MCPcopy Create free account
hub / github.com/deathkiller/jazz2-native / CreateBuffer

Method CreateBuffer

Sources/Jazz2/Scripting/RegisterArray.cpp:875–890  ·  view source on GitHub ↗

internal

Source from the content-addressed store, hash-verified

873
874 // internal
875 void CScriptArray::CreateBuffer(SArrayBuffer** buf, std::uint32_t numElements)
876 {
877 *buf = static_cast<SArrayBuffer*>(asAllocMem(sizeof(SArrayBuffer) - 1 + elementSize * numElements));
878
879 if ((*buf) != nullptr) {
880 (*buf)->numElements = numElements;
881 (*buf)->maxElements = numElements;
882 Construct(*buf, 0, numElements);
883 } else {
884 // Oops, out of memory
885 asIScriptContext* ctx = asGetActiveContext();
886 if (ctx != nullptr) {
887 ctx->SetException("Out of memory");
888 }
889 }
890 }
891
892 // internal
893 void CScriptArray::DeleteBuffer(SArrayBuffer* buf)

Callers

nothing calls this directly

Calls 1

ConstructFunction · 0.85

Tested by

no test coverage detected