Fixes infinite loop issue in trapgen
Vertical coridoors before level 4 wouldn't leave enough space to place 4 traps since there is only 10 rows of tiles eligible for a trap and every trap ocupies 3 rows and requires at least 2 spare rows. This could cause an infinite loop situation. * Also fixes linux build warnings and other stuff.
This commit is contained in:
parent
0ca64fb882
commit
ef0e418e96
2
.vimrc
2
.vimrc
|
@ -5,4 +5,4 @@ nnoremap <F4> :ter ++close ./_build/breakhack<cr>
|
||||||
|
|
||||||
packadd termdebug
|
packadd termdebug
|
||||||
let g:termdebug_wide = 1
|
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' ]
|
||||||
|
|
|
@ -31,6 +31,7 @@ function module.add_traps_to_room(room)
|
||||||
end
|
end
|
||||||
|
|
||||||
local count = random(4)
|
local count = random(4)
|
||||||
|
local attempts = 0;
|
||||||
local i = 0
|
local i = 0
|
||||||
while i < count do
|
while i < count do
|
||||||
local rx = random(13) + 1
|
local rx = random(13) + 1
|
||||||
|
@ -55,6 +56,8 @@ function module.add_traps_to_room(room)
|
||||||
i = i + 1
|
i = i + 1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
attempts = attempts + 1
|
||||||
|
if attempts > 100 then break end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -62,8 +62,9 @@ void
|
||||||
steam_init()
|
steam_init()
|
||||||
{
|
{
|
||||||
m_AppID = c_SteamAPI_Init();
|
m_AppID = c_SteamAPI_Init();
|
||||||
c_SteamAPI_SetCallbacks(stats_received, stats_stored, leaderboard_received);
|
|
||||||
m_Initiated = m_AppID != 0;
|
m_Initiated = m_AppID != 0;
|
||||||
|
if (m_Initiated)
|
||||||
|
c_SteamAPI_SetCallbacks(stats_received, stats_stored, leaderboard_received);
|
||||||
requestDataTimer = timer_create();
|
requestDataTimer = timer_create();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +74,7 @@ void steam_shutdown(void)
|
||||||
timer_destroy(requestDataTimer);
|
timer_destroy(requestDataTimer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
static void
|
||||||
request_data_queue_run(void)
|
request_data_queue_run(void)
|
||||||
{
|
{
|
||||||
if (!timer_started(requestDataTimer))
|
if (!timer_started(requestDataTimer))
|
||||||
|
@ -122,4 +123,4 @@ void steam_register_kills(Sint32 nKills)
|
||||||
if (!m_hKillsLeaderboard)
|
if (!m_hKillsLeaderboard)
|
||||||
return;
|
return;
|
||||||
c_SteamUserStats_UploadLeaderboardScore(m_hKillsLeaderboard, nKills);
|
c_SteamUserStats_UploadLeaderboardScore(m_hKillsLeaderboard, nKills);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@ else ()
|
||||||
add_library(steamworks_c_wrapper
|
add_library(steamworks_c_wrapper
|
||||||
SHARED
|
SHARED
|
||||||
src/steamworks_c_wrapper
|
src/steamworks_c_wrapper
|
||||||
|
src/CallbackHandler
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <steam_api.h>
|
#include <steam_api.h>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
class CallbackHandler
|
class CallbackHandler
|
||||||
{
|
{
|
||||||
|
@ -16,9 +17,9 @@ public:
|
||||||
|
|
||||||
void(*statsReceivedCb)() = nullptr;
|
void(*statsReceivedCb)() = nullptr;
|
||||||
void(*statsStoredCb)() = nullptr;
|
void(*statsStoredCb)() = nullptr;
|
||||||
void(*leaderboardReceivedCb)(int64, const char*) = nullptr;
|
void(*leaderboardReceivedCb)(int64_t, const char*) = nullptr;
|
||||||
|
|
||||||
bool CallbackReceived() const;
|
bool CallbackReceived() const;
|
||||||
|
|
||||||
void OnFindLeaderboard(LeaderboardFindResult_t *pCallback, bool bIOFailiure);
|
void OnFindLeaderboard(LeaderboardFindResult_t *pCallback, bool bIOFailiure);
|
||||||
};
|
};
|
||||||
|
|
|
@ -12,9 +12,9 @@ static CallbackHandler *m_CallbackHandler = NULL;
|
||||||
extern "C" int64_t
|
extern "C" int64_t
|
||||||
c_SteamAPI_Init()
|
c_SteamAPI_Init()
|
||||||
{
|
{
|
||||||
|
m_CallbackHandler = new CallbackHandler(m_AppId);
|
||||||
if (SteamAPI_Init()) {
|
if (SteamAPI_Init()) {
|
||||||
m_AppId = SteamUtils()->GetAppID();
|
m_AppId = SteamUtils()->GetAppID();
|
||||||
m_CallbackHandler = new CallbackHandler(m_AppId);
|
|
||||||
m_Initiated = true;
|
m_Initiated = true;
|
||||||
return m_AppId;
|
return m_AppId;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue