Author: silene
Date: Sun Apr 19 19:11:35 2009
New Revision: 35056

URL: http://svn.gna.org/viewcvs/wesnoth?rev=35056&view=rev
Log:
Simplified team interface a bit.

Modified:
    trunk/src/game_events.cpp
    trunk/src/scripting/lua.cpp
    trunk/src/team.hpp

Modified: trunk/src/game_events.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_events.cpp?rev=35056&r1=35055&r2=35056&view=diff
==============================================================================
--- trunk/src/game_events.cpp (original)
+++ trunk/src/game_events.cpp Sun Apr 19 19:11:35 2009
@@ -893,7 +893,7 @@
                        }
                        // Modify total gold
                        if(!gold.empty()) {
-                               
(*teams)[team_index].spend_gold((*teams)[team_index].gold()-lexical_cast_default<int>(gold));
+                               
(*teams)[team_index].set_gold(lexical_cast_default<int>(gold));
                        }
                        // Set controller
                        if(!controller.empty()) {

Modified: trunk/src/scripting/lua.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/scripting/lua.cpp?rev=35056&r1=35055&r2=35056&view=diff
==============================================================================
--- trunk/src/scripting/lua.cpp (original)
+++ trunk/src/scripting/lua.cpp Sun Apr 19 19:11:35 2009
@@ -651,10 +651,10 @@
        lua_settop(L, 3);
 
        // Find the corresponding attribute.
-       modify_int_attrib("gold", t.spend_gold(t.gold() - value));
+       modify_int_attrib("gold", t.set_gold(value));
        modify_tstring_attrib("objectives", t.set_objectives(value, true));
        modify_int_attrib("village_gold", t.set_village_gold(value));
-       modify_bool_attrib("objectives_changed", if (value) 
t.set_objectives_changed(); else t.reset_objectives_changed());
+       modify_bool_attrib("objectives_changed", 
t.set_objectives_changed(value));
        return 0;
 }
 

Modified: trunk/src/team.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/team.hpp?rev=35056&r1=35055&r2=35056&view=diff
==============================================================================
--- trunk/src/team.hpp (original)
+++ trunk/src/team.hpp Sun Apr 19 19:11:35 2009
@@ -149,6 +149,7 @@
        void new_turn() { gold_ += income(); }
        void set_time_of_day(int turn, const struct time_of_day& tod);
        void get_shared_maps();
+       void set_gold(int amount) { gold_ = amount; }
        void spend_gold(const int amount) { gold_ -= amount; }
        void set_income(const int amount)
                { info_.income = lexical_cast<std::string>(amount); }
@@ -186,7 +187,7 @@
        const std::string& current_player() const { return 
info_.current_player; }
 
        void set_objectives(const t_string& new_objectives, bool 
silently=false);
-       void set_objectives_changed() { info_.objectives_changed = true; }
+       void set_objectives_changed(bool c = true) { info_.objectives_changed = 
c; }
        void reset_objectives_changed() { info_.objectives_changed = false; }
 
        const t_string& objectives() const { return info_.objectives; }


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

Reply via email to