Pārlūkot izejas kodu

- 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://svn.code.sf.net/p/rathena/svn/trunk@5166 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex 19 gadi atpakaļ
vecāks
revīzija
7d7c9b8324
6 mainītis faili ar 28 papildinājumiem un 13 dzēšanām
  1. 2 0
      Changelog-Trunk.txt
  2. 12 2
      src/map/battle.c
  3. 2 0
      src/map/battle.h
  4. 2 1
      src/map/map.c
  5. 5 5
      src/map/npc.c
  6. 5 5
      src/map/skill.c

+ 2 - 0
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

+ 12 - 2
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);
+}

+ 2 - 0
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);

+ 2 - 1
src/map/map.c

@@ -3661,6 +3661,7 @@ void do_final(void) {
 	chrif_flush_fifo();
 
 	do_final_atcommand();
+	do_final_battle();
 	do_final_chrif(); // この内部でキャラを全て切断する
 	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();

+ 5 - 5
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

+ 5 - 5
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