#define DECLARE_FUNCTION(fun) FUNCTION fun #define args(list) list typedef void FUNCTION args((string argument = "")); struct commands { const char *cmd; FUNCTION *function; const char *usage, *example, *help; }; extern const struct commands cmd_table[]; DECLARE_FUNCTION(do_quit); DECLARE_FUNCTION(do_help); DECLARE_FUNCTION(do_newmap); DECLARE_FUNCTION(do_look); DECLARE_FUNCTION(do_move); DECLARE_FUNCTION(do_sector); DECLARE_FUNCTION(do_save); DECLARE_FUNCTION(do_load); DECLARE_FUNCTION(do_replace); DECLARE_FUNCTION(do_copy); DECLARE_FUNCTION(do_goto); DECLARE_FUNCTION(do_name); DECLARE_FUNCTION(do_savehtml); DECLARE_FUNCTION(do_height); DECLARE_FUNCTION(do_scopy); DECLARE_FUNCTION(do_depth); const struct commands cmd_table[] = { {}, { "quit", do_quit, "quit", "quit", "Exits the program."}, { "?", do_help, "?", "?", "Lists all commands."}, { "copy", do_copy, "copy [distance] [direction]", "copy 10 n", "Copies current room to all rooms in a specified distance and direction. If distance is 0, all rooms will be copied in specified direction until a room with same sector is reached."}, { "scopy", do_scopy, "scopy [distance] [direction]", "scopy 10 n", "Copies current room sector to all rooms in a specified distance and direction. If distance is 0, all rooms will be copied in specified direction until a room with same sector is reached."}, { "newmap", do_newmap, "newmap '[name]' [width] [height] -[default sector]", "newmap 'Planet Kaio' 65 65 2", "Creates a new map with specified name, height, width, and default sector if supplied, otherwise default sector will be 0"}, { "look", do_look, "look", "look", "Displays map surrounding your current location, including various information about the area and room you're in."}, { "move", do_move, "move [direction] -[distance]", "move n 5", "Moves specified distance in specified direction. Distance defaults to 1 if no distance supplied."}, { "sector", do_sector, "sector -[sector]", "sector 1", "Sets room to specified sector. This is what the room will look like on the map. If no sector is supplied, will list all available sectors."}, { "height", do_height, "height [#]", "height 5.5", "Sets room height."}, { "depth", do_depth, "depth [#]", "depth 5.5", "Sets room depth, if water."}, { "save", do_save, "save -[filename]", "save planetkaio", "Saves current map to specified filename. If no filename is supplied, current filename is used."}, { "load", do_load, "load [filename]", "load planetkaio", "Loads specified map for editing, if found."}, { "replace", do_replace, "replace [sector1] [sector2] -[%]", "replace 1 2 50", "Replaces variable percent of existing sector1 with sector2. Default percent is 100 if no percent is supplied."}, { "goto", do_goto, "goto [room]", "goto 1", "Used to instantly go to a particular location on the map."}, { "name", do_name, "name '[name]'", "name 'Planet Kaio'", "Sets area to specified name."}, { "savehtml", do_savehtml, "savehtml", "savehtml", "Outputs area to an HTML file for easy viewing in your web browser."}, {} };