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
BaseInterface::Room::Launch Class Reference

#include <base.h>

Inheritance diagram for BaseInterface::Room::Launch:
BaseInterface::Room::Link

Public Member Functions

virtual void Click (::BaseInterface *base, float x, float y, int button, int state)
 
virtual ~Launch ()
 
 Launch (const std::string &ind, const std::string &pythonfile)
 

Additional Inherited Members

Detailed Description

Definition at line 97 of file base.h.

Constructor & Destructor Documentation

virtual BaseInterface::Room::Launch::~Launch ( )
inlinevirtual

Definition at line 101 of file base.h.

101 {}
BaseInterface::Room::Launch::Launch ( const std::string &  ind,
const std::string &  pythonfile 
)
inlineexplicit

Definition at line 102 of file base.h.

102 : Link( ind, pythonfile ) {}

Member Function Documentation

void BaseInterface::Room::Launch::Click ( ::BaseInterface base,
float  x,
float  y,
int  button,
int  state 
)
virtual

Reimplemented from BaseInterface::Room::Link.

Definition at line 1206 of file base_interface.cpp.

References _Universe, abletodock(), BaseInterface::baseun, c, BaseInterface::caller, BaseInterface::Room::Link::Click(), Order::Communicate(), Unit::faction, CommunicationMessage::fsm, Unit::getAIState(), Unit::GetSerial(), FSM::GetUnDockNode(), UnitContainer::GetUnit(), VegaConfig::getVariable(), Unit::name, Network, Unit::owner, XMLSupport::parse_bool(), CommunicationMessage::SetCurrentState(), BaseInterface::Terminate(), Unit::UnDock(), NetClient::undockRequest(), vs_config, Universe::whichPlayerStarship(), and WS_MOUSE_UP.

1207 {
1208  if (state == WS_MOUSE_UP) {
1209  Link::Click( base, x, y, button, state );
1210  static bool auto_undock_var = XMLSupport::parse_bool( vs_config->getVariable( "physics", "AutomaticUnDock", "true" ) );
1211  bool auto_undock = auto_undock_var;
1212  Unit *bas = base->baseun.GetUnit();
1213  Unit *playa = base->caller.GetUnit();
1214  if (Network != NULL && auto_undock && playa && bas) {
1215  cerr<<"Sending an undock notification"<<endl;
1216  int playernum = _Universe->whichPlayerStarship( playa );
1217  if (playernum >= 0) {
1218  Network[playernum].undockRequest( bas->GetSerial() );
1219  auto_undock = false;
1220  }
1221  }
1222  if (playa && bas) {
1223  if ( ( (playa->name == "eject") || (playa->name == "ejecting") || (playa->name == "pilot")
1224  || (playa->name == "Pilot") || (playa->name == "Eject") ) && (bas->faction == playa->faction) )
1225  playa->name = "return_to_cockpit";
1226  }
1227  if ( (playa && bas) && ( auto_undock || (playa->name == "return_to_cockpit") ) ) {
1228  playa->UnDock( bas );
1229  CommunicationMessage c( bas, playa, NULL, 0 );
1230  c.SetCurrentState( c.fsm->GetUnDockNode(), NULL, 0 );
1231  if ( playa->getAIState() )
1232  playa->getAIState()->Communicate( c );
1233  abletodock( 5 );
1234  if (playa->name == "return_to_cockpit")
1235  if (playa->faction == playa->faction)
1236  playa->owner = bas;
1237  }
1238  base->Terminate();
1239  }
1240 }

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