Merge remote-tracking branch 'DFHack/develop' into remote_control

# Conflicts:
#	scripts
develop
Japa 2018-01-19 22:11:48 +05:30
commit 7439f7fba7
11 changed files with 156 additions and 116 deletions

@ -140,7 +140,7 @@ if (NOT EXISTS ${dfhack_SOURCE_DIR}/library/xml/codegen.pl OR NOT EXISTS ${dfhac
endif() endif()
# set up versioning. # set up versioning.
set(DF_VERSION "0.44.04") set(DF_VERSION "0.44.05")
set(DFHACK_RELEASE "alpha1") set(DFHACK_RELEASE "alpha1")
set(DFHACK_PRERELEASE TRUE) set(DFHACK_PRERELEASE TRUE)

@ -49,6 +49,7 @@ Fixes
----- -----
- Fixed issues with the console output color affecting the prompt on Windows - Fixed issues with the console output color affecting the prompt on Windows
- `createitem`: stopped items from teleporting away in some forts - `createitem`: stopped items from teleporting away in some forts
- `devel/inject-raws`: now recognizes spaces in reaction names
- `gui/gm-unit`: can now edit mining skill - `gui/gm-unit`: can now edit mining skill
- `gui/quickcmd`: stopped error from adding too many commands - `gui/quickcmd`: stopped error from adding too many commands
@ -63,6 +64,7 @@ Misc Improvements
- `gui/gm-editor`: added enum names to enum edit dialogs - `gui/gm-editor`: added enum names to enum edit dialogs
- `gui/gm-unit`: made skill search case-insensitive - `gui/gm-unit`: made skill search case-insensitive
- `gui/liquids`: added more keybindings: 0-7 to change liquid level, P/B to cycle backwards
- `gui/pathable`: added tile types to sidebar - `gui/pathable`: added tile types to sidebar
- `gui/rename`: added "clear" and "special characters" options - `gui/rename`: added "clear" and "special characters" options
- `modtools/skill-change`: - `modtools/skill-change`:

@ -207,7 +207,6 @@ tweak civ-view-agreement
tweak eggs-fertile tweak eggs-fertile
tweak fps-min tweak fps-min
tweak hide-priority tweak hide-priority
tweak kitchen-keys
tweak kitchen-prefs-empty tweak kitchen-prefs-empty
tweak max-wheelbarrow tweak max-wheelbarrow
tweak shift-8-scroll tweak shift-8-scroll

@ -37,9 +37,25 @@ Development Changelog
.. contents:: .. contents::
:depth: 2 :depth: 2
DFHack 0.44.05-alpha1
=====================
Structures
----------
- ``incident``: re-aligned again to match disassembly
Other Changes
-------------
- `gui/liquids`: added more keybindings: 0-7 to change liquid level, P/B to cycle backwards
DFHack 0.44.04-alpha1 DFHack 0.44.04-alpha1
===================== =====================
Fixes
-----
- `devel/inject-raws`: now recognizes spaces in reaction names
- `exportlegends`: fixed an error that could occur when exporting empty lists
Structures Structures
---------- ----------
- ``artifact_record``: fixed layout (changed in 0.44.04) - ``artifact_record``: fixed layout (changed in 0.44.04)
@ -125,6 +141,11 @@ Other Changes
------------- -------------
- The console now provides suggestions for built-in commands - The console now provides suggestions for built-in commands
- `devel/export-dt-ini`: avoid hardcoding flags - `devel/export-dt-ini`: avoid hardcoding flags
- `exportlegends`:
- reordered some tags to match DF's order
- added progress indicators for exporting long lists
- `gui/gm-editor`: added enum names to enum edit dialogs - `gui/gm-editor`: added enum names to enum edit dialogs
- `gui/gm-unit`: made skill search case-insensitive - `gui/gm-unit`: made skill search case-insensitive
- `gui/rename`: added "clear" and "special characters" options - `gui/rename`: added "clear" and "special characters" options

@ -311,7 +311,6 @@ Subcommands that persist until disabled or DF quits:
:import-priority-category: :import-priority-category:
Allows changing the priority of all goods in a Allows changing the priority of all goods in a
category when discussing an import agreement with the liaison category when discussing an import agreement with the liaison
:kitchen-keys: Fixes DF kitchen meal keybindings (:bug:`614`)
:kitchen-prefs-color: Changes color of enabled items to green in kitchen preferences :kitchen-prefs-color: Changes color of enabled items to green in kitchen preferences
:kitchen-prefs-empty: Fixes a layout issue with empty kitchen tabs (:bug:`9000`) :kitchen-prefs-empty: Fixes a layout issue with empty kitchen tabs (:bug:`9000`)
:max-wheelbarrow: Allows assigning more than 3 wheelbarrows to a stockpile :max-wheelbarrow: Allows assigning more than 3 wheelbarrows to a stockpile

@ -1619,6 +1619,18 @@ bool Core::Init()
} }
cerr << "Version: " << vinfo->getVersion() << endl; cerr << "Version: " << vinfo->getVersion() << endl;
#if defined(_WIN32)
const OSType expected = OS_WINDOWS;
#elif defined(_DARWIN)
const OSType expected = OS_APPLE;
#else
const OSType expected = OS_LINUX;
#endif
if (expected != vinfo->getOS()) {
cerr << "OS mismatch; resetting to " << int(expected) << endl;
vinfo->setOS(expected);
}
// Init global object pointers // Init global object pointers
df::global::InitGlobals(); df::global::InitGlobals();
alias_mutex = new recursive_mutex(); alias_mutex = new recursive_mutex();

