diff options
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 |
commit | 9b5c358e45804e93eb9e6a9a33a9f8d3cfb4a8eb (patch) | |
tree | fd182f66b8d42872dc5aa972448c1256b1314df4 /src/map | |
parent | c06b6f595d99b11e28e044377edf76ceb19f535c (diff) | |
download | hercules-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')
-rw-r--r-- | src/map/clif.c | 2 | ||||
-rw-r--r-- | src/map/map.h | 2 | ||||
-rw-r--r-- | src/map/script.c | 53 |
3 files changed, 33 insertions, 24 deletions
diff --git a/src/map/clif.c b/src/map/clif.c index 288ac3b28..87aa1ff5e 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -3887,7 +3887,7 @@ int clif_clearchar_skillunit(struct skill_unit *unit,int fd) WFIFOW(fd, 0)=0x120; WFIFOL(fd, 2)=unit->bl.id; WFIFOSET(fd,packet_len_table[0x120]); - if(unit->group->skill_id == WZ_ICEWALL) + if(unit->group && unit->group->skill_id == WZ_ICEWALL) clif_set0192(fd,unit->bl.m,unit->bl.x,unit->bl.y,unit->val2); return 0; diff --git a/src/map/map.h b/src/map/map.h index 565f68dbc..5944167ad 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -456,7 +456,7 @@ struct mob_data { struct skill_unit_group skillunit[MAX_MOBSKILLUNITGROUP]; struct skill_unit_group_tickset skillunittick[MAX_SKILLUNITGROUPTICKSET]; char npc_event[50]; - short size; + unsigned char size; int owner; }; struct pet_data { 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; } |