DungeonCrawl
Loading...
Searching...
No Matches
gear.h
Go to the documentation of this file.
1
5#ifndef GEAR_H
6#define GEAR_H
7
8#include "../combat/ability.h"
9#include "../common.h"
10#include "../stats/stats.h"
11#include "gear_identifier.h"
12
13
14#define MAX_ABILITY_PER_GEAR 4
15
16typedef enum {
17 SLOT_HEAD,
18 SLOT_CHEST,
19 SLOT_LEGS,
20 SLOT_FEET,
21 SLOT_HANDS,
22 SLOT_NECK,
23 SLOT_FINGER_RIGHT,
24 SLOT_FINGER_LEFT,
25 SLOT_LEFT_HAND, // Weapon slot
26 SLOT_RIGHT_HAND,// Weapon slot
27 SLOT_BOTH_HANDS,// Weapon slot
28 MAX_SLOT
29} gear_slot_t;
30
31typedef struct
32{
33 char local_key[MAX_NAME_LENGTH];
34 char* local_name;
35 gear_identifier_t gear_identifier;
36 gear_slot_t slot;
37 stats_t stats;
38 defenses_t defenses;// Armor Pieces can have other stats, e.g. +might etc. for now only armor
39 int num_abilities;
40 ability_t* abilities[MAX_ABILITY_PER_GEAR];
41} gear_t;
42
43
44typedef struct
45{
46 gear_t* gears[MAX_GEARS];
47 int num_gears;
49
67gear_t* init_gear(memory_pool_t* memory_pool, const char* name, gear_identifier_t gear_identifier, gear_slot_t slot, stats_t stats, defenses_t defenses, ability_table_t* ability_table, ability_names_t* abilities, int num_abilities);
79gear_table_t* init_gear_table(memory_pool_t* memory_pool, const db_connection_t* db_connection, ability_table_t* ability_table);
90void free_gear_table(memory_pool_t* memory_pool, gear_table_t* table);
101const char* gear_slot_to_string(gear_slot_t slot);
102
103
104#endif//GEAR_H
Exposes functions for working with abilities.
Defines common macros, types, and global variables for color schemes and utilities.
void free_gear_table(memory_pool_t *memory_pool, gear_table_t *table)
Frees the memory allocated for a gear table.
Definition gear.c:74
gear_t * init_gear(memory_pool_t *memory_pool, const char *name, gear_identifier_t gear_identifier, gear_slot_t slot, stats_t stats, defenses_t defenses, ability_table_t *ability_table, ability_names_t *abilities, int num_abilities)
Initializes a gear object.
Definition gear.c:14
gear_table_t * init_gear_table(memory_pool_t *memory_pool, const db_connection_t *db_connection, ability_table_t *ability_table)
Initializes a gear table.
Definition gear.c:45
const char * gear_slot_to_string(gear_slot_t slot)
Converts a gear slot enumeration value to its string representation.
Definition gear.c:86
Defines a gear identifier struct.
Exposes functions for working with stats.
This struct is used for the database connection in SQLite.
Definition database.h:22
Definition gear.h:32