1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-07-02 16:38:41 +00:00

Use the logger; also, default to not showing much crap in console. Use --info-on-stderr to enable crap.

This commit is contained in:
Perttu Ahola 2011-10-16 14:57:53 +03:00
parent 4846846a2d
commit b65a5aceb0
16 changed files with 844 additions and 646 deletions

View file

@ -25,6 +25,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
#include "gettime.h"
#include "sha1.h"
#include "base64.h"
#include "log.h"
TimeTaker::TimeTaker(const char *name, u32 *result)
{
@ -47,7 +48,7 @@ u32 TimeTaker::stop(bool quiet)
else
{
if(quiet == false)
std::cout<<m_name<<" took "<<dtime<<"ms"<<std::endl;
infostream<<m_name<<" took "<<dtime<<"ms"<<std::endl;
}
m_running = false;
return dtime;
@ -156,6 +157,21 @@ void mysrand(unsigned seed)
next = seed;
}
int myrand_range(int min, int max)
{
if(max-min > MYRAND_MAX)
{
errorstream<<"WARNING: myrand_range: max-min > MYRAND_MAX"<<std::endl;
assert(0);
}
if(min > max)
{
assert(0);
return max;
}
return (myrand()%(max-min+1))+min;
}
#ifndef SERVER
// Sets the color of all vertices in the mesh
void setMeshVerticesColor(scene::IMesh* mesh, video::SColor& color)