Save/load: Add extra cheats savegame chunk

This commit is contained in:
Jonathan G Rennison
2020-04-18 10:51:02 +01:00
parent 17f25690eb
commit 3e7618f519
6 changed files with 130 additions and 1 deletions

View File

@@ -10,15 +10,23 @@
#include "stdafx.h"
#include "cheat_type.h"
#include <map>
#include <string>
#include "safeguards.h"
/** All the cheats. */
Cheats _cheats;
ExtraCheats _extra_cheats;
std::map<std::string, Cheat> _unknown_cheats;
/** Reinitialise all the cheats. */
void InitializeCheats()
{
memset(&_cheats, 0, sizeof(Cheats));
memset(&_extra_cheats, 0, sizeof(ExtraCheats));
_unknown_cheats.clear();
}
/**
@@ -35,5 +43,12 @@ bool CheatHasBeenUsed()
if (cht->been_used) return true;
}
cht = (Cheat*)&_extra_cheats;
cht_last = &cht[sizeof(_extra_cheats) / sizeof(Cheat)];
for (; cht != cht_last; cht++) {
if (cht->been_used) return true;
}
return false;
}