Commit Graph

2816 Commits (be881936f3a81e6d1a167292a997f6e18036c768)

Author SHA1 Message Date
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
lethosor b913076451 Update xml, stonesense, changelog
Merged DFHack/df-structures#296 and (modified) attached changelog
entry
2018-11-24 17:09:24 -05:00
lethosor 368f8d0504 Remove and replace checks for OnBreak 2018-11-24 14:52:26 -05:00
Kelly Kinkade 02f047e9f1 a pox on whitespace 2018-09-11 18:41:32 -05:00
Kelly Kinkade 3817773b5a eliminate stray whitespace 2018-09-11 17:32:33 -05:00
Ben Lubar 10267f3e70
Only save on the first frame of the save screen. 2018-08-26 19:11:41 -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 338572d270 resolve uninitialized variable warning 2018-08-16 12:15:56 -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 e56cb2a25a Update xml (setup_character_info.skill_points_remaining) 2018-08-04 00:59:15 -04: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
lethosor c53353fc28 Update changelog, xml 2018-07-20 23:29:24 -04:00
lethosor 163c9b4059 Add utils.OrderedTable, make test order consistent
Also added OrderedTable tests and comment support to expect.*()
2018-07-19 12:40:25 -04:00
lethosor 063602349c Add a basic test library and a couple GUI module tests (squashed)
Also modified Core/Console a bit to get this to actually produce output on
Travis (DFHACK_DISABLE_CONSOLE now allows console output, just not input)

Squashed merge from lethosor/tests
2018-07-18 14:29:13 -04:00
lethosor 3b44c18576 Followups for #1325
- Fix git tag detection
- Fix changelog entry position
- Update/clean up docs some
2018-07-17 00:58:49 -04:00
lethosor 1d6c3dc871 Merge remote-tracking branch 'suokko/fix_cmake_dependencies_to_generated_headers' into develop 2018-07-17 00:24:18 -04: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 699f864110 use dts::make_unique instead of new 2018-07-14 19:51:46 -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
lethosor 790d16cc1c Merge remote-tracking branch 'sgayda2/call_once' into develop 2018-07-14 21:08:15 -04:00
Stoyan Gaydarov 99d05117ab fix a return statement in FirstCall 2018-07-14 12:15:52 -07:00
lethosor c2a64b3573 Update changelog, xml, bump to r1 2018-07-13 21:16:35 -04:00
lethosor f85b2c2b3c Merge branch 'develop' of gh:dfhack/dfhack into develop 2018-07-13 20:00:52 -04:00
lethosor 78f2431c93 Update xml 2018-07-13 19:59:46 -04:00
Ben Lubar b44789285c
Fix Windows df-structures stubs failing to compile if the option to keep symbols is specified. 2018-07-13 15:49:37 -05:00
Pauli f02466de8a Correct codegen.pl output dependecies for VC
The change allows correct and optimized incremental builds with VC and
ninja but unix makefile backend will rebuild everything if anything
changes in structures.
2018-07-13 17:01:36 +03:00
Pauli bc8b8ef256 Use configure_file to optimize incremental builds for git-describe.h 2018-07-13 16:07:46 +03:00
Pauli c92b52537c Only run once codegen.pl and git-describe.cmake with make
ninja has a single build file which avoided issues if multiple targets
depend on same files. But Unix Makefiles generator user recursive make
which requires each ADD_CUSTOM_COMMAND to have only one target depending
on them.

Then makefile generator also has stupid rule that it touches all
secundary output files if primary file has been updated.

It was surprising hard to find a version that actually works correctly
for both issues. Solution is using BYPRODUCTS and refactoring command
and target dependencies.

