[cppcheck] Part 1: Performance
[supertux.git] / src / supertux / info_box.cpp
index 0ba7f38..46c4da9 100644 (file)
 
 InfoBox::InfoBox(const std::string& text) :
   firstline(0),
-  lines(),
+  // Split text string lines into a vector
+  lines(InfoBoxLine::split(text, 400)),
   images(),
   arrow_scrollup(),
   arrow_scrolldown()
 {
-  // Split text string lines into a vector
-  lines = InfoBoxLine::split(text, 400);
-
   try
   {
     // get the arrow sprites
@@ -49,7 +47,7 @@ InfoBox::InfoBox(const std::string& text) :
 InfoBox::~InfoBox()
 {
   for(std::vector<InfoBoxLine*>::iterator i = lines.begin();
-      i != lines.end(); i++)
+      i != lines.end(); ++i)
     delete *i;
 }
 
@@ -79,12 +77,12 @@ InfoBox::draw(DrawingContext& context)
   {
     // draw the scrolling arrows
     if (arrow_scrollup.get() && firstline > 0)
-      context.draw_surface(arrow_scrollup.get(),
+      context.draw_surface(arrow_scrollup,
                            Vector( x1 + width  - arrow_scrollup->get_width(),  // top-right corner of box
                                    y1), LAYER_GUI);
 
     if (arrow_scrolldown.get() && linesLeft && firstline < lines.size()-1)
-      context.draw_surface(arrow_scrolldown.get(),
+      context.draw_surface(arrow_scrolldown,
                            Vector( x1 + width  - arrow_scrolldown->get_width(),  // bottom-light corner of box
                                    y1 + height - arrow_scrolldown->get_height()),
                            LAYER_GUI);