Complete.Org: Mailing Lists: Archives: freeciv-dev: March 1999:
Re: [Freeciv-Dev] two new patches
Home

Re: [Freeciv-Dev] two new patches

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: permath@xxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx
Subject: Re: [Freeciv-Dev] two new patches
From: David Pfitzner <dwp@xxxxxxxxxxxxxx>
Date: Tue, 16 Mar 1999 00:02:10 +1100

Per Mathisen wrote:

> On Sat, 13 Mar 1999, David Pfitzner wrote:
> > Shouldn't build_req in the ruleset file be a string with the
> > improvement name, rather than a number, to make them easier to
> > edit?

> You know, I think enumerating each line (so that our prospective ruleset
> editor will not have to count lines) will suffice.

Hmm, do you mean editor in terms of a person, or a program?
(eg, with a gui).  The latter would be pretty cool, and then
numbers would be fine, but I was thinking more of the former.

For editing rulesets with a text editor, I tend to prefer
using names everywhere, and let the program convert to numbers,
instead of making the human do the lookup.  At least that's 
what I did for the current rulesets -- eg, consider unit 
flags, which I initially did using numbers, but later decided
that even there I preferred to use names.  

> I know this is still not easy to edit, but take a look at
> http://ulven.ifi.ntnu.no/freeciv/improvements.rules, which is where I hope
> to get eventually, and I think you will understand why.

Looks cool!  Though I'll probably quibble about some of the 
details when I have a closer look ;-)

> > It occured to be that wrapping the freelog calls via 
> > console_log is not sufficient

> >  I still think the way to do this 
> > is to pass a printf-like (or vprintf, or something) function 
> > pointer to log_init(), to tell the log module how we want 
> > log messages which go to the "screen" to be printed.
> 
> I am not sure how to do it. I tried, but the compiler laughed 
> at the puny efforts of my simple C skills.

For an example of sort of what I have in mind (at least in 
terms of using function pointers) you can see

http://www.complete.org/mailinglists/archives/freeciv-dev-199902/msg00049.html

(That patch wasn't used, but I don't think there was anything 
actually wrong with it as such).  I'm not sure about function 
pointers to variadic functions (like printf, or maybe vprintf), 
but if necessary one could just use a puts-like function pointer 
instead and handle the variadic args before calling that function.

Regards,
-- David

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