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
This commit is contained in:
hikerstk 2011-09-22 05:46:17 +00:00
parent 18f6f6de17
commit 02a2642be7
2 changed files with 7 additions and 8 deletions

View File

@ -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
// ----------------------------------------------------------------------------

View File

@ -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);