Calculate unpack

This commit is contained in:
jl777
2019-02-16 01:29:42 -11:00
parent f341a6938e
commit 49e84c350e
5 changed files with 59 additions and 15 deletions

View File

@@ -165,6 +165,7 @@ out:
bool
pack_room(struct rogue_state *rs,bool from_floor, THING *obj)
{
inpack = num_packitems();
if (++inpack > MAXPACK)
{
if (!terse)
@@ -245,6 +246,16 @@ pack_char()
* List what is in the pack. Return TRUE if there is something of
* the given type.
*/
int32_t num_packitems()
{
THING *list = pack;
int32_t type = 0,n = 0;
for (; list != NULL; list = next(list))
n++;
return(n);
}
bool
inventory(struct rogue_state *rs,THING *list, int type)
{