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

Function S_SBuyEnter

Source/stores.cpp:1866–1896  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1864}
1865
1866void S_SBuyEnter()
1867{
1868 int idx, i;
1869 BOOL done;
1870
1871 if (stextsel == 22) {
1872 StartStore(STORE_SMITH);
1873 stextsel = 12;
1874 } else {
1875 stextlhold = stextsel;
1876 stextvhold = stextsval;
1877 stextshold = STORE_SBUY;
1878 idx = stextsval + ((stextsel - stextup) >> 2);
1879 if (plr[myplr]._pGold < smithitem[idx]._iIvalue) {
1880 StartStore(STORE_NOMONEY);
1881 } else {
1882 plr[myplr].HoldItem = smithitem[idx];
1883 SetCursor_(plr[myplr].HoldItem._iCurs + CURSOR_FIRSTITEM);
1884 done = FALSE;
1885
1886 for (i = 0; i < 40 && !done; i++) {
1887 done = AutoPlace(myplr, i, cursW / 28, cursH / 28, FALSE);
1888 }
1889 if (done)
1890 StartStore(STORE_CONFIRM);
1891 else
1892 StartStore(STORE_NOROOM);
1893 SetCursor_(CURSOR_HAND);
1894 }
1895 }
1896}
1897
1898void SmithBuyPItem()
1899{

Callers 1

STextEnterFunction · 0.85

Calls 3

StartStoreFunction · 0.85
SetCursor_Function · 0.85
AutoPlaceFunction · 0.85

Tested by

no test coverage detected