milopeach / ghostplusplus

Automatically exported from code.google.com/p/ghostplusplus
Other
0 stars 0 forks source link

Be able to enter commands in console #19

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I think it would be nice if ghost++ could read stdin and execute commands. 
Sometimes I close wc3 and forget to ban a leaver.

Original issue reported on code.google.com by nobi...@gmail.com on 9 May 2009 at 7:17

GoogleCodeExporter commented 8 years ago
It's not possible to do this cleanly in a portable manner. There is no single
portable curses library that I know of which leaves three options:

1.) Read console input from stdin in a seperate thread. Assuming it's possible 
to
avoid concurrency issues with this it would produce "ugly" text in the console
because the text you enter would be overwritten and appended to by the bot's 
console
messages. This makes correcting any typos and errors in your input difficult 
since
you wouldn't have an unbroken line of editable text.

2.) Use two different curses libraries, e.g. pdcurses and ncurses, and write 
two sets
of code, one for Windows and one for Linux. This is a lot of effort, makes the 
source
code ugly, and introduces even more required libraries to the project.

3.) Add a network interface to GHost++ and write a seperate program that uses 
this
interface to relay commands to the bot. This has already been done by another
programmer but due to the poorly laid out internal command structure of GHost++ 
it
creates a mess in the source code.

Since none of these solutions are particularly great and/or require a lot of 
effort
to do properly, I probably won't be fixing this. It's something that I would 
have
liked to do eventually but don't want to spend the time on now so I will accept 
the
issue but you should not expect a resolution.

Original comment by hogantp on 17 Jul 2009 at 6:30