File tree 2 files changed +15
-5
lines changed
2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change 14
14
std::vector<AMX *> CCallbackManager::m_vAmx;
15
15
std::map<AMX *, std::vector<int >> CCallbackManager::m_mapCallbacks;
16
16
std::queue<AMX *> CCallbackManager::m_vAmxLoadQueue;
17
+ std::queue<AMX *> CCallbackManager::m_vAmxInitQueue;
17
18
std::array<char *, CCallbackManager::Callbacks::CallbacksCount> CCallbackManager::m_aCallbackNames = {
18
19
(char *)" FCNPC_OnInit" ,
19
20
(char *)" FCNPC_OnCreate" ,
@@ -57,13 +58,21 @@ void CCallbackManager::Init()
57
58
58
59
if (vIndexes.size () > 0 ) {
59
60
m_mapCallbacks[pAmx] = vIndexes;
60
-
61
- int iIndex = vIndexes.at (FCNPC_OnInit);
62
- if (iIndex != 0 ) {
63
- amx_Exec (pAmx, NULL , iIndex);
64
- }
65
61
}
62
+
66
63
m_vAmxLoadQueue.pop ();
64
+ m_vAmxInitQueue.push (pAmx);
65
+ }
66
+
67
+ while (!m_vAmxInitQueue.empty ()) {
68
+ AMX *pAmx = m_vAmxInitQueue.front ();
69
+
70
+ int iIndex = m_mapCallbacks[pAmx].at (FCNPC_OnInit);
71
+ if (iIndex != 0 ) {
72
+ amx_Exec (pAmx, NULL , iIndex);
73
+ }
74
+
75
+ m_vAmxInitQueue.pop ();
67
76
}
68
77
}
69
78
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ class CCallbackManager
46
46
47
47
static std::vector<AMX *> m_vAmx;
48
48
static std::queue<AMX *> m_vAmxLoadQueue;
49
+ static std::queue<AMX *> m_vAmxInitQueue;
49
50
50
51
enum Callbacks {
51
52
FCNPC_OnInit,
You can’t perform that action at this time.
0 commit comments