Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class CaveContain : public OpenContain, public CreateModuleInterface, public Cav
virtual UnsignedInt getContainCount() const override;
virtual Int getContainMax() const override;
virtual const ContainedItemsList* getContainedItemsList() const override;
virtual Bool isSharedContainer() const override { return TRUE; }
virtual Bool isKickOutOnCapture() override { return FALSE; }///< Caves and Tunnels don't kick out on capture.

// override the onDie we inherit from OpenContain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ class ContainModuleInterface
virtual Bool isSpecialZeroSlotContainer() const = 0;
virtual Bool isHealContain() const = 0;
virtual Bool isTunnelContain() const = 0;
virtual Bool isSharedContainer() const = 0;
virtual Bool isImmuneToClearBuildingAttacks() const = 0;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ class OpenContain : public UpdateModule,
virtual Bool isGarrisonable() const override { return false; } ///< can this unit be Garrisoned? (ick)
virtual Bool isHealContain() const override { return false; } ///< true when container only contains units while healing (not a transport!)
virtual Bool isTunnelContain() const override { return FALSE; }
virtual Bool isSharedContainer() const override { return FALSE; }
virtual Bool isSpecialZeroSlotContainer() const override { return false; }
virtual Bool isImmuneToClearBuildingAttacks() const override { return true; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class TunnelContain : public OpenContain, public CreateModuleInterface
virtual OpenContain *asOpenContain() override { return this; } ///< treat as open container
virtual Bool isGarrisonable() const override { return false; } ///< can this unit be Garrisoned? (ick)
virtual Bool isHealContain() const override { return false; } ///< true when container only contains units while healing (not a transport!)
virtual Bool isSharedContainer() const override { return TRUE; }
virtual Bool isImmuneToClearBuildingAttacks() const override { return true; }

virtual void onContaining( Object *obj ) override; ///< object now contains 'obj'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3658,6 +3658,24 @@ void AIUpdateInterface::privateCombatDrop( Object *target, const Coord3D& pos, C
}
}

//----------------------------------------------------------------------------------------
#if !RETAIL_COMPATIBLE_CRC
static Bool isContainedBy( const Object *us, const Object *container )
{
if (us->getContainedBy() == container)
return TRUE;

// A shared container holds one passenger list for the whole network, so a passenger is contained
// by the endpoint it entered and not by the one that was ordered to unload.
const ContainModuleInterface *contain = container->getContain();
if (contain == nullptr || !contain->isSharedContainer())
return FALSE;

const ContainedItemsList *items = contain->getContainedItemsList();
return items != nullptr && std::find(items->begin(), items->end(), us) != items->end();
}
#endif

//----------------------------------------------------------------------------------------
/**
* Get out of whatever it is inside of
Expand All @@ -3674,12 +3692,10 @@ void AIUpdateInterface::privateExit( Object *objectToExit, CommandSourceType cmd
}
else
{
// TheSuperHackers @bugfix Caball009 10/08/2026 Don't process invalid exit commands,
// TheSuperHackers @bugfix Caball009 / Okladnoj 10/08/2026 Don't process invalid exit commands,
// because an object should not attempt to exit something it's not contained by.
#if !RETAIL_COMPATIBLE_CRC
// @todo Remove function parameter 'objectToExit' because it's become obsolete.

if (us->getContainedBy() != objectToExit)
if (!isContainedBy(us, objectToExit))
return;
#endif
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class CaveContain : public OpenContain, public CreateModuleInterface, public Cav
virtual UnsignedInt getContainCount() const override;
virtual Int getContainMax() const override;
virtual const ContainedItemsList* getContainedItemsList() const override;
virtual Bool isSharedContainer() const override { return TRUE; }
virtual Bool isKickOutOnCapture() override { return FALSE; }///< Caves and Tunnels don't kick out on capture.

// override the onDie we inherit from OpenContain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class ContainModuleInterface
virtual Bool isSpecialZeroSlotContainer() const = 0;
virtual Bool isHealContain() const = 0;
virtual Bool isTunnelContain() const = 0;
virtual Bool isSharedContainer() const = 0;
virtual Bool isRiderChangeContain() const = 0;
virtual Bool isImmuneToClearBuildingAttacks() const = 0;
virtual Bool isSpecialOverlordStyleContainer() const = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ class OpenContain : public UpdateModule,
virtual Bool isBustable() const override { return false; } ///< can this container get busted by a bunkerbuster
virtual Bool isHealContain() const override { return false; } ///< true when container only contains units while healing (not a transport!)
virtual Bool isTunnelContain() const override { return FALSE; }
virtual Bool isSharedContainer() const override { return FALSE; }
virtual Bool isRiderChangeContain() const override { return FALSE; }
virtual Bool isSpecialZeroSlotContainer() const override { return false; }
virtual Bool isImmuneToClearBuildingAttacks() const override { return true; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class TunnelContain : public OpenContain, public CreateModuleInterface
virtual Bool isBustable() const override { return TRUE; } ///< can this container get busted by a bunkerbuster
virtual Bool isHealContain() const override { return false; } ///< true when container only contains units while healing (not a transport!)
virtual Bool isTunnelContain() const override { return TRUE; }
virtual Bool isSharedContainer() const override { return TRUE; }
virtual Bool isImmuneToClearBuildingAttacks() const override { return true; }
virtual Bool isSpecialOverlordStyleContainer() const override {return FALSE;}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3813,6 +3813,24 @@ void AIUpdateInterface::privateCombatDrop( Object *target, const Coord3D& pos, C
}
}

//----------------------------------------------------------------------------------------
#if !RETAIL_COMPATIBLE_CRC
static Bool isContainedBy( const Object *us, const Object *container )
{
if (us->getContainedBy() == container)
return TRUE;

// A shared container holds one passenger list for the whole network, so a passenger is contained
// by the endpoint it entered and not by the one that was ordered to unload.
const ContainModuleInterface *contain = container->getContain();
if (contain == nullptr || !contain->isSharedContainer())
return FALSE;

const ContainedItemsList *items = contain->getContainedItemsList();
return items != nullptr && std::find(items->begin(), items->end(), us) != items->end();
}
#endif

//----------------------------------------------------------------------------------------
/**
* Get out of whatever it is inside of
Expand All @@ -3829,12 +3847,10 @@ void AIUpdateInterface::privateExit( Object *objectToExit, CommandSourceType cmd
}
else
{
// TheSuperHackers @bugfix Caball009 10/08/2026 Don't process invalid exit commands,
// TheSuperHackers @bugfix Caball009 / Okladnoj 10/08/2026 Don't process invalid exit commands,
// because an object should not attempt to exit something it's not contained by.
#if !RETAIL_COMPATIBLE_CRC
// @todo Remove function parameter 'objectToExit' because it's become obsolete.

if (us->getContainedBy() != objectToExit)
if (!isContainedBy(us, objectToExit))
return;
#endif
}
Expand Down Expand Up @@ -3868,12 +3884,10 @@ void AIUpdateInterface::privateExitInstantly( Object *objectToExit, CommandSourc
}
else
{
// TheSuperHackers @bugfix Caball009 10/08/2026 Don't process invalid exit commands,
// TheSuperHackers @bugfix Caball009 / Okladnoj 10/08/2026 Don't process invalid exit commands,
// because an object should not attempt to exit something it's not contained by.
#if !RETAIL_COMPATIBLE_CRC
// @todo Remove function parameter 'objectToExit' because it's become obsolete.

if (us->getContainedBy() != objectToExit)
if (!isContainedBy(us, objectToExit))
return;
#endif
}
Expand Down
Loading