station_cmd.c
changeset 4389 18d6ccfb5335
parent 4354 10f4ce894eb1
child 4393 19245f613d3d
equal deleted inserted replaced
4388:c8a66d26e146 4389:18d6ccfb5335
  1861 	const Vehicle *v;
  1861 	const Vehicle *v;
  1862 	FOR_ALL_VEHICLES(v) {
  1862 	FOR_ALL_VEHICLES(v) {
  1863 		if (v->type == VEH_Ship) {
  1863 		if (v->type == VEH_Ship) {
  1864 			const Order *order;
  1864 			const Order *order;
  1865 			FOR_VEHICLE_ORDERS(v, order) {
  1865 			FOR_VEHICLE_ORDERS(v, order) {
  1866 				if (order->type == OT_GOTO_STATION && order->station == st->index) {
  1866 				if (order->type == OT_GOTO_STATION && order->dest.station == st->index) {
  1867 					return true;
  1867 					return true;
  1868 				}
  1868 				}
  1869 			}
  1869 			}
  1870 		}
  1870 		}
  1871 	}
  1871 	}
  2331 		if (IsRailwayStation(tile) && IsFrontEngine(v) &&
  2331 		if (IsRailwayStation(tile) && IsFrontEngine(v) &&
  2332 				!IsCompatibleTrainStationTile(tile + TileOffsByDir(DirToDiagDir(v->direction)), tile)) {
  2332 				!IsCompatibleTrainStationTile(tile + TileOffsByDir(DirToDiagDir(v->direction)), tile)) {
  2333 			StationID station_id = GetStationIndex(tile);
  2333 			StationID station_id = GetStationIndex(tile);
  2334 
  2334 
  2335 			if ((!(v->current_order.flags & OF_NON_STOP) && !_patches.new_nonstop) ||
  2335 			if ((!(v->current_order.flags & OF_NON_STOP) && !_patches.new_nonstop) ||
  2336 					(v->current_order.type == OT_GOTO_STATION && v->current_order.station == station_id)) {
  2336 					(v->current_order.type == OT_GOTO_STATION && v->current_order.dest.station == station_id)) {
  2337 				if (!(_patches.new_nonstop && v->current_order.flags & OF_NON_STOP) &&
  2337 				if (!(_patches.new_nonstop && v->current_order.flags & OF_NON_STOP) &&
  2338 						v->current_order.type != OT_LEAVESTATION &&
  2338 						v->current_order.type != OT_LEAVESTATION &&
  2339 						v->last_station_visited != station_id) {
  2339 						v->last_station_visited != station_id) {
  2340 					DiagDirection dir = DirToDiagDir(v->direction);
  2340 					DiagDirection dir = DirToDiagDir(v->direction);
  2341 
  2341 
  2410 
  2410 
  2411 	index = st->index;
  2411 	index = st->index;
  2412 	DeleteWindowById(WC_STATION_VIEW, index);
  2412 	DeleteWindowById(WC_STATION_VIEW, index);
  2413 
  2413 
  2414 	/* Now delete all orders that go to the station */
  2414 	/* Now delete all orders that go to the station */
  2415 	RemoveOrderFromAllVehicles(OT_GOTO_STATION, index);
  2415 	RemoveOrderFromAllVehicles(OT_GOTO_STATION, (DestinationID)index);
  2416 
  2416 
  2417 	//And do the same with aircraft that have the station as a hangar-stop
  2417 	//And do the same with aircraft that have the station as a hangar-stop
  2418 	FOR_ALL_VEHICLES(v) {
  2418 	FOR_ALL_VEHICLES(v) {
  2419 		bool invalidate = false;
  2419 		bool invalidate = false;
  2420 		if (v->type == VEH_Aircraft) {
  2420 		if (v->type == VEH_Aircraft) {
  2421 			Order *order;
  2421 			Order *order;
  2422 			FOR_VEHICLE_ORDERS(v, order) {
  2422 			FOR_VEHICLE_ORDERS(v, order) {
  2423 				if (order->type == OT_GOTO_DEPOT && order->station == index) {
  2423 				if (order->type == OT_GOTO_DEPOT && order->dest.station == index) {
  2424 					order->type = OT_DUMMY;
  2424 					order->type = OT_DUMMY;
  2425 					order->flags = 0;
  2425 					order->flags = 0;
  2426 					invalidate = true;
  2426 					invalidate = true;
  2427 				}
  2427 				}
  2428 			}
  2428 			}