Fix crash when copying bridges
This commit is contained in:
@@ -74,11 +74,12 @@ This is usable for any OpenTTD servers
|
||||
|
||||
== CHANGELOG ==
|
||||
|
||||
*** 12.0 (?? Oct 2021) ***
|
||||
*** 12.0 (17 Oct 2021) ***
|
||||
- Automatically search servers when opening multiplayer window.
|
||||
- Added TeamGame server filtering button.
|
||||
- Show town population instead of name in IMBA minimap mode.
|
||||
- In polyrail mode placing rail while holding Fn modifier will automatically flatten the land for it.
|
||||
- Fixed crash when copying rail bridges.
|
||||
|
||||
*** 12.0-RC1 (5 Oct 2021) ***
|
||||
- Added experimental rail copy-paste tool.
|
||||
|
||||
@@ -100,9 +100,13 @@ void Blueprint::Add(TileIndex source_tile, Blueprint::Item item) {
|
||||
);
|
||||
break;
|
||||
case Item::Type::RAIL_BRIDGE:
|
||||
this->source_tiles.insert(TILE_ADDXY(source_tile, item.u.rail.bridge.other_end.x, item.u.rail.bridge.other_end.y));
|
||||
this->source_tiles.insert(source_tile);
|
||||
break;
|
||||
case Item::Type::RAIL_TUNNEL:
|
||||
this->source_tiles.insert(TILE_ADDXY(source_tile, item.u.rail.tunnel.other_end.x, item.u.rail.tunnel.other_end.y));
|
||||
FALLTHROUGH;
|
||||
this->source_tiles.insert(source_tile);
|
||||
break;
|
||||
case Item::Type::RAIL_DEPOT:
|
||||
case Item::Type::RAIL_STATION:
|
||||
this->source_tiles.insert(source_tile);
|
||||
@@ -399,7 +403,6 @@ static void BlueprintAddTracks(sp<Blueprint> &blueprint, TileIndex tile, TileInd
|
||||
uint16 length = 0;
|
||||
Track c_track = track;
|
||||
Trackdir c_tdir = _track_iterate_dir[track];
|
||||
// fprintf(stderr, "TTTTTT %u %u %u\n", c_tile, c_track, GetTrackBits(c_tile));
|
||||
while (IsPlainRailTile(c_tile) && HasBit(GetTrackBits(c_tile), c_track)) {
|
||||
if (HasBit(track_tiles[c_tile], c_track)) break;
|
||||
length++;
|
||||
@@ -409,13 +412,11 @@ static void BlueprintAddTracks(sp<Blueprint> &blueprint, TileIndex tile, TileInd
|
||||
if (!area.Contains(c_tile)) break;
|
||||
c_tdir = NextTrackdir(c_tdir);
|
||||
c_track = TrackdirToTrack(c_tdir);
|
||||
// fprintf(stderr, "TTTTTTI %u %u %u\n", c_tile, c_track, GetTrackBits(c_tile));
|
||||
}
|
||||
if (end_tile == INVALID_TILE) continue;
|
||||
Blueprint::Item bi(Blueprint::Item::Type::RAIL_TRACK, tdiff);
|
||||
bi.u.rail.track.length = length;
|
||||
bi.u.rail.track.start_dir = _track_iterate_dir[track];
|
||||
// fprintf(stderr, "TTTTTTEE %u %u %u\n", tdiff, bi.u.rail.track.end_diff, bi.u.rail.track.start_dir);
|
||||
blueprint->Add(tile, bi);
|
||||
}
|
||||
}
|
||||
@@ -597,9 +598,7 @@ void SetBlueprintHighlight(const TileInfo *ti, TileHighlight &th) {
|
||||
}
|
||||
|
||||
void BuildBlueprint(sp<Blueprint> &blueprint, TileIndex start) {
|
||||
TileIndex last_tile;
|
||||
// uint32 last_p1, last_p2, last_cmd = CMD_END;
|
||||
CommandContainer last_rail = {INVALID_TILE, 0, 0, CMD_END};
|
||||
CommandContainer last_rail = {INVALID_TILE, 0, 0, CMD_END, nullptr, ""};
|
||||
for (auto &item : blueprint->items) {
|
||||
switch (item.type) {
|
||||
case Blueprint::Item::Type::RAIL_TRACK:
|
||||
|
||||
@@ -400,9 +400,11 @@ void ObjectHighlight::MarkDirty() {
|
||||
}
|
||||
if (this->type == ObjectHighlight::Type::BLUEPRINT && this->blueprint) { // TODO why && blueprint check is needed?
|
||||
for (auto tile : this->blueprint->source_tiles) {
|
||||
// fprintf(stderr, "D %d\n", (int)tile);
|
||||
MarkTileDirtyByTile(tile);
|
||||
}
|
||||
}
|
||||
// fprintf(stderr, "E\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user