1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

PlayerCheated: new netpack to apply losing / winning cheat code

This commit is contained in:
Arseniy Shestakov
2017-06-02 03:34:50 +03:00
parent 4b0f702e7e
commit bc6f65af04
4 changed files with 34 additions and 3 deletions

View File

@@ -1040,7 +1040,10 @@ void CGameHandler::handleConnection(std::set<PlayerColor> players, CConnection &
{
if(playerConn.second == &c)
{
gs->getPlayer(playerConn.first)->enteredLosingCheatCode = 1;
PlayerCheated pc;
pc.player = playerConn.first;
pc.losingCheatCode = true;
sendAndApply(&pc);
checkVictoryLossConditionsForPlayer(playerConn.first);
}
}
@@ -6210,12 +6213,18 @@ void CGameHandler::handleCheatCode(std::string & cheat, PlayerColor player, cons
else if (cheat == "vcmisilmaril")
{
///Player wins
gs->getPlayer(player)->enteredWinningCheatCode = 1;
PlayerCheated pc;
pc.player = player;
pc.winningCheatCode = true;
sendAndApply(&pc);
}
else if (cheat == "vcmimelkor")
{
///Player looses
gs->getPlayer(player)->enteredLosingCheatCode = 1;
PlayerCheated pc;
pc.player = player;
pc.losingCheatCode = true;
sendAndApply(&pc);
}
else if (cheat == "vcmieagles" || cheat == "vcmiungoliant")
{