-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtile.c
76 lines (66 loc) · 1.31 KB
/
tile.c
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#include <stdlib.h>
#include <stdbool.h>
#include "tile.h"
#include "array.h"
void tile_init(tile *tile, unsigned char x, unsigned char y, unsigned char value)
{
tile->x = x;
tile->y = y;
tile->value = value;
}
unsigned char tile_get_value(tile *tile)
{
return tile->value;
}
void tile_set_value(tile *tile, unsigned char value)
{
tile->value = value;
}
void tile_set_moved(tile *tile, bool moved)
{
if (moved) {
tile->flags |= FLAG_MOVED;
} else {
tile->flags &= ~FLAG_MOVED;
}
}
bool tile_moved(tile *tile)
{
return FLAG_MOVED == ( tile->flags & FLAG_MOVED );
}
void tile_set_added(tile *tile, bool added)
{
if (added) {
tile->flags |= FLAG_ADDED;
} else {
tile->flags &= ~FLAG_ADDED;
}
}
bool tile_added(tile *tile)
{
return FLAG_ADDED == ( tile->flags & FLAG_ADDED );
}
void tile_set_dirty(tile *tile, bool dirty)
{
if (dirty) {
tile->flags |= FLAG_DIRTY;
} else {
tile->flags &= ~FLAG_DIRTY;
}
}
bool tile_dirty(tile *tile)
{
return FLAG_DIRTY == ( tile->flags & FLAG_DIRTY );
}
void tile_set_needs_drawing(tile *tile, bool needs_drawing)
{
if (needs_drawing) {
tile->flags |= FLAG_NEEDS_DRAWING;
} else {
tile->flags &= ~FLAG_NEEDS_DRAWING;
}
}
bool tile_needs_drawing(tile *tile)
{
return FLAG_NEEDS_DRAWING == ( tile->flags & FLAG_NEEDS_DRAWING );
}