forked from andbof/yastg
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathuniverse.h
More file actions
42 lines (35 loc) · 1.26 KB
/
universe.h
File metadata and controls
42 lines (35 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef _HAS_UNIVERSE_H
#define _HAS_UNIVERSE_H
#include "list.h"
#include "rbtree.h"
#include "civ.h"
#include "sector.h"
#include "names.h"
struct universe {
size_t id; /* ID of the universe (or the game?) */
char* name; /* The name of the universe (or the game?) */
time_t created; /* When the universe was created */
unsigned long inhabited_sectors;
struct ptrlist sectors;
struct rb_root x_rbtree;
struct list_head sectornames;
pthread_rwlock_t sectornames_lock;
struct list_head planetnames;
pthread_rwlock_t planetnames_lock;
struct list_head basenames;
pthread_rwlock_t basenames_lock;
struct list_head list;
struct name_list avail_base_names;
struct name_list avail_player_names;
};
extern struct universe univ;
void universe_free(struct universe *u);
struct universe* universe_create();
void universe_init(struct universe *u);
int universe_genesis(struct universe *univ, struct civ *civs);
unsigned long get_neighbouring_systems(struct ptrlist * const neighbours,
const struct sector * const origin, const long max_distance);
int sector_move(struct sector * const s, const long x, const long y);
int makeneighbours(struct sector *s1, struct sector *s2, unsigned long min, unsigned long max);
void linksectors(struct sector *s1, struct sector *s2);
#endif