From 41727b6e2371cdc2282217bc5b874dfbed1a1dc7 Mon Sep 17 00:00:00 2001 From: rubidium Date: Mon, 19 Mar 2007 19:56:16 +0000 Subject: [PATCH] (svn r9347) [0.5] -Backport from trunk (r9019, r9076, r9077): - Fix: use <> for system-headers (r9019) - Fix: the intercontinental airport used 'T-junction' runway sprites when there is no exit in the middle of the runway as in the city airport (r9076) - Fix: the wrong catenary wires were drawn for tunnel entrances (r9077) --- economy.c | 5 +++-- elrail.c | 22 +++++++++++++++++----- heightmap.c | 2 +- station_cmd.c | 4 ++-- table/elrail_data.h | 8 ++++++++ table/sprites.h | 6 ++++++ 6 files changed, 37 insertions(+), 10 deletions(-) diff --git a/economy.c b/economy.c index c40e658652..14909b6e10 100644 --- a/economy.c +++ b/economy.c @@ -365,6 +365,8 @@ void ChangeOwnershipOfPlayerItems(PlayerID old_player, PlayerID new_player) static void ChangeNetworkOwner(PlayerID current_player, PlayerID new_player) { #ifdef ENABLE_NETWORK + NetworkClientState *cs; + NetworkClientInfo *ci; if (!_networking) return; if (current_player == _local_player) { @@ -376,8 +378,7 @@ static void ChangeNetworkOwner(PlayerID current_player, PlayerID new_player) /* The server has to handle all administrative issues, for example * updating and notifying all clients of what has happened */ - NetworkClientState *cs; - NetworkClientInfo *ci = NetworkFindClientInfoFromIndex(NETWORK_SERVER_INDEX); + ci = NetworkFindClientInfoFromIndex(NETWORK_SERVER_INDEX); /* The server has just changed from player */ if (current_player == ci->client_playas) { diff --git a/elrail.c b/elrail.c index 64a1735d31..6a9c0dbb5b 100644 --- a/elrail.c +++ b/elrail.c @@ -133,7 +133,7 @@ static void AdjustTileh(TileIndex tile, Slope *tileh) { if (IsTileType(tile, MP_TUNNELBRIDGE)) { if (IsTunnel(tile)) { - *tileh = SLOPE_FLAT; + *tileh = SLOPE_STEEP; /* XXX - Hack to make tunnel entrances to always have a pylon */ } else { if (IsBridgeRamp(tile)) { if (*tileh != SLOPE_FLAT) { @@ -294,12 +294,24 @@ static void DrawCatenaryRailway(const TileInfo *ti) /* Drawing of pylons is finished, now draw the wires */ for (t = 0; t < TRACK_END; t++) { if (HASBIT(trackconfig[TS_HOME], t)) { + byte PCPconfig; + const SortableSpriteStruct *sss; + int tileh_selector; - byte PCPconfig = HASBIT(PCPstatus, PCPpositions[t][0]) + + if (IsTunnelTile(ti->tile)) { + const SortableSpriteStruct* sss = &CatenarySpriteData_Tunnel[GetTunnelDirection(ti->tile)]; + + AddSortableSpriteToDraw( + sss->image, ti->x + sss->x_offset, ti->y + sss->y_offset, + sss->x_size, sss->y_size, sss->z_size, + GetTileZ(ti->tile) + sss->z_offset + ); + break; + } + PCPconfig = HASBIT(PCPstatus, PCPpositions[t][0]) + (HASBIT(PCPstatus, PCPpositions[t][1]) << 1); - const SortableSpriteStruct *sss; - int tileh_selector = !(tileh[TS_HOME] % 3) * tileh[TS_HOME] / 3; /* tileh for the slopes, 0 otherwise */ + tileh_selector = !(tileh[TS_HOME] % 3) * tileh[TS_HOME] / 3; /* tileh for the slopes, 0 otherwise */ assert(PCPconfig != 0); /* We have a pylon on neither end of the wire, that doesn't work (since we have no sprites for that) */ assert(!IsSteepSlope(tileh[TS_HOME])); @@ -367,7 +379,7 @@ void DrawCatenary(const TileInfo *ti) switch (GetTileType(ti->tile)) { case MP_RAILWAY: - if (IsRailDepot(ti->tile)) { + if ( IsRailDepot(ti->tile)) { const SortableSpriteStruct* sss = &CatenarySpriteData_Depot[GetRailDepotDirection(ti->tile)]; AddSortableSpriteToDraw( diff --git a/heightmap.c b/heightmap.c index f98e98f3b5..adc2a53ea8 100644 --- a/heightmap.c +++ b/heightmap.c @@ -29,7 +29,7 @@ static inline byte RGBToGrayscale(byte red, byte green, byte blue) #ifdef WITH_PNG -#include "png.h" +#include /** * The PNG Heightmap loader. diff --git a/station_cmd.c b/station_cmd.c index d5fef7f978..31248e123f 100644 --- a/station_cmd.c +++ b/station_cmd.c @@ -1589,7 +1589,7 @@ static const byte _airport_sections_international[] = { // Intercontinental Airport (vlarge) - 4 runways static const byte _airport_sections_intercontinental[] = { 102, 120, 89, 89, 89, 89, 89, 89, 118, - 120, 22, 22, 22, 22, 22, 22, 119, 117, + 120, 23, 23, 23, 23, 23, 23, 119, 117, 87, 54, 87, 8, 8, 8, 8, 51, 117, 87, 162, 87, 85, 116, 116, 8, 9, 10, 87, 8, 8, 11, 31, 11, 8, 160, 32, @@ -1598,7 +1598,7 @@ static const byte _airport_sections_intercontinental[] = { 87, 142, 8, 11, 29, 11, 10, 163, 10, 87, 164, 87, 8, 8, 8, 10, 37, 117, 87, 120, 89, 89, 89, 89, 89, 89, 119, - 121, 22, 22, 22, 22, 22, 22, 119, 37 + 121, 23, 23, 23, 23, 23, 23, 119, 37 }; diff --git a/table/elrail_data.h b/table/elrail_data.h index 1ed5751b42..b0a180b7a8 100644 --- a/table/elrail_data.h +++ b/table/elrail_data.h @@ -340,6 +340,14 @@ static const SortableSpriteStruct CatenarySpriteData_Depot[] = { { SPR_WIRE_DEPOT_NW, 8, 0, 1, 8, 1, ELRAIL_ELEVATION } //! Wire for NW depot exit }; +static const SortableSpriteStruct CatenarySpriteData_Tunnel[] = { + { SPR_WIRE_TUNNEL_NE, 0, 8, 8, 1, 1, ELRAIL_ELEVATION }, //! Wire for NE tunnel exit + { SPR_WIRE_TUNNEL_SE, 8, 0, 1, 8, 1, ELRAIL_ELEVATION }, //! Wire for SE tunnel exit + { SPR_WIRE_TUNNEL_SW, 0, 8, 8, 1, 1, ELRAIL_ELEVATION }, //! Wire for SW tunnel exit + { SPR_WIRE_TUNNEL_NW, 8, 0, 1, 8, 1, ELRAIL_ELEVATION } //! Wire for NW tunnel exit +}; + + /** Refers to a certain element of the catenary. * Identifiers for Wires: *
  1. Direction of the wire
  2. diff --git a/table/sprites.h b/table/sprites.h index 674f7456ad..f1b9352a53 100644 --- a/table/sprites.h +++ b/table/sprites.h @@ -276,6 +276,12 @@ enum Sprites { SPR_WIRE_Y_NW_DOWN = SPR_ELRAIL_BASE + 26, /* Tunnel entries */ + SPR_WIRE_TUNNEL_NE = SPR_ELRAIL_BASE + 27, + SPR_WIRE_TUNNEL_SE = SPR_ELRAIL_BASE + 28, + SPR_WIRE_TUNNEL_SW = SPR_ELRAIL_BASE + 29, + SPR_WIRE_TUNNEL_NW = SPR_ELRAIL_BASE + 30, + + /* Depot entries */ SPR_WIRE_DEPOT_SW = SPR_ELRAIL_BASE + 27, SPR_WIRE_DEPOT_NW = SPR_ELRAIL_BASE + 28, SPR_WIRE_DEPOT_NE = SPR_ELRAIL_BASE + 29,