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
fire.h File Reference
#include "comm_ai.h"
#include "event_xml.h"

Go to the source code of this file.

Classes

class  Orders::FireAt
 

Namespaces

 Orders
 

Constant Groups

 Orders
 

Functions

bool RequestClearence (class Unit *parent, class Unit *targ, unsigned char sex)
 
UnitgetAtmospheric (Unit *targ)
 

Function Documentation

Unit* getAtmospheric ( Unit targ)

Definition at line 29 of file fire.cpp.

References _Universe, Universe::activeStarSystem(), UnitCollection::createIterator(), StarSystem::getUnitList(), i, Unit::isUnit(), Magnitude(), PLANETPTR, Unit::Position(), and Unit::rSize().

Referenced by RequestClearence().

30 {
31  if (targ) {
32  Unit *un;
34  (un = *i) != NULL;
35  ++i)
36  if (un->isUnit() == PLANETPTR) {
37  if ( ( targ->Position()-un->Position() ).Magnitude() < targ->rSize()*.5 )
38  if ( !( ( (Planet*) un )->isAtmospheric() ) )
39  return un;
40  }
41  }
42  return NULL;
43 }
bool RequestClearence ( class Unit parent,
class Unit targ,
unsigned char  sex 
)

Definition at line 45 of file fire.cpp.

References c, Order::Communicate(), Unit::DockingPortLocations(), CommunicationMessage::fsm, Unit::getAIState(), getAtmospheric(), FSM::GetRequestLandNode(), Unit::isUnit(), NoDockWithClear(), PLANETPTR, CommunicationMessage::SetCurrentState(), and Unit::Target().

Referenced by Cockpit::Update().

46 {
47  if ( !targ->DockingPortLocations().size() )
48  return false;
49  if (targ->isUnit() == PLANETPTR) {
50  if ( ( (Planet*) targ )->isAtmospheric() && NoDockWithClear() ) {
51  targ = getAtmospheric( targ );
52  if (!targ)
53  return false;
54  parent->Target( targ );
55  }
56  }
57  CommunicationMessage c( parent, targ, NULL, sex );
58  c.SetCurrentState( c.fsm->GetRequestLandNode(), NULL, sex );
59  Order *o = targ->getAIState();
60  if (o)
61  o->Communicate( c );
62  return true;
63 }