summaryrefslogtreecommitdiffstats
path: root/source/Concept
diff options
context:
space:
mode:
authormasterm <devnull@localhost>2007-02-13 15:40:04 +0100
committermasterm <devnull@localhost>2007-02-13 15:40:04 +0100
commit54a7ea32d4c79b5ca56b66a5dac28690e928740e (patch)
treee64f40a8eafd815cbb40c045b8d3c14d133a61a1 /source/Concept
parent05c8b0af602b222d00c227560682158333b726a2 (diff)
downloadrc2007-soccer-54a7ea32d4c79b5ca56b66a5dac28690e928740e.tar
rc2007-soccer-54a7ea32d4c79b5ca56b66a5dac28690e928740e.zip
+++ added parent object to io_modules
+++ added speed and enabling value stores for engines
Diffstat (limited to 'source/Concept')
-rw-r--r--source/Concept/Framework/Concept.vcproj18
-rw-r--r--source/Concept/Framework/defines.h2
-rw-r--r--source/Concept/Framework/engine.h29
-rw-r--r--source/Concept/Framework/io_module.h22
-rw-r--r--source/Concept/Framework/robot.cpp2
-rw-r--r--source/Concept/Framework/sensor.h2
-rw-r--r--source/Concept/Framework/stdafx.h2
-rw-r--r--source/Concept/Framework/tools.cpp4
-rw-r--r--source/Concept/Framework/tools.h6
9 files changed, 79 insertions, 8 deletions
diff --git a/source/Concept/Framework/Concept.vcproj b/source/Concept/Framework/Concept.vcproj
index 1559721..fd22f8d 100644
--- a/source/Concept/Framework/Concept.vcproj
+++ b/source/Concept/Framework/Concept.vcproj
@@ -220,6 +220,24 @@
</File>
</Filter>
</Filter>
+ <Filter
+ Name="Tools"
+ Filter="">
+ <Filter
+ Name="Source Files"
+ Filter="">
+ <File
+ RelativePath=".\tools.cpp">
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="">
+ <File
+ RelativePath=".\tools.h">
+ </File>
+ </Filter>
+ </Filter>
</Files>
<Globals>
</Globals>
diff --git a/source/Concept/Framework/defines.h b/source/Concept/Framework/defines.h
index fd07125..9eac05d 100644
--- a/source/Concept/Framework/defines.h
+++ b/source/Concept/Framework/defines.h
@@ -18,7 +18,7 @@
#ifdef __int16
#define int16 __int16
#else
- #define int16 int
+ #define int16 short
#endif
#endif
diff --git a/source/Concept/Framework/engine.h b/source/Concept/Framework/engine.h
index 0b8bfac..2736a7a 100644
--- a/source/Concept/Framework/engine.h
+++ b/source/Concept/Framework/engine.h
@@ -8,12 +8,41 @@ class Engine : public IO_Module
public:
Engine()
{
+ this->enabled = false;
+ this->parent = NULL;
}
Engine(uint32 engineId)
{
+ this->enabled = false;
+ this->parent = NULL;
this->moduleId = engineId;
}
+
+protected:
+ bool enabled;
+ float curSpeed;
+
+public:
+ float GetSpeed()
+ {
+ return curSpeed;
+ }
+
+ void SetSpeed(float newSpeed)
+ {
+ curSpeed = newSpeed;
+ }
+
+ bool GetEnabled()
+ {
+ return enabled;
+ }
+
+ void SetEnabled(bool newStatus)
+ {
+ enabled = newStatus;
+ }
};
#endif
diff --git a/source/Concept/Framework/io_module.h b/source/Concept/Framework/io_module.h
index 271f7a7..af5d611 100644
--- a/source/Concept/Framework/io_module.h
+++ b/source/Concept/Framework/io_module.h
@@ -3,27 +3,41 @@
#include "defines.h"
+class Robot;
+
class IO_Module
{
public:
+ IO_Module()
+ {
+ this->parent = NULL;
+ }
+
IO_Module(uint32 moduleId)
{
+ this->parent = NULL;
this->moduleId = moduleId;
}
- IO_Module(){}
-
protected:
+ Robot* parent;
uint32 moduleId;
public:
+ Robot* GetParent()
+ {
+ return parent;
+ }
+
+ void SetParent(Robot* newParent)
+ {
+ parent = newParent;
+ }
uint32 GetId()
{
return moduleId;
}
-
-
};
#endif
diff --git a/source/Concept/Framework/robot.cpp b/source/Concept/Framework/robot.cpp
index 24038d3..f982be6 100644
--- a/source/Concept/Framework/robot.cpp
+++ b/source/Concept/Framework/robot.cpp
@@ -24,6 +24,8 @@ bool Robot::AddModule(IO_Module* newModule)
if(modules[newModule->GetId()])
return false;
+ newModule->SetParent(this);
+
modules[newModule->GetId()] = newModule;
return true;
diff --git a/source/Concept/Framework/sensor.h b/source/Concept/Framework/sensor.h
index 15dcdc0..117f446 100644
--- a/source/Concept/Framework/sensor.h
+++ b/source/Concept/Framework/sensor.h
@@ -8,10 +8,12 @@ class Sensor : public IO_Module
public:
Sensor()
{
+ this->parent = NULL;
}
Sensor(uint32 sensorId, SensorTypes sensorType)
{
+ this->parent = NULL;
this->moduleId = sensorId;
this->sensorType = sensorType;
}
diff --git a/source/Concept/Framework/stdafx.h b/source/Concept/Framework/stdafx.h
index db15d17..5a50add 100644
--- a/source/Concept/Framework/stdafx.h
+++ b/source/Concept/Framework/stdafx.h
@@ -1,6 +1,6 @@
#include <stdlib.h>
-#ifdef _WIN32
+#ifdef _MSC_VER // MS VC++
#include <memory.h>
#endif
diff --git a/source/Concept/Framework/tools.cpp b/source/Concept/Framework/tools.cpp
index 93766f1..625ef20 100644
--- a/source/Concept/Framework/tools.cpp
+++ b/source/Concept/Framework/tools.cpp
@@ -1,5 +1,7 @@
#include "tools.h"
+#ifndef __cplusplus
+
//-----------------------------------------------------------------------------
void* operator new(size_t sz)
{
@@ -11,3 +13,5 @@ void operator delete(void* p)
{
free(p);
}
+
+#endif \ No newline at end of file
diff --git a/source/Concept/Framework/tools.h b/source/Concept/Framework/tools.h
index a3c12de..9cd38f2 100644
--- a/source/Concept/Framework/tools.h
+++ b/source/Concept/Framework/tools.h
@@ -1,7 +1,9 @@
#ifndef _TOOLS_H
#define _TOOLS_H
-void* operator new(size_t sz);
-void operator delete(void* p);
+#ifndef __cplusplus
+ void* operator new(size_t sz);
+ void operator delete(void* p);
+#endif
#endif