MCPcopy Index your code
hub / github.com/assaultcube/AC / setmodelattributes

Function setmodelattributes

source/src/rendermodel.cpp:316–337  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

314hashtable<const char *, mapmodelattributes *> mdlregistry;
315
316void setmodelattributes(const char *name, mapmodelattributes &ma)
317{
318 if(!strchr(name, ' ') && !strncmp(name, mmpath, strlen(mmpath))) name += strlen(mmpath); // for now: ignore mapmodels with spaces in the path (next release: ban them)
319 else return; // we only want mapmodels
320 mapmodelattributes **mrp = mdlregistry.access(name), *mr = mrp ? *mrp : NULL, *r = mr;
321 if(!r)
322 {
323 r = new mapmodelattributes;
324 copystring(r->name, name);
325 }
326 loopi(MMA_NUM)
327 {
328 if(ma.n[i])
329 {
330 if(!r->n[i]) mapmodelchanged = 1;
331 DELSTRING(r->n[i]); // overwrite existing attributes
332 r->n[i] = ma.n[i];
333 ma.n[i] = NULL;
334 }
335 }
336 if(!mr) mdlregistry.access(r->name, r);
337}
338
339void mapmodelregister_(char **args, int numargs) // read model attributes without loading the model
340{

Callers 2

mapmodelregister_Function · 0.85
loadmodelFunction · 0.85

Calls 2

copystringFunction · 0.85
accessMethod · 0.80

Tested by

no test coverage detected