1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-23 22:37:55 +02:00

Fix checking PlayerColor's for validness

This commit is contained in:
Ivan Savenko
2023-08-27 01:35:38 +03:00
parent 3b06abd0d7
commit ce20d913e0
25 changed files with 55 additions and 49 deletions

View File

@@ -164,10 +164,10 @@ void ApplyGhNetPackVisitor::visitTradeOnMarketplace(TradeOnMarketplace & pack)
PlayerColor player = market->tempOwner;
if(player >= PlayerColor::PLAYER_LIMIT)
if(!player.isValidPlayer())
player = gh.getTile(market->visitablePos())->visitableObjects.back()->tempOwner;
if(player >= PlayerColor::PLAYER_LIMIT)
if(!player.isValidPlayer())
gh.throwAndComplain(&pack, "No player can use this market!");
bool allyTownSkillTrade = (pack.mode == EMarketMode::RESOURCE_SKILL && gh.getPlayerRelations(player, hero->tempOwner) == PlayerRelations::ALLIES);