Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2001:
[Freeciv-Dev] Re: More imporved game starting [patch]
Home

[Freeciv-Dev] Re: More imporved game starting [patch]

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Andreas Kemnade <akemnade@xxxxxxxxxxx>
Cc: jdorje@xxxxxxxxxxxxxxxxxxxxx, freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: More imporved game starting [patch]
From: Daniel L Speyer <dspeyer@xxxxxxxxxxx>
Date: Tue, 25 Dec 2001 21:33:51 -0500 (EST)

On Tue, 25 Dec 2001, Andreas Kemnade wrote:

> Jason Short writes:
 [snip]
>  > Here's another idea: when you load a game, it should first load the game 
>  > to the server and then popup a list of choices for the player name. 
>  > This would be far superior IMO.  Unfortunately, this might be very hard 
>  > to implement.
> I don't think it is so difficult.
> Just parse the output from the list command:

I actually have done this, so let me comment on the trouble I had.  It's
not as easy as it sounds.

First, you need to make sure you get the output from the list command.  I
took advantage of being the first command issued, but even so I'm not
confident a weird circumstance wouldn't break it.  My solution involved a
while(read....) loop which took several tries to make work.  Furthermore,
having tried more complicated things in TCL, I can say with confidence
that it gets worse.

>  - go to the line after the "------------------".
I wound up looping through a 1024 byte buffer (which might be inadequate
in large games) for "--\n", manually.  This actually wasn't too bad.

>  - extract until the first whitespace 
This is no good: names can include whitespace.  In fact, many
automatically selected names do.  I search backward for an open
parenthesis, and *hope* that no nation or loginname contains one.

>  - go to the next line
And you know when you're done how?  It's actually not too bad, but it's
not as easy as you'd expect.

So, as I said, I've done this, and it works, but I'm really not eager to
tackle more complicated versions of it.  Handling show would be worse, as
would not knowing what happened before you began.  I think we should have
a set of machine-based commands, just added to the set.  I'm not sure of
the exact syntax, but each would get or set a single thing with no
syntactic sugar.  We might also add some sort of command-stamp so that you
can easily scan for the responce to the just-issued command.

Just some observations and ideas, probably more code tommorow.

--Daniel Speyer
"May the /src be with you, always"






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