Spiel.h 3.2 KB

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