Skip to content

Commit

Permalink
CEntity::KillEntity: Detach Actor from Vehicle or Mounted Weapon upon…
Browse files Browse the repository at this point in the history
… death to circumvent crash with character_physics_support
  • Loading branch information
revolucas committed Sep 17, 2016
1 parent 473004e commit 9701519
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/xrGame/Actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,15 +244,14 @@ struct SDefNewsMsg{
void detach_Vehicle ();
void steer_Vehicle (float angle);
void attach_Vehicle (CHolderCustom* vehicle);

bool use_MountedWeapon (CHolderCustom* object);
virtual bool can_attach (const CInventoryItem *inventory_item) const;
protected:
CHolderCustom* m_holder;
u16 m_holderID;
bool use_Holder (CHolderCustom* holder);

bool use_Vehicle (CHolderCustom* object);
bool use_MountedWeapon (CHolderCustom* object);
void ActorUse ();

protected:
Expand Down
5 changes: 5 additions & 0 deletions src/xrGame/Entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,11 @@ void CEntity::net_Destroy ()

void CEntity::KillEntity(u16 whoID)
{
if (this->ID() == Actor()->ID())
{
Actor()->detach_Vehicle();
Actor()->use_MountedWeapon(NULL);
}
if (whoID != ID()) {
#ifdef DEBUG
if (m_killer_id != ALife::_OBJECT_ID(-1)) {
Expand Down

0 comments on commit 9701519

Please sign in to comment.