diff options
author | tron <tron@openttd.org> | 2006-06-19 20:13:50 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2006-06-19 20:13:50 +0000 |
commit | 9b6fce70a2cc8facd68c5148af8bdb55da2d4e71 (patch) | |
tree | 68851fcced56843f2bd0017f7f7dfef0bac22517 /road_cmd.c | |
parent | 10e00914f7d27359ba885ba20db376c14276f11a (diff) | |
download | openttd-9b6fce70a2cc8facd68c5148af8bdb55da2d4e71.tar.xz |
(svn r5317) s/RGT_/ROADSIDE_/ and some minor changes
Diffstat (limited to 'road_cmd.c')
-rw-r--r-- | road_cmd.c | 67 |
1 files changed, 38 insertions, 29 deletions
diff --git a/road_cmd.c b/road_cmd.c index 7f99d6d0a..0bf2ded25 100644 --- a/road_cmd.c +++ b/road_cmd.c @@ -700,6 +700,7 @@ static void DrawRoadBits(TileInfo* ti, RoadBits road) { const DrawRoadTileStruct *drts; PalSpriteID image = 0; + Roadside roadside; if (ti->tileh != SLOPE_FLAT) { int foundation = GetRoadFoundation(ti->tileh, road); @@ -713,13 +714,17 @@ static void DrawRoadBits(TileInfo* ti, RoadBits road) if (image == 0) image = _road_tile_sprites_1[road]; - if (GetGroundType(ti->tile) == RGT_BARREN) image |= PALETTE_TO_BARE_LAND; + roadside = GetRoadside(ti->tile); if (IsOnSnow(ti->tile)) { image += 19; - } else if (HasPavement(ti->tile)) { - // Pavement tiles. - image -= 19; + } else { + switch (roadside) { + case ROADSIDE_BARREN: image |= PALETTE_TO_BARE_LAND; break; + case ROADSIDE_GRASS: break; + case ROADSIDE_GRASS_ROAD_WORKS: break; + default: image -= 19; break; // Paved + } } DrawGroundSprite(image); @@ -734,7 +739,7 @@ static void DrawRoadBits(TileInfo* ti, RoadBits road) } // Draw extra details. - for (drts = _road_display_table[GetGroundType(ti->tile)][road]; drts->image != 0; drts++) { + for (drts = _road_display_table[roadside][road]; drts->image != 0; drts++) { int x = ti->x | drts->subcoord_x; int y = ti->y | drts->subcoord_y; byte z = ti->z; @@ -763,8 +768,11 @@ static void DrawTile_Road(TileInfo *ti) if (IsOnSnow(ti->tile)) { image += 8; } else { - if (GetGroundType(ti->tile) == RGT_BARREN) image |= PALETTE_TO_BARE_LAND; - if (HasPavement(ti->tile)) image += 4; + switch (GetRoadside(ti->tile)) { + case ROADSIDE_BARREN: image |= PALETTE_TO_BARE_LAND; break; + case ROADSIDE_GRASS: break; + default: image += 4; break; // Paved + } } DrawGroundSprite(image); @@ -866,20 +874,21 @@ static void AnimateTile_Road(TileIndex tile) if (IsLevelCrossing(tile)) MarkTileDirtyByTile(tile); } -static const RoadGroundType _town_road_types[5][2] = { - {RGT_GRASS,RGT_GRASS}, - {RGT_PAVED,RGT_PAVED}, - {RGT_PAVED,RGT_PAVED}, - {RGT_ALLEY,RGT_ALLEY}, - {RGT_LIGHT,RGT_PAVED}, + +static const Roadside _town_road_types[][2] = { + { ROADSIDE_GRASS, ROADSIDE_GRASS }, + { ROADSIDE_PAVED, ROADSIDE_PAVED }, + { ROADSIDE_PAVED, ROADSIDE_PAVED }, + { ROADSIDE_TREES, ROADSIDE_TREES }, + { ROADSIDE_STREET_LIGHTS, ROADSIDE_PAVED } }; -static const RoadGroundType _town_road_types_2[5][2] = { - {RGT_GRASS,RGT_GRASS}, - {RGT_PAVED,RGT_PAVED}, - {RGT_LIGHT,RGT_PAVED}, - {RGT_LIGHT,RGT_PAVED}, - {RGT_LIGHT,RGT_PAVED}, +static const Roadside _town_road_types_2[][2] = { + { ROADSIDE_GRASS, ROADSIDE_GRASS }, + { ROADSIDE_PAVED, ROADSIDE_PAVED }, + { ROADSIDE_STREET_LIGHTS, ROADSIDE_PAVED }, + { ROADSIDE_STREET_LIGHTS, ROADSIDE_PAVED }, + { ROADSIDE_STREET_LIGHTS, ROADSIDE_PAVED } }; @@ -934,23 +943,23 @@ static void TileLoop_Road(TileIndex tile) { /* Adjust road ground type depending on 'grp' (grp is the distance to the center) */ - const RoadGroundType *target_rgt = (_opt.landscape == LT_CANDY) ? _town_road_types_2[grp] : _town_road_types[grp]; - RoadGroundType rgt = GetGroundType(tile); + const Roadside* new_rs = (_opt.landscape == LT_CANDY) ? _town_road_types_2[grp] : _town_road_types[grp]; + Roadside cur_rs = GetRoadside(tile); /* We have our desired type, do nothing */ - if (rgt == target_rgt[0]) return; + if (cur_rs == new_rs[0]) return; /* We have the pre-type of the desired type, switch to the desired type */ - if (rgt == target_rgt[1]) { - rgt = target_rgt[0]; + if (cur_rs == new_rs[1]) { + cur_rs = new_rs[0]; /* We have barren land, install the pre-type */ - } else if (rgt == RGT_BARREN) { - rgt = target_rgt[1]; + } else if (cur_rs == ROADSIDE_BARREN) { + cur_rs = new_rs[1]; /* We're totally off limits, remove any installation and make barren land */ } else { - rgt = RGT_BARREN; + cur_rs = ROADSIDE_BARREN; } - SetGroundType(tile, rgt); + SetRoadside(tile, cur_rs); MarkTileDirtyByTile(tile); } } else if (IncreaseRoadWorksCounter(tile)) { @@ -1018,7 +1027,7 @@ static void GetTileDesc_Road(TileIndex tile, TileDesc *td) switch (GetRoadTileType(tile)) { case ROAD_TILE_CROSSING: td->str = STR_1818_ROAD_RAIL_LEVEL_CROSSING; break; case ROAD_TILE_DEPOT: td->str = STR_1817_ROAD_VEHICLE_DEPOT; break; - default: td->str = _road_tile_strings[GetGroundType(tile)]; break; + default: td->str = _road_tile_strings[GetRoadside(tile)]; break; } } |