#include <src/Misc/SWTypes/Nuke.h>
List of all members.
Constructor & Destructor Documentation
SW_NuclearMissile::SW_NuclearMissile |
( |
| ) |
[inline] |
virtual SW_NuclearMissile::~SW_NuclearMissile |
( |
| ) |
[inline, virtual] |
Member Function Documentation
virtual const char* SW_NuclearMissile::GetTypeString |
( |
| ) |
[inline, virtual] |
bool SW_NuclearMissile::HandlesType |
( |
int |
type | ) |
[virtual] |
Reimplemented from NewSWType.
{
return (type == SuperWeaponType::Nuke);
}
void SW_NuclearMissile::Initialize |
( |
SWTypeExt::ExtData * |
pData, |
|
|
SuperWeaponTypeClass * |
pSW |
|
) |
| [virtual] |
bool SW_NuclearMissile::Launch |
( |
SuperClass * |
pThis, |
|
|
CellStruct * |
pCoords, |
|
|
byte |
IsPlayer |
|
) |
| [virtual] |
Implements NewSWType.
{
if(pThis->IsCharged) {
SuperWeaponTypeClass *pType = pThis->Type;
if(SWTypeExt::ExtData *pData = SWTypeExt::ExtMap.Find(pType)) {
CellClass* pCell = MapClass::Instance->GetCellAt(pCoords);
CoordStruct target;
pCell->GetCoordsWithBridge(&target);
BuildingClass* pSilo = NULL;
if((!pThis->Granted || !pThis->Quantity) && pData->Nuke_SiloLaunch.Get()) {
for(int i=0; i<BuildingTypeClass::Array->Count; ++i) {
BuildingTypeClass *pTBld = BuildingTypeClass::Array->GetItem(i);
if(pTBld->NukeSilo) {
if(pTBld->SuperWeapon == pType->ArrayIndex || pTBld->SuperWeapon2 == pType->ArrayIndex) {
if((pSilo = pThis->Owner->FindBuildingOfType(pTBld->ArrayIndex, -1)) != NULL) {
break;
}
}
}
}
}
bool fired = false;
if(pSilo) {
Debug::Log("Nuke launched from Missile Silo, type %s.\n", pSilo->Type->ID);
pSilo->FiringSWType = pType->ArrayIndex;
pSilo->QueueMission(mission_Missile, false);
pSilo->NextMission();
pThis->Owner->NukeTarget = *pCoords;
fired = true;
}
if(!fired) {
Debug::Log("Nuke launched manually.\n");
if(WeaponTypeClass *pWeapon = pData->Nuke_Payload) {
if(BulletTypeClass *pProjectile = pWeapon->Projectile) {
int damage = (pData->SW_Damage < 0 ? pWeapon->Damage : pData->SW_Damage.Get());
WarheadTypeClass *pWarhead = (!pData->SW_Warhead ? pWeapon->Warhead : pData->SW_Warhead.Get());
if(BulletClass* pBullet = pProjectile->CreateBullet(pCell, NULL, damage, pWarhead, pWeapon->Speed, pWeapon->Bright)) {
pBullet->SetWeaponType(pWeapon);
if(pData->Nuke_PsiWarning.Get()) {
pThis->Owner->PsiWarn(pCell, pBullet, pData->Nuke_PsiWarning.Get()->ID);
}
if(BulletExt::ExtData *pData = BulletExt::ExtMap.Find(pBullet)) {
pData->NukeSW = pType;
}
if(pBullet) {
BulletVelocity vel;
vel.X = 0;
vel.Y = 0;
vel.Z = -100;
CoordStruct high = target;
high.Z += 20000;
pBullet->MoveTo(&high, &vel);
fired = true;
}
}
}
}
}
if(fired) {
if(pData->SW_RadarEvent.Get()) {
if(pThis->Owner->IsAlliedWith(HouseClass::Player)) {
RadarEventClass::Create(RADAREVENT_SUPERWEAPONLAUNCHED, *pCoords);
}
}
VocClass::PlayAt(pData->SW_ActivationSound, &target, NULL);
pThis->Owner->ShouldRecheckTechTree = true;
return true;
}
}
}
return false;
}
void SW_NuclearMissile::LoadFromINI |
( |
SWTypeExt::ExtData * |
pData, |
|
|
SuperWeaponTypeClass * |
pSW, |
|
|
CCINIClass * |
pINI |
|
) |
| [virtual] |
Reimplemented from NewSWType.
{
const char * section = pSW->ID;
if(!pINI->GetSection(section)) {
return;
}
INI_EX exINI(pINI);
pData->Nuke_Payload.Parse(&exINI, section, "Nuke.Payload", true);
pData->Nuke_TakeOff.Parse(&exINI, section, "Nuke.TakeOff");
pData->Nuke_PsiWarning.Parse(&exINI, section, "Nuke.PsiWarning");
pData->Nuke_SiloLaunch.Read(&exINI, section, "Nuke.SiloLaunch");
Debug::Log("[Nuke] basics %s: ", section);
Debug::Log("%s, ", pData->SW_Warhead.Get() ? pData->SW_Warhead.Get()->ID : "<empty>");
Debug::Log("%d, ", pData->SW_Damage.Get());
Debug::Log("%s\n", pData->AttachedToObject->WeaponType ? pData->AttachedToObject->WeaponType->ID : "<empty>");
Debug::Log("[Nuke] parsing %s: ", section);
Debug::Log("%s, ", pData->Nuke_Payload.Get() ? pData->Nuke_Payload.Get()->ID : "<empty>");
Debug::Log("%s, ", pData->Nuke_TakeOff.Get() ? pData->Nuke_TakeOff.Get()->ID : "<empty>");
Debug::Log("%s, ", pData->Nuke_PsiWarning.Get() ? pData->Nuke_PsiWarning.Get()->ID : "<empty>");
Debug::Log("%d\n", pData->Nuke_SiloLaunch.Get());
}
Member Data Documentation
The documentation for this class was generated from the following files: