From: Christian Heller Date: Sun, 7 Dec 2014 02:35:51 +0000 (+0100) Subject: Server: Execute THINGS_HERE command only on existing worlds. X-Git-Tag: tce~568 X-Git-Url: https://plomlompom.com/repos/edit?a=commitdiff_plain;h=6c2654a6e4be4cdec81067002c667ade9895a82a;p=plomrogue Server: Execute THINGS_HERE command only on existing worlds. --- diff --git a/SERVER_COMMANDS b/SERVER_COMMANDS index dba4b95..de6ad7b 100644 --- a/SERVER_COMMANDS +++ b/SERVER_COMMANDS @@ -54,9 +54,9 @@ QUIT Shut down server. THINGS_HERE [0 to 255] [0 to 255] -Write line-by-line list of items at y position of first argument, x position of -second argument into ./server/out file, enclosed by two lines "THINGS_HERE START" -and "THINGS_HERE END". +If world exists, write line-by-line list of things at y position of first +argument, x position of second argument of map into ./server/out file, enclosed +by two lines "THINGS_HERE START" and "THINGS_HERE END". Player commands --------------- diff --git a/src/server/run.c b/src/server/run.c index 9163ee0..d88d583 100644 --- a/src/server/run.c +++ b/src/server/run.c @@ -214,6 +214,11 @@ static uint8_t parse_command_meta(char * tok0) char * tok2 = token_from_line(NULL); if (tok1&&tok2 && !parsetest_int(tok1, '8')&&!parsetest_int(tok2, '8')) { + if (!world.exists) + { + err_line(1, "Command only works on existing worlds."); + return 0; + } send_to_outfile("THINGS_HERE START\n", 1); struct Thing * t; for (t = world.things; t; t = t->next) @@ -411,7 +416,7 @@ extern uint8_t obey_msg(char * msg, uint8_t obey_state) } else if (!world.replay) { - err_line(1, "Unknown command/argument or bad number of tokens."); + err_line(1, "Invalid command/argument or bad number of tokens."); } } free(msg_copy);