Jump to content
  • Advertisement
Sign in to follow this  
DarkNebula

Strange input error? I have no idea...

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

Well. I started my Tetris game in Windows and decided to port it over to Linux today, and when I compile it and all it works great. Until I clear a line. Once a line is cleared it seems that all input is frozen and the program doesn't respond at all to anything! Of course I tried to debug it and such but it looks like nothing is wrong! I know where the part of the code that does it but it's only the part that adds stuff to your score: player->score += (level+1) * 40; That's the line. It doesn't make sense that it would stop all input... but it is. And this might sound strange, but if I put a: print("%i\n", blah); in front of it, it seems to work!? It's confusing me greatly and I would appreciate any help or insight at all :S Here is a tar of the binary... thanks a lot. T_T You probably have to run it in a term and select the button one. Controls: j-left k-down l-right i-rotate space-auto down http://galatron.net/blockktris1.tar

Share this post


Link to post
Share on other sites
Advertisement
Sounds like you have some sort of heap corruption. Maybe you are writing off the end of an array or have a stray pointer somewhere.

Linux is generally a lot more anal about this kind of thing; you might want to use mmgr.h or efence with your app to make sure it's not doing anything blatantly illegal.

Share this post


Link to post
Share on other sites
One from the obvious questions camp: are you sure player is pointing to the right thing? If player isn't initialised, player->score is going to write all over something it shouldn't.

Share this post


Link to post
Share on other sites
Yes. It is initialised. That's something I've checked over and over. :( My problem still isn't fixed either. I've tried MMGR and that isn't really helping at all. :/ Any other suggestions?

Share this post


Link to post
Share on other sites
Wow... after compiling it with a makefie generated from Codeblocks IDE it... works? Maybe it was my linkage or something? Is that even possible?

[Edited by - DarkNebula on June 28, 2006 10:08:33 AM]

Share this post


Link to post
Share on other sites
Sure, anything's possible. Usually, though, bugs like this are latent problems that just happen to slip by under some circumstances, but die under other circumstances.

Share this post


Link to post
Share on other sites
Heisenbugs like this are almost always memory problems. Check your array accesses, use of uninitialized pointers, re-use of freed pointers, etc.

Share this post


Link to post
Share on other sites
Wow. I got it. I can't believe what it was either. It was some stupid string. char score[20]; Just not enough space. Thanks for the hints about it, I'm surprised I even found it at all. It wasn't even close to the spot where the program was crashing.

Share this post


Link to post
Share on other sites
No problem. efence would probably have caught your accesses over the end of the array, though mmgr probably should've too.

Enjoy your new Linux game.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

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!