Jump to content
  • Advertisement
Sign in to follow this  
  • entries
    686
  • comments
    1952
  • views
    387397

Blocky Man is using Game Genie!

Sign in to follow this  
Stompy9999

137 views

So, obviously not what I intended:


Yeah, those spikes were supposed to kill him. I've been working on special tiles that do different things throughout the game(spikes, water, ladders, etc.). Obviously, I still have a lot of work to do.

Now I'm going to ask a programming question that might help me out. I'm not going to use the actual code, because that would just make it more complicated than it has to be. Basically, I have something like this:


struct A
{
int *pA;
int *pB;
int *pC;
};

class B
{
private:
int numA;
int numB;
int numC;
public:
A stuff;

B()
{
numA = 1;
numB = 2;
numC = 3;
stuff.pA = &numA;
stuff.pB = &numB;
stuff.pC = &numC;
}
};

void DoSomething(A *stuff)
{
*stuff->pA = 0;
*stuff->pB = 0;
*stuff->pC = 0;
}

int main()
{
B something;
DoSomething(&something.stuff);
return 0;
}





After something.stuff is passed to DoSomething(), the values of B.numA, B.numB, and B.numC are not changed to 0. Why?
Sign in to follow this  


10 Comments


Recommended Comments

You forgot to pass the pointer to something.stuff. Should be &something.stuff. That should have given a compile error, or was that a typo? I see you fixed it, my bad.

I ran the example on my end and it did exactly what you were expecting, it set something.numA,etc... all to 0.

Share this comment


Link to comment
Yeah, I just fixed it. It was caused by something else entirely, and I was just looking in the wrong place.

Share this comment


Link to comment
Guest Anonymous Poster

Posted

I think he means the ghetto art :D

Share this comment


Link to comment
Quote:
Original post by MarijnStevens
Nice gfx style, but is that done on purpous ??


Stompy is famous (or infamous?) for his programmer art. [grin]

Edit: WTF? This post shouldn't be where it is, considering it was posted after the posts which succeed it...

Share this comment


Link to comment
Quote:
Original post by MarijnStevens
Nice gfx style, but is that done on purpous ??


Stompy is famous (or infamous?) for his programmer art. [grin]

Share this comment


Link to comment
I think we will go with infamous.

Look, I might end up getting a pixel artist for my games(to make them look 16-Bit). Or I might get my brother, who is an excellent artist, to hand draw the graphics.

Either way, hopefully I won't be drawing them for long[lol]

Share this comment


Link to comment

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