X-Git-Url: https://plomlompom.com/repos/feed.xml?a=blobdiff_plain;f=src%2Fclient%2Fio.c;h=45008155098ac03150c1ad53bf6a9ea8f503866c;hb=25cb881d3f6b7f98d4b52e084c75b6322c57f2bc;hp=233a60c78043bd8e6c7de7e54c0e98eed511bcdf;hpb=67e966f69657be9260488db2282a70dacb5a903c;p=plomrogue diff --git a/src/client/io.c b/src/client/io.c index 233a60c..4500815 100644 --- a/src/client/io.c +++ b/src/client/io.c @@ -80,7 +80,7 @@ static uint8_t read_worldstate(); */ 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(); @@ -237,7 +237,14 @@ 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);