From: Christoph Sommer Date: Fri, 7 Jul 2006 13:32:28 +0000 (+0000) Subject: Removed broken chain() function X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=033c0951d4cb82136300de80b2185085369936fb;p=supertux.git Removed broken chain() function SVN-Revision: 3931 --- diff --git a/src/game_session.cpp b/src/game_session.cpp index 1159d2ce4..fe24f2596 100644 --- a/src/game_session.cpp +++ b/src/game_session.cpp @@ -229,20 +229,9 @@ GameSession::play_demo(const std::string& filename) playback_demo_stream->seekg(0); // old style w/o seed, restart at beg } -namespace { - inline const char* chain(const char* c1, const char* c2) { - return (std::string(c1) + std::string(c2)).c_str(); - } - inline const char* chain(const char* c1, const char* c2, const char* c3) { - return (std::string(c1) + std::string(c2) + std::string(c3)).c_str(); - } -} - void GameSession::levelintro() { - char str[60]; - sound_manager->stop_music(); DrawingContext context; @@ -263,8 +252,9 @@ GameSession::levelintro() context.draw_center_text(gold_text, level->get_name(), Vector(0, 160), LAYER_FOREGROUND1); - snprintf(str, sizeof(str), chain(_("Coins"), ": %d"), player_status->coins); - context.draw_text(white_text, str, Vector(SCREEN_WIDTH/2, 210), + std::stringstream ss_coins; + ss_coins << _("Coins") << ": " << player_status->coins; + context.draw_text(white_text, ss_coins.str(), Vector(SCREEN_WIDTH/2, 210), CENTER_ALLIGN, LAYER_FOREGROUND1); if((level->get_author().size()) && (level->get_author() != "SuperTux Team")) diff --git a/src/statistics.cpp b/src/statistics.cpp index 652da58ed..aa215389c 100644 --- a/src/statistics.cpp +++ b/src/statistics.cpp @@ -22,6 +22,7 @@ #include #include +#include #include "video/drawing_context.hpp" #include "gettext.hpp" #include "lisp/lisp.hpp" @@ -80,15 +81,6 @@ const float WMAP_INFO_RIGHT_X = 800 - 32; const float WMAP_INFO_TOP_Y1 = 600 - 128 - 16; const float WMAP_INFO_TOP_Y2 = 600 - 128; -namespace { - inline const char* chain(const char* c1, const char* c2) { - return (std::string(c1) + std::string(c2)).c_str(); - } - inline const char* chain(const char* c1, const char* c2, const char* c3) { - return (std::string(c1) + std::string(c2) + std::string(c3)).c_str(); - } -} - void Statistics::draw_worldmap_info(DrawingContext& context) { @@ -98,7 +90,7 @@ Statistics::draw_worldmap_info(DrawingContext& context) // skip draw if stats were declared invalid if (!valid) return; - context.draw_text(white_small_text, ::chain("- ", _("Best Level Statistics"), " -"), Vector((WMAP_INFO_LEFT_X + WMAP_INFO_RIGHT_X) / 2, WMAP_INFO_TOP_Y1), CENTER_ALLIGN, LAYER_GUI); + context.draw_text(white_small_text, std::string("- ") + _("Best Level Statistics") + " -", Vector((WMAP_INFO_LEFT_X + WMAP_INFO_RIGHT_X) / 2, WMAP_INFO_TOP_Y1), CENTER_ALLIGN, LAYER_GUI); float alpha; if(timer.get_timegone() < FADING_TIME)