- [NEW] Simplificada la búsqueda de si hiha un arounder bloquejant el pas

- [FIX] Arreglat un include
This commit is contained in:
2025-10-20 13:58:00 +02:00
parent 81c5011bc7
commit eb0f5e24bd
2 changed files with 7 additions and 36 deletions

View File

@@ -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) {