summaryrefslogtreecommitdiff
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
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
-rw-r--r--Changelog-Trunk.txt2
-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
6 files changed, 28 insertions, 13 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 1d37d805b..3b101c853 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -5,6 +5,8 @@ IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK. EV
GOES INTO TRUNK AND WILL BE MERGED INTO STABLE BY VALARIS AND WIZPUTER. -- VALARIS
2006/02/02
+ * Applied the Entry Reusage System to the battle delay damage timers.
+ [Skotlex]
* Fixed the map server complain when using the default user/password
showing up if you set the new user/pass on the import file. [Skotlex]
2006/02/01
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