mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-01 10:03:47 +00:00
feat(Core/Maps): Improve map object updater (#22392)
This commit is contained in:
@@ -405,14 +405,58 @@ class MovableMapObject
|
||||
protected:
|
||||
MovableMapObject() = default;
|
||||
|
||||
private:
|
||||
[[nodiscard]] Cell const& GetCurrentCell() const { return _currentCell; }
|
||||
|
||||
private:
|
||||
void SetCurrentCell(Cell const& cell) { _currentCell = cell; }
|
||||
|
||||
Cell _currentCell;
|
||||
MapObjectCellMoveState _moveState{MAP_OBJECT_CELL_MOVE_NONE};
|
||||
};
|
||||
|
||||
class UpdatableMapObject
|
||||
{
|
||||
friend class Map;
|
||||
|
||||
public:
|
||||
enum UpdateState : uint8
|
||||
{
|
||||
NotUpdating,
|
||||
PendingAdd,
|
||||
Updating
|
||||
};
|
||||
|
||||
protected:
|
||||
UpdatableMapObject() : _mapUpdateListOffset(0), _mapUpdateState(NotUpdating) { }
|
||||
|
||||
private:
|
||||
void SetMapUpdateListOffset(std::size_t const offset)
|
||||
{
|
||||
ASSERT(_mapUpdateState == Updating, "Attempted to set update list offset when object is not in map update list");
|
||||
_mapUpdateListOffset = offset;
|
||||
}
|
||||
|
||||
size_t GetMapUpdateListOffset() const
|
||||
{
|
||||
ASSERT(_mapUpdateState == Updating, "Attempted to get update list offset when object is not in map update list");
|
||||
return _mapUpdateListOffset;
|
||||
}
|
||||
|
||||
void SetUpdateState(UpdateState state)
|
||||
{
|
||||
_mapUpdateState = state;
|
||||
}
|
||||
|
||||
UpdateState GetUpdateState() const
|
||||
{
|
||||
return _mapUpdateState;
|
||||
}
|
||||
|
||||
private:
|
||||
std::size_t _mapUpdateListOffset;
|
||||
UpdateState _mapUpdateState;
|
||||
};
|
||||
|
||||
class WorldObject : public Object, public WorldLocation
|
||||
{
|
||||
protected:
|
||||
@@ -639,6 +683,9 @@ public:
|
||||
[[nodiscard]] GuidUnorderedSet const& GetAllowedLooters() const;
|
||||
void RemoveAllowedLooter(ObjectGuid guid);
|
||||
|
||||
virtual bool IsUpdateNeeded();
|
||||
bool CanBeAddedToMapUpdateList();
|
||||
|
||||
std::string GetDebugInfo() const override;
|
||||
|
||||
// Event handler
|
||||
|
||||
Reference in New Issue
Block a user