From 7ee4faa9502b88765731b703a056bce284a28f81 Mon Sep 17 00:00:00 2001 From: hikerstk Date: Sun, 12 Sep 2010 23:57:23 +0000 Subject: [PATCH] Fixed incorrect start positions in tracks that don't have checklines defined (removed old, temporary global variable and replaced it with correct variable in class), added a warning message printed to stdout in case that checkline are missing. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5977 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/tracks/track.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/tracks/track.cpp b/src/tracks/track.cpp index 4d17e3f90..e135e3a80 100644 --- a/src/tracks/track.cpp +++ b/src/tracks/track.cpp @@ -57,8 +57,6 @@ using namespace irr; const float Track::NOHIT = -99999.9f; -btTransform global_start; - // ---------------------------------------------------------------------------- Track::Track(std::string filename) { @@ -189,8 +187,8 @@ void Track::setStartCoordinates(const core::line2df& line) end.X - start.X); core::vector2df mid = (start+end)*0.5f; btQuaternion q(Vec3(0, 1, 0), m_start_angle); - global_start.setRotation(q); - global_start.setOrigin(Vec3(mid.X, 0, mid.Y)); + m_start_transform.setRotation(q); + m_start_transform.setOrigin(Vec3(mid.X, 0, mid.Y)); } // setStartCoordinates //----------------------------------------------------------------------------- @@ -217,7 +215,7 @@ btTransform Track::getStartTransform(unsigned int pos) const orig = Vec3( X_DIST * (pos%2==0) ? 1.0f : -1.0f, 1.0f, -Z_DIST*pos-Z_DIST_FROM_START); - orig = global_start(orig); + orig = m_start_transform(orig); angle = m_start_angle; } @@ -934,6 +932,13 @@ void Track::loadTrackModel(World* parent, unsigned int mode_id) if(m_use_fog) for(unsigned int i=0; isetMaterialFlag(video::EMF_FOG_ENABLE, true); + + if(!m_check_manager) + { + printf("WARNING: no check lines found in track '%s'.\n", + m_ident.c_str()); + printf("Lap counting will not work, and start positions might be incorrect.\n"); + } } // loadTrackModel //-----------------------------------------------------------------------------