diff --git a/library/Console-windows.cpp b/library/Console-windows.cpp index ea90979e7..7e5a232df 100644 --- a/library/Console-windows.cpp +++ b/library/Console-windows.cpp @@ -42,7 +42,7 @@ distribution. using namespace DFHack; // FIXME: maybe make configurable with an ini option? -#define MAX_CONSOLE_LINES 250; +#define MAX_CONSOLE_LINES 999; duthomhas::stdiostream dfout; FILE * dfout_C = 0; diff --git a/library/Core.cpp b/library/Core.cpp index e1a961fd0..505676822 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -73,10 +73,13 @@ static int getdir (string dir, vector &files) int fIOthread(void * _core) { Core * core = (Core *) _core; + #ifdef LINUX_BUILD string path = core->p->getPath() + "/plugins/"; + const char * searchstr = ".plug.so"; #else string path = core->p->getPath() + "\\plugins\\"; + const char * searchstr = ".plug.dll"; #endif vector filez; @@ -86,7 +89,7 @@ int fIOthread(void * _core) int (*_PlugRun)(Core *) = 0; for(int i = 0; i < filez.size();i++) { - if(strstr(filez[i].c_str(),".plug.")) + if(strstr(filez[i].c_str(),searchstr)) { string fullpath = path + filez[i]; DFLibrary * plug = OpenPlugin(fullpath.c_str()); diff --git a/plugins/prospector.cpp b/plugins/prospector.cpp index 6439c5a4e..aaef2f96e 100644 --- a/plugins/prospector.cpp +++ b/plugins/prospector.cpp @@ -17,6 +17,7 @@ using namespace std; #include #include #include +#include typedef std::map MatMap; typedef std::vector< pair > MatSorter; @@ -92,15 +93,15 @@ void printMats(MatMap &mat, std::vector &materials) { if(it->first >= materials.size()) { - cerr << "Bad index: " << it->first << " out of " << materials.size() << endl; + dfout << "Bad index: " << it->first << " out of " << materials.size() << endl; continue; } DFHack::t_matgloss mat = materials[it->first]; - std::cout << std::setw(25) << mat.id << " : " << it->second << std::endl; + dfout << std::setw(25) << mat.id << " : " << it->second << std::endl; total += it->second; } - std::cout << ">>> TOTAL = " << total << std::endl << std::endl; + dfout << ">>> TOTAL = " << total << std::endl << std::endl; } DFhackCExport const char * plugin_name ( void ) @@ -125,7 +126,7 @@ DFhackCExport int plugin_run (DFHack::Core * c) DFHack::Maps *maps = c->getMaps(); if (!maps->Start()) { - std::cerr << "Cannot get map info!" << std::endl; + dfout << "Cannot get map info!" << std::endl; c->Resume(); return 1; } @@ -135,13 +136,13 @@ DFhackCExport int plugin_run (DFHack::Core * c) DFHack::Materials *mats = c->getMaterials(); if (!mats->ReadInorganicMaterials()) { - std::cerr << "Unable to read inorganic material definitons!" << std::endl; + dfout << "Unable to read inorganic material definitons!" << std::endl; c->Resume(); return 1; } if (showPlants && !mats->ReadOrganicMaterials()) { - std::cerr << "Unable to read organic material definitons; plants won't be listed!" << std::endl; + dfout << "Unable to read organic material definitons; plants won't be listed!" << std::endl; showPlants = false; } @@ -161,21 +162,21 @@ DFhackCExport int plugin_run (DFHack::Core * c) if (!(showSlade && maps->ReadGlobalFeatures(globalFeatures))) { - std::cerr << "Unable to read global features; slade won't be listed!" << std::endl; + dfout << "Unable to read global features; slade won't be listed!" << std::endl; } if (!maps->ReadLocalFeatures(localFeatures)) { - std::cerr << "Unable to read local features; adamantine " - << (showTemple ? "and demon temples " : "") - << "won't be listed!" << std::endl; + dfout << "Unable to read local features; adamantine " + << (showTemple ? "and demon temples " : "") + << "won't be listed!" << std::endl; } uint32_t vegCount = 0; DFHack::Vegetation *veg = c->getVegetation(); if (showPlants && !veg->Start()) { - std::cerr << "Unable to read vegetation; plants won't be listed!" << std::endl; + dfout << "Unable to read vegetation; plants won't be listed!" << std::endl; } for(uint32_t z = 0; z < z_max; z++) @@ -244,7 +245,7 @@ DFhackCExport int plugin_run (DFHack::Core * c) if (!info) { - std::cerr << "Bad type: " << type << std::endl; + dfout << "Bad type: " << type << std::endl; continue; } @@ -333,39 +334,39 @@ DFhackCExport int plugin_run (DFHack::Core * c) MatMap::const_iterator it; - std::cout << "Base materials:" << std::endl; + dfout << "Base materials:" << std::endl; for (it = baseMats.begin(); it != baseMats.end(); ++it) { - std::cout << std::setw(25) << DFHack::TileMaterialString[it->first] << " : " << it->second << std::endl; + dfout << std::setw(25) << DFHack::TileMaterialString[it->first] << " : " << it->second << std::endl; } - std::cout << std::endl << "Layer materials:" << std::endl; + dfout << std::endl << "Layer materials:" << std::endl; printMats(layerMats, mats->inorganic); - std::cout << "Vein materials:" << std::endl; + dfout << "Vein materials:" << std::endl; printMats(veinMats, mats->inorganic); if (showPlants) { - std::cout << "Shrubs:" << std::endl; + dfout << "Shrubs:" << std::endl; printMats(plantMats, mats->organic); - std::cout << "Wood in trees:" << std::endl; + dfout << "Wood in trees:" << std::endl; printMats(treeMats, mats->organic); } if (hasAquifer) { - std::cout << "Has aquifer" << std::endl; + dfout << "Has aquifer" << std::endl; } if (hasDemonTemple) { - std::cout << "Has demon temple" << std::endl; + dfout << "Has demon temple" << std::endl; } if (hasLair) { - std::cout << "Has lair" << std::endl; + dfout << "Has lair" << std::endl; } // Cleanup @@ -376,6 +377,6 @@ DFhackCExport int plugin_run (DFHack::Core * c) mats->Finish(); maps->Finish(); c->Resume(); - std::cout << std::endl; + dfout << std::endl; return 0; }