Skip to content

Commit a4f3a0b

Browse files
authored
Merge pull request #273 from FreeZoneMods/xd_dev
fix event notifier for Linux build
2 parents 09a5d86 + 55a56d4 commit a4f3a0b

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

src/xrCore/Events/Notifier.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
#include "xrCore/Threading/Lock.hpp"
1414
#include "xrCore/Threading/ScopeLock.hpp"
1515

16+
#include <limits>
17+
#include <algorithm>
18+
1619
/*!
1720
\brief Base abstract class for implementing event handling callbacks
1821
@@ -49,7 +52,7 @@ class CEventNotifierCallbackWithCid : public CEventNotifierCallback
4952
/*! Constructor, takes callback ID which was generated by the notifier
5053
/param[in] cid callback ID, should be generated by the notifier in subscription process only
5154
*/
52-
CEventNotifierCallbackWithCid(CID cid) : m_cid(cid), CEventNotifierCallback(){};
55+
CEventNotifierCallbackWithCid(CID cid) : CEventNotifierCallback(), m_cid(cid){};
5356

5457
/*! Returns the callback ID which was generated by the notifier and passed to the constructor */
5558
CID GetCid() const { return m_cid; }
@@ -87,7 +90,7 @@ class CEventNotifier
8790
CEventNotifierCallback::CID FindFreeCid()
8891
{
8992
ScopeLock lock(&m_lock);
90-
auto it = std::find(m_callbacks.begin(), m_callbacks.end(), nullptr);
93+
auto it = std::find(m_callbacks.begin(), m_callbacks.end(), static_cast<CEventNotifierCallback*>(nullptr));
9194
return (it == m_callbacks.end()) ? CEventNotifierCallback::INVALID_CID :
9295
std::distance(m_callbacks.begin(), it);
9396
}
@@ -96,7 +99,7 @@ class CEventNotifier
9699
CEventNotifierCallback::CID RegisterCallback(CEventNotifierCallback* cb)
97100
{
98101
ScopeLock lock(&m_lock);
99-
auto it = std::find(m_callbacks.begin(), m_callbacks.end(), nullptr);
102+
auto it = std::find(m_callbacks.begin(), m_callbacks.end(), static_cast<CEventNotifierCallback*>(nullptr));
100103
return (it == m_callbacks.end()) ? (m_callbacks.emplace_back(cb), m_callbacks.size() - 1) :
101104
(it->callback.reset(cb), std::distance(m_callbacks.begin(), it));
102105
}
@@ -203,7 +206,7 @@ class CEventNotifier
203206
CEventNotifierCallback::CID CreateRegisteredCallback(unsigned int event_id, Args&&... args)
204207
{
205208
R_ASSERT(event_id < CNT);
206-
return m_callbacks[event_id].CreateRegisteredCallback<CB>(args...);
209+
return m_callbacks[event_id].template CreateRegisteredCallback<CB>(args...);
207210
}
208211

209212
/*! \brief Provides the way to unsubscribe and delete the callback

src/xrGame/MainMenu.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ CMainMenu::CMainMenu()
7676
void ProcessEvent() override { m_mainmenu->DestroyInternal(true); }
7777
};
7878

79-
m_script_reset_event_cid = ai().Subscribe<CResetEventCb>(CAI_Space::EVENT_SCRIPT_ENGINE_RESET, this);
79+
m_script_reset_event_cid = ai().template Subscribe<CResetEventCb>(CAI_Space::EVENT_SCRIPT_ENGINE_RESET, this);
8080

8181
m_Flags.zero();
8282
m_startDialog = NULL;

src/xrGame/ai_space.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class CAI_Space : public AISpaceBase
7676
template <class CB, class... Args>
7777
CEventNotifierCallback::CID Subscribe(EEventID event_id, Args&&... args)
7878
{
79-
return m_events_notifier.CreateRegisteredCallback<CB>(event_id, args...);
79+
return m_events_notifier.template CreateRegisteredCallback<CB>(event_id, args...);
8080
}
8181

8282
bool Unsubscribe(CEventNotifierCallback::CID cid, EEventID event_id);

src/xrGame/ui/UIWpnParams.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ void CUIWpnParams::SetInfo(CInventoryItem* slot_wpn, CInventoryItem& cur_wpn)
120120
};
121121

122122
g_lua_wpn_params = new SLuaWpnParams();
123-
ai().Subscribe<CResetEventCb>(CAI_Space::EVENT_SCRIPT_ENGINE_RESET);
123+
ai().template Subscribe<CResetEventCb>(CAI_Space::EVENT_SCRIPT_ENGINE_RESET);
124124
}
125125

126126
LPCSTR cur_section = cur_wpn.object().cNameSect().c_str();

src/xrServerEntities/object_factory_inline.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ IC const CObjectFactory& object_factory()
3030
}
3131
};
3232

33-
ai().Subscribe<CResetEventCb>(CAI_Space::EVENT_SCRIPT_ENGINE_RESET);
33+
ai().template Subscribe<CResetEventCb>(CAI_Space::EVENT_SCRIPT_ENGINE_RESET);
3434
}
3535
return (*g_object_factory);
3636
}

0 commit comments

Comments
 (0)