Changeset 179 for trunk

Show
Ignore:
Timestamp:
11/19/08 13:43:49 (17 years ago)
Author:
yumileroy
Message:

[svn] Check combat reach in GetRandomContactPoint?() until find out why some units have invalid combat reach.

Original author: megamage
Date: 2008-11-06 10:36:40-06:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/Unit.cpp

    r178 r179  
    429429void Unit::GetRandomContactPoint( const Unit* obj, float &x, float &y, float &z, float distance2dMin, float distance2dMax ) const 
    430430{ 
    431     assert(GetCombatReach() > 0.1); 
     431    //assert(GetCombatReach() > 0.1); 
     432    float combat_reach = GetCombatReach(); 
     433    if(combat_reach < 0.1) 
     434    { 
     435        sLog.outError("Unit %u (Type: %u) has invalid combat_reach %f",GetGUIDLow(),GetTypeId(),combat_reach); 
     436        if(GetTypeId() ==  TYPEID_UNIT) 
     437            sLog.outError("Creature entry %u has invalid combat_reach", ((Creature*)this)->GetEntry()); 
     438        combat_reach = 0.5; 
     439    } 
    432440        uint32 attacker_number = getAttackers().size(); 
    433441    if(attacker_number > 0) --attacker_number; 
    434442        GetNearPoint(obj,x,y,z,obj->GetCombatReach(), distance2dMin+(distance2dMax-distance2dMin)*rand_norm() 
    435         , GetAngle(obj) + (attacker_number ? (M_PI/2 - M_PI * rand_norm()) * (float)attacker_number / GetCombatReach() / 3 : 0)); 
     443        , GetAngle(obj) + (attacker_number ? (M_PI/2 - M_PI * rand_norm()) * (float)attacker_number / combat_reach / 3 : 0)); 
    436444} 
    437445