NEO-69: Fix output-deny rollback order to prevent item loss.
Remove partial outputs before restoring inputs when output grant is denied, matching StoreMissing and XP-failure compensating paths.pull/103/head
parent
36adfd1897
commit
c5115a3a13
|
|
@ -55,6 +55,8 @@ None.
|
||||||
|
|
||||||
2. ~~**Missing output rollback in store-missing branch** — output-add `StoreMissing` restored inputs but not partial outputs.~~ **Done.** `CompensatingRemoveOutputs` added before input restore on that path.
|
2. ~~**Missing output rollback in store-missing branch** — output-add `StoreMissing` restored inputs but not partial outputs.~~ **Done.** `CompensatingRemoveOutputs` added before input restore on that path.
|
||||||
|
|
||||||
|
3. ~~**Rollback order on output deny** — `Denied` branch restored inputs before removing partial outputs, so `TryAddStack` could fail silently when bag was full.~~ **Done.** Swapped to remove outputs first, then restore inputs (matches `StoreMissing` and XP-failure paths).
|
||||||
|
|
||||||
## Verification
|
## Verification
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
|
|
||||||
|
|
@ -117,8 +117,8 @@ public static class CraftOperations
|
||||||
|
|
||||||
if (addOutcome.Kind == PlayerInventoryMutationKind.Denied)
|
if (addOutcome.Kind == PlayerInventoryMutationKind.Denied)
|
||||||
{
|
{
|
||||||
CompensatingRestoreInputs(playerId, scaledInputs, itemRegistry, inventoryStore);
|
|
||||||
CompensatingRemoveOutputs(playerId, outputsApplied, itemRegistry, inventoryStore);
|
CompensatingRemoveOutputs(playerId, outputsApplied, itemRegistry, inventoryStore);
|
||||||
|
CompensatingRestoreInputs(playerId, scaledInputs, itemRegistry, inventoryStore);
|
||||||
return Deny(CraftReasonCodes.InventoryFull);
|
return Deny(CraftReasonCodes.InventoryFull);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue