mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-02-06 22:37:22 +00:00
(svn r11883) -Fix (r11864): assert when trying to remove rail from a house or industry tile
This commit is contained in:
parent
ac7bc24b0e
commit
c8178d43c1
@ -441,9 +441,11 @@ CommandCost CmdRemoveSingleRail(TileIndex tile, uint32 flags, uint32 p1, uint32
|
|||||||
if (!ValParamTrackOrientation((Track)p2)) return CMD_ERROR;
|
if (!ValParamTrackOrientation((Track)p2)) return CMD_ERROR;
|
||||||
trackbit = TrackToTrackBits(track);
|
trackbit = TrackToTrackBits(track);
|
||||||
|
|
||||||
/* Need to read tile owner now because it may change when the rail is removed.
|
/* Need to read tile owner now because it may change when the rail is removed
|
||||||
* Also, in case of floods, _current_player != owner */
|
* Also, in case of floods, _current_player != owner
|
||||||
Owner owner = GetTileOwner(tile);
|
* There may be invalid tiletype even in exec run (when removing long track),
|
||||||
|
* so do not call GetTileOwner(tile) in any case here */
|
||||||
|
Owner owner = INVALID_OWNER;
|
||||||
|
|
||||||
switch (GetTileType(tile)) {
|
switch (GetTileType(tile)) {
|
||||||
case MP_ROAD: {
|
case MP_ROAD: {
|
||||||
@ -455,6 +457,7 @@ CommandCost CmdRemoveSingleRail(TileIndex tile, uint32 flags, uint32 p1, uint32
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
|
owner = GetTileOwner(tile);
|
||||||
MakeRoadNormal(tile, GetCrossingRoadBits(tile), GetRoadTypes(tile), GetTownIndex(tile), GetRoadOwner(tile, ROADTYPE_ROAD), GetRoadOwner(tile, ROADTYPE_TRAM), GetRoadOwner(tile, ROADTYPE_HWAY));
|
MakeRoadNormal(tile, GetCrossingRoadBits(tile), GetRoadTypes(tile), GetTownIndex(tile), GetRoadOwner(tile, ROADTYPE_ROAD), GetRoadOwner(tile, ROADTYPE_TRAM), GetRoadOwner(tile, ROADTYPE_HWAY));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -478,6 +481,7 @@ CommandCost CmdRemoveSingleRail(TileIndex tile, uint32 flags, uint32 p1, uint32
|
|||||||
cost.AddCost(DoCommand(tile, track, 0, flags, CMD_REMOVE_SIGNALS));
|
cost.AddCost(DoCommand(tile, track, 0, flags, CMD_REMOVE_SIGNALS));
|
||||||
|
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
|
owner = GetTileOwner(tile);
|
||||||
present ^= trackbit;
|
present ^= trackbit;
|
||||||
if (present == 0) {
|
if (present == 0) {
|
||||||
if (GetRailGroundType(tile) == RAIL_GROUND_WATER) {
|
if (GetRailGroundType(tile) == RAIL_GROUND_WATER) {
|
||||||
@ -496,6 +500,9 @@ CommandCost CmdRemoveSingleRail(TileIndex tile, uint32 flags, uint32 p1, uint32
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (flags & DC_EXEC) {
|
if (flags & DC_EXEC) {
|
||||||
|
/* if we got that far, 'owner' variable is set correctly */
|
||||||
|
assert(IsValidPlayer(owner));
|
||||||
|
|
||||||
MarkTileDirtyByTile(tile);
|
MarkTileDirtyByTile(tile);
|
||||||
if (crossing) {
|
if (crossing) {
|
||||||
/* crossing is set when only TRACK_BIT_X and TRACK_BIT_Y are set. As we
|
/* crossing is set when only TRACK_BIT_X and TRACK_BIT_Y are set. As we
|
||||||
|
Loading…
Reference in New Issue
Block a user