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

This commit is contained in:
Josh Bodner 2022-09-21 15:28:07 -07:00 committed by GitHub
parent 2b78bea475
commit 3d0d97d6b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 15 deletions

View File

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