X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=src%2Fserver%2Fio.h;h=2f8397fa2da941b8689b681a109e5593da10355b;hb=c8841380b53dbd999061a8de399e71d5d8272fb0;hp=78cb068279d4899490c5a1f1dcb267f7ac90eb57;hpb=dd9d65ee727ac7e95801da0f8b5bae7009811802;p=plomrogue diff --git a/src/server/io.h b/src/server/io.h index 78cb068..2f8397f 100644 --- a/src/server/io.h +++ b/src/server/io.h @@ -1,7 +1,7 @@ -/* io.h: +/* io.h * - * Communication of the server with the outside world via input fifo and output - * file. + * Communication of the server with the outside world and its client via input, + * output and world state files. */ #ifndef IO_H @@ -10,21 +10,26 @@ /* Return single \0-terminated string read from input queue (world.queue); or, - * if queue is empty and world.turn is unequal world.last_update_turn, update - * output file at world.path_out (and update world.last_update_turn), then read - * file at world.path_in for the next load of bytes to put onto the input queue. + * if queue is empty and world.do_update is set, update world state file (and + * unset world.do_update) and write a single dot line to server out file, then + * read server in file for the next load of bytes to put onto the input queue. * - * Reading the file at world.path_in may put many \0-terminated strings on the - * queue at once. Successive calls of io_round() will make these available one - * by one. Each such call cuts off bytes from the beginning of world.queue, up - * to and including the last \0 byte that is followed by a non-\0 byte or ends - * the queue. If the queue starts with a \0 byte, it and its \0 followers are - * cut and a NULL pointer is returned. Reading from the input file stops only - * when one or more byte were read and the next read returns 0 bytes. If the + * Reading the server in file may put many \0-terminated strings on the queue at + * once. Successive calls of io_round() will make these available one by one. + * Each such call cuts off bytes from the beginning of world.queue, up to and + * including the last \0 byte that is followed by a non-\0 byte or ends the + * queue. If the queue starts with a \0 byte, it and its \0 followers are cut + * and a NULL pointer is returned. Reading from the input file stops only when + * one or more byte were read and the next read returns 0 bytes. If the * re-filled queue does not end in a \0 byte, a \0 byte is appended to it. */ extern char * io_round(); +/* Write to savefile (atomically) god commands (one per line) to rebuild the + * current world state. + */ +extern void save_world(); + #endif