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

Function S_SPBuyEnter

Source/stores.cpp:1921–1957  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1919}
1920
1921void S_SPBuyEnter()
1922{
1923 int i, idx, xx;
1924 BOOL done;
1925
1926 if (stextsel == 22) {
1927 StartStore(STORE_SMITH);
1928 stextsel = 14;
1929 } else {
1930 stextshold = STORE_SPBUY;
1931 stextlhold = stextsel;
1932 stextvhold = stextsval;
1933 xx = stextsval + ((stextsel - stextup) >> 2);
1934 idx = 0;
1935 for (i = 0; xx >= 0; i++) {
1936 if (premiumitem[i]._itype != ITYPE_NONE) {
1937 xx--;
1938 idx = i;
1939 }
1940 }
1941 if (plr[myplr]._pGold < premiumitem[idx]._iIvalue) {
1942 StartStore(STORE_NOMONEY);
1943 } else {
1944 plr[myplr].HoldItem = premiumitem[idx];
1945 SetCursor_(plr[myplr].HoldItem._iCurs + CURSOR_FIRSTITEM);
1946 done = FALSE;
1947 for (i = 0; i < 40 && !done; i++) {
1948 done = AutoPlace(myplr, i, cursW / 28, cursH / 28, FALSE);
1949 }
1950 if (done)
1951 StartStore(STORE_CONFIRM);
1952 else
1953 StartStore(STORE_NOROOM);
1954 SetCursor_(CURSOR_HAND);
1955 }
1956 }
1957}
1958
1959BOOL StoreGoldFit(int idx)
1960{

Callers 1

STextEnterFunction · 0.85

Calls 3

StartStoreFunction · 0.85
SetCursor_Function · 0.85
AutoPlaceFunction · 0.85

Tested by

no test coverage detected