mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-16 18:52:22 +00:00
Switch random function to std::mt19937
Added class EQEmu::Random Functions: EQEmu::Random::Int(int low, int high) EQEmu::Random::Real(double low, double high) EQEmu::Random::Roll(int required) EQEmu::Random::Roll(double required) EQEmu::Random::Reseed() For zone, you will access the random object through the zone object ex. zone->random.Int(0, 100); Int returns a random int between low and high Real returns a random double between low and high Roll(int) returns true if Int(0, 99) < required is true Roll(double) returns true if Real(0.0, 1.0) <= required is true
This commit is contained in:
+3
-3
@@ -1300,13 +1300,13 @@ void Zone::ChangeWeather()
|
||||
return;
|
||||
}
|
||||
|
||||
int chance = MakeRandomInt(0, 3);
|
||||
int chance = zone->random.Int(0, 3);
|
||||
uint8 rainchance = zone->newzone_data.rain_chance[chance];
|
||||
uint8 rainduration = zone->newzone_data.rain_duration[chance];
|
||||
uint8 snowchance = zone->newzone_data.snow_chance[chance];
|
||||
uint8 snowduration = zone->newzone_data.snow_duration[chance];
|
||||
uint32 weathertimer = 0;
|
||||
uint16 tmpweather = MakeRandomInt(0, 100);
|
||||
uint16 tmpweather = zone->random.Int(0, 100);
|
||||
uint8 duration = 0;
|
||||
uint8 tmpOldWeather = zone->zone_weather;
|
||||
bool changed = false;
|
||||
@@ -1315,7 +1315,7 @@ void Zone::ChangeWeather()
|
||||
{
|
||||
if(rainchance > 0 || snowchance > 0)
|
||||
{
|
||||
uint8 intensity = MakeRandomInt(1, 10);
|
||||
uint8 intensity = zone->random.Int(1, 10);
|
||||
if((rainchance > snowchance) || (rainchance == snowchance))
|
||||
{
|
||||
//It's gunna rain!
|
||||
|
||||
Reference in New Issue
Block a user