Merge branch 'develop' into allow-calling-blueprint-from-lua

develop
Daniel Brooks 2018-05-09 12:55:17 -07:00
commit b127522992
12 changed files with 47 additions and 11 deletions

@ -721,8 +721,8 @@ Replaces the DF stocks screen with an improved version.
.. _stocksettings:
.. _stockpiles:
stocksettings
=============
stockpiles
==========
Offers the following commands to save and load stockpile settings.
See `gui/stockpiles` for an in-game interface.

@ -37,6 +37,16 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
================================================================================
# Future
## New Scripts
- `devel/find-primitive`: Finds a primitive variable in memory
## Fixes
- `stockpiles`: stopped sidebar option from overlapping with `autodump`
-@ `autodump`, `automelt`, `autotrade`, `stocks`, `stockpiles`: fixed conflict with building renaming
## Internals
- Added ``Gui::inRenameBuilding()``
# 0.44.10-alpha1
## New Scripts

@ -1493,6 +1493,7 @@ static const LuaWrapper::FunctionReg dfhack_gui_module[] = {
WRAPM(Gui, resetDwarfmodeView),
WRAPM(Gui, revealInDwarfmodeMap),
WRAPM(Gui, refreshSidebar),
WRAPM(Gui, inRenameBuilding),
WRAPM(Gui, getDepthAt),
{ NULL, NULL }
};

@ -150,6 +150,8 @@ namespace DFHack
DFHACK_EXPORT bool revealInDwarfmodeMap(df::coord pos, bool center = false);
DFHACK_EXPORT bool refreshSidebar();
DFHACK_EXPORT bool inRenameBuilding();
DFHACK_EXPORT bool getViewCoords (int32_t &x, int32_t &y, int32_t &z);
DFHACK_EXPORT bool setViewCoords (const int32_t x, const int32_t y, const int32_t z);

@ -111,14 +111,16 @@ using namespace DFHack;
#include "df/world.h"
using namespace df::enums;
using df::global::gamemode;
using df::global::gps;
using df::global::gview;
using df::global::init;
using df::global::gps;
using df::global::ui;
using df::global::world;
using df::global::selection_rect;
using df::global::ui;
using df::global::ui_menu_width;
using df::global::gamemode;
using df::global::ui_sidebar_menus;
using df::global::world;
static df::layer_object_listst *getLayerList(df::viewscreen_layer *layer, int idx)
{
@ -1757,6 +1759,14 @@ bool Gui::refreshSidebar()
return false;
}
bool Gui::inRenameBuilding()
{
if (!ui_sidebar_menus)
return false;
return ui_sidebar_menus->barracks.in_rename;
}
bool Gui::getViewCoords (int32_t &x, int32_t &y, int32_t &z)
{
x = *df::global::window_x;

@ -181,6 +181,9 @@ struct dump_hook : public df::viewscreen_dwarfmodest
bool handleInput(set<df::interface_key> *input)
{
if (Gui::inRenameBuilding())
return false;
building_stockpilest *sp = get_selected_stockpile();
if (!sp)
return false;

@ -194,6 +194,9 @@ struct melt_hook : public df::viewscreen_dwarfmodest
bool handleInput(set<df::interface_key> *input)
{
if (Gui::inRenameBuilding())
return false;
building_stockpilest *sp = get_selected_stockpile();
if (!sp)
return false;

@ -389,6 +389,9 @@ struct trade_hook : public df::viewscreen_dwarfmodest
bool handleInput(set<df::interface_key> *input)
{
if (Gui::inRenameBuilding())
return false;
building_stockpilest *sp = get_selected_stockpile();
if (!sp)
return false;

@ -1,11 +1,9 @@
#include "buildingplan-lib.h"
#include "df/ui_sidebar_menus.h"
DFHACK_PLUGIN("buildingplan");
#define PLUGIN_VERSION 0.14
REQUIRE_GLOBAL(ui);
REQUIRE_GLOBAL(ui_build_selector);
REQUIRE_GLOBAL(ui_sidebar_menus);
REQUIRE_GLOBAL(world);
DFhackCExport command_result plugin_shutdown ( color_ostream &out )
@ -188,7 +186,7 @@ struct buildingplan_hook : public df::viewscreen_dwarfmodest
}
else if (isInNobleRoomQueryMode())
{
if (ui_sidebar_menus->barracks.in_rename)
if (Gui::inRenameBuilding())
return false;
auto np = getNoblePositionOfSelectedBuildingOwner();
df::interface_key last_token = get_string_key(input);

@ -376,6 +376,9 @@ struct stockpiles_import_hook : public df::viewscreen_dwarfmodest
bool handleInput ( set<df::interface_key> *input )
{
if ( Gui::inRenameBuilding() )
return false;
df::building_stockpilest *sp = get_selected_stockpile();
if ( !sp )
return false;
@ -406,7 +409,7 @@ struct stockpiles_import_hook : public df::viewscreen_dwarfmodest
auto dims = Gui::getDwarfmodeViewDims();
int left_margin = dims.menu_x1 + 1;
int x = left_margin;
int y = dims.y2 - 7;
int y = dims.y2 - 3;
int links = 0;
links += sp->links.give_to_pile.size();

@ -1451,6 +1451,9 @@ struct stocks_stockpile_hook : public df::viewscreen_dwarfmodest
bool handleInput(set<df::interface_key> *input)
{
if (Gui::inRenameBuilding())
return false;
df::building_stockpilest *sp = get_selected_stockpile();
if (!sp)
return false;

@ -1 +1 @@
Subproject commit a1cd002d60fdbf7b4c4bf833db41ec691746552b
Subproject commit 313655344562956f2c3a2c3d547ac04816730306