From f3ac07ef1c9f6224f985d5bff2f405f6bc9bf226 Mon Sep 17 00:00:00 2001 From: ultramage Date: Sat, 6 Oct 2007 15:35:31 +0000 Subject: * the mapserver won't exit when no mapcache is found, with use_grf: yes * Fixed some \r uses, now looks better; /thx to Ai4rei (topic:165952) * Removed that ridiculous spinner that displays during map/npc loading, and added a more informative progress indicator (idea from jA/eapp) * Checked/fixed/removed some old script and npc commands * cmdothernpc - a specialized 'donpcevent' with the event specified as two arguments * enablearena/disablearena - completely equivalent to enablewaitingroomevent & co. * inittimer/stoptimer - removed since its logic was incompatible with the code it depended on * Removed loads of code that supported these functions. Result: -100b per npc => -1,5MB of wasted memory * Fixed related npcs that erroneously used 'stoptimer' git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11374 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/pc.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) (limited to 'src/map/pc.c') diff --git a/src/map/pc.c b/src/map/pc.c index 9acfd92a3..d30f41873 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -6198,13 +6198,14 @@ static int pc_eventtimer(int tid,unsigned int tick,int id,int data) if(sd==NULL) return 0; - for(i=0;i < MAX_EVENTTIMER && sd->eventtimer[i]!=tid; i++); - - if(i < MAX_EVENTTIMER){ + ARR_FIND( 0, MAX_EVENTTIMER, i, sd->eventtimer[i] == tid ); + if( i < MAX_EVENTTIMER ) + { + sd->eventtimer[i] = -1; sd->eventcount--; - sd->eventtimer[i]=-1; npc_event(sd,p,0); - } else if(battle_config.error_log) + } + else if( battle_config.error_log ) ShowError("pc_eventtimer: no such event timer\n"); if (p) aFree(p); @@ -6217,18 +6218,15 @@ static int pc_eventtimer(int tid,unsigned int tick,int id,int data) int pc_addeventtimer(struct map_session_data *sd,int tick,const char *name) { int i; - char *evname; - + char* evname; nullpo_retr(0, sd); - for(i=0;ieventtimer[i]!=-1;i++); - - if(i==MAX_EVENTTIMER) + ARR_FIND( 0, MAX_EVENTTIMER, i, sd->eventtimer[i] == -1 ); + if( i == MAX_EVENTTIMER ) return 0; evname = aStrdup(name); - sd->eventtimer[i]=add_timer(gettick()+tick, - pc_eventtimer,sd->bl.id,(int)evname); + sd->eventtimer[i] = add_timer(gettick()+tick, pc_eventtimer,sd->bl.id,(int)evname); sd->eventcount++; return 1; -- cgit v1.2.3-60-g2f50