[Freeciv-Dev] Re: More imporved game starting [patch]
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
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"
- [Freeciv-Dev] Re: More imporved game starting [patch], (continued)
- [Freeciv-Dev] Re: More imporved game starting [patch], Per I. Mathisen, 2001/12/26
- [Freeciv-Dev] Re: More imporved game starting [patch], Christian Knoke, 2001/12/26
- [Freeciv-Dev] Re: More imporved game starting [patch], Per I. Mathisen, 2001/12/26
- [Freeciv-Dev] Re: More imporved game starting [patch], Christian Knoke, 2001/12/26
- [Freeciv-Dev] Re: More imporved game starting [patch], Per I. Mathisen, 2001/12/27
- [Freeciv-Dev] Re: More imporved game starting [patch], Petr Baudis, 2001/12/25
- [Freeciv-Dev] Re: More imporved game starting [patch],
Daniel L Speyer <=
- [Freeciv-Dev] Re: More imporved game starting [patch], Andreas Kemnade, 2001/12/26
[Freeciv-Dev] Re: More imporved game starting [patch], Christian Knoke, 2001/12/24
[Freeciv-Dev] Re: More imporved game starting [patch], Reinier Post, 2001/12/25
|
|