|
@@ -33,7 +33,6 @@ EditorServer::EditorServer( InitDatei *zIni )
|
|
|
end = 0;
|
|
|
nichtPausiert = 0;
|
|
|
InitializeCriticalSection( &cs );
|
|
|
- ref = 1;
|
|
|
if( zIni->zWert( "Aktiv" )->istGleich( "TRUE" ) )
|
|
|
{
|
|
|
serverStarten();
|
|
@@ -72,7 +71,7 @@ void EditorServer::runn()
|
|
|
}
|
|
|
if( !klient )
|
|
|
continue;
|
|
|
- EdSAKlient *clHandle = new EdSAKlient( klient, getThis() );
|
|
|
+ EdSAKlient * clHandle = new EdSAKlient( klient, (EditorServer *)getThis() );
|
|
|
clHandle->start();
|
|
|
}
|
|
|
}
|
|
@@ -85,8 +84,8 @@ void EditorServer::thread()
|
|
|
klient = server->getKlient();
|
|
|
if( !klient )
|
|
|
continue;
|
|
|
- Framework::getThreadRegister()->cleanUpClosedThreads();
|
|
|
- EdSKlient *clHandle = new EdSKlient( klient, getThis() );
|
|
|
+ Framework::getThreadRegister()->cleanUpClosedThreads();
|
|
|
+ EdSKlient * clHandle = new EdSKlient( klient, (EditorServer *)getThis() );
|
|
|
EnterCriticalSection( &cs );
|
|
|
klients->set( clHandle, klientAnzahl );
|
|
|
klientAnzahl++;
|
|
@@ -111,7 +110,7 @@ void EditorServer::close()
|
|
|
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();
|
|
@@ -224,7 +223,7 @@ bool EditorServer::absturzKlient( int klientId )
|
|
|
return gefunden;
|
|
|
}
|
|
|
|
|
|
-bool EditorServer::removeKlient( EdSKlient *zKlient )
|
|
|
+bool EditorServer::removeKlient( EdSKlient * zKlient )
|
|
|
{
|
|
|
bool gefunden = 0;
|
|
|
EnterCriticalSection( &cs );
|
|
@@ -288,25 +287,10 @@ char *EditorServer::getLetzterFehler() const
|
|
|
return fehler->getText();
|
|
|
}
|
|
|
|
|
|
-// Reference Counting
|
|
|
-EditorServer *EditorServer::getThis()
|
|
|
-{
|
|
|
- ref++;
|
|
|
- return this;
|
|
|
-}
|
|
|
-
|
|
|
-EditorServer *EditorServer::release()
|
|
|
-{
|
|
|
- ref--;
|
|
|
- if( !ref )
|
|
|
- delete this;
|
|
|
- return 0;
|
|
|
-}
|
|
|
-
|
|
|
|
|
|
// Inhalt der EdSAKlient Klasse aus EditorServer.h
|
|
|
// Konstruktor
|
|
|
-EdSAKlient::EdSAKlient( SSLSKlient *klient, EditorServer *eds )
|
|
|
+EdSAKlient::EdSAKlient( SSLSKlient * klient, EditorServer * eds )
|
|
|
: Thread()
|
|
|
{
|
|
|
this->klient = klient;
|
|
@@ -344,13 +328,13 @@ void EdSAKlient::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 )
|
|
@@ -446,7 +430,7 @@ void EdSAKlient::thread()
|
|
|
}
|
|
|
else
|
|
|
ok = 1;
|
|
|
- if( ok && eds->hatClients() )
|
|
|
+ if( ok &&eds->hatClients() )
|
|
|
{
|
|
|
errorZuKlient( "Es sind noch Klients Online. Bitte versuche es später erneut." );
|
|
|
break;
|
|
@@ -542,7 +526,7 @@ void EdSAKlient::thread()
|
|
|
{
|
|
|
klient->sende( "\1", 1 );
|
|
|
int maxK = 0;
|
|
|
- klient->getNachricht( (char*)&maxK, 4 );
|
|
|
+ klient->getNachricht( (char *)& maxK, 4 );
|
|
|
if( eds->zDB()->adminHatRecht( adminId, Admin_Recht::EdSMKChange ) )
|
|
|
{
|
|
|
if( eds->setMaxKarten( maxK ) )
|
|
@@ -564,8 +548,8 @@ void EdSAKlient::thread()
|
|
|
{
|
|
|
klient->sende( "\1", 1 );
|
|
|
int klientId = 0;
|
|
|
- klient->getNachricht( (char*)&klientId, 4 );
|
|
|
- if( klientId && eds->absturzKlient( klientId ) )
|
|
|
+ klient->getNachricht( (char *)& klientId, 4 );
|
|
|
+ if( klientId &&eds->absturzKlient( klientId ) )
|
|
|
klient->sende( "\1", 1 );
|
|
|
else
|
|
|
klient->sende( "\0", 1 );
|
|
@@ -597,13 +581,13 @@ void EdSAKlient::errorZuKlient( const char *nachricht ) const // sendet eine Feh
|
|
|
|
|
|
// Inhalt der EdSKlient aus EditorServer.h
|
|
|
// Konstruktor
|
|
|
-EdSKlient::EdSKlient( SKlient *klient, EditorServer *eds )
|
|
|
+EdSKlient::EdSKlient( SKlient * klient, EditorServer * eds )
|
|
|
: Thread()
|
|
|
{
|
|
|
this->klient = klient;
|
|
|
unsigned char key[ 20 ] = { 55, 124, 19, 204, 23, 5, 59, 75, 247, 138, 119, 111, 57, 250, 206, 187, 165, 6, 247, 151 };
|
|
|
- klient->setSendeKey( (char*)key, 20 );
|
|
|
- klient->setEmpfangKey( (char*)key, 20 );
|
|
|
+ klient->setSendeKey( (char *)key, 20 );
|
|
|
+ klient->setEmpfangKey( (char *)key, 20 );
|
|
|
klientNummer = 0;
|
|
|
this->eds = eds;
|
|
|
ked = 0;
|
|
@@ -640,7 +624,7 @@ void EdSKlient::thread()
|
|
|
switch( c )
|
|
|
{
|
|
|
case 1: // Klient identifikation
|
|
|
- klient->getNachrichtEncrypted( (char*)&klientNummer, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char *)& klientNummer, 4 );
|
|
|
if( !eds->zDB()->proveKlient( klientNummer, eds->getId() ) )
|
|
|
{
|
|
|
klientNummer = 0;
|
|
@@ -671,8 +655,8 @@ void EdSKlient::thread()
|
|
|
if( 1 )
|
|
|
{
|
|
|
int klientId = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&klientId, 4 );
|
|
|
- if( klientId && eds->absturzKlient( klientId ) )
|
|
|
+ klient->getNachrichtEncrypted( (char *)& klientId, 4 );
|
|
|
+ if( klientId &&eds->absturzKlient( klientId ) )
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
else
|
|
|
klient->sendeEncrypted( "\0", 1 );
|
|
@@ -715,7 +699,7 @@ void EdSKlient::thread()
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
int karteId = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&karteId, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char *)& karteId, 4 );
|
|
|
if( eds->zDB()->proveKarte( karteId, klientNummer, eds->getId() ) )
|
|
|
{
|
|
|
if( ked )
|
|
@@ -762,7 +746,7 @@ void EdSKlient::thread()
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
int id = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&id, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char *)& id, 4 );
|
|
|
if( ked )
|
|
|
ked->release();
|
|
|
ked = new KarteEditor( id, eds->zDB()->getThis(), eds->zIni()->zWert( "KartenPfad" )->getText(), eds->zIni() );
|
|
@@ -774,8 +758,8 @@ void EdSKlient::thread()
|
|
|
}
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
RCArray< Text > *list = new RCArray< Text >();
|
|
|
- int anz = ked->getDateiUpdateListe( ( char* )"shop", list );
|
|
|
- klient->sendeEncrypted( (char*)&anz, 4 );
|
|
|
+ int anz = ked->getDateiUpdateListe( ( char * )"shop", list );
|
|
|
+ klient->sendeEncrypted( (char *)& anz, 4 );
|
|
|
for( int i = 0; i < anz; i++ )
|
|
|
{
|
|
|
Text p = list->z( i )->getText();
|
|
@@ -784,11 +768,11 @@ void EdSKlient::thread()
|
|
|
klient->sendeEncrypted( p, l );
|
|
|
Text tmp = ked->getPfad();
|
|
|
tmp += "/live/shop";
|
|
|
- p.insert( 0, (char*)tmp );
|
|
|
+ p.insert( 0, (char *)tmp );
|
|
|
Datei d;
|
|
|
d.setDatei( p );
|
|
|
__int64 size = d.getSize();
|
|
|
- klient->sendeEncrypted( (char*)&size, 8 );
|
|
|
+ klient->sendeEncrypted( (char *)& size, 8 );
|
|
|
d.open( Datei::Style::lesen );
|
|
|
char *buffer = new char[ 2048 ];
|
|
|
while( size )
|
|
@@ -816,7 +800,7 @@ void EdSKlient::thread()
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
int id = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&id, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char *)& id, 4 );
|
|
|
if( ked )
|
|
|
ked->release();
|
|
|
ked = new KarteEditor( id, eds->zDB()->getThis(), eds->zIni()->zWert( "KartenPfad" )->getText(), eds->zIni() );
|
|
@@ -828,8 +812,8 @@ void EdSKlient::thread()
|
|
|
}
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
RCArray< Text > *list = new RCArray< Text >();
|
|
|
- int anz = ked->getDateiUpdateListe( ( char* )"map", list );
|
|
|
- klient->sendeEncrypted( (char*)&anz, 4 );
|
|
|
+ int anz = ked->getDateiUpdateListe( ( char * )"map", list );
|
|
|
+ klient->sendeEncrypted( (char *)& anz, 4 );
|
|
|
for( int i = 0; i < anz; i++ )
|
|
|
{
|
|
|
Text p = list->z( i )->getText();
|
|
@@ -838,11 +822,11 @@ void EdSKlient::thread()
|
|
|
klient->sendeEncrypted( p, l );
|
|
|
Text tmp = ked->getPfad();
|
|
|
tmp += "/live/map";
|
|
|
- p.insert( 0, (char*)tmp );
|
|
|
+ p.insert( 0, (char *)tmp );
|
|
|
Datei d;
|
|
|
d.setDatei( p );
|
|
|
__int64 size = d.getSize();
|
|
|
- klient->sendeEncrypted( (char*)&size, 8 );
|
|
|
+ klient->sendeEncrypted( (char *)& size, 8 );
|
|
|
d.open( Datei::Style::lesen );
|
|
|
char *buffer = new char[ 2048 ];
|
|
|
while( size )
|
|
@@ -871,12 +855,12 @@ void EdSKlient::thread()
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
unsigned char l = 0;
|
|
|
- klient->getNachrichtEncrypted((char*)&l, 1 );
|
|
|
+ klient->getNachrichtEncrypted( (char *)& l, 1 );
|
|
|
char *n = new char[ l + 1 ];
|
|
|
n[ (int)l ] = 0;
|
|
|
klient->getNachrichtEncrypted( n, l );
|
|
|
int spielArt = 0;
|
|
|
- klient->getNachrichtEncrypted( (char*)&spielArt, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char *)& spielArt, 4 );
|
|
|
if( eds->zDB()->karteErstellen( n, spielArt, klientNummer ) )
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
else
|
|
@@ -905,26 +889,11 @@ void EdSKlient::errorZuKlient( const char *nachricht ) const // sendet eine Fehl
|
|
|
{
|
|
|
klient->sendeEncrypted( "\3", 1 );
|
|
|
unsigned char len = (unsigned char)textLength( nachricht );
|
|
|
- klient->sendeEncrypted( (char*)&len, 1 );
|
|
|
+ klient->sendeEncrypted( (char *)& len, 1 );
|
|
|
klient->sendeEncrypted( nachricht, len );
|
|
|
}
|
|
|
|
|
|
int EdSKlient::getKlientNummer() const // gibt die KlientId zurück
|
|
|
{
|
|
|
return klientNummer;
|
|
|
-}
|
|
|
-
|
|
|
-// Reference Counting
|
|
|
-EdSKlient *EdSKlient::getThis()
|
|
|
-{
|
|
|
- ref++;
|
|
|
- return this;
|
|
|
-}
|
|
|
-
|
|
|
-EdSKlient *EdSKlient::release()
|
|
|
-{
|
|
|
- ref--;
|
|
|
- if( !ref )
|
|
|
- delete this;
|
|
|
- return 0;
|
|
|
}
|