File: culture.c

package info (click to toggle)
freeciv 2.6.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 212,508 kB
  • sloc: ansic: 443,831; cpp: 29,541; sh: 7,982; makefile: 7,886; python: 1,933; xml: 945
file content (62 lines) | stat: -rw-r--r-- 2,281 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/****************************************************************************
 Freeciv - Copyright (C) 2004 - The Freeciv Team
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
****************************************************************************/

#ifdef HAVE_CONFIG_H
#include <fc_config.h>
#endif

/* common */
#include "city.h"
#include "effects.h"
#include "player.h"

#include "culture.h"

/****************************************************************************
  Return current culture score of the city.
****************************************************************************/
int city_culture(const struct city *pcity)
{
  return pcity->history + get_city_bonus(pcity, EFT_PERFORMANCE);
}

/****************************************************************************
  How much history city gains this turn.
****************************************************************************/
int city_history_gain(const struct city *pcity)
{
  return get_city_bonus(pcity, EFT_HISTORY);
}

/****************************************************************************
  Return current culture score of the player.
****************************************************************************/
int player_culture(const struct player *plr)
{
  int culture = plr->history + get_player_bonus(plr, EFT_NATION_PERFORMANCE);

  city_list_iterate(plr->cities, pcity) {
    culture += city_culture(pcity);
  } city_list_iterate_end;

  return culture;
}

/****************************************************************************
  How much nation-wide history player gains this turn. Does NOT include
  history gains of individual cities.
****************************************************************************/
int nation_history_gain(const struct player *pplayer)
{
  return get_player_bonus(pplayer, EFT_NATION_HISTORY);
}