(svn r1777) Fix map generation for tropical and arctic landscape on larger/smaller maps
authortron
Thu, 03 Feb 2005 18:20:43 +0000
changeset 1273 240fa6848fbc
parent 1272 d3e09adb7736
child 1274 1605774b5589
(svn r1777) Fix map generation for tropical and arctic landscape on larger/smaller maps
landscape.c
--- a/landscape.c	Thu Feb 03 17:22:35 2005 +0000
+++ b/landscape.c	Thu Feb 03 18:20:43 2005 +0000
@@ -533,22 +533,26 @@
 	p += 8;
 
 	if (flag & 4) {
-		if (!(flag & 2)) {
-			if (!(flag & 1)) {
-				if (x + y > 190)
-					return;
-			} else {
-				if (y < 30 + x)
-					return;
-			}
-		} else {
-			if (!(flag & 1)) {
-				if (x + y < 256)
-					return;
-			} else {
-				if (x < 30 + y)
-					return;
-			}
+		uint xw = x * MapSizeY();
+		uint yw = y * MapSizeX();
+		uint bias = (MapSizeX() + MapSizeY()) * 16;
+
+		switch (flag & 3) {
+			case 0:
+				if (xw + yw > MapSize() - bias) return;
+				break;
+
+			case 1:
+				if (yw < xw + bias) return;
+				break;
+
+			case 2:
+				if (xw + yw < MapSize() + bias) return;
+				break;
+
+			case 3:
+				if (xw < yw + bias) return;
+				break;
 		}
 	}