--HG--
branch : trunk
This commit is contained in:
megamage
2008-12-27 11:31:14 -06:00
10 changed files with 164 additions and 35 deletions
+8 -2
View File
@@ -653,7 +653,7 @@ bool Map::loaded(const GridPair &p) const
}
}*/
void Map::Update(const uint32 &t_diff)
void Map::RelocationNotify()
{
//creatures may be added to the list during update
i_lock = true;
@@ -666,6 +666,7 @@ void Map::Update(const uint32 &t_diff)
continue;
CellPair val = Trinity::ComputeCellPair(unit->GetPositionX(), unit->GetPositionY());
Cell cell(val);
cell.SetNoCreate();
//if(unit->GetTypeId() == TYPEID_PLAYER)
// PlayerRelocationNotify((Player*)unit, cell, val);
//else
@@ -693,7 +694,10 @@ void Map::Update(const uint32 &t_diff)
}
i_unitsToNotify.clear();
i_lock = false;
}
void Map::Update(const uint32 &t_diff)
{
resetMarkedCells();
//TODO: is there a better way to update activeobjects?
@@ -743,7 +747,7 @@ void Map::Update(const uint32 &t_diff)
CellPair pair(x,y);
Cell cell(pair);
cell.data.Part.reserved = CENTER_DISTRICT;
cell.SetNoCreate();
//cell.SetNoCreate();
CellLock<NullGuard> cell_lock(cell, pair);
cell_lock->Visit(cell_lock, grid_object_update, *this);
cell_lock->Visit(cell_lock, world_object_update, *this);
@@ -754,6 +758,8 @@ void Map::Update(const uint32 &t_diff)
// UpdateActiveCells((*iter)->GetPositionX(), (*iter)->GetPositionY(), t_diff);
}
RelocationNotify();
// Don't unload grids if it's battleground, since we may have manually added GOs,creatures, those doesn't load from DB at grid re-load !
// This isn't really bother us, since as soon as we have instanced BG-s, the whole map unloads as the BG gets ended
if (IsBattleGroundOrArena())
+1
View File
@@ -259,6 +259,7 @@ class TRINITY_DLL_SPEC Map : public GridRefManager<NGridType>, public Trinity::O
void AddActiveObject(WorldObject* obj) { i_activeObjects.insert(obj); }
void RemoveActiveObject(WorldObject* obj) { i_activeObjects.erase(obj); }
void AddUnitToNotify(Unit* unit);
void RelocationNotify();
void SendToPlayers(WorldPacket const* data) const;
+2 -4
View File
@@ -1190,10 +1190,6 @@ void Aura::TriggerSpell()
uint64 originalCasterGUID = GetCasterGUID();
SpellEntry const *triggeredSpellInfo = sSpellStore.LookupEntry(trigger_spell_id);
SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(triggeredSpellInfo->rangeIndex);
if(!GetSpellMaxRange(srange))
target = caster; //for druid dispel poison
SpellEntry const *auraSpellInfo = GetSpellProto();
uint32 auraId = auraSpellInfo->Id;
@@ -1881,6 +1877,8 @@ void Aura::TriggerSpell()
}
}
}
if(!GetSpellMaxRange(sSpellRangeStore.LookupEntry(triggeredSpellInfo->rangeIndex)))
target = m_target; //for druid dispel poison
m_target->CastSpell(target, triggeredSpellInfo, true, 0, this, originalCasterGUID);
}
+18 -18
View File
@@ -31,24 +31,6 @@ template<class T>
void
WaypointMovementGenerator<T>::Initialize(T &u){}
template<>
void
WaypointMovementGenerator<Creature>::Initialize(Creature &u)
{
u.StopMoving();
if(!path_id)
path_id = u.GetWaypointPath();
waypoints = WaypointMgr.GetPath(path_id);
if(waypoints && waypoints->size())
{
Traveller<Creature> traveller(u);
node = *(waypoints->at(i_currentNode));
InitTraveller(u,node);
i_destinationHolder.SetDestination(traveller, node.x, node.y, node.z);
i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime());
}
}
template<>
void
WaypointMovementGenerator<Creature>::Finalize(Creature &u){}
@@ -108,6 +90,24 @@ void WaypointMovementGenerator<Creature>::InitTraveller(Creature &unit, const Wa
unit.addUnitState(UNIT_STAT_ROAMING);
}
template<>
void
WaypointMovementGenerator<Creature>::Initialize(Creature &u)
{
u.StopMoving();
if(!path_id)
path_id = u.GetWaypointPath();
waypoints = WaypointMgr.GetPath(path_id);
if(waypoints && waypoints->size())
{
Traveller<Creature> traveller(u);
node = *(waypoints->at(i_currentNode));
InitTraveller(u,node);
i_destinationHolder.SetDestination(traveller, node.x, node.y, node.z);
i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime());
}
}
template<>
void WaypointMovementGenerator<Player>::InitTraveller(Player &unit, const WaypointData &node){}