summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/map/battle.c14
-rw-r--r--src/map/battle.h2
-rw-r--r--src/map/map.c3
-rw-r--r--src/map/npc.c10
-rw-r--r--src/map/skill.c10
5 files changed, 26 insertions, 13 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);
+}
diff --git a/src/map/battle.h b/src/map/battle.h
index 56404f0c9..e59cd9bd2 100644
--- a/src/map/battle.h
+++ b/src/map/battle.h
@@ -418,6 +418,8 @@ extern struct Battle_Config {
unsigned short cell_stack_limit; // [Skotlex]
} battle_config;
+void do_init_battle(void);
+void do_final_battle(void);
extern int battle_config_read(const char *cfgName);
extern void battle_validate_conf(void);
extern void battle_set_defaults(void);
diff --git a/src/map/map.c b/src/map/map.c
index 4e77e9d23..222ada48a 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -3661,6 +3661,7 @@ void do_final(void) {
chrif_flush_fifo();
do_final_atcommand();
+ do_final_battle();
do_final_chrif(); // ‚±‚Ì“à•”‚ŃLƒƒƒ‰‚ð‘S‚ÄØ’f‚·‚é
do_final_npc();
// map_removenpc();
@@ -3870,6 +3871,7 @@ int do_init(int argc, char *argv[]) {
add_timer_interval(gettick()+1000, map_freeblock_timer, 0, 0, 60*1000);
do_init_atcommand();
+ do_init_battle();
do_init_chrif();
do_init_clif();
do_init_script();
@@ -3883,7 +3885,6 @@ int do_init(int argc, char *argv[]) {
do_init_skill();
do_init_pet();
do_init_npc();
-
#ifndef TXT_ONLY /* mail system [Valaris] */
if(mail_server_enable)
do_init_mail();
diff --git a/src/map/npc.c b/src/map/npc.c
index bcf66db6c..2cec45a8d 100644
--- a/src/map/npc.c
+++ b/src/map/npc.c
@@ -8,9 +8,11 @@
#include <math.h>
#include <time.h>
-#include "timer.h"
-#include "nullpo.h"
-#include "malloc.h"
+#include "../common/timer.h"
+#include "../common/nullpo.h"
+#include "../common/malloc.h"
+#include "../common/grfio.h"
+#include "../common/showmsg.h"
#include "map.h"
#include "log.h"
#include "npc.h"
@@ -24,8 +26,6 @@
#include "pet.h"
#include "battle.h"
#include "skill.h"
-#include "grfio.h"
-#include "showmsg.h"
#ifdef _WIN32
#undef isspace
diff --git a/src/map/skill.c b/src/map/skill.c
index f1e29c5c3..22a0ac5dc 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -6,9 +6,11 @@
#include <string.h>
#include <time.h>
-#include "timer.h"
-#include "nullpo.h"
-#include "malloc.h"
+#include "../common/timer.h"
+#include "../common/nullpo.h"
+#include "../common/malloc.h"
+#include "../common/showmsg.h"
+#include "../common/grfio.h"
#include "skill.h"
#include "map.h"
@@ -25,8 +27,6 @@
#include "log.h"
#include "chrif.h"
#include "guild.h"
-#include "showmsg.h"
-#include "grfio.h"
#include "date.h"
#define SKILLUNITTIMER_INVERVAL 100