mirror of
				https://github.com/vcmi/vcmi.git
				synced 2025-10-31 00:07:39 +02:00 
			
		
		
		
	Fix translations in map editor / fix crash on game end
This commit is contained in:
		| @@ -681,8 +681,11 @@ void CServerHandler::endGameplay(bool closeConnection, bool restart) | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	c->enterLobbyConnectionMode(); | ||||
| 	c->disableStackSendingByID(); | ||||
| 	if(c) | ||||
| 	{ | ||||
| 		c->enterLobbyConnectionMode(); | ||||
| 		c->disableStackSendingByID(); | ||||
| 	} | ||||
| 	 | ||||
| 	//reset settings | ||||
| 	Settings saveSession = settings.write["server"]["reconnect"]; | ||||
|   | ||||
| @@ -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; | ||||
|   | ||||
| @@ -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) | ||||
|   | ||||
| @@ -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() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user