* Fix possible server crash in Player::IsAtGroupRewardDistance, by Spp

* Fix possible server crash in Player::RewardPlayerAndGroupAtEvent
* Wintergrasp: Correct use of RewardPlayerAndGroupAtEvent, by Spp

--HG--
branch : trunk
This commit is contained in:
tartalo
2009-10-21 22:15:36 +02:00
parent 7a0bb775f0
commit 5e9c0d385a
2 changed files with 7 additions and 3 deletions
+4
View File
@@ -20289,6 +20289,8 @@ bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim)
void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewardSource) void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewardSource)
{ {
if (!pRewardSource)
return;
uint64 creature_guid = (pRewardSource && pRewardSource->GetTypeId()==TYPEID_UNIT) ? pRewardSource->GetGUID() : uint64(0); uint64 creature_guid = (pRewardSource && pRewardSource->GetTypeId()==TYPEID_UNIT) ? pRewardSource->GetGUID() : uint64(0);
// prepare data for near group iteration // prepare data for near group iteration
@@ -20314,6 +20316,8 @@ void Player::RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewar
bool Player::IsAtGroupRewardDistance(WorldObject const* pRewardSource) const bool Player::IsAtGroupRewardDistance(WorldObject const* pRewardSource) const
{ {
if (!pRewardSource)
return;
const WorldObject* player = GetCorpse(); const WorldObject* player = GetCorpse();
if(!player || isAlive()) if(!player || isAlive())
player = this; player = this;
+3 -3
View File
@@ -865,18 +865,18 @@ void OPvPWintergrasp::HandleKill(Player *killer, Unit *victim)
{ {
if (victim->getLevel() >= 70) if (victim->getLevel() >= 70)
ok = true; ok = true;
killer->RewardPlayerAndGroupAtEvent(CRE_PVP_KILL, 0); killer->RewardPlayerAndGroupAtEvent(CRE_PVP_KILL, victim);
} }
else else
{ {
switch(GetCreatureType(victim->GetEntry())) switch(GetCreatureType(victim->GetEntry()))
{ {
case CREATURE_SIEGE_VEHICLE: case CREATURE_SIEGE_VEHICLE:
killer->RewardPlayerAndGroupAtEvent(CRE_PVP_KILL_V,0); killer->RewardPlayerAndGroupAtEvent(CRE_PVP_KILL_V, victim);
ok = true; ok = true;
break; break;
case CREATURE_GUARD: case CREATURE_GUARD:
killer->RewardPlayerAndGroupAtEvent(CRE_PVP_KILL, 0); killer->RewardPlayerAndGroupAtEvent(CRE_PVP_KILL, victim);
ok = true; ok = true;
break; break;
case CREATURE_TURRET: case CREATURE_TURRET: