Freeciv-3.1: /fast/freeciv/nightly/S3_1/ai/threaded/taiplayer.h Source File

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
30 struct tai_msgs
31{
32 fc_thread_cond thr_cond;
33 fc_mutex mutex;
34 struct taimsg_list *msglist;
35};
36
37 struct tai_reqs
38{
39 struct taireq_list *reqlist;
40};
41
42 struct 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
61 static 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 */
aidata.h
fcthread.h
player_ai_data
void * player_ai_data(const struct player *pplayer, const struct ai_type *ai)
Definition player.c:1904
player.h
ai_plr
Definition aidata.h:71
ai_type
Definition ai.h:50
player
Definition player.h:249
tai_msg
Definition taimsg.h:33
tai_msgs
Definition taiplayer.h:31
tai_msgs::mutex
fc_mutex mutex
Definition taiplayer.h:33
tai_msgs::thr_cond
fc_thread_cond thr_cond
Definition taiplayer.h:32
tai_msgs::msglist
struct taimsg_list * msglist
Definition taiplayer.h:34
tai_plr
Definition taiplayer.h:43
tai_plr::defai
struct ai_plr defai
Definition taiplayer.h:44
tai_req
Definition taimsg.h:40
tai_reqs
Definition taiplayer.h:38
tai_reqs::reqlist
struct taireq_list * reqlist
Definition taiplayer.h:39
taimsg.h
tai_msg_to_thr
void tai_msg_to_thr(struct tai_msg *msg)
Definition taiplayer.c:274
tai_thread_running
bool tai_thread_running(void)
Definition taiplayer.c:295
tai_control_gained
void tai_control_gained(struct ai_type *ait, struct player *pplayer)
Definition taiplayer.c:196
tai_control_lost
void tai_control_lost(struct ai_type *ait, struct player *pplayer)
Definition taiplayer.c:217
tai_player_alloc
void tai_player_alloc(struct ai_type *ait, struct player *pplayer)
Definition taiplayer.c:167
tai_player_free
void tai_player_free(struct ai_type *ait, struct player *pplayer)
Definition taiplayer.c:180
tai_init_threading
void tai_init_threading(void)
Definition taiplayer.c:63
tai_req_from_thr
void tai_req_from_thr(struct tai_req *req)
Definition taiplayer.c:285
tai_refresh
void tai_refresh(struct ai_type *ait, struct player *pplayer)
Definition taiplayer.c:239
tai_player_data
static struct tai_plr * tai_player_data(struct ai_type *ait, const struct player *pplayer)
Definition taiplayer.h:61