player.h
author truelight
Fri, 20 Aug 2004 09:32:32 +0000
changeset 84 1e0721c29bad
parent 0 29654efe3188
child 145 6e5468217504
permissions -rw-r--r--
(svn r85) -Add: initial commit of new AI (enable in Patch menu)
-Add: generalised A* Algorithm
-Add: generalised queues (Fifo, Stack, InsSort, BinaryHeap)
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     1
#ifndef PLAYER_H
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     2
#define PLAYER_H
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     3
84
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
     4
#include "aystar.h"
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
     5
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     6
typedef struct PlayerEconomyEntry {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     7
	int32 income;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     8
	int32 expenses;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     9
	int32 delivered_cargo;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    10
	int32 performance_history;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    11
	int32 company_value;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    12
} PlayerEconomyEntry;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    13
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    14
typedef struct AiBuildRec {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    15
	TileIndex spec_tile;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    16
	TileIndex use_tile;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    17
	byte rand_rng;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    18
	byte cur_building_rule;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    19
	byte unk6;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    20
	byte unk7;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    21
	byte buildcmd_a;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    22
	byte buildcmd_b;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    23
	byte direction;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    24
	byte cargo;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    25
} AiBuildRec;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    26
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    27
typedef struct PlayerAI {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    28
	byte state;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    29
	byte tick; // Used to determine how often to move
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    30
	uint16 state_counter;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    31
	uint16 timeout_counter;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    32
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    33
	byte state_mode;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    34
	byte banned_tile_count;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    35
	byte railtype_to_use;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    36
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    37
	byte cargo_type;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    38
	byte num_wagons;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    39
	byte build_kind;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    40
	byte num_build_rec;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    41
	byte num_loco_to_build;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    42
	byte num_want_fullload;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    43
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    44
	byte route_type_mask;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    45
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    46
	TileIndex start_tile_a;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    47
	TileIndex cur_tile_a;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    48
	byte cur_dir_a;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    49
	byte start_dir_a;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    50
	
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    51
	TileIndex start_tile_b;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    52
	TileIndex cur_tile_b;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    53
	byte cur_dir_b;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    54
	byte start_dir_b;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    55
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    56
	Vehicle *cur_veh; /* only used by some states */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    57
		
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    58
	AiBuildRec src, dst, mid1, mid2;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    59
	
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    60
	VehicleID wagon_list[9];
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    61
	byte order_list_blocks[20];
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    62
	
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    63
	TileIndex banned_tiles[16];
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    64
	byte banned_val[16];
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    65
} PlayerAI;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    66
84
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
    67
typedef struct Ai_PathFinderInfo {
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
    68
	TileIndex start_tile_tl; // tl = top-left
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
    69
	TileIndex start_tile_br; // br = bottom-right
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
    70
	TileIndex end_tile_tl; // tl = top-left
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
    71
	TileIndex end_tile_br; // br = bottom-right
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
    72
	byte start_direction; // 0 to 3 or AI_PATHFINDER_NO_DIRECTION
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
    73
	byte end_direction; // 0 to 3 or AI_PATHFINDER_NO_DIRECTION
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
    74
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
    75
	TileIndex route[500];
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
    76
	byte route_extra[500]; // Some extra information about the route like bridge/tunnel
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
    77
	int route_length;
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
    78
	int position; // Current position in the build-path, needed to build the path
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
    79
	
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
    80
	bool rail_or_road; // true = rail, false = road
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
    81
} Ai_PathFinderInfo;
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
    82
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
    83
typedef struct PlayerAiNew {
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
    84
	uint8 state;
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
    85
	uint tick;
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
    86
	uint idle;
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
    87
	
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
    88
	int temp; 	// A value used in more then one function, but it just temporary
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
    89
				// The use is pretty simple: with this we can 'think' about stuff
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
    90
				//   in more then one tick, and more then one AI. A static will not
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
    91
				//   do, because they are not saved. This way, the AI is almost human ;)
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
    92
	int counter; 	// For the same reason as temp, we have counter. It can count how
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
    93
					//  long we are trying something, and just abort if it takes too long
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
    94
	
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
    95
	// Pathfinder stuff
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
    96
	Ai_PathFinderInfo path_info;
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
    97
	AyStar *pathfinder;
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
    98
	
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
    99
	// Route stuff
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   100
	
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   101
	byte cargo;
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   102
	byte tbt; // train/bus/truck 0/1/2 AI_TRAIN/AI_BUS/AI_TRUCK
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   103
	int new_cost;
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   104
	
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   105
	byte action;
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   106
	
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   107
	uint last_id; // here is stored the last id of the searched city/industry
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   108
	
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   109
	TileIndex from_tile;
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   110
	TileIndex to_tile;
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   111
	
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   112
	byte from_direction;
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   113
	byte to_direction;
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   114
	
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   115
	bool from_deliver; // True if this is the station that GIVES cargo
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   116
	bool to_deliver;
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   117
	
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   118
	TileIndex depot_tile;
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   119
	byte depot_direction;
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   120
	
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   121
	byte amount_veh; // How many vehicles we are going to build in this route
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   122
	byte cur_veh; // How many vehicles did we bought?
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   123
	VehicleID veh_id; // Used when bought a vehicle
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   124
	VehicleID veh_main_id; // The ID of the first vehicle, for shared copy
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   125
	
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   126
	int from_ic; // ic = industry/city. This is the ID of them
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   127
	byte from_type; // AI_NO_TYPE/AI_CITY/AI_INDUSTRY
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   128
	int to_ic;
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   129
	byte to_type;
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   130
	
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   131
} PlayerAiNew;
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   132
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   133
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   134
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   135
typedef struct Player {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   136
	uint32 name_2;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   137
	uint16 name_1;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   138
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   139
	uint16 president_name_1;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   140
	uint32 president_name_2;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   141
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   142
	uint32 face;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   143
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   144
	int32 player_money;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   145
	int32 current_loan;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   146
	int64 money64; // internal 64-bit version of the money. the 32-bit field will be clamped to plus minus 2 billion
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   147
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   148
	byte player_color;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   149
	byte player_money_fraction;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   150
	byte max_railtype;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   151
	byte block_preview;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   152
	byte index;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   153
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   154
	uint16 cargo_types; /* which cargo types were transported the last year */
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   155
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   156
	TileIndex location_of_house;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   157
	TileIndex last_build_coordinate;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   158
	
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   159
	byte share_owners[4];
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   160
	
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   161
	byte inaugurated_year;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   162
	byte num_valid_stat_ent;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   163
	
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   164
	byte quarters_of_bankrupcy;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   165
	byte bankrupt_asked; // which players were asked about buying it?
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   166
	int16 bankrupt_timeout;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   167
	int32 bankrupt_value;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   168
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   169
	bool is_active;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   170
	byte is_ai;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   171
	PlayerAI ai;
84
1e0721c29bad (svn r85) -Add: initial commit of new AI (enable in Patch menu)
truelight
parents: 0
diff changeset
   172
	PlayerAiNew ainew;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   173
	
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   174
	int64 yearly_expenses[3][13];
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   175
	PlayerEconomyEntry cur_economy;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   176
	PlayerEconomyEntry old_economy[24];
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   177
} Player;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   178
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   179
void ChangeOwnershipOfPlayerItems(byte old_player, byte new_player);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   180
void GetNameOfOwner(byte owner, uint tile);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   181
uint32 CalculateCompanyValue(Player *p);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   182
void InvalidatePlayerWindows(Player *p);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   183
void AiDoGameLoop(Player *p);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   184
void UpdatePlayerMoney32(Player *p);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   185
#define DEREF_PLAYER(i) (&_players[i])
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   186
#define FOR_ALL_PLAYERS(p) for(p=_players; p != endof(_players); p++)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   187
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   188
#define MAX_PLAYERS 8
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   189
VARDEF Player _players[MAX_PLAYERS];
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   190
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   191
#define IS_HUMAN_PLAYER(p) (!DEREF_PLAYER((byte)(p))->is_ai)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   192
#define IS_INTERACTIVE_PLAYER(p) (((byte)p) == _local_player)
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   193
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   194
#endif /* PLAYER_H */