summaryrefslogtreecommitdiff
path: root/src/map/npc.c
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/map/npc.c
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/map/npc.c')
-rw-r--r--src/map/npc.c30
1 files changed, 24 insertions, 6 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);