aboutsummaryrefslogtreecommitdiff
path: root/src/player/inc/player.h
blob: 06463f9cbc8b46c7f97343257c645012e4a8dd3c (plain) (blame)
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
#ifndef PLAYER_H
#define PLAYER_H

#include <building.h>
#include <camera.h>
#include <instance.h>
#include <pad.h>
#include <unit.h>
#include <stdbool.h>
#include <stddef.h>

#ifdef __cplusplus
extern "C"
{
#endif

typedef unsigned player_team;

enum
{
    PLAYER_MAX_UNITS = 10,
    PLAYER_MAX_BUILDINGS = 5
};

struct player
{
    enum player_color
    {
        PLAYER_COLOR_BLUE,
        PLAYER_COLOR_RED
    } color;

    player_team team;
    bool alive;
    struct unit units[PLAYER_MAX_UNITS];
    struct building buildings[PLAYER_MAX_BUILDINGS];
    unsigned char pop, bpop;
};

struct player_cfg
{
    enum player_color color;
    player_team team;
    unsigned long x, y;
};

struct player_others
{
    struct player *pl;
    size_t n_pl;
};

int player_init(const struct player_cfg *cfg, struct player *pl);
int player_create_unit(const struct unit_cfg *cfg, struct player *pl);
int player_create_building(const struct building_cfg *cfg, struct player *pl);
void player_update(struct player *p);

#ifdef __cplusplus
}
#endif

#endif /* PLAYER_H */