| 581 | //======================================================================================= |
| 582 | |
| 583 | bool embark_match(embark_assist::defs::world_tile_data *survey_results, |
| 584 | embark_assist::defs::mid_level_tiles *mlt, |
| 585 | uint16_t x, |
| 586 | uint16_t y, |
| 587 | uint16_t start_x, |
| 588 | uint16_t start_y, |
| 589 | embark_assist::defs::finders *finder) { |
| 590 | |
| 591 | // color_ostream_proxy out(Core::getInstance().getConsole()); |
| 592 | df::world_data *world_data = world->world_data; |
| 593 | matcher_info result; |
| 594 | result.elevation = mlt->at(start_x).at(start_y).elevation; |
| 595 | result.min_temperature = survey_results->at(x).at(y).min_temperature[mlt->at(start_x).at(start_y).biome_offset]; |
| 596 | result.max_temperature = survey_results->at(x).at(y).max_temperature[mlt->at(start_x).at(start_y).biome_offset]; |
| 597 | result.metal_1 = finder->metal_1 == -1; |
| 598 | result.metal_2 = finder->metal_2 == -1; |
| 599 | result.metal_3 = finder->metal_3 == -1; |
| 600 | result.economic_1 = finder->economic_1 == -1; |
| 601 | result.economic_2 = finder->economic_2 == -1; |
| 602 | result.economic_3 = finder->economic_3 == -1; |
| 603 | result.mineral_1 = finder->mineral_1 == -1; |
| 604 | result.mineral_2 = finder->mineral_2 == -1; |
| 605 | result.mineral_3 = finder->mineral_3 == -1; |
| 606 | bool failed_match = false; |
| 607 | |
| 608 | if (finder->biome_count_min != -1 || |
| 609 | finder->biome_count_max != -1 || |
| 610 | finder->biome_1 != -1 || |
| 611 | finder->biome_2 != -1 || |
| 612 | finder->biome_3 != -1) { |
| 613 | for (uint8_t i = 0; i <= ENUM_LAST_ITEM(biome_type); i++) result.biomes[i] = false; |
| 614 | } |
| 615 | |
| 616 | for (uint8_t i = 0; i <= ENUM_LAST_ITEM(world_region_type); i++) result.region_types[i] = false; |
| 617 | |
| 618 | for (uint16_t i = start_x; i < start_x + finder->x_dim; i++) { |
| 619 | for (uint16_t k = start_y; k < start_y + finder->y_dim; k++) { |
| 620 | |
| 621 | // Savagery & Evilness |
| 622 | { |
| 623 | result.savagery_found[mlt->at(i).at(k).savagery_level] = true; |
| 624 | result.evilness_found[mlt->at(i).at(k).evilness_level] = true; |
| 625 | |
| 626 | embark_assist::defs::evil_savagery_ranges l = embark_assist::defs::evil_savagery_ranges::Low; |
| 627 | while (true) { |
| 628 | if (mlt->at(i).at(k).savagery_level == static_cast<uint8_t>(l)) { |
| 629 | if (finder->savagery[static_cast <int>(l)] == |
| 630 | embark_assist::defs::evil_savagery_values::Absent) return false; |
| 631 | } |
| 632 | else { |
| 633 | if (finder->savagery[static_cast <int>(l)] == |
| 634 | embark_assist::defs::evil_savagery_values::All) return false; |
| 635 | } |
| 636 | |
| 637 | if (mlt->at(i).at(k).evilness_level == static_cast<uint8_t>(l)) { |
| 638 | if (finder->evilness[static_cast <int>(l)] == |
| 639 | embark_assist::defs::evil_savagery_values::Absent) return false; |
| 640 | } |
no test coverage detected