-
Notifications
You must be signed in to change notification settings - Fork 3
Error Management
This section is meant to explain our error codes and why they were triggered in the first place ! First, they are defined in an enum from enums.h as :
typedef enum e_status
{
NOTHING,
...
NB_ERRORS
} t_status;
Each macro except E_P
, E_P_NAME
, E_FLOAT
, E_EDIT_ENTITY
, E_EDIT_PORTAL
, E_EDIT_SECTOR
, E_EDIT_SECT_PORTAL
, E_EDIT_TEXT
and E_EDIT_VERTEX
which are deprecated, NB_ERRORS
which is used to allocate memory for messages and NOTHING
, DEATH
and WIN
which are game-states at program termination so they fall in the same function call as those errors, are used in the current version of the program and every single error is linked to a message defined in env.h. So, when the program encounters an error it uses our clean()
function prototyped as :
void clean(t_env *env, uint8_t error)
env
points to the structure that stores almost everything from our program (defined in structs.h so does the allocated memory and the error message array. Given an error
defined in enum t_status
, clean()
frees used memory and display the right message on the standard output before exit()
with error
as parameter. As explained in README.md, you can retrieve the termination code using the following command in your shell :
$> echo $?
In the following section each individual error is formatted as :
-
ERROR_CODE :
ERROR_NAME
Description
Click on the sub-category name to be redirected by the related errors.
The corresponding errors are either common or don't directly concern our source-code but need to be handled nonetheless to ensure the process integrity.
This project uses SDL2 to get a graphic output and SDL2_TTF, a SDL2 Framework which allow to display text inside windows generated via SDL2.
On top of graphic output we wanted to add somewhat of an audio atmosphere. To accomplish the goal we used sndfile to retrieve critical informations or Waveform (.wav) audio streams and ao to playback buffered frequencies.
Since our map is a plain text file (example map available here), we must ensure that a lot of data in it is valid at some point during the parsing because the user is able to modify the map data itself. See our map format to fix the following errors by hand.