Vegastrike 0.5.1 rc1  1.0
Original sources for Vegastrike Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FireKeyboard Class Reference

#include <firekeyboard.h>

Inheritance diagram for FireKeyboard:
Order

Public Member Functions

virtual void SetParent (Unit *parent1)
 Sets the parent of this Unit. Any virtual functions must call this one. More...
 
virtual void ProcessCommMessage (class CommunicationMessage &c)
 processes a single message...generally called by the Messages() func More...
 
 FireKeyboard (unsigned int whichjoystick, unsigned int whichplayer)
 
virtual void Execute ()
 The function that gets called and executes all queued suborders. More...
 
virtual ~FireKeyboard ()
 
- Public Member Functions inherited from Order
virtual void ChooseTarget ()
 this function calls the destructor (needs to be overridden for python; More...
 
virtual bool PursueTarget (Unit *, bool isleader)
 
void ClearMessages ()
 clears the messasges of this order More...
 
 Order ()
 The default constructor setting everything to NULL and no dependency on order. More...
 
 Order (int type, int subtype)
 The constructor that specifies what order dependencies this order has. More...
 
virtual void Destroy ()
 The virutal function that unrefs all memory then calls Destruct () which takes care of unreffing this or calling delete on this. More...
 
OrderqueryType (unsigned int type)
 returns a pointer to the first order that may be bitwised ored with that type More...
 
OrderqueryAny (unsigned int type)
 returns a pointer to the first order that may be bitwise ored with any type More...
 
void eraseType (unsigned int type)
 Erases all orders that bitwise OR with that type. More...
 
bool AttachOrder (Unit *targets)
 Attaches a group of targets to this order (used for strategery-type games) More...
 
bool AttachOrder (QVector target)
 Attaches a navigation point to this order. More...
 
bool AttachSelfOrder (Unit *targets)
 Attaches a group (form up) to this order. More...
 
OrderEnqueueOrder (Order *ord)
 Enqueues another order that will be executed (in parallel perhaps) when next void Execute() is called. More...
 
OrderReplaceOrder (Order *ord)
 Replaces the first order of that type in the order queue. More...
 
bool Done ()
 
int getType ()
 
int getSubType ()
 
UnitGetParent () const
 
virtual void Communicate (const class CommunicationMessage &c)
 Sends a communication message from the Unit (encapulated in c) to this unit. More...
 
virtual void ProcessCommunicationMessages (float CommRepsonseTime, bool RemoveMessageProcessed)
 responds (or does not) to certain messages in the message queue More...
 
OrderfindOrder (Order *ord)
 return pointer to order or NULL if not found More...
 
void eraseOrder (Order *ord)
 erase that order from the list More...
 
OrderEnqueueOrderFirst (Order *ord)
 enqueue order as first order More...
 
virtual olist_tgetOrderList ()
 returns the orderlist (NULL for orders that haven't got any) More...
 
virtual void AdjustRelationTo (Unit *un, float factor)
 
virtual std::string getOrderDescription ()
 
OrderfindOrderList ()
 searches the suborders recursively for the first order that has an orderlist More...
 
std::string createFullOrderDescription (int level=0)
 
void setActionString (std::string astring)
 
std::string getActionString ()
 
virtual float getMood ()
 

Static Public Member Functions

static void SetShieldsOff (const KBData &, KBSTATE)
 
static void SetShieldsOneThird (const KBData &, KBSTATE)
 
static void SetShieldsTwoThird (const KBData &, KBSTATE)
 
static void ToggleGlow (const KBData &, KBSTATE)
 
static void ToggleWarpDrive (const KBData &, KBSTATE)
 
static void ToggleAutotracking (const KBData &, KBSTATE)
 
static void ToggleAnimation (const KBData &, KBSTATE)
 
static void PressComm1Key (const KBData &, KBSTATE)
 
static void PressComm2Key (const KBData &, KBSTATE)
 
static void PressComm3Key (const KBData &, KBSTATE)
 
static void PressComm4Key (const KBData &, KBSTATE)
 
static void PressComm5Key (const KBData &, KBSTATE)
 
static void PressComm6Key (const KBData &, KBSTATE)
 
static void PressComm7Key (const KBData &, KBSTATE)
 
static void PressComm8Key (const KBData &, KBSTATE)
 
static void PressComm9Key (const KBData &, KBSTATE)
 
static void PressComm10Key (const KBData &, KBSTATE)
 
static void SaveTarget1Key (const KBData &, KBSTATE)
 
static void SaveTarget2Key (const KBData &, KBSTATE)
 
static void SaveTarget3Key (const KBData &, KBSTATE)
 
static void SaveTarget4Key (const KBData &, KBSTATE)
 
static void SaveTarget5Key (const KBData &, KBSTATE)
 
static void SaveTarget6Key (const KBData &, KBSTATE)
 
static void SaveTarget7Key (const KBData &, KBSTATE)
 
static void SaveTarget8Key (const KBData &, KBSTATE)
 
static void SaveTarget9Key (const KBData &, KBSTATE)
 
static void SaveTarget10Key (const KBData &, KBSTATE)
 
static void RestoreTarget1Key (const KBData &, KBSTATE)
 
static void RestoreTarget2Key (const KBData &, KBSTATE)
 
static void RestoreTarget3Key (const KBData &, KBSTATE)
 
static void RestoreTarget4Key (const KBData &, KBSTATE)
 
static void RestoreTarget5Key (const KBData &, KBSTATE)
 
static void RestoreTarget6Key (const KBData &, KBSTATE)
 
static void RestoreTarget7Key (const KBData &, KBSTATE)
 
static void RestoreTarget8Key (const KBData &, KBSTATE)
 
static void RestoreTarget9Key (const KBData &, KBSTATE)
 
static void RestoreTarget10Key (const KBData &, KBSTATE)
 
static void RequestClearenceKey (const KBData &, KBSTATE)
 
static void UnDockKey (const KBData &, KBSTATE)
 
static void EjectKey (const KBData &, KBSTATE)
 
static void EjectDockKey (const KBData &, KBSTATE)
 
static void EjectCargoKey (const KBData &, KBSTATE)
 
static void EjectNonMissionCargoKey (const KBData &, KBSTATE)
 
static void DockKey (const KBData &, KBSTATE)
 
static void FireKey (const KBData &, KBSTATE)
 
static void MissileKey (const KBData &, KBSTATE)
 
static void TargetKey (const KBData &, KBSTATE k)
 
static void MissionTargetKey (const KBData &, KBSTATE k)
 
static void ReverseMissionTargetKey (const KBData &, KBSTATE k)
 
static void MissileTargetKey (const KBData &, KBSTATE k)
 
static void IncomingMissileTargetKey (const KBData &, KBSTATE k)
 
static void ReverseMissileTargetKey (const KBData &, KBSTATE k)
 
static void ReverseIncomingMissileTargetKey (const KBData &, KBSTATE k)
 
static void PickTargetKey (const KBData &, KBSTATE k)
 
static void NearestTargetKey (const KBData &, KBSTATE k)
 
static void SubUnitTargetKey (const KBData &, KBSTATE k)
 
static void ThreatTargetKey (const KBData &, KBSTATE k)
 
static void UnitTargetKey (const KBData &, KBSTATE k)
 
static void SigTargetKey (const KBData &, KBSTATE k)
 
static void ReverseTargetKey (const KBData &, KBSTATE k)
 
static void ReversePickTargetKey (const KBData &, KBSTATE k)
 
static void ReverseNearestTargetKey (const KBData &, KBSTATE k)
 
static void ReverseThreatTargetKey (const KBData &, KBSTATE k)
 
static void ReverseUnitTargetKey (const KBData &, KBSTATE k)
 
static void ReverseSigTargetKey (const KBData &, KBSTATE k)
 
static void NearestTargetTurretKey (const KBData &, KBSTATE)
 
static void ThreatTargetTurretKey (const KBData &, KBSTATE)
 
static void TargetTurretKey (const KBData &, KBSTATE)
 
static void PickTargetTurretKey (const KBData &, KBSTATE)
 
static void JFireKey (KBSTATE, float, float, int)
 
static void JMissileKey (KBSTATE, float, float, int)
 
static void JTargetKey (KBSTATE, float, float, int)
 
static void WeapSelKey (const KBData &, KBSTATE)
 
static void MisSelKey (const KBData &, KBSTATE)
 
static void ReverseWeapSelKey (const KBData &, KBSTATE)
 
static void ReverseMisSelKey (const KBData &, KBSTATE)
 
static void CloakKey (const KBData &, KBSTATE)
 
static void LockKey (const KBData &, KBSTATE)
 
static void ECMKey (const KBData &, KBSTATE)
 
static void HelpMeOut (const KBData &, KBSTATE)
 
static void HelpMeOutFaction (const KBData &, KBSTATE)
 
static void EnslaveKey (const KBData &, KBSTATE)
 
static void FreeSlaveKey (const KBData &, KBSTATE)
 
static void HelpMeOutCrit (const KBData &, KBSTATE)
 
static void JoinFg (const KBData &, KBSTATE)
 
static void BreakFormation (const KBData &, KBSTATE)
 
static void FormUp (const KBData &, KBSTATE)
 
static void DockWithMe (const KBData &, KBSTATE)
 
static void DefendTarget (const KBData &, KBSTATE)
 
static void DockTarget (const KBData &, KBSTATE k)
 
static void HoldPosition (const KBData &, KBSTATE k)
 
static void AttackTarget (const KBData &, KBSTATE)
 
static void TurretAIOn (const KBData &, KBSTATE)
 
static void TurretAIOff (const KBData &, KBSTATE)
 
static void TurretFireAtWill (const KBData &, KBSTATE)
 
static void NearestHostileTargetKey (const KBData &, KBSTATE k)
 
static void NearestDangerousHostileKey (const KBData &, KBSTATE k)
 
static void NearestFriendlyKey (const KBData &, KBSTATE k)
 
static void NearestBaseKey (const KBData &, KBSTATE k)
 
static void NearestPlanetKey (const KBData &, KBSTATE k)
 
static void NearestJumpKey (const KBData &, KBSTATE k)
 
static void TogglePause (const KBData &, KBSTATE)
 

Protected Member Functions

struct FIREKEYBOARDTYPEf ()
 
struct FIREKEYBOARDTYPEj ()
 
unsigned int DoSpeechAndAni (Unit *un, Unit *parent, class CommunicationMessage &c)
 
- Protected Member Functions inherited from Order
virtual ~Order ()
 
virtual void Destructor ()
 changes the local relation of this unit to another...may inform superiors about "good" or bad! behavior depending on the AI More...
 

Protected Attributes

void * savedTargets [NUMSAVEDTARGETS]
 
float distance
 
unsigned int whichplayer
 
unsigned int whichjoystick
 
- Protected Attributes inherited from Order
Unitparent
 The unit this order is attached to. More...
 
unsigned int type
 The bit code (from ORDERTYPES) that this order is (for parallel execution) More...
 
unsigned int subtype
 
bool done
 Whether or not this order is done. More...
 
UnitContainer group
 If this order applies to a group of units (as in form up with this group) More...
 
QVector targetlocation
 If this order applies to a physical location in world space. More...
 
std::vector< Order * > suborders
 The queue of suborders that will be executed in parallel according to bit code. More...
 
std::list< class
CommunicationMessage * > 
messagequeue
 a bunch of communications that have not been answered CommunicationMessages are actually containing reference to a nice Finite State Machine that can allow a player to have a reasonable conversation with an AI More...
 
std::string actionstring
 

Additional Inherited Members

- Public Types inherited from Order
enum  ORDERTYPES {
  MOVEMENT =1, FACING =2, WEAPON =4, CLOAKING =8,
  ALLTYPES =(1|2|4|8)
}
 The varieties of order types MOVEMENT,FACING, and WEAPON orders may not be mutually executed (lest one engine goes left, the other right) More...
 
enum  SUBORDERTYPES { SLOCATION =1, STARGET =2, SSELF =4 }
 

Detailed Description

Definition at line 9 of file firekeyboard.h.

Constructor & Destructor Documentation

FireKeyboard::FireKeyboard ( unsigned int  whichjoystick,
unsigned int  whichplayer 
)

Definition at line 34 of file firekeyboard.cpp.

References NUMSAVEDTARGETS, savedTargets, whichjoystick, and whichplayer.

34  : Order( WEAPON, 0 )
35 {
36  memset( savedTargets, 0, sizeof (void*)*NUMSAVEDTARGETS );
37  this->autotrackingtoggle = 1;
38  this->cloaktoggle = true;
40  this->whichplayer = whichplayer;
41  gunspeed = gunrange = .0001;
42  refresh_target = true;
43 }
FireKeyboard::~FireKeyboard ( )
virtual

Definition at line 1211 of file firekeyboard.cpp.

References VSFileSystem::vs_fprintf().

1212 {
1213 #ifdef ORDERDEBUG
1214  VSFileSystem::vs_fprintf( stderr, "fkb%x", this );
1215  fflush( stderr );
1216 #endif
1217 }

Member Function Documentation

void FireKeyboard::AttackTarget ( const KBData ,
KBSTATE  k 
)
static

Definition at line 834 of file firekeyboard.cpp.

References LeadMe(), and PRESS.

Referenced by initGlobalCommandMap().

835 {
836  if (k == PRESS)
837  LeadMe( "k", "Attack my target!", true );
838 }
void FireKeyboard::BreakFormation ( const KBData ,
KBSTATE  k 
)
static

Definition at line 886 of file firekeyboard.cpp.

References LeadMe(), and PRESS.

Referenced by initGlobalCommandMap().

887 {
888  if (k == PRESS) {
889  LeadMe( "", "Break formation!", false ); //used to clear group target
890 
891  LeadMe( "b", "Pick a target and open fire!", false );
892  }
893 }
void FireKeyboard::CloakKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 521 of file firekeyboard.cpp.

References FIREKEYBOARDTYPE::cloakkey, g(), and PRESS.

Referenced by initGlobalCommandMap().

522 {
523  if (k == PRESS)
524  g().cloakkey = k;
525 }
void FireKeyboard::DefendTarget ( const KBData ,
KBSTATE  k 
)
static

Definition at line 864 of file firekeyboard.cpp.

References LeadMe(), and PRESS.

Referenced by initGlobalCommandMap().

865 {
866  if (k == PRESS)
867  LeadMe( "p", "Defend my target!", true );
868 }
void FireKeyboard::DockKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 430 of file firekeyboard.cpp.

References _Universe, Universe::AccessCockpit(), FIREKEYBOARDTYPE::doc, g(), Cockpit::GetParent(), Unit::isSubUnit(), PRESS, and RELEASE.

Referenced by GameCockpit::DoAutoLanding(), and initGlobalCommandMap().

431 {
433  if ( k == PRESS && u && (u->isSubUnit() == false) )
434  g().doc = true;
435  if ( k == RELEASE && u && (u->isSubUnit() == false) )
436  g().doc = false;
437 }
void FireKeyboard::DockTarget ( const KBData ,
KBSTATE  k 
)
static

Definition at line 869 of file firekeyboard.cpp.

References LeadMe(), and PRESS.

Referenced by initGlobalCommandMap().

870 {
871  if (k == PRESS)
872  LeadMe( "t", "Dock at my target!", true );
873 }
void FireKeyboard::DockWithMe ( const KBData ,
KBSTATE  k 
)
static

Definition at line 858 of file firekeyboard.cpp.

References LeadMe(), and PRESS.

Referenced by initGlobalCommandMap().

859 {
860  if (k == PRESS)
861  LeadMe( "l", "Get in front of me and prepare to be tractored in.", false );
862 }
unsigned int FireKeyboard::DoSpeechAndAni ( Unit un,
Unit parent,
class CommunicationMessage c 
)
protected

Definition at line 1466 of file firekeyboard.cpp.

References _Universe, Universe::AccessCockpit(), Order::AdjustRelationTo(), CommunicationMessage::ani, DoSpeech(), CommunicationMessage::getCurrentState(), Cockpit::GetParent(), FSM::Node::messagedelta, and Cockpit::SetCommAnimation().

Referenced by ProcessCommMessage().

1467 {
1468  this->AdjustRelationTo( un, c.getCurrentState()->messagedelta );
1469  unsigned int retval = DoSpeech( un, parent, *c.getCurrentState() );
1470  if ( parent == _Universe->AccessCockpit()->GetParent() )
1471  _Universe->AccessCockpit()->SetCommAnimation( c.ani, un );
1472  this->refresh_target = true;
1473  return retval;
1474 }
void FireKeyboard::ECMKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 533 of file firekeyboard.cpp.

References FIREKEYBOARDTYPE::ECMkey, g(), and PRESS.

Referenced by initGlobalCommandMap().

534 {
535  if (k == PRESS)
536  g().ECMkey = k;
537 }
void FireKeyboard::EjectCargoKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 497 of file firekeyboard.cpp.

References FIREKEYBOARDTYPE::ejectcargo, g(), and PRESS.

Referenced by initGlobalCommandMap().

498 {
499  if (k == PRESS)
500  g().ejectcargo = k;
501 }
void FireKeyboard::EjectDockKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 457 of file firekeyboard.cpp.

References FIREKEYBOARDTYPE::doc, FIREKEYBOARDTYPE::ejectdock, g(), PRESS, and RELEASE.

Referenced by initGlobalCommandMap().

458 {
459  if (k == PRESS) {
460  g().ejectdock = k;
461  g().doc = true;
462  }
463  if (k == RELEASE)
464  g().doc = false;
465 }
void FireKeyboard::EjectKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 448 of file firekeyboard.cpp.

References FIREKEYBOARDTYPE::eject, g(), LeadMe(), and PRESS.

Referenced by initGlobalCommandMap().

449 {
450  if (k == PRESS) {
451  LeadMe( "", "I am ejecting! Record the current location of my ship.", false ); //used to clear group target
452  LeadMe( "e", "Then get over here and pick me up!", false );
453  g().eject = k;
454  }
455 }
void FireKeyboard::EjectNonMissionCargoKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 515 of file firekeyboard.cpp.

References FIREKEYBOARDTYPE::ejectnonmissioncargo, g(), and PRESS.

Referenced by initGlobalCommandMap().

516 {
517  if (k == PRESS)
519 }
void FireKeyboard::EnslaveKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 503 of file firekeyboard.cpp.

References FIREKEYBOARDTYPE::enslave, g(), and PRESS.

Referenced by initGlobalCommandMap().

504 {
505  if (k == PRESS)
506  g().enslave = k;
507 }
void FireKeyboard::Execute ( )
virtual

The function that gets called and executes all queued suborders.

Reimplemented from Order.

Definition at line 1646 of file firekeyboard.cpp.

References _Universe, Universe::AccessCockpit(), Mount::ACTIVE, Universe::activeStarSystem(), Unit::graphic_options::Animating, Arrested(), AUDIsPlaying(), AUDPlay(), c, Cockpit::CanDrawNavSystem(), Unit::Computer::RADARLIM::canlock, weapon_info::CAPSHIPHEAVY, weapon_info::CAPSHIPLIGHT, ChooseSubTargets(), ChooseTargets(), Unit::Cloak(), FIREKEYBOARDTYPE::cloakkey, FIREKEYBOARDTYPE::commKeys, Order::Communicate(), Cockpit::communication_choices, UnitCollection::createIterator(), CommunicationMessage::curstate, Unit::DisableTurretAI(), DoDockingOps(), DoSpeech(), DOWN, Unit::Computer::ecmactive, FIREKEYBOARDTYPE::ECMkey, FIREKEYBOARDTYPE::eject, Cockpit::Eject(), FIREKEYBOARDTYPE::ejectcargo, Unit::EjectCargo(), FIREKEYBOARDTYPE::ejectdock, Cockpit::EjectDock(), FIREKEYBOARDTYPE::ejectnonmissioncargo, Unit::EnergyRechargeData(), FIREKEYBOARDTYPE::enslave, Enslave(), ROLES::EVERYTHING_ELSE, f(), Unit::faction, Unit::Fire(), ROLES::FIRE_GUNS, ROLES::FIRE_MISSILES, FIREKEYBOARDTYPE::firekey, ForceChangeTarget(), CAR::FORWARD_BLINKEN, FIREKEYBOARDTYPE::freeslave, CommunicationMessage::fsm, Unit::getAIState(), Unit::GetCargo(), Cargo::GetCategory(), Unit::GetComputerData(), FactionUtil::GetConversation(), CommunicationMessage::getCurrentState(), FSM::getDefaultState(), UnitUtil::getECM(), FSM::GetEdgesString(), Pilot::getGender(), Unit::GetHull(), getNearestTargetUnit(), Unit::GetNumMounts(), Unit::getRelation(), Cockpit::getScrollOffset(), GetTargetMessageQueue(), getTopLevelOwner(), StarSystem::getUnitList(), VegaConfig::getVariable(), Unit::graphicOptions, weapon_info::HEAVY, i, Mount::INACTIVE, FIREKEYBOARDTYPE::incomingmissiletargetkey, Unit::InRange(), Unit::graphic_options::InWarp, Universe::isPlayerStarship(), Unit::isSubUnit(), j(), FIREKEYBOARDTYPE::jfirekey, FIREKEYBOARDTYPE::jmissilekey, FIREKEYBOARDTYPE::jtargetkey, CAR::LEFT_BLINKEN, weapon_info::LIGHT, soundContainer::loadsound(), FIREKEYBOARDTYPE::lockkey, Unit::LockTarget(), VDU::MANIFEST, weapon_info::MEDIUM, FIREKEYBOARDTYPE::misk, FIREKEYBOARDTYPE::missilekey, FIREKEYBOARDTYPE::missiletargetkey, Cargo::mission, FIREKEYBOARDTYPE::missiontargetkey, Unit::mounts, Unit::name, FIREKEYBOARDTYPE::nearestbasekey, FIREKEYBOARDTYPE::nearestdangeroushostilekey, FIREKEYBOARDTYPE::nearestfriendlykey, FIREKEYBOARDTYPE::nearesthostilekey, FIREKEYBOARDTYPE::nearestjumpkey, FIREKEYBOARDTYPE::nearestplanetkey, FIREKEYBOARDTYPE::neartargetkey, FIREKEYBOARDTYPE::nearturrettargetkey, Network, FSM::nodes, Unit::numCargo(), NUMCOMMKEYS, NUMSAVEDTARGETS, CAR::ON_NO_BLINKEN, Cockpit::OnPauseBegin(), Cockpit::OnPauseEnd(), Order::parent, XMLSupport::parse_bool(), FIREKEYBOARDTYPE::picktargetkey, FIREKEYBOARDTYPE::pickturrettargetkey, Unit::pilot, soundContainer::playsound(), PowerDownShield(), PRESS, Order::ProcessCommunicationMessages(), QVector, Unit::Computer::radar, RELEASE, FIREKEYBOARDTYPE::restoreTargetKeys, CAR::RIGHT_BLINKEN, FIREKEYBOARDTYPE::rincomingmissiletargetkey, FIREKEYBOARDTYPE::rmisk, FIREKEYBOARDTYPE::rmissiletargetkey, FIREKEYBOARDTYPE::rmissiontargetkey, FIREKEYBOARDTYPE::rneartargetkey, FIREKEYBOARDTYPE::rpicktargetkey, FIREKEYBOARDTYPE::rtargetkey, FIREKEYBOARDTYPE::rtargetskey, FIREKEYBOARDTYPE::rtargetukey, FIREKEYBOARDTYPE::rthreattargetkey, FIREKEYBOARDTYPE::rweapk, savedTargets, FIREKEYBOARDTYPE::saveTargetKeys, Orders::SelectDockPort(), SERVER, UnitUtil::setECM(), Unit::SetGlowVisible(), Unit::SetTurretAI(), Unit::shield, SIMULATION_ATOM, CAR::SIREN_BLINKEN, soundContainer::sound, weapon_info::SPECIAL, FIREKEYBOARDTYPE::subtargetkey, TargAll(), Unit::Target(), FIREKEYBOARDTYPE::targetkey, Unit::TargetLocked(), FIREKEYBOARDTYPE::targetskey, Unit::TargetTurret(), FIREKEYBOARDTYPE::targetukey, TargFront(), TargIncomingMissile(), TargMissile(), TargMission(), TargNear(), TargSig(), TargThreat(), TargUn(), FIREKEYBOARDTYPE::threattargetkey, FIREKEYBOARDTYPE::threatturrettargetkey, toggle_pause(), FIREKEYBOARDTYPE::toggleanimation, FIREKEYBOARDTYPE::toggleautotracking, FIREKEYBOARDTYPE::toggleglow, FIREKEYBOARDTYPE::togglepausekey, FIREKEYBOARDTYPE::togglewarpdrive, Unit::ToggleWeapon(), Unit::Computer::RADARLIM::trackingactive, FIREKEYBOARDTYPE::turretaikey, FIREKEYBOARDTYPE::turretfaw, Unit::TurretFAW(), FIREKEYBOARDTYPE::turretoffkey, FIREKEYBOARDTYPE::turrettargetkey, Unit::UnFire(), UP, Vector, vectorOfKeyboardInput, vs_config, Unit::graphic_options::WarpRamping, FIREKEYBOARDTYPE::weapk, whichjoystick, and whichplayer.

1647 {
1649  vectorOfKeyboardInput.push_back( FIREKEYBOARDTYPE() );
1651  Unit *targ = parent->Target();
1653  if (SERVER || Network == NULL) {
1654  if (targ) {
1655  double mm = 0.0;
1656  ShouldFire( targ );
1657  if (targ->GetHull() < 0) {
1658  parent->Target( NULL );
1660  refresh_target = true;
1661  } else if ( false == parent->InRange( targ, mm, true, true, true ) && !parent->TargetLocked() ) {
1662  ChooseTargets( parent, TargUn, false ); //only go for other active units in cone
1663  if (parent->Target() == NULL)
1664  parent->Target( targ );
1665  }
1666  } else {
1668  refresh_target = true;
1669  }
1670  }
1671  if (f().shieldpowerstate != 1) {
1672  Shield *shield = &parent->shield;
1673  PowerDownShield( shield, f().shieldpowerstate );
1674  }
1675  if (f().firekey == PRESS || f().jfirekey == PRESS || j().firekey == DOWN || j().jfirekey == DOWN) {
1676  if ( !_Universe->AccessCockpit()->CanDrawNavSystem() ) {
1677  static bool allow_special_with_weapons =
1678  XMLSupport::parse_bool( vs_config->getVariable( "physics", "special_and_normal_gun_combo", "true" ) );
1679  if (!allow_special_with_weapons) {
1680  bool special = false;
1681  bool normal = false;
1682  int nm = parent->GetNumMounts();
1683  int i;
1684  for (i = 0; i < nm; ++i)
1685  if (parent->mounts[i].status == Mount::ACTIVE) {
1686  special = special || (parent->mounts[i].type->size&weapon_info::SPECIAL) != 0;
1687  normal = normal
1688  || ( parent->mounts[i].type->size
1690  |weapon_info::CAPSHIPHEAVY) ) != 0;
1691  }
1692  for (i = 0; i < nm; ++i)
1693  if (special && normal) {
1694  if (parent->mounts[i].status == Mount::ACTIVE)
1695  if ( (parent->mounts[i].type->size&weapon_info::SPECIAL) != 0 )
1696  parent->mounts[i].status = Mount::INACTIVE;
1697  }
1698  }
1700  }
1701  }
1702  if (f().missilekey == PRESS || j().jmissilekey == PRESS) {
1705  if (f().missilekey == PRESS)
1706  f().missilekey = DOWN;
1707  if (j().jmissilekey == PRESS)
1708  j().jmissilekey = DOWN;
1709  } else if (f().firekey == RELEASE || j().jfirekey == RELEASE) {
1710  f().firekey = UP;
1711  j().jfirekey = UP;
1712  parent->UnFire();
1713  }
1714  if (f().cloakkey == PRESS) {
1715  f().cloakkey = DOWN;
1716  parent->Cloak( cloaktoggle );
1717  cloaktoggle = !cloaktoggle;
1718  }
1719  if (f().lockkey == PRESS) {
1720  f().lockkey = DOWN;
1722  }
1723  if (f().ECMkey == PRESS) {
1724  f().ECMkey = DOWN;
1726  }
1727 #ifdef CAR_SIM
1728  int origecm = UnitUtil::getECM( parent );
1729  if (origecm >= CAR::ON_NO_BLINKEN)
1730  origecm = CAR::FORWARD_BLINKEN;
1731  if (origecm < 0)
1732  origecm = 0;
1733  if (f().blinkleftkey == PRESS) {
1734  f().blinkleftkey = DOWN;
1735  if ( (origecm&CAR::LEFT_BLINKEN) )
1736  UnitUtil::setECM( parent, ( origecm&(~CAR::LEFT_BLINKEN) ) );
1737  else
1738  UnitUtil::setECM( parent, origecm|CAR::LEFT_BLINKEN );
1739  }
1740  if (f().blinkrightkey == PRESS) {
1741  f().blinkrightkey = DOWN;
1742  if ( (origecm&CAR::RIGHT_BLINKEN) )
1743  UnitUtil::setECM( parent, ( origecm&(~CAR::RIGHT_BLINKEN) ) );
1744  else
1745  UnitUtil::setECM( parent, origecm|CAR::RIGHT_BLINKEN );
1746  }
1747  if (f().sirenkey == PRESS) {
1748  f().sirenkey = DOWN;
1749  if ( (origecm&CAR::SIREN_BLINKEN) )
1750  UnitUtil::setECM( parent, ( origecm&(~CAR::SIREN_BLINKEN) ) );
1751  else
1752  UnitUtil::setECM( parent, origecm|CAR::SIREN_BLINKEN );
1753  }
1754  if (f().headlightkey == PRESS) {
1755  f().headlightkey = DOWN;
1756  if ( (origecm&CAR::FORWARD_BLINKEN) )
1757  UnitUtil::setECM( parent, ( origecm&(~CAR::FORWARD_BLINKEN) ) );
1758  else
1759  UnitUtil::setECM( parent, origecm|CAR::FORWARD_BLINKEN );
1760  }
1761 #endif
1762  if (f().targetkey == PRESS || j().jtargetkey == PRESS) {
1763  f().targetkey = DOWN;
1764  j().jtargetkey = DOWN;
1765  ChooseTargets( parent, TargAll, false );
1766  refresh_target = true;
1767  }
1768  if (f().rtargetkey == PRESS) {
1769  f().rtargetkey = DOWN;
1770  ChooseTargets( parent, TargAll, true );
1771  refresh_target = true;
1772  }
1773  if (f().missiontargetkey == PRESS) {
1774  f().missiontargetkey = DOWN;
1775  ChooseTargets( parent, TargMission, false );
1776  refresh_target = true;
1777  }
1778  if (f().rmissiontargetkey == PRESS) {
1779  f().rmissiontargetkey = DOWN;
1780  ChooseTargets( parent, TargMission, true );
1781  refresh_target = true;
1782  }
1783  if (f().targetskey == PRESS) {
1784  f().targetskey = DOWN;
1785  ChooseTargets( parent, TargSig, false );
1786  refresh_target = true;
1787  parent->LockTarget( true );
1788  }
1789  if (f().targetukey == PRESS) {
1790  f().targetukey = DOWN;
1791  static bool smart_targetting =
1792  XMLSupport::parse_bool( vs_config->getVariable( "graphics", "smart_targetting_key", "true" ) );
1793  Unit *tmp = parent->Target();
1794  bool sysobj = false;
1795  if (tmp)
1796  if ( tmp->owner == getTopLevelOwner() )
1797  sysobj = true;
1798  ChooseTargets( parent, TargUn, false );
1799  if ( (Network == NULL || parent->Target() == NULL) && tmp == parent->Target() && sysobj && smart_targetting ) {
1800  ChooseTargets( parent, TargSig, false );
1801  if ( tmp == parent->Target() )
1802  ChooseTargets( parent, TargAll, false );
1803  }
1804  refresh_target = true;
1805  }
1806  if (f().picktargetkey == PRESS) {
1807  f().picktargetkey = DOWN;
1808  ChooseTargets( parent, TargFront, false );
1809  refresh_target = true;
1810  }
1811  if (f().neartargetkey == PRESS) {
1812  ChooseTargets( parent, TargNear, false );
1813  f().neartargetkey = DOWN;
1814  refresh_target = true;
1815  }
1816  if (f().missiletargetkey == PRESS) {
1817  ChooseTargets( parent, TargMissile, false );
1818  f().missiletargetkey = DOWN;
1819  refresh_target = true;
1820  }
1821  if (f().incomingmissiletargetkey == PRESS) {
1824  refresh_target = true;
1825  }
1826  if (f().rmissiletargetkey == PRESS) {
1827  ChooseTargets( parent, TargMissile, true );
1828  f().rmissiletargetkey = DOWN;
1829  refresh_target = true;
1830  }
1831  if (f().rincomingmissiletargetkey == PRESS) {
1834  refresh_target = true;
1835  }
1836  if (f().threattargetkey == PRESS) {
1837  ChooseTargets( parent, TargThreat, false );
1838  f().threattargetkey = DOWN;
1839  refresh_target = true;
1840  }
1841  if (f().subtargetkey == PRESS) {
1843  f().subtargetkey = DOWN;
1844  refresh_target = true;
1845  }
1846  if (f().rpicktargetkey == PRESS) {
1847  f().rpicktargetkey = DOWN;
1848  ChooseTargets( parent, TargFront, true );
1849  refresh_target = true;
1850  }
1851  if (f().rneartargetkey == PRESS) {
1852  ChooseTargets( parent, TargNear, true );
1853  f().rneartargetkey = DOWN;
1854  refresh_target = true;
1855  }
1856  if (f().rthreattargetkey == PRESS) {
1857  ChooseTargets( parent, TargThreat, true );
1858  f().rthreattargetkey = DOWN;
1859  refresh_target = true;
1860  }
1861  if (f().rtargetskey == PRESS) {
1862  f().rtargetskey = DOWN;
1863  ChooseTargets( parent, TargSig, true );
1864  refresh_target = true;
1865  parent->LockTarget( true );
1866  }
1867  if (f().rtargetukey == PRESS) {
1868  f().rtargetukey = DOWN;
1869  static bool smart_targetting =
1870  XMLSupport::parse_bool( vs_config->getVariable( "graphics", "smart_targetting_key", "true" ) );
1871  Unit *tmp = parent->Target();
1872  bool sysobj = false;
1873  if (tmp)
1874  if ( tmp->owner == getTopLevelOwner() )
1875  sysobj = true;
1876  ChooseTargets( parent, TargUn, true );
1877  if (tmp == parent->Target() && sysobj && smart_targetting) {
1878  ChooseTargets( parent, TargFront, true );
1879  if ( tmp == parent->Target() )
1880  ChooseTargets( parent, TargAll, true );
1881  }
1882  refresh_target = true;
1883  }
1884  if (f().turretaikey == PRESS) {
1885  parent->SetTurretAI();
1887  f().turretaikey = DOWN;
1888  }
1889  static bool noturretai = XMLSupport::parse_bool( vs_config->getVariable( "AI", "no_turret_ai", "false" ) );
1890  static int taicounter = 0;
1891  if ( f().turretoffkey == PRESS || (noturretai && taicounter++%128 == 0) ) {
1893  f().turretoffkey = DOWN;
1894  }
1895  if (f().turretfaw == PRESS) {
1896  parent->TurretFAW();
1897  f().turretfaw = DOWN;
1898  }
1899  if (f().turretaikey == RELEASE)
1900  f().turretaikey = UP;
1901  if (f().turrettargetkey == PRESS) {
1902  f().turrettargetkey = DOWN;
1904  refresh_target = true;
1905  }
1906  if (f().pickturrettargetkey == PRESS) {
1909  refresh_target = true;
1910  }
1911  if (f().nearturrettargetkey == PRESS) {
1914  refresh_target = true;
1915  }
1916  if (f().threatturrettargetkey == PRESS) {
1919  refresh_target = true;
1920  }
1921  //Added for nearest unit targeting -ch
1922  if (f().nearesthostilekey == PRESS) {
1924  f().nearesthostilekey = DOWN;
1925  refresh_target = true;
1926  }
1927  if (f().nearestdangeroushostilekey == PRESS) {
1930  refresh_target = true;
1931  }
1932  if (f().nearestfriendlykey == PRESS) {
1935  refresh_target = true;
1936  }
1937  if (f().nearestbasekey == PRESS) {
1939  f().nearestbasekey = DOWN;
1940  refresh_target = true;
1941  }
1942  if (f().nearestplanetkey == PRESS) {
1944  f().nearestplanetkey = DOWN;
1945  refresh_target = true;
1946  }
1947  if (f().nearestjumpkey == PRESS) {
1949  f().nearestjumpkey = DOWN;
1950  refresh_target = true;
1951  }
1952  if (f().togglepausekey == PRESS) {
1953  f().togglepausekey = DOWN;
1954  if (toggle_pause())
1955  {
1957  }
1958  else
1959  {
1961  }
1962  }
1963  if (f().weapk == PRESS || f().rweapk == PRESS) {
1964  bool forward;
1965  if (f().weapk == PRESS) {
1966  f().weapk = DOWN;
1967  forward = true;
1968  }
1969  if (f().rweapk == PRESS) {
1970  f().rweapk = DOWN;
1971  forward = false;
1972  }
1973  parent->UnFire();
1974  parent->ToggleWeapon( false, forward );
1975  static soundContainer weapsound;
1976  if (weapsound.sound < 0) {
1977  static string str = vs_config->getVariable( "cockpitaudio", "weapon_switch", "vdu_d" );
1978  weapsound.loadsound( str );
1979  }
1980  weapsound.playsound();
1981  }
1982  if (f().toggleanimation == PRESS) {
1983  f().toggleanimation = DOWN;
1985  }
1986  if (f().toggleglow == PRESS) {
1987  f().toggleglow = DOWN;
1988  static bool isvis = true;
1989  isvis = !isvis;
1990  parent->SetGlowVisible( isvis );
1991  }
1992  if (f().togglewarpdrive == PRESS) {
1993  f().togglewarpdrive = DOWN;
1996  }
1997  if (f().toggleautotracking == PRESS) {
2000  }
2001  if (f().misk == PRESS || f().rmisk == PRESS) {
2002  bool forward;
2003  if (f().misk == PRESS) {
2004  f().misk = DOWN;
2005  forward = true;
2006  }
2007  if (f().rmisk == PRESS) {
2008  f().rmisk = DOWN;
2009  forward = false;
2010  }
2011  parent->ToggleWeapon( true, forward );
2012  static soundContainer missound;
2013  if (missound.sound < 0) {
2014  static string str = vs_config->getVariable( "cockpitaudio", "missile_switch", "vdu_d" );
2015  missound.loadsound( str );
2016  }
2017  missound.playsound();
2018  }
2019  unsigned int i;
2020  for (i = 0; i < NUMSAVEDTARGETS; i++) {
2021  if (f().saveTargetKeys[i] == PRESS) {
2022  f().saveTargetKeys[i] = RELEASE;
2023  savedTargets[i] = parent->Target();
2024  }
2025  if (f().restoreTargetKeys[i] == PRESS && parent->GetComputerData().radar.canlock) {
2026  f().restoreTargetKeys[i] = RELEASE;
2027  Unit *un;
2029  (un = *u) != NULL;
2030  ++u)
2031  if (un == savedTargets[i]) {
2032  parent->Target( un );
2033  break;
2034  }
2035  }
2036  }
2037  for (i = 0; i < NUMCOMMKEYS; i++)
2038  if (f().commKeys[i] == PRESS) {
2039  f().commKeys[i] = RELEASE;
2040  Unit *targ = parent->Target();
2041  if (targ) {
2042  CommunicationMessage *mymsg = GetTargetMessageQueue( targ, resp );
2044  if ( mymsg == NULL || mymsg->curstate >= static_cast<int>(fsm->nodes.size()) ) {
2045  CommunicationMessage c( parent, targ, i, NULL, parent->pilot->getGender() );
2046  unsigned int whichspeech = DoSpeech( targ, targ, *c.getCurrentState() );
2047  int sound = c.getCurrentState()->GetSound( c.sex, whichspeech );
2048  if ( !AUDIsPlaying( sound ) )
2049  AUDPlay( sound, QVector( 0, 0, 0 ), Vector( 0, 0, 0 ), 1 );
2050  Order *o = targ->getAIState();
2051  if (o)
2052  o->Communicate( c );
2053  } else {
2054  FSM *tmp = mymsg->fsm;
2055  mymsg->fsm = fsm;
2056  FSM::Node *n = mymsg->getCurrentState();
2057  if ( i < n->edges.size() ) {
2058  CommunicationMessage c( parent, targ, *mymsg, i, NULL, parent->pilot->getGender() );
2059  unsigned int whichmessage = DoSpeech( targ, targ, *c.getCurrentState() );
2060  int sound = c.getCurrentState()->GetSound( c.sex, whichmessage );
2061  if ( !AUDIsPlaying( sound ) )
2062  AUDPlay( sound, QVector( 0, 0, 0 ), Vector( 0, 0, 0 ), 1 );
2063  Order *oo = targ->getAIState();
2064  if (oo)
2065  oo->Communicate( c );
2066  }
2067  mymsg->fsm = tmp;
2068  }
2069  }
2070  }
2071  if (refresh_target) {
2072  Unit *targ;
2073  if ( ( targ = parent->Target() ) ) {
2074  if ( parent->isSubUnit() )
2075  parent->TargetTurret( targ );
2076  CommunicationMessage *mymsg = GetTargetMessageQueue( targ, resp );
2078  if (mymsg == NULL)
2080  fsm->GetEdgesString( fsm->getDefaultState( parent->getRelation( targ ) ) );
2081  else
2083  } else {
2084  _Universe->AccessCockpit()->communication_choices = "\nNo Communication\nLink\nEstablished";
2085  }
2086  }
2087  if (f().enslave == PRESS || f().freeslave == PRESS) {
2088  Enslave( parent, f().enslave == PRESS );
2089  f().enslave = RELEASE;
2090  f().freeslave = RELEASE;
2091  }
2092  if (f().ejectcargo == PRESS || f().ejectnonmissioncargo == PRESS) {
2093  bool missiontoo = (f().ejectcargo == PRESS);
2095  f().ejectcargo = RELEASE;
2097  if (offset < 3)
2098  offset = 0;
2099  else
2100  offset -= 3;
2101  for ( ; offset < static_cast<int>(parent->numCargo()); ++offset) {
2102  Cargo *tmp = &parent->GetCargo( offset );
2103  if ( tmp->GetCategory().find( "upgrades" ) == string::npos && (missiontoo || tmp->mission == false) ) {
2104  parent->EjectCargo( offset );
2105  break;
2106  }
2107  }
2108  if (missiontoo)
2110  else
2111  f().ejectcargo = DOWN;
2112  }
2113  //i think this ejects the pilot? yep it does
2114  if (f().eject == PRESS) {
2115  f().eject = DOWN;
2116  Cockpit *cp = NULL;
2117  if ( (parent->name != "eject") && (parent->name != "Pilot") && ( cp = _Universe->isPlayerStarship( parent ) ) )
2118  cp->Eject();
2119  }
2120  //eject pilot and warp pilot to the docking screen instantly.
2121  if (f().ejectdock == PRESS) {
2122  f().ejectdock = DOWN;
2123  Unit *utdw = parent;
2124  Cockpit *cp = NULL; //check if docking ports exist, no docking ports = no need to ejectdock so don't do anything
2125  if ( (SelectDockPort( utdw, parent ) > -1) && ( cp = _Universe->isPlayerStarship( parent ) ) )
2126  cp->EjectDock(); //use specialized ejectdock in the future
2127  }
2128  static bool actually_arrest = XMLSupport::parse_bool( vs_config->getVariable( "AI", "arrest_energy_zero", "false" ) );
2129  if (actually_arrest && parent->EnergyRechargeData() == 0)
2130  Arrested( parent );
2131 }
FIREKEYBOARDTYPE & FireKeyboard::f ( )
protected

