Removed broken chain() function
authorChristoph Sommer <mail@christoph-sommer.de>
Fri, 7 Jul 2006 13:32:28 +0000 (13:32 +0000)
committerChristoph Sommer <mail@christoph-sommer.de>
Fri, 7 Jul 2006 13:32:28 +0000 (13:32 +0000)
SVN-Revision: 3931

src/game_session.cpp
src/statistics.cpp

index 1159d2c..fe24f25 100644 (file)
@@ -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"))
index 652da58..aa21538 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <assert.h>
 #include <math.h>
+#include <sstream>
 #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)