Complete.Org: Mailing Lists: Archives: freeciv-dev: February 1999:
[Freeciv-Dev] Re: terrain transform + fix + help :)
Home

[Freeciv-Dev] Re: terrain transform + fix + help :)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Nicolas BRUNEL <brunel@xxxxxxxxxxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: terrain transform + fix + help :)
From: Greg Wooledge <ic5035%tss1crs.amgreetings.com@xxxxxxxxxxxxxxxxxxxx>
Date: Fri, 12 Feb 1999 15:38:49 -0500

On Fri, Feb 12, 1999 at 09:09:22PM +0100, Nicolas BRUNEL wrote:

> - in menu.c change declaration of irrtext,mintext,roadtext and
>             transtext to avoid segfault.
>       char *toto;
>       toto = "a message"; is wrong no memory has been allocated to toto.
>       ( OK ok it was in the the previous  version. :)  )

I'm not sure I understand what you're saying.  I'm going to Cc the
freeciv-dev mailing list with this one, hope you don't mind.

Above, "a message" is a string constant.  It is allocated in 10 bytes[1]
of read-only memory (the text segment) at compile time, unless you use
"gcc -traditional" or "gcc -fwritable-strings" or an equivalent
compiler, in which case it's allocated in normal variable space.  The
assignment toto = "a message" sets toto to contain the address of this
string constant.

Most importantly, my use of this in client/menu.c simply follows the
pattern of what's already there.  When I wrote the terrain
transformation patch, all I did was look to the existing code to see
how similar features were implemented (I did greps for "mining" and
"irrigation" and similar words).  Since I don't completely understand
the client and Xaw, I kept the implementation as simple as possible,
and just followed the patterns I saw in the current code.

Looking at the Feb. 12 CVS snapshot, I see plenty of this:

        mintext="Change to Forest    m";

which is perfectly good code.  There's no segfault here, and I've
certainly done lots of transformation testing, although only on one
system (AIX/MCA/PowerPC).  mintext, irrtext and roadtext were defined
as "char *" variables already; I just added a fourth one.

This code also appears in 1.7.2, which was released as stable....

>      The use of capability has to be implemented in theory.
> But as ruleset breaks the comptability rule, it will be of use to
> implement it just now before a release. But i encourage you to use
> capability string for your future patches.

OK, this is a valid complaint.  I must confess I never thought of this
because I'm not sure how Freeciv's capabilities work.  I'll be sure to
study that before I implement any more "big features".  I apologize for
having done this wrong.

What's the other tile set that's going to be in the next version?  If
someone can tell me where it is, I can add the new "O" overlay tile to
that one.  (I haven't been following the tile set discussions very
closely; I understand the need for fancy graphics, but I don't go out
of my way to chase after them myself.  Game play issues are more
important to me.)

[1] 9 bytes for "a message" and 1 byte for the trailing NUL character.


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