diff --git a/CMakeLists.txt b/CMakeLists.txt index d84e8dfd1..6e92fc967 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -140,7 +140,7 @@ if (NOT EXISTS ${dfhack_SOURCE_DIR}/library/xml/codegen.pl OR NOT EXISTS ${dfhac endif() # set up versioning. -set(DF_VERSION "0.44.04") +set(DF_VERSION "0.44.05") set(DFHACK_RELEASE "alpha1") set(DFHACK_PRERELEASE TRUE) diff --git a/NEWS.rst b/NEWS.rst index abecc0900..a14bafa9f 100644 --- a/NEWS.rst +++ b/NEWS.rst @@ -49,6 +49,7 @@ Fixes ----- - Fixed issues with the console output color affecting the prompt on Windows - `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/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-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/rename`: added "clear" and "special characters" options - `modtools/skill-change`: diff --git a/dfhack.init-example b/dfhack.init-example index 3542956ce..75552006e 100644 --- a/dfhack.init-example +++ b/dfhack.init-example @@ -207,7 +207,6 @@ tweak civ-view-agreement tweak eggs-fertile tweak fps-min tweak hide-priority -tweak kitchen-keys tweak kitchen-prefs-empty tweak max-wheelbarrow tweak shift-8-scroll diff --git a/docs/NEWS-dev.rst b/docs/NEWS-dev.rst index 33ff4237a..834282608 100644 --- a/docs/NEWS-dev.rst +++ b/docs/NEWS-dev.rst @@ -37,9 +37,25 @@ Development Changelog .. contents:: :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 ===================== +Fixes +----- +- `devel/inject-raws`: now recognizes spaces in reaction names +- `exportlegends`: fixed an error that could occur when exporting empty lists + Structures ---------- - ``artifact_record``: fixed layout (changed in 0.44.04) @@ -125,6 +141,11 @@ Other Changes ------------- - The console now provides suggestions for built-in commands - `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-unit`: made skill search case-insensitive - `gui/rename`: added "clear" and "special characters" options diff --git a/docs/Plugins.rst b/docs/Plugins.rst index 0ed65c4a3..04f5df321 100644 --- a/docs/Plugins.rst +++ b/docs/Plugins.rst @@ -311,7 +311,6 @@ Subcommands that persist until disabled or DF quits: :import-priority-category: Allows changing the priority of all goods in a 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-empty: Fixes a layout issue with empty kitchen tabs (:bug:`9000`) :max-wheelbarrow: Allows assigning more than 3 wheelbarrows to a stockpile diff --git a/library/Core.cpp b/library/Core.cpp index 47bddbab8..5173a3ad9 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -640,7 +640,7 @@ static std::string sc_event_name (state_change_event id) { string getBuiltinCommand(std::string cmd) { std::string builtin = ""; - + // Check our list of builtin commands from the header if (built_in_commands.count(cmd)) builtin = cmd; @@ -1619,6 +1619,18 @@ bool Core::Init() } 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 df::global::InitGlobals(); alias_mutex = new recursive_mutex(); diff --git a/library/VersionInfoFactory.cpp b/library/VersionInfoFactory.cpp index cdfdbf774..7033fd598 100644 --- a/library/VersionInfoFactory.cpp +++ b/library/VersionInfoFactory.cpp @@ -153,7 +153,7 @@ void VersionInfoFactory::ParseVersion (TiXmlElement* entry, VersionInfo* mem) else if (type == "md5-hash") { 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) throw Error::SymbolsXmlUnderspecifiedEntry(cstr_name); mem->addMD5(cstr_value); @@ -161,7 +161,7 @@ void VersionInfoFactory::ParseVersion (TiXmlElement* entry, VersionInfo* mem) else if (type == "binary-timestamp") { 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) throw Error::SymbolsXmlUnderspecifiedEntry(cstr_name); mem->addPE(strtol(cstr_value, 0, 16)); diff --git a/plugins/dwarfmonitor.cpp b/plugins/dwarfmonitor.cpp index 2ea811f38..7aed7188d 100644 --- a/plugins/dwarfmonitor.cpp +++ b/plugins/dwarfmonitor.cpp @@ -18,31 +18,35 @@ #include "modules/Translation.h" #include "modules/World.h" #include "modules/Maps.h" -#include "df/activity_event.h" + #include "df/activity_entry.h" -#include "df/unit_preference.h" -#include "df/unit_soul.h" +#include "df/activity_event.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/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_siegeammost.h" +#include "df/itemdef_armorst.h" +#include "df/itemdef_foodst.h" #include "df/itemdef_glovesst.h" -#include "df/itemdef_shoesst.h" -#include "df/itemdef_shieldst.h" #include "df/itemdef_helmst.h" +#include "df/itemdef_instrumentst.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/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/descriptor_shape.h" -#include "df/descriptor_color.h" using std::deque; @@ -137,6 +141,14 @@ static string getUnitName(df::unit * unit) return label; } +template +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) { set< df::interface_key > keys; @@ -480,6 +492,8 @@ public: void render() { + using namespace df::enums::interface_key; + if (Screen::isDismissed(this)) return; @@ -493,18 +507,18 @@ public: int32_t y = gps->dimy - 4; int32_t x = 2; - OutputHotkeyString(x, y, "Leave", "Esc"); + OutputHotkeyString(x, y, "Leave", LEAVESCREEN); x += 13; 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; x = 2; - OutputHotkeyString(x, y, "Fort Stats", "Shift-D"); + OutputHotkeyString(x, y, "Fort Stats", CUSTOM_SHIFT_D); x += 3; - OutputHotkeyString(x, y, "Zoom Unit", "Shift-Z"); + OutputHotkeyString(x, y, "Zoom Unit", CUSTOM_SHIFT_Z); } std::string getFocusString() { return "dwarfmonitor_dwarfstats"; } @@ -1088,6 +1102,8 @@ public: void render() { + using namespace df::enums::interface_key; + if (Screen::isDismissed(this)) return; @@ -1102,18 +1118,18 @@ public: int32_t y = gps->dimy - 4; int32_t x = 2; - OutputHotkeyString(x, y, "Leave", "Esc"); + OutputHotkeyString(x, y, "Leave", LEAVESCREEN); x += 13; 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; x = 2; - OutputHotkeyString(x, y, "Dwarf Stats", "Shift-D"); + OutputHotkeyString(x, y, "Dwarf Stats", CUSTOM_SHIFT_D); x += 3; - OutputHotkeyString(x, y, "Zoom Unit", "Shift-Z"); + OutputHotkeyString(x, y, "Zoom Unit", CUSTOM_SHIFT_Z); } std::string getFocusString() { return "dwarfmonitor_fortstats"; } @@ -1201,6 +1217,18 @@ struct preference_map break; 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; } @@ -1217,15 +1245,13 @@ struct preference_map { case (T_type::LikeCreature): { - label = "Creature :"; - Units::getRaceNamePluralById(pref.creature_id); + label = "Creature :" + Units::getRaceNamePluralById(pref.creature_id); break; } case (T_type::HateCreature): { - label = "Hates :"; - Units::getRaceNamePluralById(pref.creature_id); + label = "Hates :" + Units::getRaceNamePluralById(pref.creature_id); break; } @@ -1290,6 +1316,22 @@ struct preference_map case (T_type::LikeColor): label += "Color :" + raws.language.colors[pref.color_id]->name; break; + + case (T_type::LikePoeticForm): + label += "Poetry :" + getFormName(pref.poetic_form_id); + break; + + case (T_type::LikeMusicalForm): + label += "Music :" + getFormName(pref.musical_form_id); + break; + + case (T_type::LikeDanceForm): + label += "Dance :" + getFormName(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.setTitle("Preference"); preferences_column.bottom_margin = 3; - preferences_column.search_margin = 35; + preferences_column.search_margin = 50; dwarf_column.multiselect = false; dwarf_column.auto_select = true; dwarf_column.allow_null = true; dwarf_column.setTitle("Units with Preference"); dwarf_column.bottom_margin = 3; - dwarf_column.search_margin = 35; + dwarf_column.search_margin = 50; populatePreferencesColumn(); } @@ -1444,6 +1486,18 @@ public: return false; 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: return false; } @@ -1483,8 +1537,13 @@ public: case (T_type::LikeColor): return COLOR_BLUE; + case (T_type::LikePoeticForm): + case (T_type::LikeMusicalForm): + case (T_type::LikeDanceForm): + return COLOR_LIGHTCYAN; + default: - return false; + return COLOR_LIGHTMAGENTA; } return true; @@ -1543,6 +1602,11 @@ public: dwarf_column.setHighlight(0); } + df::unit *getSelectedUnit() override + { + return (selected_column == 1) ? dwarf_column.getFirstSelectedElem() : nullptr; + } + void feed(set *input) { bool key_processed = false; @@ -1572,9 +1636,19 @@ public: Screen::dismiss(this); return; } + else if (input->count(interface_key::CUSTOM_SHIFT_V)) + { + df::unit *unit = getSelectedUnit(); + if (unit) + { + auto unitscr = df::allocate(); + unitscr->unit = unit; + Screen::show(unitscr); + } + } 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) { input->clear(); @@ -1610,6 +1684,8 @@ public: void render() { + using namespace df::enums::interface_key; + if (Screen::isDismissed(this)) return; @@ -1623,10 +1699,15 @@ public: int32_t y = gps->dimy - 3; 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; - 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"; } diff --git a/plugins/listcolumn.h b/plugins/listcolumn.h index 4e4815b69..f7747d96d 100644 --- a/plugins/listcolumn.h +++ b/plugins/listcolumn.h @@ -113,7 +113,7 @@ public: for (int i = display_start_offset; i < display_list.size() && i < last_index_able_to_display; i++) { ++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; string item_label = display_list[i]->text; diff --git a/plugins/tweak/tweak.cpp b/plugins/tweak/tweak.cpp index 417784efb..252f4c738 100644 --- a/plugins/tweak/tweak.cpp +++ b/plugins/tweak/tweak.cpp @@ -94,7 +94,6 @@ #include "tweaks/hide-priority.h" #include "tweaks/hotkey-clear.h" #include "tweaks/import-priority-category.h" -#include "tweaks/kitchen-keys.h" #include "tweaks/kitchen-prefs-color.h" #include "tweaks/kitchen-prefs-empty.h" #include "tweaks/max-wheelbarrow.h" @@ -218,8 +217,6 @@ DFhackCExport command_result plugin_init (color_ostream &out, std::vector (world->selected_building); - if (!ws) - return false; - if (ws->type != workshop_type::Kitchen) - return false; - return true; - } - - DEFINE_VMETHOD_INTERPOSE(void, feed, (std::set *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);