@ -153,7 +153,7 @@ void VersionInfoFactory::ParseVersion (TiXmlElement* entry, VersionInfo* mem)
else if (type == "md5-hash") else if (type == "md5-hash")
{ {
const char *cstr_value = pMemEntry->Attribute("value"); const char *cstr_value = pMemEntry->Attribute("value");
fprintf(stderr, "%s: MD5: %s\n", cstr_name, cstr_value); fprintf(stderr, "%s (%s): MD5: %s\n", cstr_name, cstr_os, cstr_value);
if(!cstr_value) if(!cstr_value)
throw Error::SymbolsXmlUnderspecifiedEntry(cstr_name); throw Error::SymbolsXmlUnderspecifiedEntry(cstr_name);
mem->addMD5(cstr_value); mem->addMD5(cstr_value);
@ -161,7 +161,7 @@ void VersionInfoFactory::ParseVersion (TiXmlElement* entry, VersionInfo* mem)
else if (type == "binary-timestamp") else if (type == "binary-timestamp")
{ {
const char *cstr_value = pMemEntry->Attribute("value"); const char *cstr_value = pMemEntry->Attribute("value");
fprintf(stderr, "%s: PE: %s\n", cstr_name, cstr_value); fprintf(stderr, "%s (%s): PE: %s\n", cstr_name, cstr_os, cstr_value);
if(!cstr_value) if(!cstr_value)
throw Error::SymbolsXmlUnderspecifiedEntry(cstr_name); throw Error::SymbolsXmlUnderspecifiedEntry(cstr_name);
mem->addPE(strtol(cstr_value, 0, 16)); mem->addPE(strtol(cstr_value, 0, 16));

@ -18,31 +18,35 @@
#include "modules/Translation.h" #include "modules/Translation.h"
#include "modules/World.h" #include "modules/World.h"
#include "modules/Maps.h" #include "modules/Maps.h"
#include "df/activity_event.h"
#include "df/activity_entry.h" #include "df/activity_entry.h"
#include "df/unit_preference.h" #include "df/activity_event.h"
#include "df/unit_soul.h" #include "df/creature_raw.h"
#include "df/dance_form.h"
#include "df/descriptor_color.h"
#include "df/descriptor_shape.h"
#include "df/item_type.h" #include "df/item_type.h"
#include "df/itemdef_weaponst.h"
#include "df/itemdef_trapcompst.h"
#include "df/itemdef_toyst.h"
#include "df/itemdef_toolst.h"
#include "df/itemdef_instrumentst.h"
#include "df/itemdef_armorst.h"
#include "df/itemdef_ammost.h" #include "df/itemdef_ammost.h"
#include "df/itemdef_siegeammost.h" #include "df/itemdef_armorst.h"
#include "df/itemdef_foodst.h"
#include "df/itemdef_glovesst.h" #include "df/itemdef_glovesst.h"
#include "df/itemdef_shoesst.h"
#include "df/itemdef_shieldst.h"
#include "df/itemdef_helmst.h" #include "df/itemdef_helmst.h"
#include "df/itemdef_instrumentst.h"
#include "df/itemdef_pantsst.h" #include "df/itemdef_pantsst.h"
#include "df/itemdef_foodst.h" #include "df/itemdef_shieldst.h"
#include "df/itemdef_shoesst.h"
#include "df/itemdef_siegeammost.h"
#include "df/itemdef_toolst.h"
#include "df/itemdef_toyst.h"
#include "df/itemdef_trapcompst.h"
#include "df/itemdef_weaponst.h"
#include "df/musical_form.h"
#include "df/poetic_form.h"
#include "df/trapcomp_flags.h" #include "df/trapcomp_flags.h"
#include "df/creature_raw.h" #include "df/unit_preference.h"
#include "df/unit_soul.h"
#include "df/viewscreen_unitst.h"
#include "df/world_raws.h" #include "df/world_raws.h"
#include "df/descriptor_shape.h"
#include "df/descriptor_color.h"
using std::deque; using std::deque;
@ -137,6 +141,14 @@ static string getUnitName(df::unit * unit)
return label; return label;
} }
template<typename T>
static string getFormName(int32_t id, const string &default_ = "?") {
T *form = T::find(id);
if (form)
return Translation::TranslateName(&form->name);
return default_;
}
static void send_key(const df::interface_key &key) static void send_key(const df::interface_key &key)
{ {
set< df::interface_key > keys; set< df::interface_key > keys;
@ -480,6 +492,8 @@ public:
void render() void render()
{ {
using namespace df::enums::interface_key;
if (Screen::isDismissed(this)) if (Screen::isDismissed(this))
return; return;
@ -493,18 +507,18 @@ public:
int32_t y = gps->dimy - 4; int32_t y = gps->dimy - 4;
int32_t x = 2; int32_t x = 2;
OutputHotkeyString(x, y, "Leave", "Esc"); OutputHotkeyString(x, y, "Leave", LEAVESCREEN);
x += 13; x += 13;
string window_label = "Window Months: " + int_to_string(window_days / min_window); string window_label = "Window Months: " + int_to_string(window_days / min_window);
OutputHotkeyString(x, y, window_label.c_str(), "*"); OutputHotkeyString(x, y, window_label.c_str(), SECONDSCROLL_PAGEDOWN);
++y; ++y;
x = 2; x = 2;
OutputHotkeyString(x, y, "Fort Stats", "Shift-D"); OutputHotkeyString(x, y, "Fort Stats", CUSTOM_SHIFT_D);
x += 3; x += 3;
OutputHotkeyString(x, y, "Zoom Unit", "Shift-Z"); OutputHotkeyString(x, y, "Zoom Unit", CUSTOM_SHIFT_Z);
} }
std::string getFocusString() { return "dwarfmonitor_dwarfstats"; } std::string getFocusString() { return "dwarfmonitor_dwarfstats"; }
@ -1088,6 +1102,8 @@ public:
void render() void render()
{ {
using namespace df::enums::interface_key;
if (Screen::isDismissed(this)) if (Screen::isDismissed(this))
return; return;
@ -1102,18 +1118,18 @@ public:
int32_t y = gps->dimy - 4; int32_t y = gps->dimy - 4;
int32_t x = 2; int32_t x = 2;
OutputHotkeyString(x, y, "Leave", "Esc"); OutputHotkeyString(x, y, "Leave", LEAVESCREEN);
x += 13; x += 13;
string window_label = "Window Months: " + int_to_string(window_days / min_window); string window_label = "Window Months: " + int_to_string(window_days / min_window);
OutputHotkeyString(x, y, window_label.c_str(), "*"); OutputHotkeyString(x, y, window_label.c_str(), SECONDSCROLL_PAGEDOWN);
++y; ++y;
x = 2; x = 2;
OutputHotkeyString(x, y, "Dwarf Stats", "Shift-D"); OutputHotkeyString(x, y, "Dwarf Stats", CUSTOM_SHIFT_D);
x += 3; x += 3;
OutputHotkeyString(x, y, "Zoom Unit", "Shift-Z"); OutputHotkeyString(x, y, "Zoom Unit", CUSTOM_SHIFT_Z);
} }
std::string getFocusString() { return "dwarfmonitor_fortstats"; } std::string getFocusString() { return "dwarfmonitor_fortstats"; }
@ -1201,6 +1217,18 @@ struct preference_map
break; break;
default: default:
label = ENUM_ATTR_STR(item_type, caption, pref.item_type);
if (label.size())
{
if (label[label.size() - 1] == 's')
label += "es";
else
label += "s";
}
else
{
label = "UNKNOWN";
}
break; break;
} }
@ -1217,15 +1245,13 @@ struct preference_map
{ {
case (T_type::LikeCreature): case (T_type::LikeCreature):
{ {
label = "Creature :"; label = "Creature :" + Units::getRaceNamePluralById(pref.creature_id);
Units::getRaceNamePluralById(pref.creature_id);
break; break;
} }
case (T_type::HateCreature): case (T_type::HateCreature):
{ {
label = "Hates :"; label = "Hates :" + Units::getRaceNamePluralById(pref.creature_id);
Units::getRaceNamePluralById(pref.creature_id);
break; break;
} }
@ -1290,6 +1316,22 @@ struct preference_map
case (T_type::LikeColor): case (T_type::LikeColor):
label += "Color :" + raws.language.colors[pref.color_id]->name; label += "Color :" + raws.language.colors[pref.color_id]->name;
break; break;
case (T_type::LikePoeticForm):
label += "Poetry :" + getFormName<df::poetic_form>(pref.poetic_form_id);
break;
case (T_type::LikeMusicalForm):
label += "Music :" + getFormName<df::musical_form>(pref.musical_form_id);
break;
case (T_type::LikeDanceForm):
label += "Dance :" + getFormName<df::dance_form>(pref.dance_form_id);
break;
default:
label += string("UNKNOWN ") + ENUM_KEY_STR(unit_preference::T_type, pref.type);
break;
} }
} }
}; };
@ -1304,14 +1346,14 @@ public:
preferences_column.auto_select = true; preferences_column.auto_select = true;
preferences_column.setTitle("Preference"); preferences_column.setTitle("Preference");
preferences_column.bottom_margin = 3; preferences_column.bottom_margin = 3;
preferences_column.search_margin = 35; preferences_column.search_margin = 50;
dwarf_column.multiselect = false; dwarf_column.multiselect = false;
dwarf_column.auto_select = true; dwarf_column.auto_select = true;
dwarf_column.allow_null = true; dwarf_column.allow_null = true;
dwarf_column.setTitle("Units with Preference"); dwarf_column.setTitle("Units with Preference");
dwarf_column.bottom_margin = 3; dwarf_column.bottom_margin = 3;
dwarf_column.search_margin = 35; dwarf_column.search_margin = 50;
populatePreferencesColumn(); populatePreferencesColumn();
} }
@ -1444,6 +1486,18 @@ public:
return false; return false;
break; break;
case (T_type::LikePoeticForm):
return lhs.poetic_form_id == rhs.poetic_form_id;
break;
case (T_type::LikeMusicalForm):
return lhs.musical_form_id == rhs.musical_form_id;
break;
case (T_type::LikeDanceForm):
return lhs.dance_form_id == rhs.dance_form_id;
break;
default: default:
return false; return false;
} }
@ -1483,8 +1537,13 @@ public:
case (T_type::LikeColor): case (T_type::LikeColor):
return COLOR_BLUE; return COLOR_BLUE;
case (T_type::LikePoeticForm):
case (T_type::LikeMusicalForm):
case (T_type::LikeDanceForm):
return COLOR_LIGHTCYAN;
default: default:
return false; return COLOR_LIGHTMAGENTA;
} }
return true; return true;
@ -1543,6 +1602,11 @@ public:
dwarf_column.setHighlight(0); dwarf_column.setHighlight(0);
} }
df::unit *getSelectedUnit() override
{
return (selected_column == 1) ? dwarf_column.getFirstSelectedElem() : nullptr;
}
void feed(set<df::interface_key> *input) void feed(set<df::interface_key> *input)
{ {
bool key_processed = false; bool key_processed = false;
@ -1572,9 +1636,19 @@ public:
Screen::dismiss(this); Screen::dismiss(this);
return; return;
} }
else if (input->count(interface_key::CUSTOM_SHIFT_V))
{
df::unit *unit = getSelectedUnit();
if (unit)
{
auto unitscr = df::allocate<df::viewscreen_unitst>();
unitscr->unit = unit;
Screen::show(unitscr);
}
}
else if (input->count(interface_key::CUSTOM_SHIFT_Z)) else if (input->count(interface_key::CUSTOM_SHIFT_Z))
{ {
df::unit *selected_unit = (selected_column == 1) ? dwarf_column.getFirstSelectedElem() : nullptr; df::unit *selected_unit = getSelectedUnit();
if (selected_unit) if (selected_unit)
{ {
input->clear(); input->clear();
@ -1610,6 +1684,8 @@ public:
void render() void render()
{ {
using namespace df::enums::interface_key;
if (Screen::isDismissed(this)) if (Screen::isDismissed(this))
return; return;
@ -1623,10 +1699,15 @@ public:
int32_t y = gps->dimy - 3; int32_t y = gps->dimy - 3;
int32_t x = 2; int32_t x = 2;
OutputHotkeyString(x, y, "Leave", "Esc"); OutputHotkeyString(x, y, "Leave", LEAVESCREEN);
x += 2;
OutputHotkeyString(x, y, "View Unit", CUSTOM_SHIFT_V, false, 0,
getSelectedUnit() ? COLOR_WHITE : COLOR_DARKGREY);
x += 2; x += 2;
OutputHotkeyString(x, y, "Zoom Unit", "Shift-Z"); OutputHotkeyString(x, y, "Zoom Unit", CUSTOM_SHIFT_Z, false, 0,
getSelectedUnit() ? COLOR_WHITE : COLOR_DARKGREY);
} }
std::string getFocusString() { return "dwarfmonitor_preferences"; } std::string getFocusString() { return "dwarfmonitor_preferences"; }

@ -113,7 +113,7 @@ public:
for (int i = display_start_offset; i < display_list.size() && i < last_index_able_to_display; i++) for (int i = display_start_offset; i < display_list.size() && i < last_index_able_to_display; i++)
{ {
++y; ++y;
UIColor fg_color = (display_list[i]->selected) ? COLOR_SELECTED : display_list[i]->color; UIColor fg_color = (is_selected_column && display_list[i]->selected) ? COLOR_SELECTED : display_list[i]->color;
UIColor bg_color = (is_selected_column && i == highlighted_index) ? COLOR_HIGHLIGHTED : COLOR_BLACK; UIColor bg_color = (is_selected_column && i == highlighted_index) ? COLOR_HIGHLIGHTED : COLOR_BLACK;
string item_label = display_list[i]->text; string item_label = display_list[i]->text;

@ -94,7 +94,6 @@
#include "tweaks/hide-priority.h" #include "tweaks/hide-priority.h"
#include "tweaks/hotkey-clear.h" #include "tweaks/hotkey-clear.h"
#include "tweaks/import-priority-category.h" #include "tweaks/import-priority-category.h"
#include "tweaks/kitchen-keys.h"
#include "tweaks/kitchen-prefs-color.h" #include "tweaks/kitchen-prefs-color.h"
#include "tweaks/kitchen-prefs-empty.h" #include "tweaks/kitchen-prefs-empty.h"
#include "tweaks/max-wheelbarrow.h" #include "tweaks/max-wheelbarrow.h"
@ -218,8 +217,6 @@ DFhackCExport command_result plugin_init (color_ostream &out, std::vector <Plugi
" tweak import-priority-category [disable]\n" " tweak import-priority-category [disable]\n"
" When meeting with a liaison, makes Shift+Left/Right arrow adjust\n" " When meeting with a liaison, makes Shift+Left/Right arrow adjust\n"
" the priority of an entire category of imports.\n" " the priority of an entire category of imports.\n"
" tweak kitchen-keys [disable]\n"
" Fixes DF kitchen meal keybindings (bug 614)\n"
" tweak kitchen-prefs-color [disable]\n" " tweak kitchen-prefs-color [disable]\n"
" Changes color of enabled items to green in kitchen preferences\n" " Changes color of enabled items to green in kitchen preferences\n"
" tweak kitchen-prefs-empty [disable]\n" " tweak kitchen-prefs-empty [disable]\n"
@ -293,9 +290,6 @@ DFhackCExport command_result plugin_init (color_ostream &out, std::vector <Plugi
TWEAK_HOOK("import-priority-category", takerequest_hook, feed); TWEAK_HOOK("import-priority-category", takerequest_hook, feed);
TWEAK_HOOK("import-priority-category", takerequest_hook, render); TWEAK_HOOK("import-priority-category", takerequest_hook, render);
TWEAK_HOOK("kitchen-keys", kitchen_keys_hook, feed);
TWEAK_HOOK("kitchen-keys", kitchen_keys_hook, render);
TWEAK_HOOK("kitchen-prefs-color", kitchen_prefs_color_hook, render); TWEAK_HOOK("kitchen-prefs-color", kitchen_prefs_color_hook, render);
TWEAK_HOOK("kitchen-prefs-empty", kitchen_prefs_empty_hook, render); TWEAK_HOOK("kitchen-prefs-empty", kitchen_prefs_empty_hook, render);

@ -1,68 +0,0 @@
using namespace DFHack;
using namespace df::enums;
using df::global::ui_sidebar_menus;
using df::global::ui_workshop_in_add;
static df::interface_key kitchen_bindings[] = {
df::interface_key::HOTKEY_KITCHEN_COOK_2,
df::interface_key::HOTKEY_KITCHEN_COOK_3,
df::interface_key::HOTKEY_KITCHEN_COOK_4,
// DF uses CUSTOM_R for this reaction in the raws, so this key is recognized
// by this tweak but not displayed
df::interface_key::HOTKEY_KITCHEN_RENDER_FAT
};
struct kitchen_keys_hook : df::viewscreen_dwarfmodest {
typedef df::viewscreen_dwarfmodest interpose_base;
void draw_binding (int row, df::interface_key key)
{
std::string label = Screen::getKeyDisplay(key);
int x = Gui::getDwarfmodeViewDims().menu_x2 - 2 - label.size();
int y = row + 4;
OutputString(COLOR_GREY, x, y, "(");
OutputString(COLOR_LIGHTRED, x, y, label);
OutputString(COLOR_GREY, x, y, ")");
}
bool kitchen_in_add()
{
if (!*ui_workshop_in_add)
return false;
df::building_workshopst *ws = virtual_cast<df::building_workshopst>(world->selected_building);
if (!ws)
return false;
if (ws->type != workshop_type::Kitchen)
return false;
return true;
}
DEFINE_VMETHOD_INTERPOSE(void, feed, (std::set<df::interface_key> *input))
{
if (kitchen_in_add())
{
for (int i = 0; i < 4; i++)
{
if (input->count(kitchen_bindings[i]))
{
ui_sidebar_menus->workshop_job.cursor = i;
input->clear();
input->insert(df::interface_key::SELECT);
}
}
}
INTERPOSE_NEXT(feed)(input);
}
DEFINE_VMETHOD_INTERPOSE(void, render, ())
{
INTERPOSE_NEXT(render)();
if (kitchen_in_add())
for (int i = 0; i < 3; i++)
draw_binding(i, kitchen_bindings[i]);
}
};
IMPLEMENT_VMETHOD_INTERPOSE(kitchen_keys_hook, feed);
IMPLEMENT_VMETHOD_INTERPOSE(kitchen_keys_hook, render);