Skip to content

Commit

Permalink
fix(zc): Allow throwing lifted object without validating cost
Browse files Browse the repository at this point in the history
  • Loading branch information
EmilyV99 authored and connorjclark committed Dec 10, 2023
1 parent 172c7a5 commit 498f70f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
20 changes: 18 additions & 2 deletions src/zc/hero.cpp
Expand Up @@ -1687,6 +1687,7 @@ void HeroClass::init()
magiccastclk=0;
magicitem = div_prot_item = -1;
last_lens_id = 0; //Should be -1 (-Z)
last_lift_id.reset();
last_savepoint_id = 0;
misc_internal_hero_flags = 0;
last_cane_of_byrna_item_id = -1;
Expand Down Expand Up @@ -10665,8 +10666,14 @@ void HeroClass::drop_liftwpn()
}
void HeroClass::do_liftglove(int32_t liftid, bool passive)
{
if(!lift_wpn)
last_lift_id.reset();
if(liftid < 0)
liftid = current_item_id(itype_liftglove,true,true);
{
if(last_lift_id && can_lift(*last_lift_id))
liftid = *last_lift_id;
else liftid = current_item_id(itype_liftglove,true,true);
}
if(!can_lift(liftid)) return;
itemdata const& glove = itemsbuf[liftid];
byte intbtn = byte(glove.misc1&0xFF);
Expand Down Expand Up @@ -10767,9 +10774,11 @@ void HeroClass::do_liftglove(int32_t liftid, bool passive)
}
Lwpns.add(lift_wpn);
lift_wpn = nullptr;
last_lift_id.reset();
if(glove.usesound2)
sfx(glove.usesound2,pan(int32_t(x)));
}
else last_lift_id = liftid;

if(passive)
{
Expand Down Expand Up @@ -10888,7 +10897,14 @@ void HeroClass::do_liftglove(int32_t liftid, bool passive)
}
}
}
if(!lifted) return;

if(!lifted)
{
last_lift_id.reset();
return;
}
last_lift_id = liftid;

if(!paidmagic)
{
paidmagic = true;
Expand Down
1 change: 1 addition & 0 deletions src/zc/hero.h
Expand Up @@ -323,6 +323,7 @@ class HeroClass : public sprite
byte tliftclk;
zfix liftheight;
uint32_t liftflags;
optional<byte> last_lift_id;

private:
ffcdata const* platform_ffc;
Expand Down

0 comments on commit 498f70f

Please sign in to comment.