Variables Getting Overwritten?

Started by
11 comments, last by TheChuckster 20 years ago
Problem solved. By making Rotation and Position private, it's fine. But I never attempt to change it outside of SetRotation, SetPosition, Rotate, and Translate. Weird...

[edited by - TheChuckster on April 13, 2004 8:40:46 PM]
---2x John Carmack
Advertisement
quote:Original post by TheChuckster
Problem solved. By making Rotation and Position private, it''s fine. But I never attempt to change it outside of SetRotation, SetPosition, Rotate, and Translate. Weird...

[edited by - TheChuckster on April 13, 2004 8:40:46 PM]


I didn''t really pay attentian to what''s going on, but is there a chance you had a pointer/array in some other file that wrote to the wrong location?

<-- that''s still a link if you didn''t notice
"Gay marriage will encourage people to be gay, in the same way that hanging around tall people will make you tall." - Grizwald
-~-The Cow of Darkness-~-
quote:Original post by TheChuckster

for (i = 1; i <= 6; i++)
{
for(j = 1; j <= 4; j++)
{


Here's your problem.

You're counting starting with 1. Arrays are numbered starting with zero.

So in these for() loops you're skipping the first element of the arrays, and worse than that, you're writing data after the array ends which could be over-writing who knows what. (Probably whatever you declared next.)

Those lines should read :
quote:for (i = 0; i < 6; i++)
{
for(j = 0; j < 4; j++)
{


Hope this helps!

-Andy

[edited by - AndyL on April 14, 2004 1:51:41 AM]

This topic is closed to new replies.

Advertisement