MCPcopy Create free account
hub / github.com/crossuo/crossuo / ClearUnusedAnimations

Method ClearUnusedAnimations

src/Managers/AnimationManager.cpp:336–362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

334}
335
336void 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
364void CAnimationManager::GarbageCollect()
365{

Callers 2

InitMethod · 0.80
GarbageCollectMethod · 0.80

Calls 4

uo_animation_destroyFunction · 0.85
eraseMethod · 0.80
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected