Sign in to follow this  

member func question

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

Ok, so i have this class, well, a struct rather, that has a function that Is causing me grief. Para-coded to leave out a bunch of bounds checking that I have deduced to not be the culprit.
void _entity::Warp(int x, int y)
{
     pos.Setxy(x, y);
}
Where as pos is a coord struct with an x, a y, whiche are set with Setxy(); Setxy works, as Ive used it to set other things before, but when used within Warp() it doesnt seem to work, and I can seem to figure out why

Share this post


Link to post
Share on other sites
You'll need to be a bit more specific than "it doesn't seem to work". What do you expect to happen, what do you observe to happen, and what steps have you taken to debug why the two results are different?

Share this post


Link to post
Share on other sites
Well, it doesnt set the variables. I havent gotten the debugger to work on my laptop yet, but Ive created a series of file outputs to check variables before and after every set leading up to warp being called, and afterwards. the variables before and after are identical. and in the game itself, the player entity does not relocate from 1,1 (where function is called) to 34, 34 (which is the exspected new location). The text output walks through the thingy, shows everything is getting called, but does not move the player, he simply stays still, and further keyboard input moves him from the origonal location as if the warp did not happen.

hmm... well, maybe this might help

void Setxy(int xx, int yy) {x = xx; y = yy;}

that is the method, x and y being the other members, both ints

Share this post


Link to post
Share on other sites
I can't see where there could be a problem. Are you sure the proper parameters are being passed to _entity::Warp in the first place, and are you sure that pos.x and pos.y are being used the way you intended them?

From the looks of it, I can't believe that these few bits are the actual problem.

Share this post


Link to post
Share on other sites

This topic is 3505 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this