diff --git a/examples/buildingsdump.cpp b/examples/buildingsdump.cpp index 4c4a0dc35..7b87b734b 100644 --- a/examples/buildingsdump.cpp +++ b/examples/buildingsdump.cpp @@ -109,6 +109,10 @@ int main (int argc,const char* argv[]) { cout << "usage:" << endl; cout << argv[0] << " object_name [number of lines]" << endl; + #ifndef LINUX_BUILD + cout << "Done. Press any key to continue" << endl; + cin.ignore(); + #endif return 0; } int lines = 16; diff --git a/examples/creaturedump.cpp b/examples/creaturedump.cpp index 723599854..200fca0f7 100644 --- a/examples/creaturedump.cpp +++ b/examples/creaturedump.cpp @@ -315,10 +315,25 @@ int main (void) return 1; } - + uint32_t numCreatures; + if(!DF.InitReadCreatures(numCreatures)) + { + cerr << "Can't get creatures" << endl; + #ifndef LINUX_BUILD + cin.ignore(); + #endif + return 1; + } + if(!numCreatures) + { + cerr << "No creatures to print" << endl; + #ifndef LINUX_BUILD + cin.ignore(); + #endif + return 1; + } + DF.ReadItemTypes(itemTypes); - - DF.ReadPlantMatgloss(mat.plantMat); DF.ReadWoodMatgloss(mat.woodMat); DF.ReadStoneMatgloss(mat.stoneMat); @@ -338,12 +353,6 @@ int main (void) cerr << "Can't get name tables" << endl; return 1; } - uint32_t numCreatures; - if(!DF.InitReadCreatures(numCreatures)) - { - cerr << "Can't get creatures" << endl; - return 1; - } DF.InitViewAndCursor(); for(uint32_t i = 0; i < numCreatures; i++) { diff --git a/examples/materialtest.cpp b/examples/materialtest.cpp index d28fb8e64..2337b3fc9 100644 --- a/examples/materialtest.cpp +++ b/examples/materialtest.cpp @@ -24,6 +24,16 @@ int main (void) return 1; } + if(!DF.InitMap()) + { + cerr << "No map loaded, it would be unsafe to enumerate materials" << endl; + #ifndef LINUX_BUILD + cin.ignore(); + #endif + return 1; + } + DF.DestroyMap(); + vector Woods; DF.ReadWoodMatgloss(Woods); @@ -46,7 +56,7 @@ int main (void) cout << "Creature: " << CreatureTypes[0].id << endl; cout << endl; cout << "Dumping all stones!" << endl; - for(int i = 0; i < Stones.size();i++) + for(uint32_t i = 0; i < Stones.size();i++) { cout << Stones[i].id << "$" << endl;; } diff --git a/examples/renamer.cpp b/examples/renamer.cpp index 39e501489..d00993487 100644 --- a/examples/renamer.cpp +++ b/examples/renamer.cpp @@ -450,7 +450,7 @@ start: uint32_t nickname = mem->getOffset("creature_name") + mem->getOffset("name_nickname"); p->writeSTLString(toChange.origin+nickname,changeString); } - catch (DFHack::Error::MissingMemoryDefinition& e) + catch (DFHack::Error::MissingMemoryDefinition&) { cerr << "Writing creature nicknames unsupported in this version!" << endl; } @@ -462,7 +462,7 @@ start: uint32_t custom_prof = mem->getOffset("creature_custom_profession"); p->writeSTLString(toChange.origin+custom_prof,changeString); } - catch (DFHack::Error::MissingMemoryDefinition& e) + catch (DFHack::Error::MissingMemoryDefinition&) { cerr << "Writing creature custom profession unsupported in this version!" << endl; } diff --git a/library/DFHackAPI.cpp b/library/DFHackAPI.cpp index de0fc3c79..f124fbcca 100644 --- a/library/DFHackAPI.cpp +++ b/library/DFHackAPI.cpp @@ -259,7 +259,7 @@ bool API::InitMap() off->y_count_offset = y_count_offset; off->z_count_offset = z_count_offset; full_barrier - const uint32_t cmd = Maps::MAP_INIT + d->maps_module << 16; + const uint32_t cmd = Maps::MAP_INIT + (d->maps_module << 16); g_pProcess->SetAndWait(cmd); //cerr << "Map acceleration enabled!" << endl; } @@ -920,7 +920,7 @@ bool API::InitReadEffects ( uint32_t & numeffects ) return true; } -bool API::ReadEffect(const int32_t index, t_effect_df40d & effect) +bool API::ReadEffect(const uint32_t index, t_effect_df40d & effect) { if(!d->effectsInited) return false; @@ -935,7 +935,7 @@ bool API::ReadEffect(const int32_t index, t_effect_df40d & effect) } // use with care! -bool API::WriteEffect(const int32_t index, const t_effect_df40d & effect) +bool API::WriteEffect(const uint32_t index, const t_effect_df40d & effect) { if(!d->effectsInited) return false; diff --git a/library/DFHackAPI.h b/library/DFHackAPI.h index c99b8c287..c615c4a11 100644 --- a/library/DFHackAPI.h +++ b/library/DFHackAPI.h @@ -192,8 +192,8 @@ namespace DFHack * Effects like mist, dragonfire or dust */ bool InitReadEffects ( uint32_t & numeffects ); - bool ReadEffect(const int32_t index, t_effect_df40d & effect); - bool WriteEffect(const int32_t index, const t_effect_df40d & effect); + bool ReadEffect(const uint32_t index, t_effect_df40d & effect); + bool WriteEffect(const uint32_t index, const t_effect_df40d & effect); void FinishReadEffects(); /* diff --git a/library/DFMemInfoManager.cpp b/library/DFMemInfoManager.cpp index 14bda92ec..68060e9ef 100644 --- a/library/DFMemInfoManager.cpp +++ b/library/DFMemInfoManager.cpp @@ -28,7 +28,7 @@ using namespace DFHack; MemInfoManager::~MemInfoManager() { // for each in std::vector meminfo;, delete - for(int i = 0; i < meminfo.size();i++) + for(uint32_t i = 0; i < meminfo.size();i++) { delete meminfo[i]; } @@ -248,7 +248,7 @@ bool MemInfoManager::loadFile(string path_to_xml) // transform elements { // trash existing list - for(int i = 0; i < meminfo.size(); i++) + for(uint32_t i = 0; i < meminfo.size(); i++) { delete meminfo[i]; } diff --git a/library/DFProcess-windows-SHM.cpp b/library/DFProcess-windows-SHM.cpp index fb1635061..5a61fae55 100644 --- a/library/DFProcess-windows-SHM.cpp +++ b/library/DFProcess-windows-SHM.cpp @@ -354,7 +354,7 @@ bool SHMProcess::Private::validate(vector & known_versions) { pe_timestamp = (*it)->getHexValue("pe_timestamp"); } - catch(Error::MissingMemoryDefinition& e) + catch(Error::MissingMemoryDefinition&) { continue; } diff --git a/library/DFProcess-windows.cpp b/library/DFProcess-windows.cpp index 271bf191c..4ab8fb7f0 100644 --- a/library/DFProcess-windows.cpp +++ b/library/DFProcess-windows.cpp @@ -97,7 +97,7 @@ NormalProcess::NormalProcess(uint32_t pid, vector & known_versio { pe_timestamp = (*it)->getHexValue("pe_timestamp"); } - catch(Error::MissingMemoryDefinition& e) + catch(Error::MissingMemoryDefinition&) { continue; } diff --git a/precompiled/linux/libdfconnect.so b/precompiled/linux/libdfconnect.so index 51f0e949a..98aaad1d0 100755 Binary files a/precompiled/linux/libdfconnect.so and b/precompiled/linux/libdfconnect.so differ diff --git a/precompiled/windows/SDL.dll b/precompiled/windows/SDL.dll index d6c94edb8..61db5a270 100644 Binary files a/precompiled/windows/SDL.dll and b/precompiled/windows/SDL.dll differ