/** * "Boots" up XCSoar * @param hInstance Instance handle * @param lpCmdLine Command line string * @return True if bootup successful, False otherwise */ bool XCSoarInterface::Startup() { VerboseOperationEnvironment operation; // Set the application title to "XCSoar" TCHAR szTitle[] = _T("XCSoar"); //If "XCSoar" is already running, stop this instance if (MainWindow::find(szTitle)) return false; LogStartUp(_T("Display dpi=%u,%u"), Display::GetXDPI(), Display::GetYDPI()); // Creates the main window LogStartUp(_T("Create main window")); TopWindowStyle style; if (CommandLine::full_screen) style.FullScreen(); if (CommandLine::resizable) style.Resizable(); main_window.Set(szTitle, SystemWindowSize(), style); if (!main_window.IsDefined()) return false; #ifdef ENABLE_OPENGL LogStartUp(_T("OpenGL: " #ifdef HAVE_EGL "egl=%d " #endif "npot=%d vbo=%d fbo=%d"), #ifdef HAVE_EGL OpenGL::egl, #endif OpenGL::texture_non_power_of_two, OpenGL::vertex_buffer_object, OpenGL::frame_buffer_object); #endif main_window.Initialise(); #ifdef SIMULATOR_AVAILABLE // prompt for simulator if not set by command line argument "-simulator" or "-fly" if (!sim_set_in_cmd_line_flag) { DialogLook white_look; white_look.Initialise(Fonts::map_bold, Fonts::map, Fonts::map_label, Fonts::map_bold, Fonts::map_bold); white_look.SetBackgroundColor(COLOR_WHITE); SetXMLDialogLook(white_look); SimulatorPromptResult result = dlgSimulatorPromptShowModal(); switch (result) { case SPR_QUIT: return false; case SPR_FLY: global_simulator_flag = false; break; case SPR_SIMULATOR: global_simulator_flag = true; break; } } #endif SetXMLDialogLook(main_window.GetLook().dialog); SetSystemSettings().SetDefaults(); SetComputerSettings().SetDefaults(); SetUISettings().SetDefaults(); SetUIState().Clear(); if (!LoadProfile()) return false; operation.SetText(_("Initialising")); /* create XCSoarData on the first start */ CreateDataPath(); Display::LoadOrientation(operation); main_window.InitialiseConfigured(); TCHAR path[MAX_PATH]; LocalPath(path, _T("cache")); file_cache = new FileCache(path); ReadLanguageFile(); status_messages.LoadFile(); InputEvents::readFile(); // Initialize DeviceBlackboard device_blackboard = new DeviceBlackboard(); DeviceListInitialise(); // Initialize Markers marks = new Markers(); protected_marks = new ProtectedMarkers(*marks); #ifdef HAVE_AYGSHELL_DLL const AYGShellDLL &ayg = main_window.ayg_shell_dll; ayg.SHSetAppKeyWndAssoc(VK_APP1, main_window); ayg.SHSetAppKeyWndAssoc(VK_APP2, main_window); ayg.SHSetAppKeyWndAssoc(VK_APP3, main_window); ayg.SHSetAppKeyWndAssoc(VK_APP4, main_window); // Typical Record Button // Why you can't always get this to work // http://forums.devbuzz.com/m_1185/mpage_1/key_/tm.htm // To do with the fact it is a global hotkey, but you can with code above // Also APPA is record key on some systems ayg.SHSetAppKeyWndAssoc(VK_APP5, main_window); ayg.SHSetAppKeyWndAssoc(VK_APP6, main_window); #endif // Initialize main blackboard data task_manager = new TaskManager(GetComputerSettings().task, way_points); task_manager->SetTaskEvents(task_events); task_manager->Reset(); protected_task_manager = new ProtectedTaskManager(*task_manager, XCSoarInterface::GetComputerSettings().task); // Read the terrain file operation.SetText(_("Loading Terrain File...")); LogStartUp(_T("OpenTerrain")); terrain = RasterTerrain::OpenTerrain(file_cache, operation); glide_computer = new GlideComputer(way_points, airspace_database, *protected_task_manager, task_events); glide_computer->ReadComputerSettings(GetComputerSettings()); glide_computer->SetTerrain(terrain); glide_computer->SetLogger(&logger); glide_computer->Initialise(); replay = new Replay(&logger, *protected_task_manager); // Load the EGM96 geoid data EGM96::Load(); GlidePolar &gp = SetComputerSettings().polar.glide_polar_task; gp = GlidePolar(fixed_zero); gp.SetMC(GetComputerSettings().task.safety_mc); gp.SetBugs(GetComputerSettings().polar.degradation_factor); PlaneGlue::FromProfile(SetComputerSettings().plane); PlaneGlue::Synchronize(GetComputerSettings().plane, SetComputerSettings(), gp); task_manager->SetGlidePolar(gp); // Read the topography file(s) topography = new TopographyStore(); LoadConfiguredTopography(*topography, operation); // Read the waypoint files WaypointGlue::LoadWaypoints(way_points, terrain, operation); // Read and parse the airfield info file WaypointDetails::ReadFileFromProfile(way_points, operation); // Set the home waypoint WaypointGlue::SetHome(way_points, terrain, SetComputerSettings(), device_blackboard, false); // ReSynchronise the blackboards here since SetHome touches them device_blackboard->Merge(); ReadBlackboardBasic(device_blackboard->Basic()); // Scan for weather forecast LogStartUp(_T("RASP load")); RASP.ScanAll(Basic().location, operation); // Reads the airspace files ReadAirspace(airspace_database, terrain, GetComputerSettings().pressure, operation); { const AircraftState aircraft_state = ToAircraftState(device_blackboard->Basic(), device_blackboard->Calculated()); ProtectedAirspaceWarningManager::ExclusiveLease lease(glide_computer->GetAirspaceWarnings()); lease->Reset(aircraft_state); lease->SetConfig(CommonInterface::GetComputerSettings().airspace.warnings); } #ifdef HAVE_NET noaa_store = new NOAAStore(); noaa_store->LoadFromProfile(); #endif AudioVarioGlue::Initialise(); AudioVarioGlue::Configure(GetComputerSettings().sound); // Start the device thread(s) operation.SetText(_("Starting devices")); devStartup(); /* -- Reset polar in case devices need the data LogStartUp(_T("GlidePolar::UpdatePolar")); GlidePolar::UpdatePolar(true, GetComputerSettings()); This should be done inside devStartup if it is really required */ operation.SetText(_("Initialising display")); GlueMapWindow *map_window = main_window.GetMap(); if (map_window != NULL) { map_window->SetWaypoints(&way_points); map_window->SetTask(protected_task_manager); map_window->SetRoutePlanner(&glide_computer->GetProtectedRoutePlanner()); map_window->SetGlideComputer(glide_computer); map_window->SetAirspaces(&airspace_database); map_window->SetTopography(topography); map_window->SetTerrain(terrain); map_window->SetWeather(&RASP); map_window->SetMarks(protected_marks); map_window->SetLogger(&logger); /* show map at home waypoint until GPS fix becomes available */ if (GetComputerSettings().poi.home_location_available) map_window->SetLocation(GetComputerSettings().poi.home_location); } // Finally ready to go.. all structures must be present before this. // Create the drawing thread #ifndef ENABLE_OPENGL LogStartUp(_T("CreateDrawingThread")); draw_thread = new DrawThread(*map_window); draw_thread->Start(true); #endif // Show the infoboxes LogStartUp(_T("ShowInfoBoxes")); InfoBoxManager::Show(); // Create the calculation thread LogStartUp(_T("CreateCalculationThread")); CreateCalculationThread(); // Find unique ID of this PDA ReadAssetNumber(); glide_computer_events.Reset(); GetLiveBlackboard().AddListener(glide_computer_events); if (CommonInterface::GetComputerSettings().logger.enable_flight_logger) { flight_logger = new GlueFlightLogger(GetLiveBlackboard()); LocalPath(path, _T("flights.log")); flight_logger->SetPath(path); } if (CommonInterface::GetComputerSettings().logger.enable_nmea_logger) NMEALogger::enabled = true; LogStartUp(_T("ProgramStarted")); // Give focus to the map main_window.SetDefaultFocus(); Pages::Initialise(GetUISettings().pages); // Start calculation thread merge_thread->Start(); calculation_thread->Start(); #ifdef HAVE_TRACKING tracking = new TrackingGlue(); tracking->SetSettings(GetComputerSettings().tracking); #endif globalRunningEvent.Signal(); AfterStartup(); operation.Hide(); main_window.ResumeThreads(); return true; }
//------------------------------------------------------------------------------ // CUISiegeWarfareDoc::EndWar // Explain: 메세지 표시후 공성 종료 // Date : 2005-07-07,Author: Lee Ki-hwan //------------------------------------------------------------------------------ void CUISiegeWarfareDoc::EndWar( int nZoneIndex, int nWinDefense, int nOwnerGuildIndex, CTString strOwnerGuildName, int nOwnerIndex, CTString strOwnerName, int nNextMonth, int nNextDay, int nNextWeek, int nNextHour ) { CUIManager* pUIManager = CUIManager::getSingleton(); INDEX i; if( nZoneIndex == 7 ) { SetUIState( SWS_END ); // 공성이 끝나면 모든 문을 열어 둔다. // FIXME : 문 열어주기. ((CPlayerEntity*)CEntity::GetPlayerEntity(0))->OpenGate( 0, TRUE ); ((CPlayerEntity*)CEntity::GetPlayerEntity(0))->OpenGate( 1, TRUE ); ((CPlayerEntity*)CEntity::GetPlayerEntity(0))->OpenGate( 2, TRUE ); if( _pNetwork->MyCharacterInfo.sbJoinFlagMerac == WCJF_NONE ) return; if( g_slZone == 7 ) ((CPlayerEntity*)CEntity::GetPlayerEntity(0))->PlayBGM( MUSIC_MERAC_FIELD ); // 이미지 출력 추가 _UISignBoard->ShowSingBoard ( 12, 7 ); m_tmLeftTime = _pTimer->GetHighPrecisionTimer().GetMilliseconds(); _pNetwork->MyCharacterInfo.sbJoinFlagMerac = WCJF_NONE; // Start My Guild, Enemy Guild Effect Start ACTORMGR()->SetJoinFlagMerac(WCJF_NONE); } else if( nZoneIndex == 4) { // WSS_DRATAN_SEIGEWARFARE 2007/10/1 -------------------------------->> // 공성 종료 관련 수정... SetUIState( SWS_END ); // WSS_DRATAN_SEIGEWARFARE 2007/10/11 if( _pNetwork->MyCharacterInfo.sbJoinFlagDratan == WCJF_NONE ) return; // WSS_DRATAN_SIEGEWARFARE 2007/10/16 //_pNetwork->MyCharacterInfo.sbJoinFlagDratan = WCJF_NONE; // Start My Guild, Enemy Guild Effect Start ACTORMGR()->SetJoinFlagMerac(WCJF_NONE); // -------------------------------------------------------------------<< // WSS_DRATAN_SIEGEWARFARE 0070725 // TODO :: 드라탄 공성 종료 루틴 ((CPlayerEntity*)CEntity::GetPlayerEntity(0))->OpenGate( 3, TRUE ); ((CPlayerEntity*)CEntity::GetPlayerEntity(0))->OpenGate( 4, TRUE ); ((CPlayerEntity*)CEntity::GetPlayerEntity(0))->OpenGate( 5, TRUE ); ((CPlayerEntity*)CEntity::GetPlayerEntity(0))->OpenGate( 6, TRUE ); ((CPlayerEntity*)CEntity::GetPlayerEntity(0))->OpenGate( 7, TRUE ); pUIManager->GetSiegeWarfareNew()->SetWarState(FALSE); // WSS_DRATAN_SEIGEWARFARE 2007/08/14 -------------------------------->> // 390 ~ 399 공성 부활진지 초기화 CTString tStr; for( i = 0; i < 10; i++) { INDEX tNpcIdx = 390+i; _pNetwork->MyCharacterInfo.mQuarter[tNpcIdx] = -1; _pNetwork->MyCharacterInfo.mQuarterName[tNpcIdx] = CTString(""); // Hard Cording ^^;; 어쩔수 없이.... // 몹 이름 변경 CMobData* MD = CMobData::getData(tNpcIdx); if(MD->GetMobIndex()>0) { tStr.PrintF(_S( 3685,"공성 부활진지%d"),tNpcIdx-389); MD->SetName(tStr); } } // -------------------------------------------------------------------<< if( pUIManager->GetSiegeWarfareNew()->IsEnabled()&& pUIManager->GetSiegeWarfareNew()->IsVisible() ) { pUIManager->RearrangeOrder(UI_SIEGE_WARFARE_NEW,FALSE); } // WSS_DRATAN_SIEGEWARFARE 2007/10/17 // 교감중 공성 종료 처리 if( _pNetwork->MyCharacterInfo.bConsensus ) { pUIManager->GetSiegeWarfareNew()->StopConsensus(_pNetwork->MyCharacterInfo.index); } StopConsensusEffect(0,TRUE); // WSS_DRATAN_SIEGEWARFARE 2007/10/18 // 상태 초기화 ((CPlayerEntity*)CEntity::GetPlayerEntity(0))->PlayerInit(false); } m_nZoneIndex = nZoneIndex; CTString strMessage1; CTString strMessage2; // 공성 끝났면 지도는 초기화 pUIManager->GetMap()->SetCurrentWorldMap( _pNetwork->MyCharacterInfo.zoneNo, 0 ); pUIManager->GetMap()->ReSetData(); if( nWinDefense ) { if( strOwnerGuildName.Length() <= 0 ) { strMessage1.PrintF( _S( 2019, "[%s]지역 [%s]공성에 실패 하였습니다." ), CZoneInfo::getSingleton()->GetZoneName( nZoneIndex ), GetCastleName( nZoneIndex ) ); } else { strMessage1.PrintF( _S(2020 , "[%s]지역 [%s]공성이 종료되었습니다. [%s]길드가 수성에 성공하였습니다." ), CZoneInfo::getSingleton()->GetZoneName( nZoneIndex ), GetCastleName( nZoneIndex ), strOwnerGuildName ); } } else { strMessage1.PrintF( _S(2021 , "[%s]지역 [%s]공성이 종료되었습니다. 새로운 성주로 [%s]길드의 [%s]길드장이 선출 되었습니다." ), CZoneInfo::getSingleton()->GetZoneName( nZoneIndex ), GetCastleName( nZoneIndex ), strOwnerGuildName, strOwnerName ); } strMessage2.PrintF(_S( 2022, "다음 공성전 신청은 %d월 %d일 %s요일 오후 %d시부터 신청이 가능합니다." ), nNextMonth, nNextDay, pUIManager->GetWeekToString( nNextWeek ), nNextHour ); // [2012/06/04 : Sora] ITS 8986 공성시작전 공성시작 지점으로 이동 시 캐릭터 이동불가 상태 발생 수정 // 공성 메시지 출력하면서 해당 UI를 활성화 시켜주어햐 한다. 공성 메시지 출력 방식 변경 pUIManager->GetSiegeWarfare()->SetNotice( strMessage1, strMessage2 ); // Date : 2005-11-18(오후 4:27:13), By Lee Ki-hwan // 메세지 박스 표시 추가 pUIManager->CloseMessageBox( MSGCMD_NULL ); CUIMsgBox_Info MsgBoxInfo; MsgBoxInfo.SetMsgBoxInfo( _S(2341, "공성 종료" ), UMBS_OK, UI_NONE, MSGCMD_NULL ); MsgBoxInfo.AddString( strMessage1 ); pUIManager->CreateMessageBox( MsgBoxInfo ); }