This class adds extra editor-specific functionality to a normal gamemap. More...
#include <editor_map.hpp>


Public Member Functions | |
| std::vector< team > & | get_teams () |
| Get the team from the current map context object. | |
| unit_map & | get_units () |
| Get the unit map from the current map context object. | |
| const unit_map & | get_units () const |
| tod_manager & | get_time_manager () |
| game_state & | get_game_state () |
| editor_map (const config &terrain_cfg, const display &disp) | |
| Empty map constructor. | |
| editor_map (const config &terrain_cfg, const config &level, const display &disp) | |
| Create an editor map from a map data string. | |
| editor_map (const config &terrain_cfg, const std::string &data, const display &disp) | |
| editor_map (const config &terrain_cfg, size_t width, size_t height, t_translation::t_terrain filler, const display &disp) | |
| Create an editor map with the given dimensions and filler terrain. | |
| editor_map (const gamemap &map, const display &disp) | |
| Create an editor_map by upgrading an existing gamemap. | |
| ~editor_map () | |
| editor_map destructor | |
| void | sanity_check () |
| Debugging aid. | |
| std::set< map_location > | get_contiguous_terrain_tiles (const map_location &start) const |
| Get a contiguous set of tiles having the same terrain as the starting location. | |
| map_labels & | get_map_labels () |
| const map_labels & | get_map_labels () const |
| std::set< map_location > | set_starting_position_labels (display &disp) |
| Set labels for staring positions in the given display object. | |
| bool | in_selection (const map_location &loc) const |
| bool | add_to_selection (const map_location &loc) |
| Add a location to the selection. | |
| bool | remove_from_selection (const map_location &loc) |
| Remove a location to the selection. | |
| const std::set< map_location > & | selection () const |
| Return the selection set. | |
| void | clear_selection () |
| Clear the selection. | |
| void | invert_selection () |
| Invert the selection, i.e. | |
| void | select_all () |
| Select all map hexes. | |
| bool | everything_selected () const |
| void | resize (int width, int height, int x_offset, int y_offset, t_translation::t_terrain filler=t_translation::NONE_TERRAIN) |
| Resize the map. | |
| editor_map | mask_to (const editor_map &target) const |
| A sort-of diff operation returning a mask that, when applied to the current editor_map, will transform it into the target map. | |
| bool | same_size_as (const gamemap &other) const |
| A precondition to several map operations. | |
| void | write (config &) const |
Static Public Member Functions | |
| static editor_map | from_string (const config &terrain_cfg, const std::string &data, const display &disp) |
| Wrapper around editor_map(cfg, data) that catches possible exceptions and wraps them in a editor_map_load_exception. | |
Protected Member Functions | |
| t_translation::t_list | clone_column (int x, t_translation::t_terrain filler) |
| void | expand_right (int count, t_translation::t_terrain filler) |
| void | expand_left (int count, t_translation::t_terrain filler) |
| void | expand_top (int count, t_translation::t_terrain filler) |
| void | expand_bottom (int count, t_translation::t_terrain filler) |
| void | shrink_right (int count) |
| void | shrink_left (int count) |
| void | shrink_top (int count) |
| void | shrink_bottom (int count) |
Protected Attributes | |
| std::set< map_location > | selection_ |
| The selected hexes. | |
Private Attributes | |
| map_labels | labels_ |
| The labels of this map. | |
| unit_map | units_ |
| TODO. | |
| std::vector< team > | teams_ |
| tod_manager | tod_manager_ |
| game_state | state_ |
This class adds extra editor-specific functionality to a normal gamemap.
Definition at line 75 of file editor_map.hpp.
Empty map constructor.
Definition at line 44 of file editor_map.cpp.
Referenced by from_string().

| editor::editor_map::editor_map | ( | const config & | terrain_cfg, | |
| const config & | level, | |||
| const display & | disp | |||
| ) |
Create an editor map from a map data string.
Definition at line 55 of file editor_map.cpp.
References unit_map::add(), team::build(), team::change_controller(), config::child_range(), labels_, map_labels::read(), sanity_check(), teams_, and units_.

| editor::editor_map::editor_map | ( | const config & | terrain_cfg, | |
| const std::string & | data, | |||
| const display & | disp | |||
| ) |
Definition at line 84 of file editor_map.cpp.
References sanity_check().

| editor::editor_map::editor_map | ( | const config & | terrain_cfg, | |
| size_t | width, | |||
| size_t | height, | |||
| t_translation::t_terrain | filler, | |||
| const display & | disp | |||
| ) |
Create an editor map with the given dimensions and filler terrain.
Definition at line 109 of file editor_map.cpp.
References sanity_check().

Create an editor_map by upgrading an existing gamemap.
The map data is copied. Marked "explicit" to avoid potentially harmful automatic conversions.
Definition at line 130 of file editor_map.cpp.
References sanity_check().

| editor::editor_map::~editor_map | ( | ) |
editor_map destructor
Definition at line 142 of file editor_map.cpp.
| bool editor::editor_map::add_to_selection | ( | const map_location & | loc | ) |
Add a location to the selection.
The location should be valid (i.e. on the map)
Definition at line 223 of file editor_map.cpp.
References gamemap::on_board_with_border(), and selection_.

