本文整理汇总了C++中mapextras::MapCache::temperature1At方法的典型用法代码示例。如果您正苦于以下问题:C++ MapCache::temperature1At方法的具体用法?C++ MapCache::temperature1At怎么用?C++ MapCache::temperature1At使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mapextras::MapCache
的用法示例。
在下文中一共展示了MapCache::temperature1At方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: df_probe
command_result df_probe (color_ostream &out, vector <string> & parameters)
{
//bool showBlock, showDesig, showOccup, showTile, showMisc;
/*
if (!parseOptions(parameters, showBlock, showDesig, showOccup,
showTile, showMisc))
{
out.printerr("Unknown parameters!\n");
return CR_FAILURE;
}
*/
CoreSuspender suspend;
DFHack::Materials *Materials = Core::getInstance().getMaterials();
std::vector<t_matglossInorganic> inorganic;
bool hasmats = Materials->CopyInorganicMaterials(inorganic);
if (!Maps::IsValid())
{
out.printerr("Map is not available!\n");
return CR_FAILURE;
}
MapExtras::MapCache mc;
int32_t regionX, regionY, regionZ;
Maps::getPosition(regionX,regionY,regionZ);
int32_t cursorX, cursorY, cursorZ;
Gui::getCursorCoords(cursorX,cursorY,cursorZ);
if(cursorX == -30000)
{
out.printerr("No cursor; place cursor over tile to probe.\n");
return CR_FAILURE;
}
DFCoord cursor (cursorX,cursorY,cursorZ);
uint32_t blockX = cursorX / 16;
uint32_t tileX = cursorX % 16;
uint32_t blockY = cursorY / 16;
uint32_t tileY = cursorY % 16;
MapExtras::Block * b = mc.BlockAt(cursor/16);
if(!b || !b->is_valid())
{
out.printerr("No data.\n");
return CR_OK;
}
auto &block = *b->getRaw();
out.print("block addr: 0x%x\n\n", &block);
/*
if (showBlock)
{
out.print("block flags:\n");
print_bits<uint32_t>(block.blockflags.whole,out);
out.print("\n\n");
}
*/
df::tiletype tiletype = mc.tiletypeAt(cursor);
df::tile_designation &des = block.designation[tileX][tileY];
df::tile_occupancy &occ = block.occupancy[tileX][tileY];
/*
if(showDesig)
{
out.print("designation\n");
print_bits<uint32_t>(block.designation[tileX][tileY].whole,
out);
out.print("\n\n");
}
if(showOccup)
{
out.print("occupancy\n");
print_bits<uint32_t>(block.occupancy[tileX][tileY].whole,
out);
out.print("\n\n");
}
*/
// tiletype
out.print("tiletype: ");
describeTile(out, tiletype);
out.print("static: ");
describeTile(out, mc.staticTiletypeAt(cursor));
out.print("base: ");
describeTile(out, mc.baseTiletypeAt(cursor));
out.print("temperature1: %d U\n",mc.temperature1At(cursor));
out.print("temperature2: %d U\n",mc.temperature2At(cursor));
int offset = block.region_offset[des.bits.biome];
int bx = clip_range(block.region_pos.x + (offset % 3) - 1, 0, world->world_data->world_width-1);
int by = clip_range(block.region_pos.y + (offset / 3) - 1, 0, world->world_data->world_height-1);
auto biome = &world->world_data->region_map[bx][by];
int sav = biome->savagery;
//.........这里部分代码省略.........
示例2: df_probe
//.........这里部分代码省略.........
}
if(showOccup)
{
con.print("occupancy\n");
print_bits<uint32_t>(block.occupancy[tileX][tileY].whole,
con);
con.print("\n\n");
}
*/
// tiletype
con.print("tiletype: %d", tiletype);
if(tileName(tiletype))
con.print(" = %s",tileName(tiletype));
con.print("\n");
df::tiletype_shape shape = tileShape(tiletype);
df::tiletype_material material = tileMaterial(tiletype);
df::tiletype_special special = tileSpecial(tiletype);
df::tiletype_variant variant = tileVariant(tiletype);
con.print("%-10s: %4d %s\n","Class" ,shape,
ENUM_KEY_STR(tiletype_shape, shape));
con.print("%-10s: %4d %s\n","Material" ,
material, ENUM_KEY_STR(tiletype_material, material));
con.print("%-10s: %4d %s\n","Special" ,
special, ENUM_KEY_STR(tiletype_special, special));
con.print("%-10s: %4d %s\n" ,"Variant" ,
variant, ENUM_KEY_STR(tiletype_variant, variant));
con.print("%-10s: %s\n" ,"Direction",
tileDirection(tiletype).getStr());
con.print("\n");
con.print("temperature1: %d U\n",mc.temperature1At(cursor));
con.print("temperature2: %d U\n",mc.temperature2At(cursor));
// biome, geolayer
con << "biome: " << des.bits.biome << std::endl;
con << "geolayer: " << des.bits.geolayer_index
<< std::endl;
int16_t base_rock = mc.baseMaterialAt(cursor);
if(base_rock != -1)
{
con << "Layer material: " << dec << base_rock;
if(hasmats)
con << " / " << inorganic[base_rock].id
<< " / "
<< inorganic[base_rock].name
<< endl;
else
con << endl;
}
int16_t vein_rock = mc.veinMaterialAt(cursor);
if(vein_rock != -1)
{
con << "Vein material (final): " << dec << vein_rock;
if(hasmats)
con << " / " << inorganic[vein_rock].id
<< " / "
<< inorganic[vein_rock].name
<< endl;
else
con << endl;
}
// liquids
if(des.bits.flow_size)