v50 Steam/Premium information for editors
  • v50 information can now be added to pages in the main namespace. v0.47 information can still be found in the DF2014 namespace. See here for more details on the new versioning policy.
  • Use this page to report any issues related to the migration.
This notice may be cached—the current version can be found here.

User talk:Rick/Memory research

From Dwarf Fortress Wiki
Jump to navigation Jump to search

Voodoo[edit]

Hi Rick,
you may be interested in the "Voodoo" section on my user talk page.
0x517A5D 01:28, 8 November 2007 (EST)

Thanks for the info, though it wasn't necessary. :) --Rick 04:59, 8 November 2007 (EST)
So you found something similar, or you just intend to rediscover/recompile for each new version? Not being snarky here, honestly curious.
0x517A5D 12:42, 8 November 2007 (EST)
There are easier ways, yes. --Rick 13:13, 8 November 2007 (EST)

Suspend[edit]

On another topic, I was looking at reveal's main.cpp and saw a bug. You're not suspending/resuming the process. The problem is that process handles are not thread handles, and SuspendThread() and friends use thread handles. You do this:

GetWindowThreadProcessId(window, &pid);
[...]
SuspendThread(process);
cleanMap(process);
ResumeThread(process);
CloseHandle(process);

But you need to do something like this:

thread = GetWindowThreadProcessId(window, &pid);
[...]
SuspendThread(thread);
cleanMap(process);
ResumeThread(thread);
CloseHandle(thread);
CloseHandle(process);


0x517A5D 12:42, 8 November 2007 (EST)

That's probably a leftover from having old code laying around, I know I fixed this in some other tools but forgot to update older ones. Thanks! --Rick 13:08, 8 November 2007 (EST)

Definitions for some map data block fields[edit]

Caveat: My research was done with 33c while your page refers to 33a, but I don't believe the map data offsets have changed.

I think I've figured out what the list of shorts at 0x1160 in the map data block is. If a tile isn't some place that a creature can stand, the value for the square is 0. Otherwise, any region of tiles that are connected in terms of walking all share a single value. If, for example, your main fortress all has a value of 2, and you lock the door to a room inside, the value for the inside of the room will change to whatever's next available (let's say 7), and the value for the door will change to 0. So it seems to be some sort of notion of regions, rooms, or zones for pathfinding.

Also, for the list of longs labeled as pathfinding in the table, it seems that it's equal to 0x00000000 if the tile isn't reachable by any dwarf (which is true if the zone contains no dwarves). So to use the example from before, if there weren't any dwarves in the room, it'd have a pathfinding of 0 but it would still have a unique pathfinding zone.

For 0x1360, it seems to be some sort of vague notion of "distance from the edge". Non-walkable squares are all 0. The walkable edge squares of the map are all 1. Any square at most 10 steps away from a 1 square is a 2. Any square at most 10 steps away from a 2 is a 3, and so on. Also, subterranean squares seem to all be 0, but indoor surface squares have their regular non-zero value. The inside of a locked, outdoor shed seems to be the same as if the door was unlocked. This value seems to mostly ignore constructions and digging when calculating itself.

As far as practical uses goes, it seems that if the tile's 0x1360 value is non-zero, than you've found the Z=0 tile for a given X/Y coordinate. -- Erasmus Darwin 10:59, 30 November 2007 (EST)

Also, Designation flag 0x400000 signifies aquifer rock (it's currently labeled "Damp?"). If set on a piece of wall, water will start flowing out of it. (Caveat: This may be affected by the flow calculation optimizations. I haven't really tested. If water doesn't start flowing, just dig in the map block to force a recalculation of whether or not that map block has water flow.) -- Erasmus Darwin 13:49, 30 November 2007 (EST)