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); } } }
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); } } }