Ares
Public Member Functions | Public Attributes

TechnoExt::ExtData Class Reference

#include <src/Ext/Techno/Body.h>

Inheritance diagram for TechnoExt::ExtData:
Extension< TT >

List of all members.

Public Member Functions

 ExtData (const DWORD Canary, TT *const OwnerObject)
virtual ~ExtData ()
virtual size_t Size () const
virtual void InvalidatePointer (void *ptr)
bool IsOperated ()
bool IsPowered ()
unsigned int AlphaFrame (SHPStruct *Image)
bool DrawVisualFX ()
UnitTypeClass * GetUnitType ()
bool IsDeactivated () const
eAction GetDeactivatedAction (ObjectClass *Hovered=NULL) const

Public Attributes

BYTE idxSlot_Wave
BYTE idxSlot_Beam
BYTE idxSlot_Warp
BYTE idxSlot_Parasite
bool Survivors_Done
TimerStruct CloakSkipTimer
SHPStruct * Insignia_Image
BuildingClass * GarrisonedIn
AnimClass * EMPSparkleAnim
eMission EMPLastMission
bool ShadowDrawnManually
JammerClassRadarJam
PoweredUnitClassPoweredUnit

Constructor & Destructor Documentation

TechnoExt::ExtData::ExtData ( const DWORD  Canary,
TT *const  OwnerObject 
) [inline]
                                                                   : Extension<TT>(Canary, OwnerObject),
                        idxSlot_Wave (0),
                        idxSlot_Beam (0),
                        idxSlot_Warp (0),
                        idxSlot_Parasite(0),
                        Survivors_Done (0),
                        Insignia_Image (NULL),
                        GarrisonedIn (NULL),
                        EMPSparkleAnim (NULL),
                        EMPLastMission (mission_None),
                        ShadowDrawnManually (false),
                        RadarJam(NULL),
                        PoweredUnit(NULL)
                        {
                                this->CloakSkipTimer.Stop();
                                // hope this works with the timing - I assume it does, since Types should be created before derivates thereof
                                //TechnoTypeExt::ExtData* TypeExt = TechnoTypeExt::ExtMap.Find(this->AttachedToObject->GetTechnoType());
                                /*if(TypeExt->RadarJamRadius) {
                                        RadarJam = new JammerClass(this->AttachedToObject, this); // now in hooks -> TechnoClass_Update_CheckOperators
                                }*/
                        };
virtual TechnoExt::ExtData::~ExtData ( ) [inline, virtual]
                                   {
                        //delete RadarJam; // now in hooks -> TechnoClass_Remove
                };

Member Function Documentation

unsigned int TechnoExt::ExtData::AlphaFrame ( SHPStruct *  Image)
                                                          {
        int countFrames = Conversions::Int2Highest(Image->Frames);
        DWORD Facing;
        this->AttachedToObject->Facing.GetFacing(&Facing);
        WORD F = (WORD)Facing;
        return (F >> (16 - countFrames));
}
bool TechnoExt::ExtData::DrawVisualFX ( )
                                    {
        TechnoClass * Object = this->AttachedToObject;
        if(Object->VisualCharacter(true, Object->Owner) == VisualType::Normal) {
                if(!Object->Disguised) {
                        return true;
                }
        }
        return false;
}
eAction TechnoExt::ExtData::GetDeactivatedAction ( ObjectClass *  Hovered = NULL) const
                                                                         {
        if(!Hovered) {
                return act_None;
        }
        if(auto tHovered = generic_cast<TechnoClass *>(Hovered)) {
                if(this->AttachedToObject->Owner->IsAlliedWith(tHovered)) {
                        if(tHovered->IsSelectable()) {
                                return act_Select;
                        }
                }
        }
        return act_None;
}
UnitTypeClass * TechnoExt::ExtData::GetUnitType ( )
                                              {
        if(UnitClass * U = specific_cast<UnitClass *>(this->AttachedToObject)) {
                TechnoTypeExt::ExtData * pData = TechnoTypeExt::ExtMap.Find(U->Type);
                if(pData->WaterImage && !U->OnBridge && U->GetCell()->LandType == lt_Water) {
                        return pData->WaterImage;
                }
        }
        return NULL;
}
virtual void TechnoExt::ExtData::InvalidatePointer ( void *  ptr) [inline, virtual]

