From: LMH Date: Sat, 7 Sep 2013 01:06:39 +0000 (-1000) Subject: Worldmap stats report level target time X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=5264ec041d99a8652709f12edc65d3f73eb92ac2;p=supertux.git Worldmap stats report level target time --- diff --git a/src/supertux/statistics.cpp b/src/supertux/statistics.cpp index 975880acc..22dbace62 100644 --- a/src/supertux/statistics.cpp +++ b/src/supertux/statistics.cpp @@ -95,7 +95,7 @@ Statistics::unserialize_from_squirrel(HSQUIRRELVM vm) } void -Statistics::draw_worldmap_info(DrawingContext& context) +Statistics::draw_worldmap_info(DrawingContext& context, float target_time) { // skip draw if level was never played if (coins == nv_coins) return; @@ -121,7 +121,7 @@ Statistics::draw_worldmap_info(DrawingContext& context) std::string caption_buf; std::string stat_buf; float posy = WMAP_INFO_TOP_Y2; - for (int stat_no = 0; stat_no < 4; stat_no++) { + for (int stat_no = 0; stat_no < 5; stat_no++) { switch (stat_no) { case 0: @@ -133,13 +133,21 @@ Statistics::draw_worldmap_info(DrawingContext& context) stat_buf = frags_to_string(badguys, total_badguys); break; case 2: - caption_buf = _("Min time needed:"); - stat_buf = time_to_string(time); - break; - case 3: caption_buf = _("Max secrets found:"); stat_buf = secrets_to_string(secrets, total_secrets); break; + case 3: + caption_buf = _("Best time completed:"); + stat_buf = time_to_string(time); + break; + case 4: + if(target_time){ // display target time only if defined for level + caption_buf = _("Level target time:"); + stat_buf = time_to_string(target_time); + } else { + caption_buf = ""; + stat_buf = ""; + } default: log_debug << "Invalid stat requested to be drawn" << std::endl; break; diff --git a/src/supertux/statistics.hpp b/src/supertux/statistics.hpp index e11c39d0d..37a7710a4 100644 --- a/src/supertux/statistics.hpp +++ b/src/supertux/statistics.hpp @@ -58,7 +58,7 @@ public: */ void unserialize_from_squirrel(HSQUIRRELVM vm); - void draw_worldmap_info(DrawingContext& context); /**< draw worldmap stat HUD */ + void draw_worldmap_info(DrawingContext& context, float target_time); /**< draw worldmap stat HUD */ void draw_endseq_panel(DrawingContext& context, Statistics* best_stats, SurfacePtr backdrop); /**< draw panel shown during level's end sequence */ void zero(); /**< Set stats to zero */ diff --git a/src/worldmap/worldmap.cpp b/src/worldmap/worldmap.cpp index 31d631cf3..09bb8b540 100644 --- a/src/worldmap/worldmap.cpp +++ b/src/worldmap/worldmap.cpp @@ -858,7 +858,8 @@ WorldMap::draw_status(DrawingContext& context) } */ - level->statistics.draw_worldmap_info(context); + get_level_target_time(*level); + level->statistics.draw_worldmap_info(context, level->target_time); break; } }