scripts.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. #ifndef SCRIPTS_H
  2. #define SCRIPTS_H
  3. #include "buysell.h"
  4. #include "dispatchers.h"
  5. #include "galaxy.h"
  6. #include <stack>
  7. #include "ansicolor.h"
  8. class ScriptTerror : public Dispatch {
  9. private:
  10. MoveDispatch * md;
  11. std::shared_ptr<Dispatch> move;
  12. InputDispatch * id;
  13. std::shared_ptr<Dispatch> input;
  14. TraderDispatch * td;
  15. std::shared_ptr<Dispatch> trader;
  16. std::string old_trade_end_empty;
  17. public:
  18. ScriptTerror(Director &);
  19. ~ScriptTerror();
  20. int loops;
  21. int max_loops;
  22. port_pair_type ppt;
  23. void init(void);
  24. void activate(void) override;
  25. void deactivate(void) override;
  26. void input_notify(void);
  27. void move_notify(void);
  28. void trade_notify(void);
  29. void server_prompt(const std::string &prompt) override;
  30. };
  31. class ScriptVoyager : public Dispatch {
  32. private:
  33. MoveDispatch * md;
  34. std::shared_ptr<Dispatch> move;
  35. InputDispatch * id;
  36. std::shared_ptr<Dispatch> input;
  37. void next(void);
  38. public:
  39. ScriptVoyager(Director &);
  40. ~ScriptVoyager();
  41. int loops;
  42. void init(void);
  43. void activate(void) override;
  44. void deactivate(void) override;
  45. void input_notify(void);
  46. void move_notify(void);
  47. void server_prompt(const std::string &prompt) override;
  48. };
  49. class ScriptExplore : public Dispatch {
  50. private:
  51. MoveDispatch * md;
  52. std::shared_ptr<Dispatch> move;
  53. InputDispatch * id;
  54. std::shared_ptr<Dispatch> input;
  55. void next(void);
  56. std::shared_ptr<Dispatch> us;
  57. public:
  58. ScriptExplore(Director &);
  59. ~ScriptExplore();
  60. int loops;
  61. bool infinite;
  62. bool prefer_ports;
  63. int state;
  64. int target;
  65. std::stack<sector_type> unknown_warps;
  66. void init(void);
  67. void activate(void) override;
  68. void deactivate(void) override;
  69. void input_notify(void);
  70. void move_notify(void);
  71. void server_prompt(const std::string &prompt) override;
  72. };
  73. class ScriptPlanet : public Dispatch {
  74. private:
  75. MoveDispatch * md;
  76. std::shared_ptr<Dispatch> move;
  77. InputDispatch * id;
  78. std::shared_ptr<Dispatch> input;
  79. TraderDispatch * td;
  80. std::shared_ptr<Dispatch> trader;
  81. void next(void);
  82. std::shared_ptr<Dispatch> us;
  83. public:
  84. ScriptPlanet(Director &);
  85. ~ScriptPlanet();
  86. int planet;
  87. int sector;
  88. int state;
  89. int current_level;
  90. int population[3];
  91. int total_population;
  92. int amount[3];
  93. int ship[3];
  94. int to_make_one[3];
  95. int support_construction;
  96. int needs[3];
  97. int days;
  98. void init(void);
  99. void activate(void) override;
  100. void deactivate(void) override;
  101. void input_notify(void);
  102. void move_notify(void);
  103. void trade_notify(void);
  104. void server_prompt(const std::string &prompt) override;
  105. void server_line(const std::string &line, const std::string &raw_line) override;
  106. void client_input(const std::string &input) override;
  107. private:
  108. void clear_amounts(void);
  109. int place_colonists(void);
  110. };
  111. #endif