bool CMainFrame::Seek(double Frame) { if (!IsPlaying() || ActivePlayer()) { // if stopped, or active view owns player SetNow(Frame); // normal case } else { // player is playing but owned by inactive view if (!SetPosition(Frame)) // just set player position return(FALSE); } return(TRUE); }
CDateTime::CDateTime( const char* szTime ) : m_dtsTime() { SetNow(); EDTFORMAT edtfFormat = DetermineFormat( szTime ); ScanFromString( szTime, edtfFormat ); }
CDateTime::CDateTime() : m_dtsTime() { SetNow(); }
int CLobbyApp::Run() { const DWORD c_dwUpdateInterval = 200; // milliseconds DWORD dwSleep = c_dwUpdateInterval; DWORD dwWait = WAIT_TIMEOUT; InitializeCriticalSectionAndSpinCount(&HttpCriticalSection, 0x00000400); InitializeCriticalSectionAndSpinCount(GetLogonCS(), 0x00000400); m_plas->LogEvent(EVENTLOG_INFORMATION_TYPE, LE_Running); puts("---------Press Q to exit---------"); printf("Ready for clients/servers.\n"); CTempTimer timerIterations("between iterations", .25f); timerIterations.Start(); CTempTimer timerReceiveClientsMessages("in clients ReceiveMessages()", .05f); CTempTimer timerReceiveServersMessages("in servers ReceiveMessages()", .05f); Time timeLastQueueCheck = Time::Now(); Time timeLastGameInfo = Time::Now(); while (true) { timerIterations.Stop(); timerIterations.Start(); if (ProcessMsgPump() || (_kbhit() && toupper(_getch()) == 'Q')) { //Imago #111 7/10 if(g_pAutoUpdate) { char szFileName[MAX_PATH+16]; strcpy(szFileName, _Module.GetModulePath()); Strcat(szFileName, "FileList.txt"); g_pAutoUpdate->LoadCRC(szFileName); FedMessaging * pfm = &g_pLobbyApp->GetFMClients(); int count = pfm->GetConnectionCount(); ListConnections::Iterator iterCnxn(*pfm->GetConnections()); while (!iterCnxn.End()) { BEGIN_PFM_CREATE(*pfm, pfmAutoUpdate, L, AUTO_UPDATE_INFO) FM_VAR_PARM(g_pAutoUpdate->GetFTPServer(), CB_ZTS) FM_VAR_PARM(g_pAutoUpdate->GetFTPInitialDir(), CB_ZTS) FM_VAR_PARM(g_pAutoUpdate->GetFTPAccount(), CB_ZTS) FM_VAR_PARM(g_pAutoUpdate->GetFTPPassword(), CB_ZTS) END_PFM_CREATE pfmAutoUpdate->crcFileList = g_pAutoUpdate->GetFileListCRC(); pfmAutoUpdate->nFileListSize = g_pAutoUpdate->GetFileListSize(); pfm->SendMessages(iterCnxn.Value(), FM_GUARANTEED, FM_FLUSH); iterCnxn.Next(); } } return 0; } SetNow(); m_pCounters->timeInnerLoop = timerIterations.LastInterval(); // receive any messages in the queue timerReceiveClientsMessages.Start(); m_fmClients.ReceiveMessages(); timerReceiveClientsMessages.Stop(); timerReceiveServersMessages.Start(); m_fmServers.ReceiveMessages(); timerReceiveServersMessages.Stop(); if (GetNow() - timeLastQueueCheck >= 1.0f) { // count the fairly expensive stuff no more than once a second UpdatePerfCounters(); timeLastQueueCheck = GetNow(); if (GetNow() - timeLastGameInfo >= (float) m_sGameInfoInterval) { SendGameInfo(); timeLastGameInfo = GetNow(); } // Do a periodic roll call. If we haven't heard from anyone for two roll calls in a row, waste 'em static Time timeRollCall = Time::Now(); if (GetNow() - timeRollCall >= 5.0f) { RollCall(); timeRollCall = GetNow(); } } Sleep(1); } DeleteCriticalSection(GetLogonCS()); DeleteCriticalSection(&HttpCriticalSection); return 0; }