Skip to content

Commit

Permalink
Fix: Object lookup used total weight of a item stack in player's poss…
Browse files Browse the repository at this point in the history
…ession - not the base weight.
  • Loading branch information
elunna committed Jul 30, 2023
1 parent e604de9 commit 6e79b54
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
1 change: 1 addition & 0 deletions hackem_changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

Version 1.2.1 (unreleased)

Fix: Object lookup used total weight of a item stack in player's possession - not the base weight.
Fix: Object lookup leaking info for object's in player's possession.

Version 1.2.0 (released July 28, 2023)
Expand Down
11 changes: 5 additions & 6 deletions src/pager.c
Original file line number Diff line number Diff line change
Expand Up @@ -1094,7 +1094,7 @@ char *usr_text;
/* We have the object and it is reveal_info */
boolean reveal_fullname = (obj && (oc.oc_name_known || obj->oprops_known));
boolean reveal_info = (boolean) (!obj || (obj && oc.oc_name_known));
int i, mat_bon, obj_weight;
int i, mat_bon;

struct obj dummy = { 0 };
dummy.otyp = otyp;
Expand Down Expand Up @@ -1718,11 +1718,10 @@ char *usr_text;

/* cost, wt should go next */
buf[0] = '\0';
obj_weight = obj ? weight(obj) : oc.oc_weight;
if (is_artifact) {
Sprintf(buf, "Weighs %d aum.", obj_weight);
Sprintf(buf, "Weighs %d aum.", oc.oc_weight);
} else if (reveal_info) {
Sprintf(buf, "Base cost %d, weighs %d aum.", oc.oc_cost, obj_weight);
Sprintf(buf, "Base cost %d, weighs %d aum.", oc.oc_cost, oc.oc_weight);
} else {
int base_cost = oc.oc_cost;
for (i = 0; i < NUM_OBJECTS; i++) {
Expand All @@ -1737,9 +1736,9 @@ char *usr_text;
}

if (base_cost > 0) {
Sprintf(buf, "Base cost %d, weighs %d aum.", oc.oc_cost, obj_weight);
Sprintf(buf, "Base cost %d, weighs %d aum.", oc.oc_cost, oc.oc_weight);
} else {
Sprintf(buf, "Weighs %d aum.", obj_weight);
Sprintf(buf, "Weighs %d aum.", oc.oc_weight);
}
}
OBJPUTSTR(buf);
Expand Down

0 comments on commit 6e79b54

Please sign in to comment.