diff --git a/library/lua/binpatch.lua b/library/lua/binpatch.lua index e957148f7..20d0869a4 100644 --- a/library/lua/binpatch.lua +++ b/library/lua/binpatch.lua @@ -1,5 +1,7 @@ -- Simple binary patch with IDA dif file support. +local _ENV = mkmodule('binpatch') + local function load_patch(name) local filename = name if not string.match(filename, '[./\\]') then diff --git a/plugins/tweak.cpp b/plugins/tweak.cpp index 433f8d197..751de4422 100644 --- a/plugins/tweak.cpp +++ b/plugins/tweak.cpp @@ -815,14 +815,18 @@ struct military_training_ct_hook : df::activity_event_combat_trainingst { spar++; } +#if 0 color_ostream_proxy out(Core::getInstance().getConsole()); +#endif // If the xp gap is low, sometimes replace with sparring if ((maxv - minv) < 64*15 && spar == units.size() && random_int(45) >= 30 + (maxv-minv)/64) { +#if 0 out.print("Replacing %s demonstration (xp %d-%d, gap %d) with sparring.\n", ENUM_KEY_STR(job_skill, sd->skill).c_str(), minv, maxv, maxv-minv); +#endif if (auto spar = df::allocate()) { @@ -844,18 +848,22 @@ struct military_training_ct_hook : df::activity_event_combat_trainingst { // If the teacher has less xp than somebody else, switch if (best >= 0 && maxv > cur_xp) { +#if 0 out.print("Replacing %s teacher %d (%d xp) with %d (%d xp); xp gap %d.\n", ENUM_KEY_STR(job_skill, sd->skill).c_str(), sd->unit_id, cur_xp, units[best], maxv, maxv-minv); +#endif sd->hist_figure_id = sd->participants.histfigs[best]; sd->unit_id = units[best]; } else { +#if 0 out.print("Not changing %s demonstration (xp %d-%d, gap %d).\n", ENUM_KEY_STR(job_skill, sd->skill).c_str(), minv, maxv, maxv-minv); +#endif } } }