mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-22 04:23:50 +00:00
Convert some of ostringstream << operations to std::to_sting() calls.
- At least with MSVC the latter is more efficient. - There are many more, but leave them until they show up during profiling (so far only loading was profiled, and mainly cell references)
This commit is contained in:
parent
86945d1912
commit
47b5fa9dae
1 changed files with 4 additions and 11 deletions
|
@ -1,6 +1,5 @@
|
||||||
#include "refcollection.hpp"
|
#include "refcollection.hpp"
|
||||||
|
|
||||||
#include <sstream>
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <components/misc/stringops.hpp>
|
#include <components/misc/stringops.hpp>
|
||||||
|
@ -63,10 +62,7 @@ void CSMWorld::RefCollection::load (ESM::ESMReader& reader, int cellIndex, bool
|
||||||
// ignoring moved references sub-record; instead calculate cell from coordinates
|
// ignoring moved references sub-record; instead calculate cell from coordinates
|
||||||
std::pair<int, int> index = ref.getCellIndex();
|
std::pair<int, int> index = ref.getCellIndex();
|
||||||
|
|
||||||
std::ostringstream stream;
|
ref.mCell = "#" + std::to_string(index.first) + " " + std::to_string(index.second);
|
||||||
stream << "#" << index.first << " " << index.second;
|
|
||||||
|
|
||||||
ref.mCell = stream.str();
|
|
||||||
|
|
||||||
if (!base && // don't try to update base records
|
if (!base && // don't try to update base records
|
||||||
mref.mRefNum.mIndex != 0) // MVRF tag found
|
mref.mRefNum.mIndex != 0) // MVRF tag found
|
||||||
|
@ -91,9 +87,8 @@ void CSMWorld::RefCollection::load (ESM::ESMReader& reader, int cellIndex, bool
|
||||||
std::cerr << "Position: #" << index.first << " " << index.second
|
std::cerr << "Position: #" << index.first << " " << index.second
|
||||||
<<", Target #"<< mref.mTarget[0] << " " << mref.mTarget[1] << std::endl;
|
<<", Target #"<< mref.mTarget[0] << " " << mref.mTarget[1] << std::endl;
|
||||||
|
|
||||||
std::ostringstream stream2;
|
// overwrite
|
||||||
stream2 << "#" << mref.mTarget[0] << " " << mref.mTarget[1];
|
ref.mCell = "#" + std::to_string(mref.mTarget[0]) + " " + std::to_string(mref.mTarget[1]);
|
||||||
ref.mCell = stream2.str(); // overwrite
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -187,9 +182,7 @@ void CSMWorld::RefCollection::load (ESM::ESMReader& reader, int cellIndex, bool
|
||||||
|
|
||||||
std::string CSMWorld::RefCollection::getNewId()
|
std::string CSMWorld::RefCollection::getNewId()
|
||||||
{
|
{
|
||||||
std::ostringstream stream;
|
return "ref#" + std::to_string(mNextId++);
|
||||||
stream << "ref#" << mNextId++;
|
|
||||||
return stream.str();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int CSMWorld::RefCollection::extractIdNum (const std::string& id) const
|
unsigned int CSMWorld::RefCollection::extractIdNum (const std::string& id) const
|
||||||
|
|
Loading…
Reference in a new issue