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

Merge pull request #3012 from Nordsoft91/fixes

This commit is contained in:
Nordsoft91
2023-10-08 12:11:32 +02:00
committed by GitHub
5 changed files with 26 additions and 7 deletions

View File

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

View File

@@ -157,7 +157,7 @@ void CMapHeader::registerMapStrings()
mapLanguages.insert(translation.first); 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()); logGlobal->info("Map %s doesn't have any supported translation", name.toString());
return; return;

View File

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

View File

@@ -17,7 +17,7 @@
void Translations::cleanupRemovedItems(CMap & map) void Translations::cleanupRemovedItems(CMap & map)
{ {
std::set<std::string> existingObjects; std::set<std::string> existingObjects{"map", "header"};
for(auto object : map.objects) for(auto object : map.objects)
existingObjects.insert(object->instanceName); existingObjects.insert(object->instanceName);
@@ -28,7 +28,7 @@ void Translations::cleanupRemovedItems(CMap & map)
{ {
for(auto part : QString::fromStdString(s.first).split('.')) for(auto part : QString::fromStdString(s.first).split('.'))
{ {
if(part == "map" || existingObjects.count(part.toStdString())) if(existingObjects.count(part.toStdString()))
{ {
updateTranslations.Struct()[s.first] = s.second; updateTranslations.Struct()[s.first] = s.second;
break; break;

View File

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