Core/Battleground: Some (minor) code optimizations

- All access to Battleground vars are done using funtions (Remove friendship from Battleground and BattlegroundMgr)
- Move specific 47 mins arena check to battleground code as its generic to all arenas
- Create PreUpdateImpl and PostUpdateImpl functions. Specific battlegrounds will implement those if needed (No more need of call Battleground::Update inside specific BGs)
- Modify Create function to use only one parameter
- Remove EventPlayerCapturedFlag from Battleground class, only one BG implements it and it's not used outside that BG.
This commit is contained in:
Spp
2011-08-05 11:57:09 +02:00
parent d7715fa4b8
commit 4ecda557e4
33 changed files with 299 additions and 336 deletions
@@ -62,10 +62,8 @@ BattlegroundWS::~BattlegroundWS()
{
}
void BattlegroundWS::Update(uint32 diff)
void BattlegroundWS::PostUpdateImpl(uint32 diff)
{
Battleground::Update(diff);
if (GetStatus() == STATUS_IN_PROGRESS)
{
if (GetStartTime() >= 25*MINUTE*IN_MILLISECONDS)
@@ -256,8 +254,7 @@ void BattlegroundWS::RespawnFlagAfterDrop(uint32 team)
PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED);
GameObject *obj = GetBgMap()->GetGameObject(GetDroppedFlagGUID(team));
if (obj)
if (GameObject *obj = GetBgMap()->GetGameObject(GetDroppedFlagGUID(team)))
obj->Delete();
else
sLog->outError("unknown droped flag bg, guid: %u", GUID_LOPART(GetDroppedFlagGUID(team)));