rail_cmd.c
changeset 1399 4503bd2bfb82
parent 1363 01d3de5d8039
child 1477 2174a73b11c9
--- a/rail_cmd.c	Tue Feb 22 15:39:45 2005 +0000
+++ b/rail_cmd.c	Tue Feb 22 18:27:57 2005 +0000
@@ -1620,7 +1620,6 @@
 		}
 	} else {
 		/* draw depots / waypoints */
-		const byte *s;
 		const DrawTrackSeqStruct *drss;
 		byte type = m5 & 0x3F; // 0-3: depots, 4-5: waypoints
 
@@ -1664,9 +1663,9 @@
 			}
 		}
 
-		s = _track_depot_layout_table[type];
+		drss = _track_depot_layout_table[type];
 
-		image = *(const uint16*)s;
+		image = drss++->image;
 		if (image & 0x8000) image = (image & 0x7FFF) + tracktype_offs;
 
 		// adjust ground tile for desert
@@ -1681,8 +1680,6 @@
 
 		DrawGroundSprite(image);
 
-		drss = (const DrawTrackSeqStruct*)(s + sizeof(uint16));
-
 		while ((image=drss->image) != 0) {
 			DrawSpecialBuilding(image, type < 4 ? tracktype_offs : 0, ti,
 			                    drss->subcoord_x, drss->subcoord_y, 0,
@@ -1696,23 +1693,22 @@
 {
 	uint32 ormod, img;
 	const DrawTrackSeqStruct *dtss;
-	const byte *t;
 
 	/* baseimage */
 	railtype *= TRACKTYPE_SPRITE_PITCH;
 
 	ormod = PLAYER_SPRITE_COLOR(_local_player);
 
-	t = _track_depot_layout_table[image];
+	dtss = _track_depot_layout_table[image];
 
 	x+=33;
 	y+=17;
 
-	img = *(const uint16*)t;
+	img = dtss++->image;
 	if (img & 0x8000) img = (img & 0x7FFF) + railtype;
 	DrawSprite(img, x, y);
 
-	for(dtss = (const DrawTrackSeqStruct *)(t + sizeof(uint16)); dtss->image != 0; dtss++) {
+	for (; dtss->image != 0; dtss++) {
 		Point pt = RemapCoords(dtss->subcoord_x, dtss->subcoord_y, 0);
 		image = dtss->image;
 		if (image & 0x8000) image |= ormod;
@@ -1735,14 +1731,13 @@
 
 	// draw default waypoint graphics of ID 0
 	if (stat_id == 0) {
-		const byte *t = _track_depot_layout_table[4];
-		const DrawTrackSeqStruct *dtss;
+		const DrawTrackSeqStruct *dtss = _track_depot_layout_table[4];
 
-		img = *(const uint16*)t;
+		img = dtss++->image;
 		if (img & 0x8000) img = (img & 0x7FFF) + railtype*TRACKTYPE_SPRITE_PITCH;
 		DrawSprite(img, x, y);
 
-		for (dtss = (const DrawTrackSeqStruct *)(t + sizeof(uint16)); dtss->image != 0; dtss++) {
+		for (; dtss->image != 0; dtss++) {
 			Point pt = RemapCoords(dtss->subcoord_x, dtss->subcoord_y, 0);
 			img = dtss->image;
 			if (img & 0x8000) img |= ormod;