Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2001:
[Freeciv-Dev] Re: PATCH: Advanced City Name Generation (version 2)
Home

[Freeciv-Dev] Re: PATCH: Advanced City Name Generation (version 2)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: PATCH: Advanced City Name Generation (version 2)
From: Erik Sigra <sigra@xxxxxxx>
Date: Tue, 30 Jan 2001 21:28:47 +0100
Reply-to: sigra@xxxxxxx

måndagen den 29 januari 2001 22:43 skrev Erik Sigra:
> Hi,
> The patch yesterday was the proof of concept. With this patch, city name
> generation will work just as great as with the last one, but the code is
> cleaner. I removed unneeded stuff, fixed the copyright notices (I hope),
> and optimized memory usage. Now a namer is loaded from a file to memory
> only when a client requests a city name suggestion from that namer.

I discovered a serious bug in the patch. When you have requested all the 
names in a random namer, you should get the suggestion "? no more names?", 
but instead, the servers enters a long loop and eventually returns the 
suggestion "" to the client.

I spent a few hours searching for the problem and finally found it. The 
problem is that the random functions work different in Freeciv than in Xconq, 
which makes porting stuff problematic; Xconq's xrandom(0) returns 0, while 
Freeciv's myrand(0) returns a random number up to Integer'Last. This random 
number is then the number of iterations the server will spend in the long 
loop.

I have fixed the bug, but I need to verify all uses of myrand. Expect a fix 
tomorrow evening.



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