Author: ai0867
Date: Sun Nov  6 21:18:50 2011
New Revision: 51898

URL: http://svn.gna.org/viewcvs/wesnoth?rev=51898&view=rev
Log:
Add [unit_type]image_icon key (FR bug #15466)

Modified:
    trunk/changelog
    trunk/data/scenario-test.cfg
    trunk/src/unit.cpp
    trunk/src/unit.hpp
    trunk/src/unit_types.cpp
    trunk/src/unit_types.hpp

Modified: trunk/changelog
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=51898&r1=51897&r2=51898&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Sun Nov  6 21:18:50 2011
@@ -124,6 +124,8 @@
    * Introduce [capture_village]fire_event=yes|no (def no) whether to fire
      any capture events (was previously always yes)
    * Made [move_unit] respect image modifications applied by EffectWML to 
single units
+   * Introduce [unit_type]image_icon key to override image for 72x72 icons
+     (FR bug #15466)
  * Miscellaneous and bug fixes:
    * Add --language/-L commandline option to set the language for that session
    * Fixed: Avoid copying of singular iterators in the whiteboard code

Modified: trunk/data/scenario-test.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/scenario-test.cfg?rev=51898&r1=51897&r2=51898&view=diff
==============================================================================
--- trunk/data/scenario-test.cfg (original)
+++ trunk/data/scenario-test.cfg Sun Nov  6 21:18:50 2011
@@ -120,8 +120,9 @@
         [unit]
             # Unhealable unit
             x,y=9,8
-            type="Peasant"
+            type="Peasant_unhealable"
             name="Unhealable"
+            image_icon="misc/key.png"
             generate_name=yes
             [status]
                 unhealable=yes
@@ -3103,6 +3104,16 @@
     [/event]
 [/test]
 
+[+units]
+    [unit_type]
+        id=Peasant_unhealable
+        [base_unit]
+            id=Peasant
+        [/base_unit]
+        image_icon="misc/key.png"
+    [/unit_type]
+[/units]
+
 [+language]
     range_very_long= _ "very long"
     type_electrical= _ "electrical"

Modified: trunk/src/unit.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit.cpp?rev=51898&r1=51897&r2=51898&view=diff
==============================================================================
--- trunk/src/unit.cpp (original)
+++ trunk/src/unit.cpp Sun Nov  6 21:18:50 2011
@@ -525,7 +525,7 @@
 
        static char const *raw_attrs[] = { "description", "halo",
                "profile", "small_profile", "upkeep", "usage", "ellipse",
-               "image", "random_traits", "generate_name" };
+               "image", "image_icon", "random_traits", "generate_name" };
        foreach (const char *attr, raw_attrs) {
                input_cfg.remove_attribute(attr);
        }
@@ -796,7 +796,7 @@
        // except for a few attributes.
        config new_cfg;
        static char const *persistent_attrs[] = { "upkeep", "ellipse",
-               "image", "usage", "random_traits", "generate_name" };
+               "image", "image_icon", "usage", "random_traits", 
"generate_name" };
        foreach (const char *attr, persistent_attrs) {
                if (const config::attribute_value *v = old_cfg.get(attr)) {
                        new_cfg[attr] = *v;
@@ -2708,6 +2708,10 @@
        }
 }
 
+std::string unit::absolute_image() const {
+       return cfg_["image_icon"].empty() ? cfg_["image"] : cfg_["image_icon"];
+}
+
 const unit_animation* unit::choose_animation(const game_display& disp, const 
map_location& loc,const std::string& event,
                const map_location& second_loc,const int value,const 
unit_animation::hit_type hit,
                const attack_type* attack, const attack_type* second_attack, 
int swing_num) const

Modified: trunk/src/unit.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit.hpp?rev=51898&r1=51897&r2=51898&view=diff
==============================================================================
--- trunk/src/unit.hpp (original)
+++ trunk/src/unit.hpp Sun Nov  6 21:18:50 2011
@@ -277,7 +277,7 @@
                Uint32 text_color = 0, STATE state = STATE_ANIM);
 
        /** The name of the file to game_display (used in menus). */
-       std::string absolute_image() const { return cfg_["image"]; }
+       std::string absolute_image() const;
        std::string image_halo() const { return cfg_["halo"]; }
 
        std::string image_ellipse() const { return cfg_["ellipse"]; }

Modified: trunk/src/unit_types.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit_types.cpp?rev=51898&r1=51897&r2=51898&view=diff
==============================================================================
--- trunk/src/unit_types.cpp (original)
+++ trunk/src/unit_types.cpp Sun Nov  6 21:18:50 2011
@@ -568,6 +568,7 @@
        usage_(o.usage_),
        undead_variation_(o.undead_variation_),
        image_(o.image_),
+       icon_(o.icon_),
        small_profile_(o.small_profile_),
        big_profile_(o.big_profile_),
        flag_rgb_(o.flag_rgb_),
@@ -614,6 +615,7 @@
        usage_(),
        undead_variation_(),
        image_(),
+       icon_(),
        small_profile_(),
        big_profile_(),
        flag_rgb_(),
@@ -775,6 +777,7 @@
        usage_ = cfg_["usage"].str();
        undead_variation_ = cfg_["undead_variation"].str();
        image_ = cfg_["image"].str();
+       icon_ = cfg_["image_icon"].str();
        small_profile_ = cfg_["small_profile"].str();
        big_profile_ = cfg_["profile"].str();
        adjust_profile(small_profile_, big_profile_, image_);

Modified: trunk/src/unit_types.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit_types.hpp?rev=51898&r1=51897&r2=51898&view=diff
==============================================================================
--- trunk/src/unit_types.hpp (original)
+++ trunk/src/unit_types.hpp Sun Nov  6 21:18:50 2011
@@ -228,6 +228,7 @@
        int cost() const { return cost_; }
        const std::string& usage() const { return usage_; }
        const std::string& image() const { return image_; }
+       const std::string& icon() const { return icon_; }
        const std::string &small_profile() const { return small_profile_; }
        const std::string &big_profile() const { return big_profile_; }
 
@@ -306,6 +307,7 @@
     std::string undead_variation_;
 
        std::string image_;
+       std::string icon_;
        std::string small_profile_;
        std::string big_profile_;
        std::string flag_rgb_;


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

Reply via email to