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

better caves

This commit is contained in:
Perttu Ahola 2010-12-25 16:04:51 +02:00
parent c37eb9b139
commit 07a759fdb8
9 changed files with 404 additions and 157 deletions

View file

@ -550,6 +550,41 @@ inline bool isInArea(v2s16 p, s16 d)
);
}
inline s16 rangelim(s16 i, s16 min, s16 max)
{
if(i < min)
return min;
if(i > max)
return max;
return i;
}
inline s16 rangelim(s16 i, s16 max)
{
if(i < 0)
return 0;
if(i > max)
return max;
return i;
}
inline v3s16 arealim(v3s16 p, s16 d)
{
if(p.X < 0)
p.X = 0;
if(p.Y < 0)
p.Y = 0;
if(p.Z < 0)
p.Z = 0;
if(p.X > d-1)
p.X = d-1;
if(p.Y > d-1)
p.Y = d-1;
if(p.Z > d-1)
p.Z = d-1;
return p;
}
inline std::wstring narrow_to_wide(const std::string& mbs)
{
size_t wcl = mbs.size();