Freeciv21
Develop your civilization from humble roots to a global empire
aiplayer.h
Go to the documentation of this file.
1 /*__ ___ ***************************************
2 / \ / \ Copyright (c) 1996-2020 Freeciv21 and Freeciv
3 \_ \ / __/ contributors. This file is part of Freeciv21.
4  _\ \ / /__ Freeciv21 is free software: you can redistribute it
5  \___ \____/ __/ and/or modify it under the terms of the GNU General
6  \_ _/ Public License as published by the Free Software
7  | @ @ \_ Foundation, either version 3 of the License,
8  | or (at your option) any later version.
9  _/ /\ You should have received a copy of the GNU
10  /o) (o/\ \_ General Public License along with Freeciv21.
11  \_____/ / If not, see https://www.gnu.org/licenses/.
12  \____/ ********************************************************/
13 #pragma once
14 
15 // common
16 #include "player.h"
17 #include "unit.h"
18 
19 struct player;
20 struct ai_plr;
21 
22 void dai_player_alloc(struct ai_type *ait, struct player *pplayer);
23 void dai_player_free(struct ai_type *ait, struct player *pplayer);
24 void dai_player_save_relations(struct ai_type *ait, const char *aitstr,
25  struct player *pplayer, struct player *other,
26  struct section_file *file, int plrno);
27 void dai_player_load_relations(struct ai_type *ait, const char *aitstr,
28  struct player *pplayer, struct player *other,
29  const struct section_file *file, int plrno);
30 
31 void dai_player_copy(struct ai_type *ait, struct player *original,
32  struct player *created);
33 void dai_gained_control(struct ai_type *ait, struct player *pplayer);
34 
35 static inline struct ai_city *def_ai_city_data(const struct city *pcity,
36  struct ai_type *deftype)
37 {
38  return static_cast<struct ai_city *>(city_ai_data(pcity, deftype));
39 }
40 
41 static inline struct unit_ai *def_ai_unit_data(const struct unit *punit,
42  struct ai_type *deftype)
43 {
44  return static_cast<struct unit_ai *>(unit_ai_data(punit, deftype));
45 }
46 
47 static inline struct ai_plr *def_ai_player_data(const struct player *pplayer,
48  struct ai_type *deftype)
49 {
50  return static_cast<struct ai_plr *>(player_ai_data(pplayer, deftype));
51 }
52 
55 };
static struct ai_plr * def_ai_player_data(const struct player *pplayer, struct ai_type *deftype)
Definition: aiplayer.h:47
void dai_player_alloc(struct ai_type *ait, struct player *pplayer)
Initialize player for use with default AI.
Definition: aiplayer.cpp:34
static struct ai_city * def_ai_city_data(const struct city *pcity, struct ai_type *deftype)
Definition: aiplayer.h:35
static struct unit_ai * def_ai_unit_data(const struct unit *punit, struct ai_type *deftype)
Definition: aiplayer.h:41
void dai_player_copy(struct ai_type *ait, struct player *original, struct player *created)
Copy default ai data from player to player.
Definition: aiplayer.cpp:117
void dai_player_save_relations(struct ai_type *ait, const char *aitstr, struct player *pplayer, struct player *other, struct section_file *file, int plrno)
Store player specific data to savegame.
Definition: aiplayer.cpp:62
void dai_player_free(struct ai_type *ait, struct player *pplayer)
Free player from use with default AI.
Definition: aiplayer.cpp:46
void dai_gained_control(struct ai_type *ait, struct player *pplayer)
Ai got control of the player.
Definition: aiplayer.cpp:144
void dai_player_load_relations(struct ai_type *ait, const char *aitstr, struct player *pplayer, struct player *other, const struct section_file *file, int plrno)
Load player vs player specific data from savegame.
Definition: aiplayer.cpp:87
void * city_ai_data(const struct city *pcity, const struct ai_type *ai)
Return pointer to ai data of given city and ai type.
Definition: city.cpp:3509
void * player_ai_data(const struct player *pplayer, const struct ai_type *ai)
Return pointer to ai data of given player and ai type.
Definition: player.cpp:1838
Definition: aidata.h:63
Definition: ai.h:42
Definition: city.h:291
bool contemplace_workers
Definition: aiplayer.h:54
Definition: player.h:231
Definition: aiunit.h:39
Definition: unit.h:134
void * unit_ai_data(const struct unit *punit, const struct ai_type *ai)
Return pointer to ai data of given unit and ai type.
Definition: unit.cpp:2039