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()) if (!obj || !IsWarTime())
return; return;
// We handle only gameobjects here
GameObject* go = obj->ToGameObject();
if (!go)
return;
// On click on titan relic // 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 // Check that the door is break
if (m_CanClickOnOrb) 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 // 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) 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) if ((*itr)->m_Build->GetGOInfo()->building.damagedEvent == eventId)
(*itr)->Damaged(); (*itr)->Damaged();
@@ -412,7 +412,7 @@ class BattlefieldWG : public Battlefield
void PromotePlayer(Player *killer); void PromotePlayer(Player *killer);
void UpdateTenacity(); void UpdateTenacity();
void ProcessEvent(GameObject *obj, uint32 eventId); void ProcessEvent(WorldObject *obj, uint32 eventId);
protected: protected:
bool m_CanClickOnOrb; bool m_CanClickOnOrb;
@@ -1366,7 +1366,7 @@ struct BfWGGameObjectBuilding
} }
// Rebuild gameobject // Rebuild gameobject
m_Build->Rebuild(); m_Build->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true);
// Update worldstate // Update worldstate
m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT - (m_Team * 3); 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_ALLIANCE_INTACT:
case BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT: case BATTLEFIELD_WG_OBJECTSTATE_HORDE_INTACT:
m_Build->Rebuild(); m_Build->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true);
break; break;
case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DESTROY: case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DESTROY:
case BATTLEFIELD_WG_OBJECTSTATE_HORDE_DESTROY: case BATTLEFIELD_WG_OBJECTSTATE_HORDE_DESTROY:
m_Build->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED); m_Build->SetDestructibleState(GO_DESTRUCTIBLE_DESTROYED);
m_Build->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DESTROYED);
m_Build->SetUInt32Value(GAMEOBJECT_DISPLAYID, m_Build->GetGOInfo()->building.destroyedDisplayId);
break; break;
case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DAMAGE: case BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_DAMAGE:
case BATTLEFIELD_WG_OBJECTSTATE_HORDE_DAMAGE: case BATTLEFIELD_WG_OBJECTSTATE_HORDE_DAMAGE:
m_Build->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_DAMAGED); m_Build->SetDestructibleState(GO_DESTRUCTIBLE_DAMAGED);
m_Build->SetUInt32Value(GAMEOBJECT_DISPLAYID, m_Build->GetGOInfo()->building.damagedDisplayId);
break; break;
} }
} }