ChaosSlayer, you're right... it
is great to see people getting more involved with the project! I'm glad that our contributions seem to be well received by the established community and senior developers. I hope that I'll have more opportunities to help in the future!
Trevius, I did see that others were working on this particular problem, as well. I did work along with several of them (such as Reno) to develop what we believe to be the final solution to the problem, as posted above. Unlike the other threads, we're confident saying "it's done; it's fixed" with the code in this thread.
Please do review and test, and if you agree, please feel free to throw it into the next build!
Quote:
Originally Posted by trevius
So, where does Calculate2HDamageBonus function go? I can't figure out where to put it and it errors as shown in my previous post if I put it directly in my attack.cpp.
|
Trevius, you have several options.
The GetWeaponDamageBonus() is a member of the Mob class, so it's trying to call a Calculate2HDamageBonus() that's also a member of that class. There is none, as Calculate2HDamageBonus() is declared as a global function.
The quick fix is to, when Calculate2HDamageBonus() is called, add two colons (the C++ Scope Resolution Operator) before its name to indicate that it's a function that resides in the global namespace, like this:
Code:
return ::Calculate2HDamageBonus( GetLevel(), Weapon->Delay );
A better long-term choice would probably be to make the Calculate2HDamageBonus() a member of the Mob class. As this is my first contribution and I'm therefore a very junior contributor, I didn't want to presume to add a new function to someone else's class. But if you want to do it, here's a rough description of how:
Sorry that I can't give precise line numbers, as I'm at work, and do not have a copy of the Emu source available. Find the declaration of the Mob class, and add a prototype for the Calculate2HDamageBonus() function. Then add "Mob" and the scope resolution operator before the definition of the function.
A third possibility is: You could also rip out the guts of the function and plug it directly into GetWeaponDamageBonus(), but that'll make the GetWeaponDamageBonus() function huge and ugly. I'd recommend keeping Calculate2HDamageBonus() as a function.
I'll be happy to post more detail on these changes when I get home from work tonight!
Take care,
-Eric