Definition at line 149 of file firekeyboard.cpp.

References vectorOfKeyboardInput, and whichplayer.

Referenced by Execute().

150 {
152 }
void FireKeyboard::FireKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 539 of file firekeyboard.cpp.

References DOWN, FIREKEYBOARDTYPE::firekey, g(), RELEASE, and UP.

Referenced by FlyByJoystick::FlyByJoystick(), and initGlobalCommandMap().

540 {
541  if (g().firekey == DOWN && k == UP)
542  return;
543  if (k == UP && g().firekey == RELEASE) {} else {
544  g().firekey = k;
545  }
546 }
void FireKeyboard::FormUp ( const KBData ,
KBSTATE  k 
)
static

Definition at line 880 of file firekeyboard.cpp.

References LeadMe(), and PRESS.

Referenced by initGlobalCommandMap().

881 {
882  if (k == PRESS)
883  LeadMe( "f", "Form on my wing.", false );
884 }
void FireKeyboard::FreeSlaveKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 509 of file firekeyboard.cpp.

References FIREKEYBOARDTYPE::freeslave, g(), and PRESS.

Referenced by initGlobalCommandMap().

510 {
511  if (k == PRESS)
512  g().freeslave = k;
513 }
void FireKeyboard::HelpMeOut ( const KBData ,
KBSTATE  k 
)
static

Definition at line 840 of file firekeyboard.cpp.

References LeadMe(), and PRESS.

Referenced by initGlobalCommandMap().

841 {
842  if (k == PRESS)
843  LeadMe( "h", "Help me out!", false );
844 }
void FireKeyboard::HelpMeOutCrit ( const KBData ,
KBSTATE  k 
)
static

Definition at line 852 of file firekeyboard.cpp.

References HelpOut(), and PRESS.

Referenced by initGlobalCommandMap().

853 {
854  if (k == PRESS)
855  HelpOut( true, "Help me out! Systems going critical!" );
856 }
void FireKeyboard::HelpMeOutFaction ( const KBData ,
KBSTATE  k 
)
static

Definition at line 846 of file firekeyboard.cpp.

References HelpOut(), and PRESS.

Referenced by initGlobalCommandMap().

847 {
848  if (k == PRESS)
849  HelpOut( false, "Help me out! I need critical assistance!" );
850 }
void FireKeyboard::HoldPosition ( const KBData ,
KBSTATE  k 
)
static

Definition at line 875 of file firekeyboard.cpp.

References LeadMe(), and PRESS.

Referenced by initGlobalCommandMap().

876 {
877  if (k == PRESS)
878  LeadMe( "s", "Hold Position!", true );
879 }
void FireKeyboard::IncomingMissileTargetKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 578 of file firekeyboard.cpp.

