Move Script ownership to script holder, added OnRemove script hook.
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2020-02-05 14:52:50 +01:00
parent cd7ddcf78e
commit e45a36d78e
9 changed files with 19 additions and 22 deletions

View File

@@ -63,9 +63,6 @@ TEST_CASE("Script Aggregator properly iterates Script Set.", "[Battling, Scripti
dynamic_cast<TestScript*>(next)->TestMethod(ran);
}
CHECK(ran == 3);
delete script;
delete script2;
delete script3;
}
TEST_CASE("Script Aggregator properly iterates data of Script Set and Script.", "[Battling, Scripting]") {
@@ -85,8 +82,6 @@ TEST_CASE("Script Aggregator properly iterates data of Script Set and Script.",
}
CHECK(ran == 3);
delete script;
delete script2;
delete script3;
}
TEST_CASE("Script Aggregator properly iterates data of Script and Script Set.", "[Battling, Scripting]") {
@@ -106,8 +101,6 @@ TEST_CASE("Script Aggregator properly iterates data of Script and Script Set.",
}
CHECK(ran == 3);
delete script;
delete script2;
delete script3;
}
TEST_CASE("Script Aggregator properly iterates data of Script, Script Set and Script.", "[Battling, Scripting]") {
@@ -128,8 +121,6 @@ TEST_CASE("Script Aggregator properly iterates data of Script, Script Set and Sc
}
CHECK(ran == 4);
delete script;
delete script2;
delete script3;
delete script4;
}

View File

@@ -17,7 +17,6 @@ TEST_CASE("Add script to script set", "[Battling, Scripting]") {
auto s = new Script("foobar");
set.Add(s);
REQUIRE(set.Count() == 1);
delete s;
}
TEST_CASE("Add script to script set, then retrieve it", "[Battling, Scripting]") {
@@ -27,7 +26,6 @@ TEST_CASE("Add script to script set, then retrieve it", "[Battling, Scripting]")
REQUIRE(set.Count() == 1);
auto get = set.GetIterator()->at(0);
REQUIRE(get->GetName() == "foobar");
delete s;
}
TEST_CASE("Add two scripts to script set", "[Battling, Scripting]") {
@@ -37,8 +35,6 @@ TEST_CASE("Add two scripts to script set", "[Battling, Scripting]") {
set.Add(s);
set.Add(s2);
REQUIRE(set.Count() == 2);
delete s;
delete s2;
}
TEST_CASE("Add two scripts to script set, then retrieve them", "[Battling, Scripting]") {
@@ -52,8 +48,6 @@ TEST_CASE("Add two scripts to script set, then retrieve them", "[Battling, Scrip
auto get2 = set.GetIterator()->at(1);
REQUIRE(get1->GetName() == "foobar");
REQUIRE(get2->GetName() == "foobar2");
delete s;
delete s2;
}
TEST_CASE("Add script to script set, then remove it", "[Battling, Scripting]") {
@@ -65,7 +59,6 @@ TEST_CASE("Add script to script set, then remove it", "[Battling, Scripting]") {
REQUIRE(set.Count() == 0);
auto it = set.GetIterator();
REQUIRE(it->empty());
delete s;
}
TEST_CASE("Add two scripts to script set, then remove them", "[Battling, Scripting]") {
@@ -79,8 +72,6 @@ TEST_CASE("Add two scripts to script set, then remove them", "[Battling, Scripti
REQUIRE(set.Count() == 1);
auto it = set.GetIterator();
REQUIRE(it->at(0)->GetName() == "foobar2");
delete s;
delete s2;
}
#endif

View File

@@ -74,7 +74,6 @@ TEST_CASE("Script source with single item script set.", "[Battling, Scripting]")
auto first = scripts.GetNext();
CHECK(first != nullptr);
CHECK(first->GetName() == "foobar");
delete s;
}
TEST_CASE("Script source with multiple item script set.", "[Battling, Scripting]") {
@@ -90,8 +89,6 @@ TEST_CASE("Script source with multiple item script set.", "[Battling, Scripting]
auto second = scripts.GetNext();
CHECK(second != nullptr);
CHECK(second->GetName() == "foobar2");
delete s;
delete s2;
}
#endif