aboutsummaryrefslogtreecommitdiff
path: root/src/game/GridNotifiers.h
diff options
context:
space:
mode:
authorsilver1ce <none@none>2010-02-27 15:25:14 +0200
committersilver1ce <none@none>2010-02-27 15:25:14 +0200
commitfcaa318fb36aca077ca9ba5bfe2707ae0fcbd377 (patch)
tree81007144350a78785d58a9797aac0385edb25589 /src/game/GridNotifiers.h
parent1815d19b85c8b6685850e761a49e1c0d2d7f366b (diff)
Update visibility system
*visibility updates and ai relocations processed simultaneously for each grid *these operations now are not synchronized for different grids *some changes into structure of visibility notifiers --HG-- branch : trunk
Diffstat (limited to 'src/game/GridNotifiers.h')
-rw-r--r--src/game/GridNotifiers.h83
1 files changed, 27 insertions, 56 deletions
diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h
index 9031794a6ac..c6c4ee30a87 100644
--- a/src/game/GridNotifiers.h
+++ b/src/game/GridNotifiers.h
@@ -40,41 +40,34 @@ namespace Trinity
{
struct VisibleNotifier
{
- bool force;
Player &i_player;
UpdateData i_data;
std::set<Unit*> i_visibleNow;
Player::ClientGUIDs vis_guids;
- explicit VisibleNotifier(Player &player, bool forced) :
- i_player(player), vis_guids(player.m_clientGUIDs), force(forced) {}
- explicit VisibleNotifier(Player &player) :
- i_player(player), vis_guids(player.m_clientGUIDs),
- force(player.isNeedNotify(NOTIFY_VISIBILITY_CHANGED)) {}
+ VisibleNotifier(Player &player) : i_player(player), vis_guids(player.m_clientGUIDs) {}
template<class T> void Visit(GridRefManager<T> &m);
- void Visit(CreatureMapType &m);
- void Visit(PlayerMapType &m) {}
void SendToSelf(void);
};
- struct Player2PlayerNotifier : public VisibleNotifier
+ struct VisibleChangesNotifier
{
- Player2PlayerNotifier(Player &player, bool forced = false) :
- VisibleNotifier(player, forced) {}
+ WorldObject &i_object;
+ explicit VisibleChangesNotifier(WorldObject &object) : i_object(object) {}
template<class T> void Visit(GridRefManager<T> &) {}
void Visit(PlayerMapType &);
- void SendToSelf(void);
+ void Visit(CreatureMapType &);
+ void Visit(DynamicObjectMapType &);
};
- struct PlayerRelocationNotifier
+ struct PlayerRelocationNotifier : public VisibleNotifier
{
- Player &i_player;
- PlayerRelocationNotifier(Player &pl) : i_player(pl) {}
- template<class T> void Visit(GridRefManager<T> &) {}
- #ifdef WIN32
- template<> inline void Visit(CreatureMapType &);
- #endif
+ PlayerRelocationNotifier(Player &pl) : VisibleNotifier(pl) {}
+
+ template<class T> void Visit(GridRefManager<T> &m) { VisibleNotifier::Visit(m); }
+ void Visit(CreatureMapType &);
+ void Visit(PlayerMapType &);
};
struct CreatureRelocationNotifier
@@ -82,47 +75,31 @@ namespace Trinity
Creature &i_creature;
CreatureRelocationNotifier(Creature &c) : i_creature(c) {}
template<class T> void Visit(GridRefManager<T> &) {}
- #ifdef WIN32
- template<> inline void Visit(PlayerMapType &);
- template<> inline void Visit(CreatureMapType &);
- #endif
- };
-
- struct VisibleChangesNotifier
- {
- WorldObject &i_object;
-
- explicit VisibleChangesNotifier(WorldObject &object) : i_object(object) {}
- template<class T> void Visit(GridRefManager<T> &) {}
- void Visit(PlayerMapType &);
void Visit(CreatureMapType &);
- void Visit(DynamicObjectMapType &);
+ void Visit(PlayerMapType &);
};
struct DelayedUnitRelocation
{
Map &i_map;
- const Cell& i_cell;
- const CellPair& i_cellPair;
+ Cell &cell;
+ CellPair &p;
const float i_radius;
- DelayedUnitRelocation(const Cell& cell, const CellPair& cellp, Map &map, float radius) :
- i_cell(cell), i_cellPair(cellp), i_map(map), i_radius(radius) {}
+ DelayedUnitRelocation(Cell &c, CellPair &pair, Map &map, float radius) :
+ cell(c), p(pair), i_map(map), i_radius(radius) {}
template<class T> void Visit(GridRefManager<T> &) {}
- void Visit(CreatureMapType &m) { Notify<Creature,CreatureRelocationNotifier >(m); }
- void Visit(PlayerMapType &m) { Notify<Player,PlayerRelocationNotifier >(m); }
- template<class T, class VISITOR>
- void Notify(GridRefManager<T> &);
+ void Visit(CreatureMapType &);
+ void Visit(PlayerMapType &);
};
- struct ResetNotifier
- {
- uint16 reset_mask;
- ResetNotifier(uint16 notifies) : reset_mask(notifies) {}
- template<class T> void Visit(GridRefManager<T> &m) { /*resetNotify(m);*/}
- template<class T> void resetNotify(GridRefManager<T> &);
- void Visit(CreatureMapType &m) { resetNotify<Creature>(m);}
- void Visit(PlayerMapType &m) { resetNotify<Player>(m);}
- };
+ struct AIRelocationNotifier
+ {
+ Unit &i_unit;
+ bool isCreature;
+ explicit AIRelocationNotifier(Unit &unit) : i_unit(unit), isCreature(unit.GetTypeId() == TYPEID_UNIT) {}
+ template<class T> void Visit(GridRefManager<T> &) {}
+ void Visit(CreatureMapType &);
+ };
struct GridUpdater
{
@@ -1225,11 +1202,5 @@ namespace Trinity
std::vector<WorldPacketList> i_data_cache;
// 0 = default, i => i-1 locale index
};
-
- #ifndef WIN32
- template<> inline void PlayerRelocationNotifier::Visit<Creature>(CreatureMapType &);
- template<> inline void CreatureRelocationNotifier::Visit<Player>(PlayerMapType &);
- template<> inline void CreatureRelocationNotifier::Visit<Creature>(CreatureMapType &);
- #endif
}
#endif