diff --git a/data/Memory-ng.xml b/data/Memory-ng.xml
index defc06a00..822ee87e4 100644
--- a/data/Memory-ng.xml
+++ b/data/Memory-ng.xml
@@ -2033,6 +2033,10 @@
maybe
+ fortress = 0, adventure = 1, arena = 0 0xb4a814
+ Game mode: 0xb4a818 . fortress = 0, adventure = 1, arena = 4
+ 0xe2e2a2 seems to be a copy of the first one
+
diff --git a/library/include/dfhack/modules/Maps.h b/library/include/dfhack/modules/Maps.h
index 41f572c0e..d8b92f3bc 100644
--- a/library/include/dfhack/modules/Maps.h
+++ b/library/include/dfhack/modules/Maps.h
@@ -68,7 +68,7 @@ namespace DFHack
int32_t type;
/// bit mask describing how the vein maps to the map block
/// assignment[y] & (1 << x) describes the tile (x, y) of the block
- int16_t assignment[16];
+ int16_t assignment[16];
uint32_t flags;
/// this is NOT part of the DF vein, but an address of the vein as seen by DFhack.
uint32_t address_of;
@@ -112,6 +112,18 @@ namespace DFHack
/// this is NOT part of the DF vein, but an address of the vein as seen by DFhack.
uint32_t address_of;
};
+
+ struct t_worldconstruction
+ {
+ uint32_t vtable;
+ /// material vector index
+ uint32_t material;
+ /// 16x16 array of bits
+ uint16_t assignment[16];
+ /// this is NOT part of the structure, but an address of it as seen by DFhack.
+ uint32_t address_of;
+ };
+
enum BiomeOffset
{
eNorthWest,
@@ -431,7 +443,8 @@ namespace DFHack
std::vector* veins,
std::vector* ices = 0,
std::vector* splatter = 0,
- std::vector* grass = 0
+ std::vector* grass = 0,
+ std::vector* constructions = 0
);
/// read all plants in this block
bool ReadVegetation(uint32_t x, uint32_t y, uint32_t z, std::vector* plants);
diff --git a/library/modules/Maps.cpp b/library/modules/Maps.cpp
index d236cf623..cfd6e61cd 100644
--- a/library/modules/Maps.cpp
+++ b/library/modules/Maps.cpp
@@ -151,6 +151,8 @@ Maps::Maps(DFContextShared* _d)
mem->resolveClassnameToVPtr("block_square_event_material_spatterst",off.vein_spatter_vptr);
off.vein_grass_vptr = 0;
mem->resolveClassnameToVPtr("block_square_event_grassst",off.vein_grass_vptr);
+ off.vein_worldconstruction_vptr = 0;
+ mem->resolveClassnameToVPtr("block_square_event_world_constructionst",off.vein_worldconstruction_vptr);
// upload offsets to SHM server if possible
d->maps_module = 0;
@@ -547,13 +549,14 @@ bool Maps::WriteGlobalFeature(uint32_t x, uint32_t y, uint32_t z, int16_t global
/*
* Block events
*/
-bool Maps::ReadVeins(uint32_t x, uint32_t y, uint32_t z, vector * veins, vector * ices, vector *splatter, vector *grass)
+bool Maps::ReadVeins(uint32_t x, uint32_t y, uint32_t z, vector * veins, vector * ices, vector *splatter, vector *grass, vector *constructions)
{
MAPS_GUARD
t_vein v;
t_frozenliquidvein fv;
t_spattervein sv;
t_grassvein gv;
+ t_worldconstruction wcv;
Process* p = d->owner;
uint32_t addr = d->block[x*d->y_block_count*d->z_block_count + y*d->z_block_count + z];
@@ -561,6 +564,7 @@ bool Maps::ReadVeins(uint32_t x, uint32_t y, uint32_t z, vector * veins,
if(ices) ices->clear();
if(splatter) splatter->clear();
if(grass) splatter->clear();
+ if(constructions) constructions->clear();
Server::Maps::maps_offsets &off = d->offsets;
if (addr)
@@ -608,6 +612,14 @@ try_again:
// store it in the vector
grass->push_back (gv);
}
+ else if(constructions && type == off.vein_worldconstruction_vptr)
+ {
+ // read the splatter vein data (dereference pointer)
+ p->read (temp, sizeof(t_worldconstruction), (uint8_t *) &wcv);
+ wcv.address_of = temp;
+ // store it in the vector
+ constructions->push_back (wcv);
+ }
else
{
string cname = p->readClassName(type);
@@ -631,12 +643,15 @@ try_again:
off.vein_grass_vptr = type;
goto try_again;
}
- #ifdef DEBUG
+ else if(constructions && cname=="block_square_event_world_constructionst")
+ {
+ off.vein_worldconstruction_vptr = type;
+ goto try_again;
+ }
else
{
- cerr << "unknown vein " << cname << endl;
+ cerr << "unknown vein " << cname << hex << " 0x" << temp << " block: 0x" << addr << dec << endl;
}
- #endif
// or it was something we don't care about
}
}
diff --git a/library/shm/mod-maps.h b/library/shm/mod-maps.h
index 56c717b18..9bc026a52 100644
--- a/library/shm/mod-maps.h
+++ b/library/shm/mod-maps.h
@@ -59,6 +59,7 @@ typedef struct
uint32_t vein_ice_vptr;
uint32_t vein_spatter_vptr;
uint32_t vein_grass_vptr;
+ uint32_t vein_worldconstruction_vptr;
/*
GEOLOGY
*/
diff --git a/tools/supported/veinlook.cpp b/tools/supported/veinlook.cpp
index 81fcde949..624baae1e 100644
--- a/tools/supported/veinlook.cpp
+++ b/tools/supported/veinlook.cpp
@@ -537,6 +537,7 @@ main(int argc, char *argv[])
vector IceVeinVector;
vector splatter;
vector grass;
+ vector wconstructs;
t_temperatures b_temp1;
t_temperatures b_temp2;
@@ -784,7 +785,7 @@ main(int argc, char *argv[])
if(hasInorgMats)
do_features(DF, Block, cursorX, cursorY, 50,10, Mats->inorganic);
// read veins
- Maps->ReadVeins(cursorX+i,cursorY+j,cursorZ,&veinVector,&IceVeinVector,&splatter,&grass);
+ Maps->ReadVeins(cursorX+i,cursorY+j,cursorZ,&veinVector,&IceVeinVector,&splatter,&grass, &wconstructs);
// get pointer to block
blockaddr = Maps->getBlockPtr(cursorX+i,cursorY+j,cursorZ);
@@ -885,11 +886,12 @@ main(int argc, char *argv[])
uint32_t icesize = IceVeinVector.size();
uint32_t splattersize = splatter.size();
uint32_t grasssize = grass.size();
- uint32_t totalVeinSize = mineralsize+ icesize + splattersize + grasssize;
+ uint32_t wconstrsize = wconstructs.size();
+ uint32_t totalVeinSize = mineralsize+ icesize + splattersize + grasssize + wconstrsize;
if(vein == totalVeinSize) vein = totalVeinSize - 1;
if(vein < -1) vein = -1;
cprintf("X %d/%d, Y %d/%d, Z %d/%d. Vein %d of %d",cursorX+1,x_max,cursorY+1,y_max,cursorZ,z_max,vein+1,totalVeinSize);
- if(!veinVector.empty() || !IceVeinVector.empty() || !splatter.empty() || !grass.empty())
+ if(!veinVector.empty() || !IceVeinVector.empty() || !splatter.empty() || !grass.empty() || !wconstructs.empty())
{
if(vein != -1 && vein < totalVeinSize)
{
@@ -968,7 +970,7 @@ main(int argc, char *argv[])
cprintf("Spatter: %s",PrintSplatterType(splatter[realvein].mat1,splatter[realvein].mat2,Mats->race).c_str());
}
}
- else
+ else if(vein < mineralsize + icesize + splattersize + grasssize)
{
realvein = vein - mineralsize - icesize - splattersize;
t_grassvein & grassy =grass[realvein];
@@ -985,8 +987,32 @@ main(int argc, char *argv[])
}
}
}
- gotoxy(50,3);
- cprintf("Grass: 0x%x, %s",grassy.address_of, Mats->organic[grassy.material].id);
+ if(hasPlantMats)
+ {
+ gotoxy(50,3);
+ cprintf("Grass: 0x%x, %s",grassy.address_of, Mats->organic[grassy.material].id);
+ }
+ }
+ else
+ {
+ realvein = vein - mineralsize - icesize - splattersize - grasssize;
+ t_worldconstruction & wconstr=wconstructs[realvein];
+ for(uint32_t j = 0; j < 16; j++)
+ {
+ for(uint32_t k = 0; k < 16; k++)
+ {
+ bool set = !!(((1 << k) & wconstr.assignment[j]) >> k);
+ if(set)
+ {
+ putch(k+16,j+16,'$',COLOR_RED);
+ }
+ }
+ }
+ if(hasInorgMats)
+ {
+ gotoxy(50,3);
+ cprintf("Road: 0x%x, %d - %s", wconstr.address_of, wconstr.material,Mats->inorganic[wconstr.material].id);
+ }
}
}
}