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
Orders::MoveTo Class Reference

#include <navigation.h>

Inheritance diagram for Orders::MoveTo:
Order FlyTo Orders::DockingOps Orders::FormUp Orders::FormUpToOwner

Public Member Functions

void SetAfterburn (bool tf)
 The last_velocity keeps track of the previous velocity so the script may determine if it has crossed over 0 this frame or not. More...
 
 MoveTo (const QVector &target, bool aft, unsigned char switchbacks, bool terminating=true)
 takes in the destination target, whether afterburners should be applied, and the ammount of accuracy (how many times it shoudl miss destination and come back) should be used More...
 
void SetDest (const QVector &)
 
virtual void Execute ()
 The function that gets called and executes all queued suborders. More...
 
virtual ~MoveTo ()
 
virtual string getOrderDescription ()
 
- 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 ()
 
virtual void SetParent (Unit *parent1)
 Sets the parent of this Unit. Any virtual functions must call this one. More...
 
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 ProcessCommMessage (class CommunicationMessage &c)
 processes a single message...generally called by the Messages() func 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)
 
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 ()
 

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 }
 
- 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 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
 

Detailed Description

Definition at line 48 of file navigation.h.

Constructor & Destructor Documentation

Orders::MoveTo::MoveTo ( const QVector target,
bool  aft,
unsigned char  switchbacks,
bool  terminating = true 
)
inline

takes in the destination target, whether afterburners should be applied, and the ammount of accuracy (how many times it shoudl miss destination and come back) should be used

Definition at line 58 of file navigation.h.

References Order::done, and Order::targetlocation.

58  : Order( MOVEMENT,
59  SLOCATION )
60  , m( aft, switchbacks, terminating )
61  {
62  targetlocation = target;
63  done = false;
64  }
MoveTo::~MoveTo ( )
virtual

Definition at line 212 of file navigation.cpp.

References VSFileSystem::vs_fprintf().

213 {
214 #ifdef ORDERDEBUG
215  VSFileSystem::vs_fprintf( stderr, "mt%x", this );
216  fflush( stderr );
217 #endif
218 }

Member Function Documentation

void MoveTo::Execute ( )
virtual
virtual string Orders::MoveTo::getOrderDescription ( )
inlinevirtual

Reimplemented from Order.

Reimplemented in Orders::FormUpToOwner, and Orders::FormUp.

Definition at line 68 of file navigation.h.

69  {
70  return "moveto";
71  }
void Orders::MoveTo::SetAfterburn ( bool  tf)
inline

The last_velocity keeps track of the previous velocity so the script may determine if it has crossed over 0 this frame or not.

Definition at line 53 of file navigation.h.

References Orders::MoveToParent::SetAfterburn().

Referenced by Orders::DockingOps::Movement().

54  {
55  m.SetAfterburn( tf );
56  }
void MoveTo::SetDest ( const QVector target)

The Time We need to start slowing down from the now calculation. k = num simulation atoms before we slow down. m = num sim atoms till we stop R = P = 1 We know v + S*k*a-S*m*d=0 (stopped at end) m = v/(d*S)+k*a/d L = a*S^2 (k*(k+R)*.5) - d*S^2 (m*(m+P)*.5) + v*(k+m)*S L = .5*a*k^2*S^2+.5*a*k*R*s^2 - .5*d*S^2 (k*a/d + v/(d*S))*(k*a/d+v/(d*S)+P) + S*v*(v/(d*S) + k*a/d + k) L = k^2 (.5*a*S^2) +.5*a*k*R*S^2 - .5*d*S^2 (k^2 a^2 / d^2 + 2*(k*a/d)*v/(dS) + v^2/(d^2 s^2) + Pk*a/d + P * v/(d*S)) + v^2/d + S*v*k (a/d + 1) 0 = k^2 (.5*a*S*S*(1-a/d)) + k*S*( .5*R*a*S - .5*P*a*S- .5*2*a*v/d+v(1+a/d)) + v*v/d-.5*v*v/d- P*v*S*.5 - L 0 = (k*S)^2 *(.5*a*(1-a/d)) + k*S*v + v^2/(2d) - vS/2 -L kS = -v (+/-) sqrtf (v*v-a*(1-a/d)*(v*v/d-vS-L))/(a*(1-a/d))

Definition at line 98 of file navigation.cpp.

References Order::done, and Order::targetlocation.

Referenced by Orders::FormUp::Execute(), Orders::FormUpToOwner::Execute(), Orders::DockingOps::Movement(), Orders::DockingOps::PerformDockingOperations(), and Orders::DockingOps::Undock().

99 {
100  targetlocation = target;
101  done = false;
102 }

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