MCPcopy Create free account
hub / github.com/diasurgical/devilution / S_StartWSell

Function S_StartWSell

Source/stores.cpp:874–938  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

872}
873
874void S_StartWSell()
875{
876 int i;
877 BOOL sellok;
878
879 stextsize = 1;
880 sellok = FALSE;
881 storenumh = 0;
882
883 for (i = 0; i < 48; i++)
884 storehold[i]._itype = ITYPE_NONE;
885
886 for (i = 0; i < plr[myplr]._pNumInv; i++) {
887 if (WitchSellOk(i)) {
888 sellok = TRUE;
889 storehold[storenumh] = plr[myplr].InvList[i];
890
891 if (storehold[storenumh]._iMagical != ITEM_QUALITY_NORMAL && storehold[storenumh]._iIdentified)
892 storehold[storenumh]._ivalue = storehold[storenumh]._iIvalue;
893
894 if (!(storehold[storenumh]._ivalue >>= 2))
895 storehold[storenumh]._ivalue = 1;
896
897 storehold[storenumh]._iIvalue = storehold[storenumh]._ivalue;
898 storehidx[storenumh++] = i;
899 }
900 }
901
902 for (i = 0; i < MAXBELTITEMS; i++) {
903 if (plr[myplr].SpdList[i]._itype != ITYPE_NONE && WitchSellOk(-(i + 1))) {
904 sellok = TRUE;
905 storehold[storenumh] = plr[myplr].SpdList[i];
906
907 if (storehold[storenumh]._iMagical != ITEM_QUALITY_NORMAL && storehold[storenumh]._iIdentified)
908 storehold[storenumh]._ivalue = storehold[storenumh]._iIvalue;
909
910 if (!(storehold[storenumh]._ivalue >>= 2))
911 storehold[storenumh]._ivalue = 1;
912
913 storehold[storenumh]._iIvalue = storehold[storenumh]._ivalue;
914 storehidx[storenumh++] = -(i + 1);
915 }
916 }
917
918 if (!sellok) {
919 stextscrl = FALSE;
920 sprintf(tempstr, "You have nothing I want. Your gold : %i", plr[myplr]._pGold);
921 AddSText(0, 1, 1, tempstr, COL_GOLD, 0);
922 AddSLine(3);
923 AddSLine(21);
924 AddSText(0, 22, 1, "Back", COL_WHITE, 1);
925 OffsetSTextY(22, 6);
926 } else {
927 stextscrl = TRUE;
928 stextsval = 0;
929 stextsmax = plr[myplr]._pNumInv;
930 sprintf(tempstr, "Which item is for sale? Your gold : %i", plr[myplr]._pGold);
931 AddSText(0, 1, 1, tempstr, COL_GOLD, 0);

Callers 1

StartStoreFunction · 0.85

Calls 5

WitchSellOkFunction · 0.85
AddSTextFunction · 0.85
AddSLineFunction · 0.85
OffsetSTextYFunction · 0.85
S_ScrollSSellFunction · 0.85

Tested by

no test coverage detected