The Battle for Wesnoth 1.21.0-dev
 
Loading...
Searching...
No Matches
game_info.hpp
Go to the documentation of this file.
1/*
2 Copyright (C) 2003 - 2025
3 by David White <dave@whitevine.net>
4 Part of the Battle for Wesnoth Project https://www.wesnoth.org/
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY.
12
13 See the COPYING file for more details.
14*/
15
16/**
17 * @file
18 * Game information for the AI
19 */
20
21#pragma once
22
23#include "map/location.hpp"
24
25#include <map>
26#include <memory>
27
28namespace pathfind
29{
30struct paths;
31}
32
33/**
34 * info is structure which holds references to all the important objects
35 * that an AI might need access to, in order to make and implement its
36 * decisions.
37 */
38namespace ai
39{
40typedef int side_number;
41
42/** The standard way in which a map of possible moves is recorded. */
43typedef std::multimap<map_location, map_location> move_map;
44
45/** The standard way in which a map of possible movement routes to location is recorded*/
46typedef std::map<map_location, pathfind::paths> moves_map;
47
48class ai_composite;
49typedef std::unique_ptr<ai_composite> composite_ai_ptr;
50
51class attack_analysis;
52typedef std::vector<attack_analysis> attacks_vector;
53
54template<typename T>
55class typesafe_aspect;
56
57template<typename T>
58using typesafe_aspect_ptr = std::shared_ptr<typesafe_aspect<T>>;
59
60template<typename T>
61using typesafe_aspect_vector = std::vector<typesafe_aspect_ptr<T>>;
62
63template<typename T>
65
66template<typename T>
67using typesafe_known_aspect_ptr = std::shared_ptr<typesafe_known_aspect<T>>;
68
69template<typename T>
70using typesafe_known_aspect_vector = std::vector<typesafe_known_aspect_ptr<T>>;
71
72class action_result;
73class attack_result;
74class recall_result;
75class recruit_result;
76class move_result;
77class move_and_attack_result;
78class stopunit_result;
80
81typedef std::shared_ptr<action_result> action_result_ptr;
82typedef std::shared_ptr<attack_result> attack_result_ptr;
83typedef std::shared_ptr<recall_result> recall_result_ptr;
84typedef std::shared_ptr<recruit_result> recruit_result_ptr;
85typedef std::shared_ptr<move_result> move_result_ptr;
86typedef std::shared_ptr<move_and_attack_result> move_and_attack_result_ptr;
87typedef std::shared_ptr<stopunit_result> stopunit_result_ptr;
88typedef std::shared_ptr<synced_command_result> synced_command_result_ptr;
89
90class aspect;
92class engine;
93class goal;
94class known_aspect;
95class stage;
96
97typedef std::shared_ptr<aspect> aspect_ptr;
98typedef std::shared_ptr<candidate_action> candidate_action_ptr;
99typedef std::shared_ptr<engine> engine_ptr;
100typedef std::shared_ptr<goal> goal_ptr;
101typedef std::shared_ptr<known_aspect> known_aspect_ptr;
102typedef std::shared_ptr<stage> stage_ptr;
103
104typedef std::map<std::string, aspect_ptr> aspect_map;
105typedef std::map<std::string, known_aspect_ptr> known_aspect_map;
106
108{
109public:
112 {
113 }
114
115 std::set<map_location> recent_attacks;
116};
117
118} // of namespace ai
std::set< map_location > recent_attacks
A small explanation about what's going on here: Each action has access to two game_info objects First...
Definition actions.cpp:59
std::shared_ptr< engine > engine_ptr
Definition game_info.hpp:99
std::vector< attack_analysis > attacks_vector
Definition game_info.hpp:52
std::shared_ptr< recruit_result > recruit_result_ptr
Definition game_info.hpp:84
std::shared_ptr< move_and_attack_result > move_and_attack_result_ptr
Definition game_info.hpp:86
std::shared_ptr< typesafe_known_aspect< T > > typesafe_known_aspect_ptr
Definition game_info.hpp:67
std::shared_ptr< typesafe_aspect< T > > typesafe_aspect_ptr
Definition game_info.hpp:58
std::map< std::string, known_aspect_ptr > known_aspect_map
std::shared_ptr< aspect > aspect_ptr
Definition game_info.hpp:97
std::shared_ptr< attack_result > attack_result_ptr
Definition game_info.hpp:82
std::shared_ptr< stopunit_result > stopunit_result_ptr
Definition game_info.hpp:87
std::multimap< map_location, map_location > move_map
The standard way in which a map of possible moves is recorded.
Definition game_info.hpp:43
std::vector< typesafe_known_aspect_ptr< T > > typesafe_known_aspect_vector
Definition game_info.hpp:70
std::shared_ptr< goal > goal_ptr
std::shared_ptr< stage > stage_ptr
std::shared_ptr< synced_command_result > synced_command_result_ptr
Definition game_info.hpp:88
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:46
int side_number
Definition game_info.hpp:40
std::shared_ptr< candidate_action > candidate_action_ptr
Definition rca.hpp:145
std::shared_ptr< move_result > move_result_ptr
Definition game_info.hpp:85
std::shared_ptr< known_aspect > known_aspect_ptr
std::shared_ptr< action_result > action_result_ptr
Definition game_info.hpp:81
std::shared_ptr< recall_result > recall_result_ptr
Definition game_info.hpp:83
std::map< std::string, aspect_ptr > aspect_map
std::unique_ptr< ai_composite > composite_ai_ptr
Definition game_info.hpp:49
std::vector< typesafe_aspect_ptr< T > > typesafe_aspect_vector
Definition game_info.hpp:61