Merge remote-tracking branch 'PatrikLundell/embark-assistant' into develop

develop
lethosor 2020-07-16 01:47:57 -04:00
commit a0d627ebc7
No known key found for this signature in database
GPG Key ID: 76A269552F4F58C1
3 changed files with 30 additions and 6 deletions

@ -37,6 +37,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
- Fixed a segfault when attempting to start a headless session with a graphical PRINT_MODE setting
- Fixed an issue with the macOS launcher failing to un-quarantine some files
- `labormanager`: fixed handling of new jobs in 0.47
- `embark-assistant`: fixed a couple of incursion handling bugs.
- Fixed ``Units::isEggLayer``, ``Units::isGrazer``, ``Units::isMilkable``, ``Units::isTrainableHunting``, ``Units::isTrainableWar``, and ``Units::isTamable`` ignoring the unit's caste
- `RemoteFortressReader`: fixed a couple crashes that could result from decoding invalid enum items (``site_realization_building_type`` and ``improvement_type``)

@ -119,6 +119,8 @@ namespace embark_assist {
df::world_region_type region_type[16][16]; // Required for incursion override detection. We could store only the
// edges, but storing it for every tile allows for a unified fetching
// logic.
int8_t north_row_biome_x[16]; // "biome_x" data cached for the northern row for access from the north.
int8_t west_column_biome_y[16]; // "biome_y" data cached for the western row for access from the west.
};
struct geo_datum {

@ -1470,6 +1470,8 @@ void embark_assist::survey::survey_mid_level_tile(embark_assist::defs::geo_data
tile->north_corner_selection[i] = world_data->region_details[0]->edges.biome_corner[i][0];
tile->west_corner_selection[i] = world_data->region_details[0]->edges.biome_corner[0][i];
tile->north_row_biome_x[i] = world_data->region_details[0]->edges.biome_x[i][0];
tile->west_column_biome_y[i] = world_data->region_details[0]->edges.biome_y[0][i];
}
for (uint8_t i = 0; i < 16; i++) {
@ -1601,7 +1603,7 @@ df::world_region_type embark_assist::survey::region_type_of(embark_assist::defs:
int16_t effective_y = y;
int8_t effective_i = i;
int8_t effective_k = k;
adjust_coordinates(&effective_x, &effective_y, &effective_i, &effective_i);
adjust_coordinates(&effective_x, &effective_y, &effective_i, &effective_k);
if (effective_x < 0 ||
effective_x >= world_data->world_width ||
@ -1657,7 +1659,7 @@ uint8_t embark_assist::survey::translate_corner(embark_assist::defs::world_tile
effective_k = k + 1;
}
adjust_coordinates(&effective_x, &effective_y, &effective_i, &effective_i);
adjust_coordinates(&effective_x, &effective_y, &effective_i, &effective_k);
if (effective_x == world_data->world_width) {
if (effective_y == world_data->world_height) { // Only the SE corner of the SE most tile of the world can reference this.
@ -1919,7 +1921,17 @@ uint8_t embark_assist::survey::translate_ns_edge(embark_assist::defs::world_tile
north_region_type = embark_assist::survey::region_type_of(survey_results, x, y, i, k - 1);
}
else {
effective_edge = world_data->region_details[0]->edges.biome_x[i][k + 1];
if (k < 15) { // We're still within the same world tile
effective_edge = world_data->region_details[0]->edges.biome_x[i][k + 1];
}
else { // Getting the data from the world tile to the south
if (y + 1 == world_data->world_height) {
return 4; // There's nothing to the south, so we fall back on our own tile.
}
effective_edge = survey_results->at(x).at(y + 1).north_row_biome_x[i];
}
north_region_type = embark_assist::survey::region_type_of(survey_results, x, y, i, k);
south_region_type = embark_assist::survey::region_type_of(survey_results, x, y, i, k + 1);
}
@ -1993,7 +2005,16 @@ uint8_t embark_assist::survey::translate_ew_edge(embark_assist::defs::world_tile
west_region_type = embark_assist::survey::region_type_of(survey_results, x, y, i - 1, k);
}
else {
effective_edge = world_data->region_details[0]->edges.biome_y[i + 1][k];
if (i < 15) { // We're still within the same world tile
effective_edge = world_data->region_details[0]->edges.biome_y[i + 1][k];
}
else { // Getting the data from the world tile to the east
if (x + 1 == world_data->world_width) {
return 4; // There's nothing to the east, so we fall back on our own tile.
}
effective_edge = survey_results->at(x + 1).at(y).west_column_biome_y[k];
}
west_region_type = embark_assist::survey::region_type_of(survey_results, x, y, i, k);
east_region_type = embark_assist::survey::region_type_of(survey_results, x, y, i + 1, k);
}
@ -2424,7 +2445,7 @@ void embark_assist::survey::survey_embark(embark_assist::defs::mid_level_tiles *
}
else {
process_embark_incursion_mid_level_tile
(translate_ns_edge(survey_results,
(translate_ew_edge(survey_results,
true,
x,
y,
@ -2481,7 +2502,7 @@ void embark_assist::survey::survey_embark(embark_assist::defs::mid_level_tiles *
}
else {
process_embark_incursion_mid_level_tile
(translate_ns_edge(survey_results,
(translate_ew_edge(survey_results,
false,
x,
y,