aboutsummaryrefslogtreecommitdiff
path: root/engines/sword25
diff options
context:
space:
mode:
authorPaul Gilbert2010-10-20 10:53:50 +0000
committerPaul Gilbert2010-10-20 10:53:50 +0000
commit66ecd08868b83d166e6e01c2e4c2b66eecdbe99a (patch)
treedd5868e84766fc5541749e2fe4163ab6b50889ce /engines/sword25
parent9d12ee212561b0f9b94c8fc76f48c73d35b5ced9 (diff)
downloadscummvm-rg350-66ecd08868b83d166e6e01c2e4c2b66eecdbe99a.tar.gz
scummvm-rg350-66ecd08868b83d166e6e01c2e4c2b66eecdbe99a.tar.bz2
scummvm-rg350-66ecd08868b83d166e6e01c2e4c2b66eecdbe99a.zip
SWORD25: Fix to correctly write game state to savegame files
svn-id: r53637
Diffstat (limited to 'engines/sword25')
-rw-r--r--engines/sword25/kernel/outputpersistenceblock.cpp7
-rw-r--r--engines/sword25/kernel/outputpersistenceblock.h1
-rw-r--r--engines/sword25/script/luascript.cpp2
3 files changed, 9 insertions, 1 deletions
diff --git a/engines/sword25/kernel/outputpersistenceblock.cpp b/engines/sword25/kernel/outputpersistenceblock.cpp
index 811ca983dc..b81f3c1bbe 100644
--- a/engines/sword25/kernel/outputpersistenceblock.cpp
+++ b/engines/sword25/kernel/outputpersistenceblock.cpp
@@ -79,6 +79,13 @@ void OutputPersistenceBlock::write(const Common::String &string) {
rawWrite(string.c_str(), string.size());
}
+void OutputPersistenceBlock::write(Common::Array<byte> &value) {
+ writeMarker(BLOCK_MARKER);
+
+ write((uint)value.size());
+ rawWrite(&value[0], value.size());
+}
+
void OutputPersistenceBlock::write(const void *bufferPtr, size_t size) {
writeMarker(BLOCK_MARKER);
diff --git a/engines/sword25/kernel/outputpersistenceblock.h b/engines/sword25/kernel/outputpersistenceblock.h
index 3ece0175af..a7b0673f6f 100644
--- a/engines/sword25/kernel/outputpersistenceblock.h
+++ b/engines/sword25/kernel/outputpersistenceblock.h
@@ -49,6 +49,7 @@ public:
void write(float value);
void write(bool value);
void write(const Common::String &string);
+ void write(Common::Array<byte> &value);
void write(const void *bufferPtr, size_t size);
const void *getData() const {
diff --git a/engines/sword25/script/luascript.cpp b/engines/sword25/script/luascript.cpp
index 4144a6a9e2..4ed4a158f9 100644
--- a/engines/sword25/script/luascript.cpp
+++ b/engines/sword25/script/luascript.cpp
@@ -423,7 +423,7 @@ bool LuaScriptEngine::persist(OutputPersistenceBlock &writer) {
pluto_persist(_state, chunkwriter, &chunkData);
// Persistenzdaten in den Writer schreiben.
- writer.write(&chunkData[0], chunkData.size());
+ writer.write(chunkData);
// Die beiden Tabellen vom Stack nehmen.
lua_pop(_state, 2);