Tried to refactor for but #42 but nothing worked. I'll try later.
This commit is contained in:
parent
05fc9062a7
commit
a1c3f4df5a
5 changed files with 17 additions and 19 deletions
11
systems.cpp
11
systems.cpp
|
|
@ -423,12 +423,10 @@ void System::player_status() {
|
|||
|
||||
std::shared_ptr<sf::Shader> System::sprite_effect(Entity entity) {
|
||||
auto world = GameDB::current_world();
|
||||
if(world->has<SpriteEffect>(entity)) {
|
||||
auto& se = world->get<SpriteEffect>(entity);
|
||||
|
||||
if(se.frames > 0) {
|
||||
se.frames--;
|
||||
return se.effect;
|
||||
if(auto se = world->get_if<SpriteEffect>(entity)) {
|
||||
if(se->frames > 0) {
|
||||
se->frames--;
|
||||
return se->effect;
|
||||
} else {
|
||||
world->remove<SpriteEffect>(entity);
|
||||
return nullptr;
|
||||
|
|
@ -597,7 +595,6 @@ void System::render_map(Matrix& tiles, EntityGrid& entity_map, sf::RenderTexture
|
|||
sprite.setPosition({float(point.x * tile_sprite_dim.x), float(point.y * tile_sprite_dim.y)});
|
||||
}
|
||||
|
||||
|
||||
render.draw(sprite);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue