Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2003:
[Freeciv-Dev] (PR#6587) stdinhand.c auto-completion
Home

[Freeciv-Dev] (PR#6587) stdinhand.c auto-completion

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#6587) stdinhand.c auto-completion
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 21 Oct 2003 13:48:49 -0700
Reply-to: rt@xxxxxxxxxxxxxx

The stdinhand auto-completion is unnecesarily complex, IMO.  Currently 
for instance there is an array listing which commands have, as their 
first parameter, a player name.  For each auto-completion we iterate 
over every entry in this list to see if (1) we are using this command 
and (2) this is the first parameter of that command.  If this check 
passes, we use the player list (via a function returning the player list 
autocompletion list) for autocompletion, if not we go on to the next 
type of autocompletion.

Not only is this really inefficient (probably a non-issue), the data's 
just so spread out it's hard to keep things updated [1].  Instead I 
think 'struct command' should have an entry which is just the 
autocomplete function for the first parameter of that command (in the 
case of players: player_generator).  This also generalizes better to 
allowing autocompletion of commands other than the first [2] (which 
would currently require an entirely new, added infrastructure).

[1] For instance the first parameter of /team should use 
player_generator, but nobody thought to update the array.  What other 
commands are misconfigured?

[2] Like the second parameter of /team, which should use team_generator 
(currently there is no team_generator).

jason




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