This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
So I took some time to look at the source to see what was up and discovered that the stats doubling didn't only affect two-handed weapons. It also affected headgears that covered more than one slot. I found the perpetrator which is located in src\map\pc.c. The function:
bool pc_is_same_equip_index(enum equip_index eqi, int *equip_index, int8 index) {
if (index < 0 || index >= ARRAYLENGTH(equip_index))
return false;
// Dual weapon checks
if (eqi == EQI_HAND_R && equip_index[EQI_HAND_L] == index)
return true;
// Headgear with Mid & Low location
else if (eqi == EQI_HEAD_MID && equip_index[EQI_HEAD_LOW] == index)
return true;
// Headgear with Top & Mid or Low location
else if (eqi == EQI_HEAD_TOP && (equip_index[EQI_HEAD_MID] == index || equip_index[EQI_HEAD_LOW] == index))
return true;
// Headgear with Mid & Low location
else if (eqi == EQI_COSTUME_MID && equip_index[EQI_COSTUME_LOW] == index)
return true;
// Headgear with Top & Mid or Low location
else if (eqi == EQI_COSTUME_TOP && (equip_index[EQI_COSTUME_MID] == index || equip_index[EQI_COSTUME_LOW] == index))
return true;
return false;
}
has the check:
if (index < 0 || index >= ARRAYLENGTH(equip_index))
return false;
which causes the function to prematurely exit for some reason. Removing this check fixes the issue. I don't think we really need this check as the function will return false if none of the conditions are met anyways and it's not actually used to access the array.
edit Didn't catch this before, but now I can see why the check will cause the function to prematurely exit. ARRAYLENGTH(equip_index) is calculating the length of a pointer, which is a big no no.
Subreddit
Post Details
- Posted
- 10 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/RedditRO/co...