Go Back   EQEmulator Home > EQEmulator Forums > Development > Development::Server Code Submissions

Reply
 
Thread Tools Display Modes
  #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
  #2  
Old 06-20-2013, 01:42 PM
demonstar55
Demi-God
 
Join Date: Apr 2008
Location: MA
Posts: 1,164
Default

Since our current target compilers are VS10 and gcc 4.6, we can use the C++11 std::to_string instead. Or should be able to, I will test this today.

EDIT: apparently VS10 has implemented std::to_string in a stupid method making it rather impractical to use : |
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 05:32 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3