Babar was just asking on Stickam how you'd set a particular inventory
item to be first of your inventory window (not rearranging inv item order, but just scrolling the window to the correct point). And here we are:
function settop(this InvWindow *, InventoryItem *thing)
{
int itemi=0;
while (itemi < this.TopItem) {
if (this.ItemAtIndex[itemi]==thing) {
this.TopItem=itemi;
return;
}
itemi++;
}
}
Make that
ReplyDeleteif (this.ItemAtIndex[itemi]==thing) {
and it works even neater ;)
You spotted my deliberate mistake! That one and the other one you didn't spot now fixed. :) I blame blogger's rubbishness at posting code
ReplyDeleteYou should blame that we were running a small competition..to which I lost..
ReplyDelete