1 #include "offlinebattle.h" 2 #include "spring.h" 3 4 #include <wx/timer.h> 5 OfflineBattle(const int id)6OfflineBattle::OfflineBattle( const int id ): 7 m_id( id ), 8 m_me( User(_T("Spectator")) ) 9 { 10 m_opts.founder = m_me.GetNick(); 11 OnUserAdded( m_me ); 12 UserBattleStatus& newstatus = m_me.BattleStatus(); 13 newstatus.spectator = true; 14 newstatus.sync = true; 15 } 16 OfflineBattle()17OfflineBattle::OfflineBattle(): 18 m_id( 0 ), 19 m_me( User(_T("Spectator")) ) 20 { 21 m_opts.founder = m_me.GetNick(); 22 OnUserAdded( m_me ); 23 UserBattleStatus& newstatus = m_me.BattleStatus(); 24 newstatus.spectator = true; 25 newstatus.sync = true; 26 } 27 StartSpring()28void OfflineBattle::StartSpring() 29 { 30 spring().Run(*this); 31 } 32 OfflineBattle(const OfflineBattle & other)33OfflineBattle::OfflineBattle ( const OfflineBattle& other ): 34 IBattle(), 35 m_id(0) 36 { 37 *this = other; 38 } 39 operator =(const OfflineBattle & other)40OfflineBattle& OfflineBattle::operator = ( const OfflineBattle& other ) 41 { 42 m_map_loaded = other.m_map_loaded; 43 m_map_loaded = other.m_map_loaded; 44 m_mod_loaded = other.m_mod_loaded; 45 m_map_exists = other.m_map_exists; 46 m_mod_exists = other.m_mod_exists; 47 m_local_map = other.m_local_map; 48 m_local_mod = other.m_local_mod; 49 m_host_map = other.m_host_map; 50 m_host_mod = other.m_host_mod; 51 m_restricted_units = other.m_restricted_units; 52 m_opt_wrap = other.m_opt_wrap; 53 m_opts = other.m_opts; 54 m_ingame = other.m_ingame; 55 m_generating_script = other.m_generating_script; 56 m_rects = other.m_rects; 57 m_ready_up_map = other.m_ready_up_map; // player name -> time counting from join/unspect 58 m_players_ready = other.m_players_ready; 59 m_players_sync = other.m_players_sync; 60 m_teams_sizes = other.m_teams_sizes; // controlteam -> number of people in 61 m_ally_sizes = other.m_ally_sizes; // allyteam -> number of people in 62 m_preset = other.m_preset; 63 m_is_self_in = other.m_is_self_in; 64 m_internal_bot_list = other.m_internal_bot_list; 65 m_script = other.m_script; 66 m_playback_file_path = other.m_playback_file_path; 67 m_parsed_teams = other.m_parsed_teams; 68 m_parsed_allies = other.m_parsed_allies; 69 m_internal_user_list = other.m_internal_user_list; 70 m_timer = new wxTimer( other.m_timer ); //!no idea if this is proper 71 return *this; 72 } 73