Bunch of small code cleanup

This commit is contained in:
Marianne Gagnon
2014-01-25 21:05:00 -05:00
parent 4355c6450e
commit 3d054ea91b
10 changed files with 23 additions and 31 deletions

View File

@@ -164,12 +164,16 @@ ParticleKind::ParticleKind(const std::string file) : m_min_start_color(255,255,2
{
size->get("min", &m_min_size);
size->get("max", &m_max_size);
bool has_x = size->get("x-increase-factor", &m_scale_affector_factor_x) == 1;
bool has_y = size->get("y-increase-factor", &m_scale_affector_factor_y) == 1;
m_has_scale_affector = (has_x || has_y);
}
bool has_x = size->get("x-increase-factor", &m_scale_affector_factor_x)==1;
bool has_y = size->get("y-increase-factor", &m_scale_affector_factor_y)==1;
m_has_scale_affector = (has_x || has_y);
else
{
m_has_scale_affector = false;
}
//std::cout << "m_particle_size = " << m_particle_size << "\n";
//std::cout << "m_min_size = " << m_min_size << "\n";
//std::cout << "m_max_size = " << m_max_size << "\n";

View File

@@ -115,7 +115,7 @@ void ShowCurve::addPoint(const Vec3 &pnt)
// 4 sides of the 'tunnel', so all in all 24 indices.
irr::u16 *indices = new irr::u16[24];
m_buffer->append(vertices, 4, indices, 24);
delete indices;
delete[] indices;
indices = m_buffer->getIndices();
// index = first newly added index

View File

@@ -42,6 +42,7 @@ ListWidget::ListWidget() : Widget(WTYPE_LIST)
m_selected_column = NULL;
m_sort_desc = false;
m_sort_default = true;
m_sort_col = 0;
}
// -----------------------------------------------------------------------------

View File

@@ -79,7 +79,7 @@ struct Input
Input()
: m_type(IT_NONE), m_device_id(0), m_button_id(0),
m_axis_direction(0), m_character(0)
m_axis_direction(0), m_character(0), m_axis_range(Input::AR_FULL)
{
// Nothing to do.
}
@@ -109,7 +109,7 @@ struct Input
*/
Input(InputType ntype, int deviceID , int btnID = 0, int axisDirection= 0)
: m_type(ntype), m_device_id(deviceID), m_button_id(btnID),
m_axis_direction(axisDirection)
m_axis_direction(axisDirection), m_axis_range(Input::AR_FULL)
{
// Nothing to do.
}

View File

@@ -258,24 +258,16 @@ bool GamePadDevice::processAndMapInput(Input::InputType type, const int id,
if (!m_axis_ok[id]) return false;
}
if (m_configuration != NULL)
if (mode == InputManager::INGAME)
{
if (mode == InputManager::INGAME)
{
success = m_configuration->getGameAction(type, id, value, action);
}
else if (abs(*value) > Input::MAX_VALUE/2)
{
// bindings can only be accessed in game and menu modes
assert(mode == InputManager::MENU);
success = m_configuration->getMenuAction(type, id, value, action);
}
success = m_configuration->getGameAction(type, id, value, action);
}
else
else if (abs(*value) > Input::MAX_VALUE/2)
{
fprintf(stderr, "processAndMapInput() called on improperly "
"initialized GamePadDevice\n");
abort();
// bindings can only be accessed in game and menu modes
assert(mode == InputManager::MENU);
success = m_configuration->getMenuAction(type, id, value, action);
}
return success;

View File

@@ -53,6 +53,7 @@ Attachment::Attachment(AbstractKart* kart)
m_bomb_sound = NULL;
m_bubble_explode_sound = NULL;
m_node_scale = 1.0f;
m_initial_speed = 0.0f;
// If we attach a NULL mesh, we get a NULL scene node back. So we
// have to attach some kind of mesh, but make it invisible.

View File

@@ -46,10 +46,6 @@ class Flyable : public Moveable, public TerrainInfo
public:
private:
bool m_has_hit_something;
/** This flag is used to avoid that a rocket explodes mode than once.
* It can happen that more than one collision between a rocket and
* a track or kart is reported by the physics. */
bool m_exploded;
/** If this flag is set, the up velocity of the kart will not be
* adjusted in case that the objects is too high or too low above the

View File

@@ -187,9 +187,6 @@ private:
/** A 'ping' sound effect to be played when the ball hits the ground. */
SFXBase *m_ping_sfx;
/** Sound effect to be played when a ball hits a kart. */
SFXBase *m_hit_sfx;
void computeTarget();
void updateDistanceToTarget();
unsigned int getSuccessorToHitTarget(unsigned int node_index,

View File

@@ -42,8 +42,7 @@ private:
RB_TO_KART, /**< Rubber band is attached to a kart hit. */
RB_TO_TRACK} /**< Rubber band is attached to track. */
m_attached_state;
/** True if plunger was fired backwards. */
bool m_is_backward;
/** If rubber band is attached to track, the coordinates. */
Vec3 m_hit_position;
/** The plunger the rubber band is attached to. */

View File

@@ -41,6 +41,8 @@ TerrainInfo::TerrainInfo()
TerrainInfo::TerrainInfo(const Vec3 &pos)
{
// initialise HoT
m_last_material = NULL;
m_material = NULL;
update(pos);
} // TerrainInfo
//-----------------------------------------------------------------------------