3 * Process commands and act on them. Stuff that furthers the state of the game.
9 #include <stdint.h> /* uint8_t */
13 /* Record save and record file data. Both are only written if "force" is set, or
14 * on the first run with unset "force", or if 15 seconds have passed since the
15 * last file writing. "msg" is appended to the record file if it is set.
17 extern void record(char * msg, uint8_t force);
19 /* Try parsing "msg" into a command to apply, and apply it. Output commands to
20 * stdout if "do_verbose" and world.is_verbose are set. If "do_record" is set,
21 * record commands to record file, and run save_world() if the last call to it
22 * via this function has not happened yet or is at least one minute in the past.
24 extern void obey_msg(char * msg, uint8_t do_record, uint8_t do_verbose);
26 /* Loop for receiving commands via io_round() and acting on them. Exits with 1
27 * on "QUIT" command. In replay mode, exits with 0 on each non-"QUIT" command.
28 * Writes a "PONG" line to server output file on "PING" command. In play mode,
29 * processes further incomming commands via obey_msg(). Compares the first line
30 * of the server out file with world.server_test to ensure that the current
31 * server process has not been superseded by a new one.
33 extern uint8_t io_loop();