Freeciv-3.3
Loading...
Searching...
No Matches
server
advisors
advcity.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
/* common */
19
#include "
city.h
"
20
#include "
fc_types.h
"
21
22
/* server/advisors */
23
#include "
advdata.h
"
24
25
#include "
advcity.h
"
26
27
/**************************************************************************
28
This calculates the usefulness of pcity to us. Note that you can pass
29
another player's adv_data structure here for evaluation by different
30
priorities.
31
**************************************************************************/
32
int
adv_eval_calc_city
(
struct
city
*
pcity
,
struct
adv_data
*adv)
33
{
34
int
i
= (
pcity
->surplus[
O_FOOD
] * adv->
food_priority
35
+
pcity
->surplus[
O_SHIELD
] * adv->
shield_priority
36
+
pcity
->prod[
O_LUXURY
] * adv->
luxury_priority
37
+
pcity
->prod[
O_GOLD
] * adv->
gold_priority
38
+
pcity
->prod[
O_SCIENCE
] * adv->
science_priority
39
+
pcity
->feel[
CITIZEN_HAPPY
][
FEELING_FINAL
] * adv->
happy_priority
40
-
pcity
->feel[
CITIZEN_UNHAPPY
][
FEELING_FINAL
] * adv->
unhappy_priority
41
-
pcity
->feel[
CITIZEN_ANGRY
][
FEELING_FINAL
] * adv->
angry_priority
42
-
pcity
->pollution * adv->
pollution_priority
);
43
44
if
(
pcity
->surplus[
O_FOOD
] < 0 ||
pcity
->surplus[
O_SHIELD
] < 0) {
45
/* The city is unmaintainable, it can't be good */
46
i
=
MIN
(
i
, 0);
47
}
48
49
return
i
;
50
}
adv_eval_calc_city
int adv_eval_calc_city(struct city *pcity, struct adv_data *adv)
Definition
advcity.c:32
advcity.h
advdata.h
city.h
CITIZEN_ANGRY
@ CITIZEN_ANGRY
Definition
city.h:268
CITIZEN_HAPPY
@ CITIZEN_HAPPY
Definition
city.h:265
CITIZEN_UNHAPPY
@ CITIZEN_UNHAPPY
Definition
city.h:267
FEELING_FINAL
@ FEELING_FINAL
Definition
city.h:281
incite_cost
char * incite_cost
Definition
comments.c:76
pcity
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
fc_types.h
O_SHIELD
@ O_SHIELD
Definition
fc_types.h:101
O_FOOD
@ O_FOOD
Definition
fc_types.h:101
O_SCIENCE
@ O_SCIENCE
Definition
fc_types.h:101
O_LUXURY
@ O_LUXURY
Definition
fc_types.h:101
O_GOLD
@ O_GOLD
Definition
fc_types.h:101
MIN
#define MIN(x, y)
Definition
shared.h:55
adv_data
Definition
advdata.h:50
adv_data::pollution_priority
int pollution_priority
Definition
advdata.h:121
adv_data::shield_priority
int shield_priority
Definition
advdata.h:113
adv_data::unhappy_priority
int unhappy_priority
Definition
advdata.h:119
adv_data::luxury_priority
int luxury_priority
Definition
advdata.h:115
adv_data::angry_priority
int angry_priority
Definition
advdata.h:120
adv_data::food_priority
int food_priority
Definition
advdata.h:114
adv_data::happy_priority
int happy_priority
Definition
advdata.h:118
adv_data::science_priority
int science_priority
Definition
advdata.h:117
adv_data::gold_priority
int gold_priority
Definition
advdata.h:116
city
Definition
city.h:317
Generated on Sun Dec 22 2024 22:30:37 for Freeciv-3.3 by
1.9.8