mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
Don't use std::shared_ptr in ScriptInterface
Differential Revision: https://code.wildfiregames.com/D5159 This was SVN commit r27945.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2020 Wildfire Games.
|
||||
/* Copyright (C) 2023 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
|
||||
void test_basic()
|
||||
{
|
||||
ComponentTestHelper test(g_ScriptContext);
|
||||
ComponentTestHelper test(*g_ScriptContext);
|
||||
|
||||
ICmpCinemaManager* cmp = test.Add<ICmpCinemaManager>(CID_CinemaManager, "", SYSTEM_ENTITY);
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2020 Wildfire Games.
|
||||
/* Copyright (C) 2023 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
|
||||
void test_basic()
|
||||
{
|
||||
ComponentTestHelper test(g_ScriptContext);
|
||||
ComponentTestHelper test(*g_ScriptContext);
|
||||
ScriptRequest rq(test.GetScriptInterface());
|
||||
|
||||
std::vector<SimulationCommand> empty;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
/* Copyright (C) 2023 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -103,7 +103,7 @@ public:
|
||||
ent3z = ent2z + ent2c + ent3c; // ensure it just touches the border of ent2
|
||||
ent3g = ent3;
|
||||
|
||||
testHelper = new ComponentTestHelper(g_ScriptContext);
|
||||
testHelper = new ComponentTestHelper(*g_ScriptContext);
|
||||
cmp = testHelper->Add<ICmpObstructionManager>(CID_ObstructionManager, "", SYSTEM_ENTITY);
|
||||
cmp->SetBounds(fixed::FromInt(0), fixed::FromInt(0), fixed::FromInt(1000), fixed::FromInt(1000));
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
/* Copyright (C) 2023 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -145,7 +145,7 @@ public:
|
||||
|
||||
LDR_BeginRegistering();
|
||||
mapReader->LoadMap(L"maps/skirmishes/Median Oasis (2).pmp",
|
||||
*sim2.GetScriptInterface().GetContext(), JS::UndefinedHandleValue,
|
||||
sim2.GetScriptInterface().GetContext(), JS::UndefinedHandleValue,
|
||||
&terrain, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
&sim2, &sim2.GetSimContext(), -1, false);
|
||||
LDR_EndRegistering();
|
||||
@@ -259,7 +259,7 @@ public:
|
||||
|
||||
LDR_BeginRegistering();
|
||||
mapReader->LoadMap(L"maps/scenarios/Peloponnese.pmp",
|
||||
*sim2.GetScriptInterface().GetContext(), JS::UndefinedHandleValue,
|
||||
sim2.GetScriptInterface().GetContext(), JS::UndefinedHandleValue,
|
||||
&terrain, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
&sim2, &sim2.GetSimContext(), -1, false);
|
||||
LDR_EndRegistering();
|
||||
@@ -316,7 +316,7 @@ public:
|
||||
|
||||
LDR_BeginRegistering();
|
||||
mapReader->LoadMap(L"maps/scenarios/Peloponnese.pmp",
|
||||
*sim2.GetScriptInterface().GetContext(), JS::UndefinedHandleValue,
|
||||
sim2.GetScriptInterface().GetContext(), JS::UndefinedHandleValue,
|
||||
&terrain, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
&sim2, &sim2.GetSimContext(), -1, false);
|
||||
LDR_EndRegistering();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
/* Copyright (C) 2023 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -65,7 +65,7 @@ public:
|
||||
|
||||
void test_basic()
|
||||
{
|
||||
ComponentTestHelper test(g_ScriptContext);
|
||||
ComponentTestHelper test(*g_ScriptContext);
|
||||
|
||||
MockTerrain terrain;
|
||||
test.AddMock(SYSTEM_ENTITY, IID_Terrain, terrain);
|
||||
@@ -137,7 +137,7 @@ public:
|
||||
|
||||
void test_water()
|
||||
{
|
||||
ComponentTestHelper test(g_ScriptContext);
|
||||
ComponentTestHelper test(*g_ScriptContext);
|
||||
|
||||
MockTerrain terrain;
|
||||
test.AddMock(SYSTEM_ENTITY, IID_Terrain, terrain);
|
||||
@@ -210,7 +210,7 @@ public:
|
||||
|
||||
void test_serialize()
|
||||
{
|
||||
ComponentTestHelper test(g_ScriptContext);
|
||||
ComponentTestHelper test(*g_ScriptContext);
|
||||
|
||||
MockTerrain terrain;
|
||||
test.AddMock(SYSTEM_ENTITY, IID_Terrain, terrain);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2022 Wildfire Games.
|
||||
/* Copyright (C) 2023 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -130,7 +130,7 @@ public:
|
||||
|
||||
void test_basic()
|
||||
{
|
||||
ComponentTestHelper test(g_ScriptContext);
|
||||
ComponentTestHelper test(*g_ScriptContext);
|
||||
|
||||
ICmpRangeManager* cmp = test.Add<ICmpRangeManager>(CID_RangeManager, "", SYSTEM_ENTITY);
|
||||
|
||||
@@ -199,7 +199,7 @@ public:
|
||||
|
||||
void test_queries()
|
||||
{
|
||||
ComponentTestHelper test(g_ScriptContext);
|
||||
ComponentTestHelper test(*g_ScriptContext);
|
||||
|
||||
ICmpRangeManager* cmp = test.Add<ICmpRangeManager>(CID_RangeManager, "", SYSTEM_ENTITY);
|
||||
|
||||
@@ -271,7 +271,7 @@ public:
|
||||
|
||||
void test_IsInTargetParabolicRange()
|
||||
{
|
||||
ComponentTestHelper test(g_ScriptContext);
|
||||
ComponentTestHelper test(*g_ScriptContext);
|
||||
ICmpRangeManager* cmp = test.Add<ICmpRangeManager>(CID_RangeManager, "", SYSTEM_ENTITY);
|
||||
const entity_id_t source = 200;
|
||||
const entity_id_t target = 201;
|
||||
|
||||
@@ -160,7 +160,7 @@ public:
|
||||
// Regression test for D5181 / fix for rP27673 issue
|
||||
void test_calculate_territories_uninitialised()
|
||||
{
|
||||
ComponentTestHelper test(g_ScriptContext);
|
||||
ComponentTestHelper test(*g_ScriptContext);
|
||||
ICmpTerritoryManager* cmp = test.Add<ICmpTerritoryManager>(CID_TerritoryManager, "", SYSTEM_ENTITY);
|
||||
|
||||
MockPathfinderTerrMan pathfinder;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 2021 Wildfire Games.
|
||||
/* Copyright (C) 2023 Wildfire Games.
|
||||
* This file is part of 0 A.D.
|
||||
*
|
||||
* 0 A.D. is free software: you can redistribute it and/or modify
|
||||
@@ -90,7 +90,7 @@ public:
|
||||
for (const VfsPath& path : paths)
|
||||
{
|
||||
CSimContext context;
|
||||
CComponentManager componentManager(context, g_ScriptContext, true);
|
||||
CComponentManager componentManager(context, *g_ScriptContext, true);
|
||||
ScriptTestSetup(componentManager.GetScriptInterface());
|
||||
|
||||
ScriptRequest rq(componentManager.GetScriptInterface());
|
||||
@@ -117,7 +117,7 @@ public:
|
||||
// Clean up previous scripts.
|
||||
g_ScriptContext->ShrinkingGC();
|
||||
CSimContext context;
|
||||
CComponentManager componentManager(context, g_ScriptContext, true);
|
||||
CComponentManager componentManager(context, *g_ScriptContext, true);
|
||||
|
||||
ScriptTestSetup(componentManager.GetScriptInterface());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user