director.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. #ifndef DIRECTOR_H
  2. #define DIRECTOR_H
  3. #include "galaxy.h"
  4. #include "session_common.h"
  5. class Dispatch;
  6. class MenuDispatch;
  7. class InputDispatch;
  8. class Director {
  9. public:
  10. /**
  11. * This dispatches client_input, server_line and server_prompt.
  12. *
  13. * Set chain.setNotify() to get a response when it is done.
  14. * activate() to begin the chain.
  15. *
  16. * The chain has to_client, to_server functions that dispatch to those
  17. * functions in Dispatch/Director/Session.
  18. */
  19. std::shared_ptr<Dispatch> chain;
  20. StringFunc to_client;
  21. StringFunc to_server;
  22. // void Session::post(notifyFunc nf)
  23. std::function<void(notifyFunc)> post;
  24. void client_input(const std::string &input);
  25. void server_line(const std::string &line, const std::string &raw_line);
  26. void server_prompt(const std::string &prompt, const std::string &raw_prompt);
  27. bool active;
  28. // not sure if I need these or not?
  29. std::string current_raw_prompt;
  30. std::string current_prompt;
  31. std::string old_prompt;
  32. std::string old_raw_prompt;
  33. void proxy_activate();
  34. void proxy_deactivate();
  35. char game; // 0 = not in a game
  36. // not sure on these... or how I want to use them.
  37. // maybe this is the place for these?!
  38. // IF these are public -- Session can access them. :P
  39. bool show_client;
  40. bool talk_direct;
  41. // maybe these would work better?
  42. std::function<void(bool)> set_show_client;
  43. std::function<void(bool)> set_talk_direct;
  44. Director();
  45. ~Director();
  46. int count;
  47. int current_sector;
  48. Galaxy galaxy;
  49. std::string username;
  50. private:
  51. void build_menu(void);
  52. std::shared_ptr<Dispatch> main_menu;
  53. std::shared_ptr<Dispatch> cim;
  54. std::shared_ptr<Dispatch> config_input;
  55. std::shared_ptr<Dispatch> scripts_menu;
  56. std::shared_ptr<Dispatch> script;
  57. InputDispatch *init_config_input(void);
  58. MenuDispatch *init_scripts_menu(void);
  59. // notifications
  60. void have_input(void);
  61. void menu_choice(void);
  62. void cim_done(void);
  63. void scripts_done(void);
  64. void information(void);
  65. void config_edit(void);
  66. void config_have_input(void);
  67. std::string config_item; // current item being edited
  68. StringFunc SL_parser;
  69. StringFunc SF_cimline, SF_sectorline, SF_portline, SF_warpline, SF_infoline,
  70. SF_densityline, SF_computer_portline, SF_planetline;
  71. void SL_cimline(const std::string &line);
  72. void SL_thiefline(const std::string &line);
  73. void SL_sectorline(const std::string &line);
  74. void SL_portline(const std::string &line);
  75. void SL_computer_portline(const std::string &line);
  76. void SL_warpline(const std::string &line);
  77. void SL_infoline(const std::string &line);
  78. void SL_densityline(const std::string &line);
  79. void SL_planetline(const std::string &line);
  80. int computer_port_sector;
  81. bool computer_port_done;
  82. };
  83. #include "dispatchers.h"
  84. #endif