Revision: 2491
          http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2491&view=rev
Author:   ulteq
Date:     2012-05-02 05:25:12 +0000 (Wed, 02 May 2012)
Log Message:
-----------
-Codechange: Continued CameraSystem, Small cleanup in CacheSystem

Modified Paths:
--------------
    trunk/source/main/gameplay/CacheSystem.cpp
    trunk/source/main/gameplay/CacheSystem.h
    trunk/source/main/gfx/camera/CameraManager.cpp
    trunk/source/main/gfx/camera/CameraManager.h
    trunk/source/main/gui/SelectorWindow.cpp
    trunk/source/main/physics/BeamForcesEuler.cpp

Modified: trunk/source/main/gameplay/CacheSystem.cpp
===================================================================
--- trunk/source/main/gameplay/CacheSystem.cpp  2012-05-02 05:22:51 UTC (rev 
2490)
+++ trunk/source/main/gameplay/CacheSystem.cpp  2012-05-02 05:25:12 UTC (rev 
2491)
@@ -26,7 +26,6 @@
 #include "errorutils.h"
 #include "ImprovedConfigFile.h"
 #include "language.h"
-#include "ScopeLog.h"
 #include "SerializedRig.h"
 #include "Settings.h"
 #include "sha1.h"
@@ -545,13 +544,12 @@
 
 bool CacheSystem::loadCache()
 {
-       // clear possible generated entries
+       // Clear existing entries
        entries.clear();
 
        String cfgfilename = getCacheConfigFilename(false);
-       ImprovedConfigFile cfg;
 
-       if(!resourceExistsInAllGroups(cfgfilename))
+       if ( !resourceExistsInAllGroups(cfgfilename) )
        {
                LOG("unable to load config file: "+cfgfilename);
                return false;
@@ -560,52 +558,55 @@
        String group = 
ResourceGroupManager::getSingleton().findGroupContainingResource(String(cfgfilename));
        DataStreamPtr 
stream=ResourceGroupManager::getSingleton().openResource(cfgfilename, group);
 
-       String line;
-       LOG("CacheSystem::loadCache2");
+       LOG("CacheSystem::loadCache");
 
        Cache_Entry t;
+       String line = "";
        int mode = 0;
+
        while( !stream->eof() )
        {
                line = stream->getLine();
-               if(StringUtil::startsWith(line, "shaone=") || 
StringUtil::startsWith(line, "modcount=") || StringUtil::startsWith(line, 
"cacheformat="))
-                       // ignore here
-                       continue;
 
                // Ignore blanks & comments
-               if( !line.length() || line.substr( 0, 2 ) == "//" )
+               if ( line.empty() || line.substr( 0, 2 ) == "//" )
                {
                        continue;
                }
-               else
+
+               // Skip these
+               if ( StringUtil::startsWith(line, "shaone=") || 
StringUtil::startsWith(line, "modcount=") || StringUtil::startsWith(line, 
"cacheformat=") )
                {
-                       if (!mode)
+                       continue;
+               }
+
+               if ( mode == 0 )
+               {
+                       // No current entry
+                       if ( line == "mod" )
                        {
-                               // No current entry
-                               if(line == "mod")
+                               mode = 1;
+                               t = Cache_Entry();
+                               t.resourceLoaded = false;
+                               t.deleted        = false;
+                               t.changedornew   = false; // default upon 
loading
+                               // Skip to and over next {
+                               stream->skipLine("{");
+                       }
+               } else if ( mode == 1 )
+               {
+                       // Already in mod
+                       if ( line == "}" )
+                       {
+                               // Finished
+                               if( !t.deleted )
                                {
-                                       mode = 1;
-                                       t = Cache_Entry();
-                                       t.resourceLoaded=false;
-                                       t.deleted=false;
-                                       t.changedornew=false; // default upon 
loading
-                                       // Skip to and over next {
-                                       stream->skipLine("{");
+                                       entries.push_back(t);
                                }
-                       } else if(mode == 1)
+                               mode = 0;
+                       } else
                        {
-                               // Already in mod
-                               if (line == "}")
-                               {
-                                       // Finished
-                                       if(mode == 1 && !t.deleted)
-                                               entries.push_back(t);
-                                       mode = 0;
-                               }
-                               else
-                               {
-                                       parseModAttribute(line, t);
-                               }
+                               parseModAttribute(line, t);
                        }
                }
        }

Modified: trunk/source/main/gameplay/CacheSystem.h
===================================================================
--- trunk/source/main/gameplay/CacheSystem.h    2012-05-02 05:22:51 UTC (rev 
2490)
+++ trunk/source/main/gameplay/CacheSystem.h    2012-05-02 05:25:12 UTC (rev 
2491)
@@ -212,7 +212,7 @@
 
        int getTimeStamp();
 
-       //these location MUST include a path separator at the end!
+       // this location MUST include a path separator at the end!
        void setLocation(String cachepath, String configpath);
        
        // this is for stats only, maybe protect it by getter later
@@ -238,7 +238,7 @@
 
        Ogre::String currentSHA1;       // stores sha1 over the content
        int rgcounter;                          // resource group counter, used 
to track the resource groups created
-       int modcounter; // counter the number of mods
+       int modcounter;                         // counter the number of mods
 
 
 
@@ -261,16 +261,16 @@
        void addFile(Ogre::FileInfo f, String ext);     // adds a file to 
entries
        void addFile(Ogre::String filename, Ogre::String archiveType, 
Ogre::String archiveDirectory, Ogre::String ext);
 
-       // reads all advanced infromation out of the entry's file
+       // reads all advanced information out of the entry's file
        void fillTerrainDetailInfo(Cache_Entry &entry, Ogre::DataStreamPtr ds, 
Ogre::String fname);
        void fillTruckDetailInfo(Cache_Entry &entry, Ogre::DataStreamPtr ds, 
Ogre::String fname);
 
-       int isCacheValid();                     // validate cache
-       void unloadUselessResourceGroups();             // unload unused 
resources afer cache generation
-       Ogre::String filenamesSHA1();   // generates the hash over the whole 
content
-       bool loadCache();                       // loads cache config file, new 
format
-       String getCacheConfigFilename(bool full);       // returns filename of 
the cache file
-       int incrementalCacheUpdate();   // tries to update parts of the Cache 
only
+       int isCacheValid();                       // validate cache
+       void unloadUselessResourceGroups();       // unload unused resources 
after cache generation
+       Ogre::String filenamesSHA1();             // generates the hash over 
the whole content
+       bool loadCache();                                     // loads cache 
config file, new format
+       String getCacheConfigFilename(bool full); // returns filename of the 
cache file
+       int incrementalCacheUpdate();             // tries to update parts of 
the Cache only
 
        void generateFileCache(Cache_Entry &entry, Ogre::String 
directory=Ogre::String());      // generates a new cache
        void deleteFileCache(char *filename); // removed files from cache

Modified: trunk/source/main/gfx/camera/CameraManager.cpp
===================================================================
--- trunk/source/main/gfx/camera/CameraManager.cpp      2012-05-02 05:22:51 UTC 
(rev 2490)
+++ trunk/source/main/gfx/camera/CameraManager.cpp      2012-05-02 05:25:12 UTC 
(rev 2491)
@@ -36,7 +36,6 @@
 #include "CameraBehaviorVehicleInternal.h"
 #include "CameraBehaviorVehicleOrbit.h"
 #include "CameraBehaviorVehicleSpline.h"
-#include "CameraBehaviorWheelChase.h"
 #include "OverlayWrapper.h"
 
 using namespace Ogre;
@@ -81,12 +80,8 @@
        globalBehaviors.insert( std::pair<int, 
CameraBehavior*>(CAMERA_VEHICLE_INTERNAL, new CameraBehaviorVehicleInternal()) 
);
        globalBehaviors.insert( std::pair<int, 
CameraBehavior*>(CAMERA_VEHICLE_ORBIT, new CameraBehaviorVehicleOrbit()) );
        globalBehaviors.insert( std::pair<int, 
CameraBehavior*>(CAMERA_VEHICLE_SPLINE, new CameraBehaviorVehicleSpline()) );
-       globalBehaviors.insert( std::pair<int, CameraBehavior*>(CAMERA_FREE, 
new CameraBehaviorFree()) );
        globalBehaviors.insert( std::pair<int, CameraBehavior*>(CAMERA_FIXED, 
new CameraBehaviorFixed()) );
-
-       // TODO: Think about this. Do we really need this CameraBehavior, or 
could it be part of the CAMERA_VEHICLE_INTERNAL behavior?
-       globalBehaviors.insert( std::pair<int, 
CameraBehavior*>(CAMERA_VEHICLE_WHEELCHASE, new CameraBehaviorWheelChase()) );
-       
+       globalBehaviors.insert( std::pair<int, CameraBehavior*>(CAMERA_FREE, 
new CameraBehaviorFree()) );
 }
 
 #if 0

