changeset 8119 | 52b48108425a |
parent 8116 | 8da76dcb3287 |
child 8121 | 3bc6351e7369 |
8118:fa5fe5491657 | 8119:52b48108425a |
---|---|
7 #include "string.h" |
7 #include "string.h" |
8 #include "aircraft.h" |
8 #include "aircraft.h" |
9 #include "bridge_map.h" |
9 #include "bridge_map.h" |
10 #include "cmd_helper.h" |
10 #include "cmd_helper.h" |
11 #include "debug.h" |
11 #include "debug.h" |
12 #include "functions.h" |
12 #include "tile_cmd.h" |
13 #include "landscape.h" |
13 #include "landscape.h" |
14 #include "station_map.h" |
14 #include "station_map.h" |
15 #include "table/sprites.h" |
15 #include "table/sprites.h" |
16 #include "table/strings.h" |
16 #include "table/strings.h" |
17 #include "map.h" |
17 #include "map.h" |
2343 |
2343 |
2344 static const byte _enter_station_speedtable[12] = { |
2344 static const byte _enter_station_speedtable[12] = { |
2345 215, 195, 175, 155, 135, 115, 95, 75, 55, 35, 15, 0 |
2345 215, 195, 175, 155, 135, 115, 95, 75, 55, 35, 15, 0 |
2346 }; |
2346 }; |
2347 |
2347 |
2348 static uint32 VehicleEnter_Station(Vehicle *v, TileIndex tile, int x, int y) |
2348 static VehicleEnterTileStatus VehicleEnter_Station(Vehicle *v, TileIndex tile, int x, int y) |
2349 { |
2349 { |
2350 if (v->type == VEH_TRAIN) { |
2350 if (v->type == VEH_TRAIN) { |
2351 if (IsRailwayStation(tile) && IsFrontEngine(v) && |
2351 if (IsRailwayStation(tile) && IsFrontEngine(v) && |
2352 !IsCompatibleTrainStationTile(tile + TileOffsByDiagDir(DirToDiagDir(v->direction)), tile)) { |
2352 !IsCompatibleTrainStationTile(tile + TileOffsByDiagDir(DirToDiagDir(v->direction)), tile)) { |
2353 StationID station_id = GetStationIndex(tile); |
2353 StationID station_id = GetStationIndex(tile); |
2363 y &= 0xF; |
2363 y &= 0xF; |
2364 |
2364 |
2365 if (DiagDirToAxis(dir) != AXIS_X) Swap(x, y); |
2365 if (DiagDirToAxis(dir) != AXIS_X) Swap(x, y); |
2366 if (y == TILE_SIZE / 2) { |
2366 if (y == TILE_SIZE / 2) { |
2367 if (dir != DIAGDIR_SE && dir != DIAGDIR_SW) x = TILE_SIZE - 1 - x; |
2367 if (dir != DIAGDIR_SE && dir != DIAGDIR_SW) x = TILE_SIZE - 1 - x; |
2368 if (x == 12) return VETSB_ENTERED_STATION | (station_id << VETS_STATION_ID_OFFSET); /* enter station */ |
2368 if (x == 12) return VETSB_ENTERED_STATION | (VehicleEnterTileStatus)(station_id << VETS_STATION_ID_OFFSET); /* enter station */ |
2369 if (x < 12) { |
2369 if (x < 12) { |
2370 uint16 spd; |
2370 uint16 spd; |
2371 |
2371 |
2372 v->vehstatus |= VS_TRAIN_SLOWING; |
2372 v->vehstatus |= VS_TRAIN_SLOWING; |
2373 spd = _enter_station_speedtable[x]; |
2373 spd = _enter_station_speedtable[x]; |