[openjk] 40/130: Add method to control preview mode
Simon McVittie
smcv at debian.org
Fri Oct 28 11:09:16 UTC 2016
This is an automated email from the git hooks/post-receive script.
smcv pushed a commit to branch debian/master
in repository openjk.
commit 43bcc08059151ff0b88cf342e4954cc1a072789a
Author: bibendovsky <bibendovsky at hotmail.com>
Date: Sat Jul 16 17:09:13 2016 +0300
Add method to control preview mode
---
code/server/sv_savegame.cpp | 21 ++++++++++++++++-----
shared/qcommon/ojk_saved_game.cpp | 6 ++++++
shared/qcommon/ojk_saved_game.h | 3 +++
3 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/code/server/sv_savegame.cpp b/code/server/sv_savegame.cpp
index 79b44d1..76dfdba 100644
--- a/code/server/sv_savegame.cpp
+++ b/code/server/sv_savegame.cpp
@@ -50,7 +50,11 @@ fileHandle_t fhSaveGame = 0;
#endif
SavedGameJustLoaded_e eSavedGameJustLoaded = eNO;
+
+#if 0
qboolean qbSGReadIsTestOnly = qfalse; // this MUST be left in this state
+#endif
+
char sLastSaveFileLoaded[MAX_QPATH]={0};
#define iSG_MAPCMD_SIZE MAX_QPATH
@@ -91,6 +95,7 @@ typedef map<unsigned int, CChid> CChidInfo_t;
CChidInfo_t save_info;
#endif
+#if 0
const char *SG_GetChidText(unsigned int chid)
{
static union { char c[5]; int i; } chidtext;
@@ -99,7 +104,7 @@ const char *SG_GetChidText(unsigned int chid)
return chidtext.c;
}
-
+#endif
static const char *GetString_FailedToOpenSaveGame(const char *psFilename, qboolean bOpen)
{
@@ -117,6 +122,7 @@ static const char *GetString_FailedToOpenSaveGame(const char *psFilename, qboole
return sTemp;
}
+#if 0
// (copes with up to 8 ptr returns at once)
//
static const char *SG_AddSavePath( const char *psPathlessBaseName )
@@ -142,6 +148,7 @@ static const char *SG_AddSavePath( const char *psPathlessBaseName )
Com_sprintf( sSaveName[i], MAX_OSPATH, "saves/%s.sav", psPathlessBaseName );
return sSaveName[i];
}
+#endif
void SG_WipeSavegame(
const char* psPathlessBaseName)
@@ -309,6 +316,7 @@ qboolean SG_Open( const char *psPathlessBaseName )
}
#endif
+#if 0
// you should only call this when you know you've successfully opened a savegame, and you want to query for
// whether it's an old (street-copy) version, or a new (expansion-pack) version
//
@@ -316,6 +324,7 @@ int SG_Version(void)
{
return giSaveGameVersion;
}
+#endif
void SV_WipeGame_f(void)
{
@@ -929,14 +938,17 @@ int SG_GetSaveGameComment(const char *psPathlessBaseName, char *sComment, char *
size_t iScreenShotLength;
#endif
- qbSGReadIsTestOnly = qtrue; // do NOT leave this in this state
-
auto saved_game = &ojk::SavedGame::get_instance();
+ saved_game->set_preview_mode(
+ true);
+
if (!saved_game->open(
psPathlessBaseName))
{
- qbSGReadIsTestOnly = qfalse;
+ saved_game->set_preview_mode(
+ false);
+
return 0;
}
@@ -973,7 +985,6 @@ int SG_GetSaveGameComment(const char *psPathlessBaseName, char *sComment, char *
#endif
}
}
- qbSGReadIsTestOnly = qfalse;
saved_game->close();
diff --git a/shared/qcommon/ojk_saved_game.cpp b/shared/qcommon/ojk_saved_game.cpp
index 328cc5b..3ab447d 100644
--- a/shared/qcommon/ojk_saved_game.cpp
+++ b/shared/qcommon/ojk_saved_game.cpp
@@ -504,6 +504,12 @@ bool SavedGame::is_write_failed() const
return is_write_failed_;
}
+void SavedGame::set_preview_mode(
+ bool value)
+{
+ is_preview_mode_ = value;
+}
+
const SavedGame::Buffer& SavedGame::get_buffer() const
{
return io_buffer_;
diff --git a/shared/qcommon/ojk_saved_game.h b/shared/qcommon/ojk_saved_game.h
index d975411..7511a2b 100644
--- a/shared/qcommon/ojk_saved_game.h
+++ b/shared/qcommon/ojk_saved_game.h
@@ -88,6 +88,9 @@ public:
bool is_write_failed() const;
+ void set_preview_mode(
+ bool value);
+
// Returns an I/O buffer.
const Buffer& get_buffer() const override;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/openjk.git
More information about the Pkg-games-commits
mailing list