summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-03 18:08:16 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-03 18:08:16 +0000
commit7b9cddaed2958e41f570ada6cdaec0cceb5ec103 (patch)
treeadb3fccda7c1a9b8ecd8c1d00878f4ccd66f8932
parent443cecd840029f0b758d32eb3e51d12e555ef0a1 (diff)
downloadhercules-7b9cddaed2958e41f570ada6cdaec0cceb5ec103.tar.gz
hercules-7b9cddaed2958e41f570ada6cdaec0cceb5ec103.tar.bz2
hercules-7b9cddaed2958e41f570ada6cdaec0cceb5ec103.tar.xz
hercules-7b9cddaed2958e41f570ada6cdaec0cceb5ec103.zip
- Removed the flag variable from the npc_data structure. Disabled NPCs are now handled through nd->sc.option&OPTION_INVISIBLE checks. Should fix disable/enablenpc calls not working.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5889 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt2
-rw-r--r--src/map/map.h1
-rw-r--r--src/map/npc.c29
3 files changed, 15 insertions, 17 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index d5424da32..66dd224b6 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -4,6 +4,8 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/04/03
+ * Disabled NPCs are now handled through nd->sc.option&OPTION_INVISIBLE
+ checks. Should fix disable/enablenpc calls not working. [Skotlex]
* Moved skill_counter_additional_effect calls to trigger right after
skill_additional_effect (which means they trigger at the end of the attack
motion for physical attacks instead of at the beginning of the attack
diff --git a/src/map/map.h b/src/map/map.h
index 3c32e4605..a94da16df 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -786,7 +786,6 @@ struct npc_data {
unsigned char name[NAME_LENGTH];
unsigned char exname[NAME_LENGTH];
int chat_id;
- short flag;
unsigned int next_walktime;
char eventqueue[MAX_EVENTQUEUE][50];
diff --git a/src/map/npc.c b/src/map/npc.c
index d58f4ec66..936c04226 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -90,7 +90,7 @@ int npc_enable_sub( struct block_list *bl, va_list ap )
if(bl->type == BL_PC && (sd=(struct map_session_data *)bl)){
char name[50]; // need 24 + 9 for the "::OnTouch"
- if (nd->flag&1) // 無効化されている
+ if (nd->sc.option&OPTION_INVISIBLE) // 無効化されている
return 1;
if(sd->areanpc_id==nd->bl.id)
@@ -110,19 +110,17 @@ int npc_enable(const char *name,int flag)
return 0;
if (flag&1) { // 有効化
- nd->flag&=~1;
- clif_spawn(&nd->bl);
+ nd->sc.option&=~OPTION_INVISIBLE;
+ clif_changeoption(&nd->bl);
}else if (flag&2){
- nd->flag&=~1;
- nd->sc.option = 0x0000;
+ nd->sc.option&=~OPTION_HIDE;
clif_changeoption(&nd->bl);
}else if (flag&4){
- nd->flag|=1;
- nd->sc.option = 0x0002;
+ nd->sc.option = OPTION_HIDE;
+ clif_changeoption(&nd->bl);
+ }else{ //Can't change the view_data to invisible class because the view_data for all npcs is shared! [Skotlex]
+ nd->sc.option = OPTION_INVISIBLE;
clif_changeoption(&nd->bl);
- }else{ // 無効化
- nd->flag|=1;
- clif_clearchar(&nd->bl,0);
}
if(flag&3 && (nd->u.scr.xs > 0 || nd->u.scr.ys >0))
map_foreachinarea( npc_enable_sub,nd->bl.m,nd->bl.x-nd->u.scr.xs,nd->bl.y-nd->u.scr.ys,nd->bl.x+nd->u.scr.xs,nd->bl.y+nd->u.scr.ys,BL_PC,nd);
@@ -859,7 +857,7 @@ int npc_event (struct map_session_data *sd, const unsigned char *eventname, int
}
return 1;
}
- if (nd->flag&1) { // 無効化されている
+ if (nd->sc.option&OPTION_INVISIBLE) { // 無効化されている
npc_event_dequeue(sd);
return 0;
}
@@ -909,7 +907,7 @@ int npc_touch_areanpc(struct map_session_data *sd,int m,int x,int y)
return 1;
for(i=0;i<map[m].npc_num;i++) {
- if (map[m].npc[i]->flag&1) { // 無効化されている
+ if (map[m].npc[i]->sc.option&OPTION_INVISIBLE) { // 無効化されている
f=0;
continue;
}
@@ -1034,7 +1032,8 @@ int npc_click(struct map_session_data *sd,int id)
nd=(struct npc_data *)map_id2bl(id);
- if (nd->flag&1) // 無効化されている
+ //Disabled npc.
+ if (nd->sc.option&OPTION_INVISIBLE)
return 1;
sd->npc_id=id;
@@ -1093,7 +1092,7 @@ int npc_buysellsel(struct map_session_data *sd,int id,int type)
sd->npc_id=0;
return 1;
}
- if (nd->flag&1) // 無効化されている
+ if (nd->sc.option&OPTION_INVISIBLE) // 無効化されている
return 1;
sd->npc_shopid=id;
@@ -1570,7 +1569,6 @@ static int npc_parse_shop (char *w1, char *w2, char *w3, char *w4)
nd->bl.x = x;
nd->bl.y = y;
nd->bl.id = npc_get_new_npc_id();
- nd->flag = 0;
memcpy(nd->name, w3, NAME_LENGTH-1);
nd->name[NAME_LENGTH-1] = '\0';
nd->class_ = m==-1?-1:atoi(w4);
@@ -1874,7 +1872,6 @@ static int npc_parse_script (char *w1,char *w2,char *w3,char *w4,char *first_lin
nd->bl.x = x;
nd->bl.y = y;
nd->bl.id = npc_get_new_npc_id();
-// nd->flag = 0;
nd->class_ = class_;
nd->speed = 200;
nd->u.scr.script = script;