-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
66c6b48
commit b8d78b7
Showing
2 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */ | ||
|
||
#include "RequeuePathsSystem.h" | ||
|
||
#include "Sim/Path/IPathManager.h" | ||
#include "Sim/Path/QTPFS/Components/Path.h" | ||
#include "Sim/Path/QTPFS/PathManager.h" | ||
#include "Sim/Path/QTPFS/Registry.h" | ||
|
||
#include "System/Ecs/EcsMain.h" | ||
#include "System/Ecs/Utils/SystemGlobalUtils.h" | ||
#include "System/TimeProfiler.h" | ||
#include "System/Log/ILog.h" | ||
|
||
using namespace SystemGlobals; | ||
using namespace QTPFS; | ||
|
||
|
||
void RequeuePathsSystem::Init() | ||
{ | ||
systemUtils.OnUpdate().connect<&RequeuePathsSystem::Update>(); | ||
} | ||
|
||
void RequeuePathsSystem::Update() | ||
{ | ||
SCOPED_TIMER("ECS::RequeuePathsSystem::Update"); | ||
|
||
auto* pm = dynamic_cast<PathManager*>(pathManager); | ||
auto view = registry.view<PathRequeueSearch>(); | ||
for (auto pathEntity : view) { | ||
bool &requeueSearch = view.get<PathRequeueSearch>(pathEntity).value; | ||
if (requeueSearch) { | ||
pm->RequeueSearch(®istry.get<IPath>(pathEntity), true, false); | ||
registry.emplace_or_replace<PathUpdatedCounterIncrease>(pathEntity); | ||
requeueSearch = false; | ||
} | ||
} | ||
} | ||
|
||
void RequeuePathsSystem::Shutdown() { | ||
systemUtils.OnUpdate().disconnect<&RequeuePathsSystem::Update>(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* This file is part of the Spring engine (GPL v2 or later), see LICENSE.html */ | ||
|
||
#ifndef REQUEUE_PATHS_SYSTEM_H__ | ||
#define REQUEUE_PATHS_SYSTEM_H__ | ||
|
||
namespace QTPFS { | ||
|
||
class RequeuePathsSystem { | ||
public: | ||
static void Init(); | ||
static void Update(); | ||
static void Shutdown(); | ||
}; | ||
|
||
} | ||
|
||
#endif |