- merged two smaller savegame handlers into the main function.

This commit is contained in:
Christoph Oelckers 2020-11-21 23:56:56 +01:00
parent 2cb3d44384
commit 1a588c3cbf
3 changed files with 6 additions and 49 deletions

View file

@ -250,28 +250,5 @@ void levelTryPlayMusic()
}
}
class LevelsLoadSave : public LoadSave
{
virtual void Load(void);
virtual void Save(void);
};
void LevelsLoadSave::Load(void)
{
Read(&gNextLevel, sizeof(gNextLevel));
Read(&gGameOptions, sizeof(gGameOptions));
}
void LevelsLoadSave::Save(void)
{
Write(&gNextLevel, sizeof(gNextLevel));
Write(&gGameOptions, sizeof(gGameOptions));
}
void LevelsLoadSaveConstruct(void)
{
new LevelsLoadSave();
}
END_BLD_NS

View file

@ -638,6 +638,9 @@ void MyLoadSave::Load(void)
Read(skyInfo, sizeof(*skyInfo));
skyInfo->combinedtile = -1;
cheatReset();
Read(&bPlayerCheated, sizeof(bPlayerCheated));
Read(&gNextLevel, sizeof(gNextLevel));
Read(&gGameOptions, sizeof(gGameOptions));
}
@ -720,11 +723,12 @@ void MyLoadSave::Save(void)
#endif
psky_t *skyInfo = tileSetupSky(DEFAULTPSKY);
Write(skyInfo, sizeof(*skyInfo));
Write(&bPlayerCheated, sizeof(bPlayerCheated));
Write(&gNextLevel, sizeof(gNextLevel));
Write(&gGameOptions, sizeof(gGameOptions));
}
void EndGameLoadSaveConstruct(void);
void LevelsLoadSaveConstruct(void);
void MessagesLoadSaveConstruct(void);
void MirrorLoadSaveConstruct(void);
void PlayerLoadSaveConstruct(void);
void ViewLoadSaveConstruct(void);
@ -737,8 +741,6 @@ void LoadSaveSetup(void)
new MyLoadSave();
EndGameLoadSaveConstruct();
LevelsLoadSaveConstruct();
MessagesLoadSaveConstruct();
MirrorLoadSaveConstruct();
PlayerLoadSaveConstruct();
ViewLoadSaveConstruct();

View file

@ -551,28 +551,6 @@ static void cmd_Give(int player, uint8_t **stream, bool skip)
}
class MessagesLoadSave : public LoadSave
{
public:
virtual void Load();
virtual void Save();
};
void MessagesLoadSave::Load()
{
Read(&bPlayerCheated, sizeof(bPlayerCheated));
}
void MessagesLoadSave::Save()
{
Write(&bPlayerCheated, sizeof(bPlayerCheated));
}
void MessagesLoadSaveConstruct(void)
{
new MessagesLoadSave();
}
void InitCheats()
{
SetCheats(s_CheatInfo, countof(s_CheatInfo));