Skip to content

Commit a25e635

Browse files
committed
Remove CAI_Space::script_engine() method
1 parent 9e56983 commit a25e635

File tree

69 files changed

+546
-554
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+546
-554
lines changed

src/xrGame/ActorCondition.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ void CActorCondition::UpdateTutorialThresholds()
738738
if (!b)
739739
{
740740
luabind::functor<void> fl;
741-
R_ASSERT(ai().script_engine().functor<void>(cb_name, fl));
741+
R_ASSERT(GEnv.ScriptEngine->functor<void>(cb_name, fl));
742742
fl();
743743
}
744744
}

src/xrGame/ActorEffector_script.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ BOOL CAnimatorCamEffectorScriptCB::Valid()
2323
if (!res && cb_name.size())
2424
{
2525
luabind::functor<void> fl;
26-
R_ASSERT(ai().script_engine().functor<void>(*cb_name, fl));
26+
R_ASSERT(GEnv.ScriptEngine->functor<void>(*cb_name, fl));
2727
fl();
2828
cb_name = "";
2929
}

src/xrGame/GameObject.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ BOOL CGameObject::net_Spawn(CSE_Abstract* DC)
457457
//R_ASSERT(Level().Objects.net_Find(E->ID) == nullptr);
458458
if (Level().Objects.net_Find(E->ID) != nullptr)
459459
{
460-
ai().script_engine().script_log(LuaMessageType::Error, "CGameObject:net_Spawn() | Level().Objects.net_Find(E->ID) != nullptr (This mean object already exist on level by this ID) ID=%s s_name=%s", E->ID, E->s_name);
460+
GEnv.ScriptEngine->script_log(LuaMessageType::Error, "CGameObject:net_Spawn() | Level().Objects.net_Find(E->ID) != nullptr (This mean object already exist on level by this ID) ID=%s s_name=%s", E->ID, E->s_name);
461461
return false;
462462
}
463463
}

src/xrGame/GamePersistent.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -813,12 +813,12 @@ void CGamePersistent::LoadTitle(bool change_tip, shared_str map_name)
813813
bool is_single = !xr_strcmp(m_game_params.m_game_type, "single");
814814
if (is_single)
815815
{
816-
R_ASSERT(ai().script_engine().functor("loadscreen.get_tip_number", m_functor));
816+
R_ASSERT(GEnv.ScriptEngine->functor("loadscreen.get_tip_number", m_functor));
817817
tip_num = m_functor(map_name.c_str());
818818
}
819819
else
820820
{
821-
R_ASSERT(ai().script_engine().functor("loadscreen.get_mp_tip_number", m_functor));
821+
R_ASSERT(GEnv.ScriptEngine->functor("loadscreen.get_mp_tip_number", m_functor));
822822
tip_num = m_functor(map_name.c_str());
823823
}
824824
// tip_num = 83;

src/xrGame/GameTask.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ void SScriptTaskHelper::init_functors(xr_vector<shared_str>& v_src, task_state_f
267267

268268
for (u32 idx = 0; it != it_e; ++it, ++idx)
269269
{
270-
bool functor_exists = ai().script_engine().functor(*(*it), v_dest[idx]);
270+
bool functor_exists = GEnv.ScriptEngine->functor(*(*it), v_dest[idx]);
271271
if (!functor_exists)
272272
Log("Cannot find script function described in task objective ", *(*it));
273273
}

src/xrGame/Inventory.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1203,7 +1203,7 @@ CInventoryItem* CInventory::tpfGetObjectByIndex(int iIndex)
12031203
}
12041204
else
12051205
{
1206-
ai().script_engine().script_log(LuaMessageType::Error, "invalid inventory index!");
1206+
GEnv.ScriptEngine->script_log(LuaMessageType::Error, "invalid inventory index!");
12071207
return (0);
12081208
}
12091209
R_ASSERT(false);

src/xrGame/Level.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ CLevel::~CLevel()
150150
xr_delete(m_debug_renderer);
151151
#endif
152152
if (!GEnv.isDedicatedServer)
153-
ai().script_engine().remove_script_process(ScriptProcessor::Level);
153+
GEnv.ScriptEngine->remove_script_process(ScriptProcessor::Level);
154154
xr_delete(game);
155155
xr_delete(game_events);
156156
xr_delete(m_pBulletManager);
@@ -555,7 +555,7 @@ void CLevel::OnFrame()
555555
#endif
556556
g_pGamePersistent->Environment().SetGameTime(GetEnvironmentGameDayTimeSec(), game->GetEnvironmentGameTimeFactor());
557557
if (!GEnv.isDedicatedServer)
558-
ai().script_engine().script_process(ScriptProcessor::Level)->update();
558+
GEnv.ScriptEngine->script_process(ScriptProcessor::Level)->update();
559559
m_ph_commander->update();
560560
m_ph_commander_scripts->update();
561561
stats.BulletManagerCommit.Begin();
@@ -590,7 +590,7 @@ void CLevel::OnFrame()
590590
}
591591

592592
int psLUA_GCSTEP = 10;
593-
void CLevel::script_gc() { lua_gc(ai().script_engine().lua(), LUA_GCSTEP, psLUA_GCSTEP); }
593+
void CLevel::script_gc() { lua_gc(GEnv.ScriptEngine->lua(), LUA_GCSTEP, psLUA_GCSTEP); }
594594
#ifdef DEBUG_PRECISE_PATH
595595
void test_precise_path();
596596
#endif

src/xrGame/Level_input.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ void CLevel::IR_OnKeyboardPress(int key)
461461
// m_bSynchronization = false;
462462
// }
463463
// luabind::functor<void> functor;
464-
// ai().script_engine().functor("alife_test.set_switch_online",functor);
464+
// GEnv.ScriptEngine->functor("alife_test.set_switch_online",functor);
465465
// functor(0,false);
466466
// }
467467
// return;

src/xrGame/Level_load.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ bool CLevel::Load_GameSpecific_After()
141141
if (!GEnv.isDedicatedServer)
142142
{
143143
// loading scripts
144-
auto& scriptEngine = ai().script_engine();
144+
auto& scriptEngine = *GEnv.ScriptEngine;
145145
scriptEngine.remove_script_process(ScriptProcessor::Level);
146146
shared_str scripts;
147147
if (pLevel->section_exist("level_scripts") && pLevel->line_exist("level_scripts", "script"))

src/xrGame/Level_network.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ void CLevel::remove_objects()
8282
g_b_ClearGameCaptions = true;
8383

8484
if (!GEnv.isDedicatedServer)
85-
ai().script_engine().collect_all_garbage();
85+
GEnv.ScriptEngine->collect_all_garbage();
8686

8787
stalker_animation_data_storage().clear();
8888

@@ -163,7 +163,7 @@ void CLevel::net_Stop()
163163
}
164164

165165
if (!GEnv.isDedicatedServer)
166-
ai().script_engine().collect_all_garbage();
166+
GEnv.ScriptEngine->collect_all_garbage();
167167

168168
#ifdef DEBUG
169169
show_animation_stats();

0 commit comments

Comments
 (0)