Commit Graph

1154 Commits (4e51e02924e2c2c183445f6f540856b3365c1c01)

Author SHA1 Message Date
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
Myk Taylor bda678bcd4 add some explanatory text to the top of the header 2020-08-11 19:47:04 -07:00
Myk Taylor 39ae2d95fc 2nd attempt to solve compilation errors on windows 2020-08-11 17:06:28 -07:00
Myk Taylor 4f88bb4c3d attempt to solve compilation error on windows 2020-08-11 16:54:53 -07:00
Myk Taylor 0bda289b17 move xlsxreader identity statics to dfhack lib 2020-08-11 14:51:17 -07:00
Myk Taylor a41f7c0998 convert XlsxReader module to xlsxreader plugin 2020-08-09 08:54:42 -07:00
Myk Taylor 18f4786458 Merge remote-tracking branch 'upstream/develop' into quickfort_xlsxio 2020-08-08 17:17:45 -07:00
Myk Taylor 89a6309788 build xlsxio and link it into dfhack, add lua api 2020-08-08 15: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 9510dd52e1 Add Goal to Manipulator Detail Modes 2020-08-04 23:01:28 +01:00
Myk Taylor e17d492203 address PR review comments on api docs 2020-07-23 21:55:05 -07:00
Myk Taylor 16cfd34678 recurs-ify default config copying logic
I refactored Filesystem::listdir_recursive to support removing the path
prefix from the returned files list. There are no current calls that
make use of the prefix parameter, so I converted it into a boolean.
Current usages will use the new default parameter and will not see any
changed behavior.
2020-07-18 22:22:37 -07:00
Myk Taylor bb91fdcf8c Merge remote-tracking branch 'upstream/develop' into blueprint_in_blueprints 2020-07-16 09:24:52 -07:00
Myk Taylor c19fc1f349 gcc-4.8 compatibility 2020-07-15 21:35:21 -07:00
lethosor a44a2e2298 Merge branch 'develop' into lua-ref-target 2020-07-14 01:31:23 -04:00
Ben Lubar f20446534b
fix DfOtherVectors computed size 2020-05-14 14:01:12 -05:00
Ben Lubar 6c20fe4c80
implement df-other-vectors-type for lua 2020-05-09 18:28:40 -05:00
Ben Lubar 7cf9624de9
add assert to make sure other_id array index is in bounds 2020-05-09 18:28:40 -05:00
Ben Lubar fc10ed3df6
Implementation for df-other-vectors-type in C++. Still needs Lua and Ruby support. 2020-05-09 18:28:40 -05:00
lethosor 9e085b66ac Merge branch 'develop' into lua-ref-target 2020-04-27 23:24:29 -04:00
lethosor 7c1d1c43e5 Merge remote-tracking branch 'PatrikLundell/stocks' into develop
Conflicts:
	docs/changelog.txt
