MCPcopy Create free account
hub / github.com/Norbyte/bg3se / MarkComponentAsChanged

Method MarkComponentAsChanged

BG3Extender/GameDefinitions/EntitySystem.cpp:323–343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

321}
322
323bool EntityStorageData::MarkComponentAsChanged(EntityHandle entity, ComponentTypeIndex component)
324{
325 auto componentSlot = ComponentTypeToIndex.try_get(component);
326 if (componentSlot) {
327 auto storageIndex = InstanceToPageMap.try_get(entity);
328 if (storageIndex) {
329 auto& page = Components[storageIndex->PageIndex]->Components[*componentSlot];
330 uint64_t entryMask = 1ull << (storageIndex->EntryIndex & 0x3f);
331 if (!(page.ModifiedEntities & entryMask)) {
332 page.ModifiedEntities |= entryMask;
333
334 if (!ModifiedComponents[*componentSlot]) {
335 ModifiedComponents.AtomicSet(*componentSlot);
336 }
337 }
338 return true;
339 }
340 }
341
342 return false;
343}
344
345bool EntityStorageData::WasComponentChanged(EntityHandle entity, ComponentTypeIndex component)
346{

Callers

nothing calls this directly

Calls 4

GetEntityWorldFunction · 0.85
AtomicSetMethod · 0.80
try_getMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected