Skip to content

Commit

Permalink
TONY: Fix endianness issue when saving/loading inventory
Browse files Browse the repository at this point in the history
  • Loading branch information
wjp committed Nov 2, 2012
1 parent b403a6f commit da0490f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions engines/tony/inventory.cpp
Expand Up @@ -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++) {
Expand All @@ -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++) {
Expand Down

0 comments on commit da0490f

Please sign in to comment.