- make server and client communicate by specific world state info requests
in server/out, replacing server/worldstate
+- beautify form of command arguments (strings instead of numbers for directions)
+
SERVER:
- consider
- enable toggling of window borders
- make log scrollable
-
-- send zero-argument player commands without argument
char * dsc_short; /* short name of command to be used internally */
char * dsc_long; /* long description of command to be shown to the user */
char * server_msg; /* optionally start string of message to send to server*/
- char arg; /* defines server message suffix by player_control() convention */
+ char arg; /* defines server message suffix by try_server_commands() rules */
};
struct CommandDB
/* Try out "command" as one for server messaging; sending is .server_msg,
* followed by either a string representing "command"'s .arg, or, if .arg is
- * 'i', world.player_inventory_select. Return 1 on success, 0 on failure.
+ * 'i', world.player_inventory_select, or, if .arg is '0', nothing. Return 1 on
+ * success, 0 on failure.
*/
static uint8_t try_server_commands(struct Command * command);
if (command->server_msg)
{
uint8_t arg = (uint8_t) command->arg;
- if ('i' == arg)
+ if ('0' == arg)
{
- arg = world.player_inventory_select;
+ send(command->server_msg);
+ }
+ else
+ {
+ if ('i' == arg)
+ {
+ arg = world.player_inventory_select;
+ }
+ uint8_t command_size = strlen(command->server_msg);
+ uint8_t arg_size = 3;
+ char * msg = try_malloc(command_size + 1 + arg_size + 1, f_name);
+ int test = sprintf(msg, "%s %d", command->server_msg, arg);
+ exit_trouble(test < 0, f_name, "sprintf()");
+ send(msg);
+ free(msg);
}
- uint8_t command_size = strlen(command->server_msg);
- uint8_t arg_size = 3;
- char * msg = try_malloc(command_size + 1 + arg_size + 1, f_name);
- int test = sprintf(msg, "%s %d", command->server_msg, arg);
- exit_trouble(test < 0, f_name, "sprintf()");
- send(msg);
- free(msg);
return 1;
}
return 0;