*/
static void test_and_poll_server();
-/* Read server out file for messages, act on them (i.e. derive log messages). */
-static uint8_t read_outfile();
+/* Read messages from queue, act on them. */
+static uint8_t read_queue();
-static uint8_t read_outfile()
+static uint8_t read_queue()
{
uint8_t ret = 0;
char * msg;
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);
world.winch = 0;
change_in_client++;
}
- if (change_in_client || read_worldstate() || read_outfile())
+ if (change_in_client || read_worldstate() || read_queue())
{
if (world.turn != last_focused_turn && world.focus_each_turn)
{