summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-10-06 15:35:31 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-10-06 15:35:31 +0000
commitf3ac07ef1c9f6224f985d5bff2f405f6bc9bf226 (patch)
tree0bfc02f8ef4c4a924296958465ae1ec480aa7c17 /src/map/pc.c
parent688dc3e7034d4cdbb9a6f62879a2dcdc84ec8180 (diff)
downloadhercules-f3ac07ef1c9f6224f985d5bff2f405f6bc9bf226.tar.gz
hercules-f3ac07ef1c9f6224f985d5bff2f405f6bc9bf226.tar.bz2
hercules-f3ac07ef1c9f6224f985d5bff2f405f6bc9bf226.tar.xz
hercules-f3ac07ef1c9f6224f985d5bff2f405f6bc9bf226.zip
* 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
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c22
1 files changed, 10 insertions, 12 deletions
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;i<MAX_EVENTTIMER && sd->eventtimer[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;