|
@@ -45,7 +45,7 @@ static car * newcar(Direction origin, Direction dest)
|
|
|
}
|
|
|
|
|
|
// initialize the array active
|
|
|
-void activeinit()
|
|
|
+void activeinit(void)
|
|
|
{
|
|
|
active = kmalloc(12 * sizeof(car *));
|
|
|
|
|
@@ -79,7 +79,7 @@ static void clearint(car * done)
|
|
|
// 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
|
|
|
// set the array of active cars to null at this value
|
|
|
- int total = *(dirs + newcar->origin) + *(*(compass + newcar->origin) + newcar->dest);
|
|
|
+ int total = *(dirs + done->origin) + *(*(compass + done->origin) + done->dest);
|
|
|
active + total = NULL;
|
|
|
|
|
|
if (done->cv) // if this car was blocking something
|
|
@@ -211,7 +211,7 @@ void intersection_before_entry(Direction origin, Direction destination)
|
|
|
|
|
|
for (int i = 0; i < 12; ++i)
|
|
|
{
|
|
|
- car * temp = *(active + i);
|
|
|
+ car * temp = active + i;
|
|
|
|
|
|
if (temp)
|
|
|
{
|
|
@@ -257,7 +257,7 @@ void intersection_before_entry(Direction origin, Direction destination)
|
|
|
void intersection_after_exit(Direction origin, Direction destination)
|
|
|
{
|
|
|
lock_acquire(globlock);
|
|
|
- int position = *(dirs + origin) + *(*(compass + origin) + dest);
|
|
|
+ int position = *(dirs + origin) + *(*(compass + origin) + destination);
|
|
|
clearint(active + position);
|
|
|
lock_release(globlock);
|
|
|
}
|