Revision: 1517
http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=1517&view=rev
Author: rorthomas
Date: 2010-08-18 15:19:29 +0000 (Wed, 18 Aug 2010)
Log Message:
-----------
fixed senseless exceptions when looking for optional files
Modified Paths:
--------------
trunk/source/main/Airfoil.cpp
trunk/source/main/BeamSlideNode.cpp
trunk/source/main/CacheSystem.cpp
trunk/source/main/FlexBody.cpp
trunk/source/main/MeshObject.h
trunk/source/main/RoRFrameListener.cpp
trunk/source/main/ScriptEngine.cpp
trunk/source/main/ShadowManager.cpp
trunk/source/main/luasystem.cpp
Modified: trunk/source/main/Airfoil.cpp
===================================================================
--- trunk/source/main/Airfoil.cpp 2010-08-18 14:31:25 UTC (rev 1516)
+++ trunk/source/main/Airfoil.cpp 2010-08-18 15:19:29 UTC (rev 1517)
@@ -35,7 +35,7 @@
int lastia=-1;
//fd=fopen(rfname, "r");
ResourceGroupManager& rgm = ResourceGroupManager::getSingleton();
-
+
String group="";
try
{
Modified: trunk/source/main/BeamSlideNode.cpp
===================================================================
--- trunk/source/main/BeamSlideNode.cpp 2010-08-18 14:31:25 UTC (rev 1516)
+++ trunk/source/main/BeamSlideNode.cpp 2010-08-18 15:19:29 UTC (rev 1517)
@@ -267,6 +267,7 @@
void Beam::resetSlideNodePositions()
{
+ if(mSlideNodes.empty()) return;
for(std::vector<SlideNode>::iterator it = mSlideNodes.begin(); it !=
mSlideNodes.end(); ++it)
{
it->ResetPositions();
Modified: trunk/source/main/CacheSystem.cpp
===================================================================
--- trunk/source/main/CacheSystem.cpp 2010-08-18 14:31:25 UTC (rev 1516)
+++ trunk/source/main/CacheSystem.cpp 2010-08-18 15:19:29 UTC (rev 1517)
@@ -2200,30 +2200,26 @@
StringUtil::splitBaseFilename(entry.fname, fbase, fext);
String minifn = fbase + "-mini." + entry.minitype;
- String group="";
- try
+ bool exists =
ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(minifn);
+ String group = "";
+ if(!exists)
{
- group =
ResourceGroupManager::getSingleton().findGroupContainingResource(minifn);
- }catch(...)
- {
- }
- if(group == "")
- {
String base, ext;
StringUtil::splitBaseFilename(entry.fname, base, ext);
entry.minitype = detectFilesMiniType(base + "-mini");
- try
+ exists =
ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(minifn);
+ if(!exists)
{
- group =
ResourceGroupManager::getSingleton().findGroupContainingResource(minifn);
- }catch(...)
- {
- }
- if(group == "")
- {
// no minipic found
entry.filecachename = "none";
return;
+ } else
+ {
+ group =
ResourceGroupManager::getSingleton().findGroupContainingResource(minifn);
}
+ } else
+ {
+ group =
ResourceGroupManager::getSingleton().findGroupContainingResource(minifn);
}
FileInfoListPtr files =
ResourceGroupManager::getSingleton().findResourceFileInfo(group, minifn);
@@ -2640,13 +2636,9 @@
// we found the file, load it
filename = it->fname;
bool res = checkResourceLoaded(*it);
- try
- {
- group =
ResourceGroupManager::getSingleton().findGroupContainingResource(filename);
- } catch (...)
- {
+ bool exists =
ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(filename);
+ if(!exists)
return false;
- }
return res;
}
}
Modified: trunk/source/main/FlexBody.cpp
===================================================================
--- trunk/source/main/FlexBody.cpp 2010-08-18 14:31:25 UTC (rev 1516)
+++ trunk/source/main/FlexBody.cpp 2010-08-18 15:19:29 UTC (rev 1517)
@@ -118,17 +118,9 @@
for(int i=0; i<4;i++)
{
String fn = basename + "_" + StringConverter::toString(i) +
".mesh";
- String group = "";
- try
- {
- group =
ResourceGroupManager::getSingleton().findGroupContainingResource(fn);
- }catch(...)
- {
- continue;
- }
+ bool exists =
ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(fn);
+ if(!exists) continue;
- if(group.empty()) continue;
-
float distance = 3;
if(i == 1) distance = 20;
if(i == 2) distance = 50;
Modified: trunk/source/main/MeshObject.h
===================================================================
--- trunk/source/main/MeshObject.h 2010-08-18 14:31:25 UTC (rev 1516)
+++ trunk/source/main/MeshObject.h 2010-08-18 15:19:29 UTC (rev 1517)
@@ -217,17 +217,9 @@
for(int i=0; i<4;i++)
{
String fn = basename + "_lod" +
StringConverter::toString(i+1) + ".mesh";
- String group = "";
- try
- {
- group =
ResourceGroupManager::getSingleton().findGroupContainingResource(fn);
- }catch(...)
- {
- continue;
- }
+ bool exists =
ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(fn);
+ if(!exists) continue;
- if(group.empty()) continue;
-
float distance = 3;
if(i == 1) distance = 20;
if(i == 2) distance = 50;
Modified: trunk/source/main/RoRFrameListener.cpp
===================================================================
--- trunk/source/main/RoRFrameListener.cpp 2010-08-18 14:31:25 UTC (rev
1516)
+++ trunk/source/main/RoRFrameListener.cpp 2010-08-18 15:19:29 UTC (rev
1517)
@@ -1689,13 +1689,11 @@
{
sprintf(fname,"%s-%s.odef", terrainUID.c_str(), name);
odefname = String(fname);
- try
+ bool exists =
ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(odefname);
+ if(exists)
{
odefgroup =
ResourceGroupManager::getSingleton().findGroupContainingResource(odefname);
odefFound = true;
- } catch(...)
- {
- odefFound=false;
}
}
@@ -1703,13 +1701,11 @@
{
sprintf(fname,"%s.odef", name);
odefname = String(fname);
- try
+ bool exists =
ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(odefname);
+ if(exists)
{
odefgroup =
ResourceGroupManager::getSingleton().findGroupContainingResource(odefname);
- odefFound=true;
- } catch(...)
- {
- odefFound=false;
+ odefFound = true;
}
}
Modified: trunk/source/main/ScriptEngine.cpp
===================================================================
--- trunk/source/main/ScriptEngine.cpp 2010-08-18 14:31:25 UTC (rev 1516)
+++ trunk/source/main/ScriptEngine.cpp 2010-08-18 15:19:29 UTC (rev 1517)
@@ -266,7 +266,6 @@
// Register everything
// class Beam
- /*
result = engine->RegisterObjectType("BeamClass", sizeof(Beam),
asOBJ_REF); assert(result>=0);
result = engine->RegisterObjectMethod("BeamClass", "void
scaleTruck(float)", asMETHOD(Beam,scaleTruck), asCALL_THISCALL);
assert(result>=0);
result = engine->RegisterObjectMethod("BeamClass", "string
getTruckName()", asMETHOD(Beam,getTruckName), asCALL_THISCALL);
assert(result>=0);
@@ -299,6 +298,7 @@
result = engine->RegisterObjectMethod("BeamClass", "bool
getCustomParticleMode()", asMETHOD(Beam,getCustomParticleMode),
asCALL_THISCALL); assert(result>=0);
result = engine->RegisterObjectMethod("BeamClass", "bool
getReverseLightVisible()", asMETHOD(Beam,getCustomParticleMode),
asCALL_THISCALL); assert(result>=0);
result = engine->RegisterObjectMethod("BeamClass", "float
getHeadingDirectionAngle()", asMETHOD(Beam,getHeadingDirectionAngle),
asCALL_THISCALL); assert(result>=0);
+ result = engine->RegisterObjectMethod("BeamClass", "bool isLocked()",
asMETHOD(Beam,isLocked), asCALL_THISCALL); assert(result>=0);
// offsetof invalid for classes?
result = engine->RegisterObjectProperty("BeamClass", "float brake",
offsetof(Beam, brake)); assert(result>=0);
@@ -313,13 +313,12 @@
result = engine->RegisterObjectProperty("BeamClass", "bool replaymode",
offsetof(Beam, replaymode)); assert(result>=0);
result = engine->RegisterObjectProperty("BeamClass", "int replaylen",
offsetof(Beam, replaylen)); assert(result>=0);
result = engine->RegisterObjectProperty("BeamClass", "int replaypos",
offsetof(Beam, replaypos)); assert(result>=0);
- result = engine->RegisterObjectProperty("BeamClass", "int locked",
offsetof(Beam, locked)); assert(result>=0);
result = engine->RegisterObjectProperty("BeamClass", "bool
cparticle_enabled", offsetof(Beam, cparticle_enabled)); assert(result>=0);
- result = engine->RegisterObjectProperty("BeamClass", "int hookId",
offsetof(Beam, hookId)); assert(result>=0);
- result = engine->RegisterObjectProperty("BeamClass", "BeamClass
@lockTruck", offsetof(Beam, lockTruck)); assert(result>=0);
+ //result = engine->RegisterObjectProperty("BeamClass", "int hookId",
offsetof(Beam, hookId)); assert(result>=0);
+ //result = engine->RegisterObjectProperty("BeamClass", "BeamClass
@lockTruck", offsetof(Beam, lockTruck)); assert(result>=0);
result = engine->RegisterObjectProperty("BeamClass", "int free_node",
offsetof(Beam, free_node)); assert(result>=0);
result = engine->RegisterObjectProperty("BeamClass", "int
dynamicMapMode", offsetof(Beam, dynamicMapMode)); assert(result>=0);
- result = engine->RegisterObjectProperty("BeamClass", "int tied",
offsetof(Beam, tied)); assert(result>=0);
+ //result = engine->RegisterObjectProperty("BeamClass", "int tied",
offsetof(Beam, tied)); assert(result>=0);
result = engine->RegisterObjectProperty("BeamClass", "int canwork",
offsetof(Beam, canwork)); assert(result>=0);
result = engine->RegisterObjectProperty("BeamClass", "int hashelp",
offsetof(Beam, hashelp)); assert(result>=0);
result = engine->RegisterObjectProperty("BeamClass", "float minx",
offsetof(Beam, minx)); assert(result>=0);
@@ -374,7 +373,6 @@
result = engine->RegisterObjectProperty("BeamClass", "bool
meshesVisible", offsetof(Beam, meshesVisible)); assert(result>=0);
result = engine->RegisterObjectBehaviour("BeamClass", asBEHAVE_ADDREF,
"void f()",asMETHOD(Beam,addRef), asCALL_THISCALL); assert(result>=0);
result = engine->RegisterObjectBehaviour("BeamClass", asBEHAVE_RELEASE,
"void f()",asMETHOD(Beam,release), asCALL_THISCALL); assert(result>=0);
- */
// class Settings
result = engine->RegisterObjectType("SettingsClass", sizeof(Settings),
asOBJ_REF); assert(result>=0);
@@ -383,7 +381,6 @@
result = engine->RegisterObjectBehaviour("SettingsClass",
asBEHAVE_RELEASE, "void f()",asMETHOD(Settings,release), asCALL_THISCALL);
assert(result>=0);
// class Cache_Entry
- /*
result = engine->RegisterObjectType("Cache_EntryClass",
sizeof(Cache_Entry), asOBJ_REF); assert(result>=0);
result = engine->RegisterObjectProperty("Cache_EntryClass", "string
minitype", offsetof(Cache_Entry, minitype)); assert(result>=0);
result = engine->RegisterObjectProperty("Cache_EntryClass", "string
fname", offsetof(Cache_Entry, fname)); assert(result>=0);
@@ -445,7 +442,6 @@
result = engine->RegisterObjectBehaviour("Cache_EntryClass",
asBEHAVE_ADDREF, "void f()",asMETHOD(Cache_Entry,addRef), asCALL_THISCALL);
assert(result>=0);
result = engine->RegisterObjectBehaviour("Cache_EntryClass",
asBEHAVE_RELEASE, "void f()",asMETHOD(Cache_Entry,release), asCALL_THISCALL);
assert(result>=0);
// TODO: add Cache_Entry::sectionconfigs
- */
// todo: add Vector3 classes and other utility classes!
Modified: trunk/source/main/ShadowManager.cpp
===================================================================
--- trunk/source/main/ShadowManager.cpp 2010-08-18 14:31:25 UTC (rev 1516)
+++ trunk/source/main/ShadowManager.cpp 2010-08-18 15:19:29 UTC (rev 1517)
@@ -59,7 +59,7 @@
}
int ShadowManager::changeShadowTechnique(Ogre::ShadowTechnique tech)
{
- float shadowFarDistance = 500;
+ float shadowFarDistance = 50;
float scoef=0.2;
mSceneMgr->setShadowColour(ColourValue(0.563+scoef, 0.578+scoef,
0.625+scoef));
@@ -80,7 +80,7 @@
// mSceneMgr->showBoundingBoxes(true);
} else if(tech == SHADOWTYPE_TEXTURE_MODULATIVE)
{
- mSceneMgr->setShadowTextureSettings(1024,1);
+ mSceneMgr->setShadowTextureSettings(2048,1);
} else if(tech == SHADOWTYPE_TEXTURE_ADDITIVE_INTEGRATED)
{
#if OGRE_VERSION>0x010602
@@ -117,7 +117,6 @@
bool depthShadows = false;
if (depthShadows)
{
- /*
mSceneMgr->setShadowTextureCount(3);
mSceneMgr->setShadowTextureConfig(0, 2048, 2048,
PF_FLOAT32_R);
mSceneMgr->setShadowTextureConfig(1, 1024, 1024,
PF_FLOAT32_R);
@@ -126,13 +125,13 @@
mSceneMgr->setShadowCasterRenderBackFaces(true);
mSceneMgr->setShadowTextureCasterMaterial("PSSM/shadow_caster");
+ /*
MaterialPtr houseMat =
buildDepthShadowMaterial("fw12b.jpg");
for (EntityList::iterator i = mHouseList.begin(); i !=
mHouseList.end(); ++i)
{
(*i)->setMaterial(houseMat);
}
*/
-
}
else
{
Modified: trunk/source/main/luasystem.cpp
===================================================================
--- trunk/source/main/luasystem.cpp 2010-08-18 14:31:25 UTC (rev 1516)
+++ trunk/source/main/luasystem.cpp 2010-08-18 15:19:29 UTC (rev 1517)
@@ -130,14 +130,7 @@
bool LuaSystem::fileExists(const char *filename)
{
- try
- {
-
ResourceGroupManager::getSingleton().findGroupContainingResource(filename);
- return true;
- }catch(...)
- {
- }
- return false;
+ return
ResourceGroupManager::getSingleton().resourceExistsInAnyGroup(filename);
}
void LuaSystem::loadTerrain(Ogre::String terrainname)
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
This SF.net email is sponsored by
Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________
Rigsofrods-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel