Freeciv-3.3
Loading...
Searching...
No Matches
culture.c
Go to the documentation of this file.
1/****************************************************************************
2 Freeciv - Copyright (C) 2004 - The Freeciv Team
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 "effects.h"
21#include "game.h"
22#include "player.h"
23
24#include "culture.h"
25
26/************************************************************************/
29int city_culture(const struct city *pcity)
30{
31 return pcity->history
33 * (100 + get_city_bonus(pcity, EFT_CULTURE_PCT)) / 100;
34}
35
36/************************************************************************/
39int city_history_gain(const struct city *pcity)
40{
41 return get_city_bonus(pcity, EFT_HISTORY)
42 * (100 + get_city_bonus(pcity, EFT_CULTURE_PCT)) / 100
43 + pcity->history * game.info.history_interest_pml / 1000;
44}
45
46/************************************************************************/
49int player_culture(const struct player *plr)
50{
51 int culture = plr->history
53 * (100 + get_player_bonus(plr, EFT_CULTURE_PCT)) / 100;
54
55 city_list_iterate(plr->cities, pcity) {
56 culture += city_culture(pcity);
58
59 return culture;
60}
61
62/************************************************************************/
66int nation_history_gain(const struct player *pplayer)
67{
69 * (100 + get_player_bonus(pplayer, EFT_CULTURE_PCT)) / 100
70 + pplayer->history * game.info.history_interest_pml / 1000;
71}
#define city_list_iterate(citylist, pcity)
Definition city.h:508
#define city_list_iterate_end
Definition city.h:510
char * incite_cost
Definition comments.c:74
int city_culture(const struct city *pcity)
Definition culture.c:29
int player_culture(const struct player *plr)
Definition culture.c:49
int city_history_gain(const struct city *pcity)
Definition culture.c:39
int nation_history_gain(const struct player *pplayer)
Definition culture.c:66
int get_city_bonus(const struct city *pcity, enum effect_type effect_type)
Definition effects.c:842
int get_player_bonus(const struct player *pplayer, enum effect_type effect_type)
Definition effects.c:824
struct civ_game game
Definition game.c:61
Definition city.h:320
int history
Definition city.h:410
struct packet_game_info info
Definition game.h:89
struct city_list * cities
Definition player.h:281
int history
Definition player.h:316