References ExamineWhenTargetKey(), g(), FIREKEYBOARDTYPE::incomingmissiletargetkey, and PRESS.

Referenced by initGlobalCommandMap().

579 {
580  if (g().incomingmissiletargetkey != PRESS)
582  if (k == PRESS)
584 }
FIREKEYBOARDTYPE & FireKeyboard::j ( )
protected

Definition at line 154 of file firekeyboard.cpp.

References vectorOfKeyboardInput, and whichjoystick.

Referenced by Execute().

155 {
157 }
static void FireKeyboard::JFireKey ( KBSTATE  ,
float  ,
float  ,
int   
)
static
static void FireKeyboard::JMissileKey ( KBSTATE  ,
float  ,
float  ,
int   
)
static
void FireKeyboard::JoinFg ( const KBData ,
KBSTATE  k 
)
static

Definition at line 810 of file firekeyboard.cpp.

References _Universe, Universe::AccessCockpit(), Flightgroup::Decrement(), Unit::faction, Unit::getFlightgroup(), Cockpit::GetParent(), Flightgroup::nr_ships, Flightgroup::nr_ships_left, PRESS, Unit::SetFg(), and Unit::Target().

Referenced by initGlobalCommandMap().

811 {
812  if (k == PRESS) {
814  if (un) {
815  Unit *targ = un->Target();
816  if (targ) {
817  if (targ->faction == un->faction) {
818  Flightgroup *fg = targ->getFlightgroup();
819  if (fg) {
820  if ( fg != un->getFlightgroup() ) {
821  if ( un->getFlightgroup() )
822  un->getFlightgroup()->Decrement( un );
823  fg->nr_ships_left++;
824  fg->nr_ships++;
825  un->SetFg( fg, fg->nr_ships_left-1 );
826  }
827  }
828  }
829  }
830  }
831  }
832 }
static void FireKeyboard::JTargetKey ( KBSTATE  ,
float  ,
float  ,
int   
)
static
void FireKeyboard::LockKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 527 of file firekeyboard.cpp.

