naev 0.10.4
Functions
player_fleet.c File Reference

Contains all the player fleet related stuff. More...

#include "player_fleet.h"
#include "array.h"
#include "dialogue.h"
#include "escort.h"
#include "land.h"
#include "equipment.h"

Go to the source code of this file.

Functions

void pfleet_update (void)
 Updates the used fleet capacity of the player. More...
 
int pfleet_toggleDeploy (PlayerShip_t *ps, int deploy)
 Toggles a player ship as deployed. More...
 
int pfleet_deploy (PlayerShip_t *ps)
 Deploys a player's pilot. More...
 
static void shipCargo (PilotCommodity **pclist, Pilot *p, int remove)
 
static int pc_cmp (const void *pa, const void *pb)
 
void pfleet_cargoRedistribute (void)
 Redistributes the cargo in the player's fleet. More...
 
int pfleet_cargoUsed (void)
 Gets the total cargo space used by the player's fleet. More...
 
int pfleet_cargoFree (void)
 Gets the total amount of free cargo space in the player's fleet. More...
 
int pfleet_cargoOwned (const Commodity *com)
 Gets the total amount of a commodity type owned by the player's fleet. More...
 
int pfleet_cargoAdd (const Commodity *com, int q)
 Adds some cargo to the player's fleet. More...
 
int pfleet_cargoRm (const Commodity *com, int q, int jet)
 Removes some cargo from the player's fleet. More...
 
PilotCommoditypfleet_cargoList (void)
 Gets a list of all the cargo in the fleet. More...
 
PFleetCargopfleet_cargoListShips (const Commodity *com)
 Gets the list of ships that are carry a certain commodity in the player fleet and the amount they are carrying. More...
 

Detailed Description

Contains all the player fleet related stuff.

Definition in file player_fleet.c.

Function Documentation

◆ pc_cmp()

static int pc_cmp ( const void *  pa,
const void *  pb 
)
static

Definition at line 176 of file player_fleet.c.

◆ pfleet_cargoAdd()

int pfleet_cargoAdd ( const Commodity com,
int  q 
)

Adds some cargo to the player's fleet.

Parameters
comCommodity to add.
qQuantity to add.
Returns
Total amount of cargo added (less than q if it doesn't fit).

Definition at line 306 of file player_fleet.c.

◆ pfleet_cargoFree()

int pfleet_cargoFree ( void  )

Gets the total amount of free cargo space in the player's fleet.

Returns
Total amount of free cargo space.

Definition at line 255 of file player_fleet.c.

◆ pfleet_cargoList()

PilotCommodity * pfleet_cargoList ( void  )

Gets a list of all the cargo in the fleet.

Returns
List of all the cargo in the fleet (array.h). Individual elements do not have to be freed, but the list does.

Definition at line 373 of file player_fleet.c.

◆ pfleet_cargoListShips()

PFleetCargo * pfleet_cargoListShips ( const Commodity com)

Gets the list of ships that are carry a certain commodity in the player fleet and the amount they are carrying.

Parameters
comCommodity to see which ships have.
Returns
An array of ships and the amount they have (array.h). Must be freed with array_free.

Definition at line 395 of file player_fleet.c.

◆ pfleet_cargoOwned()

int pfleet_cargoOwned ( const Commodity com)

Gets the total amount of a commodity type owned by the player's fleet.

Parameters
comCommodity to add.
Returns
Total amount of a cargo owned.

Definition at line 280 of file player_fleet.c.

◆ pfleet_cargoRedistribute()

void pfleet_cargoRedistribute ( void  )

Redistributes the cargo in the player's fleet.

Definition at line 188 of file player_fleet.c.

◆ pfleet_cargoRm()

int pfleet_cargoRm ( const Commodity com,
int  q,
int  jet 
)

Removes some cargo from the player's fleet.

Parameters
comCommodity to remove.
qQuantity to remove.
jetWhether or not to jet into space.
Returns
Total amount of cargo removed (can be less than q).

Definition at line 335 of file player_fleet.c.

◆ pfleet_cargoUsed()

int pfleet_cargoUsed ( void  )

Gets the total cargo space used by the player's fleet.

Returns
Total amount of used cargo.

Definition at line 231 of file player_fleet.c.

◆ pfleet_deploy()

int pfleet_deploy ( PlayerShip_t ps)

Deploys a player's pilot.

Will not deploy duplicates.

Parameters
psPlayer ship to deploy.
Returns
0 on success

Definition at line 109 of file player_fleet.c.

◆ pfleet_toggleDeploy()

int pfleet_toggleDeploy ( PlayerShip_t ps,
int  deploy 
)

Toggles a player ship as deployed.

Parameters
psPlayer ship to toggle.
deployWhether or not to set status as deployed.
Returns
0 on success

Definition at line 45 of file player_fleet.c.

◆ pfleet_update()

void pfleet_update ( void  )

Updates the used fleet capacity of the player.

Definition at line 24 of file player_fleet.c.

◆ shipCargo()

static void shipCargo ( PilotCommodity **  pclist,
Pilot p,
int  remove 
)
static

Definition at line 134 of file player_fleet.c.