The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Macros | Typedefs | Functions | Variables
reports.cpp File Reference
#include "global.hpp"
#include "actions/attack.hpp"
#include "attack_prediction.hpp"
#include "font.hpp"
#include "game_preferences.hpp"
#include "gettext.hpp"
#include "language.hpp"
#include "map/map.hpp"
#include "marked-up_text.hpp"
#include "mouse_events.hpp"
#include "reports.hpp"
#include "strftime.hpp"
#include "team.hpp"
#include "text.hpp"
#include "tod_manager.hpp"
#include "units/unit.hpp"
#include "units/helper.hpp"
#include "whiteboard/manager.hpp"
#include <boost/shared_ptr.hpp>
#include <cassert>
#include <ctime>
Include dependency graph for reports.cpp:

Go to the source code of this file.

Classes

struct  report_generator_helper
 

Macros

#define REPORT_GENERATOR(n, cn)
 

Typedefs

typedef std::map< std::string,
reports::generator_function
static_report_generators
 

Functions

static void add_text (config &report, const std::string &text, const std::string &tooltip, const std::string &help="")
 
static void add_image (config &report, const std::string &image, const std::string &tooltip, const std::string &help="")
 
static config text_report (const std::string &text, const std::string &tooltip="", const std::string &help="")
 
static config image_report (const std::string &image, const std::string &tooltip="", const std::string &help="")
 
static void add_status (config &r, char const *path, char const *desc1, char const *desc2)
 
static std::string flush (std::ostringstream &s)
 
static const unitget_visible_unit (reports::context &rc)
 
static const unitget_selected_unit (reports::context &rc)
 
static config gray_inactive (reports::context &rc, const std::string &str)
 
static config unit_name (const unit *u)
 
 REPORT_GENERATOR (unit_name, rc)
 
 REPORT_GENERATOR (selected_unit_name, rc)
 
static config unit_type (const unit *u)
 
 REPORT_GENERATOR (unit_type, rc)
 
 REPORT_GENERATOR (selected_unit_type, rc)
 
static config unit_race (const unit *u)
 
 REPORT_GENERATOR (unit_race, rc)
 
 REPORT_GENERATOR (selected_unit_race, rc)
 
static config unit_side (reports::context &rc, const unit *u)
 
 REPORT_GENERATOR (unit_side, rc)
 
 REPORT_GENERATOR (selected_unit_side, rc)
 
static config unit_level (const unit *u)
 
 REPORT_GENERATOR (unit_level, rc)
 
 REPORT_GENERATOR (selected_unit_level, rc)
 
 REPORT_GENERATOR (unit_amla, rc)
 
static config unit_traits (const unit *u)
 
 REPORT_GENERATOR (unit_traits, rc)
 
 REPORT_GENERATOR (selected_unit_traits, rc)
 
static config unit_status (reports::context &rc, const unit *u)
 
 REPORT_GENERATOR (unit_status, rc)
 
 REPORT_GENERATOR (selected_unit_status, rc)
 
static config unit_alignment (reports::context &rc, const unit *u)
 
 REPORT_GENERATOR (unit_alignment, rc)
 
 REPORT_GENERATOR (selected_unit_alignment, rc)
 
static config unit_abilities (const unit *u)
 
 REPORT_GENERATOR (unit_abilities, rc)
 
 REPORT_GENERATOR (selected_unit_abilities, rc)
 
static config unit_hp (reports::context &rc, const unit *u)
 
 REPORT_GENERATOR (unit_hp, rc)
 
 REPORT_GENERATOR (selected_unit_hp, rc)
 
static config unit_xp (const unit *u)
 
 REPORT_GENERATOR (unit_xp, rc)
 
 REPORT_GENERATOR (selected_unit_xp, rc)
 
static config unit_advancement_options (const unit *u)
 
 REPORT_GENERATOR (unit_advancement_options, rc)
 
 REPORT_GENERATOR (selected_unit_advancement_options, rc)
 
static config unit_defense (reports::context &rc, const unit *u, const map_location &displayed_unit_hex)
 
 REPORT_GENERATOR (unit_defense, rc)
 
 REPORT_GENERATOR (selected_unit_defense, rc)
 
static config unit_vision (const unit *u)
 
 REPORT_GENERATOR (unit_vision, rc)
 
 REPORT_GENERATOR (selected_unit_vision, rc)
 
static config unit_moves (reports::context &rc, const unit *u)
 
 REPORT_GENERATOR (unit_moves, rc)
 
 REPORT_GENERATOR (selected_unit_moves, rc)
 
static int attack_info (reports::context &rc, const attack_type &at, config &res, const unit &u, const map_location &displayed_unit_hex)
 
