First shot on structures, First shot on option
option:
Added options for help, debug, save, file using bgoulard lib
structures:
Moved cub3d.h structures to cub3d_struct.h
Added color, dpoint, ipoint, tile, cli, error
Modified t_map, t_player to use previously mentioned struct :
ipoint, dpoint, tyle
This commit is contained in:
parent
be6038dcc8
commit
8ee1c5f85a
14 changed files with 580 additions and 79 deletions
|
|
@ -6,11 +6,13 @@
|
|||
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/10/30 16:41:32 by rparodi #+# #+# */
|
||||
/* Updated: 2024/10/31 16:54:21 by rparodi ### ########.fr */
|
||||
/* Updated: 2024/11/09 01:21:24 by bgoulard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "cub3d.h"
|
||||
#include "cub3d_struct.h"
|
||||
#include "ft_string.h"
|
||||
|
||||
/**
|
||||
* @brief checking if the args given to the executable is valid
|
||||
|
|
@ -19,12 +21,15 @@
|
|||
* @param argv the arguments value
|
||||
* @return false if an error / true if no error
|
||||
*/
|
||||
bool ft_parse_args(int argc, char *argv[])
|
||||
void parse_args(char *arg, t_info *inf)
|
||||
{
|
||||
if (argc != 2)
|
||||
return (print_error(ERR_ARGS_COUNT), false);
|
||||
if (ft_strlen(argv[1]) < 4 || \
|
||||
ft_strcmp((argv[1] + (strlen(argv[1]) - 4)), ".cub") != 0)
|
||||
return (print_error(INV_NAME_MAP), false);
|
||||
return (true);
|
||||
if (arg == NULL && inf->cli_ctx.file == NULL)
|
||||
return (inf->last_error = MISSING_FILE_ERROR, (void)0);
|
||||
if (arg && ft_strlen(arg) < 5)
|
||||
return (inf->last_error = NAME_FILE_ERROR, (void)0);
|
||||
if (arg && ft_strend_with(arg, FILE_EXTENSION) == false)
|
||||
return (inf->last_error = EXTENSION_FILE_ERROR, (void)0);
|
||||
if (arg && inf->cli_ctx.file == NULL)
|
||||
inf->cli_ctx.file = ft_strdup(arg);
|
||||
inf->last_error = NO_ERROR;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue