[openjk] 51/130: Fix ICARUS data saving
Simon McVittie
smcv at debian.org
Fri Oct 28 11:09:17 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 35a97816473284f34895a668ede751ae07c3d238
Author: bibendovsky <bibendovsky at hotmail.com>
Date: Sat Jul 23 21:59:22 2016 +0300
Fix ICARUS data saving
---
code/game/g_savegame.cpp | 9 +++++++++
code/icarus/IcarusImplementation.cpp | 4 ++--
shared/qcommon/ojk_saved_game.cpp | 12 ++++--------
3 files changed, 15 insertions(+), 10 deletions(-)
diff --git a/code/game/g_savegame.cpp b/code/game/g_savegame.cpp
index 25a362c..5d6e77c 100644
--- a/code/game/g_savegame.cpp
+++ b/code/game/g_savegame.cpp
@@ -814,6 +814,15 @@ static void EvaluateFields(
pbData->sg_import(
::gi.saved_game);
+ // FIXME Add support for retail version?
+
+ if (!::gi.saved_game->is_all_data_read())
+ {
+ ::G_Error(
+ ::va("EvaluateFields(): variable-sized chunk '%s' without handler!",
+ ::SG_GetChidText(ulChid)));
+ }
+
if (pFields)
{
for (const save_field_t* pField = pFields; pField->psName; ++pField) {
diff --git a/code/icarus/IcarusImplementation.cpp b/code/icarus/IcarusImplementation.cpp
index a3cf024..a93fdc6 100644
--- a/code/icarus/IcarusImplementation.cpp
+++ b/code/icarus/IcarusImplementation.cpp
@@ -543,7 +543,7 @@ int CIcarus::Save()
//Save out a ICARUS save block header with the ICARUS version
double version = ICARUS_VERSION;
- saved_game->read_chunk<double>(
+ saved_game->write_chunk<double>(
INT_ID('I','C','A','R'),
version);
@@ -569,7 +569,7 @@ int CIcarus::Save()
}
// Write out the buffer with all our collected data.
- saved_game->read_chunk(
+ saved_game->write_chunk(
INT_ID('I','S','E','Q'),
m_byBuffer,
static_cast<int>(m_ulBufferCurPos));
diff --git a/shared/qcommon/ojk_saved_game.cpp b/shared/qcommon/ojk_saved_game.cpp
index b170dfe..9617e5f 100644
--- a/shared/qcommon/ojk_saved_game.cpp
+++ b/shared/qcommon/ojk_saved_game.cpp
@@ -120,7 +120,7 @@ bool SavedGame::create(
}
- is_writable_ = false;
+ is_writable_ = true;
int sg_version = iSAVEGAME_VERSION;
@@ -327,13 +327,9 @@ bool SavedGame::write_chunk(
static_cast<int>(sizeof(chunk_id)),
file_handle_);
- int iCompressedLength = 0;
+ int iCompressedLength = -1;
- if (::sv_compress_saved_games->integer == 0)
- {
- iCompressedLength = -1;
- }
- else
+ if (::sv_compress_saved_games->integer != 0)
{
compress(
io_buffer_,
@@ -577,7 +573,7 @@ void SavedGame::rename(
old_path.c_str(),
new_path.c_str());
- if (rename_result != 0)
+ if (rename_result == 0)
{
::Com_Printf(
S_COLOR_RED "Error during savegame-rename. Check \"%s\" for write-protect or disk full!\n",
--
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