diff options
-rw-r--r-- | Changelog.txt | 2 | ||||
-rw-r--r-- | src/map/npc.c | 25 | ||||
-rw-r--r-- | src/map/skill.c | 2 |
3 files changed, 18 insertions, 11 deletions
diff --git a/Changelog.txt b/Changelog.txt index 11b7d012a..9b3c33647 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,6 +1,8 @@ Date Added 02/05 + * optimizing OnTouch event name generation [Shinomori] + * fixing Celests Sharp Shooting [Shinomori] * Updated Sharp Shooting AoE code, thanks to Neodis / k-Athena [celest] - Update: Adapt jA's path_search algorithm and removed the need of struct 'dev' in map_session_data diff --git a/src/map/npc.c b/src/map/npc.c index 95788a2cd..12906a1fc 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -69,23 +69,25 @@ int npc_enable_sub( struct block_list *bl, va_list ap ) { struct map_session_data *sd; struct npc_data *nd; - char *name=(char *)aCallocA(50,sizeof(char)); + //char *name=(char *)aCallocA(50,sizeof(char)); // fixed [Shinomori] nullpo_retr(0, bl); nullpo_retr(0, ap); nullpo_retr(0, nd=va_arg(ap,struct npc_data *)); if(bl->type == BL_PC && (sd=(struct map_session_data *)bl)){ + char name[50]; // need 24 + 9 for the "::OnTouch" if (nd->flag&1) // 無効化されている return 1; - memcpy(name,nd->name,50); if(sd->areanpc_id==nd->bl.id) return 1; sd->areanpc_id=nd->bl.id; - npc_event(sd,strcat(name,"::OnTouch"),0); + + sprintf(name,"%s::OnTouch", nd->name); + npc_event(sd,name,0); } - aFree(name); + //aFree(name); return 0; } int npc_enable(const char *name,int flag) @@ -825,15 +827,18 @@ int npc_touch_areanpc(struct map_session_data *sd,int m,int x,int y) break; case SCRIPT: { - char *name=(char *)aCallocA(50,sizeof(char)); + //char *name=(char *)aCallocA(50,sizeof(char)); // fixed [Shinomori] + char name[50]; // need 24 max + 9 for "::OnTouch" - memcpy(name,map[m].npc[i]->name,50); - if(sd->areanpc_id==map[m].npc[i]->bl.id) + if(sd->areanpc_id == map[m].npc[i]->bl.id) return 1; - sd->areanpc_id=map[m].npc[i]->bl.id; - if(npc_event(sd,strcat(name,"::OnTouch"),0)>0) + sd->areanpc_id = map[m].npc[i]->bl.id; + + sprintf(name,"%s::OnTouch", map[m].npc[i]->name); + + if( npc_event(sd,name,0)>0 ) npc_click(sd,map[m].npc[i]->bl.id); - aFree(name); + //aFree(name); break; } } diff --git a/src/map/skill.c b/src/map/skill.c index d4963e521..aab8a77d4 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -2310,7 +2310,7 @@ int skill_castend_damage_id( struct block_list* src, struct block_list *bl,int s } dy = (y1 - y0); weight = dx > abs(dy) ? dx : abs(y1 - y0); - while ((x0 != x1 || y0 != y1) && num < skill_get_range(skillid)) { + while ((x0 != x1 || y0 != y1) && num < skill_get_range(skillid,skilllv)) { // fixed [Shinomori] wx += dx; wy += dy; if (wx >= weight) { |