From: Erik V. <eri...@hc...> - 2007-08-01 21:28:52
|
I have committed code to implement a generic Game Options feature. See the example in 1830/Game.xml, where it is used to allow the optional 3rd 6-train. 1830/Game.xml has some comments about the usage of the new <GameOption> tag. The existing <Variant> tag (1835) has been replaced by <GameOption> as well. If a game has any <GameOption> tags, a dialog window will appear to let the user make the necessary selections (in fact I have reused the Options window). The window contents are automatically generated from all found <GameOption> tags. Currently two selection objects can be shown: - a dropdown list (the default), or - a checkbox (if a 'type="toggle"' attribute exists in that GameOption). I have not made any special attempts to make the window look nice, but it does the job. The presence in one XML file (Game.xml) of the specification of the available game options, and the consumption of their user-assigned values, required a split of the game initialisation code in the classes Options and GameManager. Now first the GameManager component is parsed, then the popup is shown, and finally the other components are parsed. This structure will in a later stage be refactored to fit into the pattern for all user actions (where PossibleAction objects are exchanged between the client and the server part). But I am a bit tired of that subject now.... The save file structure has changed to contain the game options list. I have also added a version number to the code and the save files. Save files with a different version number than would be created by the current code are considered incompatible. So you can throw away any existing save files after you have loaded this code. The version number should not change that often, but this time it does.... Erik Vos |