Vegastrike 0.5.1 rc1
1.0
Original sources for Vegastrike Evolved
|
this class is meant to be inherited by AI wishing to process comm messages More...
#include <comm_ai.h>
Public Member Functions | |
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 float | getMood () |
Unit * | GetRandomUnit (float PlayerProbability, float TargetProbability) |
void | RandomInitiateCommunication (float PlayerProbability, float TargetProbability) |
void | TerminateContrabandSearch (bool foundcontraband) |
void | InitiateContrabandSearch (float PlayerProbability, float TargetProbability) |
void | UpdateContrabandSearch () |
CommunicatingAI (int ttype, int stype, float mood=0, float anger=-666, float appeasement=666, float moodswingyness=666, float randomnessresponse=666) | |
virtual void | ProcessCommMessage (class CommunicationMessage &c) |
processes a single message...generally called by the Messages() func More... | |
virtual void | AdjustRelationTo (Unit *un, float factor) |
virtual | ~CommunicatingAI () |
virtual int | selectCommunicationMessage (class CommunicationMessage &c, Unit *) |
virtual int | selectCommunicationMessageMood (CommunicationMessage &c, float mood) |
![]() | |
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 | 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 | 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 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 () |
Protected Member Functions | |
void | GetMadAt (Unit *which, int howMad) |
![]() | |
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 | |
float | anger |
float | appease |
float | moodswingyness |
float | randomresponse |
float | mood |
UnitContainer | contraband_searchee |
Vector | SpeedAndCourse |
int | which_cargo_item |
![]() | |
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 |
Additional Inherited Members | |
![]() | |
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 } |
this class is meant to be inherited by AI wishing to process comm messages
CommunicatingAI::CommunicatingAI | ( | int | ttype, |
int | stype, | ||
float | mood = 0 , |
||
float | anger = -666 , |
||
float | appeasement = 666 , |
||
float | moodswingyness = 666 , |
||
float | randomnessresponse = 666 |
||
) |
Definition at line 16 of file comm_ai.cpp.
References appease, VegaConfig::getVariable(), XMLSupport::parse_float(), randomresponse, and vs_config.
|
virtual |
Definition at line 435 of file comm_ai.cpp.
Reimplemented from Order.
Definition at line 278 of file comm_ai.cpp.
References _Universe, UniverseUtil::adjustFGRelationModifier(), UniverseUtil::adjustRelationModifierInt(), Order::AdjustRelationTo(), Pilot::adjustSpecificRelationship(), anger, appease, Flightgroup::directive, Unit::faction, UnitUtil::getFactionRelation(), Unit::getFlightgroup(), Pilot::getRank(), mood, moodswingyness, Flightgroup::name, Network, Order::parent, Unit::pilot, Unit::Target(), Unit::TargetTurret(), and Universe::whichPlayerStarship().
|
virtual |
The virutal function that unrefs all memory then calls Destruct () which takes care of unreffing this or calling delete on this.
Reimplemented from Order.
Definition at line 235 of file comm_ai.cpp.
References _Universe, Universe::AccessCockpit(), Order::Destroy(), Unit::faction, FactionUtil::GetConversation(), Pilot::getGender(), Cockpit::GetParent(), i, Universe::numPlayers(), Order::parent, Unit::pilot, Cockpit::SetStaticAnimation(), and FSM::StopAllSounds().
Definition at line 159 of file comm_ai.cpp.
References Order::parent.
Referenced by TerminateContrabandSearch(), and UpdateContrabandSearch().
|
inlinevirtual |
Definition at line 327 of file comm_ai.cpp.
References _Universe, Universe::AccessCockpit(), Universe::activeStarSystem(), StarSystem::collidemap, CollideArray::end(), findObjects(), Unit::GetComputerData(), Order::GetParent(), VegaConfig::getVariable(), CollideArray::lower_bound(), Magnitude(), Unit::Computer::RADARLIM::maxrange, Universe::numPlayers(), Order::parent, XMLSupport::parse_float(), Unit::Position(), QVector, Unit::Computer::radar, Collidable::radius, Collidable::ref, Unit::rSize(), Unit::Target(), VSRandom::uniformInc(), Collidable::CollideRef::unit, Unit::UNIT_ONLY, vs_config, and vsrandom.
Referenced by InitiateContrabandSearch(), and RandomInitiateCommunication().
Definition at line 250 of file comm_ai.cpp.
References c, Order::Communicate(), contraband_searchee, Unit::faction, CommunicationMessage::fsm, Unit::getAIState(), Pilot::getCommFaces(), FactionUtil::GetContraband(), FSM::GetContrabandInitiateNode(), GetRandomUnit(), UnitContainer::GetUnit(), UnitUtil::getUnitSystemFile(), Unit::GetVelocity(), UnitUtil::isDockableUnit(), Unit::numCargo(), Order::parent, Unit::pilot, CommunicationMessage::SetCurrentState(), UnitContainer::SetUnit(), SpeedAndCourse, TerminateContrabandSearch(), v, and which_cargo_item.
|
virtual |
processes a single message...generally called by the Messages() func
Reimplemented from Order.
Definition at line 408 of file comm_ai.cpp.
References b, Order::Communicate(), FSM::Node::edges, Unit::faction, CommunicationMessage::fsm, Unit::getAIState(), Pilot::getCommFaces(), FactionUtil::GetConversation(), CommunicationMessage::getCurrentState(), UnitContainer::GetUnit(), UnitUtil::getUnitSystemFile(), isDockedAtAll(), Order::messagequeue, Order::parent, Unit::pilot, Order::ProcessCommMessage(), selectCommunicationMessage(), and CommunicationMessage::sender.
void CommunicatingAI::RandomInitiateCommunication | ( | float | PlayerProbability, |
float | TargetProbability | ||
) |
Definition at line 366 of file comm_ai.cpp.
References Unit::faction, Pilot::getCommFaces(), Unit::GetComputerData(), FactionUtil::GetConversation(), FSM::getDefaultState(), UnitUtil::getDistance(), UnitUtil::getFlightgroupName(), GetRandomUnit(), Unit::getRelation(), UnitUtil::getUnitSystemFile(), i, isDockedAtAll(), Unit::Computer::RADARLIM::maxrange, Order::messagequeue, Order::parent, Unit::pilot, and Unit::Computer::radar.
|
virtual |
Definition at line 389 of file comm_ai.cpp.
References FSM::Node::edges, Pilot::getAnger(), CommunicationMessage::getCurrentState(), UnitUtil::getFactionRelation(), VegaConfig::getVariable(), mood, Order::parent, XMLSupport::parse_float(), Unit::pilot, selectCommunicationMessageMood(), and vs_config.
Referenced by ProcessCommMessage().
|
virtual |
Definition at line 68 of file comm_ai.cpp.
References CommunicationMessage::curstate, CommunicationMessage::fsm, FSM::getCommMessageMood(), FSM::getDefaultState(), Pilot::GetEffectiveRelationship(), FSM::GetUnDockNode(), UnitContainer::GetUnit(), MatchingMood(), Order::parent, Unit::pilot, randomresponse, CommunicationMessage::sender, and Unit::Target().
Referenced by selectCommunicationMessage().
void CommunicatingAI::TerminateContrabandSearch | ( | bool | foundcontraband) |
Definition at line 137 of file comm_ai.cpp.
References AllUnitsCloseAndEngage(), c, Order::Communicate(), contraband_searchee, Unit::faction, CommunicationMessage::fsm, Unit::getAIState(), Pilot::getCommFaces(), FSM::GetContrabandDetectedNode(), FSM::GetContrabandUnDetectedNode(), GetMadAt(), UnitContainer::GetUnit(), Order::parent, Unit::pilot, CommunicationMessage::SetCurrentState(), and UnitContainer::SetUnit().
Referenced by InitiateContrabandSearch(), and UpdateContrabandSearch().
void CommunicatingAI::UpdateContrabandSearch | ( | ) |
Definition at line 176 of file comm_ai.cpp.
References c, Order::Communicate(), Cargo::content, contraband_searchee, Unit::CourseDeviation(), Unit::faction, CommunicationMessage::fsm, Unit::getAIState(), Unit::GetCargo(), Pilot::getCommFaces(), FactionUtil::GetContraband(), FSM::GetContrabandWobblyNode(), Unit::getHiddenCargoVolume(), GetMadAt(), Unit::GetManifest(), UnitContainer::GetUnit(), VegaConfig::getVariable(), Unit::GetVelocity(), i, InList(), max(), Unit::numCargo(), Order::parent, XMLSupport::parse_bool(), XMLSupport::parse_float(), XMLSupport::parse_int(), Unit::pilot, Cargo::quantity, CommunicationMessage::SetCurrentState(), SpeedAndCourse, TerminateContrabandSearch(), vs_config, and which_cargo_item.
|
protected |
Definition at line 12 of file comm_ai.h.
Referenced by AdjustRelationTo().
|
protected |
Definition at line 13 of file comm_ai.h.
Referenced by AdjustRelationTo(), and CommunicatingAI().
|
protected |
Definition at line 17 of file comm_ai.h.
Referenced by InitiateContrabandSearch(), TerminateContrabandSearch(), and UpdateContrabandSearch().
|
protected |
Definition at line 16 of file comm_ai.h.
Referenced by AdjustRelationTo(), getMood(), and selectCommunicationMessage().
|
protected |
Definition at line 14 of file comm_ai.h.
Referenced by AdjustRelationTo().
|
protected |
Definition at line 15 of file comm_ai.h.
Referenced by CommunicatingAI(), and selectCommunicationMessageMood().
|
protected |
Definition at line 18 of file comm_ai.h.
Referenced by InitiateContrabandSearch(), and UpdateContrabandSearch().
|
protected |
Definition at line 19 of file comm_ai.h.
Referenced by InitiateContrabandSearch(), and UpdateContrabandSearch().