naev 0.12.6
pilot_hook.c File Reference

Handles the pilot hook stuff. More...

#include "pilot_hook.h"
#include "array.h"
#include "claim.h"
#include "hook.h"
#include "log.h"
Include dependency graph for pilot_hook.c:

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
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 116 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 212 of file pilot_hook.c.

◆ pilot_freeGlobalHooks()

void pilot_freeGlobalHooks ( void )

Clears global pilot hooks.

Definition at line 227 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 104 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 33 of file pilot_hook.c.

◆ pilots_addGlobalHook()

void pilots_addGlobalHook ( int type,
unsigned int hook )

Adds a pilot global hook.

Definition at line 139 of file pilot_hook.c.

◆ pilots_clearGlobalHooks()

void pilots_clearGlobalHooks ( void )

Removes all the pilot global hooks.

Definition at line 170 of file pilot_hook.c.

◆ pilots_rmGlobalHook()

void pilots_rmGlobalHook ( unsigned int hook)

Removes a pilot global hook.

Definition at line 156 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 181 of file pilot_hook.c.

Variable Documentation

◆ pilot_globalHooks

PilotHook* pilot_globalHooks
static
Initial value:
=
NULL

Global hooks that affect all pilots.

Definition at line 20 of file pilot_hook.c.

◆ pilot_hookCleanup

int pilot_hookCleanup = 0
static

Are hooks being removed from a pilot?

Definition at line 22 of file pilot_hook.c.