3 * This file is part of PlomRogue. PlomRogue is licensed under the GPL version 3
4 * or any later version. For details on its copyright, license, and warranties,
5 * see the file NOTICE in the root directory of the PlomRogue source package.
7 * Process commands and act on them. Stuff that furthers the state of the game.
13 #include <stdint.h> /* uint8_t */
17 /* Append "answer" to server output file, with instant fflush() if "flush". */
18 extern void send_to_outfile(char * answer, uint8_t flush);
20 /* Record save and record file data. Both are only written if "force" is set, or
21 * on the first run with unset "force", or if 15 seconds have passed since the
22 * last file writing. "msg" is appended to the record file if it is set.
24 extern void record(char * msg, uint8_t force);
26 /* Try parsing "msg" into a command to apply. Output "msg" if world.is_verbose.
27 * If "obey_state" is > 1 and world.replay is set, any non-meta command message
28 * is not executed, but merely returns 3. The QUIT meta command (if well-formed)
29 * always returns 2. Other meta commands and (with "obey_state" < 2) non-meta
30 * commands return 1 if well-formed. Malformed or empty command messages return
31 * 0. If "obey_state" is 1, "msg" is recorded via a non-forced record(). If a
32 * non-meta command is executed and world.exists, world.do_update is set.
34 extern uint8_t obey_msg(char * msg, uint8_t obey_state);
36 /* Loop to read commands via io_round() and call obey_msg() with "obey_state"
37 * set on them. If latter returns 2 and world.replay is not set, or returns > 1
38 * and world.replay is set, abort loop to return that result. After io_round(),
39 * compares 1st line of the server out file is compared with world.server_test
40 * to ensure the server process hasn't been superseded by a new one.
42 extern uint8_t io_loop(uint8_t obey_state);