aboutsummaryrefslogtreecommitdiff
path: root/gst/units.h
blob: 2b401e9689af153829f265049c71646bdf8e89f6 (plain)
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
#ifndef UNITS_H
#define UNITS_H

#define MAXUNITS 128
#define MAXSOLVESTEPS 128

#include <info.h>

typedef struct unit_ {
    float pos[2];
    int gridpos[2];
    info_unit info;
    int owner;
    float hp;
    float move_points;
    float cooldown[8];
    float charge;
    float reduced_armor[7];
    float stun;
} unit;

typedef struct army_ {
    unit us[MAXUNITS];
    unit **grid;
    int uslen;
    int sx, sy;
    char name[32];
} army;


#include <map.h>

void unit_init (infos *info, army *ar, map *m, 
    int x, int y, info_unit *iu, int owner, unit *u);
void unit_remove (army *ar, map *m, unit *u);

void army_grid_init (army *ar);
void army_init (army *ar, map *m);
void army_destory (army *ar);
void army_spawn (army *ar, map *m, unit u);
int army_move (infos *info, army *ar, map *m, stats_unit *ustats);

typedef struct { unit *u, *t; float dam; } a_dmg;
int army_fire (infos *info, army *ar, map *m, a_dmg dmgs[], 
    stats_unit *ustats);
void army_upkeep (infos *info, army *ar, map *m, stats_unit *ustats);

#endif