From c4536b1bccaa26175ac6f8a482c4ab50baa86cdd Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Thu, 12 Nov 2015 22:10:00 +0100
Subject: Fix detection of freetype.


diff --git a/configure.ac b/configure.ac
index c1fa529..93ed5de 100644
--- a/configure.ac
+++ b/configure.ac
@@ -12,6 +12,7 @@ AC_PROG_RANLIB
 
 PKG_CHECK_MODULES(ZAZ, [sdl vorbisfile theoraenc theoradec])
 PKG_CHECK_MODULES(FTGL, ftgl >= 2.1.3)
+PKG_CHECK_MODULES(FREETYPE, freetype2)
 
 AC_CHECK_LIB(SDL_image, IMG_Load, [], AC_MSG_ERROR(no SDL_image found))
 AC_CHECK_LIB(vorbisenc, vorbis_encode_init, [], AC_MSG_ERROR(no vorbisenc found))
diff --git a/src/Makefile.am b/src/Makefile.am
index 0028693..83e4dd6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -2,9 +2,7 @@ AM_CPPFLAGS = \
 	-DPACKAGE_LOCALE_DIR=\""$(localedir)"\" \
 	-DPACKAGE_SRC_DIR=\""$(srcdir)"\" \
 	-DPACKAGE_DATA_DIR=\""$(datadir)"\"\
-	-I/usr/include/freetype2\
-	-DENABLE_SPLASH=$(enable_splash)
-	$(FTGL_CFLAGS)
+	-DENABLE_SPLASH=$(enable_splash) $(FTGL_CFLAGS) $(FREETYPE_FLAGS)
 
 AM_CFLAGS =\
 	 -Wall\
@@ -75,5 +73,5 @@ zaz_SOURCES = \
 
 zaz_LDFLAGS = 
 
-zaz_LDADD = $(ZAZ_LIBS) $(FTGL_LIBS) $(GL_LIBS) @LIBINTL@
+zaz_LDADD = $(ZAZ_LIBS) $(FTGL_LIBS) $(FREETYPE_LIBS) $(GL_LIBS) @LIBINTL@
 
-- 
2.19.0


From 027a2efbf8b1f4ced9dd2c59c8919a3a335a7557 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Thu, 12 Nov 2015 22:10:15 +0100
Subject: Fix line endings.


diff --git a/src/settings.cpp b/src/settings.cpp
index ff1c002..9334aa3 100755
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -27,10 +27,11 @@
 
 #ifdef WIN32
 #include <shlobj.h>
-#include <shlwapi.h>
#endif
+#include <shlwapi.h>
+#endif
 
 #ifndef WIN32
-#include <dirent.h>
+#include <dirent.h>
 #endif
 
 using namespace std;
@@ -38,7 +39,8 @@ using namespace std;
 struct langlist_tag
 {
     const char *name;
-    const char *description;
    Uint16 lid;
+    const char *description;
+    Uint16 lid;
 };
 
 struct langlist_tag langlist[] =
@@ -162,7 +164,8 @@ string Settings::getHighscoreFileName(void)
 {
     return getDefaultDirectory() + SEPARATOR + HIGHSCORE_FILENAME;
 }
-
Settings::Settings(string fileName)
+
+Settings::Settings(string fileName)
         : fileNameInUse(fileName)
 {
     forcedDir = NULL;
@@ -220,8 +223,10 @@ string Settings::getHighscoreFileName(void)
                     languageFromEnv = lng;
         }
     }
-
#ifdef WIN32
-    LANGID lid = GetUserDefaultUILanguage();

    for (int l =0; langlist[l].name != NULL; l++)
    {
        if (langlist[l].lid == (0xFF & lid))
            languageFromEnv = langlist[l].name;
    }
#endif //WIN32

    if (!languageFromEnv.size())
        languageFromEnv = "en";

    setLanguage(get("language", languageFromEnv));
+#ifdef WIN32
+    LANGID lid = GetUserDefaultUILanguage();    for (int l =0; langlist[l].name != NULL; l++)    {        if (langlist[l].lid == (0xFF & lid))            languageFromEnv = langlist[l].name;    }
+#endif //WIN32    
+    if (!languageFromEnv.size())        languageFromEnv = "en";    setLanguage(get("language", languageFromEnv));
 #endif //ENABLE_NLS
 }
 
@@ -262,7 +267,7 @@ string Settings::W32_GetFileName(string phname)
     wchar_t wfn[MAX_PATH];
     wchar_t pthname[MAX_PATH];
     char shrt[MAX_PATH];
-
    MultiByteToWideChar(CP_UTF8, 0, phname.c_str(), -1, wfn, MAX_PATH);
+    MultiByteToWideChar(CP_UTF8, 0, phname.c_str(), -1, wfn, MAX_PATH);
     if (GetShortPathNameW(wfn, pthname, MAX_PATH) > 0)
     {
         WideCharToMultiByte(CP_UTF8, 0, pthname, -1, shrt, MAX_PATH, NULL, NULL);
-- 
2.19.0


From 0b020e2d7487cdabff8ff537a979ed097dffd150 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sun, 24 Jan 2016 17:23:59 +0100
Subject: gcc2 hacks.


diff --git a/src/hiscores.cpp b/src/hiscores.cpp
index 17c1663..f1efb36 100644
--- a/src/hiscores.cpp
+++ b/src/hiscores.cpp
@@ -364,7 +364,7 @@ vector<ReportPage> HiScores::GenerateReport(int entriesPerPage)
                     stringstream ln;
                     ln.clear();
                     ln << setw(7) << s->score;
-                    ln << " " << setw(12) << left << trimUtf8(s->name, 12) << " " << _(s->level.c_str());
+                    ln << " " << setw(12) << trimUtf8(s->name, 12) << " " << _(s->level.c_str());
                     pag.lines.push_back(ln.str());
                     lines++;
 
@@ -388,7 +388,7 @@ vector<ReportPage> HiScores::GenerateReport(int entriesPerPage)
                     ln.clear();
                     sprintf(tm, "%02d:%02d", s->score / 60, s->score%60);
                     ln << setw(7) << tm;
-                    ln << " " << setw(12) << left << trimUtf8(s->name, 12) << " " << _(s->level.c_str());
+                    ln << " " << setw(12) << trimUtf8(s->name, 12) << " " << _(s->level.c_str());
                     pag.lines.push_back(ln.str());
                     lines++;
 
@@ -410,7 +410,7 @@ vector<ReportPage> HiScores::GenerateReport(int entriesPerPage)
                     stringstream ln;
                     ln.clear();
                     ln << setw(7) << s->score;
-                    ln << " " << setw(12) << left << trimUtf8(s->name, 12) << " " << _(s->level.c_str());
+                    ln << " " << setw(12) << trimUtf8(s->name, 12) << " " << _(s->level.c_str());
                     pag.lines.push_back(ln.str());
                     lines++;
 
diff --git a/src/level.cpp b/src/level.cpp
index 9cce170..78ab94b 100644
--- a/src/level.cpp
+++ b/src/level.cpp
@@ -256,16 +256,17 @@ void Level::LoadData(const char *philename)
     }
 
     // loop
+    int tmp;
     getline(in, l);
     sl.clear();
     sl.str(l);
-    sl >> loop;
+    sl >> tmp; loop = tmp;
 
     // invert
     getline(in, l);
     sl.clear();
     sl.str(l);
-    sl >> invert;
+    sl >> tmp; invert = tmp;
 
     FixData();
 
@@ -417,7 +418,7 @@ void Level::LoadData(const char *philename)
     {
         sl.clear();
         sl.str(l);
-        sl >> kidsMode;
+        sl >> tmp; kidsMode = tmp;
     }
 
     // ballsizes
diff --git a/src/settings.cpp b/src/settings.cpp
index 9334aa3..016c029 100755
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -219,7 +219,7 @@ Settings::Settings(string fileName)
         {
             string lng = iter->first;
             if (l >= lng.size())
-                if (lng.compare(0, lng.size(), envLang, 0, lng.size()) == 0)
+                if (lng.compare(0, lng.size(), envLang) == 0)
                     languageFromEnv = lng;
         }
     }
-- 
2.19.0


From edcc50f3cf660a681e9c5c10d135a779f8417192 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Sun, 24 Jan 2016 17:38:11 +0100
Subject: Look for libvorbis.


diff --git a/configure.ac b/configure.ac
index 93ed5de..89f85c2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -10,7 +10,7 @@ AM_PROG_CC_STDC
 AC_HEADER_STDC
 AC_PROG_RANLIB
 
-PKG_CHECK_MODULES(ZAZ, [sdl vorbisfile theoraenc theoradec])
+PKG_CHECK_MODULES(ZAZ, [sdl vorbis vorbisfile theoraenc theoradec])
 PKG_CHECK_MODULES(FTGL, ftgl >= 2.1.3)
 PKG_CHECK_MODULES(FREETYPE, freetype2)
 
-- 
2.19.0


From d655f7a68e10e53d278df2d01c25ecf1f8414f5f Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Wed, 12 Sep 2018 09:20:36 +0200
Subject: Haiku doesn't have d_type/DT_REG


diff --git a/src/directorylister.cpp b/src/directorylister.cpp
index 90ef132..7282582 100644
--- a/src/directorylister.cpp
+++ b/src/directorylister.cpp
@@ -34,8 +34,10 @@ vector<string> ListFiles(string dir, const string extension)
     {
         bool isFile = false;
 
-        if (file->d_type == DT_REG)
-            isFile = true;
+        #ifndef __HAIKU__ // Haiku doesn't have d_type
+            if (file->d_type == DT_REG)
+                isFile = true;
+        #endif //__HAIKU__
 
         if (!isFile)
         { // do additional test
-- 
2.19.0

