DungeonCrawl
Loading...
Searching...
No Matches
common.h File Reference

Defines common macros, types, and global variables for color schemes and utilities. More...

Go to the source code of this file.

Data Structures

struct  vector2d_t
 2-dimensional vector struct More...
struct  string_max_t
 String struct with a fixed maximum length, it is directly linked to the macro MAX_STRING_LENGTH. More...

Macros

#define PYXEL
#define FG_R   253
#define FG_G   253
#define FG_B   253
#define BG_R   0
#define BG_G   0
#define BG_B   0
#define GREY_R   144
#define GREY_G   144
#define GREY_B   144
#define RED_R   180
#define RED_G   33
#define RED_B   44
#define YELLOW_R   244
#define YELLOW_G   220
#define YELLOW_B   95
#define GREEN_R   151
#define GREEN_G   197
#define GREEN_B   34
#define BLUE_R   43
#define BLUE_G   152
#define BLUE_B   240
#define BROWN_R   152
#define BROWN_G   88
#define BROWN_B   30
#define DEFAULT_COLORS   NCCHANNELS_INITIALIZER(FG_R, FG_G, FG_B, BG_R, BG_G, BG_B)
#define INVERTED_COLORS   NCCHANNELS_INITIALIZER(BG_R, BG_G, BG_B, FG_R, FG_G, FG_B)
#define RED_TEXT_COLORS   NCCHANNELS_INITIALIZER(RED_R, RED_G, RED_B, BG_R, BG_G, BG_B)
#define WALL_COLORS   NCCHANNELS_INITIALIZER(BLUE_R, BLUE_G, BLUE_B, BROWN_R, BROWN_G, BROWN_B)
#define EXIT_DOOR_COLORS   NCCHANNELS_INITIALIZER(YELLOW_R, YELLOW_G, YELLOW_B, BG_R, BG_G, BG_B)
#define KEY_COLORS   NCCHANNELS_INITIALIZER(YELLOW_R, YELLOW_G, YELLOW_B, BG_R, BG_G, BG_B)
#define GOBLIN_COLORS   NCCHANNELS_INITIALIZER(RED_R, RED_G, RED_B, BG_R, BG_G, BG_B)
#define HIDDEN_COLORS   NCCHANNELS_INITIALIZER(GREY_R, GREY_G, GREY_B, GREY_R, GREY_G, GREY_B)
#define START_DOOR_COLORS   NCCHANNELS_INITIALIZER(GREEN_R, GREEN_G, GREEN_B, BG_R, BG_G, BG_B)
#define FLOOR_COLORS   NCCHANNELS_INITIALIZER(BG_R, BG_G, BG_B, BG_R, BG_G, BG_B)
#define LIFE_FOUNTAIN_COLORS   NCCHANNELS_INITIALIZER(BG_R, BG_G, BG_B, GREEN_R, GREEN_G, GREEN_B)
#define MANA_FOUNTAIN_COLORS   NCCHANNELS_INITIALIZER(BG_R, BG_G, BG_B, BLUE_R, BLUE_G, BLUE_B)
#define MAX_STRING_LENGTH   256
#define MAX_NAME_LENGTH   64
#define COMMON_SUCCESS   0
 Common success return value.
#define NULL_PTR_HANDLER_RETURN(ptr, return_value, modul, format, ...)
#define CHECK_ARG_RETURN(bool_expr, return_value, modul, format, ...)

Typedefs

typedef struct vector2d_t vector2d_t
 2-dimensional vector struct
typedef struct string_max_t string_max_t
 String struct with a fixed maximum length, it is directly linked to the macro MAX_STRING_LENGTH.

Variables

memory_pool_tmain_memory_pool
 Global memory pool for the application.

Detailed Description

Defines common macros, types, and global variables for color schemes and utilities.

Definition in file common.h.

Macro Definition Documentation

◆ BG_B

#define BG_B   0

Definition at line 22 of file common.h.

◆ BG_G

#define BG_G   0

Definition at line 21 of file common.h.

◆ BG_R

#define BG_R   0

Definition at line 20 of file common.h.

◆ BLUE_B

#define BLUE_B   240

Definition at line 42 of file common.h.

◆ BLUE_G

#define BLUE_G   152

Definition at line 41 of file common.h.

◆ BLUE_R

#define BLUE_R   43

Definition at line 40 of file common.h.

◆ BROWN_B

#define BROWN_B   30

Definition at line 46 of file common.h.

◆ BROWN_G

#define BROWN_G   88

Definition at line 45 of file common.h.

◆ BROWN_R

#define BROWN_R   152

Definition at line 44 of file common.h.

◆ CHECK_ARG_RETURN

