Also, is it valid to return a reference to 'NULLEVENT'?? What is that exactly? What happened when you made your class simpler by removing bits until you got it to work
Also, is it valid to return a reference to 'NULLEVENT'?? What is that exactly? What happened when you made your class simpler by removing bits until you got it to work
Which key did you press that makes the application crash? Dis you cover all possibilities when mapping keys to events inside IPlayer's constructor? Does mActiveControllable handle NULLEVENT? I mean, if getInputMessage returns that constant, will the controller properly handle such a case?
I'm pressing the Return key, currently I'm not doing anything with the InputMessages, because I'm trying to get around the crash cause first. I'm only covering which keys are relavant at this point, but I am covering these keys in IPlayer.h-
Is the error deterministic? Happens at every keypress or only sometimes.
Is your application single threaded ?
Is your OIS.dll built with the same Visual Studio version as your game ?
Does it repeat when you change std::map to std::unordered_map ?
Nimet - Advanced Ogre3D Mesh/dotScene Viewer asPEEK - Remote Angelscript debugger with html interface ogreHTML - HTML5 user interfaces in Ogre
Faranwath is right, though, returning by reference is incorrect, so you must return by value, or you will eventually get the next crash once you fixed this one.
Why do you use a static iterator in that function? Why not declare it locally?
In any case, you should probably use a debugger to look at the variables inside that function. I have a feeling that one of them is already corrupt (potentially the global map itself?), so your error might even be unrelated to this particular code. The debugger might help you to spot that corruption, and then you can work your way backwards to the actual root cause.
The weird (or perhaps enlightening) part is that the exception is raised when creating the iterator. Here's my last shot: don't use references at all, pass messages by value (its'a an integer, after all). Also, the library seems to be throwing an exception. Did you try and catch it? Does its type tell you anything useful? I none of this works, perhaps some other user may give you more valuable insights
Is the error deterministic? Happens at every keypress or only sometimes.
Is your application single threaded ?
Is your OIS.dll built with the same Visual Studio version as your game ?
Does it repeat when you change std::map to std::unordered_map ?
Every keypress - 1st keypress
single threaded except for physics - Havok
OIS.dll is built with vc100, which is same version - vs2010
unordered map has same behaviour
CABAListic wrote:
Why do you use a static iterator in that function? Why not declare it locally?
I was thinking maybe I had to make it static for some reason because I was running into this error. I get the same behaviour even without the static definitions, also the same behaviour with a locally defined iterator.
I tried removing all references like so but ending up with the same behaviour -
drwbns, I think you should do more work to identify the root of your problem.
Make a testing member function that you can call after you've created your object. Make it print out the size of the inputmap, then when you've got that working, expand it to iterate through the map printing out values (using a local scope iterator like Cabailistic mentioned). Eventually you'll find your smoking gun.
Is it possible that this has something to do with the enormous amount of keypress captures? I'm only hitting the Return key once, but as you can see from my call stack picture, it's called many times over. Is this normal OIS behavior?
I found the cause, very stupid error - I was calling the keyPress function over and over in my derived class by saying return keyPress() instead of return BaseApplication::keyPress ....thanks for the help guys