mirror of https://github.com/OpenTTD/OpenTTD
(svn r25956) -Fix [FS#5772]: temporary persistent storage modifications, e.g. command tests or those from GUI, were not properly reset, creating the possibility of desyncs
parent
169bf3a403
commit
c04d635ddb
|
@ -84,7 +84,7 @@ struct PersistentStorageArray : BaseStorageArray {
|
||||||
if (this->storage[pos] == value) return;
|
if (this->storage[pos] == value) return;
|
||||||
|
|
||||||
/* We do not have made a backup; lets do so */
|
/* We do not have made a backup; lets do so */
|
||||||
if (this->prev_storage != NULL) {
|
if (this->prev_storage == NULL) {
|
||||||
this->prev_storage = MallocT<TYPE>(SIZE);
|
this->prev_storage = MallocT<TYPE>(SIZE);
|
||||||
memcpy(this->prev_storage, this->storage, sizeof(this->storage));
|
memcpy(this->prev_storage, this->storage, sizeof(this->storage));
|
||||||
|
|
||||||
|
@ -121,6 +121,7 @@ struct PersistentStorageArray : BaseStorageArray {
|
||||||
memcpy(this->storage, this->prev_storage, sizeof(this->storage));
|
memcpy(this->storage, this->prev_storage, sizeof(this->storage));
|
||||||
}
|
}
|
||||||
free(this->prev_storage);
|
free(this->prev_storage);
|
||||||
|
this->prev_storage = NULL;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue