From 3db72416630980f1a557fdcac6fc81f592766e43 Mon Sep 17 00:00:00 2001
From: Allanis <allanis@saracraft.net>
Date: Sun, 10 Feb 2013 21:06:08 +0000
Subject: [PATCH] [Fix] Configuration file issues.

---
 src/main.c   | 2 +-
 src/opengl.c | 2 +-
 src/player.c | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/main.c b/src/main.c
index a7ae77a..952ddc6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -122,7 +122,7 @@ int main(int argc, char** argv) {
     // Grab the keybindings if there are any.
     char* str;
     int type, key, reverse;
-    for(i = 0; keybindNames[i]; i++) {
+    for(i = 0; strcmp(keybindNames[i],"end"); i++) {
       lua_getglobal(L, keybindNames[i]);
       str = NULL;
       key = -1;
diff --git a/src/opengl.c b/src/opengl.c
index 003e378..5d7d162 100644
--- a/src/opengl.c
+++ b/src/opengl.c
@@ -591,7 +591,7 @@ int gl_init(void) {
       DEBUG("Available fullscreen modes:");
       for(i = 0; modes[i]; ++i) {
         DEBUG("\t%dx%d", modes[i]->w, modes[i]->h);
-        if(flags & SDL_FULLSCREEN && modes[i]->w == gl_screen.w && modes[i]->h == gl_screen.h)
+        if((flags & SDL_FULLSCREEN) && (modes[i]->w == gl_screen.w) && (modes[i]->h == gl_screen.h))
           supported = 1;
       }
     }
diff --git a/src/player.c b/src/player.c
index 655db0f..79834c7 100644
--- a/src/player.c
+++ b/src/player.c
@@ -24,7 +24,7 @@ typedef struct {
 static Keybind** player_input; // Contains the players keybindings.
 // Name of each keybinding.
 const char* keybindNames[] = { "accel", "left", "right", "primary", "target",
-      "target_nearest", "mapzoomin", "mapzoomout" };
+      "target_nearest", "mapzoomin", "mapzoomout", "end" }; // Need to terminate in "end".
 
 // Player stuff.
 Pilot* player = NULL; // extern in pilot.h
@@ -394,7 +394,7 @@ void input_init(void) {
   player_input = malloc(i*sizeof(Keybind*));
 
   // Create a null keybinding for each.
-  for(i = 0; keybindNames[i]; i++) {
+  for(i = 0; strcmp(keybindNames[i], "end"); i++) {
     tmp = MALLOC_L(Keybind);
     tmp->name = (char*)keybindNames[i];
     tmp->type = KEYBIND_NULL;