summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-11-06 22:43:15 +0000
committerultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec>2007-11-06 22:43:15 +0000
commit53ff28bfc805862d09f32fa2f7b4330c7365e084 (patch)
treefd040b522986dba5845a735d79cac5c18b5a8263 /src/map
parent54eb27fc3e1e3635e0905a2fc5735a2c77b19d98 (diff)
downloadhercules-53ff28bfc805862d09f32fa2f7b4330c7365e084.tar.gz
hercules-53ff28bfc805862d09f32fa2f7b4330c7365e084.tar.bz2
hercules-53ff28bfc805862d09f32fa2f7b4330c7365e084.tar.xz
hercules-53ff28bfc805862d09f32fa2f7b4330c7365e084.zip
Fixed a crash caused by a mistake in r11657 (bad macro -> function code conversion)
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11690 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/skill.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/map/skill.c b/src/map/skill.c
index d63269a7b..15c49c915 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -91,15 +91,17 @@ const char* skill_get_desc( int id )
return skill_db[skill_get_index(id)].desc;
}
-// macros to check for out of bounds errors [celest]
+// out of bounds error checking [celest]
// i: Skill ID, l: Skill Level, var: Value to return after checking
// for values that don't require level just put a one (putting 0 will trigger return 0; instead
// for values that might need to use a different function just skill_chk would suffice.
-#define skill_chk(i,l) \
- if (skill_get_index(i) == 0) return 0; \
- if (l <= 0 || l > MAX_SKILL_LEVEL) return 0;
-#define skill_get(var,i,l) \
- { skill_chk((i), (l)); return (var); }
+static void skill_chk(int* id, int lv)
+{
+ *id = skill_get_index(*id); // checks/adjusts id
+ if( lv <= 0 || lv > MAX_SKILL_LEVEL ) *id = 0;
+}
+
+#define skill_get(var,id,lv) { skill_chk(&id,lv); if(!id) return 0; return var; }
// Skill DB
int skill_get_hit( int id ) { skill_get (skill_db[id].hit, id, 1); }
@@ -108,7 +110,7 @@ int skill_get_ele( int id , int lv ) { skill_get (skill_db[id].element[lv-1
int skill_get_nk( int id ) { skill_get (skill_db[id].nk, id, 1); }
int skill_get_max( int id ) { skill_get (skill_db[id].max, id, 1); }
int skill_get_range( int id , int lv ) { skill_get (skill_db[id].range[lv-1], id, lv); }
-int skill_get_splash( int id , int lv ) { skill_chk (id, lv); return (skill_db[id].splash[lv-1]>=0?skill_db[id].splash[lv-1]:AREA_SIZE); }
+int skill_get_splash( int id , int lv ) { skill_chk (&id, lv); return (skill_db[id].splash[lv-1]>=0?skill_db[id].splash[lv-1]:AREA_SIZE); }
int skill_get_hp( int id ,int lv ) { skill_get (skill_db[id].hp[lv-1], id, lv); }
int skill_get_sp( int id ,int lv ) { skill_get (skill_db[id].sp[lv-1], id, lv); }
int skill_get_hp_rate(int id, int lv ) { skill_get (skill_db[id].hp_rate[lv-1], id, lv); }