Total < strength*3

This commit is contained in:
jl777
2019-02-18 01:11:53 -11:00
parent 63bad40a58
commit f9b288af47

View File

@@ -157,37 +157,55 @@ out:
} }
} }
int32_t num_packitems(struct rogue_state *rs)
{
THING *list = pack;
int32_t type = 0,n = 0,total = 0;
for (; list != NULL; list = next(list))
{
if ( list->o_packch != 0 )
{
n++;
total += list->o_count;
}
}
char str[MAXSTR];
sprintf(str,"strength*3 %d vs total.%d vs %d inventory letters\n",pstats.s_str*3,total,n);
add_line(rs,"%s",str);
if ( total > pstats.s_str*3 )
return(MAXPACK);
return(n);
}
/* /*
* pack_room: * pack_room:
* See if there's room in the pack. If not, print out an * See if there's room in the pack. If not, print out an
* appropriate message * appropriate message
*/ */
bool bool pack_room(struct rogue_state *rs,bool from_floor, THING *obj)
pack_room(struct rogue_state *rs,bool from_floor, THING *obj)
{ {
inpack = num_packitems(rs); inpack = num_packitems(rs);
if (++inpack > MAXPACK) if ( ++inpack > MAXPACK )
{ {
if (!terse) if (!terse)
addmsg(rs,"there's "); addmsg(rs,"there's ");
addmsg(rs,"no room"); addmsg(rs,"no room");
if (!terse) if (!terse)
addmsg(rs," in your pack"); addmsg(rs," in your pack");
endmsg(rs); endmsg(rs);
if (from_floor) if (from_floor)
move_msg(rs,obj); move_msg(rs,obj);
inpack = MAXPACK; inpack = MAXPACK;
return FALSE; return FALSE;
} }
//fprintf(stderr,"inpack.%d vs MAX.%d\n",inpack,MAXPACK), sleep(2); //fprintf(stderr,"inpack.%d vs MAX.%d\n",inpack,MAXPACK), sleep(2);
if ( from_floor != 0 )
if (from_floor)
{ {
detach(lvl_obj, obj); detach(lvl_obj, obj);
mvaddch(hero.y, hero.x, floor_ch()); mvaddch(hero.y, hero.x, floor_ch());
chat(hero.y, hero.x) = (proom->r_flags & ISGONE) ? PASSAGE : FLOOR; chat(hero.y, hero.x) = (proom->r_flags & ISGONE) ? PASSAGE : FLOOR;
} }
return TRUE; return TRUE;
} }
@@ -247,24 +265,6 @@ pack_char()
* the given type. * the given type.
*/ */
int32_t num_packitems(struct rogue_state *rs)
{
THING *list = pack;
int32_t type = 0,n = 0,total = 0;
for (; list != NULL; list = next(list))
{
if ( list->o_packch != 0 )
{
n++;
total += list->o_count;
}
}
char str[MAXSTR];
sprintf(str,"total.%d vs %d inventory letters\n",total,n);
add_line(rs,"%s",str);
return(n);
}
bool bool
inventory(struct rogue_state *rs,THING *list, int type) inventory(struct rogue_state *rs,THING *list, int type)