void CVehicleEntity::SetOccupant(BYTE byteSeatId, CPlayerEntity * pOccupant) { if(byteSeatId == 0) SetDriver(pOccupant); //else //SetPassenger((byteSeatId - 1), pOccupant); }
void CClientVehicle::SetOccupant(BYTE byteSeatId, CClientPlayer * pOccupant) { if(byteSeatId == 0) SetDriver(pOccupant); else SetPassenger((byteSeatId - 1), pOccupant); }
TestDatabase::TestDatabase(std::shared_ptr<DatabaseDriver> & driver, int target_version): books(new TestTableBooks), authors(new TestTableAuthors) { // set the driver (currently just SQLite) SetDriver(driver); // set up our tables AddTable(books); AddTable(authors); // handle migrations after setting the driver CheckVersion(target_version); }
bool CVehicleEntity::Destroy() { // Is the vehicle not spawned? if(!IsSpawned()) return false; // Remove driver and passengers if (m_pDriver) { m_pDriver->RemoveFromVehicle(); SetDriver(nullptr); } for (auto pPassenger : m_pPassengers) { if (pPassenger) { pPassenger->RemoveFromVehicle(); } } unsigned int handle = g_pCore->GetGame()->GetPools()->GetVehiclePool()->HandleOf(m_pVehicle->GetVehicle()); EFLC::CScript::MarkCarAsNoLongerNeeded(&handle); pIVehicleFactory->Delete(m_pVehicle->GetVehicle()); // Remove the vehicle model reference m_pModelInfo->RemoveReference(); // Delete the vehicle instance SAFE_DELETE(m_pVehicle); // Mark as not spawned m_bSpawned = false; return true; }
void EjectedPilotClass::InitLocalData(AircraftClass *ac, int mode, int no){ DrawableBSP *acBSP; int labelLen; _delayTime = SimLibElapsedTime + no * 2 * CampaignSeconds; // Initialize position, rotation, velocity, angular velocity. if (ac) { _pos = EP_VECTOR(ac->XPos(),ac->YPos(),ac->ZPos()); _rot[I_ROLL] = ac->Roll(); _rot[I_PITCH] = ac->Pitch(); _rot[I_YAW] = ac->Yaw(); _vel = EP_VECTOR(ac->XDelta(),ac->YDelta(),ac->ZDelta()); _aVel[I_ROLL] = ac->RollDelta(); _aVel[I_PITCH] = ac->PitchDelta(); _aVel[I_YAW] = ac->YawDelta(); } else { _pos = EP_VECTOR(XPos(),YPos(),ZPos()); _rot[I_ROLL] = Roll(); _rot[I_PITCH] = Pitch(); _rot[I_YAW] = Yaw(); _vel = EP_VECTOR(XDelta(),YDelta(),ZDelta()); _aVel[I_ROLL] = RollDelta(); _aVel[I_PITCH] = PitchDelta(); _aVel[I_YAW] = YawDelta(); } // Play with this value to change the signature of an // ejected pilot on the IR. SetPowerOutput(0); // sfr: not setters on this anymore //SetVt(0); //SetKias(0); // Initialize physical data. _pd = NULL; _stage = PD_START; // Initialize model data to NULL. _md = NULL; _model = MD_START; // Set the ejection mode. SetMode(mode); // Initialize run time and delta time. _runTime = 0.0; _deltaTime = 0.0; // We just set the type flag to "FalconSimEntity". SetTypeFlag(FalconEntity::FalconSimEntity); // Is it ourselves - Find out from the aircraft. if (ac && no == 0){ _isPlayer = (SimDriver.GetPlayerEntity() == ac) ? TRUE : FALSE; } else { _isPlayer = FALSE; } // Is it a player - Find out from the aircraft. if (ac){ _isDigital = ac->IsDigital() ? TRUE : FALSE; } else{ _isDigital = TRUE; } // Set team/country if (ac){ SetCountry (ac->GetCountry()); } _endStageTimeAdjust = ( IsDigiPilot() ? 0.0F : _pd->humanPilotEndStageTimeAdjust ); // It hasn't hit the ground yet. _hitGround = FALSE; // The chute isn't collapsed yet. _collapseChute = FALSE; _chuteCollapsedTime = 1000000.0; // No death message yet. _deathMsg = NULL; // Update shared data. SetPosition(_pos[I_X], _pos[I_Y], _pos[I_Z]); SetDelta(_vel[I_X], _vel[I_Y], _vel[I_Z]); SetYPR(_rot[I_YAW], _rot[I_PITCH], _rot[I_ROLL]); SetYPRDelta(_aVel[I_YAW], _aVel[I_PITCH], _aVel[I_ROLL]); // Update matrices for geometry. CalcTransformMatrix((SimMoverClass *)this); // Set up our label. if (ac) { acBSP = (DrawableBSP *)ac->drawPointer; if(acBSP != NULL) { strncpy(_label, acBSP->Label(), 32); labelLen = strlen(acBSP->Label()); if (no == 0){ strncat(_label, " Pilot", 32 - labelLen); } else { char crewstr[20]; sprintf (crewstr, " Crew%d", no); strncat(_label, crewstr, 32 - labelLen); } _label[31] = 0; _labelColor = acBSP->LabelColor(); } else { _label[0] = 0; _labelColor = 0; } } else { strcpy(_label, "Pilot"); labelLen = strlen(_label); _labelColor = 0;//acBSP->LabelColor(); } _execCalledFromAircraft = FALSE; // Point to the aircraft that I ejected from. if (ac) { _aircraftId = ac->Id(); _flightId = ac->GetCampaignObject()->Id(); } // Update exec transfer synching data. _lastFrameCount = 0; // _execCount = 0; // Act like a bomb, so nobody sees you // edg: yuck, we now have an eject pilot motion SetFlag(MOTION_BMB_AI); SetFlag(MOTION_EJECT_PILOT); if (IsLocal()) { SimVuDriver *drive = new SimVuDriver(this); drive->ExecDR(SimLibElapsedTime); SetDriver (drive); } }