Merge remote-tracking branch 'remotes/dfhack/develop' into auto_clothing

develop
JapaMala 2019-08-06 20:07:20 -05:00
commit e1661d8404
3 changed files with 14 additions and 14 deletions

@ -3,8 +3,6 @@
[![Build Status](https://travis-ci.org/DFHack/dfhack.svg?branch=develop)](https://travis-ci.org/DFHack/dfhack) [![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) [![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) [![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 DFHack is a Dwarf Fortress memory access library, distributed with scripts
and plugins implementing a wide variety of useful functions and tools. and plugins implementing a wide variety of useful functions and tools.

@ -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) FILE(GLOB GENERATE_INPUT_XMLS ${dfapi_SOURCE_DIR}/xml/df.*.xml)
set(CODEGEN_OUT ${dfapi_SOURCE_DIR}/include/df/codegen.out.xml) set(CODEGEN_OUT ${dfapi_SOURCE_DIR}/include/df/codegen.out.xml)
IF(NOT("${CMAKE_GENERATOR}" STREQUAL Ninja))
# use BYPRODUCTS instead under Ninja to avoid rebuilds
LIST(APPEND CODEGEN_OUT ${GENERATED_HDRS}) LIST(APPEND CODEGEN_OUT ${GENERATED_HDRS})
ENDIF()
ADD_CUSTOM_COMMAND( ADD_CUSTOM_COMMAND(
OUTPUT ${CODEGEN_OUT} OUTPUT ${CODEGEN_OUT}
BYPRODUCTS ${GENERATED_HDRS}
COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/xml/codegen.pl COMMAND ${PERL_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/xml/codegen.pl
${CMAKE_CURRENT_SOURCE_DIR}/xml ${CMAKE_CURRENT_SOURCE_DIR}/xml
${CMAKE_CURRENT_SOURCE_DIR}/include/df ${CMAKE_CURRENT_SOURCE_DIR}/include/df

@ -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 // 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) // (so we can clear the button down flag)
auto dims = Gui::getDwarfmodeViewDims(); auto dims = Gui::getDwarfmodeViewDims();
int right_bound = (dims.menu_x1 > 0) ? dims.menu_x1 - 2 : gps->dimx - 2; if (mx < 1 || mx > dims.map_x2 || my < 1 || my > dims.map_y2)
if (mx < 1 || mx > right_bound || my < 1 || my > gps->dimy - 2)
return false; return false;
if (ui->main.mode == df::ui_sidebar_mode::Zones || 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) if (mx < scroll_trigger_x)
sendKey(interface_key::CURSOR_LEFT_FAST); 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); sendKey(interface_key::CURSOR_RIGHT_FAST);
if (my < scroll_trigger_y) if (my < scroll_trigger_y)
sendKey(interface_key::CURSOR_UP_FAST); 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); sendKey(interface_key::CURSOR_DOWN_FAST);
} }
@ -572,12 +571,11 @@ struct mousequery_hook : public df::viewscreen_dwarfmodest
static decltype(enabler->clock) last_t = 0; static decltype(enabler->clock) last_t = 0;
auto dims = Gui::getDwarfmodeViewDims(); auto dims = Gui::getDwarfmodeViewDims();
auto right_margin = (dims.menu_x1 > 0) ? dims.menu_x1 : gps->dimx;
int32_t mx, my; int32_t mx, my;
auto mpos = get_mouse_pos(mx, my); auto mpos = get_mouse_pos(mx, my);
bool mpos_valid = mpos.x != -30000 && mpos.y != -30000 && mpos.z != -30000; 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; mpos_valid = false;
// Check if in lever binding mode // Check if in lever binding mode
@ -683,7 +681,7 @@ struct mousequery_hook : public df::viewscreen_dwarfmodest
return; return;
} }
if (mx > right_margin - scroll_buffer) if (mx > dims.map_x2 - scroll_buffer)
{ {
sendKey(interface_key::CURSOR_RIGHT); sendKey(interface_key::CURSOR_RIGHT);
return; return;
@ -695,7 +693,7 @@ struct mousequery_hook : public df::viewscreen_dwarfmodest
return; return;
} }
if (my > gps->dimy - scroll_buffer) if (my > dims.map_y2 - scroll_buffer)
{ {
sendKey(interface_key::CURSOR_DOWN); sendKey(interface_key::CURSOR_DOWN);
return; return;
@ -732,9 +730,9 @@ struct mousequery_hook : public df::viewscreen_dwarfmodest
if (shouldTrack()) if (shouldTrack())
{ {
if (delta_t <= scroll_delay && (mx < scroll_buffer || if (delta_t <= scroll_delay && (mx < scroll_buffer ||
mx > dims.menu_x1 - scroll_buffer || mx > dims.map_x2 - scroll_buffer ||
my < scroll_buffer || my < scroll_buffer ||
my > gps->dimy - scroll_buffer)) my > dims.map_y2 - scroll_buffer))
{ {
return; return;
} }