Pārlūkot izejas kodu

fix array usage

Kolja Strohm 3 gadi atpakaļ
vecāks
revīzija
9744fb9fb4
2 mainītis faili ar 54 papildinājumiem un 54 dzēšanām
  1. 3 3
      ErhaltungServer/Datenbank.cpp
  2. 51 51
      ErhaltungServer/ErhaltungServer.cpp

+ 3 - 3
ErhaltungServer/Datenbank.cpp

@@ -628,7 +628,7 @@ int ESDatenbank::logoutKlient( int klientId, Array< int > *ret )
     unlock();
     befehl->release();
     for( int i = 0; i < res.zeilenAnzahl; i++ )
-        ret->set( TextZuInt( res.values[ i ].getText(), 10 ), i );
+        ret->add( TextZuInt( res.values[ i ].getText(), 10 ) );
     int retVal = res.zeilenAnzahl;
     res.destroy();
     return retVal;
@@ -650,7 +650,7 @@ int ESDatenbank::getSpielerAusGruppe( int gruppeId, Array< int > *accountId )
     befehl->release();
     int ret = res.zeilenAnzahl;
     for( int i = 0; i < ret; i++ )
-        accountId->add( TextZuInt( res.values[ i ].getText(), 10 ), i );
+        accountId->add( TextZuInt( res.values[ i ].getText(), 10 ) );
     return ret;
 }
 
@@ -716,7 +716,7 @@ int ESDatenbank::getSpielerAusChatroom( int chatroomId, Array< int > *accountId
     befehl->release();
     int ret = res.zeilenAnzahl;
     for( int i = 0; i < ret; i++ )
-        accountId->add( TextZuInt( res.values[ i ].getText(), 10 ), i );
+        accountId->add( TextZuInt( res.values[ i ].getText(), 10 ) );
     return ret;
 }
 

+ 51 - 51
ErhaltungServer/ErhaltungServer.cpp

@@ -1222,25 +1222,25 @@ bool ESGWeiterleitung::spielErstelltAbbrechen( int spielErstelltId )
     bool ret = 1;
     Text *ip = new Text( "" );
     int port = 0;
