Example #1
0
//--------------------------------------------------------------------
  AEvent::AEvent() : AEventHeader()
//--------------------------------------------------------------------
  { 
  	fDebugLevel = "DEBUG"; 
    InitLogger("AEvent");
    SetDebugLevel(fDebugLevel,"AEvent");
  }
Example #2
0
lua_State *
Lua::NewFullState()
{
  lua_State *L = NewBasicState();

  InitLog(L);
  InitPersistent(L);
  InitTimer(L);
  InitMap(L);
  InitBlackboard(L);
  InitDialogs(L);
  InitLegacy(L);
  InitAirspace(L);
  InitTask(L);
  InitSettings(L);
  InitWind(L);
  InitLogger(L);
  InitTracking(L);
  InitReplay(L);
  InitInputEvent(L);

  {
    SetPackagePath(L,
                   WideToUTF8Converter(LocalPath(_T("lua" DIR_SEPARATOR_S "?.lua")).c_str()));
  }

  return L;
}
Example #3
0
void ParseArgs(int argc,char**argv)
{
    int i,j;
    const char*logfile="stderr";
    //int loglevel=kInfo;
    int loglevel=kDebug;

    InitLogger(loglevel,NULL); //set log_file and log_level

    for(i=1;i<argc;i++){
	policy=ParsePolicy(argv[i]);
    }
    InitLogger(loglevel,logfile);
    if(policy==NULL){
	LogFatal("policy not valid");
    }
}
Example #4
0
//--------------------------------------------------------------------
  AEvent::AEvent(int evtNumber,
                 double trueEventEnergy, double recEventEnergy)
//--------------------------------------------------------------------
  {
    AEventHeader(evtNumber,trueEventEnergy,recEventEnergy);
    fDebugLevel = "DEBUG"; 
    InitLogger("AEvent");
    SetDebugLevel(fDebugLevel,"AEvent");
  }
Example #5
0
int main(int argc, char* argv[]) {
  try {
    InitLogger(argc, argv);
    return boost::unit_test::unit_test_main(&init_unit_test_suite, argc, argv);
  } catch (const std::exception& err) {
    std::cerr << err.what() << "\n";
    return 1;
  } catch (...) {
    std::cerr << "Unknown error\n";
    return 2;
  }

  return 0;
}
Example #6
0
	AParticle::AParticle(int Id, std::string name, 
											bool isPrimary, double charge, 
         							TVector3 vertex, 
         							TLorentzVector p4,
                      int motherID)
  {
 		SetID(Id);
  	SetParticleName(name);
  	SetIsPrimary(isPrimary);
 		SetCharge(charge);
 		SetVertex(vertex);
  	SetP4(p4);
    SetMotherID(motherID);
    InitLogger("Aparticle");
    fDebug = "WARN";
    SetDebugLevel(fDebug,"Aparticle");
  }
