mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2024-11-08 17:28:20 +00:00
Remove std::couts littered throughout the base (#1313)
This commit is contained in:
parent
98dc291b57
commit
1a199151da
@ -402,10 +402,10 @@ void PhantomPhysicsComponent::SetDirection(const NiPoint3& pos) {
|
||||
void PhantomPhysicsComponent::SpawnVertices() {
|
||||
if (!m_dpEntity) return;
|
||||
|
||||
std::cout << m_Parent->GetObjectID() << std::endl;
|
||||
LOG("%llu", m_Parent->GetObjectID());
|
||||
auto box = static_cast<dpShapeBox*>(m_dpEntity->GetShape());
|
||||
for (auto vert : box->GetVertices()) {
|
||||
std::cout << vert.x << ", " << vert.y << ", " << vert.z << std::endl;
|
||||
LOG("%f, %f, %f", vert.x, vert.y, vert.z);
|
||||
|
||||
EntityInfo info;
|
||||
info.lot = 33;
|
||||
|
@ -244,13 +244,6 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
|
||||
|
||||
case eGameMessageType::REQUEST_RESURRECT: {
|
||||
GameMessages::SendResurrect(entity);
|
||||
/*auto* dest = static_cast<DestroyableComponent*>(entity->GetComponent(eReplicaComponentType::DESTROYABLE));
|
||||
if (dest) {
|
||||
dest->SetHealth(4);
|
||||
dest->SetArmor(0);
|
||||
dest->SetImagination(6);
|
||||
Game::entityManager->SerializeEntity(entity);
|
||||
}*/
|
||||
break;
|
||||
}
|
||||
case eGameMessageType::GET_HOT_PROPERTY_DATA: {
|
||||
@ -339,11 +332,8 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
|
||||
RakNet::BitStream bitStreamLocal;
|
||||
BitStreamUtils::WriteHeader(bitStreamLocal, eConnectionType::CLIENT, eClientMessageType::GAME_MSG);
|
||||
bitStreamLocal.Write(entity->GetObjectID());
|
||||
//bitStreamLocal.Write((unsigned short)eGameMessageType::ECHO_SYNC_SKILL);
|
||||
//bitStreamLocal.Write(inStream);
|
||||
|
||||
SyncSkill sync = SyncSkill(inStream); // inStream replaced &bitStream
|
||||
//sync.Serialize(&bitStreamLocal);
|
||||
|
||||
ostringstream buffer;
|
||||
|
||||
@ -353,8 +343,6 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System
|
||||
buffer << setw(2) << hex << setfill('0') << (int)s << " ";
|
||||
}
|
||||
|
||||
//cout << buffer.str() << endl;
|
||||
|
||||
if (usr != nullptr) {
|
||||
RakNet::BitStream* bs = new RakNet::BitStream((unsigned char*)sync.sBitStream.c_str(), sync.sBitStream.size(), false);
|
||||
|
||||
|
@ -1372,7 +1372,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
|
||||
ChatPackets::SendSystemMessage(sysAddr, u"<" + (GeneralUtils::to_u16string(position.x)) + u", " + (GeneralUtils::to_u16string(position.y)) + u", " + (GeneralUtils::to_u16string(position.z)) + u">");
|
||||
|
||||
std::cout << position.x << ", " << position.y << ", " << position.z << std::endl;
|
||||
LOG("Position: %f, %f, %f", position.x, position.y, position.z);
|
||||
}
|
||||
|
||||
if (chatCommand == "rot" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) {
|
||||
@ -1380,14 +1380,14 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
|
||||
ChatPackets::SendSystemMessage(sysAddr, u"<" + (GeneralUtils::to_u16string(rotation.w)) + u", " + (GeneralUtils::to_u16string(rotation.x)) + u", " + (GeneralUtils::to_u16string(rotation.y)) + u", " + (GeneralUtils::to_u16string(rotation.z)) + u">");
|
||||
|
||||
std::cout << rotation.w << ", " << rotation.x << ", " << rotation.y << ", " << rotation.z << std::endl;
|
||||
LOG("Rotation: %f, %f, %f, %f", rotation.w, rotation.x, rotation.y, rotation.z);
|
||||
}
|
||||
|
||||
if (chatCommand == "locrow" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) {
|
||||
const auto position = entity->GetPosition();
|
||||
const auto rotation = entity->GetRotation();
|
||||
|
||||
std::cout << "<location x=\"" << position.x << "\" y=\"" << position.y << "\" z=\"" << position.z << "\" rw=\"" << rotation.w << "\" rx=\"" << rotation.x << "\" ry=\"" << rotation.y << "\" rz=\"" << rotation.z << "\" />" << std::endl;
|
||||
LOG("<location x=\"%f\" y=\"%f\" z=\"%f\" rw=\"%f\" rx=\"%f\" ry=\"%f\" rz=\"%f\" />", position.x, position.y, position.z, rotation.w, rotation.x, rotation.y, rotation.z);
|
||||
}
|
||||
|
||||
if (chatCommand == "playlvlfx" && entity->GetGMLevel() >= eGameMasterLevel::DEVELOPER) {
|
||||
@ -1652,7 +1652,7 @@ void SlashCommandHandler::HandleChatCommand(const std::u16string& command, Entit
|
||||
|
||||
auto sphere = static_cast<dpShapeSphere*>(prox.second->GetShape());
|
||||
auto pos = prox.second->GetPosition();
|
||||
std::cout << prox.first << ", r: " << sphere->GetRadius() << ", pos: " << pos.x << "," << pos.y << "," << pos.z << std::endl;
|
||||
LOG("Proximity: %s, r: %f, pos: %f, %f, %f", prox.first.c_str(), sphere->GetRadius(), pos.x, pos.y, pos.z);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ dpEntity::dpEntity(const LWOOBJID& objectID, dpShapeType shapeType, bool isStati
|
||||
break;
|
||||
|
||||
default:
|
||||
std::cout << "No shape for shapeType: " << (int)shapeType << std::endl;
|
||||
LOG("No shape for shapeType: %d", static_cast<int32_t>(shapeType));
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,15 +83,9 @@ void dpEntity::CheckCollision(dpEntity* other) {
|
||||
if (isColliding && !wasFound) {
|
||||
m_CurrentlyCollidingObjects.emplace(other->GetObjectID(), other);
|
||||
m_NewObjects.push_back(other);
|
||||
|
||||
//if (m_CollisionShape->GetShapeType() == dpShapeType::Sphere && other->GetShape()->GetShapeType() == dpShapeType::Sphere)
|
||||
//std::cout << "started sphere col at: " << other->GetPosition().x << ", " << other->GetPosition().y << ", " << other->GetPosition().z << std::endl;
|
||||
} else if (!isColliding && wasFound) {
|
||||
m_CurrentlyCollidingObjects.erase(other->GetObjectID());
|
||||
m_RemovedObjects.push_back(other);
|
||||
|
||||
//if (m_CollisionShape->GetShapeType() == dpShapeType::Sphere && other->GetShape()->GetShapeType() == dpShapeType::Sphere)
|
||||
// std::cout << "stopped sphere col at: " << other->GetPosition().x << ", " << other->GetPosition().y << ", " << other->GetPosition().z << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -8,8 +8,6 @@ dpGrid::dpGrid(int numCells, int cellSize) {
|
||||
CELL_SIZE = cellSize;
|
||||
m_DeleteGrid = true;
|
||||
|
||||
//dumb method but i can't be bothered
|
||||
|
||||
//fill x
|
||||
for (int i = 0; i < NUM_CELLS; i++) {
|
||||
m_Cells.push_back(std::vector<std::forward_list<dpEntity*>>());
|
||||
|
@ -10,7 +10,7 @@ dpShapeBase::~dpShapeBase() {
|
||||
}
|
||||
|
||||
bool dpShapeBase::IsColliding(dpShapeBase* other) {
|
||||
std::cout << "Base shapes do not have any *shape* to them, and thus cannot be overlapping." << std::endl;
|
||||
std::cout << "You should be using a shape class inherited from this base class." << std::endl;
|
||||
LOG("Base shapes do not have any *shape* to them, and thus cannot be overlapping.");
|
||||
LOG("You should be using a shape class inherited from this base class.");
|
||||
return false;
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ bool dpShapeBox::IsColliding(dpShapeBase* other) {
|
||||
return dpCollisionChecks::CheckBoxes(m_ParentEntity, other->GetParentEntity());
|
||||
|
||||
default:
|
||||
std::cout << "No collision detection for: " << (int)m_ShapeType << "-to-" << (int)other->GetShapeType() << " collision!" << std::endl;
|
||||
LOG("No collision detection for: %i-to-%i collision!", static_cast<int32_t>(m_ShapeType), static_cast<int32_t>(other->GetShapeType()));
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -72,10 +72,7 @@ void dpShapeBox::SetScale(float scale) {
|
||||
m_Height *= scale;
|
||||
m_Depth *= scale;
|
||||
|
||||
//fuuuckkk yoouu
|
||||
InitVertices();
|
||||
|
||||
//SetRotation(m_ParentEntity->GetRotation());
|
||||
}
|
||||
|
||||
void dpShapeBox::SetRotation(const NiQuaternion& rotation) {
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "dpShapeSphere.h"
|
||||
#include "dpCollisionChecks.h"
|
||||
#include "Game.h"
|
||||
#include "Logger.h"
|
||||
#include <iostream>
|
||||
|
||||
dpShapeSphere::dpShapeSphere(dpEntity* parentEntity, float radius) :
|
||||
@ -22,7 +24,7 @@ bool dpShapeSphere::IsColliding(dpShapeBase* other) {
|
||||
return dpCollisionChecks::CheckSphereBox(m_ParentEntity, other->GetParentEntity());
|
||||
|
||||
default:
|
||||
std::cout << "No collision detection for: " << (int)m_ShapeType << "-to-" << (int)other->GetShapeType() << " collision!" << std::endl;
|
||||
LOG("No collision detection for: %i-to-%i collision!", static_cast<int32_t>(m_ShapeType), static_cast<int32_t>(other->GetShapeType()));
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -1,35 +0,0 @@
|
||||
//This file included for reference only
|
||||
|
||||
/*#include <iostream>
|
||||
#include <chrono>
|
||||
#include <thread>
|
||||
#include "dpWorld.h"
|
||||
|
||||
#include "NiQuaternion.hpp"
|
||||
#include "NiPoint3.hpp"
|
||||
|
||||
int main() {
|
||||
std::cout << "dPhysics test engine" << std::endl;
|
||||
|
||||
//Test rotation code:
|
||||
NiPoint3 p(1.0f, 0.0f, 0.0f);
|
||||
|
||||
float angle = 45.0f;
|
||||
NiQuaternion q = NiQuaternion::CreateFromAxisAngle(NiPoint3(0.0f, 0.0f, 1.0f), angle);
|
||||
|
||||
NiPoint3 rotated = p.RotateByQuaternion(q);
|
||||
|
||||
std::cout << "OG: " << p.x << ", " << p.y << ", " << p.z << std::endl;
|
||||
std::cout << "Quater: " << q.x << ", " << q.y << ", " << q.z << ", " << q.w << " angle: " << angle << std::endl;
|
||||
std::cout << "Rotated: " << rotated.x << ", " << rotated.y << ", " << rotated.z << std::endl;
|
||||
|
||||
//Test some collisions:
|
||||
dpWorld::GetInstance().Initialize(1000);
|
||||
|
||||
while (true) {
|
||||
dpWorld::GetInstance().StepWorld(1.0f/60.0f);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(16));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}*/
|
@ -16,6 +16,12 @@
|
||||
#include "AssetManager.h"
|
||||
#include "dConfig.h"
|
||||
|
||||
void Level::SceneObjectDataChunk::PrintAllObjects() const {
|
||||
for (const auto& [id, sceneObj] : objects) {
|
||||
LOG("ID: %d LOT: %d", id, sceneObj.lot);
|
||||
}
|
||||
}
|
||||
|
||||
Level::Level(Zone* parentZone, const std::string& filepath) {
|
||||
m_ParentZone = parentZone;
|
||||
|
||||
@ -33,9 +39,9 @@ Level::Level(Zone* parentZone, const std::string& filepath) {
|
||||
}
|
||||
|
||||
Level::~Level() {
|
||||
for (std::map<uint32_t, Header>::iterator it = m_ChunkHeaders.begin(); it != m_ChunkHeaders.end(); ++it) {
|
||||
if (it->second.id == Level::ChunkTypeID::FileInfo) delete it->second.fileInfo;
|
||||
if (it->second.id == Level::ChunkTypeID::SceneObjectData) delete it->second.sceneObjects;
|
||||
for (auto& [id, header] : m_ChunkHeaders) {
|
||||
if (header.id == Level::ChunkTypeID::FileInfo) delete header.fileInfo;
|
||||
if (header.id == Level::ChunkTypeID::SceneObjectData) delete header.sceneObjects;
|
||||
}
|
||||
}
|
||||
|
||||
@ -248,8 +254,8 @@ void Level::ReadSceneObjectDataChunk(std::istream& file, Header& header) {
|
||||
BinaryIO::BinaryRead(file, obj.id);
|
||||
BinaryIO::BinaryRead(file, obj.lot);
|
||||
|
||||
/*if (header.fileInfo->version >= 0x26)*/ BinaryIO::BinaryRead(file, obj.value1);
|
||||
/*if (header.fileInfo->version >= 0x20)*/ BinaryIO::BinaryRead(file, obj.value2);
|
||||
/*if (header.fileInfo->version >= 0x26)*/ BinaryIO::BinaryRead(file, obj.nodeType);
|
||||
/*if (header.fileInfo->version >= 0x20)*/ BinaryIO::BinaryRead(file, obj.glomId);
|
||||
|
||||
BinaryIO::BinaryRead(file, obj.position);
|
||||
BinaryIO::BinaryRead(file, obj.rotation);
|
||||
|
@ -30,11 +30,7 @@ public:
|
||||
struct SceneObjectDataChunk {
|
||||
std::map<LWOOBJID, SceneObject> objects;
|
||||
|
||||
const void PrintAllObjects() {
|
||||
for (std::map<LWOOBJID, SceneObject>::iterator it = objects.begin(); it != objects.end(); ++it) {
|
||||
std::cout << "\t ID: " << it->first << " LOT: " << it->second.lot << std::endl;
|
||||
}
|
||||
}
|
||||
void PrintAllObjects() const;
|
||||
|
||||
uint32_t GetObjectCount() { return objects.size(); }
|
||||
};
|
||||
|
@ -148,6 +148,8 @@ struct PropertyPath {
|
||||
float repMultiplier;
|
||||
PropertyRentalPeriod rentalPeriod;
|
||||
PropertyAchievmentRequired achievementRequired;
|
||||
|
||||
// Player respawn coordinates in the main zone (not the property zone)
|
||||
NiPoint3 playerZoneCoords;
|
||||
float maxBuildHeight;
|
||||
};
|
||||
|
@ -12,8 +12,8 @@ struct mapCompareLwoSceneIDs {
|
||||
struct SceneObject {
|
||||
LWOOBJID id;
|
||||
LOT lot;
|
||||
uint32_t value1;
|
||||
uint32_t value2;
|
||||
uint32_t nodeType;
|
||||
uint32_t glomId;
|
||||
NiPoint3 position;
|
||||
NiQuaternion rotation;
|
||||
float scale = 1.0f;
|
||||
|
@ -71,25 +71,15 @@ TEST(dCommonTests, AMF3InsertionAssociativeTest) {
|
||||
array.Insert<std::vector<uint32_t>>("Undefined", {});
|
||||
array.Insert("Null", nullptr);
|
||||
|
||||
std::cout << "test" << std::endl;
|
||||
ASSERT_EQ(array.Get<const char*>("CString")->GetValueType(), eAmf::String);
|
||||
std::cout << "test" << std::endl;
|
||||
ASSERT_EQ(array.Get<std::string>("String")->GetValueType(), eAmf::String);
|
||||
std::cout << "test" << std::endl;
|
||||
ASSERT_EQ(array.Get<bool>("False")->GetValueType(), eAmf::False);
|
||||
std::cout << "test" << std::endl;
|
||||
ASSERT_EQ(array.Get<bool>("True")->GetValueType(), eAmf::True);
|
||||
std::cout << "test" << std::endl;
|
||||
ASSERT_EQ(array.Get<int32_t>("Integer")->GetValueType(), eAmf::Integer);
|
||||
std::cout << "test" << std::endl;
|
||||
ASSERT_EQ(array.Get<double>("Double")->GetValueType(), eAmf::Double);
|
||||
std::cout << "test" << std::endl;
|
||||
ASSERT_EQ(array.GetArray("Array")->GetValueType(), eAmf::Array);
|
||||
std::cout << "test" << std::endl;
|
||||
ASSERT_EQ(array.Get<nullptr_t>("Null")->GetValueType(), eAmf::Null);
|
||||
std::cout << "test" << std::endl;
|
||||
ASSERT_EQ(array.Get<std::vector<uint32_t>>("Undefined")->GetValueType(), eAmf::Undefined);
|
||||
std::cout << "test" << std::endl;
|
||||
}
|
||||
|
||||
TEST(dCommonTests, AMF3InsertionDenseTest) {
|
||||
|
Loading…
Reference in New Issue
Block a user