scripts.h 2.5 KB

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