|
@@ -43,18 +43,6 @@ static car * newcar(Direction origin, Direction dest)
|
|
|
return temp;
|
|
|
}
|
|
|
|
|
|
-// push a car to the active array
|
|
|
-static void push(car * newcar)
|
|
|
-{
|
|
|
- // dirs + origin is our offset for where to start in the array
|
|
|
- // compass + origin is the array we use to determine what to add to the first number
|
|
|
- // newcar->dest gives the direction, which we use to find the offset indicating it's additive value
|
|
|
- int total = dirs[newcar->origin] + *(compass[newcar->origin] + newcar->dest);
|
|
|
-
|
|
|
- // with our offset, set the pointer here to newcar
|
|
|
- active[total] = newcar;
|
|
|
-}
|
|
|
-
|
|
|
// called when a car clears the intersection
|
|
|
static void clearint(car * done, int pos)
|
|
|
{
|
|
@@ -148,7 +136,7 @@ void intersection_before_entry(Direction origin, Direction destination)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- push(new);
|
|
|
+ active[(dirs[new->origin] + *(compass[new->origin] + new->dest))] = new;
|
|
|
lock_release(globlock);
|
|
|
}
|
|
|
|