Vegastrike 0.5.1 rc1
1.0
Original sources for Vegastrike Evolved
|
#include <order.h>
Public Types | |
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 } |
Public Member Functions | |
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... | |
virtual void | Execute () |
The function that gets called and executes all queued suborders. More... | |
Order * | queryType (unsigned int type) |
returns a pointer to the first order that may be bitwised ored with that type More... | |
Order * | queryAny (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... | |
Order * | EnqueueOrder (Order *ord) |
Enqueues another order that will be executed (in parallel perhaps) when next void Execute() is called. More... | |
Order * | ReplaceOrder (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... | |
Unit * | GetParent () 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... | |
Order * | findOrder (Order *ord) |
return pointer to order or NULL if not found More... | |
void | eraseOrder (Order *ord) |
erase that order from the list More... | |
Order * | EnqueueOrderFirst (Order *ord) |
enqueue order as first order More... | |
virtual olist_t * | getOrderList () |
returns the orderlist (NULL for orders that haven't got any) More... | |
virtual void | AdjustRelationTo (Unit *un, float factor) |
virtual std::string | getOrderDescription () |
Order * | findOrderList () |
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 () |
Protected Member Functions | |
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 | |
Unit * | parent |
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 |
enum Order::ORDERTYPES |
enum Order::SUBORDERTYPES |
|
protectedvirtual |
|
inline |
The default constructor setting everything to NULL and no dependency on order.
Definition at line 87 of file order.h.
References VSCONSTRUCT1.
Referenced by OrderFactory::newOrder().
The constructor that specifies what order dependencies this order has.
Definition at line 97 of file order.h.
References VSCONSTRUCT1.
Reimplemented in CommunicatingAI.
Definition at line 8 of file order_comm.cpp.
Referenced by CommunicatingAI::AdjustRelationTo(), Communicate(), and FireKeyboard::DoSpeechAndAni().
Attaches a group of targets to this order (used for strategery-type games)
Definition at line 118 of file order.cpp.
References AttachSelfOrder(), parent, SSELF, STARGET, subtype, and Unit::Target().
Referenced by Orders::AggressiveAI::AggressiveAI(), and PlanetaryOrbit::PlanetaryOrbit().
Attaches a navigation point to this order.
Definition at line 138 of file order.cpp.
References SLOCATION, subtype, and targetlocation.
Attaches a group (form up) to this order.
Definition at line 130 of file order.cpp.
References group, UnitContainer::SetUnit(), SSELF, and subtype.
Referenced by AttachOrder(), PlanetaryOrbit::PlanetaryOrbit(), Orders::AggressiveAI::ProcessCurrentFgDirective(), Orders::FormUp::SetParent(), Orders::FormUpToOwner::SetParent(), and Orders::FaceDirection::SetParent().
|
inlinevirtual |
this function calls the destructor (needs to be overridden for python;
Reimplemented in Orders::FireAt.
Definition at line 73 of file order.h.
Referenced by Pilot::adjustSpecificRelationship().
void Order::ClearMessages | ( | ) |
clears the messasges of this order
Definition at line 185 of file order.cpp.
References i, messagequeue, and suborders.
|
virtual |
Sends a communication message from the Unit (encapulated in c) to this unit.
Definition at line 13 of file order_comm.cpp.
References _Universe, AdjustRelationTo(), FACING, CommunicationMessage::getDeltaRelation(), Unit::GetSerial(), getType(), UnitContainer::GetUnit(), VegaConfig::getVariable(), i, messagequeue, MOVEMENT, Universe::netLocked(), Network, parent, XMLSupport::parse_bool(), XMLSupport::parse_float(), NetServer::sendCommunication(), CommunicationMessage::sender, SERVER, suborders, vs_config, VSServer, WEAPON, and Universe::whichPlayerStarship().
Referenced by Unit::ApplyDamage(), BaseInterface::Room::Launch::Click(), BaseInterface::Room::Eject::Click(), DoDockingOps(), FireKeyboard::Execute(), GetMadAt(), HelpOut(), CommunicatingAI::InitiateContrabandSearch(), CommunicatingAI::ProcessCommMessage(), ProcessCommunicationMessages(), Orders::AggressiveAI::ProcessCurrentFgDirective(), RequestClearence(), ScoreKill(), CommunicatingAI::TerminateContrabandSearch(), TryDock(), and CommunicatingAI::UpdateContrabandSearch().
string Order::createFullOrderDescription | ( | int | level = 0 ) |
Definition at line 228 of file order.cpp.
References getOrderDescription(), i, j, BeamXML::level, and suborders.
|
virtual |
The virutal function that unrefs all memory then calls Destruct () which takes care of unreffing this or calling delete on this.
Reimplemented in Orders::ExecuteFor, FlyByKeyboard, Orders::DockingOps, and CommunicatingAI.
Definition at line 166 of file order.cpp.
References Destructor(), getOrderDescription(), i, messagequeue, and suborders.
Referenced by CommunicatingAI::Destroy(), Orders::DockingOps::Destroy(), FlyByKeyboard::Destroy(), Orders::ExecuteFor::Destroy(), Unit::DisableTurretAI(), FlyByKeyboard::Execute(), ReplaceOrder(), and Unit::SetTurretAI().
|
protectedvirtual |
|
inline |
Definition at line 127 of file order.h.
References done.
Referenced by Orders::AutoDocking::DepartureState(), Orders::ChangeHeading::Execute(), Orders::Join::Execute(), and Orders::Sequence::Execute().
Enqueues another order that will be executed (in parallel perhaps) when next void Execute() is called.
Definition at line 80 of file order.cpp.
References getOrderDescription(), parent, SetParent(), and suborders.
Referenced by AddOrd(), AfterburnVeerAndTurnAway(), Orders::AutoDocking::EnqueuePort(), Orders::AggressiveAI::ExecuteLogicItem(), GoTo(), Orders::Join::Join(), Orders::DockingOps::Movement(), Orders::DockingOps::PerformDockingOperations(), and Orders::Sequence::Sequence().
enqueue order as first order
Definition at line 91 of file order.cpp.
References getOrderDescription(), parent, SetParent(), and suborders.
Referenced by FlyByKeyboard::Execute(), and Orders::AggressiveAI::ProcessCurrentFgDirective().
void Order::eraseOrder | ( | Order * | ord) |
void Order::eraseType | ( | unsigned int | type) |
Erases all orders that bitwise OR with that type.
Definition at line 69 of file order.cpp.
References i, j, suborders, and type.
Referenced by Orders::AutoDocking::EraseOrders(), Orders::AggressiveAI::Execute(), FlyByKeyboard::Execute(), GoTo(), Orders::AggressiveAI::ProcessCurrentFgDirective(), and Orders::AggressiveAI::ProcessLogic().
|
virtual |
The function that gets called and executes all queued suborders.
Reimplemented in FlyTo, Orders::FacePerpendicular, Orders::LoopAroundAgro, Orders::LoopAround, Orders::Sequence, Orders::Join, Orders::ExecuteFor, Orders::FaceDirection, FlyByWire, Orders::FormUpToOwner, Orders::FormUp, Orders::FaceTargetITTS, FireKeyboard, EvadeLeftRightC, Orders::AutoLongHaul, Orders::MatchVelocity, Orders::FaceTarget, Orders::ChangeHeading, Orders::MatchRoll, FlyByKeyboard, Orders::MatchAngularVelocity, Orders::MoveTo, Orders::AutoDocking, Orders::FireAt, Orders::AggressiveAI, AImissionScript, PlanetaryOrbit, AIScript, Orders::MatchLinearVelocity, Orders::DockingOps, CloakFor, FlyByJoystick, Orders::Ikarus, Orders::TurretAI, and Orders::FireAllYouGot.
Definition at line 31 of file order.cpp.
References ALLTYPES, done, getType(), VegaConfig::getVariable(), i, XMLSupport::parse_float(), ProcessCommunicationMessages(), suborders, and vs_config.
Referenced by Orders::AutoDocking::ApproachState(), Orders::AutoDocking::DepartureState(), Orders::Ikarus::Execute(), AIScript::Execute(), AImissionScript::Execute(), PlanetaryOrbit::Execute(), Orders::FireAt::Execute(), Orders::MatchAngularVelocity::Execute(), FlyByKeyboard::Execute(), Orders::MatchRoll::Execute(), Orders::ChangeHeading::Execute(), Orders::ExecuteFor::Execute(), Orders::Join::Execute(), and Orders::Sequence::Execute().
return pointer to order or NULL if not found
Definition at line 146 of file order.cpp.
References getOrderDescription(), i, and suborders.
Order * Order::findOrderList | ( | ) |
searches the suborders recursively for the first order that has an orderlist
Definition at line 217 of file order.cpp.
References getOrderList(), i, and suborders.
Referenced by Mission::DirectorShipDestroyed().
|
inline |
Definition at line 179 of file order.h.
References actionstring.
Referenced by AImissionScript::getOrderDescription().
|
inlinevirtual |
|
inlinevirtual |
Reimplemented in Orders::FaceDirection, FlyByWire, Orders::FormUpToOwner, Orders::FormUp, Orders::FaceTargetITTS, Orders::AutoLongHaul, Orders::MatchVelocity, Orders::FaceTarget, Orders::ChangeHeading, Orders::MatchRoll, Orders::MatchAngularVelocity, Orders::MoveTo, Orders::AggressiveAI, AImissionScript, Orders::MatchLinearVelocity, and Orders::Ikarus.
Definition at line 167 of file order.h.
Referenced by createFullOrderDescription(), Destroy(), EnqueueOrder(), EnqueueOrderFirst(), eraseOrder(), and findOrder().
|
inlinevirtual |
returns the orderlist (NULL for orders that haven't got any)
Reimplemented in AIOrderList.
Definition at line 161 of file order.h.
Referenced by Mission::DirectorShipDestroyed(), and findOrderList().
|
inline |
Definition at line 144 of file order.h.
References parent.
Referenced by Orders::AutoDocking::Execute(), Orders::FireAt::GetParent(), and CommunicatingAI::GetRandomUnit().
|
inline |
|
inline |
Definition at line 131 of file order.h.
References type.
Referenced by Communicate(), Execute(), Orders::ExecuteFor::Execute(), Orders::Join::Join(), and ReplaceOrder().
|
virtual |
processes a single message...generally called by the Messages() func
Reimplemented in FireKeyboard, and CommunicatingAI.
Definition at line 61 of file order_comm.cpp.
Referenced by CommunicatingAI::ProcessCommMessage(), and ProcessCommunicationMessages().
|
virtual |
responds (or does not) to certain messages in the message queue
Definition at line 62 of file order_comm.cpp.
References c, Communicate(), CommunicationMessage::fsm, FSM::GetAbleToDockNode(), Unit::getAIState(), Unit::getFlightgroup(), Unit::getRelation(), FSM::GetUnAbleToDockNode(), messagequeue, Flightgroup::name, parent, ProcessCommMessage(), Unit::RequestClearance(), CommunicationMessage::SetCurrentState(), and SIMULATION_ATOM.
Referenced by Execute(), and FireKeyboard::Execute().
Reimplemented in Orders::FireAt.
Definition at line 77 of file order.h.
Referenced by Unit::AutoPilotToErrorMessage().
returns a pointer to the first order that may be bitwise ored with any type
Definition at line 61 of file order.cpp.
Referenced by Orders::AggressiveAI::Execute().
returns a pointer to the first order that may be bitwised ored with that type
Definition at line 54 of file order.cpp.
References i, suborders, and type.
Referenced by FlyByKeyboard::Execute(), and Orders::AggressiveAI::ProcessLogicItem().
Replaces the first order of that type in the order queue.
Definition at line 104 of file order.cpp.
References ALLTYPES, Destroy(), getType(), and suborders.
Referenced by GoTo(), Orders::AggressiveAI::ProcessCurrentFgDirective(), and ReplaceOrd().
|
inline |
Definition at line 175 of file order.h.
References actionstring.
|
inlinevirtual |
Sets the parent of this Unit. Any virtual functions must call this one.
Reimplemented in Orders::FacePerpendicular, Orders::LoopAround, Orders::FaceDirection, Orders::FormUpToOwner, Orders::FormUp, Orders::AutoLongHaul, EvadeLeftRightC, Orders::FireAt, Orders::AggressiveAI, FireKeyboard, and Orders::DockingOps.
Definition at line 140 of file order.h.
References parent.
Referenced by AddOrd(), Unit::DisableTurretAI(), Unit::EnqueueAI(), Unit::EnqueueAIFirst(), EnqueueOrder(), EnqueueOrderFirst(), FlyByKeyboard::Execute(), Orders::ExecuteFor::Execute(), GoTo(), Orders::Join::Join(), PlanetaryOrbit::PlanetaryOrbit(), Unit::PrimeOrders(), Orders::AggressiveAI::ProcessCurrentFgDirective(), ReplaceOrd(), Orders::Sequence::Sequence(), Unit::SetAI(), Orders::DockingOps::SetParent(), FireKeyboard::SetParent(), Orders::FireAt::SetParent(), EvadeLeftRightC::SetParent(), Orders::AutoLongHaul::SetParent(), Orders::FormUp::SetParent(), Orders::FormUpToOwner::SetParent(), Orders::FaceDirection::SetParent(), Orders::LoopAround::SetParent(), Orders::FacePerpendicular::SetParent(), and Unit::SetTurretAI().
|
protected |
Definition at line 188 of file order.h.
Referenced by AImissionScript::AImissionScript(), getActionString(), and setActionString().
|
protected |
Whether or not this order is done.
Definition at line 57 of file order.h.
Referenced by Orders::AutoDocking::DepartureState(), Done(), Orders::AutoDocking::EndState(), CloakFor::Execute(), Orders::DockingOps::Execute(), Orders::MatchLinearVelocity::Execute(), AImissionScript::Execute(), PlanetaryOrbit::Execute(), Orders::AutoDocking::Execute(), Orders::MoveTo::Execute(), Orders::MatchAngularVelocity::Execute(), FlyByKeyboard::Execute(), Execute(), Orders::ChangeHeading::Execute(), Orders::FaceTarget::Execute(), Orders::MatchVelocity::Execute(), Orders::AutoLongHaul::Execute(), Orders::FaceTargetITTS::Execute(), Orders::FaceDirection::Execute(), Orders::ExecuteFor::Execute(), Orders::Join::Execute(), Orders::Sequence::Execute(), Orders::MatchAngularVelocity::MatchAngularVelocity(), Orders::MatchLinearVelocity::MatchLinearVelocity(), Orders::MoveTo::MoveTo(), Orders::ChangeHeading::ResetDone(), Orders::MoveTo::SetDest(), and Orders::DockingOps::Undock().
|
protected |
If this order applies to a group of units (as in form up with this group)
Definition at line 59 of file order.h.
Referenced by AttachSelfOrder(), PlanetaryOrbit::Execute(), Orders::AutoLongHaul::Execute(), Orders::FormUp::Execute(), Orders::FormUpToOwner::Execute(), Orders::FaceDirection::Execute(), and Orders::AutoLongHaul::SetParent().
|
protected |
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
Definition at line 65 of file order.h.
Referenced by ClearMessages(), Communicate(), Destroy(), CommunicatingAI::ProcessCommMessage(), ProcessCommunicationMessages(), and CommunicatingAI::RandomInitiateCommunication().
|
protected |
The unit this order is attached to.
Definition at line 51 of file order.h.
Referenced by FlyByWire::Accel(), Orders::FireAt::AddReplaceLastOrder(), CommunicatingAI::AdjustRelationTo(), FlyByWire::Afterburn(), Orders::AggressiveAI::AfterburnerJumpTurnTowards(), AttachOrder(), Orders::FireAt::ChangeLocalDirection(), FlyByKeyboard::clamp_axis(), Communicate(), CommunicatingAI::Destroy(), Orders::DockingOps::Destroy(), FlyByWire::DirectThrustFront(), FlyByWire::DirectThrustRight(), FlyByWire::DirectThrustUp(), Orders::DockingOps::DockToTarget(), EnqueueOrder(), EnqueueOrderFirst(), Orders::FireAllYouGot::Execute(), Orders::TurretAI::Execute(), FlyByJoystick::Execute(), Orders::Ikarus::Execute(), CloakFor::Execute(), Orders::DockingOps::Execute(), PlanetaryOrbit::Execute(), AImissionScript::Execute(), Orders::AggressiveAI::Execute(), Orders::MatchAngularVelocity::Execute(), FlyByKeyboard::Execute(), FireKeyboard::Execute(), FlyByWire::Execute(), Orders::ExecuteFor::Execute(), Orders::AggressiveAI::ExecuteNoEnemies(), CommunicatingAI::GetMadAt(), GetParent(), CommunicatingAI::GetRandomUnit(), FlyByWire::InertialFlight(), CommunicatingAI::InitiateContrabandSearch(), Orders::FireAt::MatchAngularVelocity(), Orders::FireAt::MatchLinearVelocity(), FlyByWire::MatchSpeed(), Orders::FireAt::MatchVelocity(), Orders::DockingOps::Movement(), Orders::DockingOps::PerformDockingOperations(), CommunicatingAI::ProcessCommMessage(), FireKeyboard::ProcessCommMessage(), ProcessCommunicationMessages(), Orders::AggressiveAI::ProcessCurrentFgDirective(), Orders::AggressiveAI::ProcessLogicItem(), Orders::FireAt::PursueTarget(), CommunicatingAI::RandomInitiateCommunication(), Orders::AggressiveAI::ReCommandWing(), FlyByKeyboard::reduce_axis(), Orders::DockingOps::RequestClearence(), Orders::DockingOps::RestoreOldAI(), FlyByWire::Right(), FlyByWire::RollRight(), CommunicatingAI::selectCommunicationMessage(), CommunicatingAI::selectCommunicationMessageMood(), Orders::DockingOps::SetParent(), FireKeyboard::SetParent(), Orders::AggressiveAI::SetParent(), SetParent(), Orders::AggressiveAI::SignalChosenTarget(), FlyByWire::Stop(), CommunicatingAI::TerminateContrabandSearch(), FlyByWire::ThrustFront(), FlyByWire::ThrustRight(), FlyByWire::ThrustUp(), Orders::DockingOps::Undock(), FlyByWire::Up(), CommunicatingAI::UpdateContrabandSearch(), AImissionScript::~AImissionScript(), CloakFor::~CloakFor(), and PlanetaryOrbit::~PlanetaryOrbit().
|
protected |
The queue of suborders that will be executed in parallel according to bit code.
Definition at line 63 of file order.h.
Referenced by ClearMessages(), Communicate(), createFullOrderDescription(), Destroy(), EnqueueOrder(), EnqueueOrderFirst(), eraseOrder(), eraseType(), Orders::MatchLinearVelocity::Execute(), Execute(), findOrder(), findOrderList(), Orders::AggressiveAI::ProcessCurrentFgDirective(), queryAny(), queryType(), and ReplaceOrder().
|
protected |
Definition at line 55 of file order.h.
Referenced by AttachOrder(), AttachSelfOrder(), Orders::AutoLongHaul::AutoLongHaul(), PlanetaryOrbit::Execute(), Orders::FaceDirection::FaceDirection(), Orders::FaceTarget::FaceTarget(), Orders::FaceTargetITTS::FaceTargetITTS(), Orders::FormUp::FormUp(), Orders::FormUpToOwner::FormUpToOwner(), getSubType(), Orders::MatchVelocity::MatchVelocity(), and PlanetaryOrbit::PlanetaryOrbit().
|
protected |
If this order applies to a physical location in world space.
Definition at line 61 of file order.h.
Referenced by AttachOrder(), PlanetaryOrbit::Execute(), Orders::MoveTo::Execute(), Orders::MoveTo::MoveTo(), and Orders::MoveTo::SetDest().
|
protected |
The bit code (from ORDERTYPES) that this order is (for parallel execution)
Definition at line 53 of file order.h.
Referenced by Orders::AutoLongHaul::AutoLongHaul(), eraseType(), Orders::ExecuteFor::Execute(), Orders::FaceDirection::FaceDirection(), Orders::FaceTarget::FaceTarget(), Orders::FaceTargetITTS::FaceTargetITTS(), getType(), Orders::MatchVelocity::MatchVelocity(), PlanetaryOrbit::PlanetaryOrbit(), queryType(), and Orders::TurretAI::TurretAI().