gtav-ent / GTAV-EnhancedNativeTrainer

GTA V PC Enhanced Native Trainer
http://gtaforums.com/topic/789786-vrelwip-enhanced-native-trainer
GNU General Public License v2.0
37 stars 14 forks source link

Be careful with variable initialization and conventions #139

Closed alexquebecois closed 9 years ago

alexquebecois commented 9 years ago

I found this declaration on the neonlightsmenu.cpp: int rCol, bCol, gCol = 0;

Probably just a mistake but only gCol is assigned. rCol and bCol might be initialized to anything. The best practice is to always initialize a variable. Using the following way will make sure they are all assigned at the initialization: int rCol = 0, bCol = 0, gCol = 0;

Also, without wanting to be annoying, it's better by convention to use RGB for colors rather than what there is in the code snippet (RBG). It will reduce the chance of inverting color values since functions are asking for it like this (Vehicle vehicle, int r, int g, int *b).

I just wanted to clarify that to avoid someone loses its time searching for the small problem that is well hidden.

gtav-ent commented 9 years ago

Good find, I'll fix it.

qaisjp commented 9 years ago

Yea RBG is actually a quite peculiar thing to write, where was this written?

alexquebecois commented 9 years ago

Only one thing to add: http://www.rrrgggbbb.com/