13#include "player_inventory.h"
53 if ( strcmp( pi->
name, name ) == 0 )
73 if ( strcmp( pi->
name, name ) == 0 ) {
79 npi.
name = strdup( name );
96 if ( strcmp( pi->
name, name ) == 0 ) {
Provides macros to work with dynamic arrays.
#define array_free(ptr_array)
Frees memory allocated and sets array to NULL.
#define array_erase(ptr_array, first, last)
Erases elements in interval [first, last).
static ALWAYS_INLINE int array_size(const void *array)
Returns number of elements in the array.
#define array_push_back(ptr_array, element)
Adds a new element at the end of the array.
#define array_create(basic_type)
Creates a new dynamic array of ‘basic_type’.
Header file with generic functions and naev-specifics.
int player_inventoryAdd(const char *name, int amount)
Adds an item to the player inventory.
static PlayerItem * inventory
void player_inventoryClear(void)
Clears the inventory and frees memory.
int player_inventoryRemove(const char *name, int amount)
Removes an item from the player inventory.
const PlayerItem * player_inventory(void)
Gets the whole player inventory.
int player_inventoryAmount(const char *name)
Gets the amount of an item the player has.
Represents an item in the player inventory.