keyboard production setting (long standing bug)

Hans Ronne hronne@pp.sbbs.se
Wed Sep 4 05:24:00 GMT 2002


>> The map should scroll if the current unit is moving and gets too close to
>> the edge. Are you sure it is not just this recentering that you are seeing?
>
>If it is recentering, it is doing it wrong.
>The producer in most cases is a non-moving city, so the unit is not moving.
>Also, it moves the map the distance the *previous* unit moved.

I have now checked in a fix to this bug. It was a rather interesting
example of how different pieces of code may interact in unexpected ways.

The bug (for those who had problems following this thread):

When you pick a new unit type to build using keyboard commands (or clicking
in the unit list) the map suddenly scrolls and recenters on the last mobile
unit that was moved.

I first checked the obvious suspect (i.e. the do_build code) for anything
that would recenter the map with an obsolete focus. However, this led
nowhere.

Further debugging revealed that the culprit was the little crosshair cursor
that pops up when you are asked where to build the unit. So why should this
refocus the map on the wrong cell? Well, any command the changes the map
widget configuration (and the cursor is part of it) also refocuses the map
just to make sure. The focus picked is (quite reasonably) the last point
that was clicked on the map. In this particular case it happens to be the
destination cell for the last moving unit. Everything after that was
keyboard commands.

I have now eliminated map refocusing after cursor changes. This also got
rid of some other unnecessary scrolling, such as the focusing on the
selected build spot etc.

Hans

Hans Ronne

hronne@pp.sbbs.se




More information about the Xconq7 mailing list