Gruppe.cpp 57 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460
  1. #include "Gruppe.h"
  2. #include <Punkt.h>
  3. #include <Rahmen.h>
  4. #include "..\..\..\Global\Variablen.h"
  5. #include "..\..\..\Global\Initialisierung.h"
  6. #include "..\..\..\Leser\KartenLeser.h"
  7. #include <DateiSystem.h>
  8. #include <AlphaFeld.h>
  9. #include <ToolTip.h>
  10. // Inhalt der GruppeEinladungAccount Klasse aus Gruppe.h
  11. // Konstruktor
  12. GruppeEinladungAccount::GruppeEinladungAccount( Schrift *zSchrift )
  13. {
  14. Bild *nachrichtBild = bilder->get( "chat.ltdb/nachricht.png" );
  15. if( !nachrichtBild )
  16. {
  17. LTDBDatei *datei = new LTDBDatei();
  18. datei->setDatei( new Text( "data/client/bilder/chat.ltdb" ) );
  19. datei->leseDaten( 0 );
  20. nachrichtBild = datei->laden( 0, new Text( "nachricht.png" ) );
  21. datei->release();
  22. bilder->add( "chat.ltdb/nachricht.png", nachrichtBild->getThis() );
  23. }
  24. Bild *neuSendenBild = bilder->get( "chat.ltdb/neusenden.png" );
  25. if( !neuSendenBild )
  26. {
  27. LTDBDatei *datei = new LTDBDatei();
  28. datei->setDatei( new Text( "data/client/bilder/chat.ltdb" ) );
  29. datei->leseDaten( 0 );
  30. neuSendenBild = datei->laden( 0, new Text( "neusenden.png" ) );
  31. datei->release();
  32. bilder->add( "chat.ltdb/neusenden.png", neuSendenBild->getThis() );
  33. }
  34. Bild *entfernenBild = bilder->get( "chat.ltdb/entfernen.png" );
  35. if( !entfernenBild )
  36. {
  37. LTDBDatei *datei = new LTDBDatei();
  38. datei->setDatei( new Text( "data/client/bilder/chat.ltdb" ) );
  39. datei->leseDaten( 0 );
  40. entfernenBild = datei->laden( 0, new Text( "entfernen.png" ) );
  41. datei->release();
  42. bilder->add( "chat.ltdb/entfernen.png", entfernenBild->getThis() );
  43. }
  44. rahmen = new LRahmen();
  45. rahmen->setFarbe( 0xFFFFFFFF );
  46. rahmen->setRamenBreite( 1 );
  47. auswahl = new AlphaFeld();
  48. auswahl->setFarbe( 0x0000FF00 );
  49. auswahl->setStärke( -2 );
  50. auswahl->setPosition( 1, 1 );
  51. name = initTextFeld( 0, 5, 100, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, "" );
  52. nachrichtSenden = initKnopf( 0, 30, 20, 20, 0, 0, "" );
  53. nachrichtSenden->setStyle( Knopf::Style::Sichtbar | Knopf::Style::Erlaubt | Knopf::Style::Hintergrund | Knopf::Style::HAlpha | Knopf::Style::HBild | Knopf::Style::KlickBuffer );
  54. nachrichtSenden->setHintergrundBildZ( nachrichtBild );
  55. initToolTip( nachrichtSenden, "Nachricht senden.", zSchrift->getThis(), hauptScreen );
  56. erneutSenden = initKnopf( 0, 30, 20, 20, 0, 0, "" );
  57. erneutSenden->setStyle( Knopf::Style::Sichtbar | Knopf::Style::Erlaubt | Knopf::Style::Hintergrund | Knopf::Style::HAlpha | Knopf::Style::HBild | Knopf::Style::KlickBuffer );
  58. erneutSenden->setHintergrundBildZ( neuSendenBild );
  59. initToolTip( erneutSenden, "Einladung erneut senden.", zSchrift->getThis(), hauptScreen );
  60. einladungAbbrechen = initKnopf( 0, 30, 20, 20, 0, 0, "" );
  61. einladungAbbrechen->setStyle( Knopf::Style::Sichtbar | Knopf::Style::Erlaubt | Knopf::Style::Hintergrund | Knopf::Style::HAlpha | Knopf::Style::HBild | Knopf::Style::KlickBuffer );
  62. einladungAbbrechen->setHintergrundBildZ( entfernenBild );
  63. initToolTip( einladungAbbrechen, "Einladung abbrechen.", zSchrift->getThis(), hauptScreen );
  64. status = 0;
  65. knopfX = 500;
  66. tickVal = 0;
  67. mausIn = 0;
  68. remove = 0;
  69. gruppeId = 0;
  70. accountId = 0;
  71. admin = 0;
  72. höhe = 0;
  73. animation = 0x1;
  74. rend = 0;
  75. ref = 1;
  76. }
  77. // Destruktor
  78. GruppeEinladungAccount::~GruppeEinladungAccount()
  79. {
  80. rahmen->release();
  81. auswahl->release();
  82. name->release();
  83. nachrichtSenden->release();
  84. erneutSenden->release();
  85. einladungAbbrechen->release();
  86. }
  87. // nicht constant
  88. void GruppeEinladungAccount::setGruppeId( int gruppeId )
  89. {
  90. this->gruppeId = gruppeId;
  91. }
  92. void GruppeEinladungAccount::setAccountId( int id )
  93. {
  94. this->accountId = id;
  95. name->setText( infoKlient->getSpielerName( id ) );
  96. rend = 1;
  97. }
  98. void GruppeEinladungAccount::setGröße( int br )
  99. {
  100. if( this->br != br )
  101. rend = 1;
  102. this->br = br;
  103. if( knopfX == 500 )
  104. {
  105. knopfX = br;
  106. rend = 1;
  107. }
  108. }
  109. void GruppeEinladungAccount::setAbgelehnt()
  110. {
  111. status = 1;
  112. }
  113. void GruppeEinladungAccount::setAngenommen()
  114. {
  115. status = 2;
  116. }
  117. void GruppeEinladungAccount::setRemove()
  118. {
  119. animation &= ~0x1;
  120. }
  121. void GruppeEinladungAccount::setAdmin( int admin )
  122. {
  123. this->admin = admin;
  124. }
  125. bool GruppeEinladungAccount::tick( double tickVal )
  126. {
  127. rend |= name->tick( tickVal );
  128. rend |= nachrichtSenden->tick( tickVal );
  129. rend |= erneutSenden->tick( tickVal );
  130. rend |= einladungAbbrechen->tick( tickVal );
  131. this->tickVal += tickVal * 100;
  132. int val = ( int )this->tickVal;
  133. if( val < 1 )
  134. {
  135. bool ret = rend;
  136. rend = 0;
  137. return ret;
  138. }
  139. if( val > 4 )
  140. val = 4;
  141. this->tickVal -= val;
  142. if( ( animation | 0x1 ) == animation )
  143. {
  144. if( höhe < 30 )
  145. {
  146. höhe += val;
  147. if( höhe > 30 )
  148. höhe = 30;
  149. rend = 1;
  150. }
  151. }
  152. else
  153. {
  154. if( höhe > 0 )
  155. {
  156. höhe -= val;
  157. if( höhe < 0 )
  158. höhe = 0;
  159. rend = 1;
  160. }
  161. }
  162. if( mausIn )
  163. {
  164. if( admin == loginKlient->getAccountId() && !status )
  165. {
  166. if( knopfX > br - 60 )
  167. {
  168. knopfX -= val;
  169. if( knopfX < br - 60 )
  170. knopfX = br - 60;
  171. rend = 1;
  172. }
  173. }
  174. else if( admin == loginKlient->getAccountId() && status != 2 )
  175. {
  176. if( knopfX > br - 40 )
  177. {
  178. knopfX -= val;
  179. if( knopfX < br - 40 )
  180. knopfX = br - 40;
  181. rend = 1;
  182. }
  183. }
  184. else
  185. {
  186. if( knopfX > br - 20 )
  187. {
  188. knopfX -= val;
  189. if( knopfX < br - 20 )
  190. knopfX = br - 20;
  191. rend = 1;
  192. }
  193. }
  194. }
  195. else
  196. {
  197. if( knopfX < br )
  198. {
  199. knopfX += val;
  200. if( knopfX > br )
  201. knopfX = br;
  202. rend = 1;
  203. }
  204. }
  205. switch( status )
  206. {
  207. case 1:
  208. if( 1 )
  209. {
  210. int r = ( rahmen->getFarbe() >> 16 ) & 0xFF;
  211. int g = ( rahmen->getFarbe() >> 8 ) & 0xFF;
  212. int b = rahmen->getFarbe() & 0xFF;
  213. if( r < 255 )
  214. {
  215. r += val;
  216. if( r > 255 )
  217. r = 255;
  218. rend = 1;
  219. }
  220. if( g > 0 )
  221. {
  222. g -= val;
  223. if( g < 0 )
  224. g = 0;
  225. rend = 1;
  226. }
  227. if( b > 0 )
  228. {
  229. b -= val;
  230. if( b < 0 )
  231. b = 0;
  232. rend = 1;
  233. }
  234. int f = ( ( r << 16 ) & 0xFF0000 ) | ( ( g << 8 ) & 0xFF00 ) | ( b & 0xFF );
  235. rahmen->setFarbe( ( rahmen->getFarbe() & 0xFF000000 ) | f );
  236. auswahl->setFarbe( ( auswahl->getFarbe() & 0xFF000000 ) | f );
  237. }
  238. break;
  239. case 2:
  240. if( 1 )
  241. {
  242. int r = ( rahmen->getFarbe() >> 16 ) & 0xFF;
  243. int g = ( rahmen->getFarbe() >> 8 ) & 0xFF;
  244. int b = rahmen->getFarbe() & 0xFF;
  245. if( r > 0 )
  246. {
  247. r -= val;
  248. if( r < 0 )
  249. r = 0;
  250. rend = 1;
  251. }
  252. if( g < 255 )
  253. {
  254. g += val;
  255. if( g > 255 )
  256. g = 255;
  257. rend = 1;
  258. }
  259. if( b > 0 )
  260. {
  261. b -= val;
  262. if( b < 0 )
  263. b = 0;
  264. rend = 1;
  265. }
  266. int f = ( ( r << 16 ) & 0xFF0000 ) | ( ( g << 8 ) & 0xFF00 ) | ( b & 0xFF );
  267. rahmen->setFarbe( ( rahmen->getFarbe() & 0xFF000000 ) | f );
  268. auswahl->setFarbe( ( auswahl->getFarbe() & 0xFF000000 ) | f );
  269. }
  270. break;
  271. }
  272. bool ret = rend;
  273. rend = 0;
  274. return ret;
  275. }
  276. void GruppeEinladungAccount::doMausEreignis( MausEreignis &me )
  277. {
  278. if( me.mx < 0 || me.my < 0 || me.mx > br || me.my > höhe )
  279. mausIn = 0;
  280. else
  281. mausIn = 1;
  282. bool ak = !me.verarbeitet;
  283. nachrichtSenden->doMausEreignis( me );
  284. int aktion = ( me.verarbeitet && ak ) ? 1 : 0;
  285. erneutSenden->doMausEreignis( me );
  286. aktion = ( me.verarbeitet && ak && !aktion ) ? 2 : aktion;
  287. einladungAbbrechen->doMausEreignis( me );
  288. aktion = ( me.verarbeitet && ak && !status && !aktion ) ? 3 : aktion;
  289. if( me.id != ME_RLinks || !mausIn )
  290. return;
  291. switch( aktion )
  292. {
  293. case 1:
  294. nachLogin->zChatLeiste()->addChat( accountId, 0 );
  295. break;
  296. case 2:
  297. if( !anmeldungKlient->gruppeSpielerEinladen( accountId, gruppeId ) )
  298. {
  299. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( anmeldungKlient->getLetzterFehler() ),
  300. new Text( "Ok" ), 0, NachrichtType::nachricht, 0 );
  301. }
  302. break;
  303. case 3:
  304. if( !anmeldungKlient->gruppeEinladungAbbrechen( accountId, gruppeId ) )
  305. {
  306. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( anmeldungKlient->getLetzterFehler() ),
  307. new Text( "Ok" ), 0, NachrichtType::nachricht, 0 );
  308. }
  309. break;
  310. }
  311. }
  312. void GruppeEinladungAccount::render( int y, Bild &zrObj )
  313. {
  314. if( !zrObj.setDrawOptions( 0, y, br, höhe ) )
  315. return;
  316. rahmen->setGröße( br, höhe );
  317. rahmen->render( zrObj );
  318. int rbr = rahmen->getRBreite();
  319. if( !zrObj.setDrawOptions( rbr, rbr, br - rbr * 2, höhe - rbr * 2 ) )
  320. {
  321. zrObj.releaseDrawOptions();
  322. return;
  323. }
  324. auswahl->setGröße( br - rbr * 2, höhe - rbr * 2 );
  325. auswahl->render( zrObj );
  326. nachrichtSenden->setPosition( knopfX, 5 );
  327. nachrichtSenden->render( zrObj );
  328. erneutSenden->setPosition( knopfX + 20, 5 );
  329. erneutSenden->render( zrObj );
  330. einladungAbbrechen->setPosition( knopfX + 40, 5 );
  331. einladungAbbrechen->render( zrObj );
  332. name->render( zrObj );
  333. zrObj.releaseDrawOptions();
  334. zrObj.releaseDrawOptions();
  335. }
  336. // constant
  337. bool GruppeEinladungAccount::getRemove() const
  338. {
  339. return remove;
  340. }
  341. int GruppeEinladungAccount::getAccountId() const
  342. {
  343. return accountId;
  344. }
  345. int GruppeEinladungAccount::getHöhe() const
  346. {
  347. return höhe;
  348. }
  349. // Reference Counting
  350. GruppeEinladungAccount *GruppeEinladungAccount::getThis()
  351. {
  352. ref++;
  353. return this;
  354. }
  355. GruppeEinladungAccount *GruppeEinladungAccount::release()
  356. {
  357. ref--;
  358. if( !ref )
  359. delete this;
  360. return 0;
  361. }
  362. // Inhalt der GruppeEinladungListe Klasse aus Gruppe.h
  363. // Konstruktor
  364. GruppeEinladungListe::GruppeEinladungListe( Schrift *zSchrift )
  365. {
  366. schrift = zSchrift->getThis();
  367. Bild *maximierenBild = bilder->get( "chat.ltdb/maximieren.png" );
  368. if( !maximierenBild )
  369. {
  370. LTDBDatei *datei = new LTDBDatei();
  371. datei->setDatei( new Text( "data/client/bilder/chat.ltdb" ) );
  372. datei->leseDaten( 0 );
  373. maximierenBild = datei->laden( 0, new Text( "maximieren.png" ) );
  374. datei->release();
  375. bilder->add( "chat.ltdb/maximieren.png", maximierenBild->getThis() );
  376. }
  377. pos = Punkt( 200, 0 );
  378. gr = Punkt( 150, 350 );
  379. rahmen = new LRahmen();
  380. rahmen->setRamenBreite( 1 );
  381. rahmen->setFarbe( 0xFFFFFFFF );
  382. rahmen->setGröße( 150, 350 );
  383. einladenName = initTextFeld( 5, 5, 115, 20, zSchrift, TextFeld::Style::TextFeld, "" );
  384. initToolTip( einladenName, "Name des Spielers den du einladen möchtest.", zSchrift->getThis(), hauptScreen );
  385. einladen = initKnopf( 125, 5, 20, 20, 0, 0, "" );
  386. einladen->setStyle( Knopf::Style::Sichtbar | Knopf::Style::Erlaubt | Knopf::Style::Hintergrund | Knopf::Style::HAlpha | Knopf::Style::HBild | Knopf::Style::KlickBuffer );
  387. einladen->setHintergrundBildZ( maximierenBild );
  388. initToolTip( einladen, "Diesen Spieler einladen.", zSchrift->getThis(), hauptScreen );
  389. scroll = new VScrollBar();
  390. accounts = new RCArray< GruppeEinladungAccount >();
  391. einladungHöhe = 0;
  392. tickVal = 0;
  393. anzahl = 0;
  394. gruppeId = 0;
  395. admin = 0;
  396. rend = 0;
  397. ref = 1;
  398. }
  399. // Destruktor
  400. GruppeEinladungListe::~GruppeEinladungListe()
  401. {
  402. rahmen->release();
  403. einladenName->release();
  404. einladen->release();
  405. scroll->release();
  406. accounts->release();
  407. schrift->release();
  408. }
  409. // nicht constant
  410. void GruppeEinladungListe::reset()
  411. {
  412. einladenName->setText( "" );
  413. scroll->update( 0, 0 );
  414. einladungHöhe = 0;
  415. tickVal = 0;
  416. accounts->leeren();
  417. anzahl = 0;
  418. gruppeId = 0;
  419. admin = 0;
  420. rend = 1;
  421. }
  422. void GruppeEinladungListe::setGruppeId( int gruppeId )
  423. {
  424. this->gruppeId = gruppeId;
  425. for( int i = 0; i < anzahl; i++ )
  426. accounts->z( i )->setGruppeId( gruppeId );
  427. }
  428. void GruppeEinladungListe::addAccount( int id )
  429. {
  430. for( int i = 0; i < anzahl; i++ )
  431. {
  432. GruppeEinladungAccount *tmp = accounts->z( i );
  433. if( tmp->getAccountId() == id )
  434. tmp->setRemove();
  435. }
  436. GruppeEinladungAccount *tmp = new GruppeEinladungAccount( schrift );
  437. tmp->setGruppeId( gruppeId );
  438. tmp->setAccountId( id );
  439. tmp->setAdmin( admin );
  440. accounts->add( tmp, anzahl );
  441. anzahl++;
  442. rend = 1;
  443. }
  444. void GruppeEinladungListe::setAbgelehnt( int id )
  445. {
  446. for( int i = 0; i < anzahl; i++ )
  447. {
  448. GruppeEinladungAccount *tmp = accounts->z( i );
  449. if( tmp && tmp->getAccountId() == id )
  450. {
  451. tmp->setAbgelehnt();
  452. break;
  453. }
  454. }
  455. }
  456. void GruppeEinladungListe::setAngenommen( int id )
  457. {
  458. for( int i = 0; i < anzahl; i++ )
  459. {
  460. GruppeEinladungAccount *tmp = accounts->z( i );
  461. if( tmp && tmp->getAccountId() == id )
  462. {
  463. tmp->setAngenommen();
  464. break;
  465. }
  466. }
  467. }
  468. void GruppeEinladungListe::remove( int id )
  469. {
  470. for( int i = 0; i < anzahl; i++ )
  471. {
  472. GruppeEinladungAccount *tmp = accounts->z( i );
  473. if( tmp && tmp->getAccountId() == id )
  474. {
  475. tmp->setRemove();
  476. break;
  477. }
  478. }
  479. }
  480. void GruppeEinladungListe::setAdmin( int admin )
  481. {
  482. this->admin = admin;
  483. for( int i = 0; i < anzahl; i++ )
  484. {
  485. GruppeEinladungAccount *tmp = accounts->z( i );
  486. if( tmp )
  487. tmp->setAdmin( admin );
  488. }
  489. }
  490. bool GruppeEinladungListe::tick( double tickVal )
  491. {
  492. rend |= einladenName->tick( tickVal );
  493. rend |= einladen->tick( tickVal );
  494. rend |= scroll->getRend();
  495. this->tickVal += tickVal * 100;
  496. int val = ( int )this->tickVal;
  497. if( val < 1 )
  498. {
  499. bool ret = rend;
  500. rend = 0;
  501. return ret;
  502. }
  503. if( val > 4 )
  504. val = 4;
  505. this->tickVal -= val;
  506. if( admin == loginKlient->getAccountId() )
  507. {
  508. if( einladungHöhe < 30 )
  509. {
  510. einladungHöhe += val;
  511. if( einladungHöhe > 30 )
  512. einladungHöhe = 30;
  513. rend = 1;
  514. }
  515. }
  516. else
  517. {
  518. if( einladungHöhe > 0 )
  519. {
  520. einladungHöhe -= val;
  521. if( einladungHöhe < 0 )
  522. einladungHöhe = 0;
  523. rend = 1;
  524. }
  525. }
  526. for( int i = 0; i < anzahl; i++ )
  527. {
  528. GruppeEinladungAccount *tmp = accounts->z( i );
  529. if( tmp )
  530. rend |= tmp->tick( tickVal );
  531. }
  532. for( int i = 0; i < anzahl; i++ )
  533. {
  534. GruppeEinladungAccount *tmp = accounts->z( i );
  535. if( !tmp->getHöhe() )
  536. {
  537. accounts->lösche( i );
  538. anzahl--;
  539. rend = 1;
  540. }
  541. }
  542. bool ret = rend;
  543. rend = 0;
  544. return ret;
  545. }
  546. void GruppeEinladungListe::doMausEreignis( MausEreignis &me )
  547. {
  548. int tmpX = me.mx;
  549. int tmpY = me.my;
  550. me.mx -= pos.x;
  551. me.my -= pos.y;
  552. if( einladungHöhe == 30 )
  553. {
  554. einladenName->doMausEreignis( me );
  555. bool ak = !me.verarbeitet;
  556. einladen->doMausEreignis( me );
  557. if( me.verarbeitet && ak )
  558. {
  559. if( me.id == ME_RLinks )
  560. {
  561. if( einladenName->zText()->getLänge() )
  562. {
  563. int accountId = infoKlient->getAccountId( einladenName->zText()->getText() );
  564. if( accountId )
  565. {
  566. if( !anmeldungKlient->gruppeSpielerEinladen( accountId, gruppeId ) )
  567. {
  568. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( anmeldungKlient->getLetzterFehler() ),
  569. new Text( "Ok" ), 0, NachrichtType::nachricht, 0 );
  570. }
  571. else
  572. {
  573. einladenName->setText( "" );
  574. einladenName->setAuswahl( 0, 0 );
  575. rend = 1;
  576. }
  577. }
  578. else
  579. {
  580. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( "Der Account wurde nicht gefunden." ),
  581. new Text( "Ok" ), 0, NachrichtType::nachricht, 0 );
  582. }
  583. }
  584. }
  585. return;
  586. }
  587. }
  588. scroll->doMausMessage( 134, 1 + einladungHöhe, 15, 348 - einladungHöhe, me );
  589. me.my -= einladungHöhe + 1;
  590. for( int i = 0; i < anzahl; i++ )
  591. {
  592. GruppeEinladungAccount *tmp = accounts->z( i );
  593. if( tmp )
  594. {
  595. tmp->doMausEreignis( me );
  596. if( tmp->getRemove() )
  597. {
  598. accounts->lösche( i );
  599. anzahl--;
  600. rend = 1;
  601. }
  602. me.my -= tmp->getHöhe();
  603. }
  604. }
  605. me.mx = tmpX;
  606. me.my = tmpY;
  607. }
  608. void GruppeEinladungListe::doTastaturEreignis( TastaturEreignis &te )
  609. {
  610. bool b = !te.verarbeitet;
  611. einladenName->doTastaturEreignis( te );
  612. if( te.verarbeitet && b && te.id == TE_Release && te.taste == T_Enter )
  613. {
  614. if( einladenName->zText()->getLänge() )
  615. {
  616. int accountId = infoKlient->getAccountId( einladenName->zText()->getText() );
  617. if( accountId )
  618. {
  619. if( !anmeldungKlient->gruppeSpielerEinladen( accountId, gruppeId ) )
  620. {
  621. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( anmeldungKlient->getLetzterFehler() ),
  622. new Text( "Ok" ), 0, NachrichtType::nachricht, 0 );
  623. }
  624. else
  625. {
  626. einladenName->setText( "" );
  627. einladenName->setAuswahl( 0, 0 );
  628. rend = 1;
  629. }
  630. }
  631. else
  632. {
  633. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( "Der Account wurde nicht gefunden." ),
  634. new Text( "Ok" ), 0, NachrichtType::nachricht, 0 );
  635. }
  636. }
  637. }
  638. }
  639. void GruppeEinladungListe::render( Bild &zRObj )
  640. {
  641. if( !zRObj.setDrawOptions( pos, gr ) )
  642. return;
  643. rahmen->render( zRObj );
  644. int rbr = rahmen->getRBreite();
  645. if( einladungHöhe )
  646. {
  647. if( zRObj.setDrawOptions( rbr, rbr, gr.x - rbr * 2, einladungHöhe - rbr * 2 ) )
  648. {
  649. einladenName->render( zRObj );
  650. einladen->render( zRObj );
  651. zRObj.releaseDrawOptions();
  652. }
  653. }
  654. if( !zRObj.setDrawOptions( rbr, einladungHöhe + rbr, gr.x - rbr * 2, gr.y - rbr * 2 ) )
  655. {
  656. zRObj.releaseDrawOptions();
  657. return;
  658. }
  659. scroll->render( 134, 0, 15, 348 - einladungHöhe, zRObj );
  660. int höhe = 0;
  661. for( int i = 0; i < anzahl; i++ )
  662. {
  663. GruppeEinladungAccount *tmp = accounts->z( i );
  664. if( tmp )
  665. {
  666. tmp->setGröße( gr.x - 15 - rbr * 2 );
  667. tmp->render( höhe - scroll->getScrollData()->anzeigeBeginn, zRObj );
  668. höhe += tmp->getHöhe();
  669. }
  670. }
  671. scroll->update( höhe, gr.y - rbr * 2 - einladungHöhe );
  672. zRObj.releaseDrawOptions();
  673. zRObj.releaseDrawOptions();
  674. }
  675. // constant
  676. // Reference Counting
  677. GruppeEinladungListe *GruppeEinladungListe::getThis()
  678. {
  679. ref++;
  680. return this;
  681. }
  682. GruppeEinladungListe *GruppeEinladungListe::release()
  683. {
  684. ref--;
  685. if( !ref )
  686. delete this;
  687. return 0;
  688. }
  689. // Inhalt der GruppeAccountDaten Klasse aus Gruppe.h
  690. // Konstruktor
  691. GruppeAccountDaten::GruppeAccountDaten( Schrift *zSchrift )
  692. {
  693. Bild *nachrichtBild = bilder->get( "chat.ltdb/nachricht.png" );
  694. if( !nachrichtBild )
  695. {
  696. LTDBDatei *datei = new LTDBDatei();
  697. datei->setDatei( new Text( "data/client/bilder/chat.ltdb" ) );
  698. datei->leseDaten( 0 );
  699. nachrichtBild = datei->laden( 0, new Text( "nachricht.png" ) );
  700. datei->release();
  701. bilder->add( "chat.ltdb/nachricht.png", nachrichtBild->getThis() );
  702. }
  703. Bild *einladungBild = bilder->get( "chat.ltdb/neuerfreund.png" );
  704. if( !nachrichtBild )
  705. {
  706. LTDBDatei *datei = new LTDBDatei();
  707. datei->setDatei( new Text( "data/client/bilder/chat.ltdb" ) );
  708. datei->leseDaten( 0 );
  709. einladungBild = datei->laden( 0, new Text( "neuerfreund.png" ) );
  710. datei->release();
  711. bilder->add( "chat.ltdb/neuerfreund.png", einladungBild->getThis() );
  712. }
  713. Bild *ansehenBild = bilder->get( "chat.ltdb/ansehen.png" );
  714. if( !ansehenBild )
  715. {
  716. LTDBDatei *datei = new LTDBDatei();
  717. datei->setDatei( new Text( "data/client/bilder/chat.ltdb" ) );
  718. datei->leseDaten( 0 );
  719. ansehenBild = datei->laden( 0, new Text( "ansehen.png" ) );
  720. datei->release();
  721. bilder->add( "chat.ltdb/ansehen.png", ansehenBild->getThis() );
  722. }
  723. Bild *entfernenBild = bilder->get( "chat.ltdb/entfernen.png" );
  724. if( !entfernenBild )
  725. {
  726. LTDBDatei *datei = new LTDBDatei();
  727. datei->setDatei( new Text( "data/client/bilder/chat.ltdb" ) );
  728. datei->leseDaten( 0 );
  729. entfernenBild = datei->laden( 0, new Text( "entfernen.png" ) );
  730. datei->release();
  731. bilder->add( "chat.ltdb/entfernen.png", entfernenBild->getThis() );
  732. }
  733. rahmen = new LRahmen();
  734. rahmen->setFarbe( 0xFFFFFFFF );
  735. rahmen->setRamenBreite( 1 );
  736. auswahl = new AlphaFeld();
  737. auswahl->setFarbe( 0x0000FF00 );
  738. auswahl->setStärke( -2 );
  739. auswahl->setPosition( 1, 1 );
  740. name = initTextFeld( 1, 6, 100, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, "" );
  741. punkte = initTextFeld( 101, 6, 100, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, "0p" );
  742. nachrichtSenden = initKnopf( 0, 30, 20, 20, 0, 0, "" );
  743. nachrichtSenden->setStyle( Knopf::Style::Sichtbar | Knopf::Style::Erlaubt | Knopf::Style::Hintergrund | Knopf::Style::HAlpha | Knopf::Style::HBild | Knopf::Style::KlickBuffer );
  744. nachrichtSenden->setHintergrundBildZ( nachrichtBild );
  745. initToolTip( nachrichtSenden, "Nachricht senden.", zSchrift->getThis(), hauptScreen );
  746. freundEinladung = initKnopf( 0, 30, 20, 20, 0, 0, "" );
  747. freundEinladung->setStyle( Knopf::Style::Sichtbar | Knopf::Style::Erlaubt | Knopf::Style::Hintergrund | Knopf::Style::HAlpha | Knopf::Style::HBild | Knopf::Style::KlickBuffer );
  748. freundEinladung->setHintergrundBildZ( einladungBild );
  749. initToolTip( freundEinladung, "Freundeseinladung senden.", zSchrift->getThis(), hauptScreen );
  750. accountAnsehen = initKnopf( 0, 30, 20, 20, 0, 0, "" );
  751. accountAnsehen->setStyle( Knopf::Style::Sichtbar | Knopf::Style::Erlaubt | Knopf::Style::Hintergrund | Knopf::Style::HAlpha | Knopf::Style::HBild | Knopf::Style::KlickBuffer );
  752. accountAnsehen->setHintergrundBildZ( ansehenBild );
  753. initToolTip( accountAnsehen, "Account ansehen.", zSchrift->getThis(), hauptScreen );
  754. kick = initKnopf( 0, 30, 20, 20, 0, 0, "" );
  755. kick->setStyle( Knopf::Style::Sichtbar | Knopf::Style::Erlaubt | Knopf::Style::Hintergrund | Knopf::Style::HAlpha | Knopf::Style::HBild | Knopf::Style::KlickBuffer );
  756. kick->setHintergrundBildZ( entfernenBild );
  757. initToolTip( kick, "Diesen Spieler kicken.", zSchrift->getThis(), hauptScreen );
  758. tickVal = 0;
  759. mausIn = 0;
  760. remove = 0;
  761. gruppeId = 0;
  762. accountId = 0;
  763. admin = 0;
  764. höhe = 0;
  765. animation = 0x1;
  766. rend = 0;
  767. ref = 1;
  768. }
  769. // Destruktor
  770. GruppeAccountDaten::~GruppeAccountDaten()
  771. {
  772. rahmen->release();
  773. auswahl->release();
  774. name->release();
  775. punkte->release();
  776. nachrichtSenden->release();
  777. freundEinladung->release();
  778. accountAnsehen->release();
  779. kick->release();
  780. }
  781. // nicht constant
  782. void GruppeAccountDaten::setGruppeId( int gruppeId )
  783. {
  784. this->gruppeId = gruppeId;
  785. }
  786. void GruppeAccountDaten::setAccountId( int id )
  787. {
  788. accountId = id;
  789. name->setText( infoKlient->getSpielerName( id ) );
  790. punkte->setText( "" );
  791. punkte->zText()->anhängen( infoKlient->getSpielerPunkte( id, infoKlient->getSpielId( infoKlient->getGruppenKarteId( gruppeId ) ) ) );
  792. punkte->zText()->anhängen( "p" );
  793. rend = 1;
  794. }
  795. void GruppeAccountDaten::setGröße( int x )
  796. {
  797. if( br != x )
  798. {
  799. br = x;
  800. rend = 1;
  801. }
  802. }
  803. void GruppeAccountDaten::entfernen()
  804. {
  805. animation &= ~0x1;
  806. }
  807. void GruppeAccountDaten::setAdmin( int admin )
  808. {
  809. this->admin = admin;
  810. rend = 1;
  811. }
  812. bool GruppeAccountDaten::tick( double tickVal )
  813. {
  814. rend |= name->tick( tickVal );
  815. rend |= punkte->tick( tickVal );
  816. rend |= nachrichtSenden->tick( tickVal );
  817. rend |= accountAnsehen->tick( tickVal );
  818. rend |= freundEinladung->tick( tickVal );
  819. rend |= kick->tick( tickVal );
  820. this->tickVal += tickVal * 100;
  821. int val = ( int )this->tickVal;
  822. if( val < 1 )
  823. {
  824. bool ret = rend;
  825. rend = 0;
  826. return ret;
  827. }
  828. if( val > 4 )
  829. val = 4;
  830. this->tickVal -= val;
  831. if( admin == accountId )
  832. {
  833. int r = ( auswahl->getFarbe() >> 16 ) & 0xFF;
  834. if( r < 200 )
  835. {
  836. r += val;
  837. if( r > 200 )
  838. r = 200;
  839. auswahl->setFarbe( ( auswahl->getFarbe() & 0xFF00FFFF ) | ( ( r << 16 ) & 0xFF0000 ) );
  840. rend = 1;
  841. }
  842. }
  843. else
  844. {
  845. int r = ( auswahl->getFarbe() >> 16 ) & 0xFF;
  846. if( r > 0 )
  847. {
  848. if( r - val < 0 )
  849. r = 0;
  850. else
  851. r -= val;
  852. auswahl->setFarbe( ( auswahl->getFarbe() & 0xFF00FFFF ) | ( ( r << 16 ) & 0xFF0000 ) );
  853. rend = 1;
  854. }
  855. }
  856. if( ( animation | 0x1 ) == animation )
  857. {
  858. if( höhe < 30 )
  859. {
  860. höhe += val;
  861. if( höhe > 30 )
  862. höhe = 30;
  863. rend = 1;
  864. }
  865. if( mausIn )
  866. {
  867. if( höhe < 50 )
  868. {
  869. höhe += val;
  870. if( höhe > 50 )
  871. höhe = 50;
  872. rend = 1;
  873. }
  874. int a = ( auswahl->getFarbe() >> 24 ) & 0xFF;
  875. if( a < 50 )
  876. {
  877. a += val;
  878. if( a > 50 )
  879. a = 50;
  880. auswahl->setFarbe( ( ( a << 24 ) & 0xFF000000 ) | ( auswahl->getFarbe() & 0xFFFFFF ) );
  881. rend = 1;
  882. }
  883. }
  884. else
  885. {
  886. if( höhe > 30 )
  887. {
  888. höhe -= val;
  889. if( höhe < 30 )
  890. höhe = 30;
  891. rend = 1;
  892. }
  893. int a = ( auswahl->getFarbe() >> 24 ) & 0xFF;
  894. if( a > 0 )
  895. {
  896. if( a - val < 0 )
  897. a = 0;
  898. else
  899. a -= val;
  900. auswahl->setFarbe( ( ( a << 24 ) & 0xFF000000 ) | ( auswahl->getFarbe() & 0xFFFFFF ) );
  901. rend = 1;
  902. }
  903. }
  904. if( accountId != loginKlient->getAccountId() )
  905. {
  906. if( nachrichtSenden->getBreite() < 20 )
  907. {
  908. nachrichtSenden->setGröße( nachrichtSenden->getBreite() + val, nachrichtSenden->getHöhe() );
  909. if( nachrichtSenden->getBreite() > 20 )
  910. nachrichtSenden->setGröße( 20, nachrichtSenden->getHöhe() );
  911. rend = 1;
  912. }
  913. }
  914. else
  915. {
  916. if( nachrichtSenden->getBreite() > 0 )
  917. {
  918. nachrichtSenden->setGröße( nachrichtSenden->getBreite() - val, nachrichtSenden->getHöhe() );
  919. if( nachrichtSenden->getBreite() < 0 )
  920. nachrichtSenden->setGröße( 0, nachrichtSenden->getHöhe() );
  921. rend = 1;
  922. }
  923. }
  924. if( accountAnsehen->getBreite() < 20 )
  925. {
  926. accountAnsehen->setGröße( accountAnsehen->getBreite() + val, accountAnsehen->getHöhe() );
  927. if( accountAnsehen->getBreite() > 20 )
  928. accountAnsehen->setGröße( 20, accountAnsehen->getHöhe() );
  929. rend = 1;
  930. }
  931. if( accountId == loginKlient->getAccountId() || nachLogin->zFreundesListe()->istFreund( accountId ) )
  932. {
  933. if( freundEinladung->getBreite() > 0 )
  934. {
  935. freundEinladung->setGröße( freundEinladung->getBreite() - val, freundEinladung->getHöhe() );
  936. if( freundEinladung->getBreite() < 0 )
  937. freundEinladung->setGröße( 0, freundEinladung->getHöhe() );
  938. rend = 1;
  939. }
  940. }
  941. else
  942. {
  943. if( freundEinladung->getBreite() < 20 )
  944. {
  945. freundEinladung->setGröße( freundEinladung->getBreite() + val, freundEinladung->getHöhe() );
  946. if( freundEinladung->getBreite() > 20 )
  947. freundEinladung->setGröße( 20, freundEinladung->getHöhe() );
  948. rend = 1;
  949. }
  950. }
  951. if( accountId == loginKlient->getAccountId() || admin != loginKlient->getAccountId() )
  952. {
  953. if( kick->getBreite() > 0 )
  954. {
  955. kick->setGröße( kick->getBreite() - val, kick->getHöhe() );
  956. if( kick->getBreite() < 0 )
  957. kick->setGröße( 0, kick->getHöhe() );
  958. rend = 1;
  959. }
  960. }
  961. else
  962. {
  963. if( kick->getBreite() < 20 )
  964. {
  965. kick->setGröße( kick->getBreite() + val, kick->getHöhe() );
  966. if( kick->getBreite() > 20 )
  967. kick->setGröße( 20, kick->getHöhe() );
  968. rend = 1;
  969. }
  970. }
  971. }
  972. else
  973. {
  974. if( höhe > 0 )
  975. {
  976. höhe -= val;
  977. if( höhe <= 0 )
  978. {
  979. höhe = 0;
  980. remove = 1;
  981. }
  982. rend = 1;
  983. }
  984. }
  985. bool ret = rend;
  986. rend = 0;
  987. return ret;
  988. }
  989. void GruppeAccountDaten::doMausEreignis( MausEreignis &me )
  990. {
  991. if( me.mx < 0 || me.my < 0 || me.mx > br || me.my > höhe )
  992. mausIn = 0;
  993. else
  994. mausIn = 1;
  995. bool ak = !me.verarbeitet;
  996. nachrichtSenden->doMausEreignis( me );
  997. int aktion = ( me.verarbeitet && ak ) ? 1 : 0;
  998. accountAnsehen->doMausEreignis( me );
  999. aktion = ( me.verarbeitet && ak && !aktion ) ? 2 : aktion;
  1000. freundEinladung->doMausEreignis( me );
  1001. aktion = ( me.verarbeitet && ak && !aktion ) ? 3 : aktion;
  1002. kick->doMausEreignis( me );
  1003. aktion = ( me.verarbeitet && ak && !aktion ) ? 4 : aktion;
  1004. if( me.id != ME_RLinks )
  1005. return;
  1006. switch( aktion )
  1007. {
  1008. case 1:
  1009. nachLogin->zChatLeiste()->addChat( accountId, 0 );
  1010. break;
  1011. case 2:
  1012. if( nachLogin->zAccountAnsehenFenster()->setSpielerDetails( accountId, 2 ) )
  1013. {
  1014. MausEreignis me = { ME_RLinks, 0, 0, 0, 0, 0 };
  1015. nachLogin->zTitelLeiste()->druckAccountAnsehen( me );
  1016. }
  1017. break;
  1018. case 3:
  1019. chatKlient->freundesAnfrage( accountId );
  1020. break;
  1021. case 4:
  1022. if( !anmeldungKlient->kickSpielerAusGruppe( accountId, gruppeId ) )
  1023. {
  1024. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( anmeldungKlient->getLetzterFehler() ),
  1025. new Text( "Ok" ), 0, NachrichtType::nachricht, 0 );
  1026. }
  1027. break;
  1028. }
  1029. }
  1030. void GruppeAccountDaten::render( int y, Bild &zrObj )
  1031. {
  1032. if( !zrObj.setDrawOptions( 0, y, br, höhe ) )
  1033. return;
  1034. rahmen->setGröße( br, höhe );
  1035. rahmen->render( zrObj );
  1036. int rbr = rahmen->getRBreite();
  1037. auswahl->setPosition( rbr, rbr );
  1038. auswahl->setGröße( br - rbr * 2, höhe - rbr * 2 );
  1039. auswahl->render( zrObj );
  1040. name->render( zrObj );
  1041. punkte->render( zrObj );
  1042. if( !zrObj.setDrawOptions( rbr, rbr, br - rbr * 2, höhe - rbr * 2 ) )
  1043. {
  1044. zrObj.releaseDrawOptions();
  1045. return;
  1046. }
  1047. int b = kick->getBreite();
  1048. kick->setPosition( br - rbr - b, 30 );
  1049. kick->render( zrObj );
  1050. b += freundEinladung->getBreite();
  1051. freundEinladung->setPosition( br - rbr - b, 30 );
  1052. freundEinladung->render( zrObj );
  1053. b += accountAnsehen->getBreite();
  1054. accountAnsehen->setPosition( br - rbr - b, 30 );
  1055. accountAnsehen->render( zrObj );
  1056. b += nachrichtSenden->getBreite();
  1057. nachrichtSenden->setPosition( br - rbr - b, 30 );
  1058. nachrichtSenden->render( zrObj );
  1059. zrObj.releaseDrawOptions();
  1060. zrObj.releaseDrawOptions();
  1061. }
  1062. // constant
  1063. bool GruppeAccountDaten::getRemove() const
  1064. {
  1065. return remove;
  1066. }
  1067. int GruppeAccountDaten::getAccountId() const
  1068. {
  1069. return accountId;
  1070. }
  1071. int GruppeAccountDaten::getHöhe() const
  1072. {
  1073. return höhe;
  1074. }
  1075. // Reference Counting
  1076. GruppeAccountDaten *GruppeAccountDaten::getThis()
  1077. {
  1078. ref++;
  1079. return this;
  1080. }
  1081. GruppeAccountDaten *GruppeAccountDaten::release()
  1082. {
  1083. ref--;
  1084. if( !ref )
  1085. delete this;
  1086. return 0;
  1087. }
  1088. // Inhalt der GruppeAccountListe Klasse aus Gruppe.h
  1089. // Konstruktor
  1090. GruppeAccountListe::GruppeAccountListe( Schrift *zSchrift )
  1091. {
  1092. schrift = zSchrift->getThis();
  1093. pos = Punkt( 0, 0 );
  1094. gr = Punkt( 200, 350 );
  1095. rahmen = new LRahmen();
  1096. rahmen->setFarbe( 0xFFFFFFFF );
  1097. rahmen->setRamenBreite( 1 );
  1098. rahmen->setGröße( 200, 350 );
  1099. scroll = new VScrollBar();
  1100. accounts = new RCArray< GruppeAccountDaten >();
  1101. anzahl = 0;
  1102. gruppeId = 0;
  1103. admin = 0;
  1104. rend = 0;
  1105. ref = 1;
  1106. }
  1107. // Destruktor
  1108. GruppeAccountListe::~GruppeAccountListe()
  1109. {
  1110. schrift->release();
  1111. rahmen->release();
  1112. scroll->release();
  1113. accounts->release();
  1114. }
  1115. // nicht constant
  1116. void GruppeAccountListe::reset()
  1117. {
  1118. accounts->leeren();
  1119. anzahl = 0;
  1120. gruppeId = 0;
  1121. admin = 0;
  1122. rend = 1;
  1123. }
  1124. void GruppeAccountListe::setGruppeId( int gruppeId )
  1125. {
  1126. this->gruppeId = gruppeId;
  1127. for( int i = 0; i < anzahl; i++ )
  1128. accounts->z( i )->setGruppeId( gruppeId );
  1129. }
  1130. void GruppeAccountListe::addAccount( int id )
  1131. {
  1132. GruppeAccountDaten *tmp = new GruppeAccountDaten( schrift );
  1133. tmp->setGruppeId( gruppeId );
  1134. tmp->setAccountId( id );
  1135. tmp->setAdmin( admin );
  1136. accounts->add( tmp, anzahl );
  1137. anzahl++;
  1138. rend = 1;
  1139. }
  1140. void GruppeAccountListe::removeAccount( int id )
  1141. {
  1142. for( int i = 0; i < anzahl; i++ )
  1143. {
  1144. GruppeAccountDaten *tmp = accounts->z( i );
  1145. if( tmp && tmp->getAccountId() == id )
  1146. {
  1147. tmp->entfernen();
  1148. break;
  1149. }
  1150. }
  1151. }
  1152. void GruppeAccountListe::setAdmin( int admin )
  1153. {
  1154. this->admin = admin;
  1155. for( int i = 0; i < anzahl; i++ )
  1156. {
  1157. GruppeAccountDaten *tmp = accounts->z( i );
  1158. if( tmp )
  1159. tmp->setAdmin( admin );
  1160. }
  1161. }
  1162. bool GruppeAccountListe::tick( double tickVal )
  1163. {
  1164. rend |= scroll->getRend();
  1165. for( int i = 0; i < anzahl; i++ )
  1166. {
  1167. GruppeAccountDaten *tmp = accounts->z( i );
  1168. if( tmp )
  1169. rend |= tmp->tick( tickVal );
  1170. }
  1171. bool ret = rend;
  1172. rend = 0;
  1173. return ret;
  1174. }
  1175. void GruppeAccountListe::doMausEreignis( MausEreignis &me )
  1176. {
  1177. int tmpX = me.mx;
  1178. int tmpY = me.my;
  1179. me.mx -= pos.x;
  1180. me.my -= pos.y;
  1181. scroll->doMausMessage( 184, 1, 15, 248, me );
  1182. for( int i = 0; i < anzahl; i++ )
  1183. {
  1184. GruppeAccountDaten *tmp = accounts->z( i );
  1185. if( tmp )
  1186. {
  1187. tmp->doMausEreignis( me );
  1188. if( tmp->getRemove() )
  1189. {
  1190. accounts->lösche( i );
  1191. anzahl--;
  1192. rend = 1;
  1193. }
  1194. me.my -= tmp->getHöhe();
  1195. }
  1196. }
  1197. me.mx = tmpX;
  1198. me.my = tmpY;
  1199. }
  1200. void GruppeAccountListe::render( Bild &zRObj )
  1201. {
  1202. if( !zRObj.setDrawOptions( pos, gr ) )
  1203. return;
  1204. rahmen->render( zRObj );
  1205. int rbr = rahmen->getRBreite();
  1206. scroll->render( gr.x - 15 - rbr, 1, 15, gr.y - rbr * 2, zRObj );
  1207. if( !zRObj.setDrawOptions( rbr, rbr, gr.x - rbr * 2, gr.y - rbr * 2 ) )
  1208. {
  1209. zRObj.releaseDrawOptions();
  1210. return;
  1211. }
  1212. int höhe = 0;
  1213. for( int i = 0; i < anzahl; i++ )
  1214. {
  1215. GruppeAccountDaten *tmp = accounts->z( i );
  1216. if( tmp )
  1217. {
  1218. tmp->setGröße( gr.x - 15 - rbr * 2 );
  1219. tmp->render( höhe - scroll->getScrollData()->anzeigeBeginn, zRObj );
  1220. höhe += tmp->getHöhe();
  1221. }
  1222. }
  1223. zRObj.releaseDrawOptions();
  1224. zRObj.releaseDrawOptions();
  1225. scroll->update( höhe, gr.y - rbr * 2 );
  1226. }
  1227. // constant
  1228. // Reference Counting
  1229. GruppeAccountListe *GruppeAccountListe::getThis()
  1230. {
  1231. ref++;
  1232. return this;
  1233. }
  1234. GruppeAccountListe *GruppeAccountListe::release()
  1235. {
  1236. ref--;
  1237. if( !ref )
  1238. delete this;
  1239. return 0;
  1240. }
  1241. // Inhalt der GruppeChat Klasse aus Gruppe.h
  1242. // Konstruktor
  1243. GruppeChat::GruppeChat( Schrift *zSchrift )
  1244. {
  1245. Bild *sendenBild = bilder->get( "chat.ltdb/senden.png" );
  1246. if( !sendenBild )
  1247. {
  1248. LTDBDatei *datei = new LTDBDatei();
  1249. datei->setDatei( new Text( "data/client/bilder/chat.ltdb" ) );
  1250. datei->leseDaten( 0 );
  1251. sendenBild = datei->laden( 0, new Text( "senden.png" ) );
  1252. datei->release();
  1253. bilder->add( "chat.ltdb/senden.png", sendenBild->getThis() );
  1254. }
  1255. pos = Punkt( 0, 350 );
  1256. gr = Punkt( 750, 200 );
  1257. rahmen = new LRahmen();
  1258. rahmen->setFarbe( 0xFFFFFFFF );
  1259. rahmen->setRamenBreite( 1 );
  1260. rahmen->setGröße( 750, 200 );
  1261. nachricht = initTextFeld( 2, 176, 724, 20, zSchrift, TextFeld::Style::TextFeld, "" );
  1262. initToolTip( nachricht, "Nachricht an die Gruppe senden.", zSchrift->getThis(), hauptScreen );
  1263. senden = initKnopf( 726, 176, 20, 20, 0, 0, "" );
  1264. senden->setStyle( Knopf::Style::Sichtbar | Knopf::Style::Erlaubt | Knopf::Style::Hintergrund | Knopf::Style::HAlpha | Knopf::Style::HBild | Knopf::Style::KlickBuffer );
  1265. senden->setHintergrundBildZ( sendenBild );
  1266. initToolTip( senden, "Diese Nachricht an die Gruppe senden.", zSchrift->getThis(), hauptScreen );
  1267. verlauf = initTextFeld( 2, 2, 746, 174, zSchrift, TextFeld::Style::TextGebiet, "" );
  1268. verlauf->löscheStyle( TextFeld::Style::Erlaubt );
  1269. verlauf->updateVScroll();
  1270. verlauf->setVertikalKlickScroll( 5 );
  1271. gruppeId = 0;
  1272. rend = 0;
  1273. ref = 1;
  1274. }
  1275. // Destruktor
  1276. GruppeChat::~GruppeChat()
  1277. {
  1278. rahmen->release();
  1279. nachricht->release();
  1280. senden->release();
  1281. verlauf->release();
  1282. }
  1283. // nicht constant
  1284. void GruppeChat::reset()
  1285. {
  1286. gruppeId = 0;
  1287. verlauf->setText( "" );
  1288. verlauf->updateVScroll();
  1289. nachricht->setText( "" );
  1290. rend = 1;
  1291. }
  1292. void GruppeChat::setGruppeId( int gruppeId )
  1293. {
  1294. this->gruppeId = gruppeId;
  1295. }
  1296. void GruppeChat::gruppeNachricht( const char *nachricht )
  1297. {
  1298. verlauf->addZeile( nachricht );
  1299. verlauf->updateVScroll();
  1300. rend = 1;
  1301. }
  1302. bool GruppeChat::tick( double tickVal )
  1303. {
  1304. rend |= verlauf->tick( tickVal );
  1305. rend |= nachricht->tick( tickVal );
  1306. rend |= senden->tick( tickVal );
  1307. bool ret = rend;
  1308. rend = 0;
  1309. return ret;
  1310. }
  1311. void GruppeChat::doMausEreignis( MausEreignis &me )
  1312. {
  1313. me.mx -= pos.x;
  1314. me.my -= pos.y;
  1315. verlauf->doMausEreignis( me );
  1316. nachricht->doMausEreignis( me );
  1317. bool ak = !me.verarbeitet;
  1318. senden->doMausEreignis( me );
  1319. int aktion = ( me.verarbeitet && ak ) ? 1 : 0;
  1320. if( me.id != ME_RLinks )
  1321. {
  1322. me.mx += pos.x;
  1323. me.my += pos.y;
  1324. return;
  1325. }
  1326. if( aktion )
  1327. {
  1328. if( anmeldungKlient->gruppeNachricht( gruppeId, nachricht->zText()->getText() ) )
  1329. {
  1330. nachricht->setText( "" );
  1331. nachricht->setAuswahl( 0, 0 );
  1332. rend = 1;
  1333. }
  1334. else
  1335. {
  1336. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( anmeldungKlient->getLetzterFehler() ),
  1337. new Text( "Ok" ), 0, NachrichtType::nachricht, 0 );
  1338. }
  1339. }
  1340. me.mx += pos.x;
  1341. me.my += pos.y;
  1342. }
  1343. void GruppeChat::doTastaturEreignis( TastaturEreignis &te )
  1344. {
  1345. bool b = te.verarbeitet;
  1346. nachricht->doTastaturEreignis( te );
  1347. if( te.verarbeitet && !b && te.id == TE_Release && te.taste == T_Enter )
  1348. {
  1349. if( anmeldungKlient->gruppeNachricht( gruppeId, nachricht->zText()->getText() ) )
  1350. {
  1351. nachricht->setText( "" );
  1352. nachricht->setAuswahl( 0, 0 );
  1353. rend = 1;
  1354. }
  1355. else
  1356. {
  1357. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( anmeldungKlient->getLetzterFehler() ),
  1358. new Text( "Ok" ), 0, NachrichtType::nachricht, 0 );
  1359. }
  1360. }
  1361. }
  1362. void GruppeChat::render( Bild &zRObj )
  1363. {
  1364. if( !zRObj.setDrawOptions( pos.x, pos.y, gr.x, gr.y ) )
  1365. return;
  1366. verlauf->render( zRObj );
  1367. nachricht->render( zRObj );
  1368. senden->render( zRObj );
  1369. zRObj.releaseDrawOptions();
  1370. }
  1371. // constant
  1372. // Reference Counting
  1373. GruppeChat *GruppeChat::getThis()
  1374. {
  1375. ref++;
  1376. return this;
  1377. }
  1378. GruppeChat *GruppeChat::release()
  1379. {
  1380. ref--;
  1381. if( !ref )
  1382. delete this;
  1383. return 0;
  1384. }
  1385. // Inhalt der GruppeAnmeldung Klasse aus Gruppe.h
  1386. // Konstruktor
  1387. GruppeAnmeldung::GruppeAnmeldung( Schrift *zSchrift )
  1388. {
  1389. pos = Punkt( 750, 350 );
  1390. gr = Punkt( 200, 200 );
  1391. rahmen = new LRahmen();
  1392. rahmen->setFarbe( 0xFFFFFFFF );
  1393. rahmen->setRamenBreite( 1 );
  1394. rahmen->setGröße( 200, 200 );
  1395. spielerHinzufügen = initKontrollKnopf( 25, 45, 150, 20, zSchrift, KontrollKnopf::Style::Normal, "Spieler hinzufügen" );
  1396. spielerHinzufügen->löscheStyle( KontrollKnopf::Style::Erlaubt );
  1397. spielerHinzufügen->setMausEreignis( _ret1ME );
  1398. initToolTip( spielerHinzufügen, "Es werden nur Spieler aus dieser Gruppe mit ins Spiel kommen.", zSchrift->getThis(), hauptScreen );
  1399. angemeldet = initKontrollKnopf( 25, 75, 150, 20, zSchrift, KontrollKnopf::Style::Normal, "in Warteschlange" );
  1400. angemeldet->löscheStyle( KontrollKnopf::Style::Erlaubt );
  1401. angemeldet->setMausEreignis( _ret1ME );
  1402. initToolTip( angemeldet, "Die Gruppe befindet sich momentan nicht in der Warteschlange.", zSchrift->getThis(), hauptScreen );
  1403. zeit = initTextFeld( 0, 105, 200, 20, zSchrift, TextFeld::Style::Text | TextFeld::Style::Center, "Zeit in Warteschlange: " );
  1404. gruppeVerlassen = initKnopf( 40, 135, 120, 20, zSchrift, Knopf::Style::Normal, "Gruppe verlassen" );
  1405. admin = 0;
  1406. time = 0;
  1407. gruppeId = 0;
  1408. rend = 0;
  1409. ref = 1;
  1410. }
  1411. // Destruktor
  1412. GruppeAnmeldung::~GruppeAnmeldung()
  1413. {
  1414. rahmen->release();
  1415. spielerHinzufügen->release();
  1416. angemeldet->release();
  1417. zeit->release();
  1418. gruppeVerlassen->release();
  1419. }
  1420. // nicht constant
  1421. void GruppeAnmeldung::reset()
  1422. {
  1423. spielerHinzufügen->löscheStyle( KontrollKnopf::Style::Selected );
  1424. angemeldet->löscheStyle( KontrollKnopf::Style::Selected );
  1425. admin = 0;
  1426. time = 0;
  1427. gruppeId = 0;
  1428. rend = 1;
  1429. }
  1430. void GruppeAnmeldung::setGruppeId( int gruppeId )
  1431. {
  1432. this->gruppeId = gruppeId;
  1433. spielerHinzufügen->setStyle( KontrollKnopf::Style::Selected, infoKlient->getGruppeSpielerHinzufügen( gruppeId ) );
  1434. rend = 1;
  1435. }
  1436. void GruppeAnmeldung::setAdmin( int admin )
  1437. {
  1438. this->admin = admin;
  1439. if( admin == loginKlient->getAccountId() )
  1440. {
  1441. spielerHinzufügen->addStyle( KontrollKnopf::Style::Erlaubt );
  1442. angemeldet->addStyle( KontrollKnopf::Style::Erlaubt );
  1443. }
  1444. else
  1445. {
  1446. spielerHinzufügen->löscheStyle( KontrollKnopf::Style::Erlaubt );
  1447. angemeldet->löscheStyle( KontrollKnopf::Style::Erlaubt );
  1448. }
  1449. rend = 1;
  1450. }
  1451. void GruppeAnmeldung::setSpielerHinzufügen( bool spielerHinzufügen )
  1452. {
  1453. this->spielerHinzufügen->setStyle( KontrollKnopf::Style::Selected, spielerHinzufügen );
  1454. if( spielerHinzufügen )
  1455. this->spielerHinzufügen->zToolTip()->setText( "Es kommen auch andere Spieler mit ins Spiel,\ndie nicht in dieser Gruppe sind." );
  1456. else
  1457. this->spielerHinzufügen->zToolTip()->setText( "Es werden nur Spieler aus dieser Gruppe mit ins Spiel kommen." );
  1458. rend = 1;
  1459. }
  1460. void GruppeAnmeldung::setAngemeldet( bool angemeldet )
  1461. {
  1462. this->angemeldet->setStyle( KontrollKnopf::Style::Selected, angemeldet );
  1463. if( angemeldet )
  1464. this->angemeldet->zToolTip()->setText( "Die Gruppe befindet sich in der Warteschlange." );
  1465. else
  1466. this->angemeldet->zToolTip()->setText( "Die Gruppe befindet sich momentan nicht in der Warteschlange." );
  1467. time = 0;
  1468. rend = 1;
  1469. }
  1470. void GruppeAnmeldung::zurückInWarteschlange( int stunden, int minuten, int sekunden )
  1471. {
  1472. this->angemeldet->setStyle( KontrollKnopf::Style::Selected, 1 );
  1473. time = sekunden + minuten * 60 + stunden * 60 * 60;
  1474. rend = 1;
  1475. }
  1476. void GruppeAnmeldung::spielGefunden()
  1477. {
  1478. this->angemeldet->setStyle( KontrollKnopf::Style::Selected, 0 );
  1479. time = 0;
  1480. rend = 1;
  1481. }
  1482. bool GruppeAnmeldung::tick( double tickVal )
  1483. {
  1484. if( angemeldet->hatStyle( KontrollKnopf::Style::Selected ) )
  1485. {
  1486. if( (int)( time / 1 ) != (int)( ( time + tickVal ) / 1 ) )
  1487. rend = 1;
  1488. time += tickVal;
  1489. }
  1490. if( rend )
  1491. {
  1492. zeit->setText( "Zeit in Warteschlange: " );
  1493. zeit->zText()->anhängen( (int)( time / 60 / 60 ) );
  1494. zeit->zText()->anhängen( ":" );
  1495. zeit->zText()->anhängen( (int)( time / 60 ) % 60 );
  1496. zeit->zText()->anhängen( ":" );
  1497. zeit->zText()->anhängen( (int)( time ) % 60 );
  1498. }
  1499. rend |= spielerHinzufügen->tick( tickVal );
  1500. rend |= angemeldet->tick( tickVal );
  1501. rend |= gruppeVerlassen->tick( tickVal );
  1502. bool ret = rend;
  1503. rend = 0;
  1504. return ret;
  1505. }
  1506. void GruppeAnmeldung::doMausEreignis( MausEreignis &me )
  1507. {
  1508. me.mx -= pos.x;
  1509. me.my -= pos.y;
  1510. bool ak = !me.verarbeitet;
  1511. int aktion = 0;
  1512. if( admin == loginKlient->getAccountId() )
  1513. {
  1514. spielerHinzufügen->doMausEreignis( me );
  1515. aktion = ( me.verarbeitet && admin == loginKlient->getAccountId() && ak ) ? 1 : aktion;
  1516. angemeldet->doMausEreignis( me );
  1517. aktion = ( me.verarbeitet && admin == loginKlient->getAccountId() && ak && !aktion ) ? 2 : aktion;
  1518. }
  1519. gruppeVerlassen->doMausEreignis( me );
  1520. aktion = ( me.verarbeitet && ak && !aktion ) ? 3 : aktion;
  1521. if( me.id != ME_RLinks )
  1522. {
  1523. me.mx += pos.x;
  1524. me.my += pos.y;
  1525. return;
  1526. }
  1527. switch( aktion )
  1528. {
  1529. case 1:
  1530. if( !anmeldungKlient->gruppeSpielStarten( gruppeId, spielerHinzufügen->hatStyleNicht( KontrollKnopf::Style::Selected ) ) )
  1531. {
  1532. spielerHinzufügen->setStyle( KontrollKnopf::Style::Selected, spielerHinzufügen->hatStyleNicht( KontrollKnopf::Style::Selected ) );
  1533. rend = 1;
  1534. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( anmeldungKlient->getLetzterFehler() ),
  1535. new Text( "Ok" ), 0, NachrichtType::nachricht, 0 );
  1536. }
  1537. break;
  1538. case 2:
  1539. if( angemeldet->hatStyle( KontrollKnopf::Style::Selected ) )
  1540. {
  1541. if( !anmeldungKlient->gruppeAnmelden( gruppeId ) )
  1542. {
  1543. angemeldet->setStyle( KontrollKnopf::Style::Selected, angemeldet->hatStyleNicht( KontrollKnopf::Style::Selected ) );
  1544. rend = 1;
  1545. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( anmeldungKlient->getLetzterFehler() ),
  1546. new Text( "Ok" ), 0, NachrichtType::nachricht, 0 );
  1547. }
  1548. }
  1549. else
  1550. {
  1551. if( !anmeldungKlient->gruppeAbmelden( gruppeId ) )
  1552. {
  1553. angemeldet->setStyle( KontrollKnopf::Style::Selected, angemeldet->hatStyleNicht( KontrollKnopf::Style::Selected ) );
  1554. rend = 1;
  1555. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( anmeldungKlient->getLetzterFehler() ),
  1556. new Text( "Ok" ), 0, NachrichtType::nachricht, 0 );
  1557. }
  1558. }
  1559. break;
  1560. case 3:
  1561. if( anmeldungKlient->gruppeVerlassen( gruppeId ) )
  1562. nachLogin->zSpielenFenster()->gruppeVerlassen();
  1563. else
  1564. {
  1565. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( anmeldungKlient->getLetzterFehler() ),
  1566. new Text( "Ok" ), 0, NachrichtType::nachricht, 0 );
  1567. }
  1568. break;
  1569. }
  1570. me.mx += pos.x;
  1571. me.my += pos.y;
  1572. }
  1573. void GruppeAnmeldung::render( Bild &zRObj )
  1574. {
  1575. if( !zRObj.setDrawOptions( pos.x, pos.y, gr.x, gr.y ) )
  1576. return;
  1577. rahmen->render( zRObj );
  1578. spielerHinzufügen->render( zRObj );
  1579. angemeldet->render( zRObj );
  1580. zeit->render( zRObj );
  1581. gruppeVerlassen->render( zRObj );
  1582. zRObj.releaseDrawOptions();
  1583. }
  1584. // constant
  1585. // Reference Counting
  1586. GruppeAnmeldung *GruppeAnmeldung::getThis()
  1587. {
  1588. ref++;
  1589. return this;
  1590. }
  1591. GruppeAnmeldung *GruppeAnmeldung::release()
  1592. {
  1593. ref--;
  1594. if( !ref )
  1595. delete this;
  1596. return 0;
  1597. }
  1598. void GruppeKarteKSGSAktion( void *p, RCArray< KSGSVariable > *parameter, KSGSVariable **retVal )
  1599. {
  1600. if( !p )
  1601. return;
  1602. ( (GruppeKarte*)p )->ksgsAktion( parameter, retVal );
  1603. }
  1604. // Inhalt der GruppeKarte Klasse aus Gruppe.h
  1605. // Konstruktor
  1606. GruppeKarte::GruppeKarte( Schrift *zSchrift )
  1607. {
  1608. schrift = zSchrift;
  1609. pos = Punkt( 350, 0 );
  1610. gr = Punkt( 600, 350 );
  1611. rahmen = new LRahmen();
  1612. rahmen->setFarbe( 0xFFFFFFFF );
  1613. rahmen->setRamenBreite( 1 );
  1614. rahmen->setGröße( 350, 350 );
  1615. rahmen->setPosition( 248, 0 );
  1616. info = 0;
  1617. ksgs = dllDateien->ladeDLL( "KSGScript.dll", "data/bin/KSGScript.dll" );
  1618. if( ksgs )
  1619. {
  1620. KSGSGetZeichnung getKSGScript = (KSGSGetZeichnung)GetProcAddress( ksgs, KSGS_START_FUNKTION );
  1621. if( getKSGScript )
  1622. {
  1623. info = getKSGScript();
  1624. info->setBildschirmZ( hauptScreen->getThis() );
  1625. info->setSchriftZ( schrift->getThis() );
  1626. info->setGröße( 248, 350 );
  1627. info->setRückrufParam( this );
  1628. info->setRückrufFunktion( GruppeKarteKSGSAktion );
  1629. }
  1630. else
  1631. {
  1632. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ),
  1633. new Text( "Der Einstiegspunkt '" KSGS_START_FUNKTION "' in der DLL-Datei "
  1634. "'data/bin/KSGScript.dll' konnte nicht gefunden werden." ),
  1635. new Text( "Ok" ), 0, NachrichtType::nachricht, 0 );
  1636. }
  1637. }
  1638. else
  1639. {
  1640. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ),
  1641. new Text( "Die DLL-Datei 'data/bin/KSGScript.dll' konnte nicht geladen werden." ),
  1642. new Text( "Ok" ), 0, NachrichtType::nachricht, 0 );
  1643. }
  1644. hintergrund = 0;
  1645. fehler = 0;
  1646. alpha1 = 0;
  1647. alpha2 = 0;
  1648. ladenZeit = 0;
  1649. tickVal = 0;
  1650. ladeBild = 0;
  1651. karteId = 0;
  1652. gruppeId = 0;
  1653. exit = 0;
  1654. geladen = 0;
  1655. rend = 0;
  1656. ref = 1;
  1657. }
  1658. // Destruktor
  1659. GruppeKarte::~GruppeKarte()
  1660. {
  1661. exit = 1;
  1662. warteAufThread( 5000 );
  1663. if( run )
  1664. ende();
  1665. rahmen->release();
  1666. if( info )
  1667. {
  1668. info->zurücksetzen();
  1669. info->release();
  1670. }
  1671. if( hintergrund )
  1672. hintergrund->release();
  1673. if( fehler )
  1674. fehler->release();
  1675. if( schrift )
  1676. schrift->release();
  1677. if( ksgs )
  1678. dllDateien->releaseDLL( "KSGScript.dll" );
  1679. }
  1680. // nicht constant
  1681. void GruppeKarte::reset()
  1682. {
  1683. if( info )
  1684. info->zurücksetzen();
  1685. if( hintergrund )
  1686. hintergrund = hintergrund->release();
  1687. if( fehler )
  1688. fehler = fehler->release();
  1689. if( run )
  1690. {
  1691. exit = 1;
  1692. warteAufThread( 5000 );
  1693. if( run )
  1694. ende();
  1695. }
  1696. geladen = 0;
  1697. alpha1 = 0;
  1698. alpha2 = 0;
  1699. ladenZeit = 0;
  1700. tickVal = 0;
  1701. ladeBild = 0;
  1702. karteId = 0;
  1703. gruppeId = 0;
  1704. exit = 0;
  1705. rend = 1;
  1706. }
  1707. void GruppeKarte::ksgsAktion( RCArray< KSGSVariable > *parameter, KSGSVariable **retVal )
  1708. {
  1709. }
  1710. void GruppeKarte::setGruppeId( int gruppeId )
  1711. {
  1712. this->gruppeId = gruppeId;
  1713. if( run )
  1714. {
  1715. exit = 1;
  1716. warteAufThread( 5000 );
  1717. if( run )
  1718. ende();
  1719. exit = 0;
  1720. }
  1721. geladen = 0;
  1722. rend = 1;
  1723. start();
  1724. }
  1725. bool GruppeKarte::tick( double tickVal )
  1726. {
  1727. if( !gruppeId )
  1728. return 0;
  1729. if( info )
  1730. rend |= info->tick( tickVal );
  1731. ladenZeit += tickVal;
  1732. if( ladenZeit >= 1 / 30.0 )
  1733. {
  1734. ladenZeit -= 1 / 30.0;
  1735. if( ladeAnimation && ladeAnimation->zAnimationData() )
  1736. {
  1737. if( alpha1 )
  1738. rend = 1;
  1739. ladeBild++;
  1740. if( ladeBild >= ladeAnimation->zAnimationData()->getBildAnzahl() )
  1741. ladeBild = 0;
  1742. }
  1743. }
  1744. this->tickVal += tickVal * 300;
  1745. int val = ( int )this->tickVal;
  1746. if( val < 1 )
  1747. {
  1748. bool ret = rend;
  1749. rend = 0;
  1750. return ret;
  1751. }
  1752. if( val > 10 )
  1753. val = 10;
  1754. this->tickVal -= val;
  1755. if( !geladen && !fehler )
  1756. {
  1757. if( alpha1 != 255 || alpha2 != 0 )
  1758. rend = 1;
  1759. if( alpha1 + val > 255 )
  1760. alpha1 = 255;
  1761. else
  1762. alpha1 += val;
  1763. if( alpha2 - val < 0 )
  1764. alpha2 = 0;
  1765. else
  1766. alpha2 -= val;
  1767. }
  1768. else
  1769. {
  1770. if( alpha1 != 0 || alpha2 != 255 )
  1771. rend = 1;
  1772. if( alpha1 - val < 0 )
  1773. alpha1 = 0;
  1774. else
  1775. alpha1 -= val;
  1776. if( alpha2 + val > 255 )
  1777. alpha2 = 255;
  1778. else
  1779. alpha2 += val;
  1780. }
  1781. bool ret = rend;
  1782. rend = 0;
  1783. return ret;
  1784. }
  1785. void GruppeKarte::doMausEreignis( MausEreignis &me )
  1786. {
  1787. me.mx -= pos.x;
  1788. me.my -= pos.y;
  1789. if( info )
  1790. info->doMausEreignis( me );
  1791. me.mx += pos.x;
  1792. me.my += pos.y;
  1793. }
  1794. void GruppeKarte::render( Bild &zrObj )
  1795. {
  1796. int x = pos.x;
  1797. int y = pos.y;
  1798. if( !zrObj.setDrawOptions( x, y, gr.x, gr.y ) )
  1799. return;
  1800. if( alpha1 != 0 && ladeAnimation && ladeAnimation->zAnimationData() )
  1801. {
  1802. Bild *tmp = ladeAnimation->zAnimationData()->zBild( ladeBild );
  1803. if( tmp )
  1804. {
  1805. zrObj.setAlpha( alpha1 );
  1806. zrObj.drawBild( gr.x / 2 - tmp->getBreite() / 2, gr.y / 2 - tmp->getHöhe() / 2, tmp->getBreite(), tmp->getHöhe(), *tmp );
  1807. zrObj.releaseAlpha();
  1808. }
  1809. }
  1810. if( alpha2 != 0 )
  1811. {
  1812. zrObj.setAlpha( alpha2 );
  1813. if( geladen )
  1814. {
  1815. if( info )
  1816. info->render( zrObj );
  1817. rahmen->render( zrObj );
  1818. zrObj.drawBild( 248 + rahmen->getRBreite(), rahmen->getRBreite(),
  1819. rahmen->getBreite() - rahmen->getRBreite() * 2, rahmen->getHöhe() - rahmen->getRBreite() * 2, *hintergrund );
  1820. }
  1821. else if( fehler )
  1822. fehler->render( zrObj );
  1823. zrObj.releaseAlpha();
  1824. }
  1825. zrObj.releaseDrawOptions();
  1826. }
  1827. void GruppeKarte::thread()
  1828. {
  1829. if( info )
  1830. info->zurücksetzen();
  1831. if( hintergrund )
  1832. hintergrund = hintergrund->release();
  1833. if( fehler )
  1834. fehler = fehler->release();
  1835. karteId = infoKlient->getGruppenKarteId( gruppeId );
  1836. if( !karteId )
  1837. {
  1838. run = 0;
  1839. return;
  1840. }
  1841. KartenLeser *karte = new KartenLeser();
  1842. karte->setKarteId( karteId );
  1843. hintergrund = karte->getKartenVorschauBild();
  1844. if( exit )
  1845. {
  1846. if( hintergrund )
  1847. hintergrund = hintergrund->release();
  1848. karte->release();
  1849. run = 0;
  1850. return;
  1851. }
  1852. if( !hintergrund )
  1853. {
  1854. Text *f = new Text( karte->getLetzterFehler() );
  1855. schrift->lock();
  1856. schrift->setSchriftGröße( 12 );
  1857. int br = schrift->getTextBreite( f );
  1858. int hö = schrift->getTextHöhe( f );
  1859. schrift->unlock();
  1860. fehler = initTextFeld( gr.x / 2 - ( br + 10 ) / 2, gr.y / 2 - ( hö + 4 ) / 2, br + 10, hö + 4,
  1861. schrift, TextFeld::Style::Text | TextFeld::Style::Center, f->getText() );
  1862. f->release();
  1863. karte->release();
  1864. run = 0;
  1865. return;
  1866. }
  1867. bool ok = 0;
  1868. if( info )
  1869. {
  1870. if( !karte->getKartenBeschreibung() )
  1871. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( "Beschreibung nicht gefunden." ), new Text( "Ok" ) );
  1872. else
  1873. {
  1874. Text *pf = karte->getKartePfad();
  1875. *pf += "beschreibung.ksgs";
  1876. info->setScriptDatei( pf );
  1877. ok = info->neuLaden();
  1878. KSGSVariable *var = info->startFunktion( info->getFunktionId( "_in_gruppe" ), new RCArray< KSGSVariable >() );
  1879. if( var )
  1880. var->release();
  1881. }
  1882. }
  1883. if( !ok )
  1884. {
  1885. Text *f = new Text( karte->getLetzterFehler() );
  1886. schrift->lock();
  1887. schrift->setSchriftGröße( 12 );
  1888. int br = schrift->getTextBreite( f );
  1889. int hö = schrift->getTextHöhe( f );
  1890. schrift->unlock();
  1891. fehler = initTextFeld( gr.x / 2 - ( br + 10 ) / 2, gr.y / 2 - ( hö + 4 ) / 2, br + 10, hö + 4,
  1892. schrift, TextFeld::Style::Text | TextFeld::Style::Center, f->getText() );
  1893. f->release();
  1894. karte->release();
  1895. run = 0;
  1896. return;
  1897. }
  1898. karte->release();
  1899. geladen = 1;
  1900. run = 0;
  1901. rend = 1;
  1902. }
  1903. // constant
  1904. int GruppeKarte::getKarteId() const
  1905. {
  1906. return karteId;
  1907. }
  1908. // Reference Counting
  1909. GruppeKarte *GruppeKarte::getThis()
  1910. {
  1911. ref++;
  1912. return this;
  1913. }
  1914. GruppeKarte *GruppeKarte::release()
  1915. {
  1916. ref--;
  1917. if( !ref )
  1918. delete this;
  1919. return 0;
  1920. }
  1921. // Inhalt der GruppeSpielGefunden Klasse aus Gruppe.h
  1922. // Konstruktor
  1923. GruppeSpielGefunden::GruppeSpielGefunden( Schrift *zSchrift )
  1924. {
  1925. pos = Punkt( 375, 235 );
  1926. gr = Punkt( 200, 90 );
  1927. spielGefunden = initFenster( 0, 0, 200, 90, zSchrift, Fenster::Style::Sichtbar | Fenster::Style::Rahmen | Fenster::Style::Titel, "Spiel gefunden" );
  1928. zeit = initTextFeld( 0, 30, 200, 20, zSchrift, TextFeld::Style::Text, "Verbleibende Zeit: 10" );
  1929. warte = initTextFeld( 0, 60, 200, 20, zSchrift, TextFeld::Style::Text & ~TextFeld::Style::Sichtbar, "Warte auf andere Spieler. . ." );
  1930. annehmen = initKnopf( 50, 60, 100, 20, zSchrift, Knopf::Style::Normal, "beitreten" );
  1931. alpha = 0;
  1932. time = 0;
  1933. sichtbar = 0;
  1934. tickVal = 0;
  1935. rend = 0;
  1936. ref = 1;
  1937. }
  1938. // Destruktor
  1939. GruppeSpielGefunden::~GruppeSpielGefunden()
  1940. {
  1941. spielGefunden->release();
  1942. zeit->release();
  1943. warte->release();
  1944. annehmen->release();
  1945. }
  1946. // nicht constant
  1947. void GruppeSpielGefunden::reset()
  1948. {
  1949. zeit->setText( "Verbleibende Zeit: 10" );
  1950. alpha = 0;
  1951. time = 0;
  1952. sichtbar = 0;
  1953. warte->löscheStyle( TextFeld::Style::Sichtbar );
  1954. annehmen->addStyle( Knopf::Style::Sichtbar );
  1955. rend = 1;
  1956. }
  1957. void GruppeSpielGefunden::setSichtbar( bool sichtbar )
  1958. {
  1959. warte->löscheStyle( TextFeld::Style::Sichtbar );
  1960. annehmen->addStyle( Knopf::Style::Sichtbar );
  1961. this->sichtbar = sichtbar;
  1962. rend = 1;
  1963. }
  1964. void GruppeSpielGefunden::setVerbleibendeZeit( int sekunden )
  1965. {
  1966. if( time != sekunden )
  1967. rend = 1;
  1968. time = sekunden;
  1969. }
  1970. bool GruppeSpielGefunden::tick( double tickVal )
  1971. {
  1972. if( rend )
  1973. {
  1974. zeit->setText( "Verbleibende Zeit: " );
  1975. zeit->zText()->anhängen( (int)time );
  1976. }
  1977. rend |= annehmen->tick( tickVal );
  1978. this->tickVal += tickVal * 300;
  1979. int val = ( int )this->tickVal;
  1980. if( val < 1 )
  1981. {
  1982. bool ret = rend;
  1983. rend = 0;
  1984. return ret;
  1985. }
  1986. if( val > 10 )
  1987. val = 10;
  1988. this->tickVal -= val;
  1989. if( sichtbar )
  1990. {
  1991. if( alpha < 255 )
  1992. {
  1993. if( alpha + val > 255 )
  1994. alpha = 255;
  1995. else
  1996. alpha += val;
  1997. rend = 1;
  1998. }
  1999. }
  2000. else
  2001. {
  2002. if( alpha )
  2003. {
  2004. if( alpha - val < 0 )
  2005. alpha = 0;
  2006. else
  2007. alpha -= val;
  2008. rend = 1;
  2009. }
  2010. }
  2011. bool ret = rend;
  2012. rend = 0;
  2013. return ret;
  2014. }
  2015. void GruppeSpielGefunden::doMausEreignis( MausEreignis &me )
  2016. {
  2017. me.mx -= pos.x;
  2018. me.my -= pos.y;
  2019. bool ver = me.verarbeitet;
  2020. annehmen->doMausEreignis( me );
  2021. if( me.verarbeitet && !ver && me.id == ME_RLinks )
  2022. {
  2023. if( spielKlient->spielErstelltAnnehmen() )
  2024. {
  2025. annehmen->löscheStyle( Knopf::Style::Sichtbar );
  2026. warte->addStyle( TextFeld::Style::Sichtbar );
  2027. rend = 1;
  2028. }
  2029. else if( nachLogin && nachLogin->zSpielenFenster() )
  2030. nachLogin->zNachrichtenListe()->addNachricht( new Text( "Fehler" ), new Text( spielKlient->getLetzterFehler() ), new Text( "Ok" ), 0, NachrichtType::nachricht, 0 );
  2031. }
  2032. me.mx += pos.x;
  2033. me.my += pos.y;
  2034. }
  2035. void GruppeSpielGefunden::render( Bild &zRObj )
  2036. {
  2037. if( !zRObj.setDrawOptions( pos.x, pos.y, gr.x, gr.y ) )
  2038. return;
  2039. zRObj.setAlpha( alpha );
  2040. spielGefunden->render( zRObj );
  2041. zeit->render( zRObj );
  2042. warte->render( zRObj );
  2043. annehmen->render( zRObj );
  2044. zRObj.releaseAlpha();
  2045. zRObj.releaseDrawOptions();
  2046. }
  2047. // constant
  2048. bool GruppeSpielGefunden::istSichtbar() const
  2049. {
  2050. return sichtbar;
  2051. }
  2052. // Reference Counting
  2053. GruppeSpielGefunden *GruppeSpielGefunden::getThis()
  2054. {
  2055. ref++;
  2056. return this;
  2057. }
  2058. GruppeSpielGefunden *GruppeSpielGefunden::release()
  2059. {
  2060. ref--;
  2061. if( !ref )
  2062. delete this;
  2063. return 0;
  2064. }
  2065. // Inhalt der GruppeFenster Klasse aus Gruppe.h
  2066. // Konstruktor
  2067. GruppeFenster::GruppeFenster( Schrift *zSchrift )
  2068. {
  2069. pos = Punkt( 0, 0 );
  2070. gr = Punkt( 950, 550 );
  2071. anmeldung = new GruppeAnmeldung( zSchrift );
  2072. chat = new GruppeChat( zSchrift );
  2073. accounts = new GruppeAccountListe( zSchrift );
  2074. einladungen = new GruppeEinladungListe( zSchrift );
  2075. karte = new GruppeKarte( zSchrift );
  2076. spiel = new GruppeSpielGefunden( zSchrift );
  2077. alpha = 0;
  2078. sichtbar = 0;
  2079. tickVal = 0;
  2080. rend = 0;
  2081. ref = 1;
  2082. }
  2083. // Destruktor
  2084. GruppeFenster::~GruppeFenster()
  2085. {
  2086. anmeldung->release();
  2087. chat->release();
  2088. accounts->release();
  2089. einladungen->release();
  2090. karte->release();
  2091. spiel->release();
  2092. }
  2093. // nicht constant
  2094. void GruppeFenster::setGruppeId( int id )
  2095. {
  2096. gruppeId = id;
  2097. anmeldung->setGruppeId( id );
  2098. chat->setGruppeId( id );
  2099. accounts->setGruppeId( id );
  2100. einladungen->setGruppeId( id );
  2101. karte->setGruppeId( id );
  2102. spiel->setSichtbar( 0 );
  2103. if( id )
  2104. {
  2105. int adminId = infoKlient->getGruppeAdminId( id );
  2106. nachLogin->zFreundesListe()->zeigeEinladeKnopf( adminId == loginKlient->getAccountId() );
  2107. setAdmin( adminId );
  2108. }
  2109. rend = 1;
  2110. }
  2111. void GruppeFenster::setSichtbar( bool sichtbar )
  2112. {
  2113. this->sichtbar = sichtbar;
  2114. rend = 1;
  2115. }
  2116. void GruppeFenster::chatNachricht( const char *nachricht )
  2117. {
  2118. chat->gruppeNachricht( nachricht );
  2119. }
  2120. void GruppeFenster::neuerSpieler( int accountId )
  2121. {
  2122. einladungen->setAngenommen( accountId );
  2123. accounts->addAccount( accountId );
  2124. }
  2125. void GruppeFenster::spielerVerlässt( int accountId )
  2126. {
  2127. accounts->removeAccount( accountId );
  2128. anmeldung->setAngemeldet( 0 );
  2129. }
  2130. void GruppeFenster::neueEinladung( int accountId )
  2131. {
  2132. einladungen->addAccount( accountId );
  2133. }
  2134. void GruppeFenster::einladungEntfernt( int accountId )
  2135. {
  2136. einladungen->remove( accountId );
  2137. }
  2138. void GruppeFenster::einladungAbgelehnt( int accountId )
  2139. {
  2140. einladungen->setAbgelehnt( accountId );
  2141. }
  2142. void GruppeFenster::setSpielerHinzufügen( bool sh )
  2143. {
  2144. anmeldung->setSpielerHinzufügen( sh );
  2145. }
  2146. void GruppeFenster::setAngemeldet( bool angemeldet )
  2147. {
  2148. anmeldung->setAngemeldet( angemeldet );
  2149. }
  2150. void GruppeFenster::spielGefunden()
  2151. {
  2152. anmeldung->spielGefunden();
  2153. spiel->setSichtbar( 1 );
  2154. rend = 1;
  2155. }
  2156. void GruppeFenster::verbleibendeZeit( int sekunden )
  2157. {
  2158. spiel->setVerbleibendeZeit( sekunden );
  2159. }
  2160. void GruppeFenster::spielGefundenAbbruch()
  2161. {
  2162. spiel->setSichtbar( 0 );
  2163. }
  2164. void GruppeFenster::zurückInWarteschlange( int stunden, int minuten, int sekunden )
  2165. {
  2166. anmeldung->zurückInWarteschlange( stunden, minuten, sekunden );
  2167. }
  2168. void GruppeFenster::setAdmin( int accountId )
  2169. {
  2170. anmeldung->setAdmin( accountId );
  2171. accounts->setAdmin( accountId );
  2172. einladungen->setAdmin( accountId );
  2173. }
  2174. void GruppeFenster::kick()
  2175. {
  2176. }
  2177. void GruppeFenster::reset()
  2178. {
  2179. accounts->reset();
  2180. einladungen->reset();
  2181. karte->reset();
  2182. chat->reset();
  2183. anmeldung->reset();
  2184. spiel->reset();
  2185. }
  2186. bool GruppeFenster::tick( double tickVal )
  2187. {
  2188. if( !spiel->istSichtbar() )
  2189. {
  2190. rend |= anmeldung->tick( tickVal );
  2191. rend |= chat->tick( tickVal );
  2192. rend |= accounts->tick( tickVal );
  2193. rend |= einladungen->tick( tickVal );
  2194. rend |= karte->tick( tickVal );
  2195. }
  2196. rend |= spiel->tick( tickVal );
  2197. this->tickVal += tickVal * 300;
  2198. int val = ( int )this->tickVal;
  2199. if( val < 1 )
  2200. {
  2201. bool ret = rend;
  2202. rend = 0;
  2203. return ret;
  2204. }
  2205. if( val > 10 )
  2206. val = 10;
  2207. this->tickVal -= val;
  2208. if( sichtbar )
  2209. {
  2210. if( spiel->istSichtbar() )
  2211. {
  2212. if( alpha > 0x70 )
  2213. {
  2214. if( alpha - val < 0x70 )
  2215. alpha = 0x70;
  2216. else
  2217. alpha -= val;
  2218. rend = 1;
  2219. }
  2220. else if( alpha < 0x70 )
  2221. {
  2222. if( alpha + val > 0x70 )
  2223. alpha = 0x70;
  2224. else
  2225. alpha += val;
  2226. rend = 1;
  2227. }
  2228. }
  2229. else
  2230. {
  2231. if( alpha < 255 )
  2232. {
  2233. if( alpha + val > 255 )
  2234. alpha = 255;
  2235. else
  2236. alpha += val;
  2237. rend = 1;
  2238. }
  2239. }
  2240. }
  2241. else
  2242. {
  2243. if( alpha > 0 )
  2244. {
  2245. if( alpha - val < 0 )
  2246. alpha = 0;
  2247. else
  2248. alpha -= val;
  2249. rend = 1;
  2250. if( !alpha )
  2251. reset();
  2252. }
  2253. }
  2254. bool ret = rend;
  2255. rend = 0;
  2256. return ret;
  2257. }
  2258. void GruppeFenster::doMausEreignis( MausEreignis &me )
  2259. {
  2260. if( !spiel->istSichtbar() )
  2261. {
  2262. anmeldung->doMausEreignis( me );
  2263. chat->doMausEreignis( me );
  2264. accounts->doMausEreignis( me );
  2265. einladungen->doMausEreignis( me );
  2266. karte->doMausEreignis( me );
  2267. }
  2268. spiel->doMausEreignis( me );
  2269. }
  2270. void GruppeFenster::doTastaturEreignis( TastaturEreignis &te )
  2271. {
  2272. if( !spiel->istSichtbar() )
  2273. {
  2274. chat->doTastaturEreignis( te );
  2275. einladungen->doTastaturEreignis( te );
  2276. }
  2277. }
  2278. void GruppeFenster::render( Bild &zRObj )
  2279. {
  2280. if( alpha )
  2281. {
  2282. int x = pos.x;
  2283. int y = pos.y;
  2284. if( !zRObj.setDrawOptions( x, y, gr.x, gr.y ) )
  2285. return;
  2286. unsigned char tmpAlpha = zRObj.getAlpha();
  2287. zRObj.setAlpha( alpha );
  2288. anmeldung->render( zRObj );
  2289. chat->render( zRObj );
  2290. accounts->render( zRObj );
  2291. einladungen->render( zRObj );
  2292. karte->render( zRObj );
  2293. zRObj.releaseAlpha();
  2294. spiel->render( zRObj );
  2295. zRObj.releaseDrawOptions();
  2296. }
  2297. }
  2298. // constant
  2299. int GruppeFenster::getGruppeId() const
  2300. {
  2301. return gruppeId;
  2302. }
  2303. int GruppeFenster::getKarteId() const
  2304. {
  2305. return karte ? karte->getKarteId() : 0;
  2306. }
  2307. // Reference Counting
  2308. GruppeFenster *GruppeFenster::getThis()
  2309. {
  2310. ref++;
  2311. return this;
  2312. }
  2313. GruppeFenster *GruppeFenster::release()
  2314. {
  2315. ref--;
  2316. if( !ref )
  2317. delete this;
  2318. return 0;
  2319. }