From cc687673367d7b9ea913e73deaf6deaa9d9fa478 Mon Sep 17 00:00:00 2001 From: bseiller Date: Mon, 18 Jan 2021 23:23:50 +0100 Subject: [PATCH 1/5] created struct mid_level_tile_incursion_base that only contains attributes that are relevant for incursion processing - def.h: make attributes/fields of mid_level_tile_incursion_base available in mid_level_tile by inheriting from mid_level_tile_incursion_base which also allows treating mid_level_tile as a mid_level_tile_incursion_base --- plugins/embark-assistant/defs.h | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/plugins/embark-assistant/defs.h b/plugins/embark-assistant/defs.h index 0f34b288a..99db1f7a7 100644 --- a/plugins/embark-assistant/defs.h +++ b/plugins/embark-assistant/defs.h @@ -68,24 +68,29 @@ namespace embark_assist { Woodland, Heavily_Forested }; - - struct mid_level_tile { + + // only contains those attributes that are being handled during incursion processing + struct mid_level_tile_incursion_base { uint8_t aquifer = Clear_Aquifer_Bits; bool clay = false; bool sand = false; + int8_t soil_depth; + int16_t elevation; + int8_t biome_offset; + tree_levels trees; + uint8_t savagery_level; // 0 - 2 + uint8_t evilness_level; // 0 - 2 + }; + + // contains all attributes (some by inheritance), used for regular survey/matching + struct mid_level_tile : public mid_level_tile_incursion_base { bool flux = false; bool coal = false; - int8_t soil_depth; int8_t offset; - int16_t elevation; river_sizes river_size = river_sizes::None; int16_t river_elevation = 100; int8_t adamantine_level; // -1 = none, 0 .. 3 = cavern 1 .. magma sea. Currently not used beyond present/absent. int8_t magma_level; // -1 = none, 0 .. 3 = cavern 3 .. surface/volcano - int8_t biome_offset; - tree_levels trees; - uint8_t savagery_level; // 0 - 2 - uint8_t evilness_level; // 0 - 2 std::vector metals; std::vector economics; std::vector minerals; From bdfd50cc6551645dff6339161b14f83591ffda2f Mon Sep 17 00:00:00 2001 From: bseiller Date: Mon, 18 Jan 2021 23:50:14 +0100 Subject: [PATCH 2/5] using mid_level_tile_incursion_base instead of mid_level_tile for incursion processing - matcher.cpp, survey.cpp: adapting signatures to use new struct that only contains incursion specific attributes --- plugins/embark-assistant/matcher.cpp | 4 ++-- plugins/embark-assistant/survey.cpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/embark-assistant/matcher.cpp b/plugins/embark-assistant/matcher.cpp index 2b5e4728b..36a43d9b3 100644 --- a/plugins/embark-assistant/matcher.cpp +++ b/plugins/embark-assistant/matcher.cpp @@ -68,7 +68,7 @@ namespace embark_assist { void process_embark_incursion(matcher_info *result, embark_assist::defs::world_tile_data *survey_results, - embark_assist::defs::mid_level_tile *mlt, // Note this is a single tile, as opposed to most usages of this variable name. + embark_assist::defs::mid_level_tile_incursion_base *mlt, // Note this is a single tile, as opposed to most usages of this variable name. embark_assist::defs::finders *finder, int16_t elevation, uint16_t x, @@ -2699,7 +2699,7 @@ namespace embark_assist { void merge_incursion_into_world_tile(embark_assist::defs::region_tile_datum* current, embark_assist::defs::region_tile_datum* target_tile, - embark_assist::defs::mid_level_tile* target_mlt) { + embark_assist::defs::mid_level_tile_incursion_base* target_mlt) { df::world_data* world_data = world->world_data; current->aquifer |= target_mlt->aquifer; diff --git a/plugins/embark-assistant/survey.cpp b/plugins/embark-assistant/survey.cpp index e0deb5e58..300750a29 100644 --- a/plugins/embark-assistant/survey.cpp +++ b/plugins/embark-assistant/survey.cpp @@ -455,7 +455,7 @@ namespace embark_assist { void process_embark_incursion(embark_assist::defs::site_infos *site_info, embark_assist::defs::world_tile_data *survey_results, - embark_assist::defs::mid_level_tile *mlt, // Note this is a single tile, as opposed to most usages of this variable name. + embark_assist::defs::mid_level_tile_incursion_base *mlt, // Note this is a single tile, as opposed to most usages of this variable name. int16_t elevation, uint16_t x, uint16_t y) { From e99c8faa24b948fb56365a868d2791568c6c644c Mon Sep 17 00:00:00 2001 From: bseiller Date: Tue, 19 Jan 2021 00:01:54 +0100 Subject: [PATCH 3/5] switching to mid_level_tile_incursion_base to store incursion data of world tile edges - defs.h: using mid_level_tile_incursion_base in region_tile_datum to store incursion data of world tile edges - survey.cpp: commented out "not used" blocks of assignment in survey_mid_level_tile that no longer make sense now --- plugins/embark-assistant/defs.h | 8 +-- plugins/embark-assistant/survey.cpp | 80 ++++++++++++++--------------- 2 files changed, 44 insertions(+), 44 deletions(-) diff --git a/plugins/embark-assistant/defs.h b/plugins/embark-assistant/defs.h index 99db1f7a7..a67660545 100644 --- a/plugins/embark-assistant/defs.h +++ b/plugins/embark-assistant/defs.h @@ -146,10 +146,10 @@ namespace embark_assist { std::vector minerals; std::vector neighbors; // entity_raw indices uint8_t necro_neighbors; - mid_level_tile north_row[16]; - mid_level_tile south_row[16]; - mid_level_tile west_column[16]; - mid_level_tile east_column[16]; + mid_level_tile_incursion_base north_row[16]; + mid_level_tile_incursion_base south_row[16]; + mid_level_tile_incursion_base west_column[16]; + mid_level_tile_incursion_base east_column[16]; uint8_t north_corner_selection[16]; // 0 - 3. For some reason DF stores everything needed for incursion uint8_t west_corner_selection[16]; // detection in 17:th row/colum data in the region details except // this info, so we have to go to neighboring world tiles to fetch it. diff --git a/plugins/embark-assistant/survey.cpp b/plugins/embark-assistant/survey.cpp index 300750a29..fac5af267 100644 --- a/plugins/embark-assistant/survey.cpp +++ b/plugins/embark-assistant/survey.cpp @@ -1381,50 +1381,50 @@ void embark_assist::survey::survey_mid_level_tile(embark_assist::defs::geo_data tile->west_column[i].sand = mlt->at(0).at(i).sand; tile->east_column[i].sand = mlt->at(15).at(i).sand; - tile->north_row[i].flux = mlt->at(i).at(0).flux; // Not used - tile->south_row[i].flux = mlt->at(i).at(15).flux; - tile->west_column[i].flux = mlt->at(0).at(i).flux; - tile->east_column[i].flux = mlt->at(15).at(i).flux; + // tile->north_row[i].flux = mlt->at(i).at(0).flux; // Not used + // tile->south_row[i].flux = mlt->at(i).at(15).flux; + // tile->west_column[i].flux = mlt->at(0).at(i).flux; + // tile->east_column[i].flux = mlt->at(15).at(i).flux; - tile->north_row[i].coal = mlt->at(i).at(0).coal; // Not used - tile->south_row[i].coal = mlt->at(i).at(15).coal; - tile->west_column[i].coal = mlt->at(0).at(i).coal; - tile->east_column[i].coal = mlt->at(15).at(i).coal; + // tile->north_row[i].coal = mlt->at(i).at(0).coal; // Not used + // tile->south_row[i].coal = mlt->at(i).at(15).coal; + // tile->west_column[i].coal = mlt->at(0).at(i).coal; + // tile->east_column[i].coal = mlt->at(15).at(i).coal; tile->north_row[i].soil_depth = mlt->at(i).at(0).soil_depth; tile->south_row[i].soil_depth = mlt->at(i).at(15).soil_depth; tile->west_column[i].soil_depth = mlt->at(0).at(i).soil_depth; tile->east_column[i].soil_depth = mlt->at(15).at(i).soil_depth; - tile->north_row[i].offset = mlt->at(i).at(0).offset; // Not used - tile->south_row[i].offset = mlt->at(i).at(15).offset; - tile->west_column[i].offset = mlt->at(0).at(i).offset; - tile->east_column[i].offset = mlt->at(15).at(i).offset; + // tile->north_row[i].offset = mlt->at(i).at(0).offset; // Not used + // tile->south_row[i].offset = mlt->at(i).at(15).offset; + // tile->west_column[i].offset = mlt->at(0).at(i).offset; + // tile->east_column[i].offset = mlt->at(15).at(i).offset; tile->north_row[i].elevation = mlt->at(i).at(0).elevation; tile->south_row[i].elevation = mlt->at(i).at(15).elevation; tile->west_column[i].elevation = mlt->at(0).at(i).elevation; tile->east_column[i].elevation = mlt->at(15).at(i).elevation; - tile->north_row[i].river_size = mlt->at(i).at(0).river_size; // Not used - tile->south_row[i].river_size = mlt->at(i).at(15).river_size; - tile->west_column[i].river_size = mlt->at(0).at(i).river_size; - tile->east_column[i].river_size = mlt->at(15).at(i).river_size; + // tile->north_row[i].river_size = mlt->at(i).at(0).river_size; // Not used + // tile->south_row[i].river_size = mlt->at(i).at(15).river_size; + // tile->west_column[i].river_size = mlt->at(0).at(i).river_size; + // tile->east_column[i].river_size = mlt->at(15).at(i).river_size; - tile->north_row[i].river_elevation = mlt->at(i).at(0).river_elevation; // Not used - tile->south_row[i].river_elevation = mlt->at(i).at(15).river_elevation; - tile->west_column[i].river_elevation = mlt->at(0).at(i).river_elevation; - tile->east_column[i].river_elevation = mlt->at(15).at(i).river_elevation; + // tile->north_row[i].river_elevation = mlt->at(i).at(0).river_elevation; // Not used + // tile->south_row[i].river_elevation = mlt->at(i).at(15).river_elevation; + // tile->west_column[i].river_elevation = mlt->at(0).at(i).river_elevation; + // tile->east_column[i].river_elevation = mlt->at(15).at(i).river_elevation; - tile->north_row[i].adamantine_level = mlt->at(i).at(0).adamantine_level; // Not used - tile->south_row[i].adamantine_level = mlt->at(i).at(15).adamantine_level; - tile->west_column[i].adamantine_level = mlt->at(0).at(i).adamantine_level; - tile->east_column[i].adamantine_level = mlt->at(15).at(i).adamantine_level; + // tile->north_row[i].adamantine_level = mlt->at(i).at(0).adamantine_level; // Not used + // tile->south_row[i].adamantine_level = mlt->at(i).at(15).adamantine_level; + // tile->west_column[i].adamantine_level = mlt->at(0).at(i).adamantine_level; + // tile->east_column[i].adamantine_level = mlt->at(15).at(i).adamantine_level; - tile->north_row[i].magma_level = mlt->at(i).at(0).magma_level; // Not used - tile->south_row[i].magma_level = mlt->at(i).at(15).magma_level; - tile->west_column[i].magma_level = mlt->at(0).at(i).magma_level; - tile->east_column[i].magma_level = mlt->at(15).at(i).magma_level; + // tile->north_row[i].magma_level = mlt->at(i).at(0).magma_level; // Not used + // tile->south_row[i].magma_level = mlt->at(i).at(15).magma_level; + // tile->west_column[i].magma_level = mlt->at(0).at(i).magma_level; + // tile->east_column[i].magma_level = mlt->at(15).at(i).magma_level; tile->north_row[i].biome_offset = mlt->at(i).at(0).biome_offset; tile->south_row[i].biome_offset = mlt->at(i).at(15).biome_offset; @@ -1446,20 +1446,20 @@ void embark_assist::survey::survey_mid_level_tile(embark_assist::defs::geo_data tile->west_column[i].evilness_level = mlt->at(0).at(i).evilness_level; tile->east_column[i].evilness_level = mlt->at(15).at(i).evilness_level; - tile->north_row[i].metals.resize(0); // Not used - tile->south_row[i].metals.resize(0); - tile->west_column[i].metals.resize(0); - tile->east_column[i].metals.resize(0); + // tile->north_row[i].metals.resize(0); // Not used + // tile->south_row[i].metals.resize(0); + // tile->west_column[i].metals.resize(0); + // tile->east_column[i].metals.resize(0); - tile->north_row[i].economics.resize(0); // Not used - tile->south_row[i].economics.resize(0); - tile->west_column[i].economics.resize(0); - tile->east_column[i].economics.resize(0); + // tile->north_row[i].economics.resize(0); // Not used + // tile->south_row[i].economics.resize(0); + // tile->west_column[i].economics.resize(0); + // tile->east_column[i].economics.resize(0); - tile->north_row[i].minerals.resize(0); // Not used - tile->south_row[i].minerals.resize(0); - tile->west_column[i].minerals.resize(0); - tile->east_column[i].minerals.resize(0); + // tile->north_row[i].minerals.resize(0); // Not used + // tile->south_row[i].minerals.resize(0); + // tile->west_column[i].minerals.resize(0); + // tile->east_column[i].minerals.resize(0); 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]; From cb496c3f59c8f78b40b89eaaa4ff590585806eca Mon Sep 17 00:00:00 2001 From: bseiller Date: Tue, 19 Jan 2021 00:07:28 +0100 Subject: [PATCH 4/5] fixing indention/whitespaces - defs.h: replacing tab with space/blank for indents --- plugins/embark-assistant/defs.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/embark-assistant/defs.h b/plugins/embark-assistant/defs.h index a67660545..9634d7c48 100644 --- a/plugins/embark-assistant/defs.h +++ b/plugins/embark-assistant/defs.h @@ -68,9 +68,9 @@ namespace embark_assist { Woodland, Heavily_Forested }; - - // only contains those attributes that are being handled during incursion processing - struct mid_level_tile_incursion_base { + + // only contains those attributes that are being handled during incursion processing + struct mid_level_tile_incursion_base { uint8_t aquifer = Clear_Aquifer_Bits; bool clay = false; bool sand = false; @@ -82,7 +82,7 @@ namespace embark_assist { uint8_t evilness_level; // 0 - 2 }; - // contains all attributes (some by inheritance), used for regular survey/matching + // contains all attributes (some by inheritance), used for regular survey/matching struct mid_level_tile : public mid_level_tile_incursion_base { bool flux = false; bool coal = false; From 9b9373be4fee372e90ddb5ca0188154c5fe18c8c Mon Sep 17 00:00:00 2001 From: bseiller Date: Tue, 19 Jan 2021 12:06:36 +0100 Subject: [PATCH 5/5] removing commented out assigments --- plugins/embark-assistant/survey.cpp | 50 ----------------------------- 1 file changed, 50 deletions(-) diff --git a/plugins/embark-assistant/survey.cpp b/plugins/embark-assistant/survey.cpp index fac5af267..3691976f2 100644 --- a/plugins/embark-assistant/survey.cpp +++ b/plugins/embark-assistant/survey.cpp @@ -1381,51 +1381,16 @@ void embark_assist::survey::survey_mid_level_tile(embark_assist::defs::geo_data tile->west_column[i].sand = mlt->at(0).at(i).sand; tile->east_column[i].sand = mlt->at(15).at(i).sand; - // tile->north_row[i].flux = mlt->at(i).at(0).flux; // Not used - // tile->south_row[i].flux = mlt->at(i).at(15).flux; - // tile->west_column[i].flux = mlt->at(0).at(i).flux; - // tile->east_column[i].flux = mlt->at(15).at(i).flux; - - // tile->north_row[i].coal = mlt->at(i).at(0).coal; // Not used - // tile->south_row[i].coal = mlt->at(i).at(15).coal; - // tile->west_column[i].coal = mlt->at(0).at(i).coal; - // tile->east_column[i].coal = mlt->at(15).at(i).coal; - tile->north_row[i].soil_depth = mlt->at(i).at(0).soil_depth; tile->south_row[i].soil_depth = mlt->at(i).at(15).soil_depth; tile->west_column[i].soil_depth = mlt->at(0).at(i).soil_depth; tile->east_column[i].soil_depth = mlt->at(15).at(i).soil_depth; - // tile->north_row[i].offset = mlt->at(i).at(0).offset; // Not used - // tile->south_row[i].offset = mlt->at(i).at(15).offset; - // tile->west_column[i].offset = mlt->at(0).at(i).offset; - // tile->east_column[i].offset = mlt->at(15).at(i).offset; - tile->north_row[i].elevation = mlt->at(i).at(0).elevation; tile->south_row[i].elevation = mlt->at(i).at(15).elevation; tile->west_column[i].elevation = mlt->at(0).at(i).elevation; tile->east_column[i].elevation = mlt->at(15).at(i).elevation; - // tile->north_row[i].river_size = mlt->at(i).at(0).river_size; // Not used - // tile->south_row[i].river_size = mlt->at(i).at(15).river_size; - // tile->west_column[i].river_size = mlt->at(0).at(i).river_size; - // tile->east_column[i].river_size = mlt->at(15).at(i).river_size; - - // tile->north_row[i].river_elevation = mlt->at(i).at(0).river_elevation; // Not used - // tile->south_row[i].river_elevation = mlt->at(i).at(15).river_elevation; - // tile->west_column[i].river_elevation = mlt->at(0).at(i).river_elevation; - // tile->east_column[i].river_elevation = mlt->at(15).at(i).river_elevation; - - // tile->north_row[i].adamantine_level = mlt->at(i).at(0).adamantine_level; // Not used - // tile->south_row[i].adamantine_level = mlt->at(i).at(15).adamantine_level; - // tile->west_column[i].adamantine_level = mlt->at(0).at(i).adamantine_level; - // tile->east_column[i].adamantine_level = mlt->at(15).at(i).adamantine_level; - - // tile->north_row[i].magma_level = mlt->at(i).at(0).magma_level; // Not used - // tile->south_row[i].magma_level = mlt->at(i).at(15).magma_level; - // tile->west_column[i].magma_level = mlt->at(0).at(i).magma_level; - // tile->east_column[i].magma_level = mlt->at(15).at(i).magma_level; - tile->north_row[i].biome_offset = mlt->at(i).at(0).biome_offset; tile->south_row[i].biome_offset = mlt->at(i).at(15).biome_offset; tile->west_column[i].biome_offset = mlt->at(0).at(i).biome_offset; @@ -1446,21 +1411,6 @@ void embark_assist::survey::survey_mid_level_tile(embark_assist::defs::geo_data tile->west_column[i].evilness_level = mlt->at(0).at(i).evilness_level; tile->east_column[i].evilness_level = mlt->at(15).at(i).evilness_level; - // tile->north_row[i].metals.resize(0); // Not used - // tile->south_row[i].metals.resize(0); - // tile->west_column[i].metals.resize(0); - // tile->east_column[i].metals.resize(0); - - // tile->north_row[i].economics.resize(0); // Not used - // tile->south_row[i].economics.resize(0); - // tile->west_column[i].economics.resize(0); - // tile->east_column[i].economics.resize(0); - - // tile->north_row[i].minerals.resize(0); // Not used - // tile->south_row[i].minerals.resize(0); - // tile->west_column[i].minerals.resize(0); - // tile->east_column[i].minerals.resize(0); - 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];