aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegamage <none@none>2009-08-28 20:04:46 -0500
committermegamage <none@none>2009-08-28 20:04:46 -0500
commit594a1f8a36c5f7c5f7292348942d3753fcd8e2dd (patch)
tree808861b076d39057c3047c7b7a7c9796b8d19af3 /src
parentdc5c054ab9ff8cb09e7b5c9ee5bfb9556163a5ef (diff)
*Fix a frequent crash caused by wintergrasp. Thanks to drahy.
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/Wintergrasp.cpp43
1 files changed, 22 insertions, 21 deletions
diff --git a/src/game/Wintergrasp.cpp b/src/game/Wintergrasp.cpp
index dd9d5eb99da..ea9cd0cd83a 100644
--- a/src/game/Wintergrasp.cpp
+++ b/src/game/Wintergrasp.cpp
@@ -357,18 +357,18 @@ void OPvPWintergrasp::OnCreatureCreate(Creature *creature, bool add)
return;
TeamId team;
- if(creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE])
- team = TEAM_ALLIANCE;
- else if(creature->getFaction() == WintergraspFaction[TEAM_HORDE])
- team = TEAM_HORDE;
- else
- return;
-
- if(uint32 engLowguid = GUID_LOPART(((TempSummon*)creature)->GetSummonerGUID()))
+ if(add)
{
- if(SiegeWorkshop *workshop = GetWorkshopByEngGuid(engLowguid))
+ if(creature->getFaction() == WintergraspFaction[TEAM_ALLIANCE])
+ team = TEAM_ALLIANCE;
+ else if(creature->getFaction() == WintergraspFaction[TEAM_HORDE])
+ team = TEAM_HORDE;
+ else
+ return;
+
+ if(uint32 engLowguid = GUID_LOPART(((TempSummon*)creature)->GetSummonerGUID()))
{
- if(add)
+ if(SiegeWorkshop *workshop = GetWorkshopByEngGuid(engLowguid))
{
if(CanBuildVehicle(workshop))
{
@@ -382,17 +382,8 @@ void OPvPWintergrasp::OnCreatureCreate(Creature *creature, bool add)
return;
}
}
- // TODO: now you have to wait until the corpse of vehicle disappear to build a new one
- else
- {
- m_vehicles[team].erase(creature);
- //if(!workshop->m_vehicles.erase(creature))
- // sLog.outError("OPvPWintergrasp::OnCreatureCreate: a vehicle is removed but it does not have record in workshop!");
- }
}
- }
- if(add)
- {
+
if(m_tenacityStack > 0)
{
if(team == TEAM_ALLIANCE)
@@ -403,7 +394,17 @@ void OPvPWintergrasp::OnCreatureCreate(Creature *creature, bool add)
if(team == TEAM_HORDE)
creature->SetAuraStack(SPELL_TENACITY_VEHICLE, creature, -m_tenacityStack);
}
- }
+ }
+ else // the faction may be changed in uncharm
+ {
+ // TODO: now you have to wait until the corpse of vehicle disappear to build a new one
+ if(m_vehicles[TEAM_ALLIANCE].erase(creature))
+ team = TEAM_ALLIANCE;
+ else if(m_vehicles[TEAM_HORDE].erase(creature))
+ team = TEAM_HORDE;
+ else
+ return;
+ }
SendUpdateWorldState(VehNumWorldState[team], m_vehicles[team].size());
break;
}