React better when missing start positoons on arenas

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@9745 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2011-09-04 23:37:58 +00:00
parent 026e7e67ce
commit 2b2c07d81e

View File

@ -1138,14 +1138,16 @@ void Track::loadTrackModel(World* parent, unsigned int mode_id)
default_start->get("upwards-distance", &upwards_distance );
default_start->get("karts-per-row", &karts_per_row );
}
m_start_transforms.resize(race_manager->getNumberOfKarts());
if(!m_is_arena)
{
m_start_transforms.resize(race_manager->getNumberOfKarts());
QuadGraph::get()->setDefaultStartPositions(&m_start_transforms,
karts_per_row,
forwards_distance,
sidewards_distance,
upwards_distance);
}
loadMainTrack(*root);
unsigned int main_track_count = m_all_nodes.size();
unsigned int start_position_counter = 0;
@ -1193,15 +1195,15 @@ void Track::loadTrackModel(World* parent, unsigned int mode_id)
node->getXYZ(&xyz);
float h=0;
node->get("h", &h);
// It is possible that there are more start positions defined
// than there are karts (and therefore that there are values
// allocated in m_start_transforms. Ignore those:
if(position <(unsigned int)m_start_transforms.size())
if (position >= m_start_transforms.size())
{
m_start_transforms[position].setOrigin(xyz);
m_start_transforms[position].setRotation(
btQuaternion(btVector3(0,1,0),h ) );
m_start_transforms.resize(position + 1);
}
m_start_transforms[position].setOrigin(xyz);
m_start_transforms[position].setRotation(
btQuaternion(btVector3(0,1,0),h ) );
}
else if(name=="camera")
{