diff options
| author | megamage <none@none.none> | 2011-10-07 17:36:23 -0400 |
|---|---|---|
| committer | megamage <none@none.none> | 2011-10-07 17:36:23 -0400 |
| commit | eb8cbae0d5d2e43585300271db86c4bd0bacd58a (patch) | |
| tree | d63028a4cdfedcd3c7f7bc26039beb3ec2fd3192 /src/server/game/Entities | |
| parent | 381cf2f9d3a8bfddea02574987ff64e26d1889d4 (diff) | |
Fix the relocation of creatures across cells. Try to fix #3054.
Diffstat (limited to 'src/server/game/Entities')
| -rwxr-xr-x | src/server/game/Entities/Creature/Creature.cpp | 3 | ||||
| -rwxr-xr-x | src/server/game/Entities/Creature/Creature.h | 36 |
2 files changed, 32 insertions, 7 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index d92f591803e..9996acbfe9e 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -143,7 +143,8 @@ m_PlayerDamageReq(0), m_lootMoney(0), m_lootRecipient(0), m_lootRecipientGroup(0 m_respawnDelay(300), m_corpseDelay(60), m_respawnradius(0.0f), m_reactState(REACT_AGGRESSIVE), m_defaultMovementType(IDLE_MOTION_TYPE), m_DBTableGuid(0), m_equipmentId(0), m_AlreadyCallAssistance(false), m_AlreadySearchedAssistance(false), m_regenHealth(true), m_AI_locked(false), m_meleeDamageSchoolMask(SPELL_SCHOOL_MASK_NORMAL), -m_creatureInfo(NULL), m_creatureData(NULL), m_formation(NULL) +m_creatureInfo(NULL), m_creatureData(NULL), m_formation(NULL), +MapCreature() { m_regenTimer = CREATURE_REGEN_INTERVAL; m_valuesCount = UNIT_END; diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 3d5b86a106a..6bca501f76b 100755 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -407,7 +407,36 @@ typedef std::map<uint32, time_t> CreatureSpellCooldowns; #define MAX_VENDOR_ITEMS 150 // Limitation in 3.x.x item count in SMSG_LIST_INVENTORY -class Creature : public Unit, public GridObject<Creature> +enum CreatureCellMoveState +{ + CREATURE_CELL_MOVE_NONE, //not in move list + CREATURE_CELL_MOVE_ACTIVE, //in move list + CREATURE_CELL_MOVE_INACTIVE, //in move list but should not move +}; + +class MapCreature +{ + friend class Map; //map for moving creatures + friend class ObjectGridLoader; //grid loader for loading creatures + +public: + MapCreature() : _moveState(CREATURE_CELL_MOVE_NONE) {} + +private: + Cell _currentCell; + Cell const& GetCurrentCell() const { return _currentCell; } + void SetCurrentCell(Cell const& cell) { _currentCell = cell; } + + CreatureCellMoveState _moveState; + Position _newPosition; + void SetNewCellPosition(float x, float y, float z, float o) + { + _moveState = CREATURE_CELL_MOVE_ACTIVE; + _newPosition.Relocate(x, y, z, o); + } +}; + +class Creature : public Unit, public GridObject<Creature>, public MapCreature { public: @@ -598,10 +627,6 @@ class Creature : public Unit, public GridObject<Creature> MovementGeneratorType GetDefaultMovementType() const { return m_defaultMovementType; } void SetDefaultMovementType(MovementGeneratorType mgt) { m_defaultMovementType = mgt; } - // for use only in LoadHelper, Map::Add Map::CreatureCellRelocation - Cell const& GetCurrentCell() const { return m_currentCell; } - void SetCurrentCell(Cell const& cell) { m_currentCell = cell; } - void RemoveCorpse(bool setSpawnTime = true); void ForcedDespawn(uint32 timeMSToDespawn = 0); @@ -703,7 +728,6 @@ class Creature : public Unit, public GridObject<Creature> void RegenerateHealth(); void Regenerate(Powers power); MovementGeneratorType m_defaultMovementType; - Cell m_currentCell; // store current cell where creature listed uint32 m_DBTableGuid; ///< For new or temporary creatures is 0 for saved it is lowguid uint32 m_equipmentId; |
