MCPcopy Create free account
hub / github.com/SimHacker/micropolis / destroySprite

Method destroySprite

MicropolisCore/src/MicropolisEngine/src/sprite.cpp:303–325  ·  view source on GitHub ↗

* Destroy the sprite by taking it out of the active list. * @param sprite Sprite to destroy. * @todo Break the connection between any views that are following this sprite. */

Source from the content-addressed store, hash-verified

301 * @todo Break the connection between any views that are following this sprite.
302 */
303void Micropolis::destroySprite(SimSprite *sprite)
304{
305 SimSprite **sp;
306
307 if (globalSprites[sprite->type] == sprite) {
308 globalSprites[sprite->type] = (SimSprite *)NULL;
309 }
310
311 if (sprite->name != NULL) {
312 freePtr(sprite->name);
313 sprite->name = NULL;
314 }
315
316 for (sp = &spriteList; *sp != NULL; sp = &((*sp)->next)) {
317 if (sprite == (*sp)) {
318 *sp = sprite->next;
319 break;
320 }
321 }
322
323 sprite->next = freeSprites;
324 freeSprites = sprite;
325}
326
327
328/**

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected