1 | /* |
---|
2 | orxonox - the future of 3D-vertical-scrollers |
---|
3 | |
---|
4 | Copyright (C) 2004 orx |
---|
5 | |
---|
6 | This program is free software; you can redistribute it and/or modify |
---|
7 | it under the terms of the GNU General Public License as published by |
---|
8 | the Free Software Foundation; either version 2, or (at your option) |
---|
9 | any later version. |
---|
10 | |
---|
11 | ### File Specific: |
---|
12 | main-programmer: Patrick Boenzli |
---|
13 | */ |
---|
14 | |
---|
15 | |
---|
16 | #define DEBUG_MODULE_NETWORK |
---|
17 | |
---|
18 | #include "proxy_settings.h" |
---|
19 | #include "netdefs.h" |
---|
20 | |
---|
21 | #include "loading/load_param.h" |
---|
22 | |
---|
23 | |
---|
24 | using namespace std; |
---|
25 | |
---|
26 | |
---|
27 | ProxySettings* ProxySettings::singletonRef = NULL; |
---|
28 | |
---|
29 | /** |
---|
30 | * Standard constructor |
---|
31 | */ |
---|
32 | ProxySettings::ProxySettings() |
---|
33 | { |
---|
34 | /* set the class id for the base object */ |
---|
35 | this->setClassID(CL_PROXY_SETTINGS, "ProxySettings"); |
---|
36 | } |
---|
37 | |
---|
38 | |
---|
39 | /** |
---|
40 | * Standard destructor |
---|
41 | */ |
---|
42 | ProxySettings::~ProxySettings() |
---|
43 | { |
---|
44 | ProxySettings::singletonRef = NULL; |
---|
45 | } |
---|
46 | |
---|
47 | |
---|
48 | |
---|
49 | /** |
---|
50 | * load the proxy settings |
---|
51 | * @param root: the root element of the xml elemnts |
---|
52 | */ |
---|
53 | void ProxySettings::loadProxySettings(const TiXmlElement* root) |
---|
54 | { |
---|
55 | |
---|
56 | LoadParam(root, "max-player", this, ProxySettings, setMaxPlayer); |
---|
57 | |
---|
58 | LoadParam(root, "proxy-addr", this, ProxySettings, setProxyAddr); |
---|
59 | } |
---|
60 | |
---|
61 | |
---|
62 | /** |
---|
63 | * sets the proxy address to |
---|
64 | * @param proxyAddr: the proxy address |
---|
65 | */ |
---|
66 | void ProxySettings::setProxyAddr(const std::string& proxyAddr) |
---|
67 | { |
---|
68 | IPaddress *ip = new IPaddress; |
---|
69 | |
---|
70 | SDLNet_ResolveHost( ip, proxyAddr.c_str(), 9999 ); |
---|
71 | |
---|
72 | this->proxies.push_back(ip); |
---|
73 | } |
---|
74 | |
---|
75 | |
---|
76 | |
---|
77 | |
---|
78 | |
---|
79 | |
---|
80 | |
---|