| 334 | } |
| 335 | |
| 336 | void CAnimationManager::ClearUnusedAnimations(uint32_t ticks) |
| 337 | { |
| 338 | ticks -= CLEAR_ANIMATION_TEXTURES_DELAY; |
| 339 | int count = 0; |
| 340 | for (auto it = s_AnimationLifetime.begin(); it != s_AnimationLifetime.end();) |
| 341 | { |
| 342 | const auto lastAccessTime = it->second; |
| 343 | if (lastAccessTime < ticks || ticks == ~0) |
| 344 | { |
| 345 | const auto animId = it->first; |
| 346 | uo_animation_destroy(animId, DeleteSprite); |
| 347 | it = s_AnimationLifetime.erase(it); |
| 348 | if (++count >= MAX_ANIMATIONS_OBJECT_REMOVED_BY_GARBAGE_COLLECTOR) |
| 349 | { |
| 350 | break; |
| 351 | } |
| 352 | } |
| 353 | else |
| 354 | { |
| 355 | ++it; |
| 356 | } |
| 357 | } |
| 358 | if (count) |
| 359 | { |
| 360 | Info(Data, "removed %d animation textures", count); |
| 361 | } |
| 362 | } |
| 363 | |
| 364 | void CAnimationManager::GarbageCollect() |
| 365 | { |
no test coverage detected