As an example of this behavior in action:
Open barter with Ajira (Balmora, Guild of Mages) - she has 5 kwama cuttle (her base restock count)
Buy 5 kwama cuttle, close barter, open barter - she has 5, you have 5 (she restocked)
Sell 5 kwama cuttle, close barter, open barter - she has 10, you have 0 (no restock was necessary)
Buy 10 kwama cuttle, close barter, open barter - she has 10, you have 10 (she restocked with 10, not 5)
I hope that makes the expected Vanilla behavior clear.
I would like input on Implementation:
The logic for restocking behavior is found in MWWorld::ContainerStore::restock. The full function signature is:
Code: Select all
void MWWorld::ContainerStore::restock (const ESM::InventoryList& items, const MWWorld::Ptr& ptr, const std::string& owner);
The other option is to leave the function signature as is and come up with some other place to record the fact that the player has sold back some larger amount than the base restock size, and to restock using that value whenever it's greater than the base restock size.
I'm happy to wrap all of this logic with a configuration setting that can TURN THIS FUNCTIONALITY OFF for those who feel like it's cheating, but Scrawl's comments on the bug report suggest that we want the vanilla behavior by default.
Today I have a branch that just const_casts this away as a proof of concept before I go re-plumbing the whole call chain to remove the const. How should I proceed with a correct implementation that will be accepted into the code base?