Skip to content
Merged
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 @@ -112,6 +112,11 @@ class OverlordContain : public TransportContain
virtual Bool getContainerPipsToShow(Int& numTotal, Int& numFull);
virtual void createPayload();

virtual short getRiderSlot(ObjectID riderID) const;
virtual short getPortableSlot(ObjectID portableID) const;
virtual const ContainedItemsList* getAddOnList() const;
virtual ContainedItemsList* getAddOnList();

private:
/**< An empty overlord is a conatiner, but a full one redirects calls to its passengers. If this returns NULL,
we are either empty or carrying a non container.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ Bool OverlordContain::isKickOutOnCapture()
void OverlordContain::addToContainList( Object *obj )
{
// Do you mean me the Overlord, or my behavior of passing stuff on to my passengers?
if( getRedirectedContain() == NULL )
if( getRedirectedContain() == NULL || obj->isKindOf(KINDOF_PORTABLE_STRUCTURE))
{
TransportContain::addToContainList( obj );
return;
Expand All @@ -288,7 +288,7 @@ void OverlordContain::addToContainList( Object *obj )
void OverlordContain::addToContain( Object *obj )
{
// Do you mean me the Overlord, or my behavior of passing stuff on to my passengers?
if( getRedirectedContain() == NULL )
if( getRedirectedContain() == NULL || obj->isKindOf(KINDOF_PORTABLE_STRUCTURE))
{
TransportContain::addToContain( obj );
return;
Expand All @@ -306,7 +306,7 @@ void OverlordContain::addToContain( Object *obj )
void OverlordContain::removeFromContain( Object *obj, Bool exposeStealthUnits )
{
// Do you mean me the Overlord, or my behavior of passing stuff on to my passengers?
if( getRedirectedContain() == NULL )
if( getRedirectedContain() == NULL || obj->isKindOf(KINDOF_PORTABLE_STRUCTURE))
{
TransportContain::removeFromContain( obj, exposeStealthUnits );
return;
Expand Down Expand Up @@ -360,7 +360,7 @@ void OverlordContain::iterateContained( ContainIterateFunc func, void *userData,
void OverlordContain::onContaining( Object *obj, Bool wasSelected )
{
// Do you mean me the Overlord, or my behavior of passing stuff on to my passengers?
if( getRedirectedContain() == NULL )
if( getRedirectedContain() == NULL || obj->isKindOf(KINDOF_PORTABLE_STRUCTURE))
{
TransportContain::onContaining( obj, wasSelected );

Expand Down Expand Up @@ -415,7 +415,7 @@ void OverlordContain::killAllContained( void )
void OverlordContain::onRemoving( Object *obj )
{
// Do you mean me the Overlord, or my behavior of passing stuff on to my passengers?
if( getRedirectedContain() == NULL )
if( getRedirectedContain() == NULL || obj->isKindOf(KINDOF_PORTABLE_STRUCTURE))
{
TransportContain::onRemoving( obj );
return;
Expand All @@ -431,7 +431,7 @@ void OverlordContain::onRemoving( Object *obj )
Bool OverlordContain::isValidContainerFor(const Object* obj, Bool checkCapacity) const
{
// Do you mean me the Overlord, or my behavior of passing stuff on to my passengers?
if( getRedirectedContain() == NULL )
if( getRedirectedContain() == NULL || obj->isKindOf(KINDOF_PORTABLE_STRUCTURE))
return TransportContain::isValidContainerFor( obj, checkCapacity );

return getRedirectedContain()->isValidContainerFor( obj, checkCapacity );
Expand Down Expand Up @@ -492,7 +492,8 @@ Bool OverlordContain::isEnclosingContainerFor( const Object *obj ) const
// for Overlord subObjects, once I have a passenger, _I_ become a transport of their type.
// So, the answer to this question depends on if it is my passenger asking, or theirs.
// As always, I can't use convience functions that get redirected on a ? like this.
if( m_containListSize > 0 && obj == m_containList.front() )
//if( m_containListSize > 0 && obj == m_containList.front() )
if( m_containListSize > 0 && obj->isKindOf(KINDOF_PORTABLE_STRUCTURE) )
return FALSE;

return TRUE;
Expand Down Expand Up @@ -587,7 +588,34 @@ Bool OverlordContain::isPassengerAllowedToFire( ObjectID id ) const
return TransportContain::isPassengerAllowedToFire();
}

const ContainedItemsList* OverlordContain::getAddOnList() const
{
return &m_containList;
}

ContainedItemsList* OverlordContain::getAddOnList() {
return &m_containList;
}

short OverlordContain::getRiderSlot(ObjectID riderID) const {
ContainedItemsList::const_iterator it;
it = m_containList.begin();

short idx = 0;
while (it != m_containList.end())
{
Object* object = *it;
if (object->getID() == riderID) {
return idx;
}
++idx;
++it;
}
return -1;
}
short OverlordContain::getPortableSlot(ObjectID portableID) const {
return getRiderSlot(portableID);
}

// ------------------------------------------------------------------------------------------------
/** CRC */
Expand Down