| 477 | } |
| 478 | |
| 479 | void MapExtras::Block::ParseTiles(TileInfo *tiles) |
| 480 | { |
| 481 | tiletypes40d icetiles; |
| 482 | BlockInfo::SquashFrozenLiquids(block, icetiles); |
| 483 | |
| 484 | COPY(tiles->raw_tiles, block->tiletype); |
| 485 | |
| 486 | for (int x = 0; x < 16; x++) |
| 487 | { |
| 488 | for (int y = 0; y < 16; y++) |
| 489 | { |
| 490 | using namespace df::enums::tiletype_material; |
| 491 | |
| 492 | df::tiletype tt = tiles->raw_tiles[x][y]; |
| 493 | df::coord coord = block->map_pos + df::coord(x,y,0); |
| 494 | bool had_ice = false; |
| 495 | |
| 496 | // Frozen liquid comes topmost |
| 497 | if (tileMaterial(tt) == FROZEN_LIQUID) |
| 498 | { |
| 499 | had_ice = true; |
| 500 | tiles->init_iceinfo(); |
| 501 | |
| 502 | tiles->ice_info->frozen.setassignment(x,y,true); |
| 503 | if (icetiles[x][y] != tiletype::Void) |
| 504 | { |
| 505 | tt = icetiles[x][y]; |
| 506 | } |
| 507 | } |
| 508 | |
| 509 | // The next layer may be construction |
| 510 | bool is_con = false; |
| 511 | |
| 512 | if (tileMaterial(tt) == CONSTRUCTION) |
| 513 | { |
| 514 | df::construction *con = df::construction::find(coord); |
| 515 | if (con) |
| 516 | { |
| 517 | if (!tiles->con_info) |
| 518 | tiles->init_coninfo(); |
| 519 | |
| 520 | is_con = true; |
| 521 | tiles->con_info->constructed.setassignment(x,y,true); |
| 522 | tiles->con_info->tiles[x][y] = tt; |
| 523 | tiles->con_info->mat_type[x][y] = con->mat_type; |
| 524 | tiles->con_info->mat_index[x][y] = con->mat_index; |
| 525 | |
| 526 | tt = con->original_tile; |
| 527 | |
| 528 | // Ice under construction is buggy: |
| 529 | // http://www.bay12games.com/dwarves/mantisbt/view.php?id=6330 |
| 530 | // Therefore we just pretend it wasn't there (if it isn't too late), |
| 531 | // and overwrite it if/when we write the base layer. |
| 532 | if (!had_ice && tileMaterial(tt) == FROZEN_LIQUID) |
| 533 | { |
| 534 | if (icetiles[x][y] != tiletype::Void) |
| 535 | tt = icetiles[x][y]; |
| 536 | } |
nothing calls this directly
no test coverage detected