Freeciv-3.3
Loading...
Searching...
No Matches
cma_core.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__CMA_CORE_H
15#define FC__CMA_CORE_H
16
17#ifdef __cplusplus
18extern "C" {
19#endif /* __cplusplus */
20
21/*
22 * CM stands for citizen management.
23 *
24 * The purpose of this module is to manage the citizens of a city. The
25 * caller has to provide a goal (struct cma_parameter) which
26 * determines in which way the citizens are allocated and placed. The
27 * module will also avoid disorder.
28 *
29 * The plan defines a minimal surplus. The module will try to get the
30 * required surplus. If there are citizens free after allocation of
31 * the minimal surplus these citizens will get arranged to maximize
32 * the sum over base*factor. The base depends upon the factor_target.
33 */
34
35#include "cm.h"
36
37#include "attribute.h"
38
39/*
40 * Called once per client start.
41 */
42void cma_init(void);
43
44/* Change the actual city setting. */
45bool cma_apply_result(struct city *pcity, const struct cm_result *result);
46
47/* Till a call of cma_release_city the city will be managed by the agent. */
48void cma_put_city_under_agent(struct city *pcity,
49 const struct cm_parameter *const parameter);
50
51/* Release the city from the agent. */
52void cma_release_city(struct city *pcity);
53
54/*
55 * Test if the citizen in the given city are managed by the agent. The
56 * given parameter is filled if pointer is non-NULL. The parameter is
57 * only valid if cma_is_city_under_agent returns true.
58 */
59bool cma_is_city_under_agent(const struct city *pcity,
60 struct cm_parameter *parameter);
61
62/***************** utility methods *************************************/
63bool cma_get_parameter(enum attr_city attr, int city_id,
64 struct cm_parameter *parameter);
65void cma_set_parameter(enum attr_city attr, int city_id,
66 const struct cm_parameter *parameter);
67
68#ifdef __cplusplus
69}
70#endif /* __cplusplus */
71
72#endif /* FC__CMA_CORE_H */
attr_city
Definition attribute.h:37
bool cma_is_city_under_agent(const struct city *pcity, struct cm_parameter *parameter)
Definition cma_core.c:551
void cma_put_city_under_agent(struct city *pcity, const struct cm_parameter *const parameter)
Definition cma_core.c:523
bool cma_get_parameter(enum attr_city attr, int city_id, struct cm_parameter *parameter)
Definition cma_core.c:574
void cma_release_city(struct city *pcity)
Definition cma_core.c:541
void cma_set_parameter(enum attr_city attr, int city_id, const struct cm_parameter *parameter)
Definition cma_core.c:622
bool cma_apply_result(struct city *pcity, const struct cm_result *result)
Definition cma_core.c:509
void cma_init(void)
Definition cma_core.c:477
char * incite_cost
Definition comments.c:74
Definition city.h:320
Definition cm.h:52