Files
@ r10095:4db6ea9bc313
Branch filter:
Location: cpp/openttd-patchpack/source/src/player_base.h - annotation
r10095:4db6ea9bc313
2.6 KiB
text/x-c
(svn r14276) -Fix: Rename one of the advanced settings, as 'TTDPatch compatible nonstop handling' wasn't a correct description anymore.
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 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 | r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r9659:f5984e9c0ecd r9659:f5984e9c0ecd r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8786:f24a6d1fba34 r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r9890:c31f485e55d9 r9890:c31f485e55d9 r9890:c31f485e55d9 r9890:c31f485e55d9 r9890:c31f485e55d9 r9659:f5984e9c0ecd r9659:f5984e9c0ecd r9659:f5984e9c0ecd r9659:f5984e9c0ecd r9659:f5984e9c0ecd r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8258:08100da56269 r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8258:08100da56269 r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r9017:a2af0704ff89 r8254:b96be9ebfc6e r10010:5157ea01c884 r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8515:e376122b0ad2 r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r9070:e059c65164f3 r9659:f5984e9c0ecd r9659:f5984e9c0ecd r8254:b96be9ebfc6e r8254:b96be9ebfc6e r9659:f5984e9c0ecd r9659:f5984e9c0ecd r9661:fdc34176f0ca r9659:f5984e9c0ecd r9659:f5984e9c0ecd r9659:f5984e9c0ecd r9659:f5984e9c0ecd r9659:f5984e9c0ecd r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r9659:f5984e9c0ecd r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e r8254:b96be9ebfc6e | /* $Id$ */
/** @file player_base.h Definition of stuff that is very close to a player, like the player struct itself. */
#ifndef PLAYER_BASE_H
#define PLAYER_BASE_H
#include "player_type.h"
#include "oldpool.h"
#include "road_type.h"
#include "rail_type.h"
#include "date_type.h"
#include "engine_type.h"
#include "livery.h"
#include "autoreplace_type.h"
#include "economy_type.h"
#include "tile_type.h"
struct PlayerEconomyEntry {
Money income;
Money expenses;
int32 delivered_cargo;
int32 performance_history; ///< player score (scale 0-1000)
Money company_value;
};
/* The third parameter and the number after >> MUST be the same,
* otherwise more (or less) players will be allowed to be
* created than what MAX_PLAYER specifies!
*/
DECLARE_OLD_POOL(Player, Player, 1, MAX_PLAYERS >> 1)
struct Player : PoolItem<Player, PlayerByte, &_Player_pool> {
Player(uint16 name_1 = 0, bool is_ai = false);
~Player();
uint32 name_2;
uint16 name_1;
char *name;
uint16 president_name_1;
uint32 president_name_2;
char *president_name;
PlayerFace face;
Money player_money;
Money current_loan;
byte player_color;
Livery livery[LS_END];
byte player_money_fraction;
RailTypes avail_railtypes;
RoadTypes avail_roadtypes;
byte block_preview;
uint32 cargo_types; ///< which cargo types were transported the last year
TileIndex location_of_HQ;
TileIndex last_build_coordinate;
PlayerByte share_owners[4];
Year inaugurated_year;
byte num_valid_stat_ent;
byte quarters_of_bankrupcy;
byte bankrupt_asked; ///< which players were asked about buying it?
int16 bankrupt_timeout;
Money bankrupt_value;
bool is_ai;
Money yearly_expenses[3][EXPENSES_END];
PlayerEconomyEntry cur_economy;
PlayerEconomyEntry old_economy[24];
EngineRenewList engine_renew_list; ///< Defined later
bool engine_renew;
bool renew_keep_length;
int16 engine_renew_months;
uint32 engine_renew_money;
uint16 *num_engines; ///< caches the number of engines of each type the player owns (no need to save this)
inline bool IsValid() const { return this->name_1 != 0; }
};
static inline bool IsValidPlayerID(PlayerID index)
{
return (uint)index < GetPlayerPoolSize() && GetPlayer(index)->IsValid();
}
#define FOR_ALL_PLAYERS_FROM(d, start) for (d = GetPlayer(start); d != NULL; d = (d->index + 1U < GetPlayerPoolSize()) ? GetPlayer(d->index + 1U) : NULL) if (d->IsValid())
#define FOR_ALL_PLAYERS(d) FOR_ALL_PLAYERS_FROM(d, 0)
static inline byte ActivePlayerCount()
{
const Player *p;
byte count = 0;
FOR_ALL_PLAYERS(p) count++;
return count;
}
Money CalculateCompanyValue(const Player *p);
#endif /* PLAYER_BASE_H */
|