Sorted Lists

05/07/2012 18:25 Shortpants#1
So, I got everything to work (thank you Interest, and Swoosh for helping me with the problems I had).

Now I am wondering about some optimization, so I can release a good performance bot some time.

I am currently using a loop to read 0 - 769 for both the resources and mobs, I realize there is a npc/resource count ptr but how exactly does this work?

As far as I am aware (int i = 0; i < npc_count; i++) would not work for not every index is a valid ptr (NULL).

In simple terms, is there a better way to read out the index?
05/08/2012 00:27 dumbfck#2
Unfortunately there is no sorted list for resources.. IIRC there is a count though, so you can loop through the list just ignoring any null pointers and stop when you reach the count - that'll at least save you some CPU cycles.
NPC list should be linear - There are two lists though, one sorted, one unsorted. Perhaps you're reading the unsorted list which has null pointers?
The NPC count is [[[[[baseCall]+0x1C]+0x1C]+0x24]+0x14]
The sorted list is [[[[[baseCall]+0x1C]+0x1C]+0x50]+i*0x4]
I think the unsorted list is at
[[[[[baseCall]+0x1C]+0x1C]+0x88]+i*0x4]
or somewhere around there.