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 15:43

>>7
include the <sstream> header, and use come somewhat like this to convert a number (or any type which works with streams, really) into a string.
  std::string theString;
  std::ostringstream tmpStringStream;
  tmpStringStream << SOME_NUMBER_GOES_HERE;
  theString = tmpStringStream.str();

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