mirror of
https://github.com/zoriya/Bomberman.git
synced 2026-06-06 19:22:20 +00:00
prevent from segf when no button on scene
This commit is contained in:
@@ -392,7 +392,6 @@ namespace BBM
|
|||||||
// .addComponent<ControllableComponent>()
|
// .addComponent<ControllableComponent>()
|
||||||
// .addComponent<KeyboardComponent>()
|
// .addComponent<KeyboardComponent>()
|
||||||
// .addComponent<CollisionComponent>(WAL::Callback<WAL::Entity &, const WAL::Entity &>(), &MapGenerator::wallCollide, 3);
|
// .addComponent<CollisionComponent>(WAL::Callback<WAL::Entity &, const WAL::Entity &>(), &MapGenerator::wallCollide, 3);
|
||||||
std::srand(std::time(nullptr));
|
|
||||||
MapGenerator::loadMap(16, 16, MapGenerator::createMap(16, 16), scene);
|
MapGenerator::loadMap(16, 16, MapGenerator::createMap(16, 16), scene);
|
||||||
return scene;
|
return scene;
|
||||||
}
|
}
|
||||||
@@ -408,6 +407,7 @@ namespace BBM
|
|||||||
|
|
||||||
int Runner::run()
|
int Runner::run()
|
||||||
{
|
{
|
||||||
|
std::srand(std::time(nullptr));
|
||||||
WAL::Wal wal;
|
WAL::Wal wal;
|
||||||
Runner::addSystems(wal);
|
Runner::addSystems(wal);
|
||||||
Runner::enableRaylib(wal);
|
Runner::enableRaylib(wal);
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ namespace BBM
|
|||||||
currentButton = nullptr;
|
currentButton = nullptr;
|
||||||
if (currentButton == nullptr && buttons.size())
|
if (currentButton == nullptr && buttons.size())
|
||||||
currentButton = &(**buttons.begin());
|
currentButton = &(**buttons.begin());
|
||||||
|
if (!currentButton)
|
||||||
|
return;
|
||||||
this->updateCurrentButton();
|
this->updateCurrentButton();
|
||||||
for (auto &[buttonEntity, clickComponent]: buttons) {
|
for (auto &[buttonEntity, clickComponent]: buttons) {
|
||||||
if (buttonEntity == *currentButton) {
|
if (buttonEntity == *currentButton) {
|
||||||
|
|||||||
Reference in New Issue
Block a user