[9396] | 1 | /*! |
---|
| 2 | * @file proxy_settings.h |
---|
| 3 | * some shared data from the proxy settings |
---|
| 4 | */ |
---|
| 5 | |
---|
| 6 | #ifndef _NETWORK_SETTINGS_H |
---|
| 7 | #define _NETWORK_SETTINGS_H |
---|
| 8 | |
---|
| 9 | #include "base_object.h" |
---|
| 10 | #include "netdefs.h" |
---|
| 11 | |
---|
| 12 | #include "debug.h" |
---|
| 13 | #include "ip.h" |
---|
| 14 | |
---|
| 15 | #include <vector> |
---|
| 16 | |
---|
| 17 | |
---|
| 18 | class NetworkStream; |
---|
| 19 | class Synchronizeable; |
---|
| 20 | class TiXmlElement; |
---|
| 21 | |
---|
| 22 | |
---|
| 23 | /* and here is the class itsself*/ |
---|
| 24 | class NetworkSettings : public BaseObject |
---|
| 25 | { |
---|
| 26 | |
---|
| 27 | public: |
---|
| 28 | inline static NetworkSettings* getInstance() { if (!NetworkSettings::singletonRef) NetworkSettings::singletonRef = new NetworkSettings(); |
---|
| 29 | return NetworkSettings::singletonRef; } |
---|
| 30 | virtual ~NetworkSettings(); |
---|
| 31 | |
---|
| 32 | void loadData(); |
---|
| 33 | |
---|
| 34 | void loadNetworkSettings(const TiXmlElement* root); |
---|
| 35 | |
---|
| 36 | /** @param number: sets the max number of players */ |
---|
| 37 | inline void setMaxPlayer(int number) { this->maxPlayer = number; } |
---|
| 38 | /** @returns teh max number of players */ |
---|
| 39 | int getMaxPlayer() { return this->maxPlayer; } |
---|
| 40 | |
---|
| 41 | void setMasterAddr(const std::string& masterAddr); |
---|
| 42 | /** @returns the address of the master server read from the network config file */ |
---|
| 43 | inline IP getMasterAddr() { return this->masterServer; } |
---|
| 44 | |
---|
| 45 | void setProxyAddr(const std::string& proxyAddr); |
---|
| 46 | /** @returns the list of proxy servers from the init file */ |
---|
| 47 | inline std::vector<IPaddress*>* getProxyList() { return &this->proxies; } |
---|
| 48 | |
---|
| 49 | |
---|
| 50 | private: |
---|
| 51 | NetworkSettings(); |
---|
| 52 | |
---|
| 53 | |
---|
| 54 | private: |
---|
| 55 | static NetworkSettings* singletonRef; //!< Pointer to the only instance of this Class |
---|
| 56 | int maxPlayer; //!< maximal number of players |
---|
| 57 | std::vector<IPaddress*> proxies; //!< all registered proxies |
---|
| 58 | IP masterServer; //!< master server ip address |
---|
| 59 | |
---|
| 60 | }; |
---|
| 61 | |
---|
| 62 | |
---|
| 63 | |
---|
| 64 | #endif /* _NETWORK_SETTINGS_H */ |
---|