diff --git a/source/entities/arounders.cpp b/source/entities/arounders.cpp index 204f991..dcb96a5 100644 --- a/source/entities/arounders.cpp +++ b/source/entities/arounders.cpp @@ -55,9 +55,6 @@ namespace arounders bool pujarEscalo(arounder *a); bool baixarEscalo(arounder *a); - bool checkArounderAnt(arounder *a, int x, int y, int o); - bool checkArounderSig(arounder *a, int x, int y, int o); - void doCavar(arounder *a); void doPerforar(arounder *a); void doEscalera(arounder *a, int desfase = 0); @@ -681,11 +678,12 @@ namespace arounders bool blockArounder(arounder *a) { - bool resultado = false; - if (a->anterior) resultado = checkArounderAnt(a->anterior, a->x, a->y, a->orientacio); - if (a->siguiente) resultado = resultado || checkArounderSig(a->siguiente, a->x, a->y, a->orientacio); - - return resultado; + arounder *b = arounders::first; + while (b) { + if ( (a != b) && ( b->accio == arounders::accions::parar ) && ( a->y >= b->y-8 ) && ( a->y <= b->y+8 ) && ( b->x == a->x+8-(a->orientacio*2) ) ) return true; + b = b->siguiente; + } + return false; } bool blockParet(arounder *a, int desfase) @@ -835,33 +833,6 @@ namespace arounders ); } - - bool checkArounderAnt(arounder *a, int x, int y, int o) - { - if ( a->accio == arounders::accions::parar && (y >= a->y-8) && (y <= a->y+8) && ( (o == arounders::orientacions::dreta && a->x == x+8) || (o == arounders::orientacions::esquerra && a->x == x-8) ) ) { - return true; - } else { - if (a->anterior) { - return checkArounderAnt(a->anterior, x, y, o); - } else { - return false; - } - } - } - - bool checkArounderSig(arounder *a, int x, int y, int o) - { - if ( a->accio == arounders::accions::parar && (y >= a->y-8) && (y <= a->y+8) && ( (o == arounders::orientacions::dreta && a->x == x+8) || (o == arounders::orientacions::esquerra && a->x == x-8) ) ) { - return true; - } else { - if (a->siguiente) { - return checkArounderSig(a->siguiente, x, y, o); - } else { - return false; - } - } - } - void doCavar(arounder *a) { if (a->orientacio == arounders::orientacions::dreta) { diff --git a/source/japi/draw.cpp b/source/japi/draw.cpp index 71feb43..4128a62 100644 --- a/source/japi/draw.cpp +++ b/source/japi/draw.cpp @@ -1,5 +1,5 @@ #include "draw.h" -#include "SDL3/SDL.h" +#include #include "gif.h" #include "file.h" #include "shader.h"