Modified: trunk/source/main/gfx/camera/CameraManager.h
===================================================================
--- trunk/source/main/gfx/camera/CameraManager.h        2012-05-02 05:22:51 UTC 
(rev 2490)
+++ trunk/source/main/gfx/camera/CameraManager.h        2012-05-02 05:25:12 UTC 
(rev 2491)
@@ -71,11 +71,10 @@
                CAMERA_CHARACTER_ORBIT=0
          , CAMERA_VEHICLE_INTERNAL
          , CAMERA_VEHICLE_ORBIT
-         , CAMERA_VEHICLE_WHEELCHASE
          , CAMERA_VEHICLE_SPLINE
+         , CAMERA_FIXED
          , CAMERA_END
          , CAMERA_FREE
-         , CAMERA_FIXED
        };
        
        void triggerFOVUpdate() { /*TODO: Think about this*/ };

Modified: trunk/source/main/gui/SelectorWindow.cpp
===================================================================
--- trunk/source/main/gui/SelectorWindow.cpp    2012-05-02 05:22:51 UTC (rev 
2490)
+++ trunk/source/main/gui/SelectorWindow.cpp    2012-05-02 05:25:12 UTC (rev 
2491)
@@ -572,6 +572,9 @@
        if(!mSelectedTruck || mSelectionDone)
                return;
        
