diff options
author | Haru <haru@dotalux.com> | 2019-04-07 20:38:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-07 20:38:12 +0200 |
commit | 8986b6584cf21cec55260a242a2631843b7fdaee (patch) | |
tree | 093ac1cb791a63101a3f1741983c5546d76bbfb5 /src | |
parent | 73dacb74a8d2ed52590a6d6b8b937d9e14f77d8e (diff) | |
parent | ac3e75d1b296bb965d9b5a4290a7fd0a0024e57c (diff) | |
download | hercules-8986b6584cf21cec55260a242a2631843b7fdaee.tar.gz hercules-8986b6584cf21cec55260a242a2631843b7fdaee.tar.bz2 hercules-8986b6584cf21cec55260a242a2631843b7fdaee.tar.xz hercules-8986b6584cf21cec55260a242a2631843b7fdaee.zip |
Merge pull request #2403 from AnnieRuru/72-rand
Fix rand() not support on certain compiler
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/sample.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/plugins/sample.c b/src/plugins/sample.c index b37f7c4f7..7ad6794b3 100644 --- a/src/plugins/sample.c +++ b/src/plugins/sample.c @@ -23,6 +23,7 @@ #include "common/hercules.h" /* Should always be the first Hercules file included! (if you don't make it first, you won't be able to use interfaces) */ #include "common/memmgr.h" #include "common/mmo.h" +#include "common/random.h" #include "common/socket.h" #include "common/strlib.h" #include "map/clif.h" @@ -79,13 +80,13 @@ void sample_packet0f3(int fd) { data->lastMSGPosition.map = sd->status.last_point.map; data->lastMSGPosition.x = sd->status.last_point.x; data->lastMSGPosition.y = sd->status.last_point.y; - data->someNumber = rand()%777; + data->someNumber = rnd()%777; ShowInfo("Created Appended sockt->session[] data, %d %d %d %u\n",data->lastMSGPosition.map,data->lastMSGPosition.x,data->lastMSGPosition.y,data->someNumber); addToSession(sockt->session[fd],data,0,true); } else { ShowInfo("Existent Appended sockt->session[] data, %d %d %d %u\n",data->lastMSGPosition.map,data->lastMSGPosition.x,data->lastMSGPosition.y,data->someNumber); - if( rand()%4 == 2 ) { + if (rnd()%4 == 2) { ShowInfo("Removing Appended sockt->session[] data\n"); removeFromSession(sockt->session[fd],0); } @@ -98,13 +99,13 @@ void sample_packet0f3(int fd) { data->lastMSGPosition.map = sd->status.last_point.map; data->lastMSGPosition.x = sd->status.last_point.x; data->lastMSGPosition.y = sd->status.last_point.y; - data->someNumber = rand()%777; + data->someNumber = rnd()%777; ShowInfo("Created Appended map_session_data data, %d %d %d %u\n",data->lastMSGPosition.map,data->lastMSGPosition.x,data->lastMSGPosition.y,data->someNumber); addToMSD(sd,data,0,true); } else { ShowInfo("Existent Appended map_session_data data, %d %d %d %u\n",data->lastMSGPosition.map,data->lastMSGPosition.x,data->lastMSGPosition.y,data->someNumber); - if( rand()%4 == 2 ) { + if (rnd()%4 == 2) { ShowInfo("Removing Appended map_session_data data\n"); removeFromMSD(sd,0); } |