Aktionen.cpp 63 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217
  1. #include "Aktionen.h"
  2. #include "Trigger.h"
  3. #include "Spiel.h"
  4. Aktion::Aktion( AktionTyp typ )
  5. : Variable( AKTION )
  6. {
  7. this->typ = typ;
  8. }
  9. Aktion::~Aktion()
  10. {}
  11. KonstantNichts::KonstantNichts()
  12. : Aktion( KONSTANT_NICHTS )
  13. {}
  14. bool KonstantNichts::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  15. {
  16. zMemory->setVar( "__return__", new Variable( NICHTS ) );
  17. return 1;
  18. }
  19. KonstantInteger::KonstantInteger( int val )
  20. : Aktion( KONSTANT_INTEGER )
  21. {
  22. this->value = val;
  23. }
  24. bool KonstantInteger::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  25. {
  26. zMemory->setVar( "__return__", new Integer( value ) );
  27. return 1;
  28. }
  29. KonstantBoolean::KonstantBoolean( bool val )
  30. : Aktion( KONSTANT_BOOLEAN )
  31. {
  32. value = val;
  33. }
  34. bool KonstantBoolean::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  35. {
  36. zMemory->setVar( "__return__", new Boolean( value ) );
  37. return 1;
  38. }
  39. KonstantString::KonstantString( Text val )
  40. : Aktion( KONSTANT_STRING )
  41. {
  42. value = val;
  43. }
  44. bool KonstantString::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  45. {
  46. zMemory->setVar( "__return__", new String( value ) );
  47. return 1;
  48. }
  49. KonstantFloat::KonstantFloat( float val )
  50. : Aktion( KONSTANT_FLOAT )
  51. {
  52. value = val;
  53. }
  54. bool KonstantFloat::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  55. {
  56. zMemory->setVar( "__return__", new Float( value ) );
  57. return 1;
  58. }
  59. KonstantVariable::KonstantVariable( Text name )
  60. : Aktion( KONSTANT_VARIABLE )
  61. {
  62. this->name = name;
  63. }
  64. bool KonstantVariable::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  65. {
  66. if( zMemory->zVariable( name ) )
  67. zMemory->setVar( "__return__", zMemory->getVariable( name ) );
  68. else if( zEreignis->zParameter( name ) )
  69. zMemory->setVar( "__return__", zEreignis->zParameter( name ) );
  70. else if( zSpiel->zVariable( name ) )
  71. zMemory->setVar( "__return__", zSpiel->getVariable( name ) );
  72. else
  73. zMemory->setVar( "__return__", new Variable( NICHTS ) );
  74. return 1;
  75. }
  76. Warten::Warten( Aktion *seconds )
  77. : Aktion( WARTEN )
  78. {
  79. this->seconds = seconds;
  80. }
  81. Warten::~Warten()
  82. {
  83. seconds->release();
  84. }
  85. bool Warten::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  86. {
  87. bool finished = seconds->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount );
  88. if( finished )
  89. {
  90. Variable *t = zMemory->zVariable( "__return__" );
  91. if( !t || t->getVariableTyp() != FLOAT )
  92. {
  93. zPC->stepOut();
  94. return 1;
  95. }
  96. waitCount += ( (Float *)t )->getValue();
  97. }
  98. return finished;
  99. }
  100. WennDannSonst::WennDannSonst( Aktion *wenn, Aktion *dann, Aktion *sonst )
  101. : Aktion( WENN_DANN_SONST )
  102. {
  103. this->wenn = wenn;
  104. this->dann = dann;
  105. this->sonst = sonst;
  106. }
  107. WennDannSonst::~WennDannSonst()
  108. {
  109. wenn->release();
  110. if( dann )
  111. dann->release();
  112. if( sonst )
  113. sonst->release();
  114. }
  115. bool WennDannSonst::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  116. {
  117. zPC->stepIn();
  118. if( zPC->currentPosition() == 0 )
  119. {
  120. bool finished = wenn->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount );
  121. if( finished )
  122. {
  123. Variable *ret = zMemory->zVariable( "__return__" );
  124. zPC->count();
  125. if( !isTrue( ret ) )
  126. {
  127. zPC->count();
  128. if( !sonst )
  129. {
  130. zPC->stepOut();
  131. return 1;
  132. }
  133. }
  134. else
  135. {
  136. if( !dann )
  137. {
  138. zPC->stepOut();
  139. return 1;
  140. }
  141. }
  142. }
  143. }
  144. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  145. {
  146. bool finished = dann->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount );
  147. if( finished )
  148. {
  149. zPC->stepOut();
  150. return 1;
  151. }
  152. }
  153. if( zPC->currentPosition() == 2 && waitCount <= 0 )
  154. {
  155. bool finished = sonst->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount );
  156. if( finished )
  157. {
  158. zPC->stepOut();
  159. return 1;
  160. }
  161. }
  162. zPC->stepOut();
  163. return 0;
  164. }
  165. SetVariable::SetVariable( Text name, Aktion *value )
  166. : Aktion( SET_VARIABLE )
  167. {
  168. this->name = name;
  169. this->value = value;
  170. }
  171. SetVariable::~SetVariable()
  172. {
  173. value->release();
  174. }
  175. bool SetVariable::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  176. {
  177. bool finished = value->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount );
  178. if( finished )
  179. {
  180. if( zMemory->zVariable( name ) || zEreignis->zParameter( name ) || !zSpiel->zVariable( name ) )
  181. zMemory->setVar( name, zMemory->getVariable( "__return__" ) );
  182. else
  183. zSpiel->setVariable( name, zMemory->getVariable( "__return__" ) );
  184. }
  185. return finished;
  186. }
  187. TriggerAktion::TriggerAktion( Aktion *number, Aktion *triggerName )
  188. : Aktion( TRIGGER_AKTION )
  189. {
  190. this->number = number;
  191. trigger = triggerName;
  192. }
  193. TriggerAktion::~TriggerAktion()
  194. {
  195. number->release();
  196. trigger->release();
  197. }
  198. bool TriggerAktion::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  199. {
  200. zPC->stepIn();
  201. if( zPC->currentPosition() == 0 )
  202. {
  203. if( number->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  204. {
  205. Variable *t = zMemory->zVariable( "__return__" );
  206. if( !t || t->getVariableTyp() != INTEGER )
  207. {
  208. zPC->stepOut();
  209. return 1;
  210. }
  211. zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
  212. zPC->count();
  213. }
  214. }
  215. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  216. {
  217. if( trigger->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  218. {
  219. Variable *t = zMemory->zVariable( "__return__" );
  220. if( !t || t->getVariableTyp() != TRIGGER )
  221. {
  222. zPC->stepOut();
  223. return 1;
  224. }
  225. int id = ( (Integer *)zMemory->zVariable( zPC->getUniqueString() + "R0__" ) )->getValue();
  226. if( id >= ( (Trigger *)t )->getAktionAnzahl() )
  227. {
  228. zPC->stepOut();
  229. return 1;
  230. }
  231. zMemory->setVar( zPC->getUniqueString() + "R0__", ( (Trigger *)t )->getAktion( id ) );
  232. zPC->count();
  233. }
  234. }
  235. if( zPC->currentPosition() == 2 && waitCount <= 0 )
  236. {
  237. if( ( (Aktion *)zMemory->zVariable( zPC->getUniqueString() + "R0__" ) )->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  238. {
  239. zPC->stepOut();
  240. return 1;
  241. }
  242. }
  243. zPC->stepOut();
  244. return 0;
  245. }
  246. SpielerNachricht::SpielerNachricht( Aktion *spieler, Aktion *nachricht )
  247. : Aktion( SPIELER_NACHRICHT )
  248. {
  249. this->spieler = spieler;
  250. this->nachricht = nachricht;
  251. }
  252. SpielerNachricht::~SpielerNachricht()
  253. {
  254. spieler->release();
  255. nachricht->release();
  256. }
  257. bool SpielerNachricht::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  258. {
  259. zPC->stepIn();
  260. if( zPC->currentPosition() == 0 )
  261. {
  262. if( spieler->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  263. {
  264. Variable *t = zMemory->zVariable( "__return__" );
  265. if( !t || t->getVariableTyp() != SPIELER )
  266. {
  267. zPC->stepOut();
  268. return 1;
  269. }
  270. zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
  271. zPC->count();
  272. }
  273. }
  274. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  275. {
  276. if( nachricht->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  277. {
  278. Variable *t = zMemory->zVariable( "__return__" );
  279. if( t->getVariableTyp() != STRING )
  280. {
  281. zPC->stepOut();
  282. return 1;
  283. }
  284. // this is handeld on client side directly (no need to send the message to the player)
  285. zPC->stepOut();
  286. return 1;
  287. }
  288. }
  289. zPC->stepOut();
  290. return 0;
  291. }
  292. DisplayText::DisplayText( Aktion *x, Aktion *y, Aktion *f, Aktion *dauer, Aktion *nachricht )
  293. : Aktion( DISPLAY_TEXT )
  294. {
  295. this->x = x;
  296. this->y = y;
  297. this->color = f;
  298. this->dauer = dauer;
  299. this->nachricht = nachricht;
  300. }
  301. DisplayText::~DisplayText()
  302. {
  303. x->release();
  304. y->release();
  305. color->release();
  306. dauer->release();
  307. nachricht->release();
  308. }
  309. bool DisplayText::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  310. {
  311. zPC->stepIn();
  312. if( zPC->currentPosition() == 0 )
  313. {
  314. if( x->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  315. {
  316. Variable *t = zMemory->zVariable( "__return__" );
  317. if( !t || t->getVariableTyp() != FLOAT )
  318. {
  319. zPC->stepOut();
  320. return 1;
  321. }
  322. zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
  323. zPC->count();
  324. }
  325. }
  326. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  327. {
  328. if( y->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  329. {
  330. Variable *t = zMemory->zVariable( "__return__" );
  331. if( !t || t->getVariableTyp() != FLOAT )
  332. {
  333. zPC->stepOut();
  334. return 1;
  335. }
  336. zMemory->setVar( zPC->getUniqueString() + "R1__", t->getThis() );
  337. zPC->count();
  338. }
  339. }
  340. if( zPC->currentPosition() == 2 && waitCount <= 0 )
  341. {
  342. if( dauer->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  343. {
  344. Variable *t = zMemory->zVariable( "__return__" );
  345. if( !t || t->getVariableTyp() != FLOAT )
  346. {
  347. zPC->stepOut();
  348. return 1;
  349. }
  350. zMemory->setVar( zPC->getUniqueString() + "R2__", t->getThis() );
  351. zPC->count();
  352. }
  353. }
  354. if( zPC->currentPosition() == 3 && waitCount <= 0 )
  355. {
  356. if( color->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  357. {
  358. Variable *t = zMemory->zVariable( "__return__" );
  359. if( !t || ( t->getVariableTyp() != INTEGER ) )
  360. {
  361. zPC->stepOut();
  362. return 1;
  363. }
  364. zMemory->setVar( zPC->getUniqueString() + "R3__", t->getThis() );
  365. zPC->count();
  366. }
  367. }
  368. if( zPC->currentPosition() == 4 && waitCount <= 0 )
  369. {
  370. if( color->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  371. {
  372. Variable *t = zMemory->zVariable( "__return__" );
  373. if( !t || ( t->getVariableTyp() != STRING ) )
  374. {
  375. zPC->stepOut();
  376. return 1;
  377. }
  378. //Float *xv = (Float *)zMemory->zVariable( zPC->getUniqueString() + "R0__" );
  379. //Float *yv = (Float *)zMemory->zVariable( zPC->getUniqueString() + "R1__" );
  380. //Float *dauerv = (Float *)zMemory->zVariable( zPC->getUniqueString() + "R2__" );
  381. //Integer *farbev = (Integer *)zMemory->zVariable( zPC->getUniqueString() + "R3__" );
  382. // do nothing because the server does not need to show text
  383. zPC->stepOut();
  384. return 1;
  385. }
  386. }
  387. zPC->stepOut();
  388. return 0;
  389. }
  390. SpielPause::SpielPause( Aktion *paused )
  391. : Aktion( SPIEL_PAUSE )
  392. {
  393. this->paused = paused;
  394. }
  395. SpielPause::~SpielPause()
  396. {
  397. paused->release();
  398. }
  399. bool SpielPause::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  400. {
  401. if( paused->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  402. {
  403. Variable *t = zMemory->zVariable( "__return__" );
  404. if( !t || ( t->getVariableTyp() != BOOLEAN ) )
  405. return 1;
  406. zSpiel->setPausiert( ( (Boolean *)t )->getValue() );
  407. return 1;
  408. }
  409. return 0;
  410. }
  411. SpielEnde::SpielEnde( Aktion *gewinnerTeam )
  412. : Aktion( SPIEL_ENDE )
  413. {
  414. this->gewinnerTeam = gewinnerTeam;
  415. }
  416. SpielEnde::~SpielEnde()
  417. {
  418. gewinnerTeam->release();
  419. }
  420. bool SpielEnde::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  421. {
  422. if( gewinnerTeam->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  423. {
  424. Variable *t = zMemory->zVariable( "__return__" );
  425. if( !t || ( t->getVariableTyp() != TEAM && t->getVariableTyp() != NICHTS ) )
  426. return 1;
  427. zSpiel->setEnde( t->getVariableTyp() == NICHTS ? 0 : (Team *)t );
  428. return 1;
  429. }
  430. return 0;
  431. }
  432. SpielerSetLevel::SpielerSetLevel( Aktion *level, Aktion *spieler )
  433. : Aktion( SPIELER_SET_LEVEL )
  434. {
  435. this->level = level;
  436. this->spieler = spieler;
  437. }
  438. SpielerSetLevel::~SpielerSetLevel()
  439. {
  440. level->release();
  441. spieler->release();
  442. }
  443. bool SpielerSetLevel::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  444. {
  445. zPC->stepIn();
  446. if( zPC->currentPosition() == 0 )
  447. {
  448. if( level->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  449. {
  450. Variable *t = zMemory->zVariable( "__return__" );
  451. if( !t || t->getVariableTyp() != INTEGER )
  452. {
  453. zPC->stepOut();
  454. return 1;
  455. }
  456. zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
  457. zPC->count();
  458. }
  459. }
  460. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  461. {
  462. if( spieler->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  463. {
  464. Variable *t = zMemory->zVariable( "__return__" );
  465. if( !t || t->getVariableTyp() != SPIELER )
  466. {
  467. zPC->stepOut();
  468. return 1;
  469. }
  470. ( (Spieler *)t )->setLevel( ( (Integer *)zMemory->zVariable( zPC->getUniqueString() + "R0__" ) )->getValue() );
  471. zPC->stepOut();
  472. return 1;
  473. }
  474. }
  475. zPC->stepOut();
  476. return 0;
  477. }
  478. SpielerGiveItem::SpielerGiveItem( Aktion *item, Aktion *anzahl, Aktion *spieler )
  479. : Aktion( SPIELER_GIVE_ITEM )
  480. {
  481. this->item = item;
  482. this->anzahl = anzahl;
  483. this->spieler = spieler;
  484. }
  485. SpielerGiveItem::~SpielerGiveItem()
  486. {}
  487. bool SpielerGiveItem::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  488. {
  489. zPC->stepIn();
  490. if( zPC->currentPosition() == 0 )
  491. {
  492. if( item->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  493. {
  494. Variable *t = zMemory->zVariable( "__return__" );
  495. if( !t || t->getVariableTyp() != GEGENSTAND_TYP )
  496. {
  497. zPC->stepOut();
  498. return 1;
  499. }
  500. zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
  501. zPC->count();
  502. }
  503. }
  504. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  505. {
  506. if( anzahl->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  507. {
  508. Variable *t = zMemory->zVariable( "__return__" );
  509. if( !t || t->getVariableTyp() != INTEGER )
  510. {
  511. zPC->stepOut();
  512. return 1;
  513. }
  514. zMemory->setVar( zPC->getUniqueString() + "R1__", t->getThis() );
  515. zPC->count();
  516. }
  517. }
  518. if( zPC->currentPosition() == 2 && waitCount <= 0 )
  519. {
  520. if( spieler->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  521. {
  522. Variable *t = zMemory->zVariable( "__return__" );
  523. if( !t || t->getVariableTyp() != SPIELER )
  524. {
  525. zPC->stepOut();
  526. return 1;
  527. }
  528. ( (Spieler *)t )->addItem( ( (GegenstandTypVar *)zMemory->zVariable( zPC->getUniqueString() + "R0__" ) )->getValue(),
  529. ( (Integer *)zMemory->zVariable( zPC->getUniqueString() + "R1__" ) )->getValue(), zSpiel );
  530. zPC->stepOut();
  531. return 1;
  532. }
  533. }
  534. zPC->stepOut();
  535. return 0;
  536. }
  537. SpielerRemoveItem::SpielerRemoveItem( Aktion *item, Aktion *anzahl, Aktion *spieler )
  538. : Aktion( SPIELER_REMOVE_ITEM )
  539. {
  540. this->item = item;
  541. this->anzahl = anzahl;
  542. this->spieler = spieler;
  543. }
  544. SpielerRemoveItem::~SpielerRemoveItem()
  545. {
  546. item->release();
  547. anzahl->release();
  548. spieler->release();
  549. }
  550. bool SpielerRemoveItem::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  551. {
  552. zPC->stepIn();
  553. if( zPC->currentPosition() == 0 )
  554. {
  555. if( item->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  556. {
  557. Variable *t = zMemory->zVariable( "__return__" );
  558. if( !t || t->getVariableTyp() != GEGENSTAND_TYP )
  559. {
  560. zPC->stepOut();
  561. return 1;
  562. }
  563. zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
  564. zPC->count();
  565. }
  566. }
  567. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  568. {
  569. if( anzahl->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  570. {
  571. Variable *t = zMemory->zVariable( "__return__" );
  572. if( !t || t->getVariableTyp() != INTEGER )
  573. {
  574. zPC->stepOut();
  575. return 1;
  576. }
  577. zMemory->setVar( zPC->getUniqueString() + "R1__", t->getThis() );
  578. zPC->count();
  579. }
  580. }
  581. if( zPC->currentPosition() == 2 && waitCount <= 0 )
  582. {
  583. if( spieler->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  584. {
  585. Variable *t = zMemory->zVariable( "__return__" );
  586. if( !t || t->getVariableTyp() != SPIELER )
  587. {
  588. zPC->stepOut();
  589. return 1;
  590. }
  591. ( (Spieler *)t )->removeItem( ( (GegenstandTypVar *)zMemory->zVariable( zPC->getUniqueString() + "R0__" ) )->getValue(),
  592. ( (Integer *)zMemory->zVariable( zPC->getUniqueString() + "R1__" ) )->getValue() );
  593. zPC->stepOut();
  594. return 1;
  595. }
  596. }
  597. zPC->stepOut();
  598. return 0;
  599. }
  600. SpielerSetPosition::SpielerSetPosition( Aktion *x, Aktion *y, Aktion *spieler )
  601. : Aktion( SPIELER_SET_POSITION )
  602. {
  603. this->x = x;
  604. this->y = y;
  605. this->spieler = spieler;
  606. }
  607. SpielerSetPosition::~SpielerSetPosition()
  608. {
  609. x->release();
  610. y->release();
  611. spieler->release();
  612. }
  613. bool SpielerSetPosition::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  614. {
  615. zPC->stepIn();
  616. if( zPC->currentPosition() == 0 )
  617. {
  618. if( x->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  619. {
  620. Variable *t = zMemory->zVariable( "__return__" );
  621. if( !t || t->getVariableTyp() != FLOAT )
  622. {
  623. zPC->stepOut();
  624. return 1;
  625. }
  626. zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
  627. zPC->count();
  628. }
  629. }
  630. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  631. {
  632. if( y->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  633. {
  634. Variable *t = zMemory->zVariable( "__return__" );
  635. if( !t || t->getVariableTyp() != FLOAT )
  636. {
  637. zPC->stepOut();
  638. return 1;
  639. }
  640. zMemory->setVar( zPC->getUniqueString() + "R1__", t->getThis() );
  641. zPC->count();
  642. }
  643. }
  644. if( zPC->currentPosition() == 2 && waitCount <= 0 )
  645. {
  646. if( spieler->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  647. {
  648. Variable *t = zMemory->zVariable( "__return__" );
  649. if( !t || t->getVariableTyp() != SPIELER )
  650. {
  651. zPC->stepOut();
  652. return 1;
  653. }
  654. ( (Spieler *)t )->setX( ( (Float *)zMemory->zVariable( zPC->getUniqueString() + "R0__" ) )->getValue() );
  655. ( (Spieler *)t )->setY( ( (Float *)zMemory->zVariable( zPC->getUniqueString() + "R1__" ) )->getValue() );
  656. zPC->stepOut();
  657. return 1;
  658. }
  659. }
  660. zPC->stepOut();
  661. return 0;
  662. }
  663. SpielerSetLeben::SpielerSetLeben( Aktion *leben, Aktion *spieler )
  664. : Aktion( SPIELER_SET_LEBEN )
  665. {
  666. this->leben = leben;
  667. this->spieler = spieler;
  668. }
  669. SpielerSetLeben::~SpielerSetLeben()
  670. {
  671. leben->release();
  672. spieler->release();
  673. }
  674. bool SpielerSetLeben::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  675. {
  676. zPC->stepIn();
  677. if( zPC->currentPosition() == 0 )
  678. {
  679. if( leben->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  680. {
  681. Variable *t = zMemory->zVariable( "__return__" );
  682. if( !t || t->getVariableTyp() != FLOAT )
  683. {
  684. zPC->stepOut();
  685. return 1;
  686. }
  687. zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
  688. zPC->count();
  689. }
  690. }
  691. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  692. {
  693. if( spieler->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  694. {
  695. Variable *t = zMemory->zVariable( "__return__" );
  696. if( !t || t->getVariableTyp() != SPIELER )
  697. {
  698. zPC->stepOut();
  699. return 1;
  700. }
  701. ( (Spieler *)t )->setLeben( ( (Float *)zMemory->zVariable( zPC->getUniqueString() + "R0__" ) )->getValue() );
  702. zPC->stepOut();
  703. return 1;
  704. }
  705. }
  706. zPC->stepOut();
  707. return 0;
  708. }
  709. SpielerSetMaxLeben::SpielerSetMaxLeben( Aktion *leben, Aktion *spieler )
  710. : Aktion( SPIELER_SET_LEBEN )
  711. {
  712. this->leben = leben;
  713. this->spieler = spieler;
  714. }
  715. SpielerSetMaxLeben::~SpielerSetMaxLeben()
  716. {
  717. leben->release();
  718. spieler->release();
  719. }
  720. bool SpielerSetMaxLeben::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  721. {
  722. zPC->stepIn();
  723. if( zPC->currentPosition() == 0 )
  724. {
  725. if( leben->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  726. {
  727. Variable *t = zMemory->zVariable( "__return__" );
  728. if( !t || t->getVariableTyp() != INTEGER )
  729. {
  730. zPC->stepOut();
  731. return 1;
  732. }
  733. zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
  734. zPC->count();
  735. }
  736. }
  737. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  738. {
  739. if( spieler->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  740. {
  741. Variable *t = zMemory->zVariable( "__return__" );
  742. if( !t || t->getVariableTyp() != SPIELER )
  743. {
  744. zPC->stepOut();
  745. return 1;
  746. }
  747. ( (Spieler *)t )->setMaxLeben( ( (Integer *)zMemory->zVariable( zPC->getUniqueString() + "R0__" ) )->getValue() );
  748. zPC->stepOut();
  749. return 1;
  750. }
  751. }
  752. zPC->stepOut();
  753. return 0;
  754. }
  755. SpielerSetErfahrung::SpielerSetErfahrung( Aktion *erfahrung, Aktion *spieler )
  756. : Aktion( SPIELER_SET_ERFAHRUNG )
  757. {
  758. this->erfahrung = erfahrung;
  759. this->spieler = spieler;
  760. }
  761. SpielerSetErfahrung::~SpielerSetErfahrung()
  762. {}
  763. bool SpielerSetErfahrung::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  764. {
  765. zPC->stepIn();
  766. if( zPC->currentPosition() == 0 )
  767. {
  768. if( erfahrung->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  769. {
  770. Variable *t = zMemory->zVariable( "__return__" );
  771. if( !t || t->getVariableTyp() != FLOAT )
  772. {
  773. zPC->stepOut();
  774. return 1;
  775. }
  776. zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
  777. zPC->count();
  778. }
  779. }
  780. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  781. {
  782. if( spieler->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  783. {
  784. Variable *t = zMemory->zVariable( "__return__" );
  785. if( !t || t->getVariableTyp() != SPIELER )
  786. {
  787. zPC->stepOut();
  788. return 1;
  789. }
  790. ( (Spieler *)t )->setErfahrung( ( (Float *)zMemory->zVariable( zPC->getUniqueString() + "R0__" ) )->getValue() );
  791. zPC->stepOut();
  792. return 1;
  793. }
  794. }
  795. zPC->stepOut();
  796. return 0;
  797. }
  798. SpielerSetMaxErfahrung::SpielerSetMaxErfahrung( Aktion *erfahrung, Aktion *spieler )
  799. : Aktion( SPIELER_SET_MAX_ERFAHRUNG )
  800. {
  801. this->erfahrung = erfahrung;
  802. this->spieler = spieler;
  803. }
  804. SpielerSetMaxErfahrung::~SpielerSetMaxErfahrung()
  805. {
  806. erfahrung->release();
  807. spieler->release();
  808. }
  809. bool SpielerSetMaxErfahrung::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  810. {
  811. zPC->stepIn();
  812. if( zPC->currentPosition() == 0 )
  813. {
  814. if( erfahrung->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  815. {
  816. Variable *t = zMemory->zVariable( "__return__" );
  817. if( !t || t->getVariableTyp() != INTEGER )
  818. {
  819. zPC->stepOut();
  820. return 1;
  821. }
  822. zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
  823. zPC->count();
  824. }
  825. }
  826. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  827. {
  828. if( spieler->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  829. {
  830. Variable *t = zMemory->zVariable( "__return__" );
  831. if( !t || t->getVariableTyp() != SPIELER )
  832. {
  833. zPC->stepOut();
  834. return 1;
  835. }
  836. ( (Spieler *)t )->setMaxErfahrung( ( (Integer *)zMemory->zVariable( zPC->getUniqueString() + "R0__" ) )->getValue() );
  837. zPC->stepOut();
  838. return 1;
  839. }
  840. }
  841. zPC->stepOut();
  842. return 0;
  843. }
  844. SpielerSetTempo::SpielerSetTempo( Aktion *tempo, Aktion *spieler )
  845. : Aktion( SPIELER_SET_TEMPO )
  846. {
  847. this->tempo = tempo;
  848. this->spieler = spieler;
  849. }
  850. SpielerSetTempo::~SpielerSetTempo()
  851. {
  852. tempo->release();
  853. spieler->release();
  854. }
  855. bool SpielerSetTempo::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  856. {
  857. zPC->stepIn();
  858. if( zPC->currentPosition() == 0 )
  859. {
  860. if( tempo->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  861. {
  862. Variable *t = zMemory->zVariable( "__return__" );
  863. if( !t || t->getVariableTyp() != FLOAT )
  864. {
  865. zPC->stepOut();
  866. return 1;
  867. }
  868. zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
  869. zPC->count();
  870. }
  871. }
  872. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  873. {
  874. if( spieler->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  875. {
  876. Variable *t = zMemory->zVariable( "__return__" );
  877. if( !t || t->getVariableTyp() != SPIELER )
  878. {
  879. zPC->stepOut();
  880. return 1;
  881. }
  882. ( (Spieler *)t )->setLaufTempo( ( (Float *)zMemory->zVariable( zPC->getUniqueString() + "R0__" ) )->getValue() );
  883. zPC->stepOut();
  884. return 1;
  885. }
  886. }
  887. zPC->stepOut();
  888. return 0;
  889. }
  890. SpielerSetWaffenTempo::SpielerSetWaffenTempo( Aktion *tempo, Aktion *spieler )
  891. : Aktion( SPIELER_SET_GESCHOSS_TEMPO )
  892. {
  893. this->tempo = tempo;
  894. this->spieler = spieler;
  895. }
  896. SpielerSetWaffenTempo::~SpielerSetWaffenTempo()
  897. {
  898. tempo->release();
  899. spieler->release();
  900. }
  901. bool SpielerSetWaffenTempo::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  902. {
  903. zPC->stepIn();
  904. if( zPC->currentPosition() == 0 )
  905. {
  906. if( tempo->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  907. {
  908. Variable *t = zMemory->zVariable( "__return__" );
  909. if( !t || t->getVariableTyp() != FLOAT )
  910. {
  911. zPC->stepOut();
  912. return 1;
  913. }
  914. zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
  915. zPC->count();
  916. }
  917. }
  918. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  919. {
  920. if( spieler->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  921. {
  922. Variable *t = zMemory->zVariable( "__return__" );
  923. if( !t || t->getVariableTyp() != SPIELER )
  924. {
  925. zPC->stepOut();
  926. return 1;
  927. }
  928. ( (Spieler *)t )->setGeschossTempo( ( (Float *)zMemory->zVariable( zPC->getUniqueString() + "R0__" ) )->getValue() );
  929. zPC->stepOut();
  930. return 1;
  931. }
  932. }
  933. zPC->stepOut();
  934. return 0;
  935. }
  936. SpielerSetArmor::SpielerSetArmor( Aktion *armor, Aktion *spieler )
  937. : Aktion( SPIELER_SET_ARMOR )
  938. {
  939. this->armor = armor;
  940. this->spieler = spieler;
  941. }
  942. SpielerSetArmor::~SpielerSetArmor()
  943. {
  944. armor->release();
  945. spieler->release();
  946. }
  947. bool SpielerSetArmor::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  948. {
  949. zPC->stepIn();
  950. if( zPC->currentPosition() == 0 )
  951. {
  952. if( armor->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  953. {
  954. Variable *t = zMemory->zVariable( "__return__" );
  955. if( !t || t->getVariableTyp() != FLOAT )
  956. {
  957. zPC->stepOut();
  958. return 1;
  959. }
  960. zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
  961. zPC->count();
  962. }
  963. }
  964. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  965. {
  966. if( spieler->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  967. {
  968. Variable *t = zMemory->zVariable( "__return__" );
  969. if( !t || t->getVariableTyp() != SPIELER )
  970. {
  971. zPC->stepOut();
  972. return 1;
  973. }
  974. ( (Spieler *)t )->setArmor( ( (Float *)zMemory->zVariable( zPC->getUniqueString() + "R0__" ) )->getValue() );
  975. zPC->stepOut();
  976. return 1;
  977. }
  978. }
  979. zPC->stepOut();
  980. return 0;
  981. }
  982. SpielerSetSchadenBonus::SpielerSetSchadenBonus( Aktion *bonus, Aktion *spieler )
  983. : Aktion( SPIELER_SET_SCHADEN_BONUS )
  984. {
  985. this->bonus = bonus;
  986. this->spieler = spieler;
  987. }
  988. SpielerSetSchadenBonus::~SpielerSetSchadenBonus()
  989. {
  990. bonus->release();
  991. spieler->release();
  992. }
  993. bool SpielerSetSchadenBonus::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  994. {
  995. zPC->stepIn();
  996. if( zPC->currentPosition() == 0 )
  997. {
  998. if( bonus->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  999. {
  1000. Variable *t = zMemory->zVariable( "__return__" );
  1001. if( !t || t->getVariableTyp() != FLOAT )
  1002. {
  1003. zPC->stepOut();
  1004. return 1;
  1005. }
  1006. zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
  1007. zPC->count();
  1008. }
  1009. }
  1010. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  1011. {
  1012. if( spieler->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1013. {
  1014. Variable *t = zMemory->zVariable( "__return__" );
  1015. if( !t || t->getVariableTyp() != SPIELER )
  1016. {
  1017. zPC->stepOut();
  1018. return 1;
  1019. }
  1020. ( (Spieler *)t )->setSchadenBonus( ( (Float *)zMemory->zVariable( zPC->getUniqueString() + "R0__" ) )->getValue() );
  1021. zPC->stepOut();
  1022. return 1;
  1023. }
  1024. }
  1025. zPC->stepOut();
  1026. return 0;
  1027. }
  1028. SpielerSetLebensraub::SpielerSetLebensraub( Aktion *lebensraub, Aktion *spieler )
  1029. : Aktion( SPIELER_SET_LEBENSRAUB )
  1030. {
  1031. this->lebensraub = lebensraub;
  1032. this->spieler = spieler;
  1033. }
  1034. SpielerSetLebensraub::~SpielerSetLebensraub()
  1035. {
  1036. lebensraub->release();
  1037. spieler->release();
  1038. }
  1039. bool SpielerSetLebensraub::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  1040. {
  1041. zPC->stepIn();
  1042. if( zPC->currentPosition() == 0 )
  1043. {
  1044. if( lebensraub->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1045. {
  1046. Variable *t = zMemory->zVariable( "__return__" );
  1047. if( !t || t->getVariableTyp() != FLOAT )
  1048. {
  1049. zPC->stepOut();
  1050. return 1;
  1051. }
  1052. zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
  1053. zPC->count();
  1054. }
  1055. }
  1056. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  1057. {
  1058. if( spieler->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1059. {
  1060. Variable *t = zMemory->zVariable( "__return__" );
  1061. if( !t || t->getVariableTyp() != SPIELER )
  1062. {
  1063. zPC->stepOut();
  1064. return 1;
  1065. }
  1066. ( (Spieler *)t )->setLebensRaub( ( (Float *)zMemory->zVariable( zPC->getUniqueString() + "R0__" ) )->getValue() );
  1067. zPC->stepOut();
  1068. return 1;
  1069. }
  1070. }
  1071. zPC->stepOut();
  1072. return 0;
  1073. }
  1074. SpielerSetLebensregeneration::SpielerSetLebensregeneration( Aktion *regeneration, Aktion *spieler )
  1075. : Aktion( SPIELER_SET_LEBENSRAUB )
  1076. {
  1077. this->regeneration = regeneration;
  1078. this->spieler = spieler;
  1079. }
  1080. SpielerSetLebensregeneration::~SpielerSetLebensregeneration()
  1081. {
  1082. regeneration->release();
  1083. spieler->release();
  1084. }
  1085. bool SpielerSetLebensregeneration::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  1086. {
  1087. zPC->stepIn();
  1088. if( zPC->currentPosition() == 0 )
  1089. {
  1090. if( regeneration->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1091. {
  1092. Variable *t = zMemory->zVariable( "__return__" );
  1093. if( !t || t->getVariableTyp() != FLOAT )
  1094. {
  1095. zPC->stepOut();
  1096. return 1;
  1097. }
  1098. zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
  1099. zPC->count();
  1100. }
  1101. }
  1102. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  1103. {
  1104. if( spieler->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1105. {
  1106. Variable *t = zMemory->zVariable( "__return__" );
  1107. if( !t || t->getVariableTyp() != SPIELER )
  1108. {
  1109. zPC->stepOut();
  1110. return 1;
  1111. }
  1112. ( (Spieler *)t )->setLebensRegeneration( ( (Float *)zMemory->zVariable( zPC->getUniqueString() + "R0__" ) )->getValue() );
  1113. zPC->stepOut();
  1114. return 1;
  1115. }
  1116. }
  1117. zPC->stepOut();
  1118. return 0;
  1119. }
  1120. SpielerSetAbklingzeitverringerung::SpielerSetAbklingzeitverringerung( Aktion *verringerung, Aktion *spieler )
  1121. : Aktion( SPIELER_SET_ABKLINGZEITVERRINGERUNG )
  1122. {
  1123. this->verringerung = verringerung;
  1124. this->spieler = spieler;
  1125. }
  1126. SpielerSetAbklingzeitverringerung::~SpielerSetAbklingzeitverringerung()
  1127. {
  1128. verringerung->release();
  1129. spieler->release();
  1130. }
  1131. bool SpielerSetAbklingzeitverringerung::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  1132. {
  1133. zPC->stepIn();
  1134. if( zPC->currentPosition() == 0 )
  1135. {
  1136. if( verringerung->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1137. {
  1138. Variable *t = zMemory->zVariable( "__return__" );
  1139. if( !t || t->getVariableTyp() != FLOAT )
  1140. {
  1141. zPC->stepOut();
  1142. return 1;
  1143. }
  1144. zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
  1145. zPC->count();
  1146. }
  1147. }
  1148. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  1149. {
  1150. if( spieler->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1151. {
  1152. Variable *t = zMemory->zVariable( "__return__" );
  1153. if( !t || t->getVariableTyp() != SPIELER )
  1154. {
  1155. zPC->stepOut();
  1156. return 1;
  1157. }
  1158. ( (Spieler *)t )->setAbklingZeitVerringerung( ( (Float *)zMemory->zVariable( zPC->getUniqueString() + "R0__" ) )->getValue() );
  1159. zPC->stepOut();
  1160. return 1;
  1161. }
  1162. }
  1163. zPC->stepOut();
  1164. return 0;
  1165. }
  1166. DropSetTime::DropSetTime( Aktion *time, Aktion *drop )
  1167. : Aktion( DROP_SET_TIME )
  1168. {
  1169. this->time = time;
  1170. this->drop = drop;
  1171. }
  1172. DropSetTime::~DropSetTime()
  1173. {
  1174. time->release();
  1175. drop->release();
  1176. }
  1177. bool DropSetTime::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  1178. {
  1179. zPC->stepIn();
  1180. if( zPC->currentPosition() == 0 )
  1181. {
  1182. if( time->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1183. {
  1184. Variable *t = zMemory->zVariable( "__return__" );
  1185. if( !t || t->getVariableTyp() != FLOAT )
  1186. {
  1187. zPC->stepOut();
  1188. return 1;
  1189. }
  1190. zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
  1191. zPC->count();
  1192. }
  1193. }
  1194. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  1195. {
  1196. if( drop->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1197. {
  1198. Variable *t = zMemory->zVariable( "__return__" );
  1199. if( !t || t->getVariableTyp() != DROP )
  1200. {
  1201. zPC->stepOut();
  1202. return 1;
  1203. }
  1204. ( (Drop *)t )->setTime( ( (Float *)zMemory->zVariable( zPC->getUniqueString() + "R0__" ) )->getValue() );
  1205. zPC->stepOut();
  1206. return 1;
  1207. }
  1208. }
  1209. zPC->stepOut();
  1210. return 0;
  1211. }
  1212. DropSetMaxTime::DropSetMaxTime( Aktion *time, Aktion *drop )
  1213. : Aktion( DROP_SET_MAX_TIME )
  1214. {
  1215. this->time = time;
  1216. this->drop = drop;
  1217. }
  1218. DropSetMaxTime::~DropSetMaxTime()
  1219. {
  1220. time->release();
  1221. drop->release();
  1222. }
  1223. bool DropSetMaxTime::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  1224. {
  1225. zPC->stepIn();
  1226. if( zPC->currentPosition() == 0 )
  1227. {
  1228. if( time->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1229. {
  1230. Variable *t = zMemory->zVariable( "__return__" );
  1231. if( !t || t->getVariableTyp() != INTEGER )
  1232. {
  1233. zPC->stepOut();
  1234. return 1;
  1235. }
  1236. zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
  1237. zPC->count();
  1238. }
  1239. }
  1240. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  1241. {
  1242. if( drop->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1243. {
  1244. Variable *t = zMemory->zVariable( "__return__" );
  1245. if( !t || t->getVariableTyp() != DROP )
  1246. {
  1247. zPC->stepOut();
  1248. return 1;
  1249. }
  1250. ( (Drop *)t )->setMaxTime( ( (Integer *)zMemory->zVariable( zPC->getUniqueString() + "R0__" ) )->getValue() );
  1251. zPC->stepOut();
  1252. return 1;
  1253. }
  1254. }
  1255. zPC->stepOut();
  1256. return 0;
  1257. }
  1258. DropSetArea::DropSetArea( Aktion *minX, Aktion *maxX, Aktion *minY, Aktion *maxY, Aktion *drop )
  1259. : Aktion( DROP_SET_AREA )
  1260. {
  1261. this->minX = minX;
  1262. this->maxX = maxX;
  1263. this->minY = minY;
  1264. this->maxY = maxY;
  1265. this->drop = drop;
  1266. }
  1267. DropSetArea::~DropSetArea()
  1268. {
  1269. minX->release();
  1270. maxX->release();
  1271. minY->release();
  1272. maxY->release();
  1273. drop->release();
  1274. }
  1275. bool DropSetArea::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  1276. {
  1277. zPC->stepIn();
  1278. if( zPC->currentPosition() == 0 )
  1279. {
  1280. if( minX->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1281. {
  1282. Variable *t = zMemory->zVariable( "__return__" );
  1283. if( !t || t->getVariableTyp() != INTEGER )
  1284. {
  1285. zPC->stepOut();
  1286. return 1;
  1287. }
  1288. zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
  1289. zPC->count();
  1290. }
  1291. }
  1292. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  1293. {
  1294. if( maxX->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1295. {
  1296. Variable *t = zMemory->zVariable( "__return__" );
  1297. if( !t || t->getVariableTyp() != INTEGER )
  1298. {
  1299. zPC->stepOut();
  1300. return 1;
  1301. }
  1302. zMemory->setVar( zPC->getUniqueString() + "R1__", t->getThis() );
  1303. zPC->count();
  1304. }
  1305. }
  1306. if( zPC->currentPosition() == 2 && waitCount <= 0 )
  1307. {
  1308. if( minY->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1309. {
  1310. Variable *t = zMemory->zVariable( "__return__" );
  1311. if( !t || t->getVariableTyp() != INTEGER )
  1312. {
  1313. zPC->stepOut();
  1314. return 1;
  1315. }
  1316. zMemory->setVar( zPC->getUniqueString() + "R2__", t->getThis() );
  1317. zPC->count();
  1318. }
  1319. }
  1320. if( zPC->currentPosition() == 3 && waitCount <= 0 )
  1321. {
  1322. if( maxY->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1323. {
  1324. Variable *t = zMemory->zVariable( "__return__" );
  1325. if( !t || t->getVariableTyp() != INTEGER )
  1326. {
  1327. zPC->stepOut();
  1328. return 1;
  1329. }
  1330. zMemory->setVar( zPC->getUniqueString() + "R3__", t->getThis() );
  1331. zPC->count();
  1332. }
  1333. }
  1334. if( zPC->currentPosition() == 4 && waitCount <= 0 )
  1335. {
  1336. if( drop->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1337. {
  1338. Variable *t = zMemory->zVariable( "__return__" );
  1339. if( !t || t->getVariableTyp() != DROP )
  1340. {
  1341. zPC->stepOut();
  1342. return 1;
  1343. }
  1344. ( (Drop *)t )->setMinX( ( (Integer *)zMemory->zVariable( zPC->getUniqueString() + "R0__" ) )->getValue() );
  1345. ( (Drop *)t )->setMaxX( ( (Integer *)zMemory->zVariable( zPC->getUniqueString() + "R1__" ) )->getValue() );
  1346. ( (Drop *)t )->setMinY( ( (Integer *)zMemory->zVariable( zPC->getUniqueString() + "R2__" ) )->getValue() );
  1347. ( (Drop *)t )->setMaxY( ( (Integer *)zMemory->zVariable( zPC->getUniqueString() + "R3__" ) )->getValue() );
  1348. zPC->stepOut();
  1349. return 1;
  1350. }
  1351. }
  1352. zPC->stepOut();
  1353. return 0;
  1354. }
  1355. DropDoDrop::DropDoDrop( Aktion *drop )
  1356. : Aktion( DROP_DO_DROP )
  1357. {
  1358. this->drop = drop;
  1359. }
  1360. DropDoDrop::~DropDoDrop()
  1361. {}
  1362. bool DropDoDrop::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  1363. {
  1364. if( drop->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1365. {
  1366. Variable *t = zMemory->zVariable( "__return__" );
  1367. if( !t || t->getVariableTyp() != DROP )
  1368. {
  1369. zPC->stepOut();
  1370. return 1;
  1371. }
  1372. ( (Drop *)t )->doDrop( zSpiel );
  1373. return 1;
  1374. }
  1375. return 0;
  1376. }
  1377. BariereSetEingeschaltet::BariereSetEingeschaltet( Aktion *eingeschaltet, Aktion *bariere )
  1378. : Aktion( BARIERE_SET_EINGESCHALTET )
  1379. {
  1380. this->eingeschaltet = eingeschaltet;
  1381. this->bariere = bariere;
  1382. }
  1383. BariereSetEingeschaltet::~BariereSetEingeschaltet()
  1384. {
  1385. eingeschaltet->release();
  1386. bariere->release();
  1387. }
  1388. bool BariereSetEingeschaltet::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  1389. {
  1390. zPC->stepIn();
  1391. if( zPC->currentPosition() == 0 )
  1392. {
  1393. if( eingeschaltet->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1394. {
  1395. Variable *t = zMemory->zVariable( "__return__" );
  1396. if( !t || t->getVariableTyp() != BOOLEAN )
  1397. {
  1398. zPC->stepOut();
  1399. return 1;
  1400. }
  1401. zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
  1402. zPC->count();
  1403. }
  1404. }
  1405. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  1406. {
  1407. if( bariere->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1408. {
  1409. Variable *t = zMemory->zVariable( "__return__" );
  1410. if( !t || t->getVariableTyp() != BARIERE )
  1411. {
  1412. zPC->stepOut();
  1413. return 1;
  1414. }
  1415. ( (Bariere *)t )->setEingeschaltet( ( (Boolean *)zMemory->zVariable( zPC->getUniqueString() + "R0__" ) )->getValue() );
  1416. zPC->stepOut();
  1417. return 1;
  1418. }
  1419. }
  1420. zPC->stepOut();
  1421. return 0;
  1422. }
  1423. BariereSetPosition::BariereSetPosition( Aktion *x, Aktion *y, Aktion *bariere )
  1424. : Aktion( BARIERE_SET_POSITION )
  1425. {
  1426. this->x = x;
  1427. this->y = y;
  1428. this->bariere = bariere;
  1429. }
  1430. BariereSetPosition::~BariereSetPosition()
  1431. {
  1432. x->release();
  1433. y->release();
  1434. bariere->release();
  1435. }
  1436. bool BariereSetPosition::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  1437. {
  1438. zPC->stepIn();
  1439. if( zPC->currentPosition() == 0 )
  1440. {
  1441. if( x->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1442. {
  1443. Variable *t = zMemory->zVariable( "__return__" );
  1444. if( !t || t->getVariableTyp() != FLOAT )
  1445. {
  1446. zPC->stepOut();
  1447. return 1;
  1448. }
  1449. zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
  1450. zPC->count();
  1451. }
  1452. }
  1453. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  1454. {
  1455. if( y->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1456. {
  1457. Variable *t = zMemory->zVariable( "__return__" );
  1458. if( !t || t->getVariableTyp() != FLOAT )
  1459. {
  1460. zPC->stepOut();
  1461. return 1;
  1462. }
  1463. zMemory->setVar( zPC->getUniqueString() + "R1__", t->getThis() );
  1464. zPC->count();
  1465. }
  1466. }
  1467. if( zPC->currentPosition() == 2 && waitCount <= 0 )
  1468. {
  1469. if( bariere->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1470. {
  1471. Variable *t = zMemory->zVariable( "__return__" );
  1472. if( !t || t->getVariableTyp() != BARIERE )
  1473. {
  1474. zPC->stepOut();
  1475. return 1;
  1476. }
  1477. ( (Bariere *)t )->setX( ( (Float *)zMemory->zVariable( zPC->getUniqueString() + "R0__" ) )->getValue() );
  1478. ( (Bariere *)t )->setY( ( (Float *)zMemory->zVariable( zPC->getUniqueString() + "R1__" ) )->getValue() );
  1479. zPC->stepOut();
  1480. return 1;
  1481. }
  1482. }
  1483. zPC->stepOut();
  1484. return 0;
  1485. }
  1486. BariereSetTeam::BariereSetTeam( Aktion *team, Aktion *bariere )
  1487. : Aktion( BARIERE_SET_TEAM )
  1488. {
  1489. this->team = team;
  1490. this->bariere = bariere;
  1491. }
  1492. BariereSetTeam::~BariereSetTeam()
  1493. {
  1494. team->release();
  1495. bariere->release();
  1496. }
  1497. bool BariereSetTeam::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  1498. {
  1499. zPC->stepIn();
  1500. if( zPC->currentPosition() == 0 )
  1501. {
  1502. if( team->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1503. {
  1504. Variable *t = zMemory->zVariable( "__return__" );
  1505. if( !t || t->getVariableTyp() != TEAM )
  1506. {
  1507. zPC->stepOut();
  1508. return 1;
  1509. }
  1510. zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
  1511. zPC->count();
  1512. }
  1513. }
  1514. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  1515. {
  1516. if( bariere->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1517. {
  1518. Variable *t = zMemory->zVariable( "__return__" );
  1519. if( !t || t->getVariableTyp() != BARIERE )
  1520. {
  1521. zPC->stepOut();
  1522. return 1;
  1523. }
  1524. ( (Bariere *)t )->setTeam( ( (Team *)zMemory->getVariable( zPC->getUniqueString() + "R0__" ) ) );
  1525. zPC->stepOut();
  1526. return 1;
  1527. }
  1528. }
  1529. zPC->stepOut();
  1530. return 0;
  1531. }
  1532. SchalterSetPosition::SchalterSetPosition( Aktion *x, Aktion *y, Aktion *schalter )
  1533. : Aktion( SCHALTER_SET_POSITION )
  1534. {
  1535. this->x = x;
  1536. this->y = y;
  1537. this->schalter = schalter;
  1538. }
  1539. SchalterSetPosition::~SchalterSetPosition()
  1540. {
  1541. x->release();
  1542. y->release();
  1543. schalter->release();
  1544. }
  1545. bool SchalterSetPosition::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  1546. {
  1547. zPC->stepIn();
  1548. if( zPC->currentPosition() == 0 )
  1549. {
  1550. if( x->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1551. {
  1552. Variable *t = zMemory->zVariable( "__return__" );
  1553. if( !t || t->getVariableTyp() != FLOAT )
  1554. {
  1555. zPC->stepOut();
  1556. return 1;
  1557. }
  1558. zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
  1559. zPC->count();
  1560. }
  1561. }
  1562. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  1563. {
  1564. if( y->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1565. {
  1566. Variable *t = zMemory->zVariable( "__return__" );
  1567. if( !t || t->getVariableTyp() != FLOAT )
  1568. {
  1569. zPC->stepOut();
  1570. return 1;
  1571. }
  1572. zMemory->setVar( zPC->getUniqueString() + "R1__", t->getThis() );
  1573. zPC->count();
  1574. }
  1575. }
  1576. if( zPC->currentPosition() == 2 && waitCount <= 0 )
  1577. {
  1578. if( schalter->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1579. {
  1580. Variable *t = zMemory->zVariable( "__return__" );
  1581. if( !t || t->getVariableTyp() != SCHALTER )
  1582. {
  1583. zPC->stepOut();
  1584. return 1;
  1585. }
  1586. ( (Schalter *)t )->setX( ( (Float *)zMemory->zVariable( zPC->getUniqueString() + "R0__" ) )->getValue() );
  1587. ( (Schalter *)t )->setY( ( (Float *)zMemory->zVariable( zPC->getUniqueString() + "R1__" ) )->getValue() );
  1588. zPC->stepOut();
  1589. return 1;
  1590. }
  1591. }
  1592. zPC->stepOut();
  1593. return 0;
  1594. }
  1595. SchalterSetErlaubt::SchalterSetErlaubt( Aktion *erlaubt, Aktion *schalter )
  1596. : Aktion( SCHALTER_SET_ERLAUBT )
  1597. {
  1598. this->erlaubt = erlaubt;
  1599. this->schalter = schalter;
  1600. }
  1601. SchalterSetErlaubt::~SchalterSetErlaubt()
  1602. {
  1603. erlaubt->release();
  1604. schalter->release();
  1605. }
  1606. bool SchalterSetErlaubt::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  1607. {
  1608. zPC->stepIn();
  1609. if( zPC->currentPosition() == 0 )
  1610. {
  1611. if( erlaubt->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1612. {
  1613. Variable *t = zMemory->zVariable( "__return__" );
  1614. if( !t || t->getVariableTyp() != BOOLEAN )
  1615. {
  1616. zPC->stepOut();
  1617. return 1;
  1618. }
  1619. zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
  1620. zPC->count();
  1621. }
  1622. }
  1623. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  1624. {
  1625. if( schalter->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1626. {
  1627. Variable *t = zMemory->zVariable( "__return__" );
  1628. if( !t || t->getVariableTyp() != SCHALTER )
  1629. {
  1630. zPC->stepOut();
  1631. return 1;
  1632. }
  1633. ( (Schalter *)t )->setAktive( ( (Boolean *)zMemory->zVariable( zPC->getUniqueString() + "R0__" ) )->getValue() );
  1634. zPC->stepOut();
  1635. return 1;
  1636. }
  1637. }
  1638. zPC->stepOut();
  1639. return 0;
  1640. }
  1641. SchalterAktivieren::SchalterAktivieren( Aktion *schalter )
  1642. : Aktion( SCHALTER_AKTIVIEREN )
  1643. {
  1644. this->schalter = schalter;
  1645. }
  1646. SchalterAktivieren::~SchalterAktivieren()
  1647. {
  1648. schalter->release();
  1649. }
  1650. bool SchalterAktivieren::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  1651. {
  1652. if( schalter->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1653. {
  1654. Variable *t = zMemory->zVariable( "__return__" );
  1655. if( !t || t->getVariableTyp() != SCHALTER )
  1656. {
  1657. zPC->stepOut();
  1658. return 1;
  1659. }
  1660. zSpiel->activateShalter( ( (Schalter *)t )->getId() );
  1661. return 1;
  1662. }
  1663. return 0;
  1664. }
  1665. TunnelSetPosition::TunnelSetPosition( Aktion *x, Aktion *y, Aktion *tunnel )
  1666. : Aktion( TUNNEL_SET_POSITION )
  1667. {
  1668. this->x = x;
  1669. this->y = y;
  1670. this->tunnel = tunnel;
  1671. }
  1672. TunnelSetPosition::~TunnelSetPosition()
  1673. {
  1674. x->release();
  1675. y->release();
  1676. tunnel->release();
  1677. }
  1678. bool TunnelSetPosition::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  1679. {
  1680. zPC->stepIn();
  1681. if( zPC->currentPosition() == 0 )
  1682. {
  1683. if( x->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1684. {
  1685. Variable *t = zMemory->zVariable( "__return__" );
  1686. if( !t || t->getVariableTyp() != FLOAT )
  1687. {
  1688. zPC->stepOut();
  1689. return 1;
  1690. }
  1691. zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
  1692. zPC->count();
  1693. }
  1694. }
  1695. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  1696. {
  1697. if( y->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1698. {
  1699. Variable *t = zMemory->zVariable( "__return__" );
  1700. if( !t || t->getVariableTyp() != FLOAT )
  1701. {
  1702. zPC->stepOut();
  1703. return 1;
  1704. }
  1705. zMemory->setVar( zPC->getUniqueString() + "R1__", t->getThis() );
  1706. zPC->count();
  1707. }
  1708. }
  1709. if( zPC->currentPosition() == 2 && waitCount <= 0 )
  1710. {
  1711. if( tunnel->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1712. {
  1713. Variable *t = zMemory->zVariable( "__return__" );
  1714. if( !t || t->getVariableTyp() != TUNNEL )
  1715. {
  1716. zPC->stepOut();
  1717. return 1;
  1718. }
  1719. ( (Tunnel *)t )->setX( ( (Float *)zMemory->zVariable( zPC->getUniqueString() + "R0__" ) )->getValue() );
  1720. ( (Tunnel *)t )->setY( ( (Float *)zMemory->zVariable( zPC->getUniqueString() + "R1__" ) )->getValue() );
  1721. zPC->stepOut();
  1722. return 1;
  1723. }
  1724. }
  1725. zPC->stepOut();
  1726. return 0;
  1727. }
  1728. TunnelSetZielPosition::TunnelSetZielPosition( Aktion *x, Aktion *y, Aktion *tunnel )
  1729. : Aktion( TUNNEL_SET_ZIEL_POSITION )
  1730. {
  1731. this->x = x;
  1732. this->y = y;
  1733. this->tunnel = tunnel;
  1734. }
  1735. TunnelSetZielPosition::~TunnelSetZielPosition()
  1736. {
  1737. x->release();
  1738. y->release();
  1739. tunnel->release();
  1740. }
  1741. bool TunnelSetZielPosition::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  1742. {
  1743. zPC->stepIn();
  1744. if( zPC->currentPosition() == 0 )
  1745. {
  1746. if( x->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1747. {
  1748. Variable *t = zMemory->zVariable( "__return__" );
  1749. if( !t || t->getVariableTyp() != INTEGER )
  1750. {
  1751. zPC->stepOut();
  1752. return 1;
  1753. }
  1754. zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
  1755. zPC->count();
  1756. }
  1757. }
  1758. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  1759. {
  1760. if( y->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1761. {
  1762. Variable *t = zMemory->zVariable( "__return__" );
  1763. if( !t || t->getVariableTyp() != INTEGER )
  1764. {
  1765. zPC->stepOut();
  1766. return 1;
  1767. }
  1768. zMemory->setVar( zPC->getUniqueString() + "R1__", t->getThis() );
  1769. zPC->count();
  1770. }
  1771. }
  1772. if( zPC->currentPosition() == 2 && waitCount <= 0 )
  1773. {
  1774. if( tunnel->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1775. {
  1776. Variable *t = zMemory->zVariable( "__return__" );
  1777. if( !t || t->getVariableTyp() != TUNNEL )
  1778. {
  1779. zPC->stepOut();
  1780. return 1;
  1781. }
  1782. ( (Tunnel *)t )->setZielX( ( (Integer *)zMemory->zVariable( zPC->getUniqueString() + "R0__" ) )->getValue() );
  1783. ( (Tunnel *)t )->setZielY( ( (Integer *)zMemory->zVariable( zPC->getUniqueString() + "R1__" ) )->getValue() );
  1784. zPC->stepOut();
  1785. return 1;
  1786. }
  1787. }
  1788. zPC->stepOut();
  1789. return 0;
  1790. }
  1791. TunnelSetErlaubt::TunnelSetErlaubt( Aktion *erlaubt, Aktion *tunnel )
  1792. : Aktion( TUNNEL_SET_ERLAUBT )
  1793. {
  1794. this->erlaubt = erlaubt;
  1795. this->tunnel = tunnel;
  1796. }
  1797. TunnelSetErlaubt::~TunnelSetErlaubt()
  1798. {
  1799. erlaubt->release();
  1800. tunnel->release();
  1801. }
  1802. bool TunnelSetErlaubt::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  1803. {
  1804. zPC->stepIn();
  1805. if( zPC->currentPosition() == 0 )
  1806. {
  1807. if( erlaubt->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1808. {
  1809. Variable *t = zMemory->zVariable( "__return__" );
  1810. if( !t || t->getVariableTyp() != BOOLEAN )
  1811. {
  1812. zPC->stepOut();
  1813. return 1;
  1814. }
  1815. zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
  1816. zPC->count();
  1817. }
  1818. }
  1819. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  1820. {
  1821. if( tunnel->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1822. {
  1823. Variable *t = zMemory->zVariable( "__return__" );
  1824. if( !t || t->getVariableTyp() != TUNNEL )
  1825. {
  1826. zPC->stepOut();
  1827. return 1;
  1828. }
  1829. ( (Tunnel *)t )->setAktiv( ( (Boolean *)zMemory->zVariable( zPC->getUniqueString() + "R0__" ) )->getValue() );
  1830. zPC->stepOut();
  1831. return 1;
  1832. }
  1833. }
  1834. zPC->stepOut();
  1835. return 0;
  1836. }
  1837. UmlenkungSetPosition::UmlenkungSetPosition( Aktion *x, Aktion *y, Aktion *umlenkung )
  1838. : Aktion( UMLENKUNG_SET_POSITION )
  1839. {
  1840. this->x = x;
  1841. this->y = y;
  1842. this->umlenkung = umlenkung;
  1843. }
  1844. UmlenkungSetPosition::~UmlenkungSetPosition()
  1845. {
  1846. x->release();
  1847. y->release();
  1848. umlenkung->release();
  1849. }
  1850. bool UmlenkungSetPosition::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  1851. {
  1852. zPC->stepIn();
  1853. if( zPC->currentPosition() == 0 )
  1854. {
  1855. if( x->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1856. {
  1857. Variable *t = zMemory->zVariable( "__return__" );
  1858. if( !t || t->getVariableTyp() != FLOAT )
  1859. {
  1860. zPC->stepOut();
  1861. return 1;
  1862. }
  1863. zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
  1864. zPC->count();
  1865. }
  1866. }
  1867. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  1868. {
  1869. if( y->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1870. {
  1871. Variable *t = zMemory->zVariable( "__return__" );
  1872. if( !t || t->getVariableTyp() != FLOAT )
  1873. {
  1874. zPC->stepOut();
  1875. return 1;
  1876. }
  1877. zMemory->setVar( zPC->getUniqueString() + "R1__", t->getThis() );
  1878. zPC->count();
  1879. }
  1880. }
  1881. if( zPC->currentPosition() == 2 && waitCount <= 0 )
  1882. {
  1883. if( umlenkung->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1884. {
  1885. Variable *t = zMemory->zVariable( "__return__" );
  1886. if( !t || t->getVariableTyp() != UMLENKUNG )
  1887. {
  1888. zPC->stepOut();
  1889. return 1;
  1890. }
  1891. ( (Umlenkung *)t )->setX( ( (Float *)zMemory->zVariable( zPC->getUniqueString() + "R0__" ) )->getValue() );
  1892. ( (Umlenkung *)t )->setY( ( (Float *)zMemory->zVariable( zPC->getUniqueString() + "R1__" ) )->getValue() );
  1893. zPC->stepOut();
  1894. return 1;
  1895. }
  1896. }
  1897. zPC->stepOut();
  1898. return 0;
  1899. }
  1900. UmlenkungSetRichtung::UmlenkungSetRichtung( Aktion *richtung, Aktion *umlenkung )
  1901. : Aktion( UMLENKUNG_SET_RICHTUNG )
  1902. {
  1903. this->richtung = richtung;
  1904. this->umlenkung = umlenkung;
  1905. }
  1906. UmlenkungSetRichtung::~UmlenkungSetRichtung()
  1907. {
  1908. richtung->release();
  1909. umlenkung->release();
  1910. }
  1911. bool UmlenkungSetRichtung::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  1912. {
  1913. zPC->stepIn();
  1914. if( zPC->currentPosition() == 0 )
  1915. {
  1916. if( richtung->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1917. {
  1918. Variable *t = zMemory->zVariable( "__return__" );
  1919. if( !t || t->getVariableTyp() != RICHTUNG )
  1920. {
  1921. zPC->stepOut();
  1922. return 1;
  1923. }
  1924. zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
  1925. zPC->count();
  1926. }
  1927. }
  1928. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  1929. {
  1930. if( umlenkung->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1931. {
  1932. Variable *t = zMemory->zVariable( "__return__" );
  1933. if( !t || t->getVariableTyp() != UMLENKUNG )
  1934. {
  1935. zPC->stepOut();
  1936. return 1;
  1937. }
  1938. ( (Umlenkung *)t )->setRichtung( getRichtungFromString( ( (String *)zMemory->zVariable( zPC->getUniqueString() + "R0__" ) )->getValue() ) );
  1939. zPC->stepOut();
  1940. return 1;
  1941. }
  1942. }
  1943. zPC->stepOut();
  1944. return 0;
  1945. }
  1946. UmlenkungSetMaxAbk::UmlenkungSetMaxAbk( Aktion *abk, Aktion *umlenkung )
  1947. : Aktion( UMLENKUNG_SET_MAX_ABK )
  1948. {
  1949. this->abk = abk;
  1950. this->umlenkung = umlenkung;
  1951. }
  1952. UmlenkungSetMaxAbk::~UmlenkungSetMaxAbk()
  1953. {
  1954. abk->release();
  1955. umlenkung->release();
  1956. }
  1957. bool UmlenkungSetMaxAbk::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  1958. {
  1959. zPC->stepIn();
  1960. if( zPC->currentPosition() == 0 )
  1961. {
  1962. if( richtung->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1963. {
  1964. Variable *t = zMemory->zVariable( "__return__" );
  1965. if( !t || t->getVariableTyp() != INTEGER )
  1966. {
  1967. zPC->stepOut();
  1968. return 1;
  1969. }
  1970. zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
  1971. zPC->count();
  1972. }
  1973. }
  1974. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  1975. {
  1976. if( umlenkung->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  1977. {
  1978. Variable *t = zMemory->zVariable( "__return__" );
  1979. if( !t || t->getVariableTyp() != UMLENKUNG )
  1980. {
  1981. zPC->stepOut();
  1982. return 1;
  1983. }
  1984. ( (Umlenkung *)t )->setMaxAbklingzeit( ( (Integer *)zMemory->zVariable( zPC->getUniqueString() + "R0__" ) )->getValue() );
  1985. zPC->stepOut();
  1986. return 1;
  1987. }
  1988. }
  1989. zPC->stepOut();
  1990. return 0;
  1991. }
  1992. UmlenkungSetEnabled::UmlenkungSetEnabled( Aktion *enabled, Aktion *umlenkung )
  1993. : Aktion( UMLENKUNG_SET_ERLAUBT )
  1994. {
  1995. this->enabled = enabled;
  1996. this->umlenkung = umlenkung;
  1997. }
  1998. UmlenkungSetEnabled::~UmlenkungSetEnabled()
  1999. {
  2000. enabled->release();
  2001. umlenkung->release();
  2002. }
  2003. bool UmlenkungSetEnabled::runNext( Spiel *zSpiel, Ereignis *zEreignis, LocalMemory *zMemory, ProgramCounter *zPC, double &waitCount )
  2004. {
  2005. zPC->stepIn();
  2006. if( zPC->currentPosition() == 0 )
  2007. {
  2008. if( enabled->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  2009. {
  2010. Variable *t = zMemory->zVariable( "__return__" );
  2011. if( !t || t->getVariableTyp() != BOOLEAN )
  2012. {
  2013. zPC->stepOut();
  2014. return 1;
  2015. }
  2016. zMemory->setVar( zPC->getUniqueString() + "R0__", t->getThis() );
  2017. zPC->count();
  2018. }
  2019. }
  2020. if( zPC->currentPosition() == 1 && waitCount <= 0 )
  2021. {
  2022. if( umlenkung->runNext( zSpiel, zEreignis, zMemory, zPC, waitCount ) )
  2023. {
  2024. Variable *t = zMemory->zVariable( "__return__" );
  2025. if( !t || t->getVariableTyp() != UMLENKUNG )
  2026. {
  2027. zPC->stepOut();
  2028. return 1;
  2029. }
  2030. ( (Umlenkung *)t )->setAktiv( ( (Boolean *)zMemory->zVariable( zPC->getUniqueString() + "R0__" ) )->getValue() );
  2031. zPC->stepOut();
  2032. return 1;
  2033. }
  2034. }
  2035. zPC->stepOut();
  2036. return 0;
  2037. }