diff --git a/Source/objects.h b/Source/objects.h index 253ec10c5..74f36fd35 100644 --- a/Source/objects.h +++ b/Source/objects.h @@ -121,6 +121,15 @@ struct ObjectStruct { SetMapRange(mapRange); _oVar8 = leverID; } + + /** + * @brief Check if this object is a door + * @return True if the object is one of the door types (see _object_id) + */ + bool IsDoor() const + { + return IsAnyOf(_otype, _object_id::OBJ_L1LDOOR, _object_id::OBJ_L1RDOOR, _object_id::OBJ_L2LDOOR, _object_id::OBJ_L2RDOOR, _object_id::OBJ_L3LDOOR, _object_id::OBJ_L3RDOOR); + } }; extern ObjectStruct Objects[MAXOBJECTS]; diff --git a/Source/path.cpp b/Source/path.cpp index 69476596a..848f34daa 100644 --- a/Source/path.cpp +++ b/Source/path.cpp @@ -78,7 +78,7 @@ bool IsTileWalkable(Point position, bool ignoreDoors) { if (dObject[position.x][position.y] != 0) { int oi = abs(dObject[position.x][position.y]) - 1; - if (ignoreDoors && IsAnyOf(Objects[oi]._otype, OBJ_L1LDOOR, OBJ_L1RDOOR, OBJ_L2LDOOR, OBJ_L2RDOOR, OBJ_L3LDOOR, OBJ_L3RDOOR)) + if (ignoreDoors && Objects[oi].IsDoor()) return true; if (Objects[oi]._oSolidFlag) return false;