Freeciv-3.2: /fast/freeciv/nightly/S3_2/ai/tex/texaimsg.c Source File

Freeciv-3.2

Loading...
Searching...
No Matches
texaimsg.c
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
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18/* ai/tex */
19#include "texaiplayer.h"
20
21#include "texaimsg.h"
22
23/**********************************************************************/
26 void texai_send_msg(enum texaimsgtype type, struct player *pplayer,
27 void *data)
28{
29 struct texai_msg *msg;
30
31 if (!texai_thread_running()) {
32 /* No player thread to send messages to */
33 return;
34 }
35
36 msg = fc_malloc(sizeof(*msg));
37
38 msg->type = type;
39 msg->plr = pplayer;
40 msg->data = data;
41
42 texai_msg_to_thr(msg);
43}
44
45/**********************************************************************/
48 void texai_send_req(enum texaireqtype type, struct player *pplayer,
49 void *data)
50{
51 struct texai_req *req = fc_malloc(sizeof(*req));
52
53 req->type = type;
54 req->plr = pplayer;
55 req->data = data;
56
57 texai_req_from_thr(req);
58}
59
60/**********************************************************************/
63 void texai_first_activities(struct ai_type *ait, struct player *pplayer)
64{
65 texai_send_msg(TEXAI_MSG_FIRST_ACTIVITIES, pplayer, NULL);
66}
67
68/**********************************************************************/
71 void texai_phase_finished(struct ai_type *ait, struct player *pplayer)
72{
73 texai_send_msg(TEXAI_MSG_PHASE_FINISHED, pplayer, NULL);
74}
incite_cost
char * incite_cost
Definition comments.c:74
type
GType type
Definition repodlgs.c:1313
fc_malloc
#define fc_malloc(sz)
Definition mem.h:34
ai_type
Definition ai.h:50
player
Definition player.h:247
texai_msg
Definition texaimsg.h:55
texai_msg::plr
struct player * plr
Definition texaimsg.h:57
texai_msg::type
enum texaimsgtype type
Definition texaimsg.h:56
texai_msg::data
void * data
Definition texaimsg.h:58
texai_req
Definition texaimsg.h:62
texai_req::data
void * data
Definition texaimsg.h:65
texai_req::type
enum texaireqtype type
Definition texaimsg.h:63
texai_req::plr
struct player * plr
Definition texaimsg.h:64
texai_first_activities
void texai_first_activities(struct ai_type *ait, struct player *pplayer)
Definition texaimsg.c:63
texai_send_msg
void texai_send_msg(enum texaimsgtype type, struct player *pplayer, void *data)
Definition texaimsg.c:26
texai_phase_finished
void texai_phase_finished(struct ai_type *ait, struct player *pplayer)
Definition texaimsg.c:71
texai_send_req
void texai_send_req(enum texaireqtype type, struct player *pplayer, void *data)
Definition texaimsg.c:48
texaimsg.h
texai_thread_running
bool texai_thread_running(void)
Definition texaiplayer.c:435
texai_req_from_thr
void texai_req_from_thr(struct texai_req *req)
Definition texaiplayer.c:425
texai_msg_to_thr
void texai_msg_to_thr(struct texai_msg *msg)
Definition texaiplayer.c:414
texaiplayer.h