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

Detailed Description

Handles the player's escorts.

Definition in file escort.c.

Function Documentation

◆ escort_addList()

int escort_addList ( Pilot p,
const char *  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 229 of file escort.c.

◆ escort_command()

static int escort_command ( 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 263 of file escort.c.

◆ escort_create()

unsigned int escort_create ( Pilot p,
const char *  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 111 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 187 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 ( 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 357 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 88 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 75 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 284 of file escort.c.

◆ escorts_clear()

int escorts_clear ( Pilot parent)

Have a pilot order its escorts to clear orders.

Parameters
parentPilot giving the order.

Definition at line 343 of file escort.c.

◆ escorts_hold()

int escorts_hold ( Pilot parent)

Have a pilot order its escorts to hold position.

Parameters
parentPilot giving the order.

Definition at line 317 of file escort.c.

◆ escorts_jump()

int escorts_jump ( Pilot parent,
JumpPoint *  jp 
)

Have a pilot order its escorts to jump.

Parameters
parentPilot giving the order.
jpWhere to jump.

Definition at line 409 of file escort.c.

◆ escorts_return()

int escorts_return ( Pilot parent)

Have a pilot order its escorts to dock.

Parameters
parentPilot giving the order.

Definition at line 330 of file escort.c.