mail[Wesnoth-commits] r52799 - in /trunk/src: unit.hpp unit_abilities.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by strgaltent on January 29, 2012 - 23:50:
Author: anonymissimus
Date: Sun Jan 29 23:50:23 2012
New Revision: 52799

URL: http://svn.gna.org/viewcvs/wesnoth?rev=52799&view=rev
Log:
Rename "ability" parameter to better match what the functions do.

Affects 2 versions of unit::get_ability_bool and 2 versions
of unit::get_abilities.

Modified:
    trunk/src/unit.hpp
    trunk/src/unit_abilities.cpp

Modified: trunk/src/unit.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit.hpp?rev=52799&r1=52798&r2=52799&view=diff
==============================================================================
--- trunk/src/unit.hpp (original)
+++ trunk/src/unit.hpp Sun Jan 29 23:50:23 2012
@@ -302,16 +302,16 @@
         * Returns true if the unit is currently under effect by an ability 
with this given TAG NAME.
         * This means that the ability could be owned by the unit itself, or 
by an adjacent unit.
         */
-       bool get_ability_bool(const std::string& ability, const map_location& 
loc) const;
+       bool get_ability_bool(const std::string& tag_name, const 
map_location& loc) const;
        /**
         * Returns true if the unit is currently under effect by an ability 
with this given TAG NAME.
         * This means that the ability could be owned by the unit itself, or 
by an adjacent unit.
         */
-       bool get_ability_bool(const std::string &ability) const
-       { return get_ability_bool(ability, loc_); }
-       unit_ability_list get_abilities(const std::string &ability, const 
map_location& loc) const;
-       unit_ability_list get_abilities(const std::string &ability) const
-       { return get_abilities(ability, loc_); }
+       bool get_ability_bool(const std::string &tag_name) const
+       { return get_ability_bool(tag_name, loc_); }
+       unit_ability_list get_abilities(const std::string &tag_name, const 
map_location& loc) const;
+       unit_ability_list get_abilities(const std::string &tag_name) const
+       { return get_abilities(tag_name, loc_); }
        /** Tuple of: neutral ability name, gendered ability name, 
description */
        std::vector<boost::tuple<t_string,t_string,t_string> > 
ability_tooltips(bool force_active = false) const;
        std::vector<std::string> get_ability_list() const;

Modified: trunk/src/unit_abilities.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit_abilities.cpp?rev=52799&r1=52798&r2=52799&view=diff
==============================================================================
--- trunk/src/unit_abilities.cpp (original)
+++ trunk/src/unit_abilities.cpp Sun Jan 29 23:50:23 2012
@@ -120,13 +120,13 @@
 }
 
 
-bool unit::get_ability_bool(const std::string& ability, const map_location& 
loc) const
+bool unit::get_ability_bool(const std::string& tag_name, const map_location& 
loc) const
 {
        if (const config &abilities = cfg_.child("abilities"))
        {
-               foreach (const config &i, abilities.child_range(ability)) {
-                       if (ability_active(ability, i, loc) &&
-                           ability_affects_self(ability, i, loc))
+               foreach (const config &i, abilities.child_range(tag_name)) {
+                       if (ability_active(tag_name, i, loc) &&
+                           ability_affects_self(tag_name, i, loc))
                                return true;
                }
        }
@@ -141,10 +141,10 @@
                const config &adj_abilities = it->cfg_.child("abilities");
                if (!adj_abilities)
                        continue;
-               foreach (const config &j, adj_abilities.child_range(ability)) 
{
+               foreach (const config &j, 
adj_abilities.child_range(tag_name)) {
                        if (unit_abilities::affects_side(j, 
teams_manager::get_teams(), side(), it->side()) &&
-                           it->ability_active(ability, j, adjacent[i]) &&
-                           ability_affects_adjacent(ability,  j, i, loc))
+                           it->ability_active(tag_name, j, adjacent[i]) &&
+                           ability_affects_adjacent(tag_name,  j, i, loc))
                                return true;
                }
        }
@@ -152,15 +152,15 @@
 
        return false;
 }
-unit_ability_list unit::get_abilities(const std::string& ability, const 
map_location& loc) const
+unit_ability_list unit::get_abilities(const std::string& tag_name, const 
map_location& loc) const
 {
        unit_ability_list res;
 
        if (const config &abilities = cfg_.child("abilities"))
        {
-               foreach (const config &i, abilities.child_range(ability)) {
-                       if (ability_active(ability, i, loc) &&
-                           ability_affects_self(ability, i, loc))
+               foreach (const config &i, abilities.child_range(tag_name)) {
+                       if (ability_active(tag_name, i, loc) &&
+                           ability_affects_self(tag_name, i, loc))
                                res.cfgs.push_back(std::pair<const config *, 
map_location>(&i, loc));
                }
        }
@@ -175,10 +175,10 @@
                const config &adj_abilities = it->cfg_.child("abilities");
                if (!adj_abilities)
                        continue;
-               foreach (const config &j, adj_abilities.child_range(ability)) 
{
+               foreach (const config &j, 
adj_abilities.child_range(tag_name)) {
                        if (unit_abilities::affects_side(j, 
teams_manager::get_teams(), side(), it->side()) &&
-                           it->ability_active(ability, j, adjacent[i]) &&
-                           ability_affects_adjacent(ability, j, i, loc))
+                           it->ability_active(tag_name, j, adjacent[i]) &&
+                           ability_affects_adjacent(tag_name, j, i, loc))
                                res.cfgs.push_back(std::pair<const config *, 
map_location>(&j, adjacent[i]));
                }
        }




Related Messages


Powered by MHonArc, Updated Mon Jan 30 00:00:05 2012