Inventory/Container GUI
Re: Inventory/Container GUI
Btw, there was a typo in the getCapacity method name. You can cherry-pick e9ea1fba4e85ab99fc030ace36512f64d1140d9c from my branch (or we just wait until it's in master)
Re: Inventory/Container GUI
Oops. I'll wait. Doesn't look like the GUI will take much longer anyway.
Re: Inventory/Container GUI
Haven't you seen my previous post or do you have no idea about it?
Re: Inventory/Container GUI
Thinking ... Doesn't work instantly; unfortunately. And then something else got in the way. Sorry.
First the easy one:
First the easy one:
No. There isn't. You need to check it every frame.Edit: is there a way to subscribe to changes of capacity/weight or am i supposed to do it every frame?
The idea about moving it into the player's inventory first is correct. Guess we need to change the add function to return an iterator after all. You will have to add a new private constructor to ContainerStoreIterator, since the existing constructors only provide begin and end iterators. And this will need to be a template, which takes the container store, the type (to store in mType) and ESMS::CellRefList<X, RefData>::List::iterator to initialise one of the internal iterators as arguments.I just did what you suggested (with the drag&drop) and equipping works - but only for items that are in the player's inventory. What doesn't work is dragging an object from a different container directly onto the player avatar. In that case it has to be moved into the player's inventory first, and that means it becomes a new object and I don't have a pointer to it anymore. Any ideas on that one?
Re: Inventory/Container GUI
Ok, that was basically my idea as well, though I'm a bit scared of using templates.. but we'll see.
Re: Inventory/Container GUI
Actually. Forgot about the templates. Add one constructor for each type that can go into a container. You need to handle each of these cases with separate code anyway and doing it without template specialisation will be much shorter and more simple too.
Re: Inventory/Container GUI
And that constructor will always return the last iterator of the specified type?
Edit: I think I got what you mean.. so one of the constructors would look like so?
ContainerStoreIterator (ContainerStore *container, ESMS::CellRefList<ESM::Potion, RefData>::List::iterator);
Edit: I think I got what you mean.. so one of the constructors would look like so?
ContainerStoreIterator (ContainerStore *container, ESMS::CellRefList<ESM::Potion, RefData>::List::iterator);
Re: Inventory/Container GUI
Not entirely sure what you mean. Constructors don't return anything.
If you meant what the newly constructed iterator is set to, then no. The function signature should not change from the template version I proposed first. You can't rely on that the new object will always be at the end of the iterator. Could be stacked, after all.
If you meant what the newly constructed iterator is set to, then no. The function signature should not change from the template version I proposed first. You can't rely on that the new object will always be at the end of the iterator. Could be stacked, after all.
Re: Inventory/Container GUI
About your edit: That looks right.