浏览代码

Removed the map.h<->status.h cyclic dependency. Relies on the fact by that preprocessor definitions don't need to be expanded immediately (or some other obscure reason why the thing even compiles :D)
This allowed me to also remove the annoying/memory-wasting MAX_STATUSCHANGE define.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@10442 54d463be-8e91-2dee-dedb-b68131a5f0ec

ultramage 18 年之前
父节点
当前提交
51c14f38cd
共有 4 个文件被更改,包括 13 次插入9 次删除
  1. 3 0
      Changelog-Trunk.txt
  2. 3 2
      src/map/map.h
  3. 0 5
      src/map/status.c
  4. 7 2
      src/map/status.h

+ 3 - 0
Changelog-Trunk.txt

@@ -3,6 +3,9 @@ Date	Added
 AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
+2007/05/04
+	* Removed the cyclic map.h<->status.h dependency, which allowed me to 
+	  also remove the annoying/memory-wasting MAX_STATUSCHANGE define
 2007/04/30
 	* Ladmin fixes
 	- Added vs8 project file for ladmin

+ 3 - 2
src/map/map.h

@@ -10,6 +10,7 @@
 #include "../common/db.h"
 
 #include "itemdb.h" // MAX_ITEMGROUP
+#include "status.h" // SC_MAX
 
 //Uncomment to enable the Cell Stack Limit mod.
 //It's only config is the battle_config cell_stack_limit.
@@ -33,7 +34,7 @@
 #define LIFETIME_FLOORITEM 60
 #define DAMAGELOG_SIZE 30
 #define LOOTITEM_SIZE 10
-#define MAX_STATUSCHANGE 300
+//#define MAX_STATUSCHANGE 300
 //Quick defines to know which are the min-max common ailments. [Skotlex]
 //Because of the way the headers are included.. these must be replaced for actual values.
 //Remember to update as needed! Min is SC_STONE and max is SC_DPOISON currently.
@@ -384,7 +385,7 @@ struct status_change_entry {
 };
 
 struct status_change {
-	struct status_change_entry data[MAX_STATUSCHANGE];
+	struct status_change_entry data[SC_MAX];
 	short count;
 	unsigned short opt1,opt2;
 	unsigned int opt3, option; //Note that older packet versions use short here.

+ 0 - 5
src/map/status.c

@@ -7415,11 +7415,6 @@ int status_readdb(void) {
  */
 int do_init_status(void)
 {
-	if (SC_MAX > MAX_STATUSCHANGE)
-	{
-		ShowDebug("status.h defines %d status changes, but the MAX_STATUSCHANGE is %d! Fix it.\n", SC_MAX, MAX_STATUSCHANGE);
-		exit(1);
-	}
 	add_timer_func_list(status_change_timer,"status_change_timer");
 	add_timer_func_list(kaahi_heal_timer,"kaahi_heal_timer");
 	add_timer_func_list(status_natural_heal_timer,"status_natural_heal_timer");

+ 7 - 2
src/map/status.h

@@ -4,7 +4,12 @@
 #ifndef _STATUS_H_
 #define _STATUS_H_
 
-#include "map.h"
+// forward declarations from map.h
+struct block_list;
+struct mob_data;
+struct pet_data;
+struct homun_data;
+struct status_change;
 
 //Use this to refer the max refinery level [Skotlex]
 #define MAX_REFINE 10
@@ -258,7 +263,7 @@ enum {
 	SC_INCAGIRATE,
 	SC_INCDEXRATE,
 	SC_JAILED,
-	SC_ENCHANTARMS,
+	SC_ENCHANTARMS,	//250
 	SC_MAGICALATTACK,
 	SC_MAX, //Automatically updated max, used in for's and at startup to check we are within bounds. [Skotlex]
 };