diff --git a/.vimrc b/.vimrc index 579fddc..4647378 100644 --- a/.vimrc +++ b/.vimrc @@ -5,4 +5,4 @@ nnoremap :ter ++close ./_build/breakhack packadd termdebug let g:termdebug_wide = 1 -let g:syntastic_c_include_dirs = [ '_build', '/usr/include/SDL2' ] +let g:syntastic_c_include_dirs = [ '_build', '/usr/include/SDL2', 'steamworks_c_wrapper/src', 'steamworks_c_wrapper/sdk/public/steam' ] diff --git a/data/trapgen.lua b/data/trapgen.lua index 8edbd1c..8e47892 100644 --- a/data/trapgen.lua +++ b/data/trapgen.lua @@ -31,6 +31,7 @@ function module.add_traps_to_room(room) end local count = random(4) + local attempts = 0; local i = 0 while i < count do local rx = random(13) + 1 @@ -55,6 +56,8 @@ function module.add_traps_to_room(room) i = i + 1 end end + attempts = attempts + 1 + if attempts > 100 then break end end end diff --git a/src/steam/steamworks_api_wrapper.c b/src/steam/steamworks_api_wrapper.c index ac597b6..716cdde 100644 --- a/src/steam/steamworks_api_wrapper.c +++ b/src/steam/steamworks_api_wrapper.c @@ -62,8 +62,9 @@ void steam_init() { m_AppID = c_SteamAPI_Init(); - c_SteamAPI_SetCallbacks(stats_received, stats_stored, leaderboard_received); m_Initiated = m_AppID != 0; + if (m_Initiated) + c_SteamAPI_SetCallbacks(stats_received, stats_stored, leaderboard_received); requestDataTimer = timer_create(); } @@ -73,7 +74,7 @@ void steam_shutdown(void) timer_destroy(requestDataTimer); } -void +static void request_data_queue_run(void) { if (!timer_started(requestDataTimer)) @@ -122,4 +123,4 @@ void steam_register_kills(Sint32 nKills) if (!m_hKillsLeaderboard) return; c_SteamUserStats_UploadLeaderboardScore(m_hKillsLeaderboard, nKills); -} \ No newline at end of file +} diff --git a/steamworks_c_wrapper/CMakeLists.txt b/steamworks_c_wrapper/CMakeLists.txt index 731c097..f948ab6 100644 --- a/steamworks_c_wrapper/CMakeLists.txt +++ b/steamworks_c_wrapper/CMakeLists.txt @@ -34,6 +34,7 @@ else () add_library(steamworks_c_wrapper SHARED src/steamworks_c_wrapper + src/CallbackHandler ) endif() diff --git a/steamworks_c_wrapper/src/CallbackHandler.h b/steamworks_c_wrapper/src/CallbackHandler.h index 2abba9b..1cb8ebc 100644 --- a/steamworks_c_wrapper/src/CallbackHandler.h +++ b/steamworks_c_wrapper/src/CallbackHandler.h @@ -1,6 +1,7 @@ #pragma once #include +#include class CallbackHandler { @@ -16,9 +17,9 @@ public: void(*statsReceivedCb)() = nullptr; void(*statsStoredCb)() = nullptr; - void(*leaderboardReceivedCb)(int64, const char*) = nullptr; + void(*leaderboardReceivedCb)(int64_t, const char*) = nullptr; bool CallbackReceived() const; void OnFindLeaderboard(LeaderboardFindResult_t *pCallback, bool bIOFailiure); -}; \ No newline at end of file +}; diff --git a/steamworks_c_wrapper/src/steamworks_c_wrapper.cpp b/steamworks_c_wrapper/src/steamworks_c_wrapper.cpp index 296a157..3123c4f 100644 --- a/steamworks_c_wrapper/src/steamworks_c_wrapper.cpp +++ b/steamworks_c_wrapper/src/steamworks_c_wrapper.cpp @@ -12,9 +12,9 @@ static CallbackHandler *m_CallbackHandler = NULL; extern "C" int64_t c_SteamAPI_Init() { + m_CallbackHandler = new CallbackHandler(m_AppId); if (SteamAPI_Init()) { m_AppId = SteamUtils()->GetAppID(); - m_CallbackHandler = new CallbackHandler(m_AppId); m_Initiated = true; return m_AppId; }