|
@@ -5,18 +5,17 @@
|
|
|
|
|
|
// Inhalt der ShopServer Klasse aus ShopServer.h
|
|
|
// Konstruktor
|
|
|
-ShopServer::ShopServer( InitDatei *zIni )
|
|
|
+ShopServer::ShopServer( InitDatei* zIni )
|
|
|
: Thread()
|
|
|
{
|
|
|
Network::Start( 100 );
|
|
|
std::cout << "ShS: Verbindung mit Datenbank wird hergestellt...\n";
|
|
|
db = new ShSDatenbank( zIni );
|
|
|
- klientAnzahl = 0;
|
|
|
klients = new RCArray< ShSKlient >();
|
|
|
empfangen = 0;
|
|
|
gesendet = 0;
|
|
|
fehler = new Text();
|
|
|
- ini = dynamic_cast<InitDatei *>( zIni->getThis() );
|
|
|
+ ini = dynamic_cast<InitDatei*>(zIni->getThis());
|
|
|
id = *zIni->zWert( "ServerId" );
|
|
|
server = new Server();
|
|
|
aServer = new SSLServer();
|
|
@@ -38,7 +37,7 @@ ShopServer::ShopServer( InitDatei *zIni )
|
|
|
serverStarten();
|
|
|
serverFortsetzen();
|
|
|
}
|
|
|
- updater = new Updater( dynamic_cast<ShopServer *>( getThis() ) );
|
|
|
+ updater = new Updater( dynamic_cast<ShopServer*>(getThis()) );
|
|
|
}
|
|
|
|
|
|
// Destruktor
|
|
@@ -62,18 +61,18 @@ void ShopServer::runn()
|
|
|
{
|
|
|
while( !end && aServer->isConnected() )
|
|
|
{
|
|
|
- SSLSKlient *klient;
|
|
|
+ SSLSKlient* klient;
|
|
|
klient = aServer->getKlient();
|
|
|
if( end && klient )
|
|
|
{
|
|
|
klient->trenne();
|
|
|
- klient = (SSLSKlient *)klient->release();
|
|
|
+ klient = (SSLSKlient*)klient->release();
|
|
|
Sleep( 1000 );
|
|
|
return;
|
|
|
}
|
|
|
if( !klient )
|
|
|
continue;
|
|
|
- ShSAKlient *clHandle = new ShSAKlient( klient, dynamic_cast<ShopServer *>( getThis() ) );
|
|
|
+ ShSAKlient* clHandle = new ShSAKlient( klient, dynamic_cast<ShopServer*>(getThis()) );
|
|
|
clHandle->start();
|
|
|
}
|
|
|
}
|
|
@@ -82,15 +81,14 @@ void ShopServer::thread()
|
|
|
{
|
|
|
while( server->isConnected() )
|
|
|
{
|
|
|
- SKlient *klient;
|
|
|
+ SKlient* klient;
|
|
|
klient = server->getKlient();
|
|
|
if( !klient )
|
|
|
continue;
|
|
|
Framework::getThreadRegister()->cleanUpClosedThreads();
|
|
|
- ShSKlient *clHandle = new ShSKlient( klient, dynamic_cast<ShopServer *>( getThis() ) );
|
|
|
+ ShSKlient* clHandle = new ShSKlient( klient, dynamic_cast<ShopServer*>(getThis()) );
|
|
|
EnterCriticalSection( &cs );
|
|
|
- klients->set( clHandle, klientAnzahl );
|
|
|
- klientAnzahl++;
|
|
|
+ klients->add( clHandle );
|
|
|
LeaveCriticalSection( &cs );
|
|
|
clHandle->start();
|
|
|
}
|
|
@@ -104,15 +102,14 @@ void ShopServer::close()
|
|
|
warteAufThread( 1000 );
|
|
|
#endif
|
|
|
EnterCriticalSection( &cs );
|
|
|
- for( int i = 0; i < klientAnzahl; i++ )
|
|
|
+ for( int i = 0; i < klients->getEintragAnzahl(); i++ )
|
|
|
klients->z( i )->absturz();
|
|
|
- klients = ( RCArray<ShSKlient>* ) klients->release();
|
|
|
- klientAnzahl = 0;
|
|
|
+ klients = (RCArray<ShSKlient>*) klients->release();
|
|
|
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();
|
|
@@ -210,13 +207,12 @@ bool ShopServer::absturzKlient( int klientId )
|
|
|
{
|
|
|
bool gefunden = 0;
|
|
|
EnterCriticalSection( &cs );
|
|
|
- for( int i = 0; i < klientAnzahl; i++ )
|
|
|
+ for( int i = 0; i < klients->getEintragAnzahl(); i++ )
|
|
|
{
|
|
|
if( klients->z( i )->getKlientNummer() == klientId )
|
|
|
{
|
|
|
klients->z( i )->absturz();
|
|
|
klients->remove( i );
|
|
|
- klientAnzahl--;
|
|
|
gefunden = 1;
|
|
|
break;
|
|
|
}
|
|
@@ -225,16 +221,15 @@ bool ShopServer::absturzKlient( int klientId )
|
|
|
return gefunden;
|
|
|
}
|
|
|
|
|
|
-bool ShopServer::removeKlient( ShSKlient *zKlient )
|
|
|
+bool ShopServer::removeKlient( ShSKlient* zKlient )
|
|
|
{
|
|
|
bool gefunden = 0;
|
|
|
EnterCriticalSection( &cs );
|
|
|
- for( int i = 0; i < klientAnzahl; i++ )
|
|
|
+ for( int i = 0; i < klients->getEintragAnzahl(); i++ )
|
|
|
{
|
|
|
if( klients->z( i ) == zKlient )
|
|
|
{
|
|
|
klients->remove( i );
|
|
|
- klientAnzahl--;
|
|
|
gefunden = 1;
|
|
|
break;
|
|
|
}
|
|
@@ -259,22 +254,22 @@ bool ShopServer::istAn() const
|
|
|
return db->serverIstNichtPausiert( id );
|
|
|
}
|
|
|
|
|
|
-Server *ShopServer::zServer() const
|
|
|
+Server* ShopServer::zServer() const
|
|
|
{
|
|
|
return server;
|
|
|
}
|
|
|
|
|
|
-ShSDatenbank *ShopServer::zDB() const
|
|
|
+ShSDatenbank* ShopServer::zDB() const
|
|
|
{
|
|
|
return db;
|
|
|
}
|
|
|
|
|
|
bool ShopServer::hatClients() const
|
|
|
{
|
|
|
- return klientAnzahl > 0;
|
|
|
+ return klients->hat( 0 );
|
|
|
}
|
|
|
|
|
|
-InitDatei *ShopServer::zInit() const
|
|
|
+InitDatei* ShopServer::zInit() const
|
|
|
{
|
|
|
return ini;
|
|
|
}
|
|
@@ -284,7 +279,7 @@ int ShopServer::getId() const
|
|
|
return id;
|
|
|
}
|
|
|
|
|
|
-char *ShopServer::getLetzterFehler() const
|
|
|
+char* ShopServer::getLetzterFehler() const
|
|
|
{
|
|
|
return fehler->getText();
|
|
|
}
|
|
@@ -292,7 +287,7 @@ char *ShopServer::getLetzterFehler() const
|
|
|
|
|
|
// Inhalt der ShSAKlient Klasse aus ShopServer.h
|
|
|
// Konstruktor
|
|
|
-ShSAKlient::ShSAKlient( SSLSKlient *klient, ShopServer *shs )
|
|
|
+ShSAKlient::ShSAKlient( SSLSKlient* klient, ShopServer* shs )
|
|
|
: Thread()
|
|
|
{
|
|
|
this->klient = klient;
|
|
@@ -330,14 +325,14 @@ void ShSAKlient::thread()
|
|
|
{
|
|
|
klient->sende( "\1", 1 );
|
|
|
unsigned char nLen = 0;
|
|
|
- klient->getNachricht( (char *)&nLen, 1 );
|
|
|
- char *n = new 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 );
|
|
|
- char *p = new char[ pLen + 1 ];
|
|
|
+ klient->getNachricht( (char*)&pLen, 1 );
|
|
|
+ char* p = new char[ pLen + 1 ];
|
|
|
p[ (int)pLen ] = 0;
|
|
|
if( pLen )
|
|
|
klient->getNachricht( p, pLen );
|
|
@@ -374,7 +369,7 @@ void ShSAKlient::thread()
|
|
|
{
|
|
|
if( !shs->serverStarten() )
|
|
|
{
|
|
|
- Text *err = new Text();
|
|
|
+ Text* err = new Text();
|
|
|
err->append( shs->getLetzterFehler() );
|
|
|
errorZuKlient( err->getText() );
|
|
|
err->release();
|
|
@@ -397,7 +392,7 @@ void ShSAKlient::thread()
|
|
|
klient->sende( "\1", 1 );
|
|
|
else
|
|
|
{
|
|
|
- Text *err = new Text();
|
|
|
+ Text* err = new Text();
|
|
|
err->append( shs->getLetzterFehler() );
|
|
|
errorZuKlient( err->getText() );
|
|
|
err->release();
|
|
@@ -421,7 +416,7 @@ void ShSAKlient::thread()
|
|
|
ok = 1;
|
|
|
else
|
|
|
{
|
|
|
- Text *err = new Text();
|
|
|
+ Text* err = new Text();
|
|
|
err->append( shs->getLetzterFehler() );
|
|
|
errorZuKlient( err->getText() );
|
|
|
err->release();
|
|
@@ -506,7 +501,7 @@ void ShSAKlient::thread()
|
|
|
klient->sende( "\1", 1 );
|
|
|
else
|
|
|
{
|
|
|
- Text *err = new Text();
|
|
|
+ Text* err = new Text();
|
|
|
err->append( shs->getLetzterFehler() );
|
|
|
errorZuKlient( err->getText() );
|
|
|
err->release();
|
|
@@ -528,14 +523,14 @@ void ShSAKlient::thread()
|
|
|
{
|
|
|
klient->sende( "\1", 1 );
|
|
|
int maxK = 0;
|
|
|
- klient->getNachricht( (char *)&maxK, 4 );
|
|
|
+ klient->getNachricht( (char*)&maxK, 4 );
|
|
|
if( shs->zDB()->adminHatRecht( adminId, Admin_Recht::ShSMKChange ) )
|
|
|
{
|
|
|
if( shs->setMaxKarten( maxK ) )
|
|
|
klient->sende( "\1", 1 );
|
|
|
else
|
|
|
{
|
|
|
- Text *err = new Text();
|
|
|
+ Text* err = new Text();
|
|
|
err->append( shs->getLetzterFehler() );
|
|
|
errorZuKlient( err->getText() );
|
|
|
err->release();
|
|
@@ -550,7 +545,7 @@ void ShSAKlient::thread()
|
|
|
{
|
|
|
klient->sende( "\1", 1 );
|
|
|
int klientId = 0;
|
|
|
- klient->getNachricht( (char *)&klientId, 4 );
|
|
|
+ klient->getNachricht( (char*)&klientId, 4 );
|
|
|
if( klientId && shs->absturzKlient( klientId ) )
|
|
|
klient->sende( "\1", 1 );
|
|
|
else
|
|
@@ -572,7 +567,7 @@ void ShSAKlient::thread()
|
|
|
delete this;
|
|
|
}
|
|
|
|
|
|
-void ShSAKlient::errorZuKlient( const char *nachricht ) const // sendet eine Fehlernachricht zum Klient
|
|
|
+void ShSAKlient::errorZuKlient( const char* nachricht ) const // sendet eine Fehlernachricht zum Klient
|
|
|
{
|
|
|
klient->sende( "\3", 1 );
|
|
|
char len = (char)textLength( nachricht );
|
|
@@ -583,13 +578,13 @@ void ShSAKlient::errorZuKlient( const char *nachricht ) const // sendet eine Feh
|
|
|
|
|
|
// Inhalt der ShSKlient aus ShopServer.h
|
|
|
// Konstruktor
|
|
|
-ShSKlient::ShSKlient( SKlient *klient, ShopServer *shs )
|
|
|
+ShSKlient::ShSKlient( SKlient* klient, ShopServer* shs )
|
|
|
: Thread()
|
|
|
{
|
|
|
this->klient = klient;
|
|
|
unsigned char key[ 20 ] = { 218, 226, 231, 216, 68, 63, 132, 155, 49, 235, 239, 0, 19, 23, 116, 244, 235, 21, 189, 53 };
|
|
|
- klient->setSendeKey( (char *)key, 20 );
|
|
|
- klient->setEmpfangKey( (char *)key, 20 );
|
|
|
+ klient->setSendeKey( (char*)key, 20 );
|
|
|
+ klient->setEmpfangKey( (char*)key, 20 );
|
|
|
klientNummer = 0;
|
|
|
this->shs = shs;
|
|
|
}
|
|
@@ -622,7 +617,7 @@ void ShSKlient::thread()
|
|
|
switch( c )
|
|
|
{
|
|
|
case 1: // Klient identifikation
|
|
|
- klient->getNachrichtEncrypted( (char *)&klientNummer, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char*)&klientNummer, 4 );
|
|
|
if( !shs->zDB()->proveKlient( klientNummer, shs->getId() ) )
|
|
|
{
|
|
|
klientNummer = 0;
|
|
@@ -630,7 +625,7 @@ void ShSKlient::thread()
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- Text *key = shs->zDB()->getKlientKey( klientNummer );
|
|
|
+ Text* key = shs->zDB()->getKlientKey( klientNummer );
|
|
|
if( !key )
|
|
|
errorZuKlient( "Es konnte kein Key ermittelt werden." );
|
|
|
else
|
|
@@ -653,7 +648,7 @@ void ShSKlient::thread()
|
|
|
if( 1 )
|
|
|
{
|
|
|
int klientId = 0;
|
|
|
- klient->getNachrichtEncrypted( (char *)&klientId, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char*)&klientId, 4 );
|
|
|
if( klientId && shs->absturzKlient( klientId ) )
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
else
|
|
@@ -684,23 +679,23 @@ void ShSKlient::thread()
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
unsigned char len = 0;
|
|
|
- klient->getNachrichtEncrypted( (char *)&len, 1 );
|
|
|
- char *suche = new char[ len + 1 ];
|
|
|
+ klient->getNachrichtEncrypted( (char*)&len, 1 );
|
|
|
+ char* suche = new char[ len + 1 ];
|
|
|
suche[ (int)len ] = 0;
|
|
|
if( len )
|
|
|
klient->getNachrichtEncrypted( suche, len );
|
|
|
- Array< int > *list = new Array< int >();
|
|
|
+ Array< int >* list = new Array< int >();
|
|
|
if( shs->zDB()->getSpielArtListe( klientNummer, suche, list ) )
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
int anz = list->getEintragAnzahl();
|
|
|
- klient->sendeEncrypted( (char *)&anz, 4 );
|
|
|
+ klient->sendeEncrypted( (char*)&anz, 4 );
|
|
|
if( anz )
|
|
|
{
|
|
|
for( int i = 0; i < anz; i++ )
|
|
|
{
|
|
|
int w = list->get( i );
|
|
|
- klient->sendeEncrypted( (char *)&w, 4 );
|
|
|
+ klient->sendeEncrypted( (char*)&w, 4 );
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -717,7 +712,7 @@ void ShSKlient::thread()
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
int spielId = 0;
|
|
|
- klient->getNachrichtEncrypted( (char *)&spielId, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char*)&spielId, 4 );
|
|
|
if( !shs->zDB()->proveSpiel( shs->getId(), spielId ) )
|
|
|
{
|
|
|
Text ip = "";
|
|
@@ -727,7 +722,7 @@ void ShSKlient::thread()
|
|
|
else
|
|
|
{
|
|
|
klient->sendeEncrypted( "\2", 1 );
|
|
|
- klient->sendeEncrypted( (char *)&port, 4 );
|
|
|
+ klient->sendeEncrypted( (char*)&port, 4 );
|
|
|
char len = (char)ip.getLength();
|
|
|
klient->sendeEncrypted( &len, 1 );
|
|
|
klient->sendeEncrypted( ip.getText(), len );
|
|
@@ -735,7 +730,7 @@ void ShSKlient::thread()
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- Text *pfad = new Text( shs->zInit()->zWert( "ShopSeitenPfad" )->getText() );
|
|
|
+ Text* pfad = new Text( shs->zInit()->zWert( "ShopSeitenPfad" )->getText() );
|
|
|
pfad->append( "/spiele/" );
|
|
|
pfad->append( spielId );
|
|
|
pfad->append( "/titelbg.ltdb" );
|
|
@@ -746,12 +741,12 @@ void ShSKlient::thread()
|
|
|
break;
|
|
|
}
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
- Datei *dat = new Datei();
|
|
|
+ Datei* dat = new Datei();
|
|
|
dat->setDatei( pfad );
|
|
|
dat->open( Datei::Style::lesen );
|
|
|
__int64 gr = dat->getSize();
|
|
|
- klient->sendeEncrypted( (char *)&gr, 8 );
|
|
|
- char *bytes = new char[ 2048 ];
|
|
|
+ klient->sendeEncrypted( (char*)&gr, 8 );
|
|
|
+ char* bytes = new char[ 2048 ];
|
|
|
while( gr > 0 )
|
|
|
{
|
|
|
int len = gr > 2048 ? 2048 : (int)gr;
|
|
@@ -771,7 +766,7 @@ void ShSKlient::thread()
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
int spielId = 0;
|
|
|
- klient->getNachrichtEncrypted( (char *)&spielId, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char*)&spielId, 4 );
|
|
|
if( !shs->zDB()->proveSpiel( shs->getId(), spielId ) )
|
|
|
{
|
|
|
Text ip = "";
|
|
@@ -781,7 +776,7 @@ void ShSKlient::thread()
|
|
|
else
|
|
|
{
|
|
|
klient->sendeEncrypted( "\2", 1 );
|
|
|
- klient->sendeEncrypted( (char *)&port, 4 );
|
|
|
+ klient->sendeEncrypted( (char*)&port, 4 );
|
|
|
char len = (char)ip.getLength();
|
|
|
klient->sendeEncrypted( &len, 1 );
|
|
|
klient->sendeEncrypted( ip.getText(), len );
|
|
@@ -789,7 +784,7 @@ void ShSKlient::thread()
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- Text *pfad = new Text( shs->zInit()->zWert( "ShopSeitenPfad" )->getText() );
|
|
|
+ Text* pfad = new Text( shs->zInit()->zWert( "ShopSeitenPfad" )->getText() );
|
|
|
pfad->append( "/spiele/" );
|
|
|
pfad->append( spielId );
|
|
|
pfad->append( "/seite" );
|
|
@@ -800,9 +795,9 @@ void ShSKlient::thread()
|
|
|
break;
|
|
|
}
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
- Datei *dat = new Datei();
|
|
|
+ Datei* dat = new Datei();
|
|
|
dat->setDatei( pfad );
|
|
|
- RCArray< Text > *list = dat->getDateiListe();
|
|
|
+ RCArray< Text >* list = dat->getDateiListe();
|
|
|
int dAnz = list->getEintragAnzahl();
|
|
|
for( int i = 0; i < dAnz; i++ )
|
|
|
{
|
|
@@ -813,21 +808,21 @@ void ShSKlient::thread()
|
|
|
i--;
|
|
|
}
|
|
|
}
|
|
|
- klient->sendeEncrypted( (char *)&dAnz, 4 );
|
|
|
+ klient->sendeEncrypted( (char*)&dAnz, 4 );
|
|
|
for( int i = 0; i < dAnz; i++ )
|
|
|
{
|
|
|
- Text *pf = new Text( dat->zPfad()->getText() );
|
|
|
+ Text* pf = new Text( dat->zPfad()->getText() );
|
|
|
pf->append( "/" );
|
|
|
pf->append( list->z( i )->getText() );
|
|
|
- Datei *d = new Datei();
|
|
|
+ Datei* d = new Datei();
|
|
|
d->setDatei( pf );
|
|
|
d->open( Datei::Style::lesen );
|
|
|
char nl = (char)list->z( i )->getLength();
|
|
|
klient->sendeEncrypted( &nl, 1 );
|
|
|
klient->sendeEncrypted( list->z( i )->getText(), nl );
|
|
|
__int64 gr = d->getSize();
|
|
|
- klient->sendeEncrypted( (char *)&gr, 8 );
|
|
|
- char *bytes = new char[ 2048 ];
|
|
|
+ klient->sendeEncrypted( (char*)&gr, 8 );
|
|
|
+ char* bytes = new char[ 2048 ];
|
|
|
while( gr > 0 )
|
|
|
{
|
|
|
int len = gr > 2048 ? 2048 : (int)gr;
|
|
@@ -850,9 +845,9 @@ void ShSKlient::thread()
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
int spielId = 0;
|
|
|
- klient->getNachrichtEncrypted( (char *)&spielId, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char*)&spielId, 4 );
|
|
|
int status = shs->zDB()->getSpielBesitzStatus( klientNummer, spielId );
|
|
|
- klient->sendeEncrypted( (char *)&status, 4 );
|
|
|
+ klient->sendeEncrypted( (char*)&status, 4 );
|
|
|
}
|
|
|
else
|
|
|
errorZuKlient( "Du bist nicht Identifiziert." );
|
|
@@ -862,9 +857,9 @@ void ShSKlient::thread()
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
int spielId = 0;
|
|
|
- klient->getNachrichtEncrypted( (char *)&spielId, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char*)&spielId, 4 );
|
|
|
int status = shs->zDB()->getSpielTestversionStatus( klientNummer, spielId );
|
|
|
- klient->sendeEncrypted( (char *)&status, 4 );
|
|
|
+ klient->sendeEncrypted( (char*)&status, 4 );
|
|
|
}
|
|
|
else
|
|
|
errorZuKlient( "Du bist nicht Identifiziert." );
|
|
@@ -874,9 +869,9 @@ void ShSKlient::thread()
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
int spielId = 0;
|
|
|
- klient->getNachrichtEncrypted( (char *)&spielId, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char*)&spielId, 4 );
|
|
|
int status = shs->zDB()->getSpielErwerbbarStatus( klientNummer, spielId );
|
|
|
- klient->sendeEncrypted( (char *)&status, 4 );
|
|
|
+ klient->sendeEncrypted( (char*)&status, 4 );
|
|
|
}
|
|
|
else
|
|
|
errorZuKlient( "Du bist nicht Identifiziert." );
|
|
@@ -886,11 +881,11 @@ void ShSKlient::thread()
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
int spielId = 0;
|
|
|
- klient->getNachrichtEncrypted( (char *)&spielId, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char*)&spielId, 4 );
|
|
|
char testVersion = 0;
|
|
|
klient->getNachrichtEncrypted( &testVersion, 1 );
|
|
|
int status = shs->zDB()->getSpielPreis( spielId, testVersion == 1 );
|
|
|
- klient->sendeEncrypted( (char *)&status, 4 );
|
|
|
+ klient->sendeEncrypted( (char*)&status, 4 );
|
|
|
}
|
|
|
else
|
|
|
errorZuKlient( "Du bist nicht Identifiziert." );
|
|
@@ -900,7 +895,7 @@ void ShSKlient::thread()
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
int spielId = 0;
|
|
|
- klient->getNachrichtEncrypted( (char *)&spielId, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char*)&spielId, 4 );
|
|
|
char testVersion = 0;
|
|
|
klient->getNachrichtEncrypted( &testVersion, 1 );
|
|
|
bool ok = shs->zDB()->spielKaufen( klientNummer, spielId, testVersion == 1 );
|
|
@@ -917,25 +912,25 @@ void ShSKlient::thread()
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
int spielId = 0;
|
|
|
- klient->getNachrichtEncrypted( (char *)&spielId, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char*)&spielId, 4 );
|
|
|
unsigned char len = 0;
|
|
|
- klient->getNachrichtEncrypted( (char *)&len, 1 );
|
|
|
- char *suche = new char[ len + 1 ];
|
|
|
+ klient->getNachrichtEncrypted( (char*)&len, 1 );
|
|
|
+ char* suche = new char[ len + 1 ];
|
|
|
suche[ (int)len ] = 0;
|
|
|
if( len )
|
|
|
klient->getNachrichtEncrypted( suche, len );
|
|
|
- Array< int > *list = new Array< int >();
|
|
|
+ Array< int >* list = new Array< int >();
|
|
|
if( shs->zDB()->getKarteListe( klientNummer, spielId, suche, list ) )
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
int anz = list->getEintragAnzahl();
|
|
|
- klient->sendeEncrypted( (char *)&anz, 4 );
|
|
|
+ klient->sendeEncrypted( (char*)&anz, 4 );
|
|
|
if( anz )
|
|
|
{
|
|
|
for( int i = 0; i < anz; i++ )
|
|
|
{
|
|
|
int w = list->get( i );
|
|
|
- klient->sendeEncrypted( (char *)&w, 4 );
|
|
|
+ klient->sendeEncrypted( (char*)&w, 4 );
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -952,7 +947,7 @@ void ShSKlient::thread()
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
int karteId = 0;
|
|
|
- klient->getNachrichtEncrypted( (char *)&karteId, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char*)&karteId, 4 );
|
|
|
if( !shs->zDB()->proveKarte( shs->getId(), karteId ) )
|
|
|
{
|
|
|
Text ip = "";
|
|
@@ -962,7 +957,7 @@ void ShSKlient::thread()
|
|
|
else
|
|
|
{
|
|
|
klient->sendeEncrypted( "\2", 1 );
|
|
|
- klient->sendeEncrypted( (char *)&port, 4 );
|
|
|
+ klient->sendeEncrypted( (char*)&port, 4 );
|
|
|
char len = (char)ip.getLength();
|
|
|
klient->sendeEncrypted( &len, 1 );
|
|
|
klient->sendeEncrypted( ip.getText(), len );
|
|
@@ -970,7 +965,7 @@ void ShSKlient::thread()
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- Text *pfad = new Text( shs->zInit()->zWert( "ShopSeitenPfad" )->getText() );
|
|
|
+ Text* pfad = new Text( shs->zInit()->zWert( "ShopSeitenPfad" )->getText() );
|
|
|
pfad->append( "/karten/" );
|
|
|
pfad->append( karteId );
|
|
|
pfad->append( "/titelbg.ltdb" );
|
|
@@ -981,12 +976,12 @@ void ShSKlient::thread()
|
|
|
break;
|
|
|
}
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
- Datei *dat = new Datei();
|
|
|
+ Datei* dat = new Datei();
|
|
|
dat->setDatei( pfad );
|
|
|
dat->open( Datei::Style::lesen );
|
|
|
__int64 gr = dat->getSize();
|
|
|
- klient->sendeEncrypted( (char *)&gr, 8 );
|
|
|
- char *bytes = new char[ 2048 ];
|
|
|
+ klient->sendeEncrypted( (char*)&gr, 8 );
|
|
|
+ char* bytes = new char[ 2048 ];
|
|
|
while( gr > 0 )
|
|
|
{
|
|
|
int len = gr > 2048 ? 2048 : (int)gr;
|
|
@@ -1006,7 +1001,7 @@ void ShSKlient::thread()
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
int karteId = 0;
|
|
|
- klient->getNachrichtEncrypted( (char *)&karteId, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char*)&karteId, 4 );
|
|
|
if( !shs->zDB()->proveKarte( shs->getId(), karteId ) )
|
|
|
{
|
|
|
Text ip = "";
|
|
@@ -1016,7 +1011,7 @@ void ShSKlient::thread()
|
|
|
else
|
|
|
{
|
|
|
klient->sendeEncrypted( "\2", 1 );
|
|
|
- klient->sendeEncrypted( (char *)&port, 4 );
|
|
|
+ klient->sendeEncrypted( (char*)&port, 4 );
|
|
|
char len = (char)ip.getLength();
|
|
|
klient->sendeEncrypted( &len, 1 );
|
|
|
klient->sendeEncrypted( ip.getText(), len );
|
|
@@ -1024,7 +1019,7 @@ void ShSKlient::thread()
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
- Text *pfad = new Text( shs->zInit()->zWert( "ShopSeitenPfad" )->getText() );
|
|
|
+ Text* pfad = new Text( shs->zInit()->zWert( "ShopSeitenPfad" )->getText() );
|
|
|
pfad->append( "/karten/" );
|
|
|
pfad->append( karteId );
|
|
|
pfad->append( "/seite" );
|
|
@@ -1035,9 +1030,9 @@ void ShSKlient::thread()
|
|
|
break;
|
|
|
}
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
- Datei *dat = new Datei();
|
|
|
+ Datei* dat = new Datei();
|
|
|
dat->setDatei( pfad );
|
|
|
- RCArray< Text > *list = dat->getDateiListe();
|
|
|
+ RCArray< Text >* list = dat->getDateiListe();
|
|
|
int dAnz = list->getEintragAnzahl();
|
|
|
for( int i = 0; i < dAnz; i++ )
|
|
|
{
|
|
@@ -1048,21 +1043,21 @@ void ShSKlient::thread()
|
|
|
i--;
|
|
|
}
|
|
|
}
|
|
|
- klient->sendeEncrypted( (char *)&dAnz, 4 );
|
|
|
+ klient->sendeEncrypted( (char*)&dAnz, 4 );
|
|
|
for( int i = 0; i < dAnz; i++ )
|
|
|
{
|
|
|
- Text *pf = new Text( dat->zPfad()->getText() );
|
|
|
+ Text* pf = new Text( dat->zPfad()->getText() );
|
|
|
pf->append( "/" );
|
|
|
pf->append( list->z( i )->getText() );
|
|
|
- Datei *d = new Datei();
|
|
|
+ Datei* d = new Datei();
|
|
|
d->setDatei( pf );
|
|
|
d->open( Datei::Style::lesen );
|
|
|
char nl = (char)list->z( i )->getLength();
|
|
|
klient->sendeEncrypted( &nl, 1 );
|
|
|
klient->sendeEncrypted( list->z( i )->getText(), nl );
|
|
|
__int64 gr = d->getSize();
|
|
|
- klient->sendeEncrypted( (char *)&gr, 8 );
|
|
|
- char *bytes = new char[ 2048 ];
|
|
|
+ klient->sendeEncrypted( (char*)&gr, 8 );
|
|
|
+ char* bytes = new char[ 2048 ];
|
|
|
while( gr > 0 )
|
|
|
{
|
|
|
int len = gr > 2048 ? 2048 : (int)gr;
|
|
@@ -1085,9 +1080,9 @@ void ShSKlient::thread()
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
int karteId = 0;
|
|
|
- klient->getNachrichtEncrypted( (char *)&karteId, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char*)&karteId, 4 );
|
|
|
int status = shs->zDB()->getKarteBesitzStatus( klientNummer, karteId );
|
|
|
- klient->sendeEncrypted( (char *)&status, 4 );
|
|
|
+ klient->sendeEncrypted( (char*)&status, 4 );
|
|
|
}
|
|
|
else
|
|
|
errorZuKlient( "Du bist nicht Identifiziert." );
|
|
@@ -1097,9 +1092,9 @@ void ShSKlient::thread()
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
int karteId = 0;
|
|
|
- klient->getNachrichtEncrypted( (char *)&karteId, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char*)&karteId, 4 );
|
|
|
int status = shs->zDB()->getKarteTestversionStatus( klientNummer, karteId );
|
|
|
- klient->sendeEncrypted( (char *)&status, 4 );
|
|
|
+ klient->sendeEncrypted( (char*)&status, 4 );
|
|
|
}
|
|
|
else
|
|
|
errorZuKlient( "Du bist nicht Identifiziert." );
|
|
@@ -1109,9 +1104,9 @@ void ShSKlient::thread()
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
int karteId = 0;
|
|
|
- klient->getNachrichtEncrypted( (char *)&karteId, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char*)&karteId, 4 );
|
|
|
int status = shs->zDB()->getKarteErwerbbarStatus( klientNummer, karteId );
|
|
|
- klient->sendeEncrypted( (char *)&status, 4 );
|
|
|
+ klient->sendeEncrypted( (char*)&status, 4 );
|
|
|
}
|
|
|
else
|
|
|
errorZuKlient( "Du bist nicht Identifiziert." );
|
|
@@ -1121,11 +1116,11 @@ void ShSKlient::thread()
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
int karteId = 0;
|
|
|
- klient->getNachrichtEncrypted( (char *)&karteId, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char*)&karteId, 4 );
|
|
|
char testVersion = 0;
|
|
|
klient->getNachrichtEncrypted( &testVersion, 1 );
|
|
|
int status = shs->zDB()->getKartePreis( karteId, testVersion == 1 );
|
|
|
- klient->sendeEncrypted( (char *)&status, 4 );
|
|
|
+ klient->sendeEncrypted( (char*)&status, 4 );
|
|
|
}
|
|
|
else
|
|
|
errorZuKlient( "Du bist nicht Identifiziert." );
|
|
@@ -1135,7 +1130,7 @@ void ShSKlient::thread()
|
|
|
{
|
|
|
klient->sendeEncrypted( "\1", 1 );
|
|
|
int karteId = 0;
|
|
|
- klient->getNachrichtEncrypted( (char *)&karteId, 4 );
|
|
|
+ klient->getNachrichtEncrypted( (char*)&karteId, 4 );
|
|
|
char testVersion = 0;
|
|
|
klient->getNachrichtEncrypted( &testVersion, 1 );
|
|
|
bool ok = shs->zDB()->karteKaufen( klientNummer, karteId, testVersion == 1 );
|
|
@@ -1174,7 +1169,7 @@ void ShSKlient::thread()
|
|
|
}
|
|
|
|
|
|
// constant
|
|
|
-void ShSKlient::errorZuKlient( const char *nachricht ) const // sendet eine Fehlernachricht zum Klient
|
|
|
+void ShSKlient::errorZuKlient( const char* nachricht ) const // sendet eine Fehlernachricht zum Klient
|
|
|
{
|
|
|
klient->sendeEncrypted( "\3", 1 );
|
|
|
char len = (char)textLength( nachricht );
|