Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 768ccb7c authored by Julie Reynier's avatar Julie Reynier
Browse files

Added bug

parent b3a1b782
No related branches found
No related tags found
No related merge requests found
......@@ -3,10 +3,9 @@ OBJECTS := main.o \
../../engines/fullgame/map.o ../../engines/fullgame/action.o ../../engines/fullgame/common.o ../../engines/fullgame/events.o ../../engines/fullgame/read_input.o \
events_map.o custom_map.o input_manager.o
#DEFINES := -Dtemplate -Dinverse_xy -Dstring_comparison
#DEFINES := -Dstack_alloc -Dinverse_xy -Dstring_comparison
#DEFINES := -Dinverse_xy -Dstring_comparison
#DEFINES := -Dstring_comparison
#DEFINES := -Ddouble_writing_error
#DEFINES := -Dloops_error
#DEFINES := -Dindex_error
DEFINES :=
CC := gcc
......
......@@ -3,7 +3,7 @@
const char *str_map1 =
"\
#####################################\n\
#> b iy ## 6 @\n\
> b iy ## 6 @\n\
#####################################\n\
mix#fiw##############################\n\
";
......@@ -11,10 +11,11 @@ mix#fiw##############################\n\
const char *str_map2 =
"\
##############################\n\
#6 # @ \n\
# biy b # \n\
# fiw # \n\
# # \n\
# # #\n\
# fiw # @ #\n\
# biy 6 # #\n\
# # #\n\
# # #\n\
##############################\n\
#mix##########################\n\
";
......@@ -22,10 +23,10 @@ const char *str_map2 =
const char *str_map3 =
"\
#################################\n\
#6 # @ \n\
# mix # \n\
# biy # \n\
# # \n\
#6 # @ #\n\
# mix # #\n\
# biy # #\n\
# # #\n\
#################################\n\
fiw##############################\n\
";
......
......@@ -119,6 +119,7 @@ void add_rule(int c, int y, int x){
index_who = WALL_r;
else return;
int i = coord_idx(y,x);
int width = m->width;
if (x+2 < m->width && m->entities[i+1] && m->entities[i+1]->category == TEXT && m->entities[i+1]->stats[0] == 'i'){
if (m->entities[i+2] && m->entities[i+2]->category == TEXT){
int index_what;
......@@ -129,10 +130,12 @@ void add_rule(int c, int y, int x){
else if (m->entities[i+2]->stats[0] == 'x'){
index_what = STOP;
}
rules[index_who][index_what]=1;
rules[index_who][index_what] = 1;
}
}
int width = m->width;
#ifdef double_writing_error
else
#endif
if (y+2 < m->height && m->entities[i+width] && m->entities[i+width]->category == TEXT && m->entities[i+width]->stats[0] == 'i'){
if (m->entities[i+width*2] && m->entities[i+width*2]->category == TEXT){
int index_what;
......
......@@ -36,6 +36,13 @@ void apply_input(command * c) {
if (m->role == NONETYPE){
return;
}
#ifdef loops_error
for (int y = 0; y < m->height; y++){
for(int x = 0; x < m->width; x++){
input(y,x,c);
}
}
#else
if (!strcmp(c->command_buffer, "UP") || !strcmp(c->command_buffer, "UP_N") || !strcmp(c->command_buffer, "LEFT") || !strcmp(c->command_buffer, "LEFT_N")){
for (int y = 0; y < m->height; y++){
for(int x = 0; x < m->width; x++){
......@@ -44,8 +51,13 @@ void apply_input(command * c) {
}
}
else if (!strcmp(c->command_buffer, "DOWN") || !strcmp(c->command_buffer, "DOWN_N") || !strcmp(c->command_buffer, "RIGHT") || !strcmp(c->command_buffer, "RIGHT_N")){
#ifdef index_error
for (int y = m->height-1; y > 0; y--){
for(int x = m->width-1; x > 0; x--){
#else
for (int y = m->height-1; y >= 0; y--){
for(int x = m->width-1; x >= 0; x--){
#endif
input(y,x,c);
}
}
......@@ -53,5 +65,6 @@ void apply_input(command * c) {
else {
printf("Unknown input command.\n");
}
#endif
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment