Fix tile hash cache check warnings when loading very old savegames

See: #648
pull/653/head
Jonathan G Rennison 4 months ago
parent 11f75933bf
commit 3407b3edc0

@ -1005,12 +1005,12 @@ static bool AircraftController(Aircraft *v)
int z = GetSlopePixelZ(x, y) + 1 + afc->delta_z; int z = GetSlopePixelZ(x, y) + 1 + afc->delta_z;
if (z == v->z_pos) { if (z == v->z_pos) {
v->UpdatePosition();
Vehicle *u = v->Next()->Next(); Vehicle *u = v->Next()->Next();
/* Increase speed of rotors. When speed is 80, we've landed. */ /* Increase speed of rotors. When speed is 80, we've landed. */
if (u->cur_speed >= 80) { if (u->cur_speed >= 80) {
ClrBit(v->flags, VAF_HELI_DIRECT_DESCENT); ClrBit(v->flags, VAF_HELI_DIRECT_DESCENT);
v->UpdatePosition();
return true; return true;
} }
u->cur_speed += 4; u->cur_speed += 4;

@ -1218,6 +1218,9 @@ bool AfterLoadGame()
/* Force the freeform edges to false for old savegames. */ /* Force the freeform edges to false for old savegames. */
if (IsSavegameVersionBefore(SLV_111)) { if (IsSavegameVersionBefore(SLV_111)) {
_settings_game.construction.freeform_edges = false; _settings_game.construction.freeform_edges = false;
for (Vehicle *v : Vehicle::Iterate()) {
if (v->tile == 0) v->UpdatePosition();
}
} }
/* From version 9.0, we update the max passengers of a town (was sometimes negative /* From version 9.0, we update the max passengers of a town (was sometimes negative
@ -2960,10 +2963,12 @@ bool AfterLoadGame()
if (dir == vdir) { // Entering tunnel if (dir == vdir) { // Entering tunnel
hidden = frame >= _tunnel_visibility_frame[dir]; hidden = frame >= _tunnel_visibility_frame[dir];
v->tile = vtile; v->tile = vtile;
v->UpdatePosition();
} else if (dir == ReverseDiagDir(vdir)) { // Leaving tunnel } else if (dir == ReverseDiagDir(vdir)) { // Leaving tunnel
hidden = frame < TILE_SIZE - _tunnel_visibility_frame[dir]; hidden = frame < TILE_SIZE - _tunnel_visibility_frame[dir];
/* v->tile changes at the moment when the vehicle leaves the tunnel. */ /* v->tile changes at the moment when the vehicle leaves the tunnel. */
v->tile = hidden ? GetOtherTunnelBridgeEndOld(vtile) : vtile; v->tile = hidden ? GetOtherTunnelBridgeEndOld(vtile) : vtile;
v->UpdatePosition();
} else { } else {
/* We could get here in two cases: /* We could get here in two cases:
* - for road vehicles, it is reversing at the end of the tunnel * - for road vehicles, it is reversing at the end of the tunnel

@ -1678,6 +1678,9 @@ static void UpdateFreeformEdges(int32_t new_value)
MakeSea(TileXY(0, i)); MakeSea(TileXY(0, i));
} }
} }
for (Vehicle *v : Vehicle::Iterate()) {
if (v->tile == 0) v->UpdatePosition();
}
MarkWholeScreenDirty(); MarkWholeScreenDirty();
} }

Loading…
Cancel
Save