Jump to content
  • Advertisement
Sign in to follow this  

[C++] Problem emulating slot reels in code

This topic is 4013 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

We're developing a slots game and somehow I got the idea to experiment emulating slot reels spinning in code by using some kind of list or stack data structure. The reels in the code below are Qt's QList<int>:
for(int i = 1; i <= 7; i++)

    int one = reelOne.at(0);

    int two = reelTwo.at(0);

    int three = reelThree.at(0);

    int four = reelFour.at(0);

    int five = reelFive.at(0);

The problem is that I get an "access writing violation" everytime around the fourth reel, no matter what data structure I use or whether its a pointer. So far I've tried this method using QList, QVector, and QStack. Aside from the question of whether this is a good design or even necessary for my purposes (probably won't use this anyway) does anyone know why this code doesn't work properly? Its been bugging me...the only thing I can think is that maybe the loop is too fast for the data to be written and rewritten like that. [Edited by - JimDaniel on October 1, 2007 11:35:25 AM]

Share this post

Link to post
Share on other sites
Not with the amount of code you've posted, no.

Access violations tend to be caused by errors relatively far away from their actual manifestation. Post more code - as much as you can between the declaration and initialization of those objects and their ultimate failure.

Have you used your debugger?

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!