Spiel.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. #pragma once
  2. #include "SpielKlasse.h"
  3. #include "Variablen.h"
  4. #include "Trigger.h"
  5. #include "Bariere.h"
  6. #include "Base.h"
  7. #include "Drop.h"
  8. #include "Geschoss.h"
  9. #include "Umlenkung.h"
  10. #include "Tunnel.h"
  11. #include "Schiene.h"
  12. #include "Schalter.h"
  13. #include "Statistik.h"
  14. #include "Reader.h"
  15. #include <Critical.h>
  16. #include <Datei.h>
  17. #include <Random.h>
  18. class Statistik;
  19. class StatistikV;
  20. class Spiel : public SpielKlasse
  21. {
  22. private:
  23. bool isRunning;
  24. RandomGenerator randG;
  25. SSDatenbankV *psqldb;
  26. RCArray< SSKlientV > *zKlients;
  27. RCArray< VarPointer > variablen;
  28. RCArray< Spieler > spieler;
  29. RCArray< Team > teams;
  30. RCArray< Bariere > bariere;
  31. RCArray< Base > basen;
  32. RCArray< Drop > drops;
  33. RCArray< Gegenstand > gegenstand;
  34. RCArray< Geschoss > shots;
  35. RCArray< Schalter > schalter;
  36. RCArray< Schiene > schiene;
  37. RCArray< Timer > timer;
  38. RCArray< Tunnel > tunnel;
  39. RCArray< Umlenkung > umlenkung;
  40. RCArray< Trigger > trigger;
  41. RCArray< TriggerRun > triggerRuns;
  42. Array< int > *zAccounts;
  43. Statistik *stat;
  44. Text mapPfad;
  45. Critical c;
  46. Datei *log;
  47. bool ende;
  48. int spielerAnzahl;
  49. int spielId;
  50. int karteId;
  51. int gameTicks;
  52. bool pause;
  53. int ref;
  54. public:
  55. // Konstruktor
  56. Spiel();
  57. // Destruktor
  58. ~Spiel();
  59. // nicht constant
  60. void setPSQLK( SSDatenbankV *psqldb ) override; // call 1
  61. void setSpielId( int id ) override; // call 2
  62. void setKarteId( int karteId ) override; // call 3
  63. void setTempPfad( char *pfad ) override; // call 3.5
  64. void setAccounts( int anzahl, Array< int > *zAccounts ) override; // call 4
  65. void setKlients( int anzahl, RCArray< SSKlientV > *zKlients ) override; // call 5
  66. void setSpielerNummern( int anzahl, Array< int > *spielerNummern ) override; // call 6
  67. void run() override; // call 7
  68. void klientOffline( int accountId ) override;
  69. void klientOnline( int accountId, SSKlientV *zKlient ) override;
  70. void nachricht( int accountId, int len, char *bytes ) override;
  71. void setPausiert( bool pausiert );
  72. void tick( double zeit );
  73. void addVariable( const char *name, Variable *var );
  74. void setVariable( const char *name, Variable *var );
  75. void addTeam( Team *team );
  76. void addSpieler( Spieler *spieler );
  77. void addBariere( Bariere *bariere );
  78. void addBase( Base *base );
  79. void addDrop( Drop *drop );
  80. void addGegenstand( Gegenstand *gegenstand );
  81. void addGeschoss( Geschoss *geschoss );
  82. void addSchalter( Schalter *schalter );
  83. void addSchiene( Schiene *schiene );
  84. void addTimer( Timer *timer );
  85. void addTunnel( Tunnel *tunnel );
  86. void addUmlenkung( Umlenkung *umlenkung );
  87. void addTrigger( Trigger *trigger );
  88. void addTriggerRun( TriggerRun *tRun );
  89. Team *getTeam( int id ) const;
  90. Variable *getVariable( const char *name ) const;
  91. Variable *zVariable( const char *name ) const;
  92. bool istPausiert() const;
  93. // constant
  94. StatistikV *getStatistik() const override;
  95. // Reference Counting
  96. SpielKlasse *getThis() override;
  97. SpielKlasse *release() override;
  98. };