Variablen.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. #pragma once
  2. #include <Text.h>
  3. using namespace Framework;
  4. enum VariableTyp
  5. {
  6. NICHTS,
  7. INTEGER,
  8. BOOLEAN,
  9. STRING,
  10. RICHTUNG,
  11. FLOAT,
  12. TASTE,
  13. SPIELER,
  14. TIMER,
  15. TEAM,
  16. BARIERE,
  17. SCHALTER,
  18. BASE,
  19. DROP,
  20. GEGENSTAND,
  21. GEGENSTAND_TYP,
  22. GESCHOSS,
  23. GESCHOSS_TYP,
  24. SCHIENE,
  25. TUNNEL,
  26. UMLENKUNG,
  27. TRIGGER,
  28. FEUERBALL_TREFFER,
  29. AKTION,
  30. GAME_OBJEKT,
  31. ALLE
  32. };
  33. bool operator==( VariableTyp a, VariableTyp b );
  34. bool operator!=( VariableTyp a, VariableTyp b );
  35. class Variable
  36. {
  37. private:
  38. VariableTyp typ;
  39. int ref;
  40. public:
  41. Variable( VariableTyp typ );
  42. virtual ~Variable();
  43. VariableTyp getVariableTyp() const;
  44. Variable *getThis();
  45. Variable *release();
  46. };
  47. bool isTrue( Variable *v );
  48. class Integer : public Variable
  49. {
  50. private:
  51. int value;
  52. public:
  53. Integer( int value, bool taste = 0 );
  54. void setValue( int value );
  55. int getValue() const;
  56. };
  57. class Boolean : public Variable
  58. {
  59. private:
  60. bool value;
  61. public:
  62. Boolean( bool value );
  63. void setValue( bool value );
  64. bool getValue() const;
  65. };
  66. class String : public Variable
  67. {
  68. private:
  69. Text value;
  70. public:
  71. String( const char *value, bool richtung = 0, bool geschossTyp = 0 );
  72. void setValue( Text value );
  73. const Text &getValue() const;
  74. };
  75. class Float : public Variable
  76. {
  77. private:
  78. float value;
  79. public:
  80. Float( float value );
  81. void setValue( float value );
  82. float getValue() const;
  83. };