#include "stdafx.h"
#include "Config.h"
#include <ConfigImpl.h>
#include <sstream>

Config::Config()
{
  ConfigImpl::initialize(this);
}

unsigned int Config::getDefaultLoggerEvents() const
{
  return ConfigImpl::getDefaultLoggerEvents();
}

int Config::getDefaultSpeed() const
{
  return ConfigImpl::getDefaultSpeed();
}

bool Config::startLogServerThread() const
{
  return ConfigImpl::startLogServerThread();
}

bool Config::startStatsThread() const
{
  return ConfigImpl::startStatsThread();
}

unsigned short Config::getLogServerPort() const
{
  return ConfigImpl::getLogServerPort();
}

bool Config::displayActionsOnlyInGUI() const
{ 
  return ConfigImpl::displayActionsOnlyInGUI();
}

bool Config::displayProcessesUnitsInGUI() const
{
  return ConfigImpl::displayProcessesUnitsInGUI();
}

unsigned int Config::getWorkerThreadCount() const
{
  return ConfigImpl::getWorkerThreadCount();
}

void Config::setAvailableMillisecondsPerFrame(unsigned int availableMsPerFrame)
{
  if (m_availableMsPerFrame != availableMsPerFrame)
  {
    m_availableMsPerFrame = availableMsPerFrame;
    std::stringstream ss;
    ss << "Changed milliseconds available per frame to: ";
    if (m_availableMsPerFrame == MS_NO_LIMIT)
      ss << "no limit";
    else if (m_availableMsPerFrame == MS_SCHEDULER)
      ss << "scheduler's discretion";
    else
      ss << m_availableMsPerFrame;
    BWAPI::Broodwar->sendText(ss.str().c_str());
  }
}