Skip to content

Commit

Permalink
fix linux build
Browse files Browse the repository at this point in the history
  • Loading branch information
FreeZoneMods committed Nov 10, 2018
1 parent 09a5d86 commit 55a56d4
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
11 changes: 7 additions & 4 deletions src/xrCore/Events/Notifier.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
#include "xrCore/Threading/Lock.hpp"
#include "xrCore/Threading/ScopeLock.hpp"

#include <limits>
#include <algorithm>

/*!
\brief Base abstract class for implementing event handling callbacks
Expand Down Expand Up @@ -49,7 +52,7 @@ class CEventNotifierCallbackWithCid : public CEventNotifierCallback
/*! Constructor, takes callback ID which was generated by the notifier
/param[in] cid callback ID, should be generated by the notifier in subscription process only
*/
CEventNotifierCallbackWithCid(CID cid) : m_cid(cid), CEventNotifierCallback(){};
CEventNotifierCallbackWithCid(CID cid) : CEventNotifierCallback(), m_cid(cid){};

/*! Returns the callback ID which was generated by the notifier and passed to the constructor */
CID GetCid() const { return m_cid; }
Expand Down Expand Up @@ -87,7 +90,7 @@ class CEventNotifier
CEventNotifierCallback::CID FindFreeCid()
{
ScopeLock lock(&m_lock);
auto it = std::find(m_callbacks.begin(), m_callbacks.end(), nullptr);
auto it = std::find(m_callbacks.begin(), m_callbacks.end(), static_cast<CEventNotifierCallback*>(nullptr));
return (it == m_callbacks.end()) ? CEventNotifierCallback::INVALID_CID :
std::distance(m_callbacks.begin(), it);
}
Expand All @@ -96,7 +99,7 @@ class CEventNotifier
CEventNotifierCallback::CID RegisterCallback(CEventNotifierCallback* cb)
{
ScopeLock lock(&m_lock);
auto it = std::find(m_callbacks.begin(), m_callbacks.end(), nullptr);
auto it = std::find(m_callbacks.begin(), m_callbacks.end(), static_cast<CEventNotifierCallback*>(nullptr));
return (it == m_callbacks.end()) ? (m_callbacks.emplace_back(cb), m_callbacks.size() - 1) :
(it->callback.reset(cb), std::distance(m_callbacks.begin(), it));
}
Expand Down Expand Up @@ -203,7 +206,7 @@ class CEventNotifier
CEventNotifierCallback::CID CreateRegisteredCallback(unsigned int event_id, Args&&... args)
{
R_ASSERT(event_id < CNT);
return m_callbacks[event_id].CreateRegisteredCallback<CB>(args...);
return m_callbacks[event_id].template CreateRegisteredCallback<CB>(args...);
}

/*! \brief Provides the way to unsubscribe and delete the callback
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/MainMenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ CMainMenu::CMainMenu()
void ProcessEvent() override { m_mainmenu->DestroyInternal(true); }
};

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

m_Flags.zero();
m_startDialog = NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/ai_space.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class CAI_Space : public AISpaceBase
template <class CB, class... Args>
CEventNotifierCallback::CID Subscribe(EEventID event_id, Args&&... args)
{
return m_events_notifier.CreateRegisteredCallback<CB>(event_id, args...);
return m_events_notifier.template CreateRegisteredCallback<CB>(event_id, args...);
}

bool Unsubscribe(CEventNotifierCallback::CID cid, EEventID event_id);
Expand Down
2 changes: 1 addition & 1 deletion src/xrGame/ui/UIWpnParams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ void CUIWpnParams::SetInfo(CInventoryItem* slot_wpn, CInventoryItem& cur_wpn)
};

g_lua_wpn_params = new SLuaWpnParams();
ai().Subscribe<CResetEventCb>(CAI_Space::EVENT_SCRIPT_ENGINE_RESET);
ai().template Subscribe<CResetEventCb>(CAI_Space::EVENT_SCRIPT_ENGINE_RESET);
}

LPCSTR cur_section = cur_wpn.object().cNameSect().c_str();
Expand Down
2 changes: 1 addition & 1 deletion src/xrServerEntities/object_factory_inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ IC const CObjectFactory& object_factory()
}
};

ai().Subscribe<CResetEventCb>(CAI_Space::EVENT_SCRIPT_ENGINE_RESET);
ai().template Subscribe<CResetEventCb>(CAI_Space::EVENT_SCRIPT_ENGINE_RESET);
}
return (*g_object_factory);
}
Expand Down

0 comments on commit 55a56d4

Please sign in to comment.