diff options
| author | Japa | 2010-05-16 15:31:28 +0000 |
|---|---|---|
| committer | Japa | 2010-05-16 15:31:28 +0000 |
| commit | 5c235e57af3ad3234608ee4ebf06de43324caf79 (patch) | |
| tree | b851b20b6d9053ec4ad18ba11ccca222c99159a3 /ContentLoader.cpp | |
| parent | 72a82d2e50e9232c79edb7905dd2a214a95d66b6 (diff) | |
| download | stonesense-5c235e57af3ad3234608ee4ebf06de43324caf79.tar.gz stonesense-5c235e57af3ad3234608ee4ebf06de43324caf79.tar.bz2 stonesense-5c235e57af3ad3234608ee4ebf06de43324caf79.tar.xz | |
did some errorchecking, stonesense will now not crash when running old DF.
Diffstat (limited to 'ContentLoader.cpp')
| -rw-r--r-- | ContentLoader.cpp | 86 |
1 files changed, 83 insertions, 3 deletions
diff --git a/ContentLoader.cpp b/ContentLoader.cpp index 3751cd4..33ff0e6 100644 --- a/ContentLoader.cpp +++ b/ContentLoader.cpp @@ -70,8 +70,86 @@ bool ContentLoader::Load(API& DF){ //// make a copy for our use
//classIdStrings = *tempClasses;
- Mats = DF.getMaterials(); - Mats->ReadAllMaterials();
+ try + { + Mats = DF.getMaterials(); + } + catch(exception &e) + { + WriteErr("%s\n", e.what()); + } + if(!config.skipCreatureTypes); + { + try + { + Mats->ReadCreatureTypes();
+ }
+ catch(exception &e) + { + WriteErr("%s\n", e.what()); + config.skipCreatureTypes = true; + } + } + if(!config.skipCreatureTypesEx) + { + try + { + Mats->ReadCreatureTypesEx();
+ }
+ catch(exception &e) + { + WriteErr("%s\n", e.what()); + config.skipCreatureTypesEx = true; + } + } + try + { + Mats->ReadDescriptorColors();
+ }
+ catch(exception &e) + { + WriteErr("%s\n", e.what()); + } + try + { + Mats->ReadInorganicMaterials();
+ }
+ catch(exception &e) + { + WriteErr("%s\n", e.what()); + } + try + { + Mats->ReadOrganicMaterials();
+ }
+ catch(exception &e) + { + WriteErr("%s\n", e.what()); + } + try + { + Mats->ReadOthers();
+ }
+ catch(exception &e) + { + WriteErr("%s\n", e.what()); + } + try + { + Mats->ReadPlantMaterials();
+ }
+ catch(exception &e) + { + WriteErr("%s\n", e.what()); + } + try + { + Mats->ReadWoodMaterials();
+ }
+ catch(exception &e) + { + WriteErr("%s\n", e.what()); + } Bld = DF.getBuildings();
DFHack::memory_info *mem = DF.getMemoryInfo();
if(professionStrings.empty())
@@ -389,6 +467,7 @@ int lookupMaterialIndex(int matType, const char* strValue) }
else if (matType == LEATHER)
{
+ if(!config.skipCreatureTypes);
typeVector=&(contentLoader.Mats->race);
}
else
@@ -440,7 +519,8 @@ const char *lookupMaterialName(int matType,int matIndex) }
else if (matType == LEATHER)
{
- typeVector=&(contentLoader.Mats->race);
+ if(!config.skipCreatureTypes)
+ typeVector=&(contentLoader.Mats->race);
}
else
{
|
