From f9b288af4768d7f4f75a44da02ab1067accbed0a Mon Sep 17 00:00:00 2001 From: jl777 Date: Mon, 18 Feb 2019 01:11:53 -1100 Subject: [PATCH] Total < strength*3 --- src/cc/rogue/pack.c | 74 ++++++++++++++++++++++----------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/src/cc/rogue/pack.c b/src/cc/rogue/pack.c index 7e93dd759..f8fc98175 100644 --- a/src/cc/rogue/pack.c +++ b/src/cc/rogue/pack.c @@ -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: * See if there's room in the pack. If not, print out an * appropriate message */ -bool -pack_room(struct rogue_state *rs,bool from_floor, THING *obj) +bool pack_room(struct rogue_state *rs,bool from_floor, THING *obj) { inpack = num_packitems(rs); - if (++inpack > MAXPACK) + if ( ++inpack > MAXPACK ) { - if (!terse) - addmsg(rs,"there's "); - addmsg(rs,"no room"); - if (!terse) - addmsg(rs," in your pack"); - endmsg(rs); - if (from_floor) - move_msg(rs,obj); - inpack = MAXPACK; - return FALSE; + if (!terse) + addmsg(rs,"there's "); + addmsg(rs,"no room"); + if (!terse) + addmsg(rs," in your pack"); + endmsg(rs); + if (from_floor) + move_msg(rs,obj); + inpack = MAXPACK; + return FALSE; } //fprintf(stderr,"inpack.%d vs MAX.%d\n",inpack,MAXPACK), sleep(2); - - if (from_floor) + if ( from_floor != 0 ) { - detach(lvl_obj, obj); - mvaddch(hero.y, hero.x, floor_ch()); - chat(hero.y, hero.x) = (proom->r_flags & ISGONE) ? PASSAGE : FLOOR; + detach(lvl_obj, obj); + mvaddch(hero.y, hero.x, floor_ch()); + chat(hero.y, hero.x) = (proom->r_flags & ISGONE) ? PASSAGE : FLOOR; } - return TRUE; } @@ -247,24 +265,6 @@ pack_char() * 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 inventory(struct rogue_state *rs,THING *list, int type)