limit delta to 1 second

It doesn't make much sense to react to bugger deltas; especially that
looping over Gamestate_Tick may take significant amount of time in such
cases.
This commit is contained in:
Sebastian Krzyszkowiak 2019-07-22 17:51:57 +02:00
parent 5ca9d844b8
commit 1807fe256e
No known key found for this signature in database
GPG key ID: E8F235CF3BDBC3FF

View file

@ -90,6 +90,10 @@ SYMBOL_INTERNAL void DrawGamestates(struct Game* game) {
SYMBOL_INTERNAL void LogicGamestates(struct Game* game, double delta) {
struct Gamestate* tmp = game->_priv.gamestates;
if (delta > 1) {
PrintConsole(game, "delta > 1 second!");
delta = 1;
}
int ticks = (int)(floor((game->time + delta) / ALLEGRO_BPS_TO_SECS(60.0)) - floor(game->time / ALLEGRO_BPS_TO_SECS(60.0)));
game->time += delta;
if (game->_priv.params.handlers.prelogic) {