summaryrefslogtreecommitdiff
path: root/src/map/battle.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-02-02 15:35:27 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-02-02 15:35:27 +0000
commitcba97f4deb4a9bb62da4ab7748926fd5319090d0 (patch)
tree8bf8b528b764622c0a604e6dca7435c0b6ca8acf /src/map/battle.c
parentabb64efe8b339b84991eefd22757b31d8cdc2499 (diff)
downloadhercules-cba97f4deb4a9bb62da4ab7748926fd5319090d0.tar.gz
hercules-cba97f4deb4a9bb62da4ab7748926fd5319090d0.tar.bz2
hercules-cba97f4deb4a9bb62da4ab7748926fd5319090d0.tar.xz
hercules-cba97f4deb4a9bb62da4ab7748926fd5319090d0.zip
- Fixed some includes in skill.c and npc.c, thanks to 252-rer for finding it out.
- Applied the entry reusage system to the battle delay damage structure. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5166 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/battle.c')
-rw-r--r--src/map/battle.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/map/battle.c b/src/map/battle.c
index 39256a8f2..1f22f6c79 100644
--- a/src/map/battle.c
+++ b/src/map/battle.c
@@ -11,6 +11,7 @@
#include "../common/nullpo.h"
#include "../common/malloc.h"
#include "../common/showmsg.h"
+#include "../common/ers.h"
#include "map.h"
#include "pc.h"
@@ -28,6 +29,7 @@
int attr_fix_table[4][10][10];
struct Battle_Config battle_config;
+static struct eri *delay_damage_ers; //For battle delay damage structures.
/*==========================================
* Ž©•ª‚ðƒ?ƒbƒN‚µ‚Ä‚¢‚éMOB‚Ì?‚ð?‚¦‚é(foreachclient)
@@ -202,7 +204,7 @@ int battle_delay_damage_sub (int tid, unsigned int tick, int id, int data)
if (!status_isdead(target) && (dat->dmg_lv == ATK_DEF || dat->damage > 0) && dat->attack_type)
skill_additional_effect(dat->src,target,dat->skill_id,dat->skill_lv,dat->attack_type, tick);
}
- aFree(dat);
+ ers_free(delay_damage_ers, dat);
return 0;
}
@@ -218,7 +220,7 @@ int battle_delay_damage (unsigned int tick, struct block_list *src, struct block
skill_additional_effect(src, target, skill_id, skill_lv, attack_type, gettick());
return 0;
}
- dat = (struct delay_damage *)aCalloc(1, sizeof(struct delay_damage));
+ dat = ers_alloc(delay_damage_ers, struct delay_damage);
dat->src = src;
dat->target = target->id;
dat->skill_id = skill_id;
@@ -4437,3 +4439,11 @@ int battle_config_read(const char *cfgName)
return 0;
}
+
+void do_init_battle(void) {
+ delay_damage_ers = ers_new((uint32)sizeof(struct delay_damage));
+}
+
+void do_final_battle(void) {
+ ers_destroy(delay_damage_ers);
+}