00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef PLAYTURN_HPP_INCLUDED
00015 #define PLAYTURN_HPP_INCLUDED
00016
00017 class game_display;
00018 class config;
00019 class game_state;
00020 class replay_network_sender;
00021 class team;
00022 class unit;
00023
00024 #include "global.hpp"
00025
00026 #include "actions.hpp"
00027 #include "generic_event.hpp"
00028 #include "network.hpp"
00029
00030 #include <map>
00031 #include <vector>
00032
00033 class turn_info
00034 {
00035 public:
00036 turn_info(game_state& state_of_game,
00037 const gamestatus& status, game_display& gui, gamemap& map,
00038 std::vector<team>& teams, unsigned int team_num, unit_map& units,
00039 replay_network_sender& network_sender, undo_list& undo_stack);
00040
00041 ~turn_info();
00042
00043 void sync_network();
00044
00045 void send_data();
00046
00047 enum PROCESS_DATA_RESULT {
00048 PROCESS_CONTINUE,
00049 PROCESS_RESTART_TURN,
00050 PROCESS_END_TURN,
00051
00052 PROCESS_END_LINGER
00053 };
00054
00055
00056
00057
00058
00059
00060
00061
00062 PROCESS_DATA_RESULT process_network_data(const config& cfg,network::connection from,std::deque<config>& backlog, bool skip_replay);
00063
00064 events::generic_event& replay_error() { return replay_error_; }
00065 events::generic_event& host_transfer() { return host_transfer_; }
00066 private:
00067 static void change_side_controller(const std::string& side, const std::string& player, bool own_side=false);
00068
00069 game_state& state_of_game_;
00070 const gamestatus& status_;
00071 game_display& gui_;
00072 gamemap& map_;
00073 std::vector<team>& teams_;
00074 unsigned int team_num_;
00075 unit_map& units_;
00076
00077 undo_list& undo_stack_;
00078
00079 replay_network_sender& replay_sender_;
00080
00081 events::generic_event replay_error_;
00082 events::generic_event host_transfer_;
00083 };
00084
00085 #endif