~ubuntu-branches/debian/squeeze/openttd/squeeze

« back to all changes in this revision

Viewing changes to src/player_base.h

  • Committer: Bazaar Package Importer
  • Author(s): Jordi Mallach, Matthijs Kooijman, Jordi Mallach
  • Date: 2009-04-15 18:22:10 UTC
  • mfrom: (1.1.6 upstream) (2.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090415182210-22ktb8kdbp2tf3bm
[ Matthijs Kooijman ]
* New upstream release.
* Remove Debian specific desktop file, upstream provides one now. 
* Add debian/watch file.

[ Jordi Mallach ]
* Bump Standards-Version to 3.8.1, with no changes required.
* Move to debhelper compat 7. Bump Build-Depends accordingly.
* Use dh_prep.
* Add "set -e" to config script.
* Remove a few extra doc files that get installed by upstream Makefile.
* Add more complete copyright information.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* $Id: player_base.h 12090 2008-02-09 02:49:33Z belugas $ */
2
 
 
3
 
/** @file player_base.h Definition of stuff that is very close to a player, like the player struct itself. */
4
 
 
5
 
#ifndef PLAYER_BASE_H
6
 
#define PLAYER_BASE_H
7
 
 
8
 
#include "road_type.h"
9
 
#include "rail_type.h"
10
 
#include "date_type.h"
11
 
#include "engine.h"
12
 
#include "livery.h"
13
 
#include "autoreplace_type.h"
14
 
#include "economy_type.h"
15
 
#include "tile_type.h"
16
 
 
17
 
struct PlayerEconomyEntry {
18
 
        Money income;
19
 
        Money expenses;
20
 
        int32 delivered_cargo;
21
 
        int32 performance_history; ///< player score (scale 0-1000)
22
 
        Money company_value;
23
 
};
24
 
 
25
 
struct Player {
26
 
        uint32 name_2;
27
 
        uint16 name_1;
28
 
        char *name;
29
 
 
30
 
        uint16 president_name_1;
31
 
        uint32 president_name_2;
32
 
        char *president_name;
33
 
 
34
 
        PlayerFace face;
35
 
 
36
 
        Money player_money;
37
 
        Money current_loan;
38
 
 
39
 
        byte player_color;
40
 
        Livery livery[LS_END];
41
 
        byte player_money_fraction;
42
 
        RailTypes avail_railtypes;
43
 
        RoadTypes avail_roadtypes;
44
 
        byte block_preview;
45
 
        PlayerByte index;
46
 
 
47
 
        uint16 cargo_types; ///< which cargo types were transported the last year
48
 
 
49
 
        TileIndex location_of_house;
50
 
        TileIndex last_build_coordinate;
51
 
 
52
 
        PlayerByte share_owners[4];
53
 
 
54
 
        Year inaugurated_year;
55
 
        byte num_valid_stat_ent;
56
 
 
57
 
        byte quarters_of_bankrupcy;
58
 
        byte bankrupt_asked; ///< which players were asked about buying it?
59
 
        int16 bankrupt_timeout;
60
 
        Money bankrupt_value;
61
 
 
62
 
        bool is_active;
63
 
        bool is_ai;
64
 
 
65
 
        Money yearly_expenses[3][EXPENSES_END];
66
 
        PlayerEconomyEntry cur_economy;
67
 
        PlayerEconomyEntry old_economy[24];
68
 
        EngineRenewList engine_renew_list; ///< Defined later
69
 
        bool engine_renew;
70
 
        bool renew_keep_length;
71
 
        int16 engine_renew_months;
72
 
        uint32 engine_renew_money;
73
 
        uint16 num_engines[TOTAL_NUM_ENGINES]; ///< caches the number of engines of each type the player owns (no need to save this)
74
 
};
75
 
 
76
 
extern Player _players[MAX_PLAYERS];
77
 
#define FOR_ALL_PLAYERS(p) for (p = _players; p != endof(_players); p++)
78
 
 
79
 
static inline byte ActivePlayerCount()
80
 
{
81
 
        const Player *p;
82
 
        byte count = 0;
83
 
 
84
 
        FOR_ALL_PLAYERS(p) {
85
 
                if (p->is_active) count++;
86
 
        }
87
 
 
88
 
        return count;
89
 
}
90
 
 
91
 
static inline Player *GetPlayer(PlayerID i)
92
 
{
93
 
        assert(IsInsideBS(i, PLAYER_FIRST, lengthof(_players)));
94
 
        return &_players[i];
95
 
}
96
 
 
97
 
Money CalculateCompanyValue(const Player *p);
98
 
 
99
 
#endif /* PLAYER_BASE_H */