View Single Post
  #16  
Old 09-18-2015, 04:22 PM
Cilraaz
Sarnak
 
Join Date: Mar 2010
Posts: 77
Default

I might have just found the issue (though I'm SUPER rusty with C++ and terrible with bitmasks in general). In zone/aa.cpp, on line 1421, there is the following code:

Code:
        if(IsClient()) {
                if(!(CastToClient()->GetPP().expansions & (1 << rank->expansion))) {
                        return false;
                }
        } else {
                if(!(RuleI(World, ExpansionSettings) & (1 << rank->expansion))) {
                        return false;
                }
        }
If I'm reading this right, it's checking the expansion value (forced by World:ExpansionSettings in the rule_values table) against the expansion for the AA. If we use the example that I'd originally quoted, Ferocity, that expansion value is 4. So the bitwise left would be "1 << 4", which is 1*4^2 or 16. That would evaluate "0" after the bitwise & against an expansions variable of 15. As such, shouldn't the code be:

Code:
if(!(CastToClient()->GetPP().expansions & (1 << (rank->expansion - 1)))) {
This would be 1 << (4-1) or 1*3^2, which is 9, which would evaluate "9" after the bitwise & against an expansions value of 15.

I made this change and recompiled zone. The AA's showed up properly (SoL and PoP together) when using an ExpansionSettings value of 15. I changed it to 8, restarted the server, and only PoP AA showed up, as expected.

Could a dev take a look and see if I'm correct here or let me know if I'm a complete idiot?
Reply With Quote