Pol
Revision:cb584c9
|
Functions | |
static bool | Pol::Realms::Realm::dynamic_item_blocks_los (unsigned short x, unsigned short y, short z, LosCache &cache) |
bool | Pol::Realms::Realm::has_los (const Core::ULWObject &att, const Core::ULWObject &tgt) const |
bool | Pol::Realms::Realm::los_blocked (const Core::ULWObject &att, const Core::ULWObject &target, unsigned short x, unsigned short y, short z, LosCache &cache) const |
bool | Pol::Realms::Realm::static_item_blocks_los (unsigned short x, unsigned short y, short z, LosCache &cache) const |
To determine LOS, a 3D line is drawn from the top of the attacker to the top of the target.
An 3D extension of Bresenham's algorithm is used to draw the line.
Each point along the way is checked for items and statics of any kind. Only integer addition and subtraction is required.
The line always starts at the point with the lowest Y-coordinate, or if the Y coordinates are the same, the point with the lowest Z-coordinate. This way, if A -> B has LOS, then B -> A has LOS, always. (Bresenham lines can occupy different points, given the same endpoints, depending on which point is used as the start)
Zero-height items (floor tiles, mostly) are treated as 1-height items, sitting at 1 lower Z coordinate. This makes floors solid. (A weirdness: On a floor at height 72, characters walk around at Z=73, but items are placed at Z=72. This is somewhat unfortunate.)
|
staticprotected |
Definition at line 55 of file realmlos.cpp.
References Pol::Realms::Realm::LosCache::dyn_items, and INFO_PRINT.
Referenced by Pol::Realms::Realm::los_blocked().
bool Pol::Realms::Realm::has_los | ( | const Core::ULWObject & | att, |
const Core::ULWObject & | tgt | ||
) | const |
Definition at line 146 of file realmlos.cpp.
References ABS, Pol::Core::CLASS_CHARACTER, Pol::Realms::Realm::LosCache::dyn_items, Pol::Mobile::Character::ignores_line_of_sight(), Pol::Core::WorldIterator< Filter >::InBox(), Pol::Core::ULWObject::isa(), Pol::Realms::Realm::LosCache::last_x, Pol::Realms::Realm::LosCache::last_y, Pol::Realms::Realm::los_blocked(), Pol::Realms::los_range, Pol::Core::ULWObject::realm, Pol::Mobile::Character::search_remote_containers(), Pol::Core::ULWObject::serial, Pol::Realms::Realm::LosCache::shapes, THREADLOCAL, Pol::Core::ULWObject::x, Pol::Core::ULWObject::y, and ZSGN.
Referenced by Pol::Core::doubleclick(), Pol::Core::drop_item_on_ground(), Pol::Core::drop_item_on_mobile(), Pol::Core::drop_item_on_object(), Pol::Core::get_item(), Pol::Items::UWeapon::in_range(), Pol::Mobile::Character::is_attackable(), Pol::Module::UOExecutorModule::mf_CheckLineOfSight(), Pol::Module::UOExecutorModule::mf_CheckLosAt(), Pol::Module::UOExecutorModule::mf_CheckLosBetween(), Pol::Module::UOExecutorModule::mf_ListHostiles(), Pol::Core::LosCheckedTargetCursor::on_target_cursor(), and Pol::Core::place_item().
|
protected |
Is any object occupying point (x,y,z) that is neither attacker nor target?
Definition at line 119 of file realmlos.cpp.
References Pol::Realms::Realm::dynamic_item_blocks_los(), Pol::Core::ULWObject::height, Pol::Realms::Realm::static_item_blocks_los(), Pol::Core::ULWObject::x, Pol::Core::ULWObject::y, and Pol::Core::ULWObject::z.
Referenced by Pol::Realms::Realm::has_los().
|
protected |
Definition at line 76 of file realmlos.cpp.
References Pol::Plib::FLAG::BLOCKSIGHT, Pol::Realms::Realm::getmapshapes(), INFO_PRINT, Pol::Realms::Realm::LosCache::last_x, Pol::Realms::Realm::LosCache::last_y, Pol::Realms::Realm::readmultis(), Pol::Realms::Realm::LosCache::shapes, and Pol::Core::tile_flags().
Referenced by Pol::Realms::Realm::los_blocked().