2020-04-25 21:12:27 -04:00
lethosor 125f4b129b Add ref_target attribute to primitive field references 2020-04-09 00:02:07 -04:00
Ben Lubar 6b810b97a0
DataDefs.h can have little a documentation 2020-04-07 13:46:44 -05:00
Ben Lubar b29d009b14
update structures; implement struct_field_info_extra 2020-03-21 13:21:35 -05:00
Ben Lubar ffb3c29cfc
simplify Graphic module. update structures.
it appears that all this added complexity including an extra pointer dereference was to avoid including the vector header.
2020-03-08 00:12:48 -06:00
Ben Lubar a214e00407
allow union vectors to have tags that are bit vectors if they have exactly 2 members 2020-03-06 16:48:33 -06:00
Ben Lubar fa574cfbec
allow dfhack-run to output colors.
refactor Console-posix to avoid having a parameter equivalent to not calling the function at all.
2020-03-06 15:02:03 -06:00
Ben Lubar 84cae060b1
move find_union_tag from check-structures-sanity to DataDefs.h 2020-03-04 18:23:49 -06:00
Ben Lubar 18523a1821
Convert untagged unions to tagged. Fix some edge cases in check-structures-sanity union checking. 2020-02-29 15:08:39 -06:00
Ben Lubar 94e818fd53
reference union_identity in the df namespace 2020-02-29 13:26:42 -06:00
Ben Lubar 3ddbb5cec1
fix typo 2020-02-29 13:24:12 -06:00
Ben Lubar a30678cee3
subclass struct_identity for unions 2020-02-29 13:11:23 -06:00
Ben Lubar 0d36e62d81
fix some weird uses of the part of speech enum 2020-02-18 16:39:39 -06:00
Ben Lubar 9caf6e97e6
add -enums, -sizes, and specific starting point flags to check-structures-sanity 2020-02-14 19:47:26 -06:00
Ben Lubar 0243e422e5
Allow plugins to define subclasses of dfhack_viewscreen that have their own virtual_identity. 2020-02-07 16:00:14 -06:00
Ben Lubar 321d948f8d
Fix crash on missing symbols.
Fixes #1487.
2020-02-03 20:21:10 -06:00
PatrikLundell 121497a466 Propagated getBookTitle to Lua 2020-01-26 11:47:47 +01:00
PatrikLundell 876ac6c056 Renamed to getBookTitle, cut down on virtual_cast 2020-01-25 21:46:10 +01:00
PatrikLundell c6bbf39c6c Issue #1262. Added Items::getTitle and used in stocks 2020-01-25 12:43:02 +01:00
lethosor 5eca50476e Merge remote-tracking branch 'nornagon/unit-description' into develop 2020-01-13 23:31:23 -05:00
Jeremy Apthorp 50e696acf6 getDescription => getPhysicalDescription 2019-12-14 09:36:47 -08:00
Jeremy Apthorp 7fce6fe0b0 move THISCALL define to header, clean up code a little 2019-12-13 23:54:27 -08:00
Jeremy Apthorp 910f965838 wip 2019-12-07 22:17:59 -08:00
lethosor ca7d0f1cac Add algorithm include for MSVC 2019-10-03 23:26:57 -04:00
lethosor f3658db85f Merge branch 'develop' into avoid_rebuilding_df_statics_if_core_h_changes 2019-10-03 23:23:36 -04:00
lethosor 07575095fd Merge branch 'develop' into persist 2019-08-22 22:00:50 -04:00
lethosor 99038c395a Merge remote-tracking branch 'ab9rf/biometype' into develop 2019-07-20 16:32:46 -04:00
Pauli 49f3de979f Make ServerMain and ServerConnection data race free
RemoteServer and PluginManager side would need complete redesign to be
data race free and concurrent. But as that would be unlikely to be
required from DFHack I decided simpler solution that is fixing data
ownership to a thread and all ServerConnection share a single lock which
allows access to PluginManager and Core.
2019-07-18 23:05:11 -04:00
Pauli 0605b9601c Make Core::started thread safe 2019-07-18 23:05:11 -04:00
lethosor 5b11d14c6c Rename save/load to "save data"/"load data" 2019-05-29 19:52:03 -04:00
lethosor ceebef5fe2 Merge branch 'develop' into persist 2019-05-28 21:08:16 -04:00
Pauli f0632347d0 Remove Core.h include from DataDefs.h
Core.h isn't required for DataDefs.h which removes Core.h dependency
from DataStatics*.
2018-12-30 17:08:42 -05:00
lethosor a2f8742128 Merge remote-tracking branch 'suokko/runtime_debug_prints' into develop
Also fix and reorganize changelog
2018-12-27 16:28:25 -05:00
lethosor 13c6bfc1b2 Merge remote-tracking branch 'sgayda2/memory_fixes' into develop 2018-12-22 11:54:31 -05:00
Ben Lubar a672ffcb95
Use viewscreen_savegamest instead of viewscreen_optionst 2018-08-26 19:05:44 -05:00
Ben Lubar 4e690df96a
Add Persistence module.
Alter World to use Persistence instead of storing data in historical figures.

Fake historical figures will be converted to the new format when a world is loaded.

Added plugin_save and plugin_load functions to the plugin API.

