world.log = NULL; /* thing_actions.c's update_log() checks for this. */
world.seed_map = world.seed;
free_things(world.things);
- world.last_update_turn = 0;
+ world.do_update = 1;
remake_map();
struct ThingType * tt;
for (tt = world.thing_types; NULL != tt; tt = tt->next)
* Unlinks any pre-existing record file.
*
* Thing (action) definitions read in from server config directory are not
- * affected. The map is populated accordingly. world.last_update_turn is set to
- * 0 and world.turn to 1, so that io_round()'s criteria for updating the output
- * file are triggered even when this function is called during a round 1.
+ * affected. The map is populated accordingly. world.turn is set to 1, as is
+ * world.do_update, so that io_round() is told to update the worldstate file.
*/
extern void remake_world();
{
return get_message_from_queue();
}
- if (world.turn != world.last_update_turn)
+ if (world.do_update)
{
update_worldstate_file();
- world.last_update_turn = world.turn;
+ world.do_update = 0;
}
read_file_into_queue();
if (world.queue_size && '\0' != world.queue[world.queue_size - 1])
/* 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 (and world.last_update_turn) 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.
+ * 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 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.
free(msg_copy);
return;
}
- world.last_update_turn = 0;
+ world.do_update = 1;
free(msg_copy);
if (do_record)
{
uint32_t seed_map; /* Map seed. */
uint16_t replay; /* Turn up to which to replay game. No replay if zero. */
uint16_t turn; /* Current game turn. */
- uint16_t last_update_turn; /* Last turn the .path_out file was updated. */
+ uint16_t do_update; /* Update worldstate file if !0. */
uint8_t player_type; /* Thing type that player will start as. */
uint8_t is_verbose; /* Should server send debugging info to stdout? */
};