Freeciv-3.2: /fast/freeciv/nightly/S3_2/common/culture.c Source File

Freeciv-3.2

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 + get_city_bonus(pcity, EFT_PERFORMANCE);
32}
33
34/************************************************************************/
37 int city_history_gain(const struct city *pcity)
38{
39 return get_city_bonus(pcity, EFT_HISTORY)
40 + pcity->history * game.info.history_interest_pml / 1000;
41}
42
43/************************************************************************/
46 int player_culture(const struct player *plr)
47{
48 int culture = plr->history + get_player_bonus(plr, EFT_NATION_PERFORMANCE);
49
50 city_list_iterate(plr->cities, pcity) {
51 culture += city_culture(pcity);
52 } city_list_iterate_end;
53
54 return culture;
55}
56
57/************************************************************************/
61 int nation_history_gain(const struct player *pplayer)
62{
63 return get_player_bonus(pplayer, EFT_NATION_HISTORY)
64 + pplayer->history * game.info.history_interest_pml / 1000;
65}
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:46
city_history_gain
int city_history_gain(const struct city *pcity)
Definition culture.c:37
nation_history_gain
int nation_history_gain(const struct player *pplayer)
Definition culture.c:61
culture.h
get_city_bonus
int get_city_bonus(const struct city *pcity, enum effect_type effect_type)
Definition effects.c:846
get_player_bonus
int get_player_bonus(const struct player *pplayer, enum effect_type effect_type)
Definition effects.c:828
effects.h
game
struct civ_game game
Definition game.c:62
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:136
player
Definition player.h:247
player::cities
struct city_list * cities
Definition player.h:279
player::history
int history
Definition player.h:314