summaryrefslogtreecommitdiff
path: root/src/common/random.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2018-06-24 00:13:59 +0200
committerHaru <haru@dotalux.com>2018-07-01 21:09:24 +0200
commit8dd7aec896efc0220d6234bcfb190767c30dbb29 (patch)
tree0fd1b8d2b795c01b4a6fddc3827784d26d09cc61 /src/common/random.c
parentec1bc50b01aa4f34f151b3b3800011abdce31919 (diff)
downloadhercules-8dd7aec896efc0220d6234bcfb190767c30dbb29.tar.gz
hercules-8dd7aec896efc0220d6234bcfb190767c30dbb29.tar.bz2
hercules-8dd7aec896efc0220d6234bcfb190767c30dbb29.tar.xz
hercules-8dd7aec896efc0220d6234bcfb190767c30dbb29.zip
Change functions to static where possible (Part 1 - common)
This fixes issues with plugins defining symbols with the same names Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/common/random.c')
-rw-r--r--src/common/random.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/common/random.c b/src/common/random.c
index 6fbaba91c..9bbe4f86c 100644
--- a/src/common/random.c
+++ b/src/common/random.c
@@ -40,11 +40,11 @@
* Implementation of the random number generator interface.
*/
-struct rnd_interface rnd_s;
+static struct rnd_interface rnd_s;
struct rnd_interface *rnd;
/// @copydoc rnd_interface::init()
-void rnd_init(void)
+static void rnd_init(void)
{
unsigned long seed = (unsigned long)timer->gettick();
seed += (unsigned long)time(NULL);
@@ -66,30 +66,30 @@ void rnd_init(void)
}
/// @copydoc rnd_interface::final()
-void rnd_final(void)
+static void rnd_final(void)
{
}
/// @copydoc rnd_interface::seed()
-void rnd_seed(uint32 seed)
+static void rnd_seed(uint32 seed)
{
init_genrand(seed);
}
/// @copydoc rnd_interface::random()
-int32 rnd_random(void)
+static int32 rnd_random(void)
{
return (int32)genrand_int31();
}
/// @copydoc rnd_interface::roll()
-uint32 rnd_roll(uint32 dice_faces)
+static uint32 rnd_roll(uint32 dice_faces)
{
return (uint32)(rnd->uniform()*dice_faces);
}
/// @copydoc rnd_interface::value()
-int32 rnd_value(int32 min, int32 max)
+static int32 rnd_value(int32 min, int32 max)
{
if (min >= max)
return min;
@@ -97,13 +97,13 @@ int32 rnd_value(int32 min, int32 max)
}
/// @copydoc rnd_interface::uniform()
-double rnd_uniform(void)
+static double rnd_uniform(void)
{
return ((uint32)genrand_int32())*(1.0/4294967296.0);// divided by 2^32
}
/// @copydoc rnd_interface::uniform53()
-double rnd_uniform53(void)
+static double rnd_uniform53(void)
{
return genrand_res53();
}