Revision: 2437
          http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2437&view=rev
Author:   rorthomas
Date:     2012-02-02 21:21:41 +0000 (Thu, 02 Feb 2012)
Log Message:
-----------
fixed lots of cppcheck warnings

Modified Paths:
--------------
    trunk/source/main/audio/SoundScriptManager.h
    trunk/source/main/framework/GameState.cpp
    trunk/source/main/gameplay/BeamEngine.cpp
    trunk/source/main/gui/ExampleLoadingBar.h
    trunk/source/main/network/StreamableFactory.h
    trunk/source/main/physics/BeamForcesEuler.cpp

Modified: trunk/source/main/audio/SoundScriptManager.h
===================================================================
--- trunk/source/main/audio/SoundScriptManager.h        2012-02-02 20:06:22 UTC 
(rev 2436)
+++ trunk/source/main/audio/SoundScriptManager.h        2012-02-02 21:21:41 UTC 
(rev 2437)
@@ -34,7 +34,6 @@
 // TODO: fix this fugly defines into a proper enum
 #define MAX_SOUNDS_PER_SCRIPT 16
 #define MAX_INSTANCES_PER_GROUP 256
-#define MAX_SOUNDLINK_ITEM 64
 
 #define PITCHDOWN_FADE_FACTOR   3.0
 #define PITCHDOWN_CUTOFF_FACTOR 5.0

Modified: trunk/source/main/framework/GameState.cpp
===================================================================
--- trunk/source/main/framework/GameState.cpp   2012-02-02 20:06:22 UTC (rev 
2436)
+++ trunk/source/main/framework/GameState.cpp   2012-02-02 21:21:41 UTC (rev 
2437)
@@ -35,7 +35,7 @@
        //m_pSceneMgr->setCameraRelativeRendering(true);
 
        LOG("Adding Frame Listener");
-       bool isEmbedded = OgreFramework::getSingleton().isEmbedded();
+
        mFrameListener = new RoRFrameListener(this,
                OgreFramework::getSingleton().m_pRenderWnd,
                m_pCamera,

Modified: trunk/source/main/gameplay/BeamEngine.cpp
===================================================================
--- trunk/source/main/gameplay/BeamEngine.cpp   2012-02-02 20:06:22 UTC (rev 
2436)
+++ trunk/source/main/gameplay/BeamEngine.cpp   2012-02-02 21:21:41 UTC (rev 
2437)
@@ -22,61 +22,59 @@
 #include "TorqueCurve.h"
 #include "Scripting.h"
 
-BeamEngine::BeamEngine(
-float iddle
-, float max
-, float torque
-, std::vector<float> gears
-, float diff
-, int trucknum)
+BeamEngine::BeamEngine( float iddle, float max, float torque, 
std::vector<float> gears, float diff, int trucknum) :
+         clutch_time(0.2f)
+       , shift_time(0.5f)
+       , post_shift_time(0.2f)
 
-: clutch_time(0.2f)
-, shift_time(0.5f)
-, post_shift_time(0.2f)
+       , numGears((int)gears.size() - 2)
+       , gearsRatio( gears )
+       , inertia(10.0)
+       , clutchForce(10000.0f)
 
-, numGears((int)gears.size() - 2)
-, gearsRatio( gears )
-, inertia(10.0)
-, clutchForce(10000.0f)
+       , curGear(0)
 
-, curGear(0)
+       , curEngineRPM(0.0f)
+       , curGearboxRPM(0.0f)
+       , curClutch(0.0f)
+       , curAcc(0.0f)
+       , curClutchTorque(0.0f)
 
-, curEngineRPM(0.0f)
-, curGearboxRPM(0.0f)
-, curClutch(0.0f)
-, curAcc(0.0f)
-, curClutchTorque(0.0f)
+       , shifting(0)
+       , postshifting(0)
 
-, shifting(0)
-, postshifting(0)
+       , autocurAcc(0)
+       , starter(0)
+       , autoselect(DRIVE)
 
-, autocurAcc(0)
-, starter(0)
-, autoselect(DRIVE)
+       , curTurboRPM(0.0f)
+       , apressure(0)
+       , automode(AUTOMATIC)
+       , trucknum(trucknum)
+       , torqueCurve (new TorqueCurve())
 
-, curTurboRPM(0.0f)
-, apressure(0)
-, automode(AUTOMATIC)
-, trucknum(trucknum)
-, torqueCurve (new TorqueCurve())
 
+       , iddleRPM(iddle)
+       , maxRPM(max)
+       , stallRPM(300.0f)
+       , brakingTorque(-torque/5.0f)
+       , engineTorque(torque - brakingTorque)
 
-, iddleRPM(iddle)
-, maxRPM(max)
-, stallRPM(300.0f)
-, brakingTorque(-torque/5.0f)
-, engineTorque(torque - brakingTorque)
-
-, hasturbo(true)
-, hasair(true)
-, type('t')
-, running(0)
-, contact(0)
-, hydropump(0.0)
-, prime(0)
+       , hasturbo(true)
+       , hasair(true)
+       , type('t')
+       , running(0)
+       , contact(0)
+       , hydropump(0.0)
+       , prime(0)
+       , curGearRange(0)
+       , shiftval(0)
+       , shiftclock(0)
+       , postshiftclock(0)
+       , status("")
 {
        gearsRatio[0] = -gearsRatio[0];
-       for(std::vector< float >::iterator it = gearsRatio.begin(); it != 
gearsRatio.end(); it++)
+       for(std::vector< float >::iterator it = gearsRatio.begin(); it != 
gearsRatio.end(); ++it)
        {
                (*it) *= diff;
        }
@@ -175,12 +173,14 @@
        curEngineRPM += dt*totaltorque/inertia;
 
        //update clutch torque
-       float gearboxspinner=0.0f;
-       if (curGear){
-               gearboxspinner = curEngineRPM/gearsRatio[curGear + 1];
+       if (curGear)
+       {
+               float gearboxspinner = curEngineRPM/gearsRatio[curGear + 1];
                curClutchTorque = 
(gearboxspinner-curGearboxRPM)*curClutch*clutchForce;
-       }       
-       else curClutchTorque=0.0f;
+       } else
+       {
+               curClutchTorque=0.0f;
+       }
 
        if (curEngineRPM<0.0f) curEngineRPM=0.0f;
 
@@ -290,19 +290,13 @@
                }
                
        }
