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

fix: skip pass and priority pass if hero is not valid anymore to as extra checks for lost heroes

This commit is contained in:
Mircea TheHonestCTO
2025-09-04 00:56:36 +02:00
parent 7a40981a95
commit 2e49d6aca9
9 changed files with 37 additions and 30 deletions

View File

@@ -111,17 +111,16 @@ TurnTimerInfo CGameInfoCallback::getPlayerTurnTime(PlayerColor color) const
/* */
/************************************************************************/
const CGObjectInstance* CGameInfoCallback::getObj(ObjectInstanceID objid, bool verbose) const
const CGObjectInstance * CGameInfoCallback::getObj(const ObjectInstanceID objId, const bool verbose) const
{
const CGObjectInstance * ret = MapInfoCallback::getObj(objid, verbose);
const CGObjectInstance * ret = MapInfoCallback::getObj(objId, verbose);
if(!ret)
return nullptr;
if(getPlayerID().has_value() && !isVisibleFor(ret, *getPlayerID()) && ret->tempOwner != getPlayerID())
{
if(verbose)
logGlobal->error("Cannot get object with id %d. Object is not visible.", objid.getNum());
logGlobal->error("Cannot get object with id %d. Object is not visible.", objId.getNum());
return nullptr;
}