| void editor::editor_map::clear_selection | ( | ) |
Clear the selection.
Definition at line 233 of file editor_map.cpp.
References selection_.
Referenced by editor::editor_action_select_inverse::clone(), and select_all().

| t_translation::t_list editor::editor_map::clone_column | ( | int | x, | |
| t_translation::t_terrain | filler | |||
| ) | [protected] |
Definition at line 334 of file editor_map.cpp.
References gamemap::h(), t_translation::NONE_TERRAIN, and gamemap::tiles_.
Referenced by expand_left(), and expand_right().


| bool editor::editor_map::everything_selected | ( | ) | const |
Definition at line 257 of file editor_map.cpp.
References LOG_ED, selection_, gamemap::total_height(), and gamemap::total_width().

| void editor::editor_map::expand_bottom | ( | int | count, | |
| t_translation::t_terrain | filler | |||
| ) | [protected] |
Definition at line 385 of file editor_map.cpp.
References gamemap::h(), gamemap::h_, t_translation::NONE_TERRAIN, gui2::terrain, gamemap::tiles_, and gamemap::total_height_.
Referenced by resize().


| void editor::editor_map::expand_left | ( | int | count, | |
| t_translation::t_terrain | filler | |||
| ) | [protected] |
Definition at line 358 of file editor_map.cpp.
References gamemap::clear_border_cache(), clone_column(), gamemap::tiles_, gamemap::total_width_, and gamemap::w_.
Referenced by resize().


| void editor::editor_map::expand_right | ( | int | count, | |
| t_translation::t_terrain | filler | |||
| ) | [protected] |
Definition at line 348 of file editor_map.cpp.
References clone_column(), gamemap::tiles_, gamemap::total_width_, gamemap::w(), and gamemap::w_.
Referenced by resize().


| void editor::editor_map::expand_top | ( | int | count, | |
| t_translation::t_terrain | filler | |||
| ) | [protected] |
Definition at line 368 of file editor_map.cpp.
References gamemap::clear_border_cache(), gamemap::h_, t_translation::NONE_TERRAIN, gui2::terrain, gamemap::tiles_, and gamemap::total_height_.
Referenced by resize().


| editor_map editor::editor_map::from_string | ( | const config & | terrain_cfg, | |
| const std::string & | data, | |||
| const display & | disp | |||
| ) | [static] |
Wrapper around editor_map(cfg, data) that catches possible exceptions and wraps them in a editor_map_load_exception.
Definition at line 96 of file editor_map.cpp.
References editor_map(), game::error::message, twml_exception::user_message, and editor::wrap_exc().
Referenced by editor::map_context::map_context().


| std::set< map_location > editor::editor_map::get_contiguous_terrain_tiles | ( | const map_location & | start | ) | const |
Get a contiguous set of tiles having the same terrain as the starting location.
Useful for flood fill or magic wand selection
Definition at line 181 of file editor_map.cpp.
References get_adjacent_tiles(), gamemap::get_terrain(), gamemap::on_board_with_border(), and gui2::terrain.
Referenced by editor::mouse_action_select::affected_hexes(), and editor::editor_action_starting_position::clone().


| game_state& editor::editor_map::get_game_state | ( | ) | [inline] |
Definition at line 97 of file editor_map.hpp.
References state_.
Referenced by editor::map_context_refresher::refresh().

| map_labels& editor::editor_map::get_map_labels | ( | ) | [inline] |
Definition at line 151 of file editor_map.hpp.
References labels_.
Referenced by editor::mouse_action_map_label::drag_left(), editor::mouse_action_map_label::up_left(), and editor::mouse_action_map_label::up_right().

| const map_labels& editor::editor_map::get_map_labels | ( | ) | const [inline] |
Definition at line 154 of file editor_map.hpp.
References labels_.
| std::vector<team>& editor::editor_map::get_teams | ( | ) | [inline] |
Get the team from the current map context object.
Definition at line 80 of file editor_map.hpp.
References teams_.
Referenced by editor::map_context_refresher::refresh().

| tod_manager& editor::editor_map::get_time_manager | ( | ) | [inline] |
Definition at line 93 of file editor_map.hpp.
References tod_manager_.
Referenced by editor::map_context_refresher::refresh().

| unit_map& editor::editor_map::get_units | ( | ) | [inline] |
Get the unit map from the current map context object.
Definition at line 85 of file editor_map.hpp.
References units_.
Referenced by editor::mouse_action_unit::click_left(), and editor::map_context_refresher::refresh().

| const unit_map& editor::editor_map::get_units | ( | ) | const [inline] |
Definition at line 89 of file editor_map.hpp.
References units_.
| bool editor::editor_map::in_selection | ( | const map_location & | loc | ) | const |
Definition at line 218 of file editor_map.cpp.
References selection_.
| void editor::editor_map::invert_selection | ( | ) |
Invert the selection, i.e.
select all the map hexes that were not selected.
Definition at line 238 of file editor_map.cpp.
References gamemap::h(), selection_, and gamemap::w().
Referenced by editor::editor_action_resize_map::clone(), and select_all().


