86 #include <boost/range/algorithm/find_if.hpp>
89 #define ERR_NG LOG_STREAM(err, log_engine)
90 #define LOG_NG LOG_STREAM(info, log_engine)
97 game_config_(game_config),
121 int controlled_recruiters = 0;
122 for(
size_t i = 0;
i <
teams().size(); ++
i) {
123 if(
teams()[
i].is_local_human() && !
teams()[
i].recruits().empty()
125 ++controlled_recruiters;
128 std::stringstream
msg;
129 if(controlled_recruiters >= 2) {
131 if (leader !=
units().
end() && !leader->name().empty()) {
132 msg <<
" (" << leader->name(); msg <<
")";
145 cfg[
"side"] = std::to_string(side_num);
149 team ¤t_team =
teams()[side_num - 1];
156 team ¤t_team =
teams()[side_num - 1];
160 std::stringstream title_str;
161 title_str <<
_(
"Statistics") <<
" (" << player <<
")";
163 side_num, current_team.
save_id(), player);
176 std::vector<bool> &leader_bools,
int selected,
179 scroll_btn_(new
gui::standard_dialog_button(disp.video(),
_(
"Scroll To"), 0, false)),
189 const bool leader_bool =
leader_bools_[get_menu().selection()];
192 && (info.
key[SDLK_RETURN] || info.
key[SDLK_KP_ENTER])))) {
193 set_result(get_menu().selection());
194 }
else if(!info.
key_down && info.
key[SDLK_ESCAPE]) {
196 }
else if(!info.
key_down && info.
key[SDLK_SPACE]) {
199 dialog::action(info);
210 std::stringstream heading;
223 std::vector<std::string>
items;
224 std::vector<bool> leader_bools;
225 items.push_back(heading.str());
229 unsigned total_villages = 0;
231 bool status_table_empty =
true;
238 for(
size_t n = 0;
n !=
teams().size(); ++
n) {
242 status_table_empty=
false;
245 const bool enemy = viewing_team.
is_enemy(
n+1);
247 std::stringstream str;
256 const bool fogged = viewing_team.
fogged(leader->get_location());
262 str << leader->image_mods();
264 leader_bools.push_back(
true);
265 leader_name = leader->name();
269 str <<
"~RC(magenta>" <<
teams()[
n].color() <<
")";
271 leader_bools.push_back(
false);
272 leader_name =
"Unknown";
276 leader_name =
teams()[
n].side_name();
279 leader_bools.push_back(
false);
289 items.push_back(str.str());
295 }
else if(enemy && viewing_team.
uses_fog()) {
308 items.push_back(str.str());
311 ERR_NG <<
"Logic error: map has " <<
map().
villages().size() <<
" villages but status table shows " << total_villages <<
" owned in total" << std::endl;
314 if (status_table_empty)
317 std::stringstream str;
319 for (
int i=0;
i<7;++
i)
321 leader_bools.push_back(
false);
322 items.push_back(str.str());
330 slist.set_menu(items, &sorter);
331 slist.get_menu().move_selection(selected);
332 result = slist.show();
333 selected = slist.get_menu().selection();
344 std::stringstream heading;
353 <<
_(
"scenario settings^Shroud");
360 std::vector<std::string>
items;
361 std::vector<bool> leader_bools;
362 items.push_back(heading.str());
365 bool settings_table_empty =
true;
368 for(
size_t n = 0;
n !=
teams().size(); ++
n) {
372 settings_table_empty =
false;
374 std::stringstream str;
380 fogged=viewing_team.
fogged(leader->get_location());
383 leader_bools.push_back(
true);
386 leader_bools.push_back(
false);
389 str <<
"~RC(" << leader->team_color() <<
'>'
393 leader_bools.push_back(
false);
406 items.push_back(str.str());
409 if (settings_table_empty)
412 std::stringstream str;
413 for (
int i=0;
i<8;++
i)
415 leader_bools.push_back(
false);
416 items.push_back(str.str());
421 slist.set_menu(items, &sorter);
422 slist.get_menu().move_selection(selected);
426 result = slist.show();
427 selected = slist.get_menu().selection();
452 }
while (res == 0 && overwrite != 0);
461 symbols[
"msg"] = e.
what();
478 c[
"name"] =
"prototype of chat log";
493 has_friends() ?
board().is_observer() ?
_(
"Send to observers only") :
_(
"Send to allies only")
511 if(
board().is_observer()) {
515 for(
size_t n = 0;
n !=
teams().size(); ++
n) {
526 std::vector<const unit_type*> sample_units;
532 for(std::set<std::string>::const_iterator it = recruits.begin(); it != recruits.end(); ++it) {
535 ERR_NG <<
"could not find unit '" << *it <<
"'" << std::endl;
539 sample_units.push_back(type);
542 if(sample_units.empty()) {
560 if ( last_recruit.empty() == false )
567 team ¤t_team =
teams()[side_num - 1];
578 _(
"You don’t have enough gold to recruit that unit"));
615 team ¤t_team =
teams()[side_num - 1];
625 DBG_WB <<
"menu_handler::recall: Contents of wb-modified recall list:\n";
633 _(
"There are no troops available to recall\n(You must have"
634 " veteran survivors from a previous scenario)"));
637 if(recall_list_team->empty()) {
639 _(
"You currently can't recall at the highlighted location"));
652 else if(recall_list_team->at(res)->recall_cost() > -1) {
653 unit_cost = recall_list_team->at(res)->recall_cost();
657 if (current_team.
gold() - wb_gold < unit_cost) {
659 i18n_symbols[
"cost"] = std::to_string(unit_cost);
661 "You must have at least 1 gold piece to recall a unit",
662 "You must have at least $cost gold pieces to recall this unit",
663 unit_cost, i18n_symbols);
668 LOG_NG <<
"recall index: " << res <<
"\n";
691 ERR_NG <<
"menu_handler::recall(): Unit does not exist in the recall list." << std::endl;
706 bool invisible = u->invisible(u->get_location());
708 if (
teams()[side_num - 1].is_enemy(u->side()) &&
709 !
gui_->
fogged(u->get_location()) && !u->incapacitated() && !invisible)
722 team ¤t_team =
teams()[side_num - 1];
744 if ( un->side() == side_num )
755 if ( un->side() == side_num ) {
759 && (!whiteb || !whiteb->unit_has_actions(&*un)) )
772 if ( un->side() == side_num ) {
773 if ( board.
unit_can_move(*un) && !un->has_moved() && !un->user_end_turn()
774 && (!whiteb || !whiteb->unit_has_actions(&*un)) )
789 size_t team_num =
static_cast<size_t>(side_num - 1);
790 if ( team_num <
teams().size() &&
teams()[team_num].no_turn_confirmation() ) {
797 units_alive(side_num,
units()) )
861 if (un->unrenamable())
891 typedef std::pair<const unit_type *, unit_race::GENDER> type_and_gender;
916 ERR_NG <<
"Create unit dialog returned nonexistent or unusable unit_type id '" << ut_id <<
"'." << std::endl;
929 return type_and_gender(utp, gender);
954 assert(
gui_ !=
nullptr);
957 type_and_gender selection = choose_unit(*
gui_);
958 if ( selection.first !=
nullptr )
961 *selection.first, selection.second);
969 if(!
map().is_village(loc))
976 if(team > static_cast<int> (
teams().
size())) {
981 int side = i->side();
983 if(side > static_cast<int> (
teams().
size())) {
988 if(
map().is_village(loc)) {
999 const int dying_side = i->side();
1017 if (
map().on_board(loc) ==
false) {
1057 if (i ==
units().
end() || !i->move_interrupted()) {
1059 if (i ==
units().
end() || !i->move_interrupted())
return;
1062 side_num, mousehandler);
1073 if(route.
steps.empty())
1076 assert(route.
steps.front() == ui->get_location());
1081 LOG_NG <<
"move_unit_to_loc " << route.
steps.front() <<
" to " << route.
steps.back() <<
"\n";
1094 bool wait_blocker_move =
true;
1095 std::set<map_location> fully_moved;
1097 bool change =
false;
1098 bool blocked_unit =
false;
1101 blocked_unit =
false;
1103 if (ui->side() != side || ui->movement_left() == 0)
1109 if(goto_loc == current_loc){
1114 if(!
map().on_board(goto_loc))
1118 if(fully_moved.count(current_loc))
1123 if(route.
steps.size() <= 1) {
1124 fully_moved.insert(current_loc);
1130 pathfind::marked_route::mark_map::const_iterator
w = route.
marks.begin();
1131 for(; w != route.
marks.end(); ++
w) {
1132 if (w->second.turns == 1) {
1133 next_stop = w->first;
1138 if(next_stop == current_loc) {
1139 fully_moved.insert(current_loc);
1146 blocked_unit =
true;
1147 if (wait_blocker_move)
1154 LOG_NG <<
"execute goto from " << route.
steps.front() <<
" to " << route.
steps.back() <<
"\n";
1161 wait_blocker_move =
true;
1165 if(!change && wait_blocker_move) {
1167 wait_blocker_move =
false;
1170 }
while(change && blocked_unit);
1193 if (un !=
units().
end() && un->side() == side_num && un->movement_left() >= 0)
1195 un->toggle_hold_position();
1201 if (un->hold_position()) {
1210 if (un !=
units().
end() && un->side() == side_num && un->movement_left() >= 0)
1212 un->toggle_user_end_turn();
1218 if (un->user_end_turn()) {
1226 std::ostringstream
msg;
1249 (
"message", message)
1350 return _(
"(D) — debug only, (N) — network only, (A) — admin only");
1356 return (c.has_flag(
'D') ? space +
_(
"(debug command)") :
"")
1357 + (c.has_flag(
'N') ? space +
_(
"(network only)") :
"")
1358 + (c.has_flag(
'A') ? space +
_(
"(admin only)") :
"")
1359 + (c.has_flag(
'S') ? space +
_(
"(not during other events)") :
"");
1385 _(
"Switch a side to/from AI control."),
_(
"do not translate the on/off^[<side> [on/off]]"));
1387 _(
"Switch a side to/from idle state."),
_(
"do not translate the on/off^[<side> [on/off]]"));
1390 _(
"Assign control of a side to a different player or observer."),
_(
"<side> <nickname>"),
"N");
1392 _(
"Query the controller status of a side."),
_(
"<side>"));
1394 _(
"Clear chat history."));
1396 _(
"Visualize the screen refresh procedure."),
"",
"D");
1398 _(
"Debug foreground terrain."),
"",
"D");
1400 _(
"Debug layers from terrain under the mouse."),
"",
"D");
1409 _(
"Save and quit."));
1412 _(
"Ignore replay errors."));
1414 _(
"Disable autosaves."));
1416 _(
"Advance to the next scenario, or scenario identified by 'id'"),
_(
"<id>"),
"DS");
1419 _(
"Choose next scenario"),
"",
"DS");
1422 _(
"Change turn number (and time of day), or increase by one if no number is specified."),
_(
"[turn]"),
"DS");
1424 _(
"Change turn limit, or turn the turn limit off if no number is specified or it’s −1."),
_(
"[limit]"),
"DS");
1426 _(
"Turn debug mode on."));
1428 _(
"Turn debug mode off."),
"",
"D");
1430 _(
"Execute a Lua statement."),
_(
"<command>[;<command>...]"),
"DS");
1432 _(
"Grant higher privileges to Lua scripts."),
"",
"D");
1434 _(
"Set the command used by the custom command hotkey"),
_(
"<command>[;<command>...]"));
1437 ,
_(
"Invoke a dialog allowing changing control of MP sides.")
1441 _(
"Launch the gamestate inspector"),
"",
"D");
1443 _(
"Set or show alias to a command"),
_(
"<name>[=<command>]"));
1445 _(
"Set a scenario variable."),
_(
"<var>=<value>"),
"DS");
1447 _(
"Show a scenario variable."),
_(
"<var>"),
"D");
1449 _(
"Modify a unit variable. (Only top level keys are supported.)"),
"",
"DS");
1456 _(
"Discover all units in help."),
"");
1458 _(
"'Undiscover' all units in help."),
"");
1460 _(
"Create a unit."),
"",
"DS");
1462 _(
"Toggle fog for the current player."),
"",
"DS");
1464 _(
"Toggle shroud for the current player."),
"",
"DS");
1466 _(
"Give gold to the current player."),
"",
"DS");
1468 _(
"Fire a game event."),
"",
"DS");
1471 _(
"Toggle overlaying of x,y coordinates on hexes."));
1474 _(
"Toggle overlaying of terrain codes on hexes."));
1477 _(
"Toggle planning mode."));
1480 _(
"Access whiteboard options dialog."));
1500 const time_t time = ::time(
nullptr);
1501 std::stringstream ss;
1503 cfg[
"time"] = ss.str();
1506 if(!
board().is_observer()) {
1512 if(private_message) {
1513 if (
board().is_observer()) {
1529 if(new_search.empty() ==
false && new_search !=
last_search_)
1538 if(args.size() == 2) {
1540 x = lexical_cast_default<int>(args[0], 0)-1;
1541 y = lexical_cast_default<int>(args[1], 0)-1;
1542 if(x >= 0 && x <
map().
w() && y >= 0 && y <
map().
h()) {
1548 if(loc.
valid() ==
false)
1553 loc.
x = (loc.
x + 1) %
map().
w();
1555 loc.
y = (loc.
y + 1) %
map().
h();
1562 if(std::search(label_text.begin(), label_text.end(),
1574 if(std::search(name.begin(), name.end(),
1578 !ui->invisible(ui->get_location())) {
1599 "containing the string ‘$search’.", symbols);
1634 const unsigned int side = side_s.empty() ?
1635 team_num_ : lexical_cast_default<unsigned int>(side_s);
1639 symbols[
"side"] = side_s;
1644 symbols[
"side"] = std::to_string(side);
1648 if (
menu_handler_.
teams()[side - 1].is_droid() ? action ==
" on" : action ==
" off") {
1654 psc->set_player_type_changed();
1662 symbols[
"side"] = side_s;
1673 const unsigned int side = side_s.empty() ?
1674 team_num_ : lexical_cast_default<unsigned int>(side_s);
1678 symbols[
"side"] = side_s;
1683 symbols[
"side"] = std::to_string(side);
1688 symbols[
"side"] = std::to_string(side);
1692 if (
menu_handler_.
teams()[side - 1].is_idle() ? action ==
" on" : action ==
" off") {
1699 psc->set_player_type_changed();
1730 unsigned int side_num;
1737 symbols[
"side"] = side;
1742 side_num = it_t->side();
1747 symbols[
"side"] = side;
1757 unsigned int side_num;
1762 symbols[
"side"] = side;
1768 symbols[
"side"] = side;
1775 report +=
" (" +
menu_handler_.
teams()[side_num - 1].proxy_controller().to_string() +
")";
1778 report +=
" (networked)";
1788 int delay = lexical_cast_default<int>(
get_data());
1800 std::vector<std::string> layers;
1813 layers.push_back(heading);
1835 std::ostringstream str;
1843 if(loc_cut.
valid()) {
1846 ((tz*3) / 4) * loc_cut.
x
1847 , tz * loc_cut.
y + (tz / 2) * (loc_cut.
x % 2)
1863 if(r2.w > 0 && r2.h > 0) {
1866 << r2.x <<
"," << r2.y <<
","
1867 << r2.w <<
"," << r2.h
1869 <<
"," << r2.x-r.x <<
"," << r2.y-r.y
1871 <<
"~MASK(" <<
"terrain/alphamask.png" <<
")";
1874 str << COLUMN_SEPARATOR
1877 << COLUMN_SEPARATOR << img.
get_loc()
1878 << COLUMN_SEPARATOR << ri->
layer
1879 << COLUMN_SEPARATOR << ri->
basex
1880 << COLUMN_SEPARATOR << ri->
basey
1883 layers.push_back(str.str());
1887 std::vector<std::string>
flags(tile->
flags.begin(),tile->
flags.end());
1888 std::ostringstream
info;
1926 std::vector<std::string>
options;
1927 int next = 0, nb = 0;
1931 options.push_back(
id);
1941 if (
mp[
"id"] == scenario)
1944 options.push_back(
id);
1948 scenario =
mp[
"next_scenario"].str();
1951 std::sort(options.begin(), options.end());
1963 if (
size_t(choice) < options.size()) {
1972 int turn = tod_man.
turn() + 1;
1974 if (!data.empty()) {
1975 turn = lexical_cast_default<int>(
data, 1);
2013 _(
"You are about to open a security breach in Wesnoth. Are you sure you want to continue? If you have downloaded add-ons, do not click 'ok'! They would instantly take over your computer. You have been warned."),
2026 const std::string::const_iterator j =
std::find(data.begin(),data.end(),
'=');
2028 if(j != data.end()) {
2030 if (!command.empty()) {
2044 print(
get_cmd(),
"'"+alias+
"'" +
" = " +
"'"+command+
"'");
2053 const std::string::const_iterator j =
std::find(data.begin(),data.end(),
'=');
2054 if(j != data.end()) {
2089 if (parameters.size() < 2) {
2093 if (parameters[0] ==
"alignment") {
2094 unit_type::ALIGNMENT alignment;
2095 if (!alignment.parse(parameters[1]))
2098 symbols[
"alignment"] =
get_arg(1);
2099 command_failed(
VGETTEXT(
"Invalid alignment: '$alignment', needs to be one of lawful, neutral, chaotic, or liminal.", symbols));
2108 for(
const unit_type_data::unit_type_map::value_type &
i :
unit_types.
types()) {
2162 whiteb->set_active(!whiteb->is_active());
2163 if (whiteb->is_active()) {
2165 whiteb->print_help_once();
2218 for (; c != commands.end() ; ++
c) {
void command_failed(const std::string &message, bool=false)
void label_terrain(mouse_handler &mousehandler, bool team_only)
std::pair< const rule_image_rand *, const rule_image_variant * > log_details
static void sunset(const size_t delay=0)
Debug function to toggle the "sunset" mode.
bool is_enabled(const chmap::command &c) const
int layer
The layer of the image for horizontal layering.
surface get_image(const image::locator &i_locator, TYPE type)
function to get the surface corresponding to an image.
menu_handler & menu_handler_
child_itors child_range(const std::string &key)
virtual void highlight_hex(map_location hex)
Function to highlight a location.
int show_file_chooser_dialog_save(CVideo &video, std::string &filename, std::string const &title, const std::string &default_file_name, bool show_directory_buttons, const std::string &type_a_head, int xloc, int yloc)
Show a filechooser dialog in a "save" mode, that is, without relying on autocomplete to allow saving ...
SDL_Rect intersect_rects(SDL_Rect const &rect1, SDL_Rect const &rect2)
Calculates the intersection of two rectangles.
void do_search(const std::string &new_search)
void set_current_paths(const pathfind::paths &new_paths)
events::mouse_handler & get_mouse_handler_base()
Get a reference to a mouse handler member a derived class uses.
const std::string & id() const
bool fogged(const map_location &loc) const
Returns true if location (x,y) is covered in fog.
char const IMG_TEXT_SEPARATOR
virtual void send_to_wesnothd(const config &, const std::string &="unknown") const
void show_help(CVideo &video, const std::string &show_topic, int xloc, int yloc)
Open the help browser, show topic with id show_topic.
void goto_leader(int side_num)
static bool execute(std::string &label, bool &team_only, CVideo &video)
The execute function see tdialog for more information.
std::string const & gender_string(unit_race::GENDER gender)
tile * get_tile(const map_location &loc)
GLuint GLdouble GLdouble GLint GLint order
void invalidate_game_status()
Function to invalidate the game status displayed on the sidebar.
static std::string get_side_highlight(int side)
void set_draw_terrain_codes(bool value)
Setter for the terrain code debug overlay on tiles.
size_t move_unit_and_record(const std::vector< map_location > &steps, undo_list *undo_stack, bool continued_move, bool show_move, bool *interrupted, move_unit_spectator *move_spectator)
Moves a unit across the board.
bool invalidate(const map_location &loc)
Function to invalidate a specific tile for redrawing.
map_location last_search_hit_
int recall_dialog(display &disp, const boost::shared_ptr< std::vector< unit_const_ptr > > &units, int side, const std::string &title_suffix, const int team_recall_cost)
bool get_draw_terrain_codes() const
Getter for the terrain code debug overlay on tiles.
const t_string & name() const
The unit name for display.
const util::scoped_ptr< gui::button > & check() const
static void toggle_benchmark()
Toggle to continuously redraw the screen.
Various functions implementing vision (through fog of war and shroud).
const mp_game_settings & get_mp_settings()
const char * what() const
bool get_village(const map_location &loc, int side, bool *action_timebonus, bool fire_event)
Makes it so the village at the given location is owned by the given side.
void speak(const config &cfg)
menu_handler(game_display *gui, play_controller &pc, const config &game_config)
Various functions that implement attacks and attack calculations.
map_command_handler< console_handler > chmap
std::string current_team_name() const
bool contains(const Container &container, const Value &value)
Returns true iff value is found in container.
unit_iterator find_leader(int side)
static config get_recall(const std::string &unit_id, const map_location &loc, const map_location &from)
GLuint GLuint GLsizei GLenum type
bool show(CVideo &video, const unsigned auto_close_time=0)
Shows the window.
void clear_chat_messages()
SDL_Color int_to_color(const Uint32 rgb)
void(chat_command_handler::* command_handler)()
pathfind::marked_route get_route(const unit *un, map_location go_to, team &team) const
static int report(lua_State *L, int status)
std::string private_message
void add_chat_message(const time_t &time, const std::string &speaker, int side, const std::string &message, events::chat_handler::MESSAGE_TYPE type=events::chat_handler::MESSAGE_PRIVATE)
bool is_enemy(int n) const
void do_command(const std::string &str)
Represent a rule_image applied with a random seed.
attribute_map::value_type attribute
void redraw_everything()
Invalidates entire screen, including all tiles and sidebar.
const t_string & objectives() const
gui::floating_textbox & get_textbox()
void request_control_change(int side_num, const std::string &player)
void invalidate_unit()
Function to invalidate that unit status displayed on the sidebar.
void do_whiteboard_options()
static void set_sunset(const unsigned interval)
The class terrain_builder is constructed from a config object, and a gamemap object.
std::string get_title_suffix(int side_num)
std::string get_flags_description() const
static config get_auto_shroud(bool turned_on)
Records that the player has toggled automatic shroud updates.
unit_type_data unit_types
void print(const std::string &title, const std::string &message)
bool fire(const std::string &event, const entity_location &loc1=entity_location::null_entity, const entity_location &loc2=entity_location::null_entity, const config &data=config())
Function to fire an event.
int basex
The position of the image base (that is, the point where the image reaches the floor) for vertical la...
void update_shroud_now(int side_num)
int village_owner(const map_location &loc) const
Given the location of a village, will return the 0-based index of the team that currently owns it...
void show_transient_message(CVideo &video, const std::string &title, const std::string &message, const std::string &image, const bool message_use_markup, const bool title_use_markup, const bool restore_background)
Shows a transient message to the user.
void check_victory()
Checks to see if a side has won.
virtual bool is_enabled(const command &) const
GLint GLint GLint GLint GLint GLint y
const std::string & choice() const
Unit type choice from the user.
virtual void assert_existence(const std::string &cmd)
const std::vector< std::string > items
void show_unit_description(CVideo &video, const unit &u)
virtual void draw()
Draws invalidated items.
const map_location & get_last_hex() const
int show(int xloc, int yloc)
Contains the exception interfaces used to signal completion of a scenario, campaign or turn...
virtual std::string get_arg(unsigned i) const
terrain_builder & get_builder()
GLsizeiptr const GLvoid GLenum usage
bool is_background() const
GLint GLenum GLsizei GLint GLsizei const GLvoid * data
bool show_theme_dialog(CVideo &video)
To lexical_cast(From value)
Lexical cast converts one type to another.
void create_unit(mouse_handler &mousehandler)
Creates a unit (in debug mode via hotkey or context menu).
bool unit_can_move(const unit &u) const
Will return true iff the unit u has any possible moves it can do (including attacking etc)...
void redraw_minimap()
Schedule the minimap to be redrawn.
save_id_matches(const std::string &save_id)
static synced_state get_synced_state()
map_location get_selected_hex() const
std::vector< unit_const_ptr > get_recalls(int side, const map_location &recall_loc)
Gets the recallable units for a side, restricted by that side's leaders' personal abilities to recall...
std::vector< std::string > get_commands_list() const
static config get_update_shroud()
Records that the player has manually updated fog/shroud.
void show_statistics(int side_num)
const std::string & last_recruit() const
const map_location & get_loc() const
void rebuild_cache(const std::string &tod, logs *log=nullptr)
Rebuilds the whole image cache, for a given time-of-day.
const terrain_label * set_label(const map_location &loc, const t_string &text, const int creator=-1, const std::string &team="", const SDL_Color color=font::NORMAL_COLOR, const bool visible_in_fog=true, const bool visible_in_shroud=false, const bool immutable=false, const std::string &category="", const t_string &tooltip="")
Represents a tile of the game map, with all associated builder-specific parameters: flags...
boost::scoped_ptr< game_lua_kernel > lua_kernel_
void do_consolesave(const std::string &filename)
This module controls the multiplayer lobby.
STRIP_SPACES : strips leading and trailing blank spaces.
game_events::t_pump & pump()
This class stores all the data for a single 'side' (in game nomenclature).
bool end_turn(int side_num)
std::string half_signed_value(int val)
Sign with Unicode "−" if negative.
static UNUSEDNOWARN std::string _(const char *str)
console_handler(menu_handler &menu_handler)
virtual void register_alias(const std::string &to_cmd, const std::string &cmd)
void dispatch(std::string cmd)
void toggle_shroud_updates(int side_num)
void set_custom_command(const std::string &command)
static bool execute(const std::string &title, const std::string &label, std::string &text, CVideo &video)
Executes the dialog.
GLsizei const char ** path
void throw_quit_game_exception()
bool chars_equal_insensitive(char a, char b)
void do_ignore_replay_errors()
const t_string & text() const
Dialog is closed with ok button.
void scroll_to_leader(int side, SCROLL_TYPE scroll_type=ONSCREEN, bool force=true)
Scrolls to the leader of a certain side.
std::map< std::string, t_string > string_map
bool auto_shroud_updates() const
virtual void register_alias(const std::string &to_cmd, const std::string &cmd)
virtual void assert_existence(const std::string &cmd)
std::vector< team > * teams
game_board & board() const
std::vector< team > teams_
const unit_type_map & types() const
virtual config::attribute_value get_variable_const(const std::string &varname) const
returns a blank attribute value if varname is no valid variable name.
const std::set< std::string > get_recruits(int side, const map_location &recruit_loc)
Gets the recruitable units from a side's leaders' personal recruit lists who can recruit on or from a...
void do_create()
Implements the (debug mode) console command that creates a unit.
Applies the planned unit map for the duration of the struct's life.
std::string get_user_data_dir()
void clear(const std::string &, bool force)
Dialog is closed with the cancel button.
void write_file(const std::string &fname, const std::string &data)
Throws io_exception if an error occurs.
static void ignore_error_function(const std::string &message, bool heavy)
a function to be passed to run_in_synced_context to ignore the error.
bool operator()(const team &t)
GLubyte GLubyte GLubyte GLubyte w
void do_toggle_draw_coordinates()
void show_preferences_dialog(CVideo &video, const config &game_cfg, const DIALOG_OPEN_TO initial_view)
t_string get_scenario_name()
GLsizei const GLfloat * value
bool get_draw_coordinates() const
Getter for the x,y debug overlay on tiles.
bool ignore_replay_errors
void set_menu(menu *const m)
void set_draw_coordinates(bool value)
Setter for the x,y debug overlay on tiles.
int w() const
Effective map width.
void recall(int side_num, const map_location &last_hex)
void status_table(int selected=0)
void show_message(CVideo &video, const std::string &title, const std::string &message, const std::string &button_caption, const bool auto_close, const bool message_use_markup)
Shows a message to the user.
const config & game_config_
bool empty() const
Is it empty?
GLboolean GLboolean GLboolean GLboolean a
void end_unit_turn(mouse_handler &mousehandler, int side_num)
void set_show_fps(bool value)
Encapsulates the map of the game.
void show_unit_list(display &gui)
const std::vector< unit_race::GENDER > & genders() const
The returned vector will not be empty, provided this has been built to the HELP_INDEXED status...
Shows an ok and cancel button.
void recalculate_fog(int side)
Function that recalculates the fog of war.
void recruit(int side_num, const map_location &last_hex)
std::vector< team > & teams() const
int selected_index() const
Returns the selected item index after displaying.
void do_speak(const std::string &message, bool allies_only=false)
Object which temporarily resets a unit's movement.
void add_rename(const std::string &name, const map_location &loc)
void highlight_another_reach(const pathfind::paths &paths_list)
Add more paths to highlight.
const std::string & team_name() const
Managing the AIs lifecycle - headers.
virtual std::string get_cmd() const
Structure which holds a single route and marks for special events.
virtual const time_of_day & get_time_of_day(const map_location &loc=map_location::null_location()) const
void reset_objectives_changed() const
std::string get_command_flags_description(const map_command_handler< chat_command_handler >::command &c) const
game_state & gamestate() const
static const map_location & null_location()
void invalidate_all()
Function to invalidate all tiles.
std::string get_dir(const std::string &dir)
void set_message_private(bool value)
std::vector< log_details > logs
bool no_choice() const
Whether the user actually chose a unit type or not.
std::vector< animated< image::locator > > images
An animated image locator built according to the image string.
GLuint GLuint GLsizei count
cl_event GLbitfield flags
void show_terrain_description(CVideo &video, const terrain_type &t)
const terrain_label * get_label(const map_location &loc, const std::string &team_name) const
const std::string & save_id() const
bool do_recruit(const std::string &name, int side_num, const map_location &last_hex)
std::string join(T const &v, const std::string &s=",")
Generates a new string joining container items in a list.
Encapsulates the map of the game.
const terrain_type & get_terrain_info(const t_translation::t_terrain &terrain) const
Various functions related to moving units.
const std::string & get_filename() const
void unit_die(const map_location &loc, unit &loser, const attack_type *attack, const attack_type *secondary_attack, const map_location &winner_loc, unit *winner)
Show a unit fading out.
static bool execute(display_context &dc, CVideo &video)
The execute function.
Various functions related to the creation of units (recruits, recalls, and placed units)...
actions::undo_list & get_undo_stack()
void recalculate_labels()
static const std::string evaluate_command(side_number side, const std::string &str)
Evaluates a string command using command AI.
void continue_move(mouse_handler &mousehandler, int side_num)
void add_alias(const std::string &alias, const std::string &command)
int h() const
Effective map height.
void scroll_to_tile(const map_location &loc, SCROLL_TYPE scroll_type=ONSCREEN, bool check_fogged=true, bool force=true)
Scroll such that location loc is on-screen.
void unhighlight_reach()
Reset highlighting of paths.
const std::string space
whitespace is possible
void execute_gotos(mouse_handler &mousehandler, int side_num)
void set_selected_index(int index)
Sets the initially selected item index (-1 by default).
Game configuration data as global variables.
bool shrouded(const map_location &loc) const
Returns true if location (x,y) is covered in shroud.
An exception object used when an IO error occurs.
const std::string & next_scenario() const
const SDL_Color LABEL_COLOR
static void set_cmd_prefix(std::string value)
std::set< std::string > flags
The list of flags present in this tile.
void terrain_description(mouse_handler &mousehandler)
Define the game's event mechanism.
const std::string & parameters
GLfloat GLfloat GLfloat GLfloat h
const util::scoped_ptr< gui::textbox > & box() const
std::string find_recall_location(const int side, map_location &recall_location, map_location &recall_from, const unit &unit_recall)
Finds a location on which to recall unit_recall.
ONLY IF whiteboard is currently active, applies the planned unit map for the duration of the struct's...
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
GLint GLint GLint GLint GLint x
void unit_hold_position(mouse_handler &mousehandler, int side_num)
virtual std::string get_arg(unsigned argn) const
bool fogged(const map_location &loc) const
void change_side(mouse_handler &mousehandler)
virtual std::string get_data(unsigned n=1) const
std::set< std::string > & encountered_units()
GLdouble GLdouble GLdouble r
Definitions for the terrain builder.
int center_x
The position where the center of the image base should be.
void show(gui::TEXTBOX_MODE mode, const std::string &label, const std::string &check_label, bool checked, game_display &gui)
static int sort(lua_State *L)
void set_ellipses(bool ison)
void objectives(int side_num)
void cycle_units(const bool browse, const bool reverse=false)
bool get_disallow_recall()
void kill_unit(mouse_handler &mousehandler)
void scenario_settings_table(int selected=0)
virtual std::string get_cmd() const
const command * get_command(const std::string &cmd) const
Handling of system events.
GLuint const GLchar * name
virtual const gamemap & map() const
size_t erase(const map_location &l)
Erases the unit at location l, if any.
const game_classification & get_classification()
SDL_Rect create_rect(const int x, const int y, const int w, const int h)
Creates an empty SDL_Rect.
bool on_board(const map_location &loc) const
Tell if a location is on the map.
bool knows_about_team(size_t index) const
display_chat_manager & get_chat_manager()
void do_toggle_whiteboard()
static bool run_and_throw(const std::string &commandname, const config &data, bool use_undo=true, bool show=true, synced_command::error_handler_function error_handler=default_error_function)
To store label data Class implements logic for rendering.
char const HEADING_PREFIX
boost::shared_ptr< wb::manager > get_whiteboard()
char const COLUMN_SEPARATOR
unit_map::iterator current_unit()
const std::string & side_name() const
bool find(E event, F functor)
Tests whether an event handler is available.
bool player_acted() const
Returns true if the player has performed any actions this turn.
void show_enemy_moves(bool ignore_units, int side_num)
const std::set< std::string > & observers() const
static UNUSEDNOWARN std::string sgettext(const char *str)
A variable-expanding proxy for the config class.
Various functions that implement the undoing (and redoing) of in-game commands.
std::string find_recruit_location(const int side, map_location &recruit_location, map_location &recruited_from, const std::string &unit_type)
Finds a location on which to place a unit.
void set_action_bonus_count(const int count)
Standard logging facilities (interface).
game_display & get_display()
Get a reference to a display member a derived class uses.
CVideo & video()
Gets the underlying screen object.
Object which contains all the possible locations a unit can move to, with associated best routes to t...
recall_list_manager & recall_list()
bool is_observer() const
Check if we are an observer in this game.
Container associating units to locations.
GLsizei GLenum GLuint GLuint GLsizei char * message
static std::string get_side_color_index(int side)
static vconfig empty_vconfig()
int get_selected_index() const
const unit_type * find(const std::string &key, unit_type::BUILD_STATUS status=unit_type::FULL) const
Finds a unit_type by its id() and makes sure it is built to the specified level.
static config get_recruit(const std::string &type_id, const map_location &loc, const map_location &from)
std::vector< std::string > split(std::string const &val, const char c, const int flags)
Splits a (comma-)separated string into a vector of pieces.
virtual std::string get_data(unsigned argn=1) const
unit_iterator find(size_t id)
size_t viewing_team() const
The viewing team is the team currently viewing the game.
static Uint32 get_side_rgb(int side)
virtual bool is_networked_mp() const
std::string signed_value(int val)
Convert into a signed value (using the Unicode "−" and +0 convention.
const std::string & str() const
virtual void register_command(const std::string &cmd, command_handler h, const std::string &help="", const std::string &usage="", const std::string &flags="")
gui::floating_textbox textbox_info_
std::string get_command_flags_description(const chmap::command &c) const
void send_to_server(const config &cfg) override
A config object defines a single node in a WML file, with access to child nodes.
void add_chat_message(const time_t &time, const std::string &speaker, int side, const std::string &msg, events::chat_handler::MESSAGE_TYPE type, bool bell)
void notify_event(const std::string &name, const config &data)
void do_toggle_draw_terrain_codes()
const config & get_alias()
int action_bonus_count() const
void set_route(const pathfind::marked_route *route)
Sets the route along which footsteps are drawn to show movement of a unit.
std::string custom_command()
unit_race::GENDER gender()
Gender choice from the user.
std::vector< std::string > get_commands_list()
const std::vector< map_location > & villages() const
Return a list of the locations of villages on the map.
void send_chat_message(const std::string &message, bool allies_only=false)
void repeat_recruit(int side_num, const map_location &last_hex)
void move_unit_to_loc(const unit_map::iterator &ui, const map_location &target, bool continue_move, int side_num, mouse_handler &mousehandler)
bool file_exists(const std::string &name)
Returns true if a file or directory with such name already exists.
void write(std::ostream &out, configr_of const &cfg, unsigned int level)
Thrown when a lexical_cast fails.
void close(game_display &gui)
void clear_labels(const std::string &, bool)
static void toggle_debug_foreground()
Toggle to debug foreground terrain.
GLsizei const GLcharARB ** string
const unsigned int team_num_
Shows a yes and no button.
unit_map::iterator find_visible_unit(const map_location &loc, const team ¤t_team, bool see_all=false)
Display units performing various actions: moving, attacking, and dying.
virtual void register_command(const std::string &cmd, chat_command_handler::command_handler h, const std::string &help="", const std::string &usage="", const std::string &flags="")
team_data calculate_team_data(const class team &tm, int side) const
void show_objectives(const std::string &scenarioname, const std::string &objectives)
std::vector< map_location > & steps
const std::string & id() const
The id for this unit_type.
static plugins_manager * get()
void add_label(const terrain_label *)
const std::string observer_team_name
observer team name used for observer team chat
std::string get_actual_cmd(const std::string &cmd) const
void do_ai_formula(const std::string &str, int side_num, mouse_handler &mousehandler)
void command_failed_need_arg(int argn)