Changeset 267 for trunk/src/game/Creature.cpp
- Timestamp:
- 11/21/08 16:54:14 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/Creature.cpp
r266 r267 1544 1544 } 1545 1545 1546 bool Creature::canStartAttack(Unit const* who) const 1547 { 1548 if(!who->isInAccessiblePlaceFor(this) 1549 || !canFly() && GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE 1550 || !IsWithinDistInMap(who, GetAttackDistance(who))) 1551 return false; 1552 1553 if(!canAttack(who)) 1554 return false; 1555 1556 return IsWithinLOSInMap(who); 1557 } 1558 1546 1559 float Creature::GetAttackDistance(Unit const* pl) const 1547 1560 { … … 1825 1838 Unit* Creature::SelectNearestTarget(float dist) const 1826 1839 { 1827 /*CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY()));1840 CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY())); 1828 1841 Cell cell(p); 1829 1842 cell.data.Part.reserved = ALL_DISTRICT; 1830 1843 cell.SetNoCreate(); 1831 1844 1832 Unit *target ;1845 Unit *target = NULL; 1833 1846 1834 1847 { … … 1840 1853 1841 1854 CellLock<GridReadGuard> cell_lock(cell, p); 1842 cell_lock->Visit(cell_lock, world_unit_searcher, GetMap()); 1843 cell_lock->Visit(cell_lock, grid_unit_searcher, GetMap()); 1844 }*/ 1845 return NULL; 1855 cell_lock->Visit(cell_lock, world_unit_searcher, *GetMap()); 1856 cell_lock->Visit(cell_lock, grid_unit_searcher, *GetMap()); 1857 } 1858 1859 return target; 1846 1860 } 1847 1861