Improved forgetting of cleaned up potion forms

This commit is contained in:
Eddoursul 2024-02-19 20:18:08 +01:00
parent 29e997d15f
commit 06f28501ae
2 changed files with 13 additions and 14 deletions

View File

@ -140,15 +140,10 @@ function _addNamedPotion(Potion aPotion, string sName, string sModel)
endfunction endfunction
function _removeNamedPotion(Potion aPotion) function _removeNamedPotion(int iIndex)
if aPotion aCreatedPotions[iIndex] = None
int i = aCreatedPotions.Find(aPotion) aPotionNames[iIndex] = ""
if i > -1 aPotionModels[iIndex] = ""
aCreatedPotions[i] = None
aPotionNames[i] = ""
aPotionModels[i] = ""
endif
endif
endfunction endfunction
Function _UpdatePotion(Potion item, Int count) Function _UpdatePotion(Potion item, Int count)
@ -401,7 +396,9 @@ EndFunction
Function _InitAchemyControl() Function _InitAchemyControl()
GoToState("") if GetState() != ""
GoToState("")
endif
; Version update ; Version update
If curScriptVersion < LATEST_SCRIPT_VERSION If curScriptVersion < LATEST_SCRIPT_VERSION
@ -463,9 +460,11 @@ Event OnPlayerLoadGame()
int i = 0 int i = 0
while i < 128 while i < 128
if aCreatedPotions[i] if aCreatedPotions[i] ; this may be None but return true when a potion no longer exists
if PlayerREF.GetItemCount(aCreatedPotions[i]) == 0 && _00E_SecureChest_HostChestREF.GetItemCount(aCreatedPotions[i]) == 0 if aCreatedPotions[i] as String == "[Potion <None>]"
_removeNamedPotion(aCreatedPotions[i]) _removeNamedPotion(i)
elseif PlayerREF.GetItemCount(aCreatedPotions[i]) == 0 && _00E_SecureChest_HostChestREF.GetItemCount(aCreatedPotions[i]) == 0
_removeNamedPotion(i)
else else
aCreatedPotions[i].SetName(aPotionNames[i]) aCreatedPotions[i].SetName(aPotionNames[i])
if aPotionModels[i] != "" if aPotionModels[i] != ""