|
@@ -6,353 +6,353 @@
|
|
|
// Inhalt der SpielStatistik Klasse aus SpielStatistik.h
|
|
|
// Konstruktor
|
|
|
SpielStatistik::SpielStatistik()
|
|
|
- : ReferenceCounter()
|
|
|
+ : ReferenceCounter()
|
|
|
{
|
|
|
- InitializeCriticalSection( &cs );
|
|
|
- addNachrichtF = 0;
|
|
|
- addChatF = 0;
|
|
|
- addFreundF = 0;
|
|
|
- accountAnsehenF = 0;
|
|
|
- istFreundF = 0;
|
|
|
- nachrichtParam = 0;
|
|
|
- bilder = 0;
|
|
|
- infoc = 0;
|
|
|
- spielc = 0;
|
|
|
- status = 0;
|
|
|
- gss = new Array< SSDSpieler * >();
|
|
|
- gts = new Array< SSDTeam * >();
|
|
|
- chat = 0;
|
|
|
- tabelle = 0;
|
|
|
- accountId = 0;
|
|
|
- rend = 0;
|
|
|
+ InitializeCriticalSection(&cs);
|
|
|
+ addNachrichtF = 0;
|
|
|
+ addChatF = 0;
|
|
|
+ addFreundF = 0;
|
|
|
+ accountAnsehenF = 0;
|
|
|
+ istFreundF = 0;
|
|
|
+ nachrichtParam = 0;
|
|
|
+ bilder = 0;
|
|
|
+ infoc = 0;
|
|
|
+ spielc = 0;
|
|
|
+ status = 0;
|
|
|
+ gss = new Array< SSDSpieler* >();
|
|
|
+ gts = new Array< SSDTeam* >();
|
|
|
+ chat = 0;
|
|
|
+ tabelle = 0;
|
|
|
+ accountId = 0;
|
|
|
+ rend = 0;
|
|
|
}
|
|
|
|
|
|
// Destruktor
|
|
|
SpielStatistik::~SpielStatistik()
|
|
|
{
|
|
|
- if( chat )
|
|
|
- chat->release();
|
|
|
- if( tabelle )
|
|
|
- tabelle->release();
|
|
|
- if( infoc )
|
|
|
- infoc->release();
|
|
|
- if( spielc )
|
|
|
- spielc->release();
|
|
|
- int anz = gss->getEintragAnzahl();
|
|
|
- for( int i = 0; i < anz; i++ )
|
|
|
- {
|
|
|
- if( gss->hat( i ) )
|
|
|
- delete gss->get( i );
|
|
|
- }
|
|
|
- gss->release();
|
|
|
- anz = gts->getEintragAnzahl();
|
|
|
- for( int i = 0; i < anz; i++ )
|
|
|
- {
|
|
|
- if( gts->hat( i ) )
|
|
|
- delete gts->get( i );
|
|
|
- }
|
|
|
- gts->release();
|
|
|
- DeleteCriticalSection( &cs );
|
|
|
+ if (chat)
|
|
|
+ chat->release();
|
|
|
+ if (tabelle)
|
|
|
+ tabelle->release();
|
|
|
+ if (infoc)
|
|
|
+ infoc->release();
|
|
|
+ if (spielc)
|
|
|
+ spielc->release();
|
|
|
+ int anz = gss->getEintragAnzahl();
|
|
|
+ for (int i = 0; i < anz; i++)
|
|
|
+ {
|
|
|
+ if (gss->hat(i))
|
|
|
+ delete gss->get(i);
|
|
|
+ }
|
|
|
+ gss->release();
|
|
|
+ anz = gts->getEintragAnzahl();
|
|
|
+ for (int i = 0; i < anz; i++)
|
|
|
+ {
|
|
|
+ if (gts->hat(i))
|
|
|
+ delete gts->get(i);
|
|
|
+ }
|
|
|
+ gts->release();
|
|
|
+ DeleteCriticalSection(&cs);
|
|
|
}
|
|
|
|
|
|
// nicht constant
|
|
|
void SpielStatistik::lock()
|
|
|
{
|
|
|
- EnterCriticalSection( &cs );
|
|
|
+ EnterCriticalSection(&cs);
|
|
|
}
|
|
|
|
|
|
void SpielStatistik::unlock()
|
|
|
{
|
|
|
- LeaveCriticalSection( &cs );
|
|
|
+ LeaveCriticalSection(&cs);
|
|
|
}
|
|
|
|
|
|
void SpielStatistik::bereit()
|
|
|
{
|
|
|
- char byte = 0;
|
|
|
- spielc->statistikNachricht( 1, &byte );
|
|
|
+ char byte = 0;
|
|
|
+ spielc->statistikNachricht(1, &byte);
|
|
|
}
|
|
|
|
|
|
-void SpielStatistik::setBilder( BilderV *b )
|
|
|
+void SpielStatistik::setBilder(BilderV* b)
|
|
|
{
|
|
|
- bilder = b;
|
|
|
+ bilder = b;
|
|
|
}
|
|
|
|
|
|
-void SpielStatistik::setAccountId( int id )
|
|
|
+void SpielStatistik::setAccountId(int id)
|
|
|
{
|
|
|
- accountId = id;
|
|
|
+ accountId = id;
|
|
|
}
|
|
|
|
|
|
-void SpielStatistik::setRückrufFunktionen( void( *addNachrichtF )( void *, Text *, Text *, Text *, Text * ),
|
|
|
- void( *addChatF )( void *, int ), void( *addFreundF )( void *, int ),
|
|
|
- void( *accountAnsehenF )( void *, int ), bool( *istFreundF )( void *, int ), void *nachrichtParam )
|
|
|
+void SpielStatistik::setRückrufFunktionen(void(*addNachrichtF)(void*, Text*, Text*, Text*, Text*),
|
|
|
+ void(*addChatF)(void*, int), void(*addFreundF)(void*, int),
|
|
|
+ void(*accountAnsehenF)(void*, int), bool(*istFreundF)(void*, int), void* nachrichtParam)
|
|
|
{
|
|
|
- this->addNachrichtF = addNachrichtF;
|
|
|
- this->addChatF = addChatF;
|
|
|
- this->addFreundF = addFreundF;
|
|
|
- this->accountAnsehenF = accountAnsehenF;
|
|
|
- this->istFreundF = istFreundF;
|
|
|
- this->nachrichtParam = nachrichtParam;
|
|
|
+ this->addNachrichtF = addNachrichtF;
|
|
|
+ this->addChatF = addChatF;
|
|
|
+ this->addFreundF = addFreundF;
|
|
|
+ this->accountAnsehenF = accountAnsehenF;
|
|
|
+ this->istFreundF = istFreundF;
|
|
|
+ this->nachrichtParam = nachrichtParam;
|
|
|
}
|
|
|
|
|
|
-void SpielStatistik::setUIFactory( UIInit &uiFactory )
|
|
|
+void SpielStatistik::setUIFactory(UIInit& uiFactory)
|
|
|
{
|
|
|
- this->uiFactory = uiFactory;
|
|
|
+ this->uiFactory = uiFactory;
|
|
|
}
|
|
|
|
|
|
-void SpielStatistik::setKlients( KSGClient::InformationServerClient *infoc, KSGClient::SpielServerClient *spielc )
|
|
|
+void SpielStatistik::setKlients(KSGClient::InformationServerClient* infoc, KSGClient::SpielServerClient* spielc)
|
|
|
{
|
|
|
- if( this->infoc )
|
|
|
- this->infoc->release();
|
|
|
- if( this->spielc )
|
|
|
- this->spielc->release();
|
|
|
- this->infoc = infoc;
|
|
|
- this->spielc = spielc;
|
|
|
+ if (this->infoc)
|
|
|
+ this->infoc->release();
|
|
|
+ if (this->spielc)
|
|
|
+ this->spielc->release();
|
|
|
+ this->infoc = infoc;
|
|
|
+ this->spielc = spielc;
|
|
|
}
|
|
|
|
|
|
-void SpielStatistik::nachricht( int län, char *bytes )
|
|
|
+void SpielStatistik::nachricht(int län, const char* bytes)
|
|
|
{
|
|
|
- lock();
|
|
|
- char num = *bytes;
|
|
|
- bytes++;
|
|
|
- län--;
|
|
|
- switch( num )
|
|
|
- {
|
|
|
- case 0: // Spieler Statistik
|
|
|
- if( 1 )
|
|
|
- {
|
|
|
- SSDSpieler *ssdgs = new SSDSpieler();
|
|
|
- ssdgs->spielerNummer = *(int *)bytes;
|
|
|
- bytes += 4;
|
|
|
- län -= 4;
|
|
|
- char snlän = *bytes;
|
|
|
- län--;
|
|
|
- bytes++;
|
|
|
- char *txt = new char[ snlän + 1 ];
|
|
|
- txt[ snlän ] = 0;
|
|
|
- for( int i = 0; i < snlän; i++ )
|
|
|
- txt[ i ] = bytes[ i ];
|
|
|
- bytes += snlän;
|
|
|
- län -= snlän;
|
|
|
- ssdgs->spielerName = txt;
|
|
|
- delete[] txt;
|
|
|
- char tnlän = *bytes;
|
|
|
- län--;
|
|
|
- bytes++;
|
|
|
- txt = new char[ tnlän + 1 ];
|
|
|
- txt[ tnlän ] = 0;
|
|
|
- for( int i = 0; i < tnlän; i++ )
|
|
|
- txt[ i ] = bytes[ i ];
|
|
|
- bytes += tnlän;
|
|
|
- län -= tnlän;
|
|
|
- ssdgs->teamName = txt;
|
|
|
- delete[] txt;
|
|
|
- ssdgs->spielerFarbe = *(int *)bytes;
|
|
|
- bytes += 4;
|
|
|
- län -= 4;
|
|
|
- ssdgs->teamFarbe = *(int *)bytes;
|
|
|
- bytes += 4;
|
|
|
- län -= 4;
|
|
|
- ssdgs->schadenBekommen = *(int *)bytes;
|
|
|
- bytes += 4;
|
|
|
- län -= 4;
|
|
|
- ssdgs->schadenGemacht = *(int *)bytes;
|
|
|
- bytes += 4;
|
|
|
- län -= 4;
|
|
|
- ssdgs->treibstoffVerbraucht = *(int *)bytes;
|
|
|
- bytes += 4;
|
|
|
- län -= 4;
|
|
|
- ssdgs->schüsse = *(int *)bytes;
|
|
|
- bytes += 4;
|
|
|
- län -= 4;
|
|
|
- ssdgs->treffer = *(int *)bytes;
|
|
|
- bytes += 4;
|
|
|
- län -= 4;
|
|
|
- ssdgs->punkte = *(int *)bytes;
|
|
|
- bytes += 4;
|
|
|
- län -= 4;
|
|
|
- ssdgs->kills = *(int *)bytes;
|
|
|
- bytes += 4;
|
|
|
- län -= 4;
|
|
|
- ssdgs->tode = *(int *)bytes;
|
|
|
- bytes += 4;
|
|
|
- län -= 4;
|
|
|
- ssdgs->zeitAmLeben = *(int *)bytes;
|
|
|
- bytes += 4;
|
|
|
- län -= 4;
|
|
|
- ssdgs->zeitTod = *(int *)bytes;
|
|
|
- bytes += 4;
|
|
|
- län -= 4;
|
|
|
- gss->add( ssdgs );
|
|
|
- }
|
|
|
- break;
|
|
|
- case 1: // Team Statistik
|
|
|
- if( 1 )
|
|
|
- {
|
|
|
- SSDTeam *ssdgt = new SSDTeam();
|
|
|
- ssdgt->teamNummer = *(int *)bytes;
|
|
|
- bytes += 4;
|
|
|
- län -= 4;
|
|
|
- char tnlän = *bytes;
|
|
|
- län--;
|
|
|
- bytes++;
|
|
|
- char *txt = new char[ tnlän + 1 ];
|
|
|
- txt[ tnlän ] = 0;
|
|
|
- for( int i = 0; i < tnlän; i++ )
|
|
|
- txt[ i ] = bytes[ i ];
|
|
|
- bytes += tnlän;
|
|
|
- län -= tnlän;
|
|
|
- ssdgt->teamName = txt;
|
|
|
- delete[] txt;
|
|
|
- ssdgt->teamFarbe = *(int *)bytes;
|
|
|
- bytes += 4;
|
|
|
- län -= 4;
|
|
|
- ssdgt->schadenBekommen = *(int *)bytes;
|
|
|
- bytes += 4;
|
|
|
- län -= 4;
|
|
|
- ssdgt->schadenGemacht = *(int *)bytes;
|
|
|
- bytes += 4;
|
|
|
- län -= 4;
|
|
|
- ssdgt->treibstoffVerbraucht = *(int *)bytes;
|
|
|
- bytes += 4;
|
|
|
- län -= 4;
|
|
|
- ssdgt->schüsse = *(int *)bytes;
|
|
|
- bytes += 4;
|
|
|
- län -= 4;
|
|
|
- ssdgt->treffer = *(int *)bytes;
|
|
|
- bytes += 4;
|
|
|
- län -= 4;
|
|
|
- ssdgt->punkte = *(int *)bytes;
|
|
|
- bytes += 4;
|
|
|
- län -= 4;
|
|
|
- ssdgt->kills = *(int *)bytes;
|
|
|
- bytes += 4;
|
|
|
- län -= 4;
|
|
|
- ssdgt->tode = *(int *)bytes;
|
|
|
- bytes += 4;
|
|
|
- län -= 4;
|
|
|
- ssdgt->gewonnen = *bytes != 0;
|
|
|
- bytes++;
|
|
|
- län--;
|
|
|
- gts->add( ssdgt );
|
|
|
- }
|
|
|
- break;
|
|
|
- case 2: // Ladevorgang abgeschlossen
|
|
|
- if( 1 )
|
|
|
- {
|
|
|
- chat = new StatistikChat( accountId, dynamic_cast<KSGClient::SpielServerClient *>( spielc->getThis() ), dynamic_cast<KSGClient::InformationServerClient *>( infoc->getThis() ), uiFactory, bilder, addNachrichtF, addChatF, addFreundF, accountAnsehenF, nachrichtParam );
|
|
|
- int anz = gss->getEintragAnzahl();
|
|
|
- for( int i = 0; i < anz; i++ )
|
|
|
- {
|
|
|
- if( gss->hat( i ) )
|
|
|
- {
|
|
|
- int acc = infoc->getAccountId( gss->get( i )->spielerName );
|
|
|
- if( acc )
|
|
|
- chat->addSpieler( acc, istFreundF( nachrichtParam, acc ) || acc == accountId );
|
|
|
- }
|
|
|
- }
|
|
|
- tabelle = new StatistikTabelle( dynamic_cast<Array<SSDSpieler *> *>( gss->getThis() ), dynamic_cast<Array<SSDTeam *> *>( gts->getThis() ), uiFactory );
|
|
|
- status = 1;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 3: // Chat Nachricht
|
|
|
- if( 1 )
|
|
|
- {
|
|
|
- int vonAccount = *(int *)bytes;
|
|
|
- bytes += 4;
|
|
|
- län -= 4;
|
|
|
- char *txt = new char[ län + 1 ];
|
|
|
- txt[ län ] = 0;
|
|
|
- for( int i = 0; i < län; i++ )
|
|
|
- txt[ i ] = bytes[ i ];
|
|
|
- if( status == 1 )
|
|
|
- chat->addChatNachricht( vonAccount, txt );
|
|
|
- delete[] txt;
|
|
|
- }
|
|
|
- break;
|
|
|
- case 4: // Spieler hat verlassen
|
|
|
- if( 1 )
|
|
|
- {
|
|
|
- int acc = *(int *)bytes;
|
|
|
- bytes += 4;
|
|
|
- län -= 4;
|
|
|
- if( status == 1 )
|
|
|
- chat->spielerOffline( acc );
|
|
|
- }
|
|
|
- break;
|
|
|
- default:
|
|
|
- // Fehler
|
|
|
- break;
|
|
|
- }
|
|
|
- if( län != 0 )
|
|
|
- {
|
|
|
- // Fehler
|
|
|
- }
|
|
|
- unlock();
|
|
|
+ lock();
|
|
|
+ char num = *bytes;
|
|
|
+ bytes++;
|
|
|
+ län--;
|
|
|
+ switch (num)
|
|
|
+ {
|
|
|
+ case 0: // Spieler Statistik
|
|
|
+ if (1)
|
|
|
+ {
|
|
|
+ SSDSpieler* ssdgs = new SSDSpieler();
|
|
|
+ ssdgs->spielerNummer = *(int*)bytes;
|
|
|
+ bytes += 4;
|
|
|
+ län -= 4;
|
|
|
+ char snlän = *bytes;
|
|
|
+ län--;
|
|
|
+ bytes++;
|
|
|
+ char* txt = new char[snlän + 1];
|
|
|
+ txt[snlän] = 0;
|
|
|
+ for (int i = 0; i < snlän; i++)
|
|
|
+ txt[i] = bytes[i];
|
|
|
+ bytes += snlän;
|
|
|
+ län -= snlän;
|
|
|
+ ssdgs->spielerName = txt;
|
|
|
+ delete[] txt;
|
|
|
+ char tnlän = *bytes;
|
|
|
+ län--;
|
|
|
+ bytes++;
|
|
|
+ txt = new char[tnlän + 1];
|
|
|
+ txt[tnlän] = 0;
|
|
|
+ for (int i = 0; i < tnlän; i++)
|
|
|
+ txt[i] = bytes[i];
|
|
|
+ bytes += tnlän;
|
|
|
+ län -= tnlän;
|
|
|
+ ssdgs->teamName = txt;
|
|
|
+ delete[] txt;
|
|
|
+ ssdgs->spielerFarbe = *(int*)bytes;
|
|
|
+ bytes += 4;
|
|
|
+ län -= 4;
|
|
|
+ ssdgs->teamFarbe = *(int*)bytes;
|
|
|
+ bytes += 4;
|
|
|
+ län -= 4;
|
|
|
+ ssdgs->schadenBekommen = *(int*)bytes;
|
|
|
+ bytes += 4;
|
|
|
+ län -= 4;
|
|
|
+ ssdgs->schadenGemacht = *(int*)bytes;
|
|
|
+ bytes += 4;
|
|
|
+ län -= 4;
|
|
|
+ ssdgs->treibstoffVerbraucht = *(int*)bytes;
|
|
|
+ bytes += 4;
|
|
|
+ län -= 4;
|
|
|
+ ssdgs->schüsse = *(int*)bytes;
|
|
|
+ bytes += 4;
|
|
|
+ län -= 4;
|
|
|
+ ssdgs->treffer = *(int*)bytes;
|
|
|
+ bytes += 4;
|
|
|
+ län -= 4;
|
|
|
+ ssdgs->punkte = *(int*)bytes;
|
|
|
+ bytes += 4;
|
|
|
+ län -= 4;
|
|
|
+ ssdgs->kills = *(int*)bytes;
|
|
|
+ bytes += 4;
|
|
|
+ län -= 4;
|
|
|
+ ssdgs->tode = *(int*)bytes;
|
|
|
+ bytes += 4;
|
|
|
+ län -= 4;
|
|
|
+ ssdgs->zeitAmLeben = *(int*)bytes;
|
|
|
+ bytes += 4;
|
|
|
+ län -= 4;
|
|
|
+ ssdgs->zeitTod = *(int*)bytes;
|
|
|
+ bytes += 4;
|
|
|
+ län -= 4;
|
|
|
+ gss->add(ssdgs);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 1: // Team Statistik
|
|
|
+ if (1)
|
|
|
+ {
|
|
|
+ SSDTeam* ssdgt = new SSDTeam();
|
|
|
+ ssdgt->teamNummer = *(int*)bytes;
|
|
|
+ bytes += 4;
|
|
|
+ län -= 4;
|
|
|
+ char tnlän = *bytes;
|
|
|
+ län--;
|
|
|
+ bytes++;
|
|
|
+ char* txt = new char[tnlän + 1];
|
|
|
+ txt[tnlän] = 0;
|
|
|
+ for (int i = 0; i < tnlän; i++)
|
|
|
+ txt[i] = bytes[i];
|
|
|
+ bytes += tnlän;
|
|
|
+ län -= tnlän;
|
|
|
+ ssdgt->teamName = txt;
|
|
|
+ delete[] txt;
|
|
|
+ ssdgt->teamFarbe = *(int*)bytes;
|
|
|
+ bytes += 4;
|
|
|
+ län -= 4;
|
|
|
+ ssdgt->schadenBekommen = *(int*)bytes;
|
|
|
+ bytes += 4;
|
|
|
+ län -= 4;
|
|
|
+ ssdgt->schadenGemacht = *(int*)bytes;
|
|
|
+ bytes += 4;
|
|
|
+ län -= 4;
|
|
|
+ ssdgt->treibstoffVerbraucht = *(int*)bytes;
|
|
|
+ bytes += 4;
|
|
|
+ län -= 4;
|
|
|
+ ssdgt->schüsse = *(int*)bytes;
|
|
|
+ bytes += 4;
|
|
|
+ län -= 4;
|
|
|
+ ssdgt->treffer = *(int*)bytes;
|
|
|
+ bytes += 4;
|
|
|
+ län -= 4;
|
|
|
+ ssdgt->punkte = *(int*)bytes;
|
|
|
+ bytes += 4;
|
|
|
+ län -= 4;
|
|
|
+ ssdgt->kills = *(int*)bytes;
|
|
|
+ bytes += 4;
|
|
|
+ län -= 4;
|
|
|
+ ssdgt->tode = *(int*)bytes;
|
|
|
+ bytes += 4;
|
|
|
+ län -= 4;
|
|
|
+ ssdgt->gewonnen = *bytes != 0;
|
|
|
+ bytes++;
|
|
|
+ län--;
|
|
|
+ gts->add(ssdgt);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 2: // Ladevorgang abgeschlossen
|
|
|
+ if (1)
|
|
|
+ {
|
|
|
+ chat = new StatistikChat(accountId, dynamic_cast<KSGClient::SpielServerClient*>(spielc->getThis()), dynamic_cast<KSGClient::InformationServerClient*>(infoc->getThis()), uiFactory, bilder, addNachrichtF, addChatF, addFreundF, accountAnsehenF, nachrichtParam);
|
|
|
+ int anz = gss->getEintragAnzahl();
|
|
|
+ for (int i = 0; i < anz; i++)
|
|
|
+ {
|
|
|
+ if (gss->hat(i))
|
|
|
+ {
|
|
|
+ int acc = infoc->getAccountId(gss->get(i)->spielerName);
|
|
|
+ if (acc)
|
|
|
+ chat->addSpieler(acc, istFreundF(nachrichtParam, acc) || acc == accountId);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ tabelle = new StatistikTabelle(dynamic_cast<Array<SSDSpieler*> *>(gss->getThis()), dynamic_cast<Array<SSDTeam*> *>(gts->getThis()), uiFactory);
|
|
|
+ status = 1;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 3: // Chat Nachricht
|
|
|
+ if (1)
|
|
|
+ {
|
|
|
+ int vonAccount = *(int*)bytes;
|
|
|
+ bytes += 4;
|
|
|
+ län -= 4;
|
|
|
+ char* txt = new char[län + 1];
|
|
|
+ txt[län] = 0;
|
|
|
+ for (int i = 0; i < län; i++)
|
|
|
+ txt[i] = bytes[i];
|
|
|
+ if (status == 1)
|
|
|
+ chat->addChatNachricht(vonAccount, txt);
|
|
|
+ delete[] txt;
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case 4: // Spieler hat verlassen
|
|
|
+ if (1)
|
|
|
+ {
|
|
|
+ int acc = *(int*)bytes;
|
|
|
+ bytes += 4;
|
|
|
+ län -= 4;
|
|
|
+ if (status == 1)
|
|
|
+ chat->spielerOffline(acc);
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ // Fehler
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if (län != 0)
|
|
|
+ {
|
|
|
+ // Fehler
|
|
|
+ }
|
|
|
+ unlock();
|
|
|
}
|
|
|
|
|
|
-void SpielStatistik::doPublicMausEreignis( MausEreignis &me )
|
|
|
+void SpielStatistik::doPublicMausEreignis(MausEreignis& me)
|
|
|
{
|
|
|
- if( !status )
|
|
|
- return;
|
|
|
- lock();
|
|
|
- if( status == 1 )
|
|
|
- {
|
|
|
- tabelle->doPublicMausEreignis( me );
|
|
|
- chat->doPublicMausEreignis( me );
|
|
|
- }
|
|
|
- unlock();
|
|
|
+ if (!status)
|
|
|
+ return;
|
|
|
+ lock();
|
|
|
+ if (status == 1)
|
|
|
+ {
|
|
|
+ tabelle->doPublicMausEreignis(me);
|
|
|
+ chat->doPublicMausEreignis(me);
|
|
|
+ }
|
|
|
+ unlock();
|
|
|
}
|
|
|
|
|
|
-void SpielStatistik::doTastaturEreignis( TastaturEreignis &te )
|
|
|
+void SpielStatistik::doTastaturEreignis(TastaturEreignis& te)
|
|
|
{
|
|
|
- if( !status )
|
|
|
- return;
|
|
|
- lock();
|
|
|
- if( status == 1 )
|
|
|
- chat->doTastaturEreignis( te );
|
|
|
- unlock();
|
|
|
+ if (!status)
|
|
|
+ return;
|
|
|
+ lock();
|
|
|
+ if (status == 1)
|
|
|
+ chat->doTastaturEreignis(te);
|
|
|
+ unlock();
|
|
|
}
|
|
|
|
|
|
-bool SpielStatistik::tick( double zeit )
|
|
|
+bool SpielStatistik::tick(double zeit)
|
|
|
{
|
|
|
- if( !status )
|
|
|
- return 0;
|
|
|
- lock();
|
|
|
- if( status == 1 )
|
|
|
- {
|
|
|
- rend |= chat->tick( zeit );
|
|
|
- rend |= tabelle->tick( zeit );
|
|
|
- if( chat->hatVerlassen() && status == 1 )
|
|
|
- {
|
|
|
- spielc->trenne();
|
|
|
- status = 2;
|
|
|
- }
|
|
|
- }
|
|
|
- bool ret = rend;
|
|
|
- rend = 0;
|
|
|
- unlock();
|
|
|
- return ret;
|
|
|
+ if (!status)
|
|
|
+ return 0;
|
|
|
+ lock();
|
|
|
+ if (status == 1)
|
|
|
+ {
|
|
|
+ rend |= chat->tick(zeit);
|
|
|
+ rend |= tabelle->tick(zeit);
|
|
|
+ if (chat->hatVerlassen() && status == 1)
|
|
|
+ {
|
|
|
+ spielc->trenne();
|
|
|
+ status = 2;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ bool ret = rend;
|
|
|
+ rend = 0;
|
|
|
+ unlock();
|
|
|
+ return ret;
|
|
|
}
|
|
|
|
|
|
-void SpielStatistik::render( Bild &zRObj )
|
|
|
+void SpielStatistik::render(Bild& zRObj)
|
|
|
{
|
|
|
- if( !status )
|
|
|
- return;
|
|
|
- lock();
|
|
|
- chat->render( zRObj );
|
|
|
- tabelle->render( zRObj );
|
|
|
- unlock();
|
|
|
+ if (!status)
|
|
|
+ return;
|
|
|
+ lock();
|
|
|
+ chat->render(zRObj);
|
|
|
+ tabelle->render(zRObj);
|
|
|
+ unlock();
|
|
|
}
|
|
|
|
|
|
void SpielStatistik::verlassen()
|
|
|
{
|
|
|
- if( spielc )
|
|
|
- spielc->trenne();
|
|
|
- status = 2;
|
|
|
+ if (spielc)
|
|
|
+ spielc->trenne();
|
|
|
+ status = 2;
|
|
|
}
|
|
|
|
|
|
// constant
|
|
|
int SpielStatistik::getStatus() const // 0 = laden, 1 = läuft, 2 = fortsetzen
|
|
|
{
|
|
|
- return status;
|
|
|
+ return status;
|
|
|
}
|