Commit Graph

898 Commits (9f8a477f09cc5d56f07656a4602c90b6008eb20c)

Author SHA1 Message Date
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
Myk Taylor ae872e812f properly detect valid tiles for civzones 2020-08-15 17:24:12 -07:00
lethosor 8c5b21b7ee
Fix a couple warnings in the Units module (#1615) 2020-08-08 14:35:12 -04:00
Ryan Bennitt 23c22b3b9d Merge branch 'develop' of https://github.com/DFHack/dfhack into feature/manipulator_goal 2020-08-07 22:17:32 +01:00
Ryan Bennitt a85b77e6f1 Retrieve goal string values from enum attributes and add new Units methods to Lua API and docs 2020-08-07 22:07:48 +01:00