From 5aa246f6b0fb62b472386b9830c3734c6f27c9e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Vuchener?= Date: Sat, 8 Apr 2023 12:33:24 +0200 Subject: [PATCH 01/80] plugins: include proto directory from current source directory Updated remotefortressreader for the new behavior. --- plugins/Plugins.cmake | 10 +++++----- plugins/remotefortressreader/CMakeLists.txt | 16 +--------------- plugins/remotefortressreader/proto/.gitignore | 3 +++ .../proto/AdventureControl.proto | 0 .../proto/DwarfControl.proto | 0 .../proto/ItemdefInstrument.proto | 0 .../proto/RemoteFortressReader.proto | 0 .../proto/ui_sidebar_mode.proto | 0 8 files changed, 9 insertions(+), 20 deletions(-) create mode 100644 plugins/remotefortressreader/proto/.gitignore rename plugins/{ => remotefortressreader}/proto/AdventureControl.proto (100%) rename plugins/{ => remotefortressreader}/proto/DwarfControl.proto (100%) rename plugins/{ => remotefortressreader}/proto/ItemdefInstrument.proto (100%) rename plugins/{ => remotefortressreader}/proto/RemoteFortressReader.proto (100%) rename plugins/{ => remotefortressreader}/proto/ui_sidebar_mode.proto (100%) diff --git a/plugins/Plugins.cmake b/plugins/Plugins.cmake index db7582c09..a0cea765f 100644 --- a/plugins/Plugins.cmake +++ b/plugins/Plugins.cmake @@ -6,11 +6,6 @@ if(UNIX) endif() endif() -include_directories("${dfhack_SOURCE_DIR}/library/include") -include_directories("${dfhack_SOURCE_DIR}/library/proto") -include_directories("${CMAKE_CURRENT_SOURCE_DIR}/proto") -include_directories("${dfhack_SOURCE_DIR}/library/depends/xgetopt") - macro(car var) set(${var} ${ARGV1}) endmacro() @@ -123,6 +118,11 @@ macro(dfhack_plugin) add_library(${PLUGIN_NAME} MODULE ${PLUGIN_SOURCES}) ide_folder(${PLUGIN_NAME} "Plugins") + target_include_directories(${PLUGIN_NAME} PRIVATE "${dfhack_SOURCE_DIR}/library/include") + target_include_directories(${PLUGIN_NAME} PRIVATE "${dfhack_SOURCE_DIR}/library/proto") + target_include_directories(${PLUGIN_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/proto") + target_include_directories(${PLUGIN_NAME} PRIVATE "${dfhack_SOURCE_DIR}/library/depends/xgetopt") + if(NUM_PROTO) add_dependencies(${PLUGIN_NAME} generate_proto_${PLUGIN_NAME}) target_link_libraries(${PLUGIN_NAME} dfhack protobuf-lite dfhack-version ${PLUGIN_LINK_LIBRARIES}) diff --git a/plugins/remotefortressreader/CMakeLists.txt b/plugins/remotefortressreader/CMakeLists.txt index 55525bc21..262d163f1 100644 --- a/plugins/remotefortressreader/CMakeLists.txt +++ b/plugins/remotefortressreader/CMakeLists.txt @@ -24,23 +24,9 @@ set(PROJECT_PROTO ui_sidebar_mode ) -set(PLUGIN_PROTOS) -foreach(pbuf ${PROJECT_PROTO}) - list(APPEND PLUGIN_PROTOS ${CMAKE_CURRENT_SOURCE_DIR}/../proto/${pbuf}.proto) -endforeach() - -string(REPLACE ".proto" ".pb.cc" PLUGIN_PROTO_SRCS "${PLUGIN_PROTOS}") -string(REPLACE ".proto" ".pb.h" PLUGIN_PROTO_HDRS "${PLUGIN_PROTOS}") -set_source_files_properties(${PLUGIN_PROTO_SRCS} ${PLUGIN_PROTO_HDRS} PROPERTIES GENERATED TRUE) - -set_source_files_properties( ${PROJECT_HDRS} ${PLUGIN_PROTO_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE) - -# mash them together (headers are marked as headers and nothing will try to compile them) -list(APPEND PROJECT_SRCS ${PROJECT_HDRS} ${PLUGIN_PROTOS} ${PLUGIN_PROTO_SRCS} ${PLUGIN_PROTO_HDRS}) - if(UNIX AND NOT APPLE) set(PROJECT_LIBS ${PROJECT_LIBS} SDL) endif() # this makes sure all the stuff is put in proper places and linked to dfhack -dfhack_plugin(RemoteFortressReader ${PROJECT_SRCS} LINK_LIBRARIES protobuf-lite ${PROJECT_LIBS} COMPILE_FLAGS_MSVC "/FI\"Export.h\"" COMPILE_FLAGS_GCC "-include Export.h -Wno-misleading-indentation" ) +dfhack_plugin(RemoteFortressReader ${PROJECT_SRCS} LINK_LIBRARIES ${PROJECT_LIBS} PROTOBUFS ${PROJECT_PROTO}) diff --git a/plugins/remotefortressreader/proto/.gitignore b/plugins/remotefortressreader/proto/.gitignore new file mode 100644 index 000000000..befabf79d --- /dev/null +++ b/plugins/remotefortressreader/proto/.gitignore @@ -0,0 +1,3 @@ +*.pb.cc +*.pb.cc.rule +*.pb.h diff --git a/plugins/proto/AdventureControl.proto b/plugins/remotefortressreader/proto/AdventureControl.proto similarity index 100% rename from plugins/proto/AdventureControl.proto rename to plugins/remotefortressreader/proto/AdventureControl.proto diff --git a/plugins/proto/DwarfControl.proto b/plugins/remotefortressreader/proto/DwarfControl.proto similarity index 100% rename from plugins/proto/DwarfControl.proto rename to plugins/remotefortressreader/proto/DwarfControl.proto diff --git a/plugins/proto/ItemdefInstrument.proto b/plugins/remotefortressreader/proto/ItemdefInstrument.proto similarity index 100% rename from plugins/proto/ItemdefInstrument.proto rename to plugins/remotefortressreader/proto/ItemdefInstrument.proto diff --git a/plugins/proto/RemoteFortressReader.proto b/plugins/remotefortressreader/proto/RemoteFortressReader.proto similarity index 100% rename from plugins/proto/RemoteFortressReader.proto rename to plugins/remotefortressreader/proto/RemoteFortressReader.proto diff --git a/plugins/proto/ui_sidebar_mode.proto b/plugins/remotefortressreader/proto/ui_sidebar_mode.proto similarity index 100% rename from plugins/proto/ui_sidebar_mode.proto rename to plugins/remotefortressreader/proto/ui_sidebar_mode.proto From b9d95c5a0bbc68846952c54ed91959ac55835b1f Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Thu, 13 Apr 2023 18:53:11 -0700 Subject: [PATCH 02/80] bump version to 50.08-rc1 --- CMakeLists.txt | 6 +++--- library/xml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b9f323640..bb5c428a6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -191,9 +191,9 @@ if(NOT EXISTS ${dfhack_SOURCE_DIR}/library/xml/codegen.pl endif() # set up versioning. -set(DF_VERSION "50.07") -set(DFHACK_RELEASE "r1") -set(DFHACK_PRERELEASE FALSE) +set(DF_VERSION "50.08") +set(DFHACK_RELEASE "rc1") +set(DFHACK_PRERELEASE TRUE) set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}") diff --git a/library/xml b/library/xml index 43a89a268..e825025d3 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit 43a89a268b825fc05457678b19e551bf632dcd19 +Subproject commit e825025d399d936548c77578d4a40eb23183af0c From 52b869d908aa55410db0574610e64f69bb5502b6 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Fri, 14 Apr 2023 01:22:12 -0700 Subject: [PATCH 03/80] don't read cur_savegame.save_dir when invalid --- library/Core.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/library/Core.cpp b/library/Core.cpp index b1fe2d389..e9463ec51 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -2083,7 +2083,9 @@ void Core::handleLoadAndUnloadScripts(color_ostream& out, state_change_event eve if (!df::global::world) return; - std::string rawFolder = "save/" + (df::global::world->cur_savegame.save_dir) + "/init"; + + std::string rawFolder = !isWorldLoaded() ? "" : + "save/" + (df::global::world->cur_savegame.save_dir) + "/init"; auto i = table.find(event); if ( i != table.end() ) { From 5ace09fad0addc0fa02ff26bd27affa573fd39b1 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Fri, 14 Apr 2023 01:38:38 -0700 Subject: [PATCH 04/80] use the World module for the data read --- library/Core.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/library/Core.cpp b/library/Core.cpp index e9463ec51..c3c7bb7f2 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -2084,8 +2084,7 @@ void Core::handleLoadAndUnloadScripts(color_ostream& out, state_change_event eve if (!df::global::world) return; - std::string rawFolder = !isWorldLoaded() ? "" : - "save/" + (df::global::world->cur_savegame.save_dir) + "/init"; + std::string rawFolder = !isWorldLoaded() ? "" : "save/" + World::ReadWorldFolder() + "/init"; auto i = table.find(event); if ( i != table.end() ) { From ce6adabbdcf50c4c0a1d071c7f874d697eaeb578 Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Fri, 14 Apr 2023 05:52:24 -0500 Subject: [PATCH 05/80] sync library/xml to 50.08-beta --- library/xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/xml b/library/xml index e825025d3..055f9b4ce 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit e825025d399d936548c77578d4a40eb23183af0c +Subproject commit 055f9b4cec3bbec8e562f4774754242a14026bd2 From 051baa4e6e2ad27d0a514bbf5da68b31f25ebb96 Mon Sep 17 00:00:00 2001 From: DFHack-Urist via GitHub Actions <63161697+DFHack-Urist@users.noreply.github.com> Date: Sat, 15 Apr 2023 07:12:55 +0000 Subject: [PATCH 06/80] Auto-update submodules library/xml: master --- library/xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/xml b/library/xml index e825025d3..43059670e 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit e825025d399d936548c77578d4a40eb23183af0c +Subproject commit 43059670e7d3338d9a164bc23d0c41994187de9c From ef380e9e1c7b4e019b4e0b31c65cf16f234043c7 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sat, 15 Apr 2023 15:49:36 -0700 Subject: [PATCH 07/80] don't reset planner panel minimized state --- docs/changelog.txt | 1 + plugins/lua/buildingplan/planneroverlay.lua | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index 351e13d76..975caf91f 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -38,6 +38,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## Fixes ## Misc Improvements +- `buildingplan`: minimized planner panel stays minimized until you change it again ## Documentation diff --git a/plugins/lua/buildingplan/planneroverlay.lua b/plugins/lua/buildingplan/planneroverlay.lua index 3e06ac79d..8f12c695f 100644 --- a/plugins/lua/buildingplan/planneroverlay.lua +++ b/plugins/lua/buildingplan/planneroverlay.lua @@ -729,7 +729,6 @@ function PlannerOverlay:onInput(keys) return true end self.selected = 1 - self.minimized = false self.subviews.hollow:setOption(false) self:reset() reset_counts_flag = true From af1d886a27a6f3c2cec8d3de1492c75d528aa74e Mon Sep 17 00:00:00 2001 From: DFHack-Urist via GitHub Actions <63161697+DFHack-Urist@users.noreply.github.com> Date: Sun, 16 Apr 2023 03:28:37 +0000 Subject: [PATCH 08/80] Auto-update submodules scripts: master --- scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts b/scripts index ec1a69788..7e7a1034c 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit ec1a69788fd6329008672523b622fd8b390fea73 +Subproject commit 7e7a1034c502909fdbb73398865958230da67c69 From a5e2d79e39f0fbaad03e70d16eae7e95be146bbe Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sat, 15 Apr 2023 21:05:05 -0700 Subject: [PATCH 09/80] remove stubs for deprecated travis scripts --- travis/authors-rst.py | 14 -------------- travis/buildmaster-rebuild-pr.py | 14 -------------- travis/check-rpc.py | 14 -------------- travis/download-df.sh | 9 --------- travis/get-df-version.sh | 9 --------- travis/lint.py | 14 -------------- travis/run-tests.py | 14 -------------- travis/script-docs.py | 14 -------------- travis/script-syntax.py | 14 -------------- 9 files changed, 116 deletions(-) delete mode 100755 travis/authors-rst.py delete mode 100755 travis/buildmaster-rebuild-pr.py delete mode 100755 travis/check-rpc.py delete mode 100755 travis/download-df.sh delete mode 100755 travis/get-df-version.sh delete mode 100755 travis/lint.py delete mode 100755 travis/run-tests.py delete mode 100755 travis/script-docs.py delete mode 100755 travis/script-syntax.py diff --git a/travis/authors-rst.py b/travis/authors-rst.py deleted file mode 100755 index cf52385b5..000000000 --- a/travis/authors-rst.py +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env python3 - -import os -import subprocess -import sys - -script_name = os.path.basename(__file__) -new_script_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'ci', script_name) - -sys.stderr.write('\nNote: travis/{script_name} is deprecated. Use ci/{script_name} instead.\n\n'.format(script_name=script_name)) -sys.stderr.flush() - -p = subprocess.run([sys.executable, new_script_path] + sys.argv[1:]) -sys.exit(p.returncode) diff --git a/travis/buildmaster-rebuild-pr.py b/travis/buildmaster-rebuild-pr.py deleted file mode 100755 index cf52385b5..000000000 --- a/travis/buildmaster-rebuild-pr.py +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env python3 - -import os -import subprocess -import sys - -script_name = os.path.basename(__file__) -new_script_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'ci', script_name) - -sys.stderr.write('\nNote: travis/{script_name} is deprecated. Use ci/{script_name} instead.\n\n'.format(script_name=script_name)) -sys.stderr.flush() - -p = subprocess.run([sys.executable, new_script_path] + sys.argv[1:]) -sys.exit(p.returncode) diff --git a/travis/check-rpc.py b/travis/check-rpc.py deleted file mode 100755 index cf52385b5..000000000 --- a/travis/check-rpc.py +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env python3 - -import os -import subprocess -import sys - -script_name = os.path.basename(__file__) -new_script_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'ci', script_name) - -sys.stderr.write('\nNote: travis/{script_name} is deprecated. Use ci/{script_name} instead.\n\n'.format(script_name=script_name)) -sys.stderr.flush() - -p = subprocess.run([sys.executable, new_script_path] + sys.argv[1:]) -sys.exit(p.returncode) diff --git a/travis/download-df.sh b/travis/download-df.sh deleted file mode 100755 index aec2d6d99..000000000 --- a/travis/download-df.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -script_name="$(basename "$0")" -new_script_path="$(dirname "$0")/../ci/${script_name}" - -printf >&2 "\nNote: travis/%s is deprecated. Use ci/%s instead.\n\n" "${script_name}" "${script_name}" - -"${new_script_path}" "$@" -exit $? diff --git a/travis/get-df-version.sh b/travis/get-df-version.sh deleted file mode 100755 index aec2d6d99..000000000 --- a/travis/get-df-version.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -script_name="$(basename "$0")" -new_script_path="$(dirname "$0")/../ci/${script_name}" - -printf >&2 "\nNote: travis/%s is deprecated. Use ci/%s instead.\n\n" "${script_name}" "${script_name}" - -"${new_script_path}" "$@" -exit $? diff --git a/travis/lint.py b/travis/lint.py deleted file mode 100755 index cf52385b5..000000000 --- a/travis/lint.py +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env python3 - -import os -import subprocess -import sys - -script_name = os.path.basename(__file__) -new_script_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'ci', script_name) - -sys.stderr.write('\nNote: travis/{script_name} is deprecated. Use ci/{script_name} instead.\n\n'.format(script_name=script_name)) -sys.stderr.flush() - -p = subprocess.run([sys.executable, new_script_path] + sys.argv[1:]) -sys.exit(p.returncode) diff --git a/travis/run-tests.py b/travis/run-tests.py deleted file mode 100755 index cf52385b5..000000000 --- a/travis/run-tests.py +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env python3 - -import os -import subprocess -import sys - -script_name = os.path.basename(__file__) -new_script_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'ci', script_name) - -sys.stderr.write('\nNote: travis/{script_name} is deprecated. Use ci/{script_name} instead.\n\n'.format(script_name=script_name)) -sys.stderr.flush() - -p = subprocess.run([sys.executable, new_script_path] + sys.argv[1:]) -sys.exit(p.returncode) diff --git a/travis/script-docs.py b/travis/script-docs.py deleted file mode 100755 index cf52385b5..000000000 --- a/travis/script-docs.py +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env python3 - -import os -import subprocess -import sys - -script_name = os.path.basename(__file__) -new_script_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'ci', script_name) - -sys.stderr.write('\nNote: travis/{script_name} is deprecated. Use ci/{script_name} instead.\n\n'.format(script_name=script_name)) -sys.stderr.flush() - -p = subprocess.run([sys.executable, new_script_path] + sys.argv[1:]) -sys.exit(p.returncode) diff --git a/travis/script-syntax.py b/travis/script-syntax.py deleted file mode 100755 index cf52385b5..000000000 --- a/travis/script-syntax.py +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env python3 - -import os -import subprocess -import sys - -script_name = os.path.basename(__file__) -new_script_path = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'ci', script_name) - -sys.stderr.write('\nNote: travis/{script_name} is deprecated. Use ci/{script_name} instead.\n\n'.format(script_name=script_name)) -sys.stderr.flush() - -p = subprocess.run([sys.executable, new_script_path] + sys.argv[1:]) -sys.exit(p.returncode) From c596df2bc57585993e7544908a3c1c8643e5d8dc Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sat, 15 Apr 2023 21:30:51 -0700 Subject: [PATCH 10/80] update new authors from 01 Feb 2023 - 15 Apr 2023 --- docs/about/Authors.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/about/Authors.rst b/docs/about/Authors.rst index 75b9eb4f7..020ed5e76 100644 --- a/docs/about/Authors.rst +++ b/docs/about/Authors.rst @@ -45,6 +45,7 @@ cjhammel cjhammel Clayton Hughes Clément Vuchener cvuchener Corey CoreyJ87 +Cubittus Cubittus daedsidog daedsidog Dan Amlund danamlund Daniel Brooks db48x @@ -133,6 +134,7 @@ Milo Christiansen milochristiansen MithrilTuxedo MithrilTuxedo mizipzor mizipzor moversti moversti +mrrho mrrho Murad Beybalaev Erquint Myk Taylor myk002 napagokc napagokc @@ -158,6 +160,7 @@ Petr Mrázek peterix Pfhreak Pfhreak Pierre Lulé plule Pierre-David Bélanger pierredavidbelanger +PopnROFL PopnROFL potato ppaawwll ppaawwll 🐇🐇🐇🐇 Priit Laes plaes @@ -201,6 +204,7 @@ SeerSkye SeerSkye seishuuu seishuuu Seth Woodworth sethwoodworth Shim Panze Shim-Panze +silverflyone silverflyone simon Simon Jackson sizeak Simon Lees simotek @@ -235,6 +239,7 @@ ViTuRaS ViTuRaS Vjek vjek Warmist warmist Wes Malone wesQ3 +Will H TSM-EVO Will Rogers wjrogers WoosterUK WoosterUK XianMaeve XianMaeve From 67f50eafb0cee72a96b2a890023b4859232c90ed Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sat, 15 Apr 2023 22:26:38 -0700 Subject: [PATCH 11/80] add alias and keybinding for toggling the keyboard cursor --- data/init/dfhack.keybindings.init | 3 +++ data/init/dfhack.tools.init | 1 + docs/changelog.txt | 1 + 3 files changed, 5 insertions(+) diff --git a/data/init/dfhack.keybindings.init b/data/init/dfhack.keybindings.init index 8ce0c3696..0fc596215 100644 --- a/data/init/dfhack.keybindings.init +++ b/data/init/dfhack.keybindings.init @@ -49,6 +49,9 @@ keybinding add Ctrl-H@dwarfmode autodump-destroy-here # apply blueprints to the map keybinding add Ctrl-Shift-Q@dwarfmode gui/quickfort +# toggle keyboard cursor +keybinding add Alt-K@dwarfmode toggle-kbd-cursor + # show information collected by dwarfmonitor #keybinding add Alt-M@dwarfmode/Default "dwarfmonitor prefs" #keybinding add Ctrl-F@dwarfmode/Default "dwarfmonitor stats" diff --git a/data/init/dfhack.tools.init b/data/init/dfhack.tools.init index aaf0cf277..8fd815559 100644 --- a/data/init/dfhack.tools.init +++ b/data/init/dfhack.tools.init @@ -144,3 +144,4 @@ enable \ alias add autounsuspend suspendmanager alias add gui/dig gui/design +alias add toggle-kbd-cursor lua "local flags4 = df.global.d_init.flags4 if flags4.KEYBOARD_CURSOR then flags4.KEYBOARD_CURSOR = false else local guidm = require('gui.dwarfmode') guidm.setCursorPos(guidm.Viewport.get():getCenter()) flags4.KEYBOARD_CURSOR = true end" diff --git a/docs/changelog.txt b/docs/changelog.txt index 351e13d76..3806dd125 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -38,6 +38,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## Fixes ## Misc Improvements +- ``toggle-kbd-cursor``: add hotkey for toggling the keyboard cursor (Alt-K) ## Documentation From 86845c5bbff2b58bd5b12f49d7184a4bafd5c36c Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sun, 16 Apr 2023 09:50:57 -0700 Subject: [PATCH 12/80] update author names as per feedback --- docs/about/Authors.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/about/Authors.rst b/docs/about/Authors.rst index 020ed5e76..cf74c6412 100644 --- a/docs/about/Authors.rst +++ b/docs/about/Authors.rst @@ -12,6 +12,7 @@ Name Github Other 8Z 8Z Abel abstern acwatkins acwatkins +Alex Blamey Cubittus Alexander Collins gearsix Alexander Gavrilov angavrilov ag Amber Brown hawkowl @@ -45,7 +46,6 @@ cjhammel cjhammel Clayton Hughes Clément Vuchener cvuchener Corey CoreyJ87 -Cubittus Cubittus daedsidog daedsidog Dan Amlund danamlund Daniel Brooks db48x @@ -204,7 +204,7 @@ SeerSkye SeerSkye seishuuu seishuuu Seth Woodworth sethwoodworth Shim Panze Shim-Panze -silverflyone silverflyone +Silver silverflyone simon Simon Jackson sizeak Simon Lees simotek From 1ec6d90e463cdb270f6f4828064ff5ce4ddb9b6a Mon Sep 17 00:00:00 2001 From: DFHack-Urist via GitHub Actions <63161697+DFHack-Urist@users.noreply.github.com> Date: Mon, 17 Apr 2023 01:06:59 +0000 Subject: [PATCH 13/80] Auto-update submodules scripts: master --- scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts b/scripts index 7e7a1034c..726e5633f 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit 7e7a1034c502909fdbb73398865958230da67c69 +Subproject commit 726e5633fd2aa1e0872a3f1553d8823505fca10e From 2dbfa37f54d74168b6f880d68c43617dadf13dd3 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sun, 16 Apr 2023 22:32:50 -0700 Subject: [PATCH 14/80] set version number for feedback release --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index bb5c428a6..239892e76 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -191,8 +191,8 @@ if(NOT EXISTS ${dfhack_SOURCE_DIR}/library/xml/codegen.pl endif() # set up versioning. -set(DF_VERSION "50.08") -set(DFHACK_RELEASE "rc1") +set(DF_VERSION "50.07") +set(DFHACK_RELEASE "r2rc1") set(DFHACK_PRERELEASE TRUE) set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}") From d1d521fbdb07eb72e57d2918b48d6c7cfd9a37b3 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sun, 16 Apr 2023 22:34:29 -0700 Subject: [PATCH 15/80] infrastructure for hiding the terminal console on startup --- docs/changelog.txt | 1 + library/Core.cpp | 9 +++++++++ library/lua/dfhack.lua | 7 +++++++ 3 files changed, 17 insertions(+) diff --git a/docs/changelog.txt b/docs/changelog.txt index f7a3102cc..3bb16251c 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -40,6 +40,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## Misc Improvements - `buildingplan`: minimized planner panel stays minimized until you change it again - ``toggle-kbd-cursor``: add hotkey for toggling the keyboard cursor (Alt-K) +- `gui/control-panel`: add option for hiding the terminal console by default ## Documentation diff --git a/library/Core.cpp b/library/Core.cpp index c3c7bb7f2..4f06c3d62 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -1314,6 +1314,15 @@ static void run_dfhack_init(color_ostream &out, Core *core) // load user overrides std::vector prefixes(1, "dfhack"); loadScriptFiles(core, out, prefixes, CONFIG_PATH + "init"); + + // if the option is set, hide the terminal + auto L = Lua::Core::State; + Lua::StackUnwinder top(L); + Lua::CallLuaModuleFunction(out, L, "dfhack", "getHideConsoleOnStartup", 0, 1, + Lua::DEFAULT_LUA_LAMBDA, [&](lua_State* L) { + if (lua_toboolean(L, -1)) + core->getConsole().hide(); + }, false); } // Load dfhack.init in a dedicated thread (non-interactive console mode) diff --git a/library/lua/dfhack.lua b/library/lua/dfhack.lua index aa33b62d6..bc543fd10 100644 --- a/library/lua/dfhack.lua +++ b/library/lua/dfhack.lua @@ -51,6 +51,13 @@ if dfhack.is_core_context then SC_UNPAUSED = 8 end +-- User-changeable options + +dfhack.HIDE_CONSOLE_ON_STARTUP = true +function dfhack.getHideConsoleOnStartup() + return dfhack.HIDE_CONSOLE_ON_STARTUP +end + -- Error handling safecall = dfhack.safecall From 16fbea4c1f2bd1e8eac9cbcfc6757eb659be1612 Mon Sep 17 00:00:00 2001 From: DFHack-Urist via GitHub Actions <63161697+DFHack-Urist@users.noreply.github.com> Date: Mon, 17 Apr 2023 05:56:19 +0000 Subject: [PATCH 16/80] Auto-update submodules scripts: master --- scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts b/scripts index 726e5633f..5fe9e423b 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit 726e5633fd2aa1e0872a3f1553d8823505fca10e +Subproject commit 5fe9e423bbd5cdb7c6e7e8f1051e3aa8d00c853a From a7aded65e44d95c592eb6713e2a1b9c94028c86d Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 17 Apr 2023 01:04:03 -0700 Subject: [PATCH 17/80] match new gems category --- library/modules/Materials.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/library/modules/Materials.cpp b/library/modules/Materials.cpp index d73b59922..7a1ef249f 100644 --- a/library/modules/Materials.cpp +++ b/library/modules/Materials.cpp @@ -439,6 +439,7 @@ bool MaterialInfo::matches(const df::dfhack_material_category &cat) const return true; if (cat.bits.milk && linear_index(material->reaction_product.id, std::string("CHEESE_MAT")) >= 0) return true; + TEST(gem, IS_GEM); return false; } From 77c2458900b9cc6d04b7cd9cdfaaaad4a0f7a433 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 17 Apr 2023 01:05:25 -0700 Subject: [PATCH 18/80] filter by gems (for windows) --- plugins/buildingplan/buildingplan.cpp | 9 +++++++++ plugins/lua/buildingplan.lua | 2 ++ plugins/lua/buildingplan/filterselection.lua | 1 + 3 files changed, 12 insertions(+) diff --git a/plugins/buildingplan/buildingplan.cpp b/plugins/buildingplan/buildingplan.cpp index 1d9f58416..e2f964a44 100644 --- a/plugins/buildingplan/buildingplan.cpp +++ b/plugins/buildingplan/buildingplan.cpp @@ -150,6 +150,7 @@ static const df::dfhack_material_category stone_cat(df::dfhack_material_category static const df::dfhack_material_category wood_cat(df::dfhack_material_category::mask_wood); static const df::dfhack_material_category metal_cat(df::dfhack_material_category::mask_metal); static const df::dfhack_material_category glass_cat(df::dfhack_material_category::mask_glass); +static const df::dfhack_material_category gem_cat(df::dfhack_material_category::mask_gem); static const df::dfhack_material_category clay_cat(df::dfhack_material_category::mask_clay); static const df::dfhack_material_category cloth_cat(df::dfhack_material_category::mask_cloth); static const df::dfhack_material_category silk_cat(df::dfhack_material_category::mask_silk); @@ -169,6 +170,9 @@ static void cache_matched(int16_t type, int32_t index) { } else if (mi.matches(glass_cat)) { DEBUG(status).print("cached glass material: %s (%d, %d)\n", mi.toString().c_str(), type, index); mat_cache.emplace(mi.toString(), std::make_pair(mi, "glass")); + } else if (mi.matches(gem_cat)) { + DEBUG(status).print("cached gem material: %s (%d, %d)\n", mi.toString().c_str(), type, index); + mat_cache.emplace(mi.toString(), std::make_pair(mi, "gem")); } else if (mi.matches(clay_cat)) { DEBUG(status).print("cached clay material: %s (%d, %d)\n", mi.toString().c_str(), type, index); mat_cache.emplace(mi.toString(), std::make_pair(mi, "clay")); @@ -800,6 +804,8 @@ static int setMaterialMaskFilter(lua_State *L) { mask |= metal_cat.whole; else if (cat == "glass") mask |= glass_cat.whole; + else if (cat == "gem") + mask |= gem_cat.whole; else if (cat == "clay") mask |= clay_cat.whole; else if (cat == "cloth") @@ -850,6 +856,7 @@ static int getMaterialMaskFilter(lua_State *L) { ret.emplace("wood", !bits || bits & wood_cat.whole); ret.emplace("metal", !bits || bits & metal_cat.whole); ret.emplace("glass", !bits || bits & glass_cat.whole); + ret.emplace("gem", !bits || bits & gem_cat.whole); ret.emplace("clay", !bits || bits & clay_cat.whole); ret.emplace("cloth", !bits || bits & cloth_cat.whole); ret.emplace("silk", !bits || bits & silk_cat.whole); @@ -897,6 +904,8 @@ static int setMaterialFilter(lua_State *L) { mask.whole |= metal_cat.whole; else if (mat.matches(glass_cat)) mask.whole |= glass_cat.whole; + else if (mat.matches(gem_cat)) + mask.whole |= gem_cat.whole; else if (mat.matches(clay_cat)) mask.whole |= clay_cat.whole; else if (mat.matches(cloth_cat)) diff --git a/plugins/lua/buildingplan.lua b/plugins/lua/buildingplan.lua index 2de467f7c..d64317eb0 100644 --- a/plugins/lua/buildingplan.lua +++ b/plugins/lua/buildingplan.lua @@ -111,6 +111,8 @@ function get_desc(filter) desc = 'Ballista part' elseif desc == 'Catapultpart' then desc = 'Catapult part' + elseif desc == 'Smallgem' then + desc = 'Small, cut gem' end return desc diff --git a/plugins/lua/buildingplan/filterselection.lua b/plugins/lua/buildingplan/filterselection.lua index 498c89c1e..968ad88d9 100644 --- a/plugins/lua/buildingplan/filterselection.lua +++ b/plugins/lua/buildingplan/filterselection.lua @@ -452,6 +452,7 @@ function QualityAndMaterialsPage:refresh() make_cat_choice('Wood', 'wood', 'CUSTOM_SHIFT_O', cats), make_cat_choice('Metal', 'metal', 'CUSTOM_SHIFT_M', cats), make_cat_choice('Glass', 'glass', 'CUSTOM_SHIFT_G', cats), + make_cat_choice('Gem', 'gem', 'CUSTOM_SHIFT_E', cats), make_cat_choice('Clay', 'clay', 'CUSTOM_SHIFT_C', cats), make_cat_choice('Cloth', 'cloth', 'CUSTOM_SHIFT_L', cats), make_cat_choice('Silk', 'silk', 'CUSTOM_SHIFT_K', cats), From b26d6a90ca9edd1b8b19185cea285eed4c03803b Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 17 Apr 2023 01:06:06 -0700 Subject: [PATCH 19/80] update structures head --- library/xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/xml b/library/xml index 43059670e..1413d3c67 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit 43059670e7d3338d9a164bc23d0c41994187de9c +Subproject commit 1413d3c67c5bd85e6afbef45d8b1ade6b8389ede From eb9e40a24d6023470725959f46f2d5fe3c83daf8 Mon Sep 17 00:00:00 2001 From: John Reid Date: Mon, 17 Apr 2023 10:43:14 +0200 Subject: [PATCH 20/80] Fix typo in Quickstart.rst Fixes a typo in Quickstart.rst: mangager -> manager --- docs/Quickstart.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Quickstart.rst b/docs/Quickstart.rst index 065ba6ecc..f4a022a9c 100644 --- a/docs/Quickstart.rst +++ b/docs/Quickstart.rst @@ -162,7 +162,7 @@ You can run them all from the launcher. First, let's import some useful manager orders to keep your fort stocked with basic necessities. Run ``orders import library/basic``. If you go to your -mangager orders screen, you can see all the orders that have been created for you. +manager orders screen, you can see all the orders that have been created for you. Note that you could have imported the orders directly from this screen as well, using the DFHack `overlay` widget at the bottom of the manager orders panel. From e9f6695aceb9918ff56b3c8596498cd44faee033 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 17 Apr 2023 09:39:15 -0700 Subject: [PATCH 21/80] infrastructure for hiding armok tools --- docs/Tags.rst | 2 +- docs/changelog.txt | 3 ++- library/lua/dfhack.lua | 5 +++++ library/lua/helpdb.lua | 17 +++++++++++++++-- plugins/hotkeys.cpp | 39 +++++++++++++++++++++++++++++++-------- plugins/lua/hotkeys.lua | 13 +++++++++++++ 6 files changed, 67 insertions(+), 12 deletions(-) diff --git a/docs/Tags.rst b/docs/Tags.rst index 5ff13d632..c7b284d07 100644 --- a/docs/Tags.rst +++ b/docs/Tags.rst @@ -21,7 +21,7 @@ for the tag assignment spreadsheet. "why" tags ---------- -- `armok `: Tools that give you complete control over an aspect of the game or provide access to information that the game intentionally keeps hidden. +- `armok `: Tools that give you complete control over an aspect of the game or provide access to information that the game intentionally keeps hidden. Players that do not wish to see these tools listed in DFHack command lists can hide them in the ``Preferences`` tab of `gui/control-panel`. - `auto `: Tools that run in the background and automatically manage routine, toilsome aspects of your fortress. - `bugfix `: Tools that fix specific bugs, either permanently or on-demand. - `design `: Tools that help you design your fort. diff --git a/docs/changelog.txt b/docs/changelog.txt index 3bb16251c..553fb3362 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -40,7 +40,8 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## Misc Improvements - `buildingplan`: minimized planner panel stays minimized until you change it again - ``toggle-kbd-cursor``: add hotkey for toggling the keyboard cursor (Alt-K) -- `gui/control-panel`: add option for hiding the terminal console by default +- `gui/control-panel`: add preference option for hiding the terminal console on startup +- `gui/control-panel`: add preference option for hiding "armok" tools in command lists ## Documentation diff --git a/library/lua/dfhack.lua b/library/lua/dfhack.lua index bc543fd10..78d978147 100644 --- a/library/lua/dfhack.lua +++ b/library/lua/dfhack.lua @@ -58,6 +58,11 @@ function dfhack.getHideConsoleOnStartup() return dfhack.HIDE_CONSOLE_ON_STARTUP end +dfhack.HIDE_ARMOK_TOOLS = false +function dfhack.getHideArmokTools() + return dfhack.HIDE_ARMOK_TOOLS +end + -- Error handling safecall = dfhack.safecall diff --git a/library/lua/helpdb.lua b/library/lua/helpdb.lua index a7ac6226f..4ce078a22 100644 --- a/library/lua/helpdb.lua +++ b/library/lua/helpdb.lua @@ -788,7 +788,11 @@ function ls(filter_str, skip_tags, show_dev_commands, exclude_strs) table.insert(excludes, {str=argparse.stringList(exclude_strs)}) end if not show_dev_commands then - table.insert(excludes, {tag='dev'}) + local dev_tags = {'dev', 'unavailable'} + if dfhack.getHideArmokTools() then + table.insert(dev_tags, 'armok') + end + table.insert(excludes, {tag=dev_tags}) end list_entries(skip_tags, include, excludes) end @@ -813,7 +817,16 @@ function tags(tag) local skip_tags = true local include = {entry_type={ENTRY_TYPES.COMMAND}, tag=tag} - list_entries(skip_tags, include) + + local excludes = {tag={}} + if tag ~= 'unavailable' then + table.insert(excludes.tag, 'unavailable') + end + if tag ~= 'armok' and dfhack.getHideArmokTools() then + table.insert(excludes.tag, 'armok') + end + + list_entries(skip_tags, include, excludes) end return _ENV diff --git a/plugins/hotkeys.cpp b/plugins/hotkeys.cpp index 788a4c02b..136ad7a9d 100644 --- a/plugins/hotkeys.cpp +++ b/plugins/hotkeys.cpp @@ -49,7 +49,22 @@ static int cleanupHotkeys(lua_State *) { return 0; } -static void add_binding_if_valid(const string &sym, const string &cmdline, df::viewscreen *screen, bool filtermenu) { +static bool should_hide_armok(color_ostream &out, const string &cmdline) { + bool should_hide = false; + + auto L = Lua::Core::State; + Lua::StackUnwinder top(L); + Lua::CallLuaModuleFunction(out, L, "plugins.hotkeys", "should_hide_armok", 1, 1, + [&](lua_State *L){ + Lua::Push(L, cmdline); + }, [&](lua_State *L){ + should_hide = lua_toboolean(L, -1); + }); + + return should_hide; +} + +static void add_binding_if_valid(color_ostream &out, const string &sym, const string &cmdline, df::viewscreen *screen, bool filtermenu) { if (!can_invoke(cmdline, screen)) return; @@ -59,6 +74,11 @@ static void add_binding_if_valid(const string &sym, const string &cmdline, df::v return; } + if (should_hide_armok(out, cmdline)) { + DEBUG(log).print("filtering out armok keybinding\n"); + return; + } + current_bindings[sym] = cmdline; sorted_keys.push_back(sym); string keyspec = sym + "@" + MENU_SCREEN_FOCUS_STRING; @@ -67,7 +87,7 @@ static void add_binding_if_valid(const string &sym, const string &cmdline, df::v Core::getInstance().AddKeyBinding(keyspec, binding); } -static void find_active_keybindings(df::viewscreen *screen, bool filtermenu) { +static void find_active_keybindings(color_ostream &out, df::viewscreen *screen, bool filtermenu) { DEBUG(log).print("scanning for active keybindings\n"); if (valid) cleanupHotkeys(NULL); @@ -103,7 +123,7 @@ static void find_active_keybindings(df::viewscreen *screen, bool filtermenu) { string::size_type colon_pos = invoke_cmd->find(":"); // colons at location 0 are for commands like ":lua" if (colon_pos == string::npos || colon_pos == 0) { - add_binding_if_valid(sym, *invoke_cmd, screen, filtermenu); + add_binding_if_valid(out, sym, *invoke_cmd, screen, filtermenu); } else { vector tokens; @@ -111,7 +131,7 @@ static void find_active_keybindings(df::viewscreen *screen, bool filtermenu) { string focus = tokens[0].substr(1); if(Gui::matchFocusString(focus)) { auto cmdline = trim(tokens[1]); - add_binding_if_valid(sym, cmdline, screen, filtermenu); + add_binding_if_valid(out, sym, cmdline, screen, filtermenu); } } } @@ -124,7 +144,10 @@ static void find_active_keybindings(df::viewscreen *screen, bool filtermenu) { } static int getHotkeys(lua_State *L) { - find_active_keybindings(Gui::getCurViewscreen(true), true); + color_ostream *out = Lua::GetOutput(L); + if (!out) + out = &Core::getInstance().getConsole(); + find_active_keybindings(*out, Gui::getCurViewscreen(true), true); Lua::PushVector(L, sorted_keys); Lua::Push(L, current_bindings); return 2; @@ -140,7 +163,7 @@ static void list(color_ostream &out) { DEBUG(log).print("listing active hotkeys\n"); bool was_valid = valid; if (!valid) - find_active_keybindings(Gui::getCurViewscreen(true), false); + find_active_keybindings(out, Gui::getCurViewscreen(true), false); out.print("Valid keybindings for the current focus:\n %s\n", join_strings("\n", Gui::getCurFocus(true)).c_str()); @@ -176,6 +199,8 @@ static command_result hotkeys_cmd(color_ostream &out, vector & paramete return Core::getInstance().runCommand(out, INVOKE_MENU_COMMAND ); } + CoreSuspender guard; + if (parameters[0] == "list") { list(out); return CR_OK; @@ -185,8 +210,6 @@ static command_result hotkeys_cmd(color_ostream &out, vector & paramete if (parameters.size() != 2 || parameters[0] != "invoke") return CR_WRONG_USAGE; - CoreSuspender guard; - int index = string_to_int(parameters[1], -1); if (index < 0) return CR_WRONG_USAGE; diff --git a/plugins/lua/hotkeys.lua b/plugins/lua/hotkeys.lua index 8edb70073..ec5699fe4 100644 --- a/plugins/lua/hotkeys.lua +++ b/plugins/lua/hotkeys.lua @@ -5,6 +5,19 @@ local helpdb = require('helpdb') local overlay = require('plugins.overlay') local widgets = require('gui.widgets') +local function get_command(cmdline) + local first_word = cmdline:trim():split(' +')[1] + if first_word:startswith(':') then first_word = first_word:sub(2) end + return first_word +end + +function should_hide_armok(cmdline) + local first_word = get_command(cmdline) + return dfhack.getHideArmokTools() and + helpdb.is_entry(first_word) and + helpdb.get_entry_tags(first_word).armok +end + -- ----------------- -- -- HotspotMenuWidget -- -- ----------------- -- From f6031e6a799fac2cd7d9b738e99d93d9eb5d2e7e Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 17 Apr 2023 13:04:42 -0700 Subject: [PATCH 22/80] refactor existing logic to use new function --- plugins/lua/hotkeys.lua | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/plugins/lua/hotkeys.lua b/plugins/lua/hotkeys.lua index ec5699fe4..b162f0c08 100644 --- a/plugins/lua/hotkeys.lua +++ b/plugins/lua/hotkeys.lua @@ -12,10 +12,10 @@ local function get_command(cmdline) end function should_hide_armok(cmdline) - local first_word = get_command(cmdline) + local command = get_command(cmdline) return dfhack.getHideArmokTools() and - helpdb.is_entry(first_word) and - helpdb.get_entry_tags(first_word).armok + helpdb.is_entry(command) and + helpdb.get_entry_tags(command).armok end -- ----------------- -- @@ -245,10 +245,9 @@ end function Menu:onSelect(_, choice) if not choice or #self.subviews == 0 then return end - local first_word = choice.command:trim():split(' +')[1] - if first_word:startswith(':') then first_word = first_word:sub(2) end - self.subviews.help.text_to_wrap = helpdb.is_entry(first_word) and - helpdb.get_entry_short_help(first_word) or 'Command not found' + local command = get_command(choice.command) + self.subviews.help.text_to_wrap = helpdb.is_entry(command) and + helpdb.get_entry_short_help(command) or 'Command not found' self.subviews.help_panel:updateLayout() end From 3307427718814d7f6109828a9b39a95ce0b6f7aa Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 17 Apr 2023 13:29:58 -0700 Subject: [PATCH 23/80] update wording (thanks Ozzatron!) --- docs/Tags.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/Tags.rst b/docs/Tags.rst index c7b284d07..ded15c4c2 100644 --- a/docs/Tags.rst +++ b/docs/Tags.rst @@ -21,7 +21,9 @@ for the tag assignment spreadsheet. "why" tags ---------- -- `armok `: Tools that give you complete control over an aspect of the game or provide access to information that the game intentionally keeps hidden. Players that do not wish to see these tools listed in DFHack command lists can hide them in the ``Preferences`` tab of `gui/control-panel`. +- `armok `: Tools which give the player god-like powers of any variety, such as control over game events, creating items from thin air, or viewing information the game intentionally keeps hidden. Players that do not wish to see these tools listed in DFHack command lists can hide them in the ``Preferences`` tab of `gui/control-panel`. + + - `auto `: Tools that run in the background and automatically manage routine, toilsome aspects of your fortress. - `bugfix `: Tools that fix specific bugs, either permanently or on-demand. - `design `: Tools that help you design your fort. From c30c59c261e5c64a7573511e676a31d8d9867502 Mon Sep 17 00:00:00 2001 From: DFHack-Urist via GitHub Actions <63161697+DFHack-Urist@users.noreply.github.com> Date: Tue, 18 Apr 2023 07:13:59 +0000 Subject: [PATCH 24/80] Auto-update submodules library/xml: master scripts: master --- library/xml | 2 +- scripts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/library/xml b/library/xml index 1413d3c67..ae268954d 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit 1413d3c67c5bd85e6afbef45d8b1ade6b8389ede +Subproject commit ae268954da3cde1c4e08f6d62273a17aae0d94da diff --git a/scripts b/scripts index 5fe9e423b..6fba9905a 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit 5fe9e423bbd5cdb7c6e7e8f1051e3aa8d00c853a +Subproject commit 6fba9905a71f626ecc640fd3de988e147d16cb4e From 495c94127a47f660c5bc94ece7a080d1c3dcef68 Mon Sep 17 00:00:00 2001 From: DFHack-Urist via GitHub Actions <63161697+DFHack-Urist@users.noreply.github.com> Date: Tue, 18 Apr 2023 10:19:25 +0000 Subject: [PATCH 25/80] Auto-update submodules depends/xlsxio: dfhack --- depends/xlsxio | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depends/xlsxio b/depends/xlsxio index 439fdbc25..0a9945266 160000 --- a/depends/xlsxio +++ b/depends/xlsxio @@ -1 +1 @@ -Subproject commit 439fdbc259c13f23a3122e68ba35ad5a13bcd97c +Subproject commit 0a994526622c2201756e386ef98b44b193e25f06 From ed87075cb8b3875936c9823c8802d20b06f61e63 Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Tue, 18 Apr 2023 05:40:51 -0500 Subject: [PATCH 26/80] cmake minimum version 3.21 forced by this being the lowest version that supports vs 2022 --- depends/clsocket | 2 +- depends/lua/CMakeLists.txt | 2 +- library/CMakeLists.txt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/depends/clsocket b/depends/clsocket index 6ed8aa464..d5e17c601 160000 --- a/depends/clsocket +++ b/depends/clsocket @@ -1 +1 @@ -Subproject commit 6ed8aa46462ea01a1122fc49422840a2facc9757 +Subproject commit d5e17c6012e7eefb0cbe3e130a56c24bd11f0094 diff --git a/depends/lua/CMakeLists.txt b/depends/lua/CMakeLists.txt index c3ff0c16f..efded915f 100644 --- a/depends/lua/CMakeLists.txt +++ b/depends/lua/CMakeLists.txt @@ -1,5 +1,5 @@ project(lua CXX) -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.21) set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DLUA_USE_APICHECK") diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index a3fcb8b6f..31cfb007d 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -1,5 +1,5 @@ project(dfapi) -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.21) # prevent CMake warnings about INTERFACE_LINK_LIBRARIES vs LINK_INTERFACE_LIBRARIES cmake_policy(SET CMP0022 NEW) From 649d72e658890246585e23f830b0142595c94e50 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Tue, 18 Apr 2023 08:28:00 -0700 Subject: [PATCH 27/80] add missed NO_LOGIC_SCREEN to the list adopt_region also kills the top viewscreen on transition --- library/lua/gui.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/library/lua/gui.lua b/library/lua/gui.lua index 64e203d3c..e425dbcf1 100644 --- a/library/lua/gui.lua +++ b/library/lua/gui.lua @@ -745,6 +745,7 @@ end local NO_LOGIC_SCREENS = { 'viewscreen_loadgamest', + 'viewscreen_adopt_regionst', 'viewscreen_export_regionst', 'viewscreen_choose_game_typest', 'viewscreen_worldst', From 250f05667b70e20a7e7c55fcfd8704477c0fe487 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Tue, 18 Apr 2023 15:50:59 -0700 Subject: [PATCH 28/80] add a warning when DT appears to be running --- docs/changelog.txt | 1 + plugins/lua/autolabor.lua | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index 553fb3362..af0f208dc 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -42,6 +42,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: - ``toggle-kbd-cursor``: add hotkey for toggling the keyboard cursor (Alt-K) - `gui/control-panel`: add preference option for hiding the terminal console on startup - `gui/control-panel`: add preference option for hiding "armok" tools in command lists +- ``Dwarf Therapist``: add a warning to the Labors screen when Dwarf Therapist is active so players know that changes they make to that screen will have no effect. If you're starting a new embark and nobody seems to be doing anything, check your Labors tab for this warning to see if Dwarf Therapist thinks it is in control (even if it's not running). ## Documentation diff --git a/plugins/lua/autolabor.lua b/plugins/lua/autolabor.lua index 6ef4d7279..50f39b225 100644 --- a/plugins/lua/autolabor.lua +++ b/plugins/lua/autolabor.lua @@ -10,7 +10,7 @@ AutolaborOverlay.ATTRS{ default_enabled=true, viewscreens='dwarfmode/Info/LABOR', frame={w=29, h=5}, - frame_style=gui.MEDIUM_FRAME, + frame_style=gui.THIN_FRAME, frame_background=gui.CLEAR_PEN, } @@ -18,9 +18,20 @@ function AutolaborOverlay:init() self:addviews{ widgets.Label{ frame={t=0, l=0}, - text_pen=COLOR_RED, + text_pen=COLOR_LIGHTRED, + text='DFHack autolabor is active!', + visible=isEnabled, + }, + widgets.Label{ + frame={t=0, l=0}, + text_pen=COLOR_LIGHTRED, + text='Dwarf Therapist is active!', + visible=function() return not isEnabled() end, + }, + widgets.Label{ + frame={t=1, l=0}, + text_pen=COLOR_WHITE, text={ - 'DFHack autolabor is active!', NEWLINE, 'Any changes made on this', NEWLINE, 'screen will have no effect.' }, @@ -29,7 +40,7 @@ function AutolaborOverlay:init() end function AutolaborOverlay:render(dc) - if not isEnabled() then return false end + if df.global.game_extra.external_flag ~= 1 then return end AutolaborOverlay.super.render(self, dc) end From 150708f21db8a401a8e62f98f2c6e8ba8911d416 Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Tue, 18 Apr 2023 05:00:36 -0500 Subject: [PATCH 29/80] build lanchdf with steam sdk --- .gitignore | 3 +++ CMakeLists.txt | 13 ++++++++++++ package/windows/CMakeLists.txt | 10 +++++---- package/windows/{launchdf.c => launchdf.cpp} | 22 ++++++++++++++++++-- 4 files changed, 42 insertions(+), 6 deletions(-) rename package/windows/{launchdf.c => launchdf.cpp} (76%) diff --git a/.gitignore b/.gitignore index e24f11252..a386b260a 100644 --- a/.gitignore +++ b/.gitignore @@ -80,3 +80,6 @@ tags # external plugins /plugins/CMakeLists.custom.txt + +# steam api +depends/steam diff --git a/CMakeLists.txt b/CMakeLists.txt index 239892e76..899063d9d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -312,6 +312,19 @@ if(WIN32) ${SDLREAL_DOWNLOAD_DIR}/SDLreal.dll "5a09604daca6b2b5ce049d79af935d6a") endif() + + # download Steam SDK + set (STEAMAPI_DIR ${dfhack_SOURCE_DIR}/depends/steam/) + download_file("https://partner.steamgames.com/downloads/steamworks_sdk_156.zip" + ${STEAMAPI_DIR}/steamworks_sdk_156.zip + "af5a579990dbe5ae4c1b0689260d001b") + file(ARCHIVE_EXTRACT + INPUT ${STEAMAPI_DIR}/steamworks_sdk_156.zip + DESTINATION ${STEAMAPI_DIR}) + set(STEAMAPI_LIBRARY "${STEAMAPI_DIR}/sdk/redistributable_bin/win64/steam_api64.lib") + set(STEAMAPI_SOURCE_DIR "${STEAMAPI_DIR}/sdk/public/steam") + set(STEAMAPI_SHARED_LIBRARY "${STEAMAPI_DIR}/sdk/redistributable_bin/win64/steam_api64.dll") + endif() if(APPLE) diff --git a/package/windows/CMakeLists.txt b/package/windows/CMakeLists.txt index a5877f117..42151e663 100644 --- a/package/windows/CMakeLists.txt +++ b/package/windows/CMakeLists.txt @@ -1,7 +1,9 @@ project(package_windows) if(WIN32) - add_executable(launchdf WIN32 launchdf.c) - install(TARGETS launchdf - DESTINATION ${DFHACK_DATA_DESTINATION}) -endif() + include_directories(${STEAMAPI_SOURCE_DIR}) + link_libraries(${STEAMAPI_LIBRARY}) + add_executable(launchdf WIN32 launchdf.cpp) + install(TARGETS launchdf DESTINATION ${DFHACK_DATA_DESTINATION}) + install(FILES ${STEAMAPI_SHARED_LIBRARY} DESTINATION ${DFHACK_DATA_DESTINATION}) +endif() \ No newline at end of file diff --git a/package/windows/launchdf.c b/package/windows/launchdf.cpp similarity index 76% rename from package/windows/launchdf.c rename to package/windows/launchdf.cpp index 992bf6636..804163960 100644 --- a/package/windows/launchdf.c +++ b/package/windows/launchdf.cpp @@ -1,13 +1,17 @@ #include #include +#include "steam_api.h" + +const uint32 DFHACK_STEAM_APPID = 2346660; static BOOL is_running_on_wine() { - static const char *(CDECL *pwine_get_version)(void); + typedef const char* (CDECL wine_get_version)(void); + static wine_get_version* pwine_get_version; HMODULE hntdll = GetModuleHandle("ntdll.dll"); if(!hntdll) return FALSE; - pwine_get_version = (void *)GetProcAddress(hntdll, "wine_get_version"); + pwine_get_version = (wine_get_version*) GetProcAddress(hntdll, "wine_get_version"); return !!pwine_get_version; } @@ -61,6 +65,20 @@ static BOOL launch_direct() { } int WINAPI wWinMain(HINSTANCE hi, HINSTANCE hpi, PWSTR cmd, int ns) { + + if (SteamAPI_RestartAppIfNecessary(DFHACK_STEAM_APPID)) // Replace with your App ID + { + return 1; + } + + if (!SteamAPI_Init()) + { + printf("Fatal Error - Steam must be running to play this game (SteamAPI_Init() failed).\n"); + return 1; + } + + return 0; + LPCWSTR err = is_running_on_wine() ? launch_via_steam_posix() : launch_via_steam_windows(); if (err && !launch_direct()) { From f336771284b152684cc4eb22cb6856330c649faf Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Tue, 18 Apr 2023 08:21:54 -0500 Subject: [PATCH 30/80] launchdf rewrite this rewrites launchdf so that the dfhack launcher attempts to linger while df is running --- CMakeLists.txt | 6 +- package/windows/launchdf.cpp | 171 +++++++++++++++++++++++++++++++---- 2 files changed, 155 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 899063d9d..cf5586dfd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -314,10 +314,10 @@ if(WIN32) endif() # download Steam SDK - set (STEAMAPI_DIR ${dfhack_SOURCE_DIR}/depends/steam/) - download_file("https://partner.steamgames.com/downloads/steamworks_sdk_156.zip" + set (STEAMAPI_DIR ${dfhack_SOURCE_DIR}/depends/steam) + file(DOWNLOAD "https://partner.steamgames.com/downloads/steamworks_sdk_156.zip" ${STEAMAPI_DIR}/steamworks_sdk_156.zip - "af5a579990dbe5ae4c1b0689260d001b") + EXPECTED_HASH MD5=af5a579990dbe5ae4c1b0689260d001b) file(ARCHIVE_EXTRACT INPUT ${STEAMAPI_DIR}/steamworks_sdk_156.zip DESTINATION ${STEAMAPI_DIR}) diff --git a/package/windows/launchdf.cpp b/package/windows/launchdf.cpp index 804163960..19128ead1 100644 --- a/package/windows/launchdf.cpp +++ b/package/windows/launchdf.cpp @@ -1,8 +1,12 @@ #include #include +#include #include "steam_api.h" +#include + const uint32 DFHACK_STEAM_APPID = 2346660; +const uint32 DF_STEAM_APPID = 975370; static BOOL is_running_on_wine() { typedef const char* (CDECL wine_get_version)(void); @@ -32,7 +36,7 @@ static LPCWSTR launch_via_steam_windows() { si.cb = sizeof(si); ZeroMemory(&pi, sizeof(pi)); - WCHAR steamPath[1024]; + WCHAR steamPath[1024] = L""; DWORD datasize = 1024; LONG retCode = RegGetValueW(HKEY_CURRENT_USER, L"SOFTWARE\\Valve\\Steam", @@ -43,16 +47,24 @@ static LPCWSTR launch_via_steam_windows() { WCHAR commandLine[1024] = L"steam.exe -applaunch 975370"; - if (CreateProcessW(steamPath, commandLine, - NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi) == 0) - return L"Could not launch Dwarf Fortress"; + BOOL res = CreateProcessW(steamPath, commandLine, + NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); + + if (res) + { + WaitForSingleObject(pi.hProcess, INFINITE); - return NULL; + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + return NULL; + } + else + { + return L"Could not launch Dwarf Fortress"; + } } -// this method doesn't properly attribute Steam playtime metrics to DF, -// but that's better than not having DF start at all. -static BOOL launch_direct() { +static LPCWSTR launch_direct() { STARTUPINFOW si; PROCESS_INFORMATION pi; @@ -60,31 +72,152 @@ static BOOL launch_direct() { si.cb = sizeof(si); ZeroMemory(&pi, sizeof(pi)); - return CreateProcessW(L"Dwarf Fortress.exe", + BOOL res = CreateProcessW(L"Dwarf Fortress.exe", NULL, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi); + + if (res) + { + WaitForSingleObject(pi.hProcess, INFINITE); + + CloseHandle(pi.hProcess); + CloseHandle(pi.hThread); + return NULL; + } + + return L"Could not launch via non-steam fallback method"; +} + +DWORD findDwarfFortressProcess() +{ + PROCESSENTRY32W entry; + entry.dwSize = sizeof(PROCESSENTRY32W); + + const auto snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL); + + if (!Process32FirstW(snapshot, &entry)) + { + CloseHandle(snapshot); + return -1; + } + + do { + std::wstring executableName(entry.szExeFile); + if (executableName == L"Dwarf Fortress.exe") + { + CloseHandle(snapshot); + return entry.th32ProcessID; + } + } while (Process32NextW(snapshot, &entry)); + + CloseHandle(snapshot); + return -1; } -int WINAPI wWinMain(HINSTANCE hi, HINSTANCE hpi, PWSTR cmd, int ns) { +int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, _In_ LPWSTR lpCmdLine, _In_ int nShowCmd) { - if (SteamAPI_RestartAppIfNecessary(DFHACK_STEAM_APPID)) // Replace with your App ID + // initialize steam context + if (SteamAPI_RestartAppIfNecessary(DFHACK_STEAM_APPID)) { - return 1; + exit(0); } - if (!SteamAPI_Init()) + if (!SteamAPI_Init()) + { + // could not initialize steam context, attempt fallback launch + LPCWSTR err = launch_direct(); + if (err != NULL) { - printf("Fatal Error - Steam must be running to play this game (SteamAPI_Init() failed).\n"); - return 1; + MessageBoxW(NULL, err, NULL, 0); + exit(1); } + exit(0); + } - return 0; + bool wine = is_running_on_wine(); - LPCWSTR err = is_running_on_wine() ? launch_via_steam_posix() : launch_via_steam_windows(); + if (wine) + { + // attempt launch via steam client + LPCWSTR err = launch_via_steam_posix(); + + if (err != NULL) + // steam client launch failed, attempt fallback launch + err = launch_direct(); - if (err && !launch_direct()) { - MessageBoxW(NULL, err, NULL, 0); + if (err != NULL) + { + MessageBoxW(NULL, err, NULL, 0); + exit(1); + } + exit(0); + } + + // steam detected and not running in wine + + bool df_installed = SteamApps()->BIsAppInstalled(DF_STEAM_APPID); + + if (!df_installed) + { + // Steam DF is not installed. Assume DF is installed in same directory as DFHack and do a fallback launch + LPCWSTR err = launch_direct(); + + if (err != NULL) + { + MessageBoxW(NULL, err, NULL, 0); + exit(1); + } + exit(0); + } + + // obtain DF app path + + char buf[2048] = ""; + + int b = SteamApps()->GetAppInstallDir(DFHACK_STEAM_APPID, (char*)&buf, 2048); + std::string dfhack_install_folder = (b != -1) ? std::string(buf) : ""; + + int b2 = SteamApps()->GetAppInstallDir(DF_STEAM_APPID, (char*)&buf, 2048); + std::string df_install_folder = (b != -1) ? std::string(buf) : ""; + + + if (df_install_folder != dfhack_install_folder) + { + // DF and DFHack are not installed in the same library + MessageBoxW(NULL, L"DFHack and Dwarf Fortress must be installed in the same Steam library.\nAborting.", NULL, 0); exit(1); } + DWORD df_pid = findDwarfFortressProcess(); + + if (df_pid == -1) + { + LPCWSTR err = launch_via_steam_windows(); + if (err != NULL) + { + MessageBoxW(NULL, err, NULL, 0); + exit(1); + } + int counter = 0; + + do { + if (counter++ > 60) + { + MessageBoxW(NULL, L"Dwarf Fortress took too long to launch, aborting", NULL, 0); + exit(1); + } + Sleep(1000); + df_pid = findDwarfFortressProcess(); + } while (df_pid == -1); + } + + HANDLE hDF = OpenProcess(PROCESS_QUERY_INFORMATION | SYNCHRONIZE, FALSE, df_pid); + + // in the future open an IPC connection so that we can proxy SteamAPI calls for the DFSteam module + + // this will eventuallyh need to become a loop with a WaitForMultipleObjects call + WaitForSingleObject(hDF, INFINITE); + + CloseHandle(hDF); + exit(0); } From dae549e3d1cc3dc775260c384eb3bd589981f662 Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Tue, 18 Apr 2023 08:47:05 -0500 Subject: [PATCH 31/80] fix missing end of line --- package/windows/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/windows/CMakeLists.txt b/package/windows/CMakeLists.txt index 42151e663..309613f2e 100644 --- a/package/windows/CMakeLists.txt +++ b/package/windows/CMakeLists.txt @@ -6,4 +6,4 @@ if(WIN32) add_executable(launchdf WIN32 launchdf.cpp) install(TARGETS launchdf DESTINATION ${DFHACK_DATA_DESTINATION}) install(FILES ${STEAMAPI_SHARED_LIBRARY} DESTINATION ${DFHACK_DATA_DESTINATION}) -endif() \ No newline at end of file +endif() From ea01dae88fc3cdc5d1d9673102e2bb2977ff430a Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Tue, 18 Apr 2023 11:12:29 -0500 Subject: [PATCH 32/80] fix minor oops --- package/windows/launchdf.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/windows/launchdf.cpp b/package/windows/launchdf.cpp index 19128ead1..a84465f53 100644 --- a/package/windows/launchdf.cpp +++ b/package/windows/launchdf.cpp @@ -173,11 +173,11 @@ int WINAPI wWinMain(_In_ HINSTANCE hInstance, _In_opt_ HINSTANCE hPrevInstance, char buf[2048] = ""; - int b = SteamApps()->GetAppInstallDir(DFHACK_STEAM_APPID, (char*)&buf, 2048); - std::string dfhack_install_folder = (b != -1) ? std::string(buf) : ""; + int b1 = SteamApps()->GetAppInstallDir(DFHACK_STEAM_APPID, (char*)&buf, 2048); + std::string dfhack_install_folder = (b1 != -1) ? std::string(buf) : ""; int b2 = SteamApps()->GetAppInstallDir(DF_STEAM_APPID, (char*)&buf, 2048); - std::string df_install_folder = (b != -1) ? std::string(buf) : ""; + std::string df_install_folder = (b2 != -1) ? std::string(buf) : ""; if (df_install_folder != dfhack_install_folder) From 337c5eea2adb1be611afca3af7c796e6cdc1ba47 Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Tue, 18 Apr 2023 18:42:42 -0500 Subject: [PATCH 33/80] changes to build process for dflaunch only build dflaunch on steam-specific builds only download steamworks SDK when building dflaunch get steam account from environment when downloading steamworks SDK --- .github/workflows/steam.yml | 4 +++- CMakeLists.txt | 12 ------------ build/win64/generate-MSVC-steam.bat | 4 ++++ package/windows/CMakeLists.txt | 30 ++++++++++++++++++++++++----- 4 files changed, 32 insertions(+), 18 deletions(-) create mode 100644 build/win64/generate-MSVC-steam.bat diff --git a/.github/workflows/steam.yml b/.github/workflows/steam.yml index aae1621af..a89249eab 100644 --- a/.github/workflows/steam.yml +++ b/.github/workflows/steam.yml @@ -38,7 +38,9 @@ jobs: ccache-win64-cross-msvc - name: Cross-compile win64 artifacts env: - CMAKE_EXTRA_ARGS: '-DBUILD_STONESENSE:BOOL=1' + CMAKE_EXTRA_ARGS: '-DBUILD_STONESENSE:BOOL=1 -DBUILD_DFLAUNCH:BOOL=1' + steam_username: ${{ secrets.STEAM_USERNAME }} + steam_password: ${{ secrets.STEAM_PASSWORD }} run: | cd build bash -x build-win64-from-linux.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index cf5586dfd..fca548ccf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -313,18 +313,6 @@ if(WIN32) "5a09604daca6b2b5ce049d79af935d6a") endif() - # download Steam SDK - set (STEAMAPI_DIR ${dfhack_SOURCE_DIR}/depends/steam) - file(DOWNLOAD "https://partner.steamgames.com/downloads/steamworks_sdk_156.zip" - ${STEAMAPI_DIR}/steamworks_sdk_156.zip - EXPECTED_HASH MD5=af5a579990dbe5ae4c1b0689260d001b) - file(ARCHIVE_EXTRACT - INPUT ${STEAMAPI_DIR}/steamworks_sdk_156.zip - DESTINATION ${STEAMAPI_DIR}) - set(STEAMAPI_LIBRARY "${STEAMAPI_DIR}/sdk/redistributable_bin/win64/steam_api64.lib") - set(STEAMAPI_SOURCE_DIR "${STEAMAPI_DIR}/sdk/public/steam") - set(STEAMAPI_SHARED_LIBRARY "${STEAMAPI_DIR}/sdk/redistributable_bin/win64/steam_api64.dll") - endif() if(APPLE) diff --git a/build/win64/generate-MSVC-steam.bat b/build/win64/generate-MSVC-steam.bat new file mode 100644 index 000000000..007bb1c08 --- /dev/null +++ b/build/win64/generate-MSVC-steam.bat @@ -0,0 +1,4 @@ +IF EXIST DF_PATH.txt SET /P _DF_PATH= Date: Tue, 18 Apr 2023 19:14:37 -0500 Subject: [PATCH 34/80] make release channel parameter optional --- .github/workflows/steam.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/steam.yml b/.github/workflows/steam.yml index a89249eab..cf41f861d 100644 --- a/.github/workflows/steam.yml +++ b/.github/workflows/steam.yml @@ -14,7 +14,7 @@ on: release_channel: description: Release channel type: string - required: true + required: false default: beta jobs: From 5c541a8317ab2d82bf1744e7fdff2acf6a5d32b2 Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Tue, 18 Apr 2023 19:33:02 -0500 Subject: [PATCH 35/80] pass credentials into container (only when needed of course) --- build/build-win64-from-linux.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/build-win64-from-linux.sh b/build/build-win64-from-linux.sh index 11f4dbbc5..c0559a999 100755 --- a/build/build-win64-from-linux.sh +++ b/build/build-win64-from-linux.sh @@ -41,6 +41,8 @@ fi if ! docker run --rm -i -v "$srcdir":/src -v "$srcdir/build/win64-cross/":/src/build \ -e BUILDER_UID=$builder_uid \ -e CCACHE_DIR=/src/build/ccache \ + -e steam_username \ + -e steam_password \ --name dfhack-win \ ghcr.io/dfhack/build-env:msvc \ bash -c "cd /src/build && dfhack-configure windows 64 Release -DCMAKE_INSTALL_PREFIX=/src/build/output cmake .. -DBUILD_DOCS=1 $CMAKE_EXTRA_ARGS && dfhack-make -j$jobs install" \ From acc408c168093af1b1c51e1a1abe04d8eb97b177 Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Tue, 18 Apr 2023 21:52:57 -0500 Subject: [PATCH 36/80] change sdk download secret --- .github/workflows/steam.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/steam.yml b/.github/workflows/steam.yml index cf41f861d..71e56b662 100644 --- a/.github/workflows/steam.yml +++ b/.github/workflows/steam.yml @@ -39,8 +39,8 @@ jobs: - name: Cross-compile win64 artifacts env: CMAKE_EXTRA_ARGS: '-DBUILD_STONESENSE:BOOL=1 -DBUILD_DFLAUNCH:BOOL=1' - steam_username: ${{ secrets.STEAM_USERNAME }} - steam_password: ${{ secrets.STEAM_PASSWORD }} + steam_username: ${{ secrets.STEAM_SDK_USERNAME }} + steam_password: ${{ secrets.STEAM_SDK_PASSWORD }} run: | cd build bash -x build-win64-from-linux.sh From 93aaa5d19f1d74cf602744b5ad2dbc9bec42d19f Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Tue, 18 Apr 2023 21:01:49 -0700 Subject: [PATCH 37/80] bump beta version to 50.07-r2rc2 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fca548ccf..caf597088 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -192,7 +192,7 @@ endif() # set up versioning. set(DF_VERSION "50.07") -set(DFHACK_RELEASE "r2rc1") +set(DFHACK_RELEASE "r2rc2") set(DFHACK_PRERELEASE TRUE) set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}") From c3b077d5e742a578b066d81baebc14ba094c4701 Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Tue, 18 Apr 2023 23:05:27 -0500 Subject: [PATCH 38/80] merge upstream submodules --- depends/clsocket | 2 +- depends/xlsxio | 2 +- scripts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/depends/clsocket b/depends/clsocket index d5e17c601..6ed8aa464 160000 --- a/depends/clsocket +++ b/depends/clsocket @@ -1 +1 @@ -Subproject commit d5e17c6012e7eefb0cbe3e130a56c24bd11f0094 +Subproject commit 6ed8aa46462ea01a1122fc49422840a2facc9757 diff --git a/depends/xlsxio b/depends/xlsxio index 0a9945266..439fdbc25 160000 --- a/depends/xlsxio +++ b/depends/xlsxio @@ -1 +1 @@ -Subproject commit 0a994526622c2201756e386ef98b44b193e25f06 +Subproject commit 439fdbc259c13f23a3122e68ba35ad5a13bcd97c diff --git a/scripts b/scripts index 6fba9905a..ec1a69788 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit 6fba9905a71f626ecc640fd3de988e147d16cb4e +Subproject commit ec1a69788fd6329008672523b622fd8b390fea73 From ac4a068007055426d96ba64f6c4f3b0f96115ab0 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Tue, 18 Apr 2023 21:08:50 -0700 Subject: [PATCH 39/80] add missing changelog for buildingplan --- docs/changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog.txt b/docs/changelog.txt index 553fb3362..5110e24ab 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -39,6 +39,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## Misc Improvements - `buildingplan`: minimized planner panel stays minimized until you change it again +- `buildingplan`: can now filter by gems (for gem windows) - ``toggle-kbd-cursor``: add hotkey for toggling the keyboard cursor (Alt-K) - `gui/control-panel`: add preference option for hiding the terminal console on startup - `gui/control-panel`: add preference option for hiding "armok" tools in command lists From f45291780e324f3344fe5ab924147cd96119ca09 Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Tue, 18 Apr 2023 23:19:05 -0500 Subject: [PATCH 40/80] update structures --- library/xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/xml b/library/xml index 055f9b4ce..34bc84b11 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit 055f9b4cec3bbec8e562f4774754242a14026bd2 +Subproject commit 34bc84b1125f32b2f09b20ee0561a24bc3a66e70 From eaf2efee05c719ffda8f45eae5697da486a7d71a Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Tue, 18 Apr 2023 23:32:54 -0500 Subject: [PATCH 41/80] update dfhack version --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index fca548ccf..1ac75885c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -191,8 +191,8 @@ if(NOT EXISTS ${dfhack_SOURCE_DIR}/library/xml/codegen.pl endif() # set up versioning. -set(DF_VERSION "50.07") -set(DFHACK_RELEASE "r2rc1") +set(DF_VERSION "50.08b1") +set(DFHACK_RELEASE "beta2") set(DFHACK_PRERELEASE TRUE) set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}") From ae2bdfad5ff8fb4f9d530f9f1458415a45ed755e Mon Sep 17 00:00:00 2001 From: Taxi Service Date: Wed, 19 Apr 2023 11:28:57 +0200 Subject: [PATCH 42/80] moved Slider class from filterselection.lua to widgets.lua --- library/lua/gui/widgets.lua | 137 ++++++++++++++++++ plugins/lua/buildingplan/filterselection.lua | 139 +------------------ 2 files changed, 138 insertions(+), 138 deletions(-) diff --git a/library/lua/gui/widgets.lua b/library/lua/gui/widgets.lua index b33076cdc..eb4d53757 100644 --- a/library/lua/gui/widgets.lua +++ b/library/lua/gui/widgets.lua @@ -2293,4 +2293,141 @@ function TabBar:onInput(keys) end end +-------------------------------- +-- Slider +-- + +Slider = defclass(Slider, Widget) +Slider.ATTRS{ + num_stops=DEFAULT_NIL, + get_left_idx_fn=DEFAULT_NIL, + get_right_idx_fn=DEFAULT_NIL, + on_left_change=DEFAULT_NIL, + on_right_change=DEFAULT_NIL, +} + +function Slider:preinit(init_table) + init_table.frame = init_table.frame or {} + init_table.frame.h = init_table.frame.h or 1 +end + +function Slider:init() + if self.num_stops < 2 then error('too few Slider stops') end + self.is_dragging_target = nil -- 'left', 'right', or 'both' + self.is_dragging_idx = nil -- offset from leftmost dragged tile +end + +local function slider_get_width_per_idx(self) + return math.max(5, (self.frame_body.width-7) // (self.num_stops-1)) +end + +function Slider:onInput(keys) + if not keys._MOUSE_L_DOWN then return false end + local x = self:getMousePos() + if not x then return false end + local left_idx, right_idx = self.get_left_idx_fn(), self.get_right_idx_fn() + local width_per_idx = slider_get_width_per_idx(self) + local left_pos = width_per_idx*(left_idx-1) + local right_pos = width_per_idx*(right_idx-1) + 4 + if x < left_pos then + self.on_left_change(self.get_left_idx_fn() - 1) + elseif x < left_pos+3 then + self.is_dragging_target = 'left' + self.is_dragging_idx = x - left_pos + elseif x < right_pos then + self.is_dragging_target = 'both' + self.is_dragging_idx = x - left_pos + elseif x < right_pos+3 then + self.is_dragging_target = 'right' + self.is_dragging_idx = x - right_pos + else + self.on_right_change(self.get_right_idx_fn() + 1) + end + return true +end + +local function slider_do_drag(self, width_per_idx) + local x = self.frame_body:localXY(dfhack.screen.getMousePos()) + local cur_pos = x - self.is_dragging_idx + cur_pos = math.max(0, cur_pos) + cur_pos = math.min(width_per_idx*(self.num_stops-1)+7, cur_pos) + local offset = self.is_dragging_target == 'right' and -2 or 1 + local new_idx = math.max(0, cur_pos+offset)//width_per_idx + 1 + local new_left_idx, new_right_idx + if self.is_dragging_target == 'right' then + new_right_idx = new_idx + else + new_left_idx = new_idx + if self.is_dragging_target == 'both' then + new_right_idx = new_left_idx + self.get_right_idx_fn() - self.get_left_idx_fn() + if new_right_idx > self.num_stops then + return + end + end + end + if new_left_idx and new_left_idx ~= self.get_left_idx_fn() then + self.on_left_change(new_left_idx) + end + if new_right_idx and new_right_idx ~= self.get_right_idx_fn() then + self.on_right_change(new_right_idx) + end +end + +local SLIDER_LEFT_END = to_pen{ch=198, fg=COLOR_GREY, bg=COLOR_BLACK} +local SLIDER_TRACK = to_pen{ch=205, fg=COLOR_GREY, bg=COLOR_BLACK} +local SLIDER_TRACK_SELECTED = to_pen{ch=205, fg=COLOR_LIGHTGREEN, bg=COLOR_BLACK} +local SLIDER_TRACK_STOP = to_pen{ch=216, fg=COLOR_GREY, bg=COLOR_BLACK} +local SLIDER_TRACK_STOP_SELECTED = to_pen{ch=216, fg=COLOR_LIGHTGREEN, bg=COLOR_BLACK} +local SLIDER_RIGHT_END = to_pen{ch=181, fg=COLOR_GREY, bg=COLOR_BLACK} +local SLIDER_TAB_LEFT = to_pen{ch=60, fg=COLOR_BLACK, bg=COLOR_YELLOW} +local SLIDER_TAB_CENTER = to_pen{ch=9, fg=COLOR_BLACK, bg=COLOR_YELLOW} +local SLIDER_TAB_RIGHT = to_pen{ch=62, fg=COLOR_BLACK, bg=COLOR_YELLOW} + +function Slider:onRenderBody(dc, rect) + local left_idx, right_idx = self.get_left_idx_fn(), self.get_right_idx_fn() + local width_per_idx = slider_get_width_per_idx(self) + -- draw track + dc:seek(1,0) + dc:char(nil, SLIDER_LEFT_END) + dc:char(nil, SLIDER_TRACK) + for stop_idx=1,self.num_stops-1 do + local track_stop_pen = SLIDER_TRACK_STOP_SELECTED + local track_pen = SLIDER_TRACK_SELECTED + if left_idx > stop_idx or right_idx < stop_idx then + track_stop_pen = SLIDER_TRACK_STOP + track_pen = SLIDER_TRACK + elseif right_idx == stop_idx then + track_pen = SLIDER_TRACK + end + dc:char(nil, track_stop_pen) + for i=2,width_per_idx do + dc:char(nil, track_pen) + end + end + if right_idx >= self.num_stops then + dc:char(nil, SLIDER_TRACK_STOP_SELECTED) + else + dc:char(nil, SLIDER_TRACK_STOP) + end + dc:char(nil, SLIDER_TRACK) + dc:char(nil, SLIDER_RIGHT_END) + -- draw tabs + dc:seek(width_per_idx*(left_idx-1)) + dc:char(nil, SLIDER_TAB_LEFT) + dc:char(nil, SLIDER_TAB_CENTER) + dc:char(nil, SLIDER_TAB_RIGHT) + dc:seek(width_per_idx*(right_idx-1)+4) + dc:char(nil, SLIDER_TAB_LEFT) + dc:char(nil, SLIDER_TAB_CENTER) + dc:char(nil, SLIDER_TAB_RIGHT) + -- manage dragging + if self.is_dragging_target then + slider_do_drag(self, width_per_idx) + end + if df.global.enabler.mouse_lbut == 0 then + self.is_dragging_target = nil + self.is_dragging_idx = nil + end +end + return _ENV diff --git a/plugins/lua/buildingplan/filterselection.lua b/plugins/lua/buildingplan/filterselection.lua index 968ad88d9..fde80d4c8 100644 --- a/plugins/lua/buildingplan/filterselection.lua +++ b/plugins/lua/buildingplan/filterselection.lua @@ -12,143 +12,6 @@ local function get_cur_filters() uibs.building_subtype, uibs.custom_type) end --------------------------------- --- Slider --- - -Slider = defclass(Slider, widgets.Widget) -Slider.ATTRS{ - num_stops=DEFAULT_NIL, - get_left_idx_fn=DEFAULT_NIL, - get_right_idx_fn=DEFAULT_NIL, - on_left_change=DEFAULT_NIL, - on_right_change=DEFAULT_NIL, -} - -function Slider:preinit(init_table) - init_table.frame = init_table.frame or {} - init_table.frame.h = init_table.frame.h or 1 -end - -function Slider:init() - if self.num_stops < 2 then error('too few Slider stops') end - self.is_dragging_target = nil -- 'left', 'right', or 'both' - self.is_dragging_idx = nil -- offset from leftmost dragged tile -end - -local function slider_get_width_per_idx(self) - return math.max(5, (self.frame_body.width-7) // (self.num_stops-1)) -end - -function Slider:onInput(keys) - if not keys._MOUSE_L_DOWN then return false end - local x = self:getMousePos() - if not x then return false end - local left_idx, right_idx = self.get_left_idx_fn(), self.get_right_idx_fn() - local width_per_idx = slider_get_width_per_idx(self) - local left_pos = width_per_idx*(left_idx-1) - local right_pos = width_per_idx*(right_idx-1) + 4 - if x < left_pos then - self.on_left_change(self.get_left_idx_fn() - 1) - elseif x < left_pos+3 then - self.is_dragging_target = 'left' - self.is_dragging_idx = x - left_pos - elseif x < right_pos then - self.is_dragging_target = 'both' - self.is_dragging_idx = x - left_pos - elseif x < right_pos+3 then - self.is_dragging_target = 'right' - self.is_dragging_idx = x - right_pos - else - self.on_right_change(self.get_right_idx_fn() + 1) - end - return true -end - -local function slider_do_drag(self, width_per_idx) - local x = self.frame_body:localXY(dfhack.screen.getMousePos()) - local cur_pos = x - self.is_dragging_idx - cur_pos = math.max(0, cur_pos) - cur_pos = math.min(width_per_idx*(self.num_stops-1)+7, cur_pos) - local offset = self.is_dragging_target == 'right' and -2 or 1 - local new_idx = math.max(0, cur_pos+offset)//width_per_idx + 1 - local new_left_idx, new_right_idx - if self.is_dragging_target == 'right' then - new_right_idx = new_idx - else - new_left_idx = new_idx - if self.is_dragging_target == 'both' then - new_right_idx = new_left_idx + self.get_right_idx_fn() - self.get_left_idx_fn() - if new_right_idx > self.num_stops then - return - end - end - end - if new_left_idx and new_left_idx ~= self.get_left_idx_fn() then - self.on_left_change(new_left_idx) - end - if new_right_idx and new_right_idx ~= self.get_right_idx_fn() then - self.on_right_change(new_right_idx) - end -end - -local SLIDER_LEFT_END = to_pen{ch=198, fg=COLOR_GREY, bg=COLOR_BLACK} -local SLIDER_TRACK = to_pen{ch=205, fg=COLOR_GREY, bg=COLOR_BLACK} -local SLIDER_TRACK_SELECTED = to_pen{ch=205, fg=COLOR_LIGHTGREEN, bg=COLOR_BLACK} -local SLIDER_TRACK_STOP = to_pen{ch=216, fg=COLOR_GREY, bg=COLOR_BLACK} -local SLIDER_TRACK_STOP_SELECTED = to_pen{ch=216, fg=COLOR_LIGHTGREEN, bg=COLOR_BLACK} -local SLIDER_RIGHT_END = to_pen{ch=181, fg=COLOR_GREY, bg=COLOR_BLACK} -local SLIDER_TAB_LEFT = to_pen{ch=60, fg=COLOR_BLACK, bg=COLOR_YELLOW} -local SLIDER_TAB_CENTER = to_pen{ch=9, fg=COLOR_BLACK, bg=COLOR_YELLOW} -local SLIDER_TAB_RIGHT = to_pen{ch=62, fg=COLOR_BLACK, bg=COLOR_YELLOW} - -function Slider:onRenderBody(dc, rect) - local left_idx, right_idx = self.get_left_idx_fn(), self.get_right_idx_fn() - local width_per_idx = slider_get_width_per_idx(self) - -- draw track - dc:seek(1,0) - dc:char(nil, SLIDER_LEFT_END) - dc:char(nil, SLIDER_TRACK) - for stop_idx=1,self.num_stops-1 do - local track_stop_pen = SLIDER_TRACK_STOP_SELECTED - local track_pen = SLIDER_TRACK_SELECTED - if left_idx > stop_idx or right_idx < stop_idx then - track_stop_pen = SLIDER_TRACK_STOP - track_pen = SLIDER_TRACK - elseif right_idx == stop_idx then - track_pen = SLIDER_TRACK - end - dc:char(nil, track_stop_pen) - for i=2,width_per_idx do - dc:char(nil, track_pen) - end - end - if right_idx >= self.num_stops then - dc:char(nil, SLIDER_TRACK_STOP_SELECTED) - else - dc:char(nil, SLIDER_TRACK_STOP) - end - dc:char(nil, SLIDER_TRACK) - dc:char(nil, SLIDER_RIGHT_END) - -- draw tabs - dc:seek(width_per_idx*(left_idx-1)) - dc:char(nil, SLIDER_TAB_LEFT) - dc:char(nil, SLIDER_TAB_CENTER) - dc:char(nil, SLIDER_TAB_RIGHT) - dc:seek(width_per_idx*(right_idx-1)+4) - dc:char(nil, SLIDER_TAB_LEFT) - dc:char(nil, SLIDER_TAB_CENTER) - dc:char(nil, SLIDER_TAB_RIGHT) - -- manage dragging - if self.is_dragging_target then - slider_do_drag(self, width_per_idx) - end - if df.global.enabler.mouse_lbut == 0 then - self.is_dragging_target = nil - self.is_dragging_idx = nil - end -end - -------------------------------- -- QualityAndMaterialsPage -- @@ -328,7 +191,7 @@ function QualityAndMaterialsPage:init() enabled=enable_item_quality, on_change=function(val) self:set_max_quality(val+1) end, }, - Slider{ + widgets.Slider{ frame={l=0, t=6}, num_stops=7, get_left_idx_fn=function() From 1620604a8e0d73dd5e0b7528df284aedd11b8572 Mon Sep 17 00:00:00 2001 From: Taxi Service Date: Wed, 19 Apr 2023 11:38:22 +0200 Subject: [PATCH 43/80] added changelog entry --- docs/changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog.txt b/docs/changelog.txt index 5110e24ab..809223e25 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -49,6 +49,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## API ## Lua +- `widgets`: "Slider" class has been moved from ``filterselection.lua`` into ``widgets.lua`` ## Removed From a0b259bb676f2000eff4e160ae14f4772ab2c82f Mon Sep 17 00:00:00 2001 From: Taxi Service Date: Wed, 19 Apr 2023 11:44:27 +0200 Subject: [PATCH 44/80] attempt to fix changelog entry... --- docs/changelog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index 809223e25..1ad220b0d 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -49,7 +49,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## API ## Lua -- `widgets`: "Slider" class has been moved from ``filterselection.lua`` into ``widgets.lua`` +- ``widgets``: "Slider" class has been moved from ``filterselection.lua`` into ``widgets.lua`` ## Removed From 98a252eab4ca6418b344ac8cbbc05a3273f056e5 Mon Sep 17 00:00:00 2001 From: DFHack-Urist via GitHub Actions <63161697+DFHack-Urist@users.noreply.github.com> Date: Thu, 20 Apr 2023 07:13:34 +0000 Subject: [PATCH 45/80] Auto-update submodules scripts: master --- scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts b/scripts index 6fba9905a..ad2bd2f60 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit 6fba9905a71f626ecc640fd3de988e147d16cb4e +Subproject commit ad2bd2f60d1760db8ffb80cfa57f8fb868613e81 From 8371aa0b8b0b4bbb2716f22c649b2123e2680f41 Mon Sep 17 00:00:00 2001 From: Taxi Service Date: Thu, 20 Apr 2023 13:24:47 +0200 Subject: [PATCH 46/80] renamed Slider to RangeSlider, and added draft of Lua API.rst entry --- docs/changelog.txt | 2 +- docs/dev/Lua API.rst | 11 +++++++++ library/lua/gui/widgets.lua | 26 ++++++++++---------- plugins/lua/buildingplan/filterselection.lua | 2 +- 4 files changed, 26 insertions(+), 15 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index 1ad220b0d..c6e4386b8 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -49,7 +49,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## API ## Lua -- ``widgets``: "Slider" class has been moved from ``filterselection.lua`` into ``widgets.lua`` +- ``widgets``: "Slider" class has been moved from ``filterselection.lua`` into ``widgets.lua`` and renamed to "RangeSlider" ## Removed diff --git a/docs/dev/Lua API.rst b/docs/dev/Lua API.rst index e63bc8a61..212a6e891 100644 --- a/docs/dev/Lua API.rst +++ b/docs/dev/Lua API.rst @@ -5130,6 +5130,17 @@ widget does not require direct usage of ``Tab``. usage of ``Tab`` in ``TabBar:init()`` for an example. See the default value of ``active_tab_pens`` or ``inactive_tab_pens`` in ``TabBar`` for an example of how to construct pens. +RangeSlider class +----------------- + +This widget implements a mouse-interactable range-slider. The user can move its two handles to set minimum and maximum values to define a range. + +:num_stops: Specifies the amount of "notches" in the range slider, the places where handles can stop. +:get_left_idx_fn: The function used by the RangeSlider to determine what value to display on its left handle. +:get_right_idx_fn: The function used by the RangeSlider to determine what value to display on its right handle. +:on_left_change: Callback executed when a handle is moved leftwards. +:on_right_change: Callback executed when a handle is moved rightwards. + .. _lua-plugins: ======= diff --git a/library/lua/gui/widgets.lua b/library/lua/gui/widgets.lua index eb4d53757..a778df639 100644 --- a/library/lua/gui/widgets.lua +++ b/library/lua/gui/widgets.lua @@ -2294,11 +2294,11 @@ function TabBar:onInput(keys) end -------------------------------- --- Slider +-- RangeSlider -- -Slider = defclass(Slider, Widget) -Slider.ATTRS{ +RangeSlider = defclass(RangeSlider, Widget) +RangeSlider.ATTRS{ num_stops=DEFAULT_NIL, get_left_idx_fn=DEFAULT_NIL, get_right_idx_fn=DEFAULT_NIL, @@ -2306,27 +2306,27 @@ Slider.ATTRS{ on_right_change=DEFAULT_NIL, } -function Slider:preinit(init_table) +function RangeSlider:preinit(init_table) init_table.frame = init_table.frame or {} init_table.frame.h = init_table.frame.h or 1 end -function Slider:init() - if self.num_stops < 2 then error('too few Slider stops') end +function RangeSlider:init() + if self.num_stops < 2 then error('too few RangeSlider stops') end self.is_dragging_target = nil -- 'left', 'right', or 'both' self.is_dragging_idx = nil -- offset from leftmost dragged tile end -local function slider_get_width_per_idx(self) +local function rangeslider_get_width_per_idx(self) return math.max(5, (self.frame_body.width-7) // (self.num_stops-1)) end -function Slider:onInput(keys) +function RangeSlider:onInput(keys) if not keys._MOUSE_L_DOWN then return false end local x = self:getMousePos() if not x then return false end local left_idx, right_idx = self.get_left_idx_fn(), self.get_right_idx_fn() - local width_per_idx = slider_get_width_per_idx(self) + local width_per_idx = rangeslider_get_width_per_idx(self) local left_pos = width_per_idx*(left_idx-1) local right_pos = width_per_idx*(right_idx-1) + 4 if x < left_pos then @@ -2346,7 +2346,7 @@ function Slider:onInput(keys) return true end -local function slider_do_drag(self, width_per_idx) +local function rangeslider_do_drag(self, width_per_idx) local x = self.frame_body:localXY(dfhack.screen.getMousePos()) local cur_pos = x - self.is_dragging_idx cur_pos = math.max(0, cur_pos) @@ -2383,9 +2383,9 @@ local SLIDER_TAB_LEFT = to_pen{ch=60, fg=COLOR_BLACK, bg=COLOR_YELLOW} local SLIDER_TAB_CENTER = to_pen{ch=9, fg=COLOR_BLACK, bg=COLOR_YELLOW} local SLIDER_TAB_RIGHT = to_pen{ch=62, fg=COLOR_BLACK, bg=COLOR_YELLOW} -function Slider:onRenderBody(dc, rect) +function RangeSlider:onRenderBody(dc, rect) local left_idx, right_idx = self.get_left_idx_fn(), self.get_right_idx_fn() - local width_per_idx = slider_get_width_per_idx(self) + local width_per_idx = rangeslider_get_width_per_idx(self) -- draw track dc:seek(1,0) dc:char(nil, SLIDER_LEFT_END) @@ -2422,7 +2422,7 @@ function Slider:onRenderBody(dc, rect) dc:char(nil, SLIDER_TAB_RIGHT) -- manage dragging if self.is_dragging_target then - slider_do_drag(self, width_per_idx) + rangeslider_do_drag(self, width_per_idx) end if df.global.enabler.mouse_lbut == 0 then self.is_dragging_target = nil diff --git a/plugins/lua/buildingplan/filterselection.lua b/plugins/lua/buildingplan/filterselection.lua index fde80d4c8..4e8b98073 100644 --- a/plugins/lua/buildingplan/filterselection.lua +++ b/plugins/lua/buildingplan/filterselection.lua @@ -191,7 +191,7 @@ function QualityAndMaterialsPage:init() enabled=enable_item_quality, on_change=function(val) self:set_max_quality(val+1) end, }, - widgets.Slider{ + widgets.RangeSlider{ frame={l=0, t=6}, num_stops=7, get_left_idx_fn=function() From 1a2d5dfc8d34df66eb2a76cc1cb97ee79c17c43b Mon Sep 17 00:00:00 2001 From: DFHack-Urist via GitHub Actions <63161697+DFHack-Urist@users.noreply.github.com> Date: Fri, 21 Apr 2023 07:13:33 +0000 Subject: [PATCH 47/80] Auto-update submodules scripts: master --- scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts b/scripts index ad2bd2f60..5da969fce 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit ad2bd2f60d1760db8ffb80cfa57f8fb868613e81 +Subproject commit 5da969fce69a5b9330f183cc0629798bf9907b69 From e30b86cfd2b25bd10ebe65cf2badf9fdfb1b0744 Mon Sep 17 00:00:00 2001 From: DFHack-Urist via GitHub Actions <63161697+DFHack-Urist@users.noreply.github.com> Date: Tue, 18 Apr 2023 10:19:25 +0000 Subject: [PATCH 48/80] Auto-update submodules depends/xlsxio: dfhack --- depends/xlsxio | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depends/xlsxio b/depends/xlsxio index 439fdbc25..0a9945266 160000 --- a/depends/xlsxio +++ b/depends/xlsxio @@ -1 +1 @@ -Subproject commit 439fdbc259c13f23a3122e68ba35ad5a13bcd97c +Subproject commit 0a994526622c2201756e386ef98b44b193e25f06 From 1476e67422b426631247bc8119ff1ffa4cc3c736 Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Tue, 18 Apr 2023 05:40:51 -0500 Subject: [PATCH 49/80] cmake minimum version 3.21 forced by this being the lowest version that supports vs 2022 --- depends/clsocket | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/depends/clsocket b/depends/clsocket index 6ed8aa464..d5e17c601 160000 --- a/depends/clsocket +++ b/depends/clsocket @@ -1 +1 @@ -Subproject commit 6ed8aa46462ea01a1122fc49422840a2facc9757 +Subproject commit d5e17c6012e7eefb0cbe3e130a56c24bd11f0094 From 2b8b6a62e0d984746c386b519c5882b6e81a09be Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Fri, 21 Apr 2023 08:31:17 -0500 Subject: [PATCH 50/80] update structures --- library/xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/xml b/library/xml index 34bc84b11..98d5f8a55 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit 34bc84b1125f32b2f09b20ee0561a24bc3a66e70 +Subproject commit 98d5f8a5553690ef71b9650b28d4aababf21ef5e From 6b86f7c69128e69dc03d07b735da5c68967759d9 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Fri, 21 Apr 2023 11:20:28 -0700 Subject: [PATCH 51/80] planner panel is minimized by default and minimized state is now persisted across reloads --- data/dfhack-config/buildingplan.json | 5 +++ docs/changelog.txt | 2 +- plugins/lua/buildingplan/planneroverlay.lua | 40 ++++++++++++++------- 3 files changed, 34 insertions(+), 13 deletions(-) create mode 100644 data/dfhack-config/buildingplan.json diff --git a/data/dfhack-config/buildingplan.json b/data/dfhack-config/buildingplan.json new file mode 100644 index 000000000..9bb3052b7 --- /dev/null +++ b/data/dfhack-config/buildingplan.json @@ -0,0 +1,5 @@ +{ + "planner": { + "minimized": true + } +} \ No newline at end of file diff --git a/docs/changelog.txt b/docs/changelog.txt index 4794122f6..b53717dd0 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -38,7 +38,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## Fixes ## Misc Improvements -- `buildingplan`: minimized planner panel stays minimized until you change it again +- `buildingplan`: planner panel is minimized by default and now remembers minimized state - `buildingplan`: can now filter by gems (for gem windows) - ``toggle-kbd-cursor``: add hotkey for toggling the keyboard cursor (Alt-K) - `gui/control-panel`: add preference option for hiding the terminal console on startup diff --git a/plugins/lua/buildingplan/planneroverlay.lua b/plugins/lua/buildingplan/planneroverlay.lua index 8f12c695f..83a58ebd8 100644 --- a/plugins/lua/buildingplan/planneroverlay.lua +++ b/plugins/lua/buildingplan/planneroverlay.lua @@ -4,12 +4,15 @@ local itemselection = require('plugins.buildingplan.itemselection') local filterselection = require('plugins.buildingplan.filterselection') local gui = require('gui') local guidm = require('gui.dwarfmode') +local json = require('json') local overlay = require('plugins.overlay') local pens = require('plugins.buildingplan.pens') local utils = require('utils') local widgets = require('gui.widgets') require('dfhack.buildings') +config = config or json.open('dfhack-config/buildingplan.json') + local uibs = df.global.buildreq reset_counts_flag = false @@ -336,14 +339,14 @@ PlannerOverlay.ATTRS{ function PlannerOverlay:init() self.selected = 1 - self.minimized = false + self.state = ensure_key(config.data, 'planner') local main_panel = widgets.Panel{ view_id='main', frame={t=1, l=0, r=0, h=14}, frame_style=gui.INTERIOR_MEDIUM_FRAME, frame_background=gui.CLEAR_PEN, - visible=function() return not self.minimized end, + visible=self:callback('is_not_minimized'), } local minimized_panel = widgets.Panel{ @@ -355,8 +358,8 @@ function PlannerOverlay:init() {text=' show Planner ', pen=pens.MINI_TEXT_PEN, hpen=pens.MINI_TEXT_HPEN}, {text='['..string.char(31)..']', pen=pens.MINI_BUTT_PEN, hpen=pens.MINI_BUTT_HPEN}, }, - visible=function() return self.minimized end, - on_click=function() self.minimized = not self.minimized end, + visible=self:callback('is_minimized'), + on_click=self:callback('toggle_minimized'), }, widgets.Label{ frame={t=0, r=0, h=1}, @@ -364,8 +367,8 @@ function PlannerOverlay:init() {text=' hide Planner ', pen=pens.MINI_TEXT_PEN, hpen=pens.MINI_TEXT_HPEN}, {text='['..string.char(30)..']', pen=pens.MINI_BUTT_PEN, hpen=pens.MINI_BUTT_HPEN}, }, - visible=function() return not self.minimized end, - on_click=function() self.minimized = not self.minimized end, + visible=self:callback('is_not_minimized'), + on_click=self:callback('toggle_minimized'), }, }, } @@ -554,7 +557,7 @@ function PlannerOverlay:init() view_id='divider', frame={t=10, l=0, r=0, h=1}, on_render=self:callback('draw_divider_h'), - visible=function() return not self.minimized end, + visible=self:callback('is_not_minimized'), } local error_panel = widgets.ResizingPanel{ @@ -562,7 +565,7 @@ function PlannerOverlay:init() frame={t=15, l=0, r=0}, frame_style=gui.BOLD_FRAME, frame_background=gui.CLEAR_PEN, - visible=function() return not self.minimized end, + visible=self:callback('is_not_minimized'), } error_panel:addviews{ @@ -609,7 +612,7 @@ function PlannerOverlay:init() frame={t=0, l=1, w=37, h=1}, frame_inset=0, frame_background=gui.CLEAR_PEN, - visible=function() return not self.minimized end, + visible=self:callback('is_not_minimized'), subviews={ prev_next_selector, }, @@ -624,6 +627,19 @@ function PlannerOverlay:init() } end +function PlannerOverlay:is_minimized() + return self.state.minimized +end + +function PlannerOverlay:is_not_minimized() + return not self.state.minimized +end + +function PlannerOverlay:toggle_minimized() + self.state.minimized = not self.state.minimized + config:write() +end + function PlannerOverlay:draw_divider_h(dc) local x2 = dc.width -1 for x=0,x2 do @@ -735,13 +751,13 @@ function PlannerOverlay:onInput(keys) return false end if keys.CUSTOM_ALT_M then - self.minimized = not self.minimized + self:toggle_minimized() return true end if PlannerOverlay.super.onInput(self, keys) then return true end - if self.minimized then return false end + if self:is_minimized() then return false end if keys._MOUSE_L_DOWN then if is_over_options_panel() then return false end local detect_rect = copyall(self.frame_rect) @@ -837,7 +853,7 @@ function PlannerOverlay:onRenderFrame(dc, rect) uibs.building_type, uibs.building_subtype, uibs.custom_type)) end - if self.minimized then return end + if self:is_minimized() then return end local bounds = get_selected_bounds(self.saved_selection_pos, self.saved_pos) if not bounds then return end From 6d9a07355bde4816939177bd70086231398f3564 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Fri, 21 Apr 2023 11:54:38 -0700 Subject: [PATCH 52/80] allow filtering by yarn --- docs/changelog.txt | 2 +- plugins/buildingplan/buildingplan.cpp | 10 ++++++++++ plugins/lua/buildingplan/filterselection.lua | 1 + 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index 4794122f6..935b376b2 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -39,7 +39,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## Misc Improvements - `buildingplan`: minimized planner panel stays minimized until you change it again -- `buildingplan`: can now filter by gems (for gem windows) +- `buildingplan`: can now filter by gems (for gem windows) and yarn (for ropes in wells) - ``toggle-kbd-cursor``: add hotkey for toggling the keyboard cursor (Alt-K) - `gui/control-panel`: add preference option for hiding the terminal console on startup - `gui/control-panel`: add preference option for hiding "armok" tools in command lists diff --git a/plugins/buildingplan/buildingplan.cpp b/plugins/buildingplan/buildingplan.cpp index e2f964a44..05b2c0af6 100644 --- a/plugins/buildingplan/buildingplan.cpp +++ b/plugins/buildingplan/buildingplan.cpp @@ -154,6 +154,7 @@ static const df::dfhack_material_category gem_cat(df::dfhack_material_category:: static const df::dfhack_material_category clay_cat(df::dfhack_material_category::mask_clay); static const df::dfhack_material_category cloth_cat(df::dfhack_material_category::mask_cloth); static const df::dfhack_material_category silk_cat(df::dfhack_material_category::mask_silk); +static const df::dfhack_material_category yarn_cat(df::dfhack_material_category::mask_yarn); static void cache_matched(int16_t type, int32_t index) { MaterialInfo mi; @@ -182,6 +183,9 @@ static void cache_matched(int16_t type, int32_t index) { } else if (mi.matches(silk_cat)) { DEBUG(status).print("cached silk material: %s (%d, %d)\n", mi.toString().c_str(), type, index); mat_cache.emplace(mi.toString(), std::make_pair(mi, "silk")); + } else if (mi.matches(yarn_cat)) { + DEBUG(status).print("cached yarn material: %s (%d, %d)\n", mi.toString().c_str(), type, index); + mat_cache.emplace(mi.toString(), std::make_pair(mi, "yarn")); } else TRACE(status).print("not matched: %s\n", mi.toString().c_str()); @@ -208,6 +212,7 @@ static void load_material_cache() { load_organic_material_cache(df::organic_mat_category::Wood); load_organic_material_cache(df::organic_mat_category::PlantFiber); load_organic_material_cache(df::organic_mat_category::Silk); + load_organic_material_cache(df::organic_mat_category::Yarn); } static HeatSafety get_heat_safety_filter(const BuildingTypeKey &key) { @@ -812,6 +817,8 @@ static int setMaterialMaskFilter(lua_State *L) { mask |= cloth_cat.whole; else if (cat == "silk") mask |= silk_cat.whole; + else if (cat == "yarn") + mask |= yarn_cat.whole; } DEBUG(status,*out).print( "setting material mask filter for building_type=%d subtype=%d custom=%d index=%d to %x\n", @@ -860,6 +867,7 @@ static int getMaterialMaskFilter(lua_State *L) { ret.emplace("clay", !bits || bits & clay_cat.whole); ret.emplace("cloth", !bits || bits & cloth_cat.whole); ret.emplace("silk", !bits || bits & silk_cat.whole); + ret.emplace("yarn", !bits || bits & yarn_cat.whole); Lua::Push(L, ret); return 1; } @@ -912,6 +920,8 @@ static int setMaterialFilter(lua_State *L) { mask.whole |= cloth_cat.whole; else if (mat.matches(silk_cat)) mask.whole |= silk_cat.whole; + else if (mat.matches(yarn_cat)) + mask.whole |= yarn_cat.whole; } filter.setMaterialMask(mask.whole); get_item_filters(*out, key).setItemFilter(*out, filter, index); diff --git a/plugins/lua/buildingplan/filterselection.lua b/plugins/lua/buildingplan/filterselection.lua index 968ad88d9..eb364870d 100644 --- a/plugins/lua/buildingplan/filterselection.lua +++ b/plugins/lua/buildingplan/filterselection.lua @@ -456,6 +456,7 @@ function QualityAndMaterialsPage:refresh() make_cat_choice('Clay', 'clay', 'CUSTOM_SHIFT_C', cats), make_cat_choice('Cloth', 'cloth', 'CUSTOM_SHIFT_L', cats), make_cat_choice('Silk', 'silk', 'CUSTOM_SHIFT_K', cats), + make_cat_choice('Yarn', 'yarn', 'CUSTOM_SHIFT_Y', cats), } self.subviews.materials_categories:setChoices(category_choices) From c7bf7eba9062cc7c1aeb2f7a8cbd75e081deea5e Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Fri, 21 Apr 2023 12:01:33 -0700 Subject: [PATCH 53/80] update scripts HEAD in beta branch --- scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts b/scripts index ec1a69788..5da969fce 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit ec1a69788fd6329008672523b622fd8b390fea73 +Subproject commit 5da969fce69a5b9330f183cc0629798bf9907b69 From adeb872725cb6bfdcedbd4265a9c17e5d73d9745 Mon Sep 17 00:00:00 2001 From: Taxi Service Date: Sat, 22 Apr 2023 09:44:37 +0200 Subject: [PATCH 54/80] modified 's RangeSlider entry --- docs/dev/Lua API.rst | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/docs/dev/Lua API.rst b/docs/dev/Lua API.rst index 212a6e891..02484c745 100644 --- a/docs/dev/Lua API.rst +++ b/docs/dev/Lua API.rst @@ -5133,13 +5133,16 @@ widget does not require direct usage of ``Tab``. RangeSlider class ----------------- -This widget implements a mouse-interactable range-slider. The user can move its two handles to set minimum and maximum values to define a range. - -:num_stops: Specifies the amount of "notches" in the range slider, the places where handles can stop. -:get_left_idx_fn: The function used by the RangeSlider to determine what value to display on its left handle. -:get_right_idx_fn: The function used by the RangeSlider to determine what value to display on its right handle. -:on_left_change: Callback executed when a handle is moved leftwards. -:on_right_change: Callback executed when a handle is moved rightwards. +This widget implements a mouse-interactable range-slider. The user can move its two handles to set minimum and maximum values +to define a range, or they can drag the bar itself to move both handles at once. +The handles mirror the state of its two parent ``CycleHotkeyLabels``. + +:num_stops: Used to specify the number of "notches" in the range slider, the places where handles can stop. + (this should match the parents' number of options) +:get_left_idx_fn: The function used by the RangeSlider to get the notch index on which to display the left handle. +:get_right_idx_fn: The function used by the RangeSlider to get the notch index on which to display the right handle. +:on_left_change: Callback executed when moving the left handle. +:on_right_change: Callback executed when moving the right handle. .. _lua-plugins: From 29741dff4b012a7a5bdbda8c9dc6f797bb56f2dc Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sun, 23 Apr 2023 16:31:41 -0700 Subject: [PATCH 55/80] remove toggle-kbd-cursor alias (it's a script now) --- data/init/dfhack.tools.init | 1 - 1 file changed, 1 deletion(-) diff --git a/data/init/dfhack.tools.init b/data/init/dfhack.tools.init index 8fd815559..aaf0cf277 100644 --- a/data/init/dfhack.tools.init +++ b/data/init/dfhack.tools.init @@ -144,4 +144,3 @@ enable \ alias add autounsuspend suspendmanager alias add gui/dig gui/design -alias add toggle-kbd-cursor lua "local flags4 = df.global.d_init.flags4 if flags4.KEYBOARD_CURSOR then flags4.KEYBOARD_CURSOR = false else local guidm = require('gui.dwarfmode') guidm.setCursorPos(guidm.Viewport.get():getCenter()) flags4.KEYBOARD_CURSOR = true end" From 33142a5dfc6a0cf279570da298b62659b8ce3e07 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sun, 23 Apr 2023 17:26:45 -0700 Subject: [PATCH 56/80] add DFHack title version overlay --- docs/changelog.txt | 1 + plugins/lua/overlay.lua | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/docs/changelog.txt b/docs/changelog.txt index 76b9ab301..7d95d810a 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -44,6 +44,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: - `gui/control-panel`: add preference option for hiding the terminal console on startup - `gui/control-panel`: add preference option for hiding "armok" tools in command lists - ``Dwarf Therapist``: add a warning to the Labors screen when Dwarf Therapist is active so players know that changes they make to that screen will have no effect. If you're starting a new embark and nobody seems to be doing anything, check your Labors tab for this warning to see if Dwarf Therapist thinks it is in control (even if it's not running). +- `overlay`: add the DFHack version string to the DF title screen ## Documentation diff --git a/plugins/lua/overlay.lua b/plugins/lua/overlay.lua index ff8bf7c98..75dc301ad 100644 --- a/plugins/lua/overlay.lua +++ b/plugins/lua/overlay.lua @@ -562,4 +562,42 @@ function OverlayWidget:init() self.frame.h = self.frame.h or 1 end +-- ------------------- -- +-- TitleVersionOverlay -- +-- ------------------- -- + +TitleVersionOverlay = defclass(TitleVersionOverlay, OverlayWidget) +TitleVersionOverlay.ATTRS{ + default_pos={x=50, y=-2}, + default_enabled=true, + viewscreens='title', + frame={w=30, h=3}, +} + +function TitleVersionOverlay:init() + local text = {} + table.insert(text, 'DFHack ' .. dfhack.getDFHackVersion() .. + (dfhack.isPrerelease() and (' (%s)'):format(dfhack.getGitCommit():sub(1,7)) or '')) + if #dfhack.getDFHackBuildID() > 0 then + table.insert(text, NEWLINE) + table.insert(text, 'Build ID: ' .. dfhack.getDFHackBuildID()) + end + if dfhack.isPrerelease() then + table.insert(text, NEWLINE) + table.insert(text, {text='Pre-release build', pen=COLOR_LIGHTRED}) + end + + self:addviews{ + widgets.Label{ + frame={b=0, l=0}, + text=text, + text_pen=COLOR_WHITE, + }, + } +end + +OVERLAY_WIDGETS = { + title_version = TitleVersionOverlay, +} + return _ENV From b59bf72cd21c32cf551404ad87ac8a0b4c3d70c4 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sun, 23 Apr 2023 17:31:29 -0700 Subject: [PATCH 57/80] turn down the title-version plugin --- docs/about/Removed.rst | 6 ++ docs/changelog.txt | 1 + docs/plugins/title-version.rst | 14 ----- plugins/CMakeLists.txt | 1 - plugins/title-version.cpp | 109 --------------------------------- 5 files changed, 7 insertions(+), 124 deletions(-) delete mode 100644 docs/plugins/title-version.rst delete mode 100644 plugins/title-version.cpp diff --git a/docs/about/Removed.rst b/docs/about/Removed.rst index a0365e621..174fc56c4 100644 --- a/docs/about/Removed.rst +++ b/docs/about/Removed.rst @@ -206,6 +206,12 @@ stocksettings Along with ``copystock``, ``loadstock`` and ``savestock``, replaced with the new `stockpiles` API. +.. _title-version: + +title-version +============= +Replaced with an `overlay`. + .. _warn-stuck-trees: warn-stuck-trees diff --git a/docs/changelog.txt b/docs/changelog.txt index 76b9ab301..fa5c15fde 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -52,6 +52,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## Lua ## Removed +- `title-version`: replaced by an `overlay` widget # 50.07-r1 diff --git a/docs/plugins/title-version.rst b/docs/plugins/title-version.rst deleted file mode 100644 index 4d0ef0c0b..000000000 --- a/docs/plugins/title-version.rst +++ /dev/null @@ -1,14 +0,0 @@ -title-version -============= - -.. dfhack-tool:: - :summary: Displays the DFHack version on DF's title screen. - :tags: unavailable interface - :no-command: - -Usage ------ - -:: - - enable title-version diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 53d0296c7..97216ad50 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -162,7 +162,6 @@ dfhack_plugin(strangemood strangemood.cpp) dfhack_plugin(tailor tailor.cpp LINK_LIBRARIES lua) dfhack_plugin(tiletypes tiletypes.cpp Brushes.h LINK_LIBRARIES lua) #dfhack_plugin(title-folder title-folder.cpp) -#dfhack_plugin(title-version title-version.cpp) #dfhack_plugin(trackstop trackstop.cpp) #dfhack_plugin(tubefill tubefill.cpp) #add_subdirectory(tweak) diff --git a/plugins/title-version.cpp b/plugins/title-version.cpp deleted file mode 100644 index 66bb159ad..000000000 --- a/plugins/title-version.cpp +++ /dev/null @@ -1,109 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#include "Core.h" -#include "Console.h" -#include "Export.h" -#include "PluginManager.h" -#include "modules/Gui.h" -#include "modules/Screen.h" -#include "VTableInterpose.h" -#include "DFHackVersion.h" - -#include "df/graphic.h" -#include "df/viewscreen_optionst.h" -#include "df/viewscreen_titlest.h" -#include "uicommon.h" - -using std::vector; -using std::string; -using namespace DFHack; - -DFHACK_PLUGIN("title-version"); -DFHACK_PLUGIN_IS_ENABLED(is_enabled); -REQUIRE_GLOBAL(gps); - -void draw_version(int start_x, int start_y) { - int x = start_x, - y = start_y; - - OutputString(COLOR_WHITE, x, y, string("DFHack ") + DFHACK_VERSION); - if (!DFHACK_IS_RELEASE) - { - OutputString(COLOR_WHITE, x, y, " (dev)"); - x = start_x; y++; - OutputString(COLOR_WHITE, x, y, "Git: "); - OutputString(COLOR_WHITE, x, y, DFHACK_GIT_DESCRIPTION); - } - if (strlen(DFHACK_BUILD_ID)) - { - x = start_x; y++; - OutputString(COLOR_WHITE, x, y, "Build ID: "); - OutputString(COLOR_WHITE, x, y, DFHACK_BUILD_ID); - } - if (DFHACK_IS_PRERELEASE) - { - x = start_x; y++; - OutputString(COLOR_LIGHTRED, x, y, "Pre-release build"); - } -} - -struct title_version_hook : df::viewscreen_titlest { - typedef df::viewscreen_titlest interpose_base; - - DEFINE_VMETHOD_INTERPOSE(void, render, ()) - { - INTERPOSE_NEXT(render)(); - if (!loading) - draw_version(0, 0); - } -}; - -IMPLEMENT_VMETHOD_INTERPOSE(title_version_hook, render); - -struct options_version_hook : df::viewscreen_optionst { - typedef df::viewscreen_optionst interpose_base; - - DEFINE_VMETHOD_INTERPOSE(void, render, ()) - { - INTERPOSE_NEXT(render)(); - if (!msg_quit && !in_retire_adv && !msg_peasant && - !in_retire_dwf_abandon_adv && !in_abandon_dwf && !ending_game) - draw_version(2, gps->dimy - 6); - } -}; - -IMPLEMENT_VMETHOD_INTERPOSE(options_version_hook, render); - -DFhackCExport command_result plugin_enable (color_ostream &out, bool enable) -{ - if (!gps) - return CR_FAILURE; - - if (enable != is_enabled) - { - if (!INTERPOSE_HOOK(title_version_hook, render).apply(enable) || - !INTERPOSE_HOOK(options_version_hook, render).apply(enable)) - return CR_FAILURE; - - is_enabled = enable; - } - - return CR_OK; -} - -DFhackCExport command_result plugin_init (color_ostream &out, vector &commands) -{ - return CR_OK; -} - -DFhackCExport command_result plugin_shutdown (color_ostream &out) -{ - INTERPOSE_HOOK(title_version_hook, render).remove(); - INTERPOSE_HOOK(options_version_hook, render).remove(); - return CR_OK; -} From 87e67987a926dab0fbe98f06541717d2214eb8d3 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sun, 23 Apr 2023 17:41:38 -0700 Subject: [PATCH 58/80] add "version" alias to run the help --- data/init/dfhack.tools.init | 1 + docs/changelog.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/data/init/dfhack.tools.init b/data/init/dfhack.tools.init index 8fd815559..cdd2a63a0 100644 --- a/data/init/dfhack.tools.init +++ b/data/init/dfhack.tools.init @@ -145,3 +145,4 @@ enable \ alias add autounsuspend suspendmanager alias add gui/dig gui/design alias add toggle-kbd-cursor lua "local flags4 = df.global.d_init.flags4 if flags4.KEYBOARD_CURSOR then flags4.KEYBOARD_CURSOR = false else local guidm = require('gui.dwarfmode') guidm.setCursorPos(guidm.Viewport.get():getCenter()) flags4.KEYBOARD_CURSOR = true end" +alias add version help diff --git a/docs/changelog.txt b/docs/changelog.txt index fa5c15fde..ecc616669 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -41,6 +41,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: - `buildingplan`: planner panel is minimized by default and now remembers minimized state - `buildingplan`: can now filter by gems (for gem windows) and yarn (for ropes in wells) - ``toggle-kbd-cursor``: add hotkey for toggling the keyboard cursor (Alt-K) +- ``version``: add alias to display the DFHack help (including the version number) so something happens when players try to run "version" - `gui/control-panel`: add preference option for hiding the terminal console on startup - `gui/control-panel`: add preference option for hiding "armok" tools in command lists - ``Dwarf Therapist``: add a warning to the Labors screen when Dwarf Therapist is active so players know that changes they make to that screen will have no effect. If you're starting a new embark and nobody seems to be doing anything, check your Labors tab for this warning to see if Dwarf Therapist thinks it is in control (even if it's not running). From b5459faffea36a6b579f6e7fe957f29d0d7aac72 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sun, 23 Apr 2023 18:20:50 -0700 Subject: [PATCH 59/80] format version string in help the same way --- library/Core.cpp | 2 +- library/DFHackVersion.cpp | 7 +++++-- library/include/DFHackVersion.h | 2 +- plugins/lua/overlay.lua | 4 ++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/library/Core.cpp b/library/Core.cpp index 4f06c3d62..a1e3b60e5 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -273,7 +273,7 @@ static std::string dfhack_version_desc() if (Version::is_release()) s << "(release)"; else - s << "(development build " << Version::git_description() << ")"; + s << "(git: " << Version::git_commit(true) << ")"; s << " on " << (sizeof(void*) == 8 ? "x86_64" : "x86"); if (strlen(Version::dfhack_build_id())) s << " [build ID: " << Version::dfhack_build_id() << "]"; diff --git a/library/DFHackVersion.cpp b/library/DFHackVersion.cpp index 7746ebece..42aac251e 100644 --- a/library/DFHackVersion.cpp +++ b/library/DFHackVersion.cpp @@ -1,6 +1,8 @@ #define NO_DFHACK_VERSION_MACROS #include "DFHackVersion.h" #include "git-describe.h" +#include + namespace DFHack { namespace Version { int dfhack_abi_version() @@ -27,9 +29,10 @@ namespace DFHack { { return DFHACK_GIT_DESCRIPTION; } - const char *git_commit() + const char* git_commit(bool short_hash) { - return DFHACK_GIT_COMMIT; + static std::string shorty(DFHACK_GIT_COMMIT, 0, 7); + return short_hash ? shorty.c_str() : DFHACK_GIT_COMMIT; } const char *git_xml_commit() { diff --git a/library/include/DFHackVersion.h b/library/include/DFHackVersion.h index 1b69dfe55..fbf2539bf 100644 --- a/library/include/DFHackVersion.h +++ b/library/include/DFHackVersion.h @@ -8,7 +8,7 @@ namespace DFHack { int dfhack_abi_version(); const char *git_description(); - const char *git_commit(); + const char* git_commit(bool short_hash = false); const char *git_xml_commit(); const char *git_xml_expected_commit(); bool git_xml_match(); diff --git a/plugins/lua/overlay.lua b/plugins/lua/overlay.lua index 75dc301ad..6a568fb85 100644 --- a/plugins/lua/overlay.lua +++ b/plugins/lua/overlay.lua @@ -571,13 +571,13 @@ TitleVersionOverlay.ATTRS{ default_pos={x=50, y=-2}, default_enabled=true, viewscreens='title', - frame={w=30, h=3}, + frame={w=35, h=3}, } function TitleVersionOverlay:init() local text = {} table.insert(text, 'DFHack ' .. dfhack.getDFHackVersion() .. - (dfhack.isPrerelease() and (' (%s)'):format(dfhack.getGitCommit():sub(1,7)) or '')) + (dfhack.isPrerelease() and (' (git: %s)'):format(dfhack.getGitCommit(true)) or '')) if #dfhack.getDFHackBuildID() > 0 then table.insert(text, NEWLINE) table.insert(text, 'Build ID: ' .. dfhack.getDFHackBuildID()) From 276efc981302646e2cee7b3d5c63dba245cdeeef Mon Sep 17 00:00:00 2001 From: Myk Date: Sun, 23 Apr 2023 18:40:24 -0700 Subject: [PATCH 60/80] Apply suggestions from code review --- docs/changelog.txt | 2 +- docs/dev/Lua API.rst | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index c6e4386b8..e05227e0d 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -49,7 +49,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## API ## Lua -- ``widgets``: "Slider" class has been moved from ``filterselection.lua`` into ``widgets.lua`` and renamed to "RangeSlider" +- ``widgets.RangeSlider``: new mouse-controlled two-headed slider widget ## Removed diff --git a/docs/dev/Lua API.rst b/docs/dev/Lua API.rst index 02484c745..078cec828 100644 --- a/docs/dev/Lua API.rst +++ b/docs/dev/Lua API.rst @@ -5133,9 +5133,9 @@ widget does not require direct usage of ``Tab``. RangeSlider class ----------------- -This widget implements a mouse-interactable range-slider. The user can move its two handles to set minimum and maximum values +This widget implements a mouse-interactable range-slider. The player can move its two handles to set minimum and maximum values to define a range, or they can drag the bar itself to move both handles at once. -The handles mirror the state of its two parent ``CycleHotkeyLabels``. +The parent widget owns the range values, and can control them independently (e.g. with ``CycleHotkeyLabels``). If the range values change, the ``RangeSlider`` appearance will adjust automatically. :num_stops: Used to specify the number of "notches" in the range slider, the places where handles can stop. (this should match the parents' number of options) From 74e1aa70d9aea0bea57573b95797a659d236c1b1 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sun, 23 Apr 2023 23:28:50 -0700 Subject: [PATCH 61/80] fix smoothing job detection --- docs/changelog.txt | 1 + plugins/dig-now.cpp | 10 +++------- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index 3c1ed7e8f..588c1a6be 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -36,6 +36,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## New Plugins ## Fixes +- `dig-now`: properly detect and complete smoothing designations that have been converted into active jobs ## Misc Improvements - `buildingplan`: planner panel is minimized by default and now remembers minimized state diff --git a/plugins/dig-now.cpp b/plugins/dig-now.cpp index be431722b..b2af2dbca 100644 --- a/plugins/dig-now.cpp +++ b/plugins/dig-now.cpp @@ -113,14 +113,10 @@ public: case job_type::CarveUpDownStaircase: td.bits.dig = tile_dig_designation::UpDownStair; break; - case job_type::DetailWall: - case job_type::DetailFloor: { - df::tiletype tt = map.tiletypeAt(job->pos); - if (tileSpecial(tt) != df::tiletype_special::SMOOTH) { - td.bits.smooth = 1; - } + case job_type::SmoothWall: + case job_type::SmoothFloor: + td.bits.smooth = 1; break; - } case job_type::CarveTrack: to.bits.carve_track_north = (job->item_category.whole >> 18) & 1; to.bits.carve_track_south = (job->item_category.whole >> 19) & 1; From 31401b2e199d31027be4fd155c4c91dc88805190 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Sun, 23 Apr 2023 23:48:10 -0700 Subject: [PATCH 62/80] fixed size limit calculations for rollers --- docs/changelog.txt | 1 + plugins/lua/buildingplan/planneroverlay.lua | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index 3c1ed7e8f..0080ab9c3 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -36,6 +36,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## New Plugins ## Fixes +- `buildingplan`: fixed size limit calculations for rollers ## Misc Improvements - `buildingplan`: planner panel is minimized by default and now remembers minimized state diff --git a/plugins/lua/buildingplan/planneroverlay.lua b/plugins/lua/buildingplan/planneroverlay.lua index 83a58ebd8..803e9ae99 100644 --- a/plugins/lua/buildingplan/planneroverlay.lua +++ b/plugins/lua/buildingplan/planneroverlay.lua @@ -34,9 +34,10 @@ local function get_selection_size_limits() or btype == df.building_type.RoadPaved or btype == df.building_type.RoadDirt then return {w=31, h=31} - elseif btype == df.building_type.AxleHorizontal - or btype == df.building_type.Rollers then + elseif btype == df.building_type.AxleHorizontal then return uibs.direction == 1 and {w=1, h=31} or {w=31, h=1} + elseif btype == df.building_type.Rollers then + return (uibs.direction == 1 or uibs.direction == 3) and {w=31, h=1} or {w=1, h=31} end end From 5e1117473ae577e009ba4825f81dfcd981105cfd Mon Sep 17 00:00:00 2001 From: DFHack-Urist via GitHub Actions <63161697+DFHack-Urist@users.noreply.github.com> Date: Mon, 24 Apr 2023 07:14:36 +0000 Subject: [PATCH 63/80] Auto-update submodules scripts: master --- scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts b/scripts index 5da969fce..68f6d354b 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit 5da969fce69a5b9330f183cc0629798bf9907b69 +Subproject commit 68f6d354b0d815ad0985dbe9b5faa140c980af14 From ab047af1633ed386edef49c7e329d1d34e6b4a92 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 24 Apr 2023 00:31:20 -0700 Subject: [PATCH 64/80] demote chatty WARN messages to DEBUG --- docs/changelog.txt | 1 + plugins/autoclothing.cpp | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index 3c1ed7e8f..54d002f3e 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -36,6 +36,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## New Plugins ## Fixes +- `autoclothing`: eliminate game lag when there are many inventory items in the fort ## Misc Improvements - `buildingplan`: planner panel is minimized by default and now remembers minimized state diff --git a/plugins/autoclothing.cpp b/plugins/autoclothing.cpp index aa114cb84..d404960b4 100644 --- a/plugins/autoclothing.cpp +++ b/plugins/autoclothing.cpp @@ -565,7 +565,7 @@ static void find_needed_clothing_items() if (!item) { - WARN(cycle).print("autoclothing: Invalid inventory item ID: %d\n", ownedItem); + DEBUG(cycle).print("autoclothing: Invalid inventory item ID: %d\n", ownedItem); continue; } @@ -818,7 +818,7 @@ static void generate_report(color_ostream& out) auto item = Items::findItemByID(itemId); if (!item) { - WARN(cycle,out).print("autoclothing: Invalid inventory item ID: %d\n", itemId); + DEBUG(cycle, out).print("autoclothing: Invalid inventory item ID: %d\n", itemId); continue; } if (item->getWear() >= 1) From 6203894c998aef9f9aa3de7c6b85833719032618 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 24 Apr 2023 08:03:11 -0700 Subject: [PATCH 65/80] add title screen focus string detection --- library/modules/Gui.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/library/modules/Gui.cpp b/library/modules/Gui.cpp index 6ea0a5ff0..44642b5fa 100644 --- a/library/modules/Gui.cpp +++ b/library/modules/Gui.cpp @@ -84,6 +84,7 @@ using namespace DFHack; #include "df/unit.h" #include "df/unit_inventory_item.h" #include "df/viewscreen_dwarfmodest.h" +#include "df/viewscreen_titlest.h" #include "df/world.h" const size_t MAX_REPORTS_SIZE = 3000; // DF clears old reports to maintain this vector size @@ -144,6 +145,17 @@ static std::map getFocusStringsHandle ); \ static void getFocusStrings_##screen_type(std::string &baseFocus, std::vector &focusStrings, VIEWSCREEN(screen_type) *screen) +DEFINE_GET_FOCUS_STRING_HANDLER(title) +{ + if (screen->managing_mods) + focusStrings.push_back(baseFocus + "/Mods"); + else if (game->main_interface.settings.open) + focusStrings.push_back(baseFocus + "/Settings"); + + if (focusStrings.empty()) + focusStrings.push_back(baseFocus + "/Default"); +} + DEFINE_GET_FOCUS_STRING_HANDLER(dwarfmode) { std::string newFocusString; From 65da8ef3c97e9c7b819c0cabf77292c69249dcfc Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 24 Apr 2023 08:03:31 -0700 Subject: [PATCH 66/80] only display dfhack logo on base title screen to avoid overlapping important widgets on subscreens --- plugins/lua/hotkeys.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/lua/hotkeys.lua b/plugins/lua/hotkeys.lua index b162f0c08..fca0f1f27 100644 --- a/plugins/lua/hotkeys.lua +++ b/plugins/lua/hotkeys.lua @@ -39,7 +39,7 @@ HotspotMenuWidget.ATTRS{ -- 'new_region', -- conflicts with vanilla panel layouts 'savegame', 'setupdwarfgame', - 'title', + 'title/Default', 'update_region', 'world' }, From 2686c8f08441088cb6d008c4728c66533e4a2f51 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 24 Apr 2023 08:04:08 -0700 Subject: [PATCH 67/80] move DFHack version next to logo and only display on the base title screen --- plugins/lua/overlay.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/lua/overlay.lua b/plugins/lua/overlay.lua index 6a568fb85..81dde32b6 100644 --- a/plugins/lua/overlay.lua +++ b/plugins/lua/overlay.lua @@ -570,7 +570,7 @@ TitleVersionOverlay = defclass(TitleVersionOverlay, OverlayWidget) TitleVersionOverlay.ATTRS{ default_pos={x=50, y=-2}, default_enabled=true, - viewscreens='title', + viewscreens='title/Default', frame={w=35, h=3}, } @@ -589,7 +589,7 @@ function TitleVersionOverlay:init() self:addviews{ widgets.Label{ - frame={b=0, l=0}, + frame={t=0, l=0}, text=text, text_pen=COLOR_WHITE, }, From 300e891f8aa8d97fcef4493cc3ac9a0d7bfd7a0c Mon Sep 17 00:00:00 2001 From: Myk Date: Mon, 24 Apr 2023 14:15:09 -0700 Subject: [PATCH 68/80] Update changelog.txt --- docs/changelog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index 4429e40be..49723ab27 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -37,7 +37,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## Fixes - `buildingplan`: fixed size limit calculations for rollers -`- `dig-now`: properly detect and complete smoothing designations that have been converted into active jobs +- `dig-now`: properly detect and complete smoothing designations that have been converted into active jobs ## Misc Improvements - `buildingplan`: planner panel is minimized by default and now remembers minimized state From 4ecf125a1aa2eb1c4efe513ba1cca5bbe37278d7 Mon Sep 17 00:00:00 2001 From: DFHack-Urist via GitHub Actions <63161697+DFHack-Urist@users.noreply.github.com> Date: Mon, 24 Apr 2023 21:19:02 +0000 Subject: [PATCH 69/80] Auto-update submodules scripts: master --- scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts b/scripts index 68f6d354b..6b4001dc2 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit 68f6d354b0d815ad0985dbe9b5faa140c980af14 +Subproject commit 6b4001dc2f9d0e662bb7d06d8ba6fcf343a656aa From 5a4dec35f1a28ad9838a951d3049924622c81166 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 24 Apr 2023 14:28:21 -0700 Subject: [PATCH 70/80] reorder template declarations so we can push vectors of maps --- library/include/LuaTools.h | 40 +++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/library/include/LuaTools.h b/library/include/LuaTools.h index b19fc31de..cab3ee9cc 100644 --- a/library/include/LuaTools.h +++ b/library/include/LuaTools.h @@ -342,26 +342,6 @@ namespace DFHack {namespace Lua { DFHACK_EXPORT void PushInterfaceKeys(lua_State *L, const std::set &keys); - template - void PushVector(lua_State *state, const T &pvec, bool addn = false) - { - lua_createtable(state,pvec.size(), addn?1:0); - - if (addn) - { - lua_pushinteger(state, pvec.size()); - lua_setfield(state, -2, "n"); - } - - for (size_t i = 0; i < pvec.size(); i++) - { - Push(state, pvec[i]); - lua_rawseti(state, -2, i+1); - } - } - - DFHACK_EXPORT void GetVector(lua_State *state, std::vector &pvec, int idx = 1); - DFHACK_EXPORT int PushPosXYZ(lua_State *state, const df::coord &pos); DFHACK_EXPORT int PushPosXY(lua_State *state, const df::coord2d &pos); @@ -412,6 +392,26 @@ namespace DFHack {namespace Lua { lua_settable(state, -3); } + template + void PushVector(lua_State *state, const T &pvec, bool addn = false) + { + lua_createtable(state,pvec.size(), addn?1:0); + + if (addn) + { + lua_pushinteger(state, pvec.size()); + lua_setfield(state, -2, "n"); + } + + for (size_t i = 0; i < pvec.size(); i++) + { + Push(state, pvec[i]); + lua_rawseti(state, -2, i+1); + } + } + + DFHACK_EXPORT void GetVector(lua_State *state, std::vector &pvec, int idx = 1); + DFHACK_EXPORT void CheckPen(lua_State *L, Screen::Pen *pen, int index, bool allow_nil = false, bool allow_color = true); DFHACK_EXPORT bool IsCoreContext(lua_State *state); From 73b5e37f678719c7f4473ebfa5263e8c743484d9 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 24 Apr 2023 14:28:47 -0700 Subject: [PATCH 71/80] simplify loops with foreach syntax --- library/modules/Buildings.cpp | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/library/modules/Buildings.cpp b/library/modules/Buildings.cpp index 7694a696b..b9e61c863 100644 --- a/library/modules/Buildings.cpp +++ b/library/modules/Buildings.cpp @@ -1115,31 +1115,17 @@ static void createDesign(df::building *bld, bool rough) static int getMaxStockpileId() { - auto &vec = world->buildings.other[buildings_other_id::STOCKPILE]; int max_id = 0; - - for (size_t i = 0; i < vec.size(); i++) - { - auto bld = strict_virtual_cast(vec[i]); - if (bld) - max_id = std::max(max_id, bld->stockpile_number); - } - + for (auto bld : world->buildings.other.STOCKPILE) + max_id = std::max(max_id, bld->stockpile_number); return max_id; } static int getMaxCivzoneId() { - auto &vec = world->buildings.other[buildings_other_id::ANY_ZONE]; int max_id = 0; - - for (size_t i = 0; i < vec.size(); i++) - { - auto bld = strict_virtual_cast(vec[i]); - if (bld) - max_id = std::max(max_id, bld->zone_num); - } - + for (auto bld : world->buildings.other.ANY_ZONE) + max_id = std::max(max_id, bld->zone_num); return max_id; } From 65d7b290a3f7a859d2a75fa44e4c3109684f63b1 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 24 Apr 2023 14:32:33 -0700 Subject: [PATCH 72/80] add ZScreenModal class for modal dialogs --- docs/changelog.txt | 1 + docs/dev/Lua API.rst | 7 +++++++ library/lua/gui.lua | 13 +++++++++++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index a3e9c6f6c..2b3438cc5 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -55,6 +55,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## Lua - ``widgets.RangeSlider``: new mouse-controlled two-headed slider widget +- ``gui.ZScreenModal``: ZScreen subclass for modal dialogs ## Removed - `title-version`: replaced by an `overlay` widget diff --git a/docs/dev/Lua API.rst b/docs/dev/Lua API.rst index 078cec828..9c320fc98 100644 --- a/docs/dev/Lua API.rst +++ b/docs/dev/Lua API.rst @@ -4323,6 +4323,13 @@ Here is an example skeleton for a ZScreen tool window:: view = view and view:raise() or MyScreen{}:show() +ZScreenModal class +------------------ + +A ZScreen convenience subclass that sets the attributes to something +appropriate for modal dialogs. The game is force paused, and no input is passed +through to the underlying viewscreens. + FramedScreen class ------------------ diff --git a/library/lua/gui.lua b/library/lua/gui.lua index e425dbcf1..b2c90d076 100644 --- a/library/lua/gui.lua +++ b/library/lua/gui.lua @@ -867,8 +867,17 @@ function ZScreen:onGetSelectedPlant() return zscreen_get_any(self, 'Plant') end --------------------------- --- Framed screen object -- +-- convenience subclass for modal dialogs +ZScreenModal = defclass(ZScreenModal, ZScreen) +ZScreenModal.ATTRS{ + defocusable = false, + force_pause = true, + pass_pause = false, + pass_movement_keys = false, + pass_mouse_clicks = false, +} + +-- Framed screen object -------------------------- -- Plain grey-colored frame. From 54ea391b1daf7059eef570add6e327a2eebaa3b0 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 24 Apr 2023 15:26:33 -0700 Subject: [PATCH 73/80] bump to 50.07-r2rc3 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index caf597088..72314ee6a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -192,7 +192,7 @@ endif() # set up versioning. set(DF_VERSION "50.07") -set(DFHACK_RELEASE "r2rc2") +set(DFHACK_RELEASE "r2rc3") set(DFHACK_PRERELEASE TRUE) set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}") From 6c88fa6440b9282595fb2dddf7e6c5ba5bf07336 Mon Sep 17 00:00:00 2001 From: Myk Taylor Date: Mon, 24 Apr 2023 16:12:37 -0700 Subject: [PATCH 74/80] don't output git hash on release builds --- plugins/lua/overlay.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/lua/overlay.lua b/plugins/lua/overlay.lua index 81dde32b6..cf7008a40 100644 --- a/plugins/lua/overlay.lua +++ b/plugins/lua/overlay.lua @@ -577,7 +577,7 @@ TitleVersionOverlay.ATTRS{ function TitleVersionOverlay:init() local text = {} table.insert(text, 'DFHack ' .. dfhack.getDFHackVersion() .. - (dfhack.isPrerelease() and (' (git: %s)'):format(dfhack.getGitCommit(true)) or '')) + (dfhack.isRelease() and '' or (' (git: %s)'):format(dfhack.getGitCommit(true)))) if #dfhack.getDFHackBuildID() > 0 then table.insert(text, NEWLINE) table.insert(text, 'Build ID: ' .. dfhack.getDFHackBuildID()) From 4d3a4adf572dd49aab402a72bcd8bd368b0612f4 Mon Sep 17 00:00:00 2001 From: DFHack-Urist via GitHub Actions <63161697+DFHack-Urist@users.noreply.github.com> Date: Tue, 25 Apr 2023 07:13:39 +0000 Subject: [PATCH 75/80] Auto-update submodules scripts: master --- scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts b/scripts index 6b4001dc2..ad1998a00 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit 6b4001dc2f9d0e662bb7d06d8ba6fcf343a656aa +Subproject commit ad1998a0032ce50e90d05429a4178b668c0840ba From 68a8c687eabbecbf4c39b8045340ee5f76dfdf05 Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Tue, 25 Apr 2023 16:02:15 -0500 Subject: [PATCH 76/80] steam build workflow improvements improve cmake handling for downloading the sdk set up GHA to cache the SDK download --- .github/workflows/steam.yml | 6 ++++++ package/windows/CMakeLists.txt | 21 +++++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.github/workflows/steam.yml b/.github/workflows/steam.yml index 71e56b662..05692c680 100644 --- a/.github/workflows/steam.yml +++ b/.github/workflows/steam.yml @@ -36,6 +36,12 @@ jobs: restore-keys: | ccache-win64-cross-msvc-develop-${{ github.event.inputs.commit_hash }} ccache-win64-cross-msvc + - name: Restore steam SDK + uses: action/cache@v3 + with: + path: depends/steam/steamworks_sdk_156.zip + key: steam-sdk-156 + enableCrossOsArchive: true - name: Cross-compile win64 artifacts env: CMAKE_EXTRA_ARGS: '-DBUILD_STONESENSE:BOOL=1 -DBUILD_DFLAUNCH:BOOL=1' diff --git a/package/windows/CMakeLists.txt b/package/windows/CMakeLists.txt index b74cdfec5..d92d687c4 100644 --- a/package/windows/CMakeLists.txt +++ b/package/windows/CMakeLists.txt @@ -9,13 +9,22 @@ if(WIN32) ${STEAMAPI_DIR}/steamworks_sdk_156.zip EXPECTED_HASH MD5=af5a579990dbe5ae4c1b0689260d001b USERPWD $ENV{steam_username}:$ENV{steam_password} + STATUS STEAM_SDK_DOWNLOAD_STATUS + SHOW_PROGRESS ) - file(ARCHIVE_EXTRACT - INPUT ${STEAMAPI_DIR}/steamworks_sdk_156.zip - DESTINATION ${STEAMAPI_DIR}) - set(STEAMAPI_LIBRARY "${STEAMAPI_DIR}/sdk/redistributable_bin/win64/steam_api64.lib") - set(STEAMAPI_SOURCE_DIR "${STEAMAPI_DIR}/sdk/public/steam") - set(STEAMAPI_SHARED_LIBRARY "${STEAMAPI_DIR}/sdk/redistributable_bin/win64/steam_api64.dll") + list(GET STEAM_SDK_DOWNLOAD_STATUS 0 STEAM_SDK_DL_STATUS_CODE) + list(GET STEAM_SDK_DOWNLOAD_STATUS 1 STEAM_SDK_DL_ERROR_MESSAGE) + if (NOT (${STEAM_SDK_DL_STATUS_CODE} EQUAL 0)) + message(FATAL_ERROR "Steam SDK download: " ${STEAM_SDK_DL_ERROR_MESSAGE}) + else () + message(STATUS "Steam SDK download: " ${STEAM_SDK_DL_ERROR_MESSAGE}) + file(ARCHIVE_EXTRACT + INPUT ${STEAMAPI_DIR}/steamworks_sdk_156.zip + DESTINATION ${STEAMAPI_DIR}) + set(STEAMAPI_LIBRARY "${STEAMAPI_DIR}/sdk/redistributable_bin/win64/steam_api64.lib") + set(STEAMAPI_SOURCE_DIR "${STEAMAPI_DIR}/sdk/public/steam") + set(STEAMAPI_SHARED_LIBRARY "${STEAMAPI_DIR}/sdk/redistributable_bin/win64/steam_api64.dll") + endif() else() message(SEND_ERROR "Need to set steam_username and steam_password in environment to download Steamworks SDK") endif() From 17a798d5bc9f0b3d64930663e992275bdddf7d4a Mon Sep 17 00:00:00 2001 From: Kelly Kinkade Date: Tue, 25 Apr 2023 16:06:36 -0500 Subject: [PATCH 77/80] add missing letter --- .github/workflows/steam.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/steam.yml b/.github/workflows/steam.yml index 05692c680..ca6802446 100644 --- a/.github/workflows/steam.yml +++ b/.github/workflows/steam.yml @@ -37,7 +37,7 @@ jobs: ccache-win64-cross-msvc-develop-${{ github.event.inputs.commit_hash }} ccache-win64-cross-msvc - name: Restore steam SDK - uses: action/cache@v3 + uses: actions/cache@v3 with: path: depends/steam/steamworks_sdk_156.zip key: steam-sdk-156 From 48ffad2f7145cfe19613bc8e1dba2a04e4bd565e Mon Sep 17 00:00:00 2001 From: Taxi Service Date: Wed, 26 Apr 2023 01:02:38 +0200 Subject: [PATCH 78/80] added and attributes to --- docs/changelog.txt | 1 + docs/dev/Lua API.rst | 4 ++++ library/lua/gui/widgets.lua | 9 +++++---- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index b85c738a5..80f2797b6 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -57,6 +57,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## Lua - ``widgets.RangeSlider``: new mouse-controlled two-headed slider widget - ``gui.ZScreenModal``: ZScreen subclass for modal dialogs +- ``widgets.CycleHotkeyLabel``: exposed `key_sep` and `val_gap` attributes for improved stylistic control. ## Removed - `title-version`: replaced by an `overlay` widget diff --git a/docs/dev/Lua API.rst b/docs/dev/Lua API.rst index 9c320fc98..73538a5a3 100644 --- a/docs/dev/Lua API.rst +++ b/docs/dev/Lua API.rst @@ -4912,12 +4912,16 @@ It has the following attributes: :key: The hotkey keycode to display, e.g. ``'CUSTOM_A'``. :key_back: Similar to ``key``, but will cycle backwards (optional) +:key_sep: If specified, will be used to customize how the activation key is + displayed. See ``token.key_sep`` in the ``Label`` documentation. :label: The string (or a function that returns a string) to display after the hotkey. :label_width: The number of spaces to allocate to the ``label`` (for use in aligning a column of ``CycleHotkeyLabel`` labels). :label_below: If ``true``, then the option value will apear below the label instead of to the right of it. Defaults to ``false``. +:val_gap: The size of the gap between the label text and the option value. + Default is ``1``. If set to ``0``, there'll be no gap between the strings. :options: A list of strings or tables of ``{label=string or fn, value=val[, pen=pen]}``. String options use the same string for the label and value and use the default pen. The optional ``pen`` diff --git a/library/lua/gui/widgets.lua b/library/lua/gui/widgets.lua index a778df639..c7cde698c 100644 --- a/library/lua/gui/widgets.lua +++ b/library/lua/gui/widgets.lua @@ -1488,6 +1488,8 @@ CycleHotkeyLabel = defclass(CycleHotkeyLabel, Label) CycleHotkeyLabel.ATTRS{ key=DEFAULT_NIL, key_back=DEFAULT_NIL, + key_sep=': ', + val_gap=1, label=DEFAULT_NIL, label_width=DEFAULT_NIL, label_below=false, @@ -1499,17 +1501,16 @@ CycleHotkeyLabel.ATTRS{ function CycleHotkeyLabel:init() self:setOption(self.initial_option) - local val_gap = 1 if self.label_below then - val_gap = 0 + (self.key_back and 1 or 0) + (self.key and 3 or 0) + self.val_gap = 0 + (self.key_back and 1 or 0) + (self.key and 3 or 0) end self:setText{ self.key_back ~= nil and {key=self.key_back, key_sep='', width=0, on_activate=self:callback('cycle', true)} or {}, - {key=self.key, key_sep=': ', text=self.label, width=self.label_width, + {key=self.key, key_sep=self.key_sep, text=self.label, width=self.label_width, on_activate=self:callback('cycle')}, self.label_below and NEWLINE or '', - {gap=val_gap, text=self:callback('getOptionLabel'), + {gap=self.val_gap, text=self:callback('getOptionLabel'), pen=self:callback('getOptionPen')}, } end From 6e1300458cf4440d3c510fb7007d0925099a9e42 Mon Sep 17 00:00:00 2001 From: Taxi Service Date: Wed, 26 Apr 2023 01:26:38 +0200 Subject: [PATCH 79/80] fixed some wrong quotation marks in changelog.txt that made the build thingy cry --- docs/changelog.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index 80f2797b6..91f25a323 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -57,7 +57,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## Lua - ``widgets.RangeSlider``: new mouse-controlled two-headed slider widget - ``gui.ZScreenModal``: ZScreen subclass for modal dialogs -- ``widgets.CycleHotkeyLabel``: exposed `key_sep` and `val_gap` attributes for improved stylistic control. +- ``widgets.CycleHotkeyLabel``: exposed "key_sep" and "val_gap" attributes for improved stylistic control. ## Removed - `title-version`: replaced by an `overlay` widget From ec659ca1c26bed0ee768421e29d49e3b4038b781 Mon Sep 17 00:00:00 2001 From: Taxi Service Date: Wed, 26 Apr 2023 11:26:29 +0200 Subject: [PATCH 80/80] added note about val_gap's behaviour when label_below == true --- docs/dev/Lua API.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/dev/Lua API.rst b/docs/dev/Lua API.rst index 73538a5a3..37d85f7f6 100644 --- a/docs/dev/Lua API.rst +++ b/docs/dev/Lua API.rst @@ -4922,6 +4922,7 @@ It has the following attributes: instead of to the right of it. Defaults to ``false``. :val_gap: The size of the gap between the label text and the option value. Default is ``1``. If set to ``0``, there'll be no gap between the strings. + Note that ``val_gap`` is ignored if ``label_below`` is set to ``true``. :options: A list of strings or tables of ``{label=string or fn, value=val[, pen=pen]}``. String options use the same string for the label and value and use the default pen. The optional ``pen``