Pyrogenesis
trunk
|
#include "precompiled.h"
#include "simulation2/system/Component.h"
#include "ICmpUnitMotion.h"
#include "simulation2/components/ICmpObstruction.h"
#include "simulation2/components/ICmpObstructionManager.h"
#include "simulation2/components/ICmpOwnership.h"
#include "simulation2/components/ICmpPosition.h"
#include "simulation2/components/ICmpPathfinder.h"
#include "simulation2/components/ICmpRangeManager.h"
#include "simulation2/components/ICmpValueModificationManager.h"
#include "simulation2/helpers/Geometry.h"
#include "simulation2/helpers/Render.h"
#include "simulation2/MessageTypes.h"
#include "simulation2/serialization/SerializeTemplates.h"
#include "graphics/Overlay.h"
#include "graphics/Terrain.h"
#include "maths/FixedVector2D.h"
#include "ps/CLogger.h"
#include "ps/Profile.h"
#include "renderer/Scene.h"
Classes | |
class | CCmpUnitMotion |
Macros | |
#define | DISABLE_PATHFINDER 0 |
Variables | |
static const entity_pos_t | WAYPOINT_ADVANCE_MAX = entity_pos_t::FromInt(TERRAIN_TILE_SIZE*8) |
When advancing along the long path, and picking a new waypoint to move towards, we'll pick one that's up to this far from the unit's current position (to minimise the effects of grid-constrained movement) More... | |
static const entity_pos_t | SHORT_PATH_MIN_SEARCH_RANGE = entity_pos_t::FromInt(TERRAIN_TILE_SIZE*2) |
Min/Max range to restrict short path queries to. More... | |
static const entity_pos_t | SHORT_PATH_MAX_SEARCH_RANGE = entity_pos_t::FromInt(TERRAIN_TILE_SIZE*9) |
static const entity_pos_t | LONG_PATH_MIN_DIST = entity_pos_t::FromInt(TERRAIN_TILE_SIZE*4) |
Minimum distance to goal for a long path request. More... | |
static const entity_pos_t | SHORT_PATH_GOAL_RADIUS = entity_pos_t::FromInt(TERRAIN_TILE_SIZE*2) |
When short-pathing, and the short-range pathfinder failed to return a path, Assume we are at destination if we are closer than this distance to the target And we have no target entity. More... | |
static const entity_pos_t | DIRECT_PATH_RANGE = entity_pos_t::FromInt(TERRAIN_TILE_SIZE*4) |
If we are this close to our target entity/point, then think about heading for it in a straight line instead of pathfinding. More... | |
static const entity_pos_t | CHECK_TARGET_MOVEMENT_MIN_DELTA = entity_pos_t::FromInt(TERRAIN_TILE_SIZE*4) |
If we're following a target entity, we will recompute our path if the target has moved more than this distance from where we last pathed to. More... | |
static const entity_pos_t | CHECK_TARGET_MOVEMENT_MIN_DELTA_FORMATION = entity_pos_t::FromInt(TERRAIN_TILE_SIZE*1) |
If we're following as part of a formation, but can't move to our assigned target point in a straight line, we will recompute our path if the target has moved more than this distance from where we last pathed to. More... | |
static const entity_pos_t | CHECK_TARGET_MOVEMENT_AT_MAX_DIST = entity_pos_t::FromInt(TERRAIN_TILE_SIZE*16) |
If we're following something but it's more than this distance away along our path, then don't bother trying to repath regardless of how much it has moved, until we get this close to the end of our old path. More... | |
static const fixed | CHECK_TARGET_MOVEMENT_MIN_COS = fixed::FromInt(866)/1000 |
If we're following something and the angle between the (straight-line) directions to its previous target position and its present target position is greater than a given angle, recompute the path even far away (i.e. More... | |
static const CColor | OVERLAY_COLOR_LONG_PATH (1, 1, 1, 1) |
static const CColor | OVERLAY_COLOR_SHORT_PATH (1, 0, 0, 1) |
#define DISABLE_PATHFINDER 0 |
|
static |
If we're following something but it's more than this distance away along our path, then don't bother trying to repath regardless of how much it has moved, until we get this close to the end of our old path.
|
static |
If we're following something and the angle between the (straight-line) directions to its previous target position and its present target position is greater than a given angle, recompute the path even far away (i.e.
even if CHECK_TARGET_MOVEMENT_AT_MAX_DIST condition is not fulfilled). The actual check is done on the cosine of this angle, with a PI/6 angle.
|
static |
If we're following a target entity, we will recompute our path if the target has moved more than this distance from where we last pathed to.
|
static |
If we're following as part of a formation, but can't move to our assigned target point in a straight line, we will recompute our path if the target has moved more than this distance from where we last pathed to.
|
static |
If we are this close to our target entity/point, then think about heading for it in a straight line instead of pathfinding.
|
static |
Minimum distance to goal for a long path request.
|
static |
|
static |
|
static |
When short-pathing, and the short-range pathfinder failed to return a path, Assume we are at destination if we are closer than this distance to the target And we have no target entity.
This is somewhat arbitrary, but setting a too big distance means units might lose sight of their end goal too much;
|
static |
|
static |
Min/Max range to restrict short path queries to.
(Larger ranges are slower, smaller ranges might miss some legitimate routes around large obstacles.)
|
static |
When advancing along the long path, and picking a new waypoint to move towards, we'll pick one that's up to this far from the unit's current position (to minimise the effects of grid-constrained movement)