mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 22:23:51 +00:00
[Client] Use utility function for converting strings in mwmp::Cell
This commit is contained in:
parent
d4a12856ee
commit
67ec81ad0c
3 changed files with 13 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
||||||
#include "../mwworld/worldimp.hpp"
|
#include "../mwworld/worldimp.hpp"
|
||||||
#include <components/esm/cellid.hpp>
|
#include <components/esm/cellid.hpp>
|
||||||
#include <components/openmw-mp/Log.hpp>
|
#include <components/openmw-mp/Log.hpp>
|
||||||
|
#include <components/openmw-mp/Utils.hpp>
|
||||||
|
|
||||||
#include "Cell.hpp"
|
#include "Cell.hpp"
|
||||||
#include "Main.hpp"
|
#include "Main.hpp"
|
||||||
|
@ -75,8 +76,8 @@ std::string Cell::generateMapIndex(MWWorld::Ptr ptr)
|
||||||
{
|
{
|
||||||
std::string mapIndex = "";
|
std::string mapIndex = "";
|
||||||
mapIndex += ptr.getCellRef().getRefId();
|
mapIndex += ptr.getCellRef().getRefId();
|
||||||
mapIndex += "-" + std::to_string(ptr.getCellRef().getRefNum().mIndex);
|
mapIndex += "-" + Utils::toString(ptr.getCellRef().getRefNum().mIndex);
|
||||||
mapIndex += "-" + std::to_string(ptr.getCellRef().getMpNum());
|
mapIndex += "-" + Utils::toString(ptr.getCellRef().getMpNum());
|
||||||
return mapIndex;
|
return mapIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <sstream>
|
||||||
#include <boost/crc.hpp>
|
#include <boost/crc.hpp>
|
||||||
#include <boost/filesystem/fstream.hpp>
|
#include <boost/filesystem/fstream.hpp>
|
||||||
|
|
||||||
|
@ -82,6 +83,13 @@ bool Utils::DoubleCompare(double a, double b, double epsilon)
|
||||||
return fabs(a - b) < 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)
|
string Utils::str_replace(const string& source, const char* find, const char* replace)
|
||||||
{
|
{
|
||||||
unsigned int find_len = strlen(find);
|
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 str_replace(const std::string &source, const char *find, const char *replace);
|
||||||
|
|
||||||
|
std::string toString(int num);
|
||||||
|
|
||||||
std::string &RemoveExtension(std::string &file);
|
std::string &RemoveExtension(std::string &file);
|
||||||
|
|
||||||
long int FileLength(const char *file);
|
long int FileLength(const char *file);
|
||||||
|
|
Loading…
Reference in a new issue