src/rail_cmd.cpp
branchnoai
changeset 10645 8cbdb511a674
parent 10513 33cb70ff2f5d
child 10715 6bdf79ffb022
equal deleted inserted replaced
10644:6c4314786d68 10645:8cbdb511a674
   775 		MarkTileDirtyByTile(tile);
   775 		MarkTileDirtyByTile(tile);
   776 
   776 
   777 		d->town_index = ClosestTownFromTile(tile, (uint)-1)->index;
   777 		d->town_index = ClosestTownFromTile(tile, (uint)-1)->index;
   778 
   778 
   779 		AddSideToSignalBuffer(tile, INVALID_DIAGDIR, _current_player);
   779 		AddSideToSignalBuffer(tile, INVALID_DIAGDIR, _current_player);
   780 		YapfNotifyTrackLayoutChange(tile, TrackdirToTrack(DiagdirToDiagTrackdir(dir)));
   780 		YapfNotifyTrackLayoutChange(tile, DiagDirToDiagTrack(dir));
   781 	}
   781 	}
   782 
   782 
   783 	return cost.AddCost(_price.build_train_depot);
   783 	return cost.AddCost(_price.build_train_depot);
   784 }
   784 }
   785 
   785 
  1244 				case MP_RAILWAY:
  1244 				case MP_RAILWAY:
  1245 					switch (GetRailTileType(tile)) {
  1245 					switch (GetRailTileType(tile)) {
  1246 						case RAIL_TILE_WAYPOINT:
  1246 						case RAIL_TILE_WAYPOINT:
  1247 							if (flags & DC_EXEC) {
  1247 							if (flags & DC_EXEC) {
  1248 								/* notify YAPF about the track layout change */
  1248 								/* notify YAPF about the track layout change */
  1249 								YapfNotifyTrackLayoutChange(tile, AxisToTrack(GetWaypointAxis(tile)));
  1249 								YapfNotifyTrackLayoutChange(tile, GetRailWaypointTrack(tile));
  1250 							}
  1250 							}
  1251 							cost.AddCost(RailConvertCost(type, totype));
  1251 							cost.AddCost(RailConvertCost(type, totype));
  1252 							break;
  1252 							break;
  1253 
  1253 
  1254 						case RAIL_TILE_DEPOT:
  1254 						case RAIL_TILE_DEPOT:
  1255 							if (flags & DC_EXEC) {
  1255 							if (flags & DC_EXEC) {
  1256 								/* notify YAPF about the track layout change */
  1256 								/* notify YAPF about the track layout change */
  1257 								YapfNotifyTrackLayoutChange(tile, AxisToTrack(DiagDirToAxis(GetRailDepotDirection(tile))));
  1257 								YapfNotifyTrackLayoutChange(tile, GetRailDepotTrack(tile));
  1258 
  1258 
  1259 								/* Update build vehicle window related to this depot */
  1259 								/* Update build vehicle window related to this depot */
  1260 								InvalidateWindowData(WC_VEHICLE_DEPOT, tile);
  1260 								InvalidateWindowData(WC_VEHICLE_DEPOT, tile);
  1261 								InvalidateWindowData(WC_BUILD_VEHICLE, tile);
  1261 								InvalidateWindowData(WC_BUILD_VEHICLE, tile);
  1262 							}
  1262 							}
  1293 						SetRailType(endtile, totype);
  1293 						SetRailType(endtile, totype);
  1294 
  1294 
  1295 						VehicleFromPos(tile, NULL, &UpdateTrainPowerProc);
  1295 						VehicleFromPos(tile, NULL, &UpdateTrainPowerProc);
  1296 						VehicleFromPos(endtile, NULL, &UpdateTrainPowerProc);
  1296 						VehicleFromPos(endtile, NULL, &UpdateTrainPowerProc);
  1297 
  1297 
  1298 						Track track = AxisToTrack(DiagDirToAxis(GetTunnelBridgeDirection(tile)));
  1298 						Track track = DiagDirToDiagTrack(GetTunnelBridgeDirection(tile));
  1299 
  1299 
  1300 						YapfNotifyTrackLayoutChange(tile, track);
  1300 						YapfNotifyTrackLayoutChange(tile, track);
  1301 						YapfNotifyTrackLayoutChange(endtile, track);
  1301 						YapfNotifyTrackLayoutChange(endtile, track);
  1302 
  1302 
  1303 						MarkTileDirtyByTile(tile);
  1303 						MarkTileDirtyByTile(tile);
  1342 		Owner owner = GetTileOwner(tile);
  1342 		Owner owner = GetTileOwner(tile);
  1343 
  1343 
  1344 		DoClearSquare(tile);
  1344 		DoClearSquare(tile);
  1345 		delete GetDepotByTile(tile);
  1345 		delete GetDepotByTile(tile);
  1346 		AddSideToSignalBuffer(tile, dir, owner);
  1346 		AddSideToSignalBuffer(tile, dir, owner);
  1347 		YapfNotifyTrackLayoutChange(tile, TrackdirToTrack(DiagdirToDiagTrackdir(dir)));
  1347 		YapfNotifyTrackLayoutChange(tile, DiagDirToDiagTrack(dir));
  1348 	}
  1348 	}
  1349 
  1349 
  1350 	return CommandCost(EXPENSES_CONSTRUCTION, _price.remove_train_depot);
  1350 	return CommandCost(EXPENSES_CONSTRUCTION, _price.remove_train_depot);
  1351 }
  1351 }
  1352 
  1352 
  2147 		case RAIL_TILE_DEPOT: {
  2147 		case RAIL_TILE_DEPOT: {
  2148 			DiagDirection dir = GetRailDepotDirection(tile);
  2148 			DiagDirection dir = GetRailDepotDirection(tile);
  2149 
  2149 
  2150 			if (side != INVALID_DIAGDIR && side != dir) break;
  2150 			if (side != INVALID_DIAGDIR && side != dir) break;
  2151 
  2151 
  2152 			trackbits = AxisToTrackBits(DiagDirToAxis(dir));
  2152 			trackbits = DiagDirToDiagTrackBits(dir);
  2153 			break;
  2153 			break;
  2154 		}
  2154 		}
  2155 
  2155 
  2156 		case RAIL_TILE_WAYPOINT:
  2156 		case RAIL_TILE_WAYPOINT:
  2157 			trackbits = GetRailWaypointBits(tile);
  2157 			trackbits = GetRailWaypointBits(tile);