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
AIEvents::AIEvresult Struct Reference

A struct indicating an event that may or may not be executed. More...

#include <event_xml.h>

Public Member Functions

 AIEvresult (int type, float const min, const float max, float timetofinish, float timetointerrupt, float priority, const std::string &aiscript)
 
bool Eval (const float eval) const
 

Public Attributes

int type
 will never be zero...negative indicates "not" More...
 
float max
 The maximum/minimum values that will cause this event. More...
 
float min
 
float timetofinish
 
float timetointerrupt
 
float priority
 
std::string script
 The string indicating what type of thing this event evaluates. More...
 

Detailed Description

A struct indicating an event that may or may not be executed.

Definition at line 18 of file event_xml.h.

Constructor & Destructor Documentation

AIEvents::AIEvresult::AIEvresult ( int  type,
float const  min,
const float  max,
float  timetofinish,
float  timetointerrupt,
float  priority,
const std::string &  aiscript 
)

Definition at line 24 of file event_xml.cpp.

References fprintf, VegaConfig::getVariable(), i, max, min, XMLSupport::parse_int(), priority, script, timetofinish, timetointerrupt, type, validateHardCodedScript(), and vs_config.

31 {
32  this->timetointerrupt = timeuntilinterrupts;
33  this->timetofinish = timetofinish;
34  this->type = type;
35  this->priority = priority;
36  this->max = max;
37 
38  this->min = min;
39 
40  this->script = aiscript;
41  if ( !validateHardCodedScript( this->script ) ) {
42  static int aidebug = XMLSupport::parse_int( vs_config->getVariable( "AI", "debug_level", "0" ) );
43  if (aidebug) {
44  for (int i = 0; i < 10; ++i) {
45  printf( "SERIOUS WARNING %s\n", this->script.c_str() );
46  fprintf( stderr, "SERIOUS WARNING: %s\n", this->script.c_str() );
47  }
48  }
49  printf(
50  "SERIOUS WARNING in AI script: no fast method to perform %s when type %d is at least %f and at most %f with priority %f for %f time\n",
51  this->script.c_str(),
52  type,
53  min,
54  max,
55  priority,
56  timetofinish );
57  }
58 }

Member Function Documentation

bool AIEvents::AIEvresult::Eval ( const float  eval) const
inline

Definition at line 36 of file event_xml.h.

References max, min, and type.

Referenced by Orders::AggressiveAI::ProcessLogicItem().

37  {
38  if (eval >= min)
39  if (eval < max)
40  if (type > 0)
41  return true;
42  if (eval < min)
43  if (eval >= max)
44  if (type < 0)
45  return true;
46  return false;
47  }

Member Data Documentation

float AIEvents::AIEvresult::max

The maximum/minimum values that will cause this event.

Definition at line 23 of file event_xml.h.

Referenced by AIEvresult(), and Eval().

float AIEvents::AIEvresult::min

Definition at line 23 of file event_xml.h.

Referenced by AIEvresult(), and Eval().

float AIEvents::AIEvresult::priority

Definition at line 26 of file event_xml.h.

Referenced by AIEvresult().

std::string AIEvents::AIEvresult::script

The string indicating what type of thing this event evaluates.

Definition at line 28 of file event_xml.h.

Referenced by AIEvresult(), and Orders::AggressiveAI::ExecuteLogicItem().

float AIEvents::AIEvresult::timetofinish

Definition at line 24 of file event_xml.h.

Referenced by AIEvresult(), and Orders::AggressiveAI::ExecuteLogicItem().

float AIEvents::AIEvresult::timetointerrupt

Definition at line 25 of file event_xml.h.

Referenced by AIEvresult().

int AIEvents::AIEvresult::type

will never be zero...negative indicates "not"

Definition at line 21 of file event_xml.h.

Referenced by AIEvresult(), Eval(), and Orders::AggressiveAI::ProcessLogicItem().


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