Skip to content

Commit

Permalink
Equipment: Handling missing object for weapons
Browse files Browse the repository at this point in the history
Fixes: issue #1286
  • Loading branch information
dscharrer committed Dec 31, 2022
1 parent d057550 commit b85cece
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG
Expand Up @@ -66,9 +66,10 @@ Other Fixes:

* Added a workaround for broken ratman backflip in intro (bug #93)
* Fixed a crash when dragging an entity without a 3D object (bug #1592)
* Fixed a crash when using a weapon without a 3D object (bug #1286)
* Fixed a crash when an equipped candle is destroyed (bug #1622)
* Fixed a crash with negative (or zero with -i) intervals in the `timer` command
* Fixed a crash when loading save files with linked items inside an inventory
* Fixed a crash when loading save files with linked items inside an inventory (bug #1618)
* Fixed linked entities being removed from NPC inventories even if linked to the owning NPC
* Fixed the `replaceme` script command for NPC weapons not equipping the new weapon

Expand Down
9 changes: 7 additions & 2 deletions src/game/Equipment.cpp
Expand Up @@ -603,13 +603,17 @@ bool ARX_EQUIPMENT_Strike_Check(Entity * io_source, Entity * io_weapon, float ra
arx_assert(io_source);
arx_assert(io_weapon);

if(!io_weapon->obj) {
return false;
}

bool ret = false;

EXCEPTIONS_LIST_Pos = 0;

float drain_life = ARX_EQUIPMENT_GetSpecialValue(io_weapon, IO_SPECIAL_ELEM_DRAIN_LIFE);
float paralyse = ARX_EQUIPMENT_GetSpecialValue(io_weapon, IO_SPECIAL_ELEM_PARALYZE);

for(const EERIE_ACTIONLIST & action : io_weapon->obj->actionlist) {

float rad = GetHitValue(action.name);
Expand All @@ -629,6 +633,7 @@ bool ARX_EQUIPMENT_Strike_Check(Entity * io_source, Entity * io_weapon, float ra
if(CheckEverythingInSphere(sphere, io_source, entities.get(targ), sphereContent)) {
for(Entity * target : sphereContent) {
arx_assert(target);
arx_assert(target->obj);
{

bool HIT_SPARK = false;
Expand Down

0 comments on commit b85cece

Please sign in to comment.