Kolja Strohm před 5 roky
rodič
revize
6410f16857
2 změnil soubory, kde provedl 13 přidání a 10 odebrání
  1. 5 5
      Asteroids/Skill.cpp
  2. 8 5
      Asteroids/Spiel.cpp

+ 5 - 5
Asteroids/Skill.cpp

@@ -43,16 +43,16 @@ void ActiveSkill::tick( double time )
 {
     if( active )
     {
-        if( time < time )
+        if( this->time < time )
             active = 0;
         else
-            time -= time;
+            this->time -= time;
     }
     if( !active )
     {
-        time += time * reloadTimeFactor;
-        if( time > maxTime )
-            time = maxTime;
+        this->time += time * reloadTimeFactor;
+        if( this->time > maxTime )
+            this->time = maxTime;
     }
 }
 

+ 8 - 5
Asteroids/Spiel.cpp

@@ -279,10 +279,9 @@ void Spiel::nachricht( int accountId, int len, char *bytes )
         }
         break;
     case 9: // Skill verwendung
-        if( 1 )
         {
             bytes++;
-            char id = *bytes;
+            char art = *bytes;
             len--;
             for( int i = 0; i < spielerAnzahl; i++ )
             {
@@ -291,19 +290,22 @@ void Spiel::nachricht( int accountId, int len, char *bytes )
                 {
                     if( !tmp->istAmLeben() )
                         break;
-                    tmp->useSkill( id );
+                    if( !tmp->setSkill( art ) )
+                    {
+                        saveMSG = 0;
+                        break;
+                    }
                     for( int j = 0; j < spielerAnzahl; j++ )
                     {
                         Spieler *s = spieler->z( j );
                         if( s && s->zKlient() )
-                            s->zKlient()->sendeSkillNachricht( tmp->getSpielerNummer(), id, spielZeit );
+                            s->zKlient()->sendeSkillNachricht( tmp->getSpielerNummer(), art, spielZeit );
                     }
                     break;
                 }
             }
             break;
         }
-        break;
     case 0xA: // Use active skill
     {
         bytes++;
@@ -316,6 +318,7 @@ void Spiel::nachricht( int accountId, int len, char *bytes )
             {
                 if( !tmp->istAmLeben() )
                     break;
+                tmp->useSkill( id );
                 for( int j = 0; j < spielerAnzahl; j++ )
                 {
                     Spieler *s = spieler->z( j );