weird Run-time error (debug & release mode)

This topic is 4243 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

As the title suggests, I have a weird run time error (debug only tested right now). First just to let everyone know, C++, VS 2005. I have a function, that I am passing in two parameters, a pointer to a class and a float. Where the function is called, the float variable that is passed in = 85.0f, however, when I enter the function, the local variable is 0.0f and if I go back up the stack, the initial variable still = 85.0f. If I place a constant value there, (i.e. pass in 85.0f instead of the variable) it works fine. Also I call this function from other places using variables, and they work fine. The pointer is passed in corrently, only the float type is having issues. In both places, the type is float (i.e. no typedefs, or casting even). Both classes reside in the same namespace as well. prototype and function call below.
bool ActorManager::MainActorInRadius( const Actor *pActor, const float fRadius ) const;


Any help is a appriciated. tHom EDIT: I am thoroughly confused now. I was trying to add some menu content, when I notice a slightly similar but different issue. When trying to get a variable from another class via a "GET" function, the address it returns is not correct. For example, I have an unsigned short array of size 6, when inside the class, the array's pointer value is "0x24001f37". After the "GET" function returns, the return value is, "0x24001f3a". I am not calling this anywhere else, so I can't test if this function call is working in other places. Again, these seems to be an isolated event. Any ideas as to what could be causing all these weird memory issues? Some other important issues to point out: I am also using the Ogre Rendering Engine for my game, the first instance up above with the value not being passed correctly resides in the same dll, and the 2nd case, the pointer that is set is form within an .exe and the function call itself is placed within a .dll. I'm not sure if this is important enough, but it seems that most of the errors are kind of around my Actor class. I can provide the source if you think it would be useful. Src below
const WORD* pExpTable = RPGObject::ActorManager::GetSingletonPointer()->GetHumanPlayer()->GetProfLevelsExp();

const WORD* GetProfLevelsExp() const
{
return this->m_wProfExp;
}


here is a link to my uploaded uml diagram. maybe this will help? AIPlayer class size is 186 if I remember correctly, and HumanPlayer is 166 if I remember correctly. MY UML design Just trying to provide as much info as I can. [Edited by - tHomahwk on March 10, 2007 3:07:18 PM]

1. 1
Rutin
33
2. 2
3. 3
4. 4
5. 5

• 13
• 76
• 11
• 10
• 14
• Forum Statistics

• Total Topics
632968
• Total Posts
3009584
• Who's Online (See full list)

There are no registered users currently online

×

Important Information

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!