1071 if (callback != CALLBACK_FAILED && callback < 8) SetStationGfx(tile, (callback & ~1) + axis); |
1071 if (callback != CALLBACK_FAILED && callback < 8) SetStationGfx(tile, (callback & ~1) + axis); |
1072 } |
1072 } |
1073 |
1073 |
1074 tile += tile_delta; |
1074 tile += tile_delta; |
1075 } while (--w); |
1075 } while (--w); |
1076 SetSignalsOnBothDir(tile_org, track); |
1076 SetSignalsOnBothDir(tile_org, track, _current_player); |
1077 YapfNotifyTrackLayoutChange(tile_org, track); |
1077 YapfNotifyTrackLayoutChange(tile_org, track); |
1078 tile_org += tile_delta ^ TileDiffXY(1, 1); // perpendicular to tile_delta |
1078 tile_org += tile_delta ^ TileDiffXY(1, 1); // perpendicular to tile_delta |
1079 } while (--numtracks); |
1079 } while (--numtracks); |
1080 |
1080 |
1081 st->MarkTilesDirty(false); |
1081 st->MarkTilesDirty(false); |
1200 |
1200 |
1201 /* If we reached here, the tile is valid so increase the quantity of tiles we will remove */ |
1201 /* If we reached here, the tile is valid so increase the quantity of tiles we will remove */ |
1202 quantity++; |
1202 quantity++; |
1203 |
1203 |
1204 if (flags & DC_EXEC) { |
1204 if (flags & DC_EXEC) { |
|
1205 /* read variables before the station tile is removed */ |
1205 uint specindex = GetCustomStationSpecIndex(tile2); |
1206 uint specindex = GetCustomStationSpecIndex(tile2); |
1206 Track track = GetRailStationTrack(tile2); |
1207 Track track = GetRailStationTrack(tile2); |
|
1208 Owner owner = GetTileOwner(tile2); |
|
1209 |
1207 DoClearSquare(tile2); |
1210 DoClearSquare(tile2); |
1208 st->rect.AfterRemoveTile(st, tile2); |
1211 st->rect.AfterRemoveTile(st, tile2); |
1209 SetSignalsOnBothDir(tile2, track); |
1212 SetSignalsOnBothDir(tile2, track, owner); |
1210 YapfNotifyTrackLayoutChange(tile2, track); |
1213 YapfNotifyTrackLayoutChange(tile2, track); |
1211 |
1214 |
1212 DeallocateSpecFromStation(st, specindex); |
1215 DeallocateSpecFromStation(st, specindex); |
1213 |
1216 |
1214 /* now we need to make the "spanned" area of the railway station smaller |
1217 /* now we need to make the "spanned" area of the railway station smaller |
1255 CommandCost cost(EXPENSES_CONSTRUCTION); |
1258 CommandCost cost(EXPENSES_CONSTRUCTION); |
1256 /* clear all areas of the station */ |
1259 /* clear all areas of the station */ |
1257 do { |
1260 do { |
1258 int w_bak = w; |
1261 int w_bak = w; |
1259 do { |
1262 do { |
1260 // for nonuniform stations, only remove tiles that are actually train station tiles |
1263 /* for nonuniform stations, only remove tiles that are actually train station tiles */ |
1261 if (st->TileBelongsToRailStation(tile)) { |
1264 if (st->TileBelongsToRailStation(tile)) { |
1262 if (!EnsureNoVehicleOnGround(tile)) |
1265 if (!EnsureNoVehicleOnGround(tile)) |
1263 return CMD_ERROR; |
1266 return CMD_ERROR; |
1264 cost.AddCost(_price.remove_rail_station); |
1267 cost.AddCost(_price.remove_rail_station); |
1265 if (flags & DC_EXEC) { |
1268 if (flags & DC_EXEC) { |
|
1269 /* read variables before the station tile is removed */ |
1266 Track track = GetRailStationTrack(tile); |
1270 Track track = GetRailStationTrack(tile); |
|
1271 Owner owner = GetTileOwner(tile); // _current_player can be OWNER_WATER |
1267 DoClearSquare(tile); |
1272 DoClearSquare(tile); |
1268 SetSignalsOnBothDir(tile, track); |
1273 SetSignalsOnBothDir(tile, track, owner); |
1269 YapfNotifyTrackLayoutChange(tile, track); |
1274 YapfNotifyTrackLayoutChange(tile, track); |
1270 } |
1275 } |
1271 } |
1276 } |
1272 tile += TileDiffXY(1, 0); |
1277 tile += TileDiffXY(1, 0); |
1273 } while (--w); |
1278 } while (--w); |