![]() |
naev 0.12.6
|
Handles the pilot cargo stuff. More...
#include "pilot_cargo.h"#include "array.h"#include "commodity.h"#include "gui.h"#include "log.h"#include "rng.h"
Go to the source code of this file.
Functions | |
| static int | pilot_cargoAddInternal (Pilot *pilot, const Commodity *cargo, int quantity, unsigned int id) |
| Adds cargo to the pilot's "commodities" array only. | |
| int | pilot_cargoOwned (const Pilot *pilot, const Commodity *cargo) |
| Gets how many of the commodity a pilot has. | |
| int | pilot_cargoFree (const Pilot *p) |
| Gets the pilot's free cargo space. | |
| int | pilot_cargoMoveRaw (Pilot *dest, Pilot *src) |
| Moves cargo from one pilot to another without any checks. | |
| int | pilot_cargoMove (Pilot *dest, Pilot *src) |
| Moves cargo from one pilot to another. | |
| int | pilot_cargoAddRaw (Pilot *pilot, const Commodity *cargo, int quantity, unsigned int id) |
| Adds cargo without checking the pilot's free space. | |
| int | pilot_cargoAdd (Pilot *pilot, const Commodity *cargo, int quantity, unsigned int id) |
| Tries to add quantity of cargo to pilot. | |
| int | pilot_cargoUsed (const Pilot *p) |
| Gets how much cargo ship has on board. | |
| int | pilot_cargoUsedMission (const Pilot *p) |
| Gets how much mission cargo ship has on board. | |
| void | pilot_cargoCalc (Pilot *pilot) |
| Calculates how much cargo ship has left and such. | |
| unsigned int | pilot_addMissionCargo (Pilot *pilot, const Commodity *cargo, int quantity) |
| Adds special mission cargo, can't sell it and such. | |
| unsigned int | pilot_genMissionCargoID (Pilot *pilot) |
| int | pilot_rmMissionCargo (Pilot *pilot, unsigned int cargo_id, int jettison) |
| Removes special mission cargo based on id. | |
| int | pilot_cargoRmRaw (Pilot *pilot, const Commodity *cargo, int quantity, int cleanup) |
| Tries to get rid of quantity cargo from pilot. Can remove mission cargo. | |
| int | pilot_cargoRmAll (Pilot *pilot, int cleanup) |
| Gets rid of all cargo from pilot. Can remove mission cargo. | |
| int | pilot_cargoRm (Pilot *pilot, const Commodity *cargo, int quantity) |
| Tries to get rid of quantity cargo from pilot. | |
| int | pilot_cargoJet (Pilot *p, const Commodity *cargo, int quantity, int simulate) |
| Tries to get rid of quantity cargo from pilot, jetting it into space. | |
Variables | |
| static unsigned int | mission_cargo_id |
Handles the pilot cargo stuff.
Definition in file pilot_cargo.c.
Adds special mission cargo, can't sell it and such.
Definition at line 249 of file pilot_cargo.c.
Tries to add quantity of cargo to pilot.
Note that the commodity will not be added as 0 quantity unless 0 is explicitly specified, or it is mission cargo.
| pilot | Pilot to add cargo to. |
| cargo | Cargo to add. |
| quantity | Quantity to add. |
| id | Mission ID to add (0 is none). |
Definition at line 183 of file pilot_cargo.c.
|
static |
Adds cargo to the pilot's "commodities" array only.
| pilot | Pilot to add cargo to. |
| cargo | Cargo to add. |
| quantity | Quantity to add. |
| id | Mission ID to add (0 is none). |
Definition at line 113 of file pilot_cargo.c.
Adds cargo without checking the pilot's free space.
Does not check if currently exists.
| pilot | Pilot to add cargo to. |
| cargo | Cargo to add. |
| quantity | Quantity to add. |
| id | Mission ID to add (0 is none). |
Definition at line 159 of file pilot_cargo.c.
| void pilot_cargoCalc | ( | Pilot * | pilot | ) |
Calculates how much cargo ship has left and such.
| pilot | Pilot to calculate free cargo space of. |
Definition at line 234 of file pilot_cargo.c.
| int pilot_cargoFree | ( | const Pilot * | p | ) |
Gets the pilot's free cargo space.
| p | Pilot to get the free space of. |
Definition at line 53 of file pilot_cargo.c.
Tries to get rid of quantity cargo from pilot, jetting it into space.
| p | Pilot to get rid of cargo. |
| cargo | Cargo to get rid of. |
| quantity | Amount of cargo to get rid of. |
| simulate | Doesn't actually remove cargo, just simulates the removal. |
Definition at line 429 of file pilot_cargo.c.
Moves cargo from one pilot to another.
At the end has dest have exactly the same cargo as src and leaves src with none.
| dest | Destination pilot. |
| src | Source pilot. |
Definition at line 92 of file pilot_cargo.c.
Moves cargo from one pilot to another without any checks.
At the end has dest have exactly the same cargo as src and leaves src with none.
| dest | Destination pilot. |
| src | Source pilot. |
Definition at line 68 of file pilot_cargo.c.
Gets how many of the commodity a pilot has.
Definition at line 38 of file pilot_cargo.c.
Tries to get rid of quantity cargo from pilot.
| pilot | Pilot to get rid of cargo. |
| cargo | Cargo to get rid of. |
| quantity | Amount of cargo to get rid of. |
Definition at line 415 of file pilot_cargo.c.
| int pilot_cargoRmAll | ( | Pilot * | pilot, |
| int | cleanup ) |
Gets rid of all cargo from pilot. Can remove mission cargo.
| pilot | Pilot to get rid of cargo. |
| cleanup | Whether we're cleaning up or not (removes mission cargo). |
Definition at line 371 of file pilot_cargo.c.
Tries to get rid of quantity cargo from pilot. Can remove mission cargo.
| pilot | Pilot to get rid of cargo. |
| cargo | Cargo to get rid of. |
| quantity | Amount of cargo to get rid of. |
| cleanup | Whether we're cleaning up or not (removes mission cargo). |
Definition at line 325 of file pilot_cargo.c.
| int pilot_cargoUsed | ( | const Pilot * | p | ) |
Gets how much cargo ship has on board.
| p | Pilot to get used cargo space of. |
Definition at line 203 of file pilot_cargo.c.
| int pilot_cargoUsedMission | ( | const Pilot * | p | ) |
Gets how much mission cargo ship has on board.
| p | Pilot to get used cargo space of. |
Definition at line 217 of file pilot_cargo.c.
| unsigned int pilot_genMissionCargoID | ( | Pilot * | pilot | ) |
Definition at line 258 of file pilot_cargo.c.
| int pilot_rmMissionCargo | ( | Pilot * | pilot, |
| unsigned int | cargo_id, | ||
| int | jettison ) |
Removes special mission cargo based on id.
| pilot | Pilot to remove cargo from. |
| cargo_id | ID of the cargo to remove. |
| jettison | Should jettison the cargo? |
Definition at line 282 of file pilot_cargo.c.
|
static |
ID generator for special mission cargo. Not guaranteed to be absolutely unique, only unique for each pilot.
Definition at line 26 of file pilot_cargo.c.