rail_cmd.c
changeset 2670 f2d6a8424e3e
parent 2668 c0f1828b89e4
child 2737 fb1556b8f5e0
equal deleted inserted replaced
2669:277ad4105efb 2670:f2d6a8424e3e
  1491 
  1491 
  1492 		if (ti->tileh != 0) DrawFoundation(ti, ti->tileh);
  1492 		if (ti->tileh != 0) DrawFoundation(ti, ti->tileh);
  1493 
  1493 
  1494 		if (IsRailWaypoint(ti->tile) && HASBIT(_m[ti->tile].m3, 4)) {
  1494 		if (IsRailWaypoint(ti->tile) && HASBIT(_m[ti->tile].m3, 4)) {
  1495 			// look for customization
  1495 			// look for customization
  1496 			const StationSpec *stat = GetCustomStation(STAT_CLASS_WAYP, _m[ti->tile].m4 + 1);
  1496 			byte stat_id = GetWaypointByTile(ti->tile)->stat_id;
       
  1497 			const StationSpec *stat = GetCustomStation(STAT_CLASS_WAYP, stat_id);
  1497 
  1498 
  1498 			if (stat != NULL) {
  1499 			if (stat != NULL) {
  1499 				DrawTileSeqStruct const *seq;
  1500 				DrawTileSeqStruct const *seq;
  1500 				// emulate station tile - open with building
  1501 				// emulate station tile - open with building
  1501 				const DrawTileSprites *cust = &stat->renderdata[2 + (m5 & 0x1)];
  1502 				const DrawTileSprites *cust = &stat->renderdata[2 + (m5 & 0x1)];
  1533 		if (image & PALETTE_MODIFIER_COLOR) image = (image & SPRITE_MASK) + rti->total_offset;
  1534 		if (image & PALETTE_MODIFIER_COLOR) image = (image & SPRITE_MASK) + rti->total_offset;
  1534 
  1535 
  1535 		// adjust ground tile for desert
  1536 		// adjust ground tile for desert
  1536 		// (don't adjust for arctic depots, because snow in depots looks weird)
  1537 		// (don't adjust for arctic depots, because snow in depots looks weird)
  1537 		// type >= 4 means waypoints
  1538 		// type >= 4 means waypoints
  1538 		if ((_m[ti->tile].m2 & RAIL_MAP2LO_GROUND_MASK) == RAIL_GROUND_ICE_DESERT && (_opt.landscape == LT_DESERT || type >= 4)) {
  1539 		if ((_m[ti->tile].m4 & RAIL_MAP2LO_GROUND_MASK) == RAIL_GROUND_ICE_DESERT && (_opt.landscape == LT_DESERT || type >= 4)) {
  1539 			if (image != SPR_FLAT_GRASS_TILE) {
  1540 			if (image != SPR_FLAT_GRASS_TILE) {
  1540 				image += rti->snow_offset; // tile with tracks
  1541 				image += rti->snow_offset; // tile with tracks
  1541 			} else {
  1542 			} else {
  1542 				image = SPR_FLAT_SNOWY_TILE; // flat ground
  1543 				image = SPR_FLAT_SNOWY_TILE; // flat ground
  1543 			}
  1544 			}
  1972 {
  1973 {
  1973 	byte old_ground;
  1974 	byte old_ground;
  1974 	byte new_ground;
  1975 	byte new_ground;
  1975 	TrackBits rail;
  1976 	TrackBits rail;
  1976 
  1977 
  1977 	old_ground = GB(_m[tile].m2, 0, 4);
  1978 	old_ground = _m[tile].m5 & RAIL_TYPE_SPECIAL ? GB(_m[tile].m4, 0, 4) : GB(_m[tile].m2, 0, 4);
  1978 
  1979 
  1979 	switch (_opt.landscape) {
  1980 	switch (_opt.landscape) {
  1980 		case LT_HILLY:
  1981 		case LT_HILLY:
  1981 			if (GetTileZ(tile) > _opt.snow_line) { /* convert into snow? */
  1982 			if (GetTileZ(tile) > _opt.snow_line) { /* convert into snow? */
  1982 				new_ground = RAIL_GROUND_ICE_DESERT;
  1983 				new_ground = RAIL_GROUND_ICE_DESERT;
  2043 	}
  2044 	}
  2044 
  2045 
  2045 modify_me:;
  2046 modify_me:;
  2046 	/* tile changed? */
  2047 	/* tile changed? */
  2047 	if (old_ground != new_ground) {
  2048 	if (old_ground != new_ground) {
  2048 		SB(_m[tile].m2, 0, 4, new_ground);
  2049 		if (_m[tile].m5 & RAIL_TYPE_SPECIAL) {
       
  2050 			SB(_m[tile].m4, 0, 4, new_ground);
       
  2051 		} else {
       
  2052 			SB(_m[tile].m2, 0, 4, new_ground);
       
  2053 		}
  2049 		MarkTileDirtyByTile(tile);
  2054 		MarkTileDirtyByTile(tile);
  2050 	}
  2055 	}
  2051 }
  2056 }
  2052 
  2057 
  2053 
  2058