Made the weird int7/int28 code that was in the old persistence API slightly safer.
2018-08-26 18:27:58 -05:00
Kelly Kinkade 59d70d6687 Add function to infer biome type to Maps module
This moves code intended to infer biome type currently living in a
couple of plugins into the Maps module, so that this code can be shared
more easily by multiple plugins, as discussed in #1392.
2018-08-15 20:28:18 -05:00
Lethosor 9bd5ecd738
Merge pull request #1372 from BenLubar/dfhack-viewscreen-identity
Add an identity to dfhack_viewscreen and dfhack_lua_viewscreen.
2018-07-26 16:06:24 -04:00
Ben Lubar 4837e65322
Add an identity to dfhack_viewscreen and dfhack_lua_viewscreen. 2018-07-22 17:31:39 -05:00
Stoyan Gaydarov 38cccdb0f4 Update the module create calls to return unique_ptrs 2018-07-14 19:55:25 -07:00
Stoyan Gaydarov 6f90273bb6 More usage of smart pointers throughout core and version info. 2018-07-14 19:55:25 -07:00
Stoyan Gaydarov 6cfd987c0d Remove an outdated comment, with c++11 enabled the code is thread safe 2018-07-14 19:51:46 -07:00
Stoyan Gaydarov 12c8046f90 Some memory management changes for Core 2018-07-14 19:51:46 -07:00
Stoyan Gaydarov b5ddde8475 Use a shared_ptr to avoid having to manage VersionInfo vector memory 2018-07-14 19:51:46 -07:00
Stoyan Gaydarov c127ceab96 Use a unique_ptr for VersionInfo to avoid worrying about memory 2018-07-14 19:51:46 -07:00
Pauli bc8b8ef256 Use configure_file to optimize incremental builds for git-describe.h 2018-07-13 16:07:46 +03:00
lethosor 9ee368d456 Merge remote-tracking branch 'suokko/MapCache_reduce_latency_from_designation_to_jobs' into develop 2018-07-11 11:51:24 -04:00
lethosor 7afa3690bf Add support for DFHACK_BUILD_ID
Used for BuildMaster builds, for example
2018-07-11 11:47:55 -04:00
lethosor fa8c6724f6 Merge remote-tracking branch 'suokko/dlsym_libgraphics' into develop 2018-07-10 12:25:11 -04:00
lethosor 06511340ab Merge remote-tracking branch 'BenLubar/proto-docs' into develop 2018-07-10 11:26:31 -04:00
Pauli ca5c11603f Support dlsym loading from libgraphics vtables 2018-07-10 17:08:23 +03:00
lethosor 2dac3c53c7 Add stress cutoffs to Units module, fix dwarfmonitor/manipulator
Fixes #1292
2018-07-09 15:59:12 -04:00
lethosor 46e53fc3b3 Make df2console only call df2utf if the output stream is a console
Fixes output in command-prompt, for example
2018-07-09 11:00:28 -04:00
lethosor 03b01048d7 Merge remote-tracking branch 'BenLubar/linked-list' into develop 2018-07-07 23:49:53 -04:00
lethosor 037e7e4901 Merge remote-tracking branch 'suokko/spotclean_ui_state_fix_1194' into develop
Moved/adjusted changelog entry
2018-07-07 18:08:53 -04:00
lethosor aa76b92662 Merge remote-tracking branch 'suokko/main_thread_ownership_for_df_ai' into develop 2018-07-06 16:37:06 -04:00
Ben Lubar 3b6a0738a0
Add check-rpc.py for Travis. 2018-07-04 15:32:06 -05:00
Pauli d1a3f1a738 Allow canceling lineedit with ctrl+c 2018-07-04 15:21:25 +03:00
Pauli a550e112c3 Allow temporary transfer of main logic thread ownership
Dependency to fix df-ai to work with the new CoreSuspender
2018-07-04 00:02:03 +03:00
Ben Lubar dabe04cbf1
Rename bind argument proto -> plugin to avoid confusion. 2018-07-03 16:00:48 -05:00
Pauli 320e94a1eb Avoid locking CoreSuspender second time in main thread 2018-07-04 00:00:06 +03:00
Pauli ee999ccbdf Implement runtime debug print filtering
The runtime debug print filtering support dynamic debug print selection.
Tis patch only implements basic core support for filtering. The commands
to change the runtime filtering settings will be added in a following
patch.

