X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fbadguy%2Fmrtree.cpp;h=500bd30ecf84ac3ba87af862440a9f6d7d22104d;hb=7e413dc6f0aa8315b97b1b433e38613308e1ccbd;hp=74c46a5675fb0fdeb4e4ef33d20a75e92b6e8c03;hpb=4e70d578de5d05a2bbc945f1d3853db758161f8f;p=supertux.git diff --git a/src/badguy/mrtree.cpp b/src/badguy/mrtree.cpp index 74c46a567..500bd30ec 100644 --- a/src/badguy/mrtree.cpp +++ b/src/badguy/mrtree.cpp @@ -54,7 +54,7 @@ MrTree::collision_squished(GameObject& object) Vector stumpy_pos = get_pos(); stumpy_pos.x += 20; stumpy_pos.y += 25; - Stumpy* stumpy = new Stumpy(stumpy_pos, dir); + auto stumpy = std::make_shared(stumpy_pos, dir); remove_me(); Sector::current()->add_object(stumpy); @@ -73,14 +73,18 @@ MrTree::collision_squished(GameObject& object) float vy = -cos(angle)*velocity; Vector pspeed = Vector(vx, vy); Vector paccel = Vector(0, 100); - Sector::current()->add_object(new SpriteParticle("images/objects/particles/leaf.sprite", "default", ppos, ANCHOR_MIDDLE, pspeed, paccel, LAYER_OBJECTS-1)); + Sector::current()->add_object(std::make_shared("images/objects/particles/leaf.sprite", + "default", + ppos, ANCHOR_MIDDLE, + pspeed, paccel, + LAYER_OBJECTS-1)); } // spawn PoisonIvy Vector leaf1_pos(stumpy_pos.x - POISONIVY_WIDTH - 1, stumpy_pos.y - POISONIVY_Y_OFFSET); Rectf leaf1_bbox(leaf1_pos.x, leaf1_pos.y, leaf1_pos.x + POISONIVY_WIDTH, leaf1_pos.y + POISONIVY_HEIGHT); if (Sector::current()->is_free_of_movingstatics(leaf1_bbox, this)) { - PoisonIvy* leaf1 = new PoisonIvy(leaf1_bbox.p1, LEFT); + auto leaf1 = std::make_shared(leaf1_bbox.p1, LEFT); leaf1->countMe = false; Sector::current()->add_object(leaf1); } @@ -89,7 +93,7 @@ MrTree::collision_squished(GameObject& object) Vector leaf2_pos(stumpy_pos.x + sprite->get_current_hitbox_width() + 1, stumpy_pos.y - POISONIVY_Y_OFFSET); Rectf leaf2_bbox(leaf2_pos.x, leaf2_pos.y, leaf2_pos.x + POISONIVY_WIDTH, leaf2_pos.y + POISONIVY_HEIGHT); if (Sector::current()->is_free_of_movingstatics(leaf2_bbox, this)) { - PoisonIvy* leaf2 = new PoisonIvy(leaf2_bbox.p1, RIGHT); + auto leaf2 = std::make_shared(leaf2_bbox.p1, RIGHT); leaf2->countMe = false; Sector::current()->add_object(leaf2); }