Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9388 in orxonox.OLD


Ignore:
Timestamp:
Jul 21, 2006, 2:40:01 PM (18 years ago)
Author:
patrick
Message:

working on loading proxy config file from a seperate file

Location:
branches/proxy/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/proxy/src/lib/network/proxy/proxy_settings.cc

    r9387 r9388  
    1919#include "netdefs.h"
    2020
     21#include "loading/resource_manager.h"
    2122#include "loading/load_param.h"
    2223
     
    3435  /* set the class id for the base object */
    3536  this->setClassID(CL_PROXY_SETTINGS, "ProxySettings");
     37
    3638  // suggest a good standard max players value
    3739  this->maxPlayer = 10;
     40
     41  PRINTF(0)("\n\n\n\n");
     42
     43  std::string fileName = ResourceManager::getInstance()->getDataDir();
     44  fileName += "configs/proxy_settings.conf";
     45
     46
     47  PRINTF(0)("trying file %s\n", fileName.c_str());
     48  TiXmlDocument doc(fileName);
     49  if( !doc.LoadFile(fileName))
     50  {
     51    PRINTF(0)("Loading file %s failed for Proxy Settings.\n", fileName.c_str());
     52    return;
     53  }
     54  const TiXmlElement* root = doc.RootElement();
     55
     56  if( strcmp( root->Value(), "ProxySettings"))
     57  {
     58    // report an error
     59    PRINTF(0)("Specified XML File is not an orxonox proxy settings file (ProxySettings element missing)\n");
     60    return;
     61  }
     62  LoadParamXML(root, "ProxySettings", this, ProxySettings, loadProxySettings);
    3863}
    3964
     
    6388void ProxySettings::loadProxySettings(const TiXmlElement* root)
    6489{
    65 
     90  PRINTF(0)("lalalallalala\n\n");
    6691  LoadParam(root, "max-player", this, ProxySettings, setMaxPlayer);
    6792
     
    6994  {
    7095    element->ToText();
    71     // PER-PARTICLE-ATTRIBUTES:
    7296    LoadParam(root, "proxy-addr", this, ProxySettings, setProxyAddr);
    7397  }
  • branches/proxy/src/lib/network/proxy/proxy_settings.h

    r9347 r9388  
    99#include "base_object.h"
    1010#include "netdefs.h"
     11
     12#include "debug.h"
    1113
    1214#include <vector>
     
    3032
    3133    /** @param number: sets the max number of players */
    32     inline void setMaxPlayer(int number) { this->maxPlayer = number; }
     34    inline void setMaxPlayer(int number) { this->maxPlayer = number; PRINTF(0)("maxplayers set to %i\n\n\n", number);}
    3335    /** @returns teh max number of players */
    3436    int getMaxPlayer() { return this->maxPlayer; }
  • branches/proxy/src/lib/network/shared_network_data.cc

    r9387 r9388  
    3838
    3939//   if( State::isOnline())
    40 //     this->newUniqueID = ProxySettings::getInstance()->getMaxPlayer() + 2;
     40  this->newUniqueID = ProxySettings::getInstance()->getMaxPlayer() + 2;
    4141//   else
    42   this->newUniqueID = NET_MAX_CONNECTIONS + 2;
     42//  this->newUniqueID = NET_MAX_CONNECTIONS + 2;
    4343  this->nodeType = NET_CLIENT;
    4444}
  • branches/proxy/src/lib/network/shared_network_data.h

    r9387 r9388  
    4040
    4141    /** @returns the maximum number of players for this server */
    42     inline int getMaxPlayer() { return /*ProxySettings::getInstance()->getMaxPlayer()*/NET_MAX_CONNECTIONS; }
     42    inline int getMaxPlayer() { return ProxySettings::getInstance()->getMaxPlayer(); }
    4343
    4444    /** @returns the hostID of the node */
  • branches/proxy/src/story_entities/multi_player_world_data.cc

    r9371 r9388  
    281281  GameWorldData::loadScene(root);
    282282
    283   LoadParamXML(root, "ProxySettings", ProxySettings::getInstance(), ProxySettings, loadProxySettings);
     283//   LoadParamXML(root, "ProxySettings", ProxySettings::getInstance(), ProxySettings, loadProxySettings);
    284284
    285285  // create server playable
Note: See TracChangeset for help on using the changeset viewer.