summaryrefslogtreecommitdiff
path: root/src/saveload
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2013-12-23 18:09:29 +0000
committerfrosch <frosch@openttd.org>2013-12-23 18:09:29 +0000
commit49852e3dac0e59377b440a23c514608e714846f2 (patch)
treeba094a330655085516bd75bd560973ae29cd64b3 /src/saveload
parenteca86d1baf5f374d25dcc9bf0ff2bad328bdffab (diff)
downloadopenttd-49852e3dac0e59377b440a23c514608e714846f2.tar.xz
(svn r26175) -Add: Log in desync output when persistent storage is discarded.
Diffstat (limited to 'src/saveload')
-rw-r--r--src/saveload/afterload.cpp23
-rw-r--r--src/saveload/industry_sl.cpp2
-rw-r--r--src/saveload/station_sl.cpp2
-rw-r--r--src/saveload/storage_sl.cpp2
4 files changed, 26 insertions, 3 deletions
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index 82c13e3f6..ab34a0c07 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -254,6 +254,29 @@ static void InitializeWindowsAndCaches()
Object::IncTypeCount(o->type);
}
+ /* Identify owners of persistent storage arrays */
+ Industry *i;
+ FOR_ALL_INDUSTRIES(i) {
+ if (i->psa != NULL) {
+ i->psa->feature = GSF_INDUSTRIES;
+ i->psa->tile = i->location.tile;
+ }
+ }
+ Station *s;
+ FOR_ALL_STATIONS(s) {
+ if (s->airport.psa != NULL) {
+ s->airport.psa->feature = GSF_AIRPORTS;
+ s->airport.psa->tile = s->airport.tile;
+ }
+ }
+ Town *t;
+ FOR_ALL_TOWNS(t) {
+ for (std::list<PersistentStorage *>::iterator it = t->psa_list.begin(); it != t->psa_list.end(); ++it) {
+ (*it)->feature = GSF_FAKE_TOWNS;
+ (*it)->tile = t->xy;
+ }
+ }
+
RecomputePrices();
GroupStatistics::UpdateAfterLoad();
diff --git a/src/saveload/industry_sl.cpp b/src/saveload/industry_sl.cpp
index 8943a5d52..469548f23 100644
--- a/src/saveload/industry_sl.cpp
+++ b/src/saveload/industry_sl.cpp
@@ -98,7 +98,7 @@ static void Load_INDY()
if (IsSavegameVersionBefore(161) && !IsSavegameVersionBefore(76)) {
/* Store the old persistent storage. The GRFID will be added later. */
assert(PersistentStorage::CanAllocateItem());
- i->psa = new PersistentStorage(0);
+ i->psa = new PersistentStorage(0, 0, 0);
memcpy(i->psa->storage, _old_ind_persistent_storage.storage, sizeof(i->psa->storage));
}
Industry::IncIndustryTypeCount(i->type);
diff --git a/src/saveload/station_sl.cpp b/src/saveload/station_sl.cpp
index 7da2d3bad..71e3b31ec 100644
--- a/src/saveload/station_sl.cpp
+++ b/src/saveload/station_sl.cpp
@@ -527,7 +527,7 @@ static void Load_STNN()
if (IsSavegameVersionBefore(161) && !IsSavegameVersionBefore(145) && st->facilities & FACIL_AIRPORT) {
/* Store the old persistent storage. The GRFID will be added later. */
assert(PersistentStorage::CanAllocateItem());
- st->airport.psa = new PersistentStorage(0);
+ st->airport.psa = new PersistentStorage(0, 0, 0);
memcpy(st->airport.psa->storage, _old_st_persistent_storage.storage, sizeof(st->airport.psa->storage));
}
diff --git a/src/saveload/storage_sl.cpp b/src/saveload/storage_sl.cpp
index 1fa8d2404..9fb1c8672 100644
--- a/src/saveload/storage_sl.cpp
+++ b/src/saveload/storage_sl.cpp
@@ -27,7 +27,7 @@ static void Load_PSAC()
while ((index = SlIterateArray()) != -1) {
assert(PersistentStorage::CanAllocateItem());
- PersistentStorage *ps = new (index) PersistentStorage(0);
+ PersistentStorage *ps = new (index) PersistentStorage(0, 0, 0);
SlObject(ps, _storage_desc);
}
}