-
Notifications
You must be signed in to change notification settings - Fork 173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: CppScripts Cleanup #1571
chore: CppScripts Cleanup #1571
Conversation
Rewrote file to use a lambda map rather than the massive if else chain. Kept the original comments alongside each of the different scripts they were by before.
Script stuff
script = new WildNinjaSensei(); | ||
else if (scriptName == "scripts\\ai\\WILD\\L_LUP_generic_interact.lua") | ||
script = new LupGenericInteract(); | ||
else if (scriptName.rfind("scripts\\zone\\LUPs\\RobotCity Intro\\WBL_RCIntro_RobotCitizen", 0) == 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where did these go?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there should be 4-5 with this style name we need to load, its the only missing script from the transfer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are 5, one for each color. Currently at lines 680-684 in the CPPScripts.cpp file
If this is still a question let me know
{"scripts\\ai\\WILD\\L_WILD_NINJA_SENSEI.lua", [](){return new WildNinjaSensei();}}, | ||
{"scripts\\ai\\WILD\\L_LUP_generic_interact.lua", [](){return new LupGenericInteract();}}, | ||
|
||
//And on, and on, and on, and on |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
//And on, and on, and on, and on |
Please also format your files before commiting with alt+shift+f in VSCode or your preferred editor |
You don't need to close this PR and open a new one, pushing to your branch will add changes to it |
Fixes #1511
Desc: Changed the CppScripts file to use a lambda map to load scripts rather than the if else chain. This should make it easier to make future changes as well as reduce code size (especially with an issue with number of if-else statements for some operating machines).
Motivation: Received notice of the issue from a head developer
Type of Changes: Made changes to the CppScripts main file, which now use a lambda. Made a few comment changes but tried to keep all original comments. Overall file lines reduced drastically.
How Has This Been Tested?:
Emosewamc helped write a test file which we used to verify the scripts between the old scripts and new script changes. It returned successful tests when running
ctest
in the/build
directory