HPL1: replace std::sort usage

This commit is contained in:
grisenti 2022-07-28 09:37:18 +02:00 committed by Eugene Sandulenko
parent b63ed0b537
commit f30a1e139c
No known key found for this signature in database
GPG Key ID: 014D387312D34F08
2 changed files with 6 additions and 8 deletions

View File

@ -36,7 +36,7 @@
#include "hpl1/engine/impl/tinyXML/tinyxml.h"
//#include <algorithm>
#include "common/algorithm.h"
namespace hpl {
@ -359,9 +359,9 @@ void cAINodeContainer::Compile() {
///////////////////////////////////////
// Sort nodes and remove unwanted ones.
#if 0
std::sort(pNode->mvEdges.begin(), pNode->mvEdges.end(), cSortEndNodes());
#endif
Common::sort(pNode->mvEdges.data(), pNode->mvEdges.data() + pNode->mvEdges.size(), cSortEndNodes());
// Resize if to too large
if (mlMaxNodeEnds > 0 && (int)pNode->mvEdges.size() > mlMaxNodeEnds) {
pNode->mvEdges.resize(mlMaxNodeEnds);

View File

@ -34,7 +34,7 @@
#include "hpl1/engine/system/low_level_system.h"
//#include <algorithm>
#include "common/algorithm.h"
namespace hpl {
@ -133,9 +133,7 @@ void iResourceManager::DestroyUnused(int alMaxToKeep) {
}
// Sort the sounds according to num of users and then time.
#if 0
std::sort(vResources.begin(), vResources.end(), cSortResources());
#endif
Common::sort(vResources.data(), vResources.data() + vResources.size(), cSortResources());
// Log("-------------Num: %d-----------------\n",vResources.size());
for (size_t i = alMaxToKeep; i < vResources.size(); ++i) {
iResourceBase *pRes = vResources[i];