[Client] Use utility function for converting strings in mwmp::Cell

pull/199/head
David Cernat 8 years ago
parent d4a12856ee
commit 67ec81ad0c

@ -1,6 +1,7 @@
#include "../mwworld/worldimp.hpp"
#include <components/esm/cellid.hpp>
#include <components/openmw-mp/Log.hpp>
#include <components/openmw-mp/Utils.hpp>
#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;
}

@ -9,6 +9,7 @@
#include <ctime>
#include <cmath>
#include <memory>
#include <sstream>
#include <boost/crc.hpp>
#include <boost/filesystem/fstream.hpp>
@ -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);

@ -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);

Loading…
Cancel
Save