Merge branch 'DFHack:develop' into patch-1

develop
Ryan Williams 2023-02-05 12:02:58 -08:00 committed by GitHub
commit 08d90de277
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 13 deletions

@ -38,6 +38,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
## Fixes ## Fixes
## Misc Improvements ## Misc Improvements
- `automelt`: is now more resistent to savegame corruption
## Documentation ## Documentation

@ -87,8 +87,8 @@ using namespace DFHack;
const size_t MAX_REPORTS_SIZE = 3000; // DF clears old reports to maintain this vector size const size_t MAX_REPORTS_SIZE = 3000; // DF clears old reports to maintain this vector size
const int32_t RECENT_REPORT_TICKS = 500; // used by UNIT_COMBAT_REPORT_ALL_ACTIVE const int32_t RECENT_REPORT_TICKS = 500; // used by UNIT_COMBAT_REPORT_ALL_ACTIVE
const int32_t ANNOUNCE_LINE_DURATION = 100; // time to display each line in announcement bar; 3.3 sec at 30 GFPS const int32_t ANNOUNCE_LINE_DURATION = 100; // time to display each line in announcement bar; 2 sec at 50 GFPS
const int16_t ANNOUNCE_DISPLAY_TIME = 2000; // DF uses this value for most announcements; 66.6 sec at 30 GFPS const int16_t ANNOUNCE_DISPLAY_TIME = 2000; // DF uses this value for most announcements; 40 sec at 50 GFPS
namespace DFHack namespace DFHack
{ {
@ -1992,16 +1992,20 @@ void Gui::resetDwarfmodeView(bool pause)
{ {
plotinfo->follow_unit = -1; plotinfo->follow_unit = -1;
plotinfo->follow_item = -1; plotinfo->follow_item = -1;
/* TODO: understand how this changes for v50
plotinfo->main.mode = ui_sidebar_mode::Default; plotinfo->main.mode = ui_sidebar_mode::Default;
*/
} }
if (selection_rect) if (selection_rect)
{ {
selection_rect->start_x = -30000; selection_rect->start_x = -30000;
selection_rect->start_y = -30000;
selection_rect->start_z = -30000;
selection_rect->end_x = -30000; selection_rect->end_x = -30000;
selection_rect->end_y = -30000;
selection_rect->end_z = -30000;
} }
// NOTE: There's an unidentified global coord after selection_rect that is reset to -30000 here.
// This coord goes into game->main_interface.keyboard_last_track_s if the x value is not -30000. Probably okay to ignore?
if (cursor) if (cursor)
cursor->x = cursor->y = cursor->z = -30000; cursor->x = cursor->y = cursor->z = -30000;

@ -115,13 +115,17 @@ static void remove_stockpile_config(color_ostream &out, int id)
watched_stockpiles.erase(id); watched_stockpiles.erase(id);
} }
static bool isStockpile(df::building * building) {
return building->getType() == df::building_type::Stockpile;
}
static void validate_stockpile_configs(color_ostream &out) static void validate_stockpile_configs(color_ostream &out)
{ {
for (auto &c : watched_stockpiles) { for (auto &c : watched_stockpiles) {
int id = get_config_val(c.second, STOCKPILE_CONFIG_ID); int id = get_config_val(c.second, STOCKPILE_CONFIG_ID);
if (!df::building::find(id)){ auto bld = df::building::find(id);
if (!bld || !isStockpile(bld))
remove_stockpile_config(out, id); remove_stockpile_config(out, id);
}
} }
} }
@ -268,10 +272,6 @@ static inline bool is_metal_item(df::item *item)
return (mat.getCraftClass() == craft_material_class::Metal); return (mat.getCraftClass() == craft_material_class::Metal);
} }
static bool isStockpile(df::building * building) {
return building->getType() == df::building_type::Stockpile;
}
struct BadFlagsCanMelt { struct BadFlagsCanMelt {
uint32_t whole; uint32_t whole;
@ -305,7 +305,6 @@ struct BadFlagsMarkItem {
// Copied from Kelly Martin's code // Copied from Kelly Martin's code
static inline bool can_melt(df::item *item) static inline bool can_melt(df::item *item)
{ {
static const BadFlagsCanMelt bad_flags; static const BadFlagsCanMelt bad_flags;
if (item->flags.whole & bad_flags.whole) if (item->flags.whole & bad_flags.whole)
@ -356,7 +355,7 @@ static inline bool is_set_to_melt(df::item *item)
static int mark_item(color_ostream &out, df::item *item, BadFlagsMarkItem bad_flags, int32_t stockpile_id, static int mark_item(color_ostream &out, df::item *item, BadFlagsMarkItem bad_flags, int32_t stockpile_id,
int32_t &premarked_item_count, int32_t &item_count, map<int32_t, bool> &tracked_item_map, bool should_melt) int32_t &premarked_item_count, int32_t &item_count, map<int32_t, bool> &tracked_item_map, bool should_melt)
{ {
DEBUG(perf,out).print("%s running mark_item\nshould_melt=%d\n", plugin_name,should_melt); DEBUG(perf,out).print("%s running mark_item: should_melt=%d\n", plugin_name, should_melt);
if (DBG_NAME(perf).isEnabled(DebugCategory::LDEBUG)) { if (DBG_NAME(perf).isEnabled(DebugCategory::LDEBUG)) {
string name = ""; string name = "";

@ -1 +1 @@
Subproject commit 2459ea718bb5cd431b62cee09eb8e41ee18965ba Subproject commit dc11839b673019e9dac0e63de0b05dedd3aea786