Acceptable/efficient syntax
I made a small change to remove max lvl 1 starting skills in client.cpp.
It appears to work after logging in but, I want to be certain the syntax is correct and if it could be done better. My comments inside: Code:
void Client::SetClassStartingSkills(PlayerProfile_Struct *pp) EDIT: I notice the client shows skills with values > 0 but the DB does not. I suppose the addition of quite a few more lines of code will be needed to account for the removal of the segment above to make accurate. If this doesn't belong here please move it, thanks. |
The client will often display hard-coded level 1 starting stats no matter what you code into the server and enter into the database. I haven't tested to see if it corrects to what the server tells it at level two.
I'd say the very easiest thing to do in that method would simply be to add a return statement after the very first opening brace. Hehe. Code:
void Client::SetClassStartingSkills(PlayerProfile_Struct *pp) |
Superb! Thank you.
I'll have to add something that states something along the lines of: set 1hb = 5 if class = a,b,c,d... and set 1hs = 5 if class = e,f.. I'll have to look at similar to see what the syntax would look like. Thanks again. |
In the C++ code they have a couple of shortcuts so you don't have to go by individual classes, too.
IsWarriorClass() returns true for WAR, ROG, MNK, PAL, SHD, RNG, BST, BER, BRD. GetArchectype() returns ARCHETYPE_MELEE, _CASTER, or _HYBRID depending on the class. If you aren't clear on who is and isn't a hybrid, you can see the full list in zone/mob.cpp around line 862. |
Grateful for that, thank you Shendare.
|
Likely, this would be easier done in Perl because it would be done as soon as the player logged in, rather than being handled by something that may or may not be hard-coded client-side, such as start skills and stuff like that.
|
Quote:
|
Quote:
|
Or a couple of rules.
Character:MaxSkillsOnCharCreate (true) Character:MaxSkillsOnLevelUp (false) |
Quote:
Note clients would still receive data as that's handled in another thread entirely. The point I was making is it'd be faster to make a method in C++ that you can call from Perl as opposed from looping in Perl. |
Below are the changes I made, it seems to work but, curious if everything looks right.
Also, I couldn't figure out how to do this using <GetArchectype>. If someone could throw me a bone, I'd appreciate it. Code:
void Client::SetClassStartingSkills(PlayerProfile_Struct *pp) Thanks |
Do you anticipate that you'll want to make changes on a per-class level later?
If not, you could group them together to clean it up a tad. Code:
void Client::SetClassStartingSkills(PlayerProfile_Struct *pp) |
Also, you're missing Beastlords. If that wasn't intended, they'd probably be grouped with Monks.
|
BST - oversight, thanks (and clarifying starting skill)
Quote:
I appreciate your help =) EDIT: I understand the implications of the corrections, for the most part. I am most thankful for that. |
Yes, Shendare's method is more efficient!
Switch statements essentially create a jump table entry (per case value) and code paths for each entry listed in the machine code. If no exit clause is specified, the code path will 'fall-through' every line of code until it reaches the default exit clause..meaning that every case between case entry and default exit will be processed as true. The fall-through behavior can be very useful for grouping like singular and progressive-compound methodologies..but, it can also be a trap if that behavior is not desired. |
All times are GMT -4. The time now is 06:15 AM. |
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.