Angband
z-type.h
Go to the documentation of this file.
1 
19 #ifndef INCLUDED_ZTYPE_H
20 #define INCLUDED_ZTYPE_H
21 
22 #include "h-basic.h"
23 
24 struct loc {
25  int x;
26  int y;
27 };
28 
29 struct loc loc(int x, int y);
30 bool loc_eq(struct loc grid1, struct loc grid2);
31 bool loc_is_zero(struct loc grid);
32 struct loc loc_sum(struct loc grid1, struct loc grid2);
33 struct loc loc_diff(struct loc grid1, struct loc grid2);
34 struct loc rand_loc(struct loc grid, int x_spread, int y_spread);
35 struct loc loc_offset(struct loc grid, int dx, int dy);
36 
37 
41 typedef struct grouper grouper;
42 struct grouper {
43  int tval;
44  const char *name;
45 };
46 
50 struct point_set {
51  int n;
52  int allocated;
53  struct loc *pts;
54 };
55 
56 struct point_set *point_set_new(int initial_size);
57 void point_set_dispose(struct point_set *ps);
58 void add_to_point_set(struct point_set *ps, struct loc grid);
59 int point_set_size(struct point_set *ps);
60 int point_set_contains(struct point_set *ps, struct loc grid);
61 
62 #endif /* !INCLUDED_ZTYPE_H */
struct loc rand_loc(struct loc grid, int x_spread, int y_spread)
Get a random location with the given x and y centres and spread.
Definition: z-type.c:65
int n
Definition: z-type.h:51
Definition: z-type.h:24
void point_set_dispose(struct point_set *ps)
Definition: z-type.c:87
typedef int
Definition: libpng12/png.h:1135
struct loc loc_diff(struct loc grid1, struct loc grid2)
Take the difference of two grid locations.
Definition: z-type.c:57
struct loc loc_sum(struct loc grid1, struct loc grid2)
Sum two grid locations.
Definition: z-type.c:49
struct loc loc_offset(struct loc grid, int dx, int dy)
Definition: z-type.c:70
struct point_set * point_set_new(int initial_size)
Utility functions to work with point_sets.
Definition: z-type.c:78
A set of points that can be constructed to apply a set of changes to.
Definition: z-type.h:50
int x
Definition: z-type.h:25
The lowest level header.
const char * name
Definition: z-type.h:44
struct loc * pts
Definition: z-type.h:53
bool loc_eq(struct loc grid1, struct loc grid2)
Determine if two grid locations are equal.
Definition: z-type.c:33
int y
Definition: z-type.h:26
Definition: z-type.h:42
void add_to_point_set(struct point_set *ps, struct loc grid)
Add the point to the given point set, making more space if there is no more space left...
Definition: z-type.c:97
int allocated
Definition: z-type.h:52
int point_set_size(struct point_set *ps)
Definition: z-type.c:107
int point_set_contains(struct point_set *ps, struct loc grid)
Definition: z-type.c:112
int tval
Definition: z-type.h:43
bool loc_is_zero(struct loc grid)
Determine if a grid location is the (0, 0) location.
Definition: z-type.c:41