Skip to content

Commit

Permalink
Merge pull request #5182 from myk002/myk_links_only
Browse files Browse the repository at this point in the history
[stockpiles] don't use uninitialized value for use_links_only
  • Loading branch information
myk002 authored Jan 9, 2025
2 parents 84dc66d + 271de51 commit 0a8b233
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 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:
- `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

0 comments on commit 0a8b233

Please sign in to comment.