Author: crab
Date: Wed Apr  4 11:25:21 2012
New Revision: 53770

URL: http://svn.gna.org/viewcvs/wesnoth?rev=53770&view=rev
Log:
Fixed bug #19599: Engine keeps redundant ai_special information for units. 
Patch #3235 by Ayne.

Modified:
    trunk/changelog
    trunk/data/core/about.cfg
    trunk/src/unit.cpp
    trunk/src/unit.hpp

Modified: trunk/changelog
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/changelog?rev=53770&r1=53769&r2=53770&view=diff
==============================================================================
--- trunk/changelog (original)
+++ trunk/changelog Wed Apr  4 11:25:21 2012
@@ -58,6 +58,8 @@
      * is scaled to fit at all resolutions.
      * Removed the scrolling feature which is no longer needed.
    * Map label placement tool
+ * Engine:
+    *  Fixed bug #19599: Engine keeps redundant unit.ai_special_ information.
  * Graphics:
      * New graphics for the Spectre.
  * Language and i18n:

Modified: trunk/data/core/about.cfg
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/data/core/about.cfg?rev=53770&r1=53769&r2=53770&view=diff
==============================================================================
--- trunk/data/core/about.cfg (original)
+++ trunk/data/core/about.cfg Wed Apr  4 11:25:21 2012
@@ -895,6 +895,9 @@
         name = "Andrius Å tikonas"
     [/entry]
     [entry]
+        name = "Anja Keicher (ayne)"
+    [/entry]
+    [entry]
         name = "Ben Anderman (crimson_penguin)"
         comment = "unit list"
     [/entry]

Modified: trunk/src/unit.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit.cpp?rev=53770&r1=53769&r2=53770&view=diff
==============================================================================
--- trunk/src/unit.cpp (original)
+++ trunk/src/unit.cpp Wed Apr  4 11:25:21 2012
@@ -156,7 +156,6 @@
            overlays_(o.overlays_),
 
            role_(o.role_),
-           ai_special_(o.ai_special_),
            attacks_(o.attacks_),
            facing_(o.facing_),
 
@@ -236,7 +235,6 @@
        state_(STATE_STANDING),
        overlays_(),
        role_(cfg["role"]),
-       ai_special_(cfg["ai_special"]),
        attacks_(),
        facing_(map_location::NDIRECTIONS),
        trait_names_(),
@@ -445,7 +443,7 @@
                }
        }
        if(cfg["ai_special"] == "guardian") {
-               set_state("guardian", true);
+               set_state(STATE_GUARDIAN, true);
        }
 
        // Remove animations from private cfg, they're not needed there now
@@ -597,7 +595,6 @@
        state_(STATE_STANDING),
        overlays_(),
        role_(),
-       ai_special_(),
        attacks_(),
        
facing_(static_cast<map_location::DIRECTION>(rand()%map_location::NDIRECTIONS)),
        trait_names_(),
@@ -1071,7 +1068,6 @@
 }
 void unit::new_scenario()
 {
-       ai_special_ = "";
 
        // Set the goto-command to be going to no-where
        goto_ = map_location();
@@ -1101,6 +1097,7 @@
        set_state(STATE_SLOWED, false);
        set_state(STATE_POISONED, false);
        set_state(STATE_PETRIFIED, false);
+       set_state(STATE_GUARDIAN, false);
 }
 
 void unit::heal(int amount)
@@ -1172,8 +1169,7 @@
        known_boolean_state_names_map.insert(std::make_pair("uncovered", 
STATE_UNCOVERED));
        
known_boolean_state_names_map.insert(std::make_pair("not_moved",STATE_NOT_MOVED));
        
known_boolean_state_names_map.insert(std::make_pair("unhealable",STATE_UNHEALABLE));
-       //not sure if "guardian" is a yes/no state.
-       
//known_boolean_state_names_map.insert(std::make_pair("guardian",STATE_GUARDIAN));
+       
known_boolean_state_names_map.insert(std::make_pair("guardian",STATE_GUARDIAN));
        return known_boolean_state_names_map;
 }
 
@@ -1419,7 +1415,7 @@
        }
 
        config::attribute_value cfg_ai_special = cfg["ai_special"];
-       if (!cfg_ai_special.blank() && cfg_ai_special.str() != ai_special_) {
+       if (!cfg_ai_special.blank() && ((cfg_ai_special.str() == "guardian" ? 
true : false)  != get_state(STATE_GUARDIAN))) {
                return false;
        }
 
@@ -1638,7 +1634,6 @@
        cfg["variation"] = variation_;
 
        cfg["role"] = role_;
-       cfg["ai_special"] = ai_special_;
        cfg["flying"] = flying_;
 
        config status_flags;

Modified: trunk/src/unit.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit.hpp?rev=53770&r1=53769&r2=53770&view=diff
==============================================================================
--- trunk/src/unit.hpp (original)
+++ trunk/src/unit.hpp Wed Apr  4 11:25:21 2012
@@ -171,7 +171,7 @@
        bool get_state(const std::string& state) const;
        void set_state(const std::string &state, bool value);
        enum state_t { STATE_SLOWED = 0, STATE_POISONED, STATE_PETRIFIED,
-               STATE_UNCOVERED, STATE_NOT_MOVED, STATE_UNHEALABLE, 
STATE_UNKNOWN = -1 };
+               STATE_UNCOVERED, STATE_NOT_MOVED, STATE_UNHEALABLE, 
STATE_GUARDIAN, STATE_UNKNOWN = -1 };
        void set_state(state_t state, bool value);
        bool get_state(state_t state) const;
        static state_t get_known_boolean_state_id(const std::string &state);
@@ -190,8 +190,6 @@
        void set_role(const std::string& role) { role_ = role; }
        const std::string &get_role() const { return role_; }
 
-       void assign_ai_special(const std::string& s) { ai_special_ = s;}
-            std::string get_ai_special() const { return(ai_special_); }
        const std::vector<attack_type>& attacks() const { return attacks_; }
        std::vector<attack_type>& attacks() { return attacks_; }
 
@@ -436,7 +434,6 @@
        std::vector<std::string> overlays_;
 
        std::string role_;
-       std::string ai_special_;
        std::vector<attack_type> attacks_;
        map_location::DIRECTION facing_;
 


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

Reply via email to