Freeciv-3.3
Loading...
Searching...
No Matches
agents.h
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 2001 - R. Falke
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#ifndef FC__AGENTS_H
15#define FC__AGENTS_H
16
17#ifdef __cplusplus
18extern "C" {
19#endif /* __cplusplus */
20
21#include "support.h" /* bool type */
22
23#include "fc_types.h"
24
25/*
26 * Besides callback for convenience client/agents/agents also
27 * implements a "flattening" of the call stack i.e. to ensure that
28 * every agent is only called once at any time.
29 */
30
31/* Don't use the very last level unless you know what you're doing */
32#define LAST_AGENT_LEVEL 99
33
34#define MAX_AGENT_NAME_LEN 10
35
39
49
50void agents_init(void);
51void agents_free(void);
52void register_agent(const struct agent *agent);
53bool agents_busy(void);
54
55/* Called from client/packhand.c */
56void agents_disconnect(void);
59void agents_freeze_hint(void);
60void agents_thaw_hint(void);
61void agents_game_joined(void);
62void agents_game_start(void);
63void agents_before_new_turn(void);
64void agents_start_turn(void);
65void agents_new_turn(void);
66
67void agents_unit_changed(struct unit *punit);
68void agents_unit_new(struct unit *punit);
69void agents_unit_remove(struct unit *punit);
70
71void agents_city_changed(struct city *pcity);
72void agents_city_new(struct city *pcity);
73void agents_city_remove(struct city *pcity);
74
75void agents_tile_changed(struct tile *ptile);
76void agents_tile_new(struct tile *ptile);
77void agents_tile_remove(struct tile *ptile);
78
79/* Called from agents */
81 struct city *pcity);
83 struct unit *punit);
85 int last_request_id);
86
87#ifdef __cplusplus
88}
89#endif /* __cplusplus */
90
91#endif /* FC__AGENTS_H */
void agents_unit_changed(struct unit *punit)
Definition agents.c:512
callback_type
Definition agents.h:36
@ CB_LAST
Definition agents.h:37
@ CB_NEW
Definition agents.h:37
@ CB_REMOVE
Definition agents.h:37
@ CB_CHANGE
Definition agents.h:37
void agents_city_remove(struct city *pcity)
Definition agents.c:641
void agents_free(void)
Definition agents.c:349
void agents_thaw_hint(void)
Definition agents.c:441
void agents_disconnect(void)
Definition agents.c:405
void agents_game_start(void)
Definition agents.c:458
void wait_for_requests(const char *agent_name, int first_request_id, int last_request_id)
Definition agents.c:740
void agents_tile_remove(struct tile *ptile)
Definition agents.c:668
void agents_city_new(struct city *pcity)
Definition agents.c:615
#define MAX_AGENT_NAME_LEN
Definition agents.h:34
void agents_start_turn(void)
Definition agents.c:475
void agents_tile_changed(struct tile *ptile)
Definition agents.c:692
void agents_unit_new(struct unit *punit)
Definition agents.c:537
bool agents_busy(void)
Definition agents.c:804
void agents_unit_remove(struct unit *punit)
Definition agents.c:563
void agents_processing_started(void)
Definition agents.c:414
void agents_tile_new(struct tile *ptile)
Definition agents.c:716
void agents_processing_finished(void)
Definition agents.c:423
void agents_new_turn(void)
Definition agents.c:484
void agents_city_changed(struct city *pcity)
Definition agents.c:589
void cause_a_city_changed_for_agent(const char *name_of_calling_agent, struct city *pcity)
Definition agents.c:791
void agents_game_joined(void)
Definition agents.c:450
void register_agent(const struct agent *agent)
Definition agents.c:382
void agents_init(void)
Definition agents.c:335
void cause_a_unit_changed_for_agent(const char *name_of_calling_agent, struct unit *punit)
Definition agents.c:778
void agents_freeze_hint(void)
Definition agents.c:432
void agents_before_new_turn(void)
Definition agents.c:467
char * incite_cost
Definition comments.c:76
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
Definition dialogs_g.h:74
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit int const struct action *paction struct unit struct city * pcity
Definition dialogs_g.h:78
Definition agents.h:40
int level
Definition agents.h:42
void(* unit_callbacks[CB_LAST])(int)
Definition agents.h:46
void(* tile_callbacks[CB_LAST])(struct tile *ptile)
Definition agents.h:47
char name[MAX_AGENT_NAME_LEN]
Definition agents.h:41
void(* city_callbacks[CB_LAST])(int)
Definition agents.h:45
void(* turn_start_notify)(void)
Definition agents.h:44
Definition city.h:317
Definition tile.h:50
Definition unit.h:140