From e8d123bd207e17c47cb3531a84a418467879c58e Mon Sep 17 00:00:00 2001 From: Anders Jenbo Date: Sat, 6 Apr 2019 03:53:12 +0200 Subject: [PATCH] Clean up SmithRepairOk --- Source/stores.cpp | 21 +++++++++++++-------- Source/stores.h | 2 +- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/Source/stores.cpp b/Source/stores.cpp index f2917b67f..6b133b193 100644 --- a/Source/stores.cpp +++ b/Source/stores.cpp @@ -923,15 +923,20 @@ void __cdecl S_StartSSell() // 6A09E4: using guessed type int stextsmax; // 6A6BB8: using guessed type int stextscrl; -BOOLEAN __fastcall SmithRepairOk(int i) +BOOL __fastcall SmithRepairOk(int i) { - if (plr[myplr].InvList[i]._itype != ITYPE_NONE - && plr[myplr].InvList[i]._itype - && plr[myplr].InvList[i]._itype != ITYPE_GOLD - && plr[myplr].InvList[i]._itype != ITYPE_0E) - return plr[myplr].InvList[i]._iDurability != plr[myplr].InvList[i]._iMaxDur; - else - return 0; + if (plr[myplr].InvList[i]._itype == ITYPE_NONE) + return FALSE; + if (plr[myplr].InvList[i]._itype == ITYPE_MISC) + return FALSE; + if (plr[myplr].InvList[i]._itype == ITYPE_GOLD) + return FALSE; + if (plr[myplr].InvList[i]._itype == ITYPE_0E) + return FALSE; + if (plr[myplr].InvList[i]._iDurability == plr[myplr].InvList[i]._iMaxDur) + return FALSE; + + return TRUE; } void __cdecl S_StartSRepair() diff --git a/Source/stores.h b/Source/stores.h index 4ab231e06..d9f809c7d 100644 --- a/Source/stores.h +++ b/Source/stores.h @@ -59,7 +59,7 @@ BOOLEAN __cdecl S_StartSPBuy(); BOOL __fastcall SmithSellOk(int i); void __fastcall S_ScrollSSell(int idx); void __cdecl S_StartSSell(); -BOOLEAN __fastcall SmithRepairOk(int i); +BOOL __fastcall SmithRepairOk(int i); void __cdecl S_StartSRepair(); void __fastcall AddStoreHoldRepair(ItemStruct *itm, int i); void __cdecl S_StartWitch();