Browse Source

Clean up S_SBuyEnter

pull/88/head
Anders Jenbo 7 years ago
parent
commit
55522b805e
  1. 45
      Source/stores.cpp

45
Source/stores.cpp

@ -2370,11 +2370,8 @@ void SmithBuyItem()
void S_SBuyEnter()
{
int v0; // eax
int idx; // ecx
int done; // eax
int i; // esi
char v4; // cl
int idx, i;
BOOL done;
if (stextsel == 22) {
StartStore(STORE_SMITH);
@ -2383,37 +2380,25 @@ void S_SBuyEnter()
stextlhold = stextsel;
stextvhold = stextsval;
stextshold = 2;
v0 = myplr;
idx = stextsval + ((stextsel - stextup) >> 2);
if (plr[myplr]._pGold >= smithitem[idx]._iIvalue) {
qmemcpy(&plr[v0].HoldItem, &smithitem[idx], sizeof(plr[v0].HoldItem));
SetCursor_(plr[v0].HoldItem._iCurs + CURSOR_FIRSTITEM);
done = 0;
i = 0;
do {
if (done)
goto LABEL_9;
done = AutoPlace(myplr, i++, cursW / 28, cursH / 28, 0);
} while (i < 40);
if (done) {
LABEL_9:
v4 = STORE_CONFIRM;
goto LABEL_11;
if (plr[myplr]._pGold < smithitem[idx]._iIvalue) {
StartStore(STORE_NOMONEY);
} else {
plr[myplr].HoldItem = smithitem[idx];
SetCursor_(plr[myplr].HoldItem._iCurs + CURSOR_FIRSTITEM);
done = FALSE;
for (i = 0; i < 40 && !done; i++) {
done = AutoPlace(myplr, i, cursW / 28, cursH / 28, 0);
}
v4 = STORE_NOROOM;
LABEL_11:
StartStore(v4);
if (done)
StartStore(STORE_CONFIRM);
else
StartStore(STORE_NOROOM);
SetCursor_(CURSOR_HAND);
} else {
StartStore(STORE_NOMONEY);
}
}
}
// 4B8C9C: using guessed type int cursH;
// 69F108: using guessed type int stextup;
// 69F110: using guessed type int stextlhold;
// 6A8A24: using guessed type int stextvhold;
// 6A8A28: using guessed type int stextsel;
void SmithBuyPItem()
{

Loading…
Cancel
Save