static void format_prob (char str_buf[10], double prob)
 
static void format_hp (char str_buf[10], int hp)
 
static config unit_weapons (reports::context &rc, const unit *attacker, const map_location &attacker_pos, const unit *defender, bool show_attacker)
 
static config unit_weapons (reports::context &rc, const unit *u)
 
 REPORT_GENERATOR (unit_weapons, rc)
 
 REPORT_GENERATOR (highlighted_unit_weapons, rc)
 
 REPORT_GENERATOR (selected_unit_weapons, rc)
 
 REPORT_GENERATOR (unit_image, rc)
 
 REPORT_GENERATOR (selected_unit_image, rc)
 
 REPORT_GENERATOR (selected_unit_profile, rc)
 
 REPORT_GENERATOR (unit_profile, rc)
 
 REPORT_GENERATOR (tod_stats, rc)
 
static config time_of_day_at (reports::context &rc, const map_location &mouseover_hex)
 
 REPORT_GENERATOR (time_of_day, rc)
 
static config unit_box_at (reports::context &rc, const map_location &mouseover_hex)
 
 REPORT_GENERATOR (unit_box, rc)
 
 REPORT_GENERATOR (turn, rc)
 
 REPORT_GENERATOR (gold, rc)
 
 REPORT_GENERATOR (villages, rc)
 
 REPORT_GENERATOR (num_units, rc)
 
 REPORT_GENERATOR (upkeep, rc)
 
 REPORT_GENERATOR (expenses, rc)
 
 REPORT_GENERATOR (income, rc)
 
 REPORT_GENERATOR (terrain_info, rc)
 
 REPORT_GENERATOR (terrain, rc)
 
 REPORT_GENERATOR (zoom_level, rc)
 
 REPORT_GENERATOR (position, rc)
 
 REPORT_GENERATOR (side_playing, rc)
 
 REPORT_GENERATOR (observers, rc)
 
 REPORT_GENERATOR (report_clock,)
 
 REPORT_GENERATOR (report_countdown, rc)
 

Variables

static static_report_generators static_generators
 
static char const * naps = "</span>"
 

Macro Definition Documentation

#define REPORT_GENERATOR (   n,
  cn 
)
Value:
static config report_##n(reports::context & cn); \
static report_generator_helper reg_gen_##n(#n, &report_##n); \
static config report_##n(reports::context & cn)
GLclampd n
Definition: glew.h:5903
A config object defines a single node in a WML file, with access to child nodes.
Definition: config.hpp:83

Definition at line 104 of file reports.cpp.

Typedef Documentation

Definition at line 93 of file reports.cpp.

Function Documentation

static void add_image ( config report,
const std::string image,
const std::string tooltip,
const std::string help = "" 
)
static
static void add_status ( config r,
char const *  path,
char const *  desc1,
char const *  desc2 
)
static

Definition at line 78 of file reports.cpp.

References add_image(), and translation::gettext().

Referenced by unit_status().

static void add_text ( config report,
const std::string text,
const std::string tooltip,
const std::string help = "" 
)
static
static int attack_info ( reports::context rc,
const attack_type at,
config res,
const unit u,
const map_location displayed_unit_hex 
)
static
static std::string flush ( std::ostringstream &  s)
static
static void format_hp ( char  str_buf[10],
int  hp 
)
static

Definition at line 842 of file reports.cpp.

Referenced by unit_weapons().

static void format_prob ( char  str_buf[10],
double  prob 
)
static

Definition at line 828 of file reports.cpp.

Referenced by unit_weapons().

static const unit* get_selected_unit ( reports::context rc)
static
static const unit* get_visible_unit ( reports::context rc)
static
static config gray_inactive ( reports::context rc,
const std::string str 
)
static
static config image_report ( const std::string image,
const std::string tooltip = "",
const std::string help = "" 
)
static

Definition at line 68 of file reports.cpp.

References add_image().

Referenced by REPORT_GENERATOR(), time_of_day_at(), and unit_box_at().

REPORT_GENERATOR ( unit_name  ,
rc   
)

Definition at line 150 of file reports.cpp.

References get_visible_unit(), and unit_name().

REPORT_GENERATOR ( selected_unit_name  ,
rc   
)

Definition at line 155 of file reports.cpp.

References get_selected_unit(), and unit_name().

REPORT_GENERATOR ( unit_type  ,
rc   
)

Definition at line 171 of file reports.cpp.

References get_visible_unit(), and unit_type().

REPORT_GENERATOR ( selected_unit_type  ,
rc   
)

Definition at line 176 of file reports.cpp.

References get_selected_unit(), and unit_type().

REPORT_GENERATOR ( unit_race  ,
rc   
)

Definition at line 190 of file reports.cpp.

