-
Notifications
You must be signed in to change notification settings - Fork 8
Add cubescript-defined variables. #111
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
base: master
Are you sure you want to change the base?
Add cubescript-defined variables. #111
Conversation
390d2fd to
8ba22b3
Compare
|
I'd like it if tbhey were called defint deffloat and devstring |
|
Ok, so in summary what I would like to change is: |
|
I chose these names to be consistent with the current CS name convention, e.g.
|
|
hum, ok I see. then please add |
|
Added |
MoonPadUSer
left a comment
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.
eh, I guess the case isn't really important in debug messages
TheAssassin
left a comment
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.
I only performed a functional and semantic review of the changes, focusing on the C++ code. Will happily re-review once my questions are answered.
def9ef5 to
d3fbe4a
Compare
Replaced COMMAND with ICOMMAND and made storage explicit. Made checks in ident::changed() explicit. Used proper style for debug messages.
d3fbe4a to
cbe5b47
Compare
| ushort filtered_flags = ((*flags) & EXPOSED_FLAGS); | ||
|
|
||
| // Allocate storage for the variable. | ||
| int *storage = new int(*cur); |
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.
This cries "potential memory leak" all over the place. I'll have to look into ident resp. addident to see whether this is ever cleaned up.
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.
These never get deleted; C++ variables use global variables as storage. Variables exist forever.
This PR adds cubescript-defined variables to replace faux-variable aliases.
There are three commands and one alias added and described in usage.cfg:
on_changeis CubeScript that will be executed when the variable is changed.This also adds variables for the IDF_* flags that are useful and allowed for cubescript-defined variables:
Under the hood, this adds additional functionality to idents so that they may store cubescript to be executed on change.
I am working within the existing system here, so there is a bit of hackishness especially for allowing
on_changecallbacks, but I think that giving cubescript proper variable support now is more useful than revamping the entire cubescript engine.I have converted the new faux-variable aliases to variables.