Author: crab
Date: Thu Apr 23 00:43:41 2009
New Revision: 35128

URL: http://svn.gna.org/viewcvs/wesnoth?rev=35128&view=rev
Log:
AI Refactoring: some more comments of ai_action_result interface

Modified:
    trunk/src/ai/ai_actions.cpp
    trunk/src/ai/ai_actions.hpp

Modified: trunk/src/ai/ai_actions.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/ai/ai_actions.cpp?rev=35128&r1=35127&r2=35128&view=diff
==============================================================================
--- trunk/src/ai/ai_actions.cpp (original)
+++ trunk/src/ai/ai_actions.cpp Thu Apr 23 00:43:41 2009
@@ -111,6 +111,10 @@
 }
 
 
+int ai_action_result::get_status(){
+       return status_;
+}
+
 bool ai_action_result::is_success() const
 {
        return (status_ == ai_action_result::AI_ACTION_SUCCESS);
@@ -233,7 +237,7 @@
        //allowed teleports
        std::set<map_location> allowed_teleports;
 
-       //@todo: calculate allowed teleports
+       //@todo 1.7: calculate allowed teleports
 
        //do an A*-search
        route_ = a_star_search(un->first, to_, 10000.0, &calc, map.w(), 
map.h(), &allowed_teleports);

Modified: trunk/src/ai/ai_actions.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/ai/ai_actions.hpp?rev=35128&r1=35127&r2=35128&view=diff
==============================================================================
--- trunk/src/ai/ai_actions.hpp (original)
+++ trunk/src/ai/ai_actions.hpp Thu Apr 23 00:43:41 2009
@@ -37,32 +37,79 @@
 
        virtual ~ai_action_result();
 
+       /* check as must as possible without executing anything */
        void check_before();
+
+       /* execute the action */
        void execute();
+
+       /* check the return value of the action. mandatory to call. */
        bool is_ok();
+
+       /* get the return value of the action */
+       int get_status();
+
+       /* describe the action */
        virtual std::string do_describe() const =0;
 protected:
        ai_action_result( unsigned int side );
+
+       /* do check before execution or just check. setting status_ via 
set_error to != cancels the execution.*/
        virtual void do_check_before() = 0;
+
+       /* do some additional checks after execution. */
        virtual void do_check_after() = 0;
+
+       /* execute. assert(is_success()) */
        virtual void do_execute() = 0;
+
+       /* runs before cheching before execution */
        virtual void do_init_for_execution() = 0;
 
+       /* are we going to execute the action now ? */
        bool is_execution() const;
+
+       /* return the side number */
        unsigned int get_side() const;
+
+       /* return real information about the game state */
        ai_interface::info& get_info() const;
+
+       /* return subjective information about the game state */
        ai_interface::info& get_subjective_info() const;
+
+       /* are we using the subjective info ? */
        bool using_subjective_info() const;
+
+       /* get the team object corresponding to current side */
        team& get_my_team(ai_interface::info info) const;
+
+       /* set error code */
        void set_error(int error_code);
+
+       /* is error code equal to 0 (no errors)? */
        bool is_success() const;
 private:
+
+       /* Check after the execution */
        void check_after();
+
+       /* Initialization before execution */
        void init_for_execution();
+
+       /* set the flag that the return value had been checked */
        void set_ok_checked();
+
+       /* was the return value checked ? */
        bool return_value_checked_;
+
+       /* current side number */
        unsigned int side_;
+
+       /* execution status. if 0, all is ok. if !=0, then there were some 
problems. */
        int status_;
+
+       /* are we going to execute the action now ? */
        bool is_execution_;
 
 };
@@ -271,4 +318,7 @@
 
 
 };
+
+
+//@todo 1.7 Add an ai action to send a chat message to a player
 #endif


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

Reply via email to