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)
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 ***********************************************************************/
14 #ifndef FC__CMA_CORE_H
15 #define FC__CMA_CORE_H
19 #endif /* __cplusplus */
22 * CM stands for citizen management.
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.
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.
37 #include "attribute.h"
40 * Called once per client start.
44 /* Change the actual city setting. */
45 bool cma_apply_result(struct city
*pcity
, const struct cm_result
*result
);
47 /* Till a call of cma_release_city the city will be managed by the agent. */
48 void cma_put_city_under_agent(struct city
*pcity
,
49 const struct cm_parameter
*const parameter
);
51 /* Release the city from the agent. */
52 void cma_release_city(struct city
*pcity
);
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.
59 bool cma_is_city_under_agent(const struct city
*pcity
,
60 struct cm_parameter
*parameter
);
62 /***************** utility methods *************************************/
63 bool cma_get_parameter(enum attr_city attr
, int city_id
,
64 struct cm_parameter
*parameter
);
65 void cma_set_parameter(enum attr_city attr
, int city_id
,
66 const struct cm_parameter
*parameter
);
70 #endif /* __cplusplus */
72 #endif /* FC__CMA_CORE_H */