# player_func.h File Reference

Functions related to players. More...

`#include "core/math_func.hpp"`
`#include "player_type.h"`
`#include "tile_type.h"`
`#include "strings_type.h"`

Go to the source code of this file.

## Data Structures

struct | HighScore

## Functions

void | ChangeOwnershipOfPlayerItems (PlayerID old_player, PlayerID new_player)
void | GetNameOfOwner (Owner owner, TileIndex tile)
void | SetLocalPlayer (PlayerID new_player)
| Sets the local player and updates the patch settings that are set on a per-company (player) basis to reflect the core's state in the GUI.
bool | IsHumanPlayer (PlayerID pi)
static bool | IsLocalPlayer ()
static bool | IsValidPlayer (PlayerID pi)
static bool | IsInteractivePlayer (PlayerID pi)
void | SaveToHighScore ()
| Save HighScore table to file.
void | LoadFromHighScore ()
| Initialize the highscore table to 0 and if any file exists, load in values.
int8 | SaveHighScoreValue (const Player *p)
| Save the highscore for the player.
int8 | SaveHighScoreValueNetwork ()

## Variables

PlayerByte | _local_player
PlayerByte | _current_player
byte | _player_colors [MAX_PLAYERS]
PlayerFace | _player_face
| for player face storage in openttd.cfg
HighScore | _highscore_table [5][5]

## Detailed Description

Functions related to players.

Definition in file player_func.h.

## Function Documentation

void SetLocalPlayer | ( | PlayerID | new_player | ) |

Sets the local player and updates the patch settings that are set on a per-company (player) basis to reflect the core's state in the GUI.

Parameters:

  | new_player | the new player

Precondition:
  IsValidPlayer(new_player) || new_player == PLAYER_SPECTATOR || new_player == OWNER_NONE

Definition at line 55 of file players.cpp.

References OWNER_NONE, and PLAYER_SPECTATOR.

Referenced by _GenerateWorld(), ClickChangePlayerCheat(), CmdPlayerCtrl(), GenerateWorld(), and StartScenario().