|
@@ -392,6 +392,7 @@ boolean bomb_explode(Game* g, int playerIndex, int x, int y, JsonEncoder* json)
|
|
|
add_array_object(&bonus, &object);
|
|
|
clean_json_encoder(&object);
|
|
|
}
|
|
|
+ break;
|
|
|
}
|
|
|
//Si un joueur
|
|
|
if (player_collision_index(g, x, y - 1 - i, &index)) {
|
|
@@ -413,6 +414,12 @@ boolean bomb_explode(Game* g, int playerIndex, int x, int y, JsonEncoder* json)
|
|
|
cChain++;
|
|
|
bomb_chain(g, playerIndex, x, y - 1 - i, &chain);
|
|
|
}
|
|
|
+ //Si un mur solide
|
|
|
+ if(g->map[x][y - 1 - i] == '-'){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
//Vers le bas
|
|
@@ -432,6 +439,7 @@ boolean bomb_explode(Game* g, int playerIndex, int x, int y, JsonEncoder* json)
|
|
|
add_array_object(&bonus, &object);
|
|
|
clean_json_encoder(&object);
|
|
|
}
|
|
|
+ break;
|
|
|
}
|
|
|
//Si un joueur
|
|
|
if (player_collision_index(g, x, y + 1 + i, &index)) {
|
|
@@ -453,6 +461,12 @@ boolean bomb_explode(Game* g, int playerIndex, int x, int y, JsonEncoder* json)
|
|
|
cChain++;
|
|
|
bomb_chain(g, playerIndex, x, y + 1 + i, &chain);
|
|
|
}
|
|
|
+ //Si un mur solide
|
|
|
+ if(g->map[x][y + 1 + i] == '-'){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
//Vers la gauche
|
|
@@ -472,6 +486,7 @@ boolean bomb_explode(Game* g, int playerIndex, int x, int y, JsonEncoder* json)
|
|
|
add_array_object(&bonus, &object);
|
|
|
clean_json_encoder(&object);
|
|
|
}
|
|
|
+ break;
|
|
|
}
|
|
|
//Si un joueur
|
|
|
if (player_collision_index(g, x - 1 - i, y, &index)) {
|
|
@@ -493,6 +508,12 @@ boolean bomb_explode(Game* g, int playerIndex, int x, int y, JsonEncoder* json)
|
|
|
cChain++;
|
|
|
bomb_chain(g, playerIndex, x - 1 - i, y, &chain);
|
|
|
}
|
|
|
+ //Si un mur solide
|
|
|
+ if(g->map[x - 1 - i][y] == '-'){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
//Vers la droite
|
|
@@ -512,6 +533,7 @@ boolean bomb_explode(Game* g, int playerIndex, int x, int y, JsonEncoder* json)
|
|
|
add_array_object(&bonus, &object);
|
|
|
clean_json_encoder(&object);
|
|
|
}
|
|
|
+ break;
|
|
|
}
|
|
|
//Si un joueur
|
|
|
if (player_collision_index(g, x + 1 + i, y, &index)) {
|
|
@@ -533,6 +555,12 @@ boolean bomb_explode(Game* g, int playerIndex, int x, int y, JsonEncoder* json)
|
|
|
cChain++;
|
|
|
bomb_chain(g, playerIndex, x + 1 + i, y, &chain);
|
|
|
}
|
|
|
+ //Si un mur solide
|
|
|
+ if(g->map[x + 1 + i][y] == '-'){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -606,6 +634,7 @@ void bomb_chain(Game* g, int playerIndex, int x, int y, JsonArray* chain) {
|
|
|
//Si un mur destructible
|
|
|
if (g->map[x][y - 1 - i] == '*') {
|
|
|
g->map[x][y - 1 - i] = '_';
|
|
|
+ break;
|
|
|
}
|
|
|
//Si un joueur
|
|
|
if (player_collision_index(g, x, y - 1 - i, &index)) {
|
|
@@ -626,6 +655,12 @@ void bomb_chain(Game* g, int playerIndex, int x, int y, JsonArray* chain) {
|
|
|
if (g->map[x][y - 1 - i] == '1' || g->map[x][y - 1 - i] == '2' || g->map[x][y - 1 - i] == '3') {
|
|
|
bomb_chain(g, playerIndex, x, y - 1 - i, chain);
|
|
|
}
|
|
|
+ //Si un mur solide
|
|
|
+ if(g->map[x][y - 1 - i] == '-'){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
//Vers le bas
|
|
@@ -635,6 +670,7 @@ void bomb_chain(Game* g, int playerIndex, int x, int y, JsonArray* chain) {
|
|
|
//Si un mur destructible
|
|
|
if (g->map[x][y + 1 + i] == '*') {
|
|
|
g->map[x][y + 1 + i] = '_';
|
|
|
+ break;
|
|
|
}
|
|
|
//Si un joueur
|
|
|
if (player_collision_index(g, x, y + 1 + i, &index)) {
|
|
@@ -655,6 +691,12 @@ void bomb_chain(Game* g, int playerIndex, int x, int y, JsonArray* chain) {
|
|
|
if (g->map[x][y + 1 + i] == '1' || g->map[x][y + 1 + i] == '2' || g->map[x][y + 1 + i] == '3') {
|
|
|
bomb_chain(g, playerIndex, x, y + 1 + i, chain);
|
|
|
}
|
|
|
+ //Si un mur solide
|
|
|
+ if(g->map[x][y + 1 + i] == '-'){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
//Vers la gauche
|
|
@@ -664,6 +706,7 @@ void bomb_chain(Game* g, int playerIndex, int x, int y, JsonArray* chain) {
|
|
|
//Si un mur destructible
|
|
|
if (g->map[x - 1 - i][y] == '*') {
|
|
|
g->map[x - 1 - i][y] = '_';
|
|
|
+ break;
|
|
|
}
|
|
|
//Si un joueur
|
|
|
if (player_collision_index(g, x - 1 - i, y, &index)) {
|
|
@@ -684,6 +727,12 @@ void bomb_chain(Game* g, int playerIndex, int x, int y, JsonArray* chain) {
|
|
|
if (g->map[x - 1 - i][y] == '1' || g->map[x - 1 - i][y] == '2' || g->map[x - 1 - i][y] == '3') {
|
|
|
bomb_chain(g, playerIndex, x - 1 - i, y, chain);
|
|
|
}
|
|
|
+ //Si un mur solide
|
|
|
+ if(g->map[x - 1 - i][y] == '-'){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
//Vers la droite
|
|
@@ -693,6 +742,7 @@ void bomb_chain(Game* g, int playerIndex, int x, int y, JsonArray* chain) {
|
|
|
//Si un mur destructible
|
|
|
if (g->map[x + 1 + i][y] == '*') {
|
|
|
g->map[x + 1 + i][y] = '_';
|
|
|
+ break;
|
|
|
}
|
|
|
//Si un joueur
|
|
|
if (player_collision_index(g, x + 1 + i, y, &index)) {
|
|
@@ -713,6 +763,12 @@ void bomb_chain(Game* g, int playerIndex, int x, int y, JsonArray* chain) {
|
|
|
if (g->map[x + 1 + i][y] == '1' || g->map[x + 1 + i][y] == '2' || g->map[x + 1 + i][y] == '3') {
|
|
|
bomb_chain(g, playerIndex, x + 1 + i, y, chain);
|
|
|
}
|
|
|
+ //Si un mur solide
|
|
|
+ if(g->map[x + 1 + i][y] == '-'){
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
}
|