Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2002:
[Freeciv-Dev] Re: server console cleanup patch v2
Home

[Freeciv-Dev] Re: server console cleanup patch v2

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Freeciv developers <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: server console cleanup patch v2
From: Reinier Post <rp@xxxxxxxxxx>
Date: Tue, 8 Jan 2002 18:24:34 +0100

On Tue, Jan 08, 2002 at 02:55:29PM +0100, Per I. Mathisen wrote:

> Actually, I think this one is even better, as it can be used for all
> rulesets, not just game.ruleset, and allows us to group related options in
> a logically straight-forward manner:
> 
>       [citydistance]
>       cmdlevel = "ctrl"
>       helptext = _("whatever!")
>       city_min_dist = 3
>       city_max_dist = 5
>       city_avg_dist = 2
>       city_dist_options = { "help", "we", "have", "too", "many", "options"
>                               1,      2,      3       4,      4,      2
>                               9,      4,      1,      3,      4,      1 }

This looks like a hack to me: two very different ways ([foo] and {})
to indicate grouping, mixed together.  The existing parsing code has
certain problems, too.  (The exit()s are a showstopper.)

(Really if I were doing the coding I'd prefer to switch to a different
format, such as XML, with freely available third-party processors,
rather than continuing to hack on registry.[ch] to improve support for
structure.  But for a first implementation, using the existing registry
code is a great idea.)

> "cmdlevel" and "helptext" are interpreted as special cases, the rest are
> rendered as user-changeable values. Default is whatever value the option
> is set to. However, there is no way to put min/max info in here.

Aren't city_min_dist and city_max_dist just that?  Why aren't they
just called min and max?

> In order to pull this off, I believe common/registry.c probably needs to
> put all key values into some sort of tree structure for easy/fast
> iteration. Parsing a list of key values isn't going to cut it, AFAIK.

The trees aren't deep yet.

-- 
Reinier


[Prev in Thread] Current Thread [Next in Thread]