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

Function S_StartSSell

Source/stores.cpp:630–678  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

628}
629
630void S_StartSSell()
631{
632 int i;
633 BOOL sellok;
634
635 stextsize = 1;
636 sellok = FALSE;
637 storenumh = 0;
638
639 for (i = 0; i < 48; i++)
640 storehold[i]._itype = ITYPE_NONE;
641
642 for (i = 0; i < plr[myplr]._pNumInv; i++) {
643 if (SmithSellOk(i)) {
644 sellok = TRUE;
645 storehold[storenumh] = plr[myplr].InvList[i];
646
647 if (storehold[storenumh]._iMagical != ITEM_QUALITY_NORMAL && storehold[storenumh]._iIdentified)
648 storehold[storenumh]._ivalue = storehold[storenumh]._iIvalue;
649
650 if (!(storehold[storenumh]._ivalue >>= 2))
651 storehold[storenumh]._ivalue = 1;
652
653 storehold[storenumh]._iIvalue = storehold[storenumh]._ivalue;
654 storehidx[storenumh++] = i;
655 }
656 }
657
658 if (!sellok) {
659 stextscrl = FALSE;
660 sprintf(tempstr, "You have nothing I want. Your gold : %i", plr[myplr]._pGold);
661 AddSText(0, 1, 1, tempstr, COL_GOLD, 0);
662 AddSLine(3);
663 AddSLine(21);
664 AddSText(0, 22, 1, "Back", COL_WHITE, 1);
665 OffsetSTextY(22, 6);
666 } else {
667 stextscrl = TRUE;
668 stextsval = 0;
669 stextsmax = plr[myplr]._pNumInv;
670 sprintf(tempstr, "Which item is for sale? Your gold : %i", plr[myplr]._pGold);
671 AddSText(0, 1, 1, tempstr, COL_GOLD, 0);
672 AddSLine(3);
673 AddSLine(21);
674 S_ScrollSSell(stextsval);
675 AddSText(0, 22, 1, "Back", COL_WHITE, 1);
676 OffsetSTextY(22, 6);
677 }
678}
679
680BOOL SmithRepairOk(int i)
681{

Callers 1

StartStoreFunction · 0.85

Calls 5

SmithSellOkFunction · 0.85
AddSTextFunction · 0.85
AddSLineFunction · 0.85
OffsetSTextYFunction · 0.85
S_ScrollSSellFunction · 0.85

Tested by

no test coverage detected