-
Notifications
You must be signed in to change notification settings - Fork 4
/
ship.h
56 lines (45 loc) · 1.26 KB
/
ship.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
/*
* Atlantis v1.0 13 September 1993
* Copyright 1993 by Russell Wallace
*
* This program may be freely used, modified and distributed. It may not be
* sold or used commercially without prior written permission from the author.
*/
#ifndef ATL_SHIP_H
#define ATL_SHIP_H
#include "bool.h"
struct ship;
struct region;
typedef enum {
SH_LONGBOAT,
SH_CLIPPER,
SH_GALLEON,
} ship_t;
#define NUMSHIPS 3
extern const char *shipnames[];
extern struct quicklist *shiptypes;
typedef struct ship_type {
char *name;
int capacity;
int cost;
int speed;
} ship_type;
typedef struct ship {
const struct ship_type *type;
int no;
char *name_;
char *display_;
int left;
} ship;
struct ship *create_ship(int no, const struct ship_type *type);
void free_ship(struct ship *s);
const char * ship_getname(const struct ship *self);
void ship_setname(struct ship *self, const char *name);
const char * ship_getdisplay(const struct ship *self);
void ship_setdisplay(struct ship *self, const char *display);
int ship_speed(const struct ship *sh);
struct ship_type *create_shiptype(const char *name);
void free_shiptype(struct ship_type *st);
struct ship_type *get_shiptype(ship_t type);
struct ship_type *get_shiptype_by_name(const char *name);
#endif