From b9575f897b17c88e30da98b8cd92c945f5623fea Mon Sep 17 00:00:00 2001
From: "p.kosyh"
Date: Thu, 3 Jun 2010 08:12:40 +0000
Subject: [PATCH] clever sorting
---
debian/changelog | 5 ++++-
src/sdl-instead/game.c | 4 ++++
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/debian/changelog b/debian/changelog
index 2483e20..e750354 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,9 @@
instead (1.2) unstable; urgency=low
- * unpack feature;
+ * unpack/install feature;
+ * browse feature (win32 and gtk);
+ * clever sorting;
+ * remove games;
-- Peter Kosyh Tue, 01 Jun 2010 17:40:00 +0300
diff --git a/src/sdl-instead/game.c b/src/sdl-instead/game.c
index b5d40ca..bbeb9a1 100644
--- a/src/sdl-instead/game.c
+++ b/src/sdl-instead/game.c
@@ -104,6 +104,10 @@ static int cmp_game(const void *p1, const void *p2)
{
const struct game *g1 = (const struct game*)p1;
const struct game *g2 = (const struct game*)p2;
+ int g1_s = !!strncmp(g1->path, GAMES_PATH, strlen(GAMES_PATH));
+ int g2_s = !!strncmp(g2->path, GAMES_PATH, strlen(GAMES_PATH));
+ if (g1_s != g2_s)
+ return g1_s - g2_s;
return strcmp(g1->name, g2->name);
}