unit.hpp File Reference

#include "config.hpp"
#include "map.hpp"
#include "race.hpp"
#include "team.hpp"
#include "unit_types.hpp"
#include "unit_map.hpp"
#include "formula_callable.hpp"
#include <set>
#include <string>
#include <vector>

Include dependency graph for unit.hpp:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  unit_ability_list
class  unit
struct  unit_movement_resetter
 Object which temporarily resets a unit's movement. More...
struct  team_data
struct  temporary_unit_placer
 This object is used to temporary place a unit in the unit map, swapping out any unit that is already there. More...

Functions

void sort_units (std::vector< unit > &)
int team_units (const unit_map &units, unsigned int team_num)
 Returns the number of units of the given side (team).
int team_upkeep (const unit_map &units, unsigned int team_num)
unit_map::const_iterator team_leader (unsigned int side, const unit_map &units)
unit_map::iterator find_visible_unit (unit_map &units, const gamemap::location loc, const gamemap &map, const std::vector< team > &teams, const team &current_team, bool see_all=false)
unit_map::const_iterator find_visible_unit (const unit_map &units, const gamemap::location loc, const gamemap &map, const std::vector< team > &teams, const team &current_team, bool see_all=false)
team_data calculate_team_data (const class team &tm, int side, const unit_map &units)
std::string get_checksum (const unit &u)
 Gets a checksum for a unit.


Detailed Description

Definition in file unit.hpp.


Function Documentation

team_data calculate_team_data ( const class team tm,
int  side,
const unit_map units 
)

unit_map::const_iterator find_visible_unit ( const unit_map units,
const gamemap::location  loc,
const gamemap map,
const std::vector< team > &  teams,
const team current_team,
bool  see_all = false 
)

unit_map::iterator find_visible_unit ( unit_map units,
const gamemap::location  loc,
const gamemap map,
const std::vector< team > &  teams,
const team current_team,
bool  see_all = false 
)

std::string get_checksum ( const unit u  ) 

Gets a checksum for a unit.

In MP games the descriptions are locally generated and might differ, so it should be possible to discard them. Not sure whether replays suffer the same problem.

Parameters:
u the unit
Returns:
the checksum for a unit

Definition at line 2990 of file unit.cpp.

References config::add_child(), unit::attacks(), config::clear_children(), DBG_UT, config::get_children(), config::hash(), config::recursive_clear_value(), and unit::write().

Referenced by replay::add_unit_checksum(), check_checksums(), and recruit_unit().

void sort_units ( std::vector< unit > &   ) 

Definition at line 84 of file unit.cpp.

References compare_unit_values().

Referenced by do_replay_handle(), and events::menu_handler::recall().

unit_map::const_iterator team_leader ( unsigned int  side,
const unit_map units 
)

int team_units ( const unit_map units,
unsigned int  team_num 
)

Returns the number of units of the given side (team).

Definition at line 2831 of file unit.cpp.

References unit_map::begin(), and unit_map::end().

Referenced by calculate_team_data(), reports::generate_report(), and playsingle_controller::play_turn().

int team_upkeep ( const unit_map units,
unsigned int  team_num 
)

Definition at line 2843 of file unit.cpp.

References unit_map::begin(), and unit_map::end().

Referenced by calculate_team_data(), and play_controller::init_side().


Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs