|
@@ -10,658 +10,658 @@
|
|
|
// Konstruktor
|
|
|
TeamAuswahlListeSpieler::TeamAuswahlListeSpieler( SpielerTeamStruktur *sts, Schrift *zSchrift, int accountId, int karteId )
|
|
|
{
|
|
|
- this->accountId = accountId;
|
|
|
- Text *n = infoClient->getSpielerName( accountId );
|
|
|
- name = initTextFeld( 1, 1, 99, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, n->getText() );
|
|
|
- n->release();
|
|
|
- if( accountId == loginClient->getAccountId() )
|
|
|
- {
|
|
|
- teamAuswahl = new AuswahlBox();
|
|
|
- teamAuswahl->setStyle( AuswahlBox::Style::Sichtbar | AuswahlBox::Style::Erlaubt | AuswahlBox::Style::Rahmen | AuswahlBox::Style::MultiStyled | AuswahlBox::Style::MaxHeight | AuswahlBox::Style::VScroll | AuswahlBox::Style::Hintergrund );
|
|
|
- teamAuswahl->setRahmenFarbe( 0xFFFFFFFF );
|
|
|
- teamAuswahl->setRahmenBreite( 1 );
|
|
|
- teamAuswahl->setPosition( 100, 1 );
|
|
|
- teamAuswahl->setSize( 150, 20 );
|
|
|
- teamAuswahl->setMaxAuskappHeight( 100 );
|
|
|
- teamAuswahl->setSchriftZ( zSchrift->getThis() );
|
|
|
- teamAuswahl->setHintergrundFarbe( 0xFF000000 );
|
|
|
- teamAuswahl->setMausEreignis( _ret1ME );
|
|
|
- teamAuswahl->setEventParam( this );
|
|
|
- teamAuswahl->setEventAktion( TeamAuswahlListeSpielerTeamAuswahlE );
|
|
|
- }
|
|
|
- else
|
|
|
- team = initTextFeld( 100, 1, 150, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, "" );
|
|
|
- Array< int > *statistik = new Array< int >();
|
|
|
- infoClient->getSpielStatistik( accountId, infoClient->getSpielId( karteId ), statistik );
|
|
|
- punkte = initTextFeld( 250, 1, 80, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, "Punkte: " );
|
|
|
- punkte->zText()->append( statistik->hat( 3 ) ? statistik->get( 3 ) : 0 );
|
|
|
- spiele = initTextFeld( 330, 1, 80, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, "Spiele: " );
|
|
|
- spiele->zText()->append( statistik->hat( 0 ) ? statistik->get( 0 ) : 0 );
|
|
|
- gewonnen = initTextFeld( 410, 1, 90, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, "Gewonnen: " );
|
|
|
- gewonnen->zText()->append( statistik->hat( 1 ) ? statistik->get( 1 ) : 0 );
|
|
|
- statistik->release();
|
|
|
- farbe = initTextFeld( 500, 1, 50, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, "Farbe:" );
|
|
|
- spielerFarbe = 0;
|
|
|
- rahmen = new LRahmen();
|
|
|
- rahmen->setSize( 581, 22 );
|
|
|
- rahmen->setFarbe( 0xFFFFFFFF );
|
|
|
- rahmen->setRamenBreite( 1 );
|
|
|
- teamName = new Text( "" );
|
|
|
- this->sts = sts;
|
|
|
- rend = 0;
|
|
|
- ref = 1;
|
|
|
+ this->accountId = accountId;
|
|
|
+ Text *n = infoClient->getSpielerName( accountId );
|
|
|
+ name = initTextFeld( 1, 1, 99, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, n->getText() );
|
|
|
+ n->release();
|
|
|
+ if( accountId == loginClient->getAccountId() )
|
|
|
+ {
|
|
|
+ teamAuswahl = new AuswahlBox();
|
|
|
+ teamAuswahl->setStyle( AuswahlBox::Style::Sichtbar | AuswahlBox::Style::Erlaubt | AuswahlBox::Style::Rahmen | AuswahlBox::Style::MultiStyled | AuswahlBox::Style::MaxHeight | AuswahlBox::Style::VScroll | AuswahlBox::Style::Hintergrund );
|
|
|
+ teamAuswahl->setRahmenFarbe( 0xFFFFFFFF );
|
|
|
+ teamAuswahl->setRahmenBreite( 1 );
|
|
|
+ teamAuswahl->setPosition( 100, 1 );
|
|
|
+ teamAuswahl->setSize( 150, 20 );
|
|
|
+ teamAuswahl->setMaxAuskappHeight( 100 );
|
|
|
+ teamAuswahl->setSchriftZ( zSchrift->getThis() );
|
|
|
+ teamAuswahl->setHintergrundFarbe( 0xFF000000 );
|
|
|
+ teamAuswahl->setMausEreignis( _ret1ME );
|
|
|
+ teamAuswahl->setEventParam( this );
|
|
|
+ teamAuswahl->setEventAktion( TeamAuswahlListeSpielerTeamAuswahlE );
|
|
|
+ }
|
|
|
+ else
|
|
|
+ team = initTextFeld( 100, 1, 150, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, "" );
|
|
|
+ Array< int > *statistik = new Array< int >();
|
|
|
+ infoClient->getSpielStatistik( accountId, infoClient->getSpielId( karteId ), statistik );
|
|
|
+ punkte = initTextFeld( 250, 1, 80, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, "Punkte: " );
|
|
|
+ punkte->zText()->append( statistik->hat( 3 ) ? statistik->get( 3 ) : 0 );
|
|
|
+ spiele = initTextFeld( 330, 1, 80, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, "Spiele: " );
|
|
|
+ spiele->zText()->append( statistik->hat( 0 ) ? statistik->get( 0 ) : 0 );
|
|
|
+ gewonnen = initTextFeld( 410, 1, 90, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, "Gewonnen: " );
|
|
|
+ gewonnen->zText()->append( statistik->hat( 1 ) ? statistik->get( 1 ) : 0 );
|
|
|
+ statistik->release();
|
|
|
+ farbe = initTextFeld( 500, 1, 50, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, "Farbe:" );
|
|
|
+ spielerFarbe = 0;
|
|
|
+ rahmen = new LRahmen();
|
|
|
+ rahmen->setSize( 581, 22 );
|
|
|
+ rahmen->setFarbe( 0xFFFFFFFF );
|
|
|
+ rahmen->setRamenBreite( 1 );
|
|
|
+ teamName = new Text( "" );
|
|
|
+ this->sts = sts;
|
|
|
+ rend = 0;
|
|
|
+ ref = 1;
|
|
|
}
|
|
|
|
|
|
// Destruktor
|
|
|
TeamAuswahlListeSpieler::~TeamAuswahlListeSpieler()
|
|
|
{
|
|
|
- name->release();
|
|
|
- if( accountId == loginClient->getAccountId() )
|
|
|
- teamAuswahl->release();
|
|
|
- else
|
|
|
- team->release();
|
|
|
- punkte->release();
|
|
|
- spiele->release();
|
|
|
- gewonnen->release();
|
|
|
- farbe->release();
|
|
|
- rahmen->release();
|
|
|
- teamName->release();
|
|
|
- sts->release();
|
|
|
+ name->release();
|
|
|
+ if( accountId == loginClient->getAccountId() )
|
|
|
+ teamAuswahl->release();
|
|
|
+ else
|
|
|
+ team->release();
|
|
|
+ punkte->release();
|
|
|
+ spiele->release();
|
|
|
+ gewonnen->release();
|
|
|
+ farbe->release();
|
|
|
+ rahmen->release();
|
|
|
+ teamName->release();
|
|
|
+ sts->release();
|
|
|
}
|
|
|
|
|
|
// nicht constant
|
|
|
void TeamAuswahlListeSpieler::disable()
|
|
|
{
|
|
|
- if( accountId == loginClient->getAccountId() )
|
|
|
- teamAuswahl->removeStyle( AuswahlBox::Style::Erlaubt );
|
|
|
-}
|
|
|
-
|
|
|
-void TeamAuswahlListeSpieler::spielerTeamAuswahlE( AuswahlBox *obj, int p1, int p2 )
|
|
|
-{
|
|
|
- Text *tmpTeamName = obj->zEintragText( p2 );
|
|
|
- if( !tmpTeamName->istGleich( teamName->getText() ) )
|
|
|
- {
|
|
|
- if( tmpTeamName->istGleich( "Zufällig" ) )
|
|
|
- {
|
|
|
- if( !spielClient->spielErstelltTeamWechseln( 0 ) )
|
|
|
- obj->setAuswahl( obj->getEintragPos( teamName->getText() ) );
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- int neuTeam = 0;
|
|
|
- for( int i = 0; i < sts->teamAnzahl; i++ )
|
|
|
- {
|
|
|
- if( sts->teamName->z( i )->istGleich( tmpTeamName->getText() ) )
|
|
|
- {
|
|
|
- neuTeam = i + 1;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if( !spielClient->spielErstelltTeamWechseln( neuTeam ) )
|
|
|
- obj->setAuswahl( obj->getEintragPos( teamName->getText() ) );
|
|
|
- }
|
|
|
- obj->einklappen();
|
|
|
- }
|
|
|
+ if( accountId == loginClient->getAccountId() )
|
|
|
+ teamAuswahl->removeStyle( AuswahlBox::Style::Erlaubt );
|
|
|
+}
|
|
|
+
|
|
|
+void TeamAuswahlListeSpieler::spielerTeamAuswahlE( AuswahlBox * obj, int p1, int p2 )
|
|
|
+{
|
|
|
+ Text *tmpTeamName = obj->zEintragText( p2 );
|
|
|
+ if( !tmpTeamName->istGleich( teamName->getText() ) )
|
|
|
+ {
|
|
|
+ if( tmpTeamName->istGleich( "Zufällig" ) )
|
|
|
+ {
|
|
|
+ if( !spielClient->spielErstelltTeamWechseln( 0 ) )
|
|
|
+ obj->setAuswahl( obj->getEintragPos( teamName->getText() ) );
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ int neuTeam = 0;
|
|
|
+ for( int i = 0; i < sts->teamAnzahl; i++ )
|
|
|
+ {
|
|
|
+ if( sts->teamName->z( i )->istGleich( tmpTeamName->getText() ) )
|
|
|
+ {
|
|
|
+ neuTeam = i + 1;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if( !spielClient->spielErstelltTeamWechseln( neuTeam ) )
|
|
|
+ obj->setAuswahl( obj->getEintragPos( teamName->getText() ) );
|
|
|
+ }
|
|
|
+ obj->einklappen();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
void TeamAuswahlListeSpieler::setFarbe( int farbe )
|
|
|
{
|
|
|
- this->spielerFarbe = farbe;
|
|
|
- if( farbe )
|
|
|
- rahmen->setFarbe( farbe );
|
|
|
- else
|
|
|
- rahmen->setFarbe( 0xFFFFFFFF );
|
|
|
- rend = 1;
|
|
|
-}
|
|
|
-
|
|
|
-void TeamAuswahlListeSpieler::setTeam( Text *zName )
|
|
|
-{
|
|
|
- teamName->setText( zName->getText() );
|
|
|
- rend = 1;
|
|
|
-}
|
|
|
-
|
|
|
-void TeamAuswahlListeSpieler::setTeamErlaubt( Text *zName, bool erlaubt, int teamFarbe )
|
|
|
-{
|
|
|
- if( accountId != loginClient->getAccountId() )
|
|
|
- return;
|
|
|
- if( erlaubt )
|
|
|
- {
|
|
|
- if( teamAuswahl->getEintragPos( zName->getText() ) < 0 )
|
|
|
- {
|
|
|
- int p = teamAuswahl->getEintragAnzahl();
|
|
|
- teamAuswahl->addEintrag( zName->getText() );
|
|
|
- teamAuswahl->setMsStyle( p, AuswahlBox::Style::FeldRahmen | AuswahlBox::Style::MausBuffer | AuswahlBox::Style::AuswahlBuffer | AuswahlBox::Style::FeldBuffer );
|
|
|
- if( teamFarbe )
|
|
|
- teamAuswahl->zEintrag( p )->setRahmenFarbe( teamFarbe );
|
|
|
- teamAuswahl->setMsAuswAlphaFeldFarbe( p, 0x50000000 | ( teamFarbe & 0x00FFFFFF ) );
|
|
|
- teamAuswahl->setMsAuswAlphaFeldStrength( p, -15 );
|
|
|
- teamAuswahl->setMsMausAlphaFeldFarbe( p, 0x10000000 | ( teamFarbe & 0x00FFFFFF ) );
|
|
|
- teamAuswahl->setMsMausAlphaFeldStrength( p, -15 );
|
|
|
- }
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- if( zName->istGleich( teamName->getText() ) )
|
|
|
- return;
|
|
|
- if( teamAuswahl->getEintragPos( zName->getText() ) >= 0 )
|
|
|
- teamAuswahl->removeEintrag( teamAuswahl->getEintragPos( zName->getText() ) );
|
|
|
- }
|
|
|
+ this->spielerFarbe = farbe;
|
|
|
+ if( farbe )
|
|
|
+ rahmen->setFarbe( farbe );
|
|
|
+ else
|
|
|
+ rahmen->setFarbe( 0xFFFFFFFF );
|
|
|
+ rend = 1;
|
|
|
+}
|
|
|
+
|
|
|
+void TeamAuswahlListeSpieler::setTeam( Text * zName )
|
|
|
+{
|
|
|
+ teamName->setText( zName->getText() );
|
|
|
+ rend = 1;
|
|
|
+}
|
|
|
+
|
|
|
+void TeamAuswahlListeSpieler::setTeamErlaubt( Text * zName, bool erlaubt, int teamFarbe )
|
|
|
+{
|
|
|
+ if( accountId != loginClient->getAccountId() )
|
|
|
+ return;
|
|
|
+ if( erlaubt )
|
|
|
+ {
|
|
|
+ if( teamAuswahl->getEintragPos( zName->getText() ) < 0 )
|
|
|
+ {
|
|
|
+ int p = teamAuswahl->getEintragAnzahl();
|
|
|
+ teamAuswahl->addEintrag( zName->getText() );
|
|
|
+ teamAuswahl->setMsStyle( p, AuswahlBox::Style::FeldRahmen | AuswahlBox::Style::MausBuffer | AuswahlBox::Style::AuswahlBuffer | AuswahlBox::Style::FeldBuffer );
|
|
|
+ if( teamFarbe )
|
|
|
+ teamAuswahl->zEintrag( p )->setRahmenFarbe( teamFarbe );
|
|
|
+ teamAuswahl->setMsAuswAlphaFeldFarbe( p, 0x50000000 | ( teamFarbe & 0x00FFFFFF ) );
|
|
|
+ teamAuswahl->setMsAuswAlphaFeldStrength( p, -15 );
|
|
|
+ teamAuswahl->setMsMausAlphaFeldFarbe( p, 0x10000000 | ( teamFarbe & 0x00FFFFFF ) );
|
|
|
+ teamAuswahl->setMsMausAlphaFeldStrength( p, -15 );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if( zName->istGleich( teamName->getText() ) )
|
|
|
+ return;
|
|
|
+ if( teamAuswahl->getEintragPos( zName->getText() ) >= 0 )
|
|
|
+ teamAuswahl->removeEintrag( teamAuswahl->getEintragPos( zName->getText() ) );
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
bool TeamAuswahlListeSpieler::tick( double tickVal )
|
|
|
{
|
|
|
- if( accountId == loginClient->getAccountId() )
|
|
|
- rend |= teamAuswahl->tick( tickVal );
|
|
|
- else if( !team->zText()->istGleich( teamName->getText() ) )
|
|
|
- {
|
|
|
- team->setText( "" );
|
|
|
- team->zText()->append( teamName->getText() );
|
|
|
- }
|
|
|
- bool ret = rend;
|
|
|
- rend = 0;
|
|
|
- return ret;
|
|
|
+ if( accountId == loginClient->getAccountId() )
|
|
|
+ rend |= teamAuswahl->tick( tickVal );
|
|
|
+ else if( !team->zText()->istGleich( teamName->getText() ) )
|
|
|
+ {
|
|
|
+ team->setText( "" );
|
|
|
+ team->zText()->append( teamName->getText() );
|
|
|
+ }
|
|
|
+ bool ret = rend;
|
|
|
+ rend = 0;
|
|
|
+ return ret;
|
|
|
}
|
|
|
|
|
|
-void TeamAuswahlListeSpieler::doMausEreignis( MausEreignis &me )
|
|
|
+void TeamAuswahlListeSpieler::doMausEreignis( MausEreignis & me )
|
|
|
{
|
|
|
- if( accountId == loginClient->getAccountId() )
|
|
|
- teamAuswahl->doMausEreignis( me );
|
|
|
+ if( accountId == loginClient->getAccountId() )
|
|
|
+ teamAuswahl->doMausEreignis( me );
|
|
|
}
|
|
|
|
|
|
-void TeamAuswahlListeSpieler::render( int yOff, Bild &zRObj )
|
|
|
+void TeamAuswahlListeSpieler::render( int yOff, Bild & zRObj )
|
|
|
{
|
|
|
- if( !zRObj.setDrawOptions( 0, yOff, 581, 22 ) )
|
|
|
- return;
|
|
|
- rahmen->render( zRObj );
|
|
|
- name->render( zRObj );
|
|
|
- if( loginClient->getAccountId() == accountId )
|
|
|
- teamAuswahl->render( zRObj );
|
|
|
- else
|
|
|
- team->render( zRObj );
|
|
|
- punkte->render( zRObj );
|
|
|
- spiele->render( zRObj );
|
|
|
- gewonnen->render( zRObj );
|
|
|
- farbe->render( zRObj );
|
|
|
- zRObj.alphaRegion( 550, 2, 18, 18, spielerFarbe );
|
|
|
- zRObj.releaseDrawOptions();
|
|
|
+ if( !zRObj.setDrawOptions( 0, yOff, 581, 22 ) )
|
|
|
+ return;
|
|
|
+ rahmen->render( zRObj );
|
|
|
+ name->render( zRObj );
|
|
|
+ if( loginClient->getAccountId() == accountId )
|
|
|
+ teamAuswahl->render( zRObj );
|
|
|
+ else
|
|
|
+ team->render( zRObj );
|
|
|
+ punkte->render( zRObj );
|
|
|
+ spiele->render( zRObj );
|
|
|
+ gewonnen->render( zRObj );
|
|
|
+ farbe->render( zRObj );
|
|
|
+ zRObj.alphaRegion( 550, 2, 18, 18, spielerFarbe );
|
|
|
+ zRObj.releaseDrawOptions();
|
|
|
}
|
|
|
|
|
|
// constant
|
|
|
int TeamAuswahlListeSpieler::getAccountId() const
|
|
|
{
|
|
|
- return accountId;
|
|
|
+ return accountId;
|
|
|
}
|
|
|
|
|
|
// Reference Counting
|
|
|
TeamAuswahlListeSpieler *TeamAuswahlListeSpieler::getThis()
|
|
|
{
|
|
|
- ref++;
|
|
|
- return this;
|
|
|
+ ref++;
|
|
|
+ return this;
|
|
|
}
|
|
|
|
|
|
TeamAuswahlListeSpieler *TeamAuswahlListeSpieler::release()
|
|
|
{
|
|
|
- ref--;
|
|
|
- if( !ref )
|
|
|
- delete this;
|
|
|
- return 0;
|
|
|
+ ref--;
|
|
|
+ if( !ref )
|
|
|
+ delete this;
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
// Inhalt der TeamAuswahlListeTeam Klasse aus TeamAuswahl.h
|
|
|
// Konstruktor
|
|
|
-TeamAuswahlListeTeam::TeamAuswahlListeTeam( Schrift *zSchrift )
|
|
|
-{
|
|
|
- maxSpieler = 0;
|
|
|
- jetztSpieler = 0;
|
|
|
- team = 0;
|
|
|
- name = initTextFeld( 0, 0, 300, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, "Team: " );
|
|
|
- mjSpieler = initTextFeld( 300, 0, 150, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, "Spieler: 0/0" );
|
|
|
- farbe = initTextFeld( 450, 0, 100, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, "Team Farbe:" );
|
|
|
- teamFarbe = 0;
|
|
|
- spieler = new RCArray< TeamAuswahlListeSpieler >();
|
|
|
- rahmen = new LRahmen();
|
|
|
- rahmen->setSize( 583, 22 );
|
|
|
- rahmen->setFarbe( 0xFFFFFFFF );
|
|
|
- rahmen->setRamenBreite( 1 );
|
|
|
- titelAf = new AlphaFeld();
|
|
|
- titelAf->setPosition( 1, 1 );
|
|
|
- titelAf->setSize( 581, 20 );
|
|
|
- titelAf->setFarbe( 0x1000FF00 );
|
|
|
- titelAf->setStrength( -15 );
|
|
|
- teamName = new Text( "" );
|
|
|
- tickVal = 0;
|
|
|
- höhe = 22;
|
|
|
- rend = 0;
|
|
|
- ref = 1;
|
|
|
+TeamAuswahlListeTeam::TeamAuswahlListeTeam( Schrift * zSchrift )
|
|
|
+{
|
|
|
+ maxSpieler = 0;
|
|
|
+ jetztSpieler = 0;
|
|
|
+ team = 0;
|
|
|
+ name = initTextFeld( 0, 0, 300, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, "Team: " );
|
|
|
+ mjSpieler = initTextFeld( 300, 0, 150, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, "Spieler: 0/0" );
|
|
|
+ farbe = initTextFeld( 450, 0, 100, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, "Team Farbe:" );
|
|
|
+ teamFarbe = 0;
|
|
|
+ spieler = new RCArray< TeamAuswahlListeSpieler >();
|
|
|
+ rahmen = new LRahmen();
|
|
|
+ rahmen->setSize( 583, 22 );
|
|
|
+ rahmen->setFarbe( 0xFFFFFFFF );
|
|
|
+ rahmen->setRamenBreite( 1 );
|
|
|
+ titelAf = new AlphaFeld();
|
|
|
+ titelAf->setPosition( 1, 1 );
|
|
|
+ titelAf->setSize( 581, 20 );
|
|
|
+ titelAf->setFarbe( 0x1000FF00 );
|
|
|
+ titelAf->setStrength( -15 );
|
|
|
+ teamName = new Text( "" );
|
|
|
+ tickVal = 0;
|
|
|
+ höhe = 22;
|
|
|
+ rend = 0;
|
|
|
+ ref = 1;
|
|
|
}
|
|
|
|
|
|
// Destruktor
|
|
|
TeamAuswahlListeTeam::~TeamAuswahlListeTeam()
|
|
|
{
|
|
|
- name->release();
|
|
|
- mjSpieler->release();
|
|
|
- farbe->release();
|
|
|
- spieler->release();
|
|
|
- rahmen->release();
|
|
|
- titelAf->release();
|
|
|
- teamName->release();
|
|
|
+ name->release();
|
|
|
+ mjSpieler->release();
|
|
|
+ farbe->release();
|
|
|
+ spieler->release();
|
|
|
+ rahmen->release();
|
|
|
+ titelAf->release();
|
|
|
+ teamName->release();
|
|
|
}
|
|
|
|
|
|
// nicht constant
|
|
|
void TeamAuswahlListeTeam::disable()
|
|
|
{
|
|
|
- for( int i = 0; i < jetztSpieler; i++ )
|
|
|
- spieler->z( i )->disable();
|
|
|
+ for( int i = 0; i < jetztSpieler; i++ )
|
|
|
+ spieler->z( i )->disable();
|
|
|
}
|
|
|
|
|
|
void TeamAuswahlListeTeam::setMaxSpieler( int maxSpieler )
|
|
|
{
|
|
|
- this->maxSpieler = maxSpieler;
|
|
|
- rend = 1;
|
|
|
+ this->maxSpieler = maxSpieler;
|
|
|
+ rend = 1;
|
|
|
}
|
|
|
|
|
|
-void TeamAuswahlListeTeam::setName( Text *name )
|
|
|
+void TeamAuswahlListeTeam::setName( Text * name )
|
|
|
{
|
|
|
- teamName->setText( name->getText() );
|
|
|
- name->release();
|
|
|
- rend = 1;
|
|
|
+ teamName->setText( name->getText() );
|
|
|
+ name->release();
|
|
|
+ rend = 1;
|
|
|
}
|
|
|
|
|
|
void TeamAuswahlListeTeam::setFarbe( int farbe )
|
|
|
{
|
|
|
- teamFarbe = farbe;
|
|
|
- rahmen->setFarbe( teamFarbe );
|
|
|
- rend = 1;
|
|
|
+ teamFarbe = farbe;
|
|
|
+ rahmen->setFarbe( teamFarbe );
|
|
|
+ rend = 1;
|
|
|
}
|
|
|
|
|
|
void TeamAuswahlListeTeam::setTeam( int team )
|
|
|
{
|
|
|
- this->team = team;
|
|
|
- rend = 1;
|
|
|
+ this->team = team;
|
|
|
+ rend = 1;
|
|
|
}
|
|
|
|
|
|
-void TeamAuswahlListeTeam::addSpieler( TeamAuswahlListeSpieler *spieler )
|
|
|
+void TeamAuswahlListeTeam::addSpieler( TeamAuswahlListeSpieler * spieler )
|
|
|
{
|
|
|
- if( !jetztSpieler )
|
|
|
- höhe++;
|
|
|
- spieler->setTeam( teamName );
|
|
|
- höhe += 22;
|
|
|
- this->spieler->set( spieler, jetztSpieler );
|
|
|
- jetztSpieler++;
|
|
|
- rend = 1;
|
|
|
+ if( !jetztSpieler )
|
|
|
+ höhe++;
|
|
|
+ spieler->setTeam( teamName );
|
|
|
+ höhe += 22;
|
|
|
+ this->spieler->set( spieler, jetztSpieler );
|
|
|
+ jetztSpieler++;
|
|
|
+ rend = 1;
|
|
|
}
|
|
|
|
|
|
void TeamAuswahlListeTeam::removeSpieler( int accountId )
|
|
|
{
|
|
|
- höhe -= 22;
|
|
|
- for( int i = 0; i < jetztSpieler; i++ )
|
|
|
- {
|
|
|
- if( spieler->z( i )->getAccountId() == accountId )
|
|
|
- {
|
|
|
- jetztSpieler--;
|
|
|
- spieler->remove( i );
|
|
|
- rend = 1;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- if( !jetztSpieler )
|
|
|
- höhe = 22;
|
|
|
+ höhe -= 22;
|
|
|
+ for( int i = 0; i < jetztSpieler; i++ )
|
|
|
+ {
|
|
|
+ if( spieler->z( i )->getAccountId() == accountId )
|
|
|
+ {
|
|
|
+ jetztSpieler--;
|
|
|
+ spieler->remove( i );
|
|
|
+ rend = 1;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if( !jetztSpieler )
|
|
|
+ höhe = 22;
|
|
|
}
|
|
|
|
|
|
-void TeamAuswahlListeTeam::setTeamErlaubt( Text *zName, bool erlaubt, int teamFarbe )
|
|
|
+void TeamAuswahlListeTeam::setTeamErlaubt( Text * zName, bool erlaubt, int teamFarbe )
|
|
|
{
|
|
|
- for( int i = 0; i < jetztSpieler; i++ )
|
|
|
- spieler->z( i )->setTeamErlaubt( zName, erlaubt, teamFarbe );
|
|
|
+ for( int i = 0; i < jetztSpieler; i++ )
|
|
|
+ spieler->z( i )->setTeamErlaubt( zName, erlaubt, teamFarbe );
|
|
|
}
|
|
|
|
|
|
bool TeamAuswahlListeTeam::tick( double tickVal )
|
|
|
{
|
|
|
- this->tickVal += tickVal * 50;
|
|
|
- int val = ( int )this->tickVal;
|
|
|
- if( val > 2 )
|
|
|
- val = 2;
|
|
|
- this->tickVal -= val;
|
|
|
- if( val )
|
|
|
- {
|
|
|
- if( rahmen->getHeight() > höhe )
|
|
|
- {
|
|
|
- rahmen->setSize( rahmen->getBreite(), rahmen->getHeight() - val );
|
|
|
- if( rahmen->getHeight() < höhe )
|
|
|
- rahmen->setSize( rahmen->getBreite(), höhe );
|
|
|
- rend = 1;
|
|
|
- }
|
|
|
- if( rahmen->getHeight() < höhe )
|
|
|
- {
|
|
|
- rahmen->setSize( rahmen->getBreite(), rahmen->getHeight() + val );
|
|
|
- if( rahmen->getHeight() > höhe )
|
|
|
- rahmen->setSize( rahmen->getBreite(), höhe );
|
|
|
- rend = 1;
|
|
|
- }
|
|
|
- }
|
|
|
- name->setText( "Team: " );
|
|
|
- name->zText()->append( teamName->getText() );
|
|
|
- mjSpieler->setText( "Spieler: " );
|
|
|
- mjSpieler->zText()->append( jetztSpieler );
|
|
|
- mjSpieler->zText()->append( "/" );
|
|
|
- mjSpieler->zText()->append( maxSpieler );
|
|
|
- for( int i = 0; i < jetztSpieler; i++ )
|
|
|
- rend |= spieler->z( i )->tick( tickVal );
|
|
|
- bool ret = rend;
|
|
|
- rend = 0;
|
|
|
- return ret;
|
|
|
-}
|
|
|
-
|
|
|
-void TeamAuswahlListeTeam::doMausEreignis( MausEreignis &me )
|
|
|
-{
|
|
|
- int tmpX = me.mx;
|
|
|
- int tmpY = me.my;
|
|
|
- me.mx--;
|
|
|
- me.my -= 22;
|
|
|
- for( int i = 0; i < jetztSpieler; i++ )
|
|
|
- {
|
|
|
- spieler->z( i )->doMausEreignis( me );
|
|
|
- me.my -= 22;
|
|
|
- }
|
|
|
- me.mx = tmpX;
|
|
|
- me.my = tmpY;
|
|
|
-}
|
|
|
-
|
|
|
-void TeamAuswahlListeTeam::render( int yOff, Bild &zRObj )
|
|
|
-{
|
|
|
- if( !zRObj.setDrawOptions( 50, yOff, 583, rahmen->getHeight() + 1 ) )
|
|
|
- return;
|
|
|
- rahmen->render( zRObj );
|
|
|
- titelAf->setPosition( 1, 1 );
|
|
|
- titelAf->render( zRObj );
|
|
|
- name->render( zRObj );
|
|
|
- mjSpieler->render( zRObj );
|
|
|
- farbe->render( zRObj );
|
|
|
- zRObj.alphaRegion( 550, 2, 18, 18, teamFarbe );
|
|
|
- zRObj.drawLinieH( 1, 21, 581, rahmen->getFarbe() );
|
|
|
- if( !zRObj.setDrawOptions( 1, 22, 582, rahmen->getHeight() ) )
|
|
|
- {
|
|
|
- zRObj.releaseDrawOptions();
|
|
|
- return;
|
|
|
- }
|
|
|
- int y = 22 * ( jetztSpieler - 1 );
|
|
|
- for( int i = jetztSpieler - 1; i >= 0; i-- )
|
|
|
- {
|
|
|
- spieler->z( i )->render( y, zRObj );
|
|
|
- y -= 22;
|
|
|
- }
|
|
|
- zRObj.releaseDrawOptions();
|
|
|
- zRObj.releaseDrawOptions();
|
|
|
+ this->tickVal += tickVal * 50;
|
|
|
+ int val = (int)this->tickVal;
|
|
|
+ if( val > 2 )
|
|
|
+ val = 2;
|
|
|
+ this->tickVal -= val;
|
|
|
+ if( val )
|
|
|
+ {
|
|
|
+ if( rahmen->getHeight() > höhe )
|
|
|
+ {
|
|
|
+ rahmen->setSize( rahmen->getBreite(), rahmen->getHeight() - val );
|
|
|
+ if( rahmen->getHeight() < höhe )
|
|
|
+ rahmen->setSize( rahmen->getBreite(), höhe );
|
|
|
+ rend = 1;
|
|
|
+ }
|
|
|
+ if( rahmen->getHeight() < höhe )
|
|
|
+ {
|
|
|
+ rahmen->setSize( rahmen->getBreite(), rahmen->getHeight() + val );
|
|
|
+ if( rahmen->getHeight() > höhe )
|
|
|
+ rahmen->setSize( rahmen->getBreite(), höhe );
|
|
|
+ rend = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ name->setText( "Team: " );
|
|
|
+ name->zText()->append( teamName->getText() );
|
|
|
+ mjSpieler->setText( "Spieler: " );
|
|
|
+ mjSpieler->zText()->append( jetztSpieler );
|
|
|
+ mjSpieler->zText()->append( "/" );
|
|
|
+ mjSpieler->zText()->append( maxSpieler );
|
|
|
+ for( int i = 0; i < jetztSpieler; i++ )
|
|
|
+ rend |= spieler->z( i )->tick( tickVal );
|
|
|
+ bool ret = rend;
|
|
|
+ rend = 0;
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
+void TeamAuswahlListeTeam::doMausEreignis( MausEreignis & me )
|
|
|
+{
|
|
|
+ int tmpX = me.mx;
|
|
|
+ int tmpY = me.my;
|
|
|
+ me.mx--;
|
|
|
+ me.my -= 22;
|
|
|
+ for( int i = 0; i < jetztSpieler; i++ )
|
|
|
+ {
|
|
|
+ spieler->z( i )->doMausEreignis( me );
|
|
|
+ me.my -= 22;
|
|
|
+ }
|
|
|
+ me.mx = tmpX;
|
|
|
+ me.my = tmpY;
|
|
|
+}
|
|
|
+
|
|
|
+void TeamAuswahlListeTeam::render( int yOff, Bild & zRObj )
|
|
|
+{
|
|
|
+ if( !zRObj.setDrawOptions( 50, yOff, 583, rahmen->getHeight() + 1 ) )
|
|
|
+ return;
|
|
|
+ rahmen->render( zRObj );
|
|
|
+ titelAf->setPosition( 1, 1 );
|
|
|
+ titelAf->render( zRObj );
|
|
|
+ name->render( zRObj );
|
|
|
+ mjSpieler->render( zRObj );
|
|
|
+ farbe->render( zRObj );
|
|
|
+ zRObj.alphaRegion( 550, 2, 18, 18, teamFarbe );
|
|
|
+ zRObj.drawLinieH( 1, 21, 581, rahmen->getFarbe() );
|
|
|
+ if( !zRObj.setDrawOptions( 1, 22, 582, rahmen->getHeight() ) )
|
|
|
+ {
|
|
|
+ zRObj.releaseDrawOptions();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ int y = 22 * ( jetztSpieler - 1 );
|
|
|
+ for( int i = jetztSpieler - 1; i >= 0; i-- )
|
|
|
+ {
|
|
|
+ spieler->z( i )->render( y, zRObj );
|
|
|
+ y -= 22;
|
|
|
+ }
|
|
|
+ zRObj.releaseDrawOptions();
|
|
|
+ zRObj.releaseDrawOptions();
|
|
|
}
|
|
|
|
|
|
// constant
|
|
|
int TeamAuswahlListeTeam::getTeamNummer() const
|
|
|
{
|
|
|
- return team;
|
|
|
+ return team;
|
|
|
}
|
|
|
|
|
|
int TeamAuswahlListeTeam::getHeight() const
|
|
|
{
|
|
|
- return rahmen->getHeight() + 1;
|
|
|
+ return rahmen->getHeight() + 1;
|
|
|
}
|
|
|
|
|
|
bool TeamAuswahlListeTeam::istPlatzFrei() const
|
|
|
{
|
|
|
- return jetztSpieler < maxSpieler;
|
|
|
+ return jetztSpieler < maxSpieler;
|
|
|
}
|
|
|
|
|
|
int TeamAuswahlListeTeam::getMaxSpieler() const
|
|
|
{
|
|
|
- return maxSpieler;
|
|
|
+ return maxSpieler;
|
|
|
}
|
|
|
|
|
|
Text *TeamAuswahlListeTeam::zName() const
|
|
|
{
|
|
|
- return teamName;
|
|
|
+ return teamName;
|
|
|
}
|
|
|
|
|
|
TeamAuswahlListeSpieler *TeamAuswahlListeTeam::getSpielerDaten( int accountId ) const
|
|
|
{
|
|
|
- for( int i = 0; i < jetztSpieler; i++ )
|
|
|
- {
|
|
|
- if( spieler->z( i )->getAccountId() == accountId )
|
|
|
- return spieler->get( i );
|
|
|
- }
|
|
|
- return 0;
|
|
|
+ for( int i = 0; i < jetztSpieler; i++ )
|
|
|
+ {
|
|
|
+ if( spieler->z( i )->getAccountId() == accountId )
|
|
|
+ return spieler->get( i );
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
TeamAuswahlListeSpieler *TeamAuswahlListeTeam::zSpielerDaten( int accountId ) const
|
|
|
{
|
|
|
- for( int i = 0; i < jetztSpieler; i++ )
|
|
|
- {
|
|
|
- if( spieler->z( i )->getAccountId() == accountId )
|
|
|
- return spieler->z( i );
|
|
|
- }
|
|
|
- return 0;
|
|
|
+ for( int i = 0; i < jetztSpieler; i++ )
|
|
|
+ {
|
|
|
+ if( spieler->z( i )->getAccountId() == accountId )
|
|
|
+ return spieler->z( i );
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
// Reference Counting
|
|
|
TeamAuswahlListeTeam *TeamAuswahlListeTeam::getThis()
|
|
|
{
|
|
|
- ref++;
|
|
|
- return this;
|
|
|
+ ref++;
|
|
|
+ return this;
|
|
|
}
|
|
|
|
|
|
TeamAuswahlListeTeam *TeamAuswahlListeTeam::release()
|
|
|
{
|
|
|
- ref--;
|
|
|
- if( !ref )
|
|
|
- delete this;
|
|
|
- return 0;
|
|
|
+ ref--;
|
|
|
+ if( !ref )
|
|
|
+ delete this;
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
// Inhalt der TeamAuswahlListe Klasse aus TeamAuswahl.h
|
|
|
// Konstruktor
|
|
|
-TeamAuswahlListe::TeamAuswahlListe( Schrift *zSchrift, SpielerTeamStruktur *sts, int karteId )
|
|
|
-{
|
|
|
- rahmen = new LRahmen();
|
|
|
- rahmen->setSize( 698, 398 );
|
|
|
- rahmen->setFarbe( 0xFFFFFFFF );
|
|
|
- rahmen->setRamenBreite( 1 );
|
|
|
- scroll = new VScrollBar();
|
|
|
- scroll->update( 0, 396 );
|
|
|
- scroll->setKlickScroll( 7 );
|
|
|
- teams = new RCArray< TeamAuswahlListeTeam >();
|
|
|
- TeamAuswahlListeTeam *zufall = new TeamAuswahlListeTeam( zSchrift );
|
|
|
- zufall->setTeam( 0 );
|
|
|
- zufall->setName( new Text( "Zufällig" ) );
|
|
|
- zufall->setMaxSpieler( sts->spielerAnzahl );
|
|
|
- teams->set( zufall, 0 );
|
|
|
- for( int i = 0; i < sts->teamAnzahl; i++ )
|
|
|
- {
|
|
|
- TeamAuswahlListeTeam *tmp = new TeamAuswahlListeTeam( zSchrift );
|
|
|
- tmp->setTeam( i );
|
|
|
- tmp->setName( sts->teamName->get( i ) );
|
|
|
- tmp->setFarbe( sts->teamFarbe->hat( i ) ? sts->teamFarbe->get( i ) : 0 );
|
|
|
- tmp->setMaxSpieler( sts->teamSize->hat( i ) ? sts->teamSize->get( i ) : 0 );
|
|
|
- teams->set( tmp, i + 1 );
|
|
|
- }
|
|
|
- teamAnzahl = 1 + sts->teamAnzahl;
|
|
|
- schrift = zSchrift->getThis();
|
|
|
- this->karteId = karteId;
|
|
|
- this->sts = sts;
|
|
|
- rend = 0;
|
|
|
- ref = 1;
|
|
|
+TeamAuswahlListe::TeamAuswahlListe( Schrift * zSchrift, SpielerTeamStruktur * sts, int karteId )
|
|
|
+{
|
|
|
+ rahmen = new LRahmen();
|
|
|
+ rahmen->setSize( 698, 398 );
|
|
|
+ rahmen->setFarbe( 0xFFFFFFFF );
|
|
|
+ rahmen->setRamenBreite( 1 );
|
|
|
+ scroll = new VScrollBar();
|
|
|
+ scroll->update( 0, 396 );
|
|
|
+ scroll->setKlickScroll( 7 );
|
|
|
+ teams = new RCArray< TeamAuswahlListeTeam >();
|
|
|
+ TeamAuswahlListeTeam *zufall = new TeamAuswahlListeTeam( zSchrift );
|
|
|
+ zufall->setTeam( 0 );
|
|
|
+ zufall->setName( new Text( "Zufällig" ) );
|
|
|
+ zufall->setMaxSpieler( sts->spielerAnzahl );
|
|
|
+ teams->set( zufall, 0 );
|
|
|
+ for( int i = 0; i < sts->teamAnzahl; i++ )
|
|
|
+ {
|
|
|
+ TeamAuswahlListeTeam *tmp = new TeamAuswahlListeTeam( zSchrift );
|
|
|
+ tmp->setTeam( i );
|
|
|
+ tmp->setName( sts->teamName->get( i ) );
|
|
|
+ tmp->setFarbe( sts->teamFarbe->hat( i ) ? sts->teamFarbe->get( i ) : 0 );
|
|
|
+ tmp->setMaxSpieler( sts->teamSize->hat( i ) ? sts->teamSize->get( i ) : 0 );
|
|
|
+ teams->set( tmp, i + 1 );
|
|
|
+ }
|
|
|
+ teamAnzahl = 1 + sts->teamAnzahl;
|
|
|
+ schrift = zSchrift->getThis();
|
|
|
+ this->karteId = karteId;
|
|
|
+ this->sts = sts;
|
|
|
+ rend = 0;
|
|
|
+ ref = 1;
|
|
|
}
|
|
|
|
|
|
// Destruktor
|
|
|
TeamAuswahlListe::~TeamAuswahlListe()
|
|
|
{
|
|
|
- rahmen->release();
|
|
|
- scroll->release();
|
|
|
- teams->release();
|
|
|
- schrift->release();
|
|
|
- sts->release();
|
|
|
+ rahmen->release();
|
|
|
+ scroll->release();
|
|
|
+ teams->release();
|
|
|
+ schrift->release();
|
|
|
+ sts->release();
|
|
|
}
|
|
|
|
|
|
// nicht constant
|
|
|
void TeamAuswahlListe::disable()
|
|
|
{
|
|
|
- for( int i = 0; i < teamAnzahl; i++ )
|
|
|
- teams->z( i )->disable();
|
|
|
+ for( int i = 0; i < teamAnzahl; i++ )
|
|
|
+ teams->z( i )->disable();
|
|
|
}
|
|
|
|
|
|
void TeamAuswahlListe::setTeamVonSpieler( int accountId, int spielerNummer )
|
|
|
{
|
|
|
- if( spielerNummer == 0 )
|
|
|
- {
|
|
|
- int neuTeam = 0;
|
|
|
- int altTeam = 0;
|
|
|
- for( int j = 0; j < teamAnzahl; j++ )
|
|
|
- {
|
|
|
- if( teams->z( j )->zSpielerDaten( accountId ) )
|
|
|
- {
|
|
|
- altTeam = j;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- TeamAuswahlListeSpieler *tmp = teams->z( altTeam )->getSpielerDaten( accountId );
|
|
|
- teams->z( altTeam )->removeSpieler( accountId );
|
|
|
- tmp->setFarbe( 0 );
|
|
|
- teams->z( neuTeam )->addSpieler( tmp );
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- int team = 0;
|
|
|
- int max = 0;
|
|
|
- int min = 0;
|
|
|
- for( int i = 0; i < sts->teamAnzahl; i++ )
|
|
|
- {
|
|
|
- min = max;
|
|
|
- max += sts->teamSize->get( i );
|
|
|
- if( spielerNummer - 1 >= min && spielerNummer - 1 < max )
|
|
|
- {
|
|
|
- int neuTeam = i + 1;
|
|
|
- int altTeam = 0;
|
|
|
- for( int j = 0; j < teamAnzahl; j++ )
|
|
|
- {
|
|
|
- if( teams->z( j )->zSpielerDaten( accountId ) )
|
|
|
- {
|
|
|
- altTeam = j;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- TeamAuswahlListeSpieler *tmp = teams->z( altTeam )->getSpielerDaten( accountId );
|
|
|
- teams->z( altTeam )->removeSpieler( accountId );
|
|
|
- tmp->setFarbe( sts->spielerFarbe->hat( spielerNummer - 1 ) ? sts->spielerFarbe->get( spielerNummer - 1 ) : 0 );
|
|
|
- teams->z( neuTeam )->addSpieler( tmp );
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- for( int i = 0; i < teamAnzahl; i++ )
|
|
|
- {
|
|
|
- for( int j = 0; j < teamAnzahl; j++ )
|
|
|
- {
|
|
|
- if( i == 0 )
|
|
|
- teams->z( j )->setTeamErlaubt( teams->z( i )->zName(), teams->z( i )->istPlatzFrei(), 0 );
|
|
|
- else
|
|
|
- teams->z( j )->setTeamErlaubt( teams->z( i )->zName(), teams->z( i )->istPlatzFrei(), sts->teamFarbe->hat( i - 1 ) ? sts->teamFarbe->get( i - 1 ) : 0 );
|
|
|
- }
|
|
|
- }
|
|
|
- rend = 1;
|
|
|
+ if( spielerNummer == 0 )
|
|
|
+ {
|
|
|
+ int neuTeam = 0;
|
|
|
+ int altTeam = 0;
|
|
|
+ for( int j = 0; j < teamAnzahl; j++ )
|
|
|
+ {
|
|
|
+ if( teams->z( j )->zSpielerDaten( accountId ) )
|
|
|
+ {
|
|
|
+ altTeam = j;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ TeamAuswahlListeSpieler *tmp = teams->z( altTeam )->getSpielerDaten( accountId );
|
|
|
+ teams->z( altTeam )->removeSpieler( accountId );
|
|
|
+ tmp->setFarbe( 0 );
|
|
|
+ teams->z( neuTeam )->addSpieler( tmp );
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ int team = 0;
|
|
|
+ int max = 0;
|
|
|
+ int min = 0;
|
|
|
+ for( int i = 0; i < sts->teamAnzahl; i++ )
|
|
|
+ {
|
|
|
+ min = max;
|
|
|
+ max += sts->teamSize->get( i );
|
|
|
+ if( spielerNummer - 1 >= min && spielerNummer - 1 < max )
|
|
|
+ {
|
|
|
+ int neuTeam = i + 1;
|
|
|
+ int altTeam = 0;
|
|
|
+ for( int j = 0; j < teamAnzahl; j++ )
|
|
|
+ {
|
|
|
+ if( teams->z( j )->zSpielerDaten( accountId ) )
|
|
|
+ {
|
|
|
+ altTeam = j;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ TeamAuswahlListeSpieler *tmp = teams->z( altTeam )->getSpielerDaten( accountId );
|
|
|
+ teams->z( altTeam )->removeSpieler( accountId );
|
|
|
+ tmp->setFarbe( sts->spielerFarbe->hat( spielerNummer - 1 ) ? sts->spielerFarbe->get( spielerNummer - 1 ) : 0 );
|
|
|
+ teams->z( neuTeam )->addSpieler( tmp );
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for( int i = 0; i < teamAnzahl; i++ )
|
|
|
+ {
|
|
|
+ for( int j = 0; j < teamAnzahl; j++ )
|
|
|
+ {
|
|
|
+ if( i == 0 )
|
|
|
+ teams->z( j )->setTeamErlaubt( teams->z( i )->zName(), teams->z( i )->istPlatzFrei(), 0 );
|
|
|
+ else
|
|
|
+ teams->z( j )->setTeamErlaubt( teams->z( i )->zName(), teams->z( i )->istPlatzFrei(), sts->teamFarbe->hat( i - 1 ) ? sts->teamFarbe->get( i - 1 ) : 0 );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ rend = 1;
|
|
|
}
|
|
|
|
|
|
void TeamAuswahlListe::addSpieler( int accountId )
|
|
|
{
|
|
|
- TeamAuswahlListeSpieler *tmp = new TeamAuswahlListeSpieler( sts->getThis(), schrift, accountId, karteId );
|
|
|
- for( int i = 0; i < teamAnzahl; i++ )
|
|
|
- {
|
|
|
- if( teams->z( i )->istPlatzFrei() )
|
|
|
- {
|
|
|
- if( i == 0 )
|
|
|
- tmp->setTeamErlaubt( teams->z( i )->zName(), 1, 0 );
|
|
|
- else
|
|
|
- tmp->setTeamErlaubt( teams->z( i )->zName(), 1, sts->teamFarbe->hat( i - 1 ) ? sts->teamFarbe->get( i - 1 ) : 0 );
|
|
|
- }
|
|
|
- }
|
|
|
- teams->z( 0 )->addSpieler( tmp );
|
|
|
- for( int i = 0; i < teamAnzahl; i++ )
|
|
|
- teams->z( i )->setTeamErlaubt( teams->z( 0 )->zName(), teams->z( 0 )->istPlatzFrei(), 0 );
|
|
|
- rend = 1;
|
|
|
+ TeamAuswahlListeSpieler *tmp = new TeamAuswahlListeSpieler( sts->getThis(), schrift, accountId, karteId );
|
|
|
+ for( int i = 0; i < teamAnzahl; i++ )
|
|
|
+ {
|
|
|
+ if( teams->z( i )->istPlatzFrei() )
|
|
|
+ {
|
|
|
+ if( i == 0 )
|
|
|
+ tmp->setTeamErlaubt( teams->z( i )->zName(), 1, 0 );
|
|
|
+ else
|
|
|
+ tmp->setTeamErlaubt( teams->z( i )->zName(), 1, sts->teamFarbe->hat( i - 1 ) ? sts->teamFarbe->get( i - 1 ) : 0 );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ teams->z( 0 )->addSpieler( tmp );
|
|
|
+ for( int i = 0; i < teamAnzahl; i++ )
|
|
|
+ teams->z( i )->setTeamErlaubt( teams->z( 0 )->zName(), teams->z( 0 )->istPlatzFrei(), 0 );
|
|
|
+ rend = 1;
|
|
|
}
|
|
|
|
|
|
void TeamAuswahlListe::removeSpieler( int accountId )
|
|
|
{
|
|
|
- for( int i = 0; i < teamAnzahl; i++ )
|
|
|
- {
|
|
|
- if( teams->z( i )->zSpielerDaten( accountId ) )
|
|
|
- teams->z( i )->removeSpieler( accountId );
|
|
|
- }
|
|
|
- for( int i = 0; i < teamAnzahl; i++ )
|
|
|
- {
|
|
|
- for( int j = 0; j < teamAnzahl; j++ )
|
|
|
- {
|
|
|
- if( i == 0 )
|
|
|
- teams->z( j )->setTeamErlaubt( teams->z( i )->zName(), teams->z( i )->istPlatzFrei(), 0 );
|
|
|
- else
|
|
|
- teams->z( j )->setTeamErlaubt( teams->z( i )->zName(), teams->z( i )->istPlatzFrei(), sts->teamFarbe->hat( i - 1 ) ? sts->teamFarbe->get( i - 1 ) : 0 );
|
|
|
- }
|
|
|
- }
|
|
|
- rend = 1;
|
|
|
+ for( int i = 0; i < teamAnzahl; i++ )
|
|
|
+ {
|
|
|
+ if( teams->z( i )->zSpielerDaten( accountId ) )
|
|
|
+ teams->z( i )->removeSpieler( accountId );
|
|
|
+ }
|
|
|
+ for( int i = 0; i < teamAnzahl; i++ )
|
|
|
+ {
|
|
|
+ for( int j = 0; j < teamAnzahl; j++ )
|
|
|
+ {
|
|
|
+ if( i == 0 )
|
|
|
+ teams->z( j )->setTeamErlaubt( teams->z( i )->zName(), teams->z( i )->istPlatzFrei(), 0 );
|
|
|
+ else
|
|
|
+ teams->z( j )->setTeamErlaubt( teams->z( i )->zName(), teams->z( i )->istPlatzFrei(), sts->teamFarbe->hat( i - 1 ) ? sts->teamFarbe->get( i - 1 ) : 0 );
|
|
|
+ }
|
|
|
+ }
|
|
|
+ rend = 1;
|
|
|
}
|
|
|
|
|
|
bool TeamAuswahlListe::tick( double tickVal )
|
|
|
{
|
|
|
- for( int i = 0; i < teamAnzahl; i++ )
|
|
|
- rend |= teams->z( i )->tick( tickVal );
|
|
|
- rend |= scroll->getRend();
|
|
|
- bool ret = rend;
|
|
|
- rend = 0;
|
|
|
- return ret;
|
|
|
-}
|
|
|
-
|
|
|
-void TeamAuswahlListe::doMausEreignis( MausEreignis &me )
|
|
|
-{
|
|
|
- int tmpX = me.mx;
|
|
|
- int tmpY = me.my;
|
|
|
- me.mx -= 50;
|
|
|
- me.my -= 50 - scroll->getScroll();
|
|
|
- for( int i = 0; i < teamAnzahl; i++ )
|
|
|
- {
|
|
|
- teams->z( i )->doMausEreignis( me );
|
|
|
- me.my -= 20 + teams->z( i )->getHeight();
|
|
|
- }
|
|
|
- me.mx = tmpX;
|
|
|
- me.my = tmpY;
|
|
|
- if( me.mx > 1 && me.mx < 698 && me.my > 1 && me.my < 397 )
|
|
|
- {
|
|
|
- scroll->doMausMessage( 683, 1, 15, 396, me );
|
|
|
- me.verarbeitet = 1;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-void TeamAuswahlListe::render( Bild &zRObj )
|
|
|
-{
|
|
|
- if( !zRObj.setDrawOptions( 0, 0, 698, 398 ) )
|
|
|
- return;
|
|
|
- rahmen->render( zRObj );
|
|
|
- int maxHöhe = 50;
|
|
|
- for( int i = 0; i < teamAnzahl; i++ )
|
|
|
- maxHöhe += 20 + teams->z( i )->getHeight();
|
|
|
- maxHöhe += 30;
|
|
|
- scroll->update( maxHöhe, 396 );
|
|
|
- scroll->render( 683, 1, 15, 396, zRObj );
|
|
|
- if( !zRObj.setDrawOptions( 1, 1, 682, 395 ) )
|
|
|
- {
|
|
|
- zRObj.releaseDrawOptions();
|
|
|
- return;
|
|
|
- }
|
|
|
- int y = 50 - scroll->getScroll();
|
|
|
- for( int i = 0; i < teamAnzahl - 1; i++ )
|
|
|
- y += 20 + teams->z( i )->getHeight();
|
|
|
- for( int i = teamAnzahl - 1; i >= 0; i-- )
|
|
|
- {
|
|
|
- teams->z( i )->render( y, zRObj );
|
|
|
- if( i > 0 )
|
|
|
- y -= 20 + teams->z( i - 1 )->getHeight();
|
|
|
- }
|
|
|
- zRObj.releaseDrawOptions();
|
|
|
- zRObj.releaseDrawOptions();
|
|
|
+ for( int i = 0; i < teamAnzahl; i++ )
|
|
|
+ rend |= teams->z( i )->tick( tickVal );
|
|
|
+ rend |= scroll->getRend();
|
|
|
+ bool ret = rend;
|
|
|
+ rend = 0;
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
+void TeamAuswahlListe::doMausEreignis( MausEreignis & me )
|
|
|
+{
|
|
|
+ int tmpX = me.mx;
|
|
|
+ int tmpY = me.my;
|
|
|
+ me.mx -= 50;
|
|
|
+ me.my -= 50 - scroll->getScroll();
|
|
|
+ for( int i = 0; i < teamAnzahl; i++ )
|
|
|
+ {
|
|
|
+ teams->z( i )->doMausEreignis( me );
|
|
|
+ me.my -= 20 + teams->z( i )->getHeight();
|
|
|
+ }
|
|
|
+ me.mx = tmpX;
|
|
|
+ me.my = tmpY;
|
|
|
+ if( me.mx > 1 && me.mx < 698 && me.my > 1 && me.my < 397 )
|
|
|
+ {
|
|
|
+ scroll->doMausMessage( 683, 1, 15, 396, me );
|
|
|
+ me.verarbeitet = 1;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void TeamAuswahlListe::render( Bild & zRObj )
|
|
|
+{
|
|
|
+ if( !zRObj.setDrawOptions( 0, 0, 698, 398 ) )
|
|
|
+ return;
|
|
|
+ rahmen->render( zRObj );
|
|
|
+ int maxHöhe = 50;
|
|
|
+ for( int i = 0; i < teamAnzahl; i++ )
|
|
|
+ maxHöhe += 20 + teams->z( i )->getHeight();
|
|
|
+ maxHöhe += 30;
|
|
|
+ scroll->update( maxHöhe, 396 );
|
|
|
+ scroll->render( 683, 1, 15, 396, zRObj );
|
|
|
+ if( !zRObj.setDrawOptions( 1, 1, 682, 395 ) )
|
|
|
+ {
|
|
|
+ zRObj.releaseDrawOptions();
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ int y = 50 - scroll->getScroll();
|
|
|
+ for( int i = 0; i < teamAnzahl - 1; i++ )
|
|
|
+ y += 20 + teams->z( i )->getHeight();
|
|
|
+ for( int i = teamAnzahl - 1; i >= 0; i-- )
|
|
|
+ {
|
|
|
+ teams->z( i )->render( y, zRObj );
|
|
|
+ if( i > 0 )
|
|
|
+ y -= 20 + teams->z( i - 1 )->getHeight();
|
|
|
+ }
|
|
|
+ zRObj.releaseDrawOptions();
|
|
|
+ zRObj.releaseDrawOptions();
|
|
|
}
|
|
|
|
|
|
// constant
|
|
@@ -669,217 +669,208 @@ void TeamAuswahlListe::render( Bild &zRObj )
|
|
|
// Reference Counting
|
|
|
TeamAuswahlListe *TeamAuswahlListe::getThis()
|
|
|
{
|
|
|
- ref++;
|
|
|
- return this;
|
|
|
+ ref++;
|
|
|
+ return this;
|
|
|
}
|
|
|
|
|
|
TeamAuswahlListe *TeamAuswahlListe::release()
|
|
|
{
|
|
|
- ref--;
|
|
|
- if( !ref )
|
|
|
- delete this;
|
|
|
- return 0;
|
|
|
+ ref--;
|
|
|
+ if( !ref )
|
|
|
+ delete this;
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
// Inhalt der TeamAuswahlTimer Klasse aus TeamAuswahl.h
|
|
|
// Konstruktor
|
|
|
-TeamAuswahlTimer::TeamAuswahlTimer( Schrift *zSchrift )
|
|
|
+TeamAuswahlTimer::TeamAuswahlTimer( Schrift * zSchrift )
|
|
|
{
|
|
|
- zeit = initTextFeld( 0, 0, 200, 200, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, "" );
|
|
|
- bestätigen = initKnopf( 65, 170, 70, 20, zSchrift, Knopf::Style::Sichtbar, "Fertig" );
|
|
|
- time = 0;
|
|
|
- maxTime = 0;
|
|
|
- grad = 0;
|
|
|
- rend = 0;
|
|
|
- ref = 1;
|
|
|
+ zeit = initTextFeld( 0, 0, 200, 200, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, "" );
|
|
|
+ bestätigen = initKnopf( 65, 170, 70, 20, zSchrift, Knopf::Style::Sichtbar, "Fertig" );
|
|
|
+ time = 0;
|
|
|
+ maxTime = 0;
|
|
|
+ grad = 0;
|
|
|
+ rend = 0;
|
|
|
+ ref = 1;
|
|
|
}
|
|
|
|
|
|
// Destruktor
|
|
|
TeamAuswahlTimer::~TeamAuswahlTimer()
|
|
|
{
|
|
|
- zeit->release();
|
|
|
- bestätigen->release();
|
|
|
+ zeit->release();
|
|
|
+ bestätigen->release();
|
|
|
}
|
|
|
|
|
|
// nicht constant
|
|
|
void TeamAuswahlTimer::setVerbleibendeZeit( int sekunden )
|
|
|
{
|
|
|
- if( !maxTime )
|
|
|
- maxTime = sekunden;
|
|
|
- if( time != sekunden )
|
|
|
- rend = 1;
|
|
|
- time = sekunden;
|
|
|
+ if( !maxTime )
|
|
|
+ maxTime = sekunden;
|
|
|
+ if( time != sekunden )
|
|
|
+ rend = 1;
|
|
|
+ time = sekunden;
|
|
|
}
|
|
|
|
|
|
-bool TeamAuswahlTimer::doMausEreignis( MausEreignis &me )
|
|
|
+bool TeamAuswahlTimer::doMausEreignis( MausEreignis & me )
|
|
|
{
|
|
|
- bool vera = me.verarbeitet;
|
|
|
- bestätigen->doMausEreignis( me );
|
|
|
- if( !vera && me.verarbeitet && me.id == ME_RLinks )
|
|
|
- {
|
|
|
- if( spielClient->spielErstelltTeamFertig() )
|
|
|
- {
|
|
|
- bestätigen->removeStyle( Knopf::Style::Erlaubt );
|
|
|
- return 1;
|
|
|
- }
|
|
|
- }
|
|
|
- return 0;
|
|
|
+ bool vera = me.verarbeitet;
|
|
|
+ bestätigen->doMausEreignis( me );
|
|
|
+ if( !vera && me.verarbeitet &&me.id == ME_RLinks )
|
|
|
+ {
|
|
|
+ if( spielClient->spielErstelltTeamFertig() )
|
|
|
+ {
|
|
|
+ bestätigen->removeStyle( Knopf::Style::Erlaubt );
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
bool TeamAuswahlTimer::tick( double tickVal )
|
|
|
{
|
|
|
- zeit->setText( "" );
|
|
|
- zeit->zText()->append( time );
|
|
|
- grad += ( tickVal * 2 );
|
|
|
- rend = 1;
|
|
|
- if( grad > 360 )
|
|
|
- grad -= 360;
|
|
|
- bool ret = rend;
|
|
|
- rend = 0;
|
|
|
- return ret;
|
|
|
-}
|
|
|
-
|
|
|
-void TeamAuswahlTimer::render( Bild &zRObj )
|
|
|
-{
|
|
|
- if( !zRObj.setDrawOptions( 498, 398, 200, 200 ) )
|
|
|
- return;
|
|
|
- zeit->render( zRObj );
|
|
|
- int r = ( maxTime && time ) ? 90 - (int)( 75.0 / ( (double)maxTime / ( maxTime - time ) ) + 0.5 ) : 15;
|
|
|
- zRObj.drawKreis( 100, 100, 15, 0xFFFF0000 );
|
|
|
- zRObj.drawKreis( 100, 100, r, 0xFF00FF00 );
|
|
|
- int x1 = 100 + (int)( sin( grad ) * 15 );
|
|
|
- int y1 = 100 + (int)( cos( grad ) * 15 );
|
|
|
- int x2 = 100 + (int)( sin( grad ) * r );
|
|
|
- int y2 = 100 + (int)( cos( grad ) * r );
|
|
|
- zRObj.drawLinie( Punkt( x1, y1 ), Punkt( x2, y2 ), 0xFFFFFF00 );
|
|
|
- bestätigen->render( zRObj );
|
|
|
- zRObj.releaseDrawOptions();
|
|
|
+ zeit->setText( "" );
|
|
|
+ zeit->zText()->append( time );
|
|
|
+ grad += ( tickVal * 2 );
|
|
|
+ rend = 1;
|
|
|
+ if( grad > 360 )
|
|
|
+ grad -= 360;
|
|
|
+ bool ret = rend;
|
|
|
+ rend = 0;
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
+void TeamAuswahlTimer::render( Bild & zRObj )
|
|
|
+{
|
|
|
+ if( !zRObj.setDrawOptions( 498, 398, 200, 200 ) )
|
|
|
+ return;
|
|
|
+ zeit->render( zRObj );
|
|
|
+ int r = ( maxTime && time ) ? 90 - (int)( 75.0 / ( (double)maxTime / ( maxTime - time ) ) + 0.5 ) : 15;
|
|
|
+ zRObj.drawKreis( 100, 100, 15, 0xFFFF0000 );
|
|
|
+ zRObj.drawKreis( 100, 100, r, 0xFF00FF00 );
|
|
|
+ int x1 = 100 + (int)( sin( grad ) * 15 );
|
|
|
+ int y1 = 100 + (int)( cos( grad ) * 15 );
|
|
|
+ int x2 = 100 + (int)( sin( grad ) * r );
|
|
|
+ int y2 = 100 + (int)( cos( grad ) * r );
|
|
|
+ zRObj.drawLinie( Punkt( x1, y1 ), Punkt( x2, y2 ), 0xFFFFFF00 );
|
|
|
+ bestätigen->render( zRObj );
|
|
|
+ zRObj.releaseDrawOptions();
|
|
|
}
|
|
|
|
|
|
// constant
|
|
|
int TeamAuswahlTimer::getZeit() const
|
|
|
{
|
|
|
- return time;
|
|
|
+ return time;
|
|
|
}
|
|
|
|
|
|
// Reference Counting
|
|
|
TeamAuswahlTimer *TeamAuswahlTimer::getThis()
|
|
|
{
|
|
|
- ref++;
|
|
|
- return this;
|
|
|
+ ref++;
|
|
|
+ return this;
|
|
|
}
|
|
|
|
|
|
TeamAuswahlTimer *TeamAuswahlTimer::release()
|
|
|
{
|
|
|
- ref--;
|
|
|
- if( !ref )
|
|
|
- delete this;
|
|
|
- return 0;
|
|
|
+ ref--;
|
|
|
+ if( !ref )
|
|
|
+ delete this;
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
// Inhalt der TeamAuswahlChat Klasse aus TeamAuswahl.h
|
|
|
// Konstruktor
|
|
|
-TeamAuswahlChat::TeamAuswahlChat( Schrift *zSchrift )
|
|
|
-{
|
|
|
- nachricht = initTextFeld( 2, 178, 472, 20, zSchrift, TextFeld::Style::TextFeld, "" );
|
|
|
- Bild *sendenBild = bilder->get( "chat.ltdb/senden.png" );
|
|
|
- if( !sendenBild )
|
|
|
- {
|
|
|
- LTDBDatei *datei = new LTDBDatei();
|
|
|
- datei->setDatei( new Text( "data/client/bilder/chat.ltdb" ) );
|
|
|
- datei->leseDaten( 0 );
|
|
|
- sendenBild = datei->laden( 0, new Text( "senden.png" ) );
|
|
|
- datei->release();
|
|
|
- bilder->add( "chat.ltdb/senden.png", sendenBild->getThis() );
|
|
|
- }
|
|
|
- senden = initKnopf( 476, 178, 20, 20, 0, 0, "" );
|
|
|
- senden->setStyle( Knopf::Style::Sichtbar | Knopf::Style::Erlaubt | Knopf::Style::Hintergrund | Knopf::Style::HAlpha | Knopf::Style::HBild | Knopf::Style::KlickBuffer );
|
|
|
- senden->setHintergrundBildZ( sendenBild );
|
|
|
- verlauf = initTextFeld( 2, 2, 494, 174, zSchrift, TextFeld::Style::TextGebiet & ~TextFeld::Style::Erlaubt, "" );
|
|
|
- verlauf->updateVScroll();
|
|
|
- verlauf->setVertikalKlickScroll( 5 );
|
|
|
- rahmen = new LRahmen();
|
|
|
- rahmen->setSize( 498, 200 );
|
|
|
- rahmen->setFarbe( 0xFFFFFFFF );
|
|
|
- rahmen->setRamenBreite( 1 );
|
|
|
- rend = 0;
|
|
|
- ref = 1;
|
|
|
+TeamAuswahlChat::TeamAuswahlChat( Schrift * zSchrift )
|
|
|
+{
|
|
|
+ nachricht = initTextFeld( 2, 178, 472, 20, zSchrift, TextFeld::Style::TextFeld, "" );
|
|
|
+ Bild *sendenBild = bilder->get( "data/client/bilder/chat.ltdb/senden.png" );
|
|
|
+ senden = initKnopf( 476, 178, 20, 20, 0, 0, "" );
|
|
|
+ senden->setStyle( Knopf::Style::Sichtbar | Knopf::Style::Erlaubt | Knopf::Style::Hintergrund | Knopf::Style::HAlpha | Knopf::Style::HBild | Knopf::Style::KlickBuffer );
|
|
|
+ senden->setHintergrundBildZ( sendenBild );
|
|
|
+ verlauf = initTextFeld( 2, 2, 494, 174, zSchrift, TextFeld::Style::TextGebiet & ~TextFeld::Style::Erlaubt, "" );
|
|
|
+ verlauf->updateVScroll();
|
|
|
+ verlauf->setVertikalKlickScroll( 5 );
|
|
|
+ rahmen = new LRahmen();
|
|
|
+ rahmen->setSize( 498, 200 );
|
|
|
+ rahmen->setFarbe( 0xFFFFFFFF );
|
|
|
+ rahmen->setRamenBreite( 1 );
|
|
|
+ rend = 0;
|
|
|
+ ref = 1;
|
|
|
}
|
|
|
|
|
|
// Destruktor
|
|
|
TeamAuswahlChat::~TeamAuswahlChat()
|
|
|
{
|
|
|
- nachricht->release();
|
|
|
- senden->release();
|
|
|
- verlauf->release();
|
|
|
- rahmen->release();
|
|
|
+ nachricht->release();
|
|
|
+ senden->release();
|
|
|
+ verlauf->release();
|
|
|
+ rahmen->release();
|
|
|
}
|
|
|
|
|
|
// nicht constant
|
|
|
void TeamAuswahlChat::addNachricht( char *nachricht )
|
|
|
{
|
|
|
- verlauf->addZeile( nachricht );
|
|
|
- verlauf->updateVScroll();
|
|
|
- rend = 1;
|
|
|
+ verlauf->addZeile( nachricht );
|
|
|
+ verlauf->updateVScroll();
|
|
|
+ rend = 1;
|
|
|
}
|
|
|
|
|
|
bool TeamAuswahlChat::tick( double tickVal )
|
|
|
{
|
|
|
- rend |= verlauf->tick( tickVal );
|
|
|
- rend |= nachricht->tick( tickVal );
|
|
|
- rend |= senden->tick( tickVal );
|
|
|
- bool ret = rend;
|
|
|
- rend = 0;
|
|
|
- return ret;
|
|
|
-}
|
|
|
-
|
|
|
-void TeamAuswahlChat::doMausEreignis( MausEreignis &me )
|
|
|
-{
|
|
|
- verlauf->doMausEreignis( me );
|
|
|
- nachricht->doMausEreignis( me );
|
|
|
- bool ver = !me.verarbeitet;
|
|
|
- senden->doMausEreignis( me );
|
|
|
- int aktion = ( ver && me.verarbeitet && me.id == ME_RLinks ) ? 1 : 0;
|
|
|
- if( aktion == 1 )
|
|
|
- { // Nachricht senden
|
|
|
- if( spielClient->spielErstelltChatNachricht( nachricht->zText()->getText() ) )
|
|
|
- {
|
|
|
- nachricht->setText( "" );
|
|
|
- nachricht->setAuswahl( 0, 0 );
|
|
|
- rend = 1;
|
|
|
- }
|
|
|
- else
|
|
|
- nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( spielClient->getLetzterFehler() ), new Text( "Ok" ), 0 );
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-void TeamAuswahlChat::doTastaturEreignis( TastaturEreignis &te )
|
|
|
-{
|
|
|
- bool ver = !te.verarbeitet;
|
|
|
- nachricht->doTastaturEreignis( te );
|
|
|
- int aktion = ( ver && te.verarbeitet && te.id == TE_Release && te.taste == T_Enter ) ? 1 : 0;
|
|
|
- if( aktion == 1 )
|
|
|
- { // Nachricht senden
|
|
|
- if( spielClient->spielErstelltChatNachricht( nachricht->zText()->getText() ) )
|
|
|
- {
|
|
|
- nachricht->setText( "" );
|
|
|
- nachricht->setAuswahl( 0, 0 );
|
|
|
- rend = 1;
|
|
|
- }
|
|
|
- else
|
|
|
- nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( spielClient->getLetzterFehler() ), new Text( "Ok" ), 0 );
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-void TeamAuswahlChat::render( Bild &zRObj )
|
|
|
-{
|
|
|
- if( !zRObj.setDrawOptions( 0, 398, 498, 200 ) )
|
|
|
- return;
|
|
|
- rahmen->render( zRObj );
|
|
|
- verlauf->render( zRObj );
|
|
|
- nachricht->render( zRObj );
|
|
|
- senden->render( zRObj );
|
|
|
- zRObj.releaseDrawOptions();
|
|
|
+ rend |= verlauf->tick( tickVal );
|
|
|
+ rend |= nachricht->tick( tickVal );
|
|
|
+ rend |= senden->tick( tickVal );
|
|
|
+ bool ret = rend;
|
|
|
+ rend = 0;
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
+void TeamAuswahlChat::doMausEreignis( MausEreignis & me )
|
|
|
+{
|
|
|
+ verlauf->doMausEreignis( me );
|
|
|
+ nachricht->doMausEreignis( me );
|
|
|
+ bool ver = !me.verarbeitet;
|
|
|
+ senden->doMausEreignis( me );
|
|
|
+ int aktion = ( ver && me.verarbeitet && me.id == ME_RLinks ) ? 1 : 0;
|
|
|
+ if( aktion == 1 )
|
|
|
+ { // Nachricht senden
|
|
|
+ if( spielClient->spielErstelltChatNachricht( nachricht->zText()->getText() ) )
|
|
|
+ {
|
|
|
+ nachricht->setText( "" );
|
|
|
+ nachricht->setAuswahl( 0, 0 );
|
|
|
+ rend = 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( spielClient->getLetzterFehler() ), new Text( "Ok" ), 0 );
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void TeamAuswahlChat::doTastaturEreignis( TastaturEreignis & te )
|
|
|
+{
|
|
|
+ bool ver = !te.verarbeitet;
|
|
|
+ nachricht->doTastaturEreignis( te );
|
|
|
+ int aktion = ( ver && te.verarbeitet && te.id == TE_Release && te.taste == T_Enter ) ? 1 : 0;
|
|
|
+ if( aktion == 1 )
|
|
|
+ { // Nachricht senden
|
|
|
+ if( spielClient->spielErstelltChatNachricht( nachricht->zText()->getText() ) )
|
|
|
+ {
|
|
|
+ nachricht->setText( "" );
|
|
|
+ nachricht->setAuswahl( 0, 0 );
|
|
|
+ rend = 1;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( spielClient->getLetzterFehler() ), new Text( "Ok" ), 0 );
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void TeamAuswahlChat::render( Bild & zRObj )
|
|
|
+{
|
|
|
+ if( !zRObj.setDrawOptions( 0, 398, 498, 200 ) )
|
|
|
+ return;
|
|
|
+ rahmen->render( zRObj );
|
|
|
+ verlauf->render( zRObj );
|
|
|
+ nachricht->render( zRObj );
|
|
|
+ senden->render( zRObj );
|
|
|
+ zRObj.releaseDrawOptions();
|
|
|
}
|
|
|
|
|
|
// constant
|
|
@@ -887,49 +878,49 @@ void TeamAuswahlChat::render( Bild &zRObj )
|
|
|
// Reference Counting
|
|
|
TeamAuswahlChat *TeamAuswahlChat::getThis()
|
|
|
{
|
|
|
- ref++;
|
|
|
- return this;
|
|
|
+ ref++;
|
|
|
+ return this;
|
|
|
}
|
|
|
|
|
|
TeamAuswahlChat *TeamAuswahlChat::release()
|
|
|
{
|
|
|
- ref--;
|
|
|
- if( !ref )
|
|
|
- delete this;
|
|
|
- return 0;
|
|
|
+ ref--;
|
|
|
+ if( !ref )
|
|
|
+ delete this;
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
// Inhalt der TeamAuswahl Klasse aus TeamAuswahl.h
|
|
|
// Konstruktor
|
|
|
-TeamAuswahl::TeamAuswahl( Schrift *zSchrift )
|
|
|
-{
|
|
|
- tickVal = 0;
|
|
|
- animation = 0;
|
|
|
- sichtbar = 0;
|
|
|
- alpha = 0;
|
|
|
- karteId = 0;
|
|
|
- sts = 0;
|
|
|
- chat = 0;
|
|
|
- timer = 0;
|
|
|
- liste = 0;
|
|
|
- schrift = zSchrift->getThis();
|
|
|
- rend = 0;
|
|
|
- ref = 1;
|
|
|
+TeamAuswahl::TeamAuswahl( Schrift * zSchrift )
|
|
|
+{
|
|
|
+ tickVal = 0;
|
|
|
+ animation = 0;
|
|
|
+ sichtbar = 0;
|
|
|
+ alpha = 0;
|
|
|
+ karteId = 0;
|
|
|
+ sts = 0;
|
|
|
+ chat = 0;
|
|
|
+ timer = 0;
|
|
|
+ liste = 0;
|
|
|
+ schrift = zSchrift->getThis();
|
|
|
+ rend = 0;
|
|
|
+ ref = 1;
|
|
|
}
|
|
|
|
|
|
// Destruktor
|
|
|
TeamAuswahl::~TeamAuswahl()
|
|
|
{
|
|
|
- if( sichtbar )
|
|
|
- setSichtbar( 0 );
|
|
|
- if( chat )
|
|
|
- chat->release();
|
|
|
- if( timer )
|
|
|
- timer->release();
|
|
|
- if( liste )
|
|
|
- liste->release();
|
|
|
- if( sts )
|
|
|
- sts->release();
|
|
|
+ if( sichtbar )
|
|
|
+ setSichtbar( 0 );
|
|
|
+ if( chat )
|
|
|
+ chat->release();
|
|
|
+ if( timer )
|
|
|
+ timer->release();
|
|
|
+ if( liste )
|
|
|
+ liste->release();
|
|
|
+ if( sts )
|
|
|
+ sts->release();
|
|
|
if( schrift )
|
|
|
schrift->release();
|
|
|
}
|
|
@@ -937,199 +928,199 @@ TeamAuswahl::~TeamAuswahl()
|
|
|
// nicht constant
|
|
|
void TeamAuswahl::setKarteId( int karteId )
|
|
|
{
|
|
|
- this->karteId = karteId;
|
|
|
+ this->karteId = karteId;
|
|
|
}
|
|
|
|
|
|
void TeamAuswahl::setSichtbar( bool sichtbar, bool sofort )
|
|
|
{
|
|
|
- this->sichtbar = sichtbar;
|
|
|
- if( sichtbar )
|
|
|
- animation |= 0x1;
|
|
|
- else
|
|
|
- {
|
|
|
- if( sofort )
|
|
|
- alpha = 0;
|
|
|
- else
|
|
|
- animation &= ~0x1;
|
|
|
- }
|
|
|
- rend = 1;
|
|
|
-}
|
|
|
-
|
|
|
-void TeamAuswahl::initSTS( SpielerTeamStruktur *sts )
|
|
|
-{
|
|
|
- hauptScreen->lock();
|
|
|
- if( this->sts )
|
|
|
- this->sts->release();
|
|
|
- this->sts = sts;
|
|
|
- if( chat )
|
|
|
- chat = chat->release();
|
|
|
- if( timer )
|
|
|
- timer = timer->release();
|
|
|
- if( liste )
|
|
|
- liste = liste->release();
|
|
|
- chat = new TeamAuswahlChat( schrift );
|
|
|
- timer = new TeamAuswahlTimer( schrift );
|
|
|
- liste = new TeamAuswahlListe( schrift, sts->getThis(), karteId );
|
|
|
- hauptScreen->unlock();
|
|
|
- rend = 1;
|
|
|
+ this->sichtbar = sichtbar;
|
|
|
+ if( sichtbar )
|
|
|
+ animation |= 0x1;
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if( sofort )
|
|
|
+ alpha = 0;
|
|
|
+ else
|
|
|
+ animation &= ~0x1;
|
|
|
+ }
|
|
|
+ rend = 1;
|
|
|
+}
|
|
|
+
|
|
|
+void TeamAuswahl::initSTS( SpielerTeamStruktur * sts )
|
|
|
+{
|
|
|
+ hauptScreen->lock();
|
|
|
+ if( this->sts )
|
|
|
+ this->sts->release();
|
|
|
+ this->sts = sts;
|
|
|
+ if( chat )
|
|
|
+ chat = chat->release();
|
|
|
+ if( timer )
|
|
|
+ timer = timer->release();
|
|
|
+ if( liste )
|
|
|
+ liste = liste->release();
|
|
|
+ chat = new TeamAuswahlChat( schrift );
|
|
|
+ timer = new TeamAuswahlTimer( schrift );
|
|
|
+ liste = new TeamAuswahlListe( schrift, sts->getThis(), karteId );
|
|
|
+ hauptScreen->unlock();
|
|
|
+ rend = 1;
|
|
|
}
|
|
|
|
|
|
void TeamAuswahl::addSpieler( int accountId )
|
|
|
{
|
|
|
- if( liste )
|
|
|
- liste->addSpieler( accountId );
|
|
|
+ if( liste )
|
|
|
+ liste->addSpieler( accountId );
|
|
|
}
|
|
|
|
|
|
void TeamAuswahl::setSpielerNummer( int accountId, int sNummer )
|
|
|
{
|
|
|
- if( liste )
|
|
|
- liste->setTeamVonSpieler( accountId, sNummer );
|
|
|
+ if( liste )
|
|
|
+ liste->setTeamVonSpieler( accountId, sNummer );
|
|
|
}
|
|
|
|
|
|
void TeamAuswahl::removeSpieler( int accountId )
|
|
|
{
|
|
|
- if( liste )
|
|
|
- liste->removeSpieler( accountId );
|
|
|
+ if( liste )
|
|
|
+ liste->removeSpieler( accountId );
|
|
|
}
|
|
|
|
|
|
void TeamAuswahl::verbleibendeZeit( int sekunden )
|
|
|
{
|
|
|
- if( timer )
|
|
|
- timer->setVerbleibendeZeit( sekunden );
|
|
|
+ if( timer )
|
|
|
+ timer->setVerbleibendeZeit( sekunden );
|
|
|
}
|
|
|
|
|
|
void TeamAuswahl::addNachricht( char *nachricht )
|
|
|
{
|
|
|
- if( chat )
|
|
|
- chat->addNachricht( nachricht );
|
|
|
+ if( chat )
|
|
|
+ chat->addNachricht( nachricht );
|
|
|
}
|
|
|
|
|
|
bool TeamAuswahl::tick( double tickVal )
|
|
|
{
|
|
|
- if( !sichtbar && !alpha )
|
|
|
- return 0;
|
|
|
- if( chat )
|
|
|
- rend |= chat->tick( tickVal );
|
|
|
- if( timer )
|
|
|
- rend |= timer->tick( tickVal );
|
|
|
- if( liste )
|
|
|
- rend |= liste->tick( tickVal );
|
|
|
- this->tickVal += tickVal * 150;
|
|
|
- int val = ( int )this->tickVal;
|
|
|
- if( !val )
|
|
|
- {
|
|
|
- bool ret = rend;
|
|
|
- rend = 0;
|
|
|
- return ret;
|
|
|
- }
|
|
|
- if( val > 5 )
|
|
|
- val = 5;
|
|
|
- this->tickVal -= val;
|
|
|
- if( ( animation | 0x1 ) == animation ) // sichtbar werden
|
|
|
- {
|
|
|
- if( alpha != 255 )
|
|
|
- {
|
|
|
- if( alpha + val < 255 )
|
|
|
- alpha += val;
|
|
|
- else
|
|
|
- alpha = 255;
|
|
|
- rend = 1;
|
|
|
- }
|
|
|
- }
|
|
|
- else // unsichtbar werden
|
|
|
- {
|
|
|
- if( alpha != 0 )
|
|
|
- {
|
|
|
- if( alpha - val >= 0 )
|
|
|
- alpha -= val;
|
|
|
- else
|
|
|
- alpha = 0;
|
|
|
- rend = 1;
|
|
|
- }
|
|
|
- }
|
|
|
- bool ret = rend;
|
|
|
- rend = 0;
|
|
|
- return ret;
|
|
|
-}
|
|
|
-
|
|
|
-void TeamAuswahl::doMausEreignis( MausEreignis &me )
|
|
|
-{
|
|
|
- if( !alpha )
|
|
|
- return;
|
|
|
- if( liste )
|
|
|
- liste->doMausEreignis( me );
|
|
|
- if( chat )
|
|
|
- {
|
|
|
- me.my -= 398;
|
|
|
- chat->doMausEreignis( me );
|
|
|
- me.mx -= 498;
|
|
|
- if( timer->doMausEreignis( me ) )
|
|
|
- liste->disable();
|
|
|
- me.my += 398;
|
|
|
- me.mx += 498;
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-void TeamAuswahl::doTastaturEreignis( TastaturEreignis &te )
|
|
|
-{
|
|
|
- if( !alpha )
|
|
|
- return;
|
|
|
- if( chat )
|
|
|
- chat->doTastaturEreignis( te );
|
|
|
-}
|
|
|
-
|
|
|
-void TeamAuswahl::render( Bild &zRObj )
|
|
|
-{
|
|
|
- if( !alpha )
|
|
|
- return;
|
|
|
- if( !zRObj.setDrawOptions( 0, 0, 700, 600 ) )
|
|
|
- return;
|
|
|
- zRObj.setAlpha( alpha );
|
|
|
- if( timer )
|
|
|
- timer->render( zRObj );
|
|
|
- if( chat )
|
|
|
- chat->render( zRObj );
|
|
|
- if( liste )
|
|
|
- liste->render( zRObj );
|
|
|
- zRObj.releaseAlpha();
|
|
|
- zRObj.releaseDrawOptions();
|
|
|
+ if( !sichtbar && !alpha )
|
|
|
+ return 0;
|
|
|
+ if( chat )
|
|
|
+ rend |= chat->tick( tickVal );
|
|
|
+ if( timer )
|
|
|
+ rend |= timer->tick( tickVal );
|
|
|
+ if( liste )
|
|
|
+ rend |= liste->tick( tickVal );
|
|
|
+ this->tickVal += tickVal * 150;
|
|
|
+ int val = (int)this->tickVal;
|
|
|
+ if( !val )
|
|
|
+ {
|
|
|
+ bool ret = rend;
|
|
|
+ rend = 0;
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+ if( val > 5 )
|
|
|
+ val = 5;
|
|
|
+ this->tickVal -= val;
|
|
|
+ if( ( animation | 0x1 ) == animation ) // sichtbar werden
|
|
|
+ {
|
|
|
+ if( alpha != 255 )
|
|
|
+ {
|
|
|
+ if( alpha + val < 255 )
|
|
|
+ alpha += val;
|
|
|
+ else
|
|
|
+ alpha = 255;
|
|
|
+ rend = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else // unsichtbar werden
|
|
|
+ {
|
|
|
+ if( alpha != 0 )
|
|
|
+ {
|
|
|
+ if( alpha - val >= 0 )
|
|
|
+ alpha -= val;
|
|
|
+ else
|
|
|
+ alpha = 0;
|
|
|
+ rend = 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ bool ret = rend;
|
|
|
+ rend = 0;
|
|
|
+ return ret;
|
|
|
+}
|
|
|
+
|
|
|
+void TeamAuswahl::doMausEreignis( MausEreignis & me )
|
|
|
+{
|
|
|
+ if( !alpha )
|
|
|
+ return;
|
|
|
+ if( liste )
|
|
|
+ liste->doMausEreignis( me );
|
|
|
+ if( chat )
|
|
|
+ {
|
|
|
+ me.my -= 398;
|
|
|
+ chat->doMausEreignis( me );
|
|
|
+ me.mx -= 498;
|
|
|
+ if( timer->doMausEreignis( me ) )
|
|
|
+ liste->disable();
|
|
|
+ me.my += 398;
|
|
|
+ me.mx += 498;
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+void TeamAuswahl::doTastaturEreignis( TastaturEreignis & te )
|
|
|
+{
|
|
|
+ if( !alpha )
|
|
|
+ return;
|
|
|
+ if( chat )
|
|
|
+ chat->doTastaturEreignis( te );
|
|
|
+}
|
|
|
+
|
|
|
+void TeamAuswahl::render( Bild & zRObj )
|
|
|
+{
|
|
|
+ if( !alpha )
|
|
|
+ return;
|
|
|
+ if( !zRObj.setDrawOptions( 0, 0, 700, 600 ) )
|
|
|
+ return;
|
|
|
+ zRObj.setAlpha( alpha );
|
|
|
+ if( timer )
|
|
|
+ timer->render( zRObj );
|
|
|
+ if( chat )
|
|
|
+ chat->render( zRObj );
|
|
|
+ if( liste )
|
|
|
+ liste->render( zRObj );
|
|
|
+ zRObj.releaseAlpha();
|
|
|
+ zRObj.releaseDrawOptions();
|
|
|
}
|
|
|
|
|
|
// constant
|
|
|
bool TeamAuswahl::istSichtbar() const
|
|
|
{
|
|
|
- return sichtbar;
|
|
|
+ return sichtbar;
|
|
|
}
|
|
|
|
|
|
int TeamAuswahl::getKarteId() const
|
|
|
{
|
|
|
- return karteId;
|
|
|
+ return karteId;
|
|
|
}
|
|
|
|
|
|
SpielerTeamStruktur *TeamAuswahl::getSTS() const
|
|
|
{
|
|
|
- return sts->getThis();
|
|
|
+ return sts->getThis();
|
|
|
}
|
|
|
|
|
|
// Reference Counting
|
|
|
TeamAuswahl *TeamAuswahl::getThis()
|
|
|
{
|
|
|
- ref++;
|
|
|
- return this;
|
|
|
+ ref++;
|
|
|
+ return this;
|
|
|
}
|
|
|
|
|
|
TeamAuswahl *TeamAuswahl::release()
|
|
|
{
|
|
|
- ref--;
|
|
|
- if( !ref )
|
|
|
- delete this;
|
|
|
- return 0;
|
|
|
+ ref--;
|
|
|
+ if( !ref )
|
|
|
+ delete this;
|
|
|
+ return 0;
|
|
|
}
|
|
|
|
|
|
// Event Aktionen
|
|
|
-void TeamAuswahlListeSpielerTeamAuswahlE( void *p, AuswahlBox *obj, int p1, int p2 )
|
|
|
+void TeamAuswahlListeSpielerTeamAuswahlE( void *p, AuswahlBox * obj, int p1, int p2 )
|
|
|
{
|
|
|
- if( !p )
|
|
|
- return;
|
|
|
- ( (TeamAuswahlListeSpieler*)p )->spielerTeamAuswahlE( obj, p1, p2 );
|
|
|
+ if( !p )
|
|
|
+ return;
|
|
|
+ ( (TeamAuswahlListeSpieler *)p )->spielerTeamAuswahlE( obj, p1, p2 );
|
|
|
}
|