Set map seed and randomness seed to argument. Remove all things. (Re-)generate
map. Add to map things specified in thing types table in quantity defined there
by START_NUMBER command, with first thing (of thing ID of 0) of type defined as
-player type by PLAYER_TYPE command. Set world turn to 1. Activate world.
+player type by PLAYER_TYPE command. Set world turn to 1. Activate world. Answer
+with 'NEW_WORLD' message in ./server/out file.
MAP_LENGTH [1 to 256]
Deactivate world. Remove ./server/worldstate file. Remove all things. Remove
*/
static void test_and_poll_server();
-/* Read queue, act on them (as of right now only: derive log messages). */
+/* Read messages from queue, act on them. */
static uint8_t read_queue();
while (NULL != (msg = get_message_from_queue(&world.queue)))
{
char * log_prefix = "LOG ";
- if (!strncmp(msg, log_prefix, strlen(log_prefix)))
+ char * new_world = "NEW_WORLD";
+ if (!strcmp(msg, new_world))
+ {
+ ret = 1;
+ free(world.log);
+ world.log = NULL;
+ }
+ else if (!strncmp(msg, log_prefix, strlen(log_prefix)))
{
ret = 1;
char * log_msg = msg + strlen(log_prefix);
#include "things.h" /* Thing, ThingType, free_things(), add_things(),
* get_thing_id_action_id_by_name()
*/
-#include "run.h" /* obey_msg(), io_loop(), record() */
+#include "run.h" /* obey_msg(), io_loop(), record(), send_to_outfile() */
#include "world.h" /* global world */
world.turn = 1;
world.do_update = 1;
world.exists = 1;
+ send_to_outfile("NEW_WORLD\n");
return 0;
}