fix cmake not compiling because of git merge

This commit is contained in:
Askou
2021-06-14 10:51:49 +02:00
parent 53f0811b75
commit d3f77835d3
2 changed files with 10 additions and 27 deletions
+8 -20
View File
@@ -31,13 +31,14 @@ namespace BBM
return MapGenerator::wallCollided( entity, bomb, collidedAxis);
}
BombHolderSystem::BombHolderSystem(WAL::Wal &wal)
: System(wal)
{}
void BombHolderSystem::_dispatchExplosion(const Vector3f &position, WAL::Wal &wal, int radiusToDo, const Vector3f &posFrom)
void BombHolderSystem::_dispatchExplosion(Vector3f position, WAL::Wal &wal, int count)
{
if (radiusToDo <= 0)
if (count <= 0)
return;
wal.getScene()->scheduleNewEntity("explosion")
.addComponent<PositionComponent>(position)
@@ -54,23 +55,10 @@ namespace BBM
return;
}
}
const Vector3f expandVectors[] = {
{1, 0, 0},
{-1, 0, 0},
{0, 0, 1},
{0, 0, -1},
};
// should be true only at the first iteration
bool alwaysDispatch = position == posFrom;
for (const auto &expandVector : expandVectors) {
Vector3f newPos = position + expandVector;
if (!alwaysDispatch && newPos == posFrom) {
continue;
}
_dispatchExplosion(newPos, wal, radiusToDo - 1, position);
}
_dispatchExplosion(position + Vector3f(1, 0, 0), wal, count - 1);
_dispatchExplosion(position + Vector3f(-1, 0, 0), wal, count - 1);
_dispatchExplosion(position + Vector3f(0, 0, 1), wal, count - 1);
_dispatchExplosion(position + Vector3f(0, 0, -1), wal, count - 1);
});
}
@@ -79,7 +67,7 @@ namespace BBM
bomb.scheduleDeletion();
auto position = bomb.getComponent<PositionComponent>().position.round();
auto explosionRadius = bomb.getComponent<BasicBombComponent>().explosionRadius;
_dispatchExplosion(position, wal, explosionRadius);
_dispatchExplosion(position, wal, 3 + (explosionRadius - 3));
}
void BombHolderSystem::_spawnBomb(Vector3f position, BombHolderComponent &holder, unsigned id)
@@ -22,12 +22,7 @@ namespace BBM
void _spawnBomb(Vector3f position, BombHolderComponent &holder, unsigned id);
//! @brief Spawn a bomb at the specified position.
static void _dispatchExplosion(const Vector3f &position, WAL::Wal &wal, int radiusToDo, const Vector3f &posFrom);
//! @brief Wrapped call to specify default arg value
inline static void _dispatchExplosion(const Vector3f &position, WAL::Wal &wal, int radiusToDo) {
return _dispatchExplosion(position, wal, radiusToDo, position);
};
static void _dispatchExplosion(Vector3f position, WAL::Wal &, int count);
//! @brief The method triggered when the bomb explode.
static void _bombExplosion(WAL::Entity &bomb, WAL::Wal &);
@@ -51,4 +46,4 @@ namespace BBM
//! @brief A bomb holder system is not assignable.
BombHolderSystem &operator=(const BombHolderSystem &) = delete;
};
}
}