Skip to content

Commit

Permalink
[s1720] Remove unneeded InBattleGround() as it is already checked by …
Browse files Browse the repository at this point in the history
…GetBattleGround()

Also call OutdoorPvP handlers before instance script ones
  • Loading branch information
DomGries authored and Salja committed Oct 10, 2012
1 parent 2b86d03 commit 1647643
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 18 deletions.
8 changes: 4 additions & 4 deletions src/game/Creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -748,16 +748,16 @@ bool Creature::Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo cons
if (!cPos.Relocate(this))
return false;

// Notify the outdoor pvp script
if (OutdoorPvP* outdoorPvP = sOutdoorPvPMgr.GetScript(GetZoneId()))
outdoorPvP->HandleCreatureCreate(this);

// Notify the map's instance data.
// Only works if you create the object in it, not if it is moves to that map.
// Normally non-players do not teleport to other maps.
if (InstanceData* iData = GetMap()->GetInstanceData())
iData->OnCreatureCreate(this);

// Notify the outdoor pvp script
if (OutdoorPvP* outdoorPvP = sOutdoorPvPMgr.GetScript(GetZoneId()))
outdoorPvP->HandleCreatureCreate(this);

switch (GetCreatureInfo()->rank)
{
case CREATURE_ELITE_RARE:
Expand Down
13 changes: 6 additions & 7 deletions src/game/GameObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,16 +164,16 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, float x, float
if (goinfo->type == GAMEOBJECT_TYPE_CAPTURE_POINT && goinfo->capturePoint.radius)
SetCapturePointSlider(sOutdoorPvPMgr.GetCapturePointSliderValue(goinfo->id));

// Notify the outdoor pvp script
if (OutdoorPvP* outdoorPvP = sOutdoorPvPMgr.GetScript(GetZoneId()))
outdoorPvP->HandleGameObjectCreate(this);

// Notify the map's instance data.
// Only works if you create the object in it, not if it is moves to that map.
// Normally non-players do not teleport to other maps.
if (InstanceData* iData = map->GetInstanceData())
iData->OnObjectCreate(this);

// Notify the outdoor pvp script
if (OutdoorPvP* outdoorPvP = sOutdoorPvPMgr.GetScript(GetZoneId()))
outdoorPvP->HandleGameObjectCreate(this);

return true;
}

Expand Down Expand Up @@ -342,9 +342,8 @@ void GameObject::Update(uint32 update_diff, uint32 p_time)
if (IsBattleGroundTrap && ok->GetTypeId() == TYPEID_PLAYER)
{
// BattleGround gameobjects case
if (((Player*)ok)->InBattleGround())
if (BattleGround* bg = ((Player*)ok)->GetBattleGround())
bg->HandleTriggerBuff(GetObjectGuid());
if (BattleGround* bg = ((Player*)ok)->GetBattleGround())
bg->HandleTriggerBuff(GetObjectGuid());
}
}
}
Expand Down
8 changes: 3 additions & 5 deletions src/game/MiscHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -736,14 +736,12 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
return;
}

if (pl->InBattleGround())
if (BattleGround* bg = pl->GetBattleGround())
{
if (BattleGround* bg = pl->GetBattleGround())
bg->HandleAreaTrigger(pl, Trigger_ID);
bg->HandleAreaTrigger(pl, Trigger_ID);
return;
}

if (OutdoorPvP* outdoorPvP = sOutdoorPvPMgr.GetScript(pl->GetCachedZoneId()))
else if (OutdoorPvP* outdoorPvP = sOutdoorPvPMgr.GetScript(pl->GetCachedZoneId()))
{
if (outdoorPvP->HandleAreaTrigger(pl, Trigger_ID))
return;
Expand Down
1 change: 0 additions & 1 deletion src/game/MovementHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,6 @@ void WorldSession::HandleMoverRelocation(MovementInfo& movementInfo)
if (movementInfo.GetPos()->z < -500.0f)
{
if (plMover->InBattleGround()
&& plMover->GetBattleGround()
&& plMover->GetBattleGround()->HandlePlayerUnderMap(_player))
{
// do nothing, the handle already did if returned true
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "1719"
#define REVISION_NR "1720"
#endif // __REVISION_NR_H__

0 comments on commit 1647643

Please sign in to comment.