+       mSelectedTruck->usagecounter++;
+       // TODO: Save the modified value of the usagecounter
+
        if(mLoaderType != LT_SKIN)
        {
                // we show the normal loader
@@ -672,29 +675,29 @@
        descriptiontxt = descriptiontxt +_L("Author(s): ") + c + authors + nc 
+newline;
 
        
-       if(entry->version > 0) descriptiontxt                = descriptiontxt + 
_L("Version: ")   + c + TOUTFSTRING(entry->version) + nc + newline;
-       if(entry->wheelcount > 0) descriptiontxt             = descriptiontxt + 
_L("Wheels: ")    + c + TOUTFSTRING(entry->wheelcount) + U("x") + 
TOUTFSTRING(entry->propwheelcount) + nc + newline;
-       if(entry->truckmass > 0) descriptiontxt              = descriptiontxt + 
_L("Mass: ")      + c + TOUTFSTRING((int)(entry->truckmass/1000.0f)) + U(" ") + 
_L("tons") + nc + newline;
-       if(entry->loadmass > 0) descriptiontxt               = descriptiontxt + 
_L("Load Mass: ") + c + TOUTFSTRING((int)(entry->loadmass/1000.0f)) + U(" ") + 
_L("tons") + nc + newline;
-       if(entry->nodecount > 0) descriptiontxt              = descriptiontxt + 
_L("Nodes: ")     + c + TOUTFSTRING(entry->nodecount) + nc + newline;
-       if(entry->beamcount > 0) descriptiontxt              = descriptiontxt + 
_L("Beams: ")     + c + TOUTFSTRING(entry->beamcount) + nc + newline;
-       if(entry->shockcount > 0) descriptiontxt             = descriptiontxt + 
_L("Shocks: ")    + c + TOUTFSTRING(entry->shockcount) + nc + newline;
-       if(entry->hydroscount > 0) descriptiontxt            = descriptiontxt + 
_L("Hydros: ")    + c + TOUTFSTRING(entry->hydroscount) + nc + newline;
-       if(entry->soundsourcescount > 0) descriptiontxt      = descriptiontxt + 
_L("SoundSources: ") + c + TOUTFSTRING(entry->soundsourcescount) + nc + newline;
-       if(entry->commandscount > 0) descriptiontxt          = descriptiontxt + 
_L("Commands: ")  + c + TOUTFSTRING(entry->commandscount) + nc + newline;
-       if(entry->rotatorscount > 0) descriptiontxt          = descriptiontxt + 
_L("Rotators: ")  + c + TOUTFSTRING(entry->rotatorscount) + nc + newline;
-       if(entry->exhaustscount > 0) descriptiontxt          = descriptiontxt + 
_L("Exhausts: ")  + c + TOUTFSTRING(entry->exhaustscount) + nc + newline;
-       if(entry->flarescount > 0) descriptiontxt            = descriptiontxt + 
_L("Flares: ")    + c + TOUTFSTRING(entry->flarescount) + nc + newline;
-       if(entry->torque > 0) descriptiontxt                 = descriptiontxt + 
_L("Torque: ")    + c + TOUTFSTRING(entry->torque) + nc + newline;
-       if(entry->flexbodiescount > 0) descriptiontxt        = descriptiontxt + 
_L("Flexbodies: ") + c + TOUTFSTRING(entry->flexbodiescount) + nc + newline;
-       if(entry->propscount > 0) descriptiontxt             = descriptiontxt + 
_L("Props: ")     + c + TOUTFSTRING(entry->propscount) + nc + newline;
-       if(entry->wingscount > 0) descriptiontxt             = descriptiontxt + 
_L("Wings: ")     + c + TOUTFSTRING(entry->wingscount) + nc + newline;
-       if(entry->hasSubmeshs) descriptiontxt                = descriptiontxt + 
_L("Using Submeshs: ") + c + TOUTFSTRING(entry->hasSubmeshs) + nc + newline;
-       if(entry->numgears > 0) descriptiontxt               = descriptiontxt + 
_L("Transmission Gear Count: ") + c + TOUTFSTRING(entry->numgears) + nc + 
newline;
-       if(entry->minrpm > 0) descriptiontxt                 = descriptiontxt + 
_L("Engine RPM: ") + c + TOUTFSTRING(entry->minrpm) + U(" - ") + 
TOUTFSTRING(entry->maxrpm) + nc + newline;
+       if(entry->version > 0)           descriptiontxt = descriptiontxt + 
_L("Version: ")      + c + TOUTFSTRING(entry->version) + nc + newline;
+       if(entry->wheelcount > 0)        descriptiontxt = descriptiontxt + 
_L("Wheels: ")       + c + TOUTFSTRING(entry->wheelcount) + U("x") + 
TOUTFSTRING(entry->propwheelcount) + nc + newline;
+       if(entry->truckmass > 0)         descriptiontxt = descriptiontxt + 
_L("Mass: ")         + c + TOUTFSTRING((int)(entry->truckmass/1000.0f)) + U(" 
") + _L("tons") + nc + newline;
+       if(entry->loadmass > 0)          descriptiontxt = descriptiontxt + 
_L("Load Mass: ")    + c + TOUTFSTRING((int)(entry->loadmass/1000.0f)) + U(" ") 
+ _L("tons") + nc + newline;
+       if(entry->nodecount > 0)         descriptiontxt = descriptiontxt + 
_L("Nodes: ")        + c + TOUTFSTRING(entry->nodecount) + nc + newline;
+       if(entry->beamcount > 0)         descriptiontxt = descriptiontxt + 
_L("Beams: ")        + c + TOUTFSTRING(entry->beamcount) + nc + newline;
+       if(entry->shockcount > 0)        descriptiontxt = descriptiontxt + 
_L("Shocks: ")       + c + TOUTFSTRING(entry->shockcount) + nc + newline;
+       if(entry->hydroscount > 0)       descriptiontxt = descriptiontxt + 
_L("Hydros: ")       + c + TOUTFSTRING(entry->hydroscount) + nc + newline;
+       if(entry->soundsourcescount > 0) descriptiontxt = descriptiontxt + 
_L("SoundSources: ") + c + TOUTFSTRING(entry->soundsourcescount) + nc + newline;
+       if(entry->commandscount > 0)     descriptiontxt = descriptiontxt + 
_L("Commands: ")     + c + TOUTFSTRING(entry->commandscount) + nc + newline;
+       if(entry->rotatorscount > 0)     descriptiontxt = descriptiontxt + 
_L("Rotators: ")     + c + TOUTFSTRING(entry->rotatorscount) + nc + newline;
+       if(entry->exhaustscount > 0)     descriptiontxt = descriptiontxt + 
_L("Exhausts: ")     + c + TOUTFSTRING(entry->exhaustscount) + nc + newline;
+       if(entry->flarescount > 0)       descriptiontxt = descriptiontxt + 
_L("Flares: ")       + c + TOUTFSTRING(entry->flarescount) + nc + newline;
+       if(entry->torque > 0)            descriptiontxt = descriptiontxt + 
_L("Torque: ")       + c + TOUTFSTRING(entry->torque) + nc + newline;
+       if(entry->flexbodiescount > 0)   descriptiontxt = descriptiontxt + 
_L("Flexbodies: ")   + c + TOUTFSTRING(entry->flexbodiescount) + nc + newline;
+       if(entry->propscount > 0)        descriptiontxt = descriptiontxt + 
_L("Props: ")        + c + TOUTFSTRING(entry->propscount) + nc + newline;
+       if(entry->wingscount > 0)        descriptiontxt = descriptiontxt + 
_L("Wings: ")        + c + TOUTFSTRING(entry->wingscount) + nc + newline;
+       if(entry->hasSubmeshs)           descriptiontxt = descriptiontxt + 
_L("Using Submeshs: ")          + c + TOUTFSTRING(entry->hasSubmeshs) + nc + 
newline;
+       if(entry->numgears > 0)          descriptiontxt = descriptiontxt + 
_L("Transmission Gear Count: ") + c + TOUTFSTRING(entry->numgears) + nc + 
newline;
+       if(entry->minrpm > 0)            descriptiontxt = descriptiontxt + 
_L("Engine RPM: ")   + c + TOUTFSTRING(entry->minrpm) + U(" - ") + 
TOUTFSTRING(entry->maxrpm) + nc + newline;
        if(!entry->uniqueid.empty() && entry->uniqueid != "no-uid") 
descriptiontxt = descriptiontxt + _L("Unique ID: ") + c + entry->uniqueid + nc 
+ newline;
-       if(!entry->guid.empty() && entry->guid != "no-guid") descriptiontxt = 
descriptiontxt + _L("GUID: ") + c + entry->guid + nc + newline;
-       if(entry->usagecounter > 0) descriptiontxt           = descriptiontxt + 
_L("Times used: ") + c + TOUTFSTRING(entry->usagecounter) + nc + newline;
+       if(!entry->guid.empty() && entry->guid != "no-guid")            
descriptiontxt = descriptiontxt + _L("GUID: ") + c + entry->guid + nc + newline;
+       if(entry->usagecounter > 0)      descriptiontxt = descriptiontxt + 
_L("Times used: ")   + c + TOUTFSTRING(entry->usagecounter) + nc + newline;
 
        if(entry->addtimestamp > 0)
        {

Modified: trunk/source/main/physics/BeamForcesEuler.cpp
===================================================================
--- trunk/source/main/physics/BeamForcesEuler.cpp       2012-05-02 05:22:51 UTC 
(rev 2490)
+++ trunk/source/main/physics/BeamForcesEuler.cpp       2012-05-02 05:25:12 UTC 
(rev 2491)
@@ -1949,14 +1949,14 @@
                                                        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);
+                                                               
SoundScriptManager::getSingleton().trigStop(trucknum, SS_TRIG_LINKED_COMMAND, 
SL_COMMAND, -i);
+                                                               
SoundScriptManager::getSingleton().trigStart(trucknum, SS_TRIG_LINKED_COMMAND, 
SL_COMMAND, i);
                                                                vst = 0;
 
                                                        } else if(vst == -1)
                                                        {
                                                                // just stopped
-                                                               
SoundScriptManager::getSingleton().trigStop(trucknum, SS_LINKED_COMMAND, 
SL_COMMAND, i);
+                                                               
SoundScriptManager::getSingleton().trigStop(trucknum, SS_TRIG_LINKED_COMMAND, 
SL_COMMAND, i);
                                                                vst = 0;
                                                        } else if (vst == 0)
                                                        {
@@ -2038,28 +2038,26 @@
 
                                                        if(!canwork)
                                                                continue;
-
 #ifdef USE_OPENAL
                                                        // command sounds
                                                        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);
+                                                               
SoundScriptManager::getSingleton().trigStop(trucknum, SS_TRIG_LINKED_COMMAND, 
SL_COMMAND, i);
+                                                               
SoundScriptManager::getSingleton().trigStart(trucknum, SS_TRIG_LINKED_COMMAND, 
SL_COMMAND, -i);
                                                                vst = 0;
 
                                                        } else if(vst == -1)
                                                        {
                                                                // just stopped
-                                                               
SoundScriptManager::getSingleton().trigStop(trucknum, SS_LINKED_COMMAND, 
SL_COMMAND, -i);
+                                                               
SoundScriptManager::getSingleton().trigStop(trucknum, SS_TRIG_LINKED_COMMAND, 
SL_COMMAND, -i);
                                                                vst = 0;
                                                        } else if (vst == 0)
                                                        {
                                                                // already 
running, modulate
-                                                               
SoundScriptManager::getSingleton().modulate(trucknum, SS_LINKED_COMMAND, v, 
SL_COMMAND, -i);
+                                                               
SoundScriptManager::getSingleton().modulate(trucknum, SS_TRIG_LINKED_COMMAND, 
v, SL_COMMAND, -i);
                                                        }
 #endif // USE_OPENAL
-
                                                        beams[bbeam].L *= (1.0 
- beams[bbeam].commandRatioShort * v * crankfactor * dt / beams[bbeam].L);
                                                        
dl=fabs(dl-beams[bbeam].L);
                                                        if(v>0.5)

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


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Rigsofrods-devel mailing list
Rigsofrods-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel

Reply via email to