(svn r25620) -Fix (r25342): Save/load of story books were broken
This commit is contained in:
@@ -2818,6 +2818,7 @@ bool AfterLoadGame()
|
||||
AfterLoadRoadStops();
|
||||
AfterLoadLabelMaps();
|
||||
AfterLoadCompanyStats();
|
||||
AfterLoadStoryBook();
|
||||
|
||||
GamelogPrintDebug(1);
|
||||
|
||||
|
@@ -250,8 +250,9 @@
|
||||
* 182 25296
|
||||
* 183 25363
|
||||
* 184 25508
|
||||
* 185 25620
|
||||
*/
|
||||
extern const uint16 SAVEGAME_VERSION = 184; ///< Current savegame version of OpenTTD.
|
||||
extern const uint16 SAVEGAME_VERSION = 185; ///< Current savegame version of OpenTTD.
|
||||
|
||||
SavegameType _savegame_type; ///< type of savegame we are loading
|
||||
|
||||
|
@@ -31,6 +31,7 @@ void FixupTrainLengths();
|
||||
void AfterLoadStations();
|
||||
void AfterLoadRoadStops();
|
||||
void AfterLoadLabelMaps();
|
||||
void AfterLoadStoryBook();
|
||||
void AfterLoadLinkGraphs();
|
||||
void AfterLoadCompanyStats();
|
||||
void UpdateHousesAndTowns();
|
||||
|
@@ -14,10 +14,24 @@
|
||||
|
||||
#include "saveload.h"
|
||||
|
||||
/** Called after load to trash broken pages. */
|
||||
void AfterLoadStoryBook()
|
||||
{
|
||||
if (IsSavegameVersionBefore(185)) {
|
||||
/* Trash all story pages and page elements because
|
||||
* they were saved with wrong data types.
|
||||
*/
|
||||
_story_page_element_pool.CleanPool();
|
||||
_story_page_pool.CleanPool();
|
||||
}
|
||||
}
|
||||
|
||||
static const SaveLoad _story_page_elements_desc[] = {
|
||||
SLE_VAR(StoryPageElement, sort_value, SLE_UINT16),
|
||||
SLE_CONDVAR(StoryPageElement, sort_value, SLE_FILE_U16 | SLE_VAR_U32, 0, 184),
|
||||
SLE_CONDVAR(StoryPageElement, sort_value, SLE_UINT32, 185, SL_MAX_VERSION),
|
||||
SLE_VAR(StoryPageElement, page, SLE_UINT16),
|
||||
SLE_VAR(StoryPageElement, type, SLE_UINT16),
|
||||
SLE_CONDVAR(StoryPageElement, type, SLE_FILE_U16 | SLE_VAR_U8, 0, 184),
|
||||
SLE_CONDVAR(StoryPageElement, type, SLE_UINT8, 185, SL_MAX_VERSION),
|
||||
SLE_VAR(StoryPageElement, referenced_id, SLE_UINT32),
|
||||
SLE_STR(StoryPageElement, text, SLE_STR | SLF_ALLOW_CONTROL, 0),
|
||||
SLE_END()
|
||||
@@ -50,9 +64,11 @@ static void Load_STORY_PAGE_ELEMENT()
|
||||
}
|
||||
|
||||
static const SaveLoad _story_pages_desc[] = {
|
||||
SLE_VAR(StoryPage, sort_value, SLE_UINT16),
|
||||
SLE_CONDVAR(StoryPage, sort_value, SLE_FILE_U16 | SLE_VAR_U32, 0, 184),
|
||||
SLE_CONDVAR(StoryPage, sort_value, SLE_UINT32, 185, SL_MAX_VERSION),
|
||||
SLE_VAR(StoryPage, date, SLE_UINT32),
|
||||
SLE_VAR(StoryPage, company, SLE_UINT16),
|
||||
SLE_CONDVAR(StoryPage, company, SLE_FILE_U16 | SLE_VAR_U8, 0, 184),
|
||||
SLE_CONDVAR(StoryPage, company, SLE_UINT8, 185, SL_MAX_VERSION),
|
||||
SLE_STR(StoryPage, title, SLE_STR | SLF_ALLOW_CONTROL, 0),
|
||||
SLE_END()
|
||||
};
|
||||
|
Reference in New Issue
Block a user