LAB: Fix loading of saved games
This commit is contained in:
parent
95461c9161
commit
5bc37fd878
2 changed files with 9 additions and 21 deletions
|
@ -219,7 +219,7 @@ bool loadGame(uint16 *RoomNum, uint16 *Direction, uint16 *Quarters, int slot) {
|
|||
CurTile[i][j] = file->readUint16LE();
|
||||
|
||||
// Breadcrumbs
|
||||
for (i = 0; i < sizeof(BreadCrumbs); i++) {
|
||||
for (i = 0; i < 128; i++) {
|
||||
BreadCrumbs[i].RoomNum = file->readUint16LE();
|
||||
BreadCrumbs[i].Direction = file->readUint16LE();
|
||||
}
|
||||
|
@ -227,10 +227,10 @@ bool loadGame(uint16 *RoomNum, uint16 *Direction, uint16 *Quarters, int slot) {
|
|||
DroppingCrumbs = (BreadCrumbs[0].RoomNum != 0);
|
||||
FollowingCrumbs = false;
|
||||
|
||||
for (i = 0; i < sizeof(BreadCrumbs); i++) {
|
||||
for (i = 0; i < 128; i++) {
|
||||
if (BreadCrumbs[i].RoomNum == 0)
|
||||
break;
|
||||
NumCrumbs++;
|
||||
NumCrumbs = i;
|
||||
}
|
||||
|
||||
delete file;
|
||||
|
|
|
@ -972,28 +972,16 @@ bool saveRestoreGame(void) {
|
|||
// Restore
|
||||
GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false);
|
||||
int slot = dialog->runModalWithCurrentTarget();
|
||||
if (slot >= 0)
|
||||
if (slot >= 0) {
|
||||
isOK = loadGame(&RoomNum, &Direction, &(Inventory[QUARTERNUM].Many), slot);
|
||||
if (isOK)
|
||||
g_music->resetMusic();
|
||||
}
|
||||
}
|
||||
|
||||
if (!isOK)
|
||||
return false;
|
||||
|
||||
g_music->resetMusic();
|
||||
|
||||
eatMessages();
|
||||
|
||||
mouseHide();
|
||||
memset(diffcmap, 0, 3 * 256);
|
||||
VGASetPal(diffcmap, 256);
|
||||
setAPen(0);
|
||||
rectFill(0, 0, VGAScreenWidth - 1, VGAScreenHeight - 1);
|
||||
blackScreen();
|
||||
WSDL_UpdateScreen();
|
||||
|
||||
freeAllStolenMem();
|
||||
|
||||
return true;
|
||||
|
||||
return isOK;
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue