mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-16 04:18:08 +00:00
Merge main into property-entrance-rewrite
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
#include "Amf3.h"
|
||||
|
||||
#include "Game.h"
|
||||
#include "dLogger.h"
|
||||
#include "Logger.h"
|
||||
|
||||
/**
|
||||
* Helper method that all tests use to get their respective AMF.
|
||||
|
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "Game.h"
|
||||
#include "dCommonDependencies.h"
|
||||
#include "dLogger.h"
|
||||
#include "Logger.h"
|
||||
|
||||
class LDFTests : public dCommonDependenciesTest {
|
||||
protected:
|
||||
@@ -237,7 +237,7 @@ TEST_F(LDFTests, LDFParseEdgeCaseTest) {
|
||||
"key=Garbage:value", // invalid LDF type
|
||||
};
|
||||
for (auto testString : tests) {
|
||||
Game::logger->Log("LDFTests", "Testing LDF Parsing of invalid string (%s)", testString.c_str());
|
||||
LOG("Testing LDF Parsing of invalid string (%s)", testString.c_str());
|
||||
EXPECT_NO_THROW(LDFBaseData::DataFromString(testString));
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#include "Game.h"
|
||||
|
||||
class dLogger;
|
||||
class Logger;
|
||||
namespace Game
|
||||
{
|
||||
dLogger* logger;
|
||||
Logger* logger;
|
||||
} // namespace Game
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define __DCOMMONDEPENDENCIES__H__
|
||||
|
||||
#include "Game.h"
|
||||
#include "dLogger.h"
|
||||
#include "Logger.h"
|
||||
#include "dServer.h"
|
||||
#include "EntityInfo.h"
|
||||
#include "EntityManager.h"
|
||||
@@ -12,7 +12,7 @@
|
||||
class dCommonDependenciesTest : public ::testing::Test {
|
||||
protected:
|
||||
void SetUpDependencies() {
|
||||
Game::logger = new dLogger("./testing.log", true, true);
|
||||
Game::logger = new Logger("./testing.log", true, true);
|
||||
}
|
||||
|
||||
void TearDownDependencies() {
|
||||
|
@@ -1,7 +1,7 @@
|
||||
#include "GameDependencies.h"
|
||||
|
||||
namespace Game {
|
||||
dLogger* logger = nullptr;
|
||||
Logger* logger = nullptr;
|
||||
dServer* server = nullptr;
|
||||
dZoneManager* zoneManager = nullptr;
|
||||
dChatFilter* chatFilter = nullptr;
|
||||
|
@@ -2,7 +2,7 @@
|
||||
#define __GAMEDEPENDENCIES__H__
|
||||
|
||||
#include "Game.h"
|
||||
#include "dLogger.h"
|
||||
#include "Logger.h"
|
||||
#include "dServer.h"
|
||||
#include "EntityInfo.h"
|
||||
#include "EntityManager.h"
|
||||
@@ -29,7 +29,7 @@ protected:
|
||||
info.scale = 1.0f;
|
||||
info.spawner = nullptr;
|
||||
info.lot = 999;
|
||||
Game::logger = new dLogger("./testing.log", true, true);
|
||||
Game::logger = new Logger("./testing.log", true, true);
|
||||
Game::server = new dServerMock();
|
||||
Game::config = new dConfig("worldconfig.ini");
|
||||
Game::entityManager = new EntityManager();
|
||||
|
@@ -16,8 +16,7 @@ protected:
|
||||
void SetUp() override {
|
||||
SetUpDependencies();
|
||||
baseEntity = new Entity(15, GameDependenciesTest::info);
|
||||
destroyableComponent = new DestroyableComponent(baseEntity);
|
||||
baseEntity->AddComponent(eReplicaComponentType::DESTROYABLE, destroyableComponent);
|
||||
destroyableComponent = baseEntity->AddComponent<DestroyableComponent>();
|
||||
// Initialize some values to be not default
|
||||
destroyableComponent->SetMaxHealth(12345.0f);
|
||||
destroyableComponent->SetHealth(23);
|
||||
@@ -37,6 +36,14 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
TEST_F(DestroyableTest, PlacementNewAddComponentTest) {
|
||||
ASSERT_NE(destroyableComponent, nullptr);
|
||||
ASSERT_EQ(destroyableComponent->GetArmor(), 7);
|
||||
baseEntity->AddComponent<DestroyableComponent>();
|
||||
ASSERT_NE(baseEntity->GetComponent<DestroyableComponent>(), nullptr);
|
||||
ASSERT_EQ(destroyableComponent->GetArmor(), 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test Construction of a DestroyableComponent
|
||||
*/
|
||||
@@ -318,9 +325,7 @@ TEST_F(DestroyableTest, DestroyableComponentFactionTest) {
|
||||
|
||||
TEST_F(DestroyableTest, DestroyableComponentValiditiyTest) {
|
||||
auto* enemyEntity = new Entity(19, info);
|
||||
auto* enemyDestroyableComponent = new DestroyableComponent(enemyEntity);
|
||||
enemyEntity->AddComponent(eReplicaComponentType::DESTROYABLE, enemyDestroyableComponent);
|
||||
enemyDestroyableComponent->AddFactionNoLookup(16);
|
||||
enemyEntity->AddComponent<DestroyableComponent>()->AddFactionNoLookup(16);
|
||||
destroyableComponent->AddEnemyFaction(16);
|
||||
EXPECT_TRUE(destroyableComponent->IsEnemy(enemyEntity));
|
||||
EXPECT_FALSE(destroyableComponent->IsFriend(enemyEntity));
|
||||
|
@@ -15,8 +15,7 @@ protected:
|
||||
void SetUp() override {
|
||||
SetUpDependencies();
|
||||
baseEntity = std::make_unique<Entity>(15, GameDependenciesTest::info);
|
||||
simplePhysicsComponent = new SimplePhysicsComponent(1, baseEntity.get());
|
||||
baseEntity->AddComponent(SimplePhysicsComponent::ComponentType, simplePhysicsComponent);
|
||||
simplePhysicsComponent = baseEntity->AddComponent<SimplePhysicsComponent>(1);
|
||||
simplePhysicsComponent->SetClimbableType(eClimbableType::CLIMBABLE_TYPE_WALL);
|
||||
simplePhysicsComponent->SetPosition(NiPoint3(1.0f, 2.0f, 3.0f));
|
||||
simplePhysicsComponent->SetRotation(NiQuaternion(1.0f, 2.0f, 3.0f, 4.0f));
|
||||
|
Reference in New Issue
Block a user