26 return teams().at(side - 1);
36 const unit & u = *u_it;
42 }
else if (!
get_team(side_num).fogged(u_loc)
53 if (!
map().on_board(loc))
return nullptr;
55 if (!u.
valid() || !u->is_visible_to_team(current_team, see_all)) {
63 if (!
map().on_board(loc))
return nullptr;
65 if (!u.
valid() || !u->is_visible_to_team(current_team, see_all)) {
74 return {
false,
false};
79 return {
false,
false};
86 if (
map().on_board(adj)) {
89 if (
i.valid() && !
i->incapacitated() && current_team.
is_enemy(
i->side())) {
121 const std::vector<team> &
t =
teams();
122 for(std::size_t
i = 0;
i !=
t.size(); ++
i) {
123 if(
t[
i].owns_village(loc))
148 if (u.side() == side) ++res;
157 if (u.side() == side) res += u.cost();
166 if (u.side() == side) res += u.upkeep();
173 , units(dc.side_units(side))
174 , upkeep(dc.side_upkeep(side))
175 , expenses(std::max<int>(0, upkeep - tm.support()))
176 , net_income(tm.total_income() - expenses)
Abstract class for exposing game data that doesn't depend on the GUI, however which for historical re...
const team & get_team(int side) const
This getter takes a 1-based side number, not a 0-based team number.
orb_status unit_orb_status(const unit &u) const
Returns an enumurated summary of whether this unit can move and/or attack.
int village_owner(const map_location &loc) const
Given the location of a village, will return the 1-based number of the team that currently owns it,...
const unit * get_visible_unit(const map_location &loc, const team ¤t_team, bool see_all=false) const
bool is_observer() const
Check if we are an observer in this game.
can_move_result unit_can_move(const unit &u) const
Work out what u can do - this does not check which player's turn is currently active,...
virtual const gamemap & map() const =0
int side_units(int side_num) const
Returns the number of units of the side side_num.
virtual const std::vector< team > & teams() const =0
unit_const_ptr get_visible_unit_shared_ptr(const map_location &loc, const team ¤t_team, bool see_all=false) const
int side_units_cost(int side_num) const
Returns the total cost of units of side side_num.
virtual const unit_map & units() const =0
bool would_be_discovered(const map_location &loc, int side_num, bool see_all=true)
Given a location and a side number, indicates whether an invisible unit of that side at that location...
int side_upkeep(int side_num) const
This class stores all the data for a single 'side' (in game nomenclature).
bool is_enemy(int n) const
unit_iterator find(std::size_t id)
This class represents a single unit of a specific type.
bool invisible(const map_location &loc, bool see_all=true) const
bool user_end_turn() const
Check whether the user ended their turn.
bool incapacitated() const
Check if the unit has been petrified.
int side() const
The side this unit belongs to.
int max_attacks() const
The maximum number of attacks this unit may perform per turn, usually 1.
int attacks_left() const
Gets the remaining number of attacks this unit can perform this turn.
bool has_goto() const
Gets whether this unit has a multi-turn destination set.
const map_location & get_location() const
The current map location this unit is at.
bool has_moved() const
Checks if this unit has moved.
int movement_cost(const t_translation::terrain_code &terrain) const
Get the unit's movement cost on a particular terrain.
int movement_left() const
Gets how far a unit can move, considering the incapacitated flag.
int total_movement() const
The maximum moves this unit has.
void get_adjacent_tiles(const map_location &a, map_location *res)
Function which, given a location, will place all adjacent locations in res.
orb_status
Corresponds to the colored orbs displayed above units' hp-bar and xp-bar.
@ partial
There are still moves and/or attacks possible, but the unit doesn't fit in the "unmoved" status.
@ moved
All moves and possible attacks have been done.
@ unmoved
The unit still has full movement and all attacks available.
@ disengaged
The unit can move but can't attack, and wouldn't be able to attack even if it was moved to a hex adja...
std::shared_ptr< const unit > unit_const_ptr
bool attack_here
The unit can make an attack from the hex that it's currently on, this requires attack points and a no...
bool move
The unit can move to another hex, taking account of enemies' locations, ZoC and terrain costs vs curr...
Encapsulates the map of the game.
team_data(const display_context &dc, const team &tm)
pointer get_shared_ptr() const
This is exactly the same as operator-> but it's slightly more readable, and can replace &*iter syntax...