From 63a26b987de676d2cdf81974ac9a393abcfbcf8e Mon Sep 17 00:00:00 2001 From: PatrikLundell Date: Wed, 1 Apr 2020 11:16:24 +0200 Subject: [PATCH 01/35] Fix issue #1528 --- library/modules/Translation.cpp | 26 +++++++++++--------------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/library/modules/Translation.cpp b/library/modules/Translation.cpp index d836e6122..e05154b44 100644 --- a/library/modules/Translation.cpp +++ b/library/modules/Translation.cpp @@ -180,14 +180,11 @@ string Translation::TranslateName(const df::language_name * name, bool inEnglish word.append(*world->raws.language.translations[name->language]->words[name->words[1]]); addNameWord(out, word); } - if (name->words[5] >= 0) - { - word.clear(); - for (int i = 2; i <= 5; i++) - if (name->words[i] >= 0) - word.append(*world->raws.language.translations[name->language]->words[name->words[i]]); - addNameWord(out, word); - } + word.clear(); + for (int i = 2; i <= 5; i++) + if (name->words[i] >= 0) + word.append(*world->raws.language.translations[name->language]->words[name->words[i]]); + addNameWord(out, word); if (name->words[6] >= 0) { word.clear(); @@ -206,18 +203,17 @@ string Translation::TranslateName(const df::language_name * name, bool inEnglish word.append(world->raws.language.words[name->words[1]]->forms[name->parts_of_speech[1]]); addNameWord(out, word); } - if (name->words[5] >= 0) + if (name->words[2] >= 0 || name->words[3] >= 0 || name->words[4] >= 0 || name->words[5] >= 0) { if (out.length() > 0) out.append(" the"); else out.append("The"); - - for (int i = 2; i <= 5; i++) - { - if (name->words[i] >= 0) - addNameWord(out, world->raws.language.words[name->words[i]]->forms[name->parts_of_speech[i]]); - } + } + for (int i = 2; i <= 5; i++) + { + if (name->words[i] >= 0) + addNameWord(out, world->raws.language.words[name->words[i]]->forms[name->parts_of_speech[i]]); } if (name->words[6] >= 0) { From c4853bd6e121ac4d0fab9b63991a3513a1de96e6 Mon Sep 17 00:00:00 2001 From: Nilsolm Date: Mon, 6 Apr 2020 19:13:18 +0200 Subject: [PATCH 02/35] Add search to justice screen --- plugins/search.cpp | 82 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/plugins/search.cpp b/plugins/search.cpp index 43e14996a..7e72c2c1c 100644 --- a/plugins/search.cpp +++ b/plugins/search.cpp @@ -25,6 +25,7 @@ #include "df/viewscreen_buildinglistst.h" #include "df/viewscreen_dwarfmodest.h" #include "df/viewscreen_joblistst.h" +#include "df/viewscreen_justicest.h" #include "df/viewscreen_kitchenprefst.h" #include "df/viewscreen_layer_militaryst.h" #include "df/viewscreen_layer_noblelistst.h" @@ -2327,6 +2328,85 @@ IMPLEMENT_HOOKS(df::viewscreen_layer_stone_restrictionst, stone_search); // END: Stone status screen search // +// +// START: Justice screen conviction search +// + +typedef search_generic justice_conviction_search_base; +class justice_conviction_search : public justice_conviction_search_base +{ +public: + bool can_init (df::viewscreen_justicest *screen) + { + return screen->cur_column == df::viewscreen_justicest::ConvictChoices; + } + + string get_element_description (df::unit *unit) const + { + return get_unit_description(unit); + } + + void render() const + { + print_search_option(37); + } + + vector *get_primary_list() + { + return &viewscreen->convict_choices; + } + + virtual int32_t *get_viewscreen_cursor() + { + return &viewscreen->cursor_right; + } +}; + +IMPLEMENT_HOOKS(df::viewscreen_justicest, justice_conviction_search); + +// +// END: Justice screen conviction search +// + +// +// START: Justice screen interrogation search +// + +typedef search_generic justice_interrogation_search_base; +class justice_interrogation_search : public justice_interrogation_search_base +{ +public: + bool can_init (df::viewscreen_justicest *screen) + { + return screen->cur_column == df::viewscreen_justicest::InterrogateChoices; + } + + string get_element_description (df::unit *unit) const + { + return get_unit_description(unit); + } + + void render() const + { + print_search_option(37); + } + + vector *get_primary_list() + { + return &viewscreen->interrogate_choices; + } + + virtual int32_t *get_viewscreen_cursor() + { + return &viewscreen->cursor_right; + } +}; + +IMPLEMENT_HOOKS(df::viewscreen_justicest, justice_interrogation_search); + +// +// END: Justice screen conviction search +// #define SEARCH_HOOKS \ HOOK_ACTION(unitlist_search_hook) \ @@ -2350,6 +2430,8 @@ IMPLEMENT_HOOKS(df::viewscreen_layer_stone_restrictionst, stone_search); HOOK_ACTION(location_assign_occupation_search_hook) \ HOOK_ACTION(kitchen_pref_search_hook) \ HOOK_ACTION(stone_search_hook) \ + HOOK_ACTION(justice_conviction_search_hook) \ + HOOK_ACTION(justice_interrogation_search_hook) \ DFhackCExport command_result plugin_enable ( color_ostream &out, bool enable) From f4dc5e827782f9e20ca62aacc472d706d656de18 Mon Sep 17 00:00:00 2001 From: lethosor Date: Mon, 6 Apr 2020 19:57:20 -0400 Subject: [PATCH 03/35] Add an initial build workflow --- .github/workflows/build.yml | 43 +++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..1b8a6f715 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,43 @@ +name: Build and test + +on: [push, pull_request] + +jobs: + setup: + runs-on: ubuntu-18.04 + steps: + - name: Install dependencies + run: | + sudo apt install \ + libsdl-image1.2-dev \ + libsdl-ttf2.0-dev \ + libsdl1.2-dev \ + libxml-libxml-perl \ + libxml-libxslt-perl \ + lua5.3 \ + ninja-build \ + zlib1g-dev + sudo pip3 install --system sphinx + - name: Clone DFHack + uses: actions/checkout@v1 + - name: Set up environment + run: | + export DF_VERSION=$(sh travis/get-df-version.sh) + export DF_FOLDER="$HOME/DF/$DF_VERSION/df_linux" + - name: Download DF + run: | + sh travis/download-df.sh + - name: Git information + run: | + sh travis/git-info.sh + docs: + needs: [setup] + runs-on: ubuntu-18.04 + steps: + - name: Build docs + run: | + sphinx-build -qW -j3 . docs/html + - uses: actions/upload-artifact@master + with: + name: docs + path: docs/html From 6c9e3909fd62484d1dd75c834f49faa4baa777fd Mon Sep 17 00:00:00 2001 From: lethosor Date: Mon, 6 Apr 2020 20:00:10 -0400 Subject: [PATCH 04/35] Run apt-get update first --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1b8a6f715..1f3a66451 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,8 @@ jobs: steps: - name: Install dependencies run: | - sudo apt install \ + sudo apt-get update + sudo apt-get install \ libsdl-image1.2-dev \ libsdl-ttf2.0-dev \ libsdl1.2-dev \ From 9a2549bad6092bac2c2ee90a60c5f3d2d455196a Mon Sep 17 00:00:00 2001 From: lethosor Date: Thu, 9 Apr 2020 23:56:01 -0400 Subject: [PATCH 05/35] Update xml --- library/xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/xml b/library/xml index b585e182c..e4522edf1 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit b585e182c404a14130d42bf87a60f94aebbfd1fd +Subproject commit e4522edf112824fb0edac874cec0d0f7f9c33c5f From 0b926e2d150a208b8989204f0424e0cb2e2ac2bc Mon Sep 17 00:00:00 2001 From: lethosor Date: Fri, 10 Apr 2020 23:29:00 -0400 Subject: [PATCH 06/35] Update changelog, authors --- docs/Authors.rst | 1 + docs/changelog.txt | 3 +++ 2 files changed, 4 insertions(+) diff --git a/docs/Authors.rst b/docs/Authors.rst index 1bfcf051b..72d61de06 100644 --- a/docs/Authors.rst +++ b/docs/Authors.rst @@ -34,6 +34,7 @@ Clayton Hughes Clément Vuchener cvuchener Dan Amlund danamlund Daniel Brooks db48x +David Nilsolm David Corbett dscorbett David Seguin dseguin David Timm dtimm diff --git a/docs/changelog.txt b/docs/changelog.txt index 34f5c3660..3ca170566 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -42,6 +42,9 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: ## Fixes - `tweak` embark-profile-name: fixed handling of the native shift+space key +## Misc Improvements +- `search`: added support for the fortress mode justice screen + ## Lua - ``pairs()`` now returns available class methods for DF types From d72c3956608aa00afcc1a3115df3b6f664333545 Mon Sep 17 00:00:00 2001 From: lethosor Date: Fri, 10 Apr 2020 23:33:06 -0400 Subject: [PATCH 07/35] Merge into one job --- .github/workflows/build.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1f3a66451..96a623457 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,7 @@ name: Build and test on: [push, pull_request] jobs: - setup: + main: runs-on: ubuntu-18.04 steps: - name: Install dependencies @@ -31,10 +31,6 @@ jobs: - name: Git information run: | sh travis/git-info.sh - docs: - needs: [setup] - runs-on: ubuntu-18.04 - steps: - name: Build docs run: | sphinx-build -qW -j3 . docs/html From 385aa0877d2e1c72319e93160739877b09213c0e Mon Sep 17 00:00:00 2001 From: lethosor Date: Fri, 10 Apr 2020 23:38:32 -0400 Subject: [PATCH 08/35] Checkout submodules too --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 96a623457..10a653932 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,6 +21,8 @@ jobs: sudo pip3 install --system sphinx - name: Clone DFHack uses: actions/checkout@v1 + with: + submodules: true - name: Set up environment run: | export DF_VERSION=$(sh travis/get-df-version.sh) From daad14ee66dd46f19e81d860992fd56c14f4c09b Mon Sep 17 00:00:00 2001 From: lethosor Date: Fri, 10 Apr 2020 23:46:19 -0400 Subject: [PATCH 09/35] Implement linting checks --- .github/workflows/build.yml | 29 +++++++++++++++++++++++++++-- 1 file changed, 27 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 10a653932..4db414bd1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,7 +3,7 @@ name: Build and test on: [push, pull_request] jobs: - main: + build: runs-on: ubuntu-18.04 steps: - name: Install dependencies @@ -36,7 +36,32 @@ jobs: - name: Build docs run: | sphinx-build -qW -j3 . docs/html - - uses: actions/upload-artifact@master + - name: Upload docs + uses: actions/upload-artifact@master with: name: docs path: docs/html + lint: + runs-on: ubuntu-18.04 + steps: + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install \ + lua5.3 \ + ruby + - name: Check whitespace + run: | + python travis/lint.py + - name: Check Authors.rst + run: | + python travis/authors-rst.py + - name: Check for missing documentation + run: | + python travis/script-docs.py + - name: Check Lua syntax + run: | + python travis/script-syntax.py --ext=lua --cmd="luac5.3 -p" + - name: Check Ruby syntax + run: | + python travis/script-syntax.py --ext=rb --cmd="ruby -c" From 9a7c07b42bc32827d21cbc1ed2080eb0d56a4811 Mon Sep 17 00:00:00 2001 From: lethosor Date: Fri, 10 Apr 2020 23:47:47 -0400 Subject: [PATCH 10/35] Clone the repo --- .github/workflows/build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4db414bd1..dad202209 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,6 +50,10 @@ jobs: sudo apt-get install \ lua5.3 \ ruby + - name: Clone DFHack + uses: actions/checkout@v1 + with: + submodules: true - name: Check whitespace run: | python travis/lint.py From 1ebad37c2cb33bf97c6f9ec7c8fec08a64333f48 Mon Sep 17 00:00:00 2001 From: lethosor Date: Fri, 10 Apr 2020 23:53:12 -0400 Subject: [PATCH 11/35] Attempt to fix DF installation --- .github/workflows/build.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dad202209..6594dcb85 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,10 +25,11 @@ jobs: submodules: true - name: Set up environment run: | - export DF_VERSION=$(sh travis/get-df-version.sh) - export DF_FOLDER="$HOME/DF/$DF_VERSION/df_linux" + echo 'export DF_VERSION=$(sh travis/get-df-version.sh)' >> "$HOME/.dfhackrc" + echo 'export DF_FOLDER="$HOME/DF/$DF_VERSION/df_linux"' >> "$HOME/.dfhackrc" - name: Download DF run: | + source "$HOME/.dfhackrc" sh travis/download-df.sh - name: Git information run: | From 0d4572e40a41f3ca152473762c1653c1a93a57e1 Mon Sep 17 00:00:00 2001 From: lethosor Date: Fri, 10 Apr 2020 23:56:28 -0400 Subject: [PATCH 12/35] Build DFHack --- .github/workflows/build.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6594dcb85..5b28ab101 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -42,6 +42,18 @@ jobs: with: name: docs path: docs/html + - name: Build DFHack + run: | + source "$HOME/.dfhackrc" + mkdir build-ci + cd build-ci + cmake .. \ + -G Ninja \ + -DDFHACK_BUILD_ARCH=64 \ + -DBUILD_DOCS:BOOL=ON \ + -DBUILD_TESTS:BOOL=ON \ + -DCMAKE_INSTALL_PREFIX="$DF_FOLDER" + ninja install lint: runs-on: ubuntu-18.04 steps: From d2ba91e2cd3caf61d95896d835a101e0b3d05c99 Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 11 Apr 2020 00:10:28 -0400 Subject: [PATCH 13/35] Run tests --- .github/workflows/build.yml | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5b28ab101..aa179eb91 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,7 +38,7 @@ jobs: run: | sphinx-build -qW -j3 . docs/html - name: Upload docs - uses: actions/upload-artifact@master + uses: actions/upload-artifact@v1 with: name: docs path: docs/html @@ -54,6 +54,20 @@ jobs: -DBUILD_TESTS:BOOL=ON \ -DCMAKE_INSTALL_PREFIX="$DF_FOLDER" ninja install + - name: Run tests + run: | + cd .. + mv "$DF_FOLDER"/dfhack.init-example "$DF_FOLDER"/dfhack.init + python travis/run-tests.py --headless --keep-status "$DF_FOLDER" + python travis/check-rpc.py "$DF_FOLDER/dfhack-rpc.txt" + mkdir -p artifacts + cp "$DF_FOLDER/test_status.json" "$DF_FOLDER"/*.log artifacts + - name: Upload test artifacts + uses: actions/upload-artifact@v1 + if: success() || failure() + with: + name: test-artifacts + path: artifacts lint: runs-on: ubuntu-18.04 steps: From 19f84603cd56dce355020944e49f92e8c737f015 Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 11 Apr 2020 00:18:01 -0400 Subject: [PATCH 14/35] Fix test environment --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index aa179eb91..b5283258f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -56,6 +56,7 @@ jobs: ninja install - name: Run tests run: | + source "$HOME/.dfhackrc" cd .. mv "$DF_FOLDER"/dfhack.init-example "$DF_FOLDER"/dfhack.init python travis/run-tests.py --headless --keep-status "$DF_FOLDER" From 35dbf6cf5f46216e87ef902f9dfeb30c9ecd751c Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 11 Apr 2020 00:31:15 -0400 Subject: [PATCH 15/35] Avoid changing working directory --- .github/workflows/build.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b5283258f..1b4ac36b7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,19 +45,18 @@ jobs: - name: Build DFHack run: | source "$HOME/.dfhackrc" - mkdir build-ci - cd build-ci - cmake .. \ + cmake \ + -S . \ + -B build-ci \ -G Ninja \ -DDFHACK_BUILD_ARCH=64 \ -DBUILD_DOCS:BOOL=ON \ -DBUILD_TESTS:BOOL=ON \ -DCMAKE_INSTALL_PREFIX="$DF_FOLDER" - ninja install + ninja -C build-ci install - name: Run tests run: | source "$HOME/.dfhackrc" - cd .. mv "$DF_FOLDER"/dfhack.init-example "$DF_FOLDER"/dfhack.init python travis/run-tests.py --headless --keep-status "$DF_FOLDER" python travis/check-rpc.py "$DF_FOLDER/dfhack-rpc.txt" From ab81b1f06d9ac86adbccd6c957d439b67f52dee0 Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 11 Apr 2020 00:40:25 -0400 Subject: [PATCH 16/35] Avoid running travis commands when starting DF --- .github/workflows/build.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1b4ac36b7..afa907958 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,11 +25,11 @@ jobs: submodules: true - name: Set up environment run: | - echo 'export DF_VERSION=$(sh travis/get-df-version.sh)' >> "$HOME/.dfhackrc" - echo 'export DF_FOLDER="$HOME/DF/$DF_VERSION/df_linux"' >> "$HOME/.dfhackrc" + echo export DF_VERSION="$(sh travis/get-df-version.sh)" >> "$HOME/.df-env" + echo export DF_FOLDER="$HOME/DF/$DF_VERSION/df_linux" >> "$HOME/.df-env" - name: Download DF run: | - source "$HOME/.dfhackrc" + source "$HOME/.df-env" sh travis/download-df.sh - name: Git information run: | @@ -44,7 +44,7 @@ jobs: path: docs/html - name: Build DFHack run: | - source "$HOME/.dfhackrc" + source "$HOME/.df-env" cmake \ -S . \ -B build-ci \ @@ -56,7 +56,7 @@ jobs: ninja -C build-ci install - name: Run tests run: | - source "$HOME/.dfhackrc" + source "$HOME/.df-env" mv "$DF_FOLDER"/dfhack.init-example "$DF_FOLDER"/dfhack.init python travis/run-tests.py --headless --keep-status "$DF_FOLDER" python travis/check-rpc.py "$DF_FOLDER/dfhack-rpc.txt" From 023575071a165d7541d2956287421bafbbd1c351 Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 11 Apr 2020 00:49:16 -0400 Subject: [PATCH 17/35] Run tests with TERM=dumb --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index afa907958..2d158dc7c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -57,6 +57,7 @@ jobs: - name: Run tests run: | source "$HOME/.df-env" + export TERM=dumb mv "$DF_FOLDER"/dfhack.init-example "$DF_FOLDER"/dfhack.init python travis/run-tests.py --headless --keep-status "$DF_FOLDER" python travis/check-rpc.py "$DF_FOLDER/dfhack-rpc.txt" From 8b7989e93f69021f7d4b37aefb6b6c907e87995b Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 11 Apr 2020 01:17:43 -0400 Subject: [PATCH 18/35] Try with TERM=xterm to get test output logged to console It's currently going to stderr.log only --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2d158dc7c..0c5c857f5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -57,7 +57,7 @@ jobs: - name: Run tests run: | source "$HOME/.df-env" - export TERM=dumb + export TERM=xterm mv "$DF_FOLDER"/dfhack.init-example "$DF_FOLDER"/dfhack.init python travis/run-tests.py --headless --keep-status "$DF_FOLDER" python travis/check-rpc.py "$DF_FOLDER/dfhack-rpc.txt" From 9e9e71cad7f43a224c069adf2cd327e48fa3f175 Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 11 Apr 2020 01:31:41 -0400 Subject: [PATCH 19/35] Fix spacing in error message --- conf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf.py b/conf.py index bfd69d828..2f47d5644 100644 --- a/conf.py +++ b/conf.py @@ -174,7 +174,7 @@ def all_keybinds_documented(): plugin_binds = set(re.findall(':dfhack-keybind:`(.*?)`', f.read())) undocumented_binds = configured_binds - script_commands - plugin_binds if undocumented_binds: - raise ValueError('The following DFHack commands have undocumented' + raise ValueError('The following DFHack commands have undocumented ' 'keybindings: {}'.format(sorted(undocumented_binds))) From 148b5495cc589d2a4ddd6c0be67ae7f3dea3ad92 Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 11 Apr 2020 01:32:05 -0400 Subject: [PATCH 20/35] Fall back to dfout_C if set before stderr.log --- library/Console-posix.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/library/Console-posix.cpp b/library/Console-posix.cpp index 6fb1cbff3..76b5a8cb2 100644 --- a/library/Console-posix.cpp +++ b/library/Console-posix.cpp @@ -903,7 +903,10 @@ void Console::add_text(color_value color, const std::string &text) if (inited) d->print_text(color, text); else - fwrite(text.data(), 1, text.size(), stderr); + { + FILE *out = d->dfout_C ? d->dfout_C : stderr; + fwrite(text.data(), 1, text.size(), out); + } } int Console::get_columns(void) From 44be99388e487998661a851ffdd72cb7fd4bb3f0 Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 11 Apr 2020 01:43:06 -0400 Subject: [PATCH 21/35] Revert "Fall back to dfout_C if set before stderr.log" Makes stuff go to stdout.log instead This reverts commit 148b5495cc589d2a4ddd6c0be67ae7f3dea3ad92. --- library/Console-posix.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/library/Console-posix.cpp b/library/Console-posix.cpp index 76b5a8cb2..6fb1cbff3 100644 --- a/library/Console-posix.cpp +++ b/library/Console-posix.cpp @@ -903,10 +903,7 @@ void Console::add_text(color_value color, const std::string &text) if (inited) d->print_text(color, text); else - { - FILE *out = d->dfout_C ? d->dfout_C : stderr; - fwrite(text.data(), 1, text.size(), out); - } + fwrite(text.data(), 1, text.size(), stderr); } int Console::get_columns(void) From cdc82bd7dbfb85f9294adcb62cb55da26b4bb29f Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 11 Apr 2020 01:49:53 -0400 Subject: [PATCH 22/35] Run tests within `script` --- .github/workflows/build.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0c5c857f5..bc8101b8f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -57,9 +57,8 @@ jobs: - name: Run tests run: | source "$HOME/.df-env" - export TERM=xterm mv "$DF_FOLDER"/dfhack.init-example "$DF_FOLDER"/dfhack.init - python travis/run-tests.py --headless --keep-status "$DF_FOLDER" + script -qe -c "python travis/run-tests.py --headless --keep-status \"$DF_FOLDER\"" python travis/check-rpc.py "$DF_FOLDER/dfhack-rpc.txt" mkdir -p artifacts cp "$DF_FOLDER/test_status.json" "$DF_FOLDER"/*.log artifacts From 6bbda95dd4fc3519fd65c773849d4bdada3352f3 Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 11 Apr 2020 01:58:06 -0400 Subject: [PATCH 23/35] Add TERM=dumb back --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bc8101b8f..bb1791a67 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -57,6 +57,7 @@ jobs: - name: Run tests run: | source "$HOME/.df-env" + export TERM=dumb mv "$DF_FOLDER"/dfhack.init-example "$DF_FOLDER"/dfhack.init script -qe -c "python travis/run-tests.py --headless --keep-status \"$DF_FOLDER\"" python travis/check-rpc.py "$DF_FOLDER/dfhack-rpc.txt" From b3db62742c0ca150aa442bda7e81b5a99db35fb0 Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 11 Apr 2020 02:15:57 -0400 Subject: [PATCH 24/35] Rename workflow to match Travis, update badge --- .github/workflows/build.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bb1791a67..deab07958 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: Build and test +name: Build on: [push, pull_request] diff --git a/README.md b/README.md index fd95e1e5e..a0499a333 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # DFHack Readme -[![Build Status](https://travis-ci.org/DFHack/dfhack.svg?branch=develop)](https://travis-ci.org/DFHack/dfhack) +[![Build Status](https://github.com/DFHack/dfhack/workflows/Build/badge.svg)](https://github.com/DFHack/dfhack/actions?query=workflow%3ABuild) [![Documentation Status](https://readthedocs.org/projects/dfhack/badge)](https://dfhack.readthedocs.org) [![License](https://img.shields.io/badge/license-ZLib-blue.svg)](https://en.wikipedia.org/wiki/Zlib_License) From dbdd98829f46f6e9e98196a94dbfed20844bded8 Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 11 Apr 2020 02:22:12 -0400 Subject: [PATCH 25/35] Add check for PR base branch --- .github/workflows/build.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index deab07958..a585b6e80 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -97,3 +97,13 @@ jobs: - name: Check Ruby syntax run: | python travis/script-syntax.py --ext=rb --cmd="ruby -c" + check-pr: + runs-on: ubuntu-latest + steps: + - name: Check that PR is based on develop branch + if: github.event_name == 'pull_request' + env: + BASE_BRANCH: ${{ github.base_ref }} + run: | + echo "PR base branch: $BASE_BRANCH" + test "$BASE_BRANCH" = develop From dc598d501a799e043b6d5c04ab8e075091d58542 Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 11 Apr 2020 02:24:40 -0400 Subject: [PATCH 26/35] Limit entire check-pr job to PRs only --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a585b6e80..f737a1539 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -99,9 +99,9 @@ jobs: python travis/script-syntax.py --ext=rb --cmd="ruby -c" check-pr: runs-on: ubuntu-latest + if: github.event_name == 'pull_request' steps: - name: Check that PR is based on develop branch - if: github.event_name == 'pull_request' env: BASE_BRANCH: ${{ github.base_ref }} run: | From dbff3355ba92d2ba944b5093ec0e781cec9719c8 Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 11 Apr 2020 02:32:07 -0400 Subject: [PATCH 27/35] Remove .travis.yml --- .travis.yml | 64 ----------------------------------------------------- 1 file changed, 64 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index c096552bc..000000000 --- a/.travis.yml +++ /dev/null @@ -1,64 +0,0 @@ -sudo: false -language: cpp -cache: - pip: true - directories: - - $HOME/DF-travis - - $HOME/lua53 -addons: - apt: - packages: &default_packages - - libsdl-image1.2-dev - - libsdl-ttf2.0-dev - - libsdl1.2-dev - - libxml-libxml-perl - - libxml-libxslt-perl - - ninja-build - - zlib1g-dev -matrix: - include: - - env: GCC_VERSION=4.8 - addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - *default_packages - - gcc-4.8 - - g++-4.8 -before_install: -- export DF_VERSION=$(sh travis/get-df-version.sh) -- export DF_FOLDER="$HOME/DF-travis/$DF_VERSION/df_linux" -- pip install --user "sphinx==1.4" "requests[security]" -- sh travis/build-lua.sh -- sh travis/download-df.sh -script: -- export PATH="$PATH:$HOME/lua53/bin" -- git tag tmp-travis-build -- sh travis/git-info.sh -- sphinx-build -qW -j3 . docs/html -- python travis/pr-check-base.py -- python travis/lint.py -- python travis/authors-rst.py -- python travis/script-docs.py -- python travis/script-syntax.py --ext=lua --cmd="luac5.3 -p" -- python travis/script-syntax.py --ext=rb --cmd="ruby -c" -- mkdir build-travis -- cd build-travis -- cmake .. -G Ninja -DCMAKE_C_COMPILER=gcc-$GCC_VERSION -DCMAKE_CXX_COMPILER=g++-$GCC_VERSION -DDFHACK_BUILD_ARCH=64 -DBUILD_DOCS:BOOL=ON -DBUILD_TESTS:BOOL=ON -DCMAKE_INSTALL_PREFIX="$DF_FOLDER" -- ninja -j3 install -- mv "$DF_FOLDER"/dfhack.init-example "$DF_FOLDER"/dfhack.init -- cd .. -- python travis/run-tests.py --headless --keep-status "$DF_FOLDER" -- python travis/check-rpc.py "$DF_FOLDER/dfhack-rpc.txt" -- cat "$DF_FOLDER/test_status.json" -before_cache: -- cat "$DF_FOLDER/stderr.log" -- rm -rf "$DF_FOLDER" -notifications: - email: false - irc: - channels: - - "chat.freenode.net#dfhack" - on_success: change - on_failure: always From ba12e0c6d4446248683f0fa6ae3fc8709898e34d Mon Sep 17 00:00:00 2001 From: lethosor Date: Sat, 11 Apr 2020 02:33:50 -0400 Subject: [PATCH 28/35] Remove obsolete travis scripts --- .github/workflows/build.yml | 3 --- travis/build-lua.sh | 54 ------------------------------------- travis/git-info.sh | 2 -- travis/pr-check-base.py | 18 ------------- 4 files changed, 77 deletions(-) delete mode 100644 travis/build-lua.sh delete mode 100644 travis/git-info.sh delete mode 100644 travis/pr-check-base.py diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f737a1539..17af62cb1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,9 +31,6 @@ jobs: run: | source "$HOME/.df-env" sh travis/download-df.sh - - name: Git information - run: | - sh travis/git-info.sh - name: Build docs run: | sphinx-build -qW -j3 . docs/html diff --git a/travis/build-lua.sh b/travis/build-lua.sh deleted file mode 100644 index e29d7ce87..000000000 --- a/travis/build-lua.sh +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/sh - -set -e - -LUA_ROOT="$HOME/lua53" -LUA_URL="http://www.lua.org/ftp/lua-5.3.3.tar.gz" -LUA_TAR=$(basename "$LUA_URL") -LUA_DIR="$LUA_ROOT/${LUA_TAR%.tar.*}" -LUA_SHA1="a0341bc3d1415b814cc738b2ec01ae56045d64ef" - -echo LUA_ROOT $LUA_ROOT -echo LUA_TAR $LUA_TAR -echo LUA_DIR $LUA_DIR - -sha1() { - python -c 'import hashlib, sys; print(hashlib.sha1(open(sys.argv[1],"rb").read()).hexdigest())' "$1" -} - -download() { - echo "Downloading $LUA_URL" - wget -O "$LUA_ROOT/$LUA_TAR" "$LUA_URL" - tar xvf "$LUA_ROOT/$LUA_TAR" -} - -build() { - cd "$LUA_DIR/src" - make generic -} - -main() { - mkdir -p "$LUA_ROOT" - cd "$LUA_ROOT" - mkdir -p bin - - if [ "$(sha1 "$LUA_ROOT/$LUA_TAR" 2>/dev/null)" != "$LUA_SHA1" ]; then - download - build - else - echo "Already downloaded" - - if [ -x "$LUA_DIR/src/luac" ]; then - echo "Already built" - else - build - fi - fi - - echo "Linking" - ln -sf "$LUA_DIR/src/lua" "$LUA_ROOT/bin/lua5.3" - ln -sf "$LUA_DIR/src/luac" "$LUA_ROOT/bin/luac5.3" - echo "Done" -} - -main diff --git a/travis/git-info.sh b/travis/git-info.sh deleted file mode 100644 index 333d13bc1..000000000 --- a/travis/git-info.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -git log --pretty="commit %h (parents: %p): %s" -1 diff --git a/travis/pr-check-base.py b/travis/pr-check-base.py deleted file mode 100644 index 47605b051..000000000 --- a/travis/pr-check-base.py +++ /dev/null @@ -1,18 +0,0 @@ -import os, sys -repo = os.environ.get('TRAVIS_REPO_SLUG', 'dfhack/dfhack').lower() -branch = os.environ.get('TRAVIS_BRANCH', 'master') -try: - pr_id = int(os.environ.get('TRAVIS_PULL_REQUEST', 'false')) -except ValueError: - print('Not a pull request') - sys.exit(0) -print('Pull request %s#%i' % (repo, pr_id)) -if repo != 'dfhack/dfhack': - print('Not in dfhack/dfhack') - sys.exit(0) -if branch != 'develop': - print('Not based on develop branch') - sys.exit(1) -else: - print('Ok') - sys.exit(0) From 2b44e52cab541ec3b7a902cdb52277af6a750ccf Mon Sep 17 00:00:00 2001 From: Nilsolm Date: Sat, 11 Apr 2020 16:47:29 +0200 Subject: [PATCH 29/35] Add intrigue skill to manipulator --- plugins/manipulator.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/manipulator.cpp b/plugins/manipulator.cpp index 33d5ff884..e9206dc0f 100644 --- a/plugins/manipulator.cpp +++ b/plugins/manipulator.cpp @@ -242,6 +242,7 @@ const SkillColumn columns[] = { {16, 3, profession::NONE, unit_labor::NONE, job_skill::FLATTERY, "Fl"}, {16, 3, profession::NONE, unit_labor::NONE, job_skill::CONSOLE, "Cs"}, {16, 3, profession::NONE, unit_labor::NONE, job_skill::PACIFY, "Pc"}, + {16, 3, profession::NONE, unit_labor::NONE, job_skill::INTRIGUE, "Sc"}, // Noble {17, 5, profession::TRADER, unit_labor::NONE, job_skill::APPRAISAL, "Ap"}, {17, 5, profession::ADMINISTRATOR, unit_labor::NONE, job_skill::ORGANIZATION, "Or"}, From d734c83a280400c0c9ca7c51edc21c7e6cc20826 Mon Sep 17 00:00:00 2001 From: Nilsolm Date: Sat, 11 Apr 2020 17:26:09 +0200 Subject: [PATCH 30/35] also update the changelog --- docs/changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog.txt b/docs/changelog.txt index 3ca170566..d2404c951 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -43,6 +43,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences: - `tweak` embark-profile-name: fixed handling of the native shift+space key ## Misc Improvements +- `manipulator`: added intrigue to displayed skills - `search`: added support for the fortress mode justice screen ## Lua From 67c1321a0695b86b010c42ba10d650712228ceef Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Sat, 11 Apr 2020 13:03:38 -0500 Subject: [PATCH 31/35] update structures --- library/xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/xml b/library/xml index e4522edf1..f185d0b22 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit e4522edf112824fb0edac874cec0d0f7f9c33c5f +Subproject commit f185d0b22acb1daf36b3a017f7a30b48994ee42c From 362e49c0bc9c0c5cde28e1e9ff3a0ae427e27dd8 Mon Sep 17 00:00:00 2001 From: Nilsolm Date: Sun, 12 Apr 2020 11:02:26 +0200 Subject: [PATCH 32/35] autogems: check bin content in linked stockpiles --- plugins/autogems.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/plugins/autogems.cpp b/plugins/autogems.cpp index 4121b562f..f22d20d30 100644 --- a/plugins/autogems.cpp +++ b/plugins/autogems.cpp @@ -167,6 +167,16 @@ void create_jobs() { stockpiled.insert(item->id); piled[item->getMaterialIndex()] += 1; } + else if (item->flags.bits.container) { + std::vector binneditems; + Items::getContainedItems(item, &binneditems); + for (df::item *it : binneditems) { + if (valid_gem(it)) { + stockpiled.insert(it->id); + piled[it->getMaterialIndex()] += 1; + } + } + } } // Decrement current jobs from all linked workshops, not just this one. From f7630a52707b9d8e5e4d0ae82ed98244c71a7b8b Mon Sep 17 00:00:00 2001 From: Nilsolm Date: Sun, 12 Apr 2020 11:03:28 +0200 Subject: [PATCH 33/35] update changelog --- docs/changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog.txt b/docs/changelog.txt index d2404c951..ba75f09fb 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: # Future ## Fixes +- `autogems`: fixed an issue with binned gems being ignored in linked stockpiles - `tweak` embark-profile-name: fixed handling of the native shift+space key ## Misc Improvements From c97adb91735becad845d8af630e62c19c8e94d03 Mon Sep 17 00:00:00 2001 From: lethosor Date: Wed, 15 Apr 2020 01:09:16 -0400 Subject: [PATCH 34/35] Update changelog (#1528, #1530) --- docs/changelog.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/changelog.txt b/docs/changelog.txt index ba75f09fb..11734d9f7 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: # Future ## Fixes +- Fixed translation of certain types of in-game names - `autogems`: fixed an issue with binned gems being ignored in linked stockpiles - `tweak` embark-profile-name: fixed handling of the native shift+space key From 79387647d39a326fa3c82e620e7c435b4f7c2002 Mon Sep 17 00:00:00 2001 From: lethosor Date: Wed, 15 Apr 2020 01:09:29 -0400 Subject: [PATCH 35/35] Update scripts --- scripts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts b/scripts index 8618cd0b0..b3ce8fa65 160000 --- a/scripts +++ b/scripts @@ -1 +1 @@ -Subproject commit 8618cd0b0a17935fe07f329b249726cda61f5bdf +Subproject commit b3ce8fa650f86c7a1dbd5329d72c3d73dd76d05d