本文整理汇总了C++中dfhack::Maps::ReadBlockFlags方法的典型用法代码示例。如果您正苦于以下问题:C++ Maps::ReadBlockFlags方法的具体用法?C++ Maps::ReadBlockFlags怎么用?C++ Maps::ReadBlockFlags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dfhack::Maps
的用法示例。
在下文中一共展示了Maps::ReadBlockFlags方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: df_flows
DFhackCExport command_result df_flows (Core * c, vector <string> & parameters)
{
uint32_t x_max,y_max,z_max;
DFHack::designations40d designations;
DFHack::Maps *Maps;
c->Suspend();
Maps = c->getMaps();
// init the map
if(!Maps->Start())
{
c->con.printerr("Can't init map.\n");
c->Resume();
return CR_FAILURE;
}
DFHack::t_blockflags bflags;
Maps->getSize(x_max,y_max,z_max);
// walk the map, count flowing tiles, magma, water
uint32_t flow1=0, flow2=0, flowboth=0, water=0, magma=0;
c->con.print("Counting flows and liquids ...\n");
for(uint32_t x = 0; x< x_max;x++)
{
for(uint32_t y = 0; y< y_max;y++)
{
for(uint32_t z = 0; z< z_max;z++)
{
if(Maps->getBlock(x,y,z))
{
Maps->ReadBlockFlags(x, y, z, bflags);
Maps->ReadDesignations(x, y, z, &designations);
if (bflags.bits.liquid_1)
flow1++;
if (bflags.bits.liquid_2)
flow2++;
if (bflags.bits.liquid_1 && bflags.bits.liquid_2)
flowboth++;
for (uint32_t i = 0; i < 16;i++) for (uint32_t j = 0; j < 16;j++)
{
if (designations[i][j].bits.liquid_type == DFHack::liquid_magma)
magma++;
if (designations[i][j].bits.liquid_type == DFHack::liquid_water)
water++;
}
}
}
}
}
c->con.print("Blocks with liquid_1=true: %d\n"
"Blocks with liquid_2=true: %d\n"
"Blocks with both: %d\n"
"Water tiles: %d\n"
"Magma tiles: %d\n"
,flow1, flow2, flowboth, water, magma
);
c->Resume();
return CR_OK;
}
示例2: main
//.........这里部分代码省略.........
{
for(int x = 0; x < 16; x++) for(int y = 0; y < 16; y++)
{
int16_t tiletype = Block->tiletypes[x][y];
TileShape tc = tileShape(tiletype);
TileMaterial tm = tileMaterial(tiletype);
if( tc == WALL && tm == VEIN || tc == TREE_OK || tc == TREE_DEAD)
{
Block->designation[x][y].bits.dig = designation_default;
}
}
Maps->WriteDesignations(cursorX+i,cursorY+j,cursorZ, &(Block->designation));
}
// read temperature data
Maps->ReadTemperatures(cursorX+i,cursorY+j,cursorZ,&b_temp1, &b_temp2 );
if(dotwiddle)
{
bitset<32> bs = Block->designation[0][0].whole;
bs.flip(twiddle);
Block->designation[0][0].whole = bs.to_ulong();
Maps->WriteDesignations(cursorX+i,cursorY+j,cursorZ, &(Block->designation));
dotwiddle = false;
}
// do a dump of the block data
if(dump)
{
hexdump(DF,blockaddr,0x1E00,filenum);
filenum++;
}
// read/write dirty bit of the block
Maps->ReadDirtyBit(cursorX+i,cursorY+j,cursorZ,dirtybit);
Maps->ReadBlockFlags(cursorX+i,cursorY+j,cursorZ,bflags);
if(digbit)
{
dirtybit = !dirtybit;
Maps->WriteDirtyBit(cursorX+i,cursorY+j,cursorZ,dirtybit);
}
}
}
}
// Resume, print stuff to the terminal
DF->Resume();
for(int i = -1; i <= 1; i++) for(int j = -1; j <= 1; j++)
{
mapblock40d * Block = &blocks[i+1][j+1];
for(int x = 0; x < 16; x++) for(int y = 0; y < 16; y++)
{
int color = COLOR_BLACK;
color = pickColor(Block->tiletypes[x][y]);
/*
if(!Block->designation[x][y].bits.hidden)
{
puttile(x+(i+1)*16,y+(j+1)*16,Block->tiletypes[x][y], color);
}
else*/
{
attron(A_STANDOUT);
puttile(x+(i+1)*16,y+(j+1)*16,Block->tiletypes[x][y], color);
attroff(A_STANDOUT);
}
}
// print effects for the center tile