Jump to content
  • Advertisement
Sign in to follow this  
BreathOfLife

member func question

This topic is 3722 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
Advertisement
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
struct _coord
{
_coord() {};
_coord(int xx, int yy) : x(xx), y(yy) {};
~_coord() {};

int x;
int y;

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

}CORD, *LPCORD;

there she is

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
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!