View Single Post
  #1  
Old 06-20-2013, 12:29 PM
noudess
Discordant
 
Join Date: Sep 2012
Location: Upstate NY
Posts: 274
Default #showstats not working under ubunto/gcc

#showstats uses itoa extensively, and at least on my system/compiler, itoa seems to use an internal static string. About 15 fields were all displaying level instead of the stat intended.

I simply added this after the last #include in client.cpp:

Code:
#include <sstream>

inline std::string stringify(double x)
{
std::ostringstream o;
o << x;
return o.str();
}
And replaced every itoa that was being assigned into a std:;string to use stringify(value) instead of itoa(value) and it all works great. Gets rid of some compiler warnings as well.

I have too many other changes to this file to provide a diff that would be easier to use than following the above instructions. I expect some other areas could benefit from this as well.
Reply With Quote