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

Method Add

BG3Extender/GameDefinitions/EntitySystem.cpp:245–278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

243}
244
245EntityHandleGenerator::ThreadState::Entry* EntityHandleGenerator::ThreadState::Add()
246{
247 if (NumFreeSlots < Entries.bucket_size() / 2) {
248 auto oldCapacity = Entries.capacity();
249 if (Entries.capacity() < Entries.size() + Entries.bucket_size()) {
250 Entries.resize(Entries.capacity() + Entries.bucket_size());
251 }
252
253 auto growSize = Entries.capacity() - oldCapacity;
254 for (uint32_t i = 0; i < growSize; i++) {
255 auto index = Entries.size();
256 auto entry = Entries.add();
257 *entry = Entry{
258 .Index = index,
259 .Salt = 1
260 };
261 if (NumFreeSlots > 0) {
262 Entries[LastFreeSlotIndex].Index = index;
263 } else {
264 NextFreeSlotIndex = index;
265 }
266
267 LastFreeSlotIndex = index;
268 NumFreeSlots++;
269 }
270 }
271
272 auto index = NextFreeSlotIndex;
273 NumFreeSlots--;
274 auto entry = &Entries[index];
275 NextFreeSlotIndex = entry->Index;
276 entry->Index = index;
277 return entry;
278}
279
280void* EntityStorageData::GetComponent(EntityHandle entityHandle, ComponentTypeIndex type, std::size_t componentSize, bool isProxy) const
281{

Callers 6

CreateMethod · 0.45
MsgToTupleFunction · 0.45
LuaSerializers.hFile · 0.45
CreateMethod · 0.45
GetStorageMethod · 0.45
InitializeEnumerationsFunction · 0.45

Calls 5

bucket_sizeMethod · 0.45
capacityMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected