File diff r8228:c885c6f5f4a4 → r8229:4262f8715f60
src/player.h
Show inline comments
 
@@ -5,12 +5,7 @@
 
#ifndef PLAYER_H
 
#define PLAYER_H
 

	
 
#include "oldpool.h"
 
#include "aystar.h"
 
#include "rail_type.h"
 
#include "road_func.h"
 
#include "cargo_type.h"
 
#include "command_type.h"
 
#include "date_type.h"
 
#include "engine.h"
 
#include "livery.h"
 
@@ -25,136 +20,6 @@ struct PlayerEconomyEntry {
 
	Money company_value;
 
};
 

	
 
struct AiBuildRec {
 
	TileIndex spec_tile;
 
	TileIndex use_tile;
 
	byte rand_rng;
 
	byte cur_building_rule;
 
	byte unk6;
 
	byte unk7;
 
	byte buildcmd_a;
 
	byte buildcmd_b;
 
	byte direction;
 
	CargoID cargo;
 
};
 

	
 
struct PlayerAI {
 
	byte state;
 
	byte tick;            ///< Used to determine how often to move
 
	uint32 state_counter; ///< Can hold tile index!
 
	uint16 timeout_counter;
 

	
 
	byte state_mode;
 
	byte banned_tile_count;
 
	RailTypeByte railtype_to_use;
 

	
 
	CargoID cargo_type;
 
	byte num_wagons;
 
	byte build_kind;
 
	byte num_build_rec;
 
	byte num_loco_to_build;
 
	byte num_want_fullload;
 

	
 
	byte route_type_mask;
 

	
 
	TileIndex start_tile_a;
 
	TileIndex cur_tile_a;
 
	DiagDirectionByte cur_dir_a;
 
	DiagDirectionByte start_dir_a;
 

	
 
	TileIndex start_tile_b;
 
	TileIndex cur_tile_b;
 
	DiagDirectionByte cur_dir_b;
 
	DiagDirectionByte start_dir_b;
 

	
 
	Vehicle *cur_veh; ///< only used by some states
 

	
 
	AiBuildRec src, dst, mid1, mid2;
 

	
 
	VehicleID wagon_list[9];
 
	byte order_list_blocks[20];
 

	
 
	TileIndex banned_tiles[16];
 
	byte banned_val[16];
 
};
 

	
 
struct Ai_PathFinderInfo {
 
	TileIndex start_tile_tl; ///< tl = top-left
 
	TileIndex start_tile_br; ///< br = bottom-right
 
	TileIndex end_tile_tl;   ///< tl = top-left
 
	TileIndex end_tile_br;   ///< br = bottom-right
 
	DiagDirection start_direction; ///< 0 to 3 or AI_PATHFINDER_NO_DIRECTION
 
	DiagDirection end_direction;   ///< 0 to 3 or AI_PATHFINDER_NO_DIRECTION
 

	
 
	TileIndex route[500];
 
	byte route_extra[500];   ///< Some extra information about the route like bridge/tunnel
 
	int route_length;
 
	int position;            ///< Current position in the build-path, needed to build the path
 

	
 
	bool rail_or_road;       ///< true = rail, false = road
 
};
 

	
 
/* The amount of memory reserved for the AI-special-vehicles */
 
#define AI_MAX_SPECIAL_VEHICLES 100
 

	
 
struct Ai_SpecialVehicle {
 
	VehicleID veh_id;
 
	uint32 flag;
 
};
 

	
 
struct PlayerAiNew {
 
	uint8 state;
 
	uint tick;
 
	uint idle;
 

	
 
	int temp;    ///< A value used in more than one function, but it just temporary
 
	             ///< The use is pretty simple: with this we can 'think' about stuff
 
	             ///<   in more than one tick, and more than one AI. A static will not
 
	             ///<   do, because they are not saved. This way, the AI is almost human ;)
 
	int counter; ///< For the same reason as temp, we have counter. It can count how
 
	             ///<  long we are trying something, and just abort if it takes too long
 

	
 
	/* Pathfinder stuff */
 
	Ai_PathFinderInfo path_info;
 
	AyStar *pathfinder;
 

	
 
	/* Route stuff */
 

	
 
	CargoID cargo;
 
	byte tbt;    ///< train/bus/truck 0/1/2 AI_TRAIN/AI_BUS/AI_TRUCK
 
	Money new_cost;
 

	
 
	byte action;
 

	
 
	int last_id; ///< here is stored the last id of the searched city/industry
 
	Date last_vehiclecheck_date; // Used in CheckVehicle
 
	Ai_SpecialVehicle special_vehicles[AI_MAX_SPECIAL_VEHICLES]; ///< Some vehicles have some special flags
 

	
 
	TileIndex from_tile;
 
	TileIndex to_tile;
 

	
 
	DiagDirectionByte from_direction;
 
	DiagDirectionByte to_direction;
 

	
 
	bool from_deliver; ///< True if this is the station that GIVES cargo
 
	bool to_deliver;
 

	
 
	TileIndex depot_tile;
 
	DiagDirectionByte depot_direction;
 

	
 
	byte amount_veh;       ///< How many vehicles we are going to build in this route
 
	byte cur_veh;          ///< How many vehicles did we bought?
 
	VehicleID veh_id;      ///< Used when bought a vehicle
 
	VehicleID veh_main_id; ///< The ID of the first vehicle, for shared copy
 

	
 
	int from_ic;           ///< ic = industry/city. This is the ID of them
 
	byte from_type;        ///< AI_NO_TYPE/AI_CITY/AI_INDUSTRY
 
	int to_ic;
 
	byte to_type;
 

	
 
};
 

	
 

	
 
/* The "steps" in loan size, in British Pounds! */
 
enum {
 
	LOAN_INTERVAL        = 10000,
 
@@ -198,8 +63,6 @@ struct Player {
 

	
 
	bool is_active;
 
	bool is_ai;
 
	PlayerAI ai;
 
	PlayerAiNew ainew;
 

	
 
	Money yearly_expenses[3][13];
 
	PlayerEconomyEntry cur_economy;