Пример #1
0
//--------------------------------
void ForceCommand(std::string in)
{
    UNUSED(in);
    if(busy)
        StopEngine();
    force = true;
}
Пример #2
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CPropVehicleDriveable::InputTurnOff( inputdata_t &inputdata )
{
	// If the player's in the vehicle, stop the engine.
	if ( GetServerVehicle()->GetPassenger( VEHICLE_DRIVER ) )
	{
		StopEngine();
	}
}
Пример #3
0
void CCar::UpdateFuel(float time_delta)
{
	if(!b_engine_on) return;
	if(m_current_rpm>m_min_rpm)
		m_fuel-=time_delta*(m_current_rpm-m_min_rpm)*m_fuel_consumption;
	else
		m_fuel-=time_delta*m_min_rpm*m_fuel_consumption;
	if(m_fuel<EPS) StopEngine();
}
Пример #4
0
MHIContext::~MHIContext()
{
    StopEngine();
    delete(m_engine);
    delete(m_dsmcc);
    if (m_face_loaded) FT_Done_Face(m_face);

    ClearDisplay();
    ClearQueue();
}
Пример #5
0
	void C_Client::Stop()
	{
		StopScene();
		UnloadScreen();
		StopEngine();

        m_Network.Stop();

		OnStop();
	}
