Skip to content

Commit

Permalink
Shorten code
Browse files Browse the repository at this point in the history
  • Loading branch information
tobbi committed Aug 13, 2023
1 parent 082f9e5 commit 6c5d7b3
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/object/moving_sprite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,9 @@ MovingSprite::MovingSprite(const ReaderMapping& reader, const std::string& sprit
reader.get("y", m_col.m_bbox.get_top());
m_sprite_found = reader.get("sprite", m_sprite_name);

//Make the sprite go default when the sprite file is invalid
if (m_sprite_name.empty() || !PHYSFS_exists(m_sprite_name.c_str()))
{
change_sprite(m_default_sprite_name);
m_sprite_found = false;
}
else if (!change_sprite(m_sprite_name)) // If sprite change fails, change back to default.
//Make the sprite go default when the sprite file is invalid or sprite change fails
if (m_sprite_name.empty() || !PHYSFS_exists(m_sprite_name.c_str()) ||
!change_sprite(m_sprite_name))
{
change_sprite(m_default_sprite_name);
m_sprite_found = false;
Expand Down

0 comments on commit 6c5d7b3

Please sign in to comment.