aboutsummaryrefslogtreecommitdiff
path: root/src/game/Unit.cpp
diff options
context:
space:
mode:
authormegamage <none@none>2008-11-21 19:45:49 -0600
committermegamage <none@none>2008-11-21 19:45:49 -0600
commitfa667cf4507e5635d597b878119ce20f2836cc8c (patch)
tree34a1b3a70db2d8ba86be680bb341f1e499b0d672 /src/game/Unit.cpp
parentb2ba78e57a7c1895d1bacf950a3705eedd01c256 (diff)
*Alterac Valley. By Bogie and Balrok. Note: some core contents are modified. Will fix them later. Some sql are disabled because of possible conflict with offical DB. Use them at your own risk.
--HG-- branch : trunk
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r--src/game/Unit.cpp19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 94f647cdd46..73dce3e043a 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -829,22 +829,15 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
}
// battleground things (do this at the end, so the death state flag will be properly set to handle in the bg->handlekill)
- if(pVictim->GetTypeId() == TYPEID_PLAYER && (((Player*)pVictim)->InBattleGround()))
+ if(player && player->InBattleGround())
{
- Player *killed = ((Player*)pVictim);
- Player *killer = NULL;
- if(GetTypeId() == TYPEID_PLAYER)
- killer = ((Player*)this);
- else if(GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet())
+ if(BattleGround *bg = player->GetBattleGround())
{
- Unit *owner = GetOwner();
- if(owner && owner->GetTypeId() == TYPEID_PLAYER)
- killer = ((Player*)owner);
+ if(pVictim->GetTypeId() == TYPEID_PLAYER)
+ bg->HandleKillPlayer((Player*)pVictim, player);
+ else
+ bg->HandleKillUnit((Creature*)pVictim, player);
}
-
- if(killer)
- if(BattleGround *bg = killed->GetBattleGround())
- bg->HandleKillPlayer(killed, killer); // drop flags and etc
}
}
else // if (health <= damage)