本文整理汇总了C++中IshipIGC类的典型用法代码示例。如果您正苦于以下问题:C++ IshipIGC类的具体用法?C++ IshipIGC怎么用?C++ IshipIGC使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IshipIGC类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void CFSShip::ShipStatusWarped(IwarpIGC* pwarp)
{
SectorID sectorID = pwarp->GetDestination()->GetCluster()->GetObjectID();
for (SideLinkIGC* psl = GetMission()->GetIGCMission()->GetSides()->first();
(psl != NULL);
psl = psl->next())
{
IsideIGC* pside = psl->data();
if ((GetIGCShip()->SeenBySide(pside)) && (pwarp->SeenBySide(pside)))
{
SideID sideID = pside->GetObjectID();
m_rgShipStatus[sideID].SetSectorID(sectorID);
//Adjust the ship status for all of the children as well
{
for (ShipLinkIGC* psl = GetIGCShip()->GetChildShips()->first();
(psl != NULL);
psl = psl->next())
{
IshipIGC* pship = psl->data();
ShipStatus* pss = ((CFSShip*)(pship->GetPrivateData()))->GetShipStatus(sideID);
pss->SetSectorID(sectorID);
}
}
}
}
}
示例2: GetWindow
//------------------------------------------------------------------------------
void SetCommandAction::Execute (void)
{
// get a pointer to the actual ship and the target
IshipIGC* pShip = static_cast<IshipIGC*> (static_cast<ImodelIGC*> (*m_pShip));
ImodelIGC* pTarget = static_cast<ImodelIGC*> (*m_pTarget);
// the ship might not be there for any of a hundred reasons,
// including that it was destroyed. If it's not there, we want
// to skip setting its command.
if (pShip)
{
// we want to use the pretty interface if this is a command for the player
if ((pShip == trekClient.GetShip ()) and (m_command == c_cmdQueued))
{
TrekWindow* pWindow = GetWindow ();
IshipIGC* pCommander = g_pMission->GetCommanderShip ();
ZString strOrder = ZString (c_cdAllCommands[m_commandID].szVerb);
if (pTarget)
strOrder = strOrder + " " + GetModelName (pTarget);
pWindow->SetQueuedCommand (pCommander, m_commandID, pTarget);
trekClient.PostText(true, "New orders from %s to %s: %s. Press [insert] to accept.", (const char*)GetModelName (pCommander), GetModelName (pShip), (const char*) strOrder);
}
else
pShip->SetCommand (m_command, pTarget, m_commandID);
}
}
示例3: LoadUniverse
//------------------------------------------------------------------------------
void Mission5::CreateUniverse (void)
{
LoadUniverse ("training_5", 412, 1050); // an intercepter
// put the commander ship in the station
ImissionIGC* pCore = trekClient.GetCore();
ImodelIGC* pStation = pCore->GetModel (OT_station, 1050);
IshipIGC* pCommander = pCore->GetShip (m_commanderID);
pCommander->SetStation (static_cast<IstationIGC*> (pStation));
pCommander->SetCommand (c_cmdAccepted, NULL, c_cidDoNothing);
pCommander->SetCommand (c_cmdCurrent, NULL, c_cidDoNothing);
pCommander->SetAutopilot (false);
}
示例4: GetIGCShip
void CFSShip::ShipStatusDocked(IstationIGC* pstation)
{
StationID stationID = pstation->GetObjectID();
SectorID sectorID = pstation->GetCluster()->GetObjectID();
HullID hullID;
{
IhullTypeIGC* pht = GetIGCShip()->GetBaseHullType();
hullID = pht ? pht->GetObjectID() : NA;
}
IsideIGC* psideMe = GetIGCShip()->GetSide();
for (SideLinkIGC* psl = GetMission()->GetIGCMission()->GetSides()->first();
(psl != NULL);
psl = psl->next())
{
IsideIGC* pside = psl->data();
if ((pside == psideMe || pside->AlliedSides(pside,psideMe)) || // #ALLY Imago 7/8/09 VISIBILITY?
(GetIGCShip()->SeenBySide(pside) && pstation->SeenBySide(pside)))
{
SideID sideID = pside->GetObjectID();
ShipStatus* pss = &(m_rgShipStatus[sideID]);
pss->SetStateTime(g.timeNow.clock());
pss->SetState(c_ssDocked);
pss->SetParentID(NA);
pss->SetStationID(stationID);
pss->SetSectorID(sectorID);
pss->SetHullID(hullID);
//Adjust the ship status for all of the children as well
{
for (ShipLinkIGC* psl = GetIGCShip()->GetChildShips()->first();
(psl != NULL);
psl = psl->next())
{
IshipIGC* pship = psl->data();
ShipStatus* pss = ((CFSShip*)(pship->GetPrivateData()))->GetShipStatus(sideID);
assert ((pship->GetTurretID() == NA)
? (pss->GetState() == c_ssObserver)
: (pss->GetState() == c_ssTurret));
assert (pss->GetParentID() == GetIGCShip()->GetObjectID());
assert (pss->GetHullID() == NA);
pss->SetStationID(stationID);
pss->SetSectorID(sectorID);
}
}
}
}
}
示例5: LoadUniverse
//------------------------------------------------------------------------------
void Mission4::CreateUniverse (void)
{
LoadUniverse ("training_3", 486, 1030); // an advanced stealth fighter
// stuff for setup
IshipIGC* pShip = trekClient.GetShip();
// set a global attribute to increase the overall energy of the ship
IsideIGC* pSide = pShip->GetSide ();
GlobalAttributeSet gas = pSide->GetGlobalAttributeSet ();
gas.SetAttribute (c_gaMaxEnergy, 10.0f);
pSide->SetGlobalAttributeSet (gas);
// put the commander ship in the station
ImissionIGC* pCore = trekClient.GetCore();
ImodelIGC* pStation = pCore->GetModel (OT_station, 1030);
IshipIGC* pCommander = pCore->GetShip (m_commanderID);
pCommander->SetStation (static_cast<IstationIGC*> (pStation));
pCommander->SetCommand (c_cmdAccepted, NULL, c_cidDoNothing);
pCommander->SetCommand (c_cmdCurrent, NULL, c_cidDoNothing);
pCommander->SetAutopilot (false);
// activate all the starting weapons
trekClient.fGroupFire = true;
// take the missiles off the ship
IpartIGC* pPart = pShip->GetMountedPart (ET_Magazine, 0);
if (pPart)
pPart->Terminate ();
}
示例6: GetSide
void CFSShip::ShipStatusHidden(IsideIGC* pside)
{
SideID sideID = pside->GetObjectID();
m_rgShipStatus[sideID].SetUnknown();
IsideIGC* mySide = GetSide();
SideID mySideID = mySide->GetObjectID();
//Does anyone see us?
bool detectedF = false;
{
CFSMission* pmission = this->GetMission();
if (pmission)
{
for (SideLinkIGC* psl = pmission->GetIGCMission()->GetSides()->first();
(psl != NULL);
psl = psl->next())
{
if (psl->data() != mySide && !mySide->AlliedSides(psl->data(), mySide)) //#ALLY -was: != (Imago fixed 7/8/09)
{
ShipStatus* pss = GetShipStatus(psl->data()->GetObjectID());
if (!pss->GetUnknown())
{
detectedF = true;
break;
}
}
}
}
}
m_rgShipStatus[mySideID].SetDetected(detectedF);
//Adjust the ship status for all of the children as well
{
for (ShipLinkIGC* psl = GetIGCShip()->GetChildShips()->first();
(psl != NULL);
psl = psl->next())
{
IshipIGC* pship = psl->data();
CFSShip* pfsShip = ((CFSShip*)(pship->GetPrivateData()));
ShipStatus* pss = pfsShip->GetShipStatus(sideID);
pss->SetUnknown();
pfsShip->GetShipStatus(mySideID)->SetDetected(detectedF);
}
}
}
示例7:
//------------------------------------------------------------------------------
void SetDroneNanAction::Execute (void)
{
IshipIGC* nanShip = trekClient.GetSide()->GetShip(nanShipID);
IpartIGC* pPart = nanShip->GetMountedPart (ET_Weapon, 0);
if (pPart)
pPart->Terminate ();
// Stick Nanite 2 on the front
PartData pd;
pd.partID = 190;
pd.mountID = 0;
pd.amount = 0;
nanShip->CreateAndAddPart (&pd);
}
示例8: LoadUniverse
//------------------------------------------------------------------------------
void Mission6::CreateUniverse (void)
{
LoadUniverse ("training_3", 488, 1030); // a fighter 3
// activate all the starting weapons
trekClient.fGroupFire = true;
// put the commander ship in the station
ImissionIGC* pCore = trekClient.GetCore();
ImodelIGC* pStation = pCore->GetModel (OT_station, 1030);
IshipIGC* pCommander = pCore->GetShip (m_commanderID);
pCommander->SetStation (static_cast<IstationIGC*> (pStation));
pCommander->SetCommand (c_cmdAccepted, NULL, c_cidDoNothing);
pCommander->SetCommand (c_cmdCurrent, NULL, c_cidDoNothing);
pCommander->SetAutopilot (false);
}
示例9: turnToFace
//------------------------------------------------------------------------------
void TurnToAction::Execute (void)
{
IshipIGC* pShip = static_cast<IshipIGC*> (static_cast<ImodelIGC*> (*m_pObject));
ImodelIGC* pTarget = static_cast<ImodelIGC*> (*m_pTarget);
if (pShip && pTarget)
{
Vector delta = pTarget->GetPosition () - pShip->GetPosition ();
turnToFace (delta, GetWindow ()->GetDeltaTime (), pShip, &g_setInputControls);
g_setInputControls.jsValues[c_axisYaw] *= 0.5f;
g_setInputControls.jsValues[c_axisPitch] *= 0.5f;
g_setInputControls.jsValues[c_axisRoll] *= 0.5f;
}
else
{
g_setInputControls.jsValues[c_axisYaw] = NA;
g_setInputControls.jsValues[c_axisPitch] = NA;
g_setInputControls.jsValues[c_axisRoll] = NA;
}
}
示例10: GetShips
bool CclusterIGC::IsFriendlyCluster(IsideIGC* pside, ClusterQuality cqlty) //Spunky #288
{
int balanceOfPower = 0;
//carrier or ASS in sector = not friendly - Spunky #290
ShipLinkIGC* pshipl = GetShips()->first();
if (pshipl)
{
do
{
IshipIGC* pship = pshipl->data();
if (pship->GetParentShip() == NULL)
if (pship->GetSide() != pside && pship->SeenBySide(pside) && !IsideIGC::AlliedSides(pside, pship->GetSide()))
{
if (pship->GetHullType()->HasCapability(c_habmIsRipcordTarget | c_habmIsLtRipcordTarget))
return false;
if (pship->GetBaseHullType()->GetScannerRange() > 800 && cqlty & cqNoEye)
return false;
balanceOfPower--;
}
else if (pship->GetSide() == pside || IsideIGC::AlliedSides(pside, pship->GetSide()))
balanceOfPower++;
pshipl = pshipl->next();
} while (pshipl);
}
if (balanceOfPower < 0 && cqlty & cqPositiveBOP)
return false;
//Spunky #333
StationLinkIGC* psl = GetStations()->first();
bool ourBaseInCluster = false;
if (psl)
{
do
{
IstationIGC* ps = psl->data();
if (!ps->GetStationType()->HasCapability(c_sabmPedestal) && ps->SeenBySide(pside))
{
if (pside != ps->GetSide() && !IsideIGC::AlliedSides(pside, ps->GetSide())) // #ALLY FIXED 7/10/09 imago
return false;
else
ourBaseInCluster = true;
}
psl = psl->next();
}
while (psl != NULL);
}
if (cqlty & cqIncludeNeutral || ourBaseInCluster)
return true;
else
return false;
}
示例11: assert
//------------------------------------------------------------------------------
/* ImodelIGC* */ CurrentTarget::operator ImodelIGC* (void)
{
// first, get the ship and its target
IshipIGC* pShip = static_cast<IshipIGC*> (static_cast<ImodelIGC*> (*m_pTarget));
assert (pShip);
ImodelIGC* pTarget = pShip->GetCommandTarget (c_cmdCurrent);
// there is an option to cache the target the first time this target is evaluated.
// if that option is set...
if (m_bLockOnFirstFetch)
{
// first check to see if we have done a fetch at all
if (not m_pFetched)
{
// we haven't cached a target yet, so we need to get the target
m_pFetched = new TypeIDTarget (pTarget ? pTarget->GetObjectType () : NA, pTarget ? pTarget->GetObjectID () : NA);
}
else
{
// we have cached a target, but the reason we want to cache the target is to
// determine if a kill has happened, e.g. has the target been eliminated. The
// problem is that the player may choose to change the target before
// eliminating it, and then we are stuck waiting on the original target. Here
// we check to see if the target has been changed w/o eliminating the
// original target, and if so, adjust to compensate.
ImodelIGC* pFetched = *m_pFetched;
if ((pFetched != pTarget) and pFetched and pTarget)
{
// there has been such a change, so set up a new abstract target
delete m_pFetched;
m_pFetched = new TypeIDTarget (pTarget ? pTarget->GetObjectType () : NA, pTarget ? pTarget->GetObjectID () : NA);
}
}
return (*m_pFetched);
}
// that option wasn't requested, so we just return the actual found target
return pTarget;
}
示例12: MannedTurrets
static int MannedTurrets(IshipIGC* pshipParent)
{
// loop through all of the ships on that side and count the ones
// that are turrets of this.
int cMannedTurrets = 0;
const ShipListIGC* shipList = pshipParent->GetSide()->GetShips();
for (const ShipLinkIGC* lShip = shipList->first(); lShip; lShip = lShip->next())
{
IshipIGC* pship = lShip->data();
PlayerInfo* pplayer = (PlayerInfo*)pship->GetPrivateData();
if (pplayer->LastSeenState() == c_ssTurret)
{
PlayerInfo* pplayerParent = trekClient.FindPlayer(pplayer->LastSeenParent());
if (pplayerParent && pplayerParent->GetShip() == pshipParent)
cMannedTurrets++;
}
}
return cMannedTurrets;
}
示例13: assert
void CweaponIGC::SetMountID(Mount newVal)
{
assert(m_ship);
if (newVal != m_mountID)
{
Deactivate();
if (m_pshipGunner)
SetGunner(NULL);
m_ship->MountPart(this, newVal, &m_mountID);
if (newVal >= 0)
{
//Get the corresponding hardpoint: we know one exists because the
//ship allowed the part to be mounted.
const IhullTypeIGC* pht = m_ship->GetBaseHullType();
assert(pht);
m_pposition = &(pht->GetWeaponPosition(newVal));
m_porientation = &(pht->GetWeaponOrientation(newVal));
//Is there a turret gunner in this position (who does not have a gun)
{
for (ShipLinkIGC* psl = m_ship->GetChildShips()->first(); (psl != NULL); psl = psl->next())
{
IshipIGC* pship = psl->data();
if (pship->GetTurretID() == newVal)
{
SetGunner(pship);
break;
}
}
}
}
}
}
示例14: GetWindow
//------------------------------------------------------------------------------
void Mission5::SetupShipAndCamera (void)
{
// needed parameters
IshipIGC* pShip = trekClient.GetShip ();
ImissionIGC* pCore = trekClient.GetCore ();
IstationIGC* pStation = pCore->GetStation (1050);
IclusterIGC* pCluster = pCore->GetCluster(GetStartSectorID ());
// set up the ship
trekClient.ResetClusterScanners(pShip->GetSide());
// put the ship in the station
pShip->SetStation (pStation);
// set up the outside view from the station
trekClient.SetViewCluster (pCluster);
// set up the camera
TrekWindow* pWindow = GetWindow ();
pWindow->SetViewMode (TrekWindow::vmCommand);
pWindow->PositionCommandView (NULL, 0.0);
pWindow->SetRadarMode (RadarImage::c_rlAll);
pWindow->EnableDisplacementCommandView (true);
}
示例15: if
//------------------------------------------------------------------------------
void CreateDroneAction::Execute (void)
{
if (m_sectorID == NA)
{
// figure some default location
}
IshipIGC* pShip = g_pMission->CreateDrone (m_name, m_shipID, m_hullID, m_sideID, m_pilotType);
pShip->SetPosition (m_position);
pShip->SetOrientation (m_orientation);
pShip->SetCluster (trekClient.GetCore ()->GetCluster(m_sectorID));
if (m_stationTypeID != NA)
pShip->SetBaseData (trekClient.GetCore ()->GetStationType (m_stationTypeID));
else if (m_expendableTypeID != NA)
pShip->SetBaseData (trekClient.GetCore ()->GetExpendableType (m_expendableTypeID));
}