Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disallow changing a vein into itself #5255

Merged
merged 1 commit into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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