Skip to content

Commit fb47f09

Browse files
committed
Fix: thiefstone put items into a bag of tricks
Bags of tricks for some reason return true from Is_container despite not actually being usable as one. This meant that thiefstones could teleport items into a bag of tricks, which could then not easily be gotten out (it was possible, via wand of opening or polymorphing the bag, but this was certainly not intended in the first place). Adding an exception so bags of tricks don't count as containers breaks them in several ways, however, so instead I changed thiefstone behavior such that they now ignore bags completely. It's cleaner this way (rather than special-casing an exception only for bags of tricks) and slightly more thematic; sending items to a treasure chest makes more sense than a "treasure bag".
1 parent a1bd4f7 commit fb47f09

File tree

3 files changed

+25
-11
lines changed

3 files changed

+25
-11
lines changed

src/dokick.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1885,22 +1885,27 @@ obj_delivery(boolean near_hero)
18851885
if (nx > 0) {
18861886
if (where == MIGR_THIEFSTONE && Fits_in_container(otmp)) {
18871887
struct obj* cobj;
1888-
boolean found_container = FALSE;
1889-
/* put into a container on this spot, if possible */
1888+
boolean found_box = FALSE;
1889+
/* put into a box on this spot, if possible;
1890+
* only allow putting into boxes rather than bags because if
1891+
* bags are allowed, it creates weirdness like safely nesting a
1892+
* bag of holding into another, or putting items into a bag of
1893+
* tricks (Is_container is true for them!) from which they
1894+
* can't be removed */
18901895
cobj = svl.level.objects[nx][ny];
18911896
for (; cobj; cobj = cobj->nexthere) {
1892-
if (Is_container(cobj)) {
1897+
if (Is_box(cobj)) {
18931898
if (obj_is_burning(otmp))
18941899
end_burn(otmp, TRUE);
18951900
add_to_container(cobj, otmp);
18961901
cobj->owt = weight(cobj);
18971902
cobj->cknown = 0; /* contents have changed out of
18981903
* sight of the hero */
1899-
found_container = TRUE;
1904+
found_box = TRUE;
19001905
break;
19011906
}
19021907
}
1903-
if (found_container)
1908+
if (found_box)
19041909
continue;
19051910
/* if no containers here, continue normally */
19061911
}

src/mkobj.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4136,6 +4136,7 @@ choose_thiefstone_loc(coord *cc)
41364136
}
41374137
if (levl[x][y].typ == ROOM || levl[x][y].typ == CORR ||
41384138
levl[x][y].typ == SCORR) {
4139+
struct obj *otmp;
41394140
/* other terrain might be walkable but we don't want to put it
41404141
* on another feature */
41414142
quality += 2;
@@ -4146,8 +4147,14 @@ choose_thiefstone_loc(coord *cc)
41464147
&& levl[x][y].is_niche) {
41474148
quality += 20;
41484149
}
4149-
if (container_at(x, y, FALSE)) {
4150-
quality += 15;
4150+
/* modified version of container_at that ignores bags because
4151+
* thiefstone can't put items into bags */
4152+
for (otmp = svl.level.objects[x][y]; otmp;
4153+
otmp = otmp->nexthere) {
4154+
if (Is_box(otmp)) {
4155+
quality += 15;
4156+
break;
4157+
}
41514158
}
41524159
}
41534160
if (levl[x][y].typ == STAIRS) {
@@ -4325,9 +4332,11 @@ static const struct icp statue_materials[] = {
43254332
{ 1, GOLD}
43264333
};
43274334
static const struct icp figurine_materials[] = {
4328-
{45, MINERAL},
4329-
{35, WOOD},
4330-
{10, PLASTIC},
4335+
{40, MINERAL},
4336+
{30, WOOD},
4337+
{10, BONE},
4338+
{ 5, PLASTIC},
4339+
{ 5, GLASS},
43314340
{ 5, METAL},
43324341
{ 4, COPPER},
43334342
{ 1, GOLD}

src/pickup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1934,7 +1934,7 @@ thiefstone_teleport(struct obj* stone, struct obj* obj, boolean dobill)
19341934
/* put into a container on this spot, if possible */
19351935
for (cobj = svl.level.objects[obj->ox][obj->oy]; cobj;
19361936
cobj = cobj->nexthere) {
1937-
if (Is_container(cobj)) {
1937+
if (Is_box(cobj)) {
19381938
if (obj_is_burning(obj))
19391939
end_burn(obj, TRUE);
19401940
add_to_container(cobj, obj);

0 commit comments

Comments
 (0)