| editor_map editor::editor_map::mask_to | ( | const editor_map & | target | ) | const |
A sort-of diff operation returning a mask that, when applied to the current editor_map, will transform it into the target map.
Definition at line 311 of file editor_map.cpp.
References _, gamemap::border_size(), t_translation::FOGGED, gamemap::get_terrain(), gamemap::h(), mask, gamemap::set_terrain(), gamemap::w(), map_location::x, and map_location::y.
Referenced by editor::editor_action_shuffle_area::clone().


| bool editor::editor_map::remove_from_selection | ( | const map_location & | loc | ) |
Remove a location to the selection.
The location does not actually have to be selected
Definition at line 228 of file editor_map.cpp.
References selection_.
| void editor::editor_map::resize | ( | int | width, | |
| int | height, | |||
| int | x_offset, | |||
| int | y_offset, | |||
| t_translation::t_terrain | filler = t_translation::NONE_TERRAIN | |||
| ) |
Resize the map.
If the filler is NONE, the border terrain will be copied when expanding, otherwise the filler terrain will be inserted there
Definition at line 263 of file editor_map.cpp.
References expand_bottom(), expand_left(), expand_right(), expand_top(), gamemap::h(), gamemap::MAX_PLAYERS, sanity_check(), shrink_bottom(), shrink_left(), shrink_right(), shrink_top(), gamemap::startingPositions_, gamemap::w(), map_location::x, and map_location::y.
Referenced by editor::editor_action_apply_mask::clone().


| bool editor::editor_map::same_size_as | ( | const gamemap & | other | ) | const |
A precondition to several map operations.
Definition at line 328 of file editor_map.cpp.
References gamemap::h(), and gamemap::w().

| void editor::editor_map::sanity_check | ( | ) |
Debugging aid.
Check if the widths and heights correspond to the actual map data sizes.
Definition at line 146 of file editor_map.cpp.
References gamemap::border_size(), ERR_ED, gamemap::h(), gamemap::h_, gamemap::on_board_with_border(), selection_, gamemap::tiles_, gamemap::total_height(), gamemap::total_width(), gamemap::w(), and gamemap::w_.
Referenced by editor_map(), and resize().


| void editor::editor_map::select_all | ( | ) |
Select all map hexes.
Definition at line 251 of file editor_map.cpp.
References clear_selection(), and invert_selection().
Referenced by editor::editor_action_select_none::clone().


| const std::set<map_location>& editor::editor_map::selection | ( | ) | const [inline] |
| std::set< map_location > editor::editor_map::set_starting_position_labels | ( | display & | disp | ) |
Set labels for staring positions in the given display object.
Definition at line 204 of file editor_map.cpp.
References _, display::labels(), map_labels::set_label(), gamemap::startingPositions_, and schema_validation::valid.
Referenced by editor::map_context::set_starting_position_labels().


| void editor::editor_map::shrink_bottom | ( | int | count | ) | [protected] |
Definition at line 434 of file editor_map.cpp.
References gamemap::h_, gamemap::tiles_, and gamemap::total_height_.
Referenced by resize().

| void editor::editor_map::shrink_left | ( | int | count | ) | [protected] |
Definition at line 412 of file editor_map.cpp.
References gamemap::tiles_, gamemap::total_width_, and gamemap::w_.
Referenced by resize().

| void editor::editor_map::shrink_right | ( | int | count | ) | [protected] |
Definition at line 402 of file editor_map.cpp.
References gamemap::tiles_, gamemap::total_width_, and gamemap::w_.
Referenced by resize().

| void editor::editor_map::shrink_top | ( | int | count | ) | [protected] |
Definition at line 422 of file editor_map.cpp.
References gamemap::h_, gamemap::tiles_, and gamemap::total_height_.
Referenced by resize().

| void editor::editor_map::write | ( | config & | cfg | ) | const [virtual] |
Reimplemented from gamemap.
Definition at line 446 of file editor_map.cpp.
References config::add_child(), labels_, preferences::map(), and map_labels::write().
Referenced by editor::map_context::save().


map_labels editor::editor_map::labels_ [private] |
The labels of this map.
Definition at line 248 of file editor_map.hpp.
Referenced by editor_map(), get_map_labels(), and write().
std::set<map_location> editor::editor_map::selection_ [protected] |
The selected hexes.
Definition at line 241 of file editor_map.hpp.
Referenced by add_to_selection(), clear_selection(), everything_selected(), in_selection(), invert_selection(), remove_from_selection(), sanity_check(), and selection().
game_state editor::editor_map::state_ [private] |
Definition at line 259 of file editor_map.hpp.
Referenced by get_game_state().
std::vector<team> editor::editor_map::teams_ [private] |
Definition at line 255 of file editor_map.hpp.
Referenced by editor_map(), and get_teams().
tod_manager editor::editor_map::tod_manager_ [private] |
Definition at line 257 of file editor_map.hpp.
Referenced by get_time_manager().
unit_map editor::editor_map::units_ [private] |
| Generated by doxygen 1.7.1 on Thu May 24 2012 01:19:52 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |