Fix a problem in binpatch.lua and comment out debug messages in tweak.

develop
Alexander Gavrilov 2013-02-26 12:29:02 +04:00
parent bf0795d738
commit 03b91ca26c
2 changed files with 10 additions and 0 deletions

@ -1,5 +1,7 @@
-- Simple binary patch with IDA dif file support. -- Simple binary patch with IDA dif file support.
local _ENV = mkmodule('binpatch')
local function load_patch(name) local function load_patch(name)
local filename = name local filename = name
if not string.match(filename, '[./\\]') then if not string.match(filename, '[./\\]') then

@ -815,14 +815,18 @@ struct military_training_ct_hook : df::activity_event_combat_trainingst {
spar++; spar++;
} }
#if 0
color_ostream_proxy out(Core::getInstance().getConsole()); color_ostream_proxy out(Core::getInstance().getConsole());
#endif
// If the xp gap is low, sometimes replace with sparring // If the xp gap is low, sometimes replace with sparring
if ((maxv - minv) < 64*15 && spar == units.size() && if ((maxv - minv) < 64*15 && spar == units.size() &&
random_int(45) >= 30 + (maxv-minv)/64) random_int(45) >= 30 + (maxv-minv)/64)
{ {
#if 0
out.print("Replacing %s demonstration (xp %d-%d, gap %d) with sparring.\n", 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); ENUM_KEY_STR(job_skill, sd->skill).c_str(), minv, maxv, maxv-minv);
#endif
if (auto spar = df::allocate<df::activity_event_sparringst>()) if (auto spar = df::allocate<df::activity_event_sparringst>())
{ {
@ -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 the teacher has less xp than somebody else, switch
if (best >= 0 && maxv > cur_xp) if (best >= 0 && maxv > cur_xp)
{ {
#if 0
out.print("Replacing %s teacher %d (%d xp) with %d (%d xp); xp gap %d.\n", 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(), ENUM_KEY_STR(job_skill, sd->skill).c_str(),
sd->unit_id, cur_xp, units[best], maxv, maxv-minv); sd->unit_id, cur_xp, units[best], maxv, maxv-minv);
#endif
sd->hist_figure_id = sd->participants.histfigs[best]; sd->hist_figure_id = sd->participants.histfigs[best];
sd->unit_id = units[best]; sd->unit_id = units[best];
} }
else else
{ {
#if 0
out.print("Not changing %s demonstration (xp %d-%d, gap %d).\n", out.print("Not changing %s demonstration (xp %d-%d, gap %d).\n",
ENUM_KEY_STR(job_skill, sd->skill).c_str(), ENUM_KEY_STR(job_skill, sd->skill).c_str(),
minv, maxv, maxv-minv); minv, maxv, maxv-minv);
#endif
} }
} }
} }