Skip to content

Commit

Permalink
Fixed|libdoomsday: Game library information
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Sep 6, 2019
1 parent d8f88bb commit 947f4e2
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions doomsday/libs/doomsday/src/doomsdayinfo.cpp
Expand Up @@ -30,8 +30,8 @@ using namespace de;

static struct
{
char const *name;
char const *mode;
const char *name;
const char *mode;
}
const gameTable[] =
{
Expand All @@ -41,6 +41,10 @@ const gameTable[] =
{ "DOOM II", "doom2" },
{ "Final DOOM: Plutonia Experiment", "doom2-plut" },
{ "Final DOOM: TNT Evilution", "doom2-tnt" },
{ "Ultimate DOOM (BFG Editing)", "doom1-bfg" },
{ "DOOM II (BFG Edition)", "doom2-bfg" },
{ "No Rest for the Living (BFG Editing)", "doom2-nerve" },

{ "Chex Quest", "chex" },
{ "HacX", "hacx" },

Expand All @@ -52,29 +56,27 @@ const gameTable[] =
{ "Hexen v1.0", "hexen-v10" },
{ "Hexen: Death Kings of Dark Citadel", "hexen-dk" },
{ "Hexen Demo", "hexen-demo" },

{ nullptr, nullptr }
};

List<DoomsdayInfo::Game> DoomsdayInfo::allGames()
{
List<Game> games;
for (int i = 0; gameTable[i].name; ++i)
for (const auto &entry : gameTable)
{
Game game;
game.title = gameTable[i].name;
game.option = gameTable[i].mode;
game.title = entry.name;
game.option = entry.mode;
games.append(game);
}
return games;
}

String DoomsdayInfo::titleForGame(String const &mode)
String DoomsdayInfo::titleForGame(const String &mode)
{
for (int i = 0; gameTable[i].name; ++i)
for (const auto &entry : gameTable)
{
if (gameTable[i].mode == mode)
return gameTable[i].name;
if (mode == entry.mode)
return entry.name;
}
return mode;
}
Expand Down

0 comments on commit 947f4e2

Please sign in to comment.