fix some unreachable messages (either make then reachable or remove them)
can quiver coins when GOLDOBJ is defined
make #loot behave same for GOLDOBJ as for !GOLDOBJ
+for GOLDOBJ, can pick gold up into $ when all 52 letters are in use, and
+ can pick non-gold up into unused letter when gold uses one of 52 slots
grammar, spelling and other typos
keep various delayed killers separate to avoid mixed up messages
don't place randomly-placed aquatic monsters in lava on special levels
E int FDECL(calc_capacity, (int));
E int NDECL(max_capacity);
E boolean FDECL(check_capacity, (const char *));
-E int NDECL(inv_cnt);
+E int FDECL(inv_cnt, (BOOLEAN_P));
#ifdef GOLDOBJ
E long FDECL(money_cnt, (struct obj *));
#endif
if (carried(otmp)) {
freeinv(otmp);
- if (inv_cnt() >= 52) {
+ if (inv_cnt(FALSE) >= 52) {
sellobj_state(SELL_DONTSELL);
dropy(otmp);
sellobj_state(SELL_NORMAL);
}
int
-inv_cnt()
+inv_cnt(incl_gold)
+boolean incl_gold; /* only meaningful for GOLDOBJ config */
{
register struct obj *otmp = invent;
register int ct = 0;
while(otmp){
- ct++;
+ if (incl_gold || otmp->invlet != GOLD_SYM) ct++;
otmp = otmp->nobj;
}
return(ct);
money_cnt(otmp)
struct obj *otmp;
{
- while(otmp) {
- /* Must change when silver & copper is implemented: */
- if (otmp->oclass == COIN_CLASS) return otmp->quan;
- otmp = otmp->nobj;
- }
- return 0;
+ while (otmp) {
+ /* Must change when silver & copper is implemented: */
+ if (otmp->oclass == COIN_CLASS) return otmp->quan;
+ otmp = otmp->nobj;
+ }
+ return 0L;
}
-#endif
+#endif /* GOLDOBJ */
/*hack.c*/
if (drop_arg) drop_arg = strcpy(buf, drop_arg);
obj = addinv(obj);
- if (inv_cnt() > 52
+ if (inv_cnt(FALSE) > 52
|| ((obj->otyp != LOADSTONE || !obj->cursed)
&& near_capacity() > prev_encumbr)) {
if (drop_fmt) pline(drop_fmt, drop_arg);
for (let = 'A'; let <= 'Z'; ) alphabet[ix++] = let++;
alphabet[ix] = '\0';
/* for floating inv letters, truncate list after the first open slot */
- if (!flags.invlet_constant && (ix = inv_cnt()) < 52)
+ if (!flags.invlet_constant && (ix = inv_cnt(FALSE)) < 52)
alphabet[ix + (splitting ? 0 : 1)] = '\0';
/* blank out all the letters currently in use in the inventory */
if (merged(&otmp, &obj)) {
obj = otmp;
extract_nobj(obj, &invent);
- } else if (inv_cnt() >= 52) {
+ } else if (inv_cnt(FALSE) >= 52) {
(void) merged(&splitting, &obj); /* undo split */
/* "knapsack cannot accommodate any more items" */
Your("pack is too full.");
availability of open inventory slot iff not already carrying one */
if (obj->otyp == LOADSTONE ||
(obj->otyp == BOULDER && throws_rocks(youmonst.data))) {
- if (inv_cnt() < 52 || !carrying(obj->otyp) || merge_choice(invent, obj))
+ if (inv_cnt(FALSE) < 52 || !carrying(obj->otyp) ||
+ merge_choice(invent, obj))
return 1; /* lift regardless of current situation */
/* if we reach here, we're out of slots and already have at least
one of these, so treat this one more like a normal item */
*cnt_p = carry_count(obj, container, *cnt_p, telekinesis, &old_wt, &new_wt);
if (*cnt_p < 1L) {
result = -1; /* nothing lifted */
- } else if (
-#ifndef GOLDOBJ
- obj->oclass != COIN_CLASS &&
-#endif
- inv_cnt() >= 52 && !merge_choice(invent, obj)) {
+ } else if (obj->oclass != COIN_CLASS &&
+ /* [exception for gold coins will have to change
+ if silver/copper ones ever get implemented] */
+ inv_cnt(FALSE) >= 52 && !merge_choice(invent, obj)) {
Your("knapsack cannot accommodate any more items.");
result = -1; /* nothing lifted */
} else {
if (!rn2(3)) {
/* n objects: 1/(n+1) chance per object plus 1/(n+1) to fall off end */
- for (n = inv_cnt(), otmp = invent; otmp; --n, otmp = otmp->nobj)
+ for (n = inv_cnt(TRUE), otmp = invent; otmp; --n, otmp = otmp->nobj)
if (!rn2(n + 1)) {
prinv("You find old loot:", otmp, 0L);
return TRUE;
if (mongold->quan > amount) mongold = splitobj(mongold, amount);
obj_extract_self(mongold);
- if (!merge_choice(invent, mongold) && inv_cnt() >= 52) {
+ if (!merge_choice(invent, mongold) && inv_cnt(FALSE) >= 52) {
You("have no room for the money!");
dropy(mongold);
} else {
/* Returns 1 when something was stolen (or at least, when N should flee now)
* Returns -1 if the monster died in the attempt
* Avoid stealing the object stealoid
+ * GOLDOBJ: nymphs and monkeys won't steal coins
*/
int
steal(mtmp, objnambuf)
so this will cause it to be removed now */
if (occupation) (void) maybe_finished_meal(FALSE);
- if (!invent || (inv_cnt() == 1 && uskin)) {
+ if (!invent || (inv_cnt(FALSE) == 1 && uskin)) {
nothing_to_steal:
/* Not even a thousand men in armor can strip a naked man. */
if(Blind)
tmp = 0;
for(otmp = invent; otmp; otmp = otmp->nobj)
if ((!uarm || otmp != uarmc) && otmp != uskin
+#ifdef GOLDOBJ
+ && otmp->oclass != COIN_CLASS
+#endif
#ifdef INVISIBLE_OBJECTS
&& (!otmp->oinvis || perceives(mtmp->data))
#endif
tmp = rn2(tmp);
for(otmp = invent; otmp; otmp = otmp->nobj)
if ((!uarm || otmp != uarmc) && otmp != uskin
+#ifdef GOLDOBJ
+ && otmp->oclass != COIN_CLASS
+#endif
#ifdef INVISIBLE_OBJECTS
&& (!otmp->oinvis || perceives(mtmp->data))
#endif
/* the fewer items you have, the less likely the thief
is going to stick around to try again (0) instead of
running away (1) */
- return !rn2(inv_cnt() / 5 + 2);
+ return !rn2(inv_cnt(FALSE) / 5 + 2);
}
}
emergency_disrobe(lostsome)
boolean *lostsome;
{
- int invc = inv_cnt();
+ int invc = inv_cnt(TRUE);
while (near_capacity() > (Punished ? UNENCUMBERED : SLT_ENCUMBER)) {
register struct obj *obj, *otmp = (struct obj *)0;
struct obj *mongold = findgold(mdef->minvent);
if (mongold) {
obj_extract_self(mongold);
- if (merge_choice(invent, mongold) || inv_cnt() < 52) {
+ if (merge_choice(invent, mongold) ||
+ inv_cnt(FALSE) < 52) {
addinv(mongold);
Your("purse feels heavier.");
} else {