Prechádzať zdrojové kódy

Ereignis Klasse implementiert

Kolja Strohm 5 rokov pred
rodič
commit
7f47361898

+ 54 - 0
StickmanWorldOnline/Ereignis.cpp

@@ -0,0 +1,54 @@
+#include "Ereignis.h"
+#include "Trigger.h"
+
+Ereignis::Ereignis( EreignisTyp typ )
+{
+    this->typ = typ;
+    ref = 1;
+}
+
+Ereignis::~Ereignis()
+{}
+
+EreignisTyp Ereignis::getTyp() const
+{
+    return typ;
+}
+
+void Ereignis::addParameter( const char *name, Variable *var )
+{
+    params.add( new VarPointer( name, var ) );
+}
+
+VarPointer *Ereignis::getParameter( const char *name ) const
+{
+    for( auto v = params.getIterator(); v; v++ )
+    {
+        if( v->zName()->istGleich( name ) )
+            return v->getThis();
+    }
+    return 0;
+}
+
+VarPointer *Ereignis::zParameter( const char *name ) const
+{
+    for( auto v = params.getIterator(); v; v++ )
+    {
+        if( v->zName()->istGleich( name ) )
+            return v;
+    }
+    return 0;
+}
+
+Ereignis *Ereignis::getThis()
+{
+    ref++;
+    return this;
+}
+
+Ereignis *Ereignis::release()
+{
+    if( !--ref )
+        delete this;
+    return 0;
+}

+ 1 - 0
StickmanWorldOnline/StickmanWorldOnline.vcxproj

@@ -86,6 +86,7 @@
     <ClCompile Include="Drop.cpp" />
     <ClCompile Include="Effect.cpp" />
     <ClCompile Include="Enterhaken.cpp" />
+    <ClCompile Include="Ereignis.cpp" />
     <ClCompile Include="GameObject.cpp" />
     <ClCompile Include="Gegenstand.cpp" />
     <ClCompile Include="Geist.cpp" />

+ 3 - 0
StickmanWorldOnline/StickmanWorldOnline.vcxproj.filters

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