1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

better support for old maps

This commit is contained in:
Perttu Ahola 2011-04-10 22:50:31 +03:00
parent 3d25fe42f3
commit b0b5c43254
6 changed files with 145 additions and 50 deletions

View file

@ -2015,6 +2015,35 @@ inline core::aabbox3d<f32> getNodeBox(v3s16 p, float d)
);
}
class IntervalLimiter
{
public:
IntervalLimiter():
m_accumulator(0)
{
}
/*
dtime: time from last call to this method
wanted_interval: interval wanted
return value:
true: action should be skipped
false: action should be done
*/
bool step(float dtime, float wanted_interval)
{
m_accumulator += dtime;
if(m_accumulator < wanted_interval)
{
dtime = 0;
return true;
}
m_accumulator -= wanted_interval;
return false;
}
protected:
float m_accumulator;
};
#endif