X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=src%2Fserver%2Fio.h;h=6f59bd0b81bd1defe878fd1a82b204a5f574d894;hb=9ee3279f2caf89f2fdade2839840d2a07e86d50d;hp=9c7de70ec384332e82b23d9b2c9c8dc0ac3e9fb2;hpb=784a54c9ef27aa2bf0754b2761aee06cbbde270e;p=plomrogue diff --git a/src/server/io.h b/src/server/io.h index 9c7de70..6f59bd0 100644 --- a/src/server/io.h +++ b/src/server/io.h @@ -1,4 +1,8 @@ -/* io.h: +/* io.h + * + * This file is part of PlomRogue. PlomRogue is licensed under the GPL version 3 + * or any later version. For details on its copyright, license, and warranties, + * see the file NOTICE in the root directory of the PlomRogue source package. * * Communication of the server with the outside world and its client via input, * output and world state files. @@ -7,45 +11,29 @@ #ifndef IO_H #define IO_H -#include /* size_t */ -#include /* uint8_t, uint32_t */ -#include /* FILE */ -#include "cleanup.h" /* enum cleanup_flag */ - - -/* Wrapper to reading in config files from "path" for DB entries of "size - * starting at "entry_start", to be unset by "cleanup" and reading in individual - * entry data line by line via "read"(). Assumes all entries start with the - * items collected in the EntrySkeleton struct. - */ -struct EntrySkeleton -{ - uint8_t id; - struct EntrySkeleton * next; -}; -extern void read_config_file(char * path, enum cleanup_flag cleanup, - size_t size, struct EntrySkeleton ** entry_start, - void (* read) (char *, uint32_t, char *, - struct EntrySkeleton *, FILE *)); /* 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 - * world state file at world.path_worldstate (and update world.last_update_turn - * and write a single dot line to output file at world.path_out), 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