Code cleanup (replaced unnecessary inlines, added missing inlines,
replaced Vec3 parameters with const &). git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@3052 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
cdba286d28
commit
1eb42a9ff6
@ -18,14 +18,15 @@
|
|||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
|
#include "graphics/camera.hpp"
|
||||||
|
|
||||||
#define _WINSOCKAPI_
|
#define _WINSOCKAPI_
|
||||||
#include <plib/ssg.h>
|
#include <plib/ssg.h>
|
||||||
#include "modes/world.hpp"
|
|
||||||
#include "camera.hpp"
|
|
||||||
#include "user_config.hpp"
|
#include "user_config.hpp"
|
||||||
#include "race_manager.hpp"
|
|
||||||
#include "audio/sound_manager.hpp"
|
#include "audio/sound_manager.hpp"
|
||||||
#include "karts/player_kart.hpp"
|
#include "karts/player_kart.hpp"
|
||||||
|
#include "modes/world.hpp"
|
||||||
|
#include "race_manager.hpp"
|
||||||
#include "tracks/track.hpp"
|
#include "tracks/track.hpp"
|
||||||
#include "utils/constants.hpp"
|
#include "utils/constants.hpp"
|
||||||
#include "utils/coord.hpp"
|
#include "utils/coord.hpp"
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include "scene.hpp"
|
#include "scene.hpp"
|
||||||
#include "karts/kart.hpp"
|
#include "karts/kart.hpp"
|
||||||
|
#include "physics/btKart.hpp"
|
||||||
#include "utils/coord.hpp"
|
#include "utils/coord.hpp"
|
||||||
|
|
||||||
float SkidMarks::m_avoid_z_fighting = 0.0f;
|
float SkidMarks::m_avoid_z_fighting = 0.0f;
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#include "smoke.hpp"
|
#include "smoke.hpp"
|
||||||
#include "material_manager.hpp"
|
#include "material_manager.hpp"
|
||||||
#include "karts/kart.hpp"
|
#include "karts/kart.hpp"
|
||||||
|
#include "physics/btKart.hpp"
|
||||||
#include "utils/constants.hpp"
|
#include "utils/constants.hpp"
|
||||||
|
|
||||||
Smoke::Smoke(Kart* kart)
|
Smoke::Smoke(Kart* kart)
|
||||||
|
@ -91,12 +91,8 @@ TrackSel::TrackSel()
|
|||||||
m_current_track = -1;
|
m_current_track = -1;
|
||||||
for(unsigned int i=0; i<m_index_avail_tracks.size(); i++)
|
for(unsigned int i=0; i<m_index_avail_tracks.size(); i++)
|
||||||
{
|
{
|
||||||
assert(i < m_index_avail_tracks.size());
|
// Ignore track groups (which are negative)
|
||||||
//assert( m_index_avail_tracks[i] >= 0);
|
if(m_index_avail_tracks[i]<0) continue;
|
||||||
// FIXME - someone had a crash because m_index_avail_tracks[i] was set to a negative number, e.g. -2
|
|
||||||
// I have no clue what causes this issue, consider this as a temporary fix
|
|
||||||
if(m_index_avail_tracks[i] < 0) continue;
|
|
||||||
|
|
||||||
if(track_manager->getTrack(m_index_avail_tracks[i])->getIdent()==
|
if(track_manager->getTrack(m_index_avail_tracks[i])->getIdent()==
|
||||||
user_config->m_last_track)
|
user_config->m_last_track)
|
||||||
{
|
{
|
||||||
|
@ -69,9 +69,10 @@ Flyable::Flyable(Kart *kart, PowerupType type, float mass) : Moveable()
|
|||||||
scene->add(m);
|
scene->add(m);
|
||||||
} // Flyable
|
} // Flyable
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
void Flyable::createPhysics(float y_offset, const btVector3 velocity,
|
void Flyable::createPhysics(float y_offset, const btVector3 &velocity,
|
||||||
btCollisionShape *shape, const float gravity,
|
btCollisionShape *shape, const float gravity,
|
||||||
const bool rotates, const bool turn_around, const btTransform* customDirection)
|
const bool rotates, const bool turn_around,
|
||||||
|
const btTransform* customDirection)
|
||||||
{
|
{
|
||||||
// Get Kart heading direction
|
// Get Kart heading direction
|
||||||
btTransform trans = ( customDirection == NULL ? m_owner->getKartHeading() : *customDirection );
|
btTransform trans = ( customDirection == NULL ? m_owner->getKartHeading() : *customDirection );
|
||||||
|
@ -86,7 +86,7 @@ protected:
|
|||||||
const bool backwards=false) const;
|
const bool backwards=false) const;
|
||||||
/** init bullet for moving objects like projectiles */
|
/** init bullet for moving objects like projectiles */
|
||||||
void createPhysics(float y_offset,
|
void createPhysics(float y_offset,
|
||||||
const btVector3 velocity,
|
const btVector3 &velocity,
|
||||||
btCollisionShape *shape, const float gravity=0.0f,
|
btCollisionShape *shape, const float gravity=0.0f,
|
||||||
const bool rotates=false, const bool turn_around=false,
|
const bool rotates=false, const bool turn_around=false,
|
||||||
const btTransform* customDirection=NULL);
|
const btTransform* customDirection=NULL);
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
#include "karts/kart_properties_manager.hpp"
|
#include "karts/kart_properties_manager.hpp"
|
||||||
#include "network/race_state.hpp"
|
#include "network/race_state.hpp"
|
||||||
#include "network/network_manager.hpp"
|
#include "network/network_manager.hpp"
|
||||||
|
#include "physics/btKart.hpp"
|
||||||
#include "physics/btUprightConstraint.hpp"
|
#include "physics/btUprightConstraint.hpp"
|
||||||
#include "physics/physics.hpp"
|
#include "physics/physics.hpp"
|
||||||
#include "tracks/track.hpp"
|
#include "tracks/track.hpp"
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
#include "karts/kart_properties.hpp"
|
#include "karts/kart_properties.hpp"
|
||||||
#include "karts/kart_control.hpp"
|
#include "karts/kart_control.hpp"
|
||||||
#include "karts/kart_model.hpp"
|
#include "karts/kart_model.hpp"
|
||||||
#include "physics/btKart.hpp"
|
|
||||||
#include "tracks/terrain_info.hpp"
|
#include "tracks/terrain_info.hpp"
|
||||||
|
|
||||||
class SkidMarks;
|
class SkidMarks;
|
||||||
@ -40,6 +39,8 @@ class Smoke;
|
|||||||
class Nitro;
|
class Nitro;
|
||||||
class SFXBase;
|
class SFXBase;
|
||||||
class btUprightConstraint;
|
class btUprightConstraint;
|
||||||
|
class btKart;
|
||||||
|
class btRaycastVehicle::btVehicleTuning;
|
||||||
|
|
||||||
class Kart : public TerrainInfo, public Moveable
|
class Kart : public TerrainInfo, public Moveable
|
||||||
{
|
{
|
||||||
@ -68,7 +69,8 @@ protected:
|
|||||||
* is disabled to allow the karts to bounce back*/
|
* is disabled to allow the karts to bounce back*/
|
||||||
|
|
||||||
// physics parameters, storing it saves time
|
// physics parameters, storing it saves time
|
||||||
btKart::btVehicleTuning *m_tuning;
|
btRaycastVehicle::btVehicleTuning
|
||||||
|
*m_tuning;
|
||||||
btCompoundShape m_kart_chassis;
|
btCompoundShape m_kart_chassis;
|
||||||
btVehicleRaycaster *m_vehicle_raycaster;
|
btVehicleRaycaster *m_vehicle_raycaster;
|
||||||
btKart *m_vehicle;
|
btKart *m_vehicle;
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include "user_config.hpp"
|
#include "user_config.hpp"
|
||||||
#include "network/race_state.hpp"
|
#include "network/race_state.hpp"
|
||||||
|
#include "physics/btKart.hpp"
|
||||||
#include "physics/btUprightConstraint.hpp"
|
#include "physics/btUprightConstraint.hpp"
|
||||||
#include "tracks/track.hpp"
|
#include "tracks/track.hpp"
|
||||||
#include "utils/ssg_help.hpp"
|
#include "utils/ssg_help.hpp"
|
||||||
|
@ -33,8 +33,8 @@ TriangleMesh::~TriangleMesh()
|
|||||||
} // ~TriangleMesh
|
} // ~TriangleMesh
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
void TriangleMesh::addTriangle(btVector3 t1, btVector3 t2, btVector3 t3,
|
void TriangleMesh::addTriangle(const btVector3 &t1, const btVector3 &t2,
|
||||||
const Material* m)
|
const btVector3 &t3, const Material* m)
|
||||||
{
|
{
|
||||||
m_triangleIndex2Material.push_back(m);
|
m_triangleIndex2Material.push_back(m);
|
||||||
m_mesh.addTriangle(t1, t2, t3);
|
m_mesh.addTriangle(t1, t2, t3);
|
||||||
|
@ -41,8 +41,8 @@ private:
|
|||||||
public:
|
public:
|
||||||
TriangleMesh() : m_mesh() {};
|
TriangleMesh() : m_mesh() {};
|
||||||
~TriangleMesh();
|
~TriangleMesh();
|
||||||
void addTriangle(btVector3 t1, btVector3 t2, btVector3 t3,
|
void addTriangle(const btVector3 &t1, const btVector3 &t2,
|
||||||
const Material* m);
|
const btVector3 &t3, const Material* m);
|
||||||
void createBody(btCollisionObject::CollisionFlags flags=
|
void createBody(btCollisionObject::CollisionFlags flags=
|
||||||
(btCollisionObject::CollisionFlags)0);
|
(btCollisionObject::CollisionFlags)0);
|
||||||
const Material* getMaterial(int n) const {return m_triangleIndex2Material[n];}
|
const Material* getMaterial(int n) const {return m_triangleIndex2Material[n];}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user