From d0da1cfd8d05cc4d9f8dba2170002550dc9cf145 Mon Sep 17 00:00:00 2001 From: llebasca <llebasca@insa-rennes.fr> Date: Tue, 2 Mar 2021 13:45:06 +0100 Subject: [PATCH] map.c/h with doxygen documentation --- GAME/include/map.h | 28 ++++++++++++++++++++++------ GAME/src/map.c | 28 ++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 6 deletions(-) diff --git a/GAME/include/map.h b/GAME/include/map.h index eb84621..557e3d6 100644 --- a/GAME/include/map.h +++ b/GAME/include/map.h @@ -2,18 +2,34 @@ // Created by Tiny on 2/16/2021. */ +/*! + * \file map.h + * \brief Map Header File + * \authors Tin + * \version 1 + * \date 16/02/2021 + * + * Map structure and functions definiton. + * + */ + #ifndef INSAGAME_MAP_H #define INSAGAME_MAP_H +/*! + * \struct MAP + * \brief Map structure + */ + typedef struct { - char *path; //path of image bmp of map - int width; - int height; - int **functional; //2D functional matrix + char *path; /**< Path of image bmp of map */ + int width; /**< Map's width */ + int height; /**< Map's height */ + int **functional; /**< 2D functional matrix */ } MAP; -int initmap(MAP *map,char *path); //allocate the map's name and call the maptomatrix -int **maptomatrix(MAP *map); //get matrix'length and width => create a functional matrix from the bmp matrix +int initmap(MAP *map,char *path); +int **maptomatrix(MAP *map); diff --git a/GAME/src/map.c b/GAME/src/map.c index 067396e..6e9dc47 100644 --- a/GAME/src/map.c +++ b/GAME/src/map.c @@ -2,11 +2,32 @@ // Created by Tiny on 2/16/2021. */ +/*! + * \file map.c + * \brief Map Source File + * \authors Tin + * \version 1 + * \date 16/02/2021 + * + * Map function implementation. + * + */ + #include "map.h" #include <stdio.h> #include <stdint.h> #include <stdlib.h> #include <string.h> + +/*! + * \fn int initmap(MAP *map,char *path) + * \brief This function initialize the map : allocate the map's name and call the maptomatrix + * + * \param [in] map the map pointer + * \param [in] path the map image path + * \return 0 if the initialization went right. + */ + int initmap(MAP *map,char *path){ int lenpath = strlen(path); //get the path lenght map->path = (char *)malloc((lenpath)*sizeof(char)); //allocate the path @@ -15,6 +36,13 @@ int initmap(MAP *map,char *path){ return 0; } +/*! + * \fn int **maptomatrix(MAP *map) + * \brief This function gets the matrix's length and width and creates a functional matrix from the bmp matrix. + * + * \param [in] map the map pointer + * \return NULL if there is an error when opening the map, fonc otherwise. + */ int **maptomatrix(MAP *map){ -- GitLab