diff --git a/Source/stores.cpp b/Source/stores.cpp index c5447a4b1..094a133cd 100644 --- a/Source/stores.cpp +++ b/Source/stores.cpp @@ -1172,11 +1172,11 @@ BOOL WitchSellOk(int i) void S_StartWSell() { - int i; // eax - BOOLEAN sellok; // [esp+18h] [ebp-8h] + int i; + BOOL sellok; stextsize = 1; - sellok = 0; + sellok = FALSE; storenumh = 0; for (i = 0; i < 48; i++) @@ -1184,8 +1184,8 @@ void S_StartWSell() for (i = 0; i < plr[myplr]._pNumInv; i++) { if (WitchSellOk(i)) { - sellok = 1; - qmemcpy(&storehold[storenumh], &plr[myplr].InvList[i], sizeof(ItemStruct)); + sellok = TRUE; + storehold[storenumh] = plr[myplr].InvList[i]; if (storehold[storenumh]._iMagical != ITEM_QUALITY_NORMAL && storehold[storenumh]._iIdentified) storehold[storenumh]._ivalue = storehold[storenumh]._iIvalue; @@ -1199,9 +1199,9 @@ void S_StartWSell() } for (i = 0; i < MAXBELTITEMS; i++) { - if (plr[myplr].SpdList[i]._itype != -1 && WitchSellOk(~i)) { - sellok = 1; - qmemcpy(&storehold[storenumh], &plr[myplr].SpdList[i], sizeof(ItemStruct)); + if (plr[myplr].SpdList[i]._itype != -1 && WitchSellOk(-(i+1))) { + sellok = TRUE; + storehold[storenumh] = plr[myplr].SpdList[i]; if (storehold[storenumh]._iMagical != ITEM_QUALITY_NORMAL && storehold[storenumh]._iIdentified) storehold[storenumh]._ivalue = storehold[storenumh]._iIvalue; @@ -1210,11 +1210,19 @@ void S_StartWSell() storehold[storenumh]._ivalue = 1; storehold[storenumh]._iIvalue = storehold[storenumh]._ivalue; - storehidx[storenumh++] = ~i; + storehidx[storenumh++] = -(i+1); } } - if (sellok) { + if (!sellok) { + stextscrl = 0; + sprintf(tempstr, "You have nothing I want. Your gold : %i", plr[myplr]._pGold); + AddSText(0, 1, 1, tempstr, COL_GOLD, 0); + AddSLine(3); + AddSLine(21); + AddSText(0, 22, 1, "Back", COL_WHITE, 1); + OffsetSTextY(22, 6); + } else { stextscrl = 1; stextsval = 0; stextsmax = plr[myplr]._pNumInv; @@ -1223,16 +1231,9 @@ void S_StartWSell() AddSLine(3); AddSLine(21); S_ScrollSSell(stextsval); - } else { - stextscrl = 0; - sprintf(tempstr, "You have nothing I want. Your gold : %i", plr[myplr]._pGold); - AddSText(0, 1, 1, tempstr, COL_GOLD, 0); - AddSLine(3); - AddSLine(21); + AddSText(0, 22, 1, "Back", COL_WHITE, 1); + OffsetSTextY(22, 6); } - - AddSText(0, 22, 1, "Back", COL_WHITE, 1); - OffsetSTextY(22, 6); } // 69F10C: using guessed type int storenumh; // 6A09E0: using guessed type char stextsize;