diff options
| author | Quietust | 2012-01-31 20:10:21 -0600 |
|---|---|---|
| committer | Quietust | 2012-01-31 20:10:21 -0600 |
| commit | cad31c505e9c2b1edb3c171c3be6549e06f3d167 (patch) | |
| tree | e24110371415272b8bd5d821a2ac7ce60bc9d226 /plugins/fixveins.cpp | |
| parent | e5b1433d4499a4eb9691d43d6efc023bdf8e2793 (diff) | |
| download | dfhack-cad31c505e9c2b1edb3c171c3be6549e06f3d167.tar.gz dfhack-cad31c505e9c2b1edb3c171c3be6549e06f3d167.tar.bz2 dfhack-cad31c505e9c2b1edb3c171c3be6549e06f3d167.tar.xz | |
Some fixes for fixveins
* Ignore map feature tiles if the map feature does not specify a material
* Ignore mineral tiles if a map feature material is also present
Diffstat (limited to 'plugins/fixveins.cpp')
| -rw-r--r-- | plugins/fixveins.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/plugins/fixveins.cpp b/plugins/fixveins.cpp index 44b21175..e86bb01d 100644 --- a/plugins/fixveins.cpp +++ b/plugins/fixveins.cpp @@ -65,19 +65,27 @@ DFhackCExport command_result df_fixveins (Core * c, vector <string> & parameters for (int k = 0; k < 16; k++) has_mineral[k] |= mineral->tile_bitmask[k]; } + t_feature local, global; + Maps::GetGlobalFeature(global, block->global_feature); + Maps::GetLocalFeature(local, df::coord2d(block->map_pos.x / 16, block->map_pos.y / 16), block->local_feature); for (int x = 0; x < 16; x++) { for (int y = 0; y < 16; y++) { + bool has_feature = ((block->designation[x][y].bits.feature_global) && (global.main_material != -1) && (global.sub_material != -1)) || + ((block->designation[x][y].bits.feature_local) && (local.main_material != -1) && (local.sub_material != -1)); + bool has_vein = has_mineral[y] & (1 << x); + if (has_feature) + has_vein = false; int16_t oldT = block->tiletype[x][y]; TileMaterial mat = tileMaterial(oldT); - if ((mat == VEIN) && !(has_mineral[y] & (1 << x))) + if ((mat == VEIN) && !has_vein) mineral_removed += setTileMaterial(block->tiletype[x][y], STONE); - if ((mat == STONE) && (has_mineral[y] & (1 << x))) + if ((mat == STONE) && has_vein) mineral_added += setTileMaterial(block->tiletype[x][y], VEIN); - if ((mat == FEATSTONE) && !(block->designation[x][y].bits.feature_local || block->designation[x][y].bits.feature_global)) + if ((mat == FEATSTONE) && !has_feature) feature_removed += setTileMaterial(block->tiletype[x][y], STONE); - if ((mat == STONE) && (block->designation[x][y].bits.feature_local || block->designation[x][y].bits.feature_global)) + if ((mat == STONE) && has_feature) feature_added += setTileMaterial(block->tiletype[x][y], FEATSTONE); } } |
