Kolja Strohm 5 лет назад
Родитель
Сommit
505b0988c6

+ 1 - 0
StickmanWorldOnline/StickmanWorldOnline.vcxproj

@@ -108,6 +108,7 @@
     <ClCompile Include="Timer.cpp" />
     <ClCompile Include="Tunnel.cpp" />
     <ClCompile Include="Umlenkung.cpp" />
+    <ClCompile Include="Variablen.cpp" />
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="Aktionen.h" />

+ 3 - 0
StickmanWorldOnline/StickmanWorldOnline.vcxproj.filters

@@ -126,6 +126,9 @@
     <ClCompile Include="Ereignis.cpp">
       <Filter>Spiel\Auslöser</Filter>
     </ClCompile>
+    <ClCompile Include="Variablen.cpp">
+      <Filter>Spiel\Auslöser</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="SpielKlasse.h">

+ 97 - 0
StickmanWorldOnline/Variablen.cpp

@@ -0,0 +1,97 @@
+#include "Variablen.h"
+
+
+Variable::Variable( VariableTyp typ )
+{
+    this->typ = typ;
+    ref = 1;
+}
+
+Variable::~Variable()
+{}
+
+VariableTyp Variable::getVariableTyp() const
+{
+    return typ;
+}
+
+Variable *Variable::getThis()
+{
+    ref++;
+    return this;
+}
+
+Variable *Variable::release()
+{
+    if( !--ref )
+        delete this;
+    return 0;
+}
+
+
+Integer::Integer( int value, bool taste )
+    : Variable( taste ? TASTE : INTEGER )
+{
+    this->value = value;
+}
+
+void Integer::setValue( int value )
+{
+    this->value = value;
+}
+
+int Integer::getValue() const
+{
+    return value;
+}
+
+
+Boolean::Boolean( bool value )
+    : Variable( BOOLEAN )
+{
+    this->value = value;
+}
+
+void Boolean::setValue( bool value )
+{
+    this->value = value;
+}
+
+bool Boolean::getValue() const
+{
+    return value;
+}
+
+
+String::String( const char *value, bool richtung )
+    : Variable( richtung ? RICHTUNG : STRING )
+{
+    this->value = value;
+}
+
+void String::setValue( Text value )
+{
+    this->value = value;
+}
+
+const Text &String::getValue() const
+{
+    return value;
+}
+
+
+Float::Float( float value )
+    : Variable( FLOAT )
+{
+    this->value = value;
+}
+
+void Float::setValue( float value )
+{
+    this->value = value;
+}
+
+float Float::getValue() const
+{
+    return value;
+}