2023-05-02 09:42:43 +03:00
|
|
|
//
|
2023-05-24 23:41:23 +03:00
|
|
|
// YaPB, based on PODBot by Markus Klinge ("CountFloyd").
|
|
|
|
|
// Copyright © YaPB Project Developers <yapb@jeefo.net>.
|
2023-05-02 09:42:43 +03:00
|
|
|
//
|
|
|
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
// limits for storing practice data
|
|
|
|
|
CR_DECLARE_SCOPED_ENUM_TYPE (VisIndex, int32_t,
|
|
|
|
|
None = 0,
|
|
|
|
|
Stand = 1,
|
|
|
|
|
Crouch = 2,
|
|
|
|
|
Any = Stand | Crouch
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// defines visibility count
|
|
|
|
|
struct PathVis {
|
2024-11-13 17:52:19 +03:00
|
|
|
uint16_t stand {}, crouch {};
|
2023-05-02 09:42:43 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class GraphVistable final : public Singleton <GraphVistable> {
|
|
|
|
|
public:
|
|
|
|
|
using VisStorage = uint8_t;
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
SmallArray <VisStorage> m_vistable {};
|
|
|
|
|
bool m_rebuild {};
|
|
|
|
|
int m_length {};
|
|
|
|
|
|
|
|
|
|
int m_curIndex {};
|
|
|
|
|
int m_sliceIndex {};
|
|
|
|
|
|
|
|
|
|
float m_notifyMsgTimestamp {};
|
|
|
|
|
|
|
|
|
|
public:
|
2023-05-12 20:00:06 +03:00
|
|
|
explicit GraphVistable () = default;
|
2023-05-02 09:42:43 +03:00
|
|
|
~GraphVistable () = default;
|
|
|
|
|
|
|
|
|
|
public:
|
2025-10-08 20:12:46 +03:00
|
|
|
bool visible (int srcIndex, int destIndex, VisIndex vis = VisIndex::Any) const;
|
2023-05-02 09:42:43 +03:00
|
|
|
|
|
|
|
|
void load ();
|
2025-05-07 13:07:40 +03:00
|
|
|
void save () const;
|
2023-05-02 09:42:43 +03:00
|
|
|
void rebuild ();
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
// triggers re-check for all the nodes
|
|
|
|
|
void startRebuild ();
|
|
|
|
|
|
|
|
|
|
// ready to use ?
|
|
|
|
|
bool isReady () const {
|
|
|
|
|
return !m_rebuild;
|
|
|
|
|
}
|
2025-11-12 21:31:23 +03:00
|
|
|
|
|
|
|
|
// is visible fromr both points ?
|
|
|
|
|
bool visibleBothSides (int srcIndex, int destIndex, VisIndex vis = VisIndex::Any) const {
|
|
|
|
|
return visible (srcIndex, destIndex, vis) && visible (destIndex, srcIndex, vis);
|
|
|
|
|
}
|
2023-05-02 09:42:43 +03:00
|
|
|
};
|
|
|
|
|
|
2023-05-12 22:12:22 +03:00
|
|
|
// expose global
|
2023-05-02 09:42:43 +03:00
|
|
|
CR_EXPOSE_GLOBAL_SINGLETON (GraphVistable, vistab);
|
|
|
|
|
|