Freeciv-3.1
Loading...
Searching...
No Matches
taiplayer.h
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13#ifndef FC__TAIPLAYER_H
14#define FC__TAIPLAYER_H
15
16/* utility */
17#include "fcthread.h"
18
19/* common */
20#include "player.h"
21
22/* ai/default */
23#include "aidata.h"
24
25/* ai/threaded */
26#include "taimsg.h"
27
28struct player;
29
31{
32 fc_thread_cond thr_cond;
33 fc_mutex mutex;
34 struct taimsg_list *msglist;
35};
36
38{
39 struct taireq_list *reqlist;
40};
41
42struct tai_plr
43{
44 struct ai_plr defai; /* Keep this first so default ai finds it */
45};
46
47void tai_init_threading(void);
48
49bool tai_thread_running(void);
50
51void tai_player_alloc(struct ai_type *ait, struct player *pplayer);
52void tai_player_free(struct ai_type *ait, struct player *pplayer);
53void tai_control_gained(struct ai_type *ait, struct player *pplayer);
54void tai_control_lost(struct ai_type *ait, struct player *pplayer);
55void tai_refresh(struct ai_type *ait, struct player *pplayer);
56
57void tai_msg_to_thr(struct tai_msg *msg);
58
59void tai_req_from_thr(struct tai_req *req);
60
61static inline struct tai_plr *tai_player_data(struct ai_type *ait,
62 const struct player *pplayer)
63{
64 return (struct tai_plr *)player_ai_data(pplayer, ait);
65}
66
67#endif /* FC__TAIPLAYER_H */
void * player_ai_data(const struct player *pplayer, const struct ai_type *ai)
Definition player.c:1904
Definition ai.h:50
fc_mutex mutex
Definition taiplayer.h:33
fc_thread_cond thr_cond
Definition taiplayer.h:32
struct taimsg_list * msglist
Definition taiplayer.h:34
struct ai_plr defai
Definition taiplayer.h:44
struct taireq_list * reqlist
Definition taiplayer.h:39
void tai_msg_to_thr(struct tai_msg *msg)
Definition taiplayer.c:274
bool tai_thread_running(void)
Definition taiplayer.c:295
void tai_control_gained(struct ai_type *ait, struct player *pplayer)
Definition taiplayer.c:196
void tai_control_lost(struct ai_type *ait, struct player *pplayer)
Definition taiplayer.c:217
void tai_player_alloc(struct ai_type *ait, struct player *pplayer)
Definition taiplayer.c:167
void tai_player_free(struct ai_type *ait, struct player *pplayer)
Definition taiplayer.c:180
void tai_init_threading(void)
Definition taiplayer.c:63
void tai_req_from_thr(struct tai_req *req)
Definition taiplayer.c:285
void tai_refresh(struct ai_type *ait, struct player *pplayer)
Definition taiplayer.c:239
static struct tai_plr * tai_player_data(struct ai_type *ait, const struct player *pplayer)
Definition taiplayer.h:61