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

[stockpiles] don't use uninitialized value for use_links_only #5182

Merged
merged 1 commit into from
Jan 9, 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:
- `preserve-rooms`: handle case where unit records are culled by DF immediately after a unit leaves the map
- `preserve-tombs`: properly re-enable after loading a game that had the tool enabled
- `zone`: assign animal to cage/restraint dialog now allows you to unassign a pet from the cage or restraint if the pet is already somehow assigned (e.g. war dog was in cage and was subsequently assigned to a dwarf)
- `stockpiles`: don't set ``use_links_only`` flag to a random value when the flag is not set to anything in the settings that are being imported

## Misc Improvements
- `strangemood`: add ability to choose Stone Cutting and Stone Carving as the mood skill
Expand Down
9 changes: 4 additions & 5 deletions plugins/stockpiles/StockpileSerializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -904,11 +904,10 @@ void StockpileSettingsSerializer::read_general(color_ostream& out, DeserializeMo

void StockpileSerializer::read_general(color_ostream& out, DeserializeMode mode) {
StockpileSettingsSerializer::read_general(out, mode);
bool use_links_only;
read_elem<bool, bool>(out, "use_links_only", mode,
std::bind(&StockpileSettings::has_use_links_only, mBuffer),
std::bind(&StockpileSettings::use_links_only, mBuffer),
use_links_only);
if (!mBuffer.has_use_links_only())
return;
bool use_links_only = mBuffer.use_links_only();
DEBUG(log, out).print("setting use_links_only to %d\n", use_links_only);
mPile->stockpile_flag.bits.use_links_only = use_links_only;
}

Expand Down
Loading