src/players.cpp
changeset 8254 1496654ca5e7
parent 8247 16e1c8db6f55
child 8258 9fa31acb07bc
equal deleted inserted replaced
8253:eec832095805 8254:1496654ca5e7
     5 #include "stdafx.h"
     5 #include "stdafx.h"
     6 #include "openttd.h"
     6 #include "openttd.h"
     7 #include "engine.h"
     7 #include "engine.h"
     8 #include "table/strings.h"
     8 #include "table/strings.h"
     9 #include "table/sprites.h"
     9 #include "table/sprites.h"
    10 #include "player.h"
    10 #include "player_func.h"
       
    11 #include "player_gui.h"
    11 #include "town.h"
    12 #include "town.h"
    12 #include "station.h"
    13 #include "station.h"
    13 #include "news.h"
    14 #include "news.h"
    14 #include "saveload.h"
    15 #include "saveload.h"
    15 #include "command_func.h"
    16 #include "command_func.h"
    33 #include "ai/default/default.h"
    34 #include "ai/default/default.h"
    34 #include "ai/trolly/trolly.h"
    35 #include "ai/trolly/trolly.h"
    35 #include "road_func.h"
    36 #include "road_func.h"
    36 #include "rail.h"
    37 #include "rail.h"
    37 
    38 
       
    39 Player _players[MAX_PLAYERS];
       
    40 PlayerByte _local_player;
       
    41 PlayerByte _current_player;
       
    42 /* NOSAVE: can be determined from player structs */
       
    43 byte _player_colors[MAX_PLAYERS];
       
    44 PlayerFace _player_face; ///< for player face storage in openttd.cfg
       
    45 HighScore _highscore_table[5][5]; // 4 difficulty-settings (+ network); top 5
       
    46 
    38 /**
    47 /**
    39  * Sets the local player and updates the patch settings that are set on a
    48  * Sets the local player and updates the patch settings that are set on a
    40  * per-company (player) basis to reflect the core's state in the GUI.
    49  * per-company (player) basis to reflect the core's state in the GUI.
    41  * @param new_player the new player
    50  * @param new_player the new player
    42  * @pre IsValidPlayer(new_player) || new_player == PLAYER_SPECTATOR || new_player == OWNER_NONE
    51  * @pre IsValidPlayer(new_player) || new_player == PLAYER_SPECTATOR || new_player == OWNER_NONE
    54 		_patches.autorenew        = p->engine_renew;
    63 		_patches.autorenew        = p->engine_renew;
    55 		_patches.autorenew_months = p->engine_renew_months;
    64 		_patches.autorenew_months = p->engine_renew_months;
    56 		_patches.autorenew_money  = p->engine_renew_money;
    65 		_patches.autorenew_money  = p->engine_renew_money;
    57 		InvalidateWindow(WC_GAME_OPTIONS, 0);
    66 		InvalidateWindow(WC_GAME_OPTIONS, 0);
    58 	}
    67 	}
       
    68 }
       
    69 
       
    70 bool IsHumanPlayer(PlayerID pi)
       
    71 {
       
    72 	return !GetPlayer(pi)->is_ai;
    59 }
    73 }
    60 
    74 
    61 
    75 
    62 uint16 GetDrawStringPlayerColor(PlayerID player)
    76 uint16 GetDrawStringPlayerColor(PlayerID player)
    63 {
    77 {