mail[Wesnoth-commits] r20662 - in /trunk/src: menu_events.cpp unit.cpp unit.hpp


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

Header


Content

Posted by esr on September 22, 2007 - 11:42:
Author: esr
Date: Sat Sep 22 11:41:47 2007
New Revision: 20662

URL: http://svn.gna.org/viewcvs/wesnoth?rev=20662&view=rev
Log:
Second stage of attempt to implement :buff.  Everything is in place except 
the internals of the new add_trait() unit method.

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

Modified: trunk/src/menu_events.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/menu_events.cpp?rev=20662&r1=20661&r2=20662&view=diff
==============================================================================
--- trunk/src/menu_events.cpp (original)
+++ trunk/src/menu_events.cpp Sat Sep 22 11:41:47 2007
@@ -2167,8 +2167,7 @@
                } else if(game_config::debug && cmd == "buff") {
                        const unit_map::iterator i = 
current_unit(mousehandler);
                        if(i != units_.end()) {
-                               // FIXME: 'data' is the trait.  Set it.
-
+                               i->second.add_trait(data);
                                gui_->invalidate(i->first);
                                gui_->invalidate_unit();
                        }

Modified: trunk/src/unit.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit.cpp?rev=20662&r1=20661&r2=20662&view=diff
==============================================================================
--- trunk/src/unit.cpp (original)
+++ trunk/src/unit.cpp Sat Sep 22 11:41:47 2007
@@ -348,6 +348,13 @@
 
        // In case the unit carries EventWML, apply it now
        game_events::add_events(cfg_.get_children("event"),id_);
+}
+
+
+void unit::add_trait(std::string trait)
+{
+       //modifications_.add_child("trait", cfg);
+       apply_modifications();
 }
 
 // Apply mandatory traits (e.g. undead, mechanical) to a unit and then

Modified: trunk/src/unit.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/unit.hpp?rev=20662&r1=20661&r2=20662&view=diff
==============================================================================
--- trunk/src/unit.hpp (original)
+++ trunk/src/unit.hpp Sat Sep 22 11:41:47 2007
@@ -276,6 +276,7 @@
        void backup_state();
        void apply_modifications();
        void remove_temporary_modifications();
+       void add_trait(std::string trait);
        void generate_traits(bool musthaveonly=false);
        void generate_traits_description();
        std::string generate_description() const { return 
race_->generate_name(string_gender(cfg_["gender"])); }




Related Messages


Powered by MHonArc, Updated Sat Sep 22 13:00:41 2007