From fd3f3a78b6a5dcb0470f6be12d91db4bb497de1a Mon Sep 17 00:00:00 2001
From: Allanis <allanis@saracraft.net>
Date: Fri, 8 Feb 2013 16:10:31 +0000
Subject: [PATCH] [Fix] Small graphics bug.

---
 src/pilot.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/pilot.c b/src/pilot.c
index 8874eae..e025219 100644
--- a/src/pilot.c
+++ b/src/pilot.c
@@ -125,6 +125,9 @@ void pilot_render(Pilot* p) {
 
   // Get the sprite corresponding to the direction facing.
   sprite = (int)(p->solid->dir / (2.0*M_PI / (t->sy * t->sx)));
+  
+  // Ugly hack to make sure it's always "inbound".
+  if(sprite > (int)(t->sy*t->sx)-1) sprite = (int)(t->sy*t->sx)-1;
 
   gl_blitSprite(t, &p->solid->pos, sprite % (int)t->sx, sprite / (int)t->sy);
 }