Project

General

Profile

Revision 1908

reorganized stuff in intersectData. made new function getTurningIntersect
that can be used to input directly into dan's code. made new functions to get
information about road nodes stored int he intersection database. eventually
should convert it to the node database.

View differences:

intersectData.c
11 11
	//insert all intersections that are in the map.
12 12
	//THIS DATA FOR THE DEMO MAP
13 13
	
14
	insertIntersection(0, 0, INTERSECTION_DOUBLE_C, TMIDDLE);
15
	insertIntersection(1, 1, INTERSECTION_ROAD, TMIDDLE);
16
	insertIntersection(2, 2, INTERSECTION_ROAD, TMIDDLE);
17
	insertIntersection(3, 3, INTERSECTION_ROAD, TMIDDLE);
18
	insertIntersection(4, 4, INTERSECTION_ROAD, TMIDDLE);
14
	insertNode(0, INTERSECTION_NODE, INTERSECTION_DOUBLE_C, TMIDDLE);
15
	insertNode(1, ROAD_NODE, ROAD, ROAD_DOUBLE);
16
	insertNode(2, ROAD_NODE, ROAD, ROAD_DOUBLE);
17
	insertNode(3, ROAD_NODE, ROAD, ROAD_DOUBLE);
18
	insertNode(4, ROAD_NODE, ROAD, ROAD_DOUBLE);
19 19
	return;
20 20
}
21 21

  
......
28 28

  
29 29

  
30 30
// Does nothing if your indmaex is out of bounds.
31
void insertIntersection(int key, int featureid, int intersect_type, int intersect_position){
31
void insertNode(int key, int featureid, int node_type, int node_info){
32 32
//	if (key < sizeof(IntersectData)/sizeof(int))
33 33
	if(key < NUM_FEATURES)
34
	  IntersectData[key] = (featureid << 12) + intersect_type + intersect_position;
34
	  IntersectData[key] = featureid + node_type + node_info;
35 35
	return;
36 36
}
37 37

  
38 38
// Functions to get data from the Database:
39 39
//@TODO:Add some checks to make sure the key is less than NUM_FEATURES
40 40
//	also: figure out what to do when this happens.
41
//	Add checks to see if we call getIntersect...() on intersections
42
//	and getRoad...() on roads.
41 43

  
42 44
int getIntersectType(int key){
43 45
	return (IntersectData[key])&28; // 28 == 11100;
44 46
}
45 47

  
46
int getIntersectPos(int key){
47
	return (IntersectData[key])&3;
48
}
49
int getFeatureId(int key)
50
{
51
	return (IntersectData[key] >> 12)&0xF;
52
}
53
#include "lineDrive.h"
54
int getTurnIntType(int intersectiontype)
55
{
56
	switch(intersectiontype)
48
int getTurningIntersect(int key){
49
	switch(getIntersectType(key))
57 50
	{
58 51
		case INTERSECTION_SINGLE:
59 52
			return SINGLE;
......
65 58
		case INTERSECTION_OFF_RAMP:
66 59
			return OFF_RAMP;
67 60
	}
61
}
68 62

  
63
int getIntersectPos(int key){
64
	return (IntersectData[key])&3;
69 65
}
66
int getFeatureId(int key)
67
{
68
	return (IntersectData[key])&61440;  // 61220 == (15<<12);
69
}
70
int getRoadType(int key){
71
	return (IntersectData[key])&28;  // 28 == 11100;
72
}
73
int getRoadInfo(int key){
74
	return (IntersectData[key])&3;
75
}
76

  

Also available in: Unified diff