Skip to content

Commit

Permalink
Merge pull request #5255 from NicksWorld/fix/changevein_infloop
Browse files Browse the repository at this point in the history
Disallow changing a vein into itself
  • Loading branch information
myk002 authored Feb 7, 2025
2 parents 80a13e3 + d6b16e4 commit bf15f79
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Template for new versions:

## Fixes
- `spectate`: don't allow temporarily modified announcement settings to be written to disk when "auto-unpause" mode is enabled
- `changevein`: fix a crash that could occur when attempting to change a vein into itself

## Misc Improvements
- `spectate`: player-set configuration is now stored globally instead of per-fort
Expand Down
6 changes: 6 additions & 0 deletions plugins/changevein.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,12 @@ command_result df_changevein (color_ostream &out, vector <string> & parameters)
return CR_FAILURE;
}

if (mineral->inorganic_mat == mi.index)
{
out.printerr("Selected tile is already of the target material.\n");
return CR_FAILURE;
}

VeinEdgeBitmask mask = VeinEdgeBitmask(mineral);
mineral->inorganic_mat = mi.index;
ChangeSameBlockVeins(block, mineral, mask, mi.index);
Expand Down

0 comments on commit bf15f79

Please sign in to comment.