/* $Id: serverentry.hpp,v 1.2 2005/06/28 13:55:23 chfreund Exp $ */ #ifndef _SERVERENTRY_HPP_ #define _SERVERENTRY_HPP_ #include #include #include "string.hpp" class Server; struct ServerEntry { enum Type { DIRECT, REMOTE }; Type type; String theme; Uint8 numberPlayers; ServerEntry( Type t = DIRECT ) : type( t ), numberPlayers( 0 ) { } }; struct DirectServerEntry : public ServerEntry { Server* server; DirectServerEntry( Server* s = 0 ) : ServerEntry( DIRECT ), server( s ) { } }; struct RemoteServerEntry : public ServerEntry { std::string name; IPaddress address; RemoteServerEntry( IPaddress& a ) : ServerEntry( REMOTE ), address( a ) { // try to resolve the name for the given address const char* serverName = SDLNet_ResolveIP( &address ); if ( serverName ) { name = serverName; } } }; #endif // _SERVERENTRY_HPP_