* 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://svn.code.sf.net/p/rathena/svn/trunk@17077 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
markzd 2013-01-05 04:45:53 +00:00
parent 60d22b04c1
commit 82c04f1134
5 changed files with 10 additions and 9 deletions

View File

@ -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

View File

@ -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];
/**

View File

@ -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);

View File

@ -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;
}

View File

@ -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;