From 02a2642be75572770429cc77cdbebc6685214659 Mon Sep 17 00:00:00 2001 From: hikerstk Date: Thu, 22 Sep 2011 05:46:17 +0000 Subject: [PATCH] Removed unnecessary static variable, made the target a moveable instead of kart (which in future would allow us to make the cake aim e.g. at other flyables). git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@9883 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/items/cake.cpp | 8 +++----- src/items/cake.hpp | 7 ++++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/items/cake.cpp b/src/items/cake.cpp index e5a166794..7f92cc618 100644 --- a/src/items/cake.cpp +++ b/src/items/cake.cpp @@ -26,7 +26,6 @@ #include "karts/kart.hpp" #include "utils/constants.hpp" -float Cake::m_st_max_distance; float Cake::m_st_max_distance_squared; float Cake::m_gravity; @@ -124,14 +123,13 @@ Cake::Cake (Kart *kart) : Flyable(kart, PowerupManager::POWERUP_CAKE) void Cake::init(const XMLNode &node, scene::IMesh *cake_model) { Flyable::init(node, cake_model, PowerupManager::POWERUP_CAKE); - m_st_max_distance = 80.0f; - m_st_max_distance_squared = 80.0f * 80.0f; + float max_distance = 80.0f; m_gravity = 9.8f; if (m_gravity < 0) m_gravity *= -1.0f; - node.get("max-distance", &m_st_max_distance ); - m_st_max_distance_squared = m_st_max_distance*m_st_max_distance; + node.get("max-distance", &max_distance ); + m_st_max_distance_squared = max_distance*max_distance; } // init // ---------------------------------------------------------------------------- diff --git a/src/items/cake.hpp b/src/items/cake.hpp index 8b9652e3f..f810ef024 100644 --- a/src/items/cake.hpp +++ b/src/items/cake.hpp @@ -39,13 +39,14 @@ class XMLNode; class Cake : public Flyable { private: - static float m_st_max_distance; // maximum distance for a missile to be attracted + /** Maximum distance for a missile to be attracted. */ static float m_st_max_distance_squared; static float m_gravity; btVector3 m_initial_velocity; - Kart* m_target; // which kart is targeted by this - // projectile (NULL if none) + + /** Which kart is targeted by this projectile (NULL if none). */ + Moveable* m_target; public: Cake (Kart *kart); static void init (const XMLNode &node, scene::IMesh *cake_model);