summaryrefslogtreecommitdiffstats
path: root/source/Concept/Framework/robot.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Concept/Framework/robot.cpp')
-rw-r--r--source/Concept/Framework/robot.cpp31
1 files changed, 19 insertions, 12 deletions
diff --git a/source/Concept/Framework/robot.cpp b/source/Concept/Framework/robot.cpp
index 768554e..24038d3 100644
--- a/source/Concept/Framework/robot.cpp
+++ b/source/Concept/Framework/robot.cpp
@@ -1,24 +1,31 @@
-#include "robot.h"
+#include "robot.h"
+
+//-----------------------------------------------------------------------------
+Robot::Robot()
+{
+ memset(modules, NULL, sizeof(modules));
+}
//-----------------------------------------------------------------------------
Robot::~Robot()
-{
- while(!modules.empty())
- {
- moduleMap::iterator iter = modules.begin();
- delete iter->second;
- modules.erase(iter);
+{
+ for(uint8 i = 0; i < IO_END; i++)
+ {
+ if(!modules[i]) continue;
+
+ delete modules[i];
+ modules[i] = NULL;
}
}
//-----------------------------------------------------------------------------
bool Robot::AddModule(IO_Module* newModule)
-{
- moduleMap::iterator itr = modules.find(newModule->GetId());
- if(itr != modules.end())
+{
+ if(modules[newModule->GetId()])
return false;
- modules[newModule->GetId()] = newModule;
+ modules[newModule->GetId()] = newModule;
+
return true;
}
@@ -34,4 +41,4 @@ void Robot::Update()
//insert code here
}
-//--- EOF --- \ No newline at end of file
+//--- EOF ---