diff --git a/CMakeLists.txt b/CMakeLists.txt index a353495b8..c1862d122 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,8 +58,8 @@ if (NOT EXISTS ${dfhack_SOURCE_DIR}/library/xml/codegen.pl OR NOT EXISTS ${dfhac endif() # set up versioning. -set(DF_VERSION "0.40.13") -SET(DFHACK_RELEASE "r1" CACHE STRING "Current release revision.") +set(DF_VERSION "0.40.14") +SET(DFHACK_RELEASE "r0" CACHE STRING "Current release revision.") set(DFHACK_VERSION "${DF_VERSION}-${DFHACK_RELEASE}") add_definitions(-DDFHACK_VERSION="${DFHACK_VERSION}") diff --git a/library/modules/Units.cpp b/library/modules/Units.cpp index 9d2ebf2dd..463cea227 100644 --- a/library/modules/Units.cpp +++ b/library/modules/Units.cpp @@ -154,7 +154,7 @@ void Units::CopyCreature(df::unit * source, t_unit & furball) // profession furball.profession = source->profession; // happiness - furball.happiness = source->status.happiness; + furball.happiness = 100;//source->status.happiness; // physical attributes memcpy(&furball.strength, source->body.physical_attrs, sizeof(source->body.physical_attrs)); diff --git a/library/xml b/library/xml index aed9a7644..62dcffa67 160000 --- a/library/xml +++ b/library/xml @@ -1 +1 @@ -Subproject commit aed9a7644cd1d4a599c10d5f579fc742ced6bc3f +Subproject commit 62dcffa67998643966267763526b82bd7674b583 diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 6ebe3ad6d..2aea9542c 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -110,7 +110,7 @@ if (BUILD_SUPPORTED) DFHACK_PLUGIN(digFlood digFlood.cpp) add_subdirectory(diggingInvaders) DFHACK_PLUGIN(drybuckets drybuckets.cpp) - DFHACK_PLUGIN(dwarfmonitor dwarfmonitor.cpp) + #DFHACK_PLUGIN(dwarfmonitor dwarfmonitor.cpp) DFHACK_PLUGIN(embark-tools embark-tools.cpp) DFHACK_PLUGIN(eventful eventful.cpp LINK_LIBRARIES lua) DFHACK_PLUGIN(fastdwarf fastdwarf.cpp) @@ -132,7 +132,7 @@ if (BUILD_SUPPORTED) DFHACK_PLUGIN(liquids liquids.cpp Brushes.h LINK_LIBRARIES lua) DFHACK_PLUGIN(manipulator manipulator.cpp) DFHACK_PLUGIN(mode mode.cpp) - DFHACK_PLUGIN(misery misery.cpp) + #DFHACK_PLUGIN(misery misery.cpp) DFHACK_PLUGIN(mousequery mousequery.cpp) DFHACK_PLUGIN(petcapRemover petcapRemover.cpp) DFHACK_PLUGIN(plants plants.cpp) diff --git a/plugins/autolabor.cpp b/plugins/autolabor.cpp index 05855a749..23ae71969 100644 --- a/plugins/autolabor.cpp +++ b/plugins/autolabor.cpp @@ -819,7 +819,7 @@ static void assign_labor(unit_labor::unit_labor labor, // bias by happiness - value += dwarfs[dwarf]->status.happiness; + //value += dwarfs[dwarf]->status.happiness; values[dwarf] = value; diff --git a/plugins/manipulator.cpp b/plugins/manipulator.cpp index ebd23a9d7..8deddec11 100644 --- a/plugins/manipulator.cpp +++ b/plugins/manipulator.cpp @@ -313,10 +313,11 @@ bool sortBySquad (const UnitInfo *d1, const UnitInfo *d2) bool sortByHappiness (const UnitInfo *d1, const UnitInfo *d2) { - if (descending) + return sortByName(d1, d2); + /*if (descending) return (d1->unit->status.happiness > d2->unit->status.happiness); else - return (d1->unit->status.happiness < d2->unit->status.happiness); + return (d1->unit->status.happiness < d2->unit->status.happiness);*/ } bool sortByArrival (const UnitInfo *d1, const UnitInfo *d2) @@ -1043,7 +1044,7 @@ void viewscreen_unitlaborsst::render() df::unit *unit = cur->unit; int8_t fg = 15, bg = 0; - int happy = cur->unit->status.happiness; + int happy = 100;//cur->unit->status.happiness; string happiness = stl_sprintf("%4i", happy); if (happy == 0) // miserable fg = 13; // 5:1 diff --git a/plugins/strangemood.cpp b/plugins/strangemood.cpp index e1cedbfe3..41b25a9bc 100644 --- a/plugins/strangemood.cpp +++ b/plugins/strangemood.cpp @@ -631,7 +631,7 @@ command_result df_strangemood (color_ostream &out, vector & parameters) // If no mood type was specified, pick one randomly if (type == mood_type::None) { - if (rng.df_trandom(100) > unit->status.happiness) + if (rng.df_trandom(100) > 90)//rng.df_trandom(100) > unit->status.happiness) { switch (rng.df_trandom(2)) { @@ -691,7 +691,7 @@ command_result df_strangemood (color_ostream &out, vector & parameters) unit->relations.mood_copy = unit->mood; Gui::showAutoAnnouncement(announcement_type::STRANGE_MOOD, unit->pos, msg, color, bright); - unit->status.happiness = 100; + //unit->status.happiness = 100; // TODO: make sure unit drops any wrestle items unit->job.mood_timeout = 50000; unit->flags1.bits.has_mood = true; diff --git a/scripts/devel/find-offsets.lua b/scripts/devel/find-offsets.lua index d8b3406f9..ae99adbca 100644 --- a/scripts/devel/find-offsets.lua +++ b/scripts/devel/find-offsets.lua @@ -131,15 +131,24 @@ local function zoomed_searcher(startn, end_or_sz) end local finder_searches = {} -local function exec_finder(finder, names) +local function exec_finder(finder, names, validators) if type(names) ~= 'table' then names = { names } end + if type(validators) ~= 'table' then + validators = { validators } + end local search = force_scan['all'] - for _,v in ipairs(names) do + for k,v in ipairs(names) do if force_scan[v] or not is_known(v) then table.insert(finder_searches, v) search = true + elseif validators[k] then + if not validators[k](df.global[v]) then + dfhack.printerr('Validation failed for '..v..', will try to find again') + table.insert(finder_searches, v) + search = true + end end end if search then @@ -505,6 +514,7 @@ end local function is_valid_world(world) if not ms.is_valid_vector(world.units.all, 4) + or not ms.is_valid_vector(world.units.active, 4) or not ms.is_valid_vector(world.units.bad, 4) or not ms.is_valid_vector(world.history.figures, 4) or not ms.is_valid_vector(world.features.map_features, 4) @@ -776,11 +786,6 @@ end -- local function find_current_weather() - print('\nPlease load the save previously processed with prepare-save.') - if not utils.prompt_yes_no('Proceed?', true) then - return - end - local zone if os_type == 'windows' then zone = zoomed_searcher('crime_next_id', 512) @@ -839,7 +844,14 @@ local function find_ui_selected_unit() end for i,unit in ipairs(df.global.world.units.active) do - dfhack.units.setNickname(unit, i) + -- This function does a lot of things and accesses histfigs, souls and so on: + --dfhack.units.setNickname(unit, i) + + -- Instead use just a simple bit of code that only requires the start of the + -- unit to be valid. It may not work properly with vampires or reset later + -- if unpaused, but is sufficient for this script and won't crash: + unit.name.nickname = tostring(i) + unit.name.has_name = true end local addr = searcher:find_menu_cursor([[ @@ -1506,17 +1518,23 @@ print('\nInitial globals (need title screen):\n') exec_finder(find_gview, 'gview') exec_finder(find_cursor, { 'cursor', 'selection_rect', 'gamemode', 'gametype' }) exec_finder(find_announcements, 'announcements') -exec_finder(find_d_init, 'd_init') -exec_finder(find_enabler, 'enabler') -exec_finder(find_gps, 'gps') +exec_finder(find_d_init, 'd_init', is_valid_d_init) +exec_finder(find_enabler, 'enabler', is_valid_enabler) +exec_finder(find_gps, 'gps', is_valid_gps) print('\nCompound globals (need loaded world):\n') -exec_finder(find_world, 'world') -exec_finder(find_ui, 'ui') +print('\nPlease load the save previously processed with prepare-save.') +if not utils.prompt_yes_no('Proceed?', true) then + searcher:reset() + return +end + +exec_finder(find_world, 'world', is_valid_world) +exec_finder(find_ui, 'ui', is_valid_ui) exec_finder(find_ui_sidebar_menus, 'ui_sidebar_menus') exec_finder(find_ui_build_selector, 'ui_build_selector') -exec_finder(find_init, 'init') +exec_finder(find_init, 'init', is_valid_init) print('\nPrimitive globals:\n')