-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathreserve.c
executable file
·75 lines (63 loc) · 1.53 KB
/
reserve.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
/* reserve.c */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <raylib.h>
#include "baize.h"
#include "pile.h"
#include "array.h"
#include "reserve.h"
static struct PileVtable reserveVtable = {
&ReserveCanMoveTail,
&ReserveCanAcceptCard,
&ReserveCanAcceptTail,
&GenericTailTapped,
&ReserveCollect,
&ReserveComplete,
&PileGenericUnsortedPairs,
&PileReset,
&PileUpdate,
&ReserveDraw,
&PileFree,
};
struct Reserve* ReserveNew(struct Baize *const baize, Vector2 slot, enum FanType fan)
{
struct Reserve* self = calloc(1, sizeof(struct Reserve));
if ( self ) {
PileCtor(baize, (struct Pile*)self, "Reserve", slot, fan);
self->super.vtable = &reserveVtable;
}
return self;
}
_Bool ReserveCanMoveTail(struct Array *const tail)
{
(void)tail;
return 1;
}
_Bool ReserveCanAcceptCard(struct Baize *const baize, struct Pile *const self, struct Card *const c)
{
(void)self;
(void)c;
BaizeSetError(baize, "(CSOL) Cannot move a card to a Reserve");
return 0;
}
_Bool ReserveCanAcceptTail(struct Baize *const baize, struct Pile *const self, struct Array *const tail)
{
BaizeSetError(baize, "(CSOL) Cannot move a card to a Reserve");
(void)self;
(void)tail;
return 0;
}
int ReserveCollect(struct Pile *const self)
{
return PileGenericCollect(self);
}
_Bool ReserveComplete(struct Pile *const self)
{
return PileEmpty(self);
}
void ReserveDraw(struct Pile *const self)
{
(void)self;
// override PileDraw() to draw nothing
}