truelight@0: #ifndef PLAYER_H truelight@0: #define PLAYER_H truelight@0: truelight@0: typedef struct PlayerEconomyEntry { truelight@0: int32 income; truelight@0: int32 expenses; truelight@0: int32 delivered_cargo; truelight@0: int32 performance_history; truelight@0: int32 company_value; truelight@0: } PlayerEconomyEntry; truelight@0: truelight@0: typedef struct AiBuildRec { truelight@0: TileIndex spec_tile; truelight@0: TileIndex use_tile; truelight@0: byte rand_rng; truelight@0: byte cur_building_rule; truelight@0: byte unk6; truelight@0: byte unk7; truelight@0: byte buildcmd_a; truelight@0: byte buildcmd_b; truelight@0: byte direction; truelight@0: byte cargo; truelight@0: } AiBuildRec; truelight@0: truelight@0: typedef struct PlayerAI { truelight@0: byte state; truelight@0: byte tick; // Used to determine how often to move truelight@0: uint16 state_counter; truelight@0: uint16 timeout_counter; truelight@0: truelight@0: byte state_mode; truelight@0: byte banned_tile_count; truelight@0: byte railtype_to_use; truelight@0: truelight@0: byte cargo_type; truelight@0: byte num_wagons; truelight@0: byte build_kind; truelight@0: byte num_build_rec; truelight@0: byte num_loco_to_build; truelight@0: byte num_want_fullload; truelight@0: truelight@0: byte route_type_mask; truelight@0: truelight@0: TileIndex start_tile_a; truelight@0: TileIndex cur_tile_a; truelight@0: byte cur_dir_a; truelight@0: byte start_dir_a; truelight@0: truelight@0: TileIndex start_tile_b; truelight@0: TileIndex cur_tile_b; truelight@0: byte cur_dir_b; truelight@0: byte start_dir_b; truelight@0: truelight@0: Vehicle *cur_veh; /* only used by some states */ truelight@0: truelight@0: AiBuildRec src, dst, mid1, mid2; truelight@0: truelight@0: VehicleID wagon_list[9]; truelight@0: byte order_list_blocks[20]; truelight@0: truelight@0: TileIndex banned_tiles[16]; truelight@0: byte banned_val[16]; truelight@0: } PlayerAI; truelight@0: truelight@0: typedef struct Player { truelight@0: uint32 name_2; truelight@0: uint16 name_1; truelight@0: truelight@0: uint16 president_name_1; truelight@0: uint32 president_name_2; truelight@0: truelight@0: uint32 face; truelight@0: truelight@0: int32 player_money; truelight@0: int32 current_loan; truelight@0: int64 money64; // internal 64-bit version of the money. the 32-bit field will be clamped to plus minus 2 billion truelight@0: truelight@0: byte player_color; truelight@0: byte player_money_fraction; truelight@0: byte max_railtype; truelight@0: byte block_preview; truelight@0: byte index; truelight@0: truelight@0: uint16 cargo_types; /* which cargo types were transported the last year */ truelight@0: truelight@0: TileIndex location_of_house; truelight@0: TileIndex last_build_coordinate; truelight@0: truelight@0: byte share_owners[4]; truelight@0: truelight@0: byte inaugurated_year; truelight@0: byte num_valid_stat_ent; truelight@0: truelight@0: byte quarters_of_bankrupcy; truelight@0: byte bankrupt_asked; // which players were asked about buying it? truelight@0: int16 bankrupt_timeout; truelight@0: int32 bankrupt_value; truelight@0: truelight@0: bool is_active; truelight@0: byte is_ai; truelight@0: PlayerAI ai; truelight@0: truelight@0: int64 yearly_expenses[3][13]; truelight@0: PlayerEconomyEntry cur_economy; truelight@0: PlayerEconomyEntry old_economy[24]; truelight@0: } Player; truelight@0: truelight@0: void ChangeOwnershipOfPlayerItems(byte old_player, byte new_player); truelight@0: void GetNameOfOwner(byte owner, uint tile); truelight@0: uint32 CalculateCompanyValue(Player *p); truelight@0: void InvalidatePlayerWindows(Player *p); truelight@0: void AiDoGameLoop(Player *p); truelight@0: void UpdatePlayerMoney32(Player *p); truelight@0: #define DEREF_PLAYER(i) (&_players[i]) truelight@0: #define FOR_ALL_PLAYERS(p) for(p=_players; p != endof(_players); p++) truelight@0: truelight@0: #define MAX_PLAYERS 8 truelight@0: VARDEF Player _players[MAX_PLAYERS]; truelight@0: truelight@0: #define IS_HUMAN_PLAYER(p) (!DEREF_PLAYER((byte)(p))->is_ai) truelight@0: #define IS_INTERACTIVE_PLAYER(p) (((byte)p) == _local_player) truelight@0: truelight@0: #endif /* PLAYER_H */