From 77656ba113dd8e6124fa1c6dba0fed70517092e4 Mon Sep 17 00:00:00 2001 From: Hugo LAMY Date: Tue, 28 May 2019 13:05:14 +0200 Subject: [PATCH] sans l'opion o opti les sames ne s'affichent pas --- f_bonus_opti.c | 4 ++-- f_bonus_print.c | 4 ++-- f_handle_errors.c | 5 +++-- f_parse_input.c | 7 ++++--- f_search_map.c | 5 +++-- fillit.dSYM/Contents/Info.plist | 20 ++++++++++++++++++++ fillit.h | 17 ++++++++++++++++- 7 files changed, 50 insertions(+), 12 deletions(-) create mode 100644 fillit.dSYM/Contents/Info.plist diff --git a/f_bonus_opti.c b/f_bonus_opti.c index c727dfa..463730d 100644 --- a/f_bonus_opti.c +++ b/f_bonus_opti.c @@ -6,7 +6,7 @@ /* By: hulamy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/05/24 14:42:46 by hulamy #+# #+# */ -/* Updated: 2019/05/27 19:31:53 by hulamy ### ########.fr */ +/* Updated: 2019/05/28 13:03:46 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ @@ -62,7 +62,7 @@ int check_same_tetri(t_fillist *list, int num) int i; curr_tetri = list; - while (curr_tetri != NULL) + while (curr_tetri != NULL/* && list->dope[1]*/) { i = 0; if (!(curr_tetri->memory = diff --git a/f_bonus_print.c b/f_bonus_print.c index f7d0a01..5076c6b 100644 --- a/f_bonus_print.c +++ b/f_bonus_print.c @@ -6,7 +6,7 @@ /* By: hulamy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/05/27 13:46:29 by hulamy #+# #+# */ -/* Updated: 2019/05/27 19:33:09 by hulamy ### ########.fr */ +/* Updated: 2019/05/28 09:57:40 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ @@ -35,7 +35,7 @@ t_fillist *print_tetri(t_fillist *list) print = tmp->same->tetribit; print <<= 16; ft_putstr("same --> "); - ft_putchar(tmp->same->letter); + ft_put_tetri_color(tmp->same->letter); ft_putchar('\n'); } ft_putchar('\n'); diff --git a/f_handle_errors.c b/f_handle_errors.c index 230cc2a..5377be0 100644 --- a/f_handle_errors.c +++ b/f_handle_errors.c @@ -6,7 +6,7 @@ /* By: vmanzoni +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/03/01 13:29:05 by vmanzoni #+# #+# */ -/* Updated: 2019/05/24 18:02:08 by hulamy ### ########.fr */ +/* Updated: 2019/05/28 11:26:25 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ @@ -69,8 +69,9 @@ void check_file_errors(char *file, int *dope) print_error_extended(1, dope); else if (file[i] == '\n') line_nbr++; + // le if suivant verifie quoi if (file[i] == '\n' && line_nbr % 5 == 0 && file[i-1] != '\n') - print_error("error\n"); // est-ce que ca n'imprime pas error deux fois ?? + print_error("error\n"); if (file[i] == '\n' && file[i+1] != '\0' && \ file[i+2] != '.' && file[i+2] != '#') print_error_extended(2, dope); diff --git a/f_parse_input.c b/f_parse_input.c index 3b1ee80..1594cc1 100644 --- a/f_parse_input.c +++ b/f_parse_input.c @@ -6,7 +6,7 @@ /* By: vmanzoni +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/04/15 14:48:14 by vmanzoni #+# #+# */ -/* Updated: 2019/05/27 19:43:06 by hulamy ### ########.fr */ +/* Updated: 2019/05/28 10:44:43 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ @@ -144,10 +144,11 @@ int parse_input(char *input, t_fillist **list, int *dope) while (j < 19) tetri[j++] = input[i++]; tetri[19] = '\0'; + // "wrong tetrimino" utile ? if (check_tetri_errors(tetri)) - print_error("error\n"); +// print_error("error\n"); // print_error("error: Wrong tetrimino.\n"); -// print_error_extended(check_tetri_errors(tetri)); + print_error_extended(check_tetri_errors(tetri), dope); add_to_list(tetri, list, letter++, dope); while (input[i] && input[i] != '.' && input[i] != '#') i++; diff --git a/f_search_map.c b/f_search_map.c index ef8b97e..0eb4b7e 100644 --- a/f_search_map.c +++ b/f_search_map.c @@ -6,7 +6,7 @@ /* By: hulamy +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/04/27 20:47:22 by hulamy #+# #+# */ -/* Updated: 2019/05/27 19:30:37 by hulamy ### ########.fr */ +/* Updated: 2019/05/28 11:56:18 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ @@ -94,7 +94,8 @@ void add_remove(unsigned int *map, t_fillist *list, int size) while (j >= list->position) { map[(j - 1) / 32] ^= (mask & tetri << (16 + i)) >> (j - 1); - map[(j - 1) / 32 + 1] ^= (mask & tetri << (16 + i)) << (32 - j) << 1; + if (map[(j - 1) / 32 + 1]) + map[(j - 1) / 32 + 1] ^= (mask & tetri << (16 + i)) << (32 - j) << 1; j -= size; i -= list->width; } diff --git a/fillit.dSYM/Contents/Info.plist b/fillit.dSYM/Contents/Info.plist new file mode 100644 index 0000000..96bfe2d --- /dev/null +++ b/fillit.dSYM/Contents/Info.plist @@ -0,0 +1,20 @@ + + + + + CFBundleDevelopmentRegion + English + CFBundleIdentifier + com.apple.xcode.dsym.fillit + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + dSYM + CFBundleSignature + ???? + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/fillit.h b/fillit.h index c919198..067ab24 100644 --- a/fillit.h +++ b/fillit.h @@ -6,7 +6,7 @@ /* By: vmanzoni +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2019/03/01 13:34:46 by vmanzoni #+# #+# */ -/* Updated: 2019/05/27 19:26:04 by hulamy ### ########.fr */ +/* Updated: 2019/05/28 12:15:39 by hulamy ### ########.fr */ /* */ /* ************************************************************************** */ @@ -45,6 +45,21 @@ /* ** STRUCTURE +** tetribit : tetri ecrit en binaire dans un short de 16 bits +** width : largeur du tetri +** height : hauteur du tetri +** position : memorise la position d tetri bit a bit +** place : position sur l'axe des abscisses de la map (position % size) +** rank : position de 1 a 32 dans l'int du tableau d'int (position % 32) +** num : memorise dans quel int du tableau on se trouve (position / 32) +** total_num : le nombre d'int dans le tableau d'int +** test : +** letter : +** dope : +** memory : +** same : +** next : +** start : */ typedef struct s_fillist {