(svn r3052) Fix last commit *grml*
This commit is contained in:
		@@ -133,16 +133,12 @@ static int AiChooseTrainToBuild(byte railtype, int32 money, byte flag, TileIndex
 | 
				
			|||||||
		const RailVehicleInfo *rvi = RailVehInfo(i);
 | 
							const RailVehicleInfo *rvi = RailVehInfo(i);
 | 
				
			||||||
		const Engine* e = GetEngine(i);
 | 
							const Engine* e = GetEngine(i);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (e->railtype != railtype ||
 | 
							if (e->railtype != railtype || rvi->flags & RVI_WAGON
 | 
				
			||||||
				rvi->flags & RVI_WAGON ||
 | 
							    || !HASBIT(e->player_avail, _current_player) || e->reliability < 0x8A3D)
 | 
				
			||||||
				(rvi->flags & RVI_MULTIHEAD && flag & 1) ||
 | 
					 | 
				
			||||||
				!HASBIT(e->player_avail, _current_player) ||
 | 
					 | 
				
			||||||
				e->reliability < 0x8A3D) {
 | 
					 | 
				
			||||||
			continue;
 | 
								continue;
 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		ret = DoCommandByTile(tile, i, 0, 0, CMD_BUILD_RAIL_VEHICLE);
 | 
							ret = DoCommandByTile(tile, i, 0, 0, CMD_BUILD_RAIL_VEHICLE);
 | 
				
			||||||
		if (!CmdFailed(ret) && ret <= money &&
 | 
							if (!CmdFailed(ret) && (!(_cmd_build_rail_veh_var1&1) || !(flag&1)) && ret <= money &&
 | 
				
			||||||
				_cmd_build_rail_veh_score >= best_veh_score) {
 | 
									_cmd_build_rail_veh_score >= best_veh_score) {
 | 
				
			||||||
			best_veh_score = _cmd_build_rail_veh_score;
 | 
								best_veh_score = _cmd_build_rail_veh_score;
 | 
				
			||||||
			best_veh_index = i;
 | 
								best_veh_index = i;
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										21
									
								
								train_cmd.c
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								train_cmd.c
									
									
									
									
									
								
							@@ -498,6 +498,24 @@ static void NormalizeTrainVehInDepot(Vehicle *u)
 | 
				
			|||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static const byte _railveh_unk1[] = {
 | 
				
			||||||
 | 
						0, 0, 0, 0, 0, 0, 0, 0,
 | 
				
			||||||
 | 
						0, 0, 0, 1, 1, 0, 0, 0,
 | 
				
			||||||
 | 
						0, 0, 0, 0, 1, 0, 1, 0,
 | 
				
			||||||
 | 
						0, 1, 1, 0, 0, 0, 0, 0,
 | 
				
			||||||
 | 
						0, 0, 0, 0, 0, 0, 0, 0,
 | 
				
			||||||
 | 
						0, 0, 0, 0, 0, 0, 0, 0,
 | 
				
			||||||
 | 
						0, 0, 0, 0, 0, 0, 0, 1,
 | 
				
			||||||
 | 
						0, 0, 0, 0, 0, 0, 0, 0,
 | 
				
			||||||
 | 
						0, 0, 0, 0, 0, 0, 0, 0,
 | 
				
			||||||
 | 
						0, 0, 0, 0, 0, 0, 0, 0,
 | 
				
			||||||
 | 
						0, 0, 0, 0, 0, 0, 0, 0,
 | 
				
			||||||
 | 
						0, 0, 0, 0, 0, 0, 0, 0,
 | 
				
			||||||
 | 
						0, 0, 0, 0, 0, 0, 0, 0,
 | 
				
			||||||
 | 
						0, 0, 0, 0, 0, 0, 0, 0,
 | 
				
			||||||
 | 
						0, 0, 0, 0,
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static const byte _railveh_score[] = {
 | 
					static const byte _railveh_score[] = {
 | 
				
			||||||
	1, 4, 7, 19, 20, 30, 31, 19,
 | 
						1, 4, 7, 19, 20, 30, 31, 19,
 | 
				
			||||||
	20, 21, 22, 10, 11, 30, 31, 32,
 | 
						20, 21, 22, 10, 11, 30, 31, 32,
 | 
				
			||||||
@@ -572,6 +590,8 @@ int32 CmdBuildRailVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2)
 | 
				
			|||||||
		if (!IsTileOwner(tile, _current_player)) return CMD_ERROR;
 | 
							if (!IsTileOwner(tile, _current_player)) return CMD_ERROR;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						_cmd_build_rail_veh_var1 = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
 | 
						SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	rvi = RailVehInfo(p1);
 | 
						rvi = RailVehInfo(p1);
 | 
				
			||||||
@@ -656,6 +676,7 @@ int32 CmdBuildRailVehicle(int x, int y, uint32 flags, uint32 p1, uint32 p2)
 | 
				
			|||||||
			InvalidateWindow(WC_COMPANY, v->owner);
 | 
								InvalidateWindow(WC_COMPANY, v->owner);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						_cmd_build_rail_veh_var1 = _railveh_unk1[p1];
 | 
				
			||||||
	_cmd_build_rail_veh_score = _railveh_score[p1];
 | 
						_cmd_build_rail_veh_score = _railveh_score[p1];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Train); // updates the replace Train window
 | 
						InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Train); // updates the replace Train window
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -447,6 +447,7 @@ VARDEF VehicleID _new_ship_id;
 | 
				
			|||||||
VARDEF VehicleID _new_roadveh_id;
 | 
					VARDEF VehicleID _new_roadveh_id;
 | 
				
			||||||
VARDEF uint16 _aircraft_refit_capacity;
 | 
					VARDEF uint16 _aircraft_refit_capacity;
 | 
				
			||||||
VARDEF byte _cmd_build_rail_veh_score;
 | 
					VARDEF byte _cmd_build_rail_veh_score;
 | 
				
			||||||
 | 
					VARDEF byte _cmd_build_rail_veh_var1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// for each player, for each vehicle type, keep a list of the vehicles.
 | 
					// for each player, for each vehicle type, keep a list of the vehicles.
 | 
				
			||||||
//VARDEF Vehicle *_vehicle_arr[8][4];
 | 
					//VARDEF Vehicle *_vehicle_arr[8][4];
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user