I finally had a look at this, I altered it slightly so that the map will only centre if there are no units left to move. So when you right click on the map it willAndO3131 wrote:I haven't tried out your changes yet. However, I did implement simple idea of right-click on main screen center the map. Try out this patch file on dropbox and let me know, if it's any good.
1) Show the units at that location, if there are any; otherwise
2) Select the next unit that requires movement orders and centre the map on it, if there are any (even if it is nowhere near where you clicked); otherwise
3) Centre the map on where you clicked.
I realise now that the calls between selectNextUnitToMoveOverland () and showSelectUnitBoxes () are a mess, with both methods calling each other back and forth. I traced through it a lot to convince myself that it can't get stuck in an infinite loop here, but I think its fine. I'll merge these into a single method at some point to tidy it up.
What is funny is I thought the hard part of this was the calculations involved in making the map centre on a particular location, taking into account the wrapping edges of the map and the current zoom level, so I was really curious how you solved that. Then I saw you'd called scrollTo () and went to go look for it.. and realised it was something I'd already written and forgotten existed, lol :) I have been at this too long... :)