1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

Fix translations in map editor / fix crash on game end

This commit is contained in:
nordsoft
2023-10-05 23:34:29 +02:00
parent 766f9cf19f
commit 043f54698b
4 changed files with 24 additions and 5 deletions

View File

@@ -681,8 +681,11 @@ void CServerHandler::endGameplay(bool closeConnection, bool restart)
}
}
if(c)
{
c->enterLobbyConnectionMode();
c->disableStackSendingByID();
}
//reset settings
Settings saveSession = settings.write["server"]["reconnect"];

View File

@@ -157,7 +157,7 @@ void CMapHeader::registerMapStrings()
mapLanguages.insert(translation.first);
}
if(maxStrings == 0 || mapBaseLanguages.empty())
if(maxStrings == 0 || mapLanguages.empty())
{
logGlobal->info("Map %s doesn't have any supported translation", name.toString());
return;

View File

@@ -117,7 +117,7 @@ void LoseConditions::initialize(MapController & c)
void LoseConditions::update()
{
//loss messages
controller->map()->defeatMessage = MetaString::createFromTextID(mapRegisterLocalizedString("map", *controller->map(), TextIdentifier("header", "defeatMessage"), ui->defeatMessageEdit->text().toStdString()));
bool customMessage = true;
//loss conditions
EventCondition defeatCondition(EventCondition::DAYS_WITHOUT_TOWN);
@@ -138,6 +138,7 @@ void LoseConditions::update()
controller->map()->triggeredEvents.push_back(standardDefeat);
controller->map()->defeatIconIndex = 3;
controller->map()->defeatMessage = MetaString::createFromTextID("core.lcdesc.0");
customMessage = false;
}
else
{
@@ -163,6 +164,7 @@ void LoseConditions::update()
specialDefeat.onFulfill.appendTextID("core.genrltxt.251");
specialDefeat.trigger = EventExpression(noneOf);
controller->map()->defeatMessage = MetaString::createFromTextID("core.lcdesc.1");
customMessage = false;
break;
}
@@ -177,6 +179,7 @@ void LoseConditions::update()
specialDefeat.onFulfill.appendTextID("core.genrltxt.253");
specialDefeat.trigger = EventExpression(noneOf);
controller->map()->defeatMessage = MetaString::createFromTextID("core.lcdesc.2");
customMessage = false;
break;
}
@@ -187,6 +190,7 @@ void LoseConditions::update()
specialDefeat.onFulfill.appendTextID("core.genrltxt.254");
specialDefeat.trigger = EventExpression(cond);
controller->map()->defeatMessage = MetaString::createFromTextID("core.lcdesc.3");
customMessage = false;
break;
}
@@ -215,6 +219,10 @@ void LoseConditions::update()
controller->map()->triggeredEvents.push_back(specialDefeat);
}
if(customMessage)
{
controller->map()->defeatMessage = MetaString::createFromTextID(mapRegisterLocalizedString("map", *controller->map(), TextIdentifier("header", "defeatMessage"), ui->defeatMessageEdit->text().toStdString()));
}
}
void LoseConditions::on_loseComboBox_currentIndexChanged(int index)

View File

@@ -179,7 +179,7 @@ void VictoryConditions::initialize(MapController & c)
void VictoryConditions::update()
{
//victory messages
controller->map()->victoryMessage = MetaString::createFromTextID(mapRegisterLocalizedString("map", *controller->map(), TextIdentifier("header", "victoryMessage"), ui->victoryMessageEdit->text().toStdString()));
bool customMessage = true;
//victory conditions
EventCondition victoryCondition(EventCondition::STANDARD_WIN);
@@ -199,6 +199,7 @@ void VictoryConditions::update()
controller->map()->triggeredEvents.push_back(standardVictory);
controller->map()->victoryIconIndex = 11;
controller->map()->victoryMessage = MetaString::createFromTextID("core.vcdesc.0");
customMessage = false;
}
else
{
@@ -211,6 +212,7 @@ void VictoryConditions::update()
controller->map()->victoryIconIndex = vicCondition;
controller->map()->victoryMessage = MetaString::createFromTextID("core.vcdesc." + std::to_string(vicCondition + 1));
customMessage = false;
switch(vicCondition)
{
@@ -327,9 +329,15 @@ void VictoryConditions::update()
controller->map()->victoryMessage.appendRawString(" / ");
controller->map()->victoryMessage.appendTextID("core.vcdesc.0");
controller->map()->triggeredEvents.push_back(standardVictory);
customMessage = false;
}
controller->map()->triggeredEvents.push_back(specialVictory);
}
if(customMessage)
{
controller->map()->victoryMessage = MetaString::createFromTextID(mapRegisterLocalizedString("map", *controller->map(), TextIdentifier("header", "victoryMessage"), ui->victoryMessageEdit->text().toStdString()));
}
}
VictoryConditions::~VictoryConditions()