Add "default_base" parameter to [terrain].
The editor will use this do draw a default base for overlay terrains.
This commit is contained in:
parent
41be94978e
commit
d434b8d2ce
5 changed files with 24 additions and 11 deletions
|
@ -53,6 +53,8 @@ Version 1.5.0+svn:
|
|||
* fix [teleport] capturing villages with the wrong side (bug #11683)
|
||||
* SideWML recruit= no longer locks the faction except if explicitely wanted
|
||||
with the new key faction_from_recruit=yes
|
||||
* add "default_base" parameter to overlay terrains, which specifies the
|
||||
base terrain the editor draws by default.
|
||||
* wesnothd
|
||||
* added expiration time to bans
|
||||
* added restart command to server that does gracefull restart
|
||||
|
|
|
@ -415,7 +415,7 @@ void map_editor::left_click(const gamemap::location hex_clicked) {
|
|||
else if ( (key_[SDLK_RALT] || key_[SDLK_LALT]) && l_button_func_ == DRAW) {
|
||||
reset_mouseover_overlay();
|
||||
draw_on_mouseover_hexes(palette_.selected_fg_terrain(), true);
|
||||
l_button_held_func_ = DRAW_BASE_TERRAIN;
|
||||
l_button_held_func_ = DRAW_TERRAIN_LAYER;
|
||||
}
|
||||
else if (selected_hexes_.find(hex_clicked) != selected_hexes_.end()) {
|
||||
l_button_held_func_ = MOVE_SELECTION;
|
||||
|
@ -1184,7 +1184,7 @@ void map_editor::left_button_down(const int mousex, const int mousey) {
|
|||
reset_mouseover_overlay();
|
||||
draw_on_mouseover_hexes(palette_.selected_fg_terrain());
|
||||
}
|
||||
else if (l_button_held_func_ == DRAW_BASE_TERRAIN && mouse_moved_) {
|
||||
else if (l_button_held_func_ == DRAW_TERRAIN_LAYER && mouse_moved_) {
|
||||
reset_mouseover_overlay();
|
||||
draw_on_mouseover_hexes(palette_.selected_fg_terrain(), true);
|
||||
}
|
||||
|
@ -1203,16 +1203,16 @@ void map_editor::left_button_down(const int mousex, const int mousey) {
|
|||
}
|
||||
}
|
||||
|
||||
void map_editor::draw_on_mouseover_hexes(const t_translation::t_terrain terrain, const bool base_only) {
|
||||
void map_editor::draw_on_mouseover_hexes(const t_translation::t_terrain terrain, const bool one_layer_only) {
|
||||
if(map_.on_board(selected_hex_, true)) {
|
||||
std::vector<gamemap::location> hexes =
|
||||
get_tiles(map_, selected_hex_, brush_.selected_brush_size());
|
||||
draw_terrain(terrain, hexes, base_only);
|
||||
draw_terrain(terrain, hexes, one_layer_only);
|
||||
}
|
||||
}
|
||||
|
||||
void map_editor::draw_terrain(const t_translation::t_terrain terrain,
|
||||
const std::vector<gamemap::location> &hexes, const bool base_only)
|
||||
const std::vector<gamemap::location> &hexes, const bool one_layer_only)
|
||||
{
|
||||
map_undo_action undo_action;
|
||||
|
||||
|
@ -1223,8 +1223,14 @@ void map_editor::draw_terrain(const t_translation::t_terrain terrain,
|
|||
undo_action.add_terrain(old_terrain, terrain, *it);
|
||||
if (terrain.base == t_translation::NO_LAYER) {
|
||||
map_.set_overlay(*it, terrain);
|
||||
|
||||
const terrain_type& t_info = map_.get_terrain_info(terrain);
|
||||
|
||||
if (!one_layer_only && t_info.default_base() != t_translation::NONE_TERRAIN) {
|
||||
map_.set_base(*it, t_info.default_base());
|
||||
}
|
||||
}
|
||||
else if (base_only) {
|
||||
else if (one_layer_only) {
|
||||
map_.set_base(*it, terrain);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -155,7 +155,7 @@ public:
|
|||
|
||||
private:
|
||||
//! What to perform while the left button is held down.
|
||||
enum LEFT_BUTTON_HELD_FUNC {DRAW_TERRAIN, DRAW_BASE_TERRAIN, ADD_SELECTION, REMOVE_SELECTION,
|
||||
enum LEFT_BUTTON_HELD_FUNC {DRAW_TERRAIN, DRAW_TERRAIN_LAYER, ADD_SELECTION, REMOVE_SELECTION,
|
||||
MOVE_SELECTION, NONE};
|
||||
|
||||
//! What to perform on a left button click.
|
||||
|
@ -205,7 +205,7 @@ private:
|
|||
//! Draw terrain at a location. The operation is saved in the undo
|
||||
//! stack. Update the map to reflect the change.
|
||||
void draw_terrain(const t_translation::t_terrain terrain,
|
||||
const std::vector<gamemap::location> &hexes, const bool base_only);
|
||||
const std::vector<gamemap::location> &hexes, const bool one_layer_only);
|
||||
|
||||
//! Re-set the labels for the starting positions of the
|
||||
//! players. Should be called when the terrain has changed, which
|
||||
|
@ -272,7 +272,7 @@ private:
|
|||
|
||||
//! Draw the terrain on the hexes the mouse is over, taking account
|
||||
//! for brush size.
|
||||
void draw_on_mouseover_hexes(const t_translation::t_terrain t, const bool base_only = false);
|
||||
void draw_on_mouseover_hexes(const t_translation::t_terrain t, const bool one_layer_only = false);
|
||||
|
||||
// Load the tooltips for each button
|
||||
void load_tooltips(void);
|
||||
|
|
|
@ -51,7 +51,8 @@ terrain_type::terrain_type() :
|
|||
castle_(false),
|
||||
keep_(false),
|
||||
overlay_(false),
|
||||
combined_(false)
|
||||
combined_(false),
|
||||
editor_default_base_(t_translation::VOID_TERRAIN)
|
||||
{}
|
||||
|
||||
terrain_type::terrain_type(const config& cfg) :
|
||||
|
@ -75,7 +76,8 @@ terrain_type::terrain_type(const config& cfg) :
|
|||
editor_group_(cfg["editor_group"]),
|
||||
village_(utils::string_bool(cfg["gives_income"])),
|
||||
castle_(utils::string_bool(cfg["recruit_onto"])),
|
||||
keep_(utils::string_bool(cfg["recruit_from"]))
|
||||
keep_(utils::string_bool(cfg["recruit_from"])),
|
||||
editor_default_base_(t_translation::read_terrain_code(cfg["default_base"]))
|
||||
{
|
||||
//! @todo reenable these validations. The problem is that all MP
|
||||
//! scenarios/campaigns share the same namespace and one rogue scenario
|
||||
|
|
|
@ -68,6 +68,8 @@ public:
|
|||
bool is_overlay() const { return overlay_; }
|
||||
bool is_combined() const { return combined_; }
|
||||
|
||||
t_translation::t_terrain default_base() const { return editor_default_base_; }
|
||||
|
||||
private:
|
||||
//! The image used in the minimap
|
||||
std::string minimap_image_;
|
||||
|
@ -104,6 +106,7 @@ private:
|
|||
bool village_, castle_, keep_;
|
||||
|
||||
bool overlay_, combined_;
|
||||
t_translation::t_terrain editor_default_base_;
|
||||
};
|
||||
|
||||
void create_terrain_maps(const std::vector<config*>& cfgs,
|
||||
|
|
Loading…
Add table
Reference in a new issue