1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-12-22 00:27:58 +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

@@ -22,19 +22,19 @@ VCMI_LIB_NAMESPACE_BEGIN
MapInfoCallback::~MapInfoCallback() = default;
const CGObjectInstance * MapInfoCallback::getObj(ObjectInstanceID objid, bool verbose) const
const CGObjectInstance * MapInfoCallback::getObj(const ObjectInstanceID objId, const bool verbose) const
{
if(!objid.hasValue())
if(!objId.hasValue())
{
if(verbose)
logGlobal->error("Cannot get object with id %d. No such object", objid.getNum());
logGlobal->error("Cannot get object with id %d. No such object", objId.getNum());
return nullptr;
}
const CGObjectInstance * ret = getMapConstPtr()->getObject(objid);
const CGObjectInstance * ret = getMapConstPtr()->getObject(objId);
if(!ret && verbose)
{
logGlobal->error("Cannot get object with id %d. Object was removed", objid.getNum());
logGlobal->error("Cannot get object with id %d. Object was removed", objId.getNum());
return nullptr;
}