naev 0.12.5
escort.c File Reference

Handles the player's escorts. More...

#include "escort.h"
#include "array.h"
#include "dialogue.h"
#include "log.h"
#include "nlua.h"
#include "nlua_jump.h"
#include "nlua_pilot.h"
#include "player.h"
Include dependency graph for escort.c:

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, int slot)
 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 37 of file escort.c.

◆ escort_clearDeployed()

int escort_clearDeployed ( Pilot * p,
int slot )

Clears deployed escorts of a pilot.

Definition at line 243 of file escort.c.

◆ escort_command()

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 283 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 105 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 200 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 57 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 384 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 82 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 70 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 305 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 370 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 344 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 430 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 357 of file escort.c.