naev 0.11.5
escort.c File Reference

Handles the player's escorts. More...

#include "escort.h"
#include "array.h"
#include "dialogue.h"
#include "hook.h"
#include "log.h"
#include "nlua.h"
#include "nluadef.h"
#include "nstring.h"
#include "player.h"

Go to the source code of this file.

Functions

static int escort_command (const Pilot *parent, const char *cmd, unsigned int idx)
 Runs an escort command on all of a pilot's escorts.
 
int escort_addList (Pilot *p, const Ship *ship, EscortType_t type, unsigned int id, int persist)
 Adds an escort to the escort list of a pilot.
 
void escort_freeList (Pilot *p)
 Remove all escorts from a pilot.
 
void escort_rmListIndex (Pilot *p, int i)
 Remove from escorts list.
 
void escort_rmList (Pilot *p, unsigned int id)
 Remove from escorts list.
 
unsigned int escort_create (Pilot *p, const Ship *ship, const vec2 *pos, const vec2 *vel, double dir, EscortType_t type, int add, int dockslot)
 Creates an escort.
 
unsigned int escort_createRef (Pilot *p, Pilot *pe, const vec2 *pos, const vec2 *vel, double dir, EscortType_t type, int add, int dockslot)
 Creates an escort from a reference.
 
int escort_clearDeployed (Pilot *p)
 Clears deployed escorts of a pilot.
 
int escorts_attack (Pilot *parent)
 Have a pilot order its escorts to attack its target.
 
int escorts_hold (const Pilot *parent)
 Have a pilot order its escorts to hold position.
 
int escorts_return (const Pilot *parent)
 Have a pilot order its escorts to dock.
 
int escorts_clear (const Pilot *parent)
 Have a pilot order its escorts to clear orders.
 
int escort_playerCommand (const Pilot *e)
 Open a dialog for the player to issue a command to an escort.
 
int escorts_jump (const Pilot *parent, const JumpPoint *jp)
 Have a pilot order its escorts to jump.
 

Detailed Description

Handles the player's escorts.

Definition in file escort.c.

Function Documentation

◆ escort_addList()

int escort_addList ( Pilot * p,
const Ship * ship,
EscortType_t type,
unsigned int id,
int persist )

Adds an escort to the escort list of a pilot.

Parameters
pPilot to add escort to.
shipShip of the escort.
typeType of the escort.
idID of the pilot representing the escort.
persistTrue if escort should respawn on takeoff/landing.
Returns
0 on success.

Definition at line 40 of file escort.c.

◆ escort_clearDeployed()

int escort_clearDeployed ( Pilot * p)

Clears deployed escorts of a pilot.

Definition at line 228 of file escort.c.

◆ escort_command()

static int escort_command ( const Pilot * parent,
const char * cmd,
unsigned int idx )
static

Runs an escort command on all of a pilot's escorts.

Parameters
parentPilot who is giving orders.
cmdOrder to give.
idxLua index of argument or 0.
Returns
0 on success, 1 if no orders given.

Definition at line 262 of file escort.c.

◆ escort_create()

unsigned int escort_create ( Pilot * p,
const Ship * ship,
const vec2 * pos,
const vec2 * vel,
double dir,
EscortType_t type,
int add,
int dockslot )

Creates an escort.

Parameters
pParent of the escort (who he's guarding).
shipName of the ship escort should have.
posPosition to create escort at.
velVelocity to create escort with.
dirDirection to face.
typeType of escort.
addWhether or not to add it to the escort list.
dockslotThe outfit slot which launched the escort (-1 if N/A)
Returns
The ID of the escort on success.

Definition at line 108 of file escort.c.

◆ escort_createRef()

unsigned int escort_createRef ( Pilot * p,
Pilot * pe,
const vec2 * pos,
const vec2 * vel,
double dir,
EscortType_t type,
int add,
int dockslot )

Creates an escort from a reference.

Parameters
pParent of the escort (who he's guarding).
peReference for the escort.
posPosition to create escort at.
velVelocity to create escort with.
dirDirection to face.
typeType of escort.
addWhether or not to add it to the escort list.
dockslotThe outfit slot which launched the escort (-1 if N/A)
Returns
The ID of the escort on success.

Definition at line 186 of file escort.c.

◆ escort_freeList()

void escort_freeList ( Pilot * p)

Remove all escorts from a pilot.

Parameters
pPilot to remove escorts from.

Definition at line 60 of file escort.c.

◆ escort_playerCommand()

int escort_playerCommand ( const Pilot * e)

Open a dialog for the player to issue a command to an escort.

Parameters
eThe pilot for the player to issue an order to.
Returns
0 on success, 1 if no orders given.

Definition at line 362 of file escort.c.

◆ escort_rmList()

void escort_rmList ( Pilot * p,
unsigned int id )

Remove from escorts list.

Parameters
pPilot to remove escort from.
idID of the pilot representing the escort.

Definition at line 85 of file escort.c.

◆ escort_rmListIndex()

void escort_rmListIndex ( Pilot * p,
int i )

Remove from escorts list.

Parameters
pPilot to remove escort from.
iindex of the pilot representing the escort.

Definition at line 73 of file escort.c.

◆ escorts_attack()

int escorts_attack ( Pilot * parent)

Have a pilot order its escorts to attack its target.

Parameters
parentPilot giving the order.

Definition at line 283 of file escort.c.

◆ escorts_clear()

int escorts_clear ( const Pilot * parent)

Have a pilot order its escorts to clear orders.

Parameters
parentPilot giving the order.

Definition at line 348 of file escort.c.

◆ escorts_hold()

int escorts_hold ( const Pilot * parent)

Have a pilot order its escorts to hold position.

Parameters
parentPilot giving the order.

Definition at line 322 of file escort.c.

◆ escorts_jump()

int escorts_jump ( const Pilot * parent,
const JumpPoint * jp )

Have a pilot order its escorts to jump.

Parameters
parentPilot giving the order.
jpWhere to jump.

Definition at line 414 of file escort.c.

◆ escorts_return()

int escorts_return ( const Pilot * parent)

Have a pilot order its escorts to dock.

Parameters
parentPilot giving the order.

Definition at line 335 of file escort.c.