#include "global.hpp"
#include "game_config.hpp"
#include "game_errors.hpp"
#include "game_preferences.hpp"
#include "gettext.hpp"
#include "log.hpp"
#include "pathfind.hpp"
#include "random.hpp"
#include "unit.hpp"
#include "unit_types.hpp"
#include "unit_abilities.hpp"
#include "util.hpp"
#include "serialization/string_utils.hpp"
#include "halo.hpp"
#include "game_display.hpp"
#include "gamestatus.hpp"
#include "actions.hpp"
#include "game_events.hpp"
#include "sound.hpp"
#include "sdl_utils.hpp"
#include "terrain_filter.hpp"
#include "variable.hpp"
#include "callable_objects.hpp"
#include "formula.hpp"
#include <cassert>
#include <climits>
#include <ctime>
#include <algorithm>
#include <cstdlib>
#include <iostream>
#include <sstream>
#include <iterator>
Go to the source code of this file.
Defines | |
#define | DBG_UT LOG_STREAM(debug, engine) |
#define | LOG_UT LOG_STREAM(info, engine) |
#define | ERR_UT LOG_STREAM(err, engine) |
#define | ERR_CONFIG LOG_STREAM(err, config) |
Functions | |
static bool | compare_unit_values (unit const &a, unit const &b) |
void | sort_units (std::vector< unit > &units) |
static void | mod_mdr_merge (config &dst, const config &mod, bool delta) |
Helper function for add_modifications. | |
int | team_units (const unit_map &units, unsigned int side) |
Returns the number of units of the given side (team). | |
int | team_upkeep (const unit_map &units, unsigned int side) |
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 ¤t_team, bool see_all) |
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 ¤t_team, bool see_all) |
team_data | calculate_team_data (const team &tm, int side, const unit_map &units) |
std::string | get_checksum (const unit &u) |
advanceto alignment cost experience gender hitpoints level max_attacks max_experience max_hitpoints max_moves movement movement_type race random_traits resting undead_variation upkeep value zoc [attack] name type range damage number [specials] * [/special] [/attack] anything in: [abilities], [advance_from], [defense], [movement_cost], [resistance], [trait] remove description, description_inactive, name, name_inactive from all tags under [abilities] remove description from all tags under [specials] remove description, male_name, female_name, name from [trait] | |
Variables | |
const std::string | ModificationTypes [] = { "advance", "trait", "object" } |
const size_t | NumModificationTypes |
static std::vector< const unit * > | units_with_cache |
Pointers to units which have data in their internal caches. |
Definition in file unit.cpp.
#define DBG_UT LOG_STREAM(debug, engine) |
Definition at line 55 of file unit.cpp.
Referenced by unit_type_data::unit_type_map_wrapper::add_advancefrom(), unit_type::build_full(), unit_type_data::unit_type_map_wrapper::find_config(), get_checksum(), unit_type_data::unit_type_map_wrapper::set_config(), unit_type::unit_type(), and unit_type::~unit_type().
#define LOG_UT LOG_STREAM(info, engine) |
Definition at line 56 of file unit.cpp.
Referenced by unit::add_modification(), and unit::generate_traits().
Definition at line 2908 of file unit.cpp.
References team_data::expenses, team::gold(), team_data::gold, team::income(), team_data::net_income, team_units(), team_upkeep(), team_data::teamname, team_data::units, team_data::upkeep, team::user_team_name(), team::villages(), and team_data::villages.
Referenced by reports::generate_report(), ai_interface::recruit(), and events::menu_handler::status_table().
Definition at line 73 of file unit.cpp.
References unit::experience(), unit::level(), and unit::max_experience().
Referenced by sort_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 | |||
) |
Definition at line 2887 of file unit.cpp.
References unit_map::end(), unit_map::find(), team::fogged(), team::is_enemy(), and gamemap::on_board().
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 | |||
) |
Definition at line 2866 of file unit.cpp.
References unit_map::end(), unit_map::find(), team::fogged(), team::is_enemy(), and gamemap::on_board().
Referenced by shortest_path_calculator::cost(), events::menu_handler::current_unit(), ai::desperate_attack(), game_display::display_unit_hex(), game_display::draw(), game_display::draw_sidebar(), enemy_zoc(), find_routes(), events::mouse_handler::find_unit(), reports::generate_report(), game_display::highlight_hex(), and ai::move_to_targets().
std::string get_checksum | ( | const unit & | u | ) |
advanceto alignment cost experience gender hitpoints level max_attacks max_experience max_hitpoints max_moves movement movement_type race random_traits resting undead_variation upkeep value zoc [attack] name type range damage number [specials] * [/special] [/attack] anything in: [abilities], [advance_from], [defense], [movement_cost], [resistance], [trait] remove description, description_inactive, name, name_inactive from all tags under [abilities] remove description from all tags under [specials] remove description, male_name, female_name, name from [trait]
Gets a 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().
Helper function for add_modifications.
Definition at line 2311 of file unit.cpp.
References boost::foreach_detail_::end(), and config::values.
Referenced by unit::add_modification().
void sort_units | ( | std::vector< unit > & | units | ) |
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 | |||
) |
Definition at line 2855 of file unit.cpp.
References unit_map::begin(), and unit_map::end().
Referenced by events::menu_handler::get_title_suffix(), formula_ai::get_value(), events::menu_handler::goto_leader(), play_controller::in_context_menu(), events::menu_handler::scenario_settings_table(), and events::menu_handler::status_table().
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 | side | |||
) |
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().
const std::string ModificationTypes[] = { "advance", "trait", "object" } [static] |
Definition at line 61 of file unit.cpp.
Referenced by unit::apply_modifications(), and unit::remove_temporary_modifications().
const size_t NumModificationTypes [static] |
Initial value:
sizeof(ModificationTypes)/ sizeof(*ModificationTypes)
Definition at line 62 of file unit.cpp.
Referenced by unit::apply_modifications(), and unit::remove_temporary_modifications().
std::vector<const unit *> units_with_cache [static] |
Pointers to units which have data in their internal caches.
The destructor of an unit removes itself from the cache, so the pointers are always valid.
Definition at line 70 of file unit.cpp.
Referenced by unit::clear_status_caches(), unit::invisible(), and unit::~unit().
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |