/*! * @file proxy_settings.h * some shared data from the proxy settings */ #ifndef _NETWORK_SETTINGS_H #define _NETWORK_SETTINGS_H #include "base_object.h" #include "netdefs.h" #include "debug.h" #include "ip.h" #include class NetworkStream; class Synchronizeable; class TiXmlElement; /* and here is the class itsself*/ class NetworkSettings : public BaseObject { public: inline static NetworkSettings* getInstance() { if (!NetworkSettings::singletonRef) NetworkSettings::singletonRef = new NetworkSettings(); return NetworkSettings::singletonRef; } virtual ~NetworkSettings(); void loadData(); void loadNetworkSettings(const TiXmlElement* root); /** @param number: sets the max number of players */ inline void setMaxPlayer(int number) { this->maxPlayer = number; } /** @returns teh max number of players */ int getMaxPlayer() { return this->maxPlayer; } void setMasterAddr(const std::string& masterAddr); /** @returns the address of the master server read from the network config file */ inline IP getMasterAddr() { return this->masterServer; } void setProxyAddr(const std::string& proxyAddr); /** @returns the list of proxy servers from the init file */ inline std::vector* getProxyList() { return &this->proxies; } private: NetworkSettings(); private: static NetworkSettings* singletonRef; //!< Pointer to the only instance of this Class int maxPlayer; //!< maximal number of players std::vector proxies; //!< all registered proxies IP masterServer; //!< master server ip address }; #endif /* _NETWORK_SETTINGS_H */