mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-05-25 00:02:24 +00:00
More robust tests
This commit is contained in:
parent
1c23f3c030
commit
2a2799793d
@ -175,8 +175,11 @@ void Entity::ApplyComponentWhitelist(std::vector<eReplicaComponentType>& compone
|
|||||||
if (whitelistIndex < 0 || whitelistIndex >= m_ComponentWhitelists.size()) return;
|
if (whitelistIndex < 0 || whitelistIndex >= m_ComponentWhitelists.size()) return;
|
||||||
|
|
||||||
for (const auto& componentToKeep : m_ComponentWhitelists.at(whitelistIndex)) {
|
for (const auto& componentToKeep : m_ComponentWhitelists.at(whitelistIndex)) {
|
||||||
|
while (true) {
|
||||||
const auto componentIter = std::find(components.begin(), components.end(), componentToKeep);
|
const auto componentIter = std::find(components.begin(), components.end(), componentToKeep);
|
||||||
if (componentIter != components.end()) components.erase(componentIter);
|
if (componentIter == components.end()) break;
|
||||||
|
components.erase(componentIter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,12 +34,26 @@ protected:
|
|||||||
TEST_F(EntityTests, WhitelistTest) {
|
TEST_F(EntityTests, WhitelistTest) {
|
||||||
const auto whitelists = Entity::GetComponentWhitelists();
|
const auto whitelists = Entity::GetComponentWhitelists();
|
||||||
std::vector<eReplicaComponentType> whitelist = {
|
std::vector<eReplicaComponentType> whitelist = {
|
||||||
eReplicaComponentType::RACING_STATS,
|
|
||||||
eReplicaComponentType::SIMPLE_PHYSICS,
|
|
||||||
eReplicaComponentType::CONTROLLABLE_PHYSICS,
|
eReplicaComponentType::CONTROLLABLE_PHYSICS,
|
||||||
|
eReplicaComponentType::SIMPLE_PHYSICS,
|
||||||
|
eReplicaComponentType::MODEL_BEHAVIOR,
|
||||||
|
eReplicaComponentType::SPAWN,
|
||||||
eReplicaComponentType::RENDER,
|
eReplicaComponentType::RENDER,
|
||||||
|
eReplicaComponentType::ITEM,
|
||||||
|
eReplicaComponentType::BLUEPRINT,
|
||||||
|
eReplicaComponentType::PET,
|
||||||
|
eReplicaComponentType::SKILL,
|
||||||
|
eReplicaComponentType::DESTROYABLE,
|
||||||
|
eReplicaComponentType::CONTROLLABLE_PHYSICS,
|
||||||
|
eReplicaComponentType::SIMPLE_PHYSICS,
|
||||||
|
eReplicaComponentType::MODEL_BEHAVIOR,
|
||||||
|
eReplicaComponentType::SPAWN,
|
||||||
|
eReplicaComponentType::RENDER,
|
||||||
|
eReplicaComponentType::ITEM,
|
||||||
|
eReplicaComponentType::BLUEPRINT,
|
||||||
|
eReplicaComponentType::PET,
|
||||||
|
eReplicaComponentType::SKILL,
|
||||||
eReplicaComponentType::DESTROYABLE,
|
eReplicaComponentType::DESTROYABLE,
|
||||||
eReplicaComponentType::RACING_CONTROL
|
|
||||||
};
|
};
|
||||||
RunWhitelistTest(0, whitelist);
|
RunWhitelistTest(0, whitelist);
|
||||||
RunWhitelistTest(1, whitelist);
|
RunWhitelistTest(1, whitelist);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user