References g(), FIREKEYBOARDTYPE::lockkey, and PRESS.

Referenced by initGlobalCommandMap().

528 {
529  if (k == PRESS)
530  g().lockkey = k;
531 }
void FireKeyboard::MisSelKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 949 of file firekeyboard.cpp.

References g(), FIREKEYBOARDTYPE::misk, and PRESS.

Referenced by initGlobalCommandMap(), and CockpitKeys::MissileModeVDU().

950 {
951  if (g().misk != PRESS)
952  g().misk = k;
953 }
void FireKeyboard::MissileKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 955 of file firekeyboard.cpp.

References g(), FIREKEYBOARDTYPE::missilekey, and PRESS.

Referenced by FlyByJoystick::FlyByJoystick(), and initGlobalCommandMap().

956 {
957  if (k == PRESS)
958  g().missilekey = k;
959 }
void FireKeyboard::MissileTargetKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 570 of file firekeyboard.cpp.

References ExamineWhenTargetKey(), g(), FIREKEYBOARDTYPE::missiletargetkey, and PRESS.

Referenced by initGlobalCommandMap().

571 {
572  if (g().missiletargetkey != PRESS)
573  g().missiletargetkey = k;
574  if (k == PRESS)
576 }
void FireKeyboard::MissionTargetKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 485 of file firekeyboard.cpp.

References g(), FIREKEYBOARDTYPE::missiontargetkey, and PRESS.

Referenced by initGlobalCommandMap().

486 {
487  if (k == PRESS)
489 }
void FireKeyboard::NearestBaseKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 718 of file firekeyboard.cpp.

References ExamineWhenTargetKey(), g(), FIREKEYBOARDTYPE::nearestbasekey, and PRESS.

Referenced by initGlobalCommandMap().

719 {
720  if (g().nearestbasekey != PRESS)
721  g().nearestbasekey = k;
722  if (k == PRESS)
724 }
void FireKeyboard::NearestDangerousHostileKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 702 of file firekeyboard.cpp.

References ExamineWhenTargetKey(), g(), FIREKEYBOARDTYPE::nearestdangeroushostilekey, and PRESS.

Referenced by initGlobalCommandMap().

703 {
704  if (g().nearestdangeroushostilekey != PRESS)
706  if (k == PRESS)
708 }
void FireKeyboard::NearestFriendlyKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 710 of file firekeyboard.cpp.

References ExamineWhenTargetKey(), g(), FIREKEYBOARDTYPE::nearestfriendlykey, and PRESS.

Referenced by initGlobalCommandMap().

711 {
712  if (g().nearestfriendlykey != PRESS)
713  g().nearestfriendlykey = k;
714  if (k == PRESS)
716 }
void FireKeyboard::NearestHostileTargetKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 694 of file firekeyboard.cpp.

References ExamineWhenTargetKey(), g(), FIREKEYBOARDTYPE::nearesthostilekey, and PRESS.

Referenced by initGlobalCommandMap().

