Skip to content

Commit

Permalink
Unstuck tool (in case user closes a non-SHM tool), Windows fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
peterix committed Apr 11, 2010
1 parent d96d201 commit 6aef446
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions tools/CMakeLists.txt
Expand Up @@ -21,6 +21,10 @@ TARGET_LINK_LIBRARIES(dfvdig dfhack)
ADD_EXECUTABLE(dfcleanmap cleanmap.cpp)
TARGET_LINK_LIBRARIES(dfcleanmap dfhack)

# unstuck - make DF run if something goes wrong with the 'normal' memory access method
ADD_EXECUTABLE(dfunstuck unstuck.cpp)
TARGET_LINK_LIBRARIES(dfunstuck dfhack)

IF(UNIX)
# incrementalsearch - a bit like cheat engine, only DF-specific, very basic
# and Linux-only
Expand Down
8 changes: 7 additions & 1 deletion tools/vdig.cpp
Expand Up @@ -105,20 +105,24 @@ class Block
{
return raw.designation[p.x][p.y];
}
DFHack::t_designation setDesignationAt(Point p, DFHack::t_designation des)
bool setDesignationAt(Point p, DFHack::t_designation des)
{
if(!valid) return false;
dirty = true;
//printf("setting block %d/%d/%d , %d %d\n",x,y,z, p.x, p.y);
raw.designation[p.x][p.y] = des;
return true;
}
bool WriteDesignations ()
{
if(!valid) return false;
if(dirty)
{
//printf("writing %d/%d/%d\n",x,y,z);
m->WriteDesignations(x,y,z, &raw.designation);
m->WriteDirtyBit(x,y,z,true);
}
return true;
}
bool valid;
bool dirty;
Expand Down Expand Up @@ -171,6 +175,7 @@ class Layer
{
Block * nblo = new Block(Maps,blockcoord.x,blockcoord.y,z);
blocks[blockcoord] = nblo;
return nblo;
}
}

Expand Down Expand Up @@ -234,6 +239,7 @@ class Layer
p->second->WriteDesignations();
//cout << stonetypes[p->first].id << " : " << p->second << endl;
}
return true;
}
private:
bool valid;
Expand Down

0 comments on commit 6aef446

Please sign in to comment.