16 #ifndef SERVER_PLAYER_CONNECTION_HPP_INCLUDED
17 #define SERVER_PLAYER_CONNECTION_HPP_INCLUDED
23 #define BOOST_ASIO_DISABLE_THREADS
25 #include <boost/asio.hpp>
26 #include <boost/shared_ptr.hpp>
28 #include <boost/multi_index_container.hpp>
29 #include <boost/multi_index/member.hpp>
30 #include <boost/multi_index/mem_fun.hpp>
31 #include <boost/multi_index/ordered_index.hpp>
32 #include <boost/multi_index/hashed_index.hpp>
65 typedef multi_index_container<
69 tag<socket_t>, BOOST_MULTI_INDEX_CONST_MEM_FUN(player_record,
const socket_ptr,socket)>,
71 tag<name_t>, BOOST_MULTI_INDEX_CONST_MEM_FUN(player_record,
const std::string&,
name)>,
73 tag<game_t>, BOOST_MULTI_INDEX_CONST_MEM_FUN(player_record,
int,game_id)>
79 template<
typename Container>
82 typename Container::const_iterator iter = players.begin(), iter_end = players.end();
83 for(;iter != iter_end; ++iter)
static void enter_lobby(player_record &)
const socket_ptr socket() const
boost::shared_ptr< game > game_
GLint GLenum GLsizei GLint GLsizei const GLvoid * data
const std::string & name() const
static void set_game(player_record &, boost::shared_ptr< game >)
void send_to_player(socket_ptr socket, simple_wml::document &doc)
std::string client_address(socket_ptr socket)
const boost::shared_ptr< game > get_game() const
player_record(const socket_ptr socket, const player &player)
multi_index_container< player_record, indexed_by< ordered_unique< tag< socket_t >, BOOST_MULTI_INDEX_CONST_MEM_FUN(player_record, const socket_ptr, socket)>, hashed_unique< tag< name_t >, BOOST_MULTI_INDEX_CONST_MEM_FUN(player_record, const std::string &, name)>, ordered_non_unique< tag< game_t >, BOOST_MULTI_INDEX_CONST_MEM_FUN(player_record, int, game_id)> >> player_connections
GLuint const GLchar * name
const std::string & name() const
GLsizei GLenum GLuint GLuint GLsizei char * message
boost::shared_ptr< boost::asio::ip::tcp::socket > socket_ptr
GLsizei const GLcharARB ** string
void send_server_message(socket_ptr socket, const std::string &message)
void send_to_players(simple_wml::document &data, const Container &players, socket_ptr exclude=socket_ptr())