summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authoramber <amber@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-12-26 19:44:00 +0000
committeramber <amber@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-12-26 19:44:00 +0000
commitd73cbd4c778f408ce3e06c57ad6418b99e2b9c51 (patch)
tree7e0eccf71218102b49424879e1ff6d8bf5ae05af /src/map/pc.c
parent23180e04bdb7a2dfb95da6fb6ab0026fb4ea8b0d (diff)
downloadhercules-d73cbd4c778f408ce3e06c57ad6418b99e2b9c51.tar.gz
hercules-d73cbd4c778f408ce3e06c57ad6418b99e2b9c51.tar.bz2
hercules-d73cbd4c778f408ce3e06c57ad6418b99e2b9c51.tar.xz
hercules-d73cbd4c778f408ce3e06c57ad6418b99e2b9c51.zip
updates
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@793 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index d314d2e30..881d302c5 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -183,7 +183,6 @@ int pc_delinvincibletimer(struct map_session_data *sd) {
static int pc_spiritball_timer(int tid,unsigned int tick,int id,int data) {
struct map_session_data *sd;
- int i;
if( (sd=(struct map_session_data *)map_id2sd(id)) == NULL || sd->bl.type!=BL_PC )
return 1;
@@ -193,22 +192,24 @@ static int pc_spiritball_timer(int tid,unsigned int tick,int id,int data) {
printf("spirit_timer %d != %d\n",sd->spirit_timer[0],tid);
return 0;
}
- sd->spirit_timer[0]=-1;
- for(i=1;i<sd->spiritball;i++) {
- sd->spirit_timer[i-1] = sd->spirit_timer[i];
- sd->spirit_timer[i] = -1;
+
+ if(sd->spiritball <= 0) {
+ if(battle_config.error_log)
+ printf("Spiritballs are already 0 when pc_spiritball_timer gets called");
+ sd->spiritball = 0;
+ return 0;
}
+
sd->spiritball--;
- if(sd->spiritball < 0)
- sd->spiritball = 0;
+ memcpy( &sd->spirit_timer[0], &sd->spirit_timer[1], sizeof(sd->spirit_timer[0]) * sd->spiritball );
+ sd->spirit_timer[sd->spiritball]=-1;
+
clif_spiritball(sd);
return 0;
}
int pc_addspiritball(struct map_session_data *sd,int interval,int max) {
- int i;
-
nullpo_retr(0, sd);
if(max > MAX_SKILL_LEVEL)
@@ -217,16 +218,10 @@ int pc_addspiritball(struct map_session_data *sd,int interval,int max) {
sd->spiritball = 0;
if(sd->spiritball >= max) {
- if(sd->spirit_timer[0] != -1) {
+ if(sd->spirit_timer[0] != -1)
delete_timer(sd->spirit_timer[0],pc_spiritball_timer);
- sd->spirit_timer[0] = -1;
- }
- for(i=1;i<max;i++) {
- sd->spirit_timer[i-1] = sd->spirit_timer[i];
- sd->spirit_timer[i] = -1;
- }
- }
- else
+ memcpy( &sd->spirit_timer[0], &sd->spirit_timer[1], sizeof(sd->spirit_timer[0]) * (sd->spiritball - 1));
+ } else
sd->spiritball++;
sd->spirit_timer[sd->spiritball-1] = add_timer(gettick()+interval,pc_spiritball_timer,sd->bl.id,0);