breakout object bits into scoped enum (#997)

* breakout object bits into enum class
tested that things still work as expected
use the inplace set bits where appropiate

* add inline
This commit is contained in:
Aaron Kimbrell
2023-04-25 13:17:40 -05:00
committed by GitHub
parent de1ddd3125
commit 4976701f37
17 changed files with 80 additions and 62 deletions

View File

@@ -22,6 +22,7 @@
#include "Database.h"
#include "EntityInfo.h"
#include "eMissionTaskType.h"
#include "eObjectBits.h"
#include "eGameMasterLevel.h"
std::unordered_map<LOT, PetComponent::PetPuzzleData> PetComponent::buildCache{};
@@ -551,8 +552,8 @@ void PetComponent::NotifyTamingBuildSuccess(NiPoint3 position) {
LWOOBJID petSubKey = ObjectIDManager::Instance()->GenerateRandomObjectID();
petSubKey = GeneralUtils::SetBit(petSubKey, OBJECT_BIT_CHARACTER);
petSubKey = GeneralUtils::SetBit(petSubKey, OBJECT_BIT_PERSISTENT);
GeneralUtils::SetBit(petSubKey, eObjectBits::CHARACTER);
GeneralUtils::SetBit(petSubKey, eObjectBits::PERSISTENT);
m_DatabaseId = petSubKey;

View File

@@ -12,6 +12,7 @@
#include "UserManager.h"
#include "dLogger.h"
#include "AMFFormat.h"
#include "eObjectBits.h"
#include "eGameMasterLevel.h"
PropertyEntranceComponent::PropertyEntranceComponent(uint32_t componentID, Entity* parent) : Component(parent) {
@@ -243,8 +244,8 @@ void PropertyEntranceComponent::OnPropertyEntranceSync(Entity* entity, bool incl
// Convert owner char id to LWOOBJID
LWOOBJID ownerObjId = owner;
ownerObjId = GeneralUtils::SetBit(ownerObjId, OBJECT_BIT_CHARACTER);
ownerObjId = GeneralUtils::SetBit(ownerObjId, OBJECT_BIT_PERSISTENT);
GeneralUtils::SetBit(ownerObjId, eObjectBits::CHARACTER);
GeneralUtils::SetBit(ownerObjId, eObjectBits::PERSISTENT);
// Query to get friend and best friend fields
auto friendCheck = Database::CreatePreppedStmt("SELECT best_friend FROM friends WHERE (player_id = ? AND friend_id = ?) OR (player_id = ? AND friend_id = ?)");

View File

@@ -19,6 +19,7 @@
#include "PropertyEntranceComponent.h"
#include "InventoryComponent.h"
#include "eMissionTaskType.h"
#include "eObjectBits.h"
#include <vector>
#include "CppScripts.h"
@@ -66,8 +67,8 @@ PropertyManagementComponent::PropertyManagementComponent(Entity* parent) : Compo
if (propertyEntry->next()) {
this->propertyId = propertyEntry->getUInt64(1);
this->owner = propertyEntry->getUInt64(2);
this->owner = GeneralUtils::SetBit(this->owner, OBJECT_BIT_CHARACTER);
this->owner = GeneralUtils::SetBit(this->owner, OBJECT_BIT_PERSISTENT);
GeneralUtils::SetBit(this->owner, eObjectBits::CHARACTER);
GeneralUtils::SetBit(this->owner, eObjectBits::PERSISTENT);
this->clone_Id = propertyEntry->getInt(2);
this->propertyName = propertyEntry->getString(5).c_str();
this->propertyDescription = propertyEntry->getString(6).c_str();
@@ -372,16 +373,15 @@ void PropertyManagementComponent::UpdateModelPosition(const LWOOBJID id, const N
info.emulated = true;
info.emulator = EntityManager::Instance()->GetZoneControlEntity()->GetObjectID();
LWOOBJID id = static_cast<LWOOBJID>(persistentId) | 1ull << OBJECT_BIT_CLIENT;
info.spawnerID = id;
info.spawnerID = persistentId;
GeneralUtils::SetBit(info.spawnerID, eObjectBits::CLIENT);
const auto spawnerId = dZoneManager::Instance()->MakeSpawner(info);
auto* spawner = dZoneManager::Instance()->GetSpawner(spawnerId);
auto ldfModelBehavior = new LDFData<LWOOBJID>(u"modelBehaviors", 0);
auto userModelID = new LDFData<LWOOBJID>(u"userModelID", id);
auto userModelID = new LDFData<LWOOBJID>(u"userModelID", info.spawnerID);
auto modelType = new LDFData<int>(u"modelType", 2);
auto propertyObjectID = new LDFData<bool>(u"propertyObjectID", true);
auto componentWhitelist = new LDFData<int>(u"componentWhitelist", 1);
@@ -622,8 +622,8 @@ void PropertyManagementComponent::Load() {
//BBB property models need to have extra stuff set for them:
if (lot == 14) {
LWOOBJID blueprintID = lookupResult->getUInt(10);
blueprintID = GeneralUtils::SetBit(blueprintID, OBJECT_BIT_CHARACTER);
blueprintID = GeneralUtils::SetBit(blueprintID, OBJECT_BIT_PERSISTENT);
GeneralUtils::SetBit(blueprintID, eObjectBits::CHARACTER);
GeneralUtils::SetBit(blueprintID, eObjectBits::PERSISTENT);
LDFBaseData* ldfBlueprintID = new LDFData<LWOOBJID>(u"blueprintid", blueprintID);
LDFBaseData* componentWhitelist = new LDFData<int>(u"componentWhitelist", 1);