Commit 04c25d12 authored by Bruno Freitas Tissei's avatar Bruno Freitas Tissei
Browse files

Bug fix

parent b827f012
......@@ -4,7 +4,7 @@
324 244 0
1000 988 0
512 328 236
412 228 136
780 492 468
712 528 436
1000 1000 1000
0000000000000000000000000000000000000000
......
#include "firefly.h"
void updateFirefly(map *m, firefly *first, int *dead) {
void updateFirefly(map *m, firefly *first, int *dead, int done) {
firefly *aux = first->next;
int i, j, k, l;
while (aux != NULL) {
i = aux->x;
j = aux->y;
if (!aux->dead) {
for (k = -1; k <= 1; k++) {
for (l = -1; l <= 1; l++) {
if (!(k && l) && m->grid[i+k][j+l] == '5') {
*dead = true;
aux->dead = true;
m->grid[i][j] = '0';
if (!done) {
for (k = -1; k <= 1; k++) {
for (l = -1; l <= 1; l++) {
if (!(k && l) && m->grid[i+k][j+l] == '5') {
*dead = true;
aux->dead = true;
m->grid[i][j] = '0';
}
}
}
}
......
......@@ -3,6 +3,6 @@
#include "utils.h"
#include "entity.h"
void updateFirefly(map *m, firefly *first, int *dead);
void updateFirefly(map *m, firefly *first, int *dead, int done);
#endif
......@@ -235,7 +235,7 @@ void renderMap(map *m, int time) {
}
if (nff && !(time % 4))
updateFirefly(m, firstff, &dead);
updateFirefly(m, firstff, &dead, done);
for (i = 0; i < WIDTH; i++) {
for (j = 0; j < HEIGHT; j++) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment