Author: silene
Date: Sat Apr 4 19:50:47 2009
New Revision: 34483
URL: http://svn.gna.org/viewcvs/wesnoth?rev=34483&view=rev
Log:
Cleaned code by removing useless pointers.
Modified:
trunk/src/unit.cpp
Modified: trunk/src/unit.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit.cpp?rev=34483&r1=34482&r2=34483&view=diff
==============================================================================
--- trunk/src/unit.cpp (original)
+++ trunk/src/unit.cpp Sat Apr 4 19:50:47 2009
@@ -1602,26 +1602,24 @@
if ( has_formula() || has_loop_formula() || (formula_vars_ &&
formula_vars_->empty() == false) ) {
- cfg.add_child("ai");
- config* ai = cfg.child("ai");
-
- if (has_formula())
- (*ai)["formula"] = unit_formula_;
-
- if (has_loop_formula())
- (*ai)["loop_formula"] = unit_loop_formula_;
-
- if (has_priority_formula())
- (*ai)["priority"] = unit_priority_formula_;
-
- if (has_on_fail_formula())
- (*ai)["on_fail"] = unit_on_fail_formula_;
-
-
- if (formula_vars_ && formula_vars_->empty() == false)
- {
- (*ai).add_child("vars");
- config* ai_vars = (*ai).child("vars");
+ config &ai = cfg.add_child("ai");
+
+ if (has_formula())
+ ai["formula"] = unit_formula_;
+
+ if (has_loop_formula())
+ ai["loop_formula"] = unit_loop_formula_;
+
+ if (has_priority_formula())
+ ai["priority"] = unit_priority_formula_;
+
+ if (has_on_fail_formula())
+ ai["on_fail"] = unit_on_fail_formula_;
+
+
+ if (formula_vars_ && formula_vars_->empty() == false)
+ {
+ config &ai_vars = ai.add_child("vars");
std::string str;
for(game_logic::map_formula_callable::const_iterator i =
formula_vars_->begin(); i != formula_vars_->end(); ++i)
@@ -1629,7 +1627,7 @@
i->second.serialize_to_string(str);
if (!str.empty())
{
- (*ai_vars)[i->first] = str;
+ ai_vars[i->first] = str;
str.clear();
}
}
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits