Commit Graph

1302 Commits (528d7b1be146f04d6f2c414e6b932967e3a73e76)

Author SHA1 Message Date
Myk 3cddea9b61
Merge branch 'develop' into myk_clear_tile 2023-02-26 09:25:05 -08:00
Myk e81a45a742
Merge pull request #2952 from myk002/myk_keep_focus
[Gui] don't prefix focus strings that are already properly marked
2023-02-26 09:23:42 -08:00
Myk Taylor f1d5551e51
fix on-map character rendering 2023-02-24 17:23:01 -08:00
Myk Taylor 88516a899a
allow map interface tiles to be cleared 2023-02-24 17:22:55 -08:00
Myk Taylor d7d3dcb0be
keep focus strings if they are already labeled
i.e. don't add a "dfhack/" prefix if the focus string already has the
string "dfhack" in it
2023-02-24 17:20:12 -08:00
Myk Taylor 30ea58374c
better detection of fire and magma safety 2023-02-24 16:57:44 -08:00
Myk Taylor 4bf0849d51
fix usage of squad equipment vector 2023-02-24 15:50:56 -08:00
silverflyone d8afb6c682 Update Buildings.cpp
Changed the StockpileIterator::operator++ to checks block based on <= 16 rather than <16. Previously it was not returning items at stockpile tiles at the block boundary. Identified as part of combine.lua changes.
2023-02-15 15:31:50 +11:00
Kelvie Wong f8d94afb7d Add getSelectedCivZone to dfhack.gui
Mostly helpful for my own automation in my custom lua scripts.

Tested it with barracks, meeting areas, and pastures.
2023-02-13 15:22:33 -08:00
Robob27 65f38ec75c Add isGeldable, isMarkedForGelding, isPet 2023-02-11 05:44:45 -05:00
Roxy 826f918954 remove isHospital as hospitals are no longer civzones 2023-02-06 19:11:00 -05:00
Roxy ca5a17a799 explanatory comment for magic number 2023-02-06 19:09:47 -05:00
Roxy a38246aaa4 Update logic for zone type checks 2023-02-06 16:47:50 -05:00
Myk Taylor 9e318842a4
implement some Gui module hotkey guards
and clean up focus string matching logic
2023-02-06 00:58:57 -08:00
Myk Taylor 526d7c1726
allow focus string generation to fall through unfocuses ZScreens 2023-02-05 18:01:46 -08:00
Robob27 c8d672eb05 Remove duplicate SquadEquipment entry 2023-02-05 19:04:21 -05:00
Robob27 6657fb59e5 Fix pausing and warnings 2023-02-05 19:04:21 -05:00
Robob27 36e4bba779 Fixup prefix matching 2023-02-05 19:04:21 -05:00
Robob27 14f1e4b52f Per confirm pause maybe? 2023-02-05 19:04:21 -05:00
Robob27 f7df51587c More focus strings, correct docs 2023-02-05 19:04:21 -05:00
Robob27 fdbe91e35b Add the rest of the bottom modes 2023-02-05 19:04:21 -05:00
Robob27 8f32f1ed7b Fixup focusStrings->focusString 2023-02-05 19:04:21 -05:00
Robob27 86b57380a6 fixup unnecessary changes, remove unnecessary stuff 2023-02-05 19:04:21 -05:00
Robob27 085a308e99 Remove/readd comments 2023-02-05 19:04:21 -05:00
Robob27 6e442a26ca More WIP 2023-02-05 19:04:21 -05:00
Robob27 a770a4cae4 WIP 2023-02-05 19:04:21 -05:00
Ryan Williams 08d90de277
Merge branch 'DFHack:develop' into patch-1 2023-02-05 12:02:58 -08:00
Ryan Williams 1eb67ab239
Update Gui::resetDwarfmodeView
* Set `plotinfo->main.mode` again now that alignment is fixed
* Left note about unidentified global
* DF resets the whole `selection_rect` struct
* Comments for `ANNOUNCE_LINE_DURATION` and `ANNOUNCE_DISPLAY_TIME` constants reflect the default 50 GFPS
2023-02-04 19:56:37 -08:00
Ryan Williams 0f78509328
agitated_wilderness_creature is in unit->flags4 2023-02-04 19:29:37 -08:00
Ryan Williams c345acd417
Update Units::isFortControlled
Add check for `agitated_wilderness_creature`.
2023-02-04 18:48:41 -08:00
Myk Taylor 49246a60f3
properly cast for unsigned comparisons 2023-02-02 23:57:52 -08:00
Myk Taylor 8c7be9a8c2
don't use negative plant indices
and clean up the Kitchen module a bit more
2023-02-02 23:33:24 -08:00
Myk 21f93173c3
Merge pull request #2778 from myk002/myk_halfsies
support offset text in graphics mode for pens
2023-02-01 17:50:24 -08:00
Myk 7468170751
Merge pull request #2771 from myk002/myk_seedwatch
update seedwatch
2023-02-01 17:49:57 -08:00
Myk Taylor 58be8cfd69
support offset text in graphics mode for pens 2023-02-01 17:39:32 -08:00
Myk Taylor be40d55e64
update seedwatch 2023-02-01 04:03:28 -08:00
Myk Taylor aa22917aeb
add new control panel textures 2023-01-31 23:52:30 -08:00
Myk 376526d512
Merge branch 'develop' into myk_no_stuck_df_viewscreens 2023-01-29 16:55:52 -08:00
Myk 274e995790
Merge pull request #2747 from myk002/myk_on_off
Add new on/off icons
2023-01-29 16:55:01 -08:00
Myk Taylor 1c6235633f
add dfhack.units.getCitizens() 2023-01-29 16:28:05 -08:00
Myk Taylor c2d6debcd8
add on/off light textures and expose to lua 2023-01-29 00:35:29 -08:00
Myk 2003efc21f
Merge branch 'develop' into myk_no_stuck_df_viewscreens 2023-01-28 12:03:50 -08:00
Myk 99d1ed6828
Merge branch 'develop' into myk_no_inception 2023-01-28 11:58:37 -08:00
Myk Taylor a931ca692d
Fix debug level typo 2023-01-28 08:21:13 -08:00
Myk Taylor f12ca33c0b
ensure DF screens don't get "stuck" when DFHack tool windows are on top 2023-01-28 08:05:37 -08:00
Myk Taylor 863ca2ca65
solve the inception problem
where hideGuard smashes the viewscreen stack with multiple insertions
for the same screen
2023-01-28 08:02:46 -08:00
Myk Taylor 22dd49ce38
remove "room" checking for buildings -- there is no room 2023-01-27 13:38:21 -08:00
Myk Taylor 9aaa55cd7f
add textures and frames for various use cases 2023-01-23 03:58:51 -08:00
Myk d82a795ef4
Merge pull request #2681 from 20k/develop
More civzone <-> building work, add removing zones with associated squads support
2023-01-22 17:14:24 -08:00
20k 4559168005 update for multiple ownership 2023-01-22 22:59:25 +00:00
20k b15fcc93d2 remove assignments on zone destroy 2023-01-22 15:26:55 +00:00
20k c7ca9d0d7b reverse squad iteration delete 2023-01-22 15:25:16 +00:00
20k 598354d9d4 getbiometype naming, docs 2023-01-21 20:33:40 +00:00
20k 9054efd7c8 Update miscutils to support member pointer to a variable defined in the base when passing in a derived type 2023-01-21 19:15:28 +00:00
20k 3024c4a0df update to remove ambiguity after structures change 2023-01-21 18:45:36 +00:00
20k 1dbf01e5d1 Civzone interop style changes 2023-01-21 18:45:36 +00:00
20k 8c68f54f50 update with squad removal support 2023-01-21 18:45:36 +00:00
Myk 310940e1a2
Merge branch 'develop' into Autoclothing 2023-01-20 14:05:26 -08:00
Rose 8e6252fc2b Small fixes to make things more clean. 2023-01-20 13:45:56 -08:00
Myk Taylor 25c3bf4a24
adjust to name change 2023-01-20 11:57:13 -08:00
Myk Taylor eae2cec22f
use keyboard cursor
and adapt to a "bad" cursor not being equal to -30000 anymore
2023-01-20 09:31:44 -08:00
Myk Taylor 4183bace4d
update autodump, only commands, add hotkeys 2023-01-20 09:31:44 -08:00
Myk d201cf0182
Merge pull request #2662 from 20k/develop
Zone <-> building interactions
2023-01-20 09:30:52 -08:00
20k 4d9c411358 fix flag 2023-01-19 23:33:03 +00:00
20k 8b7c8d83b5 remove save fixup
Add notifyCivzoneModified
2023-01-19 21:55:20 +00:00
cjhammel c05b7526b1
Update Units.cpp
fixes renamed value
2023-01-19 15:12:24 -05:00
20k d5610ab859 zone <-> building interop 2023-01-19 16:39:41 +00:00
Rose f9ac987367 Added bounds checking to various creature name functions in the Units module. 2023-01-18 20:52:58 -08:00
Rose 0e021e392d Added a report to autoclothing, as well as some changes to DFHack::Units to enable it. 2023-01-13 21:20:01 -08:00
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
myk002 e9eef31344
refactor list item removal into a library fn 2021-08-19 19:51:25 -07:00
Myk 8b824244ac
Update library/modules/Items.cpp
Co-authored-by: Alan <lethosor@users.noreply.github.com>
2021-08-19 19:21:27 -07:00
myk002 06a85d6f0d
handle projectiles in the Items module 2021-08-19 17:44:13 -07:00
myk002 5b960b97bc
fix comment for Maps::getSize(); add getTileSize() 2021-07-30 13:09:12 -07:00
lethosor f33db33c8f
Merge remote-tracking branch 'myk002/myk_force_extents' into develop + add extra changelog note
Conflicts:
	docs/changelog.txt
2021-07-05 15:52:03 -04:00
lethosor 96dd249be0
getAnyPlant: use Maps::getPlantAtTile
Followup to #1882
2021-06-25 01:08:58 -04:00
Ryan Williams c5e7a54d97
Rename to getPlantAtTile; remove extra variables 2021-06-23 23:03:22 -07:00
Ryan Williams b64e28253f
Update Maps.cpp 2021-06-22 20:03:18 -07:00
myk002 1a016a0ff3
force creation of extents for abstract buildings 2021-06-07 07:02:46 -07:00
myk002 fc860478e4
move fastdwarf's teleport code to Units module
and expose in Lua API
2021-06-06 08:48:32 -07:00
myk002 aff5c9bf35
add getCursorCoords overload for df::coord
and factor out active cursor detection
2021-05-15 12:05:00 -07:00
lethosor 59b023c71d
Ensure that command-prompt is dismissed after a command creates a new screen
Fixes #1803

Running a command that created a new screen would previously result in a screen
order that looked like this, due to how `Screen::Hide` works:

- DF screen
  - `command-prompt` screen (dismissed)
    - New screen

The `command-prompt` screen remained on the stack until the new screen was
dismissed, so it would intercept viewscreen vmethod calls intended for the
DF screen.

This change adds a new behavior to `Screen::Hide` that results in this screen
order after running a command:

- DF screen
  - New screen
    - `command-prompt` screen (dismissed) - DF removes this screen immediately
2021-03-21 20:42:50 -04:00
myk002 9e17bc938c
only set labor validity for the player civ 2021-02-17 09:16:49 -08:00
myk002 6819ee9928
make alchemist flag valid for controllable civs 2021-02-05 16:45:39 -08:00
myk002 32a0363f31
move identity check up a bit to avoid useless work 2021-01-24 08:57:56 -08:00
myk002 03719f58df
avoid infinite parentage when linking rooms 2021-01-24 08:52:34 -08:00
myk002 3ba984c22c
only reset extents if they are unusable
this allows callers of Buildings::setSize() to "pre-initialize" the
extents to declare non-rectangular structures. this allows quickfort to
create non-rectangular stockpiles, farm plots, zones, etc. the extents
are still reset as before if the size of the building doesn't match the
caller's expectations.

this commit also fixes a memory leak when setSize() allocates memory for
extents, but the memory is not deallocated if the building is ultimately
invalid for some reason.
2020-12-16 11:10:47 -08:00
lethosor 8cb38ecf5b
Merge remote-tracking branch 'myk002/myk_metalhead_mario' into develop 2020-11-13 14:04:30 -05:00
myk002 76e8c495fe
revert skip_vector=true for now 2020-11-13 10:45:53 -08:00
myk002 fa126af1fd
undo unnecessary edits 2020-11-12 22:49:06 -08:00
myk002 10616a387f
cleaner mask-based implementation 2020-11-12 22:44:38 -08:00
myk002 02a86d761a
identify bars as non_economic items
allows Job::isSuitableMaterial() to match metal bars as a building
material
2020-11-12 19:10:06 -08:00
lethosor 913d860ae4
Use initial working directory as process path on Linux, and expose to Lua 2020-11-12 19:07:51 -05:00
lethosor 23b230495e
Merge branch 'develop' into cwd-handling 2020-11-12 18:44:05 -05:00
lethosor 1d0e2dc6bc
Update extents handling to use building_extents_type 2020-11-03 14:56:16 -05:00
Myk Taylor 09fbaba726 buildingplan: support all building types
Allow buildingplan to handle all building types, update the docs, and add in little extra fixes to ensure all the new types work correctly.
2020-10-16 14:23:35 -07:00
Myk Taylor 82013c0c5e prep buildingplan for core algorithm changes
Lots of refactoring and reorganizing, with only cosmetic player-visible changes.

- show quickfort mode hotlkey label regardless of whether the current building type has buildingplan enabled. before, it was only shown after the user enabled buildingplan for the current building. this eliminates the extra step when enabling quickfort mode, which force-enables all building types.
- changed signature of lua-exported isPlannableBuilding to take subtype
  and custom type in addition to building type. this is only used by
  quickfort, and it already sends all three params in preparation for
  this change
- added lua-exported scheduleCycle(), which is like doCycle(), but only
  takes effect on the next non-paused frame. this lets quickfort
  run only one buildingplan cycle regardless of how many #build
  blueprints were run
- declared a few dfhack library methods and params const so buildingplan
  could call them from const methods
- converted buildingplan internal debug logging fn to have a printf api
- reshaped buildingplan-planner API and refactored implementation in
  preparation for upcoming core algorithm changes for supporing all
  building types (no externally-visible functionality changes)
  - changed df::building_type params to type, subtype, custom tuple keys
  - introduced capability to return multiple filters per building type
    (though the current buildings all only have one filter per)
- split monolith hook functions in buildingplan.cpp into one per scope.
  this significantly cleans up the code and preps the hooks to handle
  iterating through multiple item filters.
- got rid of send_key function and replaced with better reporting of
  whether keys have been handled
2020-10-16 13:52:23 -07:00
lethosor ce7772a1c2
Add Filesystem::restorecwd()
This allows restoring the working directory to its original value, which may not actually be the DF root. See #1671, dfhack/scripts#152
2020-10-14 21:22:53 -04:00
lethosor c9609ad590
Make `createitem inspect` consistent for PLANT_GROWTH items 2020-10-09 12:45:49 -04:00
Myk Taylor c73b1f03af buckets can be lye- and milk-free
otherwise the bucket for wells can never be matched
2020-09-29 00:23:44 -07:00
Myk Taylor e546d3eec3 rename is_civzone to the more general allow_wall 2020-08-15 20:13:48 -07:00