-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtypes.h
62 lines (55 loc) · 1.35 KB
/
types.h
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/**
* Oświadczam, że niniejsza praca stanowiąca podstawę do uznania osiągnięcia efektów
* uczenia się z przedmiotu SOP1 została wykonana przeze mnie samodzielnie.
* Piotr Rogulski
* 305867
*/
#pragma once
#include <ncurses.h>
#include <pthread.h>
#include <signal.h>
/**
* Holds information about an object
*/
typedef struct object {
unsigned id;
unsigned assigned_room;
} object_t;
/**
* Holds information about a room (this includes objects in the room)
*/
typedef struct room {
unsigned id;
object_t *objects[2];
unsigned num_existing_objects;
unsigned num_assigned_objects;
} room_t;
/**
* Holds information about the state of the game and necessary thread info: thread IDs and mutexes
*/
typedef struct gameState {
char *rooms_map;
room_t *rooms;
unsigned player_position;
object_t *player_objects[2];
unsigned num_player_objects;
unsigned n;
pthread_mutex_t *game_mutex;
pthread_t auto_save_tid;
pthread_t alarm_generator_tid;
pthread_t user_signal_catcher_tid;
pthread_t swap_objects_tid;
WINDOW *win;
unsigned swap_seed;
} gameState_t;
typedef struct timespec timespec_t;
/**
* Data type for path finding worker threads
*/
typedef struct pathFind {
gameState_t *game;
unsigned seed;
unsigned *path;
unsigned destination;
unsigned length;
} pathFind_t;