3 * Miscellaneous routines that have not yet found a proper parent module. Having
4 * LOTS of stuff in here is a sure sign that better modularization is in order.
12 #include <stdint.h> /* for uint8_t, uint16_t */
13 #include <stdio.h> /* for FILE typedef */
14 #include "yx_uint16.h" /* for yx_uint16 coordinates */
20 /* Learn from "file" the largest line length (pointed to by "linemax_p"; length
21 * includes newline chars) and (pointed to by "n_lines_p" if it is not set to
22 * NULL) the number of lines (= number of newline chars).
24 * Returns 0 on success, 1 on error of fseek() (called to return to initial file
27 extern uint8_t textfile_sizes(FILE * file, uint16_t * linemax_p,
28 uint16_t * n_lines_p);
32 /* Update game log by appending "text", or by appending a "." if "text" is the
33 * same as the last one passed.
35 extern void update_log(struct World * world, char * text);
39 /* Return the offset necessary to center "map" on position "pos" in a frame of
42 extern uint16_t center_offset(uint16_t pos, uint16_t mapsize,
47 /* Record last player "action" in game record file "record, increment the game
48 * turn and trigger enemy movement.
50 extern void turn_over(struct World * world, char action);
54 /* Save current game data to file "savefile". */
55 extern void save_game(struct World * world);
59 /* Return a random position on the map "map" that is passable (as determined by
62 extern struct yx_uint16 find_passable_pos(struct Map * map);