summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Changelog.txt5
-rw-r--r--src/map/clif.c2
-rw-r--r--src/map/map.h2
-rw-r--r--src/map/script.c53
4 files changed, 38 insertions, 24 deletions
diff --git a/Changelog.txt b/Changelog.txt
index 2ca350948..69debaf75 100644
--- a/Changelog.txt
+++ b/Changelog.txt
@@ -1,4 +1,9 @@
Date Added
+02/02
+ * Added crash check for Ice Wall [celest]
+ * Added some optimisations by Ilpalazzo-sama [celest]
+ - reduce mob_data->size variable to 1 bytes
+ - change from if-else to switch statements in buildin_strmobinfo
01/31
* Fixed a typo in Pressure causing it to deduct sp from the caster, and remove
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;
}