summaryrefslogtreecommitdiffstats
path: root/src/objects
diff options
context:
space:
mode:
authorNikolay Korolev <nickvnuk@gmail.com>2020-05-19 00:49:09 +0200
committerNikolay Korolev <nickvnuk@gmail.com>2020-05-19 00:49:09 +0200
commit6510b15704998b14b89fa453ba9d142f85c30dd5 (patch)
treee194a3641474f3a0818bb4ff2dd139f2c293e804 /src/objects
parentfixes for braking and cloud rotation at high fps (diff)
downloadre3-6510b15704998b14b89fa453ba9d142f85c30dd5.tar
re3-6510b15704998b14b89fa453ba9d142f85c30dd5.tar.gz
re3-6510b15704998b14b89fa453ba9d142f85c30dd5.tar.bz2
re3-6510b15704998b14b89fa453ba9d142f85c30dd5.tar.lz
re3-6510b15704998b14b89fa453ba9d142f85c30dd5.tar.xz
re3-6510b15704998b14b89fa453ba9d142f85c30dd5.tar.zst
re3-6510b15704998b14b89fa453ba9d142f85c30dd5.zip
Diffstat (limited to 'src/objects')
-rw-r--r--src/objects/Object.cpp15
-rw-r--r--src/objects/Object.h2
2 files changed, 17 insertions, 0 deletions
diff --git a/src/objects/Object.cpp b/src/objects/Object.cpp
index 0107c75c..4a45050c 100644
--- a/src/objects/Object.cpp
+++ b/src/objects/Object.cpp
@@ -396,3 +396,18 @@ CObject::DeleteAllTempObjectsInArea(CVector point, float fRadius)
}
}
}
+
+bool
+IsObjectPointerValid(CObject* pObject)
+{
+ if (!pObject)
+ return false;
+ int index = CPools::GetObjectPool()->GetJustIndex(pObject);
+#ifdef FIX_BUGS
+ if (index < 0 || index >= CPools::GetObjectPool()->GetSize())
+#else
+ if (index < 0 || index > CPools::GetObjectPool()->GetSize())
+#endif
+ return false;
+ return pObject->bIsBIGBuilding || pObject->m_entryInfoList.first;
+}
diff --git a/src/objects/Object.h b/src/objects/Object.h
index 20c99b1b..73f710f0 100644
--- a/src/objects/Object.h
+++ b/src/objects/Object.h
@@ -113,3 +113,5 @@ public:
static void DeleteAllTempObjects();
static void DeleteAllTempObjectsInArea(CVector point, float fRadius);
};
+
+bool IsObjectPointerValid(CObject* pObject);