Commit Graph

1133 Commits (2ac2817987ae2e8b9d426550c50406c2e1576b3f)

Author SHA1 Message Date
Myk Taylor ac06508d92
add some more icon textures we can use
contributed by TaxiService on the DFHack Discord server
2023-01-12 21:04:41 -08:00
Myk Taylor 15998f2ebe
add gui.TRANSPARENT_PEN for clearing the UI layer 2023-01-12 12:44:50 -08:00
Myk Taylor 079d5e4178
support foreground and background writing from pens 2023-01-12 12:30:07 -08:00
Myk Taylor 1d0f6b3a95
more careful bounds checking for screen tiles 2023-01-10 19:40:13 -08:00
Myk Taylor 353117d484
fix a crash in Screen when read or paint tile indices are negative 2023-01-10 19:05:04 -08:00
Myk c26ed36893
Merge pull request #2577 from myk002/myk_get_any
get rudimentary getAny(Unit|Item|Building) working
2023-01-09 23:50:02 -08:00
Myk Taylor f8728a4388
get rudimentary getAny(Unit|Item|Building) working 2023-01-09 01:39:48 -08:00
Myk Taylor 2234328a91
use an actual pin texture for ZScreen pins 2023-01-09 00:47:13 -08:00
Myk Taylor 92489ef27d
get things to compile with the recent structure updates 2023-01-08 11:33:14 -08:00
Kelly Kinkade 3e4861b54b fix persistence for changed file structure
`data/save` -> `save`
2023-01-06 21:24:01 -06:00
Myk Taylor 6f46ae672e
add Gui::getDFViewscreen and Lua binding 2023-01-06 12:17:36 -08:00
Myk Taylor 1934014659
framework for passthru, z-order swapping windows 2023-01-05 18:07:38 -08:00
Myk Taylor 845391f4e6
fix overzealous "ui" -> "plotinfo" replacement
some comments were just talking about the UI..
2023-01-05 17:46:30 -08:00
Myk Taylor 5e5775f5e3
rename globals according to structures update 2023-01-05 17:11:01 -08:00
Myk Taylor 412531bf03
really fix the format string this time 2023-01-04 21:29:45 -08:00
Myk Taylor 9cbcd81f63
fix format strings for vars that were size_t 2023-01-04 21:24:52 -08:00
Myk Taylor 4e51e02924
move SDL shims to a new DFSDL module 2023-01-04 17:15:32 -08:00
Myk Taylor 5d04b9c4cb
add Textures module and load DFHack logo
undocumented for now since it's internal. in the future, perhaps this
could morph into a dynamic texture loading facility for tools
2023-01-04 13:30:18 -08:00
Myk 6361b0a3a4
Merge pull request #2543 from myk002/myk_prep_for_quietust
prep for Quietust's structure updates
2023-01-02 20:42:48 -08:00
Myk 35ce361b09
Merge pull request #2542 from myk002/myk_dwarfmode_dims
clear out obsolete area map and menu logic from the Gui module
2023-01-02 20:42:30 -08:00
Myk Taylor 218fbdbd45
prep for Quietust's structure updates 2023-01-01 01:03:42 -08:00
Myk Taylor aa091ed37e
overwrite anchored textures where we actually touch their anchor 2023-01-01 00:45:14 -08:00
Myk Taylor 7d5d2d0a9b
clear out obsolete area map and menu logic
in particular, return the correct map dimensions in getDwarfmodeDims()
2022-12-31 22:49:30 -08:00
Myk Taylor a6294c24fb
implement Screen::paintTile and readTile 2022-12-31 21:16:42 -08:00
Myk Taylor 7d91f9262d
respect tile colors in pens 2022-12-30 05:36:41 -08:00
Myk Taylor 83a8e9a45a
render bright colors correctly 2022-12-30 03:30:01 -08:00
Myk Taylor 1265d531d5
only keep the anchor flag if it's already there 2022-12-30 00:53:44 -08:00
Myk Taylor f45eac993a
use semantically clearer div rather than bit shift 2022-12-29 22:18:35 -08:00
Myk Taylor a4c11de4fb
returns correct mouse pos when in ascii 2022-12-29 00:01:40 -08:00
Myk Taylor 371f5be050
fix signedness of comparison var 2022-12-28 23:31:06 -08:00
Myk Taylor 07f8fad787
implement Gui::getMousePos and Gui::getDepthAt 2022-12-28 16:00:10 -08:00
Myk Taylor e2a4eeb422
write textures and chars to the map 2022-12-27 17:00:50 -08:00
Myk Taylor 033eb2aefd
use default background colors
and ensure texpos_lower doesn't peek through
2022-12-27 15:05:13 -08:00
Myk Taylor 69c9e3ffb7
render tiles if given in the pen; otherwise text
this commit also smooths out many conflicts with other layers, but the
anchor layer still gives us trouble. it will overwrite us unless we
cover the upper left tile of the anchor graphic, and then the entire
anchor graphic will disappear. not ideal, but it's a start
2022-12-27 14:39:03 -08:00
lethosor 12804a10a6
Fix Gui/Screen to work with g_src changes (dfhack/df-structures#487) 2022-12-23 00:36:09 -05:00
Myk Taylor 52c1e49197
get the text rendering back 2022-12-21 22:13:05 -08:00
Myk Taylor 48a9e1c518 more new var names 2022-12-22 05:16:40 +00:00
Myk Taylor 93c875fb56
adjust to new variable names 2022-12-21 14:07:36 -08:00
Myk Taylor 839e927f9b
comment out problematic code from Renderer 2022-12-21 14:06:58 -08:00
Myk Taylor 010b18c0e4
hide "offset" tiles that we occlude 2022-12-20 20:10:14 -08:00
Myk Taylor 663e1dd541
ascii is now in color 2022-12-20 16:33:11 -08:00
Myk Taylor d7f51e5ed8
basic text drawing 2022-12-20 11:00:49 -08:00
Myk Taylor 7f91cf6e2a
more instrumentation for eventmanager 2022-12-20 09:49:35 -08:00
Myk Taylor 999d602e79
instrument eventmanager a bit 2022-12-19 13:43:57 -08:00
Kelly Kinkade 57e599a4d9 comment out barracks reference
barracks appears to have gone away in 50.03
2022-12-17 13:07:37 -06:00
Myk Taylor 5cd60e10f0 comment out problematic code in Gui.cpp 2022-12-16 14:47:43 -06:00
Myk Taylor 768c95ecb6 absorb Putnam's work on Screen 2022-12-16 14:47:43 -06:00
Myk Taylor ccc9e976e2 comment out problematic code in Screen.cpp 2022-12-16 14:47:43 -06:00
Myk Taylor 55351951f0 comment out problematic code in Items.cpp 2022-12-16 14:47:43 -06:00
Myk Taylor 93b8479e94 comment out problematic code in Buildings.cpp 2022-12-16 14:47:43 -06:00
Myk Taylor 6c562a3fed
fix apparent typo in Materials scanning 2022-12-09 09:21:50 -08:00
Tachytaenius 0836962007 Rename [xyz]CategoryActionTimers to [xyz]GroupActionTimers in action timer API 2022-12-01 23:24:04 +00:00
Tachytaenius ae532e1452 Rename affectedActionTypeCategory to affectedActionTypeGroup in action timer API 2022-12-01 23:22:02 +00:00
Tachytaenius 76cdbfbc5c Rename affectedActionCategory to affectedActionTypeCategory in action timer API 2022-12-01 23:19:10 +00:00
Tachytaenius f06f17b59c Rename affectedActionTypes to affectedActionCategory in action timer API 2022-12-01 23:17:57 +00:00
Tachytaenius aa2cf44c4b Use lambdas to violate DRY less in action timer API 2022-12-01 13:34:54 +00:00
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
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
Myk 11c27d40dd
Merge branch 'develop' into Bumber64-patch-2 2022-11-18 17:34:00 -08:00
Myk 966623a919
Merge pull request #2387 from cppcooper/units-checking
Extends Units module
2022-11-14 16:55:42 -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 5136bbbc03
Merge pull request #2383 from cppcooper/em-fixes
Fixes JOB_STARTED event
2022-11-11 19:58:46 -08: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
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
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
Josh Cooper 92645ccb5b Fixes JOB_STARTED event 2022-11-08 12:43:23 -08:00
myk002 b82a604c8d factor out keys -> lua onInput code to LuaTools 2022-11-08 10:15:28 -08:00
Josh Cooper 2197aded30
Fixes segfault 2022-11-06 17:30:28 -08: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
Tachytaenius 1cf9688349 Implement/change/expose constructions findAtTile & insert (not building) 2022-10-12 21:10:22 +01:00
myk002 cb80f7dd75
don't cache dup civzones when scanning buildings 2022-09-25 16:04:36 -07:00
lethosor e6336e769a
Units::teleport(): set idle_area 2022-09-24 13:30:24 -04:00
Myk Taylor dbc5001bd8
fail if mouse cursor isn't over the map area 2022-09-18 13:27:13 -07:00
Myk Taylor 215a5b0a24
add Gui::getMousePos() that always gets map coords 2022-09-18 08:19:02 -07:00
Myk Taylor 448eced17c
make Screen::getMousePos always return scr coords 2022-09-18 08:07:08 -07:00
myk002 d0a5db2a0d
set sentinel value used by TWBT 2022-09-16 21:56:05 -07:00
lethosor f021dd0e0a
Gui::getAnyItem(): add support for viewscreen_treasurelistst 2022-07-12 11:25:16 -04:00
lethosor 4cdb0ff138
Merge branch 'rm-old-modules' into develop 2022-07-12 11:23:10 -04:00
Myk e0d37a31ae
Make the manager orders library available by default (#2233)
* move orders out of examples directory

* install orders into library dir

* read orders from new library dir

* update documentation

* update dreamfort references to orders import

* update changelog

* ignore json files in pre-commit
2022-07-06 07:03:29 -07:00
lethosor 1147add520
Constructions module: remove some old/unused functions/types 2022-06-29 23:35:14 -04:00
lethosor 4c7caa2658
Remove unneeded dependencies on modules/Graphic.h 2022-06-29 23:35:13 -04:00
lethosor 8bb047fcc6
Remove Notes module
Only used in a devel plugin that prints notes, and can be easily replaced
with `ui.waypoints.points`
2022-06-29 23:35:13 -04:00
Myk ba629b8e0a
manually handle DestroyBuilding jobs (#2209)
* don't delete general refs from jobs that we cancel

though we still disconnect the refs if we can

* get job remove working in all cases

we apparently need to manually handle DestroyBuilding jobs
everything else we should let cancel_job handle

* update changelog
2022-06-21 16:38:04 -07:00
Josh Cooper d38ab1d152
Fix UNIT_NEW_ACTIVE events (#2197)
* Updates eventful.lua to use UNIT_NEW_ACTIVE

* Fixes bug #2189

* Revises activeUnits declaration/initialization

* Fixes build error

* Update changelog.txt

* reword changelog entry

* add changelog entry for event name change

Co-authored-by: Myk <myk002@yahoo.com>
2022-06-17 09:34:41 -07:00
Myk 85d7489b3c
ensure refs are cleaned up when we remove a job (#2184)
* ensure job items are disassociated from the job

when the job is removed. the new df-provided ``cancel_job()`` doesn't do
this for us whereas the old custom implementation did.
ref: #2028

* remove trailing whitespace

* Clean up general refs before removing job

Because the game method doesn't do it itself

* Fix typo in var name

* clean up code

* update changelog
2022-06-11 07:38:22 -07:00
Ryan Williams a7267e3c4e
Optimize report deletion 2022-06-07 04:21:48 -07:00
Ryan Williams 5d08e5ae67
More constants; remove extra "using" statements 2022-06-06 01:56:11 -07:00
Ryan Williams ce36abce47
Fixes 2022-06-04 15:46:02 -07:00
Ryan Williams ae4446610b
Update Gui.cpp 2022-06-04 15:36:50 -07:00
Ryan Williams 16b5cade00
Add constants, update old fns
Add MAX_REPORTS_SIZE, RECENT_REPORT_TICKS

Remove redundant "using df::global::world" inside fns

Update `makeAnnouncement`:
Use `word_wrap`, `pauseRecenter`, and utility fn `delete_old_reports`
Handle repeat announcements
Insert sorted into ``world->status.announcements``

Update `addCombatReportAuto`: Use utility fn `recent_report`

Update `showPopupAnnouncement`: Delete old popups at end of fn

Update `getDwarfmodeViewDims_default`: Check for ui_sidebar_mode::Default and ArenaWeather
2022-06-04 15:23:57 -07:00
Ryan Williams 23e85a0d24 Fetch and merge 2022-06-04 12:17:28 -07:00
Ryan Williams b0b601cf0f
Remove recenterViewscreen, update revealInDwarfmodeMap 2022-06-04 11:59:04 -07:00
Ryan Williams b1e118384e Update Maps.cpp 2022-05-30 16:26:30 -07:00
Ryan Williams 574728ac5c
Move add_proper_report up with other utility fns 2022-05-30 15:04:43 -07:00
Ryan Williams 0ff0d272b5
use static instead of anon namespace; suggested changes 2022-05-30 13:51:24 -07:00
Ryan Williams 1c3ea000e1
Trim trailing whitespace 2022-05-28 15:56:49 -07:00
Ryan Williams 249ed2888f
Fix scope issue 2022-05-28 13:28:10 -07:00
Ryan Williams e613085b0e
remove whitespace 2022-05-28 12:39:49 -07:00
Ryan Williams 2b29431806
More fixes
* Use word_wrap()

* add_proper_report utility fn; have addCombatReportAuto use this

* Update Lua API.rst

* Update Gui.cpp
2022-05-28 12:35:49 -07:00
Ryan Williams 4b21e7afb4
Remove parseReportString from API (now utility fn)
Implementations using `word_wrap()` are commented out pending changes to that function.
2022-05-24 03:52:33 -07:00
Ryan Williams ce34ac8f33
Use debugfilter; remove redundant changelog entries 2022-05-16 18:41:47 -07:00
Ryan Williams 74499ad64a
Use to_string on integer 2022-05-03 00:09:34 -07:00
Ryan Williams f565de88e8
Fix stuff (#4)
* Update Lua API.rst

* Update Gui.h

* Update Gui.cpp

* Update LuaApi.cpp
2022-05-01 22:53:53 -07:00
Ryan Williams b56d9520e9
Fix trailing whitespace 2022-04-25 00:39:05 -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
Josh Cooper 9c9a7ef99a Adds consistent interface signatures for Maps module 2022-04-21 19:40:58 -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 9bf9a79a11
EventManager/Eventful - Generate event arrays (#2097)
* Replaces EventManager.cpp's event array with an auto-gen one

* Replaces eventful.cpp's event array with auto-gen one
2022-04-14 21:47:25 -07:00
lethosor d1f0edd33b
Apply initial pre-commit config 2022-04-12 14:48:19 -04:00
Josh Cooper b18eff9ce2
Revert EventManager to previous behavior, but keep new events
Fixes #2031
2022-03-29 09:42:24 -07:00
Ryan Williams 88b403ec7a
Add functions reverse-engineered from ambushing unit code (#1992)
* Add functions reverse-engineered from ambushing unit code

* Fix whitespace

* Fix debug_showambush check

* Remove getOuterContainerRef from Lua API

Don't think this works properly without allocating a new specific_ref. More trouble that it's worth.

* Fixed tile visibility check

* I don't think gamemode or gametype are ever NULL

* Minor tweaks to documentation

* Reimplement getOuterContainerRef for Lua; fix some comments

* Update Units.cpp and changelog

* Update Units.cpp
* Update changelog.txt
2022-03-13 17:19:35 -07:00
Kelly Kinkade 3d4c96de56 update Job.cpp to use the DF-provided job cancel method
use DF's provided job cancel function instead of the hackadoo workaround we used to use
2022-03-12 15:37:33 -08:00
Quietust aa1bc3fe52 Cleanup Kitchen module (and the seedwatch plugin which uses it) 2022-03-12 12:04:34 -08:00
Josh Cooper 3f05859780 Revises manageJobStartedEvent, and adds comments 2022-03-12 11:33:27 -08:00
Josh Cooper c8e7869375 Fixes some build errors 2022-03-12 11:33:27 -08:00
Josh Cooper 524f1670ed Fixes missing namespace 2022-03-12 11:33:27 -08:00
Josh Cooper ba5710f263 Adds new event type NEW_UNIT_ACTIVE 2022-03-12 11:33:27 -08:00
Josh Cooper 6ace4b2cf8 Fixes mistake in EventManager::manageTickEvent 2022-03-12 11:33:27 -08:00
Josh Cooper b8ad0131ea Modifies EventManager::registerTick to retain old behaviour of re-registering tick events 2022-03-12 11:33:27 -08:00
Josh Cooper 1107c03b86 Modifies EventManager unit loops 2022-03-12 11:33:27 -08:00
Josh Cooper c550a6caf0 Updates EventManager job loops 2022-03-12 11:33:27 -08:00
Josh Cooper 07ffa0b8da Fixes bug in manageJobStartedEvent 2022-03-12 11:33:27 -08:00
Josh Cooper 24255d3195 Adds event type JOB_STARTED 2022-03-12 11:33:27 -08:00
Josh Cooper 48444afbd5 Fixes issue in manageJobCompletedEvent 2022-03-12 11:33:27 -08:00
Josh Cooper 3e72d549d1 Switches iterators to pre-increment instead of post for EventManager
My understanding is that iterators (.begin()/end()) are slightly faster with
pre-increment instead of post. Something about avoiding a copy if I recall correctly.
I replaced all `([:alpha:]+)\+\+` with `++$1` so non-iterators were switched as well - luckily there is no impact to pre/post aside from with iterators.
2022-03-12 11:33:27 -08:00
Josh Cooper f5ced46608 Refactors EventManager
- handler freq now works on an individual handler basis (set to 0 to fire as frequently as possible)
- tick events no longer need to be re-registered after every eventful tick
2022-03-12 11:33:27 -08:00
myk002 31397af99b cache civzones so lookup is O(1) instead of O(N) 2022-02-26 15:32:25 -08:00
lethosor e7754ea890
Enable -Wunused-variable and fix most errors 2021-09-07 01:16:21 -04:00