Skip to content

Commit

Permalink
FORMAT-AUTO: automatic format on pull request #39
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Oct 4, 2023
1 parent 3c375af commit f67d07f
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 47 deletions.
2 changes: 1 addition & 1 deletion src/Client/Systems/Events/EventsSystems.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ namespace Systems {
const Types::Velocity velocity = {-0.7F, 0.0F};
const Types::Missiles missileType = {Types::MissileTypes::CLASSIC};
const Types::Health health = {1};
const Types::Damage damage = {10};
const Types::Damage damage = {10};

static void createMissile(
std::size_t id,
Expand Down
92 changes: 46 additions & 46 deletions src/ECS/Systems/Systems.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,30 +99,30 @@ namespace Systems {
}
}

#ifndef NDEBUG
void debugCollisionRect(std::size_t /*unused*/, std::size_t /*unused*/)
{
Registry::components<Types::CollisionRect> arrCollisionRect =
Registry::getInstance().getComponents<Types::CollisionRect>();
Registry::components<Types::Position> arrPosition =
Registry::getInstance().getComponents<Types::Position>();
Registry::components<Types::RectangleShape> arrRectangleShape =
Registry::getInstance().getComponents<Types::RectangleShape>();
#ifndef NDEBUG
void debugCollisionRect(std::size_t /*unused*/, std::size_t /*unused*/)
{
Registry::components<Types::CollisionRect> arrCollisionRect =
Registry::getInstance().getComponents<Types::CollisionRect>();
Registry::components<Types::Position> arrPosition =
Registry::getInstance().getComponents<Types::Position>();
Registry::components<Types::RectangleShape> arrRectangleShape =
Registry::getInstance().getComponents<Types::RectangleShape>();

std::vector<std::size_t> ids = arrCollisionRect.getExistingsId();
std::vector<std::size_t> ids = arrCollisionRect.getExistingsId();

for (auto &id : ids) {
if (arrPosition.exist(id) && !arrRectangleShape.exist(id)) {
Registry::getInstance()
.getComponents<Types::RectangleShape>()
.insert(
id,
{arrCollisionRect[id].width,
arrCollisionRect[id].height});
}
for (auto &id : ids) {
if (arrPosition.exist(id) && !arrRectangleShape.exist(id)) {
Registry::getInstance()
.getComponents<Types::RectangleShape>()
.insert(
id,
{arrCollisionRect[id].width,
arrCollisionRect[id].height});
}
}
#endif
}
#endif

void moveEntities(std::size_t /*unused*/, std::size_t /*unused*/)
{
Expand All @@ -140,7 +140,7 @@ namespace Systems {
}
}
}

static void executeDeathFunction(
std::size_t id,
Registry::components<Types::Dead> arrDead)
Expand All @@ -151,21 +151,21 @@ namespace Systems {
Registry::getInstance().removeEntity(id);
}
}
void deathChecker(std::size_t /*unused*/, std::size_t /*unused*/)
{
Registry::components<Types::Health> arrHealth =
Registry::getInstance().getComponents<Types::Health>();
Registry::components<Types::Dead> arrDead =
Registry::getInstance().getComponents<Types::Dead>();
void deathChecker(std::size_t /*unused*/, std::size_t /*unused*/)
{
Registry::components<Types::Health> arrHealth =
Registry::getInstance().getComponents<Types::Health>();
Registry::components<Types::Dead> arrDead =
Registry::getInstance().getComponents<Types::Dead>();

std::vector<std::size_t> ids = arrHealth.getExistingsId();
for (auto itIds = ids.begin(); itIds != ids.end(); itIds++) {
if (arrHealth.exist(*itIds) && arrHealth[*itIds].hp <= 0
&& arrDead.exist(*itIds)) {
executeDeathFunction(*itIds, arrDead);
}
std::vector<std::size_t> ids = arrHealth.getExistingsId();
for (auto itIds = ids.begin(); itIds != ids.end(); itIds++) {
if (arrHealth.exist(*itIds) && arrHealth[*itIds].hp <= 0
&& arrDead.exist(*itIds)) {
executeDeathFunction(*itIds, arrDead);
}
}
}

const std::string musicPath = "assets/Audio/Musics/Title.mp3";
const std::string soundPath = "assets/Audio/Sounds/fire.ogg";
Expand Down Expand Up @@ -262,18 +262,18 @@ namespace Systems {
.removeSystem(systemId);
}

#ifndef NDEBUG
std::vector<std::function<void(std::size_t, std::size_t)>> getECSSystems()
{
return {
windowCollision,
init,
entitiesCollision,
moveEntities,
debugCollisionRect,
deathChecker};
}
#else
#ifndef NDEBUG
std::vector<std::function<void(std::size_t, std::size_t)>> getECSSystems()
{
return {
windowCollision,
init,
entitiesCollision,
moveEntities,
debugCollisionRect,
deathChecker};
}
#else
std::vector<std::function<void(std::size_t, std::size_t)>> getECSSystems()
{
return {
Expand All @@ -283,5 +283,5 @@ namespace Systems {
moveEntities,
deathChecker};
}
#endif
#endif
} // namespace Systems

0 comments on commit f67d07f

Please sign in to comment.