Matthew Goldsmith / Mbed OS cis441projMS1a

Dependencies:   TextLCD

Revision:
1:54512aca944d
Parent:
0:ca7cb51e9fd1
--- a/AccCar.cpp	Sun Nov 10 23:02:16 2019 +0000
+++ b/AccCar.cpp	Mon Nov 11 00:50:05 2019 +0000
@@ -58,17 +58,17 @@
                   
         } else if( position == 54 ) {
             if( waited) {
-                road->intersection_car = id;
-                speed = 1;   
+                speed = road->intersection->attemptEnterIntersection(this->id); 
             } else {
                 speed = 0;   
                 waited = true;
+                road->intendToEnter(this->id); 
             }
         } else if( position < 56 ) {
             speed = 1;
         } else {
             if( position == 56 ) {
-                road->intersection_car = -1;
+                road->intersection->leaveIntersection(); 
             }
             
             if (forward_car != NULL && forward_car->position > -1) {