I was reminded a while ago by the problems with the Panel size and
position options to have another look at the way the client options
are handled.  This finally got to the top of the pile.

So client options are currently provided from four sources:
1. data/base/client-options.xml
2. ActionManager
3. client-options.xml in any saved game if present
4. The user <config>/<rules>/options.xml if present

FreeColClient uses all of these, and ConnectController.startSavedGame updates
with the saved game options.  There are a few problems.

1. The saved game and options.xml files can (do in my case!) contain
   outdated options, options in the wrong group, and possibly even
   incorrect ones if we change an option type (e.g. there are a few
   IntegerOptions that might be better as Range or Percentage options).

   To deal with this I have committed a fix that only merges options
   from these sources if they match what was already loaded from
   sources #1 and #2, which are considered to be definitive.  This does not
   help with the case of panel options that contain unfortunate (but not
   invalid) sizes, but it at least fixes some worse problems.

2. If there is a saved game, its options get merged twice.  We need
   this to happen in ConnectController as that happens every time we
   start a different game (like from the Open menu entry), whereas the
   routine in FreeColClient only gets called once.  We could just drop
   the check for saved game there, but this leaves a window where the
   client options are incomplete.  I am not sure if that breaks anything.

3. When we merge a set of options from sources #3 or #4, the last one
   merged wins.  Currently this will be #3 if present (due to the
   second merge) or #4 for new games (although I think we have a bug
   if you start a saved game and then use the New menu entry).  This
   is not unreasonable, but perhaps surprising.  BTW, no, we do not
   need a client option to control this!  However there might be a
   case for a command line argument to allow you to play someone
   else's game but with your preferred client options, which I have
   wanted for debugging purposes.

4. The commit mentioned above breaks saving of Panel size and position
   options --- because these options are not mentioned in the base
   client-options.xml they will be ignored when subsequently merged.
   They also get added at the top client options level which is a
   mess, they should have their own subgroup.  However, they should
   continue to work in-game for now, that is, if they were working at
   all.  I do not propose to fix this for 0.11.4, partly as adding a
   new option group requires touching the messages file, and partly
   because I am not sure what the Right Thing to do is.

5. When options.xml is written, all the actions get needlessly written
   too, then subsequently ignored on read (see
   AbstractOption.readOption).  This needs cleaning up.

As stated above, I propose to do nothing more on this for 0.11.4, but
I would be interested in suggestions on the way forward.

Cheers,
Mike Pope

Attachment: pgpnxtkL6Tshe.pgp
Description: OpenPGP digital signature

------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Freecol-developers mailing list
Freecol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freecol-developers

Reply via email to