summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
author(no author) <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-02-02 04:26:34 +0000
committer(no author) <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-02-02 04:26:34 +0000
commit9b5c358e45804e93eb9e6a9a33a9f8d3cfb4a8eb (patch)
treefd182f66b8d42872dc5aa972448c1256b1314df4 /src/map/script.c
parentc06b6f595d99b11e28e044377edf76ceb19f535c (diff)
downloadhercules-9b5c358e45804e93eb9e6a9a33a9f8d3cfb4a8eb.tar.gz
hercules-9b5c358e45804e93eb9e6a9a33a9f8d3cfb4a8eb.tar.bz2
hercules-9b5c358e45804e93eb9e6a9a33a9f8d3cfb4a8eb.tar.xz
hercules-9b5c358e45804e93eb9e6a9a33a9f8d3cfb4a8eb.zip
* Added crash check for Ice Wall
- reduce mob_data->size variable to 1 bytes - change from if-else to switch statements in buildin_strmobinfo git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1020 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c53
1 files changed, 31 insertions, 22 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 57e02ff9c..0b4374887 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -5550,37 +5550,46 @@ int buildin_strmobinfo(struct script_state *st)
int num=conv_num(st,& (st->stack->stack_data[st->start+2]));
int class_=conv_num(st,& (st->stack->stack_data[st->start+3]));
- if(num<=0 || num>=8 || (class_>=0 && class_<=1000) || class_ >2000)
+ if((class_>=0 && class_<=1000) || class_ >2000)
return 0;
- if(num==1) {
- char *buf;
- buf=aCallocA(24, 1);
-// buf=mob_db[class_].name;
+ switch (num) {
+ case 1:
+ {
+ char *buf;
+ buf=aCallocA(24, 1);
+// buf=mob_db[class_].name;
// for string assignments you would need to go for c++ [Shinomori]
- strcpy(buf,mob_db[class_].name);
- push_str(st->stack,C_STR,buf);
- return 0;
- }
- else if(num==2) {
- char *buf;
- buf=aCallocA(24, 1);
-// buf=mob_db[class_].jname;
+ strcpy(buf,mob_db[class_].name);
+ push_str(st->stack,C_STR,buf);
+ break;
+ }
+ case 2:
+ {
+ char *buf;
+ buf=aCallocA(24, 1);
+// buf=mob_db[class_].jname;
// for string assignments you would need to go for c++ [Shinomori]
- strcpy(buf,mob_db[class_].jname);
- push_str(st->stack,C_STR,buf);
- return 0;
- }
- else if(num==3)
+ strcpy(buf,mob_db[class_].jname);
+ push_str(st->stack,C_STR,buf);
+ break;
+ }
+ case 3:
push_val(st->stack,C_INT,mob_db[class_].lv);
- else if(num==4)
+ break;
+ case 4:
push_val(st->stack,C_INT,mob_db[class_].max_hp);
- else if(num==5)
+ break;
+ case 5:
push_val(st->stack,C_INT,mob_db[class_].max_sp);
- else if(num==6)
+ break;
+ case 6:
push_val(st->stack,C_INT,mob_db[class_].base_exp);
- else if(num==7)
+ break;
+ case 7:
push_val(st->stack,C_INT,mob_db[class_].job_exp);
+ break;
+ }
return 0;
}