+#ifdef USE_OPENAL
        // reverse gear beep
        if (curGear==-1 && running)
-       {
-#ifdef USE_OPENAL
                SoundScriptManager::getSingleton().trigStart(trucknum, 
SS_TRIG_REVERSE_GEAR);
-#endif //OPENAL
-       }
        else
-       {
-#ifdef USE_OPENAL
                SoundScriptManager::getSingleton().trigStop(trucknum, 
SS_TRIG_REVERSE_GEAR);
 #endif //OPENAL
-       }
        
 }
 
@@ -378,7 +372,7 @@
 
 float BeamEngine::getSmoke()
 {
-       int maxTurboRPM = 200000.0f;
+       const int maxTurboRPM = 200000.0f;
        if (running) return 
curAcc*(1.0f-curTurboRPM/maxTurboRPM);//*engineTorque/5000.0;
        else return -1;
 }

Modified: trunk/source/main/gui/ExampleLoadingBar.h
===================================================================
--- trunk/source/main/gui/ExampleLoadingBar.h   2012-02-02 20:06:22 UTC (rev 
2436)
+++ trunk/source/main/gui/ExampleLoadingBar.h   2012-02-02 21:21:41 UTC (rev 
2437)
@@ -62,10 +62,23 @@
        OverlayElement* mLoadingDescriptionElement;
        OverlayElement* mLoadingCommentElement;
        Ogre::Timer *t;
+       int counterGroups;
 
-       int counterGroups;
 public:
-       ExampleLoadingBar() : counterGroups(0)
+       ExampleLoadingBar() :
+           mWindow(NULL)
+         , mLoadOverlay(NULL)
+         , mInitProportion(1)
+         , mNumGroupsInit(0)
+         , mNumGroupsLoad(0)
+         , mProgressBarMaxSize(1)
+         , mProgressBarScriptSize(1)
+         , mProgressBarInc(1)
+         , mLoadingBarElement(NULL)
+         , mLoadingDescriptionElement(NULL)
+         , mLoadingCommentElement(0)
+         , t(NULL)
+         , counterGroups(0)
        {
                t = new Ogre::Timer();
        }

Modified: trunk/source/main/network/StreamableFactory.h
===================================================================
--- trunk/source/main/network/StreamableFactory.h       2012-02-02 20:06:22 UTC 
(rev 2436)
+++ trunk/source/main/network/StreamableFactory.h       2012-02-02 21:21:41 UTC 
(rev 2437)
@@ -159,11 +159,11 @@
                typename std::map < int, std::map < unsigned int, X *> 