But even with only this one can change filtering settings by editing
memory using a debugger. It can even be automated by using gdb break
point commands.
2018-07-03 15:23:46 +03:00
lethosor 616675f0ce Merge remote-tracking branch 'suokko/kittens_data_race_fix' into develop 2018-07-03 00:30:36 -04:00
lethosor c543a17250 Improve RPC port handling
- Use port from remote-server.json in dfhack-run
- Make DFHACK_RUN environment variable take priority over remote-server.json
- Log current port to stderr
2018-07-02 23:53:56 -04:00
lethosor 81a7ddcf92 Merge remote-tracking branch 'suokko/screen_show_memory_leak' into develop 2018-07-02 22:58:11 -04:00
lethosor f0ff96f614 Merge remote-tracking branch 'suokko/multibyte_console' into develop 2018-07-02 10:55:03 -04:00
Ben Lubar b5eb541fd3
Handle pointers back to the list link. 2018-06-30 23:04:27 -05:00
Ben Lubar 1606483e7e
perf improvement for DfLinkedList::end(), erase/insert/insert_after/push_front implementations 2018-06-30 23:04:26 -05:00
Ben Lubar 0b9d46712f
Run DfLinkedList::end's computations only when needed. 2018-06-30 23:04:26 -05:00
Ben Lubar 31d22967f8
Linked list 2018-06-30 23:04:26 -05:00
Pauli 645ec0d591 Improve kittens thread safety and shutdown with core
The bools could use acquire&release memory order or even relaxed but I
didn't think code was worth auditing for such low level optimizations.
Sequantial consistent is fast enough but much harder to use incorrectly.

The timeLast is protected by CoreSuspender lock. plugin_update is only
called when CoreSuspender lock is held.

The last_menu is protected by trackmenu_flg loads and stores.
2018-06-30 21:53:12 +03:00
Pauli 0727403ac1 Fix devel plugins linking in linux 2018-06-30 21:12:42 +03:00
lethosor 105ddd86d8 Merge remote-tracking branch 'suokko/jsoncpp_upgrade_to_submodule' into develop 2018-06-29 22:33:00 -04:00
Pauli c39a882b57 Add missing Unit::isDiplomat
Fixes #1324
2018-06-29 16:19:18 +03:00
Pauli 123de7fdf7 Use constexpr to prevent attempts of linking static variable 2018-06-24 17:06:32 +03:00
Pauli f6b0ac7819 Refactor CoreSuspender to fix Console::lineedit exit hangs
The old CoreSuspender requires processing from Core::Update to allow
commands execute. But that causes issues if Core::Shutdown wants
quarentee cleanup order with std:🧵:join. Fixing shutdown ordering
adds too many branches to already fairly complex code.

I decided to try to refactor CoreSuspender to use simpler locking
locking using a std::recusive_muted as primary synchronization
primitive.
To help control when Core::Update unlocks the primary mutex there is
std::contition_variable_any and std::atomic<size_t> queue lenght
counter.
The last state variable is std::atomic<std:🧵:id> that is used to
keep track of owner thread for Core::IsSuspended query.

This should be merged only just after a release to make sure that it
gets maximum testing in develop branch before next release.

Fixes #1066
2018-06-22 17:57:37 +03:00
Pauli 0bc1db4f07 Make sure hotkeythread exits before cleanup 2018-06-22 17:57:37 +03:00
Pauli 1acb60daa2 Prevent data races during console/init thread shutdown
There is a minor chance that console or init thread would access already
freed memory when core is shutting down and cleaning up state. To avoid
any danger of having random bugs caused by the potential data race I
decided to make sure the shutdown code waits for the thread to exit
first.

Windows change is completely untested. It is purely based on msdn
documentation.
2018-06-22 17:57:37 +03:00
Pauli 19a169ba65 Convert Core.cpp to use c++11 thread
I noticed that tthread is missing some c++11 features that make thread
handling code a bit easier. To be able to use those features I decided
to convert Core.cpp to use equivalent standard classes.

This patch has no functional changes.
2018-06-22 17:57:37 +03:00
lethosor 854f467f56 Merge remote-tracking branch 'suokko/check_jobs_on_mapcache_commit_1229' into develop 2018-06-21 15:03:51 -04:00
Pauli 9b6781f0f2 Temporary lower command-prompt when executing the command
command-prompt viewscreen may affect command execution if they are
looking for UI state. To make commands execute simillary to hotkeys or
console commands the viewscreen needs to removed from the top position.