References get_visible_unit(), and unit_race().

REPORT_GENERATOR ( selected_unit_race  ,
rc   
)

Definition at line 195 of file reports.cpp.

References get_selected_unit(), and unit_race().

REPORT_GENERATOR ( unit_side  ,
rc   
)

Definition at line 221 of file reports.cpp.

References get_visible_unit(), and unit_side().

REPORT_GENERATOR ( selected_unit_side  ,
rc   
)

Definition at line 226 of file reports.cpp.

References get_selected_unit(), and unit_side().

REPORT_GENERATOR ( unit_level  ,
rc   
)

Definition at line 246 of file reports.cpp.

References get_visible_unit(), and unit_level().

REPORT_GENERATOR ( selected_unit_level  ,
rc   
)

Definition at line 251 of file reports.cpp.

References get_selected_unit(), and unit_level().

REPORT_GENERATOR ( unit_amla  ,
rc   
)

Definition at line 257 of file reports.cpp.

References add_image(), unit::amla_icons(), and get_visible_unit().

REPORT_GENERATOR ( unit_traits  ,
rc   
)

Definition at line 288 of file reports.cpp.

References get_visible_unit(), and unit_traits().

REPORT_GENERATOR ( selected_unit_traits  ,
rc   
)

Definition at line 293 of file reports.cpp.

References get_selected_unit(), and unit_traits().

REPORT_GENERATOR ( unit_status  ,
rc   
)

Definition at line 322 of file reports.cpp.

References get_visible_unit(), and unit_status().

REPORT_GENERATOR ( selected_unit_status  ,
rc   
)

Definition at line 327 of file reports.cpp.

References get_selected_unit(), and unit_status().

REPORT_GENERATOR ( unit_alignment  ,
rc   
)

Definition at line 354 of file reports.cpp.

References get_visible_unit(), and unit_alignment().

REPORT_GENERATOR ( selected_unit_alignment  ,
rc   
)

Definition at line 359 of file reports.cpp.

References get_selected_unit(), and unit_alignment().

REPORT_GENERATOR ( unit_abilities  ,
rc   
)

Definition at line 399 of file reports.cpp.

References get_visible_unit(), and unit_abilities().

REPORT_GENERATOR ( selected_unit_abilities  ,
rc   
)

Definition at line 404 of file reports.cpp.

References get_selected_unit(), and unit_abilities().

REPORT_GENERATOR ( unit_hp  ,
rc   
)

Definition at line 453 of file reports.cpp.

References get_visible_unit(), and unit_hp().

REPORT_GENERATOR ( selected_unit_hp  ,
rc   
)

Definition at line 458 of file reports.cpp.

References get_selected_unit(), and unit_hp().

REPORT_GENERATOR ( unit_xp  ,
rc   
)

Definition at line 475 of file reports.cpp.

References get_visible_unit(), and unit_xp().

REPORT_GENERATOR ( selected_unit_xp  ,
rc   
)

Definition at line 480 of file reports.cpp.

References get_selected_unit(), and unit_xp().

REPORT_GENERATOR ( unit_advancement_options  ,
rc   
)

Definition at line 496 of file reports.cpp.

References get_visible_unit(), and unit_advancement_options().

REPORT_GENERATOR ( selected_unit_advancement_options  ,
rc   
)

Definition at line 501 of file reports.cpp.

References get_selected_unit(), and unit_advancement_options().

REPORT_GENERATOR ( unit_defense  ,
rc   
)

Definition at line 548 of file reports.cpp.

References get_visible_unit(), and unit_defense().

REPORT_GENERATOR ( selected_unit_defense  ,
rc   
)

Definition at line 554 of file reports.cpp.

References get_selected_unit(), and unit_defense().

REPORT_GENERATOR ( unit_vision  ,
rc   
)

Definition at line 571 of file reports.cpp.

References get_visible_unit(), and unit_vision().

REPORT_GENERATOR ( selected_unit_vision  ,
rc   
)

Definition at line 576 of file reports.cpp.

References get_selected_unit(), and unit_vision().

REPORT_GENERATOR ( unit_moves  ,
rc   
)

Definition at line 638 of file reports.cpp.

References get_visible_unit(), and unit_moves().

REPORT_GENERATOR ( selected_unit_moves  ,
rc   
)

Definition at line 643 of file reports.cpp.

References get_selected_unit(), and unit_moves().

REPORT_GENERATOR ( unit_weapons  ,
rc   
)

Definition at line 1000 of file reports.cpp.

References get_visible_unit(), and unit_weapons().

