The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
game_info.hpp
Go to the documentation of this file.
1 /*
2  Copyright (C) 2003 - 2016 by David White <[email protected]>
3  Part of the Battle for Wesnoth Project http://www.wesnoth.org/
4 
5  This program is free software; you can redistribute it and/or modify
6  it under the terms of the GNU General Public License as published by
7  the Free Software Foundation; either version 2 of the License, or
8  (at your option) any later version.
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY.
11 
12  See the COPYING file for more details.
13 */
14 
15 /**
16  * @file
17  * Game information for the AI
18  */
19 
20 #ifndef AI_GAME_INFO_HPP_INCLUDED
21 #define AI_GAME_INFO_HPP_INCLUDED
22 
23 #include <boost/shared_ptr.hpp>
24 #include "map/location.hpp"
25 namespace pathfind {
26  struct paths;
27 }
28 
29 #include <map>
30 
31 class game_display;
32 class gamemap;
33 class unit_map;
34 class team;
35 class tod_manager;
36 
37 /**
38  * info is structure which holds references to all the important objects
39  * that an AI might need access to, in order to make and implement its
40  * decisions.
41  */
42 namespace ai {
43 
44 typedef int side_number;
45 
46 /** The standard way in which a map of possible moves is recorded. */
47 typedef std::multimap<map_location,map_location> move_map;
48 
49 /** The standard way in which a map of possible movement routes to location is recorded*/
50 typedef std::map<map_location,pathfind::paths> moves_map;
51 
53 
55 
57 typedef std::vector<attack_analysis> attacks_vector;
58 
59 class readonly_context;
60 class readwrite_context;
61 class default_ai_context;
62 class ai_context;
63 
64 class aspect;
65 class candidate_action;
66 class engine;
67 class goal;
68 class known_aspect;
69 class stage;
70 
71 template<typename T>
72 class typesafe_aspect;
73 
74 template<typename T>
75 struct aspect_type {
77  typedef std::vector< boost::shared_ptr< typesafe_aspect<T> > > typesafe_ptr_vector;
78 };
79 
80 template<typename T>
82 
83 template<typename T>
86  typedef std::vector< boost::shared_ptr< typesafe_known_aspect<T> > > typesafe_ptr_vector;
87 };
88 
89 class action_result;
90 class attack_result;
91 class recall_result;
92 class recruit_result;
93 class move_result;
94 class move_and_attack_result;
95 class stopunit_result;
97 
106 
113 
114 typedef std::map<std::string, aspect_ptr > aspect_map;
115 typedef std::map<std::string, known_aspect_ptr > known_aspect_map;
116 
117 class game_info {
118 public:
119 
121  : recent_attacks()
122  {}
123 
124  /** hack. @todo 1.9 rework that via extended event system, or at least ensure it hurts no one */
125  std::set<map_location> recent_attacks;
126 };
127 
128 } //of namespace ai
129 
130 #endif
boost::shared_ptr< recall_result > recall_result_ptr
Definition: game_info.hpp:100
boost::shared_ptr< engine > engine_ptr
Definition: game_info.hpp:109
boost::shared_ptr< stage > stage_ptr
Definition: game_info.hpp:112
std::vector< boost::shared_ptr< typesafe_known_aspect< T > > > typesafe_ptr_vector
Definition: game_info.hpp:86
boost::shared_ptr< aspect > aspect_ptr
Definition: game_info.hpp:107
boost::shared_ptr< ai_composite > ai_ptr
Definition: game_info.hpp:52
std::map< map_location, pathfind::paths > moves_map
The standard way in which a map of possible movement routes to location is recorded.
Definition: game_info.hpp:50
boost::shared_ptr< action_result > action_result_ptr
Definition: game_info.hpp:96
boost::shared_ptr< attack_result > attack_result_ptr
Definition: game_info.hpp:99
boost::shared_ptr< typesafe_aspect< T > > typesafe_ptr
Definition: game_info.hpp:76
std::vector< attack_analysis > attacks_vector
Definition: game_info.hpp:56
std::map< std::string, known_aspect_ptr > known_aspect_map
Definition: game_info.hpp:115
std::multimap< map_location, map_location > move_map
The standard way in which a map of possible moves is recorded.
Definition: game_info.hpp:47
This class stores all the data for a single 'side' (in game nomenclature).
Definition: team.hpp:50
A small explanation about what's going on here: Each action has access to two game_info objects First...
Definition: actions.cpp:57
boost::shared_ptr< move_and_attack_result > move_and_attack_result_ptr
Definition: game_info.hpp:103
Encapsulates the map of the game.
Definition: map.hpp:37
boost::shared_ptr< goal > goal_ptr
Definition: game_info.hpp:110
boost::shared_ptr< synced_command_result > synced_command_result_ptr
Definition: game_info.hpp:105
boost::shared_ptr< recruit_result > recruit_result_ptr
Definition: game_info.hpp:101
std::vector< boost::shared_ptr< typesafe_aspect< T > > > typesafe_ptr_vector
Definition: game_info.hpp:77
std::map< std::string, aspect_ptr > aspect_map
Definition: game_info.hpp:114
std::set< map_location > recent_attacks
hack.
Definition: game_info.hpp:125
boost::shared_ptr< candidate_action > candidate_action_ptr
Definition: rca.hpp:148
boost::shared_ptr< typesafe_known_aspect< T > > typesafe_ptr
Definition: game_info.hpp:85
boost::shared_ptr< stopunit_result > stopunit_result_ptr
Definition: game_info.hpp:104
Container associating units to locations.
Definition: map.hpp:90
int side_number
Definition: game_info.hpp:44
boost::shared_ptr< move_result > move_result_ptr
Definition: game_info.hpp:102
boost::shared_ptr< known_aspect > known_aspect_ptr
Definition: game_info.hpp:111