scripts.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  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 &, const char *called = nullptr);
  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 &, const char *called = nullptr);
  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 &, const char *called = nullptr);
  59. ~ScriptExplore();
  60. int loops;
  61. bool infinite;
  62. bool prefer_ports;
  63. bool use_nearest_unknown;
  64. int state;
  65. int target;
  66. std::stack<sector_type> unknown_warps;
  67. void init(void);
  68. void activate(void) override;
  69. void deactivate(void) override;
  70. void input_notify(void);
  71. void move_notify(void);
  72. void server_prompt(const std::string &prompt) override;
  73. };
  74. class ScriptPlanet : public Dispatch {
  75. private:
  76. MoveDispatch * md;
  77. std::shared_ptr<Dispatch> move;
  78. InputDispatch * id;
  79. std::shared_ptr<Dispatch> input;
  80. TraderDispatch * td;
  81. std::shared_ptr<Dispatch> trader;
  82. void next(void);
  83. std::shared_ptr<Dispatch> us;
  84. const char * foe[3] = {"Fuel", "Organics", "Equipment"};
  85. public:
  86. ScriptPlanet(Director &, const char *called = nullptr);
  87. ~ScriptPlanet();
  88. int planet;
  89. int sector;
  90. int state;
  91. int current_level;
  92. int population[3];
  93. int total_population;
  94. int amount[3];
  95. int ship[3];
  96. int to_make_one[3];
  97. int support_construction;
  98. int needs[3];
  99. int days;
  100. int current_product;
  101. sector_type current_buyfrom;
  102. void init(void);
  103. void activate(void) override;
  104. void deactivate(void) override;
  105. void input_notify(void);
  106. void move_notify(void);
  107. void trade_notify(void);
  108. void server_prompt(const std::string &prompt) override;
  109. void server_line(const std::string &line, const std::string &raw_line) override;
  110. void client_input(const std::string &input) override;
  111. private:
  112. void clear_amounts(void);
  113. int place_colonists(void);
  114. };
  115. #endif