Saves: Overload ptrsize as a bitfield

git-svn-id: https://svn.eduke32.com/eduke32@6740 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2018-03-08 03:55:02 +00:00
parent f4ba85b600
commit 4c48a848a3
3 changed files with 7 additions and 4 deletions

View file

@ -2214,7 +2214,7 @@ static void Menu_PreDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin)
#ifndef EDUKE32_SIMPLE_MENU
Bsprintf(tempbuf,"Saved: %d.%d.%d %d-bit", savehead.majorver, savehead.minorver,
savehead.bytever, 8*savehead.ptrsize);
savehead.bytever, 8*savehead.getPtrSize());
mgametext(origin.x + (31<<16), origin.y + (104<<16), tempbuf);
Bsprintf(tempbuf,"Our: %d.%d.%d %d-bit", SV_MAJOR_VER, SV_MINOR_VER, BYTEVERSION,
(int32_t)(8*sizeof(intptr_t)));
@ -2274,7 +2274,7 @@ static void Menu_PreDraw(MenuID_t cm, MenuEntry_t *entry, const vec2_t origin)
#ifndef EDUKE32_SIMPLE_MENU
Bsprintf(tempbuf,"Saved: %d.%d.%d %d-bit", savehead.majorver, savehead.minorver,
savehead.bytever, 8*savehead.ptrsize);
savehead.bytever, 8*savehead.getPtrSize());
mgametext(origin.x + (31<<16), origin.y + (104<<16), tempbuf);
Bsprintf(tempbuf,"Our: %d.%d.%d %d-bit", SV_MAJOR_VER, SV_MINOR_VER, BYTEVERSION,
(int32_t)(8*sizeof(intptr_t)));

View file

@ -1483,11 +1483,11 @@ int32_t sv_loadheader(int32_t fil, int32_t spot, savehead_t *h)
}
}
if (h->ptrsize != sizeof(intptr_t))
if (h->getPtrSize() != sizeof(intptr_t))
{
if (havedemo)
OSD_Printf("Demo incompatible. Expected pointer size %d, found %d\n",
(int32_t)sizeof(intptr_t), h->ptrsize);
(int32_t)sizeof(intptr_t), h->getPtrSize());
Bmemset(h->headerstr, 0, sizeof(h->headerstr));
return -4;

View file

@ -58,6 +58,9 @@ typedef struct
#ifdef __ANDROID__
char skillname[32], volname[32];
#endif
uint8_t getPtrSize() const { return ptrsize & 0x7Fu; }
bool isAutoSave() const { return !!(ptrsize & (1u<<7u)); }
} savehead_t;
#pragma pack(pop)