#include "synced_commands.hpp"
#include <cassert>
#include "log.hpp"
#include "resources.hpp"
#include "map/location.hpp"
#include "game_data.hpp"
#include "units/unit.hpp"
#include "team.hpp"
#include "play_controller.hpp"
#include "actions/create.hpp"
#include "actions/attack.hpp"
#include "actions/move.hpp"
#include "actions/undo.hpp"
#include "preferences.hpp"
#include "game_preferences.hpp"
#include "game_events/manager.hpp"
#include "game_events/pump.hpp"
#include "units/helper.hpp"
#include "recall_list_manager.hpp"
#include "scripting/game_lua_kernel.hpp"
#include "formula/string_utils.hpp"
#include "units/types.hpp"
#include "units/udisplay.hpp"
Go to the source code of this file.
Macros | |
#define | DBG_REPLAY LOG_STREAM(debug, log_replay) |
#define | LOG_REPLAY LOG_STREAM(info, log_replay) |
#define | WRN_REPLAY LOG_STREAM(warn, log_replay) |
#define | ERR_REPLAY LOG_STREAM(err, log_replay) |
Functions | |
SYNCED_COMMAND_HANDLER_FUNCTION (recruit, child, use_undo, show, error_handler) | |
SYNCED_COMMAND_HANDLER_FUNCTION (recall, child, use_undo, show, error_handler) | |
SYNCED_COMMAND_HANDLER_FUNCTION (attack, child,, show, error_handler) | |
SYNCED_COMMAND_HANDLER_FUNCTION (disband, child,,, error_handler) | |
SYNCED_COMMAND_HANDLER_FUNCTION (move, child, use_undo, show, error_handler) | |
SYNCED_COMMAND_HANDLER_FUNCTION (fire_event, child, use_undo,,) | |
SYNCED_COMMAND_HANDLER_FUNCTION (lua_ai, child,,,) | |
SYNCED_COMMAND_HANDLER_FUNCTION (auto_shroud, child, use_undo,,) | |
SYNCED_COMMAND_HANDLER_FUNCTION (update_shroud,, use_undo,, error_handler) | |
from resources::undo_stack->commit_vision(bool is_replay): Updates fog/shroud based on the undo stack, then updates stack as needed. More... | |
SYNCED_COMMAND_HANDLER_FUNCTION (debug_unit, child, use_undo,,) | |
SYNCED_COMMAND_HANDLER_FUNCTION (debug_create_unit, child, use_undo,, error_handler) | |
SYNCED_COMMAND_HANDLER_FUNCTION (debug_lua, child, use_undo,,) | |
SYNCED_COMMAND_HANDLER_FUNCTION (debug_next_level, child, use_undo,,) | |
SYNCED_COMMAND_HANDLER_FUNCTION (debug_turn_limit, child, use_undo,,) | |
SYNCED_COMMAND_HANDLER_FUNCTION (debug_turn, child, use_undo,,) | |
SYNCED_COMMAND_HANDLER_FUNCTION (debug_set_var, child, use_undo,,) | |
SYNCED_COMMAND_HANDLER_FUNCTION (debug_gold, child, use_undo,,) | |
SYNCED_COMMAND_HANDLER_FUNCTION (debug_event, child, use_undo,,) | |
SYNCED_COMMAND_HANDLER_FUNCTION (debug_fog,, use_undo,,) | |
SYNCED_COMMAND_HANDLER_FUNCTION (debug_shroud,, use_undo,,) | |
Variables | |
static lg::log_domain | log_replay ("replay") |
#define DBG_REPLAY LOG_STREAM(debug, log_replay) |
Definition at line 41 of file synced_commands.cpp.
Referenced by SYNCED_COMMAND_HANDLER_FUNCTION().
#define ERR_REPLAY LOG_STREAM(err, log_replay) |
Definition at line 44 of file synced_commands.cpp.
#define LOG_REPLAY LOG_STREAM(info, log_replay) |
Definition at line 42 of file synced_commands.cpp.
Referenced by SYNCED_COMMAND_HANDLER_FUNCTION().
#define WRN_REPLAY LOG_STREAM(warn, log_replay) |
Definition at line 43 of file synced_commands.cpp.
Referenced by SYNCED_COMMAND_HANDLER_FUNCTION().
SYNCED_COMMAND_HANDLER_FUNCTION | ( | recruit | , |
child | , | ||
use_undo | , | ||
show | , | ||
error_handler | |||
) |
Definition at line 65 of file synced_commands.cpp.
References resources::controller, unit_type::cost(), play_controller::current_side(), gui2::event::find(), unit_type_data::find(), actions::find_recruit_location(), resources::gamedata, team::gold(), LOG_REPLAY, actions::recruit_unit(), gui2::tip::show(), unit_types, and resources::units.
SYNCED_COMMAND_HANDLER_FUNCTION | ( | recall | , |
child | , | ||
use_undo | , | ||
show | , | ||
error_handler | |||
) |
Definition at line 129 of file synced_commands.cpp.
References resources::controller, play_controller::current_side(), resources::gamedata, actions::recall_unit(), and gui2::tip::show().
SYNCED_COMMAND_HANDLER_FUNCTION | ( | attack | , |
child | , | ||
show | , | ||
error_handler | |||
) |
Definition at line 147 of file synced_commands.cpp.
References attack_unit_and_advance(), config::child(), actions::undo_list::clear(), DBG_REPLAY, unit_map::find(), resources::gamedata, LOG_REPLAY, gui2::tip::show(), resources::undo_stack, resources::units, unit_map::iterator_base< iter_types >::valid(), and WRN_REPLAY.
SYNCED_COMMAND_HANDLER_FUNCTION | ( | disband | , |
child | , | ||
error_handler | |||
) |
Definition at line 228 of file synced_commands.cpp.
References actions::undo_list::add_dismissal(), resources::controller, play_controller::current_side(), recall_list_manager::erase_if_matches_id(), recall_list_manager::find_if_matches_id(), team::recall_list(), recall_list_manager::size(), and resources::undo_stack.
SYNCED_COMMAND_HANDLER_FUNCTION | ( | move | , |
child | , | ||
use_undo | , | ||
show | , | ||
error_handler | |||
) |
Definition at line 252 of file synced_commands.cpp.
References resources::controller, play_controller::current_side(), unit_map::find(), game_board::find_visible_unit(), resources::gameboard, team::is_local_ai(), team::is_network_ai(), actions::move_unit_from_replay(), read_locations(), gui2::tip::show(), preferences::show_ai_moves(), resources::undo_stack, resources::units, unit_map::iterator_base< iter_types >::valid(), and WRN_REPLAY.
SYNCED_COMMAND_HANDLER_FUNCTION | ( | fire_event | , |
child | , | ||
use_undo | |||
) |
Definition at line 318 of file synced_commands.cpp.
References actions::undo_list::add_dummy(), config::child(), actions::undo_list::clear(), game_events::t_pump::fire(), resources::game_events, resources::gamedata, game_events::manager::pump(), and resources::undo_stack.
SYNCED_COMMAND_HANDLER_FUNCTION | ( | lua_ai | , |
child | |||
) |
Definition at line 345 of file synced_commands.cpp.
References resources::lua_kernel, and lua_kernel_base::run().
SYNCED_COMMAND_HANDLER_FUNCTION | ( | auto_shroud | , |
child | , | ||
use_undo | |||
) |
Definition at line 353 of file synced_commands.cpp.
References actions::undo_list::add_auto_shroud(), resources::controller, play_controller::current_team(), team::set_auto_shroud_updates(), and resources::undo_stack.
SYNCED_COMMAND_HANDLER_FUNCTION | ( | update_shroud | , |
use_undo | , | ||
error_handler | |||
) |
from resources::undo_stack->commit_vision(bool is_replay): Updates fog/shroud based on the undo stack, then updates stack as needed.
Call this when "updating shroud now". This may fire events and change the game state.
[in] | is_replay | Set to true when this is called during a replay. |
this means it ia synced command liek any other.
Definition at line 376 of file synced_commands.cpp.
References actions::undo_list::add_update_shroud(), team::auto_shroud_updates(), actions::undo_list::commit_vision(), resources::controller, play_controller::current_team(), and resources::undo_stack.
SYNCED_COMMAND_HANDLER_FUNCTION | ( | debug_unit | , |
child | , | ||
use_undo | |||
) |
Definition at line 396 of file synced_commands.cpp.
References unit_map::add(), advance_unit_at(), config::child_or_add(), actions::undo_list::clear(), unit_map::erase(), unit_map::find(), i, display::invalidate(), game_display::invalidate_unit(), lexical_cast(), resources::screen, utils::split(), resources::undo_stack, resources::units, and unit_map::iterator_base< iter_types >::valid().
SYNCED_COMMAND_HANDLER_FUNCTION | ( | debug_create_unit | , |
child | , | ||
use_undo | , | ||
error_handler | |||
) |
Definition at line 455 of file synced_commands.cpp.
References actions::actor_sighted(), actions::undo_list::clear(), actions::shroud_clearer::clear_unit(), resources::controller, play_controller::current_side(), unit_type_data::find(), game_events::t_pump::fire(), resources::game_events, resources::gameboard, actions::get_village(), game_display::invalidate_unit(), unit::new_turn(), unit_race::NUM_GENDERS, game_events::manager::pump(), unit_map::replace(), resources::screen, unit::side(), string_gender(), resources::undo_stack, unit_display::unit_recruited(), unit_types, and resources::units.
SYNCED_COMMAND_HANDLER_FUNCTION | ( | debug_lua | , |
child | , | ||
use_undo | |||
) |
Definition at line 497 of file synced_commands.cpp.
References actions::undo_list::clear(), resources::controller, game_events::t_pump::flush_messages(), resources::lua_kernel, play_controller::pump(), lua_kernel_base::run(), and resources::undo_stack.
SYNCED_COMMAND_HANDLER_FUNCTION | ( | debug_next_level | , |
child | , | ||
use_undo | |||
) |
Definition at line 509 of file synced_commands.cpp.
References transient_end_level::carryover_report, actions::undo_list::clear(), resources::controller, e, play_controller::force_end_turn(), resources::gamedata, end_level_data::is_victory, transient_end_level::linger_mode, end_level_data::prescenario_save, end_level_data::proceed_to_next_level, play_controller::set_end_level_data(), end_level_data::transient, and resources::undo_stack.
SYNCED_COMMAND_HANDLER_FUNCTION | ( | debug_turn_limit | , |
child | , | ||
use_undo | |||
) |
Definition at line 533 of file synced_commands.cpp.
References actions::undo_list::clear(), display::redraw_everything(), resources::screen, tod_manager::set_number_of_turns(), resources::tod_manager, and resources::undo_stack.
SYNCED_COMMAND_HANDLER_FUNCTION | ( | debug_turn | , |
child | , | ||
use_undo | |||
) |
Definition at line 546 of file synced_commands.cpp.
References actions::undo_list::clear(), resources::gamedata, game_display::new_turn(), display::redraw_everything(), resources::screen, tod_manager::set_turn(), resources::tod_manager, and resources::undo_stack.
SYNCED_COMMAND_HANDLER_FUNCTION | ( | debug_set_var | , |
child | , | ||
use_undo | |||
) |
Definition at line 562 of file synced_commands.cpp.
References actions::undo_list::clear(), resources::gamedata, game_data::set_variable(), and resources::undo_stack.
SYNCED_COMMAND_HANDLER_FUNCTION | ( | debug_gold | , |
child | , | ||
use_undo | |||
) |
Definition at line 580 of file synced_commands.cpp.
References actions::undo_list::clear(), resources::controller, play_controller::current_team(), display::redraw_everything(), resources::screen, team::spend_gold(), and resources::undo_stack.
SYNCED_COMMAND_HANDLER_FUNCTION | ( | debug_event | , |
child | , | ||
use_undo | |||
) |
Definition at line 594 of file synced_commands.cpp.
References actions::undo_list::clear(), resources::controller, game_events::t_pump::fire(), play_controller::pump(), display::redraw_everything(), resources::screen, and resources::undo_stack.
SYNCED_COMMAND_HANDLER_FUNCTION | ( | debug_fog | , |
use_undo | |||
) |
Definition at line 609 of file synced_commands.cpp.
References actions::undo_list::clear(), resources::controller, play_controller::current_team(), actions::recalculate_fog(), display::recalculate_minimap(), display::redraw_everything(), resources::screen, team::set_fog(), team::side(), resources::undo_stack, and team::uses_fog().
SYNCED_COMMAND_HANDLER_FUNCTION | ( | debug_shroud | , |
use_undo | |||
) |
Definition at line 628 of file synced_commands.cpp.
References actions::undo_list::clear(), actions::clear_shroud(), resources::controller, play_controller::current_team(), display::recalculate_minimap(), display::redraw_everything(), resources::screen, team::set_shroud(), team::side(), resources::undo_stack, and team::uses_shroud().
|
static |