src/station_cmd.cpp
changeset 7768 2060e8d65a72
parent 7748 5f945356a9cd
child 7794 ccc691b566eb
equal deleted inserted replaced
7767:7d8033aa8248 7768:2060e8d65a72
  1656 
  1656 
  1657 		{
  1657 		{
  1658 			const byte *b = _airport_sections[p1];
  1658 			const byte *b = _airport_sections[p1];
  1659 
  1659 
  1660 			BEGIN_TILE_LOOP(tile_cur, w, h, tile) {
  1660 			BEGIN_TILE_LOOP(tile_cur, w, h, tile) {
  1661 				MakeAirport(tile_cur, st->owner, st->index, *b++);
  1661 				MakeAirport(tile_cur, st->owner, st->index, *b - ((*b < 67) ? 8 : 24));
       
  1662 				b++;
  1662 			} END_TILE_LOOP(tile_cur, w, h, tile)
  1663 			} END_TILE_LOOP(tile_cur, w, h, tile)
  1663 		}
  1664 		}
  1664 
  1665 
  1665 		UpdateStationVirtCoordDirty(st);
  1666 		UpdateStationVirtCoordDirty(st);
  1666 		UpdateStationAcceptance(st, false);
  1667 		UpdateStationAcceptance(st, false);
  1964 	return CommandCost(_price.remove_dock);
  1965 	return CommandCost(_price.remove_dock);
  1965 }
  1966 }
  1966 
  1967 
  1967 #include "table/station_land.h"
  1968 #include "table/station_land.h"
  1968 
  1969 
  1969 const DrawTileSprites *GetStationTileLayout(byte gfx)
  1970 const DrawTileSprites *GetStationTileLayout(StationType st, byte gfx)
  1970 {
  1971 {
  1971 	return &_station_display_datas[gfx];
  1972 	return &_station_display_datas[st][gfx];
  1972 }
  1973 }
  1973 
  1974 
  1974 /* For drawing canal edges on buoys */
  1975 /* For drawing canal edges on buoys */
  1975 extern void DrawCanalWater(TileIndex tile);
  1976 extern void DrawCanalWater(TileIndex tile);
  1976 
  1977 
  2026 				t = &statspec->renderdata[tile < statspec->tiles ? tile : (uint)GetRailStationAxis(ti->tile)];
  2027 				t = &statspec->renderdata[tile < statspec->tiles ? tile : (uint)GetRailStationAxis(ti->tile)];
  2027 			}
  2028 			}
  2028 		}
  2029 		}
  2029 	}
  2030 	}
  2030 
  2031 
  2031 	if (t == NULL || t->seq == NULL) t = &_station_display_datas[GetStationGfx(ti->tile)];
  2032 	if (t == NULL || t->seq == NULL) t = &_station_display_datas[GetStationType(ti->tile)][GetStationGfx(ti->tile)];
  2032 
  2033 
  2033 	SpriteID image = t->ground_sprite;
  2034 	SpriteID image = t->ground_sprite;
  2034 	if (HASBIT(image, SPRITE_MODIFIER_USE_OFFSET)) {
  2035 	if (HASBIT(image, SPRITE_MODIFIER_USE_OFFSET)) {
  2035 		image += GetCustomStationGroundRelocation(statspec, st, ti->tile);
  2036 		image += GetCustomStationGroundRelocation(statspec, st, ti->tile);
  2036 		image += rti->custom_ground_offset;
  2037 		image += rti->custom_ground_offset;
  2082 			AddChildSpriteScreen(image, pal, dtss->delta_x, dtss->delta_y);
  2083 			AddChildSpriteScreen(image, pal, dtss->delta_x, dtss->delta_y);
  2083 		}
  2084 		}
  2084 	}
  2085 	}
  2085 }
  2086 }
  2086 
  2087 
  2087 void StationPickerDrawSprite(int x, int y, RailType railtype, RoadType roadtype, int image)
  2088 void StationPickerDrawSprite(int x, int y, StationType st, RailType railtype, RoadType roadtype, int image)
  2088 {
  2089 {
  2089 	const RailtypeInfo *rti = GetRailTypeInfo(railtype);
  2090 	const RailtypeInfo *rti = GetRailTypeInfo(railtype);
  2090 	SpriteID pal = PLAYER_SPRITE_COLOR(_local_player);
  2091 	SpriteID pal = PLAYER_SPRITE_COLOR(_local_player);
  2091 	const DrawTileSprites *t = &_station_display_datas[image];
  2092 	const DrawTileSprites *t = &_station_display_datas[st][image];
  2092 
  2093 
  2093 	SpriteID img = t->ground_sprite;
  2094 	SpriteID img = t->ground_sprite;
  2094 	DrawSprite(img + rti->total_offset, HASBIT(img, PALETTE_MODIFIER_COLOR) ? pal : PAL_NONE, x, y);
  2095 	DrawSprite(img + rti->total_offset, HASBIT(img, PALETTE_MODIFIER_COLOR) ? pal : PAL_NONE, x, y);
  2095 
  2096 
  2096 	if (roadtype == ROADTYPE_TRAM) {
  2097 	if (roadtype == ROADTYPE_TRAM) {
  2178 
  2179 
  2179 static void TileLoop_Station(TileIndex tile)
  2180 static void TileLoop_Station(TileIndex tile)
  2180 {
  2181 {
  2181 	// FIXME -- GetTileTrackStatus_Station -> animated stationtiles
  2182 	// FIXME -- GetTileTrackStatus_Station -> animated stationtiles
  2182 	// hardcoded.....not good
  2183 	// hardcoded.....not good
  2183 	switch (GetStationGfx(tile)) {
  2184 	switch (GetStationType(tile)) {
  2184 		case GFX_RADAR_LARGE_FIRST:
  2185 		case STATION_AIRPORT:
  2185 		case GFX_WINDSACK_FIRST : // for small airport
  2186 			switch (GetStationGfx(tile)) {
  2186 		case GFX_RADAR_INTERNATIONAL_FIRST:
  2187 				case GFX_RADAR_LARGE_FIRST:
  2187 		case GFX_RADAR_METROPOLITAN_FIRST:
  2188 				case GFX_WINDSACK_FIRST : // for small airport
  2188 		case GFX_RADAR_DISTRICTWE_FIRST: // radar district W-E airport
  2189 				case GFX_RADAR_INTERNATIONAL_FIRST:
  2189 		case GFX_WINDSACK_INTERCON_FIRST : // for intercontinental airport
  2190 				case GFX_RADAR_METROPOLITAN_FIRST:
  2190 			AddAnimatedTile(tile);
  2191 				case GFX_RADAR_DISTRICTWE_FIRST: // radar district W-E airport
       
  2192 				case GFX_WINDSACK_INTERCON_FIRST : // for intercontinental airport
       
  2193 					AddAnimatedTile(tile);
       
  2194 					break;
       
  2195 			}
  2191 			break;
  2196 			break;
  2192 
  2197 
  2193 		case GFX_OILRIG_BASE: //(station part)
  2198 		case STATION_OILRIG: //(station part)
  2194 		case GFX_BUOY_BASE:
  2199 		case STATION_BUOY:
  2195 			TileLoop_Water(tile);
  2200 			TileLoop_Water(tile);
  2196 			break;
  2201 			break;
  2197 
  2202 
  2198 		default: break;
  2203 		default: break;
  2199 	}
  2204 	}