Fixing a random segfault at the begining

This commit is contained in:
Anonymus Raccoon
2020-04-14 19:06:19 +02:00
parent 99318799a4
commit ecf87480ca
8 changed files with 7 additions and 93 deletions
+1 -1
View File
@@ -279,7 +279,7 @@ add_executable(my_rpg
src/components/game_display.c
src/systems/game_display_system.c
include/map_editor.h
)
)
add_compile_options(-W -Wall -Wextra -Wshadow)
Binary file not shown.

After

Width:  |  Height:  |  Size: 372 B

+2 -2
View File
@@ -1,4 +1,4 @@
<gc_entities>
<panel src="panel" x="50%" y="87%" width="100%" height="26%" />
<text text="Fatal error: No dialog found." x="7%" y="87%" centered="false" text_id="1337" />
<panel src="text_box" x="50%" y="87%" width="60%" height="15%" />
<text text="Fatal error:\nNo dialog found." x="27%" y="87%" centered="false" text_id="1337" />
</gc_entities>
+3 -2
View File
@@ -6,6 +6,7 @@
<sprite name="front_panel" src="assets/ui/front_panel.png" />
<sprite name="button_background" src="assets/ui/button_background.png" />
<sprite name="black_background" src="assets/ui/black_background.png" />
<sprite name="text_box" src="assets/ui/text_box.png" />
<sprite name="player" src="assets/sprites/player_spritesheet.png" />
<sprite name="tree" src="assets/sprites/Oak_Tree.png" />
<sprite name="main_ui_game" src="assets/ui/health_and_xp.png" />
@@ -146,8 +147,8 @@
</renderer>
<map_linker x="2" y="6" />
<dialog_holder x="2" y="5" tile_texture="cobblestone">
<test_dialog line="Hello dirt block, I am the mighty cobble block." />
<test_dialog line="Can I do something for you?" />
<test_dialog line="Hello dirt block,\nI am the mighty cobble block." />
<test_dialog line="Can I do something\n for you?" />
</dialog_holder>
</gc_entity>
-13
View File
@@ -1,13 +0,0 @@
<gc_scene>
<data>
<sprite name="panel" src="assets/ui/panel.png" />
<sprite name="button_background" src="assets/ui/button_background.png" />
<font src="assets/fonts/roboto.ttf" />
</data>
<gc_entities>
<panel src="panel" x="50%" y="45%" width="300" height="69%"/>
<text text="Game Over" x="50%" y="25%" resize="false"/>
<button text="Retry" x="50%" y="60%" click="start_button" color="black" width="200" resize="false" />
<button text="Exit" x="50%" y="72%" click="quit" color="black" width="200" resize="false" />
</gc_entities>
</gc_scene>
-15
View File
@@ -1,15 +0,0 @@
<gc_scene>
<data>
<sprite name="panel" src="assets/ui/panel.png" />
<sprite name="button_background" src="assets/ui/button_background.png" />
<sprite name="martine" src="assets/ui/martine_a_epi_marseille.png" />
<font src="assets/fonts/roboto.ttf" />
</data>
<gc_entities>
<panel src="panel" x="25%" y="45%" width="300" height="69%"/>
<text text="Game Over" x="25%" y="25%" resize="false"/>
<panel src="martine" x="75%" y="50%" width="20%" height="%" />
<button text="Retry" x="25%" y="60%" click="start_button" color="black" width="200" resize="false" />
<button text="Exit" x="25%" y="72%" click="quit" color="black" width="200" resize="false" />
</gc_entities>
</gc_scene>
-58
View File
@@ -1,58 +0,0 @@
/*
** EPITECH PROJECT, 2020
** My3D
** File description:
** map_manager_component
*/
#include "map_editor.h"
#include "engine.h"
#include "entity.h"
#include "xml.h"
#include "my.h"
static void ctr(void *comp, va_list args)
{
struct map_manager_component *cmp = (struct map_manager_component *)comp;
cmp->tile_mode = true;
cmp->brush = MOVE;
}
static void fdctr(gc_entity *entity, gc_scene *scene, void *comp, node *n)
{
struct map_manager_component *cmp = (struct map_manager_component *)comp;
void **data = scene->get_data(scene, "tiles", NULL);
cmp->tile_mode = true;
cmp->brush = MOVE;
if (data)
cmp->selected_texture = data[0];
}
static void dtr(void *component)
{
(void)component;
}
static char *serialize(void *component)
{
(void)component;
return (NULL);
}
const struct map_manager_component map_manager_component = {
base: {
name: "map_manager_component",
size: sizeof(struct map_manager_component),
dependencies: (char *[]){
NULL
},
ctr: &ctr,
fdctr: &fdctr,
dtr: &dtr,
serialize: &serialize,
destroy: &component_destroy
}
};
+1 -2
View File
@@ -26,8 +26,7 @@ static void fdctr(gc_entity *entity, gc_scene *scene, void *comp, node *n)
cmp->tile_mode = true;
cmp->brush = MOVE;
if (data)
cmp->selected_texture = data[0];
cmp->selected_texture = data ? data[0] : NULL;
}
static void dtr(void *component)