Skip to content

Commit 5fc36c4

Browse files
authored
Merge branch 'develop' into fix-follow-overlay
2 parents 9560cef + 579c063 commit 5fc36c4

File tree

14 files changed

+117
-13
lines changed

14 files changed

+117
-13
lines changed

.github/workflows/build-windows.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ jobs:
7171
- name: Install build dependencies
7272
run: |
7373
choco install sccache
74+
pip install Jinja2
7475
- name: Install doc dependencies
7576
if: inputs.docs
7677
run: |

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ repos:
2020
args: ['--fix=lf']
2121
- id: trailing-whitespace
2222
- repo: https://github.com/python-jsonschema/check-jsonschema
23-
rev: 0.35.0
23+
rev: 0.36.0
2424
hooks:
2525
- id: check-github-workflows
2626
- repo: https://github.com/Lucas-C/pre-commit-hooks

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ cmake_policy(SET CMP0048 NEW)
66
cmake_policy(SET CMP0074 NEW)
77

88
# set up versioning.
9-
set(DF_VERSION "53.08")
9+
set(DF_VERSION "53.09")
1010
set(DFHACK_RELEASE "r1")
1111
set(DFHACK_PRERELEASE FALSE)
1212

docs/changelog.txt

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,35 @@ Template for new versions:
5959
## New Features
6060

6161
## Fixes
62+
- `autochop`: the report will no longer throw a C++ exception when burrows are defined.
6263
- `suspendmanager`: Fix the overlay appearing where it should not when following a unit
6364

6465
## Misc Improvements
6566

6667
## Documentation
6768

69+
## API
70+
- Added ``Burrows::getName``: obtains the name of a burrow, or the same placeholder name that DF would show if the burrow is unnamed.
71+
72+
## Lua
73+
- Added ``Burrows::getName`` as ``dfhack.burrows.getName``.
74+
75+
## Removed
76+
77+
# 53.09-r1
78+
79+
## New Tools
80+
81+
## New Features
82+
- `tweak`: ``drawbridge-tiles``: Make it so raised bridges render with different tiles in ASCII mode to make it more obvious that they ARE raised (and to indicate their direction)
83+
84+
## Fixes
85+
- ``Filesystem::as_string`` now always uses UTF-8 encoding rather than using the system locale encoding
86+
87+
## Misc Improvements
88+
89+
## Documentation
90+
6891
## API
6992

7093
## Lua

docs/dev/Lua API.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2489,6 +2489,11 @@ Maps module
24892489
Burrows module
24902490
--------------
24912491

2492+
* ``dfhack.burrows.getName(burrow)``
2493+
2494+
Returns the name of the burrow.
2495+
If the burrow has no set name, returns the same placeholder name that DF would show in the UI.
2496+
24922497
* ``dfhack.burrows.findByName(name[, ignore_final_plus])``
24932498

24942499
Returns the burrow pointer or *nil*. if ``ignore_final_plus`` is ``true``,

docs/plugins/tweak.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ Commands
4545
Fixes crafted items not wearing out over time (:bug:`6003`). With this
4646
tweak, items made from cloth and leather will gain a level of wear every 20
4747
in-game years.
48+
``drawbridge-tiles``
49+
Makes raising bridges in ASCII mode render with different tiles when they
50+
are raised.
4851
``eggs-fertile``
4952
Displays an indicator on fertile eggs.
5053
``fast-heat``

library/include/modules/Burrows.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ namespace DFHack
4545
{
4646
namespace Burrows
4747
{
48+
DFHACK_EXPORT std::string getName(df::burrow* burrow);
49+
4850
DFHACK_EXPORT df::burrow *findByName(std::string name, bool ignore_final_plus = false);
4951

5052
// Units

library/include/modules/Filesystem.h

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,13 @@ namespace DFHack {
7777
DFHACK_EXPORT std::filesystem::path canonicalize(std::filesystem::path p) noexcept;
7878
inline std::string as_string(const std::filesystem::path path) noexcept
7979
{
80-
auto pStr = path.string();
81-
if constexpr (std::filesystem::path::preferred_separator != '/')
82-
{
83-
std::ranges::replace(pStr, std::filesystem::path::preferred_separator, '/');
84-
}
85-
return pStr;
80+
// this just mashes the utf-8 into a std::string without any conversion
81+
// this is largely because we use utf-8 everywhere internally as much as we can
82+
// but we should ultimately convert to using u8strings for strings that are utf-8
83+
// and use a different string type for strings encoded in cp437 or in the locale codepage
84+
std::u8string pstr = path.generic_u8string();
85+
return std::string((char*)pstr.c_str());
86+
8687
}
8788
DFHACK_EXPORT std::filesystem::path getInstallDir() noexcept;
8889
DFHACK_EXPORT std::filesystem::path getBaseDir() noexcept;

library/modules/Burrows.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,13 @@ using namespace df::enums;
5252
using df::global::world;
5353
using df::global::plotinfo;
5454

55+
std::string Burrows::getName(df::burrow* burrow)
56+
{
57+
CHECK_NULL_POINTER(burrow);
58+
return burrow->name.empty() ? fmt::format("Burrow {}", burrow->id + 1) : burrow->name;
59+
}
60+
61+
5562
df::burrow *Burrows::findByName(std::string name, bool ignore_final_plus)
5663
{
5764
auto &vec = df::burrow::get_vector();

0 commit comments

Comments
 (0)