From c49d38b855ef8e374d9f9477b23081575a185710 Mon Sep 17 00:00:00 2001 From: Laserlicht <13953785+Laserlicht@users.noreply.github.com> Date: Sat, 23 Sep 2023 21:37:40 +0200 Subject: [PATCH] cheats + grail in town --- client/CPlayerInterface.cpp | 3 +++ server/processors/PlayerMessageProcessor.cpp | 6 ++++++ 2 files changed, 9 insertions(+) diff --git a/client/CPlayerInterface.cpp b/client/CPlayerInterface.cpp index 5bd29f8e4..58b8414c7 100644 --- a/client/CPlayerInterface.cpp +++ b/client/CPlayerInterface.cpp @@ -1695,6 +1695,9 @@ void CPlayerInterface::requestReturningToMainMenu(bool won) for(const CGHeroInstance * h : cb->getHeroesInfo()) if(h->hasArt(ArtifactID::GRAIL)) param.hasGrail = true; + for(const CGTownInstance * t : cb->getTownInfo()) + if(t->builtBuildings.find(BuildingID::GRAIL)) + param.hasGrail = true; param.allDefeated = true; for (PlayerColor player(0); player < PlayerColor::PLAYER_LIMIT; ++player) { diff --git a/server/processors/PlayerMessageProcessor.cpp b/server/processors/PlayerMessageProcessor.cpp index 6f5358c9c..7c5e1e21d 100644 --- a/server/processors/PlayerMessageProcessor.cpp +++ b/server/processors/PlayerMessageProcessor.cpp @@ -513,7 +513,13 @@ void PlayerMessageProcessor::executeCheatCode(const std::string & cheatName, Pla assert(callbacks.count(cheatName)); if (callbacks.count(cheatName)) + { + PlayerCheated pc; + pc.player = player; + gameHandler->sendAndApply(&pc); + callbacks.at(cheatName)(); + } } void PlayerMessageProcessor::sendSystemMessage(std::shared_ptr connection, const std::string & message)