Freeciv21
Develop your civilization from humble roots to a global empire
culture.cpp
Go to the documentation of this file.
1 /*
2 _ ._ Copyright (c) 1996-2021 Freeciv21 and Freeciv contributors.
3  \ | This file is part of Freeciv21. Freeciv21 is free software: you
4  \_| can redistribute it and/or modify it under the terms of the
5  .' '. GNU General Public License as published by the Free
6  :O O: Software Foundation, either version 3 of the License,
7  '/ \' or (at your option) any later version. You should have
8  :X: received a copy of the GNU General Public License along with
9  :X: Freeciv21. If not, see https://www.gnu.org/licenses/.
10  */
11 
12 // common
13 #include "city.h"
14 #include "effects.h"
15 #include "game.h"
16 #include "player.h"
17 
18 #include "culture.h"
19 
23 int city_culture(const struct city *pcity)
24 {
25  return pcity->history + get_city_bonus(pcity, EFT_PERFORMANCE);
26 }
27 
31 int city_history_gain(const struct city *pcity)
32 {
33  return get_city_bonus(pcity, EFT_HISTORY)
34  + pcity->history * game.info.history_interest_pml / 1000;
35 }
36 
40 int player_culture(const struct player *plr)
41 {
42  int culture = plr->history + get_player_bonus(plr, EFT_NATION_PERFORMANCE);
43 
44  city_list_iterate(plr->cities, pcity) { culture += city_culture(pcity); }
46 
47  return culture;
48 }
49 
54 int nation_history_gain(const struct player *pplayer)
55 {
56  return get_player_bonus(pplayer, EFT_NATION_HISTORY)
57  + pplayer->history * game.info.history_interest_pml / 1000;
58 }
#define city_list_iterate(citylist, pcity)
Definition: city.h:482
#define city_list_iterate_end
Definition: city.h:484
int city_culture(const struct city *pcity)
Return current culture score of the city.
Definition: culture.cpp:23
int player_culture(const struct player *plr)
Return current culture score of the player.
Definition: culture.cpp:40
int city_history_gain(const struct city *pcity)
How much history city gains this turn.
Definition: culture.cpp:31
int nation_history_gain(const struct player *pplayer)
How much nation-wide history player gains this turn.
Definition: culture.cpp:54
int get_city_bonus(const struct city *pcity, enum effect_type effect_type, enum vision_layer vlayer)
Returns the effect bonus at a city.
Definition: effects.cpp:688
int get_player_bonus(const struct player *pplayer, enum effect_type effect_type)
Returns the effect bonus for a player.
Definition: effects.cpp:673
struct civ_game game
Definition: game.cpp:47
Definition: city.h:291
int history
Definition: city.h:379
struct packet_game_info info
Definition: game.h:80
Definition: player.h:231
struct city_list * cities
Definition: player.h:263
int history
Definition: player.h:300