diff --git a/apps/openmw/mwmp/Cell.cpp b/apps/openmw/mwmp/Cell.cpp index 4b3f4605f..a3a061991 100644 --- a/apps/openmw/mwmp/Cell.cpp +++ b/apps/openmw/mwmp/Cell.cpp @@ -1,6 +1,7 @@ #include "../mwworld/worldimp.hpp" #include #include +#include #include "Cell.hpp" #include "Main.hpp" @@ -75,8 +76,8 @@ std::string Cell::generateMapIndex(MWWorld::Ptr ptr) { std::string mapIndex = ""; mapIndex += ptr.getCellRef().getRefId(); - mapIndex += "-" + std::to_string(ptr.getCellRef().getRefNum().mIndex); - mapIndex += "-" + std::to_string(ptr.getCellRef().getMpNum()); + mapIndex += "-" + Utils::toString(ptr.getCellRef().getRefNum().mIndex); + mapIndex += "-" + Utils::toString(ptr.getCellRef().getMpNum()); return mapIndex; } diff --git a/components/openmw-mp/Utils.cpp b/components/openmw-mp/Utils.cpp index c9a65f462..60ea82931 100644 --- a/components/openmw-mp/Utils.cpp +++ b/components/openmw-mp/Utils.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -82,6 +83,13 @@ bool Utils::DoubleCompare(double a, double b, double epsilon) return fabs(a - b) < epsilon; } +std::string Utils::toString(int num) +{ + std::ostringstream stream; + stream << num; + return stream.str(); +} + string Utils::str_replace(const string& source, const char* find, const char* replace) { unsigned int find_len = strlen(find); diff --git a/components/openmw-mp/Utils.hpp b/components/openmw-mp/Utils.hpp index 2217f0378..88ad2b1b7 100644 --- a/components/openmw-mp/Utils.hpp +++ b/components/openmw-mp/Utils.hpp @@ -23,6 +23,8 @@ namespace Utils std::string str_replace(const std::string &source, const char *find, const char *replace); + std::string toString(int num); + std::string &RemoveExtension(std::string &file); long int FileLength(const char *file);