naev 0.12.6
player_inventory.c File Reference

Inventory management for the player items. More...

#include "player_inventory.h"
#include "array.h"
Include dependency graph for player_inventory.c:

Go to the source code of this file.

Functions

static void item_free (PlayerItem *pi)
void player_inventoryClear (void)
 Clears the inventory and frees memory.
const PlayerItemplayer_inventory (void)
 Gets the whole player inventory.
int player_inventoryAmount (const char *name)
 Gets the amount of an item the player has.
int player_inventoryAdd (const char *name, int amount)
 Adds an item to the player inventory.
int player_inventoryRemove (const char *name, int amount)
 Removes an item from the player inventory.

Variables

static PlayerIteminventory = NULL

Detailed Description

Inventory management for the player items.

Definition in file player_inventory.c.

Function Documentation

◆ item_free()

void item_free ( PlayerItem * pi)
static

Definition at line 19 of file player_inventory.c.

◆ player_inventory()

const PlayerItem * player_inventory ( void )

Gets the whole player inventory.

Definition at line 38 of file player_inventory.c.

◆ player_inventoryAdd()

int player_inventoryAdd ( const char * name,
int amount )

Adds an item to the player inventory.

Parameters
nameItem to add.
amountAmount to add.

Definition at line 65 of file player_inventory.c.

◆ player_inventoryAmount()

int player_inventoryAmount ( const char * name)

Gets the amount of an item the player has.

Parameters
nameName of the item to try to get.
Returns
Amount the player has or 0 if none.

Definition at line 49 of file player_inventory.c.

◆ player_inventoryClear()

void player_inventoryClear ( void )

Clears the inventory and frees memory.

Definition at line 27 of file player_inventory.c.

◆ player_inventoryRemove()

int player_inventoryRemove ( const char * name,
int amount )

Removes an item from the player inventory.

Parameters
nameItem to remove.
amountAmount to remove.

Definition at line 92 of file player_inventory.c.

Variable Documentation

◆ inventory

PlayerItem* inventory = NULL
static

Items the player has.

Definition at line 17 of file player_inventory.c.