Prevent AIs from creating or adding to rail custom bridge heads
This commit is contained in:
@@ -982,6 +982,7 @@ static CommandCost CmdRailTrackHelper(TileIndex tile, DoCommandFlag flags, uint3
|
|||||||
Track track = Extract<Track, 6, 3>(p2);
|
Track track = Extract<Track, 6, 3>(p2);
|
||||||
bool remove = HasBit(p2, 9);
|
bool remove = HasBit(p2, 9);
|
||||||
bool fail_if_obstacle = HasBit(p2, 10);
|
bool fail_if_obstacle = HasBit(p2, 10);
|
||||||
|
bool no_custom_bridge_heads = HasBit(p2, 11);
|
||||||
|
|
||||||
_rail_track_endtile = INVALID_TILE;
|
_rail_track_endtile = INVALID_TILE;
|
||||||
|
|
||||||
@@ -997,7 +998,7 @@ static CommandCost CmdRailTrackHelper(TileIndex tile, DoCommandFlag flags, uint3
|
|||||||
CommandCost last_error = CMD_ERROR;
|
CommandCost last_error = CMD_ERROR;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
TileIndex last_endtile = _rail_track_endtile;
|
TileIndex last_endtile = _rail_track_endtile;
|
||||||
CommandCost ret = DoCommand(tile, remove ? 0 : railtype, TrackdirToTrack(trackdir), flags, remove ? CMD_REMOVE_SINGLE_RAIL : CMD_BUILD_SINGLE_RAIL);
|
CommandCost ret = DoCommand(tile, remove ? 0 : railtype, TrackdirToTrack(trackdir) | (no_custom_bridge_heads ? 1 << 4 : 0), flags, remove ? CMD_REMOVE_SINGLE_RAIL : CMD_BUILD_SINGLE_RAIL);
|
||||||
|
|
||||||
if (ret.Failed()) {
|
if (ret.Failed()) {
|
||||||
last_error = ret;
|
last_error = ret;
|
||||||
|
@@ -355,7 +355,7 @@ static uint32 SimulateDrag(TileIndex from, TileIndex tile, TileIndex *to)
|
|||||||
(::TileX(from) == ::TileX(tile) && ::TileX(tile) == ::TileX(to)) ||
|
(::TileX(from) == ::TileX(tile) && ::TileX(tile) == ::TileX(to)) ||
|
||||||
(::TileY(from) == ::TileY(tile) && ::TileY(tile) == ::TileY(to)));
|
(::TileY(from) == ::TileY(tile) && ::TileY(tile) == ::TileY(to)));
|
||||||
|
|
||||||
uint32 p2 = SimulateDrag(from, tile, &to) | 1 << 10 | ScriptRail::GetCurrentRailType();;
|
uint32 p2 = SimulateDrag(from, tile, &to) | 1 << 10 | 1 << 11 | ScriptRail::GetCurrentRailType();;
|
||||||
return ScriptObject::DoCommand(tile, to, p2, CMD_BUILD_RAILROAD_TRACK);
|
return ScriptObject::DoCommand(tile, to, p2, CMD_BUILD_RAILROAD_TRACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user