@@ -251,49 +251,49 @@ static void Save_TOWN()
{
Town *t;
FOR_ALL_TOWNS(t) {
SlSetArrayIndex(t->index);
SlAutolength((AutolengthProc*)RealSave_Town, t);
}
static void Load_TOWN()
int index;
while ((index = SlIterateArray()) != -1) {
Town *t = new (index) Town();
SlObject(t, _town_desc);
for (CargoID i = 0; i < NUM_CARGO; i++) {
SlObject(&t->supplied[i], _town_supplied_desc);
for (int i = TE_BEGIN; i < TE_END; i++) {
SlObject(&t->received[i], _town_received_desc);
if (t->townnamegrfid == 0 && !IsInsideMM(t->townnametype, SPECSTR_TOWNNAME_START, SPECSTR_TOWNNAME_LAST)) {
if (t->townnamegrfid == 0 && !IsInsideMM(t->townnametype, SPECSTR_TOWNNAME_START, SPECSTR_TOWNNAME_LAST + 1)) {
SlErrorCorrupt("Invalid town name generator");
if (IsSavegameVersionBefore(166)) continue;
SlObject(&t->cargo_accepted, GetTileMatrixDesc());
if (t->cargo_accepted.area.w != 0) {
uint arr_len = t->cargo_accepted.area.w / AcceptanceMatrix::GRID * t->cargo_accepted.area.h / AcceptanceMatrix::GRID;
t->cargo_accepted.data = MallocT<uint32>(arr_len);
SlArray(t->cargo_accepted.data, arr_len, SLE_UINT32);
/* Rebuild total cargo acceptance. */
UpdateTownCargoTotal(t);
/** Fix pointers when loading town data. */
static void Ptrs_TOWN()
/* Don't run when savegame version lower than 161. */
if (IsSavegameVersionBefore(161)) return;
Status change: