naev 0.11.5
pilot_hook.c File Reference

Handles the pilot hook stuff. More...

#include "pilot_hook.h"
#include "array.h"
#include "hook.h"
#include "log.h"
#include "nstring.h"
#include "nxml.h"

Go to the source code of this file.

Functions

int pilot_runHookParam (Pilot *p, int hook_type, const HookParam *param, int nparam)
 Tries to run a pilot hook if he has it.
 
int pilot_runHook (Pilot *p, int hook_type)
 Tries to run a pilot hook if he has it.
 
void pilot_addHook (Pilot *pilot, int type, unsigned int hook)
 Adds a hook to the pilot.
 
void pilots_addGlobalHook (int type, unsigned int hook)
 Adds a pilot global hook.
 
void pilots_rmGlobalHook (unsigned int hook)
 Removes a pilot global hook.
 
void pilots_clearGlobalHooks (void)
 Removes all the pilot global hooks.
 
void pilots_rmHook (unsigned int hook)
 Removes a hook from all the pilots.
 
void pilot_clearHooks (Pilot *p)
 Clears the pilots hooks.
 
void pilot_freeGlobalHooks (void)
 Clears global pilot hooks.
 

Variables

static PilotHookpilot_globalHooks = NULL
 
static int pilot_hookCleanup = 0
 

Detailed Description

Handles the pilot hook stuff.

Definition in file pilot_hook.c.

Function Documentation

◆ pilot_addHook()

void pilot_addHook ( Pilot * pilot,
int type,
unsigned int hook )

Adds a hook to the pilot.

Parameters
pilotPilot to add the hook to.
typeType of the hook to add.
hookID of the hook to add.

Definition at line 118 of file pilot_hook.c.

◆ pilot_clearHooks()

void pilot_clearHooks ( Pilot * p)

Clears the pilots hooks.

Parameters
pPilot whose hooks we're clearing

Definition at line 206 of file pilot_hook.c.

◆ pilot_freeGlobalHooks()

void pilot_freeGlobalHooks ( void )

Clears global pilot hooks.

Definition at line 221 of file pilot_hook.c.

◆ pilot_runHook()

int pilot_runHook ( Pilot * p,
int hook_type )

Tries to run a pilot hook if he has it.

Parameters
pPilot to run the hook.
hook_typeType of hook to run.
Returns
The number of hooks run.

Definition at line 106 of file pilot_hook.c.

◆ pilot_runHookParam()

int pilot_runHookParam ( Pilot * p,
int hook_type,
const HookParam * param,
int nparam )

Tries to run a pilot hook if he has it.

Parameters
pPilot to run the hook.
hook_typeType of hook to run.
paramParameters to pass.
nparamNumber of parameters to pass.
Returns
The number of hooks run.

Definition at line 37 of file pilot_hook.c.

◆ pilots_addGlobalHook()

void pilots_addGlobalHook ( int type,
unsigned int hook )

Adds a pilot global hook.

Definition at line 135 of file pilot_hook.c.

◆ pilots_clearGlobalHooks()

void pilots_clearGlobalHooks ( void )

Removes all the pilot global hooks.

Definition at line 165 of file pilot_hook.c.

◆ pilots_rmGlobalHook()

void pilots_rmGlobalHook ( unsigned int hook)

Removes a pilot global hook.

Definition at line 152 of file pilot_hook.c.

◆ pilots_rmHook()

void pilots_rmHook ( unsigned int hook)

Removes a hook from all the pilots.

Parameters
hookHook to remove.

Definition at line 175 of file pilot_hook.c.

Variable Documentation

◆ pilot_globalHooks

PilotHook* pilot_globalHooks = NULL
static

Global hooks that affect all pilots.

Definition at line 25 of file pilot_hook.c.

◆ pilot_hookCleanup

int pilot_hookCleanup = 0
static

Are hooks being removed from a pilot?

Definition at line 26 of file pilot_hook.c.