fix pestistentstorages indexing issue (array save assert)

This commit is contained in:
Pavel Stupnikov
2016-07-28 20:18:06 +03:00
parent fa75f917db
commit 37c2d2b487

View File

@@ -75,7 +75,13 @@ static void Save_CMDataAsPSAC() {
SLEG_CONDARR(*ptr, SLE_UINT32, 16, 161, SL_MAX_VERSION),
SLEG_END()
};
uint index = PersistentStorage::GetNumItems();
uint index = 0;
PersistentStorage *ps;
FOR_ALL_STORAGES(ps) {
if (ps->grfid != CITYMANIA_GRFID)
index = max(index, ps->index + 1);
}
int n_chunks = data.size() / 64;
for (int i = 0; i < n_chunks; i++, ptr += 64) {