#define CHECK_ARG_RETURN ( bool_expr,
return_value,
modul,
format,
... )
Value:
if (bool_expr) { \
log_msg(ERROR, modul, format, ##__VA_ARGS__); \
return return_value; \
}

Definition at line 155 of file common.h.

155#define CHECK_ARG_RETURN(bool_expr, return_value, modul, format, ...) \
156 if (bool_expr) { \
157 log_msg(ERROR, modul, format, ##__VA_ARGS__); \
158 return return_value; \
159 }

◆ COMMON_SUCCESS

#define COMMON_SUCCESS   0

Common success return value.

This constant is used to indicate a successful operation in various functions throughout the application.

Definition at line 146 of file common.h.

◆ DEFAULT_COLORS

#define DEFAULT_COLORS   NCCHANNELS_INITIALIZER(FG_R, FG_G, FG_B, BG_R, BG_G, BG_B)

Definition at line 120 of file common.h.

◆ EXIT_DOOR_COLORS

#define EXIT_DOOR_COLORS   NCCHANNELS_INITIALIZER(YELLOW_R, YELLOW_G, YELLOW_B, BG_R, BG_G, BG_B)

Definition at line 126 of file common.h.

◆ FG_B

#define FG_B   253

Definition at line 18 of file common.h.

◆ FG_G

#define FG_G   253

Definition at line 17 of file common.h.

◆ FG_R

#define FG_R   253

Definition at line 16 of file common.h.

◆ FLOOR_COLORS

#define FLOOR_COLORS   NCCHANNELS_INITIALIZER(BG_R, BG_G, BG_B, BG_R, BG_G, BG_B)

Definition at line 131 of file common.h.

◆ GOBLIN_COLORS

#define GOBLIN_COLORS   NCCHANNELS_INITIALIZER(RED_R, RED_G, RED_B, BG_R, BG_G, BG_B)

Definition at line 128 of file common.h.

◆ GREEN_B

#define GREEN_B   34

Definition at line 38 of file common.h.

◆ GREEN_G

#define GREEN_G   197

Definition at line 37 of file common.h.

◆ GREEN_R

#define GREEN_R   151

Definition at line 36 of file common.h.

◆ GREY_B

#define GREY_B   144

Definition at line 26 of file common.h.

◆ GREY_G

#define GREY_G   144

Definition at line 25 of file common.h.

◆ GREY_R

#define GREY_R   144

Definition at line 24 of file common.h.

◆ HIDDEN_COLORS

#define HIDDEN_COLORS   NCCHANNELS_INITIALIZER(GREY_R, GREY_G, GREY_B, GREY_R, GREY_G, GREY_B)

Definition at line 129 of file common.h.

◆ INVERTED_COLORS

#define INVERTED_COLORS   NCCHANNELS_INITIALIZER(BG_R, BG_G, BG_B, FG_R, FG_G, FG_B)

Definition at line 121 of file common.h.

◆ KEY_COLORS

#define KEY_COLORS   NCCHANNELS_INITIALIZER(YELLOW_R, YELLOW_G, YELLOW_B, BG_R, BG_G, BG_B)

Definition at line 127 of file common.h.

◆ LIFE_FOUNTAIN_COLORS

#define LIFE_FOUNTAIN_COLORS   NCCHANNELS_INITIALIZER(BG_R, BG_G, BG_B, GREEN_R, GREEN_G, GREEN_B)

Definition at line 132 of file common.h.

◆ MANA_FOUNTAIN_COLORS

#define MANA_FOUNTAIN_COLORS   NCCHANNELS_INITIALIZER(BG_R, BG_G, BG_B, BLUE_R, BLUE_G, BLUE_B)

Definition at line 133 of file common.h.

◆ MAX_NAME_LENGTH

#define MAX_NAME_LENGTH   64

Definition at line 138 of file common.h.

◆ MAX_STRING_LENGTH

#define MAX_STRING_LENGTH   256

Definition at line 137 of file common.h.

◆ NULL_PTR_HANDLER_RETURN

#define NULL_PTR_HANDLER_RETURN ( ptr,
return_value,
modul,
format,
... )
Value:
if (ptr == NULL) { \
log_msg(ERROR, modul, format, ##__VA_ARGS__); \
return return_value; \
}

Definition at line 149 of file common.h.

149#define NULL_PTR_HANDLER_RETURN(ptr, return_value, modul, format, ...) \
150 if (ptr == NULL) { \
151 log_msg(ERROR, modul, format, ##__VA_ARGS__); \
152 return return_value; \
153 }

◆ PYXEL

#define PYXEL

Definition at line 11 of file common.h.

◆ RED_B

#define RED_B   44

Definition at line 30 of file common.h.

◆ RED_G

#define RED_G   33

Definition at line 29 of file common.h.

◆ RED_R

#define RED_R   180

Definition at line 28 of file common.h.

◆ RED_TEXT_COLORS

#define RED_TEXT_COLORS   NCCHANNELS_INITIALIZER(RED_R, RED_G, RED_B, BG_R, BG_G, BG_B)

Definition at line 122 of file common.h.

◆ START_DOOR_COLORS

#define START_DOOR_COLORS   NCCHANNELS_INITIALIZER(GREEN_R, GREEN_G, GREEN_B, BG_R, BG_G, BG_B)

Definition at line 130 of file common.h.

◆ WALL_COLORS

#define WALL_COLORS   NCCHANNELS_INITIALIZER(BLUE_R, BLUE_G, BLUE_B, BROWN_R, BROWN_G, BROWN_B)

Definition at line 125 of file common.h.

◆ YELLOW_B

#define YELLOW_B   95

Definition at line 34 of file common.h.

◆ YELLOW_G

#define YELLOW_G   220

Definition at line 33 of file common.h.

◆ YELLOW_R

#define YELLOW_R   244

Definition at line 32 of file common.h.

Variable Documentation

◆ main_memory_pool

memory_pool_t* main_memory_pool
extern

Global memory pool for the application.

This variable holds the main memory pool used for dynamic memory allocation throughout the application. It is initialized during the application's startup and should be properly managed to avoid memory leaks.

Definition at line 7 of file common.c.