Freeciv-3.3: /fast/freeciv/nightly/main/common/culture.c Source File

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/************************************************************************/
29 int city_culture(const struct city *pcity)
30{
31 return pcity->history
32 + get_city_bonus(pcity, EFT_PERFORMANCE)
33 * (100 + get_city_bonus(pcity, EFT_CULTURE_PCT)) / 100;
34}
35
36/************************************************************************/
39 int 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/************************************************************************/
49 int player_culture(const struct player *plr)
50{
51 int culture = plr->history
52 + get_player_bonus(plr, EFT_NATION_PERFORMANCE)
53 * (100 + get_player_bonus(plr, EFT_CULTURE_PCT)) / 100;
54
55 city_list_iterate(plr->cities, pcity) {
56 culture += city_culture(pcity);
57 } city_list_iterate_end;
58
59 return culture;
60}
61
62/************************************************************************/
66 int nation_history_gain(const struct player *pplayer)
67{
68 return get_player_bonus(pplayer, EFT_NATION_HISTORY)
69 * (100 + get_player_bonus(pplayer, EFT_CULTURE_PCT)) / 100
70 + pplayer->history * game.info.history_interest_pml / 1000;
71}
city.h
city_list_iterate
#define city_list_iterate(citylist, pcity)
Definition city.h:508
city_list_iterate_end
#define city_list_iterate_end
Definition city.h:510
incite_cost
char * incite_cost
Definition comments.c:74
city_culture
int city_culture(const struct city *pcity)
Definition culture.c:29
player_culture
int player_culture(const struct player *plr)
Definition culture.c:49
city_history_gain
int city_history_gain(const struct city *pcity)
Definition culture.c:39
nation_history_gain
int nation_history_gain(const struct player *pplayer)
Definition culture.c:66
culture.h
get_city_bonus
int get_city_bonus(const struct city *pcity, enum effect_type effect_type)
Definition effects.c:842
get_player_bonus
int get_player_bonus(const struct player *pplayer, enum effect_type effect_type)
Definition effects.c:824
effects.h
game
struct civ_game game
Definition game.c:61
game.h
player.h
city
Definition city.h:320
city::history
int history
Definition city.h:410
civ_game::info
struct packet_game_info info
Definition game.h:89
packet_game_info::history_interest_pml
int history_interest_pml
Definition packets_gen.h:139
player
Definition player.h:249
player::cities
struct city_list * cities
Definition player.h:281
player::history
int history
Definition player.h:316