I've been playing with the
craft screen inventory changes that I made, and I'm pretty happy with how it works. For me, this is the change that pushes the new equipment system from being
an ok alternative, to being a superior system. For how I use the equipment screens, this is a necessary upgrade. However, there is still one minor annoyance that I'd like to fix up. Unfortunately, it might take a bit of rewriting to resolve. It's about what happens when there is not enough equipment for the 'extra' craft gear (i.e. items that are on the craft, but not assigned to any soldier on the craft).
When there is plenty of equipment, moving a soldier onto the craft will move their equipment with them, and moving them off the craft moves their equipment off too - leaving exactly the same 'extra' equipment on the craft as when you first started. That's good. But if there is not enough items in the base for both the soldier's equipment and the extra equipment, it's different. The soldier claims ownership of the equipment so that they can complete their loadout; and so when they leave the craft they take the equipment with them.
For example, suppose you have 2 laser rifles available in your base and you want to bring them on every mission, so you assign them as 'extra' equipment on the craft. If you then equip the laser rifles in your soldiers' loadouts, those laser rifles will be taken off the craft when the soldiers are swapped out. This probably isn't what you want.
---
What I'd like is for the craft to remember the extra equipment assigned, so that when soldiers leave the craft, that amount of extra equipment remains unchanged - even if it was used in some soldiers loadout. As for how to implement it... my immediate idea involves heaps of changes - which I'd probably just go ahead and do if it was my project; but I suspect you'd be relucted to accept the changes. You might prefer it to be done in a different way.
Here's an outline of what I have in mind: the craft's `_tempSoldierItems` list that is currently used for soldier equipment should be replaced with `_extraCraftItems` to store the extras list instead of the in-use list. I figure that the total soldiers' equipment can be calculated at any time, and so we don't really need to store it. Whereas the extra items is not always inferrable; it must be recorded if we want to remember it. `calculateTotalSoldierEquipment` would remain, because it is useful - but instead of storing the results in a member variable, it would simply return the entire vector. The calling function can store that vector for however long it needs it. (Returning a vector in C++ was once a bad thing to do, for efficiency reasons. But that's no longer an issue, thanks to the magic of `std::move`.)
Anyway, that would be a significant amount of stuffing around with the API of the new code, but the logic is pretty much unchanged. Currently (without these API changes) we have total equipment on the craft, and a calculated list of what the soldiers are using; and we use `extras = total - used` to work out the leftovers. The problem is that the leftovers may only be a subset of what we want to reserve to stay on the craft. By storing the actual list of items that we want to keep on the craft we avoid that problem. Incidentally, I think it's a bit weird that `_items` and `_tempSoldierItems` are dynamically allocated rather than just being on the stack. I guess maybe there is some legacy reason for `_items`, and the new one is done that way for consistency? I guess it isn't important enough to change that now.
In any case, that's my current thinking of how it should work. I'm just not sure whether or not everyone is on the same page about the desired behaviour, or the implementation.