mirror of
https://codeberg.org/ACME-Corporation/cub3d.git
synced 2025-12-06 09:58:09 +01:00
Added filetype checking
This commit is contained in:
parent
8f99d23431
commit
935370ac63
5 changed files with 58 additions and 27 deletions
27
src/main.c
27
src/main.c
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
#include "../includes/libft.h"
|
||||
#include "../includes/mlx.h"
|
||||
//#include "../includes/filecheck.h"
|
||||
#include "../includes/maputils.h"
|
||||
#include <stdbool.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
|
@ -26,12 +26,6 @@ typedef struct s_mlx_data
|
|||
int endian;
|
||||
} t_mlx_data;
|
||||
|
||||
typedef struct s_mapdata
|
||||
{
|
||||
char *filename;
|
||||
bool isvalid;
|
||||
char error[1024];
|
||||
} t_mapdata;
|
||||
|
||||
void my_mlx_pixel_put(t_mlx_data *data, int x, int y, int color)
|
||||
{
|
||||
|
|
@ -41,25 +35,6 @@ void my_mlx_pixel_put(t_mlx_data *data, int x, int y, int color)
|
|||
*(unsigned int*)dst = color;
|
||||
}
|
||||
|
||||
bool check_filename(char *file)
|
||||
{
|
||||
(void)file;
|
||||
return (false);
|
||||
}
|
||||
|
||||
bool check_cubfile(char *file, t_mapdata *map)
|
||||
{
|
||||
int fd;
|
||||
|
||||
fd = open(file, O_RDONLY);
|
||||
if (fd < 0)
|
||||
return (ft_strlcpy(map->error, "Can't open file", 16), false);
|
||||
if (!check_filename(file))
|
||||
return (ft_strlcpy(map->error, "File is not a .cub file", 25), false);
|
||||
close(fd);
|
||||
return (true);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
void *mlx;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue