Remove precompiled garbage, fix dfcleanmap for real

develop
Petr Mrázek 2011-03-19 20:17:04 +01:00
parent 1cc74b395e
commit 2bc7aacb79
8 changed files with 117 additions and 48 deletions

@ -21,7 +21,7 @@ set(DFHACK_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR
set(CPACK_PACKAGE_NAME "dfhack")
## setting the build type
IF(NOT DEFINED CMAKE_BUILD_TYPE)
IF(NOT DEFINED CMAKE_BUILD_TYPE OR CMAKE_BUILD_TYPE STREQUAL "")
SET(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel.")
ENDIF()
@ -61,6 +61,7 @@ IF(${DFHACK_INSTALL} STREQUAL "portable")
SET(DFHACK_DOXYGEN_DESTINATION dev/doxygen)
ENDIF()
# generic linux package in a .tar.gz
IF(${DFHACK_INSTALL} STREQUAL "linux")
if(WIN32)
MESSAGE(FATAL_ERROR "WTF are you doing?")

@ -130,8 +130,26 @@ template <typename T>
void print_bits ( T val, std::ostream& out )
{
T n_bits = sizeof ( val ) * CHAR_BIT;
for ( unsigned i = 0; i < n_bits; ++i ) {
int cnt;
for ( unsigned i = 0; i < n_bits; ++i )
{
cnt = i/10;
cout << cnt << " ";
}
cout << endl;
for ( unsigned i = 0; i < n_bits; ++i )
{
cnt = i%10;
cout << cnt << " ";
}
cout << endl;
for ( unsigned i = 0; i < n_bits; ++i )
{
cout << "--";
}
cout << endl;
for ( unsigned i = 0; i < n_bits; ++i )
{
out<< !!( val & 1 ) << " ";
val >>= 1;
}

@ -307,7 +307,6 @@ namespace DFHack
unsigned int feature_global : 1;
unsigned int water_stagnant : 1;
unsigned int water_salt : 1;
// e_liquidcharacter liquid_character : 2;
};
/**
* designation bit field wrapper
@ -319,49 +318,98 @@ namespace DFHack
naked_designation bits;
};
/*
* unsigned int mud : 1;
unsigned int vomit :1;*
unsigned int broken_arrows_color :4;
unsigned int blood_g : 1;
unsigned int blood_g2 : 1;
unsigned int blood_b : 1;
unsigned int blood_b2 : 1;
unsigned int blood_y : 1;
unsigned int blood_y2 : 1;
unsigned int blood_m : 1;
unsigned int blood_m2 : 1;
unsigned int blood_c : 1;
unsigned int blood_c2 : 1;
unsigned int blood_w : 1;
unsigned int blood_w2 : 1;
unsigned int blood_o : 1;
unsigned int blood_o2 : 1;
unsigned int slime : 1;
unsigned int slime2 : 1;
unsigned int blood : 1;
unsigned int blood2 : 1;
unsigned int broken_arrows_variant : 1;
unsigned int snow : 1;
*/
/**
* occupancy flags (rat,dwarf,horse,built wall,not build wall,etc)
* \ingroup grp_maps
*/
struct naked_occupancy //FIXME: THIS IS NOT VALID FOR 31.xx versions!!!!
struct naked_occupancy
{
// building type... should be an enum?
// 7 = door
unsigned int building : 3;
/// the tile contains a standing? creature
unsigned int unit : 1;
/// the tile contains a prone creature
/// 0-2: building type... should be an enum.
unsigned int building : 3;// 0-2
/// 3: the tile contains a standing creature
unsigned int unit : 1; // 3
/// 4: the tile contains a prone creature
unsigned int unit_grounded : 1;
/// the tile contains an item
/// 5: the tile contains an item
unsigned int item : 1;
/// changed
unsigned int unknown : 26;
/*
/// splatter. everyone loves splatter. this doesn't seem to be used anymore
unsigned int mud : 1;
unsigned int vomit :1;
unsigned int broken_arrows_color :4;
unsigned int blood_g : 1;
unsigned int blood_g2 : 1;
unsigned int blood_b : 1;
unsigned int blood_b2 : 1;
unsigned int blood_y : 1;
unsigned int blood_y2 : 1;
unsigned int blood_m : 1;
unsigned int blood_m2 : 1;
unsigned int blood_c : 1;
unsigned int blood_c2 : 1;
unsigned int blood_w : 1;
unsigned int blood_w2 : 1;
unsigned int blood_o : 1;
unsigned int blood_o2 : 1;
unsigned int slime : 1;
unsigned int slime2 : 1;
unsigned int blood : 1;
unsigned int blood2 : 1;
/// 6
unsigned int unk6 : 1;
/// 7: mossy!
unsigned int moss : 1;
/// 8-11: arrow color related
unsigned int arrow_color : 4;
/// 12: arrow orientaton
unsigned int broken_arrows_variant : 1;
unsigned int snow : 1;
*/
/// 13
unsigned int unk13 : 1;
/// 14: A monster lair. Items placed won't be moved.
unsigned int monster_lair : 1;
/**
* 15: seems to be set on terrain tiles where grass growth is impossible
* pebbles, boulders, rock floors in the middle of grass. also shrubs. but not trees
*/
unsigned int no_grow : 1;
/// 16
unsigned int unk16 : 1;
/// 17
unsigned int unk17 : 1;
/// 18
unsigned int unk18 : 1;
/// 19
unsigned int unk19 : 1;
/// 20
unsigned int unk20 : 1;
/// 21
unsigned int unk21 : 1;
/// 22
unsigned int unk22 : 1;
/// 23
unsigned int unk23 : 1;
/// 24
unsigned int unk24 : 1;
/// 25
unsigned int unk25 : 1;
/// 26
unsigned int unk26 : 1;
/// 27
unsigned int unk27 : 1;
/// 28
unsigned int unk28 : 1;
/// 29
unsigned int unk29 : 1;
/// 30
unsigned int unk30 : 1;
/// 31
unsigned int unk31 : 1;
};
/**
* occupancy flags (rat,dwarf,horse,built wall,not build wall,etc) wrapper

@ -544,7 +544,7 @@ bool Maps::WriteOccupancy (uint32_t x, uint32_t y, uint32_t z, occupancies40d *b
uint32_t addr = d->block[x*d->y_block_count*d->z_block_count + y*d->z_block_count + z];
if (addr)
{
d->owner->write (addr + d->offsets.occupancy_offset, sizeof (tiletypes40d), (uint8_t *) buffer);
d->owner->write (addr + d->offsets.occupancy_offset, sizeof (occupancies40d), (uint8_t *) buffer);
return true;
}
return false;

Binary file not shown.

Binary file not shown.

@ -54,6 +54,8 @@ int main (int argc, char** argv)
uint8_t zeroes [16][16] = {{0}};
DFHack::occupancies40d occ;
DFHack::t_temperatures tt1;
DFHack::t_temperatures tt2;
// walk the map
for(uint32_t x = 0; x< x_max;x++)
@ -65,17 +67,14 @@ int main (int argc, char** argv)
if(Mapz->isValidBlock(x,y,z))
{
Mapz->ReadVeins(x,y,z,0,0,&splatter);
/*
* FIXME: THIS IS BAD
*/
/*
Mapz->ReadOccupancy(x,y,z,&occ);
for(int i = 0; i < 16; i++)
for(int j = 0; j < 16; j++)
{
occ[i][j].unibits.splatter = 0;
occ[i][j].bits.arrow_color = 0;
occ[i][j].bits.broken_arrows_variant = 0;
}
Mapz->WriteOccupancy(x,y,z,&occ);*/
Mapz->WriteOccupancy(x,y,z,&occ);
for(uint32_t i = 0; i < splatter.size(); i++)
{
DFHack::t_spattervein & vein = splatter[i];

@ -47,6 +47,7 @@ int main (int numargs, const char ** args)
uint32_t region_z_offset = mapsg->getAddress("region_z");
uint32_t designatus = mapblockg->getOffset("designation");
uint32_t occup = mapblockg->getOffset("occupancy");
uint32_t biomus = mapblockg->getOffset("biome_stuffs");
int32_t regionX, regionY, regionZ;
@ -80,8 +81,12 @@ int main (int numargs, const char ** args)
printf("block addr: 0x%x\n", block.origin);
int16_t tiletype = block.tiletypes[tileX][tileY];
naked_designation &des = block.designation[tileX][tileY].bits;
uint32_t designato = block.origin + designatus + (tileX * 16 + tileY) * sizeof(t_designation);
uint32_t occupr = block.origin + occup + (tileX * 16 + tileY) * sizeof(t_occupancy);
printf("designation offset: 0x%x\n", designato);
print_bits<uint32_t>(block.designation[tileX][tileY].whole,std::cout);
std::cout << endl;
printf("occupancy offset: 0x%x\n", occupr);
print_bits<uint32_t>(block.occupancy[tileX][tileY].whole,std::cout);
std::cout << endl;
@ -121,8 +126,6 @@ int main (int numargs, const char ** args)
std::cout << "rained?" << std::endl;
if(des.smooth)
std::cout << "smooth?" << std::endl;
uint32_t designato = block.origin + designatus + (tileX * 16 + tileY) * sizeof(t_designation);
printf("designation offset: 0x%x\n", designato);
printf("biomestuffs: 0x%x\n", block.origin + biomus);
#define PRINT_FLAG( X ) printf("%-16s= %c\n", #X , ( des.X ? 'Y' : ' ' ) )