From b355dd0f7b2f2c741ae25d46363c9fd570c496f7 Mon Sep 17 00:00:00 2001 From: LMH Date: Thu, 5 Sep 2013 15:38:43 -1000 Subject: [PATCH] Hide stats on levels that have none --- src/supertux/game_session.cpp | 3 ++- src/supertux/statistics.cpp | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/supertux/game_session.cpp b/src/supertux/game_session.cpp index f14138ce2..c338d1680 100644 --- a/src/supertux/game_session.cpp +++ b/src/supertux/game_session.cpp @@ -421,7 +421,8 @@ GameSession::setup() while(SDL_PollEvent(&event)) {} - if (!levelintro_shown) { + int total_stats_to_be_collected = level->stats.total_coins + level->stats.total_badguys + level->stats.total_secrets; + if ((!levelintro_shown) && (total_stats_to_be_collected > 0)) { levelintro_shown = true; g_screen_manager->push_screen(new LevelIntro(level.get(), best_level_statistics)); } diff --git a/src/supertux/statistics.cpp b/src/supertux/statistics.cpp index da9ffb157..0dd695d4c 100644 --- a/src/supertux/statistics.cpp +++ b/src/supertux/statistics.cpp @@ -103,6 +103,9 @@ Statistics::draw_worldmap_info(DrawingContext& context) // skip draw if stats were declared invalid if (!valid) return; + // no sense drawing stats if there are none + if (total_coins + total_badguys + total_secrets == 0) return; + // check to see if screen size has been changed if (!(WMAP_INFO_TOP_Y1 == SCREEN_HEIGHT - 100)) { WMAP_INFO_LEFT_X = SCREEN_WIDTH - 32 - 256; @@ -158,6 +161,9 @@ Statistics::draw_endseq_panel(DrawingContext& context, Statistics* best_stats, S // abort if we have no backdrop if (!backdrop) return; + // no sense drawing stats if there are none + if (total_coins + total_badguys + total_secrets == 0) return; + int box_w = 220+110+110; int box_h = 30+20+20+20; int box_x = (int)((SCREEN_WIDTH - box_w) / 2); -- 2.11.0