16 #define GETTEXT_DOMAIN "wesnoth-editor"
42 std::set<map_location> adjacent_set;
44 adjacent_set.insert(adj);
52 if (unit_it != units.
end()) {
57 std::stringstream str;
58 str <<
_(
"Identifier: ") << unit_it->id() <<
"\n";
59 if(unit_it->name() !=
"") {
60 str <<
_(
"Name: ") << unit_it->name() <<
"\n";
62 str <<
_(
"Type: ") << unit_it->type_name() <<
"\n"
63 <<
_(
"Level: ") << unit_it->level() <<
"\n"
64 <<
_(
"Cost: ") << unit_it->cost() <<
"\n";
82 if (unit_it != units.
end())
98 if (!
click_)
return nullptr;
110 const std::string& type_id =
type.id();
112 if (!new_unit_type) {
114 ERR_ED <<
"create unit dialog returned inexistent or unusable unit_type id '" << type_id <<
"'";
122 auto action = std::make_unique<editor_action_unit>(hex, *new_unit);
128 if (
click_)
return nullptr;
136 if (unit_it == units.
end())
139 return std::make_unique<editor_action_unit_replace>(
start_hex_, hex);
virtual const unit_map & units() const =0
const team & viewing_team() const
bool invalidate(const map_location &loc)
Function to invalidate a specific tile for redrawing.
const display_context & context() const
rect get_location_rect(const map_location &loc) const
Returns the on-screen rect corresponding to a loc.
map_location hex_clicked_on(int x, int y) const
given x,y co-ordinates of an onscreen pixel, will return the location of the hex that this pixel corr...
Base class for all editor actions.
void set_mouseover_hex_overlay(const texture &image)
Sets texture to be drawn in hex under the mouse's location.
void clear_mouseover_hex_overlay()
const editor_map & get_map() const
const Item & selected_fg_item() const
Return the currently selected foreground/background item.
virtual void set_mouse_overlay(editor_display &disp) override
Set the mouse overlay for this action.
std::unique_ptr< editor_action > click_left(editor_display &disp, int x, int y) override
TODO.
unit_palette & unit_palette_
std::unique_ptr< editor_action > drag_left(editor_display &disp, int x, int y, bool &partial, editor_action *last_undo) override
Drag operation.
std::unique_ptr< editor_action > up_left(editor_display &disp, int x, int y) override
TODO.
std::unique_ptr< editor_action > drag_end_left(editor_display &disp, int x, int y) override
Drag end replaces the unit when clicked left, or adjusts the facing when clicked right.
void set_unit_mouse_overlay(editor_display &disp, const unit_type &u)
void move(editor_display &disp, const map_location &hex) override
Mouse move (not a drag).
void update_brush_highlights(editor_display &disp, const map_location &hex)
Unconditionally update the brush highlights for the current tool when hex is the center location.
map_location previous_move_hex_
The hex previously used in move operations.
bool on_board(const map_location &loc) const
Tell if a location is on the map.
static std::string get_side_color_id(unsigned side)
Container associating units to locations.
unit_iterator find(std::size_t id)
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.
A single unit type that the player may recruit.
const std::string & image() const
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.
const std::string & flag_rgb() const
static unit_ptr create(const config &cfg, bool use_traits=false, const vconfig *vcfg=nullptr)
Initializes a unit from a config.
static std::string _(const char *str)
void get_adjacent_tiles(const map_location &a, map_location *res)
Function which, given a location, will place all adjacent locations in res.
Manage the empty-palette in the editor.
texture get_texture(const image::locator &i_locator, TYPE type, bool skip_cache)
Returns an image texture suitable for hardware-accelerated rendering.
std::shared_ptr< unit > unit_ptr
std::string filename
Filename.
Encapsulates the map of the game.
An abstract description of a rectangle with integer coordinates.
unit_type_data unit_types