Пример #6
0
//--------------------------------
void QuitCommand(std::string in)
{
    UNUSED(in);
#ifdef USE_THREAD_FOR_INPUT
    if(busy || t.joinable())
        StopEngine();
#endif // USE_THREAD_FOR_INPUT

    quit = true;
}
Пример #7
0
void CLocationEngine::PrepareShutdown() {
	if(iEngineState > ELocationShutdown) {
		StopEngine();
		
		iEngineState = ELocationShutdown;
		iTimer->After(KShutdownTimeout);
	}
	else {
		iEngineObserver->LocationShutdownComplete();
	}
}
Пример #8
0
//--------------------------------
int main(int argc, char* argv[])
{
    UNUSED(argc);
    UNUSED(argv);

#ifdef TUNE_PARAMETERS
    for(int i = 0; i < NPARAMS; ++i)
        param.push_back(1);
#endif
    InitEngine();
    tt.clear();

    max_search_depth      = max_ply;
    time_remains     = 300000000;
    time_base        = 300000000;
    time_inc         = 0;
    moves_per_session = 0;
    max_nodes_to_search    = 0;
    time_command_sent = false;

    char in[0x4000];
    while(!quit)
   {
        if(!std::cin.getline(in, sizeof(in), '\n'))
            std::cin.clear();

        if(CmdProcess((std::string)in))
        {
            // NiCheGoNeDeLaYem!
        }
        else if(!busy && LooksLikeMove((std::string)in))
        {
            if(!MakeMoveFinaly(in))
                std::cout << "Illegal move" << std::endl;
            else if(!force)
            {
#ifdef USE_THREAD_FOR_INPUT
                if(t.joinable())
                    t.join();
                t = std::thread(MainSearch);
#else
                MainSearch();
#endif // USE_THREAD_FOR_INPUT
            }
        }
        else
            std::cout << "Unknown command: " << in << std::endl;
    }
    if(busy)
        StopEngine();
}
Пример #9
0
HRESULT CEngine::AddToLog(const char *pcTxt, bool bError)
{
    if (_LogFile.is_open())
    {
        double Time = glfwGetTime();
        
        _LogFile << "Time passed:" << Time << " : ";
        if (bError)
            _LogFile << "ERROR : ";
        _LogFile << pcTxt << endl;
    
        if (bError)
            StopEngine();
    }
    return H_OK;
}
Пример #10
0
bool CCar::bfAssignMovement(CScriptEntityAction *tpEntityAction)
{
	if (tpEntityAction->m_tMovementAction.m_bCompleted)
		return(false);

	u32		l_tInput = tpEntityAction->m_tMovementAction.m_tInputKeys;

	vfProcessInputKey(kFWD		,	!!(l_tInput & CScriptMovementAction::eInputKeyForward		));
	vfProcessInputKey(kBACK		,	!!(l_tInput & CScriptMovementAction::eInputKeyBack		));
	vfProcessInputKey(kL_STRAFE	,	!!(l_tInput & CScriptMovementAction::eInputKeyLeft		));
	vfProcessInputKey(kR_STRAFE	,	!!(l_tInput & CScriptMovementAction::eInputKeyRight		));
	vfProcessInputKey(kACCEL	,	!!(l_tInput & CScriptMovementAction::eInputKeyShiftUp		));
	vfProcessInputKey(kCROUCH	,	!!(l_tInput & CScriptMovementAction::eInputKeyShiftDown	));
	vfProcessInputKey(kJUMP		,	!!(l_tInput & CScriptMovementAction::eInputKeyBreaks		));
	if (!!(l_tInput & CScriptMovementAction::eInputKeyEngineOn))	StartEngine();
	if (!!(l_tInput & CScriptMovementAction::eInputKeyEngineOff)) StopEngine();

	//if (_abs(tpEntityAction->m_tMovementAction.m_fSpeed) > EPS_L)
		//m_current_rpm = _abs(tpEntityAction->m_tMovementAction.m_fSpeed*m_current_gear_ratio);

	return	(true);
}
Пример #11
0
//--------------------------------
void NewCommand(std::string in)
{
    UNUSED(in);
    if(busy)
        StopEngine();
    force = false;
    pondering_in_process = false;
    if(!xboard && !uci)
    {
        if(total_time_spent == 0)
            total_time_spent = 1e-5;
        std::cout
                << "( Total node count: " << total_nodes
                << ", total time spent: " << total_time_spent / 1000000.0
                << " )" << std::endl
                << std::setprecision(4) << std::fixed
                << "( MNPS = " << total_nodes / total_time_spent
                << " )" << std::endl;
    }
    InitEngine();
    tt.clear();
}
Пример #12
0
//-----------------------------------------------------------------------------
// Purpose: 
//-----------------------------------------------------------------------------
void CPropVehicleDriveable::ExitVehicle( int iRole )
{
	CBasePlayer *pPlayer = m_hPlayer;
	if ( !pPlayer )
		return;

	m_hPlayer = NULL;
	ResetUseKey( pPlayer );
	pPlayer->SetViewOffset( m_savedViewOffset );

	m_playerOff.FireOutput( pPlayer, this, 0 );

	// clear out the fire buttons
	m_attackaxis.Set( 0, pPlayer, this );
	m_attack2axis.Set( 0, pPlayer, this );

	m_nSpeed = 0;
	m_flThrottle = 0.0f;

	StopEngine();

	m_VehiclePhysics.GetVehicle()->OnVehicleExit();
}
Пример #13
0
// Start or restart the MHEG engine.
void MHIContext::Restart(int chanid, int sourceid, bool isLive)
{
    int tuneinfo = m_tuneinfo.isEmpty() ? 0 : m_tuneinfo.takeFirst();

    LOG(VB_MHEG, LOG_INFO,
        QString("[mhi] Restart ch=%1 source=%2 live=%3 tuneinfo=0x%4")
        .arg(chanid).arg(sourceid).arg(isLive).arg(tuneinfo,0,16));

    m_currentSource = sourceid;
    m_currentStream = chanid ? chanid : -1;
    if (!(tuneinfo & kTuneKeepChnl))
        m_currentChannel = m_currentStream;

    if (tuneinfo & kTuneKeepApp)
    {
        // We have tuned to the channel in order to find the streams.
        // Leave the MHEG engine running but restart the DSMCC carousel.
        // This is a bit of a mess but it's the only way to be able to
        // select streams from a different channel.
        if (!m_dsmcc)
            m_dsmcc = new Dsmcc();
        {
            QMutexLocker locker(&m_dsmccLock);
            if (tuneinfo & kTuneCarReset)
                m_dsmcc->Reset();
            ClearQueue();
        }

        if (tuneinfo & (kTuneCarReset|kTuneCarId))
            m_engine->EngineEvent(10); // NonDestructiveTuneOK
    }
    else
    {
        StopEngine();

        m_audioTag = -1;
        m_videoTag = -1;

        if (!m_dsmcc)
            m_dsmcc = new Dsmcc();

        {
            QMutexLocker locker(&m_dsmccLock);
            m_dsmcc->Reset();
            ClearQueue();
        }

        {
            QMutexLocker locker(&m_keyLock);
            m_keyQueue.clear();
        }

        if (!m_engine)
            m_engine = MHCreateEngine(this);

        m_engine->SetBooting();
        ClearDisplay();
        m_updated = true;
        m_stop = false;
        m_isLive = isLive;
        // Don't set the NBI version here.  Restart is called
        // after the PMT is processed.
        m_engineThread = new MThread("MHEG", this);
        m_engineThread->start();
    }
}
Пример #14
0
	/**
	*	Launch the app
	*/
	void System::Run()
	{		
		try
		{
			Log("==============================================================");
			Log("=========================Launching  !=========================");
			Log("==============================================================");

			//Initialize everything, at each step we check running to be sure the previous step go init correctly
			if(InitEngine())
			{
				Log("Window opened, Width: "+ToString(_width)+"px, Height: "+ToString(_height)+"px");

				if (!_renderer.Init(_width, _height,this))
				{
					_error = true;
					Log("Renderer Init Error");
				}

				LoadUis();

				_renderer.SetMenu(_menu);

				_currentInput.SetWindowSize(vec2(_width, _height));
				_currentUiDescriptor = _uis[_startupUiName];
				_currentUi = _currentUiDescriptor->GetUi();
				_currentUi->SetUiFunction(this);
				_renderer.SetupUi(_currentUi);


				
				//Reset the clock for delta time calculation
				Clock::GetRef().GetElapsedTime();
				try
				{
					while(_running && !_error)
					{
						_running = !_currentInput.Update();

						if (_uiChangeRequested)
							ChangeUi();

						UiElement::ResetMouseInterception();

						float delta = Clock::GetRef().GetElapsedTime();

						if(_currentUiDescriptor->DisplayMenu())
							_menu->Update(delta,&_currentInput, &_lastInput);

						_currentUi->Update(delta,&_currentInput,&_lastInput);

						_renderer.DrawFrame(delta,_displayMenu && _currentUiDescriptor->DisplayMenu());

						SDL_GL_SwapWindow(_mainwindowPtr);

						_lastInput = _currentInput;
					}
				}
				catch(Exception e)
				{
					ReportError(e.what());
				}

				_renderer.Unload();
				StopEngine();
			}
		}
		catch(Exception e)
		{
			ReportError(e.what());
			StopEngine();
		}
	}
Пример #15
0
void CCar::SwitchEngine()
{
	if(b_engine_on) StopEngine();
	else			StartEngine();
}
Пример #16
0
//--------------------------------
void ResultCommand(std::string in)
{
    UNUSED(in);
    if(busy)
        StopEngine();
}