shithub: pokered

Download patch

ref: 668eefaa15ffff6415de837fc280009feba2483a
parent: be114145c3536b24be7972916547ccc53ff9c887
author: IIMarckus <[email protected]>
date: Wed Mar 16 13:42:35 EDT 2011

$0 is a valid tile in maps, even though $00 is the terminating byte.

Pointed out by Sawakita.

hg-commit-id: 27881f5e6bd4


--- a/extras/redrle.c
+++ b/extras/redrle.c
@@ -64,11 +64,11 @@
 		for (;;) {
 			int i, count;
 			int byte = fgetc(infile);
+			if (byte == 0)
+				break;
 			count = byte & 0xF;
 			byte >>= 4;
 
-			if (byte == 0)
-				break;
 			if (feof(infile)) {
 				fprintf(stderr, "Decompress error: reached "
 				    "end of file without finding terminating "
@@ -98,12 +98,6 @@
 			if (byte > 0xF) {
 				fprintf(stderr, "Compress error: read a byte "
 				    "greater than 0xF.\n");
-				exit(1);
-			}
-
-			if (byte == 0) {
-				fprintf(stderr, "Compress error: read a byte "
-				    "of 0x00.\n");
 				exit(1);
 			}