Dont loop on bad item select
This commit is contained in:
@@ -410,59 +410,63 @@ get_item(struct rogue_state *rs,char *purpose, int type)
|
|||||||
{
|
{
|
||||||
THING *obj;
|
THING *obj;
|
||||||
char ch;
|
char ch;
|
||||||
|
|
||||||
if (pack == NULL)
|
if (pack == NULL)
|
||||||
msg(rs,"you aren't carrying anything");
|
msg(rs,"you aren't carrying anything");
|
||||||
else if (again)
|
else if (again)
|
||||||
if (last_pick)
|
if (last_pick)
|
||||||
return last_pick;
|
return last_pick;
|
||||||
else
|
else
|
||||||
msg(rs,"you ran out");
|
msg(rs,"you ran out");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if (!terse)
|
if (!terse)
|
||||||
addmsg(rs,"which object do you want to ");
|
addmsg(rs,"which object do you want to ");
|
||||||
addmsg(rs,purpose);
|
addmsg(rs,purpose);
|
||||||
if (terse)
|
if (terse)
|
||||||
addmsg(rs," what");
|
addmsg(rs," what");
|
||||||
msg(rs,"? (* for list): ");
|
msg(rs,"? (* for list): ");
|
||||||
ch = readchar(rs);
|
ch = readchar(rs);
|
||||||
mpos = 0;
|
mpos = 0;
|
||||||
/*
|
/*
|
||||||
* Give the poor player a chance to abort the command
|
* Give the poor player a chance to abort the command
|
||||||
*/
|
*/
|
||||||
if (ch == ESCAPE)
|
if (ch == ESCAPE)
|
||||||
{
|
{
|
||||||
reset_last();
|
reset_last();
|
||||||
after = FALSE;
|
after = FALSE;
|
||||||
msg(rs,"");
|
msg(rs,"");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
n_objs = 1; /* normal case: person types one char */
|
n_objs = 1; /* normal case: person types one char */
|
||||||
if (ch == '*')
|
if (ch == '*')
|
||||||
{
|
{
|
||||||
mpos = 0;
|
mpos = 0;
|
||||||
if (inventory(rs,pack, type) == 0)
|
if (inventory(rs,pack, type) == 0)
|
||||||
{
|
{
|
||||||
after = FALSE;
|
after = FALSE;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (obj = pack; obj != NULL; obj = next(obj))
|
for (obj = pack; obj != NULL; obj = next(obj))
|
||||||
if (obj->o_packch == ch)
|
if (obj->o_packch == ch)
|
||||||
break;
|
break;
|
||||||
if (obj == NULL)
|
if (obj == NULL)
|
||||||
{
|
{
|
||||||
msg(rs,"'%s' is not a valid item",unctrl(ch));
|
//msg(rs,"'%s' is not a valid item",unctrl(ch));
|
||||||
continue;
|
//continue;
|
||||||
}
|
reset_last();
|
||||||
else
|
after = FALSE;
|
||||||
return obj;
|
msg(rs,"'%s' is not a valid item",unctrl(ch));
|
||||||
}
|
return NULL;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
return obj;
|
||||||
|
}
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user