Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / Bug: calling dbCreateAnimatedSprite(..) is setting a int var to 321

Author
Message
Ghthor
16
Years of Service
User Offline
Joined: 5th Apr 2008
Location:
Posted: 6th Apr 2008 04:13
If anyone can explain this please do.

Heres the code



Taco Justice
Lilith
16
Years of Service
User Offline
Joined: 12th Feb 2008
Location: Dallas, TX
Posted: 6th Apr 2008 19:18
I'm not sure your k value is actually changing, at least not according to a debug session unless the change comes . I'd be willing to be that the problem is more in the way the number is being displayed.

What is the purpose of k and where, if anywhere, are you changing it?

Accch!!!! I just did some lookups. I think the problem is in the dbStr call. The documentation doesn't seem to match the prototype for the function. That's the only routine that has access to the k variable in the entire program. I changed k to a const int and it wouldn't change. But when I removed the restriction the 321 problem re-occurred. I changed the

dbText (10, 10, dbStr(k));

to

dbText (10, 10, atoi(k, Number, 10));

where Number is char Number [128];. The number changing problem goes away but for some reason there's a buffer overrun problem when I exit the program.

I'm not certain what the purpose of k is. You're use of it in the ending doesn't make sense because, according to your logic at least, k never changes beyond 1. j starts out at 1 which means it doesn't satisfy the < k and that loop never runs.

Lilith, Night Butterfly
I'm not a programmer but I play one in the office
Ghthor
16
Years of Service
User Offline
Joined: 5th Apr 2008
Location:
Posted: 6th Apr 2008 22:28
I was Testing Dynamically Allocating Sprites During the Main Loop to see if it was possible. I built this class which I"m currently improving that handles all my sprite allocation and deallocation during runtime.

The Code from the first post was testing to make sure that the following bit of code performed correctly during the Main loop


I removed the k incrementation and the variable was still displaying 321 when the code ran.

Taco Justice

Login to post a reply

Server time is: 2024-09-29 17:33:00
Your offset time is: 2024-09-29 17:33:00