Move scripting update to updateGraphics

This commit is contained in:
Benau 2018-07-11 11:08:53 +08:00
parent 3b2acf01eb
commit b537df54fc
3 changed files with 7 additions and 11 deletions

View File

@ -994,6 +994,11 @@ void World::updateGraphics(float dt)
Camera::getCamera(i)->update(dt);
PROFILER_POP_CPU_MARKER();
Scripting::ScriptEngine *script_engine =
Scripting::ScriptEngine::getInstance();
if (script_engine)
script_engine->update(dt);
projectile_manager->updateGraphics(dt);
Track::getCurrentTrack()->updateGraphics(dt);
} // updateGraphics
@ -1044,14 +1049,6 @@ void World::update(int ticks)
PROFILER_POP_CPU_MARKER();
if(race_manager->isRecordingRace()) ReplayRecorder::get()->update(ticks);
if (!RewindManager::get()->isRewinding())
{
Scripting::ScriptEngine *script_engine =
Scripting::ScriptEngine::getInstance();
if (script_engine)
script_engine->update(ticks);
}
Physics::getInstance()->update(ticks);
PROFILER_PUSH_CPU_MARKER("World::update (projectiles)", 0xa0, 0x7F, 0x00);

View File

@ -563,9 +563,8 @@ namespace Scripting
//-----------------------------------------------------------------------------
void ScriptEngine::update(int ticks)
void ScriptEngine::update(float dt)
{
double dt = stk_config->ticks2Time(ticks);
for (int i = m_pending_timeouts.size() - 1; i >= 0; i--)
{
PendingTimeout& curr = m_pending_timeouts[i];

View File

@ -82,7 +82,7 @@ namespace Scripting
void addPendingTimeout(double time, const std::string& callback_name);
void addPendingTimeout(double time, asIScriptFunction* delegate_fn);
void update(int ticks);
void update(float dt);
asIScriptEngine* getEngine() { return m_engine; }