summaryrefslogtreecommitdiff
path: root/src/utility.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2011-10-16 14:57:53 +0300
committerPerttu Ahola <celeron55@gmail.com>2011-10-16 14:57:53 +0300
commitb65a5aceb0d6552d8ba4878bed5326c614dd3046 (patch)
tree088aa083f65c8d738609e3061f8400847c7fb2b0 /src/utility.cpp
parent4846846a2d28e06f347cb46ffe6be2a42337eb32 (diff)
downloadminetest-b65a5aceb0d6552d8ba4878bed5326c614dd3046.tar.gz
minetest-b65a5aceb0d6552d8ba4878bed5326c614dd3046.tar.bz2
minetest-b65a5aceb0d6552d8ba4878bed5326c614dd3046.zip
Use the logger; also, default to not showing much crap in console. Use --info-on-stderr to enable crap.
Diffstat (limited to 'src/utility.cpp')
-rw-r--r--src/utility.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/utility.cpp b/src/utility.cpp
index 7a43f53d2..6ce67cb3f 100644
--- a/src/utility.cpp
+++ b/src/utility.cpp
@@ -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)