ProjectSkyfire / SkyFire.406a

SkyFireEMU is a full featured F/OSS World of Warcraft: Cataclysm emulator written in C++. || Compatible with World of Warcraft client 4.0.6a (Build:13623) || Public DB is located on forum
http://www.projectskyfire.org
GNU General Public License v3.0
343 stars 218 forks source link

Fixed crash urand. #867

Closed Retriman closed 11 years ago

Retriman commented 11 years ago
diff --git a/src/server/scripts/EasternKingdoms/AlteracValley/alterac_valley.cpp b/src/server/scripts/EasternKingdoms/AlteracValley/alterac_valley.cpp
index 8db6083..d32ff8b 100644
--- a/src/server/scripts/EasternKingdoms/AlteracValley/alterac_valley.cpp
+++ b/src/server/scripts/EasternKingdoms/AlteracValley/alterac_valley.cpp
@@ -74,7 +74,7 @@ class mob_av_marshal_or_warmaster : public CreatureScript
             {
                 ChargeTimer            = urand(2 * IN_MILLISECONDS, 12 * IN_MILLISECONDS);
                 CleaveTimer            = urand(1 * IN_MILLISECONDS, 11 * IN_MILLISECONDS);
-                DemoralizingShoutTimer = urand(2 * IN_MILLISECONDS,  2 * IN_MILLISECONDS);
+                DemoralizingShoutTimer = urand(2 * IN_MILLISECONDS,  3 * IN_MILLISECONDS);
                 Whirlwind1Timer        = urand(1 * IN_MILLISECONDS, 12 * IN_MILLISECONDS);
                 Whirlwind2Timer        = urand(5 * IN_MILLISECONDS, 20 * IN_MILLISECONDS);
                 EnrageTimer            = urand(5 * IN_MILLISECONDS, 20 * IN_MILLISECONDS);
diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp
index 06b2ff9..400d1dd 100644
--- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp
+++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp
@@ -164,7 +164,7 @@ public:

         void Reset()
         {
-            DarkOffering = urand(290, 10);
+            DarkOffering = urand(200, 1000);
         }

         void UpdateAI(uint32 const Diff)
diff --git a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp
index e85c29f..e0abe23 100644
--- a/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp
+++ b/src/server/scripts/Northrend/DraktharonKeep/boss_trollgore.cpp
@@ -85,7 +85,7 @@ public:
             uiConsumeTimer = 15*IN_MILLISECONDS;
             uiAuraCountTimer = 15500;
             uiCrushTimer = urand(1*IN_MILLISECONDS, 5*IN_MILLISECONDS);
-            uiInfectedWoundTimer = urand(60*IN_MILLISECONDS, 10*IN_MILLISECONDS);
+            uiInfectedWoundTimer = urand(10*IN_MILLISECONDS, 60*IN_MILLISECONDS);
             uiExplodeCorpseTimer = 3*IN_MILLISECONDS;
             uiSpawnTimer = urand(30*IN_MILLISECONDS, 40*IN_MILLISECONDS);

diff --git a/src/server/shared/Utilities/Util.cpp b/src/server/shared/Utilities/Util.cpp
index d5bb451..3b10de2 100755
--- a/src/server/shared/Utilities/Util.cpp
+++ b/src/server/shared/Utilities/Util.cpp
@@ -29,19 +29,16 @@ static SFMTRandTSS sfmtRand;

 int32 irand(int32 min, int32 max)
 {
-    assert(max >= min);
     return int32(sfmtRand->IRandom(min, max));
 }

 uint32 urand(uint32 min, uint32 max)
 {
-    assert(max >= min);
     return sfmtRand->URandom(min, max);
 }

 float frand(float min, float max)
 {
-    assert(max >= min);
     return float(sfmtRand->Random() * (max - min) + min);
 }
ImageDev commented 11 years ago

added in commit dd89116b4297fde1947f41c0fd6d4d7f6c79e9e8