Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
with
89 additions
and 19 deletions.
- +7 −1 VCS PC/Antennas.cpp
- +2 −0 VCS PC/CCamera.h
- +5 −1 VCS PC/Coronas.cpp
- +3 −0 VCS PC/Pad.cpp
- +16 −1 VCS PC/Radar.cpp
- +0 −3 VCS PC/Rs.cpp
- +23 −0 VCS PC/StaticPatcher.cpp
- +15 −0 VCS PC/StaticPatcher.h
- +1 −0 VCS PC/StdAfx.h
- +5 −1 VCS PC/VCS PC.vcxproj
- +6 −0 VCS PC/VCS PC.vcxproj.filters
- +6 −12 VCS PC/VCSPC.cpp
There are no files selected for viewing
| @@ -0,0 +1,23 @@ | |||
| #include "StdAfx.h" | |||
| #include "StaticPatcher.h" | |||
|
|
|||
| std::vector<std::function<void()>>* StaticPatcher::m_pFunctions; | |||
|
|
|||
| StaticPatcher::StaticPatcher(std::function<void()> pInitializer) | |||
| { | |||
| if ( !m_pFunctions ) | |||
| m_pFunctions = new std::vector<std::function<void()>>; | |||
|
|
|||
| m_pFunctions->push_back(pInitializer); | |||
| } | |||
|
|
|||
| void StaticPatcher::Apply() | |||
| { | |||
| if ( m_pFunctions ) | |||
| { | |||
| for ( auto it = m_pFunctions->cbegin(); it != m_pFunctions->cend(); it++ ) | |||
| (*it)(); | |||
|
|
|||
| delete m_pFunctions; | |||
| } | |||
| } | |||
| @@ -0,0 +1,15 @@ | |||
| #ifndef __STATICPATCHER | |||
| #define __STATICPATCHER | |||
|
|
|||
| class StaticPatcher | |||
| { | |||
| private: | |||
| static std::vector<std::function<void()>>* m_pFunctions; | |||
|
|
|||
| public: | |||
| StaticPatcher(std::function<void()> pInitializer); | |||
|
|
|||
| static void Apply(); | |||
| }; | |||
|
|
|||
| #endif | |||