Started implementing the 'max number of karts' track parameter as per the todo ticket in the tracker. The count is read but not yet enforced. The values I added in the track files are very approximative and not tested. Ideally the track exporter should generate this field
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5728 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
@@ -81,6 +81,7 @@ Track::Track(std::string filename)
|
||||
m_start_angle = 0;
|
||||
m_sky_dx = 0.05f;
|
||||
m_sky_dy = 0.0f;
|
||||
m_max_kart_count = 8;
|
||||
m_start_transform.setIdentity();
|
||||
loadTrackInfo();
|
||||
} // Track
|
||||
@@ -265,6 +266,9 @@ void Track::loadTrackInfo()
|
||||
root->get("gravity", &m_gravity);
|
||||
root->get("arena", &m_is_arena);
|
||||
root->get("groups", &m_groups);
|
||||
|
||||
root->get("maxKartCount", &m_max_kart_count);
|
||||
|
||||
for(unsigned int i=0; i<root->getNumNodes(); i++)
|
||||
{
|
||||
const XMLNode *mode=root->getNode(i);
|
||||
|
||||
@@ -155,6 +155,9 @@ private:
|
||||
/** List of all modes for a track. */
|
||||
std::vector<TrackMode> m_all_modes;
|
||||
|
||||
/** Maximum number of karts that this track can sustain without them starting off-track */
|
||||
int m_max_kart_count;
|
||||
|
||||
/** Name of the track to display. */
|
||||
irr::core::stringw m_name;
|
||||
bool m_use_fog;
|
||||
@@ -294,6 +297,10 @@ public:
|
||||
const Vec3 &getStartPosition(unsigned int i) {return m_start_positions[i];}
|
||||
/** Returns the heading of the i-th. start position. */
|
||||
const float getStartHeading(unsigned int i) {return m_start_heading[i]; }
|
||||
|
||||
/** \return the maximum number of karts that this track can sustain without them starting off-track */
|
||||
int getMaxKartCount() const { return m_max_kart_count; }
|
||||
|
||||
}; // class Track
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user