| 464 | } |
| 465 | |
| 466 | command_result revflood(color_ostream &out, vector<string> & params) { |
| 467 | for (auto & param : params) { |
| 468 | if (param == "help" || param == "?") |
| 469 | return CR_WRONG_USAGE; |
| 470 | } |
| 471 | |
| 472 | if (!Maps::IsValid()) { |
| 473 | out.printerr("Map is not available!\n"); |
| 474 | return CR_FAILURE; |
| 475 | } |
| 476 | |
| 477 | if (revealed != NOT_REVEALED) { |
| 478 | out.printerr("This is only safe to use with non-revealed map.\n"); |
| 479 | return CR_FAILURE; |
| 480 | } |
| 481 | |
| 482 | if(!World::isFortressMode()) { |
| 483 | out.printerr("Only in proper dwarf mode.\n"); |
| 484 | return CR_FAILURE; |
| 485 | } |
| 486 | |
| 487 | df::coord pos; |
| 488 | Gui::getCursorCoords(pos); |
| 489 | if (!pos.isValid()) { |
| 490 | df::unit *unit = Gui::getSelectedUnit(out, true); |
| 491 | if (unit) |
| 492 | pos = Units::getPosition(unit); |
| 493 | } |
| 494 | if (!pos.isValid()) { |
| 495 | for (auto unit : Units::citizensRange(world->units.active)) { |
| 496 | pos = Units::getPosition(unit); |
| 497 | break; |
| 498 | } |
| 499 | } |
| 500 | if (!pos.isValid()) { |
| 501 | out.printerr("Please select a unit or place the keyboard cursor at some empty space you want to be unhidden.\n"); |
| 502 | return CR_FAILURE; |
| 503 | } |
| 504 | |
| 505 | df::tiletype *tt = Maps::getTileType(pos); |
| 506 | if (!tt || isWallTerrain(*tt)) { |
| 507 | out.printerr("Please select a unit or place the keyboard cursor at some empty space you want to be unhidden.\n"); |
| 508 | return CR_FAILURE; |
| 509 | } |
| 510 | |
| 511 | for (auto & b : world->map.map_blocks) { |
| 512 | // change the hidden flag to 0 |
| 513 | for (uint32_t x = 0; x < 16; x++) for (uint32_t y = 0; y < 16; y++) |
| 514 | { |
| 515 | b->designation[x][y].bits.hidden = 1; |
| 516 | } |
| 517 | } |
| 518 | |
| 519 | unhideFlood_internal(pos); |
| 520 | |
| 521 | return CR_OK; |
| 522 | } |
| 523 |
nothing calls this directly
no test coverage detected