mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Apply suggestions from code review
Co-authored-by: Nordsoft91 <nordsoft@yahoo.com>
This commit is contained in:
@@ -90,7 +90,7 @@ private:
|
|||||||
std::shared_ptr<CLabel> labelTabTitle;
|
std::shared_ptr<CLabel> labelTabTitle;
|
||||||
std::shared_ptr<CLabel> labelMapSizes;
|
std::shared_ptr<CLabel> labelMapSizes;
|
||||||
ESelectionScreen tabType;
|
ESelectionScreen tabType;
|
||||||
Rect inputNameRect;
|
Rect inputNameRect;
|
||||||
|
|
||||||
void parseMaps(const std::unordered_set<ResourceID> & files);
|
void parseMaps(const std::unordered_set<ResourceID> & files);
|
||||||
void parseSaves(const std::unordered_set<ResourceID> & files);
|
void parseSaves(const std::unordered_set<ResourceID> & files);
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ void setThreadName(const std::string &name)
|
|||||||
#elif defined(__linux__)
|
#elif defined(__linux__)
|
||||||
prctl(PR_SET_NAME, name.c_str(), 0, 0, 0);
|
prctl(PR_SET_NAME, name.c_str(), 0, 0, 0);
|
||||||
#elif defined(VCMI_APPLE)
|
#elif defined(VCMI_APPLE)
|
||||||
pthread_setname_np(name.c_str());
|
pthread_setname_np(name.c_str());
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace
|
|||||||
template<typename Node>
|
template<typename Node>
|
||||||
Node & resolvePointer(Node & in, const std::string & pointer)
|
Node & resolvePointer(Node & in, const std::string & pointer)
|
||||||
{
|
{
|
||||||
if (pointer.empty())
|
if(pointer.empty())
|
||||||
return in;
|
return in;
|
||||||
assert(pointer[0] == '/');
|
assert(pointer[0] == '/');
|
||||||
|
|
||||||
@@ -36,12 +36,12 @@ Node & resolvePointer(Node & in, const std::string & pointer)
|
|||||||
std::string entry = pointer.substr(1, splitPos - 1);
|
std::string entry = pointer.substr(1, splitPos - 1);
|
||||||
std::string remainer = splitPos == std::string::npos ? "" : pointer.substr(splitPos);
|
std::string remainer = splitPos == std::string::npos ? "" : pointer.substr(splitPos);
|
||||||
|
|
||||||
if (in.getType() == VCMI_LIB_WRAP_NAMESPACE(JsonNode)::JsonType::DATA_VECTOR)
|
if(in.getType() == VCMI_LIB_WRAP_NAMESPACE(JsonNode)::JsonType::DATA_VECTOR)
|
||||||
{
|
{
|
||||||
if (entry.find_first_not_of("0123456789") != std::string::npos) // non-numbers in string
|
if(entry.find_first_not_of("0123456789") != std::string::npos) // non-numbers in string
|
||||||
throw std::runtime_error("Invalid Json pointer");
|
throw std::runtime_error("Invalid Json pointer");
|
||||||
|
|
||||||
if (entry.size() > 1 && entry[0] == '0') // leading zeros are not allowed
|
if(entry.size() > 1 && entry[0] == '0') // leading zeros are not allowed
|
||||||
throw std::runtime_error("Invalid Json pointer");
|
throw std::runtime_error("Invalid Json pointer");
|
||||||
|
|
||||||
size_t index = boost::lexical_cast<size_t>(entry);
|
size_t index = boost::lexical_cast<size_t>(entry);
|
||||||
|
|||||||
@@ -177,8 +177,5 @@ struct DLL_LINKAGE LobbyInfo : public LobbyState
|
|||||||
TeamID getPlayerTeamId(PlayerColor color);
|
TeamID getPlayerTeamId(PlayerColor color);
|
||||||
};
|
};
|
||||||
|
|
||||||
class ExceptionMapMissing : public std::exception {};
|
|
||||||
class ExceptionNoHuman : public std::exception {};
|
|
||||||
class ExceptionNoTemplate : public std::exception {};
|
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_END
|
VCMI_LIB_NAMESPACE_END
|
||||||
|
|||||||
@@ -927,7 +927,7 @@ int main(int argc, char * argv[])
|
|||||||
logConfig.configureDefault();
|
logConfig.configureDefault();
|
||||||
logGlobal->info(SERVER_NAME);
|
logGlobal->info(SERVER_NAME);
|
||||||
|
|
||||||
boost::program_options::variables_map opts;
|
boost::program_options::variables_map opts;
|
||||||
handleCommandOptions(argc, argv, opts);
|
handleCommandOptions(argc, argv, opts);
|
||||||
preinitDLL(console);
|
preinitDLL(console);
|
||||||
settings.init();
|
settings.init();
|
||||||
|
|||||||
Reference in New Issue
Block a user