123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- #ifndef DIRECTOR_H
- #define DIRECTOR_H
- #include "galaxy.h"
- #include "session_common.h"
- #include <boost/circular_buffer.hpp>
- class Dispatch;
- class MenuDispatch;
- class InputDispatch;
- class Director {
- public:
- /**
- * This dispatches client_input, server_line and server_prompt.
- *
- * Set chain.setNotify() to get a response when it is done.
- * activate() to begin the chain.
- *
- * The chain has to_client, to_server functions that dispatch to those
- * functions in Dispatch/Director/Session.
- */
- std::shared_ptr<Dispatch> chain;
- StringFunc to_client;
- // StringFunc to_server;
- std::function<void (const std::string &, const std::string &)> to_server;
- // void Session::post(notifyFunc nf)
- std::function<void(notifyFunc)> post;
- void client_input(const std::string &input);
- void server_line(const std::string &line, const std::string &raw_line);
- void server_prompt(const std::string &prompt, const std::string &raw_prompt);
- bool active;
- // not sure if I need these or not?
- std::string current_raw_prompt;
- std::string current_prompt;
- std::string old_prompt;
- std::string old_raw_prompt;
- void proxy_activate();
- void proxy_deactivate();
- char game; // 0 = not in a game
- // not sure on these... or how I want to use them.
- // maybe this is the place for these?!
- // IF these are public -- Session can access them. :P
- bool show_client;
- bool talk_direct;
- // maybe these would work better?
- std::function<void(bool)> set_show_client;
- std::function<void(bool)> set_talk_direct;
- Director();
- ~Director();
- int count;
- int current_sector;
- Galaxy galaxy;
- std::string username;
- private:
- void build_menu(void);
- std::shared_ptr<Dispatch> main_menu;
- std::shared_ptr<Dispatch> cim;
- std::shared_ptr<Dispatch> config_input;
- std::shared_ptr<Dispatch> edit_input;
- std::shared_ptr<Dispatch> scripts_menu;
- std::shared_ptr<Dispatch> script;
- std::shared_ptr<Dispatch> macro_input;
- InputDispatch *init_config_input(void);
- InputDispatch *init_edit_input(void);
- InputDispatch *init_macro_input(void);
- MenuDispatch *init_scripts_menu(void);
- // notifications
- void have_input(void);
- void menu_choice(void);
- void cim_done(void);
- void scripts_done(void);
- void information(void);
- void config_edit(void);
- void config_have_input(void);
- std::string config_item; // current item being edited
- void macro_edit(void);
- void macro_have_input(void);
- std::string macro_item;
-
- StringFunc SL_parser;
- StringFunc SF_cimline, SF_sectorline, SF_portline, SF_warpline, SF_infoline,
- SF_densityline, SF_computer_portline, SF_planetline;
- void SL_cimline(const std::string &line);
- void SL_thiefline(const std::string &line);
- void SL_sectorline(const std::string &line);
- void SL_portline(const std::string &line);
- void SL_computer_portline(const std::string &line);
- void SL_warpline(const std::string &line);
- void SL_infoline(const std::string &line);
- void SL_densityline(const std::string &line);
- void SL_planetline(const std::string &line);
- int computer_port_sector;
- bool computer_port_done;
- boost::circular_buffer<std::string> SL_history{10};
- };
- #include "dispatchers.h"
- #endif
|