1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

Code refactor following C++ standard and condition fixes

This commit is contained in:
lainon
2022-11-15 03:20:55 +03:00
parent ae1d2c50e2
commit 7fdad4e0f6
27 changed files with 48 additions and 47 deletions

View File

@@ -226,7 +226,7 @@ std::vector<CIdentifierStorage::ObjectData> CIdentifierStorage::getPossibleIdent
//for map format support core mod has access to any mod
//TODO: better solution for access from map?
if(request.localScope == "core" || request.localScope == "")
if(request.localScope == "core" || request.localScope.empty())
{
allowedScopes.insert(request.remoteScope);
}
@@ -1116,13 +1116,13 @@ void CModHandler::parseIdentifier(const std::string & fullIdentifier, std::strin
else
{
type = p.second;
identifier = "";
identifier.clear();
}
}
std::string CModHandler::makeFullIdentifier(const std::string & scope, const std::string & type, const std::string & identifier)
{
if(type == "")
if(type.empty())
logGlobal->error("Full identifier (%s %s) requires type name", scope, identifier);
std::string actualScope = scope;
@@ -1137,13 +1137,13 @@ std::string CModHandler::makeFullIdentifier(const std::string & scope, const std
actualName = scopeAndName.second;
}
if(actualScope == "")
if(actualScope.empty())
{
return actualName == "" ? type : type + "." + actualName;
return actualName.empty() ? type : type + "." + actualName;
}
else
{
return actualName == "" ? actualScope+ ":" + type : actualScope + ":" + type + "." + actualName;
return actualName.empty() ? actualScope+ ":" + type : actualScope + ":" + type + "." + actualName;
}
}