bugFreeciv - Bugs: bug #13873, [patch 07/07] load game settings...

Show feedback again

bug #13873: [patch 07/07] load game settings from ruleset file

Submitted by:  Matthias Pfafferodt <syntron>
Submitted on:  Sun Jul 5 22:21:38 2009  
Category: generalSeverity: 2 - Minor
Priority: 5 - NormalStatus: Fixed
Assigned to: pepeto <pepeto>Open/Closed: Closed
Release: Operating System: None
Planned Release: 2.3.0Contains string changes: None

Add a New Comment (Rich MarkupRich Markup):

You are not logged in

Please log in, so followups can be emailed to you.


(Jump to the original submission Jump to the original submission)

Tue Feb 2 19:51:51 2010, SVN revision 16686:

Added possibility to load settings from the ruleset.

Patch by Matthias Pfafferodt (syntron)

See gna bug #13873

(Browse SVN revision 16686)

pepeto <pepeto>
Project MemberIn charge of this item.
Sun Jan 31 14:36:41 2010, comment #12:

updated version; changes:

  • loop over all entries in the [settings] section in the ruleset file
  • for each entry check if it is a valid setting

(file #7854)

Matthias Pfafferodt <syntron>
Project Member
Sun Jan 31 11:12:58 2010, comment #11:

I don't like how setting_ruleset() works. Maybe you could convince me the way you choose. For the moment, this is my argumentation.

You iterate all settings, and attempt to take their value in the file. In a such implementation, I think the best would be to use secfile_lookup_str(), secfile_lookup_int() and secfile_lookup_bool() instead of a their _default variant.

Another approach would be to iterate all the entries of the ruleset file and try to match the settings. I guess this could be the best solution because usually, there are not a lot of settings defined in the ruleset. Also, this would allow to warn the user if he misspelled one setting (no match).

pepeto <pepeto>
Project MemberIn charge of this item.
Mon Jan 25 17:18:40 2010, comment #10:

I created an rebased version and the patch now uses the new ruleset functions - but it are only a few calls to them.

(file #7790)

Matthias Pfafferodt <syntron>
Project Member
Sun Jan 24 09:14:56 2010, comment #9:

This patch could be improved a lot with the new registry interface.

pepeto <pepeto>
Project MemberIn charge of this item.
Sun Oct 11 17:32:50 2009, comment #8:

updated patch; changes:

  • restore all game settings, if the game is stopped by /end

(file #6969)

Matthias Pfafferodt <syntron>
Project Member
Sat Oct 10 22:54:13 2009, comment #7:

updated version; changes:

  • loading a savegame will first restore the ruleset (with possible changes to the settings) and after that restore the savegame and the setting values saved within the savegame

(file #6957)

Matthias Pfafferodt <syntron>
Project Member
Sun Sep 13 20:45:09 2009, comment #6:

rebased version of the patch:

save game settings in game.ruleset

  • rulesetdir will first do a reset and

after that load the new ruleset

  • reset will restore settings from the


(file #6687)

Matthias Pfafferodt <syntron>
Project Member
Sun Jul 26 00:31:54 2009, comment #5:

updated patch for reset command

the points mentioned in the last comments
will be implemented in patch 8-11 (they
can be found in the tracker patches)

(file #6256)

Matthias Pfafferodt <syntron>
Project Member
Fri Jul 24 08:00:45 2009, comment #4:

this could be done with an extra line in the
game.ruleset file

; define the game setting
borders = 2
; lock it (first player is not allowed to change it)
borders.lock = 1

The <setting>.lock defaults to FALSE. If it is
true, the setting can't be changed. This requires
that the 'rulesetdir' command can't be executed by
the first player.

Does warclient/warserver has such an option?

First I have to solve the main problem. My ideas are:

  • 'rulesetdir' command loads the ruleset + settings

from the game.ruleset file

  • The reset command has to restore all settings to the

default values and load the settings from the
game.ruleset file. An additional hint to changed
settings could be added.

  • executing 'rulesetdir' again does check if another

ruleset is requested. If it is not the case, the
current code will do nothing. This must be
changed to a reset (= default settings + changes
from the game.ruleset file). This way one will have
a well defined state after executing the rulesetdir

Matthias Pfafferodt <syntron>
Project Member
Thu Jul 23 21:40:03 2009, comment #3:

I just thought of feature which could be built on top of these patches, I assume.

I run public servers with custom rulesets (in addition to default ruleset ones). With these servers I'd sometimes like to further limit what settings changes first player is able to do. Ruleset may have its own special flavor coming from certain settings. It's a waste of these custom ruleset server instances if first player turns them in to more generic Freeciv games (for which there already is plenty of servers).
So ruleset could mark some settings locked, so that they cannot be changed.

Marko Lindqvist <cazfi>
Project Administrator
Sun Jul 12 20:28:29 2009, comment #2:

> contra
> - two ways to set the values; confusion?

I'm not so sure it would cause much confusion as one way is used primarily by players and the other by modpack authors. Of course you have to be careful in implementing it so that player settings have higher priority than ones from ruleset.

I'm a bit undecided if I like this feature or not. In any case, reset command has higher priority.

Marko Lindqvist <cazfi>
Project Administrator
Fri Jul 10 22:24:05 2009, comment #1:

loading game settings from the ruleset and the reset
command are exclusive at the moment. For both to work,
an additional variable ([b|i|s]val_ruleset) would be
needed for each setting to restore the corresponding

So I would like a discussion about the pro and cons
of loading game settings from the ruleset file.

- all settings in one file (scenarios!)

- two ways to set the values; confusion?

more arguments?

Matthias Pfafferodt <syntron>
Project Member
Sun Jul 5 22:21:38 2009, original submission:

load game settings from ruleset file

  • small correction for setting_check()
  • further simplification possible?
Matthias Pfafferodt <syntron>
Project Member


(Note: upload size limit is set to 1024 kB, after insertion of the required escape characters.)

Attach File(s):


   bug dependencies.

   patch dependencies.


Carbon-Copy List
  • -unavailable- added by pepeto (Posted a comment)
  • -unavailable- added by dmarks (Updated the item)
  • -unavailable- added by cazfi (Posted a comment)
  • -unavailable- added by syntron (Submitted the item)

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.


    Error: not logged in



    Follow 16 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue Feb 2 19:52:03 2010pepetoStatusReady For Test=>Fixed
    Sun Jan 31 14:41:51 2010pepetoStatusIn Progress=>Ready For Test
    Sun Jan 31 14:36:40 2010syntronAttached File-=>Added 0002-save-game-settings-in-game.ruleset.patch, #7854
    Sun Jan 31 11:12:58 2010pepetoStatusNone=>In Progress
    Mon Jan 25 17:18:40 2010syntronAttached File-=>Added 0002-save-game-settings-in-game.ruleset.patch, #7790
    Sun Jan 24 09:14:56 2010pepetoAssigned tocazfi=>pepeto
    Sun Dec 20 09:45:14 2009dmarksPlanned Release=>2.3.0
    Fri Nov 6 15:17:51 2009cazfiAssigned toNone=>cazfi
      Planned ReleaseNone=>2.3.0
    Fri Nov 6 15:16:26 2009cazfiDependencies-=>Depends on bugs #13871
    Sun Oct 11 17:32:50 2009syntronAttached File-=>Added update20091011-0001-save-game-settings-in-game.ruleset.diff, #6969
    Sat Oct 10 22:54:13 2009syntronAttached File-=>Added settings20091010-0005-save-game-settings-in-game.ruleset.diff, #6957
    Sun Sep 13 20:45:09 2009syntronAttached File-=>Added 0007-save-game-settings-in-game.ruleset.diff, #6687
    Sun Jul 26 00:31:54 2009syntronAttached File-=>Added 0007-implement-reset-command-with-settings.patch, #6256
    Sun Jul 5 22:21:38 2009syntronAttached File-=>Added 07-load-game-settings-from-ruleset-file.patch, #6141
    Show feedback again

    Back to the top

    Powered by Savane 3.1-cleanup