21 #include <boost/dynamic_bitset.hpp>
64 editor_map_load_exception
wrap_exc(
const char*
type,
const std::string& e_msg,
const std::string&
filename);
138 std::set<map_location>
selection()
const;
188 void resize(
int width,
int height,
int x_offset,
int y_offset,
271 std::set<map_location> res;
273 for(std::size_t
i = 0;
i <
mask.bitset_.size(); ++
i) {
274 if(
mask.bitset_.test(
i)) {
275 res.emplace(
mask.get_location(
i));
283 const boost::dynamic_bitset<uint64_t>&
mask()
const
299 return {pos.rem, pos.quot,
wml_loc{}};
Sort-of-Singleton that many classes, both GUI and non-GUI, use to access the game data.
selection_mask(const gamemap_base &map)
boost::dynamic_bitset< uint64_t > bitset_
static std::set< map_location > get_locations(const selection_mask &mask)
bool select(const map_location &loc)
Marks loc as selected.
const boost::dynamic_bitset< uint64_t > & mask() const
Read-only access to the underlying bitset.
selection_mask inverted() const
map_location get_location(std::size_t i) const
Gets the corresponding map_location for bit index i.
bool selected(const map_location &loc) const
bool deselect(const map_location &loc)
Marks loc as unselected.
std::size_t get_index(const map_location &loc) const
Indexes loc to its corresponding bitflag using row-major ordering.
This class adds extra editor-specific functionality to a normal gamemap.
void shrink_left(int count)
bool everything_selected() const
bool add_to_selection(const map_location &loc)
Add a location to the selection.
bool anything_selected() const
void shrink_top(int count)
void expand_left(int count, const t_translation::terrain_code &filler)
selection_mask selection_
The selected hexes.
std::set< map_location > set_starting_position_labels(display &disp)
Set labels for staring positions in the given display object.
void shrink_bottom(int count)
static editor_map from_string(std::string_view data)
Wrapper around editor_map(cfg, data) that catches possible exceptions and wraps them in a editor_map_...
void invert_selection()
Invert the selection, i.e.
void shrink_right(int count)
void select_all()
Select all map hexes.
bool same_size_as(const gamemap &other) const
A precondition to several map operations.
gamemap mask_to(const gamemap &target) const
A sort-of diff operation returning a mask that, when applied to the current editor_map,...
std::set< map_location > selection() const
Return the selection set.
bool nothing_selected() const
void expand_right(int count, const t_translation::terrain_code &filler)
bool in_selection(const map_location &loc) const
bool remove_from_selection(const map_location &loc)
Remove a location to the selection.
void expand_top(int count, const t_translation::terrain_code &filler)
void set_selection(const std::set< map_location > &area)
Select the given area.
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.
void resize(int width, int height, int x_offset, int y_offset, const t_translation::terrain_code &filler=t_translation::NONE_TERRAIN)
Resize the map.
std::set< map_location > selection_inverse() const
Returns a set of all hexes not currently selected.
editor_map()
Empty map constructor.
void clear_selection()
Clear the selection.
void expand_bottom(int count, const t_translation::terrain_code &filler)
std::size_t num_selected() const
int total_area() const
Total square area of the map, including borders.
int total_width() const
Real width of the map, including borders.
int total_height() const
Real height of the map, including borders.
Encapsulates the map of the game.
Main (common) editor header.
Manage the empty-palette in the editor.
editor_map_load_exception wrap_exc(const char *type, const std::string &e_msg, const std::string &filename)
Exception wrapping utility.
EXIT_STATUS start(bool clear_id, const std::string &filename, bool take_screenshot, const std::string &screenshot_filename)
Main interface for launching the editor from the title screen.
constexpr terrain_code NONE_TERRAIN
static void msg(const char *act, debug_info &i, const char *to="", const char *result="")
std::string filename
Filename.
editor_map_integrity_error()
~editor_map_load_exception() noexcept
editor_map_load_exception(const std::string &fn, const std::string &msg)
editor_map_operation_exception()
~editor_map_save_exception() noexcept
editor_map_save_exception(const std::string &msg)
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...