Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef PLAYTURN_HPP_INCLUDED
00017 #define PLAYTURN_HPP_INCLUDED
00018
00019 class config;
00020 class replay_network_sender;
00021
00022 #include "generic_event.hpp"
00023 #include "network.hpp"
00024 #include "replay.hpp"
00025
00026 class turn_info
00027 {
00028 public:
00029 turn_info(unsigned team_num, replay_network_sender &network_sender);
00030
00031 ~turn_info();
00032
00033 void sync_network();
00034
00035 void send_data();
00036
00037 enum PROCESS_DATA_RESULT {
00038 PROCESS_CONTINUE,
00039 PROCESS_RESTART_TURN,
00040 PROCESS_END_TURN,
00041
00042 PROCESS_END_LINGER
00043 };
00044
00045
00046
00047
00048
00049
00050
00051
00052 PROCESS_DATA_RESULT process_network_data(const config& cfg,network::connection from,std::deque<config>& backlog, bool skip_replay);
00053
00054 events::generic_event& host_transfer() { return host_transfer_; }
00055 private:
00056 static void change_controller(const std::string& side, const std::string& controller);
00057 static void change_side_controller(const std::string& side, const std::string& player);
00058
00059 void handle_turn(
00060 bool& turn_end,
00061 const config& t,
00062 const bool skip_replay,
00063 std::deque<config>& backlog);
00064
00065 unsigned int team_num_;
00066
00067 replay_network_sender& replay_sender_;
00068
00069 events::generic_event host_transfer_;
00070
00071 replay replay_;
00072 };
00073
00074 #endif