From a0f99ef7079bb741dcfa44b7365e3b13f3ec9016 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 14 Aug 2011 08:42:21 +0200 Subject: [PATCH] Many tweaks to plugins, reorganized the build system and removed more cruft. --- CMakeLists.txt | 86 +++++++++++---------------- README.rst | 18 +++++- Readme.html | 103 ++++++++++++++++++++------------- library/CMakeLists.txt | 33 +++-------- library/Core.cpp | 7 ++- library/PluginManager.cpp | 4 +- library/doc/CMakeLists.txt | 2 +- package/linux/dfhack | 10 ++-- plugins/CMakeLists.txt | 30 ++-------- plugins/Dfusion/CMakeLists.txt | 3 +- plugins/autodump.cpp | 2 + plugins/deramp.cpp | 4 +- plugins/flows.cpp | 4 +- plugins/reveal.cpp | 39 +++++++++++++ plugins/tiletypes.cpp | 13 ++++- plugins/tubefill.cpp | 11 +++- plugins/vdig.cpp | 15 ++++- 17 files changed, 222 insertions(+), 162 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8de2f5174..3ed283e36 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,79 +9,65 @@ ${dfhack_SOURCE_DIR}/CMake/Modules ${CMAKE_MODULE_PATH} ) +# mixing the build system with the source code is ugly and stupid. enforce the opposite :) if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") message(FATAL_ERROR "In-source builds are not allowed.") endif() -set(DF_VERSION_MAJOR "0") -set(DF_VERSION_MINOR "31") -set(DF_VERSION_PATCH "25") -set(DFHACK_RELEASE "1") - -set(DF_VERSION "${DF_VERSION_MAJOR}.${DF_VERSION_MINOR}.${DF_VERSION_PATCH}") - -## setting the build type +## setting the build type. IF(NOT DEFINED CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "") SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Release RelWithDebInfo.") ENDIF() -SET(DFHACK_OUTPUT_DIR "${dfhack_BINARY_DIR}/bin" CACHE STRING "Where should be the produced libraries and binaries stored.") -SET(DFHACK_PLUGIN_OUTPUT_DIR "${DFHACK_OUTPUT_DIR}/plugins") +# set up versioning. +set(DF_VERSION_MAJOR "0") +set(DF_VERSION_MINOR "31") +set(DF_VERSION_PATCH "25") +set(DF_VERSION "${DF_VERSION_MAJOR}.${DF_VERSION_MINOR}.${DF_VERSION_PATCH}") -## where to put things during the build (force MSVC to behave) -SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${DFHACK_OUTPUT_DIR}) -SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG ${DFHACK_OUTPUT_DIR}) -SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG ${DFHACK_OUTPUT_DIR}) -SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${DFHACK_OUTPUT_DIR}) -SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE ${DFHACK_OUTPUT_DIR}) -SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${DFHACK_OUTPUT_DIR}) -SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${DFHACK_OUTPUT_DIR}) -SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL ${DFHACK_OUTPUT_DIR}) -SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_MINSIZEREL ${DFHACK_OUTPUT_DIR}) -SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${DFHACK_OUTPUT_DIR}) -SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO ${DFHACK_OUTPUT_DIR}) -SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELWITHDEBINFO ${DFHACK_OUTPUT_DIR}) +set(DFHACK_RELEASE "1") ## where to install things (after the build is done, classic 'make install' or package structure) # the dfhack libraries will be installed here: -SET(DFHACK_LIBRARY_DESTINATION .) -# the dfhack tools will be installed here: -SET(DFHACK_BINARY_DESTINATION .) -# Memory.xml goes here: -SET(DFHACK_DATA_DESTINATION .) -# Plugins go here -SET(DFHACK_PLUGIN_DESTINATION plugins) -# Includes go here: -SET(DFHACK_INCLUDES_DESTINATION dev/include) -# the Windows .lib files go here: -IF(WIN32) - SET(DFHACK_DEVLIB_DESTINATION dev) - SET(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION .) -ENDIF() IF(UNIX) - SET(CMAKE_INSTALL_RPATH "$ORIGIN") + # put the lib into DF/hack + SET(DFHACK_LIBRARY_DESTINATION hack) +ELSE() + # windows is crap, therefore we can't do nice things with it. leave the libs on a nasty pile... + SET(DFHACK_LIBRARY_DESTINATION .) ENDIF() - -# documentation goes here: -SET(DFHACK_USERDOC_DESTINATION .) -SET(DFHACK_DEVDOC_DESTINATION dev) -SET(DFHACK_DOXYGEN_DESTINATION dev/doxygen) +# external tools will be installed here: +SET(DFHACK_BINARY_DESTINATION .) +# dfhack data goes here: +SET(DFHACK_DATA_DESTINATION hack) +# plugin libs go here: +SET(DFHACK_PLUGIN_DESTINATION hack/plugins) +# dfhack header files go here: +SET(DFHACK_INCLUDES_DESTINATION hack/include) +# the windows .lib file goes here: +SET(DFHACK_DEVLIB_DESTINATION hack) + +# user documentation goes here: +SET(DFHACK_USERDOC_DESTINATION hack) +# developer documentation goes here: +SET(DFHACK_DEVDOC_DESTINATION hack) ## some options for the user/developer to play with OPTION(BUILD_LIBRARY "Build the library that goes into DF." ON) OPTION(BUILD_PLUGINS "Build the plugins." ON) -# build the static lua +# build the static lua for dfusion INCLUDE_DIRECTORIES ( lua/include ) add_subdirectory (lua) +# build the lib itself IF(BUILD_LIBRARY) - #add_subdirectory (dlib) add_subdirectory (library) ## install the default documentation files - install(FILES LICENSE Readme.html DESTINATION ${DFHACK_USERDOC_DESTINATION}) + install(FILES LICENSE Readme.html Compile.html DESTINATION ${DFHACK_USERDOC_DESTINATION}) endif() +#build the plugins IF(BUILD_PLUGINS) add_subdirectory (plugins) endif() @@ -89,14 +75,8 @@ endif() # Packaging with CPack! IF(UNIX) SET(CPACK_GENERATOR "TGZ") -ENDIF() -IF(WIN32) +ELSEIF(WIN32) SET(CPACK_GENERATOR "ZIP") - # this includes the MSVC C++ DLLs in the package. Doesn't work with Express versions in general. - # we should be fine with the stuff DF already has packaged... so, commenting out - # INCLUDE(InstallRequiredSystemLibraries) ENDIF() set(CPACK_PACKAGE_FILE_NAME "dfhack-${DF_VERSION}-r${DFHACK_RELEASE}-${CMAKE_SYSTEM_NAME}") INCLUDE(CPack) - - diff --git a/README.rst b/README.rst index baedba02d..cd9bc697f 100644 --- a/README.rst +++ b/README.rst @@ -108,6 +108,22 @@ deramp (by zilpin) Removes all ramps designated for removal from the map. This is useful for replicating the old channel digging designation. It also removes any and all 'down ramps' that can remain after a cave-in (you don't have to designate anything for that to happen). +dfusion +======= +This is the DFusion lua plugin system by warmist/darius, running as a DFHack plugin. + +See the bay12 thread for details: http://www.bay12forums.com/smf/index.php?topic=69682.15 + +Confirmed working DFusion plugins: +---------------------------------- +:simple_embark:allows changing the number of dwarves available on embark. + +.. note:: + + * Some of the DFusion plugins aren't completely ported yet. This can lead to crashes. + * This is currently working only on Windows. + * The game will be suspended while you're using dfusion. Don't panic when it doen't respond. + flows ===== A tool for checking how many tiles contain flowing liquids. If you suspect that your magma sea leaks into HFS, you can use this tool to be sure without revealing the map. @@ -197,7 +213,7 @@ This is an isometric visualizer that is runs in a second window. This requires working graphics acceleration, at least a dual core CPU (otherwise it will slow down DF) and on Linux, the allegro 5 libraries installed (look for 'allegro5' in your package manager app). -For further details, see the contents of 'DF/stonesense'. +All the data resides in the 'stonesense' directory. Older versions, support and extra graphics can be found in the bay12 forum thread: http://www.bay12forums.com/smf/index.php?topic=43260.0 diff --git a/Readme.html b/Readme.html index 3bcad2b76..a10d6356b 100644 --- a/Readme.html +++ b/Readme.html @@ -346,30 +346,34 @@ access DF memory and allow for easier development of new tools.

  • deramp (by zilpin)
  • -
  • flows
  • -
  • grow
  • -
  • extirpate @@ -487,20 +491,37 @@ By default, owned food on the floor and rotten items are confistacted and dumped

    Removes all ramps designated for removal from the map. This is useful for replicating the old channel digging designation. It also removes any and all 'down ramps' that can remain after a cave-in (you don't have to designate anything for that to happen).

    +
    +

    dfusion

    +

    This is the DFusion lua plugin system by warmist/darius, running as a DFHack plugin.

    +

    See the bay12 thread for details: http://www.bay12forums.com/smf/index.php?topic=69682.15

    +
    +

    Confirmed working DFusion plugins:

    +

    :simple_embark:allows changing the number of dwarves available on embark.

    +
    +

    Note

    +
      +
    • Some of the DFusion plugins aren't completely ported yet. This can lead to crashes.
    • +
    • This is currently working only on Windows.
    • +
    • The game will be suspended while you're using dfusion. Don't panic when it doen't respond.
    • +
    +
    +
    +
    -

    flows

    +

    flows

    A tool for checking how many tiles contain flowing liquids. If you suspect that your magma sea leaks into HFS, you can use this tool to be sure without revealing the map.

    -

    grow

    +

    grow

    Makes all saplings present on the map grow into trees (almost) instantly.

    -

    extirpate

    +

    extirpate

    A tool for getting rid of trees and shrubs. By default, it only kills a tree/shrub under the cursor. The plants are turned into ashes instantly.

    -

    Options

    +

    Options

    @@ -516,11 +537,11 @@ The plants are turned into ashes instantly.

    -

    immolate

    +

    immolate

    Very similar to extirpate, but additionally sets the plants on fire. The fires can and will spread ;)

    -

    liquids

    +

    liquids

    Allows adding magma, water and obsidian to the game. It replaces the normal dfhack command line and can't be used from a hotkey. For more information, refer to the command's internal help.

    @@ -530,7 +551,7 @@ temperatures (creating heat traps). You've been warned.

    -

    mode

    +

    mode

    This command lets you see and change the game mode directly. Not all combinations are good for every situation and most of them will produce undesirable results. There are a few good ones though.

    @@ -542,22 +563,22 @@ You just lost a fortress and gained an adventurer.

    I take no responsibility of anything that happens as a result of using this tool :P

    -

    forcepause

    +

    forcepause

    Forces DF to pause. This is useful when your FPS drops below 1 and you lose control of the game.

    -

    die

    +

    die

    Instantly kills DF without saving.

    -

    probe

    +

    probe

    Can be used to determine tile properties like temperature.

    -

    prospector

    +

    prospector

    Lists all available minerals on the map and how much of them there is. By default, only processes the already discovered part of the map.

    @@ -569,41 +590,41 @@ You just lost a fortress and gained an adventurer.

    -

    reveal

    +

    reveal

    This reveals the map. By default, HFS will remain hidden so that the demons don't spawn. You can use 'reveal hell' to reveal everything. With hell revealed, you won't be able to unpause until you hide the map again.

    -

    unreveal

    +

    unreveal

    Reverts the effects of 'reveal'.

    -

    revtoggle

    +

    revtoggle

    Switches between 'reveal' and 'unreveal'.

    -

    revflood

    +

    revflood

    This command will hide the whole map and then reveal all the tiles that have a path to the in-game cursor.

    -

    ssense / stonesense

    +

    ssense / stonesense

    This is an isometric visualizer that is runs in a second window.

    This requires working graphics acceleration, at least a dual core CPU (otherwise it will slow down DF) and on Linux, the allegro 5 libraries installed (look for 'allegro5' in your package manager app).

    -

    For further details, see the contents of 'DF/stonesense'.

    +

    All the data resides in the 'stonesense' directory.

    Older versions, support and extra graphics can be found in the bay12 forum thread: http://www.bay12forums.com/smf/index.php?topic=43260.0

    Some additional resources: http://df.magmawiki.com/index.php/Utility:Stonesense/Content_repository

    -

    tubefill

    +

    tubefill

    Fills all the adamantine veins again. Veins that were empty will be filled in too, but might still trigger a demon invasion (this is a known bug).

    -

    vdig

    +

    vdig

    Designates a whole vein for digging. Requires an active in-game cursor placed over a vein tile. With the 'x' option, it will traverse z-levels (putting stairs between the same-material tiles).

    -

    weather

    +

    weather

    Lets you change the current weather to 'clear sky', 'rainy' or 'snowing'. Fill those ponds without mucking around with dfliquids :D Rain can also stop brush fires.

    diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index d827cf3c1..47acbb3c9 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -122,13 +122,10 @@ IF(UNIX) SET(CMAKE_CXX_FLAGS_DEBUG "-g -Wall") SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -m32 -std=c++0x") SET(CMAKE_C_FLAGS "-fvisibility=hidden -m32") - SET(PROJECT_LIBS rt ) ELSE() IF(MSVC) SET(PROJECT_LIBS psapi ${dfhack_SOURCE_DIR}/library/depends/ntdll/ntdll.lib) - ELSE() - SET(PROJECT_LIBS psapi ntdll) ENDIF() ENDIF() @@ -138,40 +135,26 @@ IF(WIN32) SET_TARGET_PROPERTIES(dfhack PROPERTIES OUTPUT_NAME "SDL" ) ENDIF() +#effectively disables debug builds... SET_TARGET_PROPERTIES(dfhack PROPERTIES DEBUG_POSTFIX "-debug" ) TARGET_LINK_LIBRARIES(dfhack ${PROJECT_LIBS}) -ADD_CUSTOM_TARGET( prepare -DEPENDS ${dfhack_SOURCE_DIR}/Memory.xml -COMMAND ${CMAKE_COMMAND} -E make_directory ${DFHACK_OUTPUT_DIR} -COMMAND ${CMAKE_COMMAND} -E make_directory ${DFHACK_PLUGIN_OUTPUT_DIR} -COMMAND ${CMAKE_COMMAND} -E copy ${dfhack_SOURCE_DIR}/Memory.xml ${DFHACK_OUTPUT_DIR}) -ADD_DEPENDENCIES(dfhack prepare) - -# On linux, copy our version of the df launch script which sets LD_PRELOAD IF(UNIX) - ADD_CUSTOM_TARGET( prepare_UNIX - DEPENDS ${dfhack_SOURCE_DIR}/package/linux/dfhack - COMMAND ${CMAKE_COMMAND} -E make_directory ${DFHACK_OUTPUT_DIR} - COMMAND ${CMAKE_COMMAND} -E copy ${dfhack_SOURCE_DIR}/package/linux/dfhack ${DFHACK_OUTPUT_DIR}) - ADD_DEPENDENCIES(dfhack prepare_UNIX) + # On linux, copy our version of the df launch script which sets LD_PRELOAD install(PROGRAMS ${dfhack_SOURCE_DIR}/package/linux/dfhack - DESTINATION ${DFHACK_LIBRARY_DESTINATION}) + DESTINATION .) ELSE() -# On windows, copy the renamed SDL so DF can still run. - ADD_CUSTOM_TARGET( prepare_WINDOWS - DEPENDS ${dfhack_SOURCE_DIR}/package/windows/SDLreal.dll - COMMAND ${CMAKE_COMMAND} -E make_directory ${DFHACK_OUTPUT_DIR} - COMMAND ${CMAKE_COMMAND} -E copy ${dfhack_SOURCE_DIR}/package/windows/SDLreal.dll ${DFHACK_OUTPUT_DIR}) - ADD_DEPENDENCIES(dfhack prepare_WINDOWS) + # On windows, copy the renamed SDL so DF can still run. install(PROGRAMS ${dfhack_SOURCE_DIR}/package/windows/SDLreal.dll DESTINATION ${DFHACK_LIBRARY_DESTINATION}) ENDIF() - + +#install the main lib install(TARGETS dfhack LIBRARY DESTINATION ${DFHACK_LIBRARY_DESTINATION} - RUNTIME DESTINATION ${DFHACK_LIBRARY_DESTINATION}) #linux: lib + RUNTIME DESTINATION ${DFHACK_LIBRARY_DESTINATION}) +#install the offset file install(FILES ${dfhack_SOURCE_DIR}/Memory.xml DESTINATION ${DFHACK_DATA_DESTINATION}) #linux: share/dfhack diff --git a/library/Core.cpp b/library/Core.cpp index f07be9338..0ef386a96 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -399,7 +399,12 @@ bool Core::Init() return true; // find out what we are... - vif = new DFHack::VersionInfoFactory("Memory.xml"); + #ifdef LINUX_BUILD + const char * path = "hack/Memory.xml"; + #else + const char * path = "hack\\Memory.xml"; + #endif + vif = new DFHack::VersionInfoFactory(path); p = new DFHack::Process(vif); vinfo = p->getDescriptor(); // dump offsets to a file diff --git a/library/PluginManager.cpp b/library/PluginManager.cpp index 0a553ae63..7a7bb0981 100644 --- a/library/PluginManager.cpp +++ b/library/PluginManager.cpp @@ -307,10 +307,10 @@ Plugin::plugin_state Plugin::getState() const PluginManager::PluginManager(Core * core) { #ifdef LINUX_BUILD - string path = core->p->getPath() + "/plugins/"; + string path = core->p->getPath() + "/hack/plugins/"; const string searchstr = ".plug.so"; #else - string path = core->p->getPath() + "\\plugins\\"; + string path = core->p->getPath() + "\\hack\\plugins\\"; const string searchstr = ".plug.dll"; #endif cmdlist_mutex = new mutex(); diff --git a/library/doc/CMakeLists.txt b/library/doc/CMakeLists.txt index 0a4e5bd2d..085f21119 100644 --- a/library/doc/CMakeLists.txt +++ b/library/doc/CMakeLists.txt @@ -48,7 +48,7 @@ IF(DOXYGEN_FOUND) ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) - INSTALL( DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html/" DESTINATION ${DFHACK_DOXYGEN_DESTINATION} ) + INSTALL( DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/html/" DESTINATION ${DFHACK_DEVDOC_DESTINATION}/doxygen ) INSTALL( FILES "Doxygen.html" DESTINATION ${DFHACK_DEVDOC_DESTINATION}) ELSE(DOXYGEN_FOUND) MESSAGE (WARNING "Doxygen binary couldn't be found. Can't build development documentation.'") diff --git a/package/linux/dfhack b/package/linux/dfhack index da70301d8..8ed9ee816 100755 --- a/package/linux/dfhack +++ b/package/linux/dfhack @@ -38,28 +38,28 @@ fi case "$1" in -g | --gdb) shift - echo "set environment LD_PRELOAD=./libdfhack.so" > gdbcmd.tmp + echo "set environment LD_PRELOAD=./hack/libdfhack.so" > gdbcmd.tmp gdb $DF_GDB_OPTS -x gdbcmd.tmp ./libs/Dwarf_Fortress $* rm gdbcmd.tmp ret=$? ;; -h | --helgrind) shift - LD_PRELOAD=./libdfhack.so setarch i386 -R valgrind $DF_HELGRIND_OPTS --tool=helgrind --log-file=helgrind.log ./libs/Dwarf_Fortress $* + LD_PRELOAD=./hack/libdfhack.so setarch i386 -R valgrind $DF_HELGRIND_OPTS --tool=helgrind --log-file=helgrind.log ./libs/Dwarf_Fortress $* ret=$? ;; -v | --valgrind) shift - LD_PRELOAD=./libdfhack.so setarch i386 -R valgrind $DF_VALGRIND_OPTS --log-file=valgrind.log ./libs/Dwarf_Fortress $* + LD_PRELOAD=./hack/libdfhack.so setarch i386 -R valgrind $DF_VALGRIND_OPTS --log-file=valgrind.log ./libs/Dwarf_Fortress $* ret=$? ;; -c | --callgrind) shift - LD_PRELOAD=./libdfhack.so setarch i386 -R valgrind $DF_CALLGRIND_OPTS --tool=callgrind --separate-threads=yes --dump-instr=yes --instr-atstart=no --log-file=callgrind.log ./libs/Dwarf_Fortress $* + LD_PRELOAD=./hack/libdfhack.so setarch i386 -R valgrind $DF_CALLGRIND_OPTS --tool=callgrind --separate-threads=yes --dump-instr=yes --instr-atstart=no --log-file=callgrind.log ./libs/Dwarf_Fortress $* ret=$? ;; *) - LD_PRELOAD=./libdfhack.so setarch i386 -R ./libs/Dwarf_Fortress $* + LD_PRELOAD=./hack/libdfhack.so setarch i386 -R ./libs/Dwarf_Fortress $* ret=$? ;; esac diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index ec575af66..9946ef427 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -3,7 +3,7 @@ IF(UNIX) add_definitions(-DLINUX_BUILD) SET(CMAKE_CXX_FLAGS_DEBUG "-g -Wall") SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -m32 -std=c++0x") - SET(CMAKE_C_FLAGS "-fvisibility=hidden -m32 -std=c++0x") + SET(CMAKE_C_FLAGS "-fvisibility=hidden -m32") ENDIF() include_directories("${dfhack_SOURCE_DIR}/library/include") @@ -70,36 +70,18 @@ MACRO(DFHACK_PLUGIN) ELSE() SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES SUFFIX .plug.dll) ENDIF() - SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_RELEASE ${DFHACK_PLUGIN_OUTPUT_DIR}) - SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL ${DFHACK_PLUGIN_OUTPUT_DIR}) - SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO ${DFHACK_PLUGIN_OUTPUT_DIR}) install(TARGETS ${PLUGIN_NAME} LIBRARY DESTINATION ${DFHACK_PLUGIN_DESTINATION} RUNTIME DESTINATION ${DFHACK_PLUGIN_DESTINATION}) - #MESSAGE("Depends: ${PLUGIN_DEPENDS}") - #IF (PLUGIN_AUTO_INSTALL) - # MESSAGE("Auto install") - #ENDIF (PLUGIN_AUTO_INSTALL) - #IF (PLUGIN_NO_MODULE) - # MESSAGE("No module") - #ENDIF (PLUGIN_NO_MODULE) ENDMACRO(DFHACK_PLUGIN) -# add all subdirectories. can be used in those subdirectories, etc... -# needs a re-run of cmake to pick up the changes -#macro(RECURSE_DIRS) -# file(GLOB sub-dir RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *) -# foreach(dir ${sub-dir}) -# if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${dir}) -# add_subdirectory (${dir}) -# endif() -# endforeach() -#endmacro() - -#RECURSE_DIRS() # Dfusion plugin -OPTION(BUILD_DFUSION "Build DFusion." ON) +IF(UNIX) + OPTION(BUILD_DFUSION "Build DFusion." OFF) +ELSE() + OPTION(BUILD_DFUSION "Build DFusion." ON) +ENDIF() if(BUILD_DFUSION) add_subdirectory (Dfusion) endif() diff --git a/plugins/Dfusion/CMakeLists.txt b/plugins/Dfusion/CMakeLists.txt index 13dd1bd98..d17e66a23 100644 --- a/plugins/Dfusion/CMakeLists.txt +++ b/plugins/Dfusion/CMakeLists.txt @@ -7,4 +7,5 @@ set( ${DFUSION_CPPS} ) DFHACK_PLUGIN(dfusion ${DFUSION_CPPS_ALL} LINK_LIBRARIES lua) -install(DIRECTORY luafiles/ DESTINATION ${DFHACK_DATA_DESTINATION}/dfusion) +# installs into DF root +install(DIRECTORY luafiles/ DESTINATION dfusion) diff --git a/plugins/autodump.cpp b/plugins/autodump.cpp index 87e823140..701b091a4 100644 --- a/plugins/autodump.cpp +++ b/plugins/autodump.cpp @@ -63,6 +63,8 @@ DFhackCExport command_result df_autodump (Core * c, vector & parameters "Items are instantly moved to the cursor position, the dump flag is unset,\n" "and the forbid flag is set, as if it had been dumped normally.\n" "Be aware that any active dump item tasks still point at the item.\n\n" + "Options:\n" + "destroy - instead of dumping, destroy the items instantly.\n" ); return CR_OK; } diff --git a/plugins/deramp.cpp b/plugins/deramp.cpp index 49ee415d1..0aab27d20 100644 --- a/plugins/deramp.cpp +++ b/plugins/deramp.cpp @@ -56,8 +56,8 @@ DFhackCExport command_result df_deramp (Core * c, vector & parameters) if(parameters[i] == "help" || parameters[i] == "?") { c->con.print("This command does two things:\n" - "* If there are any ramps designated for removal, thyw will be instantly removed.\n" - "* Any ramps that don't have their counterpart will be removed (fixes bugs with caveins)\n" + "If there are any ramps designated for removal, they will be instantly removed.\n" + "Any ramps that don't have their counterpart will be removed (fixes bugs with caveins)\n" ); return CR_OK; } diff --git a/plugins/flows.cpp b/plugins/flows.cpp index 7343360e0..b82d01adb 100644 --- a/plugins/flows.cpp +++ b/plugins/flows.cpp @@ -24,7 +24,7 @@ DFhackCExport command_result plugin_init ( Core * c, std::vector { commands.clear(); commands.push_back(PluginCommand("flows", - "De-ramp. All ramps marked for removal are replaced with floors.", + "Counts map blocks with flowing liquids.", df_flows)); return CR_OK; } @@ -41,7 +41,7 @@ DFhackCExport command_result df_flows (Core * c, vector & parameters) DFHack::Maps *Maps; c->Suspend(); - + Maps = c->getMaps(); // init the map if(!Maps->Start()) { diff --git a/plugins/reveal.cpp b/plugins/reveal.cpp index 736ccb702..cf9a998a7 100644 --- a/plugins/reveal.cpp +++ b/plugins/reveal.cpp @@ -101,6 +101,19 @@ DFhackCExport command_result plugin_shutdown ( Core * c ) DFhackCExport command_result reveal(DFHack::Core * c, std::vector & params) { bool no_hell = true; + for(int i = 0; i < params.size();i++) + { + if(params[i]=="hell") + no_hell = false; + else if(params[i] == "help" || params[i] == "?") + { + c->con.print("Reveals the map, by default ignoring hell.\n" + "Options:\n" + "hell - also reveal hell, while forcing the game to pause.\n" + ); + return CR_OK; + } + } if(params.size() && params[0] == "hell") { no_hell = false; @@ -189,6 +202,14 @@ DFhackCExport command_result reveal(DFHack::Core * c, std::vector & DFhackCExport command_result unreveal(DFHack::Core * c, std::vector & params) { Console & con = c->con; + for(int i = 0; i < params.size();i++) + { + if(params[i] == "help" || params[i] == "?") + { + c->con.print("Reverts the previous reveal operation, hiding the map again.\n"); + return CR_OK; + } + } if(!revealed) { con.printerr("There's nothing to revert!\n"); @@ -244,6 +265,14 @@ DFhackCExport command_result unreveal(DFHack::Core * c, std::vector DFhackCExport command_result revtoggle (DFHack::Core * c, std::vector & params) { + for(int i = 0; i < params.size();i++) + { + if(params[i] == "help" || params[i] == "?") + { + c->con.print("Toggles between reveal and unreveal.\nCurrently it: "); + break; + } + } if(revealed) { return unreveal(c,params); @@ -256,6 +285,16 @@ DFhackCExport command_result revtoggle (DFHack::Core * c, std::vector & params) { + for(int i = 0; i < params.size();i++) + { + if(params[i] == "help" || params[i] == "?") + { + c->con.print("This command hides the whole map. Then, starting from the cursor,\n" + "reveals all accessible tiles. Allows repairing parma-revealed maps.\n" + ); + return CR_OK; + } + } c->Suspend(); uint32_t x_max,y_max,z_max; Maps * Maps = c->getMaps(); diff --git a/plugins/tiletypes.cpp b/plugins/tiletypes.cpp index 5fb5f7e72..16094e0f2 100644 --- a/plugins/tiletypes.cpp +++ b/plugins/tiletypes.cpp @@ -441,13 +441,24 @@ DFhackCExport command_result df_tiletypes (Core * c, vector & parameter DFHack::Maps *maps; DFHack::Gui *gui; + for(int i = 0; i < parameters.size();i++) + { + if(parameters[i] == "help" || parameters[i] == "?") + { + c->con.print("This tool allows painting tiles types with a brush, using an optional filter.\n" + "The tool is interactive, similarly to the liquids tool.\n" + "Further help is available inside.\n" + ); + return CR_OK; + } + } TileType filter, paint; Brush *brush = new RectangleBrush(1,1); bool end = false; std::string brushname = "point"; int width = 1, height = 1, z_levels = 1; - + c->con << "Welcome to the tiletype tool.\nType 'help' or '?' for a list of available commands, 'q' to quit.\nPress return after a command to confirm." << std::endl; while (!end) { c->con << "Filter: " << filter << std::endl diff --git a/plugins/tubefill.cpp b/plugins/tubefill.cpp index ac58327ef..1249c20fb 100644 --- a/plugins/tubefill.cpp +++ b/plugins/tubefill.cpp @@ -44,7 +44,16 @@ DFhackCExport command_result tubefill(DFHack::Core * c, std::vector uint64_t count = 0; int dirty=0; - + for(int i = 0; i < params.size();i++) + { + if(params[i] == "help" || params[i] == "?") + { + c->con.print("Replenishes mined out adamantine and hollow adamantine tubes.\n" + "May cause !!FUN!!\n" + ); + return CR_OK; + } + } c->Suspend(); DFHack::Maps *Mapz = c->getMaps(); diff --git a/plugins/vdig.cpp b/plugins/vdig.cpp index 967e44fdc..9f3166d44 100644 --- a/plugins/vdig.cpp +++ b/plugins/vdig.cpp @@ -40,8 +40,19 @@ DFhackCExport command_result vdig (Core * c, vector & parameters) { uint32_t x_max,y_max,z_max; bool updown = false; - if(parameters.size() && parameters[0]=="x") - updown = true; + for(int i = 0; i < parameters.size();i++) + { + if(parameters.size() && parameters[0]=="x") + updown = true; + else if(parameters[i] == "help" || parameters[i] == "?") + { + c->con.print("Designates a whole vein under the cursor for digging.\n" + "Options:\n" + "x - follow veins through z-levels with stairs.\n" + ); + return CR_OK; + } + } Console & con = c->con;