|
@@ -16,7 +16,7 @@ MinigameServer::MinigameServer( InitDatei *zIni )
|
|
|
empfangen = 0;
|
|
|
gesendet = 0;
|
|
|
fehler = new Text();
|
|
|
- ini = zIni->getThis();
|
|
|
+ ini = dynamic_cast<InitDatei *>( zIni->getThis() );
|
|
|
id = *zIni->zWert( "ServerId" );
|
|
|
server = new Server();
|
|
|
aServer = new SSLServer();
|
|
@@ -65,13 +65,13 @@ void MinigameServer::runn()
|
|
|
if( end && klient )
|
|
|
{
|
|
|
klient->trenne();
|
|
|
- klient = klient->release();
|
|
|
+ klient = (SSLSKlient *)klient->release();
|
|
|
Sleep( 1000 );
|
|
|
return;
|
|
|
}
|
|
|
if( !klient )
|
|
|
continue;
|
|
|
- MSAKlient * clHandle = new MSAKlient( klient, (MinigameServer *)getThis() );
|
|
|
+ MSAKlient *clHandle = new MSAKlient( klient, dynamic_cast<MinigameServer *>( getThis() ) );
|
|
|
clHandle->start();
|
|
|
}
|
|
|
}
|
|
@@ -85,7 +85,7 @@ void MinigameServer::thread()
|
|
|
if( !klient )
|
|
|
continue;
|
|
|
Framework::getThreadRegister()->cleanUpClosedThreads();
|
|
|
- MSKlient * clHandle = new MSKlient( klient, (MinigameServer *)getThis() );
|
|
|
+ MSKlient *clHandle = new MSKlient( klient, dynamic_cast<MinigameServer *>( getThis() ) );
|
|
|
EnterCriticalSection( &cs );
|
|
|
klients->set( clHandle, klientAnzahl );
|
|
|
klientAnzahl++;
|
|
@@ -104,13 +104,13 @@ void MinigameServer::close()
|
|
|
EnterCriticalSection( &cs );
|
|
|
for( int i = 0; i < klientAnzahl; i++ )
|
|
|
klients->z( i )->absturz();
|
|
|
- klients = klients->release();
|
|
|
+ klients = ( RCArray<MSKlient>* )klients->release();
|
|
|
klientAnzahl = 0;
|
|
|
LeaveCriticalSection( &cs );
|
|
|
ende();
|
|
|
run = 0;
|
|
|
end = 1;
|
|
|
- Klient * klient = new Klient();
|
|
|
+ Klient *klient = new Klient();
|
|
|
klient->verbinde( aServer->getPort(), "127.0.0.1" );
|
|
|
Sleep( 500 );
|
|
|
aServer->trenne();
|
|
@@ -223,7 +223,7 @@ bool MinigameServer::absturzKlient( int klientId )
|
|
|
return gefunden;
|
|
|
}
|
|
|
|
|
|
-bool MinigameServer::removeKlient( MSKlient * zKlient )
|
|
|
+bool MinigameServer::removeKlient( MSKlient *zKlient )
|
|
|
{
|
|
|
bool gefunden = 0;
|
|
|
EnterCriticalSection( &cs );
|
|
@@ -290,7 +290,7 @@ InitDatei *MinigameServer::zInit() const
|
|
|
|
|
|
// Inhalt der LSAKlient Klasse aus LoginServer.h
|
|
|
// Konstruktor
|
|
|
-MSAKlient::MSAKlient( SSLSKlient * klient, MinigameServer * ls )
|
|
|
+MSAKlient::MSAKlient( SSLSKlient *klient, MinigameServer *ls )
|
|
|
: Thread()
|
|
|
{
|
|
|
this->klient = klient;
|
|
@@ -329,13 +329,13 @@ void MSAKlient::thread()
|
|
|
{
|
|
|
klient->sende( "\1", 1 );
|
|
|
unsigned char nLen = 0;
|
|
|
- klient->getNachricht( (char *)& nLen, 1 );
|
|
|
+ klient->getNachricht( (char *)&nLen, 1 );
|
|
|
char *n = new char[ nLen + 1 ];
|
|
|
n[ (int)nLen ] = 0;
|
|
|
if( nLen )
|
|
|
klient->getNachricht( n, nLen );
|
|
|
unsigned char pLen = 0;
|
|
|
- klient->getNachricht( (char *)& pLen, 1 );
|
|
|
+ klient->getNachricht( (char *)&pLen, 1 );
|
|
|
char *p = new char[ pLen + 1 ];
|
|
|
p[ (int)pLen ] = 0;
|
|
|
if( pLen )
|
|
@@ -431,7 +431,7 @@ void MSAKlient::thread()
|
|
|
}
|
|
|
else
|
|
|
ok = 1;
|
|
|
- if( ok &&ms->hatClients() )
|
|
|
+ if( ok && ms->hatClients() )
|
|
|
{
|
|
|
errorZuKlient( "Es sind noch Klients Online. Bitte versuche es später erneut." );
|
|
|
break;
|
|
@@ -527,7 +527,7 @@ void MSAKlient::thread()
|
|
|
{
|
|
|
klient->sende( "\1", 1 );
|
|
|
int maxC = 0;
|
|
|
- klient->getNachricht( (char *)& maxC, 4 );
|
|
|
+ klient->getNachricht( (char *)&maxC, 4 );
|
|
|
if( ms->zDB()->adminHatRecht( adminId, Admin_Recht::MSMCChange ) )
|
|
|
{
|
|
|
if( ms->setMaxKlients( maxC ) )
|
|
@@ -549,8 +549,8 @@ void MSAKlient::thread()
|
|
|
{
|
|
|
klient->sende( "\1", 1 );
|
|
|
int klientId = 0;
|
|
|
- klient->getNachricht( (char *)& klientId, 4 );
|
|
|
- if( klientId &&ms->absturzKlient( klientId ) )
|
|
|
+ klient->getNachricht( (char *)&klientId, 4 );
|
|
|
+ if( klientId && ms->absturzKlient( klientId ) )
|
|
|
klient->sende( "\1", 1 );
|
|
|
else
|
|
|
klient->sende( "\0", 1 );
|
|
@@ -582,7 +582,7 @@ void MSAKlient::errorZuKlient( const char *nachricht ) const // sendet eine Fehl
|
|
|
|
|
|
// Inhalt der LSKlient aus LoginServer.h
|
|
|
// Konstruktor
|
|
|
-MSKlient::MSKlient( SKlient * klient, MinigameServer * ls )
|
|
|
+MSKlient::MSKlient( SKlient *klient, MinigameServer *ls )
|
|
|
: Thread()
|
|
|
{
|
|
|
this->klient = klient;
|
|
@@ -621,7 +621,7 @@ void MSKlient::thread()
|
|
|
switch( c )
|
|
|
{
|
|
|
case 1: // Klient identifikation
|
|
|
- klient->getNachrichtEncrypted( (char *)& klientNummer, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char *)&klientNummer, 4 );
|
|
|
if( !ms->zDB()->proveKlient( klientNummer, ms->getId() ) )
|
|
|
{
|
|
|
klientNummer = 0;
|
|
@@ -652,8 +652,8 @@ void MSKlient::thread()
|
|
|
if( 1 )
|
|
|
{
|
|
|
int klientId = 0;
|
|
|
- klient->getNachrichtEncrypted( (char *)& klientId, 4 );
|
|
|
- if( klientId &&ms->absturzKlient( klientId ) )
|
|
|
+ klient->getNachrichtEncrypted( (char *)&klientId, 4 );
|
|
|
+ if( klientId && ms->absturzKlient( klientId ) )
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
else
|
|
|
klient->sendeEncrypted( "\0", 1 );
|
|
@@ -690,18 +690,18 @@ void MSKlient::thread()
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
unsigned char l = 0;
|
|
|
- klient->getNachrichtEncrypted( (char *)& l, 1 );
|
|
|
+ klient->getNachrichtEncrypted( (char *)&l, 1 );
|
|
|
char *mName = new char[ l ];
|
|
|
mName[ (int)l ] = 0;
|
|
|
klient->getNachrichtEncrypted( mName, l );
|
|
|
RCArray< Text > oList;
|
|
|
int anz = ms->zDB()->getMinigameOptionList( mName, &oList );
|
|
|
delete[] mName;
|
|
|
- klient->sendeEncrypted( (char *)& anz, 4 );
|
|
|
+ klient->sendeEncrypted( (char *)&anz, 4 );
|
|
|
for( auto t = oList.getIterator(); t && t._; t++ )
|
|
|
{
|
|
|
l = (char)t->getLength();
|
|
|
- klient->sendeEncrypted( (char *)& l, 1 );
|
|
|
+ klient->sendeEncrypted( (char *)&l, 1 );
|
|
|
klient->sendeEncrypted( t->getText(), l );
|
|
|
}
|
|
|
break;
|
|
@@ -710,7 +710,7 @@ void MSKlient::thread()
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
unsigned char l = 0;
|
|
|
- klient->getNachrichtEncrypted( (char *)& l, 1 );
|
|
|
+ klient->getNachrichtEncrypted( (char *)&l, 1 );
|
|
|
char *mName = new char[ l ];
|
|
|
mName[ (int)l ] = 0;
|
|
|
klient->getNachrichtEncrypted( mName, l );
|
|
@@ -719,16 +719,16 @@ void MSKlient::thread()
|
|
|
RCArray< Text > oList;
|
|
|
int anz = ms->zDB()->getMinigameBestscore( mName, &sList, &pList, &oList );
|
|
|
delete[] mName;
|
|
|
- klient->sendeEncrypted( (char *)& anz, 4 );
|
|
|
+ klient->sendeEncrypted( (char *)&anz, 4 );
|
|
|
for( int i = 0; i < anz; i++ )
|
|
|
{
|
|
|
int s = sList.get( i );
|
|
|
- klient->sendeEncrypted( (char *)& s, 4 );
|
|
|
+ klient->sendeEncrypted( (char *)&s, 4 );
|
|
|
l = (char)pList.z( i )->getLength();
|
|
|
- klient->sendeEncrypted( (char *)& l, 1 );
|
|
|
+ klient->sendeEncrypted( (char *)&l, 1 );
|
|
|
klient->sendeEncrypted( pList.z( i )->getText(), l );
|
|
|
l = (char)oList.z( i )->getLength();
|
|
|
- klient->sendeEncrypted( (char *)& l, 1 );
|
|
|
+ klient->sendeEncrypted( (char *)&l, 1 );
|
|
|
klient->sendeEncrypted( oList.z( i )->getText(), l );
|
|
|
}
|
|
|
break;
|
|
@@ -737,11 +737,11 @@ void MSKlient::thread()
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
unsigned char l = 0;
|
|
|
- klient->getNachrichtEncrypted( (char *)& l, 1 );
|
|
|
+ klient->getNachrichtEncrypted( (char *)&l, 1 );
|
|
|
char *mName = new char[ l ];
|
|
|
mName[ (int)l ] = 0;
|
|
|
klient->getNachrichtEncrypted( mName, l );
|
|
|
- klient->getNachrichtEncrypted( (char *)& l, 1 );
|
|
|
+ klient->getNachrichtEncrypted( (char *)&l, 1 );
|
|
|
char *oName = new char[ l ];
|
|
|
oName[ (int)l ] = 0;
|
|
|
klient->getNachrichtEncrypted( oName, l );
|
|
@@ -749,11 +749,11 @@ void MSKlient::thread()
|
|
|
int score = ms->zDB()->getMinigameBestscore( oName, mName, &player );
|
|
|
delete[] mName;
|
|
|
delete[] oName;
|
|
|
- klient->sendeEncrypted( (char *)& score, 4 );
|
|
|
+ klient->sendeEncrypted( (char *)&score, 4 );
|
|
|
if( score )
|
|
|
{
|
|
|
l = (char)player.getLength();
|
|
|
- klient->sendeEncrypted( (char *)& l, 1 );
|
|
|
+ klient->sendeEncrypted( (char *)&l, 1 );
|
|
|
klient->sendeEncrypted( player.getText(), l );
|
|
|
}
|
|
|
break;
|
|
@@ -767,16 +767,16 @@ void MSKlient::thread()
|
|
|
}
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
unsigned char l = 0;
|
|
|
- klient->getNachrichtEncrypted( (char *)& l, 1 );
|
|
|
+ klient->getNachrichtEncrypted( (char *)&l, 1 );
|
|
|
char *mName = new char[ l ];
|
|
|
mName[ (int)l ] = 0;
|
|
|
klient->getNachrichtEncrypted( mName, l );
|
|
|
- klient->getNachrichtEncrypted( (char *)& l, 1 );
|
|
|
+ klient->getNachrichtEncrypted( (char *)&l, 1 );
|
|
|
char *oName = new char[ l ];
|
|
|
oName[ (int)l ] = 0;
|
|
|
klient->getNachrichtEncrypted( oName, l );
|
|
|
int score;
|
|
|
- klient->getNachrichtEncrypted( (char *)& score, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char *)&score, 4 );
|
|
|
Text fName;
|
|
|
if( ms->zDB()->updateMinigameScore( score, oName, klientNummer, mName, ms->getId(), &fName ) )
|
|
|
{
|
|
@@ -792,7 +792,7 @@ void MSKlient::thread()
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
int size;
|
|
|
- klient->getNachrichtEncrypted( (char *)& size, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char *)&size, 4 );
|
|
|
char *buffer = new char[ 2048 ];
|
|
|
while( size > 0 )
|
|
|
{
|
|
@@ -818,11 +818,11 @@ void MSKlient::thread()
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
unsigned char l = 0;
|
|
|
- klient->getNachrichtEncrypted( (char *)& l, 1 );
|
|
|
+ klient->getNachrichtEncrypted( (char *)&l, 1 );
|
|
|
char *mName = new char[ l ];
|
|
|
mName[ (int)l ] = 0;
|
|
|
klient->getNachrichtEncrypted( mName, l );
|
|
|
- klient->getNachrichtEncrypted( (char *)& l, 1 );
|
|
|
+ klient->getNachrichtEncrypted( (char *)&l, 1 );
|
|
|
char *oName = new char[ l ];
|
|
|
oName[ (int)l ] = 0;
|
|
|
klient->getNachrichtEncrypted( oName, l );
|
|
@@ -842,7 +842,7 @@ void MSKlient::thread()
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
int size = (int)d.getSize();
|
|
|
- klient->sendeEncrypted( (char *)& size, 4 );
|
|
|
+ klient->sendeEncrypted( (char *)&size, 4 );
|
|
|
char *buffer = new char[ 2048 ];
|
|
|
while( size > 0 )
|
|
|
{
|
|
@@ -875,18 +875,18 @@ void MSKlient::thread()
|
|
|
if( ret == 1 )
|
|
|
{
|
|
|
l = (char)textLength( mName );
|
|
|
- k->sendeEncrypted( (char *)& l, 1 );
|
|
|
+ k->sendeEncrypted( (char *)&l, 1 );
|
|
|
k->sendeEncrypted( mName, l );
|
|
|
l = (char)textLength( oName );
|
|
|
- k->sendeEncrypted( (char *)& l, 1 );
|
|
|
+ k->sendeEncrypted( (char *)&l, 1 );
|
|
|
k->sendeEncrypted( oName, l );
|
|
|
k->getNachrichtEncrypted( &ret, 1 );
|
|
|
if( ret == 1 )
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
int size;
|
|
|
- k->getNachrichtEncrypted( (char *)& size, 4 );
|
|
|
- klient->sendeEncrypted( (char *)& size, 4 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&size, 4 );
|
|
|
+ klient->sendeEncrypted( (char *)&size, 4 );
|
|
|
char *buffer = new char[ 2048 ];
|
|
|
while( size > 0 )
|
|
|
{
|
|
@@ -900,7 +900,7 @@ void MSKlient::thread()
|
|
|
}
|
|
|
if( ret == 3 )
|
|
|
{
|
|
|
- k->getNachrichtEncrypted( (char *)& l, 1 );
|
|
|
+ k->getNachrichtEncrypted( (char *)&l, 1 );
|
|
|
char *error = new char[ l + 1 ];
|
|
|
error[ (int)l ] = 0;
|
|
|
k->getNachrichtEncrypted( error, l );
|
|
@@ -935,7 +935,7 @@ void MSKlient::thread()
|
|
|
}
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
int acc = ms->zDB()->getAccountId( klientNummer );
|
|
|
- klient->sendeEncrypted( (char *)& acc, 4 );
|
|
|
+ klient->sendeEncrypted( (char *)&acc, 4 );
|
|
|
break;
|
|
|
}
|
|
|
case 0xC:
|
|
@@ -947,7 +947,7 @@ void MSKlient::thread()
|
|
|
}
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
int acc;
|
|
|
- klient->getNachrichtEncrypted( (char *)& acc, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char *)&acc, 4 );
|
|
|
Text *name = ms->zDB()->getAccountName( acc );
|
|
|
if( !name )
|
|
|
errorZuKlient( "Der Acount existiert nicht." );
|