Browse Source

Fix crash when creating rando files and autosave is enabled (#1550)

pull/1451/head
Josh Bodner 4 months ago committed by GitHub
parent
commit
3d0d97d6b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 32
      soh/src/code/z_play.c

32
soh/src/code/z_play.c

@ -2000,20 +2000,22 @@ s32 func_800C0DB4(GlobalContext* globalCtx, Vec3f* pos) { @@ -2000,20 +2000,22 @@ s32 func_800C0DB4(GlobalContext* globalCtx, Vec3f* pos) {
}
void Gameplay_PerformSave(GlobalContext* globalCtx) {
Gameplay_SaveSceneFlags(globalCtx);
gSaveContext.savedSceneNum = globalCtx->sceneNum;
if (gSaveContext.temporaryWeapon) {
gSaveContext.equips.buttonItems[0] = ITEM_NONE;
GET_PLAYER(globalCtx)->currentSwordItem = ITEM_NONE;
Inventory_ChangeEquipment(EQUIP_SWORD, PLAYER_SWORD_NONE);
Save_SaveFile();
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_KOKIRI;
GET_PLAYER(globalCtx)->currentSwordItem = ITEM_SWORD_KOKIRI;
Inventory_ChangeEquipment(EQUIP_SWORD, PLAYER_SWORD_KOKIRI);
} else {
Save_SaveFile();
}
if (CVar_GetS32("gAutosave", 0)) {
Overlay_DisplayText(3.0f, "Game Saved");
if (globalCtx != NULL) {
Gameplay_SaveSceneFlags(globalCtx);
gSaveContext.savedSceneNum = globalCtx->sceneNum;
if (gSaveContext.temporaryWeapon) {
gSaveContext.equips.buttonItems[0] = ITEM_NONE;
GET_PLAYER(globalCtx)->currentSwordItem = ITEM_NONE;
Inventory_ChangeEquipment(EQUIP_SWORD, PLAYER_SWORD_NONE);
Save_SaveFile();
gSaveContext.equips.buttonItems[0] = ITEM_SWORD_KOKIRI;
GET_PLAYER(globalCtx)->currentSwordItem = ITEM_SWORD_KOKIRI;
Inventory_ChangeEquipment(EQUIP_SWORD, PLAYER_SWORD_KOKIRI);
} else {
Save_SaveFile();
}
if (CVar_GetS32("gAutosave", 0)) {
Overlay_DisplayText(3.0f, "Game Saved");
}
}
}

Loading…
Cancel
Save