diff options
author | (no author) <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-02-05 14:29:00 +0000 |
---|---|---|
committer | (no author) <(no author)@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-02-05 14:29:00 +0000 |
commit | 34be37c4999ba473601bf7330cb73984298e61b8 (patch) | |
tree | 3b8787e2e09899f0849345bde52d2fff8c191229 /src/map | |
parent | 3eb666be67a0a786ae11180570b9f08a098c453c (diff) | |
download | hercules-34be37c4999ba473601bf7330cb73984298e61b8.tar.gz hercules-34be37c4999ba473601bf7330cb73984298e61b8.tar.bz2 hercules-34be37c4999ba473601bf7330cb73984298e61b8.tar.xz hercules-34be37c4999ba473601bf7330cb73984298e61b8.zip |
optimizing OnTouch event name generation, fixing Celests Sharp Shooting [Shinomori]
Adding my dev-branch [Shinomori]
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1043 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/npc.c | 25 | ||||
-rw-r--r-- | src/map/skill.c | 2 |
2 files changed, 16 insertions, 11 deletions
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) { |