Provide an Empire clock with ETU resolution that is properly
synchronized to updates (the one based on s_p_etu isn't synchronized): (gamestr): New members game_turn, game_tick, game_rt. (game_ca): New selectors for them. Restrict tick and rt to deity for now. We'd need xdump update the Empire clock to make them safe for players. (game_record_update): New. (update_main): Call it. (game_tick_tick, game_tick_to_now, game_step_a_tick): New, not yet used.
This commit is contained in:
parent
654335c621
commit
dd2daaaab3
4 changed files with 157 additions and 0 deletions
|
@ -34,13 +34,27 @@
|
|||
#ifndef GAME_H
|
||||
#define GAME_H
|
||||
|
||||
#include <time.h>
|
||||
|
||||
struct gamestr {
|
||||
/* initial part must match struct empobj */
|
||||
short ef_type;
|
||||
/* end of part matching struct empobj */
|
||||
/*
|
||||
* The Empire clock.
|
||||
* Access it through game_tick_tick(), or else it'll be late.
|
||||
*/
|
||||
short game_turn; /* turn number */
|
||||
short game_tick; /* elapsed etus in this turn */
|
||||
time_t game_rt; /* when game_tick last ticked */
|
||||
};
|
||||
|
||||
#define putgame() ef_write(EF_GAME, 0, ef_ptr(EF_GAME, 0))
|
||||
#define getgamep() ((struct gamestr *)ef_ptr(EF_GAME, 0))
|
||||
|
||||
extern void game_record_update(time_t);
|
||||
extern struct gamestr *game_tick_tick(void);
|
||||
extern int game_tick_to_now(short *);
|
||||
extern int game_step_a_tick(struct gamestr *, short *);
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue