Freeciv-3.1
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:263
CITIZEN_HAPPY
@ CITIZEN_HAPPY
Definition
city.h:260
CITIZEN_UNHAPPY
@ CITIZEN_UNHAPPY
Definition
city.h:262
FEELING_FINAL
@ FEELING_FINAL
Definition
city.h:276
fc_types.h
O_SHIELD
@ O_SHIELD
Definition
fc_types.h:91
O_FOOD
@ O_FOOD
Definition
fc_types.h:91
O_SCIENCE
@ O_SCIENCE
Definition
fc_types.h:91
O_LUXURY
@ O_LUXURY
Definition
fc_types.h:91
O_GOLD
@ O_GOLD
Definition
fc_types.h:91
MIN
#define MIN(x, y)
Definition
shared.h:55
adv_data
Definition
advdata.h:45
adv_data::pollution_priority
int pollution_priority
Definition
advdata.h:115
adv_data::shield_priority
int shield_priority
Definition
advdata.h:107
adv_data::unhappy_priority
int unhappy_priority
Definition
advdata.h:113
adv_data::luxury_priority
int luxury_priority
Definition
advdata.h:109
adv_data::angry_priority
int angry_priority
Definition
advdata.h:114
adv_data::food_priority
int food_priority
Definition
advdata.h:108
adv_data::happy_priority
int happy_priority
Definition
advdata.h:112
adv_data::science_priority
int science_priority
Definition
advdata.h:111
adv_data::gold_priority
int gold_priority
Definition
advdata.h:110
city
Definition
city.h:309
city::surplus
int surplus[O_LAST]
Definition
city.h:343
city::pollution
int pollution
Definition
city.h:356
city::feel
citizens feel[CITIZEN_LAST][FEELING_LAST]
Definition
city.h:321
city::prod
int prod[O_LAST]
Definition
city.h:346
Generated on Sun Jan 5 2025 22:00:35 for Freeciv-3.1 by
1.9.8