From dd9c433f17bbeab7415ad8e7c5c75d24c88ea025 Mon Sep 17 00:00:00 2001 From: lethosor Date: Mon, 13 May 2019 19:38:24 -0400 Subject: [PATCH 1/4] Use BYPRODUCTS to keep ninja builds from re-running codegen every time This partially reverts f02466de8a783be0c5c06f42485a42f5266693aa, but behavior should be the same under MSVC, which that commit attempted to fix. From https://cmake.org/cmake/help/v3.14/command/add_custom_command.html: > The `BYPRODUCTS` option is ignored on non-Ninja generators except to mark > byproducts `GENERATED`. Since `$GENERATED_HDRS` are already marked generated, this change should have no effect on non-Ninja generators. --- library/CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index a9255ae00..d64b7429f 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -264,10 +264,14 @@ FILE(GLOB GENERATE_INPUT_SCRIPTS ${dfapi_SOURCE_DIR}/xml/*.pm ${dfapi_SOURCE_DIR FILE(GLOB GENERATE_INPUT_XMLS ${dfapi_SOURCE_DIR}/xml/df.*.xml) set(CODEGEN_OUT ${dfapi_SOURCE_DIR}/include/df/codegen.out.xml) -LIST(APPEND CODEGEN_OUT ${GENERATED_HDRS}) +IF(NOT("${CMAKE_GENERATOR}" STREQUAL Ninja)) + # use BYPRODUCTS instead under Ninja to avoid rebuilds + LIST(APPEND CODEGEN_OUT ${GENERATED_HDRS}) +ENDIF() ADD_CUSTOM_COMMAND( OUTPUT ${CODEGEN_OUT} + BYPRODUCTS ${GENERATED_HDRS} COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/xml/codegen.pl ${CMAKE_CURRENT_SOURCE_DIR}/xml ${CMAKE_CURRENT_SOURCE_DIR}/include/df From c3b06b81c7b672b0c9fb56a19a6b845d082f28e5 Mon Sep 17 00:00:00 2001 From: lethosor Date: Thu, 16 May 2019 23:22:11 -0400 Subject: [PATCH 2/4] mousequery: use map dimensions to determine edge scrolling locations TWBT modifies the map dimensions, so using the window dimensions to handle edge scrolling produces the wrong behavior when using a larger map tileset than text tileset. --- plugins/mousequery.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/mousequery.cpp b/plugins/mousequery.cpp index 5aab0b584..fb6c1e4c5 100644 --- a/plugins/mousequery.cpp +++ b/plugins/mousequery.cpp @@ -572,12 +572,11 @@ struct mousequery_hook : public df::viewscreen_dwarfmodest static decltype(enabler->clock) last_t = 0; auto dims = Gui::getDwarfmodeViewDims(); - auto right_margin = (dims.menu_x1 > 0) ? dims.menu_x1 : gps->dimx; int32_t mx, my; auto mpos = get_mouse_pos(mx, my); bool mpos_valid = mpos.x != -30000 && mpos.y != -30000 && mpos.z != -30000; - if (mx < 1 || mx > right_margin - 2 || my < 1 || my > gps->dimy - 2) + if (mx < 1 || mx > dims.map_x2 || my < 1 || my > dims.map_y2) mpos_valid = false; // Check if in lever binding mode @@ -683,7 +682,7 @@ struct mousequery_hook : public df::viewscreen_dwarfmodest return; } - if (mx > right_margin - scroll_buffer) + if (mx > dims.map_x2 - scroll_buffer) { sendKey(interface_key::CURSOR_RIGHT); return; @@ -695,7 +694,7 @@ struct mousequery_hook : public df::viewscreen_dwarfmodest return; } - if (my > gps->dimy - scroll_buffer) + if (my > dims.map_y2 - scroll_buffer) { sendKey(interface_key::CURSOR_DOWN); return; From 92717a7f71335b4b17c54bab034a3da861957b94 Mon Sep 17 00:00:00 2001 From: lethosor Date: Thu, 16 May 2019 23:30:03 -0400 Subject: [PATCH 3/4] mousequery: Fix some more instances of map boundary checks --- plugins/mousequery.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/plugins/mousequery.cpp b/plugins/mousequery.cpp index fb6c1e4c5..618252ad3 100644 --- a/plugins/mousequery.cpp +++ b/plugins/mousequery.cpp @@ -369,8 +369,7 @@ struct mousequery_hook : public df::viewscreen_dwarfmodest // Can't check limits earlier as we must be sure we are in query or default mode // (so we can clear the button down flag) auto dims = Gui::getDwarfmodeViewDims(); - int right_bound = (dims.menu_x1 > 0) ? dims.menu_x1 - 2 : gps->dimx - 2; - if (mx < 1 || mx > right_bound || my < 1 || my > gps->dimy - 2) + if (mx < 1 || mx > dims.map_x2 || my < 1 || my > dims.map_y2) return false; if (ui->main.mode == df::ui_sidebar_mode::Zones || @@ -435,13 +434,13 @@ struct mousequery_hook : public df::viewscreen_dwarfmodest if (mx < scroll_trigger_x) sendKey(interface_key::CURSOR_LEFT_FAST); - if (mx > ((dims.menu_x1 > 0) ? dims.menu_x1 : gps->dimx) - scroll_trigger_x) + if (mx > dims.map_x2 - scroll_trigger_x) sendKey(interface_key::CURSOR_RIGHT_FAST); if (my < scroll_trigger_y) sendKey(interface_key::CURSOR_UP_FAST); - if (my > gps->dimy - scroll_trigger_y) + if (my > dims.map_y2 - scroll_trigger_y) sendKey(interface_key::CURSOR_DOWN_FAST); } @@ -731,9 +730,9 @@ struct mousequery_hook : public df::viewscreen_dwarfmodest if (shouldTrack()) { if (delta_t <= scroll_delay && (mx < scroll_buffer || - mx > dims.menu_x1 - scroll_buffer || + mx > dims.map_x2 - scroll_buffer || my < scroll_buffer || - my > gps->dimy - scroll_buffer)) + my > dims.map_y2 - scroll_buffer)) { return; } From 195db1bad9697f75672838127ad435112ee72491 Mon Sep 17 00:00:00 2001 From: lethosor Date: Tue, 21 May 2019 20:22:49 -0400 Subject: [PATCH 4/4] Remove issue and PR badges from README.md githubbadges.herokuapp.com has been down for some time, and these badges repeated information that was already visible on https://github.com/dfhack/dfhack (and they weren't included in the generated docs either). --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index 9ea1ccb04..fd95e1e5e 100644 --- a/README.md +++ b/README.md @@ -3,15 +3,13 @@ [![Build Status](https://travis-ci.org/DFHack/dfhack.svg?branch=develop)](https://travis-ci.org/DFHack/dfhack) [![Documentation Status](https://readthedocs.org/projects/dfhack/badge)](https://dfhack.readthedocs.org) [![License](https://img.shields.io/badge/license-ZLib-blue.svg)](https://en.wikipedia.org/wiki/Zlib_License) -[![Github Issues](http://githubbadges.herokuapp.com/DFHack/dfhack/issues)](https://github.com/DFHack/dfhack/issues) -[![Open Pulls](http://githubbadges.herokuapp.com/DFHack/dfhack/pulls)](https://github.com/DFHack/dfhack/pulls) DFHack is a Dwarf Fortress memory access library, distributed with scripts and plugins implementing a wide variety of useful functions and tools. The full documentation [is available online here](https://dfhack.readthedocs.org), from the README.html page in the DFHack distribution, or as raw text in the `./docs` folder. -If you're an end-user, modder, or interested in contributing to DFHack - +If you're an end-user, modder, or interested in contributing to DFHack - go read those docs. If that's unclear or you need more help, try