Fixes #1194
2018-06-20 21:51:45 +03:00
lethosor 6077a8ce4c Merge remote-tracking branch 'suokko/printf_warnings' into develop 2018-06-20 11:25:14 -04:00
Pauli 9c59b7ff48 Fix unlikely memory leaks if Screen::show fails
The Screen::show takes ownership of the screen pointer. I decided to
switch the parameter to std::unique_ptr to make the pointer ownership
explicit. The unique_ptr then provides automatic screen destruction in
Screen::show unless pointer is inserted or is already in the linked list
that is managed by df.
2018-06-19 16:41:31 +03:00
Pauli 1b5ec7ce69 Update jobs when committing MapCache changes
The map_block->designation.{dig,smooth} are reset to zeros when a job
posting is created for the designation. The job is then used to override
the designation state in the map_block. To make the new designation set
propogate to jobs the job structure would require updating. The update
would be possible a complex operation. The simple alternative is to
remove the job and let df create a new job in the next tick.

Fixes #1229
2018-06-18 16:34:09 +03:00
Pauli 6a151353e3 Use automatic return type for index_tile 2018-06-18 16:23:57 +03:00
Pauli 0bc2b3ab1b Update toSimpleString to use a the new builder API 2018-06-14 21:20:54 +03:00
Pauli 2b79b4cce7 Use jsoncpp 1.8.4 as a submodule
This makes jsoncpp a submodule that can be build directly from git
sources. This changes depends/jsoncpp to depends/jsoncpp-sub to avoid
filename conflict if someone tries to use git bisect.

jsoncpp library name changes to jsoncpp_lib_static.

jsoncpp version is the latest tagged release.
2018-06-14 21:20:46 +03:00
lethosor 10e6016989 Merge branch 'units_dead' into develop
Closes #1297
2018-06-13 15:38:35 -04:00
PatrikLundell f329774059 dead & killed flag separation
squashed 4 commits from #1297
2018-06-13 15:37:45 -04:00
Pauli 8484b5dc8a Add parameter type checks to printf style functions
gcc supports type checks for printf parameters which can catch some hard
to reproduce bugs. Possible bugs happen when the parameter value is
intepreted differently to the variable value.

Example warnings follow
../library/LuaWrapper.cpp:1011:86: warning: format ‘%llu’ expects argument
    of type ‘long long unsigned int’, but argument 3 has type ‘uint64_t
    {aka long unsigned int}’ [-Wformat=]
../plugins/follow.cpp:159:35: warning: format not a string literal and no
    format arguments [-Wformat-security]
