MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / RemoveOld

Method RemoveOld

engine/Poseidon/IO/LockCache.cpp:441–465  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

439}
440
441Ref<OperField> OperCache::RemoveOld(float limit, int untilSize)
442{
443 Ref<OperField> ret;
444 // last used fields are at the end of the list
445 for (OperField *fld = _operFields.Last(), *prv; fld; fld = prv)
446 {
447 prv = _operFields.Prev(fld);
448 // if we find some too new entry, we may be sure all other will be newer
449 if (fld->_lastUsed >= Glob.time - limit)
450 {
451 break;
452 }
453 if (!ret)
454 {
455 ret = fld; // recycle first entry removed
456 }
457 RemoveField(fld);
458 // check if we have reached the limit
459 if (_count <= untilSize)
460 {
461 return ret;
462 }
463 }
464 return ret;
465}
466
467OperCache::OperCache(Landscape* land)
468{

Callers

nothing calls this directly

Calls 2

LastMethod · 0.80
PrevMethod · 0.45

Tested by

no test coverage detected