Commit Graph

15101 Commits (14871c9d2e7365a90136be330de2602045a64106)
 

Author SHA1 Message Date
Josh Cooper fe29bff845
Adds cxxrandom unit test and fixes interface problems (#2099)
* Adds cxxrandom unit test and fixes interface problems

* Tightens braces

* Adds detection code for Shuffle's seqID/engID

* Adds usage examples for cxxrandom

* Gives cxxrandom objects id ranges, sort of

* Updates changelog

* Updates changelog.txt

* Increases id space for cxxrandom

* Fixes bool distribution error message and improves check

* Adds comment explaining the seeded RNG tests for cxxrandom

* Fixes type problem for 32bit builds

* Reduces loop count a few magnitudes

* Fixes a mistake in test.cxxrandom_seed
2022-04-30 21:46:47 -07:00
DFHack-Urist via GitHub Actions 9643246b18 Auto-update submodules
library/xml: master
2022-04-30 19:20:07 +00:00
DFHack-Urist via GitHub Actions e9a2de08cd Auto-update submodules
library/xml: master
2022-04-30 07:17:43 +00:00
Myk e2fb15a3a5
add dwarfmode.MenuOverlay:renderMapOverlay() (#2119)
* add dwarfmode.MenuOverlay:renderMapOverlay()

* ensure we move with the viewport when bounds_rect is nil
2022-04-29 20:32:22 -07:00
Myk 24dd4d8ac0
Update init files (#2117)
* update example init files

replace onLoad.init-example with documentation on how to create scripts that run on world/map load
it was confusing to show it being loaded with sc-script since it gets autorun anyway if it is just named properly

* update changelog

* add quickfort keybinding

* move standard tweaks from dreamfort init to main
2022-04-29 20:24:09 -07:00
myk002 e603fee3ce
move sidebar mode management code to init
from onAboutToShow(). this allows the frames to be calculated correctly
during widget instantiation. otherwise widgets can end up with -1 width
2022-04-29 12:10:05 -07:00
myk002 af47434f52
protect against 0 width in string:wrap() 2022-04-29 11:29:19 -07:00
Tachytaenius b9c36c1e63
Added custom-raw-tokens utility (#2038)
* Added (chain) for [CHAIN_METAL_TEXT] armours in gui/materials.lua used by gui/create-item-- again (oops)

* Added customRawData utility

* Oops, whitespace

* Revised rawStringsFieldNames

* Dialed down on lua trickery and fixed wrongly formatted changelog entry

* Fixed changelog in wrong place and made customRawData a proper module

* Fixed not caching not-present tags, revised examples and fixed error

* Fixed whitespace. Changing settings in editor!

* customRawData docs

* Added getCreatureTag for respecting caste tags, "fixed" bizarre caching error (quotes because I don't even know what was causing it) and updated docs

* Added line limiting for docs, I guess

* Added missing string convert argument

* docs indent fix, code block fix, and revision

* Major revision

* gdi, docs error

* Another? But... huh.

* ...

* Made requested changes

* Whoops

* Rearrange docs lines

* Followed example, should fix linter issues

* fix typo. linted offline this time......

* Make it so that last instance of tag is what is read from

* Added requested change

* eventful key change

* i to lenArgs

* change eventful key

* add test for broken caste selection

* Major redesign

* tags --> tokens

* Added plant growth behaviour and did some requested changes

* More error handling

* fix docs

* Added basic error suppression

* Docs clarification.

* Docs registering example and fix error

* Strip errors on frame after onWorldLoad, not on map load

* Revert "Strip errors on frame after onWorldLoad, not on map load"

This reverts commit e20a0ef8d3743f79d961077f46910b77b16f36b9.

* Revert "Docs registering example and fix error"

This reverts commit 9c848c54c3f84e0ecc1dc421137c8a8b4a52280d.

* Revert "Docs clarification."

This reverts commit 6b4b6a1aa40c50398504f37ecf1ff0f93d6459b1.

* Revert "Added basic error suppression"

This reverts commit d11cb1438cf1e56ff700469e944f0b9af64651d7.

* Use more eventful key more consistent with other files

* use onStateChange instead of eventful and remove redundant utils require

* Code review stuff

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update docs/Lua API.rst

committing a suggestion

Co-authored-by: Alan <lethosor@users.noreply.github.com>

* Prepend examples with DFHACK_

* Remove unused parameters

* Use new ensure_key global

* Named a couple of unnamed arguments (untested)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Alan <lethosor@users.noreply.github.com>
2022-04-29 08:39:59 -07:00
Timur Kelman f08a268e8a
add scroll icons to Label widget (#2101)
* WIP: add scroll icons to Label widget

It's an opt-out. The icons are rendered in the right-most column of the 1st and last row. They are only rendered when text can actually be scrolled in the corresponding direction.

WIP: Currently, the icons might overlay text characters, there is no mechanism preventing it

* gui.lua: expose the `parse_inset()` function

* refactor Label's scroll icon code

* since `render_scroll_icons` only works with a label, it's now a class function
* `update_scroll_inset` ensures `frame_inset.r` or `.l` is at least 1, according to `show_scroll_icons`
* `show_scroll_icons` has 4 possible values: `false` for no icons, `left` for icons on the first column on the left (also ensuring `frame_inset.l >= 1`), `right` - last column on the right, `DEFAULT_NIL` - same as `right` if text height greater than `frame_body.height`, else same as `false`.

* make `render_scroll_icons` always draw icons

The check now happens in `onRenderFrame`

* draw frame's background

calling `Label.super.onRenderFrame(self, dc, rect)` makes frame's background invisible for some reason

* remove trailing spaces

* fix scroll icons placed far above/below text

 With `Label.frame_inset = 1` the text could be vertically centered with plenty of space below and above,
but not all rendered. Before this change, the scroll icons would be at the very top and bottom of the frame
instead of near the first and last rendered text line.

* always `update_scroll_inset` to react to resized window

* draw scroll icons next to text

* update `Lua API.rst` with new `Label` parameters

* move comment separator up

This way every scroll related parameter is in one group

* list default values for new parameters in docs

* add missing description of `Label.scroll_keys`
2022-04-29 06:55:08 -07:00
Ryan Williams c89baa5e33
Update Lua API.rst 2022-04-28 22:40:36 -07:00
Josh Cooper 8eb2831b7e
Adds plugins/external/ and auto-populates the cmake within upon creation (#2095)
* Adds a plugins sub-directory

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Auto-adds plugins/external sub-directories

* Moves plugins/external globbing as to generate plugins/external/cmake

* Removes plugins/external/.gitignore since the directory is generated

* Fixes cmake error

* Moves gitignore for plugins/external to ensure existence for fresh clone

* Adds missing EOF newline

* Adds requested changes
2022-04-27 19:53:05 -07:00
myk002 dcadde38d7 add new global function: ensure_key 2022-04-27 17:35:49 -07:00
myk002 6ad362d698
return a reference to the created dialogs 2022-04-27 11:51:46 -07:00
Quietust dc2a14c0c2 Add "partial-items" tweak.
When active, the displayed names of partially-consumed items (e.g.
hospital cloth) will display a percentage indicator at the end.

Also re-sort a few Tweaks so they're in alphabetical order again.
2022-04-27 11:27:11 -07:00
Nik Nyby fe0b33d9c4 fix typo: equiptment 2022-04-26 17:11:21 -07:00
Ryan Williams b56d9520e9
Fix trailing whitespace 2022-04-25 00:39:05 -07:00
Ryan Williams a47bf1533e
Update changelog.txt 2022-04-25 00:17:31 -07:00
Ryan Williams ad9a08f1e7
Update Lua API.rst
Fix formatting (again)
2022-04-25 00:10:26 -07:00
Ryan Williams 709adda968
Update Lua API.rst
Fix formatting
2022-04-25 00:06:53 -07:00
Ryan Williams c66448015e
Update Lua API.rst
Document autoDFAnnouncement, pauseRecenter, and recenterViewscreen.
2022-04-25 00:02:37 -07:00
Ryan Williams 861a0ee85e
Update LuaApi.cpp
Wrappers for autoDFAnnouncement, pauseRecenter, and recenterViewscreen.
2022-04-24 22:52:31 -07:00
Ryan Williams c7be54dac0
Update Gui.cpp
Add reverse engineered functions: parseReportString, autoDFAnnouncement, recenterViewscreen, and pauseRecenter.
Add versions of autoDFAnnouncement that don't take a report_init struct and that log unprinted announcements.
Add utility functions: recent_report, recent_report_any, delete_old_reports, and check_repeat_report.
2022-04-24 22:45:26 -07:00
Ryan Williams 89ed9950c7
Update Gui.h
Added parseReportString, which parses a string using '&' as a control character (&r as newline, && as &) and cuts to a certain length w/o splitting words.

Added autoDFAnnouncement, which takes a report_init and a string, and handles them like DF does.
Added variants to log unprinted announcements and to build the report_init from arguments.

Added pauseRecenter, which recenters on an xyz coord (item style, not unit) and optionally pauses, while respecting pause_zoom_no_interface_ms.
Added variant that takes a pos.

Added recenterViewscreen, which recenters on an xyz coord using a report zoom style (item, unit, generic. revealInDwarfmodeMap calls "unit" style "center". Generic style ignores coords and just enforces valid view bounds.)
Added variants that take pos or use current cursor coords.
2022-04-24 22:32:41 -07:00
DFHack-Urist via GitHub Actions cb18ce69cc Auto-update submodules
scripts: master
2022-04-23 07:17:26 +00:00
myk002 ed5523152c
factor text wrapping out of TooltipLabel into WrappedLabel 2022-04-22 09:53:10 -07:00
myk002 809f9316fd
make frame inset configurable for ListBox list 2022-04-22 08:30:53 -07:00
Guilherme Abraham 2aa28d34b6
Adding ids output to cursecheck (#2093)
Co-authored-by: Guilherme Abraham <guilherme.abraham@zpesystems.com>
Co-authored-by: Myk <myk002@yahoo.com>
2022-04-21 20:22:05 -07:00
Josh Cooper 9c9a7ef99a Adds consistent interface signatures for Maps module 2022-04-21 19:40:58 -07:00
Tim Siegel b56f57c074
cmake: Add SDL dep for Linux dfhack; deprecate BUILD_TESTS
On Linux, libdfhack.so depends on libSDL.so, but that was not marked
inside CMake. As it's only used via LD_PRELOAD, there was no problem.
But when linking unit tests against it, this becomes necessary. It may
be wise to add a find_package(SDL) to provide the user with more
control, but just a hard-coded "SDL" should work for most installs.

The CTest module creates a BUILD_TESTING option, which clashes
(thematically, not in code) with the existing BUILD_TESTS option.
Resolve it thus:
- Deprecate BUILD_TESTS; it still works, but is marked as an advanced
  option so it doesn't show in the CMake UI by default.
- Add a new BUILD_TEST_SCRIPTS that does what BUILD_TESTS used to do,
  but is a "dependent" option so it goes away if BUILD_TESTING=OFF.

The up-shot is that, by default, the C++ unit tests will be built
(BUILD_TESTING=ON) and the Lua integration tests are not installed
(BUILD_TEST_SCRIPTS=OFF).
2022-04-21 18:44:33 -04:00
Tim Siegel 6daa13ad51
unit testing: Link test executables against libdfhack
Note: Hard-coded "SDL" here is wrong, but requires some refactoring in
top-level CMakeLists.txt to fix.
2022-04-21 10:42:19 -04:00
DFHack-Urist via GitHub Actions ba5aaf897a Auto-update submodules
scripts: master
2022-04-21 07:17:14 +00:00
Tim Siegel 26a9bf9671
unit tests: Add CTest support, and a trivial first unit test
If BUILD_TESTS=ON:
- Adds a 'test' target for ninja
- Adds a library/MiscUtils.test unit test executable
2022-04-20 22:24:13 -04:00
DFHack-Urist via GitHub Actions 62b02c2367 Auto-update submodules
library/xml: master
2022-04-19 07:17:48 +00:00
Josh Cooper 251f4f92c8 Fixes build errors 2022-04-18 23:53:23 -07:00
Josh Cooper ff2bd8d953 Retypes the EventManager's constructions container 2022-04-18 23:53:23 -07:00
Josh Cooper d6b2629cfc Adds hash functions and operator overloads for event data structures 2022-04-18 23:53:23 -07:00
Josh Cooper 64b7de0339 Revises getVerb signature 2022-04-18 22:46:38 -07:00
Josh Cooper 018d189494 Simplifies report index safety 2022-04-18 22:46:38 -07:00
Josh Cooper 1f972d6c1c Implements clang-tidy suggestions 2022-04-18 22:46:38 -07:00
Josh Cooper 2bbe1aa6f5 Alphabetizes job-(material/duplicate) correctly 2022-04-18 17:40:12 -07:00
Josh Cooper f570b5441a Alphabetizes confirm/command-prompt correctly 2022-04-18 17:40:12 -07:00
Josh Cooper 634751a12c Alphabetizes the sections of Plugins.rst 2022-04-18 17:40:12 -07:00
Josh Cooper e7062e2e45 Alphabetizes the "Mods and Cheating" section 2022-04-18 17:40:12 -07:00
Josh Cooper b13b927a70 Alphabetizes the "Map modification" section 2022-04-18 17:40:12 -07:00
Josh Cooper 1c825baac1 Alphabetizes the "Job and Fortress management" section 2022-04-18 17:40:12 -07:00
Josh Cooper e9c0c01364 Alphabetizes the "UI Upgrades" section 2022-04-18 17:40:12 -07:00
Josh Cooper d5c4ad4ccc Alphabetizes the "Bugfixes" section 2022-04-18 17:40:12 -07:00
Josh Cooper 96fa0b4241 Alphabetizes the "Data inspection and visualizers" section 2022-04-18 17:40:12 -07:00
myk002 07761e1d5d add some more handy widgets to the library
TooltipLabel
HotkeyLabel
CycleHotkeyLabel
ToggleHotkeyLabel
2022-04-18 17:37:11 -07:00
pre-commit-ci[bot] b6703b2b05 [pre-commit.ci] pre-commit autoupdate
updates:
- [github.com/pre-commit/pre-commit-hooks: v4.1.0 → v4.2.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.1.0...v4.2.0)
- [github.com/python-jsonschema/check-jsonschema: 0.14.2 → 0.14.3](https://github.com/python-jsonschema/check-jsonschema/compare/0.14.2...0.14.3)
2022-04-18 17:36:17 -07:00