Esempio n. 1
0
PlayerSpawnSystem::PlayerSpawnSystem(SystemParams params)
    : System(params)
    , m_DbgConfigForceRespawn(false)
{
    EVENT_SUBSCRIBE_MEMBER(m_OnInputCommand, &PlayerSpawnSystem::OnInputCommand);
    EVENT_SUBSCRIBE_MEMBER(m_OnPlayerSpawnerd, &PlayerSpawnSystem::OnPlayerSpawned);
    EVENT_SUBSCRIBE_MEMBER(m_OnPlayerDeath, &PlayerSpawnSystem::OnPlayerDeath);
    ConfigFile* config = ResourceManager::Load<ConfigFile>("Config.ini");
    m_NetworkEnabled = config->Get("Networking.StartNetwork", false);
    m_ForcedRespawnTime = config->Get("Debug.RespawnTime", -1.0f);
    m_DbgConfigForceRespawn = m_ForcedRespawnTime > 0 && IsServer;
}
Esempio n. 2
0
void Frontend::Init(Communicator *c) {
#if 1
    const char *config_file;
#ifdef _CONFIG_FILE
    if((config_file = getenv("CONFIG_FILE")) == NULL)
        config_file = _CONFIG_FILE;
#else
	config_file = "gvirtus.properties";
#endif
    ConfigFile *cf = new ConfigFile(config_file);
    string communicator;
#ifndef _WIN32
    char *tmp;
	if((tmp = getenv("COMMUNICATOR")) != NULL)
        communicator = string(tmp);
    else
#endif
    communicator = cf->Get("communicator");
    mpCommunicator = Communicator::Get(communicator);
#else
    mpCommunicator = c;
#endif

    mpCommunicator->Connect();
    mpInputBuffer = new Buffer();
    mpOutputBuffer = new Buffer();
    mpLaunchBuffer = new Buffer();
    mExitCode = -1;
    initialized = true;
}
Esempio n. 3
0
bool Config::Load(){

  serverPort = 666;
  isPublic = true;
  memset(serverName,0,SERVERNAME_MAX); sprintf(serverName,"G Server");
  enableLogging = true;
  ignoreUnknownPackets = false;
  spriteMaxX = 50;
  spriteMaxY = 50;
  usernameMax = 20;

  ConfigFile file; file.Construct();

  if(file.Load(CONFIG_FILE)){
    file.Get("serverPort",&serverPort);
    file.Get("isPublic",&isPublic);
    file.Get("serverName",serverName,SERVERNAME_MAX);
    file.Get("enableLogging",&enableLogging);
    file.Get("ignoreUnknownPackets",&ignoreUnknownPackets);
    file.Get("spriteMaxX",&spriteMaxX);
    file.Get("spriteMaxY",&spriteMaxY);
    file.Get("usernameMax",&usernameMax);
  }else{
    fprintf(stderr,"WARNING: %s not found. Generating with default settings.\n",CONFIG_FILE);
  }

  file.Clear();
  file.Set("serverPort",serverPort);
  file.Set("isPublic",isPublic);
  file.Set("serverName",serverName);
  file.Set("enableLogging",enableLogging);
  file.Set("ignoreUnknownPackets",ignoreUnknownPackets);
  file.Set("spriteMaxX",spriteMaxX);
  file.Set("spriteMaxY",spriteMaxY);
  file.Set("usernameMax",usernameMax);

  if(file.Save(CONFIG_FILE)){
    file.Destruct();
    return true;
  }else{
    fprintf(stderr,"ERROR: Unable to save %s.\n",CONFIG_FILE);
    file.Destruct();
    return false;
  }

}
Esempio n. 4
0
	Core::Core(const string& cLog, const string& cConfig)
		: CoreObject("CORE", new ofstream(cLog), WorkPriority::WP_MAIN)
	{
		mLogger = mOutFileStream;
		m_pRenderSystem = nullptr;
		m_pInputSystem = nullptr;
		m_pFileSystem = nullptr;

		AddSystem(new FileSystem(mLogger), true);

		ConfigFile* config = new ConfigFile(cConfig, mLogger);
		for (auto it : config->Get())
		{
			if (it.first == "load_module")
			{
				LoadModule(it.second);
			}
			else if (it.first == "set_render_system")
			{
				if (it.second == "11.2")
				{
					ChangeSystem(SystemsType::SYSTEM_RENDER_DIRECTX_11_2);
				}
				else
				{
					DrawLine("Core: Íåâåðíûé ïàðàìåòîð! set_render_system");
				}
			}
			else if (it.first == "set_input_system")
			{
				ChangeSystem(SystemsType::SYSTEM_INPUT_DX);
			}
			else if (it.first == "load_resource_folder")
			{
				m_pFileSystem->AddResourceFolder(it.second);
			}
		}

		DrawLine("Core: Çàãðóçêà çàâåðøåíà!");
	}