本文整理汇总了C++中Tiles::has_state方法的典型用法代码示例。如果您正苦于以下问题:C++ Tiles::has_state方法的具体用法?C++ Tiles::has_state怎么用?C++ Tiles::has_state使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tiles
的用法示例。
在下文中一共展示了Tiles::has_state方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: print_map
void print_map(Island* island, int centerX, int centerY, int size) {
Tiles* tiles = island->getTiles();
int xmin = centerX - size;
int xmax = centerX + size;
int ymin = centerY - size;
int ymax = centerY + size;
if (xmin < 0) {
xmin = 0;
xmax = 2 * size;
}
if (xmax >= tiles->width) {
xmin = tiles->width - 2 * size;
xmax = tiles->width;
}
if (ymin < 0) {
ymin = 0;
ymax = 2 * size;
}
if (ymax >= tiles->height) {
ymin = tiles->height - 2 * size;
ymax = tiles->height;
}
for ( int y = ymax - 1; y >= ymin; --y ) {
printf("%2d | ", y);
for ( int x = xmin; x < xmax; ++x ) {
int idx = x + y * tiles->width;
if ( tiles->has_state(x,y,TS_LOCKED)) {
printf("?? ");
}
else if ( tiles->has_state(x,y,TS_UNDEFINED)) {
printf(" ");
}
else {
if ( tiles->getBuildingID(idx) != -1 ) {
printf("%s", gContext->building_definitions.getSign(tiles->getBuildingID(idx)));
if ( tiles->isActive(idx)) {
printf("# ");
}
else if ( tiles->has_state(x,y,TS_COLLECTABLE)) {
printf("* ");
}
else {
printf(" ");
}
}
else if ( tiles->_tiles[idx].ref_id != -1 ) {
printf("xx ");
}
else {
printf("- ");
}
}
}
printf("\n");
}
printf(" -----------------------------------------------------------------\n");
printf(" ");
for (int i = xmin; i < xmax; ++i) {
printf("%2d ", i);
}
printf("\n");
}