NerfUS game coordinator for the Nerf gun firing range

Dependencies:   HardwareInterface mbed-rtos mbed

Fork of NerfUS by NerfUS

Branch:
PlayableGame
Revision:
18:469c8b2a9af9
Parent:
17:48474266a361
--- a/source/GameModes/PrecisionMode.cpp	Fri Mar 17 17:19:42 2017 -0400
+++ b/source/GameModes/PrecisionMode.cpp	Mon Mar 27 11:15:50 2017 -0400
@@ -1,16 +1,15 @@
 #include "PrecisionMode.hpp"
 
-TargetInfo PrecisionMode::GetNextTarget()
+TargetInfo * PrecisionMode::GetNextTarget()
 {
     if (numberOfRounds-- == 0) {
         return NULL;
     }
-    TargetInfo new_target;
+    TargetInfo * new_target = &((*this->targets)[currentTarget]);
 
-    currentTarget = (currentTarget + 1) % NUMBER_OF_TARGETS;
-    new_target.id = currentTarget;
-    new_target.type = TARGET_TYPE_ENEMY;
-    new_target.timeout_ms = 30000; //30 seconds
+    currentTarget = (currentTarget + 1) % this->targets->size();
+    new_target->type = TARGET_TYPE_ENEMY;
+    new_target->timeout_ms = 30000; //30 seconds
 
     return new_target;
 }