diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2023-10-31 16:45:16 -0400 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2023-10-31 16:45:58 -0400 |
| commit | cb26bbf9945b7b3badb088e1c3df06efdfc7fad1 (patch) | |
| tree | a036b2bef7d5af8a64ca1f6457713a60385d169f /src/entities.cpp | |
| parent | e2078ee9339f1d57cb4addbbef9291ba98942b25 (diff) | |
add a new method for getting an EntityType's index by EntityHandle
Diffstat (limited to 'src/entities.cpp')
| -rw-r--r-- | src/entities.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/entities.cpp b/src/entities.cpp index 84a9110..f61927a 100644 --- a/src/entities.cpp +++ b/src/entities.cpp @@ -19,6 +19,15 @@ int64_t EntityType_FindByTypeCode(const char *typeCode) { return -1; } +int64_t EntityType_FindByEntityHandle(EntityHandle handle) { + for (int64_t i = 0; i < GlobalEntityTypes.Count(); ++i) { + if (GlobalEntityTypes[i].entityHandle == handle) { + return i; + } + } + return -1; +} + void EntityType_Load(EntityType &et) { assert(et.startingInstanceCount > 0); if (et.modelFile != nullptr && et.modelFile != CAFE_BABE(char)) { |
