* 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. */
| 301 | * @todo Break the connection between any views that are following this sprite. |
| 302 | */ |
| 303 | void 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 | /** |
nothing calls this directly
no outgoing calls
no test coverage detected