add missing to_string functions for Visual studio 2010

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@8415 30fe4595-0a0c-4342-8851-515496e4dcbd
This commit is contained in:
iobyte 2022-08-19 19:16:13 +00:00
parent 13b0667785
commit fe5c6f5dbf
3 changed files with 24 additions and 7 deletions

View File

@ -114,6 +114,21 @@ PORTABILITY_API char *strtok_r(char *str, const char *delim, char **nextp);
#endif
#if _MSC_VER < 1800
#define copysign _copysign
#include <string>
namespace std
{
inline string to_string(size_t value)
{
return to_string(static_cast<unsigned long long>(value));
}
inline string to_string(int value)
{
return to_string(static_cast<long long>(value));
}
}
#endif
#include <cstdarg>

View File

@ -30,6 +30,7 @@ This file deals with car setup
#include <tracks.h>
#include <drivers.h>
#include <playerpref.h>
#include <portability.h>
#include "carsetupmenu.h"
@ -394,7 +395,7 @@ void CarSetupMenu::loadSettings()
}
attribute &att = items[page][index];
std::string strIndex(std::to_string(static_cast<unsigned long long>(index)));
std::string strIndex(std::to_string(index));
att.labelId = getDynamicControlId(std::string("Label" + strIndex).c_str());
att.editId = getDynamicControlId(std::string("Edit" + strIndex).c_str());
@ -468,7 +469,7 @@ void CarSetupMenu::loadSettings()
for (size_t index = 0; index < ITEMS_PER_PAGE; ++index)
{
attribute &att = items[page][index];
std::string strIndex(std::to_string(static_cast<unsigned long long>(index)));
std::string strIndex(std::to_string(index));
if (!att.labelId)
att.labelId = getDynamicControlId(std::string("Label" + strIndex).c_str());
@ -600,7 +601,7 @@ bool CarSetupMenu::initialize(void *pPrevMenu, const GfRace *pRace, const GfDriv
// Create items.
for (size_t index = 0; index < ITEMS_PER_PAGE; ++index)
{
std::string strIndex(std::to_string(static_cast<unsigned long long>(index)));
std::string strIndex(std::to_string(index));
createLabelControl(std::string("Label" + strIndex).c_str());
createEditControl(std::string("Edit" + strIndex).c_str(), this, NULL, NULL);
createComboboxControl(std::string("Combo" + strIndex).c_str(), &comboCallbackData[index], onComboCallback);

View File

@ -38,6 +38,7 @@
#include <tgfclient.h>
#include <track.h>
#include <robottools.h>
#include <portability.h>
#include "trackgen.h"
#include "util.h"
@ -411,7 +412,7 @@ std::ostream &operator << (std::ostream &out, tSegType type)
out << (type == TR_RGT ? "TR_RGT" :
type == TR_LFT ? "TR_LFT" :
type == TR_STR ? "TR_STR" :
std::to_string(static_cast<unsigned long long>(type)));
std::to_string(type));
return out;
}
@ -423,7 +424,7 @@ std::ostream &operator << (std::ostream &out, tSegType2 type2)
type2 == TR_RSIDE ? "TR_RSIDE" :
type2 == TR_LBORDER ? "TR_LBORDER" :
type2 == TR_RBORDER ? "TR_RBORDER" :
std::to_string(static_cast<unsigned long long>(type2)));
std::to_string(type2));
return out;
}
@ -435,7 +436,7 @@ std::ostream &operator << (std::ostream &out, tSegStyle style)
style == TR_WALL ? "TR_WALL" :
style == TR_FENCE ? "TR_FENCE" :
style == TR_PITBUILDING ? "TR_PITBUILDING" :
std::to_string(static_cast<unsigned long long>(style)));
std::to_string(style));
return out;
}
@ -491,7 +492,7 @@ void dumpSeg(std::ofstream &ofs,const tTrackSeg *seg, const std::string & indent
ofs << indent << "vertex[2] " << seg->vertex[2] << std::endl;
ofs << indent << "vertex[3] " << seg->vertex[3] << std::endl;
ofs << indent << "angle ";
for (int i = 0; i < 7; ++i)
for (size_t i = 0; i < 7; ++i)
ofs << seg->angle[i] << " ";
ofs << std::endl;
ofs << indent << "sin " << seg->sin << std::endl;