home · contact · privacy
Moved textfile_sizes() to readwrite library.
[plomrogue] / src / misc.h
1 /* misc.h
2  *
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.
5  */
6
7 #ifndef MISC_H
8 #define MISC_H
9
10
11
12 #include <stdint.h>    /* for uint16_t */
13 #include "yx_uint16.h" /* for yx_uint16 coordinates */
14 struct World;
15 struct Map;
16
17
18
19 /* Update game log by appending "text", or by appending a "." if "text" is the
20  * same as the last one passed.
21  */
22 extern void update_log(struct World * world, char * text);
23
24
25
26 /* Return the offset necessary to center "map" on position "pos" in a frame of
27  * "framesize.
28  */
29 extern uint16_t center_offset(uint16_t pos, uint16_t mapsize,
30                               uint16_t framesize);
31
32
33
34 /* Record last player "action" in game record file "record, increment the game
35  * turn and trigger enemy movement.
36  */
37 extern void turn_over(struct World * world, char action);
38
39
40
41 /* Save current game data to file "savefile". */
42 extern void save_game(struct World * world);
43
44
45
46 /* Return a random position on the map "map" that is passable (as determined by
47  * is_passable().
48  */
49 extern struct yx_uint16 find_passable_pos(struct Map * map);
50
51
52
53 #endif