[cppcheck] Part 3: More perf fixes that were missed during non-verbose run for whatev...
authorTobias Markus <tobbi@mozilla-uk.org>
Sun, 23 Nov 2014 20:53:20 +0000 (21:53 +0100)
committerTobias Markus <tobbi@mozilla-uk.org>
Sun, 23 Nov 2014 20:53:20 +0000 (21:53 +0100)
src/scripting/floating_image.cpp
src/worldmap/tux.cpp

index 2264d0d..77fe80b 100644 (file)
 namespace scripting {
 
 FloatingImage::FloatingImage(const std::string& spritefile) :
-  floating_image()
+  floating_image(std::make_shared<_FloatingImage>(spritefile))
 {
   using namespace worldmap;
 
-  floating_image = std::make_shared<_FloatingImage>(spritefile);
   if(Sector::current() != NULL) {
     Sector::current()->add_object(floating_image);
   } else if(WorldMap::current() != NULL) {
index d54c650..2ea454b 100644 (file)
@@ -34,7 +34,7 @@ static const float map_message_TIME = 2.8f;
 Tux::Tux(WorldMap* worldmap_) :
   back_direction(),
   worldmap(worldmap_),
-  sprite(),
+  sprite(SpriteManager::current()->create("images/worldmap/common/tux.sprite")),
   controller(),
   input_direction(),
   direction(),
@@ -43,8 +43,6 @@ Tux::Tux(WorldMap* worldmap_) :
   moving(),
   ghost_mode()
 {
-  sprite = SpriteManager::current()->create("images/worldmap/common/tux.sprite");
-
   offset = 0;
   moving = false;
   direction = D_NONE;