|
@@ -2360,3 +2360,377 @@ bool BaseSetTeam::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMem
|
|
|
zPC->stepOut();
|
|
|
return 0;
|
|
|
}
|
|
|
+
|
|
|
+TriggerRunStart::TriggerRunStart( Aktion *trigger )
|
|
|
+ : Aktion( TRIGGER_RUN_START )
|
|
|
+{
|
|
|
+ this->trigger = trigger;
|
|
|
+}
|
|
|
+
|
|
|
+TriggerRunStart::~TriggerRunStart()
|
|
|
+{
|
|
|
+ trigger->release();
|
|
|
+}
|
|
|
+
|
|
|
+bool TriggerRunStart::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
|
|
|
+{
|
|
|
+ if( trigger->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
|
|
|
+ {
|
|
|
+ Variable *t = zMemory->zVariable( "__return__" );
|
|
|
+ if( !t || t->getVariableTyp() != TRIGGER )
|
|
|
+ {
|
|
|
+ zPC->stepOut();
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ zSpiel->addTriggerRun( ( (Trigger *)t )->runTrigger( zEreignis->getThis(), zSpiel ) );
|
|
|
+ zPC->stepOut();
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+TriggerSetEnabled::TriggerSetEnabled( Aktion *enabled, Aktion *trigger )
|
|
|
+ : Aktion( TRIGGER_SET_ENABLED )
|
|
|
+{
|
|
|
+ this->enabled = enabled;
|
|
|
+ this->trigger = trigger;
|
|
|
+}
|
|
|
+
|
|
|
+TriggerSetEnabled::~TriggerSetEnabled()
|
|
|
+{
|
|
|
+ enabled->release();
|
|
|
+ trigger->release();
|
|
|
+}
|
|
|
+
|
|
|
+bool TriggerSetEnabled::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
|
|
|
+{
|
|
|
+ zPC->stepIn();
|
|
|
+ if( zPC->currentPosition() == 0 )
|
|
|
+ {
|
|
|
+ if( enabled->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
|
|
|
+ {
|
|
|
+ Variable *t = zMemory->zVariable( "__return__" );
|
|
|
+ if( !t || t->getVariableTyp() != BOOLEAN )
|
|
|
+ {
|
|
|
+ zPC->stepOut();
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
|
|
|
+ zPC->count();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if( zPC->currentPosition() == 1 && waitCount <= 0 )
|
|
|
+ {
|
|
|
+ if( trigger->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
|
|
|
+ {
|
|
|
+ Variable *t = zMemory->zVariable( "__return__" );
|
|
|
+ if( !t || t->getVariableTyp() != TRIGGER )
|
|
|
+ {
|
|
|
+ zPC->stepOut();
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ ( (Trigger *)t )->setAktiv( ( (Boolean *)zMemory->getVariable( zPC->getUniqueString() + "R0__" ) )->getValue() );
|
|
|
+ zPC->stepOut();
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ zPC->stepOut();
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+TeamSetPunkte::TeamSetPunkte( Aktion *punkte, Aktion *team )
|
|
|
+ : Aktion( TEAM_SET_PUNKTE )
|
|
|
+{
|
|
|
+ this->punkte = punkte;
|
|
|
+ this->team = team;
|
|
|
+}
|
|
|
+
|
|
|
+TeamSetPunkte::~TeamSetPunkte()
|
|
|
+{
|
|
|
+ punkte->release();
|
|
|
+ team->release();
|
|
|
+}
|
|
|
+
|
|
|
+bool TeamSetPunkte::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
|
|
|
+{
|
|
|
+ zPC->stepIn();
|
|
|
+ if( zPC->currentPosition() == 0 )
|
|
|
+ {
|
|
|
+ if( punkte->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
|
|
|
+ {
|
|
|
+ Variable *t = zMemory->zVariable( "__return__" );
|
|
|
+ if( !t || t->getVariableTyp() != INTEGER )
|
|
|
+ {
|
|
|
+ zPC->stepOut();
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
|
|
|
+ zPC->count();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if( zPC->currentPosition() == 1 && waitCount <= 0 )
|
|
|
+ {
|
|
|
+ if( team->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
|
|
|
+ {
|
|
|
+ Variable *t = zMemory->zVariable( "__return__" );
|
|
|
+ if( !t || t->getVariableTyp() != TEAM )
|
|
|
+ {
|
|
|
+ zPC->stepOut();
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ ( (Team *)t )->setPunkte( ( (Integer *)zMemory->getVariable( zPC->getUniqueString() + "R0__" ) )->getValue() );
|
|
|
+ zPC->stepOut();
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ zPC->stepOut();
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+TimerSetPosition::TimerSetPosition( Aktion *x, Aktion *y, Aktion *timer )
|
|
|
+ : Aktion( TIMER_SET_POSITION )
|
|
|
+{
|
|
|
+ this->x = x;
|
|
|
+ this->y = y;
|
|
|
+ this->timer = timer;
|
|
|
+}
|
|
|
+
|
|
|
+TimerSetPosition::~TimerSetPosition()
|
|
|
+{
|
|
|
+ x->release();
|
|
|
+ y->release();
|
|
|
+ timer->release();
|
|
|
+}
|
|
|
+
|
|
|
+bool TimerSetPosition::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
|
|
|
+{
|
|
|
+ zPC->stepIn();
|
|
|
+ if( zPC->currentPosition() == 0 )
|
|
|
+ {
|
|
|
+ if( x->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
|
|
|
+ {
|
|
|
+ Variable *t = zMemory->zVariable( "__return__" );
|
|
|
+ if( !t || t->getVariableTyp() != FLOAT )
|
|
|
+ {
|
|
|
+ zPC->stepOut();
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
|
|
|
+ zPC->count();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if( zPC->currentPosition() == 1 && waitCount <= 0 )
|
|
|
+ {
|
|
|
+ if( y->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
|
|
|
+ {
|
|
|
+ Variable *t = zMemory->zVariable( "__return__" );
|
|
|
+ if( !t || t->getVariableTyp() != FLOAT )
|
|
|
+ {
|
|
|
+ zPC->stepOut();
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ zMemory->setVar( zPC->getUniqueString() + "R1__", t->getThis() );
|
|
|
+ zPC->count();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if( zPC->currentPosition() == 2 && waitCount <= 0 )
|
|
|
+ {
|
|
|
+ if( timer->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
|
|
|
+ {
|
|
|
+ Variable *t = zMemory->zVariable( "__return__" );
|
|
|
+ if( !t || t->getVariableTyp() != TIMER )
|
|
|
+ {
|
|
|
+ zPC->stepOut();
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ ( (Timer *)t )->setX( ( (Float *)zMemory->zVariable( zPC->getUniqueString() + "R0__" ) )->getValue() );
|
|
|
+ ( (Timer *)t )->setY( ( (Float *)zMemory->zVariable( zPC->getUniqueString() + "R1__" ) )->getValue() );
|
|
|
+ zPC->stepOut();
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ zPC->stepOut();
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+TimerSetPause::TimerSetPause( Aktion *pause, Aktion *timer )
|
|
|
+ : Aktion( TIMER_SET_PAUSE )
|
|
|
+{
|
|
|
+ this->pause = pause;
|
|
|
+ this->timer = timer;
|
|
|
+}
|
|
|
+
|
|
|
+TimerSetPause::~TimerSetPause()
|
|
|
+{
|
|
|
+ pause->release();
|
|
|
+ timer->release();
|
|
|
+}
|
|
|
+
|
|
|
+bool TimerSetPause::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
|
|
|
+{
|
|
|
+ zPC->stepIn();
|
|
|
+ if( zPC->currentPosition() == 0 )
|
|
|
+ {
|
|
|
+ if( pause->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
|
|
|
+ {
|
|
|
+ Variable *t = zMemory->zVariable( "__return__" );
|
|
|
+ if( !t || t->getVariableTyp() != BOOLEAN )
|
|
|
+ {
|
|
|
+ zPC->stepOut();
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
|
|
|
+ zPC->count();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if( zPC->currentPosition() == 1 && waitCount <= 0 )
|
|
|
+ {
|
|
|
+ if( timer->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
|
|
|
+ {
|
|
|
+ Variable *t = zMemory->zVariable( "__return__" );
|
|
|
+ if( !t || t->getVariableTyp() != TIMER )
|
|
|
+ {
|
|
|
+ zPC->stepOut();
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ ( (Timer *)t )->setPause( ( (Boolean *)zMemory->getVariable( zPC->getUniqueString() + "R0__" ) )->getValue() );
|
|
|
+ zPC->stepOut();
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ zPC->stepOut();
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+TimerStart::TimerStart( Aktion *timer )
|
|
|
+ : Aktion( TIMER_START )
|
|
|
+{
|
|
|
+ this->timer = timer;
|
|
|
+}
|
|
|
+
|
|
|
+TimerStart::~TimerStart()
|
|
|
+{
|
|
|
+ timer->release();
|
|
|
+}
|
|
|
+
|
|
|
+bool TimerStart::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
|
|
|
+{
|
|
|
+ if( timer->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
|
|
|
+ {
|
|
|
+ Variable *t = zMemory->zVariable( "__return__" );
|
|
|
+ if( !t || t->getVariableTyp() != TIMER )
|
|
|
+ {
|
|
|
+ zPC->stepOut();
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ ( (Timer *)t )->start( zSpiel );
|
|
|
+ zPC->stepOut();
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+TimerSetZeit::TimerSetZeit( Aktion *zeit, Aktion *timer )
|
|
|
+ : Aktion( TIMER_SET_ZEIT )
|
|
|
+{
|
|
|
+ this->zeit = zeit;
|
|
|
+ this->timer = timer;
|
|
|
+}
|
|
|
+
|
|
|
+TimerSetZeit::~TimerSetZeit()
|
|
|
+{
|
|
|
+ zeit->release();
|
|
|
+ timer->release();
|
|
|
+}
|
|
|
+
|
|
|
+bool TimerSetZeit::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
|
|
|
+{
|
|
|
+ zPC->stepIn();
|
|
|
+ if( zPC->currentPosition() == 0 )
|
|
|
+ {
|
|
|
+ if( zeit->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
|
|
|
+ {
|
|
|
+ Variable *t = zMemory->zVariable( "__return__" );
|
|
|
+ if( !t || t->getVariableTyp() != FLOAT )
|
|
|
+ {
|
|
|
+ zPC->stepOut();
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
|
|
|
+ zPC->count();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if( zPC->currentPosition() == 1 && waitCount <= 0 )
|
|
|
+ {
|
|
|
+ if( timer->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
|
|
|
+ {
|
|
|
+ Variable *t = zMemory->zVariable( "__return__" );
|
|
|
+ if( !t || t->getVariableTyp() != TIMER )
|
|
|
+ {
|
|
|
+ zPC->stepOut();
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ ( (Timer *)t )->setZeit( ( (Float *)zMemory->getVariable( zPC->getUniqueString() + "R0__" ) )->getValue() );
|
|
|
+ zPC->stepOut();
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ zPC->stepOut();
|
|
|
+ return 0;
|
|
|
+}
|
|
|
+
|
|
|
+
|
|
|
+TimerSetSichtbar::TimerSetSichtbar( Aktion *sichtbar, Aktion *timer )
|
|
|
+ : Aktion( TIMER_SET_SICHTBAR )
|
|
|
+{
|
|
|
+ this->sichtbar = sichtbar;
|
|
|
+ this->timer = timer;
|
|
|
+}
|
|
|
+
|
|
|
+TimerSetSichtbar::~TimerSetSichtbar()
|
|
|
+{
|
|
|
+ sichtbar->release();
|
|
|
+ timer->release();
|
|
|
+}
|
|
|
+
|
|
|
+bool TimerSetSichtbar::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
|
|
|
+{
|
|
|
+ zPC->stepIn();
|
|
|
+ if( zPC->currentPosition() == 0 )
|
|
|
+ {
|
|
|
+ if( sichtbar->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
|
|
|
+ {
|
|
|
+ Variable *t = zMemory->zVariable( "__return__" );
|
|
|
+ if( !t || t->getVariableTyp() != BOOLEAN )
|
|
|
+ {
|
|
|
+ zPC->stepOut();
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
|
|
|
+ zPC->count();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if( zPC->currentPosition() == 1 && waitCount <= 0 )
|
|
|
+ {
|
|
|
+ if( timer->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
|
|
|
+ {
|
|
|
+ Variable *t = zMemory->zVariable( "__return__" );
|
|
|
+ if( !t || t->getVariableTyp() != TIMER )
|
|
|
+ {
|
|
|
+ zPC->stepOut();
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ ( (Timer *)t )->setSichtbar( ( (Boolean *)zMemory->getVariable( zPC->getUniqueString() + "R0__" ) )->getValue() );
|
|
|
+ zPC->stepOut();
|
|
|
+ return 1;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ zPC->stepOut();
|
|
|
+ return 0;
|
|
|
+}
|