Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

WTF, is this code not valid?

Name: Anonymous 2006-06-18 2:48

void add_speed_direction (short direction, short addspeed, short& xspeed, short& yspeed) {
    /*This function adds the desired speed to the speed of the entity that calls it, in
    the direction it wants. This function should acquire its variables from the function
    that calls it.  I hope     this is a legal operation within methods.  Maybe it'll be
    easier to make it a method itself? */
    xspeed* += (addspeed*sin(direction));
    yspeed* += (addspeed*cos(direction));
}

For some reason, it doesn't like my pointers and indirection operators.  Microsoft Visual C++ 6.0 gives me this error when I go to compile it:
e:\docs\projects\space story\space story.h(124) : error C2059: syntax error : '+='
e:\docs\projects\space story\space story.h(125) : error C2059: syntax error : '+='

Name: Anonymous 2006-06-18 13:03

OK... so it's like when I give it the pointer in the declaration statement, it automatically knows to take it as a reference, because it's being passed to a function... but why did the tutorial at http://www.cplusplus.com/doc/tutorial/functions2.html say I needed them?

Anyway, another question.  This same function is giving me headaches where it doesn't seem to give the correct angle.  I'm trying to use the engine I'm using's built-in logging function to see what it gives for the values of certain things so that I can try to fix the mathematics.  Only thing is, the Log() method (I'm pretty sure you call it a method) doesn't accept number variables.  How can I convert the variables to a string, so they can be outputted to a file?

Here's approimately what I'm trying to do, horribly wrongly I know.  Wrong as trying to fit a square peg in a round hole, I know.  This makes me look like a downs patient, I know.  Please don't dwell on that.

Engine->Log( "Given sin:  " sin(direction) \n "Given cos:" cos(direction) \n "Given addsin: " addspeed*sin(direction) \n "Given addcos:" addspeed*cos(direction) )
This line is within the function I posted earlier.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List