Skip to content

Commit

Permalink
Move game-relevant registry key paths to igame.h
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Nov 8, 2017
1 parent 75edce8 commit e566853
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 21 deletions.
15 changes: 9 additions & 6 deletions include/igame.h
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
#ifndef IGAMEMANAGER_H_
#define IGAMEMANAGER_H_
#pragma once

#include "xmlutil/Node.h"
#include "imodule.h"
#include <list>

// String identifier for the game manager module
const std::string MODULE_GAMEMANAGER("GameManager");
const char* const MODULE_GAMEMANAGER("GameManager");

const char* const RKEY_GAME_TYPE = "user/game/type";
const char* const RKEY_FS_GAME = "user/game/fs_game";
const char* const RKEY_FS_GAME_BASE = "user/game/fs_game_base";
const char* const RKEY_ENGINE_PATH = "user/paths/enginePath";

namespace game
{
Expand Down Expand Up @@ -98,7 +102,8 @@ typedef std::shared_ptr<IGameManager> IGameManagerPtr;
} // namespace game

// This is the accessor for the game manager
inline game::IGameManager& GlobalGameManager() {
inline game::IGameManager& GlobalGameManager()
{
// Cache the reference locally
static game::IGameManager& _gameManager(
*std::static_pointer_cast<game::IGameManager>(
Expand All @@ -107,5 +112,3 @@ inline game::IGameManager& GlobalGameManager() {
);
return _gameManager;
}

#endif /*IGAMEMANAGER_H_*/
1 change: 0 additions & 1 deletion include/imodule.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const char* const RKEY_APP_PATH = "user/paths/appPath";
const char* const RKEY_HOME_PATH = "user/paths/homePath";
const char* const RKEY_SETTINGS_PATH = "user/paths/settingsPath";
const char* const RKEY_BITMAPS_PATH = "user/paths/bitmapsPath";
const char* const RKEY_ENGINE_PATH = "user/paths/enginePath";
const char* const RKEY_MAP_PATH = "user/paths/mapPath";
const char* const RKEY_PREFAB_PATH = "user/paths/prefabPath";

Expand Down
13 changes: 6 additions & 7 deletions radiant/settings/GameManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,12 @@

namespace game
{
namespace {
const std::string RKEY_GAME_TYPE = "user/game/type";
const std::string RKEY_FS_GAME = "user/game/fs_game";
const std::string RKEY_FS_GAME_BASE = "user/game/fs_game_base";
const char* const GKEY_PREFAB_FOLDER = "/mapFormat/prefabFolder";
const char* const GKEY_MAPS_FOLDER = "/mapFormat/mapFolder";
}

namespace
{
const char* const GKEY_PREFAB_FOLDER = "/mapFormat/prefabFolder";
const char* const GKEY_MAPS_FOLDER = "/mapFormat/mapFolder";
}

Manager::Manager() :
_enginePathInitialised(false)
Expand Down
13 changes: 12 additions & 1 deletion radiant/ui/prefdialog/GameSetupDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@ void GameSetupDialog::initialiseControls()
}
}

void GameSetupDialog::save()
{
// Save paths to the registry
// TODO
}

void GameSetupDialog::Show(const cmd::ArgumentList& args)
{
// greebo: Check if the mainframe module is already "existing". It might be
Expand All @@ -80,7 +86,12 @@ void GameSetupDialog::Show(const cmd::ArgumentList& args)

GameSetupDialog* dialog = new GameSetupDialog(parent);

dialog->ShowModal();
int result = dialog->ShowModal();

if (result == wxID_OK)
{
dialog->save();
}

dialog->Destroy();
}
Expand Down
14 changes: 14 additions & 0 deletions radiant/ui/prefdialog/GameSetupDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,18 @@ class wxChoicebook;
namespace ui
{

/**
* A dialog aimed to assist the user with setting up their
* engine/game/mod paths. Use the Show() method to run the dialog,
* after this action the current settings are stored in the XMLRegistry:
*
* Game Type: RKEY_GAME_TYPE
* Engine Path: RKEY_ENGINE_PATH
* Mod Path: RKEY_FS_GAME
* Mod Base Path: RKEY_FS_GAME_BASE
*
* Registry key paths are stored in the igame.h header
*/
class GameSetupDialog :
public wxutil::DialogBase
{
Expand All @@ -24,6 +36,8 @@ class GameSetupDialog :

private:
void initialiseControls();

void save();
};

}
7 changes: 1 addition & 6 deletions radiant/ui/prefdialog/GameSetupPageIdTech.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#include "i18n.h"
#include "imodule.h"
#include "igame.h"

#include <wx/sizer.h>
#include <wx/textctrl.h>
Expand All @@ -13,12 +14,6 @@
namespace ui
{

namespace
{
const std::string RKEY_FS_GAME = "user/game/fs_game";
const std::string RKEY_FS_GAME_BASE = "user/game/fs_game_base";
}

GameSetupPageIdTech::GameSetupPageIdTech(wxWindow* parent) :
GameSetupPage(parent)
{
Expand Down

0 comments on commit e566853

Please sign in to comment.