aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWillem Jan Palenstijn2012-11-02 21:26:15 +0100
committerWillem Jan Palenstijn2012-11-02 21:26:34 +0100
commitda0490f9b296864e8826c63295e91515f8617839 (patch)
tree6b06e951731d4c0cf22aee047b4a0d1d1556abf0
parentb403a6f3ac6ba9210025fb3b6222272d54487d7e (diff)
downloadscummvm-rg350-da0490f9b296864e8826c63295e91515f8617839.tar.gz
scummvm-rg350-da0490f9b296864e8826c63295e91515f8617839.tar.bz2
scummvm-rg350-da0490f9b296864e8826c63295e91515f8617839.zip
TONY: Fix endianness issue when saving/loading inventory
-rw-r--r--engines/tony/inventory.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/engines/tony/inventory.cpp b/engines/tony/inventory.cpp
index 12540e5b7f..a1f98d88b4 100644
--- a/engines/tony/inventory.cpp
+++ b/engines/tony/inventory.cpp
@@ -677,8 +677,10 @@ int RMInventory::getSaveStateSize() {
void RMInventory::saveState(byte *state) {
WRITE_LE_UINT32(state, _nInv);
state += 4;
- Common::copy(_inv, _inv + 256, (uint32 *)state);
- state += 256 * 4;
+ for (int i = 0; i < 256; ++i) {
+ WRITE_LE_UINT32(state, _inv[i]);
+ state += 4;
+ }
int x;
for (int i = 0; i < 256; i++) {
@@ -695,8 +697,10 @@ void RMInventory::saveState(byte *state) {
int RMInventory::loadState(byte *state) {
_nInv = READ_LE_UINT32(state);
state += 4;
- Common::copy((uint32 *)state, (uint32 *)state + 256, _inv);
- state += 256 * 4;
+ for (int i = 0; i < 256; ++i) {
+ _inv[i] = READ_LE_UINT32(state);
+ state += 4;
+ }
int x;
for (int i = 0; i < 256; i++) {