summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormarkzd <markzd@54d463be-8e91-2dee-dedb-b68131a5f0ec>2013-01-05 04:45:53 +0000
committermarkzd <markzd@54d463be-8e91-2dee-dedb-b68131a5f0ec>2013-01-05 04:45:53 +0000
commit59029a6c7a0365521aa80519081fdfc7d958cca0 (patch)
treee096f8d20d0bbb2bcae2fa93de15d5cf4da8196a /src
parent39b04a578b2a74f9e48b0eb2583c249f98c9404d (diff)
downloadhercules-59029a6c7a0365521aa80519081fdfc7d958cca0.tar.gz
hercules-59029a6c7a0365521aa80519081fdfc7d958cca0.tar.bz2
hercules-59029a6c7a0365521aa80519081fdfc7d958cca0.tar.xz
hercules-59029a6c7a0365521aa80519081fdfc7d958cca0.zip
* Follow up r17065
1. Removed some unnecessary checks.(bugreport:7078) 2. Fixed some index's which would access an invalid array position, crashing the server. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@17077 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/map/map.h2
-rw-r--r--src/map/mob.h2
-rw-r--r--src/map/script.c2
-rw-r--r--src/map/skill.c11
-rw-r--r--src/map/unit.c2
5 files changed, 10 insertions, 9 deletions
diff --git a/src/map/map.h b/src/map/map.h
index 9d48dd445..86d936972 100644
--- a/src/map/map.h
+++ b/src/map/map.h
@@ -32,7 +32,7 @@ enum E_MAPSERVER_ST
#define AREA_SIZE battle_config.area_size
#define DAMAGELOG_SIZE 30
#define LOOTITEM_SIZE 10
-#define MAX_MOBSKILL 50
+#define MAX_MOBSKILL 50 //Max 128, see mob skill_idx type if need this higher
#define MAX_MOB_LIST_PER_MAP 128
#define MAX_EVENTQUEUE 2
#define MAX_EVENTTIMER 32
diff --git a/src/map/mob.h b/src/map/mob.h
index 1dbed9f53..34e5a81c0 100644
--- a/src/map/mob.h
+++ b/src/map/mob.h
@@ -175,7 +175,7 @@ struct mob_data {
int deletetimer;
int master_id,master_dist;
- uint16 skill_idx;
+ int8 skill_idx;// key of array
unsigned int skilldelay[MAX_MOBSKILL];
char npc_event[EVENT_NAME_LENGTH];
/**
diff --git a/src/map/script.c b/src/map/script.c
index 3409d44db..a918bc853 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -16693,7 +16693,7 @@ BUILDIN_FUNC(pushpc)
dir = script_getnum(st,2);
cells = script_getnum(st,3);
- if(dir<0 || dir>7)
+ if(dir>7)
{
ShowWarning("buildin_pushpc: Invalid direction %d specified.\n", dir);
script_reportsrc(st);
diff --git a/src/map/skill.c b/src/map/skill.c
index 8241aa55f..13e92943e 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -724,7 +724,7 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, uint
nullpo_ret(src);
nullpo_ret(bl);
- if(skill_id > 0 && skill_lv <= 0) return 0; // don't forget auto attacks! - celest
+ if(skill_id > 0 && !skill_lv) return 0; // don't forget auto attacks! - celest
if( dmg_lv < ATK_BLOCK ) // Don't apply effect if miss.
return 0;
@@ -1745,7 +1745,7 @@ int skill_counter_additional_effect (struct block_list* src, struct block_list *
nullpo_ret(src);
nullpo_ret(bl);
- if(skill_id > 0 && skill_lv <= 0) return 0; // don't forget auto attacks! - celest
+ if(skill_id > 0 && !skill_lv) return 0; // don't forget auto attacks! - celest
sd = BL_CAST(BL_PC, src);
dstsd = BL_CAST(BL_PC, bl);
@@ -2232,8 +2232,8 @@ int skill_attack (int attack_type, struct block_list* src, struct block_list *ds
if (pd->a_skill && pd->a_skill->div_ && pd->a_skill->id == skill_id)
{
int element = skill_get_ele(skill_id, skill_lv);
- if (skill_id == -1)
- element = sstatus->rhw.ele;
+ /*if (skill_id == -1) Does it ever worked?
+ element = sstatus->rhw.ele;*/
if (element != ELE_NEUTRAL || !(battle_config.attack_attr_none&BL_PET))
dmg.damage=battle_attr_fix(src, bl, skill_lv, element, tstatus->def_ele, tstatus->ele_lv);
else
@@ -13570,7 +13570,8 @@ struct skill_condition skill_get_requirement(struct map_session_data* sd, uint16
}
}
if( skill_id >= HT_SKIDTRAP && skill_id <= HT_TALKIEBOX && pc_checkskill(sd, RA_RESEARCHTRAP) > 0){
- if( pc_search_inventory(sd,req.itemid[i]) < 0 || ( idx >= 0 && sd->status.inventory[idx].amount < req.amount[i] ) ){
+ int16 itIndex;
+ if( (itIndex = pc_search_inventory(sd,req.itemid[i])) < 0 || ( itIndex >= 0 && sd->status.inventory[itIndex].amount < req.amount[i] ) ){
req.itemid[i] = ITEMID_TRAP_ALLOY;
req.amount[i] = 1;
}
diff --git a/src/map/unit.c b/src/map/unit.c
index eb8eac589..111f49065 100644
--- a/src/map/unit.c
+++ b/src/map/unit.c
@@ -1687,7 +1687,7 @@ int unit_calc_pos(struct block_list *bl, int tx, int ty, uint8 dir)
struct unit_data *ud = unit_bl2ud(bl);
nullpo_ret(ud);
- if( dir < 0 || dir > 7 )
+ if(dir > 7)
return 1;
ud->to_x = tx;