MCPcopy Create free account
hub / github.com/ClassiCube/ClassiCube / CustomModel_Get

Function CustomModel_Get

src/Model.c:529–538  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

527static struct CustomModel* custom_models;
528
529struct CustomModel* CustomModel_Get(int id) {
530 if (id >= MAX_CUSTOM_MODELS) return NULL;
531
532 /* TODO log message if allocation fails? */
533 if (!custom_models)
534 custom_models = (struct CustomModel*)Mem_TryAlloc(MAX_CUSTOM_MODELS, sizeof(struct CustomModel));
535
536 if (!custom_models) return NULL;
537 return &custom_models[id];
538}
539#else
540static struct CustomModel custom_models[MAX_CUSTOM_MODELS];
541

Callers 3

CPE_DefineModelFunction · 0.85
CPE_DefineModelPartFunction · 0.85
CPE_UndefineModelFunction · 0.85

Calls 1

Mem_TryAllocFunction · 0.70

Tested by

no test coverage detected