Revision 1903
Added a "feature id" field in bits 13,14,15,16 of the database ints, documented accordingly
intersectData.c | ||
---|---|---|
9 | 9 |
|
10 | 10 |
void initializeData(){ |
11 | 11 |
//insert all intersections that are in the map. |
12 |
insertIntersection(0, INTERSECTION_DOUBLE_C, TMIDDLE); |
|
12 |
insertIntersection(0, 0, INTERSECTION_DOUBLE_C, TMIDDLE);
|
|
13 | 13 |
return; |
14 | 14 |
} |
15 | 15 |
|
... | ... | |
22 | 22 |
|
23 | 23 |
|
24 | 24 |
// Does nothing if your indmaex is out of bounds. |
25 |
void insertIntersection(int barcode, int intersect_type, int intersect_position){ |
|
26 |
if (barcode < sizeof(IntersectData)/sizeof(int)) |
|
27 |
IntersectData[barcode] = intersect_type + intersect_position; |
|
25 |
void insertIntersection(int key, int featureid, int intersect_type, int intersect_position){ |
|
26 |
// if (key < sizeof(IntersectData)/sizeof(int)) |
|
27 |
if(key < NUM_INTERSECTIONS) |
|
28 |
IntersectData[key] = (featureid << 12) + intersect_type + intersect_position; |
|
28 | 29 |
return; |
29 | 30 |
} |
30 | 31 |
|
31 | 32 |
// Functions to get data from the Database: |
33 |
//@TODO:Add some checks to make sure the key is less than NUM_INTERSECTIONS |
|
34 |
// also: figure out what to do when this happens. |
|
32 | 35 |
|
33 |
int getIntersectType(int barcode){
|
|
34 |
return (IntersectData[barcode])&28; // 28 == 11100;
|
|
36 |
int getIntersectType(int key){
|
|
37 |
return (IntersectData[key])&28; // 28 == 11100;
|
|
35 | 38 |
} |
36 | 39 |
|
37 |
int getIntersectPos(int barcode){
|
|
38 |
return (IntersectData[barcode])&3;
|
|
40 |
int getIntersectPos(int key){
|
|
41 |
return (IntersectData[key])&3;
|
|
39 | 42 |
} |
43 |
int getFeatureId(int key) |
|
44 |
{ |
|
45 |
return (IntersectData[key] >> 12)&0xF; |
|
46 |
} |
Also available in: Unified diff