Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2001:
[Freeciv-Dev] Re: Server/ruleset unification [Was [RFC PATCH] init_techs
Home

[Freeciv-Dev] Re: Server/ruleset unification [Was [RFC PATCH] init_techs

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: rf13@xxxxxxxxxxxxxxxxxxxxxx
Cc: Freeciv developers <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: Server/ruleset unification [Was [RFC PATCH] init_techs]
From: Arien Malec <arien_malec@xxxxxxxxx>
Date: Tue, 25 Sep 2001 17:54:48 -0700 (PDT)

--- Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
> Can you show some examples of simple_set_statement and
> object_set_statement. IMHO should these two be unified. So
> 
>  set players Caesar ailevel hard; OR
>  set players.Caesar.ailevel=hard;
> 
> should be use the same syntax as a
> 
>  set unit archer vison 2; OR
>  set unit.archer.vision=2;

simple_set_statement is intended for toplevel attributes:

set huts 0;
set ailevel hard;
set min_dist_bw_cities = 4;

object_set_statement in the trivial case looks like this:

set unit archer vision_range 2;

And, as you say, can be re-expressed as:

set unit.archer.vision_range 2;

so that it follows the simple_set_statement syntax.

But, in the complex case it looks like this:

set unit archer
        name = "Longbowmen"
        vision_range 2,
        hitpoints = 15;

I.e., like the object create syntax, the object spec creates a context for
later attribute setting. We can do away with any of the complex attribute
setting by making the set statement always simple, using the dotted syntax for
object references, and separating create and attribute settings. So

create tech atomic_theory
        name     = _("Atomic Theory"),
        req1     = "Theory of Gravity",
        req2     = "Physics",
        flags    = "";

becomes:

create tech.atomic_theory;
set tech.atomic_theory.name _("Atomic Theory");
set tech.atomic_theory.req1 = "Theory of Gravity";
[etc.]

The complex syntax is nicer to read, IMHO, but it may be desirable to go with
the simpler syntax.

Note that either syntax requires that the identifier name (atomic_theory) be a
proper identifier, and not a name ("Atomic Theory") (or an id).

Arien

__________________________________________________
Do You Yahoo!?
Get email alerts & NEW webcam video instant messaging with Yahoo! Messenger. 
http://im.yahoo.com


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