diff options
| author | Japa | 2011-07-20 15:59:11 +0000 |
|---|---|---|
| committer | Japa | 2011-07-20 15:59:11 +0000 |
| commit | aee9dc6758120d57a8fabc013a16c82f6682099c (patch) | |
| tree | 7d2ddd6cabb61e948d5cd19f7838ab313ac1c6e9 /ContentLoader.cpp | |
| parent | 3eacec9eef6da5e6ce6f7d966a6b601f6268557c (diff) | |
| download | stonesense-aee9dc6758120d57a8fabc013a16c82f6682099c.tar.gz stonesense-aee9dc6758120d57a8fabc013a16c82f6682099c.tar.bz2 stonesense-aee9dc6758120d57a8fabc013a16c82f6682099c.tar.xz | |
Got some sort of functionality out of DFapi. this means an empty window.
Diffstat (limited to 'ContentLoader.cpp')
| -rw-r--r-- | ContentLoader.cpp | 188 |
1 files changed, 91 insertions, 97 deletions
diff --git a/ContentLoader.cpp b/ContentLoader.cpp index bffa70a..f376c13 100644 --- a/ContentLoader.cpp +++ b/ContentLoader.cpp @@ -41,7 +41,7 @@ void DumpPrefessionNamesToDisk(vector<string> material, const char* filename){ }
fclose(fp);
}
-bool ContentLoader::Load( DFHack::Context& DF){
+bool ContentLoader::Load( DFHack::Core& DF){
/*draw_textf_border(font,
al_get_bitmap_width(al_get_target_bitmap())/2,
al_get_bitmap_height(al_get_target_bitmap())/2,
@@ -61,116 +61,110 @@ bool ContentLoader::Load( DFHack::Context& DF){ // This is an extra suspend/resume, but it only happens when reloading the config
// ie not enough to worry about
//DF.Suspend();
-
- if(!DF.isAttached())
- {
- WriteErr("FAIL");
- return false;
- }
////read data from DF
//const vector<string> *tempClasses = DF.getMemoryInfo()->getClassIDMapping();
//// make a copy for our use
//classIdStrings = *tempClasses;
- - try - { - Mats = DF.getMaterials(); - } - catch(exception &e) - { - WriteErr("DFhack exeption: %s\n", e.what()); - } - if(!config.skipCreatureTypes) - { - try - { +
+ try
+ {
+ Mats = DF.getMaterials();
+ }
+ catch(exception &e)
+ {
+ WriteErr("DFhack exeption: %s\n", e.what());
+ }
+ if(!config.skipCreatureTypes)
+ {
+ try
+ {
Mats->ReadCreatureTypes();
}
- catch(exception &e) - { - WriteErr("DFhack exeption: %s\n", e.what()); - config.skipCreatureTypes = true; - } - } - if(!config.skipCreatureTypesEx) - { - try - { + catch(exception &e)
+ {
+ WriteErr("DFhack exeption: %s\n", e.what());
+ config.skipCreatureTypes = true;
+ }
+ }
+ if(!config.skipCreatureTypesEx)
+ {
+ try
+ {
Mats->ReadCreatureTypesEx();
}
- catch(exception &e) - { - WriteErr("DFhack exeption: %s\n", e.what()); - config.skipCreatureTypesEx = true; - } - } - if(!config.skipDescriptorColors) - { - try - { + catch(exception &e)
+ {
+ WriteErr("DFhack exeption: %s\n", e.what());
+ config.skipCreatureTypesEx = true;
+ }
+ }
+ if(!config.skipDescriptorColors)
+ {
+ try
+ {
Mats->ReadDescriptorColors();
}
- catch(exception &e) - { - WriteErr("DFhack exeption: %s\n", e.what()); - config.skipDescriptorColors = true; - } - } - if(!config.skipInorganicMats) - { - try - { + catch(exception &e)
+ {
+ WriteErr("DFhack exeption: %s\n", e.what());
+ config.skipDescriptorColors = true;
+ }
+ }
+ if(!config.skipInorganicMats)
+ {
+ try
+ {
Mats->ReadInorganicMaterials();
}
- catch(exception &e) - { - WriteErr("DFhack exeption: %s\n", e.what()); - config.skipInorganicMats = true; - } - } - if(!config.skipOrganicMats) - { - try - { + catch(exception &e)
+ {
+ WriteErr("DFhack exeption: %s\n", e.what());
+ config.skipInorganicMats = true;
+ }
+ }
+ if(!config.skipOrganicMats)
+ {
+ try
+ {
Mats->ReadOrganicMaterials();
}
- catch(exception &e) - { - WriteErr("DFhack exeption: %s\n", e.what()); - config.skipOrganicMats = true; - } - } - try - { + catch(exception &e)
+ {
+ WriteErr("DFhack exeption: %s\n", e.what());
+ config.skipOrganicMats = true;
+ }
+ }
+ try
+ {
Mats->ReadOthers();
}
- catch(exception &e) - { - WriteErr("DFhack exeption: %s\n", e.what()); - } - try - { + catch(exception &e)
+ {
+ WriteErr("DFhack exeption: %s\n", e.what());
+ }
+ try
+ {
Mats->ReadPlantMaterials();
}
- catch(exception &e) - { - WriteErr("DFhack exeption: %s\n", e.what()); - } - try - { + catch(exception &e)
+ {
+ WriteErr("DFhack exeption: %s\n", e.what());
+ }
+ try
+ {
Mats->ReadWoodMaterials();
}
- catch(exception &e) - { - WriteErr("DFhack exeption: %s\n", e.what()); - } - try - { + catch(exception &e)
+ {
+ WriteErr("DFhack exeption: %s\n", e.what());
+ }
+ try
+ {
Bld = DF.getBuildings();
}
- catch(exception &e) - { - WriteErr("DFhack exeption: %s\n", e.what()); + catch(exception &e)
+ {
+ WriteErr("DFhack exeption: %s\n", e.what());
}
if(Bld)
{
@@ -178,12 +172,12 @@ bool ContentLoader::Load( DFHack::Context& DF){ }
try
{
- contentLoader.MemInfo = DF.getMemoryInfo();
+ contentLoader.MemInfo = DF.vinfo;
+ }
+ catch(exception &e)
+ {
+ WriteErr("DFhack exeption: %s\n", e.what());
}
- catch(exception &e) - { - WriteErr("DFhack exeption: %s\n", e.what()); - } if(professionStrings.empty())
{
for(int i=0;; i++)
@@ -193,9 +187,9 @@ bool ContentLoader::Load( DFHack::Context& DF){ {
temp = MemInfo->getProfession(i);
}
- catch(exception &e) - { - break; + catch(exception &e)
+ {
+ break;
}
if(temp[0])
{
|
