Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 52bf998

Browse files
committed
Adapt to review comments by @PatrikLundell
- survey.cpp: rename loop variable for more clarity; replace use of parmeter with use of vector.size(), replace nested vector.at calls with direct index access/subscript as it is faster and easier to read
1 parent 0c304cf commit 52bf998

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

plugins/embark-assistant/survey.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -902,14 +902,15 @@ void embark_assist::survey::high_level_world_survey(embark_assist::defs::geo_dat
902902

903903
//=================================================================================
904904

905-
void reset_mlt_inorganics(embark_assist::defs::mid_level_tiles *mlts, const uint16_t max_inorganic) {
905+
void reset_mlt_inorganics(embark_assist::defs::mid_level_tiles &mlts) {
906+
const uint16_t size = mlts[0][0].metals.size();
906907
for (uint8_t i = 0; i < 16; i++) {
907908
for (uint8_t k = 0; k < 16; k++) {
908-
embark_assist::defs::mid_level_tile &mlt = mlts->at(i).at(k);
909-
for (uint16_t i = 0; i < max_inorganic; i++) {
910-
mlt.metals[i] = false;
911-
mlt.economics[i] = false;
912-
mlt.minerals[i] = false;
909+
embark_assist::defs::mid_level_tile &mlt = mlts[i][k];
910+
for (uint16_t l = 0; l < size; l++) {
911+
mlt.metals[l] = false;
912+
mlt.economics[l] = false;
913+
mlt.minerals[l] = false;
913914
}
914915
}
915916
}
@@ -950,7 +951,7 @@ void embark_assist::survey::survey_mid_level_tile(embark_assist::defs::geo_data
950951
tile->minerals[i] = 0;
951952
}
952953

953-
reset_mlt_inorganics(mlt, state->max_inorganic);
954+
reset_mlt_inorganics(*mlt);
954955

955956
for (uint8_t i = 1; i < 10; i++) survey_results->at(x).at(y).biome_index[i] = -1;
956957

0 commit comments

Comments
 (0)