This is probably more of a C++ thing than a AppGameKit thing.
When I first converted my Tier 1 to Tier 2, I had a variable called
SCENE that kept changing inexplicably. I isolated the change to a specific IF STATEMENT within a specific FUNCTION. But no where in that function or if statement was the variable
SCENE.
I could not at all see why the variable was changing, so I renamed it to
otherS.
After changing the name all worked great for months as I added flow logic to my code to accomodate the Tier 2 template mainloop thingy. Suddenly,
otherS is behaving the same exact way. I also isolated it back to the same IF STATEMENT and FUNCTION as was responsible for
SCENE changing.
WTF?
Neither
SCENE nor
otherS are being changed in the suspect code. And why would the same variable be victim months after the name was changed??
TOO BIZARRE!
This is the code where the change is happening:
agk::Message(string("scene[0b]= " + string(agk::Str(otherS))).c_str());
if (TOOK[chem].Active == 5)
{
TOOK[chem].Elapse = agk::Timer() - TOOK[chem].Start;
if (TOOK[chem].Elapse > TOOK[chem].Duration* GAME_TIME) //minutes to seconds
{
TOOK[chem].Active = 8;
}
}
agk::Message(string("scene[0c]= " + string(agk::Str(otherS))).c_str());
I have a message pop-up before and after the guilty code. otherS is the correct value in the first pop-up but changes to an 8 by the time the second message pops up. So this was happening when the variable name was SCENE. I changed its name, and for 2 months this issue was not evident.
As you can see, otherS is not in the code except for my message pop-ups. So how is the variable value changing?
It seems like maybe TOOK[chem].Active is being connected to otherS within the compiler. The TOOK array is being used as timers for various events in the game. But the scene number has nothing at all to do with the timers.
Has anyone ever seen this phantom variable changing before??
home.wavecable.com/~mindsclay