Bay 12 Games Forum

Please login or register.

Login with username, password and session length
Advanced search  

Author Topic: Reclaimed fortress: Wooden logs reclaimed but untouchable? [SOLVED]  (Read 1603 times)

rezon

  • Bay Watcher
    • View Profile

I reclaimed an above ground dwarven city of mine. One which I had been violently logging for building materials (yes I'm a traitor, but I still slaugther the stupid elves (asking me to stop logging, fools)).
Now I can't build floors or roads anywhere because of the logs spread all over the surface plane, and for some reason my dwarfs won't touch them, not for stockpiling nor for dumping, not even for building a road. I checked my stock-menu which says there is about 2000, and says they are claimed as mine. There is no problems with other objects, only the logs.
Anyone got a clue?
« Last Edit: August 21, 2010, 10:22:02 am by rezon »
Logged

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: Reclaimed fortress: Wooden logs reclaimed but untouchable?
« Reply #1 on: August 06, 2010, 02:20:45 pm »

It's a known bug - they were TaSKed at the time of abandon. If you can force them to move by other means (channel out the floor from beneath them, drop a cave-in near them, or push them around with water), it'll clear the task flag and allow them to be usable.

I suspect that clearing the "tasked" flag for the item within game memory using DFHack might work in a situation like this, though I'm rather surprised nobody's suggested it before (a search turned up nothing).
Logged
P.S. If you don't get this note, let me know and I'll write you another.
It's amazing how dwarves can make a stack of bones completely waterproof and magmaproof.
It's amazing how they can make an entire floodgate out of the bones of 2 cats.

rezon

  • Bay Watcher
    • View Profile
Re: Reclaimed fortress: Wooden logs reclaimed but untouchable?
« Reply #2 on: August 06, 2010, 02:36:28 pm »

Hey, Thanks for the quick reply. I'll try the DfHack way if it's compatible with .12.
Logged

rezon

  • Bay Watcher
    • View Profile
Re: Reclaimed fortress: Wooden logs reclaimed but untouchable?
« Reply #3 on: August 06, 2010, 02:46:50 pm »

Oh damn, I thought DfHack was more accessible than this - and I don't have the necessary skills to write an untask tool myself - so I guess I'll have to test the other method for a log or two.
Logged

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: Reclaimed fortress: Wooden logs reclaimed but untouchable?
« Reply #4 on: August 06, 2010, 03:15:38 pm »

I've managed to come up with a DFHack tool that untasks all items in the current fortress. You'll need an appropriate compiler to build it for your platform.

Code: [Select]
// clears the "tasked" flag on all items
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <sstream>
#include <climits>
#include <vector>
using namespace std;

#include <DFHack.h>
#include <dfhack/DFVector.h>
#include <dfhack/DFTypes.h>

int main ()
{
    DFHack::Process * p;
    unsigned int i;
    DFHack::ContextManager DFMgr("Memory.xml");
    DFHack::Context * DF;
    try
    {
        DF = DFMgr.getSingleContext();
        DF->Attach();
    }
    catch (exception& e)
    {
        cerr << e.what() << endl;
#ifndef LINUX_BUILD
        cin.ignore();
#endif
        return 1;
    }

    DFHack::memory_info * mem = DF->getMemoryInfo();
    p = DF->getProcess();
    DFHack::DfVector <uint32_t> p_items (p, p->getDescriptor()->getAddress ("items_vector"));
    uint32_t size = p_items.size();


    int numtasked = 0;
    for (i=0;i<size;i++)
    {
        DFHack::t_itemflags flags;
        flags.whole = p->readDWord(p_items[i] + 0x0C);
        if (flags.bits.in_job)
        {
            flags.bits.in_job = 0;
            p->writeDWord(p_items[i] + 0x0C, flags.whole);
            numtasked++;
        }
    }
    cout << "Found and untasked " << numtasked << " items." << endl;

#ifndef LINUX_BUILD
    cout << "Done. Press any key to continue" << endl;
    cin.ignore();
#endif
    return 0;
}

I embarked, deconstructed my wagon, placed a wood stockpile nearby and ran long enough for the logs to be tasked for hauling (but not long enough for any of them to be picked up), then abandoned. I then reclaimed the fort, reclaimed the logs, then tried to build a wall - it wouldn't let me. After running my tool (and seeing it print "Found and untasked 3 items."), I was able to select the 3 logs as building materials - I didn't wait long enough to see if they would actually be used properly, but I suspect it'd work out in the end. Running the tool in an active fortress would likely have unpredictable results, ranging from "Urist McDwarf cancels task: Job item lost or destroyed" to crashes.
« Last Edit: August 06, 2010, 03:19:51 pm by Quietust »
Logged
P.S. If you don't get this note, let me know and I'll write you another.
It's amazing how dwarves can make a stack of bones completely waterproof and magmaproof.
It's amazing how they can make an entire floodgate out of the bones of 2 cats.

rezon

  • Bay Watcher
    • View Profile
Re: Reclaimed fortress: Wooden logs reclaimed but untouchable?
« Reply #5 on: August 06, 2010, 04:18:50 pm »

Wow you are my hero :D - I'll probably have to research some stuff (I never should have quit computer science to literature :-P) before I get the right compiler etc.. But I'll share my experience when I succeed.
Logged

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: Reclaimed fortress: Wooden logs reclaimed but untouchable?
« Reply #6 on: August 06, 2010, 04:24:37 pm »

I tested it a bit further, and running dfuntask.exe in the middle of a build operation didn't seem to cause problems if nothing else happened to the object, but if I suspended the job, untasked the material, then used it for a different job, the other job would cancel with "Job item lost or destroyed" + "The dwarves were unable to complete [structure]" upon unsuspending, which is exactly what happens if something else disrupts the building material (such as a cave-in or channeling the floor out from underneath it).
Logged
P.S. If you don't get this note, let me know and I'll write you another.
It's amazing how dwarves can make a stack of bones completely waterproof and magmaproof.
It's amazing how they can make an entire floodgate out of the bones of 2 cats.

Tokeli

  • Bay Watcher
  • Oh wow, mew
    • View Profile
Re: Reclaimed fortress: Wooden logs reclaimed but untouchable?
« Reply #7 on: August 06, 2010, 05:10:14 pm »

Quote
I've managed to come up with a DFHack tool that untasks all items in the current fortress. You'll need an appropriate compiler to build it for your platform.

I don't suppose you could attach your compiled .exe version, pretty please? :(
Logged

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: Reclaimed fortress: Wooden logs reclaimed but untouchable?
« Reply #8 on: August 06, 2010, 06:55:20 pm »

Quote
I've managed to come up with a DFHack tool that untasks all items in the current fortress. You'll need an appropriate compiler to build it for your platform.

I don't suppose you could attach your compiled .exe version, pretty please? :(

I had compiled it using Visual C++ 2010 Express, but it crashed when I tried running it with the existing dfhack.dll - it would only run properly with the dfhack.dll that was compiled along with it, and I'd rather not have to post both of them together. Someone else should be able to build it using mingw and get it to work properly.
Logged
P.S. If you don't get this note, let me know and I'll write you another.
It's amazing how dwarves can make a stack of bones completely waterproof and magmaproof.
It's amazing how they can make an entire floodgate out of the bones of 2 cats.

FleshForge

  • Bay Watcher
    • View Profile
Re: Reclaimed fortress: Wooden logs reclaimed but untouchable?
« Reply #9 on: August 12, 2010, 01:50:10 pm »

From the compile docs...
Building
open up cmd and navigate to the dfhack\build folder, run cmake and the mingw version of make:


but the build folder isn't included in the current version from http://github.com/peterix/dfhack/downloads ... which of the older distributions contains the makefil(s)?
Logged

FleshForge

  • Bay Watcher
    • View Profile
Re: Reclaimed fortress: Wooden logs reclaimed but untouchable?
« Reply #10 on: August 12, 2010, 02:59:05 pm »

Ugh I'm way too uninformed to figure this out.  If someone that knows how is kind of enough to compile this I'm sure everyone would be really grateful.
Logged

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: Reclaimed fortress: Wooden logs reclaimed but untouchable?
« Reply #11 on: August 12, 2010, 09:29:02 pm »

The "current version" you want is the 0.4.0.5 "tgz"/"zip" in the 2nd table - that one includes all of the sources. From that, it'd probably be simplest to copy/paste my code on top of one of the existing tools like dfreveal and rename the executable once it bulds.
Logged
P.S. If you don't get this note, let me know and I'll write you another.
It's amazing how dwarves can make a stack of bones completely waterproof and magmaproof.
It's amazing how they can make an entire floodgate out of the bones of 2 cats.

mLegion

  • Bay Watcher
    • View Profile
Re: Reclaimed fortress: Wooden logs reclaimed but untouchable?
« Reply #12 on: August 13, 2010, 12:42:53 pm »

dfcleartask.exe zipped
http://www.mediafire.com/?k45v4g42cbp703p

built with the 4.0.5 version of dfhack.

sorry about the edits, accidentally uploaded the debug build the first time.
« Last Edit: August 13, 2010, 01:04:32 pm by mLegion »
Logged

Quietust

  • Bay Watcher
  • Does not suffer fools gladly
    • View Profile
    • QMT Productions
Re: Reclaimed fortress: Wooden logs reclaimed but untouchable?
« Reply #13 on: August 13, 2010, 12:49:52 pm »

[edit] Seems to work nicely now that you've reuploaded it.
« Last Edit: August 13, 2010, 01:11:07 pm by Quietust »
Logged
P.S. If you don't get this note, let me know and I'll write you another.
It's amazing how dwarves can make a stack of bones completely waterproof and magmaproof.
It's amazing how they can make an entire floodgate out of the bones of 2 cats.

rezon

  • Bay Watcher
    • View Profile
Re: Reclaimed fortress: Wooden logs reclaimed but untouchable?
« Reply #14 on: August 21, 2010, 10:21:38 am »

Cool it is working :D - thanks alot. This should be included in something. It seems like it might be useful in more than the case treated here.
Logged