As a bonus this change now allows build to work from source tarball if
the tarball includes git-describe.h.
2018-07-13 15:23:54 +03:00
Pauli fad9d58ac6 Keep git-describe.h in source tree
Temporary file goes to binary directory to avoid race between
simultanous builts.
2018-07-13 15:16:04 +03:00
Pauli 68d1dfa0da Keep make output short
Without custom comment add_custom_command would list all target files.
2018-07-13 15:15:42 +03:00
Pauli 3f34ea196b Fix build not to delete git-describe.h
make doesn't keep primary output file if secundary is missing.
always_rebuild must be primary output to make the phony command work
correctly.
2018-07-13 15:15:42 +03:00
Pauli 2956e654d4 Add dependency from codegen.pl to df/*.h 2018-07-13 15:15:42 +03:00
Pauli 5154370402 Add full paths to codegen.pl error messages
I noticed that relative paths were not correctly guessed by vim. I
decided to fix the paths to allow me quickly to jump to error line in
xml.
2018-07-13 15:15:42 +03:00
Pauli b3b23e8278 Add dependency from git-describe.h to DFHackVersion.cpp
Using add_custom_command allows cmake to track dependency from command
to git-describe.h that is implicit dependency of DFHackVersion.cpp.

The change also fixes issues if there is multiple build directories and
git-describe.h missing but git-dsecribe.h.tmp is present.
2018-07-13 15:15:39 +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 2d8be8f4ad Update xml (dlsym vtables, dfhack/df-structures#282) 2018-07-10 13:01:54 -04:00
lethosor fa8c6724f6 Merge remote-tracking branch 'suokko/dlsym_libgraphics' into develop 2018-07-10 12:25:11 -04:00
lethosor dd3c04eb26 Merge remote-tracking branch 'suokko/windows_crash_after_die' into develop 2018-07-10 11:57:10 -04:00
lethosor 06511340ab Merge remote-tracking branch 'BenLubar/proto-docs' into develop 2018-07-10 11:26:31 -04:00
Pauli 7d92d3f48f Fix the class vs struct warning 2018-07-10 18:24:34 +03:00
Pauli 5eea7198a9 Make Core::~Core safe to call after die
Fixes #1356
2018-07-10 18:24:34 +03:00
lethosor 4a842810d5 Update xml, changelog 2018-07-10 11:24:26 -04:00
Pauli ce6af3d649 Use c++ standard std::_Exit instead of _exit
_exit seems to run dll unloading code which calls static destructors.
Standrd requires std::_Exit not to call destructors which makes using it
attractive in case MSVC actually follows the standard.
2018-07-10 18:21:09 +03:00
Pauli 96c9b8b864 Add windows emulation for RTLD_DEFAULT
I'm not sure if calling GetModuleHandle in static construction is safe.
But I assumme it is and works correctly.

There is still potential issue that documentation can be understood
meaning that the HMODULE will resolve only symbols from exe while
RTLD_DEFAULT resolves all global symbols.
2018-07-10 17:10:30 +03: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 7fcc6be6f6 Update xml, changelog 2018-07-09 10:46:19 -04:00
Pauli ab179bbf42 Fix crash when editing lines that are exactly console width
plen+cooked_cursor==cols => begin = -1 which is passed to substr. The
sign is incorrect as code should be removing a character from begin
instead of trying to add a character.
2018-07-09 16:12:39 +03:00
Stoyan Gaydarov e96c6f07ce fixes from comments 2018-07-08 15:53:26 -07:00
Stoyan Gaydarov 68770ecbf2 Use std::call_once to ensure thread safety and a single call to initialize the SDL pointers 2018-07-08 12:52:06 -07:00
lethosor 5d16e5a74c Bump to 0.44.12-alpha1 2018-07-08 14:26:57 -04:00
lethosor 480907259c Rename ui_sidebar_menus.command_line field
Ref dfhack/df-structures#277
2018-07-07 23:51:20 -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
Pauli dec61b89be Fix windows ReadConsoleInput return value check
I messed up the check. I forgot that windows commonly has opposite
return values to posix and failed to check it from documentation.

Fixes 1345
2018-07-08 00:50:43 +03:00
lethosor aa76b92662 Merge remote-tracking branch 'suokko/main_thread_ownership_for_df_ai' into develop 2018-07-06 16:37:06 -04:00
lethosor c006df561e Merge remote-tracking branch 'suokko/lua_printall_recurse' into develop 2018-07-06 14:25:35 -04:00
lethosor be9affc8fb Update xml, changelog 2018-07-06 14:22:46 -04:00
lethosor dc6fd8d35c Merge remote-tracking branch 'suokko/stl_printf_remove_extra_null' into develop 2018-07-06 11:09:39 -04:00
lethosor 54cf8b7dc3 Fix getVisibleName for units with identities
As of 0.44.11 (possibly 0.44.01), identity names take precedence over the
associated histfig names. Tested with:

https://drive.google.com/file/d/1bX5CQMqNsb_mjJOEOS4wBm4mGDLLs_cZ/view (#1279)
http://dffd.bay12games.com/file.php?id=13428 (from http://www.bay12games.com/dwarves/mantisbt/view.php?id=10530)

Fixes #1279
2018-07-06 11:06:04 -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
Ben Lubar 6839fde555
Remove execute permission on files that are not executables. 2018-07-03 15:37:16 -05:00
Pauli 8a3a05de24 Allow unloading plugins that use std::regex 2018-07-03 15:23:46 +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 c449041c11 Merge remote-tracking branch 'suokko/lua_List_setChoices_internal_table_1171' into develop 2018-07-03 00:27:22 -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 ba1d3fcb6a Add dfhack.printall_recurse to quickly print df containers
I often want to see multiple items quickly when trying to figure out
what states actually matter to an issue that I debug. I decided to make
it easier to quickly dump df structures with substructures and
containers. It will generate large amount of data which can be sometimes
slow to process manually. But processing can be automated using
dfhack-run lua ^<df data to inspect> and pipe to other tools (eg grep,
sed, perl, sort, uniq etc)
2018-06-30 22:31:49 +03: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
Pauli 7a2245c2fa Remove null byte from string length
I noticed an extra null when trying to grep dfhack.run ls output.

std::string manages null byte at end(). Pre C++11 didn't require null
termination for std::string but C++11 add the null termination to make
c_str() and data() truely const. It is undefined behavior to modify the
internal null termination but this modification sets the null to null.
2018-06-30 12:51:38 +03:00
lethosor 1a4440859c Update xml (viewscreen_civlistst) 2018-06-29 22:33:15 -04: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
lethosor 3c2bfb6f47 Bump to 0.44.11-alpha1, update changelog, xml 2018-06-28 13:31:56 -04:00
lethosor f9dfb5907b Update submodules, authors 2018-06-27 13:57:34 -04:00
lethosor 19627b9221 Bump to 0.44.11 2018-06-24 17:42:31 -04:00
Pauli 20bd03ab6d Reset dsgn_check_cooldown in Block::write
To make sure that DF generates jobjs from desgination as soon as
possible the dsgn_check_cooldown should be reset when designations
change.
2018-06-24 17:06:32 +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