From 87f00996afd33b2d3cbf5b202690e73d378551c3 Mon Sep 17 00:00:00 2001 From: danij Date: Wed, 5 Mar 2014 11:01:12 +0000 Subject: [PATCH] Refactor|libdeng2: Moved "saved session" components into the game namespace These are hardly 'core' components. --- .../client/include/resource/resourcesystem.h | 4 ++-- .../client/src/resource/resourcesystem.cpp | 4 ++-- doomsday/libdeng2/game.pri | 12 +++++++--- doomsday/libdeng2/include/de/SavedSession | 1 - .../include/de/SavedSessionRepository | 1 - .../libdeng2/include/de/game/SavedSession | 1 + .../include/de/game/SavedSessionRepository | 1 + .../include/de/game/igamestatereader.h | 6 ++++- .../include/de/{core => game}/savedsession.h | 4 +++- .../{core => game}/savedsessionrepository.h | 10 ++++---- doomsday/libdeng2/libdeng2.pro | 6 ----- .../src/{core => game}/savedsession.cpp | 8 +++---- .../{core => game}/savedsessionrepository.cpp | 4 +++- doomsday/plugins/common/include/g_common.h | 4 ++-- .../plugins/common/include/gamestatereader.h | 8 +++---- .../plugins/common/include/gamestatewriter.h | 2 +- doomsday/plugins/common/include/p_saveio.h | 6 ++--- doomsday/plugins/common/include/saveslots.h | 8 +++---- doomsday/plugins/common/src/g_game.cpp | 24 +++++++++---------- .../plugins/common/src/gamestatereader.cpp | 1 + .../plugins/common/src/gamestatewriter.cpp | 5 ++-- doomsday/plugins/common/src/p_saveg.cpp | 14 +++++------ doomsday/plugins/common/src/p_saveio.cpp | 4 ++-- doomsday/plugins/common/src/saveslots.cpp | 3 ++- .../doom/include/doomv9gamestatereader.h | 8 +++---- doomsday/plugins/doom/src/d_main.cpp | 4 ++-- .../doom/src/doomv9gamestatereader.cpp | 11 +++++---- .../include/hereticv13gamestatereader.h | 8 +++---- doomsday/plugins/heretic/src/h_main.cpp | 4 ++-- .../heretic/src/hereticv13gamestatereader.cpp | 10 ++++---- 30 files changed, 100 insertions(+), 86 deletions(-) delete mode 100644 doomsday/libdeng2/include/de/SavedSession delete mode 100644 doomsday/libdeng2/include/de/SavedSessionRepository create mode 100644 doomsday/libdeng2/include/de/game/SavedSession create mode 100644 doomsday/libdeng2/include/de/game/SavedSessionRepository rename doomsday/libdeng2/include/de/{core => game}/savedsession.h (98%) rename doomsday/libdeng2/include/de/{core => game}/savedsessionrepository.h (95%) rename doomsday/libdeng2/src/{core => game}/savedsession.cpp (98%) rename doomsday/libdeng2/src/{core => game}/savedsessionrepository.cpp (98%) diff --git a/doomsday/client/include/resource/resourcesystem.h b/doomsday/client/include/resource/resourcesystem.h index 57a2a0769d..efc55ac2a7 100644 --- a/doomsday/client/include/resource/resourcesystem.h +++ b/doomsday/client/include/resource/resourcesystem.h @@ -42,7 +42,7 @@ #include "resource/zip.h" #include "uri.hh" #include -#include +#include #include #include #include @@ -868,7 +868,7 @@ class ResourceSystem : public de::System /** * Returns the SavedSessionRepository. */ - de::SavedSessionRepository &savedSessionRepository() const; + de::game::SavedSessionRepository &savedSessionRepository() const; public: /// @todo Should be private: void initCompositeTextures(); diff --git a/doomsday/client/src/resource/resourcesystem.cpp b/doomsday/client/src/resource/resourcesystem.cpp index 0fc30e9a51..a395aa16c1 100644 --- a/doomsday/client/src/resource/resourcesystem.cpp +++ b/doomsday/client/src/resource/resourcesystem.cpp @@ -318,7 +318,7 @@ DENG2_PIMPL(ResourceSystem) typedef QMap SpriteGroups; SpriteGroups spriteGroups; - SavedSessionRepository saveRepo; + game::SavedSessionRepository saveRepo; Instance(Public *i) : Base(i) @@ -3810,7 +3810,7 @@ void ResourceSystem::cacheForCurrentMap() #endif // __CLIENT__ -SavedSessionRepository &ResourceSystem::savedSessionRepository() const +game::SavedSessionRepository &ResourceSystem::savedSessionRepository() const { return d->saveRepo; } diff --git a/doomsday/libdeng2/game.pri b/doomsday/libdeng2/game.pri index d7a57b7735..16afde034c 100644 --- a/doomsday/libdeng2/game.pri +++ b/doomsday/libdeng2/game.pri @@ -1,10 +1,16 @@ HEADERS += \ include/de/game/Game \ - include/de/game/IGameStateReader + include/de/game/IGameStateReader \ + include/de/game/SavedSession \ + include/de/game/SavedSessionRepository HEADERS += \ include/de/game/game.h \ - include/de/game/igamestatereader.h + include/de/game/igamestatereader.h \ + include/de/game/savedsession.h \ + include/de/game/savedsessionrepository.h SOURCES += \ - src/game/game.cpp + src/game/game.cpp \ + src/game/savedsession.cpp \ + src/game/savedsessionrepository.cpp diff --git a/doomsday/libdeng2/include/de/SavedSession b/doomsday/libdeng2/include/de/SavedSession deleted file mode 100644 index 608007f4ae..0000000000 --- a/doomsday/libdeng2/include/de/SavedSession +++ /dev/null @@ -1 +0,0 @@ -#include "core/savedsession.h" diff --git a/doomsday/libdeng2/include/de/SavedSessionRepository b/doomsday/libdeng2/include/de/SavedSessionRepository deleted file mode 100644 index b50a771773..0000000000 --- a/doomsday/libdeng2/include/de/SavedSessionRepository +++ /dev/null @@ -1 +0,0 @@ -#include "core/savedsessionrepository.h" diff --git a/doomsday/libdeng2/include/de/game/SavedSession b/doomsday/libdeng2/include/de/game/SavedSession new file mode 100644 index 0000000000..af9a700cde --- /dev/null +++ b/doomsday/libdeng2/include/de/game/SavedSession @@ -0,0 +1 @@ +#include "savedsession.h" diff --git a/doomsday/libdeng2/include/de/game/SavedSessionRepository b/doomsday/libdeng2/include/de/game/SavedSessionRepository new file mode 100644 index 0000000000..249542ebb3 --- /dev/null +++ b/doomsday/libdeng2/include/de/game/SavedSessionRepository @@ -0,0 +1 @@ +#include "savedsessionrepository.h" diff --git a/doomsday/libdeng2/include/de/game/igamestatereader.h b/doomsday/libdeng2/include/de/game/igamestatereader.h index 08a352833f..1a0e54d1c9 100644 --- a/doomsday/libdeng2/include/de/game/igamestatereader.h +++ b/doomsday/libdeng2/include/de/game/igamestatereader.h @@ -23,12 +23,15 @@ #include #include #include -#include +#include namespace de { +namespace game { /** * Interface for serialized game state (savegame) readers. + * + * @ingroup game */ class DENG2_PUBLIC IGameStateReader { @@ -55,6 +58,7 @@ class DENG2_PUBLIC IGameStateReader SavedSession::Metadata const &metadata) = 0; }; +} // namespace game } // namespace de #endif // LIBDENG2_IGAMESTATEREADER_H diff --git a/doomsday/libdeng2/include/de/core/savedsession.h b/doomsday/libdeng2/include/de/game/savedsession.h similarity index 98% rename from doomsday/libdeng2/include/de/core/savedsession.h rename to doomsday/libdeng2/include/de/game/savedsession.h index 43c628c0cc..3383142935 100644 --- a/doomsday/libdeng2/include/de/core/savedsession.h +++ b/doomsday/libdeng2/include/de/game/savedsession.h @@ -26,6 +26,7 @@ #include "../String" namespace de { +namespace game { class IGameStateReader; class SavedSessionRepository; @@ -33,7 +34,7 @@ class SavedSessionRepository; /** * Logical component representing a serialized game state on disk. * - * @ingroup core + * @ingroup game */ class DENG2_PUBLIC SavedSession { @@ -150,6 +151,7 @@ class DENG2_PUBLIC SavedSession typedef SavedSession::Metadata SessionMetadata; +} // namespace game } // namespace de #endif // LIBDENG2_SAVEDSESSION_H diff --git a/doomsday/libdeng2/include/de/core/savedsessionrepository.h b/doomsday/libdeng2/include/de/game/savedsessionrepository.h similarity index 95% rename from doomsday/libdeng2/include/de/core/savedsessionrepository.h rename to doomsday/libdeng2/include/de/game/savedsessionrepository.h index c98d7da926..df427016ea 100644 --- a/doomsday/libdeng2/include/de/core/savedsessionrepository.h +++ b/doomsday/libdeng2/include/de/game/savedsessionrepository.h @@ -23,8 +23,8 @@ #include "../Error" #include "../Folder" #include "../game/IGameStateReader" +#include "../game/SavedSession" #include "../Path" -#include "../SavedSession" #include "../String" /** @@ -35,18 +35,19 @@ * * @param metadata The read metadata is written here. */ -typedef bool (*GameStateRecognizeFunc)(de::Path const &stateFilePath, de::SessionMetadata &metadata); +typedef bool (*GameStateRecognizeFunc)(de::Path const &stateFilePath, de::game::SessionMetadata &metadata); /// Game state reader instantiator function ptr. -typedef de::IGameStateReader *(*GameStateReaderMakeFunc)(); +typedef de::game::IGameStateReader *(*GameStateReaderMakeFunc)(); namespace de { +namespace game { /** * Centralized saved session repository. The saved game state file structure is automatically * initialized when the current game changes. * - * @ingroup core + * @ingroup game */ class DENG2_PUBLIC SavedSessionRepository { @@ -130,6 +131,7 @@ class DENG2_PUBLIC SavedSessionRepository DENG2_PRIVATE(d) }; +} // namespace game } // namespace de #endif // LIBDENG2_SAVEDSESSIONREPOSITORY_H diff --git a/doomsday/libdeng2/libdeng2.pro b/doomsday/libdeng2/libdeng2.pro index e36e042193..5a52309817 100644 --- a/doomsday/libdeng2/libdeng2.pro +++ b/doomsday/libdeng2/libdeng2.pro @@ -93,8 +93,6 @@ HEADERS += \ include/de/MonospaceLogSinkFormatter \ include/de/Range \ include/de/Rectangle \ - include/de/SavedSession \ - include/de/SavedSessionRepository \ include/de/System \ include/de/TextApp \ include/de/TextStreamLogSink \ @@ -130,8 +128,6 @@ HEADERS += \ include/de/core/monospacelogsinkformatter.h \ include/de/core/range.h \ include/de/core/rectangle.h \ - include/de/core/savedsession.h \ - include/de/core/savedsessionrepository.h \ include/de/core/system.h \ include/de/core/textapp.h \ include/de/core/textstreamlogsink.h \ @@ -168,8 +164,6 @@ SOURCES += \ src/core/loop.cpp \ src/core/memorylogsink.cpp \ src/core/monospacelogsinkformatter.cpp \ - src/core/savedsession.cpp \ - src/core/savedsessionrepository.cpp \ src/core/system.cpp \ src/core/textapp.cpp \ src/core/textstreamlogsink.cpp \ diff --git a/doomsday/libdeng2/src/core/savedsession.cpp b/doomsday/libdeng2/src/game/savedsession.cpp similarity index 98% rename from doomsday/libdeng2/src/core/savedsession.cpp rename to doomsday/libdeng2/src/game/savedsession.cpp index 2bdc15d29a..bc0d444764 100644 --- a/doomsday/libdeng2/src/core/savedsession.cpp +++ b/doomsday/libdeng2/src/game/savedsession.cpp @@ -17,19 +17,18 @@ * 02110-1301 USA */ -#include "de/Savedsession" +#include "de/game/Savedsession" #include "de/App" #include "de/game/Game" +#include "de/game/SavedSessionRepository" #include "de/ArrayValue" #include "de/Log" #include "de/NumberValue" #include "de/NativePath" -#include "de/SavedSessionRepository" namespace de { - -using namespace internal; +namespace game { DENG2_PIMPL(SavedSession) { @@ -270,4 +269,5 @@ std::auto_ptr SavedSession::gameStateReader() return p; } +} // namespace game } // namespace de diff --git a/doomsday/libdeng2/src/core/savedsessionrepository.cpp b/doomsday/libdeng2/src/game/savedsessionrepository.cpp similarity index 98% rename from doomsday/libdeng2/src/core/savedsessionrepository.cpp rename to doomsday/libdeng2/src/game/savedsessionrepository.cpp index 7f7ed8e94c..bbc4ac35bd 100644 --- a/doomsday/libdeng2/src/core/savedsessionrepository.cpp +++ b/doomsday/libdeng2/src/game/savedsessionrepository.cpp @@ -17,7 +17,7 @@ * 02110-1301 USA */ -#include "de/SavedSessionRepository" +#include "de/game/SavedSessionRepository" #include "de/App" #include "de/game/Game" @@ -29,6 +29,7 @@ #include namespace de { +namespace game { DENG2_PIMPL(SavedSessionRepository) , DENG2_OBSERVES(App, GameUnload) @@ -198,4 +199,5 @@ IGameStateReader *SavedSessionRepository::recognizeAndMakeReader(SavedSession &s return 0; // Unrecognized } +} // namespace game } // namespace de diff --git a/doomsday/plugins/common/include/g_common.h b/doomsday/plugins/common/include/g_common.h index 8dcce87f5a..eb78de5d8e 100644 --- a/doomsday/plugins/common/include/g_common.h +++ b/doomsday/plugins/common/include/g_common.h @@ -239,7 +239,7 @@ bool G_LoadSession(de::String slotId); /** * @return New SessionMetadata (record). Ownership is given to the caller. */ -de::SessionMetadata *G_CurrentSessionMetadata(); +de::game::SessionMetadata *G_CurrentSessionMetadata(); /** * Returns the game's SaveSlots. @@ -249,7 +249,7 @@ SaveSlots &G_SaveSlots(); /** * Returns the game's (i.e., the app's) SavedSessionRepository. */ -de::SavedSessionRepository &G_SavedSessionRepository(); +de::game::SavedSessionRepository &G_SavedSessionRepository(); /** * Parse @a str and determine whether it references a logical game-save slot. diff --git a/doomsday/plugins/common/include/gamestatereader.h b/doomsday/plugins/common/include/gamestatereader.h index b40b3efaf7..c2181f4ce6 100644 --- a/doomsday/plugins/common/include/gamestatereader.h +++ b/doomsday/plugins/common/include/gamestatereader.h @@ -28,17 +28,17 @@ * @ingroup libcommon * @see GameStateWriter */ -class GameStateReader : public de::IGameStateReader +class GameStateReader : public de::game::IGameStateReader { public: GameStateReader(); ~GameStateReader(); - static de::IGameStateReader *make(); - static bool recognize(de::Path const &stateFilePath, de::SessionMetadata &metadata); + static de::game::IGameStateReader *make(); + static bool recognize(de::Path const &stateFilePath, de::game::SessionMetadata &metadata); void read(de::Path const &stateFilePath, de::Path const &mapStateFilePath, - de::SessionMetadata const &metadata); + de::game::SessionMetadata const &metadata); private: DENG2_PRIVATE(d) diff --git a/doomsday/plugins/common/include/gamestatewriter.h b/doomsday/plugins/common/include/gamestatewriter.h index 6d93145c5e..14016db195 100644 --- a/doomsday/plugins/common/include/gamestatewriter.h +++ b/doomsday/plugins/common/include/gamestatewriter.h @@ -41,7 +41,7 @@ class GameStateWriter GameStateWriter(); void write(de::Path const &stateFilePath, de::Path const &mapStateFilePath, - de::SessionMetadata const &metadata); + de::game::SessionMetadata const &metadata); private: DENG2_PRIVATE(d) diff --git a/doomsday/plugins/common/include/p_saveio.h b/doomsday/plugins/common/include/p_saveio.h index 1b8aed72d6..1dcb801e4b 100644 --- a/doomsday/plugins/common/include/p_saveio.h +++ b/doomsday/plugins/common/include/p_saveio.h @@ -21,8 +21,8 @@ #ifndef LIBCOMMON_SAVESTATE_INPUT_OUTPUT_H #define LIBCOMMON_SAVESTATE_INPUT_OUTPUT_H +#include #include -#include #include #include #include "lzss.h" @@ -89,8 +89,8 @@ void SV_BeginSegment(int segmentId); void SV_EndSegment(); -void SV_WriteSessionMetadata(de::SessionMetadata const &metadata, Writer *writer); -void SV_ReadSessionMetadata(de::SessionMetadata &metadata, Reader *reader); +void SV_WriteSessionMetadata(de::game::SessionMetadata const &metadata, Writer *writer); +void SV_ReadSessionMetadata(de::game::SessionMetadata &metadata, Reader *reader); void SV_WriteConsistencyBytes(); diff --git a/doomsday/plugins/common/include/saveslots.h b/doomsday/plugins/common/include/saveslots.h index 4261f2ffd5..6639a02603 100644 --- a/doomsday/plugins/common/include/saveslots.h +++ b/doomsday/plugins/common/include/saveslots.h @@ -23,8 +23,8 @@ #include "common.h" #include +#include #include -#include #include /** @@ -77,7 +77,7 @@ class SaveSlots /** * Convenient method of looking up the deserialized session metadata for the logical save slot. */ - de::SessionMetadata const &saveMetadata() const; + de::game::SessionMetadata const &saveMetadata() const; /** * Returns the saved session game state file path (in the repository). @@ -98,7 +98,7 @@ class SaveSlots /** * Returns the saved session for the logical save slot. */ - de::SavedSession &savedSession() const; + de::game::SavedSession &savedSession() const; /** * Deletes all saved session state files associated for the logical save slot. @@ -110,7 +110,7 @@ class SaveSlots * * @param newSession New SavedSession to replace with. Ownership is given. */ - void replaceSavedSession(de::SavedSession *newSession); + void replaceSavedSession(de::game::SavedSession *newSession); private: DENG2_PRIVATE(d) diff --git a/doomsday/plugins/common/src/g_game.cpp b/doomsday/plugins/common/src/g_game.cpp index f5eea56f85..58b9f15ad1 100644 --- a/doomsday/plugins/common/src/g_game.cpp +++ b/doomsday/plugins/common/src/g_game.cpp @@ -62,9 +62,9 @@ #include #include +#include #include #include -#include #include #include #include @@ -483,7 +483,7 @@ static void initSaveSlots() DENG2_ASSERT(sslots.slotCount() == 0); // Declare the native game state reader. - de::SavedSessionRepository &saveRepo = G_SavedSessionRepository(); + de::game::SavedSessionRepository &saveRepo = G_SavedSessionRepository(); saveRepo.declareReader(&GameStateReader::recognize, &GameStateReader::make); // Setup the logical save slot bindings. @@ -979,9 +979,9 @@ SaveSlots &G_SaveSlots() return sslots; } -de::SavedSessionRepository &G_SavedSessionRepository() +de::game::SavedSessionRepository &G_SavedSessionRepository() { - return *static_cast(DD_SavedSessionRepository()); + return *static_cast(DD_SavedSessionRepository()); } de::String G_SaveSlotIdFromUserInput(de::String str) @@ -2231,7 +2231,7 @@ void G_DoReborn(int plrNum) else { // Compose the confirmation message. - de::SessionMetadata const &saveMetadata = G_SaveSlots()[chosenSlot].saveMetadata(); + de::game::SessionMetadata const &saveMetadata = G_SaveSlots()[chosenSlot].saveMetadata(); AutoStr *msg = Str_Appendf(AutoStr_NewStd(), REBORNLOAD_CONFIRM, saveMetadata["userDescription"].value().asText().toUtf8().constData()); S_LocalSound(SFX_REBORNLOAD_CONFIRM, NULL); Hu_MsgStart(MSG_YESNO, Str_Text(msg), rebornLoadConfirmResponse, 0, new de::String(chosenSlot)); @@ -2939,11 +2939,11 @@ static int saveGameStateWorker(void *context) } } - de::SavedSessionRepository &saveRepo = G_SavedSessionRepository(); + de::game::SavedSessionRepository &saveRepo = G_SavedSessionRepository(); SaveSlot &sslot = G_SaveSlots()[logicalSlot]; - de::SavedSession *session = new de::SavedSession(sslot.fileName()); - de::SessionMetadata *metadata = G_CurrentSessionMetadata(); + de::game::SavedSession *session = new de::game::SavedSession(sslot.fileName()); + de::game::SessionMetadata *metadata = G_CurrentSessionMetadata(); metadata->set("userDescription", userDescription); session->replaceMetadata(metadata); session->setRepository(&saveRepo); @@ -3248,7 +3248,7 @@ void G_DoLoadSession(de::String slotId) try { - de::SavedSessionRepository &saveRepo = G_SavedSessionRepository(); + de::game::SavedSessionRepository &saveRepo = G_SavedSessionRepository(); saveRepo.folder().verifyWriteAccess(); #if __JHEXEN__ @@ -3358,9 +3358,9 @@ AutoStr *G_GenerateUserSaveDescription() return str; } -de::SessionMetadata *G_CurrentSessionMetadata() +de::game::SessionMetadata *G_CurrentSessionMetadata() { - de::SessionMetadata *metadata = new de::SessionMetadata; + de::game::SessionMetadata *metadata = new de::game::SessionMetadata; metadata->set("magic", int(IS_NETWORK_CLIENT? MY_CLIENT_SAVE_MAGIC : MY_SAVE_MAGIC)); metadata->set("version", MY_SAVE_VERSION); @@ -3390,7 +3390,7 @@ de::SessionMetadata *G_CurrentSessionMetadata() void G_ReadLegacySessionMetadata(void *metadata_, Reader *reader) { DENG2_ASSERT(metadata_ != 0); - de::SessionMetadata &metadata = *static_cast(metadata_); + de::game::SessionMetadata &metadata = *static_cast(metadata_); #if __JHEXEN__ // Read the magic byte to determine the high-level format. diff --git a/doomsday/plugins/common/src/gamestatereader.cpp b/doomsday/plugins/common/src/gamestatereader.cpp index 99b2cd6d50..48ee2823f6 100644 --- a/doomsday/plugins/common/src/gamestatereader.cpp +++ b/doomsday/plugins/common/src/gamestatereader.cpp @@ -36,6 +36,7 @@ #include using namespace de; +using namespace de::game; DENG2_PIMPL(GameStateReader) { diff --git a/doomsday/plugins/common/src/gamestatewriter.cpp b/doomsday/plugins/common/src/gamestatewriter.cpp index 37479267bd..21ff63f503 100644 --- a/doomsday/plugins/common/src/gamestatewriter.cpp +++ b/doomsday/plugins/common/src/gamestatewriter.cpp @@ -31,6 +31,7 @@ #include using namespace de; +using namespace de::game; DENG2_PIMPL(GameStateWriter) { @@ -70,7 +71,7 @@ DENG2_PIMPL(GameStateWriter) #endif } - void writeSessionHeader(de::SessionMetadata const &metadata) + void writeSessionHeader(SessionMetadata const &metadata) { SV_WriteSessionMetadata(metadata, writer); } @@ -121,7 +122,7 @@ GameStateWriter::GameStateWriter() : d(new Instance(this)) {} void GameStateWriter::write(Path const &stateFilePath, Path const &mapStateFilePath, - de::SessionMetadata const &metadata) + SessionMetadata const &metadata) { // In networked games the server tells the clients to save their games. #if !__JHEXEN__ diff --git a/doomsday/plugins/common/src/p_saveg.cpp b/doomsday/plugins/common/src/p_saveg.cpp index ff054ea3ac..49d58c32a4 100644 --- a/doomsday/plugins/common/src/p_saveg.cpp +++ b/doomsday/plugins/common/src/p_saveg.cpp @@ -31,8 +31,8 @@ #include "mapstatewriter.h" #include "saveslots.h" #include +#include #include -#include #include #include #include @@ -785,12 +785,12 @@ void SV_SaveGameClient(uint sessionId) if(!IS_CLIENT || !mo) return; - de::SavedSessionRepository &saveRepo = G_SavedSessionRepository(); + de::game::SavedSessionRepository &saveRepo = G_SavedSessionRepository(); saveRepo.folder().verifyWriteAccess(); // Prepare new saved game session session. - de::SavedSession *session = new de::SavedSession(saveNameForClientSessionId(sessionId)); - de::SessionMetadata *metadata = G_CurrentSessionMetadata(); + de::game::SavedSession *session = new de::game::SavedSession(saveNameForClientSessionId(sessionId)); + de::game::SessionMetadata *metadata = G_CurrentSessionMetadata(); metadata->set("sessionId", sessionId); session->replaceMetadata(metadata); session->setRepository(&saveRepo); @@ -847,12 +847,12 @@ void SV_LoadGameClient(uint sessionId) if(!IS_CLIENT || !mo) return; - de::SavedSessionRepository &saveRepo = G_SavedSessionRepository(); + de::game::SavedSessionRepository &saveRepo = G_SavedSessionRepository(); Reader *reader = SV_NewReader(); - de::SavedSession *session = new de::SavedSession(saveNameForClientSessionId(sessionId)); - de::SessionMetadata *metadata = new de::SessionMetadata; + de::game::SavedSession *session = new de::game::SavedSession(saveNameForClientSessionId(sessionId)); + de::game::SessionMetadata *metadata = new de::game::SessionMetadata; G_ReadLegacySessionMetadata(metadata, reader); metadata->set("sessionId", sessionId); session->replaceMetadata(metadata); diff --git a/doomsday/plugins/common/src/p_saveio.cpp b/doomsday/plugins/common/src/p_saveio.cpp index 42cb39ec76..41d512d3e0 100644 --- a/doomsday/plugins/common/src/p_saveio.cpp +++ b/doomsday/plugins/common/src/p_saveio.cpp @@ -257,7 +257,7 @@ void SV_EndSegment() SV_BeginSegment(ASEG_END); } -void SV_WriteSessionMetadata(de::SessionMetadata const &metadata, Writer *writer) +void SV_WriteSessionMetadata(de::game::SessionMetadata const &metadata, Writer *writer) { DENG2_ASSERT(writer != 0); @@ -293,7 +293,7 @@ void SV_WriteSessionMetadata(de::SessionMetadata const &metadata, Writer *writer Writer_WriteInt32(writer, metadata["sessionId"].value().asNumber()); } -void SV_ReadSessionMetadata(de::SessionMetadata &metadata, Reader *reader) +void SV_ReadSessionMetadata(de::game::SessionMetadata &metadata, Reader *reader) { G_ReadLegacySessionMetadata(&metadata, reader); } diff --git a/doomsday/plugins/common/src/saveslots.cpp b/doomsday/plugins/common/src/saveslots.cpp index 56980f2f46..c22e0e646d 100644 --- a/doomsday/plugins/common/src/saveslots.cpp +++ b/doomsday/plugins/common/src/saveslots.cpp @@ -24,9 +24,9 @@ #include "g_common.h" #include "hu_menu.h" #include "p_saveio.h" +#include #include #include -#include #include #define MAX_HUB_MAPS 99 @@ -35,6 +35,7 @@ static int cvarLastSlot = -1; ///< @c -1= Not yet loaded/saved in this game ses static int cvarQuickSlot = -1; ///< @c -1= Not yet chosen/determined. using namespace de; +using namespace de::game; DENG2_PIMPL(SaveSlots::Slot) , DENG2_OBSERVES(SavedSession, StatusChange) diff --git a/doomsday/plugins/doom/include/doomv9gamestatereader.h b/doomsday/plugins/doom/include/doomv9gamestatereader.h index 55b95fe139..a1b5453bc8 100644 --- a/doomsday/plugins/doom/include/doomv9gamestatereader.h +++ b/doomsday/plugins/doom/include/doomv9gamestatereader.h @@ -33,17 +33,17 @@ * * @ingroup libdoom */ -class DoomV9GameStateReader : public de::IGameStateReader +class DoomV9GameStateReader : public de::game::IGameStateReader { public: DoomV9GameStateReader(); ~DoomV9GameStateReader(); - static de::IGameStateReader *make(); - static bool recognize(de::Path const &stateFilePath, de::SessionMetadata &metadata); + static de::game::IGameStateReader *make(); + static bool recognize(de::Path const &stateFilePath, de::game::SessionMetadata &metadata); void read(de::Path const &stateFilePath, de::Path const &mapStateFilePath, - de::SessionMetadata const &metadata); + de::game::SessionMetadata const &metadata); private: DENG2_PRIVATE(d) diff --git a/doomsday/plugins/doom/src/d_main.cpp b/doomsday/plugins/doom/src/d_main.cpp index 3ac33dbf84..cbd260ccc6 100644 --- a/doomsday/plugins/doom/src/d_main.cpp +++ b/doomsday/plugins/doom/src/d_main.cpp @@ -30,7 +30,7 @@ #include "am_map.h" #include "g_defs.h" #include "saveslots.h" -#include +#include int verbose; @@ -382,7 +382,7 @@ void D_PreInit() G_CommonPreInit(); // Declare the Doom V9 game state reader/interpreter. - de::SavedSessionRepository &saveRepo = G_SavedSessionRepository(); + de::game::SavedSessionRepository &saveRepo = G_SavedSessionRepository(); saveRepo.declareReader(&DoomV9GameStateReader::recognize, &DoomV9GameStateReader::make); G_InitSpecialFilter(); diff --git a/doomsday/plugins/doom/src/doomv9gamestatereader.cpp b/doomsday/plugins/doom/src/doomv9gamestatereader.cpp index 96ad88f893..f0bd822d3c 100644 --- a/doomsday/plugins/doom/src/doomv9gamestatereader.cpp +++ b/doomsday/plugins/doom/src/doomv9gamestatereader.cpp @@ -621,7 +621,7 @@ static void readLegacyGameRules(GameRuleset &rules, Reader *reader) } } -static void SaveInfo_Read_Dm_v19(de::SessionMetadata &metadata, Reader *reader) +static void SaveInfo_Read_Dm_v19(de::game::SessionMetadata &metadata, Reader *reader) { char descBuf[24]; Reader_Read(reader, descBuf, 24); @@ -708,7 +708,7 @@ DENG2_PIMPL(DoomV9GameStateReader) { // Read the header again. /// @todo seek straight to the game state. - SaveInfo_Read_Dm_v19(de::SessionMetadata(), reader); + SaveInfo_Read_Dm_v19(de::game::SessionMetadata(), reader); } void readPlayers() @@ -938,7 +938,8 @@ DoomV9GameStateReader::DoomV9GameStateReader() : d(new Instance(this)) DoomV9GameStateReader::~DoomV9GameStateReader() {} -bool DoomV9GameStateReader::recognize(de::Path const &stateFilePath, de::SessionMetadata &metadata) // static +bool DoomV9GameStateReader::recognize(de::Path const &stateFilePath, + de::game::SessionMetadata &metadata) // static { if(!SV_ExistingFile(stateFilePath)) return false; if(!SV_OpenFile_Dm_v19(stateFilePath)) return false; @@ -963,13 +964,13 @@ bool DoomV9GameStateReader::recognize(de::Path const &stateFilePath, de::Session return result; } -de::IGameStateReader *DoomV9GameStateReader::make() +de::game::IGameStateReader *DoomV9GameStateReader::make() { return new DoomV9GameStateReader; } void DoomV9GameStateReader::read(de::Path const &stateFilePath, de::Path const & /*mapStateFilePath*/, - de::SessionMetadata const &metadata) + de::game::SessionMetadata const &metadata) { if(!SV_OpenFile_Dm_v19(stateFilePath)) { diff --git a/doomsday/plugins/heretic/include/hereticv13gamestatereader.h b/doomsday/plugins/heretic/include/hereticv13gamestatereader.h index 3702aa758a..a6eb4419ad 100644 --- a/doomsday/plugins/heretic/include/hereticv13gamestatereader.h +++ b/doomsday/plugins/heretic/include/hereticv13gamestatereader.h @@ -33,17 +33,17 @@ * * @ingroup libheretic */ -class HereticV13GameStateReader : public de::IGameStateReader +class HereticV13GameStateReader : public de::game::IGameStateReader { public: HereticV13GameStateReader(); ~HereticV13GameStateReader(); - static de::IGameStateReader *make(); - static bool recognize(de::Path const &stateFilePath, de::SessionMetadata &metadata); + static de::game::IGameStateReader *make(); + static bool recognize(de::Path const &stateFilePath, de::game::SessionMetadata &metadata); void read(de::Path const &stateFilePath, de::Path const &mapStateFilePath, - de::SessionMetadata const &metadata); + de::game::SessionMetadata const &metadata); private: DENG2_PRIVATE(d) diff --git a/doomsday/plugins/heretic/src/h_main.cpp b/doomsday/plugins/heretic/src/h_main.cpp index 0ebba03169..47bb517ff2 100644 --- a/doomsday/plugins/heretic/src/h_main.cpp +++ b/doomsday/plugins/heretic/src/h_main.cpp @@ -31,7 +31,7 @@ #include "g_defs.h" #include "p_inventory.h" #include "saveslots.h" -#include +#include #include int verbose; @@ -319,7 +319,7 @@ void H_PreInit() G_CommonPreInit(); // Declare the Heretic V13 game state reader/interpreter. - de::SavedSessionRepository &saveRepo = G_SavedSessionRepository(); + de::game::SavedSessionRepository &saveRepo = G_SavedSessionRepository(); saveRepo.declareReader(&HereticV13GameStateReader::recognize, &HereticV13GameStateReader::make); } diff --git a/doomsday/plugins/heretic/src/hereticv13gamestatereader.cpp b/doomsday/plugins/heretic/src/hereticv13gamestatereader.cpp index 390d9affd4..27b902ef39 100644 --- a/doomsday/plugins/heretic/src/hereticv13gamestatereader.cpp +++ b/doomsday/plugins/heretic/src/hereticv13gamestatereader.cpp @@ -642,7 +642,7 @@ static void readLegacyGameRules(GameRuleset &rules, Reader *reader) } } -static void SaveInfo_Read_Hr_v13(de::SessionMetadata &metadata, Reader *reader) +static void SaveInfo_Read_Hr_v13(de::game::SessionMetadata &metadata, Reader *reader) { char descBuf[24]; Reader_Read(reader, descBuf, 24); @@ -729,7 +729,7 @@ DENG2_PIMPL(HereticV13GameStateReader) { // Read the header again. /// @todo seek straight to the game state. - SaveInfo_Read_Hr_v13(de::SessionMetadata(), reader); + SaveInfo_Read_Hr_v13(de::game::SessionMetadata(), reader); } void readPlayers() @@ -952,7 +952,7 @@ HereticV13GameStateReader::~HereticV13GameStateReader() {} bool HereticV13GameStateReader::recognize(de::Path const &stateFilePath, - de::SessionMetadata &metadata) // static + de::game::SessionMetadata &metadata) // static { if(!SV_ExistingFile(stateFilePath)) return false; if(!SV_OpenFile_Hr_v13(stateFilePath)) return false; @@ -977,13 +977,13 @@ bool HereticV13GameStateReader::recognize(de::Path const &stateFilePath, return result; } -de::IGameStateReader *HereticV13GameStateReader::make() +de::game::IGameStateReader *HereticV13GameStateReader::make() { return new HereticV13GameStateReader; } void HereticV13GameStateReader::read(de::Path const &stateFilePath, de::Path const & /*mapStateFilePath*/, - de::SessionMetadata const &metadata) + de::game::SessionMetadata const &metadata) { if(!SV_OpenFile_Hr_v13(stateFilePath)) {