aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegamage <none@none>2009-03-18 15:31:44 -0600
committermegamage <none@none>2009-03-18 15:31:44 -0600
commit82777554a0a14a73e2dc9ffcda662ad89408b229 (patch)
treec5b28e3501d4256fa2257b41a001e5ad5f97d375 /src
parent838ad6d847b5058a4eb9fd1be8496bf7ed4ca601 (diff)
parentdbd69bda613faed2cc30ba95de5c07235ae73653 (diff)
*Merge with 243.
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/GridNotifiers.cpp13
-rw-r--r--src/game/GridNotifiers.h5
-rw-r--r--src/game/GridNotifiersImpl.h6
-rw-r--r--src/game/InstanceSaveMgr.cpp2
-rw-r--r--src/game/Object.cpp1
-rw-r--r--src/game/Player.cpp18
-rw-r--r--src/game/Player.h2
-rw-r--r--src/game/PointMovementGenerator.cpp16
-rw-r--r--src/game/PointMovementGenerator.h5
-rw-r--r--src/game/Spell.cpp16
10 files changed, 35 insertions, 49 deletions
diff --git a/src/game/GridNotifiers.cpp b/src/game/GridNotifiers.cpp
index 8699ca00de5..86f4be9adc6 100644
--- a/src/game/GridNotifiers.cpp
+++ b/src/game/GridNotifiers.cpp
@@ -53,7 +53,7 @@ PlayerVisibilityNotifier::Notify()
if(i_clientGUIDs.find((*itr)->GetGUID())!=i_clientGUIDs.end())
{
(*itr)->UpdateVisibilityOf(&i_player);
- i_player.UpdateVisibilityOf((*itr),i_data,i_data_updates,i_visibleNow);
+ i_player.UpdateVisibilityOf((*itr),i_data,i_visibleNow);
i_clientGUIDs.erase((*itr)->GetGUID());
}
}
@@ -71,17 +71,6 @@ PlayerVisibilityNotifier::Notify()
#endif
}
- // send update to other players (except player updates that already sent using SendUpdateToPlayer)
- for(UpdateDataMapType::iterator iter = i_data_updates.begin(); iter != i_data_updates.end(); ++iter)
- {
- if(iter->first==&i_player)
- continue;
-
- WorldPacket packet;
- iter->second.BuildPacket(&packet);
- iter->first->GetSession()->SendPacket(&packet);
- }
-
if( i_data.HasData() )
{
// send create/outofrange packet to player (except player create updates that already sent using SendUpdateToPlayer)
diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h
index b2988a43090..e0d96221d04 100644
--- a/src/game/GridNotifiers.h
+++ b/src/game/GridNotifiers.h
@@ -42,17 +42,12 @@ namespace Trinity
{
Player &i_player;
UpdateData i_data;
- UpdateDataMapType i_data_updates;
Player::ClientGUIDs i_clientGUIDs;
std::set<WorldObject*> i_visibleNow;
PlayerVisibilityNotifier(Player &player) : i_player(player),i_clientGUIDs(player.m_clientGUIDs) {}
template<class T> inline void Visit(GridRefManager<T> &);
- /*#ifdef WIN32
- template<> inline void Visit(PlayerMapType &);
- template<> inline void Visit(CreatureMapType &);
- #endif*/
void Notify(void);
};
diff --git a/src/game/GridNotifiersImpl.h b/src/game/GridNotifiersImpl.h
index 33e3563ae7e..491ff67aec5 100644
--- a/src/game/GridNotifiersImpl.h
+++ b/src/game/GridNotifiersImpl.h
@@ -71,7 +71,7 @@ Trinity::PlayerVisibilityNotifier::Visit(GridRefManager<T> &m)
{
for(typename GridRefManager<T>::iterator iter = m.begin(); iter != m.end(); ++iter)
{
- i_player.UpdateVisibilityOf(iter->getSource(),i_data,i_data_updates,i_visibleNow);
+ i_player.UpdateVisibilityOf(iter->getSource(),i_data,i_visibleNow);
i_clientGUIDs.erase(iter->getSource()->GetGUID());
}
}
@@ -87,7 +87,7 @@ Trinity::PlayerRelocationNotifier::Visit(PlayerMapType &m)
if(iter->getSource()->m_Notified) //self is also skipped in this check
continue;
- i_player.UpdateVisibilityOf(iter->getSource(),i_data,i_data_updates,i_visibleNow);
+ i_player.UpdateVisibilityOf(iter->getSource(),i_data,i_visibleNow);
iter->getSource()->UpdateVisibilityOf(&i_player);
//if (!i_player.GetSharedVisionList().empty())
@@ -112,7 +112,7 @@ Trinity::PlayerRelocationNotifier::Visit(CreatureMapType &m)
if(iter->getSource()->m_Notified)
continue;
- i_player.UpdateVisibilityOf(iter->getSource(),i_data,i_data_updates,i_visibleNow);
+ i_player.UpdateVisibilityOf(iter->getSource(),i_data,i_visibleNow);
PlayerCreatureRelocationWorker(&i_player, iter->getSource());
}
diff --git a/src/game/InstanceSaveMgr.cpp b/src/game/InstanceSaveMgr.cpp
index 24f8cc254c0..d4232a71838 100644
--- a/src/game/InstanceSaveMgr.cpp
+++ b/src/game/InstanceSaveMgr.cpp
@@ -159,7 +159,7 @@ void InstanceSave::SaveToDB()
// save instance data too
std::string data;
- Map *map = MapManager::Instance().FindMap(m_instanceid, GetMapId());
+ Map *map = MapManager::Instance().FindMap(GetMapId(),m_instanceid);
if(map)
{
assert(map->IsDungeon());
diff --git a/src/game/Object.cpp b/src/game/Object.cpp
index 4ff05307403..08615ba3679 100644
--- a/src/game/Object.cpp
+++ b/src/game/Object.cpp
@@ -215,7 +215,6 @@ void Object::SendUpdateToPlayer(Player* player)
UpdateData upd;
WorldPacket packet;
- upd.Clear();
BuildCreateUpdateBlockForPlayer(&upd, player);
upd.BuildPacket(&packet);
player->GetSession()->SendPacket(&packet);
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 934c9920da5..af78fd3b039 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -17154,7 +17154,10 @@ void Player::Uncharm()
charm->RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS);
}
- assert(!GetCharmGUID());
+ if(GetCharmGUID())
+ {
+ sLog.outError("CRASH ALARM! Player %s is not able to uncharm unit (Entry: %u, Type: %u)", GetName(), charm->GetEntry(), charm->GetTypeId());
+ }
}
void Player::BuildPlayerChat(WorldPacket *data, uint8 msgtype, const std::string& text, uint32 language) const
@@ -18781,7 +18784,7 @@ inline void UpdateVisibilityOf_helper(std::set<uint64>& s64, GameObject* target)
}
template<class T>
-void Player::UpdateVisibilityOf(T* target, UpdateData& data, UpdateDataMapType& data_updates, std::set<WorldObject*>& visibleNow)
+void Player::UpdateVisibilityOf(T* target, UpdateData& data, std::set<WorldObject*>& visibleNow)
{
if(HaveAtClient(target))
{
@@ -18801,7 +18804,6 @@ void Player::UpdateVisibilityOf(T* target, UpdateData& data, UpdateDataMapType&
if(target->isVisibleForInState(this,false))
{
visibleNow.insert(target);
- target->BuildUpdate(data_updates);
target->BuildCreateUpdateBlockForPlayer(&data, this);
UpdateVisibilityOf_helper(m_clientGUIDs,target);
@@ -18848,11 +18850,11 @@ void Player::UpdateVisibilityOf<Creature>(Creature* target, UpdateData& data, Up
}
}*/
-template void Player::UpdateVisibilityOf(Player* target, UpdateData& data, UpdateDataMapType& data_updates, std::set<WorldObject*>& visibleNow);
-template void Player::UpdateVisibilityOf(Creature* target, UpdateData& data, UpdateDataMapType& data_updates, std::set<WorldObject*>& visibleNow);
-template void Player::UpdateVisibilityOf(Corpse* target, UpdateData& data, UpdateDataMapType& data_updates, std::set<WorldObject*>& visibleNow);
-template void Player::UpdateVisibilityOf(GameObject* target, UpdateData& data, UpdateDataMapType& data_updates, std::set<WorldObject*>& visibleNow);
-template void Player::UpdateVisibilityOf(DynamicObject* target, UpdateData& data, UpdateDataMapType& data_updates, std::set<WorldObject*>& visibleNow);
+template void Player::UpdateVisibilityOf(Player* target, UpdateData& data, std::set<WorldObject*>& visibleNow);
+template void Player::UpdateVisibilityOf(Creature* target, UpdateData& data, std::set<WorldObject*>& visibleNow);
+template void Player::UpdateVisibilityOf(Corpse* target, UpdateData& data, std::set<WorldObject*>& visibleNow);
+template void Player::UpdateVisibilityOf(GameObject* target, UpdateData& data, std::set<WorldObject*>& visibleNow);
+template void Player::UpdateVisibilityOf(DynamicObject* target, UpdateData& data, std::set<WorldObject*>& visibleNow);
void Player::InitPrimaryProffesions()
{
diff --git a/src/game/Player.h b/src/game/Player.h
index e709e8c8169..58f766d677e 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -2112,7 +2112,7 @@ class TRINITY_DLL_SPEC Player : public Unit
void SendInitialVisiblePackets(Unit* target);
template<class T>
- void UpdateVisibilityOf(T* target, UpdateData& data, UpdateDataMapType& data_updates, std::set<WorldObject*>& visibleNow);
+ void UpdateVisibilityOf(T* target, UpdateData& data, std::set<WorldObject*>& visibleNow);
// Stealth detection system
uint32 m_DetectInvTimer;
diff --git a/src/game/PointMovementGenerator.cpp b/src/game/PointMovementGenerator.cpp
index 70c2c4d966e..adaaf9afbfc 100644
--- a/src/game/PointMovementGenerator.cpp
+++ b/src/game/PointMovementGenerator.cpp
@@ -56,9 +56,7 @@ bool PointMovementGenerator<T>::Update(T &unit, const uint32 &diff)
if(i_destinationHolder.HasArrived())
{
- //unit.StopMoving();
- if(!unit.hasUnitState(UNIT_STAT_CHARGING))
- MovementInform(unit);
+ arrived = true;
return false;
}
@@ -66,6 +64,15 @@ bool PointMovementGenerator<T>::Update(T &unit, const uint32 &diff)
}
template<class T>
+void PointMovementGenerator<T>:: Finalize(T &unit)
+{
+ if(unit.hasUnitState(UNIT_STAT_CHARGING))
+ unit.clearUnitState(UNIT_STAT_CHARGING);
+ else if(arrived)
+ MovementInform(unit);
+}
+
+template<class T>
void PointMovementGenerator<T>::MovementInform(T &unit)
{
}
@@ -78,7 +85,8 @@ template <> void PointMovementGenerator<Creature>::MovementInform(Creature &unit
template void PointMovementGenerator<Player>::Initialize(Player&);
template bool PointMovementGenerator<Player>::Update(Player &, const uint32 &diff);
template void PointMovementGenerator<Player>::MovementInform(Player&);
+template void PointMovementGenerator<Player>::Finalize(Player&);
template void PointMovementGenerator<Creature>::Initialize(Creature&);
template bool PointMovementGenerator<Creature>::Update(Creature&, const uint32 &diff);
-
+template void PointMovementGenerator<Creature>::Finalize(Creature&);
diff --git a/src/game/PointMovementGenerator.h b/src/game/PointMovementGenerator.h
index 49b48772ffb..6dfb1d6f8ec 100644
--- a/src/game/PointMovementGenerator.h
+++ b/src/game/PointMovementGenerator.h
@@ -32,10 +32,10 @@ class TRINITY_DLL_SPEC PointMovementGenerator
{
public:
PointMovementGenerator(uint32 _id, float _x, float _y, float _z) : id(_id),
- i_x(_x), i_y(_y), i_z(_z), i_nextMoveTime(0) {}
+ i_x(_x), i_y(_y), i_z(_z), i_nextMoveTime(0), arrived(false) {}
void Initialize(T &);
- void Finalize(T &unit){unit.clearUnitState(UNIT_STAT_CHARGING);}
+ void Finalize(T &unit);
void Reset(T &unit){unit.StopMoving();}
bool Update(T &, const uint32 &diff);
@@ -49,6 +49,7 @@ class TRINITY_DLL_SPEC PointMovementGenerator
float i_x,i_y,i_z;
uint32 id;
DestinationHolder< Traveller<T> > i_destinationHolder;
+ bool arrived;
};
#endif
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index a44086b9407..ed5980eadec 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -1327,8 +1327,8 @@ void Spell::SearchChainTarget(std::list<Unit*> &TagUnitMap, float max_range, uin
{
SearchAreaTarget(tempUnitMap, max_range, PUSH_TARGET_CENTER, SPELL_TARGETS_ALLY);
tempUnitMap.sort(ChainHealingOrder(m_caster));
- if(cur->GetHealth() == cur->GetMaxHealth() && tempUnitMap.size())
- cur = tempUnitMap.front();
+ //if(cur->GetHealth() == cur->GetMaxHealth() && tempUnitMap.size())
+ // cur = tempUnitMap.front();
}
else
SearchAreaTarget(tempUnitMap, max_range, PUSH_TARGET_CENTER, TargetType);
@@ -1970,14 +1970,10 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
break;
}
- if(unMaxTargets && TagUnitMap.size() > 1)
+ if(unMaxTargets && !EffectChainTarget && TagUnitMap.size() > 1)
{
- if(m_targets.getUnitTarget())
- {
+ if(m_spellInfo->Id == 5246) //Intimidating Shout
TagUnitMap.remove(m_targets.getUnitTarget());
- if(m_spellInfo->Id != 5246) //Intimidating Shout
- --unMaxTargets;
- }
// remove random units from the map
std::list<Unit*>::iterator itr;
@@ -1987,10 +1983,6 @@ void Spell::SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap)
advance(itr, urand(0, TagUnitMap.size() - 1));
TagUnitMap.erase(itr);
}
-
- // the player's target will always be added to the map
- if(m_targets.getUnitTarget() && m_spellInfo->Id != 5246)
- TagUnitMap.push_back(m_targets.getUnitTarget());
}
}