[Fix] Renamed time to gtime and made it global as it is used in pause.c

This commit is contained in:
Tamir Atias 2013-02-17 02:52:52 +02:00
parent 61f1069542
commit 326b475923
2 changed files with 7 additions and 7 deletions

View File

@ -33,7 +33,7 @@
#define FONT_SIZE 12
static int quit = 0; // Primary loop.
static unsigned int time = 0; // Calculate FPS and movement.
unsigned int gtime = 0; // Calculate FPS and movement.
static char version[VERSION_LEN];
// Just some default crap.
@ -135,7 +135,7 @@ int main(int argc, char** argv) {
// Create new player. TODO: Start menu.
player_new();
time = SDL_GetTicks(); // Init the time.
gtime = SDL_GetTicks(); // Init the time.
// Main loop.
SDL_Event event;
@ -188,8 +188,8 @@ static double fps_dt = 1.;
static double dt = 0.;
static void update_space(void) {
// dt in ms/1000.
dt = (double)(SDL_GetTicks() - time) / 1000.;
time = SDL_GetTicks();
dt = (double)(SDL_GetTicks() - gtime) / 1000.;
gtime = SDL_GetTicks();
// TODO: This could use some work.
if(dt > MINIMUM_FPS) {

View File

@ -11,7 +11,7 @@ int paused = 0; // Are we paused.
extern Pilot** pilot_stack;
extern int pilots;
// From main.c
extern unsigned int time;
extern unsigned int gtime;
static void pilots_pause(void);
static void pilots_unpause(void);
@ -20,7 +20,7 @@ static void pilots_unpause(void);
void pause(void) {
if(paused) return; // Well well.. We are paused already.
time -= SDL_GetTicks();
gtime -= SDL_GetTicks();
pilots_pause();
weapons_pause();
@ -30,7 +30,7 @@ void pause(void) {
void unpause(void) {
if(!paused) return; // We are unpaused already.
time += SDL_GetTicks();
gtime += SDL_GetTicks();
pilots_unpause();
weapons_unpause();