Complete.Org: Mailing Lists: Archives: freeciv-dev: July 1999:
Re: [Freeciv-Dev] rulesets; was terrain ruleset implementation

Re: [Freeciv-Dev] rulesets; was terrain ruleset implementation

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: Re: [Freeciv-Dev] rulesets; was terrain ruleset implementation
From: David Pfitzner <dwp@xxxxxxxxxxxxxx>
Date: Sun, 18 Jul 1999 12:20:44 +1000 (EST)

Jeff Mallatt <jjm@xxxxxxxxxxxx> wrote:

> At 1999/07/17 10:30 , David Pfitzner wrote:
> >
> >But one thing I regret about rulesets was making each ruleset
> >_require_ a separate directory. 

> I actually *like* lots of directories -- it seems more organized to me.
> However, I can see that it'd be a pain if all you want to do is override
> ONE ruleset file, and having to create a directory to do it. 

Its ok for separate modpacks etc, but its a pain to add extra
directories to cvs, and add the extra makefiles etc.

>  So, having
> *both* is probably a great idea -- lots of files can go into their own
> directory, but single files can just live in data.


> >I'm now inclined to favour a less compact format, eg, 
> >something more like the old-style savefile format:
> >
> >[unit0]
> >name = "Settlers"

> I, too, like this style (I've used it on Windows), but it has a downside:
> having to keep the index numbers unique and sequential.

Yeah :-/

>  (This can be
> overcome, but it's not pretty ;-)  Is there a way to get a list of the
> names of all the sections in a registry file?  If so, then we could do
> something like:
> [Settlers]
> tech_req = "None"

> I think this would be really nice !

It would kind off be possible, but I consider this also not pretty :-/
It means you have to somehow carefully distinguish sections which 
are units from other sections (eg, global vars), and if you do this 
in a hardwired way it becomes potentially harder to add new sections
without breaking compatability.  Its also probably not quite as 
easy to adapt for internationalization.  (For which standard tools 
want a double-quoted string which can be wrapped by _()).

How about if the section tags are of a specific form, but not
necessarily sequentially numbered?  Eg:

name = "Settlers"
tech_req = "None"

Then (with some registry hacking) one could find all sections
starting with "unit_".  (Here I'm thinking the "settlers" part 
of "unit_settlers" would actually be ignored, except that it 
has to be unique with respect to other sections).

Actually, one thing to consider:  The _ordering_ in the 
current units.ruleset is actually significant, in that for 
some purposes, for a given flag or role, units later in the 
file are considered "better".  This could actually still be
done with the above, since I think internally the registry 
does keep a distinct order, but it becoes less clear in
the ruleset file and in the registry interface.  (In the
current scheme the table is "ordered" and the order numbers
appear in the element names used for registry lookups.)

Or maybe (probably) that just means that the current method 
of using the ordering in the ruleset file is a bad approach
and an annoying inflexibility. :-/
But I'm not sure what to do instead?
Perhaps give each unit a "score" entry which is used for 

-- David

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