Ares
Public Member Functions

SW_GenericWarhead Class Reference

#include <src/Misc/SWTypes/GenericWarhead.h>

Inheritance diagram for SW_GenericWarhead:
NewSWType

List of all members.

Public Member Functions

 SW_GenericWarhead ()
virtual ~SW_GenericWarhead ()
virtual const char * GetTypeString ()
virtual void Initialize (SWTypeExt::ExtData *pData, SuperWeaponTypeClass *pSW)
virtual bool Launch (SuperClass *pThis, CellStruct *pCoords, byte IsPlayer)

Constructor & Destructor Documentation

SW_GenericWarhead::SW_GenericWarhead ( ) [inline]
                                    : NewSWType()
                        { };
virtual SW_GenericWarhead::~SW_GenericWarhead ( ) [inline, virtual]
                        { };

Member Function Documentation

virtual const char* SW_GenericWarhead::GetTypeString ( ) [inline, virtual]

Reimplemented from NewSWType.

                        { return "GenericWarhead"; }
void SW_GenericWarhead::Initialize ( SWTypeExt::ExtData pData,
SuperWeaponTypeClass *  pSW 
) [virtual]
bool SW_GenericWarhead::Launch ( SuperClass *  pThis,
CellStruct *  pCoords,
byte  IsPlayer 
) [virtual]

Implements NewSWType.

{
        SuperWeaponTypeClass *pType = pThis->Type;
        SWTypeExt::ExtData *pData = SWTypeExt::ExtMap.Find(pType);

        if(!pData || !pData->SW_Warhead) {
                Debug::Log("Couldn't launch GenericWarhead SW ([%s])\n", pType->ID);
                return 0;
        }

        CoordStruct coords;
        CellClass *Cell = MapClass::Instance->GetCellAt(pCoords);
        Cell->GetCoordsWithBridge(&coords);

        auto pWHExt = WarheadTypeExt::ExtMap.Find(pData->SW_Warhead);

        // crush, kill, destroy
        // NULL -> TechnoClass* SourceObject
        pWHExt->applyRipples(&coords);
        pWHExt->applyIronCurtain(&coords, pThis->Owner, pData->SW_Damage);

        BuildingClass *Firer = NULL;
        HouseClass *FirerHouse = pThis->Owner;
        for(int i = 0; i < FirerHouse->Buildings.Count; ++i) {
                BuildingClass *B = FirerHouse->Buildings[i];
                if(B->HasSuperWeapon(pThis->Type->ArrayIndex)) {
                        Firer = B;
                        break;
                }
        }

        pWHExt->applyEMP(&coords, Firer);

        if(!pWHExt->applyPermaMC(&coords, pThis->Owner, Cell->GetContent())) {
                MapClass::DamageArea(&coords, pData->SW_Damage, Firer, pData->SW_Warhead, 1, pThis->Owner);
                if(AnimTypeClass * DamageAnimType = MapClass::SelectDamageAnimation(pData->SW_Damage, pData->SW_Warhead, Cell->LandType, &coords)) {
                        AnimClass *DamageAnim;
                        GAME_ALLOC(AnimClass, DamageAnim, DamageAnimType, &coords);
                }
                MapClass::FlashbangWarheadAt(pData->SW_Damage, pData->SW_Warhead, coords, false, 0);
        }

        return 1;
}

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