>::iterator it1;
                typename std::map < unsigned int, X *>::iterator it2;
 
-               for(it1=streamables.begin(); it1!=streamables.end();it1++)
+               for(it1=streamables.begin(); it1!=streamables.end();++it1)
                {
                        if(it1->first != del->sourceid) continue;
 
-                       for(it2=it1->second.begin(); 
it2!=it1->second.end();it2++)
+                       for(it2=it1->second.begin(); 
it2!=it1->second.end();++it2)
                        {
                                if(del->streamid == -1 || del->streamid == 
(int)it2->first)
                                {
@@ -187,10 +187,10 @@
 
                int ok = 0;
                int num = 0;
-               for(it1=streamables.begin(); it1!=streamables.end();it1++)
+               for(it1=streamables.begin(); it1!=streamables.end();++it1)
                {
                        if(it1->first != sourceid) continue;
-                       for(it2=it1->second.begin(); 
it2!=it1->second.end();it2++)
+                       for(it2=it1->second.begin(); 
it2!=it1->second.end();++it2)
                        {
                                num++;
                                if(it2->second != 0)
@@ -214,9 +214,9 @@
                typename std::map < int, std::map < unsigned int, X *> 
>::iterator it1;
                typename std::map < unsigned int, X *>::iterator it2;
 
-               for(it1=streamables.begin(); it1!=streamables.end();it1++)
+               for(it1=streamables.begin(); it1!=streamables.end();++it1)
                {
-                       for(it2=it1->second.begin(); 
it2!=it1->second.end();it2++)
+                       for(it2=it1->second.begin(); 
it2!=it1->second.end();++it2)
                        {
                                if(!it2->second) continue;
                                if(it2->second->getStreamResultsChanged())
@@ -240,9 +240,9 @@
 
                int ok = 0;
                int originstreams = 0;
-               for(it1=streamables.begin(); it1!=streamables.end();it1++)
+               for(it1=streamables.begin(); it1!=streamables.end();++it1)
                {
-                       for(it2=it1->second.begin(); 
it2!=it1->second.end();it2++)
+                       for(it2=it1->second.begin(); 
it2!=it1->second.end();++it2)
                        {
                                if(!it2->second)
                                        continue;
@@ -299,15 +299,15 @@
                typename std::map < unsigned int, X *>::iterator it2;
 
                int res = 0;
-               for(it1=streamables.begin(); it1!=streamables.end();it1++)
+               for(it1=streamables.begin(); it1!=streamables.end();++it1)
                {
-                       for(it2=it1->second.begin(); 
it2!=it1->second.end();it2++)
+                       for(it2=it1->second.begin(); 
it2!=it1->second.end();++it2)
                        {
                                if(!it2->second)
                                        continue;
                                if(!it2->second->getIsOrigin())
                                        continue;
-                               int sid = it2->second->getSourceID();
+                               //int sid = it2->second->getSourceID(); // 
unused
                                int stid = it2->second->getStreamID();
                                // only use our locally created streams
                                if(stid == reg->origin_streamid)

Modified: trunk/source/main/physics/BeamForcesEuler.cpp
===================================================================
--- trunk/source/main/physics/BeamForcesEuler.cpp       2012-02-02 20:06:22 UTC 
(rev 2436)
+++ trunk/source/main/physics/BeamForcesEuler.cpp       2012-02-02 21:21:41 UTC 
(rev 2437)
@@ -1949,6 +1949,7 @@
                                                        if(vst == 1)
                                                        {
                                                                // just started
+                                                               
SoundScriptManager::getSingleton().trigStop(trucknum, SS_LINKED_COMMAND, 
SL_COMMAND, -i);
                                                                
SoundScriptManager::getSingleton().trigStart(trucknum, SS_LINKED_COMMAND, 
SL_COMMAND, i);
                                                                vst = 0;
 
@@ -2043,6 +2044,7 @@
                                                        if(vst == 1)
                                                        {
                                                                // just started
+                                                               
SoundScriptManager::getSingleton().trigStop(trucknum, SS_LINKED_COMMAND, 
SL_COMMAND, i);
                                                                
SoundScriptManager::getSingleton().trigStart(trucknum, SS_LINKED_COMMAND, 
SL_COMMAND, -i);
                                                                vst = 0;
 

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Rigsofrods-devel mailing list
Rigsofrods-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel

Reply via email to