03-26-2013, 05:35 PM
Now the question is, what functions can we put in this "interface". Besides the obvious SetSlot and GetSlot (and of course GetWidth, GetHeight), can it do anything more involved? I'm thinking it could, so here's a quick list, feel free to add suggestions:
Code:
int HowManyCanFit(const cItem & a_ItemStack); // Returns number of items out of a_ItemStack that can fit in the storage
bool AddItem(cItem & a_ItemStack); // Adds as many items out of a_ItemStack as can fit; the rest is left in a_ItemStack; returns true if {any?|all?} items fit.
bool AddItems(cItems & a_ItemStackList); // Same as AddItem, but works on an entire list of item stacks
int GetFirstEmptySlot(void) const; // Returns the index of the first empty slot
int GetLastEmptySlot(void) const; // ^^ last ^^