diff options
| author | Japa | 2010-05-17 11:30:33 +0000 |
|---|---|---|
| committer | Japa | 2010-05-17 11:30:33 +0000 |
| commit | 8d98b51288fa062cf5a658c4f0d24a2b100b250f (patch) | |
| tree | 4455ea9e6e0ca4ab4e380ee9a70ae07b26b2102b /GameBuildings.cpp | |
| parent | 5c235e57af3ad3234608ee4ebf06de43324caf79 (diff) | |
| download | stonesense-8d98b51288fa062cf5a658c4f0d24a2b100b250f.tar.gz stonesense-8d98b51288fa062cf5a658c4f0d24a2b100b250f.tar.bz2 stonesense-8d98b51288fa062cf5a658c4f0d24a2b100b250f.tar.xz | |
prevented some more possible crashes from missing defs
Diffstat (limited to 'GameBuildings.cpp')
| -rw-r--r-- | GameBuildings.cpp | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/GameBuildings.cpp b/GameBuildings.cpp index b85c143..dedc0fb 100644 --- a/GameBuildings.cpp +++ b/GameBuildings.cpp @@ -63,18 +63,48 @@ dirTypes findWallCloseTo(WorldSegment* segment, Block* b){ void ReadBuildings(API& DF, vector<t_building>* buildingHolder)
{
+ if(config.skipBuildings)
+ return;
if(!buildingHolder) return;
- DFHack::Buildings * Bld = DF.getBuildings();
+ DFHack::Buildings * Bld;
+ try
+ {
+ Bld = DF.getBuildings();
+ }
+ catch (exception &e)
+ {
+ WriteErr("DFhack exeption: %s\n", e.what());
+ config.skipBuildings = true;
+ return;
+ }
vector<string> dummy;
uint32_t numbuildings = 0;
- if (!Bld->Start(numbuildings)) return;
+ try
+ {
+ if (!Bld->Start(numbuildings)) return;
+ }
+ catch (exception &e)
+ {
+ WriteErr("DFhack exeption: %s\n", e.what());
+ config.skipBuildings = true;
+ return;
+ }
t_building tempbuilding;
uint32_t index = 0;
while(index < numbuildings){
- Bld->Read(index, tempbuilding);
+ try
+ {
+ Bld->Read(index, tempbuilding);
+ }
+ catch (exception &e)
+ {
+ WriteErr("DFhack exeption: %s\n", e.what());
+ config.skipBuildings = true;
+ return;
+ }
buildingHolder->push_back(tempbuilding);
index++;
}
|
