Reduced dependencies on base/plugins.h

svn-id: r21940
This commit is contained in:
Max Horn 2006-04-16 13:12:23 +00:00
parent 206fdf0528
commit 6c076f80d7
4 changed files with 18 additions and 24 deletions

View File

@ -1495,11 +1495,11 @@ static GameDescription gameDescriptions[] = {
}, },
}; };
DetectedGame GameDescription::toDetectedGame() { DetectedGame toDetectedGame(const GameDescription &g) {
const char *title; const char *title;
title = saga_games[gameType].description; title = saga_games[g.gameType].description;
DetectedGame dg(name, title, language, platform); DetectedGame dg(g.name, title, g.language, g.platform);
dg.updateDesc(extra); dg.updateDesc(g.extra);
return dg; return dg;
} }
@ -1593,7 +1593,7 @@ static int detectGame(const FSList *fslist, Common::Language language, Common::P
} }
} }
if (!fileMissing) { if (!fileMissing) {
debug(2, "Found game: %s", gameDescriptions[i].toDetectedGame().description.c_str()); debug(2, "Found game: %s", toDetectedGame(gameDescriptions[i]).description.c_str());
matched[matchedCount++] = i; matched[matchedCount++] = i;
} }
} }
@ -1621,13 +1621,13 @@ static int detectGame(const FSList *fslist, Common::Language language, Common::P
for (i = 0; i < matchedCount; i++) { for (i = 0; i < matchedCount; i++) {
if ((gameDescriptions[matched[i]].language != language && language != Common::UNK_LANG) || if ((gameDescriptions[matched[i]].language != language && language != Common::UNK_LANG) ||
(gameDescriptions[matched[i]].platform != platform && platform != Common::kPlatformUnknown)) { (gameDescriptions[matched[i]].platform != platform && platform != Common::kPlatformUnknown)) {
debug(2, "Purged %s", gameDescriptions[matched[i]].toDetectedGame().description.c_str()); debug(2, "Purged %s", toDetectedGame(gameDescriptions[matched[i]]).description.c_str());
matched[i] = -1; matched[i] = -1;
continue; continue;
} }
if (gameDescriptions[matched[i]].filesCount < maxcount) { if (gameDescriptions[matched[i]].filesCount < maxcount) {
debug(2, "Purged: %s", gameDescriptions[matched[i]].toDetectedGame().description.c_str()); debug(2, "Purged: %s", toDetectedGame(gameDescriptions[matched[i]]).description.c_str());
matched[i] = -1; matched[i] = -1;
} }
} }
@ -1676,7 +1676,7 @@ bool SagaEngine::initGame() {
error("SagaEngine::loadGame wrong gameNumber"); error("SagaEngine::loadGame wrong gameNumber");
} }
_gameTitle = gameDescriptions[gameNumber].toDetectedGame().description; _gameTitle = toDetectedGame(gameDescriptions[gameNumber]).description;
debug(2, "Running %s", _gameTitle.c_str()); debug(2, "Running %s", _gameTitle.c_str());
_gameNumber = gameNumber; _gameNumber = gameNumber;
@ -1698,7 +1698,7 @@ DetectedGameList GAME_detectGames(const FSList &fslist) {
count = detectGame(&fslist, Common::UNK_LANG, Common::kPlatformUnknown, matches); count = detectGame(&fslist, Common::UNK_LANG, Common::kPlatformUnknown, matches);
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
detectedGames.push_back(gameDescriptions[matches[i]].toDetectedGame()); detectedGames.push_back(toDetectedGame(gameDescriptions[matches[i]]));
free(matches); free(matches);
return detectedGames; return detectedGames;
} }

View File

@ -28,7 +28,6 @@
#include "base/engine.h" #include "base/engine.h"
#include "common/stream.h" #include "common/stream.h"
#include "base/plugins.h"
#include "saga/gfx.h" #include "saga/gfx.h"
#include "saga/list.h" #include "saga/list.h"
@ -517,8 +516,6 @@ struct GameDescription {
uint32 features; uint32 features;
Common::Language language; Common::Language language;
Common::Platform platform; Common::Platform platform;
DetectedGame toDetectedGame();
}; };
struct SaveFileData { struct SaveFileData {

View File

@ -1240,11 +1240,11 @@ static GameDescription gameDescriptions[] = {
}, },
}; };
DetectedGame GameDescription::toDetectedGame() { DetectedGame toDetectedGame(const GameDescription &g) {
const char *title; const char *title;
title = simonGames[gameType].description; title = simonGames[g.gameType].description;
DetectedGame dg(name, title, language, platform); DetectedGame dg(g.name, title, g.language, g.platform);
dg.updateDesc(extra); dg.updateDesc(g.extra);
return dg; return dg;
} }
@ -1339,7 +1339,7 @@ static int detectGame(const FSList *fslist, Common::Language language, Common::P
} }
} }
if (!fileMissing) { if (!fileMissing) {
debug(2, "Found game: %s", gameDescriptions[i].toDetectedGame().description.c_str()); debug(2, "Found game: %s", toDetectedGame(gameDescriptions[i]).description.c_str());
matched[matchedCount++] = i; matched[matchedCount++] = i;
} }
} }
@ -1366,13 +1366,13 @@ static int detectGame(const FSList *fslist, Common::Language language, Common::P
for (i = 0; i < matchedCount; i++) { for (i = 0; i < matchedCount; i++) {
if ((gameDescriptions[matched[i]].language != language && language != Common::UNK_LANG) || if ((gameDescriptions[matched[i]].language != language && language != Common::UNK_LANG) ||
(gameDescriptions[matched[i]].platform != platform && platform != Common::kPlatformUnknown)) { (gameDescriptions[matched[i]].platform != platform && platform != Common::kPlatformUnknown)) {
debug(2, "Purged %s", gameDescriptions[matched[i]].toDetectedGame().description.c_str()); debug(2, "Purged %s", toDetectedGame(gameDescriptions[matched[i]]).description.c_str());
matched[i] = -1; matched[i] = -1;
continue; continue;
} }
if (gameDescriptions[matched[i]].filesCount < maxcount) { if (gameDescriptions[matched[i]].filesCount < maxcount) {
debug(2, "Purged: %s", gameDescriptions[matched[i]].toDetectedGame().description.c_str()); debug(2, "Purged: %s", toDetectedGame(gameDescriptions[matched[i]]).description.c_str());
matched[i] = -1; matched[i] = -1;
} }
} }
@ -1420,7 +1420,7 @@ bool SimonEngine::initGame() {
error("SimonEngine::loadGame wrong gameNumber"); error("SimonEngine::loadGame wrong gameNumber");
} }
debug(2, "Running %s", gameDescriptions[gameNumber].toDetectedGame().description.c_str()); debug(2, "Running %s", toDetectedGame(gameDescriptions[gameNumber]).description.c_str());
_gameDescription = &gameDescriptions[gameNumber]; _gameDescription = &gameDescriptions[gameNumber];
@ -1434,7 +1434,7 @@ DetectedGameList GAME_detectGames(const FSList &fslist) {
count = detectGame(&fslist, Common::UNK_LANG, Common::kPlatformUnknown, matches); count = detectGame(&fslist, Common::UNK_LANG, Common::kPlatformUnknown, matches);
for (int i = 0; i < count; i++) for (int i = 0; i < count; i++)
detectedGames.push_back(gameDescriptions[matches[i]].toDetectedGame()); detectedGames.push_back(toDetectedGame(gameDescriptions[matches[i]]));
free(matches); free(matches);
return detectedGames; return detectedGames;
} }

View File

@ -26,7 +26,6 @@
#include <stdio.h> #include <stdio.h>
#include "base/engine.h" #include "base/engine.h"
#include "base/plugins.h"
#include "common/rect.h" #include "common/rect.h"
#include "common/util.h" #include "common/util.h"
@ -129,8 +128,6 @@ struct GameDescription {
uint32 features; uint32 features;
Common::Language language; Common::Language language;
Common::Platform platform; Common::Platform platform;
DetectedGame toDetectedGame();
}; };
struct GameSpecificSettings; struct GameSpecificSettings;