Vegastrike 0.5.1 rc1
1.0
Original sources for Vegastrike Evolved
|
#include <aggressive.h>
Public Member Functions | |
virtual void | SetParent (Unit *parent1) |
Sets the parent of this Unit. Any virtual functions must call this one. More... | |
AggressiveAI (const char *file, Unit *target=NULL) | |
void | ExecuteNoEnemies () |
void | Execute () |
The function that gets called and executes all queued suborders. More... | |
virtual std::string | getOrderDescription () |
void | AfterburnerJumpTurnTowards (Unit *target) |
![]() | |
virtual void | ChooseTarget () |
this function calls the destructor (needs to be overridden for python; More... | |
void | PossiblySwitchTarget (bool istargetjumpableplanet) |
virtual bool | PursueTarget (Unit *, bool leader) |
void | AddReplaceLastOrder (bool replace) |
void | ExecuteLastScriptFor (float time) |
void | FaceTarget (bool end) |
void | FaceTargetITTS (bool end) |
void | MatchLinearVelocity (bool terminate, Vector vec, bool afterburn, bool local) |
void | MatchAngularVelocity (bool terminate, Vector vec, bool local) |
void | ChangeHeading (QVector vec) |
void | ChangeLocalDirection (Vector vec) |
void | MoveTo (QVector, bool afterburn) |
void | MatchVelocity (bool terminate, Vector vec, Vector angvel, bool afterburn, bool local) |
void | Cloak (bool enable, float seconds) |
void | FormUp (QVector pos) |
void | FormUpToOwner (QVector pos) |
void | FaceDirection (float distToMatchFacing, bool finish) |
void | XMLScript (std::string script) |
void | LastPythonScript () |
Unit * | GetParent () |
FireAt (float aggressivitylevel) | |
FireAt () | |
virtual std::string | Pickle () |
virtual void | UnPickle (std::string) |
virtual | ~FireAt () |
![]() | |
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) |
![]() | |
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... | |
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 () |
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... | |
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 () |
Public Attributes | |
float | Fshield_prev |
float | Fshield_rate_old |
double | Fshield_prev_time |
float | Bshield_prev |
float | Bshield_rate_old |
double | Bshield_prev_time |
float | Lshield_prev |
float | Lshield_rate_old |
double | Lshield_prev_time |
float | Rshield_prev |
float | Rshield_rate_old |
double | Rshield_prev_time |
float | Farmour_prev |
float | Farmour_rate_old |
double | Farmour_prev_time |
float | Barmour_prev |
float | Barmour_rate_old |
double | Barmour_prev_time |
float | Larmour_prev |
float | Larmour_rate_old |
double | Larmour_prev_time |
float | Rarmour_prev |
float | Rarmour_rate_old |
double | Rarmour_prev_time |
float | Hull_prev |
float | Hull_rate_old |
double | Hull_prev_time |
int | personalityseed |
Protected Member Functions | |
void | SignalChosenTarget () |
bool | ProcessLogicItem (const AIEvents::AIEvresult &item) |
bool | ExecuteLogicItem (const AIEvents::AIEvresult &item) |
bool | ProcessLogic (AIEvents::ElemAttrMap &logic, bool inter) |
void | ReCommandWing (Flightgroup *fg) |
bool | ProcessCurrentFgDirective (Flightgroup *fg) |
![]() | |
bool | ShouldFire (Unit *targ, bool &missilelock) |
void | FireWeapons (bool shouldfire, bool lockmissile) |
virtual void | ChooseTargets (int num, bool force=false) |
bool | isJumpablePlanet (Unit *) |
void | ReInit (float agglevel) |
![]() | |
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 | |
AIEvents::ElemAttrMap * | logic |
float | logiccurtime |
float | interruptcurtime |
QVector | nav |
UnitContainer | navDestination |
float | lurk_on_arrival |
std::string | last_directive |
![]() | |
float | missileprobability |
float | lastmissiletime |
float | delay |
float | agg |
float | distance |
float | lastchangedtarg |
bool | had_target |
![]() | |
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 |
Definition at line 8 of file aggressive.h.
Definition at line 33 of file aggressive.h.
AggressiveAI::AggressiveAI | ( | const char * | file, |
Unit * | target = NULL |
||
) |
Definition at line 249 of file aggressive.cpp.
References aggressivity, Order::AttachOrder(), getNewTime(), VegaConfig::getVariable(), interruptcurtime, last_directive, logic, logiccurtime, AIEvents::ElemAttrMap::maxtime, nav, XMLSupport::parse_float(), personalityseed, QVector, randomtemp, and vs_config.
void AggressiveAI::AfterburnerJumpTurnTowards | ( | Unit * | target) |
Definition at line 1563 of file aggressive.cpp.
References AfterburnTurnTowards, Unit::GetDestinations(), VegaConfig::getVariable(), UnitUtil::JumpTo(), Order::parent, XMLSupport::parse_float(), Unit::Position(), and vs_config.
Referenced by Execute().
|
virtual |
The function that gets called and executes all queued suborders.
Reimplemented from Orders::FireAt.
Reimplemented in Orders::Ikarus.
Definition at line 1584 of file aggressive.cpp.
References _Universe, Universe::AccessCockpit(), Unit::ActivateJumpDrive(), AfterburnerJumpTurnTowards(), aggfire, Cockpit::autoInProgress(), Unit::UnitJump::drive, Order::eraseType(), Orders::FireAt::Execute(), ExecuteNoEnemies(), Order::FACING, Unit::faction, Unit::GetComputerData(), Unit::GetDestinations(), FactionUtil::GetFactionIndex(), Unit::getFlightgroup(), Unit::GetJumpStatus(), Unit::GetOrientation(), getTimeCompression(), VegaConfig::getVariable(), Unit::GetVelocity(), i, interruptcurtime, Unit::jump, logic, logiccurtime, Unit::Computer::max_speed(), AIEvents::ElemAttrMap::maxtime, Order::MOVEMENT, Unit::NetForce, Unit::NetLocalForce, Order::parent, XMLSupport::parse_bool(), XMLSupport::parse_float(), ProcessCurrentFgDirective(), ProcessLogic(), q, Order::queryAny(), queryTime(), Unit::SetVelocity(), SIMULATION_ATOM, Unit::Target(), uoi, Vector, Unit::Velocity, vs_config, VSFileSystem::vs_fprintf(), and WarpToP().
|
protected |
Definition at line 321 of file aggressive.cpp.
References Order::EnqueueOrder(), AIEvents::AIEvresult::script, and AIEvents::AIEvresult::timetofinish.
Referenced by ProcessLogic().
void AggressiveAI::ExecuteNoEnemies | ( | ) |
Definition at line 1470 of file aggressive.cpp.
References _Universe, Universe::AccessCockpit(), Unit::ActivateJumpDrive(), Unit::aistate, Cockpit::autoInProgress(), ChooseNavPoint(), ChooseNearNavPoint(), CloseEnoughToNavOrDest(), Unit::GetDestinations(), UnitUtil::getFlightgroupName(), Unit::getFullname(), Unit::GetMass(), getNewTime(), UniverseUtil::getPlanetRadiusPercent(), UnitContainer::GetUnit(), VegaConfig::getVariable(), Unit::GetVelocity(), GoTo(), Unit::graphicOptions, insysString(), Unit::graphic_options::InWarp, UnitUtil::isCapitalShip(), UnitUtil::isDockableUnit(), Unit::isUnit(), lurk_on_arrival, Unit::name, nav, navDestination, Order::parent, XMLSupport::parse_bool(), XMLSupport::parse_float(), PLANETPTR, Unit::Position(), Unit::PrimeOrders(), QVector, randVector(), Unit::rSize(), SIMULATION_ATOM, UniverseUtil::systemInMemory(), Unit::Target(), Unit::Thrust(), Cockpit::unitInAutoRegion(), Unit::UpCoordinateLevel(), Vector, vs_config, and WarpToP().
Referenced by Execute().
|
inlinevirtual |
Reimplemented from Order.
Reimplemented in Orders::Ikarus.
Definition at line 44 of file aggressive.h.
|
protected |
Definition at line 595 of file aggressive.cpp.
References _Universe, Universe::activeStarSystem(), Order::AttachSelfOrder(), c, Unit::ClampVelocity(), Order::Communicate(), Flightgroup::directive, Order::EnqueueOrderFirst(), Order::eraseType(), FaceTarget(), Order::FACING, Unit::faction, findUnitInStarsystem(), CommunicationMessage::fsm, Unit::getAIState(), Unit::getFgSubnumber(), Unit::getFlightgroup(), FSM::GetNoNode(), GetThreat(), UnitContainer::GetUnit(), VegaConfig::getVariable(), FSM::GetYesNode(), i, Unit::InCorrectStarSystem(), Unit::InRange(), Unit::IsBase(), Orders::FireAt::isJumpablePlanet(), last_directive, Flightgroup::leader, logic, MatchVelocity, Order::MOVEMENT, MoveTo, Flightgroup::name, AIEvents::ElemAttrMap::obedience, Unit::owner, Order::parent, XMLSupport::parse_bool(), XMLSupport::parse_float(), Unit::Position(), QVector, Unit::radial_size, Order::ReplaceOrder(), Unit::rSize(), CommunicationMessage::SetCurrentState(), Unit::SetFg(), Order::SetParent(), Unit::SetTurretAI(), Order::suborders, Flightgroup::target, Unit::Target(), Unit::TargetTurret(), Unit::Threat(), TurretFAW(), Unit::TurretFAW(), Vector, and vs_config.
Referenced by Orders::Ikarus::Execute(), and Execute().
|
protected |
Definition at line 528 of file aggressive.cpp.
References Order::eraseType(), ExecuteLogicItem(), Order::FACING, i, interruptcurtime, j, logiccurtime, Order::MOVEMENT, ProcessLogicItem(), and AIEvents::ElemAttrMap::result.
Referenced by Execute().
|
protected |
pdmag;
Definition at line 332 of file aggressive.cpp.
References BARMOR_HEAL_RATE, BSHIELD, BSHIELD_HEAL_RATE, Bshield_prev, Bshield_prev_time, Bshield_rate_old, Unit::BShieldData(), Orders::FireAt::distance, DISTANCE, AIEvents::AIEvresult::Eval(), FACING, Order::FACING, FARMOR_HEAL_RATE, float, FSHIELD, FSHIELD_HEAL_RATE, Fshield_prev, Fshield_prev_time, Fshield_rate_old, Unit::FShieldData(), Unit::GetComputerData(), UniverseUtil::GetGameTime(), Unit::GetHullPercent(), Unit::GetMass(), Unit::GetOrientation(), VegaConfig::getVariable(), Unit::GetVelocity(), Unit::graphicOptions, HULL, HULL_HEAL_RATE, Hull_prev, Hull_prev_time, Hull_rate_old, Unit::graphic_options::InWarp, LARMOR_HEAL_RATE, Unit::Limits(), LSHIELD, LSHIELD_HEAL_RATE, Lshield_prev, Lshield_prev_time, Lshield_rate_old, Unit::LShieldData(), METERDISTANCE, MOVEMENT, Order::MOVEMENT, Order::parent, XMLSupport::parse_float(), Unit::Position(), Order::queryType(), R, RANDOMIZ, RARMOR_HEAL_RATE, Unit::Limits::retro, RSHIELD, RSHIELD_HEAL_RATE, Rshield_prev, Rshield_prev_time, Rshield_rate_old, Unit::RShieldData(), Unit::rSize(), S, Unit::Target(), TARGET_FACES_YOU, TARGET_GOING_YOUR_DIRECTION, TARGET_IN_FRONT_OF_YOU, THREAT, Unit::Computer::threatlevel, AIEvents::AIEvresult::type, Vector, and vs_config.
Referenced by ProcessLogic().
|
protected |
Definition at line 1192 of file aggressive.cpp.
References Flightgroup::directive, Unit::FShieldData(), Unit::getFgSubnumber(), UnitContainer::GetUnit(), VegaConfig::getVariable(), Flightgroup::leader, LeadMe(), Unit::name, overridable(), Order::parent, XMLSupport::parse_bool(), XMLSupport::parse_float(), Unit::RShieldData(), SIMULATION_ATOM, Unit::Threat(), vs_config, and VSFileSystem::vs_fprintf().
Referenced by Orders::Ikarus::Execute().
|
virtual |
Sets the parent of this Unit. Any virtual functions must call this one.
Reimplemented from Orders::FireAt.
Definition at line 272 of file aggressive.cpp.
References Barmour_prev, Barmour_prev_time, Barmour_rate_old, Bshield_prev, Bshield_prev_time, Bshield_rate_old, Unit::BShieldData(), Farmour_prev, Farmour_prev_time, Farmour_rate_old, Fshield_prev, Fshield_prev_time, Fshield_rate_old, Unit::FShieldData(), UniverseUtil::GetGameTime(), Unit::GetHullPercent(), Unit::graphicOptions, Hull_prev, Hull_prev_time, Hull_rate_old, Unit::graphic_options::InWarp, Larmour_prev, Larmour_prev_time, Larmour_rate_old, last_directive, Lshield_prev, Lshield_prev_time, Lshield_rate_old, Unit::LShieldData(), Order::parent, Rarmour_prev, Rarmour_prev_time, Rarmour_rate_old, Rshield_prev, Rshield_prev_time, Rshield_rate_old, Unit::RShieldData(), and Orders::FireAt::SetParent().
|
protectedvirtual |
Reimplemented from Orders::FireAt.
Definition at line 314 of file aggressive.cpp.
References getProperScript(), logic, Order::parent, personalityseed, Orders::FireAt::SignalChosenTarget(), and Unit::Target().
float Orders::AggressiveAI::Barmour_prev |
Definition at line 64 of file aggressive.h.
Referenced by SetParent().
double Orders::AggressiveAI::Barmour_prev_time |
Definition at line 66 of file aggressive.h.
Referenced by SetParent().
float Orders::AggressiveAI::Barmour_rate_old |
Definition at line 65 of file aggressive.h.
Referenced by SetParent().
float Orders::AggressiveAI::Bshield_prev |
Definition at line 52 of file aggressive.h.
Referenced by ProcessLogicItem(), and SetParent().
double Orders::AggressiveAI::Bshield_prev_time |
Definition at line 54 of file aggressive.h.
Referenced by ProcessLogicItem(), and SetParent().
float Orders::AggressiveAI::Bshield_rate_old |
Definition at line 53 of file aggressive.h.
Referenced by ProcessLogicItem(), and SetParent().
float Orders::AggressiveAI::Farmour_prev |
Definition at line 61 of file aggressive.h.
Referenced by SetParent().
double Orders::AggressiveAI::Farmour_prev_time |
Definition at line 63 of file aggressive.h.
Referenced by SetParent().
float Orders::AggressiveAI::Farmour_rate_old |
Definition at line 62 of file aggressive.h.
Referenced by SetParent().
float Orders::AggressiveAI::Fshield_prev |
Definition at line 49 of file aggressive.h.
Referenced by ProcessLogicItem(), and SetParent().
double Orders::AggressiveAI::Fshield_prev_time |
Definition at line 51 of file aggressive.h.
Referenced by ProcessLogicItem(), and SetParent().
float Orders::AggressiveAI::Fshield_rate_old |
Definition at line 50 of file aggressive.h.
Referenced by ProcessLogicItem(), and SetParent().
float Orders::AggressiveAI::Hull_prev |
Definition at line 73 of file aggressive.h.
Referenced by ProcessLogicItem(), and SetParent().
double Orders::AggressiveAI::Hull_prev_time |
Definition at line 75 of file aggressive.h.
Referenced by ProcessLogicItem(), and SetParent().
float Orders::AggressiveAI::Hull_rate_old |
Definition at line 74 of file aggressive.h.
Referenced by ProcessLogicItem(), and SetParent().
|
protected |
Definition at line 21 of file aggressive.h.
Referenced by AggressiveAI(), Execute(), and ProcessLogic().
float Orders::AggressiveAI::Larmour_prev |
Definition at line 67 of file aggressive.h.
Referenced by SetParent().
double Orders::AggressiveAI::Larmour_prev_time |
Definition at line 69 of file aggressive.h.
Referenced by SetParent().
float Orders::AggressiveAI::Larmour_rate_old |
Definition at line 68 of file aggressive.h.
Referenced by SetParent().
|
protected |
Definition at line 28 of file aggressive.h.
Referenced by AggressiveAI(), ProcessCurrentFgDirective(), and SetParent().
|
protected |
Definition at line 19 of file aggressive.h.
Referenced by AggressiveAI(), Execute(), ProcessCurrentFgDirective(), and SignalChosenTarget().
|
protected |
Definition at line 20 of file aggressive.h.
Referenced by AggressiveAI(), Execute(), and ProcessLogic().
float Orders::AggressiveAI::Lshield_prev |
Definition at line 55 of file aggressive.h.
Referenced by ProcessLogicItem(), and SetParent().
double Orders::AggressiveAI::Lshield_prev_time |
Definition at line 57 of file aggressive.h.
Referenced by ProcessLogicItem(), and SetParent().
float Orders::AggressiveAI::Lshield_rate_old |
Definition at line 56 of file aggressive.h.
Referenced by ProcessLogicItem(), and SetParent().
|
protected |
Definition at line 24 of file aggressive.h.
Referenced by ExecuteNoEnemies().
|
protected |
Definition at line 22 of file aggressive.h.
Referenced by AggressiveAI(), and ExecuteNoEnemies().
|
protected |
Definition at line 23 of file aggressive.h.
Referenced by ExecuteNoEnemies().
int Orders::AggressiveAI::personalityseed |
Definition at line 76 of file aggressive.h.
Referenced by AggressiveAI(), and SignalChosenTarget().
float Orders::AggressiveAI::Rarmour_prev |
Definition at line 70 of file aggressive.h.
Referenced by SetParent().
double Orders::AggressiveAI::Rarmour_prev_time |
Definition at line 72 of file aggressive.h.
Referenced by SetParent().
float Orders::AggressiveAI::Rarmour_rate_old |
Definition at line 71 of file aggressive.h.
Referenced by SetParent().
float Orders::AggressiveAI::Rshield_prev |
Definition at line 58 of file aggressive.h.
Referenced by ProcessLogicItem(), and SetParent().
double Orders::AggressiveAI::Rshield_prev_time |
Definition at line 60 of file aggressive.h.
Referenced by ProcessLogicItem(), and SetParent().
float Orders::AggressiveAI::Rshield_rate_old |
Definition at line 59 of file aggressive.h.
Referenced by ProcessLogicItem(), and SetParent().