-
Notifications
You must be signed in to change notification settings - Fork 0
/
maps.h
62 lines (48 loc) · 931 Bytes
/
maps.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
57
58
59
60
61
62
#ifndef MAPS_H
#define MAPS_H
#include "libtca/vector.h"
#include "libtca/hashtable.h"
struct path {
struct node *target;
struct vector *path;
};
struct node {
long id;
double latitude;
double longitude;
int way_count;
double x;
double y;
struct vector *neighbors;
float *weights;
struct vector *all_reachable;
long gscore; //For astar
long fscore; //For astar
struct node *came_from; //For astar
struct vector *paths;
};
struct way {
struct vector nodes;
enum {
UNKNOWN,
RIVER,
ROAD
} type;
int is_closed;
int is_oneway;
double lane_count;
};
struct map {
struct vector ways;
struct hashtable *nodes;
struct vector *nodes_of_ways;
double min_x;
double min_y;
double max_x;
double max_y;
};
struct map *map_parse_xml(char *path);
#include <SFML/Graphics.h>
void draw_map(sfRenderWindow *win, struct map *map);
struct node *map_get_closest_node(struct map *map, int x, int y);
#endif