-    ret = ret & es->zDB()->getSpielServer( spielErstelltId, ip, &port );
+    ret &= es->zDB()->getSpielServer( spielErstelltId, ip, &port );
     if( ip->getLength() )
     {
         Klient *klient = new Klient();
         unsigned char key[ 20 ] = { 253, 234, 211, 132, 121, 230, 95, 145, 201, 13, 43, 77, 153, 223, 253, 69, 234, 43, 52, 99 };
         klient->setSendeKey( (char *)key, 20 );
         klient->setEmpfangKey( (char *)key, 20 );
-        ret = ret & klient->verbinde( (unsigned short)port, ip->getText() );
-        ret = ret & klient->sendeEncrypted( "\x8\x1", 2 );
+        ret &= klient->verbinde( (unsigned short)port, ip->getText() );
+        ret &= klient->sendeEncrypted( "\x8\x1", 2 );
         char res = 0;
-        ret = ret & klient->getNachrichtEncrypted( &res, 1 );
+        ret &= klient->getNachrichtEncrypted( &res, 1 );
         if( res )
         {
-            ret = ret & klient->sendeEncrypted( (char *)&spielErstelltId, 4 );
-            ret = ret & klient->getNachrichtEncrypted( &res, 1 );
+            ret &= klient->sendeEncrypted( (char *)&spielErstelltId, 4 );
+            ret &= klient->getNachrichtEncrypted( &res, 1 );
         }
         ret = (char)ret & res;
-        ret = ret & klient->sendeEncrypted( "\x8\x0", 2 );
-        ret = ret & klient->getNachrichtEncrypted( &res, 1 );
+        ret &= klient->sendeEncrypted( "\x8\x0", 2 );
+        ret &= klient->getNachrichtEncrypted( &res, 1 );
         ret = (char)ret & res;
         es->addEmpfangen( klient->getDownloadBytes( 1 ) );
         es->addGesendet( klient->getUploadBytes( 1 ) );
@@ -1263,33 +1263,33 @@ bool ESGWeiterleitung::spielerLeavesGruppe( int gruppeId, int accountId )
             continue;
         Text *ip = new Text( "" );
         int port = 0;
-        ret = ret & es->zDB()->getChatServer( account, ip, &port );
+        ret = ret && es->zDB()->getChatServer( account, ip, &port );
         if( ip->getLength() )
         {
             Klient *klient = new Klient();
             unsigned char key[ 20 ] = { 78, 20, 190, 133, 10, 175, 51, 96, 62, 1, 180, 194, 126, 50, 211, 154, 105, 227, 22, 101 };
             klient->setSendeKey( (char *)key, 20 );
             klient->setEmpfangKey( (char *)key, 20 );
-            ret = ret & klient->verbinde( (unsigned short)port, ip->getText() );
-            ret = ret & klient->sendeEncrypted( "\5\x15", 2 );
+            ret &= klient->verbinde( (unsigned short)port, ip->getText() );
+            ret &= klient->sendeEncrypted( "\5\x15", 2 );
             char res = 0;
-            ret = ret & klient->getNachrichtEncrypted( &res, 1 );
+            ret &= klient->getNachrichtEncrypted( &res, 1 );
             if( res )
             {
-                ret = ret & klient->sendeEncrypted( (char *)&account, 4 );
-                ret = ret & klient->sendeEncrypted( (char *)&accountId, 4 );
-                ret = ret & klient->sendeEncrypted( (char *)&gruppeId, 4 );
-                ret = ret & klient->getNachrichtEncrypted( &res, 1 );
+                ret &= klient->sendeEncrypted( (char *)&account, 4 );
+                ret &= klient->sendeEncrypted( (char *)&accountId, 4 );
+                ret &= klient->sendeEncrypted( (char *)&gruppeId, 4 );
+                ret &= klient->getNachrichtEncrypted( &res, 1 );
             }
             ret = (char)ret & res;
-            ret = ret & klient->sendeEncrypted( "\5\x18", 2 );
+            ret &= klient->sendeEncrypted( "\5\x18", 2 );
             res = 0;
-            ret = ret & klient->getNachrichtEncrypted( &res, 1 );
+            ret &= klient->getNachrichtEncrypted( &res, 1 );
             if( res )
             {
-                ret = ret & klient->sendeEncrypted( (char *)&account, 4 );
-                ret = ret & klient->sendeEncrypted( (char *)&gruppeId, 4 );
-                ret = ret & klient->getNachrichtEncrypted( &res, 1 );
+                ret &= klient->sendeEncrypted( (char *)&account, 4 );
+                ret &= klient->sendeEncrypted( (char *)&gruppeId, 4 );
+                ret &= klient->getNachrichtEncrypted( &res, 1 );
             }
             ret = (char)ret & res;
             es->addEmpfangen( klient->getDownloadBytes( 1 ) );
@@ -1315,23 +1315,23 @@ bool ESGWeiterleitung::setGruppeAdmin( int gruppeId, int adminId )
         int account = accId->get( i );
         Text *ip = new Text( "" );
         int port = 0;
-        ret = ret & es->zDB()->getChatServer( account, ip, &port );
+        ret &= es->zDB()->getChatServer( account, ip, &port );
         if( ip->getLength() )
         {
             Klient *klient = new Klient();
             unsigned char key[ 20 ] = { 78, 20, 190, 133, 10, 175, 51, 96, 62, 1, 180, 194, 126, 50, 211, 154, 105, 227, 22, 101 };
             klient->setSendeKey( (char *)key, 20 );
             klient->setEmpfangKey( (char *)key, 20 );
-            ret = ret & klient->verbinde( (unsigned short)port, ip->getText() );
-            ret = ret & klient->sendeEncrypted( "\5\x1B", 2 );
+            ret &= klient->verbinde( (unsigned short)port, ip->getText() );
+            ret &= klient->sendeEncrypted( "\5\x1B", 2 );
             char res = 0;
-            ret = ret & klient->getNachrichtEncrypted( &res, 1 );
+            ret &= klient->getNachrichtEncrypted( &res, 1 );
             if( res )
             {
-                ret = ret & klient->sendeEncrypted( (char *)&account, 4 );
-                ret = ret & klient->sendeEncrypted( (char *)&adminId, 4 );
-                ret = ret & klient->sendeEncrypted( (char *)&gruppeId, 4 );
-                ret = ret & klient->getNachrichtEncrypted( &res, 1 );
+                ret &= klient->sendeEncrypted( (char *)&account, 4 );
+                ret &= klient->sendeEncrypted( (char *)&adminId, 4 );
+                ret &= klient->sendeEncrypted( (char *)&gruppeId, 4 );
+                ret &= klient->getNachrichtEncrypted( &res, 1 );
             }
             ret = (char)ret & res;
             es->addEmpfangen( klient->getDownloadBytes( 1 ) );
@@ -1357,23 +1357,23 @@ bool ESGWeiterleitung::spielerLeavesChatroom( int chatroomId, int accountId )
             continue;
         Text *ip = new Text( "" );
         int port = 0;
-        ret = ret & es->zDB()->getChatServer( account, ip, &port );
+        ret &= es->zDB()->getChatServer( account, ip, &port );
         if( ip->getLength() )
         {
             Klient *klient = new Klient();
             unsigned char key[ 20 ] = { 78, 20, 190, 133, 10, 175, 51, 96, 62, 1, 180, 194, 126, 50, 211, 154, 105, 227, 22, 101 };
             klient->setSendeKey( (char *)key, 20 );
             klient->setEmpfangKey( (char *)key, 20 );
-            ret = ret & klient->verbinde( (unsigned short)port, ip->getText() );
-            ret = ret & klient->sendeEncrypted( "\5\xE", 2 );
+            ret &= klient->verbinde( (unsigned short)port, ip->getText() );
+            ret &= klient->sendeEncrypted( "\5\xE", 2 );
             char res = 0;
-            ret = ret & klient->getNachrichtEncrypted( &res, 1 );
+            ret &= klient->getNachrichtEncrypted( &res, 1 );
             if( res )
             {
-                ret = ret & klient->sendeEncrypted( (char *)&accountId, 4 );
-                ret = ret & klient->sendeEncrypted( (char *)&account, 4 );
-                ret = ret & klient->sendeEncrypted( (char *)&chatroomId, 4 );
-                ret = ret & klient->getNachrichtEncrypted( &res, 1 );
+                ret &= klient->sendeEncrypted( (char *)&accountId, 4 );
+                ret &= klient->sendeEncrypted( (char *)&account, 4 );
+                ret &= klient->sendeEncrypted( (char *)&chatroomId, 4 );
+                ret &= klient->getNachrichtEncrypted( &res, 1 );
             }
             ret = (char)ret & res;
             es->addEmpfangen( klient->getDownloadBytes( 1 ) );
@@ -1394,22 +1394,22 @@ bool ESGWeiterleitung::setChatroomAdmin( int chatroomId, int adminId )
     bool ret = 1;
     Text *ip = new Text( "" );
     int port = 0;
-    ret = ret & es->zDB()->getChatServer( adminId, ip, &port );
+    ret &= es->zDB()->getChatServer( adminId, ip, &port );
     if( ip->getLength() )
     {
         Klient *klient = new Klient();
         unsigned char key[ 20 ] = { 78, 20, 190, 133, 10, 175, 51, 96, 62, 1, 180, 194, 126, 50, 211, 154, 105, 227, 22, 101 };
         klient->setSendeKey( (char *)key, 20 );
         klient->setEmpfangKey( (char *)key, 20 );
-        ret = ret & klient->verbinde( (unsigned short)port, ip->getText() );
-        ret = ret & klient->sendeEncrypted( "\5\x12", 2 );
+        ret &= klient->verbinde( (unsigned short)port, ip->getText() );
+        ret &= klient->sendeEncrypted( "\5\x12", 2 );
         char res = 0;
-        ret = ret & klient->getNachrichtEncrypted( &res, 1 );
+        ret &= klient->getNachrichtEncrypted( &res, 1 );
         if( res )
         {
-            ret = ret & klient->sendeEncrypted( (char *)&adminId, 4 );
-            ret = ret & klient->sendeEncrypted( (char *)&chatroomId, 4 );
-            ret = ret & klient->getNachrichtEncrypted( &res, 1 );
+            ret &= klient->sendeEncrypted( (char *)&adminId, 4 );
+            ret &= klient->sendeEncrypted( (char *)&chatroomId, 4 );
+            ret &= klient->getNachrichtEncrypted( &res, 1 );
         }
         ret = (char)ret & res;
         es->addEmpfangen( klient->getDownloadBytes( 1 ) );
@@ -1433,22 +1433,22 @@ bool ESGWeiterleitung::kickSpielerAusGruppe( int gruppeId )
         int account = accId->get( i );
         Text *ip = new Text( "" );
         int port = 0;
-        ret = ret & es->zDB()->getChatServer( account, ip, &port );
+        ret &= es->zDB()->getChatServer( account, ip, &port );
         if( ip->getLength() )
         {
             Klient *klient = new Klient();
             unsigned char key[ 20 ] = { 78, 20, 190, 133, 10, 175, 51, 96, 62, 1, 180, 194, 126, 50, 211, 154, 105, 227, 22, 101 };
             klient->setSendeKey( (char *)key, 20 );
             klient->setEmpfangKey( (char *)key, 20 );
-            ret = ret & klient->verbinde( (unsigned short)port, ip->getText() );
-            ret = ret & klient->sendeEncrypted( "\5\x16", 2 );
+            ret &= klient->verbinde( (unsigned short)port, ip->getText() );
+            ret &= klient->sendeEncrypted( "\5\x16", 2 );
             char res = 0;
-            ret = ret & klient->getNachrichtEncrypted( &res, 1 );
+            ret &= klient->getNachrichtEncrypted( &res, 1 );
             if( res )
             {
-                ret = ret & klient->sendeEncrypted( (char *)&account, 4 );
-                ret = ret & klient->sendeEncrypted( (char *)&gruppeId, 4 );
-                ret = ret & klient->getNachrichtEncrypted( &res, 1 );
+                ret &= klient->sendeEncrypted( (char *)&account, 4 );
+                ret &= klient->sendeEncrypted( (char *)&gruppeId, 4 );
+                ret &= klient->getNachrichtEncrypted( &res, 1 );
             }
             ret = (char)ret & res;
             es->addEmpfangen( klient->getDownloadBytes( 1 ) );