Core/Battlefield

* Fix compile
* Restored GO damage events after recent changes
This commit is contained in:
tobmaps
2012-08-20 13:29:52 -04:00
committed by Kandera
parent ff85ebe632
commit 23b59c5603
2 changed files with 13 additions and 11 deletions
@@ -985,13 +985,18 @@ void BattlefieldWG::AddBrokenTower(TeamId team)
}
}
void BattlefieldWG::ProcessEvent(GameObject *obj, uint32 eventId)
void BattlefieldWG::ProcessEvent(WorldObject *obj, uint32 eventId)
{
if (!obj || !IsWarTime())
return;
// We handle only gameobjects here
GameObject* go = obj->ToGameObject();
if (!go)
return;
// On click on titan relic
if (obj->GetEntry() == BATTLEFIELD_WG_GAMEOBJECT_TITAN_RELIC)
if (go->GetEntry() == BATTLEFIELD_WG_GAMEOBJECT_TITAN_RELIC)
{
// Check that the door is break
if (m_CanClickOnOrb)
@@ -1003,7 +1008,7 @@ void BattlefieldWG::ProcessEvent(GameObject *obj, uint32 eventId)
// if destroy or damage event, search the wall/tower and update worldstate/send warning message
for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr)
{
if (obj->GetEntry() == (*itr)->m_Build->GetEntry())
if (go->GetEntry() == (*itr)->m_Build->GetEntry())
{
if ((*itr)->m_Build->GetGOInfo()->building.damagedEvent == eventId)
(*itr)->Damaged();
@@ -412,7 +412,7 @@ class BattlefieldWG : public Battlefield
void PromotePlayer(Player *killer);
void UpdateTenacity();
void ProcessEvent(GameObject *obj, uint32 eventId);
void ProcessEvent(WorldObject *obj, uint32 eventId);
protected:
bool m_CanClickOnOrb;
@@ -1366,7 +1366,7 @@ struct BfWGGameObjectBuilding
}
// Rebuild gameobject
m_Build->Rebuild();
m_Build->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true);
// Update worldstate
m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT - (m_Team * 3);
@@ -1469,18 +1469,15 @@ struct BfWGGameObjectBuilding
{
case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT:
case BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT:
m_Build->Rebuild();
m_Build->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true);
break;
case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DESTROY:
case BATTLEFIELD_WG_OBJECTSTATE_HORDE_DESTROY:
m_Build->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED);
m_Build->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DESTROYED);
m_Build->SetUInt32Value(GAMEOBJECT_DISPLAYID, m_Build->GetGOInfo()->building.destroyedDisplayId);
m_Build->SetDestructibleState(GO_DESTRUCTIBLE_DESTROYED);
break;
case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DAMAGE:
case BATTLEFIELD_WG_OBJECTSTATE_HORDE_DAMAGE:
m_Build->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED);
m_Build->SetUInt32Value(GAMEOBJECT_DISPLAYID, m_Build->GetGOInfo()->building.damagedDisplayId);
m_Build->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED);
break;
}
}