More use of SurfacePtr
[supertux.git] / src / object / candle.cpp
index e2899cb..d428745 100644 (file)
@@ -25,8 +25,8 @@
 
 Candle::Candle(const Reader& lisp)
   : MovingSprite(lisp, "images/objects/candle/candle.sprite", LAYER_BACKGROUNDTILES+1, COLGROUP_DISABLED), burning(true),
-    candle_light_1("images/objects/candle/candle-light-1.png"),
-    candle_light_2("images/objects/candle/candle-light-2.png")
+    candle_light_1(Surface::create("images/objects/candle/candle-light-1.png")),
+    candle_light_2(Surface::create("images/objects/candle/candle-light-2.png"))
 {
   lisp.get("name", name);
   lisp.get("burning", burning);
@@ -47,14 +47,14 @@ Candle::draw(DrawingContext& context)
 
   // draw on lightmap
   if (burning) {
-    Vector pos = get_pos() + (bbox.get_size() - candle_light_1.get_size()) / 2;
+    Vector pos = get_pos() + (bbox.get_size() - candle_light_1->get_size()) / 2;
     context.push_target();
     context.set_target(DrawingContext::LIGHTMAP);
     // draw approx. 1 in 10 frames darker. Makes the candle flicker
     if (systemRandom.rand(10) != 0) {
-      context.draw_surface(&candle_light_1, pos, layer);
+      context.draw_surface(candle_light_1, pos, layer);
     } else {
-      context.draw_surface(&candle_light_2, pos, layer);
+      context.draw_surface(candle_light_2, pos, layer);
     }
     context.pop_target();
   }