Fixed various float vs double compiler warnings.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11649 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk
2012-09-30 23:28:09 +00:00
parent 7f53006f2b
commit 72d856dc03
3 changed files with 14 additions and 12 deletions

View File

@@ -138,7 +138,8 @@ void CutsceneWorld::init()
if (dynamic_cast<AnimationBase*>(curr) != NULL)
{
m_duration = std::max(m_duration, dynamic_cast<AnimationBase*>(curr)->getAnimationDuration());
m_duration = std::max(m_duration,
(double)dynamic_cast<AnimationBase*>(curr)->getAnimationDuration());
}
}
@@ -176,7 +177,7 @@ const std::string& CutsceneWorld::getIdent() const
/** Update the world and the track.
* \param dt Time step size.
*/
void CutsceneWorld::update(float dt)
void CutsceneWorld::update(double dt)
{
/*
{
@@ -232,18 +233,19 @@ void CutsceneWorld::update(float dt)
if (m_time < 2.0f)
{
dynamic_cast<CutsceneGUI*>(m_race_gui)->setFadeLevel(1.0f - m_time / 2.0f);
dynamic_cast<CutsceneGUI*>(m_race_gui)->setFadeLevel(1.0f - (float)m_time / 2.0f);
}
else if (m_time > m_duration - 2.0f)
{
dynamic_cast<CutsceneGUI*>(m_race_gui)->setFadeLevel((m_time - (m_duration - 2.0f)) / 2.0f);
dynamic_cast<CutsceneGUI*>(m_race_gui)->setFadeLevel((float)(m_time - (m_duration - 2.0f)) / 2.0f);
}
else
{
dynamic_cast<CutsceneGUI*>(m_race_gui)->setFadeLevel(0.0f);
}
float currFrame = m_time*25.0f - 1.0f; // We assume 25 FPS. Irrlicht starts at frame 0.
// We assume 25 FPS. Irrlicht starts at frame 0.
float currFrame = (float)(m_time*25.0f - 1.0f);
//printf("Estimated current frame : %f\n", currFrame);
@@ -265,8 +267,8 @@ void CutsceneWorld::update(float dt)
}
World::update(dt);
World::updateTrack(dt);
World::update((float)dt);
World::updateTrack((float)dt);
PtrVector<TrackObject>& objects = m_track->getTrackObjectManager()->getObjects();
TrackObject* curr;

View File

@@ -42,14 +42,14 @@ class CutsceneWorld : public World
std::map<float, std::vector<TrackObject*> > m_sounds_to_stop;
std::map<float, std::vector<TrackObject*> > m_particles_to_trigger;
float m_duration;
double m_duration;
bool m_aborted;
/** monkey tricks to get the animations in sync with irrlicht. we reset the time
* after all is loaded and it's running withotu delays
*/
bool m_second_reset;
float m_time_at_second_reset;
double m_time_at_second_reset;
void abortCutscene()
{
@@ -85,7 +85,7 @@ public:
virtual const std::string& getIdent() const OVERRIDE;
virtual void kartHit(const int kart_id) OVERRIDE;
virtual void update(float dt) OVERRIDE;
virtual void update(double dt) OVERRIDE;
virtual void createRaceGUI() OVERRIDE;

View File

@@ -116,12 +116,12 @@ public:
printf("%s {\n", name);
// 1325966438 is an arbitrary time that is in the past but much after 1970
// to get smaller numbers in order to not lose the precision of float
m_time = getFloatTimeSinceEpoch(1325966438);
m_time = (float)getFloatTimeSinceEpoch(1325966438);
}
~ScopeProfiler()
{
float f2 = getFloatTimeSinceEpoch(1325966438);
float f2 = (float)getFloatTimeSinceEpoch(1325966438);
printf("} // took %f s\n", (f2 - m_time));
}
};