Esempio n. 1
0
// Pick a random ship type, and randomize the flavour
void ShipFlavour::MakeTrulyRandom(ShipFlavour &v, bool atmospheric)
{
	// only allow ships that can fit an atmospheric shield
	if (atmospheric) {
		const std::vector<ShipType::Id> &ships = ShipType::playable_atmospheric_ships;
		v = ShipFlavour(ships[Pi::rng.Int32(ships.size())]);
	} else {
		const std::vector<ShipType::Id> &ships = ShipType::player_ships;
		v = ShipFlavour(ships[Pi::rng.Int32(ships.size())]);
	}
}
Esempio n. 2
0
Ship::Ship(ShipType::Type shipType): DynamicBody()
{
	m_flightState = FLYING;
	m_alertState = ALERT_NONE;
	m_lastFiringAlert = 0.0;
	m_testLanded = false;
	m_launchLockTimeout = 0;
	m_wheelTransition = 0;
	m_wheelState = 0;
	m_dockedWith = 0;
	m_dockedWithPort = 0;
	m_shipFlavour = ShipFlavour(shipType);
	m_thrusters.x = m_thrusters.y = m_thrusters.z = 0;
	m_angThrusters.x = m_angThrusters.y = m_angThrusters.z = 0;
	m_equipment.InitSlotSizes(shipType);
	m_hyperspace.countdown = 0;
	m_hyperspace.now = false;
	for (int i=0; i<ShipType::GUNMOUNT_MAX; i++) {
		m_gunState[i] = 0;
		m_gunRecharge[i] = 0;
		m_gunTemperature[i] = 0;
	}
	m_ecmRecharge = 0;
	SetLabel(m_shipFlavour.regid);
	m_curAICmd = 0;
	m_equipment.onChange.connect(sigc::mem_fun(this, &Ship::OnEquipmentChange));

	Init();	
}
Esempio n. 3
0
Ship::Ship(ShipType::Id shipId): DynamicBody(),
	m_controller(0),
	m_thrusterFuel(1.0),
	m_reserveFuel(0.0)
{
	m_flightState = FLYING;
	m_alertState = ALERT_NONE;
	m_lastFiringAlert = 0.0;
	m_testLanded = false;
	m_launchLockTimeout = 0;
	m_wheelTransition = 0;
	m_wheelState = 0;
	m_dockedWith = 0;
	m_dockedWithPort = 0;
	m_shipFlavour = ShipFlavour(shipId);
	m_type = &ShipType::types[m_shipFlavour.id];
	m_thrusters.x = m_thrusters.y = m_thrusters.z = 0;
	m_angThrusters.x = m_angThrusters.y = m_angThrusters.z = 0;
	m_equipment.InitSlotSizes(shipId);
	m_hyperspace.countdown = 0;
	m_hyperspace.now = false;
	for (int i=0; i<ShipType::GUNMOUNT_MAX; i++) {
		m_gunState[i] = 0;
		m_gunRecharge[i] = 0;
		m_gunTemperature[i] = 0;
	}
	m_ecmRecharge = 0;
	SetLabel(m_shipFlavour.regid);
	m_curAICmd = 0;
	m_aiMessage = AIERROR_NONE;
	m_decelerating = false;
	m_equipment.onChange.connect(sigc::mem_fun(this, &Ship::OnEquipmentChange));

	Init();
	SetController(new ShipController());
}