Users browsing this thread: 2 Guest(s)
Condensing Spell List in Battle
09-15-2017, 04:33 AM
i think the list condensing code can be sped up some.
now, it's only run once per party member at battle start, so speed shouldn't matter too much. but 53^2 iterations is a bit high.
rather than having two, nested loops, you can have one main loop using two indices:
- current place in full list
- next spot to write in work-in-progress shortened list
you'd increment the first one normally while looping (54 passes). whenever you find a non-null entry in the full list, copy from that position to the slot at the "short list" index (unless the indices are equal), and increment the latter index.
when you're done looping, fill the list from the short index through the end with FFs and 00s.
so that's 108 iterations overall max for Magic.
now, it's only run once per party member at battle start, so speed shouldn't matter too much. but 53^2 iterations is a bit high.
rather than having two, nested loops, you can have one main loop using two indices:
- current place in full list
- next spot to write in work-in-progress shortened list
you'd increment the first one normally while looping (54 passes). whenever you find a non-null entry in the full list, copy from that position to the slot at the "short list" index (unless the indices are equal), and increment the latter index.
when you're done looping, fill the list from the short index through the end with FFs and 00s.
so that's 108 iterations overall max for Magic.
« Next Oldest | Next Newest »
Users browsing this thread: 2 Guest(s)