summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorcelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-04-06 09:00:18 +0000
committercelest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-04-06 09:00:18 +0000
commitb1a8b920af2b39f546cd3408af893741fc94e12b (patch)
treedf3f463a7b0b48bec7d366e7564461f1e224ad27 /src/map/script.c
parentcb2bb1dc2f9b4efc8925542c6162adcedac9c0b1 (diff)
downloadhercules-b1a8b920af2b39f546cd3408af893741fc94e12b.tar.gz
hercules-b1a8b920af2b39f546cd3408af893741fc94e12b.tar.bz2
hercules-b1a8b920af2b39f546cd3408af893741fc94e12b.tar.xz
hercules-b1a8b920af2b39f546cd3408af893741fc94e12b.zip
* Skip partner checking when calculating status with Marionette Control on
* Fixed plagiarised skills become unuseable after saving character * Fixed double skill fail messages for stone curse * Added modulus by zero check to rand() git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1419 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 1a0a1d1c1..9602f3505 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -1772,21 +1772,23 @@ int buildin_menu(struct script_state *st)
*/
int buildin_rand(struct script_state *st)
{
- int range,min,max;
-
- if(st->end>st->start+3){
- min=conv_num(st,& (st->stack->stack_data[st->start+2]));
- max=conv_num(st,& (st->stack->stack_data[st->start+3]));
- if(max<min){
- int tmp;
- tmp=min;
- min=max;
- max=tmp;
+ int range;
+
+ if (st->end > st->start+3){
+ int min, max;
+ min = conv_num(st,& (st->stack->stack_data[st->start+2]));
+ max = conv_num(st,& (st->stack->stack_data[st->start+3]));
+ if (max < min){
+ int tmp = min;
+ min = max;
+ max = tmp;
}
- range=max-min+1;
+ range = max - min + 1;
+ if (range == 0) range = 1;
push_val(st->stack,C_INT,rand()%range+min);
} else {
- range=conv_num(st,& (st->stack->stack_data[st->start+2]));
+ range = conv_num(st,& (st->stack->stack_data[st->start+2]));
+ if (range == 0) range = 1;
push_val(st->stack,C_INT,rand()%range);
}
return 0;