diff --git a/.gitmodules b/.gitmodules index 8a7227c..eef59d4 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,9 +1,9 @@ [submodule "Gamacon"] - path = lib/gamacon - url = https://github.com/AnonymusRaccoon/Gamacon + path = lib/gamacon + url = https://github.com/AnonymusRaccoon/Gamacon [submodule "lib/xmlparser"] - path = lib/xmlparser - url = https://github.com/AnonymusRaccoon/xmlParser + path = lib/xmlparser + url = https://github.com/AnonymusRaccoon/xmlParser [submodule "lib/quadtree"] - path = lib/quadtree - url = https://github.com/AnonymusRaccoon/quadtree + path = lib/quadtree + url = https://github.com/AnonymusRaccoon/quadtree diff --git a/Makefile b/Makefile index 9169fd3..6ab3edf 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ ## SRC = src/main.c \ - src/game_loader.c + src/game_loader.c OBJ = $(SRC:%.c=%.o) @@ -24,36 +24,36 @@ CC = gcc all: build build: $(OBJ) - $(MAKE) -C lib/gamacon - $(MAKE) -C lib/my - $(MAKE) -C lib/xmlparser - $(MAKE) -C lib/quadtree - $(CC) -o $(NAME) $(OBJ) $(LDFLAGS) + $(MAKE) -C lib/gamacon + $(MAKE) -C lib/my + $(MAKE) -C lib/xmlparser + $(MAKE) -C lib/quadtree + $(CC) -o $(NAME) $(OBJ) $(LDFLAGS) clean: - $(MAKE) -C lib/gamacon clean - $(MAKE) -C lib/my clean - $(MAKE) -C lib/xmlparser clean - $(MAKE) -C lib/quadtree clean - $(RM) $(OBJ) + $(MAKE) -C lib/gamacon clean + $(MAKE) -C lib/my clean + $(MAKE) -C lib/xmlparser clean + $(MAKE) -C lib/quadtree clean + $(RM) $(OBJ) fclean: clean - $(RM) $(NAME) + $(RM) $(NAME) ffclean: fclean - $(MAKE) -C lib/my fclean - $(MAKE) -C lib/gamacon fclean - $(MAKE) -C lib/xmlparser fclean - $(MAKE) -C lib/quadtree fclean + $(MAKE) -C lib/my fclean + $(MAKE) -C lib/gamacon fclean + $(MAKE) -C lib/xmlparser fclean + $(MAKE) -C lib/quadtree fclean re: fclean all dbg: CFLAGS += -g dbg: clean $(OBJ) - $(MAKE) -C lib/gamacon dbg - $(MAKE) -C lib/my - $(MAKE) -C lib/xmlparser dbg - $(MAKE) -C lib/quadtree dbg - $(CC) -o $(NAME) $(OBJ) $(LDFLAGS) + $(MAKE) -C lib/gamacon dbg + $(MAKE) -C lib/my + $(MAKE) -C lib/xmlparser dbg + $(MAKE) -C lib/quadtree dbg + $(CC) -o $(NAME) $(OBJ) $(LDFLAGS) .PHONY: all build clean fclean ffclean \ No newline at end of file diff --git a/include/components/game_display.h b/include/components/game_display.h index 15bbad2..8514f62 100644 --- a/include/components/game_display.h +++ b/include/components/game_display.h @@ -9,15 +9,15 @@ typedef enum display_type { - HAPPINESS_DISPLAY, - STUPIDITY_DISPLAY, - SELECT_TILE_DISPLAY + HAPPINESS_DISPLAY, + STUPIDITY_DISPLAY, + SELECT_TILE_DISPLAY } display_type; struct game_display { - gc_component base; - display_type type; + gc_component base; + display_type type; }; const struct game_display game_display; diff --git a/include/components/game_manager.h b/include/components/game_manager.h index 189e21c..61f35be 100644 --- a/include/components/game_manager.h +++ b/include/components/game_manager.h @@ -9,9 +9,9 @@ struct game_manager { - gc_component base; - int happiness; - int stupidity; + gc_component base; + int happiness; + int stupidity; }; const struct game_manager game_manager; diff --git a/include/components/isometry/map_manager_component.h b/include/components/isometry/map_manager_component.h index c6ffec0..aa18548 100644 --- a/include/components/isometry/map_manager_component.h +++ b/include/components/isometry/map_manager_component.h @@ -9,18 +9,18 @@ enum brush { - MOVE, - RESET, - ROTATE, - TEXTURE + MOVE, + RESET, + ROTATE, + TEXTURE }; struct map_manager_component { - gc_component base; - bool tile_mode; - enum brush brush; - void *selected_texture; + gc_component base; + bool tile_mode; + enum brush brush; + void *selected_texture; }; const struct map_manager_component map_manager_component; diff --git a/include/components/teams_component.h b/include/components/teams_component.h index 28becf8..c2224ca 100644 --- a/include/components/teams_component.h +++ b/include/components/teams_component.h @@ -9,12 +9,12 @@ struct teams_component { - gc_component base; - float next_teams; - float delay; - char **prefabs; - int *prefabs_size; - int prefab_count; + gc_component base; + float next_teams; + float delay; + char **prefabs; + int *prefabs_size; + int prefab_count; }; const struct teams_component teams_component; diff --git a/include/map_interactions.h b/include/map_interactions.h index f981b81..1dbc092 100644 --- a/include/map_interactions.h +++ b/include/map_interactions.h @@ -14,12 +14,12 @@ #include "keybindings.h" enum modes_on_tile { - VERTEX_0 = 2, - VERTEX_1 = 4, - VERTEX_2 = 8, - VERTEX_3 = 16, - ALL_VERTICES = 30, - INVERT_ADD_VALUE = 1 + VERTEX_0 = 2, + VERTEX_1 = 4, + VERTEX_2 = 8, + VERTEX_3 = 16, + ALL_VERTICES = 30, + INVERT_ADD_VALUE = 1 }; bool tile_interact(gc_engine *engine, gc_entity *entity, gc_vector2 pos, \ diff --git a/lib/gamacon b/lib/gamacon index 576221a..0062aa9 160000 --- a/lib/gamacon +++ b/lib/gamacon @@ -1 +1 @@ -Subproject commit 576221a8e21565a89495871c64d011ce4b1c70c0 +Subproject commit 0062aa990e97276d8e59eee3bd484b9c83758408 diff --git a/lib/my/Makefile b/lib/my/Makefile index 9301443..e3d41dd 100644 --- a/lib/my/Makefile +++ b/lib/my/Makefile @@ -6,22 +6,22 @@ ## SRC = src/printf.c \ - src/printf_utility.c \ - src/my_putlonglong_base.c \ - src/formaters/string_formater.c \ - src/formaters/string_nonprintable_formater.c \ - src/formaters/char_formater.c \ - src/formaters/int_formater.c \ - src/formaters/uint_formater.c \ - src/formaters/ptr_formater.c \ - src/formaters/ubinary_formater.c \ - src/formaters/octal_formater.c \ - src/formaters/hexa_formater.c \ - src/formaters/big_hexa_formater.c \ - src/formaters/float_formater.c \ - src/formaters/no_format.c \ - src/get_nbr_size.c \ - my/*.c + src/printf_utility.c \ + src/my_putlonglong_base.c \ + src/formaters/string_formater.c \ + src/formaters/string_nonprintable_formater.c \ + src/formaters/char_formater.c \ + src/formaters/int_formater.c \ + src/formaters/uint_formater.c \ + src/formaters/ptr_formater.c \ + src/formaters/ubinary_formater.c \ + src/formaters/octal_formater.c \ + src/formaters/hexa_formater.c \ + src/formaters/big_hexa_formater.c \ + src/formaters/float_formater.c \ + src/formaters/no_format.c \ + src/get_nbr_size.c \ + my/*.c OBJ = *.o @@ -42,20 +42,20 @@ UT = ut all: $(NAME) $(NAME): - $(CC) -c $(SRC) $(INCLUDE) $(CFLAGS) - ar rc $(NAME) $(OBJ) + $(CC) -c $(SRC) $(INCLUDE) $(CFLAGS) + ar rc $(NAME) $(OBJ) tests_run: - $(CC) -o $(UT) $(SRC) $(TESTS) $(INCLUDE) $(COVERAGE) $(CFLAGS) - ./$(UT) + $(CC) -o $(UT) $(SRC) $(TESTS) $(INCLUDE) $(COVERAGE) $(CFLAGS) + ./$(UT) clean: - rm -rf $(OBJ) - rm -rf *.gc* + rm -rf $(OBJ) + rm -rf *.gc* fclean: clean - rm -rf $(NAME) - rm -rf $(UT) + rm -rf $(NAME) + rm -rf $(UT) re: fclean all diff --git a/lib/my/my/my_getnbr.c b/lib/my/my/my_getnbr.c index 6a837c1..dcbac57 100755 --- a/lib/my/my/my_getnbr.c +++ b/lib/my/my/my_getnbr.c @@ -66,6 +66,6 @@ int my_getnbr(const char *str) break; } if (count <= 0) - return (0); + return (0); return init_print(str, count, start_index); } diff --git a/lib/my/my/my_str_replace.c b/lib/my/my/my_str_replace.c index 546c803..fd850f6 100644 --- a/lib/my/my/my_str_replace.c +++ b/lib/my/my/my_str_replace.c @@ -1,20 +1,23 @@ -// -// Created by anonymus-raccoon on 2/27/20. -// +/* +** EPITECH PROJECT, 2020 +** My3D +** File description: +** my_str_replace +*/ #include "my.h" char *my_str_replace(char *str, const char *to_replace, char c) { - char *p; - int len = my_strlen(to_replace); + char *p; + int len = my_strlen(to_replace); - while ((p = my_strstr(str, to_replace))) { - *p = c; - p++; - for (char *ptr = p + len - 1; *ptr; ptr++, p++) - *p = *ptr; - *p = '\0'; - } - return (str); + while ((p = my_strstr(str, to_replace))) { + *p = c; + p++; + for (char *ptr = p + len - 1; *ptr; ptr++, p++) + *p = *ptr; + *p = '\0'; + } + return (str); } \ No newline at end of file diff --git a/lib/my/my/my_strdup.c b/lib/my/my/my_strdup.c index e95701b..bc85464 100644 --- a/lib/my/my/my_strdup.c +++ b/lib/my/my/my_strdup.c @@ -15,7 +15,7 @@ char *my_strdup(const char *src) char *ret = malloc(sizeof(char) * (length + 1)); if (!ret) - return (NULL); + return (NULL); for (int i = 0; i < length; i++) ret[i] = src[i]; ret[length] = '\0'; diff --git a/lib/my/my/tostr.c b/lib/my/my/tostr.c index 025415c..20e31a3 100644 --- a/lib/my/my/tostr.c +++ b/lib/my/my/tostr.c @@ -55,7 +55,7 @@ char *tostr(int n) char *ret = malloc(sizeof(char) * (count + 1)); if (!ret) - return (NULL); + return (NULL); putnbr_in(n, base, ret, count); ret[count] = '\0'; diff --git a/lib/my/tests/test_printf.c b/lib/my/tests/test_printf.c deleted file mode 100644 index 3f944e9..0000000 --- a/lib/my/tests/test_printf.c +++ /dev/null @@ -1,176 +0,0 @@ -/* -** EPITECH PROJECT, 2019 -** Tests -** File description: -** test_disp_stdarg -*/ - -#include -#include -#include "my.h" - -Test(disp, first, .init = cr_redirect_stdout) -{ - my_printf("Insane %s, %c, %d, %s\n", "Yes", '8', 15, "Nope"); - cr_assert_stdout_eq_str("Insane Yes, 8, 15, Nope\n"); -} - -Test(disp, faketag, .init = cr_redirect_stdout) -{ - my_printf("Insane %Y, %c, %d, %s\n", '8', 15, "Nope"); - cr_assert_stdout_eq_str("Insane %Y, 8, 15, Nope\n"); -} - -Test(disp, str, .init = cr_redirect_stdout) -{ - my_printf("Insane %s\n", "156615"); - cr_assert_stdout_eq_str("Insane 156615\n"); -} - -Test(disp, uints, .init = cr_redirect_stdout) -{ - my_printf("Insane %u\n", 156615); - cr_assert_stdout_eq_str("Insane 156615\n"); -} - -Test(disp, characters, .init = cr_redirect_stdout) -{ - my_printf("Insane %c\n", '^'); - cr_assert_stdout_eq_str("Insane ^\n"); -} - -Test(disp, ints, .init = cr_redirect_stdout) -{ - my_printf("Insane %d, %i\n", 15, -15); - cr_assert_stdout_eq_str("Insane 15, -15\n"); -} - -Test(disp, ptr, .init = cr_redirect_stdout) -{ - int ptr = 15; - char *str = malloc(sizeof(char) * 25); - - my_printf("Insane %p\n", &ptr); - sprintf(str, "Insane %p\n", &ptr); - cr_assert_stdout_eq_str(str); -} - -Test(disp, nonprintable, .init = cr_redirect_stdout) -{ - my_printf("Insane %S\n", "\aYes\a"); - cr_assert_stdout_eq_str("Insane \\007Yes\\007\n"); -} - -Test(disp, binary, .init = cr_redirect_stdout) -{ - my_printf("%b\n", 153152); - cr_assert_stdout_eq_str("100101011001000000\n"); -} - -Test(disp, octal, .init = cr_redirect_stdout) -{ - my_printf("%o\n", 153152); - cr_assert_stdout_eq_str("453100\n"); -} - -Test(disp, hexa, .init = cr_redirect_stdout) -{ - my_printf("%x\n", 1561356523); - cr_assert_stdout_eq_str("5d1068eb\n"); -} - -Test(disp, bighexa, .init = cr_redirect_stdout) -{ - my_printf("%X\n", 1561356523); - cr_assert_stdout_eq_str("5D1068EB\n"); -} - -Test(disp, uintneg, .init = cr_redirect_stdout) -{ - my_printf("%u\n", -500); - cr_assert_stdout_eq_str("4294966796\n"); -} - -Test(disp, noformat, .init = cr_redirect_stdout) -{ - my_printf("%%\n"); - cr_assert_stdout_eq_str("%\n"); -} - -Test(disp, floats, .init = cr_redirect_stdout) -{ - my_printf("%f\n", 13.684); - cr_assert_stdout_eq_str("13.684\n"); -} - -Test(disp, morefloat, .init = cr_redirect_stdout) -{ - my_printf("%f\n", 18.138613); - cr_assert_stdout_eq_str("18.138613\n"); -} - -Test(my_printf, mouliS, .init = cr_redirect_stdout) -{ - my_printf("%S", "mouline\atte\n"); - cr_assert_stdout_eq_str("mouline\\007tte\\012"); -} - -Test(my_printf, simplePtr, .init = cr_redirect_stdout) -{ - my_printf("%p", 3456789); - cr_assert_stdout_eq_str("0x34bf15"); -} - -Test(my_printf, intLength, .init = cr_redirect_stdout) -{ - my_printf("%05i", 15); - cr_assert_stdout_eq_str("00015"); -} - -Test(my_printf, intPlusSize, .init = cr_redirect_stdout) -{ - my_printf("%0+5i", 15); - cr_assert_stdout_eq_str("+0015"); -} - -Test(my_printf, intLengthSpace, .init = cr_redirect_stdout) -{ - my_printf("% 05i", 15); - cr_assert_stdout_eq_str(" 0015"); -} - -Test(my_printf, intLengthSpacePlus, .init = cr_redirect_stdout) -{ - my_printf("% 0+5i", -15); - cr_assert_stdout_eq_str("-0015"); -} - -Test(my_printf, xLength, .init = cr_redirect_stdout) -{ - my_printf("%05X", 15); - cr_assert_stdout_eq_str("0000F"); -} - -Test(my_printf, xPlusSize, .init = cr_redirect_stdout) -{ - my_printf("%0+5X", 15); - cr_assert_stdout_eq_str("0000F"); -} - -Test(my_printf, xLengthSpace, .init = cr_redirect_stdout) -{ - my_printf("%#X", -15); - cr_assert_stdout_eq_str("0XFFFFFFF1"); -} - -Test(my_printf, xLengthSpacePlus, .init = cr_redirect_stdout) -{ - my_printf("%# +X", -15); - cr_assert_stdout_eq_str("0XFFFFFFF1"); -} - -Test(my_printf, stringWithMax, .init = cr_redirect_stdout) -{ - my_printf("%# +03s", "ABCDEFG"); - cr_assert_stdout_eq_str("ABC"); -} \ No newline at end of file diff --git a/lib/xmlparser b/lib/xmlparser index 91f3604..edee81e 160000 --- a/lib/xmlparser +++ b/lib/xmlparser @@ -1 +1 @@ -Subproject commit 91f3604772158a2ff8c17fb74459088004e4fe15 +Subproject commit edee81e3ae97aca57d513b0ce239c79b9d29c969 diff --git a/prefabs/game.gcprefab b/prefabs/game.gcprefab index 2dc4779..0d9904c 100644 --- a/prefabs/game.gcprefab +++ b/prefabs/game.gcprefab @@ -4,7 +4,7 @@ - + @@ -17,11 +17,11 @@ - + - + @@ -33,7 +33,7 @@ - + @@ -47,38 +47,38 @@ - - - - - - - + + + + + + + - - + + - - + + - - - - - - - - - + + + + + + + + + \ No newline at end of file diff --git a/prefabs/go/happiness.gcprefab b/prefabs/go/happiness.gcprefab index 9447199..217f04b 100644 --- a/prefabs/go/happiness.gcprefab +++ b/prefabs/go/happiness.gcprefab @@ -5,9 +5,9 @@ - - -