MCPcopy Create free account
hub / github.com/assaultcube/AC / deletemapmodelslot

Function deletemapmodelslot

source/src/rendermodel.cpp:169–194  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

167COMMAND(mapmodelslotusage, "i");
168
169void deletemapmodelslot(int *n, char *opt) // delete mapmodel slot - only if unused or "purge" is specified
170{
171 EDITMP("deletemapmodelslot");
172 if(!mapmodels.inrange(*n)) return;
173 bool purgeall = !strcmp(opt, "purge");
174 if(!purgeall) loopv(ents) if(ents[i].type == MAPMODEL && ents[i].attr2 == *n) { conoutf("mapmodel slot #%d is in use: can't delete", *n); return; }
175 int deld = 0;
176 loopv(ents) if(ents[i].type == MAPMODEL)
177 {
178 entity &e = ents[i];
179 if(e.attr2 == *n)
180 { // delete entity
181 deleted_ents.add(e);
182 memset((void *)&e, 0, sizeof(persistent_entity));
183 e.type = NOTUSED;
184 deld++;
185 }
186 else if(e.attr2 > *n) e.attr2--; // adjust models in higher slots
187 }
188 mapmodels.remove(*n);
189 defformatstring(s)(" (%d mapmodels purged)", deld);
190 conoutf("mapmodel slot #%d deleted%s", *n, deld ? s : "");
191 unsavededits++;
192 mapmodelchanged = 1;
193 hdr.flags |= MHF_AUTOMAPCONFIG; // requires automapcfg
194}
195COMMAND(deletemapmodelslot, "is");
196
197void editmapmodelslot(int *n, char *rad, char *h, char *zoff, char *scale, char *name) // edit slot parameters != ""

Callers

nothing calls this directly

Calls 5

inrangeMethod · 0.80
loopvFunction · 0.70
conoutfFunction · 0.70
addMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected