本文整理汇总了C++中dfhack::Context::getBuildings方法的典型用法代码示例。如果您正苦于以下问题:C++ Context::getBuildings方法的具体用法?C++ Context::getBuildings怎么用?C++ Context::getBuildings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dfhack::Context
的用法示例。
在下文中一共展示了Context::getBuildings方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
//.........这里部分代码省略.........
}
else if(DFHack::STAIR_DOWN == ts)
{
dig [zidx][yidx][xidx] = "j";
build [zidx][yidx][xidx] = "Cd";
}
else if(DFHack::STAIR_UP == ts)
{
dig [zidx][yidx][xidx] = "u";
build [zidx][yidx][xidx] = "Cu";
}
else if(DFHack::STAIR_UPDOWN == ts)
{
dig [zidx][yidx][xidx] = "i";
build [zidx][yidx][xidx] = "Cx";
}
else if(DFHack::isRampTerrain(tt))
{
dig [zidx][yidx][xidx] = "r";
build [zidx][yidx][xidx] = "Cr";
}
else if(DFHack::isWallTerrain(tt))
{
build [zidx][yidx][xidx] = "Cw";
}
}
yidx++;
}
}
}
}
}
}
DFHack::Buildings * Bld = DF->getBuildings();
std::map <uint32_t, std::string> custom_workshop_types;
uint32_t numBuildings;
if(Bld->Start(numBuildings))
{
Bld->ReadCustomWorkshopTypes(custom_workshop_types);
for(uint32_t i = 0; i < numBuildings; i++)
{
DFHack::t_building temp;
Bld->Read(i, temp);
if(temp.type != 0xFFFFFFFF) // check if type isn't invalid
{
std::string typestr;
mem->resolveClassIDToClassname(temp.type, typestr);
if(temp.z == cz1 && cx1 <= temp.x1 && cx2 >= temp.x2 && cy1 <= temp.y1 && cy2 >= temp.y2)
{
string currStr = build[temp.z-cz1][temp.y1-cy1][temp.x1-cx1];
stringstream stream;
string newStr = buildCommands[typestr];
if(temp.x1 != temp.x2)
{
stream << "(" << temp.x2-temp.x1+1 << "x" << temp.y2-temp.y1+1 << ")";
newStr += stream.str();
}
build[temp.z-cz1][temp.y1-cy1][temp.x1-cx1] = newStr + currStr;
}
}
}
}
// for testing purposes
//ofstream outfile("test.txt");
// printVecOfVec(outfile, dig,'\t');
// outfile << endl;