aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/base/scriptables
diff options
context:
space:
mode:
Diffstat (limited to 'engines/wintermute/base/scriptables')
-rw-r--r--engines/wintermute/base/scriptables/dcscript.h4
-rw-r--r--engines/wintermute/base/scriptables/script.cpp41
-rw-r--r--engines/wintermute/base/scriptables/script.h4
-rw-r--r--engines/wintermute/base/scriptables/script_engine.cpp4
-rw-r--r--engines/wintermute/base/scriptables/script_engine.h4
-rw-r--r--engines/wintermute/base/scriptables/script_ext_array.cpp6
-rw-r--r--engines/wintermute/base/scriptables/script_ext_array.h4
-rw-r--r--engines/wintermute/base/scriptables/script_ext_date.cpp18
-rw-r--r--engines/wintermute/base/scriptables/script_ext_date.h4
-rw-r--r--engines/wintermute/base/scriptables/script_ext_file.cpp16
-rw-r--r--engines/wintermute/base/scriptables/script_ext_file.h4
-rw-r--r--engines/wintermute/base/scriptables/script_ext_math.cpp4
-rw-r--r--engines/wintermute/base/scriptables/script_ext_math.h4
-rw-r--r--engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp6
-rw-r--r--engines/wintermute/base/scriptables/script_ext_mem_buffer.h4
-rw-r--r--engines/wintermute/base/scriptables/script_ext_object.cpp4
-rw-r--r--engines/wintermute/base/scriptables/script_ext_object.h4
-rw-r--r--engines/wintermute/base/scriptables/script_ext_string.cpp26
-rw-r--r--engines/wintermute/base/scriptables/script_ext_string.h4
-rw-r--r--engines/wintermute/base/scriptables/script_stack.cpp6
-rw-r--r--engines/wintermute/base/scriptables/script_stack.h4
-rw-r--r--engines/wintermute/base/scriptables/script_value.cpp26
-rw-r--r--engines/wintermute/base/scriptables/script_value.h4
23 files changed, 100 insertions, 105 deletions
diff --git a/engines/wintermute/base/scriptables/dcscript.h b/engines/wintermute/base/scriptables/dcscript.h
index d6bb3cd176..8047baaa68 100644
--- a/engines/wintermute/base/scriptables/dcscript.h
+++ b/engines/wintermute/base/scriptables/dcscript.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/wintermute/base/scriptables/script.cpp b/engines/wintermute/base/scriptables/script.cpp
index 5aeff78c50..44fd117e61 100644
--- a/engines/wintermute/base/scriptables/script.cpp
+++ b/engines/wintermute/base/scriptables/script.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -488,7 +488,8 @@ double ScScript::getFloat() {
SWAP(buffer[3], buffer[4]);
#endif
- double ret = *(double *)(buffer);
+ double ret;
+ memcpy(&ret, buffer, sizeof(double));
_iP += 8; // Hardcode the double-size used originally.
return ret;
}
@@ -1249,15 +1250,15 @@ bool ScScript::persist(BasePersistenceManager *persistMgr) {
// buffer
if (persistMgr->getIsSaving()) {
if (_state != SCRIPT_PERSISTENT && _state != SCRIPT_FINISHED && _state != SCRIPT_THREAD_FINISHED) {
- persistMgr->transfer(TMEMBER(_bufferSize));
+ persistMgr->transferUint32(TMEMBER(_bufferSize));
persistMgr->putBytes(_buffer, _bufferSize);
} else {
// don't save idle/finished scripts
int32 bufferSize = 0;
- persistMgr->transfer(TMEMBER(bufferSize));
+ persistMgr->transferSint32(TMEMBER(bufferSize));
}
} else {
- persistMgr->transfer(TMEMBER(_bufferSize));
+ persistMgr->transferUint32(TMEMBER(_bufferSize));
if (_bufferSize > 0) {
_buffer = new byte[_bufferSize];
persistMgr->getBytes(_buffer, _bufferSize);
@@ -1270,31 +1271,31 @@ bool ScScript::persist(BasePersistenceManager *persistMgr) {
}
persistMgr->transferPtr(TMEMBER_PTR(_callStack));
- persistMgr->transfer(TMEMBER(_currentLine));
+ persistMgr->transferSint32(TMEMBER(_currentLine));
persistMgr->transferPtr(TMEMBER_PTR(_engine));
- persistMgr->transfer(TMEMBER(_filename));
- persistMgr->transfer(TMEMBER(_freezable));
+ persistMgr->transferCharPtr(TMEMBER(_filename));
+ persistMgr->transferBool(TMEMBER(_freezable));
persistMgr->transferPtr(TMEMBER_PTR(_globals));
- persistMgr->transfer(TMEMBER(_iP));
+ persistMgr->transferUint32(TMEMBER(_iP));
persistMgr->transferPtr(TMEMBER_PTR(_scopeStack));
persistMgr->transferPtr(TMEMBER_PTR(_stack));
- persistMgr->transfer(TMEMBER_INT(_state));
+ persistMgr->transferSint32(TMEMBER_INT(_state));
persistMgr->transferPtr(TMEMBER_PTR(_operand));
- persistMgr->transfer(TMEMBER_INT(_origState));
+ persistMgr->transferSint32(TMEMBER_INT(_origState));
persistMgr->transferPtr(TMEMBER_PTR(_owner));
persistMgr->transferPtr(TMEMBER_PTR(_reg1));
- persistMgr->transfer(TMEMBER(_thread));
- persistMgr->transfer(TMEMBER(_threadEvent));
+ persistMgr->transferBool(TMEMBER(_thread));
+ persistMgr->transferCharPtr(TMEMBER(_threadEvent));
persistMgr->transferPtr(TMEMBER_PTR(_thisStack));
- persistMgr->transfer(TMEMBER(_timeSlice));
+ persistMgr->transferUint32(TMEMBER(_timeSlice));
persistMgr->transferPtr(TMEMBER_PTR(_waitObject));
persistMgr->transferPtr(TMEMBER_PTR(_waitScript));
- persistMgr->transfer(TMEMBER(_waitTime));
- persistMgr->transfer(TMEMBER(_waitFrozen));
+ persistMgr->transferUint32(TMEMBER(_waitTime));
+ persistMgr->transferBool(TMEMBER(_waitFrozen));
- persistMgr->transfer(TMEMBER(_methodThread));
- persistMgr->transfer(TMEMBER(_methodThread));
- persistMgr->transfer(TMEMBER(_unbreakable));
+ persistMgr->transferBool(TMEMBER(_methodThread));
+ persistMgr->transferBool(TMEMBER(_methodThread)); // TODO-SAVE: Deduplicate.
+ persistMgr->transferBool(TMEMBER(_unbreakable));
persistMgr->transferPtr(TMEMBER_PTR(_parentScript));
if (!persistMgr->getIsSaving()) {
diff --git a/engines/wintermute/base/scriptables/script.h b/engines/wintermute/base/scriptables/script.h
index 488ff63606..1edeae5b55 100644
--- a/engines/wintermute/base/scriptables/script.h
+++ b/engines/wintermute/base/scriptables/script.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/wintermute/base/scriptables/script_engine.cpp b/engines/wintermute/base/scriptables/script_engine.cpp
index bb819b23e4..cdf55a304c 100644
--- a/engines/wintermute/base/scriptables/script_engine.cpp
+++ b/engines/wintermute/base/scriptables/script_engine.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/wintermute/base/scriptables/script_engine.h b/engines/wintermute/base/scriptables/script_engine.h
index 622b3c4b94..bdb139e1f8 100644
--- a/engines/wintermute/base/scriptables/script_engine.h
+++ b/engines/wintermute/base/scriptables/script_engine.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/wintermute/base/scriptables/script_ext_array.cpp b/engines/wintermute/base/scriptables/script_ext_array.cpp
index 7f1c769ec5..7431029cbf 100644
--- a/engines/wintermute/base/scriptables/script_ext_array.cpp
+++ b/engines/wintermute/base/scriptables/script_ext_array.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -214,7 +214,7 @@ bool SXArray::scSetProperty(const char *name, ScValue *value) {
bool SXArray::persist(BasePersistenceManager *persistMgr) {
BaseScriptable::persist(persistMgr);
- persistMgr->transfer(TMEMBER(_length));
+ persistMgr->transferSint32(TMEMBER(_length));
persistMgr->transferPtr(TMEMBER_PTR(_values));
return STATUS_OK;
diff --git a/engines/wintermute/base/scriptables/script_ext_array.h b/engines/wintermute/base/scriptables/script_ext_array.h
index e6381a011e..2daa58a241 100644
--- a/engines/wintermute/base/scriptables/script_ext_array.h
+++ b/engines/wintermute/base/scriptables/script_ext_array.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/wintermute/base/scriptables/script_ext_date.cpp b/engines/wintermute/base/scriptables/script_ext_date.cpp
index d88bfc5851..89cdcde0af 100644
--- a/engines/wintermute/base/scriptables/script_ext_date.cpp
+++ b/engines/wintermute/base/scriptables/script_ext_date.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -243,15 +243,15 @@ bool SXDate::persist(BasePersistenceManager *persistMgr) {
int32 hour = _tm.tm_hour;
int32 min = _tm.tm_min;
int32 sec = _tm.tm_sec;
- persistMgr->transfer(TMEMBER(year));
- persistMgr->transfer(TMEMBER(mon));
- persistMgr->transfer(TMEMBER(mday));
- persistMgr->transfer(TMEMBER(hour));
- persistMgr->transfer(TMEMBER(min));
- persistMgr->transfer(TMEMBER(sec));
+ persistMgr->transferSint32(TMEMBER(year));
+ persistMgr->transferSint32(TMEMBER(mon));
+ persistMgr->transferSint32(TMEMBER(mday));
+ persistMgr->transferSint32(TMEMBER(hour));
+ persistMgr->transferSint32(TMEMBER(min));
+ persistMgr->transferSint32(TMEMBER(sec));
if (persistMgr->checkVersion(1, 2, 1)) {
int32 wday = _tm.tm_wday;
- persistMgr->transfer(TMEMBER(wday));
+ persistMgr->transferSint32(TMEMBER(wday));
_tm.tm_wday = wday;
}
_tm.tm_year = year;
diff --git a/engines/wintermute/base/scriptables/script_ext_date.h b/engines/wintermute/base/scriptables/script_ext_date.h
index 0ccf093a7b..46a23a36fa 100644
--- a/engines/wintermute/base/scriptables/script_ext_date.h
+++ b/engines/wintermute/base/scriptables/script_ext_date.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/wintermute/base/scriptables/script_ext_file.cpp b/engines/wintermute/base/scriptables/script_ext_file.cpp
index 18f7b8213a..15ddd4bcca 100644
--- a/engines/wintermute/base/scriptables/script_ext_file.cpp
+++ b/engines/wintermute/base/scriptables/script_ext_file.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -443,7 +443,7 @@ bool SXFile::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack,
return STATUS_OK;
}
float val;
- (*(uint32 *)&val) = _readFile->readUint32LE();
+ WRITE_UINT32(&val, _readFile->readUint32LE());
if (!_readFile->err()) {
stack->pushFloat(val);
} else {
@@ -766,16 +766,16 @@ bool SXFile::persist(BasePersistenceManager *persistMgr) {
BaseScriptable::persist(persistMgr);
- persistMgr->transfer(TMEMBER(_filename));
- persistMgr->transfer(TMEMBER(_mode));
- persistMgr->transfer(TMEMBER(_textMode));
+ persistMgr->transferCharPtr(TMEMBER(_filename));
+ persistMgr->transferSint32(TMEMBER(_mode));
+ persistMgr->transferBool(TMEMBER(_textMode));
uint32 pos = 0;
if (persistMgr->getIsSaving()) {
pos = getPos();
- persistMgr->transfer(TMEMBER(pos));
+ persistMgr->transferUint32(TMEMBER(pos));
} else {
- persistMgr->transfer(TMEMBER(pos));
+ persistMgr->transferUint32(TMEMBER(pos));
// try to re-open file if needed
_writeFile = nullptr;
diff --git a/engines/wintermute/base/scriptables/script_ext_file.h b/engines/wintermute/base/scriptables/script_ext_file.h
index a1298929f2..4994ef9c97 100644
--- a/engines/wintermute/base/scriptables/script_ext_file.h
+++ b/engines/wintermute/base/scriptables/script_ext_file.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/wintermute/base/scriptables/script_ext_math.cpp b/engines/wintermute/base/scriptables/script_ext_math.cpp
index ec53b983e7..4d770d4c51 100644
--- a/engines/wintermute/base/scriptables/script_ext_math.cpp
+++ b/engines/wintermute/base/scriptables/script_ext_math.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/wintermute/base/scriptables/script_ext_math.h b/engines/wintermute/base/scriptables/script_ext_math.h
index 1aa274a96f..5354e52f1e 100644
--- a/engines/wintermute/base/scriptables/script_ext_math.h
+++ b/engines/wintermute/base/scriptables/script_ext_math.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp b/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp
index 6a47c09136..276d1fb211 100644
--- a/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp
+++ b/engines/wintermute/base/scriptables/script_ext_mem_buffer.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -498,7 +498,7 @@ bool SXMemBuffer::persist(BasePersistenceManager *persistMgr) {
BaseScriptable::persist(persistMgr);
- persistMgr->transfer(TMEMBER(_size));
+ persistMgr->transferSint32(TMEMBER(_size));
if (persistMgr->getIsSaving()) {
if (_size > 0) {
diff --git a/engines/wintermute/base/scriptables/script_ext_mem_buffer.h b/engines/wintermute/base/scriptables/script_ext_mem_buffer.h
index 4aad8b6484..740ff1d23f 100644
--- a/engines/wintermute/base/scriptables/script_ext_mem_buffer.h
+++ b/engines/wintermute/base/scriptables/script_ext_mem_buffer.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/wintermute/base/scriptables/script_ext_object.cpp b/engines/wintermute/base/scriptables/script_ext_object.cpp
index a72b244f0a..cf1b788ede 100644
--- a/engines/wintermute/base/scriptables/script_ext_object.cpp
+++ b/engines/wintermute/base/scriptables/script_ext_object.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/wintermute/base/scriptables/script_ext_object.h b/engines/wintermute/base/scriptables/script_ext_object.h
index 566111292a..04878be85e 100644
--- a/engines/wintermute/base/scriptables/script_ext_object.h
+++ b/engines/wintermute/base/scriptables/script_ext_object.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/wintermute/base/scriptables/script_ext_string.cpp b/engines/wintermute/base/scriptables/script_ext_string.cpp
index 2f2422cdf9..bc0c658c57 100644
--- a/engines/wintermute/base/scriptables/script_ext_string.cpp
+++ b/engines/wintermute/base/scriptables/script_ext_string.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -298,21 +298,15 @@ bool SXString::scCallMethod(ScScript *script, ScStack *stack, ScStack *thisStack
uint32 start = 0;
for(uint32 i = 0; i < str.size() + 1; i++) {
- char ch = str.c_str()[i];
- if(ch=='\0' || delims.contains(ch))
- {
- char *part = new char[i - start + 1];
- if(i != start) {
- Common::strlcpy(part, str.c_str() + start, i - start + 1);
- part[i - start] = '\0';
+ // The [] operator doesn't allow access to the zero code terminator
+ // (bug #6531)
+ uint32 ch = (i == str.size()) ? '\0' : str[i];
+ if (ch =='\0' || delims.contains(ch)) {
+ if (i != start) {
+ parts.push_back(WideString(str.c_str() + start, i - start + 1));
} else {
- part[0] = '\0';
+ parts.push_back(WideString());
}
- val = new ScValue(_gameRef, part);
- array->push(val);
- delete[] part;
- delete val;
- val = nullptr;
start = i + 1;
}
}
@@ -406,7 +400,7 @@ bool SXString::persist(BasePersistenceManager *persistMgr) {
BaseScriptable::persist(persistMgr);
- persistMgr->transfer(TMEMBER(_capacity));
+ persistMgr->transferSint32(TMEMBER(_capacity));
if (persistMgr->getIsSaving()) {
if (_capacity > 0) {
diff --git a/engines/wintermute/base/scriptables/script_ext_string.h b/engines/wintermute/base/scriptables/script_ext_string.h
index 7a95c59b4c..b28f2b24c1 100644
--- a/engines/wintermute/base/scriptables/script_ext_string.h
+++ b/engines/wintermute/base/scriptables/script_ext_string.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/wintermute/base/scriptables/script_stack.cpp b/engines/wintermute/base/scriptables/script_stack.cpp
index 801ac6ab52..fe765bfb68 100644
--- a/engines/wintermute/base/scriptables/script_stack.cpp
+++ b/engines/wintermute/base/scriptables/script_stack.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -186,7 +186,7 @@ bool ScStack::persist(BasePersistenceManager *persistMgr) {
persistMgr->transferPtr(TMEMBER_PTR(_gameRef));
- persistMgr->transfer(TMEMBER(_sP));
+ persistMgr->transferSint32(TMEMBER(_sP));
_values.persist(persistMgr);
return STATUS_OK;
diff --git a/engines/wintermute/base/scriptables/script_stack.h b/engines/wintermute/base/scriptables/script_stack.h
index ee04485a51..fe7afae3f9 100644
--- a/engines/wintermute/base/scriptables/script_stack.h
+++ b/engines/wintermute/base/scriptables/script_stack.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
diff --git a/engines/wintermute/base/scriptables/script_value.cpp b/engines/wintermute/base/scriptables/script_value.cpp
index 31ec457df1..4b84574257 100644
--- a/engines/wintermute/base/scriptables/script_value.cpp
+++ b/engines/wintermute/base/scriptables/script_value.cpp
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
@@ -791,32 +791,32 @@ void ScValue::setValue(ScValue *val) {
bool ScValue::persist(BasePersistenceManager *persistMgr) {
persistMgr->transferPtr(TMEMBER_PTR(_gameRef));
- persistMgr->transfer(TMEMBER(_persistent));
- persistMgr->transfer(TMEMBER(_isConstVar));
- persistMgr->transfer(TMEMBER_INT(_type));
- persistMgr->transfer(TMEMBER(_valBool));
- persistMgr->transfer(TMEMBER(_valFloat));
- persistMgr->transfer(TMEMBER(_valInt));
+ persistMgr->transferBool(TMEMBER(_persistent));
+ persistMgr->transferBool(TMEMBER(_isConstVar));
+ persistMgr->transferSint32(TMEMBER_INT(_type));
+ persistMgr->transferBool(TMEMBER(_valBool));
+ persistMgr->transferDouble(TMEMBER(_valFloat));
+ persistMgr->transferSint32(TMEMBER(_valInt));
persistMgr->transferPtr(TMEMBER_PTR(_valNative));
int32 size;
const char *str;
if (persistMgr->getIsSaving()) {
size = _valObject.size();
- persistMgr->transfer("", &size);
+ persistMgr->transferSint32("", &size);
_valIter = _valObject.begin();
while (_valIter != _valObject.end()) {
str = _valIter->_key.c_str();
- persistMgr->transfer("", &str);
+ persistMgr->transferConstChar("", &str);
persistMgr->transferPtr("", &_valIter->_value);
_valIter++;
}
} else {
ScValue *val = nullptr;
- persistMgr->transfer("", &size);
+ persistMgr->transferSint32("", &size);
for (int i = 0; i < size; i++) {
- persistMgr->transfer("", &str);
+ persistMgr->transferConstChar("", &str);
persistMgr->transferPtr("", &val);
_valObject[str] = val;
@@ -825,7 +825,7 @@ bool ScValue::persist(BasePersistenceManager *persistMgr) {
}
persistMgr->transferPtr(TMEMBER_PTR(_valRef));
- persistMgr->transfer(TMEMBER(_valString));
+ persistMgr->transferCharPtr(TMEMBER(_valString));
if (!persistMgr->getIsSaving() && !persistMgr->checkVersion(1,2,2)) {
// Savegames prior to 1.2.2 stored empty strings as NULL.
diff --git a/engines/wintermute/base/scriptables/script_value.h b/engines/wintermute/base/scriptables/script_value.h
index 90ad9f182a..6130553645 100644
--- a/engines/wintermute/base/scriptables/script_value.h
+++ b/engines/wintermute/base/scriptables/script_value.h
@@ -8,12 +8,12 @@
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
-
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
-
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.