本文整理汇总了C++中unit::movement_type方法的典型用法代码示例。如果您正苦于以下问题:C++ unit::movement_type方法的具体用法?C++ unit::movement_type怎么用?C++ unit::movement_type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unit
的用法示例。
在下文中一共展示了unit::movement_type方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/**
* Constructor from a unit.
*/
clearer_info::clearer_info(const unit & viewer) :
underlying_id(viewer.underlying_id()),
sight_range(viewer.vision()),
slowed(viewer.get_state(unit::STATE_SLOWED)),
costs(viewer.movement_type().get_vision())
{
}
示例2: paths
/**
* Constructs a list of jamming paths for a unit.
*
* This is used to construct a list of hexes that the indicated unit can jam.
* It differs from pathfinding in that it will only ever go out one turn.
* @param jammer The unit doing the jamming.
* @param loc The location from which the jamming occurs
* (does not have to be the unit's location).
*/
jamming_path::jamming_path(const unit& jammer, map_location const &loc)
: paths()
{
const int jamming_range = jammer.jamming();
// The five NULL parameters indicate (in order): no edges, no teleports,
// ignore units, ignore ZoC (no effect), and see all (no effect).
find_routes(loc, jammer.movement_type().get_jamming(),
jammer.get_state(unit::STATE_SLOWED), jamming_range, jamming_range,
0, destinations, NULL, NULL, NULL, NULL, NULL);
}
示例3: clear_unit
/**
* Clears shroud (and fog) around the provided location for @a view_team
* as if @a viewer was standing there.
* This will also record sighted events, which should be either fired or
* explicitly dropped.
*
* This should only be called if delayed shroud updates is off.
* It is wasteful to call this if view_team uses neither fog nor shroud.
*
* @param known_units These locations are not checked for uncovered units.
* @param enemy_count Incremented for each enemy uncovered (excluding known_units).
* @param friend_count Incremented for each friend uncovered (excluding known_units).
* @param spectator Will be told of uncovered units (excluding known_units).
* @param instant If false, then drawing delays (used to make movement look better) are allowed.
*
* @return whether or not information was uncovered (i.e. returns true if any
* locations in visual range were fogged/shrouded under shared vision/maps).
*/
bool shroud_clearer::clear_unit(const map_location &view_loc,
const unit &viewer, team &view_team,
const std::set<map_location>* known_units,
std::size_t * enemy_count, std::size_t * friend_count,
move_unit_spectator * spectator, bool instant)
{
// This is just a translation to the more general interface. It is
// not inlined so that vision.hpp does not have to include unit.hpp.
return clear_unit(view_loc, view_team, viewer.underlying_id(),
viewer.vision(), viewer.get_state(unit::STATE_SLOWED),
viewer.movement_type().get_vision(), viewer.get_location(),
known_units, enemy_count, friend_count, spectator, instant);
}
示例4: destinations
/**
* Construct a list of paths for the specified unit.
*
* This function is used for several purposes, including showing a unit's
* potential moves and generating currently possible paths.
* @param u The unit whose moves and movement type will be used.
* @param force_ignore_zoc Set to true to completely ignore zones of control.
* @param allow_teleport Set to true to consider teleportation abilities.
* @param viewing_team Usually the current team, except for "show enemy moves", etc.
* @param additional_turns The number of turns to account for, in addition to the current.
* @param see_all Set to true to remove unit visibility from consideration.
* @param ignore_units Set to true if units should never obstruct paths (implies ignoring ZoC as well).
*/
paths::paths(const unit& u, bool force_ignore_zoc,
bool allow_teleport, const team &viewing_team,
int additional_turns, bool see_all, bool ignore_units)
: destinations()
{
std::vector<team> const &teams = *resources::teams;
if (u.side() < 1 || u.side() > int(teams.size())) {
return;
}
find_routes(u.get_location(), u.movement_type().get_movement(),
u.get_state(unit::STATE_SLOWED), u.movement_left(),
u.total_movement(), additional_turns, destinations, NULL,
allow_teleport ? &u : NULL,
ignore_units ? NULL : &teams[u.side()-1],
force_ignore_zoc ? NULL : &u,
see_all ? NULL : &viewing_team);
}