src/ai/trolly/trolly.h
changeset 10207 c291a21b304e
parent 9950 2a0d0769c0e3
child 10208 72c00af5c95d
equal deleted inserted replaced
10206:0050610c0368 10207:c291a21b304e
   118 #define AI_BUILDPATH_PAUSE 10
   118 #define AI_BUILDPATH_PAUSE 10
   119 
   119 
   120 // Minimum % of reliabilty a vehicle has to have before the AI buys it
   120 // Minimum % of reliabilty a vehicle has to have before the AI buys it
   121 #define AI_VEHICLE_MIN_RELIABILTY 60
   121 #define AI_VEHICLE_MIN_RELIABILTY 60
   122 
   122 
   123 // The minimum amount of money a player should always have
   123 // The minimum amount of money a company should always have
   124 #define AI_MINIMUM_MONEY 15000
   124 #define AI_MINIMUM_MONEY 15000
   125 
   125 
   126 // If the most cheap route is build, how much is it going to cost..
   126 // If the most cheap route is build, how much is it going to cost..
   127 // This is to prevent the AI from trying to build a route which can not be paid for
   127 // This is to prevent the AI from trying to build a route which can not be paid for
   128 #define AI_MINIMUM_BUS_ROUTE_MONEY 25000
   128 #define AI_MINIMUM_BUS_ROUTE_MONEY 25000
   146 // How many thick between building 2 vehicles
   146 // How many thick between building 2 vehicles
   147 #define AI_BUILD_VEHICLE_TIME_BETWEEN DAY_TICKS
   147 #define AI_BUILD_VEHICLE_TIME_BETWEEN DAY_TICKS
   148 
   148 
   149 // How many days must there between vehicle checks
   149 // How many days must there between vehicle checks
   150 //  The more often, the less non-money-making lines there will be
   150 //  The more often, the less non-money-making lines there will be
   151 //   but the unfair it may seem to a human player
   151 //   but the unfair it may seem to a human company
   152 #define AI_DAYS_BETWEEN_VEHICLE_CHECKS 30
   152 #define AI_DAYS_BETWEEN_VEHICLE_CHECKS 30
   153 
   153 
   154 // How money profit does a vehicle needs to make to stay in order
   154 // How money profit does a vehicle needs to make to stay in order
   155 //  This is the profit of this year + profit of last year
   155 //  This is the profit of this year + profit of last year
   156 //  But also for vehicles that are just one year old. In other words:
   156 //  But also for vehicles that are just one year old. In other words:
   237 
   237 
   238 // Flags used in user_data
   238 // Flags used in user_data
   239 #define AI_PATHFINDER_FLAG_BRIDGE 1
   239 #define AI_PATHFINDER_FLAG_BRIDGE 1
   240 #define AI_PATHFINDER_FLAG_TUNNEL 2
   240 #define AI_PATHFINDER_FLAG_TUNNEL 2
   241 
   241 
   242 typedef void AiNew_StateFunction(Player *p);
   242 typedef void AiNew_StateFunction(Company *c);
   243 
   243 
   244 // ai_new.c
   244 // ai_new.c
   245 void AiNewDoGameLoop(Player *p);
   245 void AiNewDoGameLoop(Company *c);
   246 
   246 
   247 struct Ai_PathFinderInfo {
   247 struct Ai_PathFinderInfo {
   248 	TileIndex start_tile_tl; ///< tl = top-left
   248 	TileIndex start_tile_tl; ///< tl = top-left
   249 	TileIndex start_tile_br; ///< br = bottom-right
   249 	TileIndex start_tile_br; ///< br = bottom-right
   250 	TileIndex end_tile_tl;   ///< tl = top-left
   250 	TileIndex end_tile_tl;   ///< tl = top-left
   266 
   266 
   267 // ai_shared.c
   267 // ai_shared.c
   268 int AiNew_GetRailDirection(TileIndex tile_a, TileIndex tile_b, TileIndex tile_c);
   268 int AiNew_GetRailDirection(TileIndex tile_a, TileIndex tile_b, TileIndex tile_c);
   269 int AiNew_GetRoadDirection(TileIndex tile_a, TileIndex tile_b, TileIndex tile_c);
   269 int AiNew_GetRoadDirection(TileIndex tile_a, TileIndex tile_b, TileIndex tile_c);
   270 DiagDirection AiNew_GetDirection(TileIndex tile_a, TileIndex tile_b);
   270 DiagDirection AiNew_GetDirection(TileIndex tile_a, TileIndex tile_b);
   271 bool AiNew_SetSpecialVehicleFlag(Player *p, Vehicle *v, uint flag);
   271 bool AiNew_SetSpecialVehicleFlag(Company *c, Vehicle *v, uint flag);
   272 uint AiNew_GetSpecialVehicleFlag(Player *p, Vehicle *v);
   272 uint AiNew_GetSpecialVehicleFlag(Company *c, Vehicle *v);
   273 
   273 
   274 // ai_build.c
   274 // ai_build.c
   275 bool AiNew_Build_CompanyHQ(Player *p, TileIndex tile);
   275 bool AiNew_Build_CompanyHQ(Company *c, TileIndex tile);
   276 CommandCost AiNew_Build_Station(Player *p, byte type, TileIndex tile, byte length, byte numtracks, byte direction, byte flag);
   276 CommandCost AiNew_Build_Station(Company *c, byte type, TileIndex tile, byte length, byte numtracks, byte direction, byte flag);
   277 CommandCost AiNew_Build_Bridge(Player *p, TileIndex tile_a, TileIndex tile_b, byte flag);
   277 CommandCost AiNew_Build_Bridge(Company *c, TileIndex tile_a, TileIndex tile_b, byte flag);
   278 CommandCost AiNew_Build_RoutePart(Player *p, Ai_PathFinderInfo *PathFinderInfo, byte flag);
   278 CommandCost AiNew_Build_RoutePart(Company *c, Ai_PathFinderInfo *PathFinderInfo, byte flag);
   279 EngineID AiNew_PickVehicle(Player *p);
   279 EngineID AiNew_PickVehicle(Company *c);
   280 CommandCost AiNew_Build_Vehicle(Player *p, TileIndex tile, byte flag);
   280 CommandCost AiNew_Build_Vehicle(Company *c, TileIndex tile, byte flag);
   281 CommandCost AiNew_Build_Depot(Player* p, TileIndex tile, DiagDirection direction, byte flag);
   281 CommandCost AiNew_Build_Depot(Company *c, TileIndex tile, DiagDirection direction, byte flag);
   282 
   282 
   283 /* The amount of memory reserved for the AI-special-vehicles */
   283 /* The amount of memory reserved for the AI-special-vehicles */
   284 #define AI_MAX_SPECIAL_VEHICLES 100
   284 #define AI_MAX_SPECIAL_VEHICLES 100
   285 
   285 
   286 struct Ai_SpecialVehicle {
   286 struct Ai_SpecialVehicle {
   287 	VehicleID veh_id;
   287 	VehicleID veh_id;
   288 	uint32 flag;
   288 	uint32 flag;
   289 };
   289 };
   290 
   290 
   291 struct PlayerAiNew {
   291 struct CompanyAiNew {
   292 	uint8 state;
   292 	uint8 state;
   293 	uint tick;
   293 	uint tick;
   294 	uint idle;
   294 	uint idle;
   295 
   295 
   296 	int temp;    ///< A value used in more than one function, but it just temporary
   296 	int temp;    ///< A value used in more than one function, but it just temporary
   336 	int from_ic;           ///< ic = industry/city. This is the ID of them
   336 	int from_ic;           ///< ic = industry/city. This is the ID of them
   337 	byte from_type;        ///< AI_NO_TYPE/AI_CITY/AI_INDUSTRY
   337 	byte from_type;        ///< AI_NO_TYPE/AI_CITY/AI_INDUSTRY
   338 	int to_ic;
   338 	int to_ic;
   339 	byte to_type;
   339 	byte to_type;
   340 };
   340 };
   341 extern PlayerAiNew _players_ainew[MAX_PLAYERS];
   341 extern CompanyAiNew _companies_ainew[MAX_COMPANIES];
   342 
   342 
   343 #endif /* AI_TROLLY_H */
   343 #endif /* AI_TROLLY_H */