summary refs log tree commit diff
path: root/pkgs/games/openttd
diff options
context:
space:
mode:
authorMoritz Ulrich <moritz@tarn-vedra.de>2014-12-22 17:28:45 +0100
committerMoritz Ulrich <moritz@tarn-vedra.de>2014-12-22 17:29:30 +0100
commite93c528a01af57caa1371c660a95be42f8e9411b (patch)
treea9b53a2945789b301162dbb6c440b0fdd47b6de2 /pkgs/games/openttd
parent656ae7a97c3de068bf236a07d774c83a7c2bb286 (diff)
downloadnixpkgs-e93c528a01af57caa1371c660a95be42f8e9411b.tar
nixpkgs-e93c528a01af57caa1371c660a95be42f8e9411b.tar.gz
nixpkgs-e93c528a01af57caa1371c660a95be42f8e9411b.tar.bz2
nixpkgs-e93c528a01af57caa1371c660a95be42f8e9411b.tar.lz
nixpkgs-e93c528a01af57caa1371c660a95be42f8e9411b.tar.xz
nixpkgs-e93c528a01af57caa1371c660a95be42f8e9411b.tar.zst
nixpkgs-e93c528a01af57caa1371c660a95be42f8e9411b.zip
openttd: Fix build with fix from upstream.
Diffstat (limited to 'pkgs/games/openttd')
-rw-r--r--pkgs/games/openttd/default.nix6
-rw-r--r--pkgs/games/openttd/fix-freetype-1.4.4.patch31
2 files changed, 37 insertions, 0 deletions
diff --git a/pkgs/games/openttd/default.nix b/pkgs/games/openttd/default.nix
index a1af42814d1..d8ae07705c6 100644
--- a/pkgs/games/openttd/default.nix
+++ b/pkgs/games/openttd/default.nix
@@ -17,6 +17,12 @@ stdenv.mkDerivation rec {
     "--without-liblzo2"
   ];
 
+  # NOTE: Remove this patch in 1.4.5 or greater
+  patches = [
+    # Adapted from svn r27079
+    ./fix-freetype-1.4.4.patch
+  ];
+
   makeFlags = "INSTALL_PERSONAL_DIR=";
 
   postInstall = ''
diff --git a/pkgs/games/openttd/fix-freetype-1.4.4.patch b/pkgs/games/openttd/fix-freetype-1.4.4.patch
new file mode 100644
index 00000000000..37706ce05c9
--- /dev/null
+++ b/pkgs/games/openttd/fix-freetype-1.4.4.patch
@@ -0,0 +1,31 @@
+diff --git a/src/fontcache.cpp b/src/fontcache.cpp
+===================================================================
+--- a/src/fontcache.cpp
++++ b/src/fontcache.cpp
+@@ -537,6 +537,6 @@
+ 
+ 	/* Add 1 pixel for the shadow on the medium font. Our sprite must be at least 1x1 pixel */
+-	int width  = max(1, slot->bitmap.width + (this->fs == FS_NORMAL));
+-	int height = max(1, slot->bitmap.rows  + (this->fs == FS_NORMAL));
++	unsigned int width  = max(1U, (unsigned int)slot->bitmap.width + (this->fs == FS_NORMAL));
++	unsigned int height = max(1U, (unsigned int)slot->bitmap.rows  + (this->fs == FS_NORMAL));
+ 
+ 	/* Limit glyph size to prevent overflows later on. */
+@@ -554,6 +554,6 @@
+ 	/* Draw shadow for medium size */
+ 	if (this->fs == FS_NORMAL && !aa) {
+-		for (int y = 0; y < slot->bitmap.rows; y++) {
+-			for (int x = 0; x < slot->bitmap.width; x++) {
++		for (unsigned int y = 0; y < (unsigned int)slot->bitmap.rows; y++) {
++			for (unsigned int x = 0; x < (unsigned int)slot->bitmap.width; x++) {
+ 				if (aa ? (slot->bitmap.buffer[x + y * slot->bitmap.pitch] > 0) : HasBit(slot->bitmap.buffer[(x / 8) + y * slot->bitmap.pitch], 7 - (x % 8))) {
+ 					sprite.data[1 + x + (1 + y) * sprite.width].m = SHADOW_COLOUR;
+@@ -564,6 +564,6 @@
+ 	}
+ 
+-	for (int y = 0; y < slot->bitmap.rows; y++) {
+-		for (int x = 0; x < slot->bitmap.width; x++) {
++	for (unsigned int y = 0; y < (unsigned int)slot->bitmap.rows; y++) {
++		for (unsigned int x = 0; x < (unsigned int)slot->bitmap.width; x++) {
+ 			if (aa ? (slot->bitmap.buffer[x + y * slot->bitmap.pitch] > 0) : HasBit(slot->bitmap.buffer[(x / 8) + y * slot->bitmap.pitch], 7 - (x % 8))) {
+ 				sprite.data[x + y * sprite.width].m = FACE_COLOUR;