Merge branch 'konstin-lapnumber'

This commit is contained in:
hiker 2014-07-24 17:44:26 +10:00
commit 2f71c5f99f
7 changed files with 153 additions and 164 deletions

View File

@ -211,7 +211,7 @@ private:
float m_nitro_small_container;
/** Nitro amount for big bittle. */
float m_nitro_big_container;
/* How much the speed of a kart might exceed its maximum speed (in m/s). */
/** How much the speed of a kart might exceed its maximum speed (in m/s). */
float m_nitro_max_speed_increase;
/** Additional engine force to affect the kart. */
float m_nitro_engine_force;

View File

@ -111,14 +111,15 @@ void GrandPrixData::changeTrackNumber(const unsigned int number_of_tracks,
rand() % available_tracks :
track_indices[rand() % available_tracks];
std::string id = track_manager->getTrack(index)->getIdent();
const Track *track = track_manager->getTrack(index);
std::string id = track->getIdent();
// Avoid duplicate tracks
if (std::find(m_tracks.begin(), m_tracks.end(), id) != m_tracks.end())
continue;
m_tracks.push_back(id);
m_laps.push_back(3); // TODO: Take the default number from the track
m_reversed.push_back(false); // This will be changed later
m_laps.push_back(track->getDefaultNumberOfLaps());
m_reversed.push_back(false); // This will be changed later in the code
}
}
else if (m_tracks.size() > number_of_tracks)

View File

@ -33,7 +33,6 @@ using irr::gui::IGUIStaticText;
typedef GUIEngine::SpinnerWidget Spinner;
RandomGPInfoDialog::RandomGPInfoDialog()
{
// Defaults - loading selection from last time frrom a file would be better
m_number_of_tracks = 2; // We can assume that there are at least 2 standard tracks
@ -87,15 +86,11 @@ void RandomGPInfoDialog::addSpinners()
int index_standard;
const std::vector<std::string>& groups = track_manager->getAllTrackGroups();
for (unsigned int i = 0; i < groups.size(); i++)
{
// FIXME: The NULL check is necessary until #1348 on github is fixed
if (groups[i].c_str() != NULL)
{
spinner->addLabel(stringw(groups[i].c_str()));
if(groups[i] == "standard")
index_standard = i+1;
}
}
// The value can only be set here because SpinnerWidget resets the value
// every time a label is added
spinner->setValue(index_standard);

View File

@ -88,9 +88,7 @@ TrackInfoDialog::TrackInfoDialog(const std::string& ribbonItem, const std::strin
screenshotWidget->add();
if (screenshot != NULL)
{
screenshotWidget->setImage(screenshot);
}
m_widgets.push_back(screenshotWidget);
@ -98,21 +96,11 @@ TrackInfoDialog::TrackInfoDialog(const std::string& ribbonItem, const std::strin
if (has_laps)
{
m_spinner = getWidget<SpinnerWidget>("lapcountspinner");
m_spinner->m_properties[PROP_ID] = "lapcountspinner";
if (UserConfigParams::m_artist_debug_mode)
{
m_spinner->setMin(0);
}
//I18N: In the track setup screen (number of laps choice, where %i is the number)
//m_spinner->setText( _("%i laps") );
m_spinner->setValue( UserConfigParams::m_num_laps );
//m_spinner->getIrrlichtElement()->setTabStop(true);
//m_spinner->getIrrlichtElement()->setTabGroup(false);
const int num_laps = m_spinner->getValue();
race_manager->setNumLaps(num_laps);
m_spinner->setValue(track->getDefaultNumberOfLaps());
race_manager->setNumLaps(m_spinner->getValue());
}
else
{
@ -149,7 +137,6 @@ TrackInfoDialog::TrackInfoDialog(const std::string& ribbonItem, const std::strin
m_highscore_entries[2] = getWidget<LabelWidget>("highscore3");
updateHighScores();
}
else
{

View File

@ -135,6 +135,7 @@ Track::Track(const std::string &filename)
m_ident=="overworld";
m_minimap_x_scale = 1.0f;
m_minimap_y_scale = 1.0f;
m_default_number_of_laps= 3;
m_all_nodes.clear();
m_all_physics_only_nodes.clear();
m_all_cached_meshes.clear();
@ -471,6 +472,7 @@ void Track::loadTrackInfo()
root->get("groups", &m_groups);
root->get("internal", &m_internal);
root->get("reverse", &m_reverse_available);
root->get("default-number-of-laps",&m_default_number_of_laps);
root->get("push-back", &m_enable_push_back);
root->get("clouds", &m_clouds);
root->get("bloom", &m_bloom);

View File

@ -398,6 +398,9 @@ private:
/** List of all bezier curves in the track - for e.g. camera, ... */
std::vector<BezierCurve*> m_all_curves;
/** The number of laps the track will be raced if no other value is given.*/
int m_default_number_of_laps;
void loadTrackInfo();
void loadQuadGraph(unsigned int mode_id, const bool reverse);
void convertTrackToBullet(scene::ISceneNode *node);
@ -612,6 +615,7 @@ public:
float getDisplacementSpeed() const { return m_displacement_speed; }
float getCausticsSpeed() const { return m_caustics_speed; }
const int getDefaultNumberOfLaps() const { return m_default_number_of_laps;}
bool operator<(const Track &other) const;
}; // class Track