void CSquirrel::CompilerErrorFunction(SQVM * pVM, const char * szError, const char * szSource, int iLine, int iColumn) { // Find the script CSquirrel * pScript = g_pScriptingManager->Get(pVM); if(pScript) { // Call the 'scriptError' event CSquirrelArguments arguments; arguments.push(szError); arguments.push(szSource); arguments.push(iLine); arguments.push(iColumn); if(g_pEvents->Call("compilerError", &arguments, pScript).GetInteger() == 1) CLogFile::Printf("Error: Failed to compile script %s on Line %d Column %d (%s).", pScript->GetName().Get(), iLine, iColumn, szError); } }
_MEMBER_FUNCTION_IMPL( Timer, Delete ) { StackHandler sa(v); _CHECK_SELF( CSquirrelTimers, Timer ); CSquirrelTimers* pTimer = CSquirrelTimerManager::Find( self->GetID() ); CSquirrel* pSquirrel = CSquirrelManager::Find( v ); if ( pSquirrel ) { if ( pSquirrel->GetObjects() ) pSquirrel->GetObjects()->RemoveTimer( pTimer ); sa.Return( true ); return 1; } sa.Return( false ); return 1; }
void CSquirrel::CompilerErrorFunction(SQVM * pVM, const char * szError, const char * szSource, int iLine, int iColumn) { // Find the script CSquirrel * pScript = CScriptingManager::GetInstance()->Get(pVM); if(pScript) { // Call the 'compilerError' event CSquirrelArguments arguments; arguments.push(szError); arguments.push(szSource); arguments.push(iLine); arguments.push(iColumn); if(CEvents::GetInstance()->Call("compilerError", &arguments, pScript).GetInteger() == 1) CLogFile::Printf("Error: Failed to compile script %s (Error: %s (Line %d, Column %d)).", pScript->GetName().Get(), szError, iLine, iColumn); } }
void CMole::Update(float _fTimeDelta, CSquirrel& _rSquirrel) { // Check interection with squirrel CCircle Bounds; Bounds.Initialise( m_vPosition, m_fRadius ); if (_rSquirrel.Intersects(Bounds)) { _rSquirrel.LoseLife(); } if (!m_Tasks.empty()) { ProcessStuckManager(_fTimeDelta); CTask& rCurrentTask = m_Tasks.top(); // Check if mole is not patrolling if (!m_bHasPatrolTask && rCurrentTask.GetType() != CTask::TYPE_PATROL || rCurrentTask.GetType() != CTask::TYPE_SNOOZE) { // Try and bags an acorn to patrol, if any BagsAcorn(); } switch (rCurrentTask.GetType()) { case CTask::TYPE_EXPLORE: ProcessExplore(_fTimeDelta, rCurrentTask); break; case CTask::TYPE_PATROL: ProcessPatrol(_fTimeDelta, rCurrentTask); break; case CTask::TYPE_SNOOZE: ProcessSnooze(_fTimeDelta, rCurrentTask); break; case CTask::TYPE_HUNT: ProcessHunt(_fTimeDelta, rCurrentTask); break; case CTask::TYPE_STUCK: ProcessStuck(_fTimeDelta, rCurrentTask); break; } } else { assert_now("Mole has no assignments"); } s_pSharedPath->NotifyAccessablePosition(m_vPosition, m_fRadius); UpdateWhiskers(); m_Repulsor.Initialise(m_vPosition, fMOLE_RADIUS, 40.0f); }