Implements Extension< TT >.

                                                          {
                        AnnounceInvalidPointer(this->GarrisonedIn, ptr);
                }
bool TechnoExt::ExtData::IsDeactivated ( ) const
                                           {
        return this->AttachedToObject->Deactivated;
}
bool TechnoExt::ExtData::IsOperated ( )

This function checks if this object can currently be used, in terms of having or needing an operator.

Returns:
true if it needs an operator and has one, or if it doesn't need an operator in the first place. false if it needs an operator and doesn't have one.
Author:
Renegade
Date:
27.04.10
                                  {
        TechnoTypeExt::ExtData* TypeExt = TechnoTypeExt::ExtMap.Find(this->AttachedToObject->GetTechnoType());

        if(TypeExt->Operator) {
                if(this->AttachedToObject->Passengers.NumPassengers) {
                        // loop & condition come from D
                        for(ObjectClass* O = this->AttachedToObject->Passengers.GetFirstPassenger(); O; O = O->NextObject) {
                                if(FootClass *F = generic_cast<FootClass *>(O)) {
                                        if(F->GetType() == TypeExt->Operator) {
                                                // takes a specific operator and someone is present AND that someone is the operator, therefore it is operated
                                                return true;
                                        }
                                }
                        }
                        // takes a specific operator and someone is present, but it's not the operator, therefore it's not operated
                        return false;
                } else {
                        // takes a specific operator but no one is present, therefore it's not operated
                        return false;
                }
        } else if(TypeExt->IsAPromiscuousWhoreAndLetsAnyoneRideIt) {
                // takes anyone, therefore it's operated if anyone is there
                return (this->AttachedToObject->Passengers.NumPassengers > 0);
        } else {
                /* Isn't even set as an Operator-using object, therefore we are returning TRUE,
                 since, logically, if it doesn't need operators, it can be/is operated, no matter if there are passengers or not.
                 (Also, if we didn't do this, Reactivate() would fail for for non-Operator-units, for example.) */
                return true;
        }
}
bool TechnoExt::ExtData::IsPowered ( )

This function checks if this object can currently be used, in terms of having or needing a powering structure and that structure's status.

Returns:
true if it needs a structure and has an active one, or if it doesn't need a structure in the first place. false if it needs a structure and doesn't have an active one.
Author:
Renegade
Date:
27.04.10
                                 {
        TechnoTypeClass *TT = this->AttachedToObject->GetTechnoType();
        if(TT && TT->PoweredUnit) {
                HouseClass* Owner = this->AttachedToObject->Owner;
                for(int i = 0; i < Owner->Buildings.Count; ++i) {
                        BuildingClass* Building = Owner->Buildings.GetItem(i);
                        if(Building->Type->PowersUnit) {
                                if(Building->Type->PowersUnit == TT) {
                                        return Building->RegisteredAsPoweredUnitSource && !Building->IsUnderEMP(); // alternatively, HasPower, IsPowerOnline()
                                }
                        }
                }
                // if we reach this, we found no building that currently powers this object
                return false;
        // #617
        } else if(this->PoweredUnit) {
                return this->PoweredUnit->IsPowered();
        } else {
                // object doesn't need a particular powering structure, therefore, for the purposes of the game, it IS powered
                return true;
        }
}
virtual size_t TechnoExt::ExtData::Size ( ) const [inline, virtual]

Implements Extension< TT >.

{ return sizeof(*this); };

Member Data Documentation


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Defines