GLK: SCOTT: Hopefully fix global constructor warning

The games list is moved to be a field of Globals, by
putting the list into a header file included directly
inside the Globals class definition
This commit is contained in:
Paul Gilbert 2022-05-29 15:34:09 -07:00
parent fae01e8c84
commit 622d27f73f
5 changed files with 2372 additions and 2350 deletions

View File

@ -378,7 +378,7 @@ GameIDType detectGame(Common::SeekableReadStream *f) {
_G(_fileLength) = f->size();
_G(_game) = new GameInfo;
_G(_game) = &_G(_fallbackGame);
Common::String md5 = g_vm->getGameMD5();
const GlkDetectionEntry *p = SCOTT_GAMES;
@ -386,7 +386,7 @@ GameIDType detectGame(Common::SeekableReadStream *f) {
while (p->_md5) {
if (md5.equalsC(p->_md5)) {
if (!scumm_stricmp(p->_extra, "")) {
CURRENT_GAME = SCOTTFREE;
_G(_fallbackGame)._gameID = SCOTTFREE;
}
if (!scumm_stricmp(p->_extra, "ZXSpectrum")) {
_G(_entireFile) = new uint8_t[_G(_fileLength)];
@ -407,10 +407,9 @@ GameIDType detectGame(Common::SeekableReadStream *f) {
if (dict_type == NOT_A_GAME)
return UNKNOWN_GAME;
for (int i = 0; i < NUMGAMES; i++) {
if (g_games[i]._dictionary == dict_type) {
if (tryLoading(g_games[i], offset, 0)) {
delete _G(_game);
_G(_game) = &g_games[i];
if (_G(_games)[i]._dictionary == dict_type) {
if (tryLoading(_G(_games)[i], offset, 0)) {
_G(_game) = &_G(_games)[i];
break;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -28,7 +28,6 @@
namespace Glk {
namespace Scott {
extern GameInfo g_games[];
extern const char *g_sysDict[];
extern const char *g_sysDictIAm[];
extern const char *g_sysDictZX[];

2363
engines/glk/scott/games.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -62,7 +62,6 @@ public:
Common::Array<Action> _actions;
Common::StringArray _sys;
Common::StringArray _systemMessages;
GameInfo *_game = nullptr;
winid_t _graphics = nullptr;
uint8_t *_entireFile = nullptr;
size_t _fileLength = 0;
@ -147,6 +146,10 @@ public:
SavedState *_oldestUndo = nullptr;
int _numberOfUndos = 0;
const GameInfo *_game;
GameInfo _fallbackGame;
// Include game list
#include "glk/scott/games.h"
public:
Globals();
~Globals();