Difference between revisions of "AI Refactoring2009Crab"

From The Battle for Wesnoth Wiki
m (CURRENT)
m (CURRENT)
Line 1: Line 1:
 
= CURRENT =
 
= CURRENT =
  
extract gamestate-changing actions from AI code to separate class.
+
extract gamestate-changing actions from AI code to separate classes.
  
 +
Proposed syntax (A):
  
 
  ai_move_command move_my_leader = execute_move_unit_command(from,to);
 
  ai_move_command move_my_leader = execute_move_unit_command(from,to);
 
  if (move_my_leader.ok()){
 
  if (move_my_leader.ok()){
        ai_recruit_command recruit = execute_recruit_command();
+
    ai_recruit_command recruit = execute_recruit_command();
 
     if (!recruit.ok()){
 
     if (!recruit.ok()){
 
         ...
 
         ...

Revision as of 17:59, 11 April 2009

CURRENT

extract gamestate-changing actions from AI code to separate classes.

Proposed syntax (A):

ai_move_command move_my_leader = execute_move_unit_command(from,to);
if (move_my_leader.ok()){
   ai_recruit_command recruit = execute_recruit_command();
   if (!recruit.ok()){
       ...
   }
}

DONE

r34723 AI Refactoring: changed 'team' to 'side' when it means 'side number that starts from 1'.

r34720 AI Refactoring: Moved location of ai_interface::info to ai_manager. Now using a single copy of ai_interface::info for all AIs, and using get_info() accessor to get it from AIs. Also, fixed side to be unsigned int where it is possible.

r34719 AI Refactoring: removed unused turn_data_ from ai_interface::info

r34705 AI Refactoring. Extracted 'team number' and 'master' from ai_interface::info. This makes ai_interface::info ai-independent and allows to push it out of ai.