Fix bug #1759850 - ELVIRA2: Restart state file causes crash. The itemStore data needed to be adjusting, when loading or saving in the AtariST and Amiga versions.

svn-id: r29534
This commit is contained in:
Travis Howell 2007-11-17 10:27:31 +00:00
parent 2e3866b6f4
commit f10f40aff0

View File

@ -1261,7 +1261,10 @@ bool AGOSEngine_Elvira2::loadGame(const char *filename, bool restartMode) {
// read the items in item store
for (i = 0; i != _numItemStore; i++) {
if (getGameType() == GType_ELVIRA2 && getPlatform() == Common::kPlatformPC) {
if ((getGameType() == GType_ELVIRA2 || getGameType() == GType_WW) &&
(getPlatform() == Common::kPlatformAmiga || getPlatform() == Common::kPlatformAtariST)) {
_itemStore[i] = derefItem(f->readUint16BE() / 18);
} else if (getGameType() == GType_ELVIRA2 && getPlatform() == Common::kPlatformPC) {
_itemStore[i] = derefItem(readItemID(f));
} else {
_itemStore[i] = derefItem(f->readUint16BE());
@ -1405,7 +1408,10 @@ bool AGOSEngine_Elvira2::saveGame(uint slot, const char *caption) {
// write the items in item store
for (i = 0; i != _numItemStore; i++) {
if (getGameType() == GType_ELVIRA2 && getPlatform() == Common::kPlatformPC) {
if ((getGameType() == GType_ELVIRA2 || getGameType() == GType_WW) &&
(getPlatform() == Common::kPlatformAmiga || getPlatform() == Common::kPlatformAtariST)) {
f->writeUint16BE(itemPtrToID(_itemStore[i]) * 18);
} else if (getGameType() == GType_ELVIRA2 && getPlatform() == Common::kPlatformPC) {
writeItemID(f, itemPtrToID(_itemStore[i]));
} else {
f->writeUint16BE(itemPtrToID(_itemStore[i]));