void GameTime::SetWaitingForUser(bool value) { if (waiting_for_user == value) return; waiting_for_user = value; stopwatch.SetPause(IsWaiting()); }
bool CslGameConnection::Connect() { CslGameConnection& self=GetInstance(); if (self.m_info->Players>0 && self.m_info->PlayersMax>0 && self.m_info->Players>=self.m_info->PlayersMax) { if (IsWaiting()) return true; wxInt32 time=g_cslSettings->waitServerFull; CslDlgConnectWait *dlg=new CslDlgConnectWait(wxTheApp->GetTopWindow(),&time); wxInt32 ret=dlg->ShowModal(); if (ret!=wxID_CANCEL) { self.m_locked=true; self.m_info->Lock(); if (ret==wxID_OK) { self.m_info->ConnectWait=time; return true; } } else { Reset(); return false; } } else if (!self.m_locked) { self.m_locked=true; self.m_info->Lock(); } CslGameProcess *process=new CslGameProcess(self.m_info,self.m_cmd); if (!::wxExecute(self.m_cmd,wxEXEC_ASYNC,process)) { wxMessageBox(_("Failed to start: ")+self.m_cmd,_("Error"), wxICON_ERROR,wxTheApp->GetTopWindow()); Reset(); return false; } self.m_playing=true; self.m_info->ConnectWait=0; self.m_info->ConnectedTimes++; self.m_info->PlayedLast=wxDateTime::Now().GetTicks(); CslStatusBar::SetText(1,wxString::Format(_("Connected to: '%s (%s)'"), self.m_info->GetBestDescription().c_str(), self.m_info->GetGame().GetName().c_str())); return true; }
void GameTime::Increase() { //if (paused) return; ASSERT(!IsWaiting()); ASSERT(CanBeIncreased()); current_time += delta_t; MSG_DEBUG("time.increase", "Real time without pause: %d; Game time: %d", stopwatch.GetValue(), current_time); }
bool CPlayer::IsInTable()const { if ( m_TableID>0 ) { assert( IsPlaying() || IsSeeing() || IsWaiting() ); } return m_RoomID>0 && m_TableID>0 ; }
void GameTime::SetWaitingForNetwork(bool value) { if (waiting_for_network == value) return; waiting_for_network = value; if (waiting_for_network) { network_wait_time_stopwatch.Reset(); MSG_DEBUG("time.waiting","Start waiting for network."); } else { MSG_DEBUG("time.waiting","Waited %d ms for network.", network_wait_time_stopwatch.GetValue()); } stopwatch.SetPause(IsWaiting()); }
bool CActorInstance::__CanInputNormalAttackCommand() { if (IsWaiting()) return true; if (isNormalAttacking()) { float fElapsedTime = GetAttackingElapsedTime(); if (fElapsedTime > m_pkCurRaceMotionData->GetMotionDuration()*0.9f) return true; } return false; }
void GameTime::LetRealTimePassUntilFrameEnd() { //if (paused) return; ASSERT(!IsWaiting()); int delay; do { #if 1 delay = current_time - (int64_t)stopwatch.GetValue(); if (delay > 0) { // Make sure it still is > 0 after rounding delay = int(delay/stopwatch.GetSpeed())+1; } #else delay = current_time - (int64_t)stopwatch.GetValue(); #endif if (delay > 0) { SDL_Delay((uint)delay); MSG_DEBUG("time.skip", "Do nothing for: %d", delay); } } while (delay > 0); }