本文整理汇总了C++中IshipIGC::GetPrivateData方法的典型用法代码示例。如果您正苦于以下问题:C++ IshipIGC::GetPrivateData方法的具体用法?C++ IshipIGC::GetPrivateData怎么用?C++ IshipIGC::GetPrivateData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IshipIGC
的用法示例。
在下文中一共展示了IshipIGC::GetPrivateData方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}
}
}
}
}
示例3: ShipStatusSpotted
void CFSShip::ShipStatusSpotted(IsideIGC* pside)
{
SideID sideID = pside->GetObjectID();
SectorID sectorID;
{
IclusterIGC* pcluster = GetIGCShip()->GetCluster();
if (pcluster == NULL)
{
IstationIGC* pstation = GetIGCShip()->GetStation();
assert (pstation);
pcluster = pstation->GetCluster();
}
sectorID = pcluster->GetObjectID();
}
ShipStatus* pss = &m_rgShipStatus[sideID];
pss->SetStateTime(g.timeNow.clock());
pss->SetState(c_ssFlying);
pss->SetParentID(NA);
pss->SetHullID(GetIGCShip()->GetHullType()->GetObjectID());
pss->SetSectorID(sectorID);
//Flag that we have been detected as well
IsideIGC* mySide = GetSide();
SideID mySideID = mySide->GetObjectID();
if (mySide != pside && !mySide->AlliedSides(mySide, pside)) //#ALLY -was: mySide != pside (Imago fixed 7/8/09)
m_rgShipStatus[mySideID].SetDetected(true);
//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->SetState((pship->GetTurretID() == NA) ? c_ssObserver : c_ssTurret);
pss->SetHullID(NA);
pss->SetSectorID(sectorID);
pss->SetParentID(GetShipID());
if (mySide != pside && !mySide->AlliedSides(mySide, pside)) //#ALLY -was != (Imago fixed 7/8/09)
pfsship->GetShipStatus(mySideID)->SetDetected(true);
}
}
}
示例4: 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);
}
}
}
示例5: 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;
}
示例6: SetCluster
//This should only be called from the ChangeCluster() callback.
void CFSPlayer::SetCluster(IclusterIGC* pcluster, bool bViewOnly)
{
CFSShip::SetCluster(pcluster, bViewOnly);
if (pcluster)
{
SetDPGroup((CFSCluster*)(pcluster->GetPrivateData()), true);
IshipIGC* pshipParent = GetIGCShip()->GetParentShip();
if ((pshipParent == NULL) || bViewOnly)
{
ShipID shipID = GetIGCShip()->GetObjectID();
assert(0 == g.fm.CbUsedSpaceInOutbox());
if (!bViewOnly)
{
//Move the player to his destination
BEGIN_PFM_CREATE(g.fm, pfmSetCluster, S, SET_CLUSTER)
END_PFM_CREATE
pfmSetCluster->sectorID = pcluster->GetObjectID();
//Send the position of the parent ship if we are a child, otherwise our position
IshipIGC* pshipSource = pshipParent ? pshipParent : GetIGCShip();
pshipSource->ExportShipUpdate(&(pfmSetCluster->shipupdate));
pfmSetCluster->cookie = NewCookie();
}
{
for (ShipLinkIGC* pshiplink = pcluster->GetShips()->first(); pshiplink; pshiplink = pshiplink->next())
{
IshipIGC * pshipExist = pshiplink->data();
if ((pshipExist != GetIGCShip()) && (pshipExist != pshipParent))
{
IshipIGC* pshipExistParent = pshipExist->GetParentShip();
//Tell the new player where the existing ship is/was
//provided the existing ship is not the child of some other ship
//and is not the parent of the new ship
if (pshipExistParent == NULL)
{
CFSShip * pfsShipExist = (CFSShip *) pshipExist->GetPrivateData();
pfsShipExist->QueueLoadoutChange();
BEGIN_PFM_CREATE(g.fm, pfmSSU, S, SINGLE_SHIP_UPDATE)
END_PFM_CREATE
//Always use the ship update based on the server's current view of the universe
//(this shouldn't be a lot worse than anything the player sent and it is easier)
pshipExist->ExportShipUpdate(&(pfmSSU->shipupdate));
{
ImodelIGC* pmodelTarget = pshipExist->GetCommandTarget(c_cmdCurrent);
if (pmodelTarget)
{
pfmSSU->otTarget = pmodelTarget->GetObjectType();
pfmSSU->oidTarget = pmodelTarget->GetObjectID();
}
else
{
pfmSSU->otTarget = NA;
pfmSSU->oidTarget = NA;
}
}
pfmSSU->bIsRipcording = pshipExist->fRipcordActive();
}
}
}
}
{
// Let's build up a list of station updates so we can batch 'em down
IsideIGC* pside = GetIGCShip()->GetSide();
{
const StationListIGC * pstnlist = pcluster->GetStations();
int nStations = 0;
{
//Count the number of visible stations
for (StationLinkIGC* pstnlink = pstnlist->first(); pstnlink; pstnlink = pstnlink->next())
{
IstationIGC* pstation = pstnlink->data();
if (pstation->SeenBySide(pside))
nStations++;
}
}
if (nStations != 0)
{
// tell the client what happened
BEGIN_PFM_CREATE(g.fm, pfmStationsUpdate, S, STATIONS_UPDATE)
FM_VAR_PARM(NULL, nStations * sizeof(StationState))
END_PFM_CREATE
StationState* pss = (StationState*)(FM_VAR_REF(pfmStationsUpdate, rgStationStates));
for (StationLinkIGC* pstnlink = pstnlist->first(); pstnlink; pstnlink = pstnlink->next())
{
IstationIGC * pstation = pstnlink->data();
if (pstation->SeenBySide(pside))
{
//.........这里部分代码省略.........
示例7: SetAutoDonate
void CFSPlayer::SetAutoDonate(CFSPlayer* pplayer, Money amount, bool bSend)
{
assert (pplayer != this);
ShipID sidDonateBy = GetShipID();
ShipID sidDonateTo;
IshipIGC* pship;
if (pplayer)
{
pship = pplayer->GetIGCShip()->GetAutoDonate();
if (pship == NULL)
pship = pplayer->GetIGCShip();
else
{
assert (pship->GetAutoDonate() == NULL);
CFSPlayer* pplayerNew = ((CFSShip*)(pship->GetPrivateData()))->GetPlayer();
if (pplayerNew == this)
{
//We are trying to autodonate to someone who is already autodonating to us
//Tell them to stop first (but don't send any messages)
pplayer->SetAutoDonate(NULL, 0, false);
//and then set our autodonate to go to them anyhow
pship = pplayer->GetIGCShip();
}
else
{
//The person we would like to donate to was already donating to someone else
//donate to who ever they were donating to.
pplayer = pplayerNew;
}
}
assert (pship->GetAutoDonate() == NULL);
assert (pplayer->GetIGCShip() == pship);
sidDonateTo = pship->GetObjectID();
if (amount != 0)
{
TrapHack(GetMoney() >= amount);
pplayer->SetMoney(amount + pplayer->GetMoney());
SetMoney(GetMoney() - amount);
}
}
else
{
pship = NULL;
sidDonateTo = NA;
}
GetIGCShip()->SetAutoDonate(pship);
BEGIN_PFM_CREATE(g.fm, pfmAD, S, AUTODONATE)
END_PFM_CREATE
pfmAD->sidDonateBy = sidDonateBy;
pfmAD->sidDonateTo = sidDonateTo;
pfmAD->amount = amount;
if (bSend)
g.fm.SendMessages(CFSSide::FromIGC(GetSide())->GetGroup(), FM_GUARANTEED, FM_FLUSH);
}