Codechange: Convert saveload numbers to enum values.

(This was mostly achieved with a few in-place regexes)
This commit is contained in:
Peter Nelson
2019-01-26 01:48:40 +00:00
committed by PeterN
parent ea4ea62816
commit 9de12521ec
37 changed files with 1265 additions and 1213 deletions

View File

@@ -19,7 +19,7 @@
/** Called after load to trash broken pages. */
void AfterLoadStoryBook()
{
if (IsSavegameVersionBefore(185)) {
if (IsSavegameVersionBefore(SLV_185)) {
/* Trash all story pages and page elements because
* they were saved with wrong data types.
*/
@@ -29,11 +29,11 @@ void AfterLoadStoryBook()
}
static const SaveLoad _story_page_elements_desc[] = {
SLE_CONDVAR(StoryPageElement, sort_value, SLE_FILE_U16 | SLE_VAR_U32, 0, 185),
SLE_CONDVAR(StoryPageElement, sort_value, SLE_UINT32, 185, SL_MAX_VERSION),
SLE_CONDVAR(StoryPageElement, sort_value, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_185),
SLE_CONDVAR(StoryPageElement, sort_value, SLE_UINT32, SLV_185, SL_MAX_VERSION),
SLE_VAR(StoryPageElement, page, SLE_UINT16),
SLE_CONDVAR(StoryPageElement, type, SLE_FILE_U16 | SLE_VAR_U8, 0, 185),
SLE_CONDVAR(StoryPageElement, type, SLE_UINT8, 185, SL_MAX_VERSION),
SLE_CONDVAR(StoryPageElement, type, SLE_FILE_U16 | SLE_VAR_U8, SL_MIN_VERSION, SLV_185),
SLE_CONDVAR(StoryPageElement, type, SLE_UINT8, SLV_185, SL_MAX_VERSION),
SLE_VAR(StoryPageElement, referenced_id, SLE_UINT32),
SLE_STR(StoryPageElement, text, SLE_STR | SLF_ALLOW_CONTROL, 0),
SLE_END()
@@ -66,11 +66,11 @@ static void Load_STORY_PAGE_ELEMENT()
}
static const SaveLoad _story_pages_desc[] = {
SLE_CONDVAR(StoryPage, sort_value, SLE_FILE_U16 | SLE_VAR_U32, 0, 185),
SLE_CONDVAR(StoryPage, sort_value, SLE_UINT32, 185, SL_MAX_VERSION),
SLE_CONDVAR(StoryPage, sort_value, SLE_FILE_U16 | SLE_VAR_U32, SL_MIN_VERSION, SLV_185),
SLE_CONDVAR(StoryPage, sort_value, SLE_UINT32, SLV_185, SL_MAX_VERSION),
SLE_VAR(StoryPage, date, SLE_UINT32),
SLE_CONDVAR(StoryPage, company, SLE_FILE_U16 | SLE_VAR_U8, 0, 185),
SLE_CONDVAR(StoryPage, company, SLE_UINT8, 185, SL_MAX_VERSION),
SLE_CONDVAR(StoryPage, company, SLE_FILE_U16 | SLE_VAR_U8, SL_MIN_VERSION, SLV_185),
SLE_CONDVAR(StoryPage, company, SLE_UINT8, SLV_185, SL_MAX_VERSION),
SLE_STR(StoryPage, title, SLE_STR | SLF_ALLOW_CONTROL, 0),
SLE_END()
};