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

Reduced number of accesses to CGObjectInstance::subID

This commit is contained in:
Ivan Savenko
2023-10-24 17:11:25 +03:00
parent 455d8d4738
commit 03e1169781
27 changed files with 135 additions and 97 deletions

View File

@@ -21,6 +21,8 @@ struct Component;
class JsonSerializeFormat;
class ObjectTemplate;
class CMap;
class AObjectTypeHandler;
using TObjectTypeHandler = std::shared_ptr<AObjectTypeHandler>;
class DLL_LINKAGE CGObjectInstance : public IObjectInterface
{
@@ -28,9 +30,9 @@ public:
/// Position of bottom-right corner of object on map
int3 pos;
/// Type of object, e.g. town, hero, creature.
Obj ID;
MapObjectID ID;
/// Subtype of object, depends on type
si32 subID;
MapObjectSubID subID;
/// Current owner of an object (when below PLAYER_LIMIT)
PlayerColor tempOwner;
/// Index of object in map's list of objects
@@ -45,8 +47,8 @@ public:
CGObjectInstance(); //TODO: remove constructor
~CGObjectInstance() override;
int32_t getObjGroupIndex() const override;
int32_t getObjTypeIndex() const override;
MapObjectID getObjGroupIndex() const override;
MapObjectSubID getObjTypeIndex() const override;
/// "center" tile from which the sight distance is calculated
int3 getSightCenter() const;
@@ -94,6 +96,8 @@ public:
std::optional<AudioPath> getVisitSound() const;
std::optional<AudioPath> getRemovalSound() const;
TObjectTypeHandler getObjectHandler() const;
/** VIRTUAL METHODS **/
/// Returns true if player can pass through visitable tiles of this object