wiz_level_change cleanup
The new routine needed to do something with u.ulevelmax
(which controls whether lost levels can be regained via magic).
This sets it to the new level rather than having it go up or
down the same amount as the user specified in the level change,
which yields a plausible reason for using this command to set
experience level explicitly to its current value.
The new code was using a mixture of spaces and tabs for
indentation; I've totally reformatted it.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
/* SCCS Id: @(#)cmd.c 3.3 2000/05/05 */
|
/* SCCS Id: @(#)cmd.c 3.3 2002/01/17 */
|
||||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||||
/* NetHack may be freely redistributed. See license for details. */
|
/* NetHack may be freely redistributed. See license for details. */
|
||||||
|
|
||||||
@@ -560,7 +560,8 @@ STATIC_PTR int
|
|||||||
wiz_mon_polycontrol()
|
wiz_mon_polycontrol()
|
||||||
{
|
{
|
||||||
iflags.mon_polycontrol = !iflags.mon_polycontrol;
|
iflags.mon_polycontrol = !iflags.mon_polycontrol;
|
||||||
pline("Monster polymorph control is %s.", iflags.mon_polycontrol ? "on" : "off");
|
pline("Monster polymorph control is %s.",
|
||||||
|
iflags.mon_polycontrol ? "on" : "off");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -572,26 +573,34 @@ wiz_level_change()
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
getlin("To what experience level do you want to be raised?", buf);
|
getlin("To what experience level do you want to be raised?", buf);
|
||||||
ret = sscanf(buf, "%d", &newlevel);
|
(void)mungspaces(buf);
|
||||||
if (ret < 1 || ret == EOF)
|
if (buf[0] == '\033' || buf[0] == '\0') ret = 0;
|
||||||
|
else ret = sscanf(buf, "%d", &newlevel);
|
||||||
|
|
||||||
|
if (ret != 1) {
|
||||||
pline(Never_mind);
|
pline(Never_mind);
|
||||||
else if (newlevel == u.ulevel)
|
return 0;
|
||||||
|
}
|
||||||
|
if (newlevel == u.ulevel) {
|
||||||
You("are already that experienced.");
|
You("are already that experienced.");
|
||||||
else if (newlevel < u.ulevel) {
|
} else if (newlevel < u.ulevel) {
|
||||||
if (u.ulevel == 1) {
|
if (u.ulevel == 1) {
|
||||||
You("are already as inexperienced as you can get.");
|
You("are already as inexperienced as you can get.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (newlevel < 1) newlevel = 1;
|
if (newlevel < 1) newlevel = 1;
|
||||||
while (u.ulevel > newlevel) losexp((const char *)0);
|
while (u.ulevel > newlevel)
|
||||||
|
losexp((const char *)0);
|
||||||
} else {
|
} else {
|
||||||
if (u.ulevel >= MAXULEV) {
|
if (u.ulevel >= MAXULEV) {
|
||||||
You("are already as experienced as you can get.");
|
You("are already as experienced as you can get.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (newlevel > MAXULEV) newlevel = MAXULEV;
|
if (newlevel > MAXULEV) newlevel = MAXULEV;
|
||||||
while (u.ulevel < newlevel) pluslvl(FALSE);
|
while (u.ulevel < newlevel)
|
||||||
|
pluslvl(FALSE);
|
||||||
}
|
}
|
||||||
|
u.ulevelmax = u.ulevel;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user