From 66cc582a9a7c28a0438de3515f648d7562c6fae4 Mon Sep 17 00:00:00 2001 From: David Markowitz <39972741+EmosewaMC@users.noreply.github.com> Date: Wed, 10 Jan 2024 20:57:41 -0800 Subject: [PATCH] chore: update noninformative comments to be informative (#1407) * better comments * more comments --- dCommon/dEnums/eGameMessageType.h | 2 +- dGame/dComponents/ActivityComponent.cpp | 6 ++++-- dGame/dComponents/PropertyManagementComponent.cpp | 2 +- dGame/dGameMessages/GameMessageHandler.cpp | 4 ++-- dGame/dGameMessages/GameMessages.cpp | 2 +- dNavigation/dTerrain/RawFile.cpp | 2 +- dScripts/ScriptComponent.cpp | 8 ++------ 7 files changed, 12 insertions(+), 14 deletions(-) diff --git a/dCommon/dEnums/eGameMessageType.h b/dCommon/dEnums/eGameMessageType.h index 14673fac..e3fc22b6 100644 --- a/dCommon/dEnums/eGameMessageType.h +++ b/dCommon/dEnums/eGameMessageType.h @@ -629,7 +629,7 @@ enum class eGameMessageType : uint16_t { GET_INSTRUCTION_COUNT = 676, GET_IS_NPC = 677, ACTIVATE_BUBBLE_BUFF = 678, - DECTIVATE_BUBBLE_BUFF = 679, // thanks netdevil + DECTIVATE_BUBBLE_BUFF = 679, // This is spelled wrong in the client, so we misspell it here. EXHIBIT_VOTE = 680, ADD_PET_TO_PLAYER = 681, REMOVE_PET_FROM_PLAYER = 682, diff --git a/dGame/dComponents/ActivityComponent.cpp b/dGame/dComponents/ActivityComponent.cpp index 7d9e37da..aa6a4604 100644 --- a/dGame/dComponents/ActivityComponent.cpp +++ b/dGame/dComponents/ActivityComponent.cpp @@ -46,18 +46,20 @@ ActivityComponent::ActivityComponent(Entity* parent, int32_t activityID) : Compo auto* destroyableComponent = m_Parent->GetComponent(); if (destroyableComponent) { - // check for LMIs and set the loot LMIs + // First lookup the loot matrix id for this component id. CDActivityRewardsTable* activityRewardsTable = CDClientManager::Instance().GetTable(); std::vector activityRewards = activityRewardsTable->Query([=](CDActivityRewards entry) {return (entry.LootMatrixIndex == destroyableComponent->GetLootMatrixID()); }); uint32_t startingLMI = 0; + // If we have one, set the starting loot matrix id to that. if (activityRewards.size() > 0) { startingLMI = activityRewards[0].LootMatrixIndex; } if (startingLMI > 0) { - // now time for bodge :) + // We may have more than 1 loot matrix index to use depending ont the size of the team that is looting the activity. + // So this logic will get the rest of the loot matrix indices for this activity. std::vector objectTemplateActivities = activityRewardsTable->Query([=](CDActivityRewards entry) {return (activityRewards[0].objectTemplate == entry.objectTemplate); }); for (const auto& item : objectTemplateActivities) { diff --git a/dGame/dComponents/PropertyManagementComponent.cpp b/dGame/dComponents/PropertyManagementComponent.cpp index 833b7d73..75466043 100644 --- a/dGame/dComponents/PropertyManagementComponent.cpp +++ b/dGame/dComponents/PropertyManagementComponent.cpp @@ -519,7 +519,7 @@ void PropertyManagementComponent::DeleteModel(const LWOOBJID id, const int delet { item->SetCount(item->GetCount() - 1); - LOG("BODGE TIME, YES IT GOES HERE"); + LOG("DLU currently does not support breaking apart brick by brick models."); break; } diff --git a/dGame/dGameMessages/GameMessageHandler.cpp b/dGame/dGameMessages/GameMessageHandler.cpp index 6e313ab1..c997bdd1 100644 --- a/dGame/dGameMessages/GameMessageHandler.cpp +++ b/dGame/dGameMessages/GameMessageHandler.cpp @@ -196,8 +196,8 @@ void GameMessageHandler::HandleMessage(RakNet::BitStream* inStream, const System } case eGameMessageType::MISSION_DIALOGUE_CANCELLED: { - //This message is pointless for our implementation, as the client just carries on after - //rejecting a mission offer. We dont need to do anything. This is just here to remove a warning in our logs :) + // This message is pointless for our implementation, as the client just carries on after + // rejecting a mission offer. We dont need to do anything. This is just here to remove a warning in our logs :) break; } diff --git a/dGame/dGameMessages/GameMessages.cpp b/dGame/dGameMessages/GameMessages.cpp index 03468884..4e410504 100644 --- a/dGame/dGameMessages/GameMessages.cpp +++ b/dGame/dGameMessages/GameMessages.cpp @@ -4627,7 +4627,7 @@ void GameMessages::HandleSetGhostReferencePosition(RakNet::BitStream* inStream, void GameMessages::HandleBuyFromVendor(RakNet::BitStream* inStream, Entity* entity, const SystemAddress& sysAddr) { - bool bConfirmed{}; // this doesnt even do anything, thanks ND! + bool bConfirmed{}; // This doesn't appear to do anything. Further research is needed. bool countIsDefault{}; int count = 1; LOT item; diff --git a/dNavigation/dTerrain/RawFile.cpp b/dNavigation/dTerrain/RawFile.cpp index dfad9ca4..efc2b39d 100644 --- a/dNavigation/dTerrain/RawFile.cpp +++ b/dNavigation/dTerrain/RawFile.cpp @@ -20,7 +20,7 @@ RawFile::RawFile(std::string fileName) { if (m_Version < 0x20) { - return; // Version too crusty to handle + return; // Version is too old to be supported } // Read in chunks diff --git a/dScripts/ScriptComponent.cpp b/dScripts/ScriptComponent.cpp index 2079d67a..7c44ded3 100644 --- a/dScripts/ScriptComponent.cpp +++ b/dScripts/ScriptComponent.cpp @@ -46,11 +46,7 @@ CppScripts::Script* ScriptComponent::GetScript() { } void ScriptComponent::SetScript(const std::string& scriptName) { - //we don't need to delete the script because others may be using it :) - /*if (m_Client) { - m_Script = new InvalidScript(); - return; - }*/ - + // Scripts are managed by the CppScripts class and are effecitvely singletons + // and they may also be used by other script components so DON'T delete them. m_Script = CppScripts::GetScript(m_Parent, scriptName); }