Merge pull request #2890 from hobotron-df/issue2888-autodump-flags

[issue-2888] Don't change dump and forbid flags on failed autodump
develop
Myk 2023-02-12 14:30:46 -08:00 committed by GitHub
commit 769d30064b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 7 deletions

@ -26,6 +26,7 @@ Ariphaos Ariphaos
arzyu arzyu arzyu arzyu
Atkana Atkana Atkana Atkana
AtomicChicken AtomicChicken AtomicChicken AtomicChicken
Batt Mush hobotron-df
Bearskie Bearskie Bearskie Bearskie
belal jimhester belal jimhester
Ben Lubar BenLubar Ben Lubar BenLubar

@ -38,6 +38,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
## Fixes ## Fixes
-@ `nestboxes`: fixed bug causing nestboxes themselves to be forbidden, which prevented citizens from using them to lay eggs. Now only eggs are forbidden. -@ `nestboxes`: fixed bug causing nestboxes themselves to be forbidden, which prevented citizens from using them to lay eggs. Now only eggs are forbidden.
- `autobutcher`: implemented work-around for Dwarf Fortress not setting nicknames properly, so that nicknames created in the in-game interface are detected & protect animals from being butchered properly. Note that nicknames for unnamed units are not currently saved by dwarf fortress - use ``enable fix/protect-nicks`` to fix any nicknames created/removed within dwarf fortress so they can be saved/reloaded when you reload the game. - `autobutcher`: implemented work-around for Dwarf Fortress not setting nicknames properly, so that nicknames created in the in-game interface are detected & protect animals from being butchered properly. Note that nicknames for unnamed units are not currently saved by dwarf fortress - use ``enable fix/protect-nicks`` to fix any nicknames created/removed within dwarf fortress so they can be saved/reloaded when you reload the game.
- `autodump`: changed behaviour to only change ``dump`` and ``forbid`` flags if an item is successfully dumped.
## Misc Improvements ## Misc Improvements

@ -396,18 +396,22 @@ static command_result autodump_main(color_ostream &out, vector <string> & parame
if (!need_forbidden && itm->flags.bits.forbid) if (!need_forbidden && itm->flags.bits.forbid)
continue; continue;
if(!destroy) // move to cursor if (!destroy) // move to cursor
{ {
// Change flags to indicate the dump was completed, as if by super-dwarfs
itm->flags.bits.dump = false;
itm->flags.bits.forbid = true;
// Don't move items if they're already at the cursor // Don't move items if they're already at the cursor
if (pos_cursor != pos_item) if (pos_cursor != pos_item)
{ {
if (!Items::moveToGround(MC, itm, pos_cursor)) if (Items::moveToGround(MC, itm, pos_cursor))
{
// Change flags to indicate the dump was completed, as if by super-dwarfs
itm->flags.bits.dump = false;
itm->flags.bits.forbid = true;
}
else
{
out.print("Could not move item: %s\n", out.print("Could not move item: %s\n",
Items::getDescription(itm, 0, true).c_str()); Items::getDescription(itm, 0, true).c_str());
}
} }
} }
else // destroy else // destroy