]> git.itanic.dy.fi Git - sdl-planets/commitdiff
main.c: Coding convention fixes
authorTimo Kokkonen <kaapeli@itanic.dy.fi>
Sun, 4 Apr 2010 08:33:59 +0000 (11:33 +0300)
committerTimo Kokkonen <kaapeli@itanic.dy.fi>
Sun, 4 Apr 2010 08:33:59 +0000 (11:33 +0300)
Signed-off-by: Timo Kokkonen <kaapeli@itanic.dy.fi>
main.c

diff --git a/main.c b/main.c
index d2f408abe1d050151594d31368965e68852be1b6..ac1627d4668df357b242fcea0425fb781f324f38 100644 (file)
--- a/main.c
+++ b/main.c
@@ -14,7 +14,7 @@ static void fade_buf(SDL_Surface *screen, double fade)
        unsigned int *buf = screen->pixels;
        unsigned char *b;
        unsigned char amount;
        unsigned int *buf = screen->pixels;
        unsigned char *b;
        unsigned char amount;
-       static double threshold = 0;
+       static double threshold;
        threshold += fade;
 
        if (threshold > 1) {
        threshold += fade;
 
        if (threshold > 1) {
@@ -24,7 +24,7 @@ static void fade_buf(SDL_Surface *screen, double fade)
                return;
        }
 
                return;
        }
 
-       for (i = 0; i < screen->pitch * screen->h / sizeof(*buf); i ++) {
+       for (i = 0; i < screen->pitch * screen->h / sizeof(*buf); i++) {
                if (!buf[i])
                        continue;
                b = (unsigned char *)&buf[i];
                if (!buf[i])
                        continue;
                b = (unsigned char *)&buf[i];
@@ -33,7 +33,8 @@ static void fade_buf(SDL_Surface *screen, double fade)
                *b = *b >= amount ? (*b - amount) : *b;
                b++;
                *b = *b >= amount ? (*b - amount) : *b;
                *b = *b >= amount ? (*b - amount) : *b;
                b++;
                *b = *b >= amount ? (*b - amount) : *b;
-       }}
+       }
+}
 
 static void clear_buf(SDL_Surface *screen)
 {
 
 static void clear_buf(SDL_Surface *screen)
 {
@@ -50,7 +51,7 @@ static unsigned long gettime(void)
 {
        struct timespec tp;
        unsigned long ret;
 {
        struct timespec tp;
        unsigned long ret;
-       static unsigned long start = 0;
+       static unsigned long start;
 
        clock_gettime(CLOCK_MONOTONIC, &tp);
 
 
        clock_gettime(CLOCK_MONOTONIC, &tp);
 
@@ -111,17 +112,17 @@ static int poll_events(struct sim_status *status, double time)
                                time_scale_rate = 1 / 1.5;
                                break;
                        case SDLK_1:
                                time_scale_rate = 1 / 1.5;
                                break;
                        case SDLK_1:
-                               status->time_scale = 1;
-                               break;
+                               status->time_scale = 1;
+                               break;
                        case SDLK_2:
                        case SDLK_2:
-                               status->time_scale = 10;
-                               break;
+                               status->time_scale = 10;
+                               break;
                        case SDLK_3:
                        case SDLK_3:
-                               status->time_scale = 20;
-                               break;
+                               status->time_scale = 20;
+                               break;
                        case SDLK_4:
                        case SDLK_4:
-                               status->time_scale = 30;
-                               break;
+                               status->time_scale = 30;
+                               break;
                        case SDLK_t:
                                status->tracers_enabled =
                                        !status->tracers_enabled;
                        case SDLK_t:
                                status->tracers_enabled =
                                        !status->tracers_enabled;
@@ -162,10 +163,11 @@ static int poll_events(struct sim_status *status, double time)
                        }
                        break;
                case SDL_VIDEORESIZE:
                        }
                        break;
                case SDL_VIDEORESIZE:
-                       status->screen = SDL_SetVideoMode(event.resize.w,
-                                                         event.resize.h,
-                                                         32,
-                                                         status->screen->flags);
+                       status->screen =
+                               SDL_SetVideoMode(event.resize.w,
+                                                event.resize.h,
+                                                32,
+                                                status->screen->flags);
                        break;
                case SDL_QUIT:
                        goto quit;
                        break;
                case SDL_QUIT:
                        goto quit;