diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index e55a130dd..f24e21fd3 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -13,54 +13,52 @@ include_directories (include) include_directories (depends/md5) include_directories (depends/tinyxml) include_directories (depends/tthread) -include_directories (private) -execute_process(COMMAND perl xml/list.pl xml include/dfhack/df ";" +execute_process(COMMAND perl xml/list.pl xml include/df ";" WORKING_DIRECTORY ${dfapi_SOURCE_DIR} OUTPUT_VARIABLE GENERATED_HDRS) SET(PROJECT_HDRS_INTERNAL - private/ContextShared.h - private/Internal.h - private/wdirent.h ) SET(PROJECT_HDRS +include/Internal.h include/DFHack.h -include/dfhack/Console.h -include/dfhack/Core.h -include/dfhack/DataDefs.h -include/dfhack/Error.h -include/dfhack/Export.h -include/dfhack/FakeSDL.h -include/dfhack/MiscUtils.h -include/dfhack/Module.h -include/dfhack/Pragma.h -include/dfhack/Process.h -include/dfhack/TileTypes.h -include/dfhack/Types.h -include/dfhack/Vector.h -include/dfhack/VersionInfo.h -include/dfhack/VersionInfoFactory.h -include/dfhack/Virtual.h -include/dfhack/extra/MapExtras.h -include/dfhack/extra/stopwatch.h -include/dfhack/extra/termutil.h -include/dfhack/modules/Buildings.h -include/dfhack/modules/Constructions.h -include/dfhack/modules/Units.h -include/dfhack/modules/Engravings.h -include/dfhack/modules/Gui.h -include/dfhack/modules/Items.h -include/dfhack/modules/kitchen.h -include/dfhack/modules/Maps.h -include/dfhack/modules/Materials.h -include/dfhack/modules/Notes.h -include/dfhack/modules/Translation.h -include/dfhack/modules/Vegetation.h -include/dfhack/modules/Vermin.h -include/dfhack/modules/World.h -include/dfhack/modules/Graphic.h +include/Console.h +include/Core.h +include/DataDefs.h +include/Error.h +include/Export.h +include/Hooks.h +include/MiscUtils.h +include/Module.h +include/Pragma.h +include/MemAccess.h +include/SDL_events.h +include/SDL_keyboard.h +include/SDL_keysym.h +include/TileTypes.h +include/Types.h +include/Vector.h +include/VersionInfo.h +include/VersionInfoFactory.h +include/Virtual.h +include/modules/Buildings.h +include/modules/Constructions.h +include/modules/Units.h +include/modules/Engravings.h +include/modules/Gui.h +include/modules/Items.h +include/modules/kitchen.h +include/modules/Maps.h +include/modules/MapCache.h +include/modules/Materials.h +include/modules/Notes.h +include/modules/Translation.h +include/modules/Vegetation.h +include/modules/Vermin.h +include/modules/World.h +include/modules/Graphic.h ) SET(PROJECT_SRCS @@ -68,6 +66,7 @@ Core.cpp DataDefs.cpp DataStatics.cpp DataStaticsCtor.cpp +MiscUtils.cpp PluginManager.cpp TileTypes.cpp VersionInfo.cpp @@ -105,17 +104,18 @@ SET(PROJECT_HDRS_LINUX ) SET(PROJECT_HDRS_WINDOWS +include/wdirent.h ) SET(PROJECT_SRCS_LINUX Console-linux.cpp -FakeSDL-linux.cpp +Hooks-linux.cpp Process-linux.cpp ) SET(PROJECT_SRCS_WINDOWS Console-windows.cpp -FakeSDL-windows.cpp +Hooks-windows.cpp Process-windows.cpp ) @@ -139,14 +139,14 @@ FILE(GLOB GENERATE_INPUT_SCRIPTS ${dfapi_SOURCE_DIR}/xml/*.pm ${dfapi_SOURCE_DIR FILE(GLOB GENERATE_INPUT_XMLS ${dfapi_SOURCE_DIR}/xml/*.xml) ADD_CUSTOM_COMMAND( - OUTPUT ${dfapi_SOURCE_DIR}/include/dfhack/df/static.inc - COMMAND perl xml/codegen.pl xml include/dfhack/df + OUTPUT ${dfapi_SOURCE_DIR}/include/df/static.inc + COMMAND perl xml/codegen.pl xml include/df WORKING_DIRECTORY ${dfapi_SOURCE_DIR} MAIN_DEPENDENCY ${dfapi_SOURCE_DIR}/xml/codegen.pl DEPENDS ${GENERATE_INPUT_XMLS} ${GENERATE_INPUT_SCRIPTS} ) -ADD_CUSTOM_TARGET(generate_headers DEPENDS ${dfapi_SOURCE_DIR}/include/dfhack/df/static.inc) +ADD_CUSTOM_TARGET(generate_headers DEPENDS ${dfapi_SOURCE_DIR}/include/df/static.inc) # Compilation diff --git a/library/Console-linux.cpp b/library/Console-linux.cpp index e15a6e9cb..c1bea16d6 100644 --- a/library/Console-linux.cpp +++ b/library/Console-linux.cpp @@ -61,8 +61,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include -#include "dfhack/Console.h" -#include "dfhack/FakeSDL.h" +#include "Console.h" +#include "Hooks.h" using namespace DFHack; #include "tinythread.h" diff --git a/library/Console-windows.cpp b/library/Console-windows.cpp index 4daab5c2f..de2c2aca8 100644 --- a/library/Console-windows.cpp +++ b/library/Console-windows.cpp @@ -50,8 +50,8 @@ POSSIBILITY OF SUCH DAMAGE. #include #include -#include "dfhack/Console.h" -#include "dfhack/FakeSDL.h" +#include "Console.h" +#include "Hooks.h" #include #include #include diff --git a/library/Core.cpp b/library/Core.cpp index 938b875e6..f8af357cf 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -34,28 +34,28 @@ distribution. #include using namespace std; -#include "dfhack/Error.h" -#include "dfhack/Process.h" -#include "dfhack/Core.h" -#include "dfhack/DataDefs.h" -#include "dfhack/Console.h" -#include "dfhack/Module.h" -#include "dfhack/VersionInfoFactory.h" -#include "dfhack/VersionInfo.h" -#include "dfhack/PluginManager.h" +#include "Error.h" +#include "MemAccess.h" +#include "Core.h" +#include "DataDefs.h" +#include "Console.h" +#include "Module.h" +#include "VersionInfoFactory.h" +#include "VersionInfo.h" +#include "PluginManager.h" #include "ModuleFactory.h" -#include "dfhack/modules/Gui.h" -#include "dfhack/modules/World.h" -#include "dfhack/modules/Graphic.h" +#include "modules/Gui.h" +#include "modules/World.h" +#include "modules/Graphic.h" using namespace DFHack; -#include "dfhack/SDL_fakes/events.h" +#include "SDL_events.h" -#include "dfhack/df/ui.h" -#include "dfhack/df/world.h" -#include "dfhack/df/world_data.h" -#include "dfhack/df/interface.h" -#include "dfhack/df/viewscreen_dwarfmodest.h" +#include "df/ui.h" +#include "df/world.h" +#include "df/world_data.h" +#include "df/interface.h" +#include "df/viewscreen_dwarfmodest.h" #include #include diff --git a/library/DataDefs.cpp b/library/DataDefs.cpp index 0693459ed..772b3393d 100644 --- a/library/DataDefs.cpp +++ b/library/DataDefs.cpp @@ -28,12 +28,12 @@ distribution. #include #include -#include "dfhack/Process.h" -#include "dfhack/Core.h" -#include "dfhack/VersionInfo.h" +#include "MemAccess.h" +#include "Core.h" +#include "VersionInfo.h" #include "tinythread.h" // must be last due to MS stupidity -#include "dfhack/DataDefs.h" +#include "DataDefs.h" using namespace DFHack; diff --git a/library/DataStatics.cpp b/library/DataStatics.cpp index 28a4de0f8..f47c0fe05 100644 --- a/library/DataStatics.cpp +++ b/library/DataStatics.cpp @@ -1,10 +1,10 @@ #include "Internal.h" -#include "dfhack/DataDefs.h" -#include "dfhack/MiscUtils.h" +#include "DataDefs.h" +#include "MiscUtils.h" -#include "dfhack/df/world.h" -#include "dfhack/df/world_data.h" -#include "dfhack/df/ui.h" +#include "df/world.h" +#include "df/world_data.h" +#include "df/ui.h" namespace { template @@ -14,5 +14,5 @@ namespace { } // Instantiate all the static objects -#include "dfhack/df/static.inc" -#include "dfhack/df/static.enums.inc" +#include "df/static.inc" +#include "df/static.enums.inc" diff --git a/library/DataStaticsCtor.cpp b/library/DataStaticsCtor.cpp index edd3092fb..2e4e84baa 100644 --- a/library/DataStaticsCtor.cpp +++ b/library/DataStaticsCtor.cpp @@ -1,6 +1,6 @@ #include "Internal.h" -#include "dfhack/DataDefs.h" -#include "dfhack/MiscUtils.h" +#include "DataDefs.h" +#include "MiscUtils.h" // Object constructors -#include "dfhack/df/static.ctors.inc" +#include "df/static.ctors.inc" diff --git a/library/FakeSDL-linux.cpp b/library/Hooks-linux.cpp similarity index 98% rename from library/FakeSDL-linux.cpp rename to library/Hooks-linux.cpp index 59ae1bbd4..69bb9f228 100644 --- a/library/FakeSDL-linux.cpp +++ b/library/Hooks-linux.cpp @@ -39,8 +39,8 @@ distribution. #include #include "DFHack.h" -#include "dfhack/Core.h" -#include "dfhack/FakeSDL.h" +#include "Core.h" +#include "Hooks.h" #include /* diff --git a/library/FakeSDL-windows.cpp b/library/Hooks-windows.cpp similarity index 99% rename from library/FakeSDL-windows.cpp rename to library/Hooks-windows.cpp index d388b75d5..51e197722 100644 --- a/library/FakeSDL-windows.cpp +++ b/library/Hooks-windows.cpp @@ -28,12 +28,12 @@ distribution. #include #include #include -#include "dfhack/Core.h" -#include "dfhack/FakeSDL.h" +#include "Core.h" +#include "Hooks.h" #include #include "tinythread.h" -#include "dfhack/modules/Graphic.h" +#include "modules/Graphic.h" /* * Plugin loading functions diff --git a/library/PluginManager.cpp b/library/PluginManager.cpp index a520575d8..29cc992b7 100644 --- a/library/PluginManager.cpp +++ b/library/PluginManager.cpp @@ -23,13 +23,13 @@ distribution. */ #include "Internal.h" -#include "dfhack/Core.h" -#include "dfhack/Process.h" -#include "dfhack/PluginManager.h" -#include "dfhack/Console.h" +#include "Core.h" +#include "MemAccess.h" +#include "PluginManager.h" +#include "Console.h" -#include "dfhack/DataDefs.h" -#include "dfhack/df/viewscreen.h" +#include "DataDefs.h" +#include "df/viewscreen.h" using namespace DFHack; @@ -278,7 +278,6 @@ command_result Plugin::invoke( std::string & command, std::vector for (int i = 0; i < commands.size();i++) { PluginCommand &cmd = commands[i]; - if(cmd.name == command) { // running interactive things from some other source than the console would break it @@ -294,7 +293,7 @@ command_result Plugin::invoke( std::string & command, std::vector df::viewscreen *top = c.getTopViewscreen(); if ((cmd.viewscreen_type && !cmd.viewscreen_type->is_instance(top)) - || !cmd.guard(&c, top)) + || !cmd.guard(&c, top)) { c.con.printerr("Could not invoke %s: unsuitable UI state.\n", command.c_str()); cr = CR_FAILURE; diff --git a/library/Process-linux.cpp b/library/Process-linux.cpp index 5fc110cc2..ee64c2740 100644 --- a/library/Process-linux.cpp +++ b/library/Process-linux.cpp @@ -36,10 +36,10 @@ distribution. using namespace std; #include -#include "dfhack/Process.h" -#include "dfhack/VersionInfoFactory.h" -#include "dfhack/VersionInfo.h" -#include "dfhack/Error.h" +#include "MemAccess.h" +#include "VersionInfoFactory.h" +#include "VersionInfo.h" +#include "Error.h" #include using namespace DFHack; diff --git a/library/Process-windows.cpp b/library/Process-windows.cpp index 88b77891e..1fba8b28a 100644 --- a/library/Process-windows.cpp +++ b/library/Process-windows.cpp @@ -91,10 +91,10 @@ extern "C" __declspec(dllimport) NTSTATUS __stdcall RtlDestroyQueryDebugBuffer( #include using namespace std; -#include "dfhack/VersionInfo.h" -#include "dfhack/VersionInfoFactory.h" -#include "dfhack/Error.h" -#include "dfhack/Process.h" +#include "VersionInfo.h" +#include "VersionInfoFactory.h" +#include "Error.h" +#include "MemAccess.h" using namespace DFHack; namespace DFHack { diff --git a/library/TileTypes.cpp b/library/TileTypes.cpp index 295e269c6..31a82eb55 100644 --- a/library/TileTypes.cpp +++ b/library/TileTypes.cpp @@ -23,8 +23,8 @@ distribution. */ #include "Internal.h" -#include "dfhack/TileTypes.h" -#include "dfhack/Export.h" +#include "TileTypes.h" +#include "Export.h" namespace DFHack { diff --git a/library/VersionInfo.cpp b/library/VersionInfo.cpp index 8403364a0..0f0764d60 100644 --- a/library/VersionInfo.cpp +++ b/library/VersionInfo.cpp @@ -31,9 +31,9 @@ distribution. #include using namespace std; -#include "dfhack/VersionInfo.h" -#include "dfhack/Error.h" -#include "dfhack/Process.h" +#include "VersionInfo.h" +#include "Error.h" +#include "MemAccess.h" using namespace DFHack; //Inital amount of space in levels vector (since we usually know the number, efficient!) diff --git a/library/VersionInfoFactory.cpp b/library/VersionInfoFactory.cpp index b2ec00d96..bb8c7c533 100644 --- a/library/VersionInfoFactory.cpp +++ b/library/VersionInfoFactory.cpp @@ -31,9 +31,9 @@ distribution. #include using namespace std; -#include "dfhack/VersionInfoFactory.h" -#include "dfhack/VersionInfo.h" -#include "dfhack/Error.h" +#include "VersionInfoFactory.h" +#include "VersionInfo.h" +#include "Error.h" using namespace DFHack; #include diff --git a/library/Virtual.cpp b/library/Virtual.cpp index bafdc0cc5..6706f93be 100644 --- a/library/Virtual.cpp +++ b/library/Virtual.cpp @@ -4,9 +4,9 @@ #include #include -#include "dfhack/Process.h" -#include "dfhack/Core.h" -#include "dfhack/Virtual.h" +#include "MemAccess.h" +#include "Core.h" +#include "Virtual.h" using namespace DFHack; std::string t_virtual::getClassName() const diff --git a/library/include/dfhack/BitArray.h b/library/include/BitArray.h similarity index 98% rename from library/include/dfhack/BitArray.h rename to library/include/BitArray.h index 7e4b8a915..77e2a3ac1 100644 --- a/library/include/dfhack/BitArray.h +++ b/library/include/BitArray.h @@ -23,8 +23,8 @@ distribution. */ #pragma once -#include "dfhack/Pragma.h" -#include "dfhack/Export.h" +#include "Pragma.h" +#include "Export.h" #include #include #include diff --git a/library/include/dfhack/Console.h b/library/include/Console.h similarity index 98% rename from library/include/dfhack/Console.h rename to library/include/Console.h index e4e2c44f7..70385d829 100644 --- a/library/include/dfhack/Console.h +++ b/library/include/Console.h @@ -23,8 +23,8 @@ distribution. */ #pragma once -#include "dfhack/Pragma.h" -#include "dfhack/Export.h" +#include "Pragma.h" +#include "Export.h" #include #include #include diff --git a/library/include/dfhack/Core.h b/library/include/Core.h similarity index 97% rename from library/include/dfhack/Core.h rename to library/include/Core.h index 427cdf048..53dbc3d8c 100644 --- a/library/include/dfhack/Core.h +++ b/library/include/Core.h @@ -24,15 +24,15 @@ distribution. #pragma once -#include "dfhack/Pragma.h" -#include "dfhack/Export.h" -#include "dfhack/FakeSDL.h" +#include "Pragma.h" +#include "Export.h" +#include "Hooks.h" #include #include #include #include -#include "dfhack/Console.h" -#include "dfhack/modules/Graphic.h" +#include "Console.h" +#include "modules/Graphic.h" struct WINDOW; diff --git a/library/include/DFHack.h b/library/include/DFHack.h index 938decbc8..ac5d78cf0 100644 --- a/library/include/DFHack.h +++ b/library/include/DFHack.h @@ -47,34 +47,34 @@ distribution. #include // DFHack core classes and types -#include "dfhack/Error.h" -#include "dfhack/VersionInfo.h" -#include "dfhack/Process.h" -#include "dfhack/Types.h" +#include "Error.h" +#include "VersionInfo.h" +#include "MemAccess.h" +#include "Types.h" // DFHack modules -#include "dfhack/modules/Buildings.h" -#include "dfhack/modules/Engravings.h" -#include "dfhack/modules/Materials.h" -#include "dfhack/modules/Constructions.h" -#include "dfhack/modules/Units.h" -#include "dfhack/modules/Translation.h" -#include "dfhack/modules/World.h" -#include "dfhack/modules/Items.h" -#include "dfhack/modules/Vegetation.h" -#include "dfhack/modules/Maps.h" -#include "dfhack/modules/Gui.h" +#include "modules/Buildings.h" +#include "modules/Engravings.h" +#include "modules/Materials.h" +#include "modules/Constructions.h" +#include "modules/Units.h" +#include "modules/Translation.h" +#include "modules/World.h" +#include "modules/Items.h" +#include "modules/Vegetation.h" +#include "modules/Maps.h" +#include "modules/Gui.h" /* * This is a header full of ugly, volatile things. * Only for use of official DFHack tools! */ #ifdef DFHACK_WANT_MISCUTILS - #include "dfhack/MiscUtils.h" + #include "MiscUtils.h" #endif // define this to get the static tiletype->properties mapping #ifdef DFHACK_WANT_TILETYPES - #include "dfhack/TileTypes.h" + #include "TileTypes.h" #endif #endif diff --git a/library/include/dfhack/DataDefs.h b/library/include/DataDefs.h similarity index 99% rename from library/include/dfhack/DataDefs.h rename to library/include/DataDefs.h index 02014a057..f6781526c 100644 --- a/library/include/dfhack/DataDefs.h +++ b/library/include/DataDefs.h @@ -28,8 +28,8 @@ distribution. #include #include -#include "dfhack/Core.h" -#include "dfhack/BitArray.h" +#include "Core.h" +#include "BitArray.h" // Stop some MS stupidity #ifdef interface diff --git a/library/include/dfhack/Error.h b/library/include/Error.h similarity index 99% rename from library/include/dfhack/Error.h rename to library/include/Error.h index 946cc2d4c..1a25d1cbb 100644 --- a/library/include/dfhack/Error.h +++ b/library/include/Error.h @@ -27,8 +27,8 @@ distribution. #ifndef ERROR_H_INCLUDED #define ERROR_H_INCLUDED -#include "dfhack/Export.h" -#include "dfhack/Pragma.h" +#include "Export.h" +#include "Pragma.h" #include #include #include diff --git a/library/include/dfhack/Export.h b/library/include/Export.h similarity index 100% rename from library/include/dfhack/Export.h rename to library/include/Export.h diff --git a/library/include/dfhack/FakeSDL.h b/library/include/Hooks.h similarity index 66% rename from library/include/dfhack/FakeSDL.h rename to library/include/Hooks.h index 0f3ced545..f01d58c07 100644 --- a/library/include/dfhack/FakeSDL.h +++ b/library/include/Hooks.h @@ -28,39 +28,20 @@ distribution. * Some much needed SDL fakery. */ -#include "dfhack/Pragma.h" -#include "dfhack/Export.h" +#include "Pragma.h" +#include "Export.h" #include #include // function and variable pointer... we don't try to understand what SDL does here - typedef void * fPtr; typedef void * vPtr; struct WINDOW; namespace SDL { union Event; - //struct Thread; - //struct Mutex; - //struct Cond; - //struct Library; } -/* -// mutex stuff -DFhackCExport SDL::Mutex * SDL_CreateMutex(void); -DFhackCExport int SDL_mutexP(SDL::Mutex *); -DFhackCExport int SDL_mutexV(SDL::Mutex *); -DFhackCExport void SDL_DestroyMutex(SDL::Mutex *); -// thread stuff -DFhackCExport SDL::Thread *SDL_CreateThread(int (*fn)(void *), void *data); -DFhackCExport uint32_t SDL_ThreadID(); -// condition variables -DFhackCExport SDL::Cond *SDL_CreateCond(void); -DFhackCExport void SDL_DestroyCond(SDL::Cond *cond); -DFhackCExport int SDL_CondSignal(SDL::Cond *cond); -DFhackCExport int SDL_CondWait(SDL::Cond *cond, SDL::Mutex * mut); -*/ + // these functions are here because they call into DFHack::Core and therefore need to // be declared as friend functions/known DFhackCExport int SDL_NumJoysticks(void); @@ -69,4 +50,3 @@ DFhackCExport int SDL_PollEvent(SDL::Event* event); DFhackCExport int SDL_Init(uint32_t flags); DFhackCExport int wgetch(WINDOW * win); -// Other crud is in the OS-specific core files. diff --git a/library/private/Internal.h b/library/include/Internal.h similarity index 90% rename from library/private/Internal.h rename to library/include/Internal.h index 34cc40901..12b7852a1 100644 --- a/library/private/Internal.h +++ b/library/include/Internal.h @@ -24,9 +24,6 @@ distribution. #pragma once -#ifndef DFCOMMONINTERNAL_H_INCLUDED -#define DFCOMMONINTERNAL_H_INCLUDED - // this makes everything that includes this file export symbols when using DFHACK_EXPORT (see DFExport.h) #ifndef BUILD_DFHACK_LIB #define BUILD_DFHACK_LIB @@ -38,10 +35,7 @@ distribution. #endif // one file for telling the MSVC compiler where it can shove its pointless warnings -#include "dfhack/Pragma.h" +#include "Pragma.h" // C99 integer types #include - -#endif // DFCOMMONINTERNAL_H_INCLUDED - diff --git a/library/include/dfhack/Process.h b/library/include/MemAccess.h similarity index 99% rename from library/include/dfhack/Process.h rename to library/include/MemAccess.h index 1bd2b9710..7da132c8a 100644 --- a/library/include/dfhack/Process.h +++ b/library/include/MemAccess.h @@ -28,8 +28,8 @@ distribution. #ifndef PROCESS_H_INCLUDED #define PROCESS_H_INCLUDED -#include "dfhack/Pragma.h" -#include "dfhack/Export.h" +#include "Pragma.h" +#include "Export.h" #include #include #include diff --git a/library/include/MiscUtils.h b/library/include/MiscUtils.h new file mode 100644 index 000000000..833e74104 --- /dev/null +++ b/library/include/MiscUtils.h @@ -0,0 +1,104 @@ +/* +https://github.com/peterix/dfhack +Copyright (c) 2009-2011 Petr Mrázek (peterix@gmail.com) + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any +damages arising from the use of this software. + +Permission is granted to anyone to use this software for any +purpose, including commercial applications, and to alter it and +redistribute it freely, subject to the following restrictions: + +1. The origin of this software must not be misrepresented; you must +not claim that you wrote the original software. If you use this +software in a product, an acknowledgment in the product documentation +would be appreciated but is not required. + +2. Altered source versions must be plainly marked as such, and +must not be misrepresented as being the original software. + +3. This notice may not be removed or altered from any source +distribution. +*/ + +#pragma once +#include "Export.h" +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +template +void print_bits ( T val, DFHack::Console& out ) +{ + stringstream strs; + T n_bits = sizeof ( val ) * CHAR_BIT; + int cnt; + for ( unsigned i = 0; i < n_bits; ++i ) + { + cnt = i/10; + strs << cnt << " "; + } + strs << endl; + for ( unsigned i = 0; i < n_bits; ++i ) + { + cnt = i%10; + strs << cnt << " "; + } + strs << endl; + for ( unsigned i = 0; i < n_bits; ++i ) + { + strs << "--"; + } + strs << endl; + for ( unsigned i = 0; i < n_bits; ++i ) + { + strs<< !!( val & 1 ) << " "; + val >>= 1; + } + strs << endl; + out.print(strs.str().c_str()); +} + +//FIXME: Error 8 error C4519: default template arguments are only allowed on a class template +template +CT *binsearch_in_vector(std::vector &vec, FT CT::*field, AT value) +{ + int min = -1, max = (int)vec.size(); + CT **p = vec.data(); + FT key = (FT)value; + for (;;) + { + int mid = (min + max)>>1; + if (mid == min) + { + return NULL; + } + FT midv = p[mid]->*field; + if (midv == key) + { + return p[mid]; + } + else if (midv < key) + { + min = mid; + } + else + { + max = mid; + } + } +} + +/** + * Returns the amount of milliseconds elapsed since the UNIX epoch. + * Works on both windows and linux. + * source: http://stackoverflow.com/questions/1861294/how-to-calculate-execution-time-of-a-code-snippet-in-c + */ +DFHACK_EXPORT uint64_t GetTimeMs64(); diff --git a/library/include/dfhack/Module.h b/library/include/Module.h similarity index 98% rename from library/include/dfhack/Module.h rename to library/include/Module.h index c583ab17c..7433fce49 100644 --- a/library/include/dfhack/Module.h +++ b/library/include/Module.h @@ -27,7 +27,7 @@ distribution. #ifndef MODULE_H_INCLUDED #define MODULE_H_INCLUDED -#include "dfhack/Export.h" +#include "Export.h" namespace DFHack { /** diff --git a/library/private/ModuleFactory.h b/library/include/ModuleFactory.h similarity index 100% rename from library/private/ModuleFactory.h rename to library/include/ModuleFactory.h diff --git a/library/include/dfhack/PluginManager.h b/library/include/PluginManager.h similarity index 99% rename from library/include/dfhack/PluginManager.h rename to library/include/PluginManager.h index 3bea5977e..4d5319dfd 100644 --- a/library/include/dfhack/PluginManager.h +++ b/library/include/PluginManager.h @@ -24,11 +24,11 @@ distribution. #pragma once -#include "dfhack/Export.h" +#include "Export.h" +#include "Hooks.h" #include #include #include -#include "FakeSDL.h" struct DFLibrary; namespace tthread { diff --git a/library/include/dfhack/Pragma.h b/library/include/Pragma.h similarity index 100% rename from library/include/dfhack/Pragma.h rename to library/include/Pragma.h diff --git a/library/include/dfhack/SDL_fakes/events.h b/library/include/SDL_events.h similarity index 99% rename from library/include/dfhack/SDL_fakes/events.h rename to library/include/SDL_events.h index b8b8b1eb6..0457dbca1 100644 --- a/library/include/dfhack/SDL_fakes/events.h +++ b/library/include/SDL_events.h @@ -24,7 +24,7 @@ // Needed for processing its event types without polluting our namespaces with C garbage #pragma once -#include "keyboard.h" +#include "SDL_keyboard.h" namespace SDL { diff --git a/library/include/dfhack/SDL_fakes/keyboard.h b/library/include/SDL_keyboard.h similarity index 98% rename from library/include/dfhack/SDL_fakes/keyboard.h rename to library/include/SDL_keyboard.h index a49cf2517..f0d325f57 100644 --- a/library/include/dfhack/SDL_fakes/keyboard.h +++ b/library/include/SDL_keyboard.h @@ -24,7 +24,7 @@ // Needed for processing its event types without polluting our namespaces with C garbage #pragma once -#include "keysym.h" +#include "SDL_keysym.h" #include namespace SDL diff --git a/library/include/dfhack/SDL_fakes/keysym.h b/library/include/SDL_keysym.h similarity index 100% rename from library/include/dfhack/SDL_fakes/keysym.h rename to library/include/SDL_keysym.h diff --git a/library/include/dfhack/TileTypes.h b/library/include/TileTypes.h similarity index 99% rename from library/include/dfhack/TileTypes.h rename to library/include/TileTypes.h index 0fba4a696..8fe53a74e 100644 --- a/library/include/dfhack/TileTypes.h +++ b/library/include/TileTypes.h @@ -27,8 +27,8 @@ distribution. #ifndef TILETYPES_H_INCLUDED #define TILETYPES_H_INCLUDED -#include "dfhack/Pragma.h" -#include "dfhack/Export.h" +#include "Pragma.h" +#include "Export.h" namespace DFHack { diff --git a/library/include/dfhack/Types.h b/library/include/Types.h similarity index 97% rename from library/include/dfhack/Types.h rename to library/include/Types.h index 2ec35692f..9ebae4c73 100644 --- a/library/include/dfhack/Types.h +++ b/library/include/Types.h @@ -25,8 +25,8 @@ distribution. #pragma once -#include "dfhack/Pragma.h" -#include "dfhack/Export.h" +#include "Pragma.h" +#include "Export.h" namespace DFHack { diff --git a/library/include/dfhack/Vector.h b/library/include/Vector.h similarity index 95% rename from library/include/dfhack/Vector.h rename to library/include/Vector.h index ec5840a0f..4ba9dd152 100644 --- a/library/include/dfhack/Vector.h +++ b/library/include/Vector.h @@ -28,10 +28,10 @@ distribution. #ifndef DFVECTOR_H_INCLUDED #define DFVECTOR_H_INCLUDED -#include "dfhack/Pragma.h" -#include "dfhack/Export.h" -#include "dfhack/VersionInfo.h" -#include "dfhack/Process.h" +#include "Pragma.h" +#include "Export.h" +#include "VersionInfo.h" +#include "MemAccess.h" #include #include diff --git a/library/include/dfhack/VersionInfo.h b/library/include/VersionInfo.h similarity index 98% rename from library/include/dfhack/VersionInfo.h rename to library/include/VersionInfo.h index 9d13c5dab..47c9ba211 100644 --- a/library/include/dfhack/VersionInfo.h +++ b/library/include/VersionInfo.h @@ -28,9 +28,9 @@ distribution. #ifndef MEMINFO_H_INCLUDED #define MEMINFO_H_INCLUDED -#include "dfhack/Pragma.h" -#include "dfhack/Export.h" -#include "dfhack/Types.h" +#include "Pragma.h" +#include "Export.h" +#include "Types.h" #include #include #include diff --git a/library/include/dfhack/VersionInfoFactory.h b/library/include/VersionInfoFactory.h similarity index 97% rename from library/include/dfhack/VersionInfoFactory.h rename to library/include/VersionInfoFactory.h index 0803a2c7f..acfa36bd3 100644 --- a/library/include/dfhack/VersionInfoFactory.h +++ b/library/include/VersionInfoFactory.h @@ -28,8 +28,8 @@ distribution. #ifndef MEMINFO_MANAGER_H_INCLUDED #define MEMINFO_MANAGER_H_INCLUDED -#include "dfhack/Pragma.h" -#include "dfhack/Export.h" +#include "Pragma.h" +#include "Export.h" class TiXmlElement; namespace DFHack diff --git a/library/include/dfhack/Virtual.h b/library/include/Virtual.h similarity index 100% rename from library/include/dfhack/Virtual.h rename to library/include/Virtual.h diff --git a/library/include/dfhack/df/.gitignore b/library/include/df/.gitignore similarity index 100% rename from library/include/dfhack/df/.gitignore rename to library/include/df/.gitignore diff --git a/library/include/dfhack/MiscUtils.h b/library/include/dfhack/MiscUtils.h deleted file mode 100644 index adae44377..000000000 --- a/library/include/dfhack/MiscUtils.h +++ /dev/null @@ -1,269 +0,0 @@ -/* -https://github.com/peterix/dfhack -Copyright (c) 2009-2011 Petr Mrázek (peterix@gmail.com) - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. -*/ - -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace std; -/* -#include -#include -#include - -void DumpObjStr0Vector (const char * name, DFHack::Process *p, uint32_t addr) -{ - cout << "----==== " << name << " ====----" << endl; - DFHack::DfVector vect(p,addr); - for(uint32_t i = 0; i < vect.size();i++) - { - uint32_t addr = vect[i]; - cout << p->readSTLString(addr) << endl; - } - cout << endl; -} -void DumpObjVtables (const char * name, DFHack::Process *p, uint32_t addr) -{ - cout << "----==== " << name << " ====----" << endl; - DFHack::DfVector vect(p,addr); - for(uint32_t i = 0; i < vect.size();i++) - { - uint32_t addr = vect[i]; - uint32_t vptr = p->readDWord(addr); - cout << p->readClassName(vptr) << endl; - } - cout << endl; -} -void DumpDWordVector (const char * name, DFHack::Process *p, uint32_t addr) -{ - cout << "----==== " << name << " ====----" << endl; - DFHack::DfVector vect(p,addr); - for(uint32_t i = 0; i < vect.size();i++) - { - uint32_t number = vect[i]; - cout << number << endl; - } - cout << endl; -} -*/ -/* -address = absolute address of dump start -length = length in lines. 1 line = 16 bytes -*/ -/* -void hexdump (DFHack::Context *DF, uint32_t address, uint32_t length) -{ - char *buf = new char[length]; - DF->ReadRaw(address, length, (uint8_t *) buf); - uint32_t i = 0; - while (i < length) - { - // leading offset - if(i%16 == 0) - cout << "0x" << hex << setw(8) << address + i << "| "; - // bytes - for(int k = 0; k < 4; k++) - { - cout << hex << setw(2) << int(static_cast(buf[i])) << " "; - i++; - if(i == length) break; - } - if(i%16 == 0 || i>= length) - { - cout << endl; - } - else if(i%4 == 0) - { - cout << " "; - } - } - delete buf; -} - -void interleave_hex (DFHack::Context* DF, vector < uint32_t > & addresses, uint32_t length) -{ - vector bufs; - - for(uint32_t counter = 0; counter < addresses.size(); counter ++) - { - char * buf = new char[length * 16]; - DF->ReadRaw(addresses[counter], length * 16, (uint8_t *) buf); - bufs.push_back(buf); - } - cout << setfill('0'); - - // output a header - cout << "line offset "; - for (uint32_t obj = 0; obj < addresses.size(); obj++) - { - cout << "0x" << hex << setw(9) << addresses[obj] << " "; - } - cout << endl; - - for(uint32_t offs = 0 ; offs < length * 16; offs += 4) - { - if((!(offs % 16)) && offs != 0) - { - cout << endl; - } - cout << setfill(' '); - cout << dec << setw(4) << offs/4 << " "; - cout << setfill('0'); - cout << "0x" << hex << setw(4) << offs << " "; - for (uint32_t object = 0; object < bufs.size(); object++) - { - // bytes - for(int k = 0; k < 4; k++) - { - uint8_t data = bufs[object][offs + k]; - cout << hex << setw(2) << int(static_cast(data)) << " "; - } - cout << " "; - } - cout << endl; - } - for(uint32_t counter = 0; counter < addresses.size(); counter ++) - { - delete bufs[counter]; - } -} -*/ -template -void print_bits ( T val, DFHack::Console& out ) -{ - stringstream strs; - T n_bits = sizeof ( val ) * CHAR_BIT; - int cnt; - for ( unsigned i = 0; i < n_bits; ++i ) - { - cnt = i/10; - strs << cnt << " "; - } - strs << endl; - for ( unsigned i = 0; i < n_bits; ++i ) - { - cnt = i%10; - strs << cnt << " "; - } - strs << endl; - for ( unsigned i = 0; i < n_bits; ++i ) - { - strs << "--"; - } - strs << endl; - for ( unsigned i = 0; i < n_bits; ++i ) - { - strs<< !!( val & 1 ) << " "; - val >>= 1; - } - strs << endl; - out.print(strs.str().c_str()); -} - -/* -// this is probably completely bogus -std::string PrintSplatterType (int16_t mat1, int32_t mat2, vector &creature_types) -{ - std::string ret; - switch (mat1) - { - case 0: - return "Rock"; - case 1: - return "Amber"; - case 2: - return "Coral"; - case 3: - return "Green Glass"; - case 4: - return "Clear Glass"; - case 5: - return "Crystal Glass"; - case 6: - return "Water"; - case 7: - return "Coal"; - case 8: - return "Potash"; - case 9: - return "Ash"; - case 10: - return "Pearlash"; - case 11: - return "Lye"; - case 12: - return "Mud"; - case 13: - return "Vomit"; - case 14: - return "Salt"; - case 15: - return "Filth"; - case 16: - return "Frozen? Filth"; - case 18: - return "Grime"; - case 0xF2: - return "Very Specific Blood (references a named creature)"; - case 0x2A: - case 0x2B: - if(mat2 != -1) - { - ret += creature_types[mat2].id; - ret += " "; - } - ret += "Blood"; - return ret; - default: - return "Unknown"; - } -} -*/ - -//FIXME: Error 8 error C4519: default template arguments are only allowed on a class template -template -CT *binsearch_in_vector(std::vector &vec, FT CT::*field, AT value) { - int min = -1, max = (int)vec.size(); - CT **p = vec.data(); - FT key = (FT)value; - for (;;) { - int mid = (min + max)>>1; - if (mid == min) - return NULL; - FT midv = p[mid]->*field; - if (midv == key) - return p[mid]; - else if (midv < key) - min = mid; - else - max = mid; - } -} diff --git a/library/include/dfhack/extra/stopwatch.h b/library/include/dfhack/extra/stopwatch.h deleted file mode 100644 index 5ef7d11a8..000000000 --- a/library/include/dfhack/extra/stopwatch.h +++ /dev/null @@ -1,47 +0,0 @@ -// Returns the amount of milliseconds elapsed since the UNIX epoch. -// Works on both windows and linux. -// source: http://stackoverflow.com/questions/1861294/how-to-calculate-execution-time-of-a-code-snippet-in-c - -#ifndef LINUX_BUILD - #include -#else - #include - #include -#endif - -#ifdef LINUX_BUILD // Linux -uint64_t GetTimeMs64() -{ - struct timeval tv; - gettimeofday(&tv, NULL); - uint64_t ret = tv.tv_usec; - - // Convert from micro seconds (10^-6) to milliseconds (10^-3) - ret /= 1000; - // Adds the seconds (10^0) after converting them to milliseconds (10^-3) - ret += (tv.tv_sec * 1000); - return ret; -} - - -#else // Windows -uint64_t GetTimeMs64() -{ - FILETIME ft; - LARGE_INTEGER li; - - // Get the amount of 100 nano seconds intervals elapsed since January 1, 1601 (UTC) - // and copy it to a LARGE_INTEGER structure. - GetSystemTimeAsFileTime(&ft); - li.LowPart = ft.dwLowDateTime; - li.HighPart = ft.dwHighDateTime; - - uint64_t ret = li.QuadPart; - // Convert from file time to UNIX epoch time. - ret -= 116444736000000000LL; - // From 100 nano seconds (10^-7) to 1 millisecond (10^-3) intervals - ret /= 10000; - - return ret; -} -#endif diff --git a/library/include/dfhack/extra/termutil.h b/library/include/dfhack/extra/termutil.h deleted file mode 100644 index 702e6ba5b..000000000 --- a/library/include/dfhack/extra/termutil.h +++ /dev/null @@ -1,54 +0,0 @@ -/* -https://github.com/peterix/dfhack -Copyright (c) 2009-2011 Petr Mrázek (peterix@gmail.com) - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. -*/ -#pragma once - -#ifndef TERMUTIL_H -#define TERMUTIL_H - -#ifdef LINUX_BUILD -// FIXME: is this ever true? -bool TemporaryTerminal () -{ - return false; -} -#else -#include -#include -#include -bool TemporaryTerminal () -{ - CONSOLE_SCREEN_BUFFER_INFO csbi; - HANDLE hStdOutput; - hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); - if (!GetConsoleScreenBufferInfo(hStdOutput, &csbi)) - { - printf("GetConsoleScreenBufferInfo failed: %d\n", GetLastError()); - return false; - } - return ((!csbi.dwCursorPosition.X) && (!csbi.dwCursorPosition.Y)); -}; - -#endif // LINUX_BUILD - -#endif \ No newline at end of file diff --git a/library/include/dfhack/modules/Buildings.h b/library/include/modules/Buildings.h similarity index 97% rename from library/include/dfhack/modules/Buildings.h rename to library/include/modules/Buildings.h index 112a4d927..330c151dc 100644 --- a/library/include/dfhack/modules/Buildings.h +++ b/library/include/modules/Buildings.h @@ -29,8 +29,8 @@ distribution. * \defgroup grp_buildings Building module parts - also includes zones and stockpiles * @ingroup grp_modules */ -#include "dfhack/Export.h" -#include "dfhack/Module.h" +#include "Export.h" +#include "Module.h" #ifdef __cplusplus namespace DFHack diff --git a/library/include/dfhack/modules/Constructions.h b/library/include/modules/Constructions.h similarity index 98% rename from library/include/dfhack/modules/Constructions.h rename to library/include/modules/Constructions.h index 046d8a074..c7cd693e8 100644 --- a/library/include/dfhack/modules/Constructions.h +++ b/library/include/modules/Constructions.h @@ -28,8 +28,8 @@ distribution. /* * DF constructions */ -#include "dfhack/Export.h" -#include "dfhack/Module.h" +#include "Export.h" +#include "Module.h" /** * \defgroup grp_constructions Construction module parts diff --git a/library/include/dfhack/modules/Engravings.h b/library/include/modules/Engravings.h similarity index 98% rename from library/include/dfhack/modules/Engravings.h rename to library/include/modules/Engravings.h index 0dfbb3f43..7e145959b 100644 --- a/library/include/dfhack/modules/Engravings.h +++ b/library/include/modules/Engravings.h @@ -28,8 +28,8 @@ distribution. /* * DF engravings */ -#include "dfhack/Export.h" -#include "dfhack/Module.h" +#include "Export.h" +#include "Module.h" /** * \defgroup grp_engraving Engraving module parts diff --git a/library/include/dfhack/modules/Graphic.h b/library/include/modules/Graphic.h similarity index 95% rename from library/include/dfhack/modules/Graphic.h rename to library/include/modules/Graphic.h index f9d6a88ec..6c003b4bc 100644 --- a/library/include/dfhack/modules/Graphic.h +++ b/library/include/modules/Graphic.h @@ -1,6 +1,6 @@ /* https://github.com/peterix/dfhack -Copyright (c) 2009-2011 Petr Mrázek (peterix@gmail.com) +Copyright (c) 2009-2011 Petr Mr�zek (peterix@gmail.com) This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any @@ -31,8 +31,8 @@ distribution. #define CL_MOD_GRAPHIC #include -#include "dfhack/Export.h" -#include "dfhack/Module.h" +#include "Export.h" +#include "Module.h" namespace DFHack { diff --git a/library/include/dfhack/modules/Gui.h b/library/include/modules/Gui.h similarity index 97% rename from library/include/dfhack/modules/Gui.h rename to library/include/modules/Gui.h index 96f4beb9e..3d3fe81c7 100644 --- a/library/include/dfhack/modules/Gui.h +++ b/library/include/modules/Gui.h @@ -26,10 +26,10 @@ distribution. #ifndef CL_MOD_GUI #define CL_MOD_GUI -#include "dfhack/Export.h" -#include "dfhack/Module.h" -#include "dfhack/Virtual.h" -#include "dfhack/BitArray.h" +#include "Export.h" +#include "Module.h" +#include "Virtual.h" +#include "BitArray.h" #include /** diff --git a/library/include/dfhack/modules/Items.h b/library/include/modules/Items.h similarity index 99% rename from library/include/dfhack/modules/Items.h rename to library/include/modules/Items.h index f6efcc8ab..4deba6cdb 100644 --- a/library/include/dfhack/modules/Items.h +++ b/library/include/modules/Items.h @@ -26,12 +26,12 @@ distribution. /* * Items! */ -#include "dfhack/Export.h" -#include "dfhack/Module.h" -#include "dfhack/Types.h" -#include "dfhack/Virtual.h" -#include "dfhack/modules/Materials.h" -#include "dfhack/Process.h" +#include "Export.h" +#include "Module.h" +#include "Types.h" +#include "Virtual.h" +#include "modules/Materials.h" +#include "MemAccess.h" /** * \defgroup grp_items Items module and its types * @ingroup grp_modules diff --git a/library/include/dfhack/extra/MapExtras.h b/library/include/modules/MapCache.h similarity index 99% rename from library/include/dfhack/extra/MapExtras.h rename to library/include/modules/MapCache.h index 9f03d1917..ad6b91e96 100644 --- a/library/include/dfhack/extra/MapExtras.h +++ b/library/include/modules/MapCache.h @@ -26,8 +26,8 @@ distribution. #ifndef MAPEXTRAS_H #define MAPEXTRAS_H -#include "dfhack/modules/Maps.h" -#include "dfhack/TileTypes.h" +#include "modules/Maps.h" +#include "TileTypes.h" #include #include namespace MapExtras diff --git a/library/include/dfhack/modules/Maps.h b/library/include/modules/Maps.h similarity index 99% rename from library/include/dfhack/modules/Maps.h rename to library/include/modules/Maps.h index cc0c17ac3..7e01a03d1 100644 --- a/library/include/dfhack/modules/Maps.h +++ b/library/include/modules/Maps.h @@ -30,12 +30,12 @@ distribution. #ifndef CL_MOD_MAPS #define CL_MOD_MAPS -#include "dfhack/Export.h" -#include "dfhack/Module.h" -#include "dfhack/modules/Vegetation.h" +#include "Export.h" +#include "Module.h" +#include "modules/Vegetation.h" #include -#include "dfhack/Virtual.h" -#include "dfhack/BitArray.h" +#include "Virtual.h" +#include "BitArray.h" #include "Materials.h" /** diff --git a/library/include/dfhack/modules/Materials.h b/library/include/modules/Materials.h similarity index 99% rename from library/include/dfhack/modules/Materials.h rename to library/include/modules/Materials.h index 48280e7f0..8c3ce6846 100644 --- a/library/include/dfhack/modules/Materials.h +++ b/library/include/modules/Materials.h @@ -29,10 +29,10 @@ distribution. * \defgroup grp_materials Materials module - used for reading raws mostly * @ingroup grp_modules */ -#include "dfhack/Export.h" -#include "dfhack/Module.h" -#include "dfhack/Types.h" -#include "dfhack/BitArray.h" +#include "Export.h" +#include "Module.h" +#include "Types.h" +#include "BitArray.h" #include #include diff --git a/library/include/dfhack/modules/Notes.h b/library/include/modules/Notes.h similarity index 95% rename from library/include/dfhack/modules/Notes.h rename to library/include/modules/Notes.h index 8339c1cdc..14bb9db84 100644 --- a/library/include/dfhack/modules/Notes.h +++ b/library/include/modules/Notes.h @@ -5,8 +5,8 @@ * \defgroup grp_notes In game notes (and routes) * @ingroup grp_notes */ -#include "dfhack/Export.h" -#include "dfhack/Module.h" +#include "Export.h" +#include "Module.h" #include #include diff --git a/library/include/dfhack/modules/Translation.h b/library/include/modules/Translation.h similarity index 96% rename from library/include/dfhack/modules/Translation.h rename to library/include/modules/Translation.h index e21102d50..843d1afb9 100644 --- a/library/include/dfhack/modules/Translation.h +++ b/library/include/modules/Translation.h @@ -30,9 +30,9 @@ distribution. * @ingroup grp_modules */ -#include "dfhack/Export.h" -#include "dfhack/Module.h" -#include "dfhack/Types.h" +#include "Export.h" +#include "Module.h" +#include "Types.h" namespace DFHack { diff --git a/library/include/dfhack/modules/Units.h b/library/include/modules/Units.h similarity index 99% rename from library/include/dfhack/modules/Units.h rename to library/include/modules/Units.h index 886b2eeb9..d373b0a16 100644 --- a/library/include/dfhack/modules/Units.h +++ b/library/include/modules/Units.h @@ -28,9 +28,9 @@ distribution. /* * Creatures */ -#include "dfhack/Export.h" -#include "dfhack/Module.h" -#include "dfhack/modules/Items.h" +#include "Export.h" +#include "Module.h" +#include "modules/Items.h" /** * \defgroup grp_units Unit module parts * @ingroup grp_modules diff --git a/library/include/dfhack/modules/Vegetation.h b/library/include/modules/Vegetation.h similarity index 96% rename from library/include/dfhack/modules/Vegetation.h rename to library/include/modules/Vegetation.h index 91e6cac8c..c52d728d4 100644 --- a/library/include/dfhack/modules/Vegetation.h +++ b/library/include/modules/Vegetation.h @@ -30,9 +30,9 @@ distribution. * @ingroup grp_modules */ -#include "dfhack/Export.h" -#include "dfhack/Module.h" -#include "dfhack/Types.h" +#include "Export.h" +#include "Module.h" +#include "Types.h" namespace DFHack { /** diff --git a/library/include/dfhack/modules/Vermin.h b/library/include/modules/Vermin.h similarity index 96% rename from library/include/dfhack/modules/Vermin.h rename to library/include/modules/Vermin.h index 5fa345df0..01ef3d4ae 100644 --- a/library/include/dfhack/modules/Vermin.h +++ b/library/include/modules/Vermin.h @@ -5,8 +5,8 @@ * \defgroup grp_vermin Wild vermin (ants, bees, etc) * @ingroup grp_vermin */ -#include "dfhack/Export.h" -#include "dfhack/Module.h" +#include "Export.h" +#include "Module.h" #ifdef __cplusplus namespace DFHack diff --git a/library/include/dfhack/modules/World.h b/library/include/modules/World.h similarity index 98% rename from library/include/dfhack/modules/World.h rename to library/include/modules/World.h index 7203d775f..01ad231d0 100644 --- a/library/include/dfhack/modules/World.h +++ b/library/include/modules/World.h @@ -31,8 +31,8 @@ distribution. * @ingroup grp_modules */ -#include "dfhack/Export.h" -#include "dfhack/Module.h" +#include "Export.h" +#include "Module.h" #include namespace DFHack diff --git a/library/include/dfhack/modules/kitchen.h b/library/include/modules/kitchen.h similarity index 93% rename from library/include/dfhack/modules/kitchen.h rename to library/include/modules/kitchen.h index bb4e313c6..b169dfb3f 100644 --- a/library/include/dfhack/modules/kitchen.h +++ b/library/include/modules/kitchen.h @@ -26,13 +26,13 @@ distribution. /* * kitchen settings */ -#include "dfhack/Export.h" -#include "dfhack/Module.h" -#include "dfhack/Types.h" -#include "dfhack/VersionInfo.h" -#include "dfhack/modules/Materials.h" -#include "dfhack/modules/Items.h" -#include +#include "Export.h" +#include "Module.h" +#include "Types.h" +#include "VersionInfo.h" +#include "modules/Materials.h" +#include "modules/Items.h" +#include "Core.h" /** * \defgroup grp_kitchen Kitchen settings * @ingroup grp_modules diff --git a/library/private/wdirent.h b/library/include/wdirent.h similarity index 100% rename from library/private/wdirent.h rename to library/include/wdirent.h diff --git a/library/modules/Buildings.cpp b/library/modules/Buildings.cpp index 4083ac5d1..fbef81315 100644 --- a/library/modules/Buildings.cpp +++ b/library/modules/Buildings.cpp @@ -30,14 +30,14 @@ distribution. #include using namespace std; -#include "dfhack/VersionInfo.h" -#include "dfhack/Process.h" -#include "dfhack/Vector.h" -#include "dfhack/Types.h" -#include "dfhack/Error.h" -#include "dfhack/modules/Buildings.h" +#include "VersionInfo.h" +#include "MemAccess.h" +#include "Vector.h" +#include "Types.h" +#include "Error.h" +#include "modules/Buildings.h" #include "ModuleFactory.h" -#include "dfhack/Core.h" +#include "Core.h" using namespace DFHack; //raw diff --git a/library/modules/Constructions.cpp b/library/modules/Constructions.cpp index 079f37398..8081560ae 100644 --- a/library/modules/Constructions.cpp +++ b/library/modules/Constructions.cpp @@ -31,13 +31,13 @@ distribution. using namespace std; -#include "dfhack/VersionInfo.h" -#include "dfhack/Process.h" -#include "dfhack/Vector.h" -#include "dfhack/Types.h" -#include "dfhack/modules/Constructions.h" +#include "VersionInfo.h" +#include "MemAccess.h" +#include "Vector.h" +#include "Types.h" +#include "modules/Constructions.h" #include "ModuleFactory.h" -#include "dfhack/Core.h" +#include "Core.h" using namespace DFHack; diff --git a/library/modules/Engravings.cpp b/library/modules/Engravings.cpp index 8e436b849..7f3b286bf 100644 --- a/library/modules/Engravings.cpp +++ b/library/modules/Engravings.cpp @@ -30,13 +30,13 @@ distribution. #include using namespace std; -#include "dfhack/VersionInfo.h" -#include "dfhack/Process.h" -#include "dfhack/Vector.h" -#include "dfhack/Types.h" -#include "dfhack/modules/Engravings.h" +#include "VersionInfo.h" +//#include "MemAccess.h" +#include "Vector.h" +#include "Types.h" +#include "modules/Engravings.h" #include "ModuleFactory.h" -#include "dfhack/Core.h" +#include "Core.h" using namespace DFHack; diff --git a/library/modules/Graphic.cpp b/library/modules/Graphic.cpp index 25ec34f7d..b482b8e4f 100644 --- a/library/modules/Graphic.cpp +++ b/library/modules/Graphic.cpp @@ -1,6 +1,6 @@ /* https://github.com/peterix/dfhack -Copyright (c) 2009-2011 Petr Mrázek (peterix@gmail.com) +Copyright (c) 2009-2011 Petr Mr�zek (peterix@gmail.com) This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any @@ -33,13 +33,13 @@ distribution. #include using namespace std; -#include "dfhack/modules/Graphic.h" -#include "dfhack/Error.h" -#include "dfhack/VersionInfo.h" -#include "dfhack/Process.h" -#include "dfhack/Vector.h" +#include "modules/Graphic.h" +#include "Error.h" +#include "VersionInfo.h" +#include "MemAccess.h" +#include "Vector.h" #include "ModuleFactory.h" -#include +#include "Core.h" using namespace DFHack; diff --git a/library/modules/Gui.cpp b/library/modules/Gui.cpp index 46f0ad2ea..6749e9f01 100644 --- a/library/modules/Gui.cpp +++ b/library/modules/Gui.cpp @@ -30,13 +30,13 @@ distribution. #include using namespace std; -#include "dfhack/modules/Gui.h" -#include "dfhack/Process.h" -#include "dfhack/VersionInfo.h" -#include "dfhack/Types.h" -#include "dfhack/Error.h" +#include "modules/Gui.h" +#include "MemAccess.h" +#include "VersionInfo.h" +#include "Types.h" +#include "Error.h" #include "ModuleFactory.h" -#include "dfhack/Core.h" +#include "Core.h" using namespace DFHack; Module* DFHack::createGui() diff --git a/library/modules/Items.cpp b/library/modules/Items.cpp index 468c00c4d..0b5cef01b 100644 --- a/library/modules/Items.cpp +++ b/library/modules/Items.cpp @@ -33,16 +33,16 @@ distribution. #include using namespace std; -#include "dfhack/Types.h" -#include "dfhack/VersionInfo.h" -#include "dfhack/Process.h" -#include "dfhack/Vector.h" -#include "dfhack/modules/Materials.h" -#include "dfhack/modules/Items.h" -#include "dfhack/modules/Units.h" +#include "Types.h" +#include "VersionInfo.h" +#include "MemAccess.h" +#include "Vector.h" +#include "modules/Materials.h" +#include "modules/Items.h" +#include "modules/Units.h" #include "ModuleFactory.h" -#include -#include +#include "Core.h" +#include "Virtual.h" using namespace DFHack; diff --git a/library/modules/Maps.cpp b/library/modules/Maps.cpp index 5b68b384f..6cb34d6af 100644 --- a/library/modules/Maps.cpp +++ b/library/modules/Maps.cpp @@ -33,13 +33,13 @@ distribution. #include using namespace std; -#include "dfhack/modules/Maps.h" -#include "dfhack/Error.h" -#include "dfhack/VersionInfo.h" -#include "dfhack/Process.h" -#include "dfhack/Vector.h" +#include "modules/Maps.h" +#include "Error.h" +#include "VersionInfo.h" +#include "MemAccess.h" +#include "Vector.h" #include "ModuleFactory.h" -#include +#include "Core.h" #define MAPS_GUARD if(!d->Started) throw DFHack::Error::ModuleNotInitialized(); diff --git a/library/modules/Materials.cpp b/library/modules/Materials.cpp index 0c4b6f46b..c77a62bd7 100644 --- a/library/modules/Materials.cpp +++ b/library/modules/Materials.cpp @@ -31,14 +31,14 @@ distribution. #include using namespace std; -#include "dfhack/Types.h" -#include "dfhack/modules/Materials.h" -#include "dfhack/VersionInfo.h" -#include "dfhack/Process.h" -#include "dfhack/Vector.h" -#include +#include "Types.h" +#include "modules/Materials.h" +#include "VersionInfo.h" +#include "MemAccess.h" +#include "Vector.h" +#include "Error.h" #include "ModuleFactory.h" -#include +#include "Core.h" using namespace DFHack; diff --git a/library/modules/Notes.cpp b/library/modules/Notes.cpp index 293077a5d..bcfe6aa68 100644 --- a/library/modules/Notes.cpp +++ b/library/modules/Notes.cpp @@ -29,13 +29,13 @@ distribution. #include using namespace std; -#include "dfhack/VersionInfo.h" -#include "dfhack/Types.h" -#include "dfhack/Error.h" -#include "dfhack/Process.h" +#include "VersionInfo.h" +#include "Types.h" +#include "Error.h" +#include "MemAccess.h" #include "ModuleFactory.h" -#include "dfhack/Core.h" -#include "dfhack/modules/Notes.h" +#include "Core.h" +#include "modules/Notes.h" using namespace DFHack; Module* DFHack::createNotes() diff --git a/library/modules/Translation.cpp b/library/modules/Translation.cpp index 57fcd8757..9c2af7901 100644 --- a/library/modules/Translation.cpp +++ b/library/modules/Translation.cpp @@ -30,13 +30,13 @@ distribution. #include using namespace std; -#include "dfhack/modules/Translation.h" -#include "dfhack/VersionInfo.h" -#include "dfhack/Process.h" -#include "dfhack/Vector.h" -#include "dfhack/Types.h" +#include "modules/Translation.h" +#include "VersionInfo.h" +#include "MemAccess.h" +#include "Vector.h" +#include "Types.h" #include "ModuleFactory.h" -#include +#include "Core.h" using namespace DFHack; Module* DFHack::createTranslation() diff --git a/library/modules/Units.cpp b/library/modules/Units.cpp index 9a6a09065..368a198ec 100644 --- a/library/modules/Units.cpp +++ b/library/modules/Units.cpp @@ -34,18 +34,18 @@ distribution. using namespace std; -#include "dfhack/VersionInfo.h" -#include "dfhack/Process.h" -#include "dfhack/Vector.h" -#include "dfhack/Error.h" -#include "dfhack/Types.h" +#include "VersionInfo.h" +#include "MemAccess.h" +#include "Vector.h" +#include "Error.h" +#include "Types.h" // we connect to those -#include "dfhack/modules/Materials.h" -#include "dfhack/modules/Units.h" -#include "dfhack/modules/Translation.h" +#include "modules/Materials.h" +#include "modules/Units.h" +#include "modules/Translation.h" #include "ModuleFactory.h" -#include +#include "Core.h" using namespace DFHack; diff --git a/library/modules/Vegetation.cpp b/library/modules/Vegetation.cpp index b581928a9..c30e26157 100644 --- a/library/modules/Vegetation.cpp +++ b/library/modules/Vegetation.cpp @@ -30,14 +30,14 @@ distribution. #include using namespace std; -#include "dfhack/VersionInfo.h" -#include "dfhack/Process.h" -#include "dfhack/Vector.h" -#include "dfhack/Types.h" -#include "dfhack/modules/Vegetation.h" -#include "dfhack/modules/Translation.h" +#include "VersionInfo.h" +#include "MemAccess.h" +#include "Vector.h" +#include "Types.h" +#include "modules/Vegetation.h" +#include "modules/Translation.h" #include "ModuleFactory.h" -#include +#include "Core.h" using namespace DFHack; Module* DFHack::createVegetation() diff --git a/library/modules/Vermin.cpp b/library/modules/Vermin.cpp index 67fd623e4..f685c4eed 100644 --- a/library/modules/Vermin.cpp +++ b/library/modules/Vermin.cpp @@ -29,13 +29,13 @@ distribution. #include using namespace std; -#include "dfhack/VersionInfo.h" -#include "dfhack/Types.h" -#include "dfhack/Error.h" -#include "dfhack/Process.h" -#include "dfhack/modules/Vermin.h" +#include "VersionInfo.h" +#include "Types.h" +#include "Error.h" +#include "MemAccess.h" +#include "modules/Vermin.h" #include "ModuleFactory.h" -#include "dfhack/Core.h" +#include "Core.h" using namespace DFHack; struct Vermin::Private @@ -106,7 +106,6 @@ SpawnPoints* Vermin::getSpawnPoints() cerr << "Couldn't get spawn points: Vermin module not inited" << endl; return NULL; } - return new SpawnPoints(this); } @@ -120,15 +119,11 @@ SpawnPoints::SpawnPoints(Vermin* v_) cerr << "Couldn't get spawn points: Vermin module not inited" << endl; return; } - - //p_sp = new DfVector (v->d->spawn_points_vector); - //p_sp = new vector (v->d->spawn_points_vector); p_sp = (vector *) (v->d->spawn_points_vector); } SpawnPoints::~SpawnPoints() { - // Do NOT delete p_sp; it's a pointer to memory the game owns. } size_t SpawnPoints::size() diff --git a/library/modules/World.cpp b/library/modules/World.cpp index bb6c3bfaf..0402c7f18 100644 --- a/library/modules/World.cpp +++ b/library/modules/World.cpp @@ -30,13 +30,13 @@ distribution. #include using namespace std; -#include "dfhack/modules/World.h" -#include "dfhack/Process.h" -#include "dfhack/VersionInfo.h" -#include "dfhack/Types.h" -#include "dfhack/Error.h" +#include "modules/World.h" +#include "MemAccess.h" +#include "VersionInfo.h" +#include "Types.h" +#include "Error.h" #include "ModuleFactory.h" -#include +#include "Core.h" using namespace DFHack; diff --git a/library/modules/kitchen.cpp b/library/modules/kitchen.cpp index c98684e08..78869ae26 100644 --- a/library/modules/kitchen.cpp +++ b/library/modules/kitchen.cpp @@ -9,17 +9,17 @@ #include using namespace std; -#include "dfhack/Types.h" -#include "dfhack/VersionInfo.h" -#include "dfhack/Process.h" -#include "dfhack/Vector.h" -#include "dfhack/modules/Materials.h" -#include "dfhack/modules/Items.h" -#include "dfhack/modules/Units.h" -#include "dfhack/modules/kitchen.h" +#include "Types.h" +#include "VersionInfo.h" +#include "MemAccess.h" +#include "Vector.h" +#include "modules/Materials.h" +#include "modules/Items.h" +#include "modules/Units.h" +#include "modules/kitchen.h" #include "ModuleFactory.h" -#include -#include +#include "Core.h" +#include "Virtual.h" namespace DFHack { diff --git a/plugins/Dfusion/dfusion.cpp b/plugins/Dfusion/dfusion.cpp index cbe84aef9..7bba2217b 100644 --- a/plugins/Dfusion/dfusion.cpp +++ b/plugins/Dfusion/dfusion.cpp @@ -1,9 +1,9 @@ -#include -#include -#include -#include -#include -#include "dfhack/extra/stopwatch.h" +#include "Core.h" +#include "Console.h" +#include "Export.h" +#include "PluginManager.h" +#include "MemAccess.h" +#include "MiscUtils.h" #include #include diff --git a/plugins/Dfusion/include/hexsearch.h b/plugins/Dfusion/include/hexsearch.h index b4ffb84d8..3a939b088 100644 --- a/plugins/Dfusion/include/hexsearch.h +++ b/plugins/Dfusion/include/hexsearch.h @@ -1,8 +1,8 @@ #ifndef HEXSEARCH_H #define HEXSEARCH_H #include -#include "dfhack/Core.h" //for some reason process.h needs core -#include "dfhack/Process.h" +#include "Core.h" //for some reason process.h needs core +#include "MemAccess.h" //(not yet)implemented using Boyer-Moore algorithm diff --git a/plugins/Dfusion/include/lua_Console.h b/plugins/Dfusion/include/lua_Console.h index a6430dcbf..2ced33645 100644 --- a/plugins/Dfusion/include/lua_Console.h +++ b/plugins/Dfusion/include/lua_Console.h @@ -1,6 +1,6 @@ #ifndef LUA_CONSOLE_H #define LUA_CONSOLE_H -#include +#include #include "luamain.h" namespace lua diff --git a/plugins/Dfusion/include/lua_Misc.h b/plugins/Dfusion/include/lua_Misc.h index 3254ed3d0..8bada83c4 100644 --- a/plugins/Dfusion/include/lua_Misc.h +++ b/plugins/Dfusion/include/lua_Misc.h @@ -3,8 +3,8 @@ #include -#include -#include +#include "Core.h" +#include #include "luamain.h" #include "OutFile.h" #include "bit.h" diff --git a/plugins/Dfusion/include/lua_Process.h b/plugins/Dfusion/include/lua_Process.h index 515aa55af..e6639cfc8 100644 --- a/plugins/Dfusion/include/lua_Process.h +++ b/plugins/Dfusion/include/lua_Process.h @@ -1,8 +1,8 @@ #ifndef LUA_PROCESS_H #define LUA_PROCESS_H -#include -#include +#include "Core.h" +#include #include "luamain.h" diff --git a/plugins/Dfusion/include/lua_VersionInfo.h b/plugins/Dfusion/include/lua_VersionInfo.h index e221eff04..99010f590 100644 --- a/plugins/Dfusion/include/lua_VersionInfo.h +++ b/plugins/Dfusion/include/lua_VersionInfo.h @@ -1,7 +1,7 @@ #ifndef LUA_VERSIONINFO_H #define LUA_VERSIONINFO_H -#include -#include +#include "Core.h" +#include #include "luamain.h" namespace lua { diff --git a/plugins/autodump.cpp b/plugins/autodump.cpp index 26fe70cc2..3963bf2af 100644 --- a/plugins/autodump.cpp +++ b/plugins/autodump.cpp @@ -8,19 +8,19 @@ #include using namespace std; -#include -#include -#include -#include +#include "Core.h" +#include +#include +#include #include #include #include -#include +#include -#include -#include -#include -#include +#include +#include +#include +#include using namespace DFHack; using MapExtras::Block; diff --git a/plugins/cleaners.cpp b/plugins/cleaners.cpp index b93b18f37..35ec69ea3 100644 --- a/plugins/cleaners.cpp +++ b/plugins/cleaners.cpp @@ -1,11 +1,11 @@ -#include -#include -#include -#include -#include -#include -#include -#include +#include "Core.h" +#include +#include +#include +#include +#include +#include +#include using namespace DFHack; diff --git a/plugins/cleanowned.cpp b/plugins/cleanowned.cpp index 4b1b61e63..c7d931676 100644 --- a/plugins/cleanowned.cpp +++ b/plugins/cleanowned.cpp @@ -8,17 +8,17 @@ #include using namespace std; -#include -#include -#include -#include +#include "Core.h" +#include +#include +#include #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include using namespace DFHack; DFhackCExport command_result df_cleanowned (Core * c, vector & parameters); diff --git a/plugins/colonies.cpp b/plugins/colonies.cpp index ce8beccb8..6b2d8a1d2 100644 --- a/plugins/colonies.cpp +++ b/plugins/colonies.cpp @@ -1,10 +1,10 @@ -#include -#include -#include -#include +#include "Core.h" +#include +#include +#include #include #include -#include +#include using std::vector; using std::string; diff --git a/plugins/deramp.cpp b/plugins/deramp.cpp index 0aab27d20..c5b1c8558 100644 --- a/plugins/deramp.cpp +++ b/plugins/deramp.cpp @@ -7,12 +7,12 @@ #include #include using namespace std; -#include -#include -#include -#include -#include -#include +#include "Core.h" +#include +#include +#include +#include +#include using namespace DFHack; DFhackCExport command_result df_deramp (Core * c, vector & parameters); diff --git a/plugins/devel/buildprobe.cpp b/plugins/devel/buildprobe.cpp index 0c7fbb7fd..9893705de 100644 --- a/plugins/devel/buildprobe.cpp +++ b/plugins/devel/buildprobe.cpp @@ -1,13 +1,13 @@ //Quick building occupancy flag test. //Individual bits had no apparent meaning. Assume it's an enum, set by number. -#include -#include -#include -#include -#include -#include -#include +#include "Core.h" +#include +#include +#include +#include +#include +#include #include #include #include diff --git a/plugins/devel/itemhacks.cpp b/plugins/devel/itemhacks.cpp index d9f045a13..0dbc94d58 100644 --- a/plugins/devel/itemhacks.cpp +++ b/plugins/devel/itemhacks.cpp @@ -1,8 +1,8 @@ -#include -#include -#include -#include -#include +#include "Core.h" +#include +#include +#include +#include #include #include #include diff --git a/plugins/devel/kittens.cpp b/plugins/devel/kittens.cpp index 7c502143c..c202331f3 100644 --- a/plugins/devel/kittens.cpp +++ b/plugins/devel/kittens.cpp @@ -1,13 +1,13 @@ -#include -#include -#include -#include +#include "Core.h" +#include "Console.h" +#include "Export.h" +#include "PluginManager.h" +#include "MiscUtils.h" #include #include -#include "dfhack/extra/stopwatch.h" -#include "dfhack/modules/Maps.h" -#include "dfhack/modules/Items.h" -#include +#include "modules/Maps.h" +#include "modules/Items.h" +#include #include using std::vector; @@ -329,8 +329,8 @@ DFhackCExport command_result kittens (Core * c, vector & parameters) } } -#include "dfhack/modules/Units.h" -#include "dfhack/VersionInfo.h" +#include "modules/Units.h" +#include "VersionInfo.h" #include command_result test_creature_offsets(Core* c, vector< string >& parameters) diff --git a/plugins/devel/memview.cpp b/plugins/devel/memview.cpp index 02727a485..a5c721101 100644 --- a/plugins/devel/memview.cpp +++ b/plugins/devel/memview.cpp @@ -1,194 +1,194 @@ -#include -#include -#include -#include -#include -#include <../depends/tthread/tinythread.h> //not sure if correct -#include -#include -#include - -using std::vector; -using std::string; -using namespace DFHack; - -uint64_t timeLast=0; -static tthread::mutex* mymutex=0; - -struct memory_data -{ - size_t addr; - size_t len; - size_t refresh; - int state; - uint8_t *buf,*lbuf; - vector ranges; -}memdata; -enum HEXVIEW_STATES -{ - STATE_OFF,STATE_ON -}; -DFhackCExport command_result memview (Core * c, vector & parameters); - -DFhackCExport const char * plugin_name ( void ) -{ - return "memview"; -} - -DFhackCExport command_result plugin_init ( Core * c, std::vector &commands) -{ - commands.clear(); - commands.push_back(PluginCommand("memview","Shows memory in real time. Params: adrr length refresh_rate. If addr==0 then stop viewing",memview)); - memdata.state=STATE_OFF; - mymutex=new tthread::mutex; - return CR_OK; -} -size_t convert(const std::string& p,bool ishex=false) -{ - size_t ret; - std::stringstream conv; - if(ishex) - conv<>ret; - return ret; -} -bool isAddr(uint32_t *trg,vector & ranges) -{ - if(trg[0]%4==0) - for(size_t i=0;i & ranges) -{ +#include "Core.h" +#include "Console.h" +#include "PluginManager.h" +#include "MemAccess.h" +#include "MiscUtils.h" +#include <../depends/tthread/tinythread.h> //not sure if correct +#include +#include +#include + +using std::vector; +using std::string; +using namespace DFHack; + +uint64_t timeLast=0; +static tthread::mutex* mymutex=0; + +struct memory_data +{ + size_t addr; + size_t len; + size_t refresh; + int state; + uint8_t *buf,*lbuf; + vector ranges; +}memdata; +enum HEXVIEW_STATES +{ + STATE_OFF,STATE_ON +}; +DFhackCExport command_result memview (Core * c, vector & parameters); + +DFhackCExport const char * plugin_name ( void ) +{ + return "memview"; +} + +DFhackCExport command_result plugin_init ( Core * c, std::vector &commands) +{ + commands.clear(); + commands.push_back(PluginCommand("memview","Shows memory in real time. Params: adrr length refresh_rate. If addr==0 then stop viewing",memview)); + memdata.state=STATE_OFF; + mymutex=new tthread::mutex; + return CR_OK; +} +size_t convert(const std::string& p,bool ishex=false) +{ + size_t ret; + std::stringstream conv; + if(ishex) + conv<>ret; + return ret; +} +bool isAddr(uint32_t *trg,vector & ranges) +{ + if(trg[0]%4==0) + for(size_t i=0;i & ranges) +{ Console &con=c->con; - const size_t page_size=16; - con.clear(); - - for(size_t i=0;i31)&&(buf[j+i]<128)) //only printable ascii - con.print("%c",buf[j+i]); - else - con.print("."); - //con.print("\n"); + //TODO make something better? + } + if(lbuf[j+i]!=buf[j+i]) + con.print("*%02X",buf[j+i]); //if modfied show a star + else + con.print(" %02X",buf[j+i]); + } + con.reset_color(); + con.print(" | "); + for(size_t j=0;(j31)&&(buf[j+i]<128)) //only printable ascii + con.print("%c",buf[j+i]); + else + con.print("."); + //con.print("\n"); } - con.print("\n"); - con.flush(); - -} -void Deinit() -{ - if(memdata.state==STATE_ON) - { - memdata.state=STATE_OFF; - delete [] memdata.buf; - delete [] memdata.lbuf; - } -} -DFhackCExport command_result plugin_onupdate ( Core * c ) -{ - - mymutex->lock(); - if(memdata.state==STATE_OFF) - { - mymutex->unlock(); - return CR_OK; - } - //Console &con=c->con; - uint64_t time2 = GetTimeMs64(); - uint64_t delta = time2-timeLast; - - if(memdata.refresh!=0) - if(deltaunlock(); - return CR_OK; - } - timeLast = time2; - - c->p->read(memdata.addr,memdata.len,memdata.buf); - outputHex(memdata.buf,memdata.lbuf,memdata.len,memdata.addr,c,memdata.ranges); - memcpy(memdata.lbuf, memdata.buf, memdata.len); - if(memdata.refresh==0) - Deinit(); - mymutex->unlock(); - return CR_OK; - -} -DFhackCExport command_result memview (Core * c, vector & parameters) -{ - mymutex->lock(); - c->p->getMemRanges(memdata.ranges); - memdata.addr=convert(parameters[0],true); - if(memdata.addr==0) - { - Deinit(); - memdata.state=STATE_OFF; - mymutex->unlock(); - return CR_OK; - } - else - { - Deinit(); - bool isValid=false; - for(size_t i=0;icon.printerr("Invalid address:%x\n",memdata.addr); - mymutex->unlock(); - return CR_OK; - } - memdata.state=STATE_ON; - } - if(parameters.size()>1) - memdata.len=convert(parameters[1]); - else - memdata.len=20*16; - - if(parameters.size()>2) - memdata.refresh=convert(parameters[2]); - else - memdata.refresh=0; - - - uint8_t *buf,*lbuf; - memdata.buf=new uint8_t[memdata.len]; - memdata.lbuf=new uint8_t[memdata.len]; - c->p->getMemRanges(memdata.ranges); - mymutex->unlock(); - return CR_OK; -} -DFhackCExport command_result plugin_shutdown ( Core * c ) -{ - mymutex->lock(); - Deinit(); - delete mymutex; - mymutex->unlock(); - return CR_OK; -} + con.print("\n"); + con.flush(); + +} +void Deinit() +{ + if(memdata.state==STATE_ON) + { + memdata.state=STATE_OFF; + delete [] memdata.buf; + delete [] memdata.lbuf; + } +} +DFhackCExport command_result plugin_onupdate ( Core * c ) +{ + + mymutex->lock(); + if(memdata.state==STATE_OFF) + { + mymutex->unlock(); + return CR_OK; + } + //Console &con=c->con; + uint64_t time2 = GetTimeMs64(); + uint64_t delta = time2-timeLast; + + if(memdata.refresh!=0) + if(deltaunlock(); + return CR_OK; + } + timeLast = time2; + + c->p->read(memdata.addr,memdata.len,memdata.buf); + outputHex(memdata.buf,memdata.lbuf,memdata.len,memdata.addr,c,memdata.ranges); + memcpy(memdata.lbuf, memdata.buf, memdata.len); + if(memdata.refresh==0) + Deinit(); + mymutex->unlock(); + return CR_OK; + +} +DFhackCExport command_result memview (Core * c, vector & parameters) +{ + mymutex->lock(); + c->p->getMemRanges(memdata.ranges); + memdata.addr=convert(parameters[0],true); + if(memdata.addr==0) + { + Deinit(); + memdata.state=STATE_OFF; + mymutex->unlock(); + return CR_OK; + } + else + { + Deinit(); + bool isValid=false; + for(size_t i=0;icon.printerr("Invalid address:%x\n",memdata.addr); + mymutex->unlock(); + return CR_OK; + } + memdata.state=STATE_ON; + } + if(parameters.size()>1) + memdata.len=convert(parameters[1]); + else + memdata.len=20*16; + + if(parameters.size()>2) + memdata.refresh=convert(parameters[2]); + else + memdata.refresh=0; + + + uint8_t *buf,*lbuf; + memdata.buf=new uint8_t[memdata.len]; + memdata.lbuf=new uint8_t[memdata.len]; + c->p->getMemRanges(memdata.ranges); + mymutex->unlock(); + return CR_OK; +} +DFhackCExport command_result plugin_shutdown ( Core * c ) +{ + mymutex->lock(); + Deinit(); + delete mymutex; + mymutex->unlock(); + return CR_OK; +} diff --git a/plugins/devel/notes.cpp b/plugins/devel/notes.cpp index 32b436121..412f64476 100644 --- a/plugins/devel/notes.cpp +++ b/plugins/devel/notes.cpp @@ -1,10 +1,10 @@ -#include -#include -#include -#include +#include "Core.h" +#include +#include +#include #include #include -#include +#include using std::vector; using std::string; diff --git a/plugins/devel/rawdump.cpp b/plugins/devel/rawdump.cpp index 0e6cac5bd..2ad840b78 100644 --- a/plugins/devel/rawdump.cpp +++ b/plugins/devel/rawdump.cpp @@ -1,10 +1,10 @@ -#include -#include -#include -#include +#include "Core.h" +#include +#include +#include #include #include -#include +#include #include using std::vector; diff --git a/plugins/devel/tiles.cpp b/plugins/devel/tiles.cpp index fc83f1891..d6ca4cbd1 100644 --- a/plugins/devel/tiles.cpp +++ b/plugins/devel/tiles.cpp @@ -7,15 +7,15 @@ using std::vector; using std::string; -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "Core.h" +#include +#include +#include +#include +#include +#include +#include +#include using namespace MapExtras; using namespace DFHack; diff --git a/plugins/devel/vectors.cpp b/plugins/devel/vectors.cpp index 320f55c00..216b69868 100644 --- a/plugins/devel/vectors.cpp +++ b/plugins/devel/vectors.cpp @@ -3,11 +3,11 @@ // // Linux only, enabled with BUILD_VECTORS cmake option. -#include -#include -#include -#include -#include +#include "Core.h" +#include +#include +#include +#include #include #include diff --git a/plugins/df2mc b/plugins/df2mc index 8ffad5163..355674a50 160000 --- a/plugins/df2mc +++ b/plugins/df2mc @@ -1 +1 @@ -Subproject commit 8ffad51635ceeae55870106a75f3dd84b044ea5a +Subproject commit 355674a508d72349983455f04791b4481b6c1515 diff --git a/plugins/drybuckets.cpp b/plugins/drybuckets.cpp index 245661736..0ea079c0c 100644 --- a/plugins/drybuckets.cpp +++ b/plugins/drybuckets.cpp @@ -7,14 +7,14 @@ #include using namespace std; -#include -#include -#include -#include +#include "Core.h" +#include +#include +#include #include #include #include -#include +#include using namespace DFHack; diff --git a/plugins/fastdwarf.cpp b/plugins/fastdwarf.cpp index 534e34614..38b7f312d 100644 --- a/plugins/fastdwarf.cpp +++ b/plugins/fastdwarf.cpp @@ -8,12 +8,12 @@ #include #include using namespace std; -#include -#include -#include -#include -#include -#include +#include "Core.h" +#include +#include +#include +#include +#include using namespace DFHack; // dfhack interface diff --git a/plugins/filltraffic.cpp b/plugins/filltraffic.cpp index 2e4e059f1..a5c2188fe 100644 --- a/plugins/filltraffic.cpp +++ b/plugins/filltraffic.cpp @@ -5,13 +5,13 @@ #include //for min(). #include #include -#include -#include -#include -#include -#include -#include -#include +#include "Core.h" +#include +#include +#include +#include +#include +#include using std::stack; using MapExtras::MapCache; using namespace DFHack; diff --git a/plugins/flows.cpp b/plugins/flows.cpp index b82d01adb..c5b588903 100644 --- a/plugins/flows.cpp +++ b/plugins/flows.cpp @@ -6,11 +6,11 @@ #include #include using namespace std; -#include -#include -#include -#include -#include +#include "Core.h" +#include +#include +#include +#include using namespace DFHack; DFhackCExport command_result df_flows (Core * c, vector & parameters); diff --git a/plugins/getplants.cpp b/plugins/getplants.cpp index dbec990f0..14fb8b90c 100644 --- a/plugins/getplants.cpp +++ b/plugins/getplants.cpp @@ -8,14 +8,14 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include "Core.h" +#include +#include +#include +#include +#include +#include +#include using namespace std; using namespace DFHack; diff --git a/plugins/initflags.cpp b/plugins/initflags.cpp index f27a318ae..29d8144a8 100644 --- a/plugins/initflags.cpp +++ b/plugins/initflags.cpp @@ -1,10 +1,10 @@ -#include -#include -#include -#include +#include "Core.h" +#include +#include +#include -#include -#include +#include +#include using std::vector; using std::string; diff --git a/plugins/liquids.cpp b/plugins/liquids.cpp index 92067ba7e..17f4e6309 100644 --- a/plugins/liquids.cpp +++ b/plugins/liquids.cpp @@ -9,15 +9,15 @@ using std::string; using std::endl; using std::set; -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "Core.h" +#include +#include +#include +#include +#include +#include +#include +#include using namespace MapExtras; using namespace DFHack; diff --git a/plugins/mode.cpp b/plugins/mode.cpp index 4a64fd2b8..2ca741ae2 100644 --- a/plugins/mode.cpp +++ b/plugins/mode.cpp @@ -1,13 +1,13 @@ #include using namespace std; -#include -#include -#include -#include +#include "Core.h" +#include +#include +#include #include #include -#include +#include #include using namespace DFHack; diff --git a/plugins/plants.cpp b/plugins/plants.cpp index 7afa0d897..4d8960cee 100644 --- a/plugins/plants.cpp +++ b/plugins/plants.cpp @@ -5,15 +5,15 @@ #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "Core.h" +#include +#include +#include +#include +#include +#include +#include +#include using std::vector; using std::string; diff --git a/plugins/probe.cpp b/plugins/probe.cpp index 59588185f..a000d9e31 100644 --- a/plugins/probe.cpp +++ b/plugins/probe.cpp @@ -9,18 +9,18 @@ #include using namespace std; -#include -#include -#include -#include +#include "Core.h" +#include +#include +#include #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include using std::vector; using std::string; diff --git a/plugins/prospector.cpp b/plugins/prospector.cpp index 5e642ed5a..6287734c1 100644 --- a/plugins/prospector.cpp +++ b/plugins/prospector.cpp @@ -14,11 +14,10 @@ using namespace std; #include -#include -#include -#include -#include -#include +#include +#include "Core.h" +#include +#include using namespace DFHack; diff --git a/plugins/qtplug/qtplug.cpp b/plugins/qtplug/qtplug.cpp index 2c6dbf3ad..a33c28ad5 100644 --- a/plugins/qtplug/qtplug.cpp +++ b/plugins/qtplug/qtplug.cpp @@ -1,10 +1,10 @@ -#include -#include -#include -#include -#include -#include -#include +#include "Core.h" +#include +#include +#include +#include +#include +#include #include #include #include diff --git a/plugins/rename.cpp b/plugins/rename.cpp index 3b6951061..17841c5fa 100644 --- a/plugins/rename.cpp +++ b/plugins/rename.cpp @@ -1,12 +1,12 @@ -#include -#include -#include -#include - -#include -#include -#include -#include +#include "Core.h" +#include +#include +#include + +#include +#include +#include +#include #include diff --git a/plugins/reveal.cpp b/plugins/reveal.cpp index 5d7c1df29..ce37f3f1e 100644 --- a/plugins/reveal.cpp +++ b/plugins/reveal.cpp @@ -2,14 +2,14 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include "Core.h" +#include +#include +#include +#include +#include +#include +#include using MapExtras::MapCache; using namespace DFHack; diff --git a/plugins/seedwatch.cpp b/plugins/seedwatch.cpp index 90175470c..3b83338e2 100755 --- a/plugins/seedwatch.cpp +++ b/plugins/seedwatch.cpp @@ -1,19 +1,18 @@ -// This does not work with Linux Dwarf Fortress +// This does not work with Linux Dwarf Fortress // With thanks to peterix for DFHack and Quietust for information http://www.bay12forums.com/smf/index.php?topic=91166.msg2605147#msg2605147 #include #include #include -#include "dfhack/Console.h" -#include "dfhack/Core.h" -#include "dfhack/Export.h" -#include "dfhack/PluginManager.h" -#include "dfhack/Process.h" -#include "dfhack/modules/Materials.h" -#include "dfhack/modules/Items.h" -#include "dfhack/modules/World.h" -#include "dfhack/modules/kitchen.h" -#include +#include "Console.h" +#include "Core.h" +#include "Export.h" +#include "PluginManager.h" +#include "modules/Materials.h" +#include "modules/Items.h" +#include "modules/World.h" +#include "modules/kitchen.h" +#include using DFHack::t_materialType; using DFHack::t_materialIndex; diff --git a/plugins/server/main.cpp b/plugins/server/main.cpp index b47128c50..91dabc6f0 100644 --- a/plugins/server/main.cpp +++ b/plugins/server/main.cpp @@ -1,7 +1,7 @@ -#include -#include -#include -#include +#include "Core.h" +#include +#include +#include #include #ifndef LINUX_BUILD #include diff --git a/plugins/skeleton/skeleton.cpp b/plugins/skeleton/skeleton.cpp index d69a2dd95..1b3ad398d 100644 --- a/plugins/skeleton/skeleton.cpp +++ b/plugins/skeleton/skeleton.cpp @@ -1,10 +1,10 @@ // This is a generic plugin that does nothing useful apart from acting as an example... of a plugin that does nothing :D // some headers required for a plugin. Nothing special, just the basics. -#include -#include -#include -#include +#include "Core.h" +#include +#include +#include using namespace DFHack; // our own, empty header. diff --git a/plugins/stockpiles.cpp b/plugins/stockpiles.cpp index 5a4de4630..fb79f3e59 100644 --- a/plugins/stockpiles.cpp +++ b/plugins/stockpiles.cpp @@ -1,14 +1,14 @@ -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include +#include "Core.h" +#include +#include +#include + +#include +#include +#include +#include +#include +#include using std::vector; using std::string; diff --git a/plugins/stonesense b/plugins/stonesense index dbfeaf935..1b28039e2 160000 --- a/plugins/stonesense +++ b/plugins/stonesense @@ -1 +1 @@ -Subproject commit dbfeaf935df92644b72746842166baf700450e15 +Subproject commit 1b28039e2c93daa3c2f69f5e2a000ff8c96ee1f8 diff --git a/plugins/tiletypes.cpp b/plugins/tiletypes.cpp index 3387d2603..57184f013 100644 --- a/plugins/tiletypes.cpp +++ b/plugins/tiletypes.cpp @@ -10,15 +10,15 @@ using std::string; using std::endl; using std::set; -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "Core.h" +#include +#include +#include +#include +#include +#include +#include +#include using namespace MapExtras; using namespace DFHack; diff --git a/plugins/tubefill.cpp b/plugins/tubefill.cpp index 1249c20fb..23e6e992a 100644 --- a/plugins/tubefill.cpp +++ b/plugins/tubefill.cpp @@ -4,14 +4,14 @@ #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include +#include "Core.h" +#include +#include +#include +#include +#include +#include +#include using MapExtras::MapCache; using namespace DFHack; diff --git a/plugins/vdig.cpp b/plugins/vdig.cpp index e9cc0db3a..392f0ea98 100644 --- a/plugins/vdig.cpp +++ b/plugins/vdig.cpp @@ -1,10 +1,10 @@ -#include -#include -#include -#include -#include -#include -#include +#include "Core.h" +#include +#include +#include +#include +#include +#include #include #include #include diff --git a/plugins/versionosd.cpp b/plugins/versionosd.cpp index 466c4a45b..5f4ff11a8 100644 --- a/plugins/versionosd.cpp +++ b/plugins/versionosd.cpp @@ -7,12 +7,12 @@ #include #include using namespace std; -#include -#include -#include -#include -#include -#include +#include "Core.h" +#include +#include +#include +#include +#include using namespace DFHack; DFhackCExport command_result df_versionosd (Core * c, vector & parameters); diff --git a/plugins/weather.cpp b/plugins/weather.cpp index d01bfcb7b..0f2325d48 100644 --- a/plugins/weather.cpp +++ b/plugins/weather.cpp @@ -1,10 +1,10 @@ -#include -#include -#include -#include +#include "Core.h" +#include +#include +#include #include #include -#include +#include using std::vector; using std::string; diff --git a/tools/examples/dfitemdump.cpp b/tools/examples/dfitemdump.cpp index a19c19734..655caf409 100644 --- a/tools/examples/dfitemdump.cpp +++ b/tools/examples/dfitemdump.cpp @@ -12,7 +12,7 @@ using namespace std; #define DFHACK_WANT_MISCUTILS #include -#include +#include int main (int argc, char *argv[]) { diff --git a/tools/examples/processenum.cpp b/tools/examples/processenum.cpp index 425b247e4..ff15c8645 100644 --- a/tools/examples/processenum.cpp +++ b/tools/examples/processenum.cpp @@ -9,7 +9,7 @@ using namespace std; #include -#include +#include using namespace DFHack; #ifndef LINUX_BUILD #endif diff --git a/tools/playground/blockflags.cpp b/tools/playground/blockflags.cpp index f46f66407..f78a8894e 100644 --- a/tools/playground/blockflags.cpp +++ b/tools/playground/blockflags.cpp @@ -6,8 +6,8 @@ using namespace std; #include -#include -#include +#include +#include int main(int argc, char *argv[]) diff --git a/tools/playground/copypaste.cpp b/tools/playground/copypaste.cpp index cc32c872f..4f584241e 100644 --- a/tools/playground/copypaste.cpp +++ b/tools/playground/copypaste.cpp @@ -13,7 +13,7 @@ #define DFHACK_WANT_MISCUTILS #define DFHACK_WANT_TILETYPES #include -#include "dfhack/modules/WindowIO.h" +#include "modules/WindowIO.h" using namespace DFHack; //bool waitTillCursorState(DFHack::Context *DF, bool On); diff --git a/tools/playground/creaturemanager.cpp b/tools/playground/creaturemanager.cpp index 59e94e9fc..0d65e9f6e 100644 --- a/tools/playground/creaturemanager.cpp +++ b/tools/playground/creaturemanager.cpp @@ -70,7 +70,7 @@ using namespace std; #define DFHACK_WANT_MISCUTILS #include -#include +#include /* Note about magic numbers: * If you have an idea how to better solve this, tell me. Currently I'd be diff --git a/tools/playground/digger.cpp b/tools/playground/digger.cpp index 16a90b682..86a9b84b2 100644 --- a/tools/playground/digger.cpp +++ b/tools/playground/digger.cpp @@ -13,7 +13,7 @@ using namespace std; #include -#include +#include #include // counts the occurances of a certain element in a vector diff --git a/tools/playground/digger2.cpp b/tools/playground/digger2.cpp index 80f202aa5..ea34b8c2c 100644 --- a/tools/playground/digger2.cpp +++ b/tools/playground/digger2.cpp @@ -22,7 +22,7 @@ using namespace std; #include -#include +#include #define BLOCK_SIZE 16 diff --git a/tools/playground/digpattern.cpp b/tools/playground/digpattern.cpp index f49df96c6..90d960ba1 100644 --- a/tools/playground/digpattern.cpp +++ b/tools/playground/digpattern.cpp @@ -9,7 +9,7 @@ using namespace std; #include -#include +#include using namespace MapExtras; //#include diff --git a/tools/playground/drawtile.cpp b/tools/playground/drawtile.cpp index 8610d7f0c..72f2beb0f 100644 --- a/tools/playground/drawtile.cpp +++ b/tools/playground/drawtile.cpp @@ -11,7 +11,7 @@ using namespace std; #include -#include +#include //Avoid including Windows.h because it causes name clashes extern "C" __declspec(dllimport) void __stdcall Sleep(unsigned long milliseconds); diff --git a/tools/playground/hellhole.cpp b/tools/playground/hellhole.cpp index ac7781a7c..a38d14cbf 100644 --- a/tools/playground/hellhole.cpp +++ b/tools/playground/hellhole.cpp @@ -16,8 +16,8 @@ using namespace std; #include -#include -#include +#include +#include using namespace DFHack; diff --git a/tools/playground/itemdesignator.cpp b/tools/playground/itemdesignator.cpp index a1211c013..63b41eb72 100644 --- a/tools/playground/itemdesignator.cpp +++ b/tools/playground/itemdesignator.cpp @@ -8,7 +8,7 @@ using namespace std; #include -#include +#include using namespace DFHack; int main () diff --git a/tools/playground/printtiletypes.cpp b/tools/playground/printtiletypes.cpp index 48fb35a44..6d37e0a1b 100644 --- a/tools/playground/printtiletypes.cpp +++ b/tools/playground/printtiletypes.cpp @@ -11,7 +11,7 @@ using namespace std; #include -#include +#include using namespace DFHack; diff --git a/tools/playground/renamer.cpp b/tools/playground/renamer.cpp index 8b3be7eb8..e82fd691e 100644 --- a/tools/playground/renamer.cpp +++ b/tools/playground/renamer.cpp @@ -8,9 +8,9 @@ using namespace std; #define DFHACK_WANT_MISCUTILS #include -#include -#include -#include +#include +#include +#include vector< vector > englishWords; vector< vector > foreignWords; diff --git a/tools/playground/veinswap.cpp b/tools/playground/veinswap.cpp index 47b83bb82..668386100 100644 --- a/tools/playground/veinswap.cpp +++ b/tools/playground/veinswap.cpp @@ -9,8 +9,8 @@ using namespace std; #include #include -#include -#include +#include +#include //Globals diff --git a/tools/supported/dfstatus.cpp b/tools/supported/dfstatus.cpp index 0ae2b3447..91c6f6589 100644 --- a/tools/supported/dfstatus.cpp +++ b/tools/supported/dfstatus.cpp @@ -24,8 +24,8 @@ #include using namespace std; #include -#include -#include +#include +#include WINDOW *create_newwin(int height, int width, int starty, int startx); diff --git a/tools/supported/lair.cpp b/tools/supported/lair.cpp index a0427f7c2..7bf3ddc28 100644 --- a/tools/supported/lair.cpp +++ b/tools/supported/lair.cpp @@ -5,7 +5,7 @@ #include using namespace std; #include -#include +#include int main (void) { diff --git a/tools/supported/position.cpp b/tools/supported/position.cpp index ca90b2532..1bf6cf098 100644 --- a/tools/supported/position.cpp +++ b/tools/supported/position.cpp @@ -7,7 +7,7 @@ using namespace std; #include -#include +#include std::ostream &operator<<(std::ostream &stream, DFHack::t_gamemodes funzies) { const char * gm[]=