diff options
| author | Shauren <shauren.trinity@gmail.com> | 2013-10-16 18:37:29 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2013-10-16 18:37:29 +0200 |
| commit | ce55647c415b710c6b440d96c2f26ebbc06c1d6e (patch) | |
| tree | 515af245894c37aa76c590b6e602eb4e398d68be /src/server/game/Entities/Creature | |
| parent | 53cc37bceca9ce7de1b9839251ccc809ebf768b6 (diff) | |
Core/Transports
* Rewritten path generation, now uses splines - timers are a lot more accurate now
* Implemented stopping transports
* Implemented spawning transports in instances
* Implemented spawning gameobjects as transport passengers
* Transport passengers are now stored in creature/gameobject table using gameobject_template.data6 from transport's template as map id
Diffstat (limited to 'src/server/game/Entities/Creature')
| -rw-r--r-- | src/server/game/Entities/Creature/Creature.cpp | 26 | ||||
| -rw-r--r-- | src/server/game/Entities/Creature/Creature.h | 31 |
2 files changed, 20 insertions, 37 deletions
diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 4efd78d5932..f68d87de2f4 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -52,7 +52,7 @@ #include "World.h" #include "WorldPacket.h" -// apply implementation of the singletons +#include "Transport.h" TrainerSpell const* TrainerSpellData::Find(uint32 spell_id) const { @@ -141,7 +141,7 @@ bool ForcedDespawnDelayEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/) return true; } -Creature::Creature(bool isWorldObject): Unit(isWorldObject), MapCreature(), +Creature::Creature(bool isWorldObject): Unit(isWorldObject), MapObject(), lootForPickPocketed(false), lootForBody(false), m_groupLootTimer(0), lootingGroupLowGUID(0), m_PlayerDamageReq(0), m_lootRecipient(0), m_lootRecipientGroup(0), m_corpseRemoveTime(0), m_respawnTime(0), m_respawnDelay(300), m_corpseDelay(60), m_respawnradius(0.0f), m_reactState(REACT_AGGRESSIVE), @@ -934,7 +934,8 @@ void Creature::SaveToDB() return; } - SaveToDB(GetMapId(), data->spawnMask, GetPhaseMask()); + uint32 mapId = GetTransport() ? GetTransport()->GetGOInfo()->moTransport.mapID : GetMapId(); + SaveToDB(mapId, data->spawnMask, GetPhaseMask()); } void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) @@ -973,10 +974,21 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask) data.phaseMask = phaseMask; data.displayid = displayId; data.equipmentId = GetCurrentEquipmentId(); - data.posX = GetPositionX(); - data.posY = GetPositionY(); - data.posZ = GetPositionZMinusOffset(); - data.orientation = GetOrientation(); + if (!GetTransport()) + { + data.posX = GetPositionX(); + data.posY = GetPositionY(); + data.posZ = GetPositionZMinusOffset(); + data.orientation = GetOrientation(); + } + else + { + data.posX = GetTransOffsetX(); + data.posY = GetTransOffsetY(); + data.posZ = GetTransOffsetZ(); + data.orientation = GetTransOffsetO(); + } + data.spawntimesecs = m_respawnDelay; // prevent add data integrity problems data.spawndist = GetDefaultMovementType() == IDLE_MOTION_TYPE ? 0.0f : m_respawnradius; diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 3a07d9c101b..a555469da63 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -415,36 +415,7 @@ typedef std::map<uint32, time_t> CreatureSpellCooldowns; #define MAX_VENDOR_ITEMS 150 // Limitation in 3.x.x item count in SMSG_LIST_INVENTORY -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 - -protected: - 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 +class Creature : public Unit, public GridObject<Creature>, public MapObject { public: |