2018-06-11 19:27:35 +03:00
lethosor 03968db344 Fix GCC warnings in 'tweak kitchen-prefs-all' and dev plugins 2018-06-01 10:02:38 -04:00
lethosor 7a04fefb0b Remove Vermin module (unused and obsolete) 2018-06-01 00:22:10 -04:00
lethosor 17ba492992 Add some exclusion functions to Kitchen module, expose to Lua, fix build 2018-05-17 19:34:03 -04:00
lethosor 97a79893e7 Change Kitchen.{h,cpp} to title case 2018-05-17 11:08:13 -04:00
lethosor e9ec08f419 Add Buildings::getRoomDescription(), moved from search plugin, +cleanup 2018-05-12 17:00:21 -04:00
lethosor c15571caa0 Move isRouteVehicle, isSquadEquipment from workflow to Items module 2018-05-12 14:49:30 -04:00
lethosor a34b34d3cb Move a few item functions from autotrade/stocks into DFHack::Items 2018-05-12 12:04:46 -04:00
lethosor 272cdcb2b5 Add function names to NullPointer and InvalidArgument exceptions 2018-05-11 09:49:27 -04:00
lethosor 2a52582c1f Add Gui::inRenameBuilding 2018-05-09 10:23:05 -04:00
lethosor a708b0b303 Add some includes in DataDefs.h 2018-04-19 21:11:43 -04:00
lethosor 2bf9632000 Merge remote-tracking branch 'origin/develop' into complex-enum 2018-04-11 10:23:32 -04:00
lethosor 61539bf345 Lua: implement key lookup and ipairs for complex enums 2018-04-09 11:04:37 -04:00
lethosor ae6b8a16e8 Handle most complex enum metadata on the C++ side 2018-04-09 03:00:58 -04:00
Ben Lubar 9cbba0ae01
Hide warnings about non-virtual destructors from df-structures. 2018-04-05 14:46:28 -05:00
lethosor eb22d5c38e Add ABI version symbol to plugins 2018-03-10 16:55:00 -05:00
lethosor f2ff609e1c Initial 0.44.06 support, update xml 2018-03-10 16:18:15 -05:00
lethosor 8779168c96 DFHACK_PLUGIN: qualify Plugin 2018-02-16 02:17:58 -05:00
Japa 7b19c9b8f0 Merge remote-tracking branch 'remotes/DFHack/develop' into RemoteServerUnsafe
# Conflicts:
#	plugins/proto/RemoteFortressReader.proto
#	plugins/remotefortressreader/remotefortressreader.cpp
#	scripts
2018-02-12 20:19:40 +05:30
Ben Lubar 7426f08504
Fix Error.cpp compile for Windows 2018-02-07 10:40:52 -06:00
lethosor c1e2633e17 Refactor DFHack exception classes
Move implementations out of MiscUtils.cpp to Error.cpp and make what() return a
more useful description
2018-02-05 19:18:35 -05:00
lethosor 1ba5477b63 Add designation priority support to MapCache and dig plugin
Fixes #481
2018-01-21 19:27:16 -05:00
lethosor 0332a5c25a Replace a call to abort() with a VTableMissing exception
This makes some scripts crash less when the viewscreen vtable is unavailable,
for example.
2017-12-25 20:13:15 -05:00
Quietust 4edc7a6f43
update DataFuncs to support vmethods with 12-13 parameters (#1192) 2017-12-02 21:41:44 -06:00
Japa Mala Illo a0634f9ee0 Merge remote-tracking branch 'DFHack/develop' into RemoteServerUnsafe 2017-11-25 11:50:56 +05:30
lethosor 2c95ac411e Update xml and all uses of job_handler 2017-11-25 00:59:59 -05:00
Japa Illo 3c5483df03 Change tabs to spaces to satisfy travis. 2017-10-04 09:48:12 +05:30
Japa 8dffd48f70 Add a flag for functions considered safe for a remote computer to call. 2017-10-02 19:55:16 +05:30
Ben Lubar 17a7885ef2
Fix a bunch of 64-bit Windows warnings 2017-07-21 13:30:05 -05:00
lethosor 10e13c532a Add "tweak cage-butcher" and some extra Building module functions
* Buildings::markedForRemoval()
* Buildings::getCageOccupants()

Closes #906
2017-06-25 15:27:21 -04:00
lethosor ae809afde7 Add Gui::refreshSidebar()
This handles feeding CURSOR_DOWN_Z and CURSOR_UP_Z properly, avoiding issues
when on the lowest z-level.
2017-06-23 00:02:21 -04:00
lethosor 0796fafb2a Add new built-in "alias" command
Closes #701
2017-06-19 00:15:20 -04:00
lethosor 27343e3253 Add unit and tile visibility functions 2017-06-10 21:54:08 -04:00
lethosor 778ffb0971 More Units module cleanup, modernize getUnitsInBox 2017-06-10 21:02:30 -04:00
lethosor 1321a64613 Remove lots of old/unused functions from the Units module 2017-06-10 17:21:34 -04:00
lethosor ba68683964 Fix ncurses wgetch() on OS X
Ref #731
2017-06-08 13:05:31 -04:00
lethosor 43c4a88068 Move some checks in paintTile/readTile after hooks are called 2017-06-02 00:40:14 -04:00
lethosor 05f322ca30 Merge remote-tracking branch 'lethosor/lua-dmdims' into develop 2017-06-01 23:34:35 -04:00
lethosor 939aff3231 readTile(): add hook support and map parameter 2017-05-31 12:12:15 -04:00
lethosor 55931703ac Designate the correct tile for trees with multi-tile trunks
DF always designates the southeast trunk tile, while plant.pos is the center,
which is sometimes inaccessible (see #1014)
2017-05-05 21:25:25 -04:00