DungeonCrawl
Loading...
Searching...
No Matches
potion.h
Go to the documentation of this file.
1
5#ifndef POTION_H
6#define POTION_H
7
8#include "../common.h"
11
12typedef enum {
13 HEALING,
14 MANA,
15 STAMINA,
16 MAX_POTION_TYPES
17} potion_type_t;
18
19typedef struct {
20 char name[MAX_NAME_LENGTH];
21 potion_type_t effectType;
22 int value;// e.g. value = 30, healing potion heals for 30 health
23 // for other item effects more values might be needed
24} potion_t;
25
26typedef struct {
27 potion_t potions[MAX_POTION_TYPES];
29
38potion_t* init_potion(potion_t* potion, const char* name, potion_type_t type, int value);
39
47potion_table_t* init_potion_table(memory_pool_t* memory_pool, const db_connection_t* db_connection);
48
55const char* potion_type_to_string(potion_type_t type);
56
63void free_potion(memory_pool_t* memory_pool, potion_t* potion);
64
71void free_potion_table(memory_pool_t* memory_pool, potion_table_t* table);
72
73#endif//POTION_H
Defines common macros, types, and global variables for color schemes and utilities.
Exposes functions for working with the database.
Exposes functions for working with the memory management.
const char * potion_type_to_string(potion_type_t type)
Converts a potion type to a string representation.
Definition potion.c:40
potion_t * init_potion(potion_t *potion, const char *name, potion_type_t type, int value)
creates a potion object with the given name, type and value
Definition potion.c:11
void free_potion(memory_pool_t *memory_pool, potion_t *potion)
Frees the memory allocated for a potion.
potion_table_t * init_potion_table(memory_pool_t *memory_pool, const db_connection_t *db_connection)
initializes a potion table with potions from the database
Definition potion.c:20
void free_potion_table(memory_pool_t *memory_pool, potion_table_t *table)
Frees the memory allocated for a potion table.
Definition potion.c:53
This struct is used for the database connection in SQLite.
Definition database.h:22