summaryrefslogtreecommitdiff
path: root/landscape.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-02-18 21:20:55 +0000
committertron <tron@openttd.org>2005-02-18 21:20:55 +0000
commitb973ad1df985dba9949bf105d3f84a42d3aeef66 (patch)
treeb7fec9eaaeb12b0f75c8f449435981405235d233 /landscape.c
parenteff325209596f7bb57a63ce66eb222d5b3a8f674 (diff)
downloadopenttd-b973ad1df985dba9949bf105d3f84a42d3aeef66.tar.xz
(svn r1888) The landscape template sprites are ordinary sprites, treating them as non-sprites resulted in yet another endianess issue. This fixes the problem introduced in r1855
Diffstat (limited to 'landscape.c')
-rw-r--r--landscape.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/landscape.c b/landscape.c
index e3cb79a5c..c697c6ae6 100644
--- a/landscape.c
+++ b/landscape.c
@@ -474,12 +474,13 @@ static void GenerateTerrain(int type, int flag)
uint y;
uint w;
uint h;
+ const Sprite* template;
const byte *p;
byte *tile;
byte direction;
r = Random();
- p = GetNonSprite((((r >> 24) * _genterrain_tbl_1[type]) >> 8) + _genterrain_tbl_2[type] + 4845);
+ template = GetSprite((((r >> 24) * _genterrain_tbl_1[type]) >> 8) + _genterrain_tbl_2[type] + 4845);
x = r & MapMaxX();
y = (r >> MapLogX()) & MapMaxY();
@@ -490,13 +491,13 @@ static void GenerateTerrain(int type, int flag)
direction = (r >> 22) & 3;
if (direction & 1) {
- w = p[1];
- h = p[2];
+ w = template->height;
+ h = template->width;
} else {
- w = p[2];
- h = p[1];
+ w = template->width;
+ h = template->height;
}
- p += 8;
+ p = template->data;
if (flag & 4) {
uint xw = x * MapSizeY();