src/station_cmd.cpp
changeset 10158 e4e8e74d96c7
parent 10143 043d546c1eac
child 10222 b6919c94cc77
equal deleted inserted replaced
10157:c6c508d9e164 10158:e4e8e74d96c7
  2404 };
  2404 };
  2405 
  2405 
  2406 static VehicleEnterTileStatus VehicleEnter_Station(Vehicle *v, TileIndex tile, int x, int y)
  2406 static VehicleEnterTileStatus VehicleEnter_Station(Vehicle *v, TileIndex tile, int x, int y)
  2407 {
  2407 {
  2408 	StationID station_id = GetStationIndex(tile);
  2408 	StationID station_id = GetStationIndex(tile);
  2409 	if (!v->current_order.ShouldStopAtStation(v, station_id)) return VETSB_CONTINUE;
       
  2410 
  2409 
  2411 	if (v->type == VEH_TRAIN) {
  2410 	if (v->type == VEH_TRAIN) {
       
  2411 		if (!v->current_order.ShouldStopAtStation(v, station_id)) return VETSB_CONTINUE;
  2412 		if (IsRailwayStation(tile) && IsFrontEngine(v) &&
  2412 		if (IsRailwayStation(tile) && IsFrontEngine(v) &&
  2413 				!IsCompatibleTrainStationTile(tile + TileOffsByDiagDir(DirToDiagDir(v->direction)), tile)) {
  2413 				!IsCompatibleTrainStationTile(tile + TileOffsByDiagDir(DirToDiagDir(v->direction)), tile)) {
  2414 			DiagDirection dir = DirToDiagDir(v->direction);
  2414 			DiagDirection dir = DirToDiagDir(v->direction);
  2415 
  2415 
  2416 			x &= 0xF;
  2416 			x &= 0xF;
  2434 			if (IsRoadStop(tile) && IsRoadVehFront(v)) {
  2434 			if (IsRoadStop(tile) && IsRoadVehFront(v)) {
  2435 				/* Attempt to allocate a parking bay in a road stop */
  2435 				/* Attempt to allocate a parking bay in a road stop */
  2436 				RoadStop *rs = GetRoadStopByTile(tile, GetRoadStopType(tile));
  2436 				RoadStop *rs = GetRoadStopByTile(tile, GetRoadStopType(tile));
  2437 
  2437 
  2438 				if (IsDriveThroughStopTile(tile)) {
  2438 				if (IsDriveThroughStopTile(tile)) {
       
  2439 					if (!v->current_order.ShouldStopAtStation(v, station_id)) return VETSB_CONTINUE;
       
  2440 
  2439 					/* Vehicles entering a drive-through stop from the 'normal' side use first bay (bay 0). */
  2441 					/* Vehicles entering a drive-through stop from the 'normal' side use first bay (bay 0). */
  2440 					byte side = ((DirToDiagDir(v->direction) == ReverseDiagDir(GetRoadStopDir(tile))) == (v->u.road.overtaking == 0)) ? 0 : 1;
  2442 					byte side = ((DirToDiagDir(v->direction) == ReverseDiagDir(GetRoadStopDir(tile))) == (v->u.road.overtaking == 0)) ? 0 : 1;
  2441 
  2443 
  2442 					if (!rs->IsFreeBay(side)) return VETSB_CANNOT_ENTER;
  2444 					if (!rs->IsFreeBay(side)) return VETSB_CANNOT_ENTER;
  2443 
  2445