109 void new_area(
const std::set<map_location>& area) {
141 virtual const std::vector<team>&
teams()
const override
228 bool one_layer_only =
false);
234 bool one_layer_only =
false);
241 bool one_layer_only =
false);
264 void set_scenario_setup(
const std::string&
id,
const std::string& name,
const std::string& description,
330 void save_schedule(
const std::string& schedule_id,
const std::string& schedule_name);
517 typedef std::map<std::string, sound::music_track>
music_map;
A config object defines a single node in a WML file, with access to child nodes.
Abstract class for exposing game data that doesn't depend on the GUI, however which for historical re...
virtual const gamemap & map() const =0
virtual const std::vector< team > & teams() const =0
virtual const unit_map & units() const =0
Sort-of-Singleton that many classes, both GUI and non-GUI, use to access the game data.
Base class for all editor actions.
This class adds extra editor-specific functionality to a normal gamemap.
This class wraps around a map to provide a concise interface for the editor to work with.
game_classification game_classification_
overlay_map & get_overlays()
std::set< map_location > starting_position_label_locs_
Cache of set starting position labels.
std::string filename_
The actual filename of this map.
void save_area(const std::set< map_location > &area)
void new_area(const std::set< map_location > &area)
utils::optional< config > previous_cfg_
void perform_partial_action(const editor_action &action)
Performs a partial action, assumes that the top undo action has been modified to maintain coherent st...
void remove_side()
removes the last side from the scenario
mp_game_settings mp_settings_
void set_active_area(int index)
bool pure_map_
Whether the map context refers to a file containing only the pure map data.
void set_labels(display &disp)
bool needs_terrain_rebuild_
Refresh flag indicating the terrain in the map has changed and requires a rebuild.
virtual const unit_map & units() const override
Const units accessor.
action_stack redo_stack_
The redo stack.
std::unique_ptr< tod_manager > tod_manager_
void set_local_starting_time(int time)
bool embedded_
Whether the map context refers to a map embedded in a scenario file.
int get_active_area() const
void set_needs_labels_reset(bool value=true)
Setter for the labels reset flag.
void set_needs_reload(bool value=true)
Setter for the reload flag.
std::string scenario_name_
bool needs_labels_reset_
Refresh flag indicating the labels in the map have changed.
void clear_starting_position_labels(display &disp)
std::vector< std::string > lbl_categories_
editor_map map_
The map object of this map_context.
void new_side()
Adds a new side to the map.
const std::string & get_id() const
static const std::size_t max_action_stack_size_
Action stack (i.e.
action_stack undo_stack_
The undo stack.
editor_action * last_undo_action()
std::string map_data_key_
When a scenario file is loaded, the referenced map is loaded instead.
void redo()
Re-does a previously undid action, and puts it back in the undo stack.
std::set< map_location > changed_locations_
void set_starting_time(int time)
void draw_terrain(const t_translation::terrain_code &terrain, const map_location &loc, bool one_layer_only=false)
Draw a terrain on a single location on the map.
bool random_start_time() const
void set_map(const editor_map &map)
bool select_area(int index)
Select the nth tod area.
void set_side_setup(editor_team_info &info)
std::vector< team > & teams()
Local non-const overload of teams.
void trim_stack(action_stack &stack)
Checks if an action stack reached its capacity and removes the front element if so.
int actions_since_save_
Number of actions performed since the map was saved.
std::string scenario_description_
void save_scenario()
Saves the scenario under the current filename.
bool needs_reload_
Refresh flag indicating the map in this context should be completely reloaded by the display.
editor_map & map()
Local non-const overload of map.
std::vector< team > teams_
void perform_action_between_stacks(action_stack &from, action_stack &to)
Perform an action at the back of one stack, and then move it to the back of the other stack.
void perform_action(const editor_action &action)
Performs an action (thus modifying the map).
void undo()
Un-does the last action, and puts it in the redo stack for a possible redo.
const std::string & get_description() const
void replace_schedule(const std::vector< time_of_day > &schedule)
utils::optional< bool > victory_defeated_
bool is_in_playlist(std::string track_id)
void remove_area(int index)
void set_addon_id(const std::string &addon_id)
void clear_undo_redo()
Clear the undo and redo stacks.
virtual ~map_context()
Map context destructor.
unit_map & units()
Local non-const overload of units.
tod_manager * get_time_manager()
virtual const std::vector< std::string > & hidden_label_categories() const override
void draw_terrain_actual(const t_translation::terrain_code &terrain, const map_location &loc, bool one_layer_only=false)
Actual drawing function used by both overloaded variants of draw_terrain.
void clear_changed_locations()
map_context(const map_context &)=delete
bool needs_labels_reset() const
Getter for the labels reset flag.
utils::optional< int > xp_mod_
void add_to_recent_files()
Adds the map to the editor's recent files list.
std::map< map_location, std::vector< overlay > > overlay_map
std::map< std::string, sound::music_track > music_map
void replace_local_schedule(const std::vector< time_of_day > &schedule)
Replace the [time]s of the currently active area.
const tod_manager * get_time_manager() const
void save_map()
Saves the map under the current filename.
void reset_starting_position_labels(display &disp)
void set_embedded(bool v)
editor_action * last_redo_action()
void partial_undo()
Un-does a single step from a undo action chain.
bool needs_reload() const
Getter for the reload flag.
void set_everything_changed()
virtual const editor_map & map() const override
Const map accessor.
void add_to_playlist(const sound::music_track &track)
virtual std::vector< std::string > & hidden_label_categories() override
void set_needs_terrain_rebuild(bool value=true)
Setter for the terrain rebuild flag.
map_context & operator=(const map_context &)=delete
config convert_scenario(const config &old_scenario)
Convert an old-style editor scenario config to a config with a top level [multiplayer] tag.
bool everything_changed() const
const t_string get_default_context_name() const
const std::string & get_filename() const
void set_starting_position_labels(display &disp)
mp_game_settings & get_mp_settings()
map_labels & get_labels()
bool needs_terrain_rebuild() const
Getter for the terrain rebuild flag.
void clear_modified()
Clear the modified state.
virtual const std::vector< team > & teams() const override
Const teams accessor.
game_classification & get_classification()
bool victory_defeated() const
void set_filename(const std::string &fn)
const std::set< map_location > changed_locations() const
utils::optional< int > get_xp_mod() const
void set_scenario_setup(const std::string &id, const std::string &name, const std::string &description, int turns, int xp_mod, bool victory_defeated, bool random_time)
void add_changed_location(const map_location &loc)
const std::string & get_name() const
void save_schedule(const std::string &schedule_id, const std::string &schedule_name)
Save custom time of day schedule in the utils directory.
A class grating read only view to a vector of config objects, viewed as one config with all children ...
Internal representation of music tracks.
const std::string & id() const
This class stores all the data for a single 'side' (in game nomenclature).
Container associating units to locations.
Manage the empty-palette in the editor.
std::deque< std::unique_ptr< editor_action > > action_stack
Action stack typedef.
Game configuration data as global variables.
std::size_t index(const std::string &str, const std::size_t index)
Codepoint index corresponding to the nth character in a UTF-8 string.
std::string filename
Filename.
editor_team_info(const team &t)
side_controller::type controller
team_shared_vision::type share_vision
Encapsulates the map of the game.
A terrain string which is converted to a terrain is a string with 1 or 2 layers the layers are separa...