mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
Code refactor following C++ standard and condition fixes
This commit is contained in:
parent
ae1d2c50e2
commit
7fdad4e0f6
@ -334,7 +334,7 @@ BuildingInfo::BuildingInfo()
|
|||||||
buildCost = 0;
|
buildCost = 0;
|
||||||
buildCostWithPrerequisits = 0;
|
buildCostWithPrerequisits = 0;
|
||||||
prerequisitesCount = 0;
|
prerequisitesCount = 0;
|
||||||
name = "";
|
name.clear();
|
||||||
armyStrength = 0;
|
armyStrength = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -381,7 +381,7 @@ void CVideoPlayer::update( int x, int y, SDL_Surface *dst, bool forceRedraw, boo
|
|||||||
|
|
||||||
void CVideoPlayer::close()
|
void CVideoPlayer::close()
|
||||||
{
|
{
|
||||||
fname = "";
|
fname.clear();
|
||||||
if (sws)
|
if (sws)
|
||||||
{
|
{
|
||||||
sws_freeContext(sws);
|
sws_freeContext(sws);
|
||||||
|
@ -1158,7 +1158,7 @@ void CInGameConsole::endEnteringText(bool printEnteredText)
|
|||||||
previouslyEntered.push_back(txt);
|
previouslyEntered.push_back(txt);
|
||||||
//print(txt);
|
//print(txt);
|
||||||
}
|
}
|
||||||
enteredText = "";
|
enteredText.clear();
|
||||||
if(GH.topInt() == adventureInt)
|
if(GH.topInt() == adventureInt)
|
||||||
{
|
{
|
||||||
GH.statusbar->alignment = CENTER;
|
GH.statusbar->alignment = CENTER;
|
||||||
|
@ -367,7 +367,7 @@ void CHeroArtPlace::setArtifact(const CArtifactInstance *art)
|
|||||||
if(!art)
|
if(!art)
|
||||||
{
|
{
|
||||||
image->disable();
|
image->disable();
|
||||||
text = std::string();
|
text.clear();
|
||||||
hoverText = CGI->generaltexth->allTexts[507];
|
hoverText = CGI->generaltexth->allTexts[507];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1034,7 +1034,7 @@ void CCommanderArtPlace::setArtifact(const CArtifactInstance * art)
|
|||||||
if (!art)
|
if (!art)
|
||||||
{
|
{
|
||||||
image->disable();
|
image->disable();
|
||||||
text = std::string();
|
text.clear();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -577,7 +577,7 @@ void CTextInput::textInputed(const SDL_TextInputEvent & event)
|
|||||||
redraw();
|
redraw();
|
||||||
cb(text);
|
cb(text);
|
||||||
}
|
}
|
||||||
newText = "";
|
newText.clear();
|
||||||
|
|
||||||
#ifdef VCMI_ANDROID
|
#ifdef VCMI_ANDROID
|
||||||
notifyAndroidTextInputChanged(text);
|
notifyAndroidTextInputChanged(text);
|
||||||
|
@ -573,7 +573,7 @@ CAdvMapInt::CAdvMapInt():
|
|||||||
strongInterest = true; // handle all mouse move events to prevent dead mouse move space in fullscreen mode
|
strongInterest = true; // handle all mouse move events to prevent dead mouse move space in fullscreen mode
|
||||||
townList.onSelect = std::bind(&CAdvMapInt::selectionChanged,this);
|
townList.onSelect = std::bind(&CAdvMapInt::selectionChanged,this);
|
||||||
bg = BitmapHandler::loadBitmap(ADVOPT.mainGraphic);
|
bg = BitmapHandler::loadBitmap(ADVOPT.mainGraphic);
|
||||||
if (ADVOPT.worldViewGraphic != "")
|
if(!ADVOPT.worldViewGraphic.empty())
|
||||||
{
|
{
|
||||||
bgWorldView = BitmapHandler::loadBitmap(ADVOPT.worldViewGraphic);
|
bgWorldView = BitmapHandler::loadBitmap(ADVOPT.worldViewGraphic);
|
||||||
}
|
}
|
||||||
|
@ -593,7 +593,7 @@ void CSpellWindow::SpellArea::clickRight(tribool down, bool previousState)
|
|||||||
std::string dmgInfo;
|
std::string dmgInfo;
|
||||||
auto causedDmg = owner->myInt->cb->estimateSpellDamage(mySpell, owner->myHero);
|
auto causedDmg = owner->myInt->cb->estimateSpellDamage(mySpell, owner->myHero);
|
||||||
if(causedDmg == 0 || mySpell->id == SpellID::TITANS_LIGHTNING_BOLT) //Titan's Lightning Bolt already has damage info included
|
if(causedDmg == 0 || mySpell->id == SpellID::TITANS_LIGHTNING_BOLT) //Titan's Lightning Bolt already has damage info included
|
||||||
dmgInfo = "";
|
dmgInfo.clear();
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dmgInfo = CGI->generaltexth->allTexts[343];
|
dmgInfo = CGI->generaltexth->allTexts[343];
|
||||||
|
@ -192,7 +192,7 @@ void CTradeWindow::CTradeableItem::clickLeft(tribool down, bool previousState)
|
|||||||
|
|
||||||
aw->arts->artifactsOnAltar.erase(art);
|
aw->arts->artifactsOnAltar.erase(art);
|
||||||
setID(-1);
|
setID(-1);
|
||||||
subtitle = "";
|
subtitle.clear();
|
||||||
aw->deal->block(!aw->arts->artifactsOnAltar.size());
|
aw->deal->block(!aw->arts->artifactsOnAltar.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,7 +352,7 @@ CArtifact * CArtHandler::loadFromJson(const std::string & scope, const JsonNode
|
|||||||
}
|
}
|
||||||
|
|
||||||
const JsonNode & warMachine = node["warMachine"];
|
const JsonNode & warMachine = node["warMachine"];
|
||||||
if(warMachine.getType() == JsonNode::JsonType::DATA_STRING && warMachine.String() != "")
|
if(warMachine.getType() == JsonNode::JsonType::DATA_STRING && !warMachine.String().empty())
|
||||||
{
|
{
|
||||||
VLC->modh->identifiers.requestIdentifier("creature", warMachine, [=](si32 id)
|
VLC->modh->identifiers.requestIdentifier("creature", warMachine, [=](si32 id)
|
||||||
{
|
{
|
||||||
|
@ -94,7 +94,9 @@ std::string MacroString::build(const GetValue & getValue) const
|
|||||||
CBonusType::CBonusType()
|
CBonusType::CBonusType()
|
||||||
{
|
{
|
||||||
hidden = true;
|
hidden = true;
|
||||||
icon = nameTemplate = descriptionTemplate = "";
|
icon.clear();
|
||||||
|
nameTemplate.clear();
|
||||||
|
descriptionTemplate.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
CBonusType::~CBonusType()
|
CBonusType::~CBonusType()
|
||||||
|
@ -1052,7 +1052,7 @@ void CStackBasicDescriptor::serializeJson(JsonSerializeFormat & handler)
|
|||||||
{
|
{
|
||||||
std::string typeName("");
|
std::string typeName("");
|
||||||
handler.serializeString("type", typeName);
|
handler.serializeString("type", typeName);
|
||||||
if(typeName != "")
|
if(!typeName.empty())
|
||||||
setType(VLC->creh->getCreature("core", typeName));
|
setType(VLC->creh->getCreature("core", typeName));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -532,7 +532,7 @@ std::pair<Obj,int> CGameState::pickObject (CGObjectInstance *obj)
|
|||||||
if (auto info = dynamic_cast<CCreGenAsCastleInfo*>(dwl->info))
|
if (auto info = dynamic_cast<CCreGenAsCastleInfo*>(dwl->info))
|
||||||
{
|
{
|
||||||
faction = getRandomGenerator().nextInt((int)VLC->townh->size() - 1);
|
faction = getRandomGenerator().nextInt((int)VLC->townh->size() - 1);
|
||||||
if(info->asCastle && info->instanceId != "")
|
if(info->asCastle && !info->instanceId.empty())
|
||||||
{
|
{
|
||||||
auto iter = map->instanceNames.find(info->instanceId);
|
auto iter = map->instanceNames.find(info->instanceId);
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@ std::vector<CIdentifierStorage::ObjectData> CIdentifierStorage::getPossibleIdent
|
|||||||
|
|
||||||
//for map format support core mod has access to any mod
|
//for map format support core mod has access to any mod
|
||||||
//TODO: better solution for access from map?
|
//TODO: better solution for access from map?
|
||||||
if(request.localScope == "core" || request.localScope == "")
|
if(request.localScope == "core" || request.localScope.empty())
|
||||||
{
|
{
|
||||||
allowedScopes.insert(request.remoteScope);
|
allowedScopes.insert(request.remoteScope);
|
||||||
}
|
}
|
||||||
@ -1116,13 +1116,13 @@ void CModHandler::parseIdentifier(const std::string & fullIdentifier, std::strin
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
type = p.second;
|
type = p.second;
|
||||||
identifier = "";
|
identifier.clear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CModHandler::makeFullIdentifier(const std::string & scope, const std::string & type, const std::string & identifier)
|
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);
|
logGlobal->error("Full identifier (%s %s) requires type name", scope, identifier);
|
||||||
|
|
||||||
std::string actualScope = scope;
|
std::string actualScope = scope;
|
||||||
@ -1137,13 +1137,13 @@ std::string CModHandler::makeFullIdentifier(const std::string & scope, const std
|
|||||||
actualName = scopeAndName.second;
|
actualName = scopeAndName.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(actualScope == "")
|
if(actualScope.empty())
|
||||||
{
|
{
|
||||||
return actualName == "" ? type : type + "." + actualName;
|
return actualName.empty() ? type : type + "." + actualName;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return actualName == "" ? actualScope+ ":" + type : actualScope + ":" + type + "." + actualName;
|
return actualName.empty() ? actualScope+ ":" + type : actualScope + ":" + type + "." + actualName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1252,7 +1252,7 @@ int CPathfinderHelper::getMovementCost(
|
|||||||
if(src.x != dst.x && src.y != dst.y) //it's diagonal move
|
if(src.x != dst.x && src.y != dst.y) //it's diagonal move
|
||||||
{
|
{
|
||||||
int old = ret;
|
int old = ret;
|
||||||
ret = static_cast < int>(ret * 1.414213);
|
ret = static_cast<int>(ret * M_SQRT2);
|
||||||
//diagonal move costs too much but normal move is possible - allow diagonal move for remaining move points
|
//diagonal move costs too much but normal move is possible - allow diagonal move for remaining move points
|
||||||
if(ret > remainingMovePoints && remainingMovePoints >= old)
|
if(ret > remainingMovePoints && remainingMovePoints >= old)
|
||||||
{
|
{
|
||||||
|
@ -822,11 +822,11 @@ void CTownHandler::loadClientData(CTown &town, const JsonNode & source)
|
|||||||
info.buildingsIcons = source["buildingsIcons"].String();
|
info.buildingsIcons = source["buildingsIcons"].String();
|
||||||
|
|
||||||
//left for back compatibility - will be removed later
|
//left for back compatibility - will be removed later
|
||||||
if (source["guildBackground"].String() != "")
|
if(!source["guildBackground"].String().empty())
|
||||||
info.guildBackground = source["guildBackground"].String();
|
info.guildBackground = source["guildBackground"].String();
|
||||||
else
|
else
|
||||||
info.guildBackground = "TPMAGE.bmp";
|
info.guildBackground = "TPMAGE.bmp";
|
||||||
if (source["tavernVideo"].String() != "")
|
if(!source["tavernVideo"].String().empty())
|
||||||
info.tavernVideo = source["tavernVideo"].String();
|
info.tavernVideo = source["tavernVideo"].String();
|
||||||
else
|
else
|
||||||
info.tavernVideo = "TAVERN.BIK";
|
info.tavernVideo = "TAVERN.BIK";
|
||||||
@ -963,7 +963,6 @@ TerrainId CTownHandler::getDefaultTerrainForAlignment(EAlignment::EAlignment ali
|
|||||||
CFaction * CTownHandler::loadFromJson(const std::string & scope, const JsonNode & source, const std::string & identifier, size_t index)
|
CFaction * CTownHandler::loadFromJson(const std::string & scope, const JsonNode & source, const std::string & identifier, size_t index)
|
||||||
{
|
{
|
||||||
auto faction = new CFaction();
|
auto faction = new CFaction();
|
||||||
faction->index = index;
|
|
||||||
|
|
||||||
faction->index = static_cast<TFaction>(index);
|
faction->index = static_cast<TFaction>(index);
|
||||||
faction->name = source["name"].String();
|
faction->name = source["name"].String();
|
||||||
|
@ -1016,7 +1016,7 @@ TConstBonusListPtr CBonusSystemNode::getAllBonuses(const CSelector &selector, co
|
|||||||
|
|
||||||
// If a bonus system request comes with a caching string then look up in the map if there are any
|
// If a bonus system request comes with a caching string then look up in the map if there are any
|
||||||
// pre-calculated bonus results. Limiters can't be cached so they have to be calculated.
|
// pre-calculated bonus results. Limiters can't be cached so they have to be calculated.
|
||||||
if (cachingStr != "")
|
if(!cachingStr.empty())
|
||||||
{
|
{
|
||||||
auto it = cachedRequests.find(cachingStr);
|
auto it = cachedRequests.find(cachingStr);
|
||||||
if(it != cachedRequests.end())
|
if(it != cachedRequests.end())
|
||||||
@ -1032,7 +1032,7 @@ TConstBonusListPtr CBonusSystemNode::getAllBonuses(const CSelector &selector, co
|
|||||||
cachedBonuses.getBonuses(*ret, selector, limit);
|
cachedBonuses.getBonuses(*ret, selector, limit);
|
||||||
|
|
||||||
// Save the results in the cache
|
// Save the results in the cache
|
||||||
if(cachingStr != "")
|
if(!cachingStr.empty())
|
||||||
cachedRequests[cachingStr] = ret;
|
cachedRequests[cachingStr] = ret;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -1708,9 +1708,9 @@ JsonNode Bonus::toJsonNode() const
|
|||||||
root["val"].Integer() = val;
|
root["val"].Integer() = val;
|
||||||
if(valType != ADDITIVE_VALUE)
|
if(valType != ADDITIVE_VALUE)
|
||||||
root["valueType"].String() = vstd::findKey(bonusValueMap, valType);
|
root["valueType"].String() = vstd::findKey(bonusValueMap, valType);
|
||||||
if(stacking != "")
|
if(!stacking.empty())
|
||||||
root["stacking"].String() = stacking;
|
root["stacking"].String() = stacking;
|
||||||
if(description != "")
|
if(!description.empty())
|
||||||
root["description"].String() = description;
|
root["description"].String() = description;
|
||||||
if(effectRange != NO_LIMIT)
|
if(effectRange != NO_LIMIT)
|
||||||
root["effectRange"].String() = vstd::findKey(bonusLimitEffect, effectRange);
|
root["effectRange"].String() = vstd::findKey(bonusLimitEffect, effectRange);
|
||||||
|
@ -55,7 +55,7 @@ static void retrieveTurretDamageRange(const CGTownInstance * town, const battle:
|
|||||||
const int baseDamage = 15;
|
const int baseDamage = 15;
|
||||||
|
|
||||||
outMinDmg = multiplier * (baseDamage + town->getTownLevel() * 3);
|
outMinDmg = multiplier * (baseDamage + town->getTownLevel() * 3);
|
||||||
outMaxDmg = multiplier * (baseDamage + town->getTownLevel() * 3);
|
outMaxDmg = outMinDmg;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BattleHex lineToWallHex(int line) //returns hex with wall in given line (y coordinate)
|
static BattleHex lineToWallHex(int line) //returns hex with wall in given line (y coordinate)
|
||||||
|
@ -46,7 +46,7 @@ void CCreGenAsCastleInfo::serializeJson(JsonSerializeFormat & handler)
|
|||||||
|
|
||||||
if(!handler.saving)
|
if(!handler.saving)
|
||||||
{
|
{
|
||||||
asCastle = (instanceId != "");
|
asCastle = !instanceId.empty();
|
||||||
allowedFactions.clear();
|
allowedFactions.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -572,7 +572,7 @@ void AObjectTypeHandler::addTemplate(JsonNode config)
|
|||||||
auto tmpl = new ObjectTemplate;
|
auto tmpl = new ObjectTemplate;
|
||||||
tmpl->id = Obj(type);
|
tmpl->id = Obj(type);
|
||||||
tmpl->subid = subtype;
|
tmpl->subid = subtype;
|
||||||
tmpl->stringID = ""; // TODO?
|
tmpl->stringID.clear(); // TODO?
|
||||||
tmpl->readJson(config);
|
tmpl->readJson(config);
|
||||||
templates.emplace_back(tmpl);
|
templates.emplace_back(tmpl);
|
||||||
}
|
}
|
||||||
|
@ -938,7 +938,7 @@ void CGSeerHut::serializeJsonOptions(JsonSerializeFormat & handler)
|
|||||||
case MANA_POINTS:
|
case MANA_POINTS:
|
||||||
case MORALE_BONUS:
|
case MORALE_BONUS:
|
||||||
case LUCK_BONUS:
|
case LUCK_BONUS:
|
||||||
identifier = "";
|
identifier.clear();
|
||||||
break;
|
break;
|
||||||
case RESOURCES:
|
case RESOURCES:
|
||||||
identifier = GameConstants::RESOURCE_NAMES[rID];
|
identifier = GameConstants::RESOURCE_NAMES[rID];
|
||||||
@ -976,7 +976,7 @@ void CGSeerHut::serializeJsonOptions(JsonSerializeFormat & handler)
|
|||||||
|
|
||||||
const JsonNode & rewardsJson = handler.getCurrent();
|
const JsonNode & rewardsJson = handler.getCurrent();
|
||||||
|
|
||||||
fullIdentifier = "";
|
fullIdentifier.clear();
|
||||||
|
|
||||||
if(rewardsJson.Struct().empty())
|
if(rewardsJson.Struct().empty())
|
||||||
return;
|
return;
|
||||||
|
@ -1802,7 +1802,7 @@ void CGScholar::serializeJsonOptions(JsonSerializeFormat & handler)
|
|||||||
//TODO: unify
|
//TODO: unify
|
||||||
const JsonNode & json = handler.getCurrent();
|
const JsonNode & json = handler.getCurrent();
|
||||||
bonusType = RANDOM;
|
bonusType = RANDOM;
|
||||||
if(json["rewardPrimSkill"].String() != "")
|
if(!json["rewardPrimSkill"].String().empty())
|
||||||
{
|
{
|
||||||
auto raw = VLC->modh->identifiers.getIdentifier("core", "primSkill", json["rewardPrimSkill"].String());
|
auto raw = VLC->modh->identifiers.getIdentifier("core", "primSkill", json["rewardPrimSkill"].String());
|
||||||
if(raw)
|
if(raw)
|
||||||
@ -1811,7 +1811,7 @@ void CGScholar::serializeJsonOptions(JsonSerializeFormat & handler)
|
|||||||
bonusID = raw.get();
|
bonusID = raw.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(json["rewardSkill"].String() != "")
|
else if(!json["rewardSkill"].String().empty())
|
||||||
{
|
{
|
||||||
auto raw = VLC->modh->identifiers.getIdentifier("core", "skill", json["rewardSkill"].String());
|
auto raw = VLC->modh->identifiers.getIdentifier("core", "skill", json["rewardSkill"].String());
|
||||||
if(raw)
|
if(raw)
|
||||||
@ -1820,7 +1820,7 @@ void CGScholar::serializeJsonOptions(JsonSerializeFormat & handler)
|
|||||||
bonusID = raw.get();
|
bonusID = raw.get();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(json["rewardSpell"].String() != "")
|
else if(!json["rewardSpell"].String().empty())
|
||||||
{
|
{
|
||||||
auto raw = VLC->modh->identifiers.getIdentifier("core", "spell", json["rewardSpell"].String());
|
auto raw = VLC->modh->identifiers.getIdentifier("core", "spell", json["rewardSpell"].String());
|
||||||
if(raw)
|
if(raw)
|
||||||
|
@ -203,7 +203,7 @@ void CMapHeader::setupEvents()
|
|||||||
standardVictory.effect.type = EventEffect::VICTORY;
|
standardVictory.effect.type = EventEffect::VICTORY;
|
||||||
standardVictory.effect.toOtherMessage = VLC->generaltexth->allTexts[5];
|
standardVictory.effect.toOtherMessage = VLC->generaltexth->allTexts[5];
|
||||||
standardVictory.identifier = "standardVictory";
|
standardVictory.identifier = "standardVictory";
|
||||||
standardVictory.description = ""; // TODO: display in quest window
|
standardVictory.description.clear(); // TODO: display in quest window
|
||||||
standardVictory.onFulfill = VLC->generaltexth->allTexts[659];
|
standardVictory.onFulfill = VLC->generaltexth->allTexts[659];
|
||||||
standardVictory.trigger = EventExpression(victoryCondition);
|
standardVictory.trigger = EventExpression(victoryCondition);
|
||||||
|
|
||||||
@ -212,7 +212,7 @@ void CMapHeader::setupEvents()
|
|||||||
standardDefeat.effect.type = EventEffect::DEFEAT;
|
standardDefeat.effect.type = EventEffect::DEFEAT;
|
||||||
standardDefeat.effect.toOtherMessage = VLC->generaltexth->allTexts[8];
|
standardDefeat.effect.toOtherMessage = VLC->generaltexth->allTexts[8];
|
||||||
standardDefeat.identifier = "standardDefeat";
|
standardDefeat.identifier = "standardDefeat";
|
||||||
standardDefeat.description = ""; // TODO: display in quest window
|
standardDefeat.description.clear(); // TODO: display in quest window
|
||||||
standardDefeat.onFulfill = VLC->generaltexth->allTexts[7];
|
standardDefeat.onFulfill = VLC->generaltexth->allTexts[7];
|
||||||
standardDefeat.trigger = EventExpression(defeatCondition);
|
standardDefeat.trigger = EventExpression(defeatCondition);
|
||||||
|
|
||||||
@ -651,7 +651,7 @@ void CMap::addNewObject(CGObjectInstance * obj)
|
|||||||
if(obj->id != ObjectInstanceID((si32)objects.size()))
|
if(obj->id != ObjectInstanceID((si32)objects.size()))
|
||||||
throw std::runtime_error("Invalid object instance id");
|
throw std::runtime_error("Invalid object instance id");
|
||||||
|
|
||||||
if(obj->instanceName == "")
|
if(obj->instanceName.empty())
|
||||||
throw std::runtime_error("Object instance name missing");
|
throw std::runtime_error("Object instance name missing");
|
||||||
|
|
||||||
if (vstd::contains(instanceNames, obj->instanceName))
|
if (vstd::contains(instanceNames, obj->instanceName))
|
||||||
|
@ -313,7 +313,7 @@ void CMapLoaderH3M::readVictoryLossConditions()
|
|||||||
standardVictory.effect.type = EventEffect::VICTORY;
|
standardVictory.effect.type = EventEffect::VICTORY;
|
||||||
standardVictory.effect.toOtherMessage = VLC->generaltexth->allTexts[5];
|
standardVictory.effect.toOtherMessage = VLC->generaltexth->allTexts[5];
|
||||||
standardVictory.identifier = "standardVictory";
|
standardVictory.identifier = "standardVictory";
|
||||||
standardVictory.description = ""; // TODO: display in quest window
|
standardVictory.description.clear(); // TODO: display in quest window
|
||||||
standardVictory.onFulfill = VLC->generaltexth->allTexts[659];
|
standardVictory.onFulfill = VLC->generaltexth->allTexts[659];
|
||||||
standardVictory.trigger = EventExpression(victoryCondition);
|
standardVictory.trigger = EventExpression(victoryCondition);
|
||||||
|
|
||||||
@ -321,7 +321,7 @@ void CMapLoaderH3M::readVictoryLossConditions()
|
|||||||
standardDefeat.effect.type = EventEffect::DEFEAT;
|
standardDefeat.effect.type = EventEffect::DEFEAT;
|
||||||
standardDefeat.effect.toOtherMessage = VLC->generaltexth->allTexts[8];
|
standardDefeat.effect.toOtherMessage = VLC->generaltexth->allTexts[8];
|
||||||
standardDefeat.identifier = "standardDefeat";
|
standardDefeat.identifier = "standardDefeat";
|
||||||
standardDefeat.description = ""; // TODO: display in quest window
|
standardDefeat.description.clear(); // TODO: display in quest window
|
||||||
standardDefeat.onFulfill = VLC->generaltexth->allTexts[7];
|
standardDefeat.onFulfill = VLC->generaltexth->allTexts[7];
|
||||||
standardDefeat.trigger = EventExpression(defeatCondition);
|
standardDefeat.trigger = EventExpression(defeatCondition);
|
||||||
|
|
||||||
@ -338,7 +338,7 @@ void CMapLoaderH3M::readVictoryLossConditions()
|
|||||||
TriggeredEvent specialVictory;
|
TriggeredEvent specialVictory;
|
||||||
specialVictory.effect.type = EventEffect::VICTORY;
|
specialVictory.effect.type = EventEffect::VICTORY;
|
||||||
specialVictory.identifier = "specialVictory";
|
specialVictory.identifier = "specialVictory";
|
||||||
specialVictory.description = ""; // TODO: display in quest window
|
specialVictory.description.clear(); // TODO: display in quest window
|
||||||
|
|
||||||
mapHeader->victoryIconIndex = ui16(vicCondition);
|
mapHeader->victoryIconIndex = ui16(vicCondition);
|
||||||
mapHeader->victoryMessage = VLC->generaltexth->victoryConditions[size_t(vicCondition) + 1];
|
mapHeader->victoryMessage = VLC->generaltexth->victoryConditions[size_t(vicCondition) + 1];
|
||||||
@ -526,7 +526,7 @@ void CMapLoaderH3M::readVictoryLossConditions()
|
|||||||
specialDefeat.effect.type = EventEffect::DEFEAT;
|
specialDefeat.effect.type = EventEffect::DEFEAT;
|
||||||
specialDefeat.effect.toOtherMessage = VLC->generaltexth->allTexts[5];
|
specialDefeat.effect.toOtherMessage = VLC->generaltexth->allTexts[5];
|
||||||
specialDefeat.identifier = "specialDefeat";
|
specialDefeat.identifier = "specialDefeat";
|
||||||
specialDefeat.description = ""; // TODO: display in quest window
|
specialDefeat.description.clear(); // TODO: display in quest window
|
||||||
|
|
||||||
mapHeader->defeatIconIndex = ui16(lossCond);
|
mapHeader->defeatIconIndex = ui16(lossCond);
|
||||||
mapHeader->defeatMessage = VLC->generaltexth->lossCondtions[size_t(lossCond) + 1];
|
mapHeader->defeatMessage = VLC->generaltexth->lossCondtions[size_t(lossCond) + 1];
|
||||||
|
@ -134,7 +134,7 @@ namespace TriggeredEventsDetail
|
|||||||
|
|
||||||
static EMetaclass decodeMetaclass(const std::string & source)
|
static EMetaclass decodeMetaclass(const std::string & source)
|
||||||
{
|
{
|
||||||
if(source == "")
|
if(source.empty())
|
||||||
return EMetaclass::INVALID;
|
return EMetaclass::INVALID;
|
||||||
auto rawId = vstd::find_pos(NMetaclass::names, source);
|
auto rawId = vstd::find_pos(NMetaclass::names, source);
|
||||||
|
|
||||||
@ -286,7 +286,7 @@ namespace TriggeredEventsDetail
|
|||||||
if(event.value > 0)
|
if(event.value > 0)
|
||||||
data["value"].Integer() = event.value;
|
data["value"].Integer() = event.value;
|
||||||
|
|
||||||
if(event.objectInstanceName != "")
|
if(!event.objectInstanceName.empty())
|
||||||
data["object"].String() = event.objectInstanceName;
|
data["object"].String() = event.objectInstanceName;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -38,7 +38,7 @@ void JsonDeserializer::serializeInternal(const std::string & fieldName, si32 & v
|
|||||||
|
|
||||||
value = defaultValue ? defaultValue.get() : 0;
|
value = defaultValue ? defaultValue.get() : 0;
|
||||||
|
|
||||||
if(identifier != "")
|
if(!identifier.empty())
|
||||||
{
|
{
|
||||||
si32 rawId = decoder(identifier);
|
si32 rawId = decoder(identifier);
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ void JsonSerializer::serializeLIC(const std::string & fieldName, LICSet & value)
|
|||||||
|
|
||||||
void JsonSerializer::serializeString(const std::string & fieldName, std::string & value)
|
void JsonSerializer::serializeString(const std::string & fieldName, std::string & value)
|
||||||
{
|
{
|
||||||
if(value != "")
|
if(!value.empty())
|
||||||
currentObject->operator[](fieldName).String() = value;
|
currentObject->operator[](fieldName).String() = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ bool ObjectBrowser::filterAcceptsRow(int source_row, const QModelIndex & source_
|
|||||||
auto factory = VLC->objtypeh->getHandlerFor(objId, objSubId);
|
auto factory = VLC->objtypeh->getHandlerFor(objId, objSubId);
|
||||||
auto templ = factory->getTemplates()[templateId];
|
auto templ = factory->getTemplates()[templateId];
|
||||||
|
|
||||||
result = result & templ->canBePlacedAt(terrain);
|
result = result && templ->canBePlacedAt(terrain);
|
||||||
|
|
||||||
//if we are here, just text filter will be applied
|
//if we are here, just text filter will be applied
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
Reference in New Issue
Block a user