summaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorJonathan Bradley <jcb@pikum.xyz>2023-12-11 14:46:50 -0500
committerJonathan Bradley <jcb@pikum.xyz>2023-12-11 18:56:57 -0500
commitba250cc496b2e617823ff8111ef463b6adea27f4 (patch)
treedc926851da01b970aca827d6c6ca84b87a7432fa /src/game.cpp
parent8047197b62894cb1f7bb6a6871870e4b91fde992 (diff)
replace handles with union struct
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/game.cpp b/src/game.cpp
index 80cc593..bf30cfe 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -83,7 +83,7 @@ void SerializeCamera(std::ofstream &stream, const PkeCamera &cam) {
void SerializeInstance(std::ofstream &stream, const CompInstance &comp) {
char handleStr[19] = { '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0', '\0' };
- snprintf(handleStr, 19, "0x%016lX",static_cast<EntityHandle_T>(comp.entHandle));
+ snprintf(handleStr, 19, "0x%016lX", comp.entHandle.hash);
EntityType *et = nullptr;
for (long i = 0; i < GlobalEntityTypes.Count(); ++i) {
if (GlobalEntityTypes[i].grBindsHandle == comp.grBindsHandle) {
@@ -249,15 +249,13 @@ void ParseInstance(std::ifstream &stream) {
auto *broadphaseProxy = compInst.bt.rigidBody->getBroadphaseProxy();
broadphaseProxy->m_collisionFilterGroup = static_cast<PhysicsCollision_T>(comp.physicsLayer);
broadphaseProxy->m_collisionFilterMask = static_cast<PhysicsCollision_T>(comp.physicsMask);
- compInst.bt.rigidBody->setUserPointer(reinterpret_cast<void *>(compInst.entHandle));
+ compInst.bt.rigidBody->setUserPointer(reinterpret_cast<void *>(compInst.entHandle.hash));
break;
}
if (strstr(readLine, PKE_FILE_INSTANCE_ENTITY_HANDLE)) {
uint64_t prefixLen = strlen(PKE_FILE_INSTANCE_ENTITY_HANDLE);
- EntityHandle_T handle_t;
- STR2NUM_ERROR result = str2num(handle_t, readLine + prefixLen);
+ STR2NUM_ERROR result = str2num(comp.entHandle.hash, readLine + prefixLen);
assert(result == STR2NUM_ERROR::SUCCESS);
- comp.entHandle = EntityHandle{handle_t};
continue;
}
if (strstr(readLine, PKE_FILE_INSTANCE_ENTITY_TYPE_CODE)) {