Commit Graph

3661 Commits (d4ab4e1631298e853cca19aa98c1b8a2b6be60a9)

Author SHA1 Message Date
Tachytaenius a925c34413 Rename [xyz]ActionTimer functions to [xyz]ActionTimers 2022-12-01 13:34:54 +00:00
Tachytaenius f863b9807a Add action timer API input validation 2022-12-01 13:34:54 +00:00
Tachytaenius cc40b80456 Protect against integer overflow when subtracting with action timer API 2022-12-01 13:34:54 +00:00
Tachytaenius 6148307e9b Change != 0 to > 0 in action timer API core functions 2022-12-01 13:34:54 +00:00
Tachytaenius 5e0c0d22cb Group action timer API internal functions together 2022-12-01 13:34:54 +00:00
Tachytaenius e93d7eefb3 Factor out set and add shared action timer code into own functions 2022-12-01 13:34:54 +00:00
Tachytaenius 357b871b4f Factor out shared unit action timer multiplication code into its own function 2022-12-01 13:34:54 +00:00
Tachytaenius 8f0b7663d9 Change ints in action timer API function signatures to int32_ts 2022-12-01 13:34:54 +00:00
Tachytaenius 4b33097e57 Remove default in action timer API switch case 2022-12-01 13:34:54 +00:00
Tachytaenius a3b1125c28 Progress on action timer API 2022-12-01 13:34:54 +00:00
Tachytaenius 7f54a77ed9 Continue work on unit action timer API 2022-12-01 13:34:54 +00:00
Tachytaenius 16ef4f8313 Rename action_type_group to unit_timer_action_type_group 2022-12-01 13:34:54 +00:00
Tachytaenius 2cbbed6750 Use df-structures XML enums for action timer API 2022-12-01 13:34:54 +00:00
Tachytaenius fa589b5764 Make progress with action timer API 2022-12-01 13:34:54 +00:00
Tachytaenius 0f8ce360ac Make first pass of action timer API 2022-12-01 13:34:54 +00:00
DFHack-Urist via GitHub Actions d14a3f4970 Auto-update submodules
library/xml: master
scripts: master
2022-12-01 00:57:53 +00:00
Myk 018bf712d5
Merge pull request #2429 from cppcooper/patch-3
Updates Units::isAnimal
2022-11-29 18:43:04 -08:00
Myk 9038c1c568
Merge pull request #2437 from myk002/myk_ctest
Combine unit testing branches and simplify
2022-11-29 15:07:47 -08:00
Myk aac89d4942
Merge branch 'develop' into myk_default_search_key 2022-11-29 15:07:12 -08:00
Myk 5b311163a9
Merge pull request #2431 from myk002/myk_widget_fixes
fix minor errors in ResizablePanel, Label, and HotkeyLabel widgets
2022-11-29 15:06:15 -08:00
Myk 757aa303b7
Update library/MiscUtils.test.cpp
Co-authored-by: Josh Cooper <cppcooper@users.noreply.github.com>
2022-11-29 15:05:04 -08:00
Josh Cooper 807894ac6c Updates Units::isAnimal
Now checks that the unit cannot learn or speak, and has either a wilderness population source, a pet/pet_exotic token, or is trainable for war/hunting
2022-11-29 13:19:19 -08:00
myk002 d0a6a3e930
remove unnecessary target modifications 2022-11-28 17:43:55 -08:00
myk002 88074dacf0
move tests into the same dir as the main files 2022-11-28 17:31:10 -08:00
myk002 7fbeb215d7
Merge branch 'myk_unit_testing' into myk_ctest 2022-11-28 17:26:27 -08:00
myk002 f921b02a1b
Merge remote-tracking branch 'cppcooper/unit-testing' into myk_ctest 2022-11-28 17:25:10 -08:00
myk002 ae035d5836
simplify unit testing setup 2022-11-28 17:16:48 -08:00
myk002 726771c8d3
supply default search key for tokenized text 2022-11-28 16:02:47 -08:00
myk002 adb9c5ea12
fix frame size calculation when frame_inset is set
also fix error when clicking on HotkeyLabels where no on_activate
callback has been set
2022-11-28 15:12:22 -08:00
myk002 fb6483fe6c
allow frames to be drawn without DFHack signature 2022-11-28 15:04:28 -08:00
Josh Cooper 25f87306b4 Removes separated unit test executables 2022-11-25 09:43:04 -08:00
Josh Cooper 79551f7ef0 Updates CMake TESTING vars 2022-11-25 09:43:04 -08:00
Josh Cooper de91fa7f28 Adds -Wno-sign-compare to test targets 2022-11-25 09:43:04 -08:00
Josh Cooper 268719ed1f Integrates googletest 2022-11-25 09:43:04 -08:00
Tim Siegel 8e18d610f5 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-11-25 09:43:04 -08:00
Tim Siegel face558dd0 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-11-25 09:43:04 -08:00
Tim Siegel c5be87e381 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-11-25 09:43:04 -08:00
myk002 c9cf5ecca8
we kept editfield as MOUSE_L for click and drag 2022-11-21 17:51:24 -08:00
myk002 24dc879888
adapt library code to newly correct mouse events 2022-11-21 17:36:46 -08:00
myk002 e2218d0429
make mouse button event behavior conform to docs
before, when a mouse button was held down, we'd send a single _MOUSE_L
and _MOUSE_L_DOWN event and that's it. now we properly send a single
_MOUSE_L_DOWN event and _MOUSE_L events for as long as the button is
held down. similar for the right mouse button
2022-11-21 17:35:14 -08:00
myk002 0190cfb117
ensure foo.init runs before foo.*.init 2022-11-20 17:27:14 -08:00
Myk ac5a1d35ae
remove duplicate function definition 2022-11-18 17:39:49 -08:00
Myk 11c27d40dd
Merge branch 'develop' into Bumber64-patch-2 2022-11-18 17:34:00 -08:00
DFHack-Urist via GitHub Actions acd561ec9c Auto-update submodules
library/xml: master
scripts: master
2022-11-18 20:59:44 +00:00
DFHack-Urist via GitHub Actions 822a1c8359 Auto-update submodules
library/xml: master
scripts: master
2022-11-15 07:17:03 +00:00
Myk 966623a919
Merge pull request #2387 from cppcooper/units-checking
Extends Units module
2022-11-14 16:55:42 -08:00
myk002 94c6bc8063
refactor generic lua function caller to Lua ns 2022-11-14 16:40:35 -08:00
Josh Cooper aa5c6515e0 Removes rogue indent 2022-11-13 11:39:20 -08:00
Josh Cooper 78021ec672 Adds indentation 2022-11-13 11:35:01 -08:00
Josh Cooper 7e1bdb5302 Matches Units.h ordering in LuaApi.cpp 2022-11-12 17:05:11 -08:00
Josh Cooper d112649886 Organizes and documents Units::is*(unit) functions 2022-11-12 16:40:20 -08:00
Josh Cooper ebd450af0e Adds isUnitInBox to Units module 2022-11-12 14:42:41 -08:00
Myk afe85137c3
Merge branch 'develop' into cmake-ctest 2022-11-12 11:50:33 -08:00
Myk 5136bbbc03
Merge pull request #2383 from cppcooper/em-fixes
Fixes JOB_STARTED event
2022-11-11 19:58:46 -08:00
myk002 5b1ebdf72a
don't return list idx when mouse is on scrollbar 2022-11-11 10:40:10 -08:00
DFHack-Urist via GitHub Actions 4d97c90f53 Auto-update submodules
library/xml: master
scripts: master
2022-11-10 07:18:00 +00:00
Josh Cooper 34de030ba9 Units module
- Updates `Lua API.rst`
  - Only adds the most important additions (complicated enough to need explaining)
- Adds new functions to LuaApi.cpp
- Revises isUndead to accommodate `dfhack.units.isUndead(u)` => `Units::isUndead(u, false)` instead of taking the default value
2022-11-09 22:03:39 -08:00
Josh Cooper f3ae193914
Update EventManager.cpp 2022-11-09 16:49:35 -08:00
Myk eac7fac8e9
Merge pull request #2389 from myk002/myk_gui_anywhere
[Gui] add "anywhere" keybinding guard
2022-11-09 15:48:04 -08:00
Josh Cooper 80824f5b75 Extends Units module 2022-11-09 14:41:45 -08:00
myk002 0344595e4e
add "anywhere" keybinding guard 2022-11-09 14:32:51 -08:00
Josh Cooper c0ffcc2f79 Updates Units::isDemon() 2022-11-09 12:37:41 -08:00
myk002 d95a5ac238
add string_to_int to MiscUtils.h 2022-11-09 11:55:29 -08:00
Josh Cooper beee445f6f Extends Units module
Adds unit check functions for
- animals
- demons
- titans
- megabeasts
- semimegabeasts
- night creatures
2022-11-09 11:44:28 -08:00
Myk ccd43f1710
Merge pull request #2381 from myk002/myk_framed_panel
[widgets.Panel] support frames around panel widgets
2022-11-09 10:32:23 -08:00
Myk 9fed02435e
Merge pull request #2378 from myk002/myk_list_mouse
Allow widgets.List to report hover target and respond to shift-click
2022-11-09 10:32:06 -08:00
Myk 4924fd0d52
Merge pull request #2377 from myk002/myk_gui_convenience
Make View:getMousePos() and Screen:show() a bit more flexible
2022-11-09 10:31:58 -08:00
Myk f2a386f0e1
Merge pull request #2375 from myk002/myk_uicommon
Move generally useful string functions from uicommon to MiscUtils
2022-11-09 10:31:50 -08:00
Josh Cooper 92645ccb5b Fixes JOB_STARTED event 2022-11-08 12:43:23 -08:00
Myk 22eb9ca8b3
Merge pull request #2380 from myk002/myk_instrument_keybinding
instrument core keybinding resolution
2022-11-08 10:16:13 -08:00
myk002 4668d8c4a3 Add Lua::Push method for maps 2022-11-08 10:15:28 -08:00
myk002 e4d0bb9e46 move Lua push methods into LuaTools.cpp 2022-11-08 10:15:28 -08:00
myk002 b82a604c8d factor out keys -> lua onInput code to LuaTools 2022-11-08 10:15:28 -08:00
Myk 193d29ba67
include cctype to fix build error 2022-11-08 09:53:08 -08:00
myk002 32dc80729a
support drawing frames around panels 2022-11-07 16:50:21 -08:00
myk002 351ecbfb59
instrument core keybinding resolution 2022-11-07 16:41:53 -08:00
myk002 83f560a6f4
allow shift-click to trigger submit2 for List 2022-11-07 16:14:16 -08:00
myk002 1b7b75d8ab
factor out detection of the list index under mouse 2022-11-07 16:13:45 -08:00
myk002 28aadea6af
allow an alternate ViewRect for getMousePos 2022-11-07 15:54:56 -08:00
myk002 be18f4e900
return self from Screen:show() as a convenience 2022-11-07 15:54:55 -08:00
myk002 5b9c18fc3c
migrate string fns from uicommon to MiscUtils
and clean up some leaky usings
2022-11-07 15:36:16 -08:00
Josh Cooper 2197aded30
Fixes segfault 2022-11-06 17:30:28 -08:00
Myk a854e379b2
Merge pull request #2354 from myk002/myk_scrollbars_redux
make scrollbars more responsive when dragging
2022-10-22 20:28:52 -07:00
myk002 64b923b9eb
make the materials dialog filter lcase only
this allows the capital letter hotkeys to be processed by the list
widget without the special-casing of the ignore_keys attribute.
2022-10-21 12:43:53 -07:00
myk002 593b80cfa0
make scrollbars more responsive when dragging 2022-10-21 12:22:57 -07:00
myk002 1e21e6546e
fix materials selection dialog
where the filter was swallowing the sublist hotkeys
2022-10-19 17:31:28 -07:00
myk002 142b45ef49
move list item hotkey hint left by one tile
so it doesn't get covered by the scrollbar
2022-10-19 17:30:51 -07:00
myk002 666edd6d60
don't overwrite dig priority by accident
many callers of setDesignationAt simply didn't bother with the priority
parameter. change the default value of the priority param so that by
default we will keep the previous value instead of overwriting it
2022-10-19 16:47:54 -07:00
myk002 f94cc3fda0
add backtick to keybinding's hardcoded docs 2022-10-19 16:24:21 -07:00
Myk 4f10cd4a9b
Merge pull request #2331 from wolfboyft/constructions-find-at-tile-patch
Implement/change/expose to Lua constructions findAtTile & insert
2022-10-13 17:40:21 -07:00
Tachytaenius ded5f483d6 Fix issues in construction module 2022-10-12 21:32:27 +01:00
myk002 b78af72403
record built constructions in blueprint 2022-10-12 13:31:46 -07:00
Tachytaenius 1cf9688349 Implement/change/expose constructions findAtTile & insert (not building) 2022-10-12 21:10:22 +01:00
myk002 d650ba2377
ensure scrollbar can never get ahead of the cursor 2022-10-10 16:42:32 -07:00
myk002 ba36e72b33
support click and drag for scrollbars 2022-10-07 16:27:19 -07:00
myk002 35eb4e08dd
hold down the mouse button to continue scrolling 2022-10-07 15:40:05 -07:00
myk002 2bff70a290
add unit tests for widgets.Scrollbar 2022-10-07 13:14:52 -07:00
myk002 5722d6914b
transition Label to use the new generic Scrollbar 2022-10-07 12:45:43 -07:00
myk002 24232e894a
create Scrollbar widget and integrate with List 2022-10-06 11:13:16 -07:00
myk002 9817106c30
add --exclude option for ls 2022-10-05 13:30:14 -07:00