Freeciv21
Develop your civilization from humble roots to a global empire
advcity.cpp
Go to the documentation of this file.
1
/*
2
Copyright (c) 1996-2020 Freeciv21 and Freeciv contributors. This file is
3
__ __ part of Freeciv21. Freeciv21 is free software: you can
4
/ \\..// \ redistribute it and/or modify it under the terms of the GNU
5
( oo ) General Public License as published by the Free Software
6
\__/ Foundation, either version 3 of the License, or (at your
7
option) any later version. You should have received
8
a copy of the GNU General Public License along with Freeciv21. If not,
9
see https://www.gnu.org/licenses/.
10
*/
11
12
// common
13
#include "
city.h
"
14
#include "
fc_types.h
"
15
16
/* server/advisors */
17
#include "
advdata.h
"
18
19
#include "
advcity.h
"
20
26
int
adv_eval_calc_city
(
struct
city
*pcity,
struct
adv_data
*adv)
27
{
28
int
i =
29
(pcity->
surplus
[
O_FOOD
] * adv->
food_priority
30
+ pcity->
surplus
[
O_SHIELD
] * adv->
shield_priority
31
+ pcity->
prod
[
O_LUXURY
] * adv->
luxury_priority
32
+ pcity->
prod
[
O_GOLD
] * adv->
gold_priority
33
+ pcity->
prod
[
O_SCIENCE
] * adv->
science_priority
34
+ pcity->
feel
[
CITIZEN_HAPPY
][
FEELING_FINAL
] * adv->
happy_priority
35
- pcity->
feel
[
CITIZEN_UNHAPPY
][
FEELING_FINAL
] * adv->
unhappy_priority
36
- pcity->
feel
[
CITIZEN_ANGRY
][
FEELING_FINAL
] * adv->
angry_priority
37
- pcity->
pollution
* adv->
pollution_priority
);
38
39
if
(pcity->
surplus
[
O_FOOD
] < 0 || pcity->
surplus
[
O_SHIELD
] < 0) {
40
// The city is unmaintainable, it can't be good
41
i =
MIN
(i, 0);
42
}
43
44
return
i;
45
}
adv_eval_calc_city
int adv_eval_calc_city(struct city *pcity, struct adv_data *adv)
This calculates the usefulness of pcity to us.
Definition:
advcity.cpp:26
advcity.h
advdata.h
city.h
CITIZEN_ANGRY
@ CITIZEN_ANGRY
Definition:
city.h:243
CITIZEN_HAPPY
@ CITIZEN_HAPPY
Definition:
city.h:240
CITIZEN_UNHAPPY
@ CITIZEN_UNHAPPY
Definition:
city.h:242
FEELING_FINAL
@ FEELING_FINAL
Definition:
city.h:256
fc_types.h
O_SHIELD
@ O_SHIELD
Definition:
fc_types.h:86
O_FOOD
@ O_FOOD
Definition:
fc_types.h:85
O_SCIENCE
@ O_SCIENCE
Definition:
fc_types.h:90
O_LUXURY
@ O_LUXURY
Definition:
fc_types.h:89
O_GOLD
@ O_GOLD
Definition:
fc_types.h:88
MIN
#define MIN(x, y)
Definition:
shared.h:49
adv_data
Definition:
advdata.h:41
adv_data::pollution_priority
int pollution_priority
Definition:
advdata.h:110
adv_data::shield_priority
int shield_priority
Definition:
advdata.h:102
adv_data::unhappy_priority
int unhappy_priority
Definition:
advdata.h:108
adv_data::luxury_priority
int luxury_priority
Definition:
advdata.h:104
adv_data::angry_priority
int angry_priority
Definition:
advdata.h:109
adv_data::food_priority
int food_priority
Definition:
advdata.h:103
adv_data::happy_priority
int happy_priority
Definition:
advdata.h:107
adv_data::science_priority
int science_priority
Definition:
advdata.h:106
adv_data::gold_priority
int gold_priority
Definition:
advdata.h:105
city
Definition:
city.h:291
city::surplus
int surplus[O_LAST]
Definition:
city.h:324
city::pollution
int pollution
Definition:
city.h:340
city::feel
citizens feel[CITIZEN_LAST][FEELING_LAST]
Definition:
city.h:302
city::prod
int prod[O_LAST]
Definition:
city.h:327
server
advisors
advcity.cpp
Generated by
1.9.1