(svn r9347) [0.5] -Backport from trunk (r9019, r9076, r9077): 0.5
authorrubidium
Mon, 19 Mar 2007 19:56:16 +0000
branch0.5
changeset 5464 d5841259ac07
parent 5463 eaf87cf4d276
child 5465 30426b385cde
(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
elrail.c
heightmap.c
station_cmd.c
table/elrail_data.h
table/sprites.h
--- a/economy.c	Mon Mar 19 19:42:40 2007 +0000
+++ b/economy.c	Mon Mar 19 19:56:16 2007 +0000
@@ -365,6 +365,8 @@
 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 @@
 
 	/* 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) {
--- a/elrail.c	Mon Mar 19 19:42:40 2007 +0000
+++ b/elrail.c	Mon Mar 19 19:56:16 2007 +0000
@@ -133,7 +133,7 @@
 {
 	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 @@
 	/* 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 @@
 
 	switch (GetTileType(ti->tile)) {
 		case MP_RAILWAY:
-			if (IsRailDepot(ti->tile)) {
+			if ( IsRailDepot(ti->tile)) {
 				const SortableSpriteStruct* sss = &CatenarySpriteData_Depot[GetRailDepotDirection(ti->tile)];
 
 				AddSortableSpriteToDraw(
--- a/heightmap.c	Mon Mar 19 19:42:40 2007 +0000
+++ b/heightmap.c	Mon Mar 19 19:56:16 2007 +0000
@@ -29,7 +29,7 @@
 
 #ifdef WITH_PNG
 
-#include "png.h"
+#include <png.h>
 
 /**
  * The PNG Heightmap loader.
--- a/station_cmd.c	Mon Mar 19 19:42:40 2007 +0000
+++ b/station_cmd.c	Mon Mar 19 19:56:16 2007 +0000
@@ -1589,7 +1589,7 @@
 // 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 @@
 	 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
 };
 
 
--- a/table/elrail_data.h	Mon Mar 19 19:42:40 2007 +0000
+++ b/table/elrail_data.h	Mon Mar 19 19:56:16 2007 +0000
@@ -340,6 +340,14 @@
 	{ 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:
  * <ol><li>Direction of the wire</li>
--- a/table/sprites.h	Mon Mar 19 19:42:40 2007 +0000
+++ b/table/sprites.h	Mon Mar 19 19:56:16 2007 +0000
@@ -276,6 +276,12 @@
 	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,