9724
|
1 |
/* $Id$ */
|
|
2 |
|
|
3 |
/** @file player_func.h Functions related to players. */
|
|
4 |
|
|
5 |
#ifndef PLAYER_FUNC_H
|
|
6 |
#define PLAYER_FUNC_H
|
|
7 |
|
|
8 |
#include "core/math_func.hpp"
|
|
9 |
#include "player_type.h"
|
|
10 |
#include "tile_type.h"
|
|
11 |
#include "strings_type.h"
|
|
12 |
|
|
13 |
void ChangeOwnershipOfPlayerItems(PlayerID old_player, PlayerID new_player);
|
|
14 |
void GetNameOfOwner(Owner owner, TileIndex tile);
|
|
15 |
void SetLocalPlayer(PlayerID new_player);
|
|
16 |
|
|
17 |
extern PlayerByte _local_player;
|
|
18 |
extern PlayerByte _current_player;
|
|
19 |
/* NOSAVE: can be determined from player structs */
|
|
20 |
extern byte _player_colors[MAX_PLAYERS];
|
|
21 |
extern PlayerFace _player_face; ///< for player face storage in openttd.cfg
|
|
22 |
|
|
23 |
bool IsHumanPlayer(PlayerID pi);
|
|
24 |
|
|
25 |
static inline bool IsLocalPlayer()
|
|
26 |
{
|
|
27 |
return _local_player == _current_player;
|
|
28 |
}
|
|
29 |
|
|
30 |
static inline bool IsValidPlayer(PlayerID pi)
|
|
31 |
{
|
|
32 |
return IsInsideBS(pi, PLAYER_FIRST, MAX_PLAYERS);
|
|
33 |
}
|
|
34 |
|
|
35 |
static inline bool IsInteractivePlayer(PlayerID pi)
|
|
36 |
{
|
|
37 |
return pi == _local_player;
|
|
38 |
}
|
|
39 |
|
|
40 |
|
|
41 |
|
|
42 |
struct HighScore {
|
|
43 |
char company[100];
|
|
44 |
StringID title; ///< NO_SAVE, has troubles with changing string-numbers.
|
|
45 |
uint16 score; ///< do NOT change type, will break hs.dat
|
|
46 |
};
|
|
47 |
|
|
48 |
extern HighScore _highscore_table[5][5]; // 4 difficulty-settings (+ network); top 5
|
|
49 |
void SaveToHighScore();
|
|
50 |
void LoadFromHighScore();
|
|
51 |
int8 SaveHighScoreValue(const Player *p);
|
|
52 |
int8 SaveHighScoreValueNetwork();
|
|
53 |
|
|
54 |
#endif /* PLAYER_FUNC_H */
|