Solved Job check statement

Status
Not open for further replies.

Caves

The Annoying Newbie
Premium
Joined
Sep 13, 2024
Messages
67
Solutions
2
Reaction score
30
Points
18
Hey guys I need help understanding how come this nJob is showing that it isn't declared but its being used throughout the source code?
What I'm doing is that I just recently copied an edit to the Ringmaster Hero Skill making it a full buff Skill.
I'm trying to put a check statement on it to see if the user is a Seraph/Florist. But it's giving me an error that the "nJob" isn't declared.
Am I missing something like an include file?

My Files: V19.4 Lodelight
Edit From: Sakura Source

The Codes:
Hey There!
Please login and(or) register to see this awesome content today.

The Error:
1728705195902.png
 
Oh, are you on "CMover::OnMagicSkill(" function? if so, just try "m_nJob";
m_nJob is a property of CMover class on L19.4
 
Solution
Okay so it worked now.

So instead of using nJob, I needed to use m_nJob.

Can you enlighten me on this a little what the difference is?

Thanks!


I don't know the correct answer, but I believe it's just a matter of nomenclature adopted by whoever edited/created the code.
Some programmers tend to use a prefix "m" in some internal properties, to differentiate between an argument received in the function, from a property in the class...I usually do this.
Hey There!
Please login and(or) register to see this awesome content today.
In my case, I consider 'm' as 'my' or 'member' referring to the class itself. To make it clearer in the function arguments, I use names without the 'm',


One tip I give is to use ctr+f in Visual Studio, and ask it to search for a part of the name of a property or function, in the entire solution, and list all the results.
This usually makes it easier to find the name that the source is using, since even with changes in the different sources, usually a good part of the 'name' is not maintained.
 
To explain what flipperworld has mentioned, the m_ etc prefix is from the Hungarian Notation paradigm. There's a difference between local variables and variables stored within the class. m_nJob is a variable stored within the CMover class that contains the ID of the players Job.

The n before Job means that Job is an integer. It's why most floats that are class members are m_f. This was used a lot because IDE's didn't have the power that they do today. Now we can just hover and see the variable type.


As a side note, I see there's a list of buffs. Rather than using a vector, use an array. This way you don't waste time reallocating the heap allocated memory from vector.
Hey There!
Please login and(or) register to see this awesome content today.

You can't push back in to an array like that, so you'd have to loop both normal buffs and then loop the florist / 3rd job buffs as well.
 
Last edited:
Status
Not open for further replies.