695 {
696  if (g().nearesthostilekey != PRESS)
697  g().nearesthostilekey = k;
698  if (k == PRESS)
700 }
void FireKeyboard::NearestJumpKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 734 of file firekeyboard.cpp.

References ExamineWhenTargetKey(), g(), FIREKEYBOARDTYPE::nearestjumpkey, and PRESS.

Referenced by initGlobalCommandMap().

735 {
736  if (g().nearestjumpkey != PRESS)
737  g().nearestjumpkey = k;
738  if (k == PRESS)
740 }
void FireKeyboard::NearestPlanetKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 726 of file firekeyboard.cpp.

References ExamineWhenTargetKey(), g(), FIREKEYBOARDTYPE::nearestplanetkey, and PRESS.

Referenced by initGlobalCommandMap().

727 {
728  if (g().nearestplanetkey != PRESS)
729  g().nearestplanetkey = k;
730  if (k == PRESS)
732 }
void FireKeyboard::NearestTargetKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 602 of file firekeyboard.cpp.

References ExamineWhenTargetKey(), g(), FIREKEYBOARDTYPE::neartargetkey, and PRESS.

Referenced by initGlobalCommandMap().

603 {
604  if (g().neartargetkey != PRESS)
605  g().neartargetkey = k;
606  if (k == PRESS)
608 }
void FireKeyboard::NearestTargetTurretKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 915 of file firekeyboard.cpp.

References ExamineWhenTargetKey(), g(), FIREKEYBOARDTYPE::nearturrettargetkey, and PRESS.

Referenced by initGlobalCommandMap().

916 {
917  if (g().nearturrettargetkey != PRESS)
918  g().nearturrettargetkey = k;
919  if (k == PRESS)
921 }
void FireKeyboard::PickTargetKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 560 of file firekeyboard.cpp.

References ExamineWhenTargetKey(), g(), FIREKEYBOARDTYPE::picktargetkey, PRESS, and RESET.

Referenced by initGlobalCommandMap().

561 {
562  if (g().picktargetkey != PRESS)
563  g().picktargetkey = k;
564  if (k == RESET)
565  g().picktargetkey = PRESS;
566  if (k == PRESS)
568 }
void FireKeyboard::PickTargetTurretKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 905 of file firekeyboard.cpp.

References ExamineWhenTargetKey(), g(), FIREKEYBOARDTYPE::pickturrettargetkey, PRESS, and RESET.

Referenced by initGlobalCommandMap().

906 {
907  if (g().pickturrettargetkey != PRESS)
908  g().pickturrettargetkey = k;
909  if (k == RESET)
911  if (k == PRESS)
913 }
void FireKeyboard::PressComm10Key ( const KBData ,
KBSTATE  k 
)
static

Definition at line 288 of file firekeyboard.cpp.

References FIREKEYBOARDTYPE::commKeys, g(), and PRESS.

Referenced by initGlobalCommandMap().

289 {
290  if (k == PRESS)
291  g().commKeys[9] = PRESS;
292 }
void FireKeyboard::PressComm1Key ( const KBData ,
KBSTATE  k 
)
static

Definition at line 234 of file firekeyboard.cpp.

References FIREKEYBOARDTYPE::commKeys, g(), and PRESS.

Referenced by initGlobalCommandMap().

235 {
236  if (k == PRESS)
237  g().commKeys[0] = PRESS;
238 }
void FireKeyboard::PressComm2Key ( const KBData ,
KBSTATE  k 
)
static

Definition at line 240 of file firekeyboard.cpp.

References FIREKEYBOARDTYPE::commKeys, g(), and PRESS.

Referenced by initGlobalCommandMap().

241 {
242  if (k == PRESS)
243  g().commKeys[1] = PRESS;
244 }
void FireKeyboard::PressComm3Key ( const KBData ,
KBSTATE  k 
)
static

Definition at line 246 of file firekeyboard.cpp.

References FIREKEYBOARDTYPE::commKeys, g(), and PRESS.

Referenced by initGlobalCommandMap().

247 {
248  if (k == PRESS)
249  g().commKeys[2] = PRESS;
250 }
void FireKeyboard::PressComm4Key ( const KBData ,
KBSTATE  k 
)
static

Definition at line 252 of file firekeyboard.cpp.

References FIREKEYBOARDTYPE::commKeys, g(), and PRESS.

Referenced by initGlobalCommandMap().

253 {
254  if (k == PRESS)
255  g().commKeys[3] = PRESS;
256 }
void FireKeyboard::PressComm5Key ( const KBData ,
KBSTATE  k 
)
static

Definition at line 258 of file firekeyboard.cpp.

References FIREKEYBOARDTYPE::commKeys, g(), and PRESS.

Referenced by initGlobalCommandMap().

259 {
260  if (k == PRESS)
261  g().commKeys[4] = PRESS;
262 }
void FireKeyboard::PressComm6Key ( const KBData ,
KBSTATE  k 
)
static

Definition at line 264 of file firekeyboard.cpp.

References FIREKEYBOARDTYPE::commKeys, g(), and PRESS.

Referenced by initGlobalCommandMap().

265 {
266  if (k == PRESS)
267  g().commKeys[5] = PRESS;
268 }
void FireKeyboard::PressComm7Key ( const KBData ,
KBSTATE  k 
)
static

Definition at line 270 of file firekeyboard.cpp.

References FIREKEYBOARDTYPE::commKeys, g(), and PRESS.

Referenced by initGlobalCommandMap().

271 {
272  if (k == PRESS)
273  g().commKeys[6] = PRESS;
274 }
void FireKeyboard::PressComm8Key ( const KBData ,
KBSTATE  k 
)
static

Definition at line 276 of file firekeyboard.cpp.

References FIREKEYBOARDTYPE::commKeys, g(), and PRESS.

Referenced by initGlobalCommandMap().

277 {
278  if (k == PRESS)
279  g().commKeys[7] = PRESS;
280 }
void FireKeyboard::PressComm9Key ( const KBData ,
KBSTATE  k 
)
static

Definition at line 282 of file firekeyboard.cpp.

References FIREKEYBOARDTYPE::commKeys, g(), and PRESS.

Referenced by initGlobalCommandMap().

283 {
284  if (k == PRESS)
285  g().commKeys[8] = PRESS;
286 }
void FireKeyboard::ProcessCommMessage ( class CommunicationMessage c)
virtual

processes a single message...generally called by the Messages() func

Reimplemented from Order.

Definition at line 1486 of file firekeyboard.cpp.

References _Universe, Universe::AccessCockpit(), AUDIsPlaying(), AUDPlay(), Cockpit::CheckCommAnimation(), DoSpeech(), DoSpeechAndAni(), CommunicationMessage::getCurrentState(), Unit::GetHull(), Cockpit::GetParent(), FSM::Node::GetSound(), UnitContainer::GetUnit(), i, MyFunction(), Order::parent, QVector, CommunicationMessage::sender, CommunicationMessage::sex, and Vector.

1487 {
1488  Unit *un = c.sender.GetUnit();
1489  unsigned int whichsound = 0;
1490  bool foundValidMessage = false;
1491  if ( _Universe->AccessCockpit()->CheckCommAnimation( un ) )
1492  return; //wait till later
1493 
1494  bool reallydospeech = false;
1495  if (un && un->GetHull() > 0) {
1496  reallydospeech = true;
1497  for (list< CommunicationMessage >::iterator i = resp.begin(); i != resp.end(); i++)
1498  if ( (*i).sender.GetUnit() == un )
1499  if ( ( i = resp.erase( i ) ) == resp.end() )
1500  break;
1501  resp.push_back( c );
1502  if (!foundValidMessage)
1503  whichsound = DoSpeechAndAni( un, parent, c );
1504  } else if (0) {
1505  //none of this happens
1506  whichsound = DoSpeech( NULL, NULL, *c.getCurrentState() );
1507  //this is when a unit is already dead
1508  if ( parent == _Universe->AccessCockpit()->GetParent() )
1509  MyFunction();
1510  //mmhmm! Gcc-4.1 hack -- otherwise linker failure
1511  }
1512  int sound = c.getCurrentState()->GetSound( c.sex, whichsound );
1513  if ( reallydospeech && !AUDIsPlaying( sound ) )
1514  AUDPlay( sound, QVector( 0, 0, 0 ), Vector( 0, 0, 0 ), 1 );
1515 }
void FireKeyboard::RequestClearenceKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 422 of file firekeyboard.cpp.

References g(), PRESS, RELEASE, and FIREKEYBOARDTYPE::req.

Referenced by initGlobalCommandMap().

423 {
424  if (k == PRESS)
425  g().req = true;
426  if (k == RELEASE)
427  g().req = false;
428 }
void FireKeyboard::RestoreTarget10Key ( const KBData ,
KBSTATE  k 
)
static

Definition at line 408 of file firekeyboard.cpp.

References g(), PRESS, and FIREKEYBOARDTYPE::restoreTargetKeys.

Referenced by initGlobalCommandMap().

409 {
410  if (k == PRESS)
411  g().restoreTargetKeys[9] = PRESS;
412 }
void FireKeyboard::RestoreTarget1Key ( const KBData ,
KBSTATE  k 
)
static

Definition at line 354 of file firekeyboard.cpp.

References g(), PRESS, and FIREKEYBOARDTYPE::restoreTargetKeys.

Referenced by initGlobalCommandMap().

355 {
356  if (k == PRESS)
357  g().restoreTargetKeys[0] = PRESS;
358 }
void FireKeyboard::RestoreTarget2Key ( const KBData ,
KBSTATE  k 
)
static

Definition at line 360 of file firekeyboard.cpp.

References g(), PRESS, and FIREKEYBOARDTYPE::restoreTargetKeys.

Referenced by initGlobalCommandMap().

361 {
362  if (k == PRESS)
363  g().restoreTargetKeys[1] = PRESS;
364 }
void FireKeyboard::RestoreTarget3Key ( const KBData ,
KBSTATE  k 
)
static

Definition at line 366 of file firekeyboard.cpp.

References g(), PRESS, and FIREKEYBOARDTYPE::restoreTargetKeys.

Referenced by initGlobalCommandMap().

367 {
368  if (k == PRESS)
369  g().restoreTargetKeys[2] = PRESS;
370 }
void FireKeyboard::RestoreTarget4Key ( const KBData ,
KBSTATE  k 
)
static

Definition at line 372 of file firekeyboard.cpp.

