This series of patches hopes to clean up the server code. Right now it's a mish-mash of commands and no clear organization or arrangement. Fx, code to directly toggle the AI status of players is in stdinhand.c. This series of patches divides stdinhand.c into several files based on functionality. The first few patches are huge rearrangements of chunks of code, while later (and future) one will target particular sections for readability and maitainability. NOTE: Apply patches in order. To compile you must run automake, etc, etc. Server-Cleanup-1 ================ - Creates files commands.[ch] and serverio.[ch]. - Updates server/Makefile.am to include new files. - Removes command enumeration and descriptions from stdinhand.c and puts them into command.[ch] - Removes cmd_reply* functions from stdinhand.c and puts them into serverio.[ch]. Server-Cleanup-2 ================ - Creates files settings.[ch]. - Updates server/Makefile.am to include new files. - Removes setting definitions and support functions from stdinhand.c and puts them into settings.[ch]. - It was necessary to change SETTINGS_NUM to a 'const int' because it was needed in other files but we can't #define it in settings.h. Server-Cleanup-3 ================ - It gets kind of ugly here. Sorry, Raimar, it had to happen sometime. :) - The command struct has been expanded to include a callback function. - In this revision, functions that are actually referenced in the command struct are defined in .h files, whereas "helper" functions are declared as static. - In commands.c, add static callback helper functions and a few basic callbacks in the commands[] struct array. Ones that do not have functions associated with them are set to be NULL right now. - Tore more code out of stdinhand.c and put it into commands.c. The downside (?) of this is that many of these functions are no longer static and confined to one file. Since the parsing code isn't really supposed to be high-performance (not called that often) it's not a huge loss. - Changed definition of quit_game to match the callback; subsequently changed how it's invoked from sernet.c. - Removed many option-related functions from stdinhand.c and gave them the same treatment as the commands WRT static/non-static as necessary. - At this point there are a few things (fx, horiz_line) that are defined as static in two files because they're needed by relatively (ATM) immutable functions in both files. These will go away soon. Server-Cleanup-4 ================ - Most of this is (still) rearrangement, some of it is temporary so I can get the code flushed out into its final position. - Moved all the metaserver stuff into commands.[ch]. - Moved some basic option parsing into commands.[ch]. - Updates the commands[] array with more functions. - Some entries in the commands[] array didn't have a long explanation string, so I simply copied the short one in order to make a spot for the function pointer. - Moved quit/save/load, etc, etc functions into commands.[ch]. - Still working on how to get the AI command stuff to fit in nicely, as well as the access level control code. - Added commands.h to srv_main.c (for show_players function).