diff options
-rw-r--r-- | src/map/npc.c | 30 | ||||
-rw-r--r-- | src/map/party.c | 5 | ||||
-rw-r--r-- | src/map/pc.h | 2 |
3 files changed, 29 insertions, 8 deletions
diff --git a/src/map/npc.c b/src/map/npc.c index 54a35c51c..70f1e3dbb 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -135,17 +135,35 @@ int npc_event_dequeue(struct map_session_data *sd) sd->npc_id=0; if (sd->eventqueue[0][0]) { // キューのイベント処理 - char *name=(char *)aCallocA(50,sizeof(char)); - int i; + size_t ev; + + // find an empty place in eventtimer list + for(ev=0;ev<MAX_EVENTTIMER;ev++) + if( sd->eventtimer[ev]==-1 ) + break; + if(ev<MAX_EVENTTIMER) + { // generate and insert the timer + int i; + // copy the first event name + char *name=(char *)aMalloc(50*sizeof(char)); + memcpy(name,sd->eventqueue[0],50); + // shift queued events down by one + for(i=1;i<MAX_EVENTQUEUE;i++) + memcpy(sd->eventqueue[i-1],sd->eventqueue[i],50); + // clear the last event + sd->eventqueue[MAX_EVENTQUEUE-1][0]=0; + // add the timer + sd->eventtimer[ev]=add_timer(gettick()+100,pc_eventtimer,sd->bl.id,(int)name);//!!todo!! - memcpy(name,sd->eventqueue[0],50); - for(i=MAX_EVENTQUEUE-2;i>=0;i--) - memcpy(sd->eventqueue[i],sd->eventqueue[i+1],50); - add_timer(gettick()+100,npc_event_timer,sd->bl.id,(int)name); + }else + ShowMessage("npc_event_dequeue: event timer is full !\n"); } return 0; } + + + int npc_delete(struct npc_data *nd) { nullpo_retr(1, nd); diff --git a/src/map/party.c b/src/map/party.c index 85774c33b..5caff4be1 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -587,12 +587,13 @@ int party_exp_share(struct party *p,int map,int base_exp,int job_exp,int zeny) nullpo_retr(0, p); for(i=c=0;i<MAX_PARTY;i++) - if((sd=p->member[i].sd)!=NULL && sd->bl.m==map) + if((sd=p->member[i].sd)!=NULL && p->member[i].online && sd->bl.m==map && session[sd->fd] != NULL) c++; + if(c==0) return 0; for(i=0;i<MAX_PARTY;i++) - if((sd=p->member[i].sd)!=NULL && sd->bl.m==map && session[sd->fd] != NULL) { + if((sd=p->member[i].sd)!=NULL && p->member[i].online && sd->bl.m==map && session[sd->fd] != NULL) { if (/* pc_issit(sd) || */ sd->chatID || (sd->idletime < (tick_ - 120))) continue; #ifdef TWILIGHT diff --git a/src/map/pc.h b/src/map/pc.h index d3a298427..4461dcb6c 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -199,6 +199,8 @@ int pc_delinvincibletimer(struct map_session_data *sd); int pc_addspiritball(struct map_session_data *sd,int,int); int pc_delspiritball(struct map_session_data *sd,int,int); +int pc_eventtimer(int tid,unsigned long tick,int id,int data); // for npc_dequeue + int do_init_pc(void); enum {ADDITEM_EXIST,ADDITEM_NEW,ADDITEM_OVERAMOUNT}; |