REPORT_GENERATOR ( highlighted_unit_weapons  ,
rc   
)
REPORT_GENERATOR ( selected_unit_weapons  ,
rc   
)
REPORT_GENERATOR ( unit_image  ,
rc   
)
REPORT_GENERATOR ( selected_unit_image  ,
rc   
)
REPORT_GENERATOR ( selected_unit_profile  ,
rc   
)

Definition at line 1057 of file reports.cpp.

References get_selected_unit(), image_report(), and unit::small_profile().

REPORT_GENERATOR ( unit_profile  ,
rc   
)

Definition at line 1063 of file reports.cpp.

References get_visible_unit(), image_report(), and unit::small_profile().

REPORT_GENERATOR ( tod_stats  ,
rc   
)

Definition at line 1070 of file reports.cpp.

References i, text_report(), and map_location::valid().

REPORT_GENERATOR ( time_of_day  ,
rc   
)

Definition at line 1138 of file reports.cpp.

References time_of_day_at(), and map_location::valid().

REPORT_GENERATOR ( unit_box  ,
rc   
)

Definition at line 1219 of file reports.cpp.

References unit_box_at().

REPORT_GENERATOR ( turn  ,
rc   
)

Definition at line 1226 of file reports.cpp.

References text_report().

REPORT_GENERATOR ( gold  ,
rc   
)
REPORT_GENERATOR ( villages  ,
rc   
)
REPORT_GENERATOR ( num_units  ,
rc   
)

Definition at line 1278 of file reports.cpp.

References gray_inactive().

REPORT_GENERATOR ( upkeep  ,
rc   
)

Definition at line 1283 of file reports.cpp.

References team_data::expenses, gray_inactive(), and team_data::upkeep.

REPORT_GENERATOR ( expenses  ,
rc   
)

Definition at line 1293 of file reports.cpp.

References team_data::expenses, and gray_inactive().

REPORT_GENERATOR ( income  ,
rc   
)
REPORT_GENERATOR ( terrain_info  ,
rc   
)
REPORT_GENERATOR ( terrain  ,
rc   
)
REPORT_GENERATOR ( zoom_level  ,
rc   
)

Definition at line 1424 of file reports.cpp.

References text_report().

REPORT_GENERATOR ( position  ,
rc   
)
REPORT_GENERATOR ( side_playing  ,
rc   
)
REPORT_GENERATOR ( observers  ,
rc   
)

Definition at line 1489 of file reports.cpp.

References _(), image_report(), and game_config::images::observer.

REPORT_GENERATOR ( report_clock  )
REPORT_GENERATOR ( report_countdown  ,
rc   
)
static config text_report ( const std::string text,
const std::string tooltip = "",
const std::string help = "" 
)
static
static config time_of_day_at ( reports::context rc,
const map_location mouseover_hex 
)
static
static config unit_abilities ( const unit u)
static
static config unit_advancement_options ( const unit u)
static

Definition at line 486 of file reports.cpp.

References add_image(), and unit::advancement_icons().

Referenced by REPORT_GENERATOR().

static config unit_alignment ( reports::context rc,
const unit u 
)
static
static config unit_box_at ( reports::context rc,
const map_location mouseover_hex 
)
static
static config unit_defense ( reports::context rc,
const unit u,
const map_location displayed_unit_hex 
)
static
static config unit_hp ( reports::context rc,
const unit u 
)
static
static config unit_level ( const unit u)
static

Definition at line 232 of file reports.cpp.

References _(), unit::advances_to_translated(), utils::join(), unit::level(), and text_report().

Referenced by REPORT_GENERATOR().

static config unit_moves ( reports::context rc,
const unit u 
)
static
static config unit_name ( const unit u)
static

Definition at line 133 of file reports.cpp.

References _(), font::escape_text(), unit::name(), and text_report().

Referenced by ai::ai_recruit(), and REPORT_GENERATOR().

static config unit_race ( const unit u)
static

Definition at line 182 of file reports.cpp.

References _(), unit::gender(), unit_race::id(), unit_race::name(), unit::race(), and text_report().

Referenced by REPORT_GENERATOR().

static config unit_side ( reports::context rc,
const unit u 
)
static
static config unit_status ( reports::context rc,
const unit u 
)
static
static config unit_traits ( const unit u)
static
static config unit_type ( const unit u)
static
static config unit_vision ( const unit u)
static

Definition at line 561 of file reports.cpp.

References _(), text_report(), unit::total_movement(), and unit::vision().

Referenced by REPORT_GENERATOR().

static config unit_weapons ( reports::context rc,
const unit attacker,
const map_location attacker_pos,
const unit defender,
bool  show_attacker 
)
static
static config unit_weapons ( reports::context rc,
const unit u 
)
static
static config unit_xp ( const unit u)
static

Variable Documentation

char const* naps = "</span>"
static
static_report_generators static_generators
static