Inexor
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Classes | Namespaces | Macros | Enumerations | Functions | Variables
waypoint.cpp File Reference
#include <boost/algorithm/clamp.hpp>
#include <math.h>
#include <string.h>
#include <algorithm>
#include <memory>
#include "inexor/engine/material.hpp"
#include "inexor/engine/octa.hpp"
#include "inexor/engine/octaedit.hpp"
#include "inexor/engine/octree.hpp"
#include "inexor/engine/world.hpp"
#include "inexor/engine/worldio.hpp"
#include "inexor/fpsgame/ai.hpp"
#include "inexor/fpsgame/entities.hpp"
#include "inexor/fpsgame/fps.hpp"
#include "inexor/fpsgame/fpsent.hpp"
#include "inexor/fpsgame/fpsstate.hpp"
#include "inexor/io/Logging.hpp"
#include "inexor/io/legacy/stream.hpp"
#include "inexor/network/SharedVar.hpp"
#include "inexor/physics/physics.hpp"
#include "inexor/shared/command.hpp"
#include "inexor/shared/cube_formatting.hpp"
#include "inexor/shared/cube_loops.hpp"
#include "inexor/shared/cube_tools.hpp"
#include "inexor/shared/cube_types.hpp"
#include "inexor/shared/cube_vector.hpp"
#include "inexor/shared/ents.hpp"
#include "inexor/shared/geom.hpp"
#include "inexor/shared/tools.hpp"

Classes

struct  ai::wpcache
 
struct  ai::wpcache::node
 
struct  ai::wpcachestack
 

Namespaces

 ai
 

Macros

#define CHECKCLOSEST(index)
 
#define CHECKWITHIN(index)
 
#define CHECKNEAR(index)
 

Enumerations

enum  { ai::WPCACHE_STATIC = 0, ai::WPCACHE_DYNAMIC, ai::NUMWPCACHES }
 

Functions

bool ai::clipped (const vec &o)
 
int ai::getweight (const vec &o)
 
static void ai::invalidatewpcache (int wp)
 
void ai::clearwpcache (bool full=true)
 
 ai::ICOMMAND (clearwpcache,"",(), clearwpcache())
 
void ai::buildwpcache ()
 
int ai::closestwaypoint (const vec &pos, float mindist, bool links, fpsent *d=nullptr)
 
void ai::findwaypointswithin (const vec &pos, float mindist, float maxdist, vector< int > &results)
 
static float ai::heapscore (waypoint *q)
 
bool ai::route (fpsent *d, int node, int goal, vector< int > &route, const avoidset &obstacles, int retries=0)
 
 ai::VARF (dropwaypoints, 0, 0, 1,{player1->lastnode=-1;})
 
int ai::addwaypoint (const vec &o, int weight=-1)
 
void ai::linkwaypoint (waypoint &a, int n)
 
static bool ai::shouldnavigate ()
 
static bool ai::shoulddrop (fpsent *d)
 
void ai::inferwaypoints (fpsent *d, const vec &o, const vec &v, float mindist=ai::CLOSEDIST)
 
void ai::navigate (fpsent *d)
 
void ai::navigate ()
 
void ai::clearwaypoints (bool full=false)
 
 ai::ICOMMAND (clearwaypoints,"",(), clearwaypoints())
 
void ai::seedwaypoints ()
 
void ai::remapwaypoints ()
 
bool ai::cleanwaypoints ()
 
bool ai::getwaypointfile (const char *mname, char *wptname)
 
void ai::loadwaypoints (bool force=false, const char *mname=nullptr)
 
 ai::ICOMMAND (loadwaypoints,"s",(char *mname), loadwaypoints(true, mname))
 
void ai::savewaypoints (bool force=false, const char *mname=nullptr)
 
 ai::ICOMMAND (savewaypoints,"s",(char *mname), savewaypoints(true, mname))
 
void ai::delselwaypoints ()
 
 ai::COMMAND (delselwaypoints,"")
 
void ai::movewaypoints (const vec &d)
 
 ai::ICOMMAND (movewaypoints,"iii",(int *dx, int *dy, int *dz), movewaypoints(vec(*dx,*dy,*dz)))
 

Variables

selinfo sel
 Bot Movement, according to waypoints (saved within the map in an excluded file). More...
 
struct ai::wpcache ai::wpcaches [NUMWPCACHES]
 
static int ai::invalidatedwpcaches = 0
 
static int ai::clearedwpcaches = (1<<NUMWPCACHES)-1
 
static int ai::numinvalidatewpcaches = 0
 
static int ai::lastwpcache = 0
 
avoidset ai::wpavoid
 
vector< wpcache::node * > ai::wpcachestack
 
string ai::loadedwaypoints = ""
 

Class Documentation

struct ai::wpcachestack
Class Members
node * node
float tmax
float tmin

Macro Definition Documentation

#define CHECKCLOSEST (   index)
Value:
do { \
int n = (index); \
if(n < waypoints.length()) \
{ \
const waypoint &w = waypoints[n]; \
if(!links || w.links[0]) \
{ \
float dist = w.o.squaredist(pos); \
if(dist < mindist*mindist) { closest = n; mindist = sqrtf(dist); } \
} \
} \
} while(0)
vector< waypoint > waypoints
Definition: waypoint.cpp:40
GLuint index
Definition: glexts.hpp:412
if(NOT DEFINED PROJECT_ARCH) message(FATAL_ERROR"You are generating from the wrong folder! \"Where is the Source
Definition: CMakeLists.txt:2

Referenced by ai::closestwaypoint().

#define CHECKNEAR (   index)
Value:
do { \
int n = (index); \
{ \
const waypoint &w = ai::waypoints[n]; \
if(w.o.squaredist(pos) < limit2) add(owner, above, n); \
} \
} while(0)
GLintptr GLsizeiptr length
Definition: glexts.hpp:354
vector< waypoint > waypoints
Definition: waypoint.cpp:40
GLuint index
Definition: glexts.hpp:412
if(NOT DEFINED PROJECT_ARCH) message(FATAL_ERROR"You are generating from the wrong folder! \"Where is the Source
Definition: CMakeLists.txt:2

Referenced by ai::avoidset::avoidnear().

#define CHECKWITHIN (   index)
Value:
do { \
int n = (index); \
if(n < waypoints.length()) \
{ \
const waypoint &w = waypoints[n]; \
float dist = w.o.squaredist(pos); \
if(dist > mindist2 && dist < maxdist2) results.add(n); \
} \
} while(0)
vector< waypoint > waypoints
Definition: waypoint.cpp:40
GLuint index
Definition: glexts.hpp:412
if(NOT DEFINED PROJECT_ARCH) message(FATAL_ERROR"You are generating from the wrong folder! \"Where is the Source
Definition: CMakeLists.txt:2

Referenced by ai::findwaypointswithin().

Variable Documentation

selinfo sel