From f6a37b5e99e7b6cc1c020adf7d255137f118fb35 Mon Sep 17 00:00:00 2001 From: hiker Date: Tue, 28 Jun 2016 17:29:32 +1000 Subject: [PATCH] Simplified Stars constructor, removed unnecessary #include from kart.cpp. --- src/graphics/stars.cpp | 16 +++++++++++----- src/graphics/stars.hpp | 7 +++++-- src/karts/kart.cpp | 9 +-------- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/graphics/stars.cpp b/src/graphics/stars.cpp index e28095e4b..56f713d8d 100644 --- a/src/graphics/stars.cpp +++ b/src/graphics/stars.cpp @@ -18,36 +18,42 @@ #include "graphics/stars.hpp" -#include #include "graphics/irr_driver.hpp" #include "graphics/material.hpp" #include "graphics/material_manager.hpp" +#include "karts/abstract_kart.hpp" +#include "karts/kart_model.hpp" #include "utils/constants.hpp" #include #include +#include + const int STAR_AMOUNT = 7; const float RADIUS = 0.7f; const float STAR_SIZE = 0.4f; -Stars::Stars(scene::ISceneNode* parentKart, core::vector3df center) +Stars::Stars(AbstractKart *kart) { - m_parent_kart_node = parentKart; + m_parent_kart_node = kart->getNode(); m_enabled = false; video::ITexture* texture = irr_driver->getTexture("starparticle.png"); Material* star_material = material_manager->getMaterial("starparticle.png"); - m_center = center; + m_center = core::vector3df(0.0f, + kart->getKartModel()->getModel() + ->getBoundingBox().MaxEdge.Y, + 0.0f ); for (int n=0; naddBillboard(core::dimension2df(STAR_SIZE, STAR_SIZE), - texture, parentKart); + texture, kart->getNode()); #ifdef DEBUG billboard->setName("star"); #endif diff --git a/src/graphics/stars.hpp b/src/graphics/stars.hpp index 89cd33a2f..5e0ec70cc 100644 --- a/src/graphics/stars.hpp +++ b/src/graphics/stars.hpp @@ -21,9 +21,12 @@ #include "utils/no_copy.hpp" +#include "vector3d.h" + #include -#include +class AbstractKart; + namespace irr { namespace scene { class ISceneNode; } @@ -54,7 +57,7 @@ private: float m_remaining_time; public: - Stars (scene::ISceneNode* parentKart, core::vector3df center); + Stars (AbstractKart *kart); ~Stars (); void showFor(float time); void reset(); diff --git a/src/karts/kart.cpp b/src/karts/kart.cpp index 79fc46911..3776933b5 100644 --- a/src/karts/kart.cpp +++ b/src/karts/kart.cpp @@ -38,8 +38,6 @@ #include "graphics/stk_text_billboard.hpp" #include "graphics/stars.hpp" #include "guiengine/scalable_font.hpp" -#include "karts/abstract_characteristic.hpp" -#include "karts/cached_characteristic.hpp" #include "karts/explosion_animation.hpp" #include "karts/kart_gfx.hpp" #include "karts/rescue_animation.hpp" @@ -215,12 +213,7 @@ void Kart::init(RaceManager::KartType type) m_kart_gfx = new KartGFX(this); m_skidding = new Skidding(this); // Create the stars effect - m_stars_effect = - new Stars(getNode(), - core::vector3df(0.0f, - getKartModel()->getModel() - ->getBoundingBox().MaxEdge.Y, - 0.0f) ); + m_stars_effect = new Stars(this); reset(); } // init