groundwork: u.twoweap manipulation

Toggle u.twoweap on or off in just one place.
This commit is contained in:
PatR
2020-04-03 11:42:17 -07:00
parent d58e449d6c
commit 8f73f926b1
9 changed files with 32 additions and 19 deletions

View File

@@ -719,13 +719,20 @@ drop_uswapwep()
dropx(obj);
}
void
set_twoweap(on_off)
boolean on_off;
{
u.twoweap = on_off;
}
int
dotwoweapon()
{
/* You can always toggle it off */
if (u.twoweap) {
You("switch to your primary weapon.");
u.twoweap = 0;
set_twoweap(FALSE); /* u.twoweap = FALSE */
update_inventory();
return 0;
}
@@ -734,7 +741,7 @@ dotwoweapon()
if (can_twoweapon()) {
/* Success! */
You("begin two-weapon combat.");
u.twoweap = 1;
set_twoweap(TRUE); /* u.twoweap = TRUE */
update_inventory();
return (rnd(20) > ACURR(A_DEX));
}
@@ -785,7 +792,7 @@ untwoweapon()
{
if (u.twoweap) {
You("can no longer use two weapons at once.");
u.twoweap = FALSE;
set_twoweap(FALSE); /* u.twoweap = FALSE */
update_inventory();
}
return;