References g(), PRESS, and FIREKEYBOARDTYPE::restoreTargetKeys.

Referenced by initGlobalCommandMap().

373 {
374  if (k == PRESS)
375  g().restoreTargetKeys[3] = PRESS;
376 }
void FireKeyboard::RestoreTarget5Key ( const KBData ,
KBSTATE  k 
)
static

Definition at line 378 of file firekeyboard.cpp.

References g(), PRESS, and FIREKEYBOARDTYPE::restoreTargetKeys.

Referenced by initGlobalCommandMap().

379 {
380  if (k == PRESS)
381  g().restoreTargetKeys[4] = PRESS;
382 }
void FireKeyboard::RestoreTarget6Key ( const KBData ,
KBSTATE  k 
)
static

Definition at line 384 of file firekeyboard.cpp.

References g(), PRESS, and FIREKEYBOARDTYPE::restoreTargetKeys.

Referenced by initGlobalCommandMap().

385 {
386  if (k == PRESS)
387  g().restoreTargetKeys[5] = PRESS;
388 }
void FireKeyboard::RestoreTarget7Key ( const KBData ,
KBSTATE  k 
)
static

Definition at line 390 of file firekeyboard.cpp.

References g(), PRESS, and FIREKEYBOARDTYPE::restoreTargetKeys.

Referenced by initGlobalCommandMap().

391 {
392  if (k == PRESS)
393  g().restoreTargetKeys[6] = PRESS;
394 }
void FireKeyboard::RestoreTarget8Key ( const KBData ,
KBSTATE  k 
)
static

Definition at line 396 of file firekeyboard.cpp.

References g(), PRESS, and FIREKEYBOARDTYPE::restoreTargetKeys.

Referenced by initGlobalCommandMap().

397 {
398  if (k == PRESS)
399  g().restoreTargetKeys[7] = PRESS;
400 }
void FireKeyboard::RestoreTarget9Key ( const KBData ,
KBSTATE  k 
)
static

Definition at line 402 of file firekeyboard.cpp.

References g(), PRESS, and FIREKEYBOARDTYPE::restoreTargetKeys.

Referenced by initGlobalCommandMap().

403 {
404  if (k == PRESS)
405  g().restoreTargetKeys[8] = PRESS;
406 }
void FireKeyboard::ReverseIncomingMissileTargetKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 594 of file firekeyboard.cpp.

References ExamineWhenTargetKey(), g(), PRESS, and FIREKEYBOARDTYPE::rincomingmissiletargetkey.

Referenced by initGlobalCommandMap().

595 {
596  if (g().rincomingmissiletargetkey != PRESS)
598  if (k == PRESS)
600 }
void FireKeyboard::ReverseMisSelKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 937 of file firekeyboard.cpp.

References g(), PRESS, and FIREKEYBOARDTYPE::rmisk.

Referenced by initGlobalCommandMap(), and CockpitKeys::ReverseMissileModeVDU().

938 {
939  if (g().rmisk != PRESS)
940  g().rmisk = k;
941 }
void FireKeyboard::ReverseMissileTargetKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 586 of file firekeyboard.cpp.

References ExamineWhenTargetKey(), g(), PRESS, and FIREKEYBOARDTYPE::rmissiletargetkey.

Referenced by initGlobalCommandMap().

587 {
588  if (g().rmissiletargetkey != PRESS)
589  g().rmissiletargetkey = k;
590  if (k == PRESS)
592 }
void FireKeyboard::ReverseMissionTargetKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 491 of file firekeyboard.cpp.

References g(), PRESS, and FIREKEYBOARDTYPE::rmissiontargetkey.

Referenced by initGlobalCommandMap().

492 {
493  if (k == PRESS)
495 }
void FireKeyboard::ReverseNearestTargetKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 662 of file firekeyboard.cpp.

References ExamineWhenTargetKey(), g(), PRESS, and FIREKEYBOARDTYPE::rneartargetkey.

Referenced by initGlobalCommandMap().

663 {
664  if (g().rneartargetkey != PRESS)
665  g().rneartargetkey = k;
666  if (k == PRESS)
668 }
void FireKeyboard::ReversePickTargetKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 652 of file firekeyboard.cpp.

References ExamineWhenTargetKey(), g(), PRESS, RESET, and FIREKEYBOARDTYPE::rpicktargetkey.

Referenced by initGlobalCommandMap().

653 {
654  if (g().rpicktargetkey != PRESS)
655  g().rpicktargetkey = k;
656  if (k == RESET)
657  g().rpicktargetkey = PRESS;
658  if (k == PRESS)
660 }
void FireKeyboard::ReverseSigTargetKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 686 of file firekeyboard.cpp.

References ExamineWhenTargetKey(), g(), PRESS, and FIREKEYBOARDTYPE::rtargetskey.

Referenced by initGlobalCommandMap().

687 {
688  if (g().rtargetskey != PRESS)
689  g().rtargetskey = k;
690  if (k == PRESS)
692 }
void FireKeyboard::ReverseTargetKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 642 of file firekeyboard.cpp.

References ExamineWhenTargetKey(), g(), PRESS, RESET, and FIREKEYBOARDTYPE::rtargetkey.

Referenced by initGlobalCommandMap().

643 {
644  if (g().rtargetkey != PRESS)
645  g().rtargetkey = k;
646  if (k == RESET)
647  g().rtargetkey = PRESS;
648  if (k == PRESS)
650 }
void FireKeyboard::ReverseThreatTargetKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 670 of file firekeyboard.cpp.

References ExamineWhenTargetKey(), g(), PRESS, and FIREKEYBOARDTYPE::rthreattargetkey.

Referenced by initGlobalCommandMap().

671 {
672  if (g().rthreattargetkey != PRESS)
673  g().rthreattargetkey = k;
674  if (k == PRESS)
676 }
void FireKeyboard::ReverseUnitTargetKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 678 of file firekeyboard.cpp.

References ExamineWhenTargetKey(), g(), PRESS, and FIREKEYBOARDTYPE::rtargetukey.

Referenced by initGlobalCommandMap().

679 {
680  if (g().rtargetukey != PRESS)
681  g().rtargetukey = k;
682  if (k == PRESS)
684 }
void FireKeyboard::ReverseWeapSelKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 931 of file firekeyboard.cpp.

References g(), PRESS, and FIREKEYBOARDTYPE::rweapk.

Referenced by initGlobalCommandMap(), and CockpitKeys::ReverseGunModeVDU().

932 {
933  if (g().rweapk != PRESS)
934  g().rweapk = k;
935 }
void FireKeyboard::SaveTarget10Key ( const KBData ,
KBSTATE  k 
)
static

Definition at line 348 of file firekeyboard.cpp.

References g(), PRESS, and FIREKEYBOARDTYPE::saveTargetKeys.

Referenced by initGlobalCommandMap().

349 {
350  if (k == PRESS)
351  g().saveTargetKeys[9] = PRESS;
352 }
void FireKeyboard::SaveTarget1Key ( const KBData ,
KBSTATE  k 
)
static

Definition at line 294 of file firekeyboard.cpp.

References g(), PRESS, and FIREKEYBOARDTYPE::saveTargetKeys.

Referenced by initGlobalCommandMap().

295 {
296  if (k == PRESS)
297  g().saveTargetKeys[0] = PRESS;
298 }
void FireKeyboard::SaveTarget2Key ( const KBData ,
KBSTATE  k 
)
static

Definition at line 300 of file firekeyboard.cpp.

References g(), PRESS, and FIREKEYBOARDTYPE::saveTargetKeys.

Referenced by initGlobalCommandMap().

301 {
302  if (k == PRESS)
303  g().saveTargetKeys[1] = PRESS;
304 }
void FireKeyboard::SaveTarget3Key ( const KBData ,
KBSTATE  k 
)
static

Definition at line 306 of file firekeyboard.cpp.

References g(), PRESS, and FIREKEYBOARDTYPE::saveTargetKeys.

Referenced by initGlobalCommandMap().

307 {
308  if (k == PRESS)
309  g().saveTargetKeys[2] = PRESS;
310 }
void FireKeyboard::SaveTarget4Key ( const KBData ,
KBSTATE  k 
)
static

Definition at line 312 of file firekeyboard.cpp.

References g(), PRESS, and FIREKEYBOARDTYPE::saveTargetKeys.

Referenced by initGlobalCommandMap().

313 {
314  if (k == PRESS)
315  g().saveTargetKeys[3] = PRESS;
316 }
void FireKeyboard::SaveTarget5Key ( const KBData ,
KBSTATE  k 
)
static

Definition at line 318 of file firekeyboard.cpp.

References g(), PRESS, and FIREKEYBOARDTYPE::saveTargetKeys.

Referenced by initGlobalCommandMap().

319 {
320  if (k == PRESS)
321  g().saveTargetKeys[4] = PRESS;
322 }
void FireKeyboard::SaveTarget6Key ( const KBData ,
KBSTATE  k 
)
static

Definition at line 324 of file firekeyboard.cpp.

References g(), PRESS, and FIREKEYBOARDTYPE::saveTargetKeys.

Referenced by initGlobalCommandMap().

325 {
326  if (k == PRESS)
327  g().saveTargetKeys[5] = PRESS;
328 }
void FireKeyboard::SaveTarget7Key ( const KBData ,
KBSTATE  k 
)
static

Definition at line 330 of file firekeyboard.cpp.

References g(), PRESS, and FIREKEYBOARDTYPE::saveTargetKeys.

Referenced by initGlobalCommandMap().

331 {
332  if (k == PRESS)
333  g().saveTargetKeys[6] = PRESS;
334 }
void FireKeyboard::SaveTarget8Key ( const KBData ,
KBSTATE  k 
)
static

Definition at line 336 of file firekeyboard.cpp.

References g(), PRESS, and FIREKEYBOARDTYPE::saveTargetKeys.

Referenced by initGlobalCommandMap().

337 {
338  if (k == PRESS)
339  g().saveTargetKeys[7] = PRESS;
340 }
void FireKeyboard::SaveTarget9Key ( const KBData ,
KBSTATE  k 
)
static

Definition at line 342 of file firekeyboard.cpp.

References g(), PRESS, and FIREKEYBOARDTYPE::saveTargetKeys.

Referenced by initGlobalCommandMap().

343 {
344  if (k == PRESS)
345  g().saveTargetKeys[8] = PRESS;
346 }
void FireKeyboard::SetParent ( Unit parent1)
virtual

Sets the parent of this Unit. Any virtual functions must call this one.

