Skip to content

Commit

Permalink
Fixing a few cppcheck warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
tobbi committed Mar 1, 2015
1 parent b747e52 commit 394aff4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/addon/addon_manager.cpp
Expand Up @@ -48,7 +48,6 @@ MD5 md5_from_file(const std::string& filename)

MD5 md5;

unsigned char buffer[1024];
PHYSFS_file* file = PHYSFS_openRead(filename.c_str());
if (!file)
{
Expand All @@ -60,6 +59,7 @@ MD5 md5_from_file(const std::string& filename)
{
while (true)
{
unsigned char buffer[1024];
PHYSFS_sint64 len = PHYSFS_read(file, buffer, 1, sizeof(buffer));
if (len <= 0) break;
md5.update(buffer, len);
Expand Down
18 changes: 10 additions & 8 deletions src/supertux/player_status.cpp
Expand Up @@ -67,15 +67,17 @@ void PlayerStatus::reset()
void
PlayerStatus::add_coins(int count, bool play_sound)
{
static float sound_played_time = 0;
coins = std::min(coins + count, MAX_COINS);
if(play_sound) {
if(count >= 100)
SoundManager::current()->play("sounds/lifeup.wav");
else if (real_time > sound_played_time + 0.010) {
SoundManager::current()->play("sounds/coin.wav");
sound_played_time = real_time;
}

if(!play_sound)
return;

static float sound_played_time = 0;
if(count >= 100)
SoundManager::current()->play("sounds/lifeup.wav");
else if (real_time > sound_played_time + 0.010) {
SoundManager::current()->play("sounds/coin.wav");
sound_played_time = real_time;
}
}

Expand Down

0 comments on commit 394aff4

Please sign in to comment.