Possible code generation bug involving arrays and struct fields

More
2 weeks 2 days ago - 2 weeks 2 days ago #155 by ludojoey
Hello!

Attached to this message (`mr.src`) is an excerpt from a game I'm currently trying to develop.
I've attempted to strip the code down as much as possible in order to keep only the smallest portion that still reproduces the bug. As a result, what the code does may seem a bit silly, but that's expected.

Ver 0.7.7 is used.

In summary:
* There is an array of 4 variables of type `tweapon`.
* This type contains, among other things, the variables `X` and `Y`.

Initially, for all 4 elements, `X` is set to 250 and `Y` is set to 200.

Then, for each element, `X` is incremented by 1.
If it reaches 548, it is reset to 0.

The process then repeats (resetting `X` and `Y` to 250 and 200, respectively, and so on).

The issue is that the value of `Y` does not remain at 200 for the second element (index 1), but is et to -2360.

If I remove line 46:

weapon.yOfs = weapontype[j].yOfs;

the problem no longer occurs.

In addition, in my original project (although not in this reduced example), I am forced to use an intermediate variable (line 42); otherwise, the code does not compile.(or if so, the program will not act as expected).
But this is maybe the bug you already correct in the next version.

I hope this helps track down the issue.

 
Last edit: 2 weeks 2 days ago by ludojoey.
The following user(s) said Thank You: Franck

Please Log in or Create an account to join the conversation.

More
2 weeks 1 day ago #156 by Franck
It seems to work fine on my version so I suspect this is related to the same previous bug that I fixed recently.

I'll try to have the 0.7.8 released this w.e.

PS: I reverted to 0.7.7 to test and indeed the problem was happening in that version but no longer in the upcoming one.
 
The following user(s) said Thank You: ludojoey

Please Log in or Create an account to join the conversation.

Time to create page: 0.162 seconds
Powered by Kunena Forum