shithub: wl3d

Download patch

ref: 8cdf6b06b9805fe39e72410549175e37415eb056
parent: a6fe5b8c177c72c40efd76c6bf255897854bb76f
author: qwx <>
date: Wed Aug 9 12:23:03 EDT 2017

map: fix writing bullshit values in stcs .tl field on save

--- a/map.c
+++ b/map.c
@@ -862,7 +862,7 @@
 	disking();
 	PUT16(p, stce - stcs);
 	for(s=stcs; s<stce; s++){
-		PUT16(p, s->tl - tiles);
+		PUT16(p, s->tl != nil ? s->tl - tiles : 0xffff);
 		PUT16(p, s->spr - sprs);
 		PUT8(p, s->f);
 		PUT8(p, s->item);
@@ -986,7 +986,8 @@
 		return -1;
 	}
 	for(s=stcs; s<stce; s++){
-		s->tl = tiles + GET16(p);
+		n = GET16(p);
+		s->tl = n == 0xffff ? nil : tiles + n;
 		s->spr = sprs + GET16(p);
 		s->f = GET8(p);
 		s->item = GET8(p);