summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorshinomori <shinomori@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-02-25 18:06:30 +0000
committershinomori <shinomori@54d463be-8e91-2dee-dedb-b68131a5f0ec>2005-02-25 18:06:30 +0000
commit715a946678a9e44ed56528f822d2e199753b8049 (patch)
treebd5da0b67c1688ea1ab4ddeea1bcf7128198798b /src
parent970ad20d01dccaff33259dc239733753db0018c1 (diff)
downloadhercules-715a946678a9e44ed56528f822d2e199753b8049.tar.gz
hercules-715a946678a9e44ed56528f822d2e199753b8049.tar.bz2
hercules-715a946678a9e44ed56528f822d2e199753b8049.tar.xz
hercules-715a946678a9e44ed56528f822d2e199753b8049.zip
revised npc_event_dequeue; added a check to party share & devel update [Shinomori]
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1175 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/npc.c30
-rw-r--r--src/map/party.c5
-rw-r--r--src/map/pc.h2
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};