-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
var_val
bugfix
#72425
var_val
bugfix
#72425
Conversation
AFAICT from a quick look, the fix can go a little deeper and remove the talker argument from You should add a test unit too, since the existing one failed to catch this issue.
I don't like this mixing. Either change it all to math syntax or not at all. IIRC we still can't change everything to math syntax because updating
Better just not resolve var_val recursively. I don't see any situation where that is useful or has a meaningful result. You'll note that recursive evaluation isn't mentioned in the documentation and isn't used anywhere. |
Changing it to a
The previous code could recursively resolve |
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.
Auto-requesting reviews from non-collaborators: @wapcaplet @andrei8l
Summary
Bugfixes "fix some issues of
var_val
"Purpose of change
Just try these 2 eocs :
The issue in "EOC_test_varval_1" is that the value of SOMETHING should be stored in npc_variable but is incorrectly stored in u_variable. And the expected behavior in this case is that it will show a debug message that there is no beta talker.
The issue in "EOC_test_varval_2" is that when running it, the game will crash without any debug messages.
Describe the solution
For issue1, I fixed it by setting the new talker after resolving the var_val.For issue1, I fixed it by removing the unnecessary parameter
talker *talk
in functionwrite_var_value
, and when it processes var_type::u and var_type::npc, it will try to get the talker from the dialogue instead of using thetalker *talk
.Additionally, parsing for values starting with "n_" has been added simultaneously to maintain consistency with
math
.For issue2, track the
call_depth
when processing the var_val. Ifcall_depth
> 1000, a debugmsg "Possible infinite loop detected: var_val points to itself or forms a cycle. %s->%s" will be shown.Describe alternatives you've considered
None
Testing
Additional context