Example #7
0
bool CSmartServer::Initialize()
{
	START_FUNCTION_BOOL();
	
	CHECK_SUCCESS(RetrieveBinDir());
	InitLogger();
	LoadConfig();

	CHECK_SUCCESS(InitCommandReceiver());
	CHECK_SUCCESS(InitArduinoDevice());
	CHECK_SUCCESS(InitDBLogger());
	CHECK_SUCCESS(InitMusicPlayer());

	LOG_MSG("[ + ] Successfull initlization");
	m_bInitSuccess = true;
	END_FUNCTION_BOOL();
}
Example #8
0
int main(int argc, char **argv) {
  struct sigaction sa;
  char *LogFile;

  memset(&sa, 0, sizeof(struct sigaction));
  sa.sa_handler = SIG_DFL;
  sa.sa_flags |= SA_RESTART;
  if (sigaction(SIGCHLD, &sa, NULL) != 0) {
    Error("sigaction(2) failure");
  }

  gtk_init(&argc, &argv);
  gtk_panda_init(&argc, &argv);
  gtk_set_locale();

  bindtextdomain(PACKAGE, LOCALEDIR);
  textdomain(PACKAGE);

  LogFile = getenv("GLPUSH_LOGFILE");
  if (LogFile == NULL) {
    InitLogger("glprint");
  } else {
    InitLogger_via_FileName(LogFile);
  }
  TempDir = getenv("GLPUSH_TEMPDIR");
  if (TempDir == NULL) {
    InitTempDir("glprint");
  } else {
    InitTempDir_via_Dir(TempDir);
  }

  gl_config_init();
  InitDesktop();

  execute();

  gtk_timeout_add(30 * 1000, push_action_exit, NULL);
  gtk_main();

  sleep(3);

  return 0;
}
Example #9
0
HumanClientApp::HumanClientApp(int width, int height, bool calculate_fps, const std::string& name,
                               int x, int y, bool fullscreen, bool fake_mode_change) :
    ClientApp(),
    SDLGUI(width, height, calculate_fps, name, x, y, fullscreen, fake_mode_change),
    m_fsm(0),
    m_single_player_game(true),
    m_game_started(false),
    m_connected(false),
    m_auto_turns(0),
    m_have_window_focus(true)
{
#ifdef ENABLE_CRASH_BACKTRACE
    signal(SIGSEGV, SigHandler);
#endif
#ifdef FREEORION_MACOSX
    SDL_SetHint(SDL_HINT_MAC_CTRL_CLICK_EMULATE_RIGHT_CLICK, "1");
#endif
    m_fsm = new HumanClientFSM(*this);

    const std::string HUMAN_CLIENT_LOG_FILENAME((GetUserDir() / "freeorion.log").string());

    InitLogger(HUMAN_CLIENT_LOG_FILENAME, "Client");

    try {
        DebugLogger() << "GL Version String: " << GetGLVersionString();
    } catch (...) {
        ErrorLogger() << "Unable to get GL Version String?";
    }

    LogDependencyVersions();

    boost::shared_ptr<GG::StyleFactory> style(new CUIStyle());
    SetStyleFactory(style);

    SetMinDragTime(0);

    m_ui = boost::shared_ptr<ClientUI>(new ClientUI());

    if ((GetOptionsDB().Get<bool>("UI.sound.music-enabled")))
        Sound::GetSound().PlayMusic(GetOptionsDB().Get<std::string>("UI.sound.bg-music"), -1);

    Sound::GetSound().SetMusicVolume(GetOptionsDB().Get<int>("UI.sound.music-volume"));
    Sound::GetSound().SetUISoundsVolume(GetOptionsDB().Get<int>("UI.sound.volume"));

    EnableFPS();
    UpdateFPSLimit();
    GG::Connect(GetOptionsDB().OptionChangedSignal("show-fps"), &HumanClientApp::UpdateFPSLimit, this);

    boost::shared_ptr<GG::BrowseInfoWnd> default_browse_info_wnd(
        new GG::TextBoxBrowseInfoWnd(GG::X(400), ClientUI::GetFont(),
                                     GG::Clr(0, 0, 0, 200), ClientUI::WndOuterBorderColor(), ClientUI::TextColor(),
                                     GG::FORMAT_LEFT | GG::FORMAT_WORDBREAK, 1));
    GG::Wnd::SetDefaultBrowseInfoWnd(default_browse_info_wnd);

    boost::shared_ptr<GG::Texture> cursor_texture = m_ui->GetTexture(ClientUI::ArtDir() / "cursors" / "default_cursor.png");
    SetCursor(boost::shared_ptr<GG::TextureCursor>(new GG::TextureCursor(cursor_texture, GG::Pt(GG::X(6), GG::Y(3)))));
    RenderCursor(true);

    EnableKeyPressRepeat(GetOptionsDB().Get<int>("UI.keypress-repeat-delay"),
                         GetOptionsDB().Get<int>("UI.keypress-repeat-interval"));
    EnableMouseButtonDownRepeat(GetOptionsDB().Get<int>("UI.mouse-click-repeat-delay"),
                                GetOptionsDB().Get<int>("UI.mouse-click-repeat-interval"));

    GG::Connect(WindowResizedSignal,    &HumanClientApp::HandleWindowResize,    this);
    GG::Connect(FocusChangedSignal,     &HumanClientApp::HandleFocusChange,     this);
    GG::Connect(WindowMovedSignal,      &HumanClientApp::HandleWindowMove,      this);
    /* TODO: Wire these signals if theyare needed
    GG::Connect(WindowClosingSignal,    &HumanClientApp::HandleWindowClosing,   this);
    GG::Connect(WindowClosedSignal,     &HumanClientApp::HandleWindowClose,     this);
    */

    SetStringtableDependentOptionDefaults();
    SetGLVersionDependentOptionDefaults();

    this->SetMouseLRSwapped(GetOptionsDB().Get<bool>("UI.swap-mouse-lr"));

    std::map<std::string, std::map<int, int> > named_key_maps;
    parse::keymaps(GetResourceDir() / "keymaps.txt", named_key_maps);
    if (GetOptionsDB().Get<bool>("verbose-logging")) {
        DebugLogger() << "Keymaps:";
        for (std::map<std::string, std::map<int, int> >::const_iterator km_it = named_key_maps.begin();
             km_it != named_key_maps.end(); ++km_it)
        {
            DebugLogger() << "Keymap name = \"" << km_it->first << "\"";
            const std::map<int, int>& key_map = km_it->second;
            for (std::map<int, int>::const_iterator keys_it = key_map.begin(); keys_it != key_map.end(); ++keys_it)
                DebugLogger() << "    " << char(keys_it->first) << " : " << char(keys_it->second);
        }
    }
    std::map<std::string, std::map<int, int> >::const_iterator km_it = named_key_maps.find("TEST");
    if (km_it != named_key_maps.end()) {
        const std::map<int, int> int_key_map = km_it->second;
        std::map<GG::Key, GG::Key> key_map;
        for (std::map<int, int>::const_iterator key_int_it = int_key_map.begin();
             key_int_it != int_key_map.end(); ++key_int_it)
        { key_map[GG::Key(key_int_it->first)] = GG::Key(key_int_it->second); }
        this->SetKeyMap(key_map);
    }

    ConnectKeyboardAcceleratorSignals();

    InitAutoTurns(GetOptionsDB().Get<int>("auto-advance-n-turns"));

    if (fake_mode_change && !FramebuffersAvailable()) {
        ErrorLogger() << "Requested fake mode changes, but the framebuffer opengl extension is not available. Ignoring.";
    }
    m_fsm->initiate();
}
Example #10
0
 AParticle::AParticle()
 {
   InitLogger("Aparticle");
   fDebug = "WARN";
   SetDebugLevel(fDebug,"Aparticle");
 }