Factor timestep calculation out to Game function

This is so we can grab the game's timestep anywhere else in the codebase
without copy-pasting it.
This commit is contained in:
Misa
2021-04-02 11:50:30 -07:00
committed by Ethan Lee
parent f8f6f3b96e
commit f6ea05f521
3 changed files with 32 additions and 30 deletions

View File

@@ -6742,3 +6742,33 @@ void Game::copyndmresults(void)
ndmresulthardestroom = hardestroom;
SDL_memcpy(ndmresultcrewstats, crewstats, sizeof(ndmresultcrewstats));
}
static inline int get_framerate(const int slowdown)
{
switch (slowdown)
{
case 30:
return 34;
case 24:
return 41;
case 18:
return 55;
case 12:
return 83;
}
return 34;
}
int Game::get_timestep(void)
{
switch (gamestate)
{
case EDITORMODE:
return 24;
case GAMEMODE:
return get_framerate(slowdown);
default:
return 34;
}
}