home
·
contact
·
privacy
projects
/
plomrogue
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
On world (re-)generation, server sends 'NEW_WORLD', client clears log.
[plomrogue]
/
src
/
client
/
io.c
diff --git
a/src/client/io.c
b/src/client/io.c
index 35e42e77c2340f3088ce9ea374c40d97a16962a0..45008155098ac03150c1ad53bf6a9ea8f503866c 100644
(file)
--- a/
src/client/io.c
+++ b/
src/client/io.c
@@
-80,8
+80,8
@@
static uint8_t read_worldstate();
*/
static void test_and_poll_server();
*/
static void test_and_poll_server();
-/* Read
server out file for messages, act on them (i.e. derive log messages)
. */
-static uint8_t read_
outfil
e();
+/* Read
messages from queue, act on them
. */
+static uint8_t read_
queu
e();
@@
-230,14
+230,21
@@
static void test_and_poll_server()
-static uint8_t read_
outfil
e()
+static uint8_t read_
queu
e()
{
uint8_t ret = 0;
char * msg;
while (NULL != (msg = get_message_from_queue(&world.queue)))
{
char * log_prefix = "LOG ";
{
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);
{
ret = 1;
char * log_msg = msg + strlen(log_prefix);
@@
-288,7
+295,7
@@
extern char * io_loop()
world.winch = 0;
change_in_client++;
}
world.winch = 0;
change_in_client++;
}
- if (change_in_client || read_worldstate() || read_
outfil
e())
+ if (change_in_client || read_worldstate() || read_
queu
e())
{
if (world.turn != last_focused_turn && world.focus_each_turn)
{
{
if (world.turn != last_focused_turn && world.focus_each_turn)
{