Quietust 2012-11-16 21:15:38 -06:00
commit 1ab48aa2de
5 changed files with 25 additions and 10 deletions

@ -12,6 +12,7 @@ DFHack future
- removebadthoughts: add --dry-run option
New tweaks:
- tweak military-training: speed up melee squad training up to 10x (depends on unit count).
- superdwarf: work in adventure mode too
New scripts:
- binpatch: the same as the stand-alone binpatch.exe, but works at runtime.
- region-pops: displays animal populations of the region and allows tweaking them.

@ -484,28 +484,28 @@ void* Process::memAlloc(const int length)
return ret;
}
int Process::memDealloc(const void *ptr, const int length)
int Process::memDealloc(void *ptr, const int length)
{
// can only free the whole region at once
// vfree returns 0 on error
return !VirtualFree(ptr, 0, MEM_RELEASE)
return !VirtualFree(ptr, 0, MEM_RELEASE);
}
int Process::memProtect(const void *ptr, const int length, const int prot)
int Process::memProtect(void *ptr, const int length, const int prot)
{
int prot_native = 0;
int old_prot = 0;
DWORD old_prot = 0;
// only support a few constant combinations
if (prot == 0)
prot_native = PAGE_NOACCESS;
else if (prot == Process::MemProt::READ)
prot_native = PAGE_READONLY;
else if (prot == Process::MemProt::READ | Process::MemProt::WRITE)
else if (prot == (Process::MemProt::READ | Process::MemProt::WRITE))
prot_native = PAGE_READWRITE;
else if (prot == Process::MemProt::READ | Process::MemProt::WRITE | Process::MemProt::EXECUTE)
else if (prot == (Process::MemProt::READ | Process::MemProt::WRITE | Process::MemProt::EXEC))
prot_native = PAGE_EXECUTE_READWRITE;
else if (prot == Process::MemProt::READ | Process::MemProt::EXECUTE)
else if (prot == (Process::MemProt::READ | Process::MemProt::EXEC))
prot_native = PAGE_EXECUTE_READ;
else
return -1;

@ -964,7 +964,7 @@ DFhackCExport command_result plugin_onupdate ( color_ostream &out )
else if (building_type::TradeDepot == type)
{
df::building_tradedepotst* depot = (df::building_tradedepotst*) build;
trader_requested = depot->trade_flags.bits.trader_requested;
trader_requested = trader_requested || depot->trade_flags.bits.trader_requested;
if (print_debug)
{
if (trader_requested)

@ -21,7 +21,7 @@ module DFHack
when :SelectTrainer
v.trainer_unit[v.trainer_cursor]
end
else
when :viewscreen_dwarfmodest
case ui.main.mode
when :ViewUnits
# nobody selected => idx == 0
@ -33,6 +33,15 @@ module DFHack
else
ui.follow_unit_tg if ui.follow_unit != -1
end
when :viewscreen_dungeonmodest
case ui_advmode.menu
when :Default
world.units.active[0]
else
unit_find(cursor) # XXX
end
when :viewscreen_dungeon_monsterstatusst
curview.unit
end
elsif what.kind_of?(Integer)
# search by id

@ -8,7 +8,12 @@ when 'add'
if u = df.unit_find
$superdwarf_ids |= [u.id]
$superdwarf_onupdate ||= df.onupdate_register(1) {
if df.gamemode == :ADVENTURE
onupdate_delay = nil
else
onupdate_delay = 1
end
$superdwarf_onupdate ||= df.onupdate_register(onupdate_delay) {
if $superdwarf_ids.empty?
df.onupdate_unregister($superdwarf_onupdate)
$superdwarf_onupdate = nil