Author: shadowmaster
Date: Sat Jul 26 20:53:17 2008
New Revision: 28225

URL: http://svn.gna.org/viewcvs/wesnoth?rev=28225&view=rev
Log:
* Make it possible to hide terrains from the editor palette using the
* hidden=(boolean) attribute in [terrain] declarations.

Modified:
    trunk/src/editor/editor_palettes.cpp
    trunk/src/terrain.cpp
    trunk/src/terrain.hpp

Modified: trunk/src/editor/editor_palettes.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/editor/editor_palettes.cpp?rev=28225&r1=28224&r2=28225&view=diff
==============================================================================
--- trunk/src/editor/editor_palettes.cpp (original)
+++ trunk/src/editor/editor_palettes.cpp Sat Jul 26 20:53:17 2008
@@ -79,6 +79,9 @@
 
         // don't display terrains that were automatically created from 
base+overlay
                if (t_info.is_combined())
+                       continue;
+               // nor display terrains that have hide_in_editor=true
+               if (t_info.hide_in_editor())
                        continue;
 
                // add the terrain to the requested groups

Modified: trunk/src/terrain.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/terrain.cpp?rev=28225&r1=28224&r2=28225&view=diff
==============================================================================
--- trunk/src/terrain.cpp (original)
+++ trunk/src/terrain.cpp Sat Jul 26 20:53:17 2008
@@ -52,7 +52,8 @@
                keep_(false),
                overlay_(false), 
                combined_(false),
-               editor_default_base_(t_translation::VOID_TERRAIN)
+               editor_default_base_(t_translation::VOID_TERRAIN),
+               hide_in_editor_(false)
 {}
 
 terrain_type::terrain_type(const config& cfg) :
@@ -79,7 +80,8 @@
                keep_(utils::string_bool(cfg["recruit_from"])),
                overlay_(number_.base == t_translation::NO_LAYER),
                combined_(false),
-               
editor_default_base_(t_translation::read_terrain_code(cfg["default_base"]))
+               
editor_default_base_(t_translation::read_terrain_code(cfg["default_base"])),
+               hide_in_editor_(utils::string_bool(cfg["hidden"], false))
 {
 /**
  *  @todo reenable these validations. The problem is that all MP 
@@ -186,7 +188,8 @@
        keep_(base.keep_ || overlay.keep_),
        overlay_(false), 
        combined_(true),
-       editor_default_base_()
+       editor_default_base_(),
+       hide_in_editor_(base.hide_in_editor_ || overlay.hide_in_editor_)
 {
 
        merge_alias_lists(mvt_type_, base.mvt_type_); 

Modified: trunk/src/terrain.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/terrain.hpp?rev=28225&r1=28224&r2=28225&view=diff
==============================================================================
--- trunk/src/terrain.hpp (original)
+++ trunk/src/terrain.hpp Sat Jul 26 20:53:17 2008
@@ -35,6 +35,8 @@
        const std::string& editor_image() const { return editor_image_; }
        const t_string& name() const { return name_; }
        const std::string& id() const { return id_; }
+       
+       bool hide_in_editor() const { return hide_in_editor_; }
 
        //the character representing this terrain
        t_translation::t_terrain number() const { return number_; }
@@ -110,6 +112,7 @@
 
        bool overlay_, combined_;
        t_translation::t_terrain editor_default_base_;
+       bool hide_in_editor_;
 };
 
 void create_terrain_maps(const std::vector<config*>& cfgs,


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to