Reimplemented from Order.

Definition at line 1635 of file firekeyboard.cpp.

References VegaConfig::getVariable(), Order::parent, XMLSupport::parse_bool(), Order::SetParent(), Unit::ToggleWeapon(), and vs_config.

1636 {
1637  this->Order::SetParent( parent1 );
1638  static bool allow_special_with_weapons =
1639  XMLSupport::parse_bool( vs_config->getVariable( "physics", "special_and_normal_gun_combo", "true" ) );
1640  if (!allow_special_with_weapons) {
1641  parent->ToggleWeapon( false, true /*reverse*/ );
1642  parent->ToggleWeapon( false, false /*reverse*/ );
1643  }
1644 }
void FireKeyboard::SetShieldsOff ( const KBData ,
KBSTATE  k 
)
static

Definition at line 176 of file firekeyboard.cpp.

References g(), VegaConfig::getVariable(), soundContainer::loadsound(), soundContainer::playsound(), PRESS, FIREKEYBOARDTYPE::shieldpowerstate, soundContainer::sound, and vs_config.

Referenced by initGlobalCommandMap().

177 {
178  if (k == PRESS) {
179  float pow = 0;
180  static soundContainer sc;
181  if (sc.sound < 0) {
182  static string str = vs_config->getVariable( "cockpitaudio", "shield", "vdu_d" );
183  sc.loadsound( str );
184  }
185  sc.playsound();
186  if (g().shieldpowerstate != pow)
187  g().shieldpowerstate = pow;
188  else
189  g().shieldpowerstate = 1;
190  }
191 }
void FireKeyboard::SetShieldsOneThird ( const KBData ,
KBSTATE  k 
)
static

Definition at line 159 of file firekeyboard.cpp.

References g(), VegaConfig::getVariable(), soundContainer::loadsound(), soundContainer::playsound(), PRESS, FIREKEYBOARDTYPE::shieldpowerstate, soundContainer::sound, and vs_config.

Referenced by initGlobalCommandMap().

160 {
161  if (k == PRESS) {
162  float pow = 1./3;
163  static soundContainer sc;
164  if (sc.sound < 0) {
165  static string str = vs_config->getVariable( "cockpitaudio", "shield", "vdu_d" );
166  sc.loadsound( str );
167  }
168  sc.playsound();
169  if (g().shieldpowerstate != pow)
170  g().shieldpowerstate = pow;
171  else
172  g().shieldpowerstate = 1;
173  }
174 }
void FireKeyboard::SetShieldsTwoThird ( const KBData ,
KBSTATE  k 
)
static

Definition at line 193 of file firekeyboard.cpp.

References g(), VegaConfig::getVariable(), soundContainer::loadsound(), soundContainer::playsound(), PRESS, FIREKEYBOARDTYPE::shieldpowerstate, soundContainer::sound, and vs_config.

Referenced by initGlobalCommandMap().

194 {
195  if (k == PRESS) {
196  float pow = 2./3;
197  static soundContainer sc;
198  if (sc.sound < 0) {
199  static string str = vs_config->getVariable( "cockpitaudio", "shield", "vdu_d" );
200  sc.loadsound( str );
201  }
202  sc.playsound();
203  if (g().shieldpowerstate != pow)
204  g().shieldpowerstate = pow;
205  else
206  g().shieldpowerstate = 1;
207  }
208 }
void FireKeyboard::SigTargetKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 634 of file firekeyboard.cpp.

References ExamineWhenTargetKey(), g(), PRESS, and FIREKEYBOARDTYPE::targetskey.

Referenced by initGlobalCommandMap().

635 {
636  if (g().targetskey != PRESS)
637  g().targetskey = k;
638  if (k == PRESS)
640 }
void FireKeyboard::SubUnitTargetKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 610 of file firekeyboard.cpp.

References ExamineWhenTargetKey(), g(), PRESS, and FIREKEYBOARDTYPE::subtargetkey.

Referenced by initGlobalCommandMap().

611 {
612  if (g().subtargetkey != PRESS)
613  g().subtargetkey = k;
614  if (k == PRESS)
616 }
void FireKeyboard::TargetKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 550 of file firekeyboard.cpp.

References ExamineWhenTargetKey(), g(), PRESS, RESET, and FIREKEYBOARDTYPE::targetkey.

Referenced by initGlobalCommandMap().

551 {
552  if (g().targetkey != PRESS)
553  g().targetkey = k;
554  if (k == RESET)
555  g().targetkey = PRESS;
556  if (k == PRESS)
558 }
void FireKeyboard::TargetTurretKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 895 of file firekeyboard.cpp.

References ExamineWhenTargetKey(), g(), PRESS, RESET, and FIREKEYBOARDTYPE::turrettargetkey.

Referenced by initGlobalCommandMap().

896 {
897  if (g().turrettargetkey != PRESS)
898  g().turrettargetkey = k;
899  if (k == RESET)
900  g().turrettargetkey = PRESS;
901  if (k == PRESS)
903 }
void FireKeyboard::ThreatTargetKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 618 of file firekeyboard.cpp.

References ExamineWhenTargetKey(), g(), PRESS, and FIREKEYBOARDTYPE::threattargetkey.

Referenced by initGlobalCommandMap().

619 {
620  if (g().threattargetkey != PRESS)
621  g().threattargetkey = k;
622  if (k == PRESS)
624 }
void FireKeyboard::ThreatTargetTurretKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 923 of file firekeyboard.cpp.

References ExamineWhenTargetKey(), g(), PRESS, and FIREKEYBOARDTYPE::threatturrettargetkey.

Referenced by initGlobalCommandMap().

924 {
925  if (g().threatturrettargetkey != PRESS)
927  if (k == PRESS)
929 }
void FireKeyboard::ToggleAnimation ( const KBData ,
KBSTATE  k 
)
static

Definition at line 228 of file firekeyboard.cpp.

References g(), PRESS, and FIREKEYBOARDTYPE::toggleanimation.

Referenced by initGlobalCommandMap().

229 {
230  if (k == PRESS)
231  g().toggleanimation = PRESS;
232 }
void FireKeyboard::ToggleAutotracking ( const KBData ,
KBSTATE  k 
)
static

Definition at line 216 of file firekeyboard.cpp.

References g(), PRESS, and FIREKEYBOARDTYPE::toggleautotracking.

Referenced by initGlobalCommandMap().

217 {
218  if (k == PRESS)
220 }
void FireKeyboard::ToggleGlow ( const KBData ,
KBSTATE  k 
)
static

Definition at line 210 of file firekeyboard.cpp.

References g(), PRESS, and FIREKEYBOARDTYPE::toggleglow.

Referenced by initGlobalCommandMap().

211 {
212  if (k == PRESS)
213  g().toggleglow = PRESS;
214 }
void FireKeyboard::TogglePause ( const KBData ,
KBSTATE  k 
)
static

Definition at line 742 of file firekeyboard.cpp.

References g(), PRESS, and FIREKEYBOARDTYPE::togglepausekey.

Referenced by initGlobalCommandMap().

743 {
744  if (g().togglepausekey != PRESS)
745  g().togglepausekey = k;
746 }
void FireKeyboard::ToggleWarpDrive ( const KBData ,
KBSTATE  k 
)
static

Definition at line 222 of file firekeyboard.cpp.

References g(), PRESS, and FIREKEYBOARDTYPE::togglewarpdrive.

Referenced by initGlobalCommandMap().

223 {
224  if (k == PRESS)
225  g().togglewarpdrive = PRESS;
226 }
void FireKeyboard::TurretAIOff ( const KBData ,
KBSTATE  k 
)
static

Definition at line 473 of file firekeyboard.cpp.

References g(), PRESS, and FIREKEYBOARDTYPE::turretoffkey.

Referenced by initGlobalCommandMap().

474 {
475  if (k == PRESS)
476  g().turretoffkey = k;
477 }
void FireKeyboard::TurretAIOn ( const KBData ,
KBSTATE  k 
)
static

Definition at line 467 of file firekeyboard.cpp.

References g(), PRESS, and FIREKEYBOARDTYPE::turretaikey.

Referenced by initGlobalCommandMap().

468 {
469  if (k == PRESS)
470  g().turretaikey = k;
471 }
void FireKeyboard::TurretFireAtWill ( const KBData ,
KBSTATE  k 
)
static

Definition at line 479 of file firekeyboard.cpp.

References g(), PRESS, and FIREKEYBOARDTYPE::turretfaw.

Referenced by initGlobalCommandMap().

480 {
481  if (k == PRESS)
482  g().turretfaw = k;
483 }
void FireKeyboard::UnDockKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 439 of file firekeyboard.cpp.

References _Universe, Universe::AccessCockpit(), g(), Cockpit::GetParent(), Unit::isSubUnit(), PRESS, RELEASE, and FIREKEYBOARDTYPE::und.

Referenced by initGlobalCommandMap().

440 {
442  if ( k == PRESS && u && (u->isSubUnit() == false) )
443  g().und = true;
444  if ( k == RELEASE && u && (u->isSubUnit() == false) )
445  g().und = false;
446 }
void FireKeyboard::UnitTargetKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 626 of file firekeyboard.cpp.

References ExamineWhenTargetKey(), g(), PRESS, and FIREKEYBOARDTYPE::targetukey.

Referenced by initGlobalCommandMap().

627 {
628  if (g().targetukey != PRESS)
629  g().targetukey = k;
630  if (k == PRESS)
632 }
void FireKeyboard::WeapSelKey ( const KBData ,
KBSTATE  k 
)
static

Definition at line 943 of file firekeyboard.cpp.

References g(), PRESS, and FIREKEYBOARDTYPE::weapk.

Referenced by CockpitKeys::GunModeVDU(), and initGlobalCommandMap().

944 {
945  if (g().weapk != PRESS)
946  g().weapk = k;
947 }

Member Data Documentation

float FireKeyboard::distance
protected

Definition at line 137 of file firekeyboard.h.

void* FireKeyboard::savedTargets[NUMSAVEDTARGETS]
protected

Definition at line 136 of file firekeyboard.h.

Referenced by Execute(), and FireKeyboard().

unsigned int FireKeyboard::whichjoystick
protected

Definition at line 146 of file firekeyboard.h.

Referenced by Execute(), FireKeyboard(), and j().

unsigned int FireKeyboard::whichplayer
protected

Definition at line 145 of file firekeyboard.h.

Referenced by Execute(), f(), and FireKeyboard().


The documentation for this class was generated from the following files: