mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r22552) -Fix: Clear airport persistent storage on construction/removal of airports.
This commit is contained in:
parent
b2275b4093
commit
d5e7537e14
|
@ -62,6 +62,12 @@ struct PersistentStorageArray : BaseStorageArray {
|
||||||
free(this->prev_storage);
|
free(this->prev_storage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Resets all values to zero. */
|
||||||
|
void ResetToZero()
|
||||||
|
{
|
||||||
|
memset(this->storage, 0, sizeof(this->storage));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stores some value at a given position.
|
* Stores some value at a given position.
|
||||||
* If there is no backup of the data that backup is made and then
|
* If there is no backup of the data that backup is made and then
|
||||||
|
|
|
@ -2191,6 +2191,7 @@ CommandCost CmdBuildAirport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
|
||||||
st->airport.layout = layout;
|
st->airport.layout = layout;
|
||||||
st->airport.flags = 0;
|
st->airport.flags = 0;
|
||||||
st->airport.rotation = rotation;
|
st->airport.rotation = rotation;
|
||||||
|
st->airport.psa.ResetToZero();
|
||||||
|
|
||||||
st->rect.BeforeAddRect(tile, w, h, StationRect::ADD_TRY);
|
st->rect.BeforeAddRect(tile, w, h, StationRect::ADD_TRY);
|
||||||
|
|
||||||
|
@ -2287,6 +2288,7 @@ static CommandCost RemoveAirport(TileIndex tile, DoCommandFlag flags)
|
||||||
|
|
||||||
st->airport.Clear();
|
st->airport.Clear();
|
||||||
st->facilities &= ~FACIL_AIRPORT;
|
st->facilities &= ~FACIL_AIRPORT;
|
||||||
|
st->airport.psa.ResetToZero();
|
||||||
|
|
||||||
SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_PLANES);
|
SetWindowWidgetDirty(WC_STATION_VIEW, st->index, SVW_PLANES);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue