Function call inconsistencies =-(
Hi. I''m having a little trouble with one of my programs and I need some professional help =-)
Well, I''m making a maze program to use in my psychology class to take statistics of how quickly people can navigate mazes and their ability to learn after repeated tries through the same maze. I''ve got most of the maze program set up except for collision detection and other program-end dealies. However, I''m having a bit of trouble with a few function calls.
Each wall of the maze has a corresponding object of class "Wall". All the walls are kept in a vector class I wrote called class "Array". Array has a method getSize() that returns the number of items in the vector. Now here''s where things get weird.... In my main game loop, I call g_wallList.getSize() (g_wallList is the global Array object in the game). It returns the correct number of walls and that allows me to loop through and render all the walls with the help of OpenGL. HOWEVER(!) inside my collision detection function, I call the SAME METHOD again and it returns 0(!!!) I through in some debug code that printed out the value of g_wallList.getSize() immediately BEFORE and AFTER I called the collision detect function and it gave me 2 DIFFERENT return values. I''m confused o_O Does anyone have any idea what might be wrong here? I can provide full source if neccessary.
Also, I had a similar problem with Texture mapping in OpenGL with the glBindTexture command. If I used it in my main game loop, it worked fine, but inside the render method of the Wall class, it didn''t work at all and I got plain white walls =-(
Can anyone help me here?
"You TK''ed my chicken!"
Everyone has problems like this occasionaly. It is almost always something small and stupid, which is hard to see by the person who wrote the code. I think you will have to post the code.
If they are in different files, you may have forgot to declare one of them extern and the compiler ended up making a seperate instance of the variable in each file.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement