(svn r10134) [gamebalance] -Sync: r9670:9700 from trunk gamebalance
authorcelestar
Wed, 13 Jun 2007 11:17:30 +0000
branchgamebalance
changeset 9910 0b2aebc8283e
parent 9909 dce9a6923bb7
child 9911 0b8b245a2391
(svn r10134) [gamebalance] -Sync: r9670:9700 from trunk
changelog.txt
config.lib
docs/openttd.6
os/debian/changelog
os/win32/installer/install.nsi
readme.txt
src/ai/ai.h
src/ai/default/default.cpp
src/ai/trolly/build.cpp
src/ai/trolly/trolly.cpp
src/aircraft.h
src/aircraft_cmd.cpp
src/airport_gui.cpp
src/autoreplace_cmd.cpp
src/build_vehicle_gui.cpp
src/clear_cmd.cpp
src/command.cpp
src/command.h
src/depot_gui.cpp
src/disaster_cmd.cpp
src/dock_gui.cpp
src/economy.cpp
src/engine.cpp
src/engine.h
src/gfx.cpp
src/graph_gui.cpp
src/industry.h
src/industry_cmd.cpp
src/industry_gui.cpp
src/landscape.cpp
src/lang/bulgarian.txt
src/lang/czech.txt
src/lang/danish.txt
src/lang/dutch.txt
src/lang/esperanto.txt
src/lang/estonian.txt
src/lang/finnish.txt
src/lang/german.txt
src/lang/italian.txt
src/lang/japanese.txt
src/lang/norwegian_bokmal.txt
src/lang/polish.txt
src/lang/romanian.txt
src/lang/russian.txt
src/lang/simplified_chinese.txt
src/lang/slovak.txt
src/lang/slovenian.txt
src/lang/spanish.txt
src/lang/traditional_chinese.txt
src/lang/turkish.txt
src/lang/ukrainian.txt
src/macros.h
src/main_gui.cpp
src/map.cpp
src/map.h
src/misc.cpp
src/misc_gui.cpp
src/music_gui.cpp
src/namegen.cpp
src/network/core/os_abstraction.h
src/network/network_client.cpp
src/network/network_gui.cpp
src/network/network_udp.cpp
src/newgrf.cpp
src/newgrf_callbacks.h
src/newgrf_engine.cpp
src/newgrf_engine.h
src/news.h
src/oldloader.cpp
src/openttd.cpp
src/order_gui.cpp
src/os2.cpp
src/pathfind.cpp
src/player_gui.cpp
src/rail.cpp
src/road_cmd.cpp
src/road_gui.cpp
src/roadveh_cmd.cpp
src/saveload.cpp
src/saveload.h
src/screenshot.cpp
src/settings.cpp
src/settings_gui.cpp
src/ship_cmd.cpp
src/ship_gui.cpp
src/signs.cpp
src/station.h
src/station_cmd.cpp
src/strgen/strgen.cpp
src/strings.cpp
src/table/ai_rail.h
src/table/build_industry.h
src/table/namegen.h
src/table/station_land.h
src/table/tree_land.h
src/terraform_gui.cpp
src/texteff.cpp
src/town_cmd.cpp
src/train_cmd.cpp
src/train_gui.cpp
src/transparency_gui.cpp
src/tree_cmd.cpp
src/variables.h
src/vehicle.cpp
src/vehicle.h
src/vehicle_gui.cpp
src/video/win32_v.cpp
src/viewport.cpp
src/water_cmd.cpp
src/win32.cpp
src/window.cpp
src/yapf/yapf_base.hpp
src/yapf/yapf_rail.cpp
src/yapf/yapf_road.cpp
src/yapf/yapf_ship.cpp
--- a/changelog.txt	Wed Jun 13 11:00:24 2007 +0000
+++ b/changelog.txt	Wed Jun 13 11:17:30 2007 +0000
@@ -1,3 +1,7 @@
+0.5.1 (2007-04-20)
+------------------------------------------------------------------------
+(None)
+
 0.5.1-RC3 (2007-04-17)
 ------------------------------------------------------------------------
 - Feature: Add list_patches to console commands; shows all patches and values (r9565)
@@ -1352,7 +1356,6 @@
 
 0.2.1 (2004-04-04)
 ------------------------------------------------------------------------
-
 - Fix: copy orders crashed if you clicked on a wagon
 - Feature: 'A' hotkey now always opens autorail
 - Change: Moved autorail button
@@ -1365,7 +1368,6 @@
 
 0.2 (2004-04-03)
 ------------------------------------------------------------------------
-
 - Feature: autoscroll (only works to left/right)
 - Feature: train checkpoints, instead of ttdpatch's nonstop handling
 - Feature: ttdpatch compatible nonstop handling
@@ -1426,7 +1428,6 @@
 
 0.1.4 (2004-03-25)
 ------------------------------------------------------------------------
-
 - Feature: crash submit system on win32
 - Fix: train smoke clouds
 - Fix: train engine sounds
@@ -1467,7 +1468,6 @@
 
 0.1.3 (2004-03-18)
 ------------------------------------------------------------------------
-
 - Fixed message options window
 - Fixed company takeover/purchase
 - Feature: Improved mouse scroll zooming
@@ -1491,7 +1491,6 @@
 
 0.1.2 (2004-03-15)
 ------------------------------------------------------------------------
-
 - Mouse wheel can be used to zoom in out on win32 (ludde)
 - Implemented some support for resizing the window dynamically in win32 (ludde)
 - Fixed tunnel mouse icon for maglev and monorail
@@ -1499,7 +1498,6 @@
 
 0.1.1 (2004-03-14)
 ------------------------------------------------------------------------
-
 - Preliminary presignal support
 - Added external MIDI driver for unix version (by robertnorris)
 - Added DirectMusic driver for Win32 version
--- a/config.lib	Wed Jun 13 11:00:24 2007 +0000
+++ b/config.lib	Wed Jun 13 11:17:30 2007 +0000
@@ -237,9 +237,9 @@
 			--with-osx-sysroot)           with_osx_sysroot="2";;
 			--with-osx-sysroot=*)         with_osx_sysroot="$optarg";;
 
-			--without-application-bundle) with_applicant_bundle="0";;
-			--with-application-bundle)    with_applicant_bundle="1";;
-			--with-application-bundle=*)  with_applicant_bundle="$optarg";;
+			--without-application-bundle) with_application_bundle="0";;
+			--with-application-bundle)    with_application_bundle="1";;
+			--with-application-bundle=*)  with_application_bundle="$optarg";;
 
 			CC=* | --CC=*)                CC="$optarg";;
 			CXX=* | --CXX=*)              CXX="$optarg";;
--- a/docs/openttd.6	Wed Jun 13 11:00:24 2007 +0000
+++ b/docs/openttd.6	Wed Jun 13 11:17:30 2007 +0000
@@ -1,6 +1,6 @@
 .\"                                      Hey, EMACS: -*- nroff -*-
 .\" Please adjust this date whenever revising the manpage.
-.Dd April 17, 2007
+.Dd April 20, 2007
 .Dt OPENTTD 6
 .Sh NAME
 .Nm openttd
--- a/os/debian/changelog	Wed Jun 13 11:00:24 2007 +0000
+++ b/os/debian/changelog	Wed Jun 13 11:17:30 2007 +0000
@@ -4,6 +4,12 @@
 
  -- Matthijs Kooijman <m.kooijman@student.utwente.nl>  Mon, 26 Feb 2007 21:07:05 +0100
 
+openttd (0.5.1-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Matthijs Kooijman <m.kooijman@student.utwente.nl>  Fri, 20 Aprr 2007 21:45:32 +0100
+
 openttd (0.5.1~rc3-1) unstable; urgency=low
 
   * New upstream release.
--- a/os/win32/installer/install.nsi	Wed Jun 13 11:00:24 2007 +0000
+++ b/os/win32/installer/install.nsi	Wed Jun 13 11:17:30 2007 +0000
@@ -1,6 +1,6 @@
 !define APPNAME "OpenTTD"   ; Define application name
 !define APPVERSION "0.5.1"  ; Define application version
-!define INSTALLERVERSION 31 ; NEED TO UPDATE THIS FOR EVERY RELEASE!!!
+!define INSTALLERVERSION 32 ; NEED TO UPDATE THIS FOR EVERY RELEASE!!!
 
 !define APPURLLINK "http://www.openttd.org"
 !define APPNAMEANDVERSION "${APPNAME} ${APPVERSION}"
--- a/readme.txt	Wed Jun 13 11:00:24 2007 +0000
+++ b/readme.txt	Wed Jun 13 11:17:30 2007 +0000
@@ -1,6 +1,6 @@
 OpenTTD README
-Last updated:    2007-04-17
-Release version: 0.5.1-RC3
+Last updated:    2007-04-20
+Release version: 0.5.1
 ------------------------------------------------------------------------
 
 
--- a/src/ai/ai.h	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/ai/ai.h	Wed Jun 13 11:17:30 2007 +0000
@@ -77,8 +77,8 @@
 	return true;
 }
 
-#define AI_CHANCE16(a,b)    ((uint16)     AI_Random()  <= (uint16)((65536 * a) / b))
-#define AI_CHANCE16R(a,b,r) ((uint16)(r = AI_Random()) <= (uint16)((65536 * a) / b))
+#define AI_CHANCE16(a, b)    ((uint16)     AI_Random()  <= (uint16)((65536 * a) / b))
+#define AI_CHANCE16R(a, b, r) ((uint16)(r = AI_Random()) <= (uint16)((65536 * a) / b))
 
 /**
  * The random-function that should be used by ALL AIs.
--- a/src/ai/default/default.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/ai/default/default.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -516,7 +516,7 @@
 {
 	uint i;
 	const Subsidy* s;
-	Town *from,*to;
+	Town *from, *to;
 
 	// initially error
 	fr->distance = -1;
@@ -1561,7 +1561,7 @@
 				return false;
 			if (cargo != CT_MAIL)
 				return true;
-			return !!((values[cargo]>>1) & ~7);
+			return !!((values[cargo] >> 1) & ~7);
 		}
 	}
 
@@ -1574,7 +1574,7 @@
 	int32 total_cost = 0;
 	Town *t = NULL;
 	int rating = 0;
-	int i,j,k;
+	int i, j, k;
 
 	for (;;) {
 		// This will seldomly overflow for valid reasons. Mask it to be on the safe side.
@@ -1588,7 +1588,7 @@
 				ret = DoCommand(c, railtype, p->attr, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_BUILD_TRAIN_DEPOT);
 			} else {
 				// Station
-				ret = DoCommand(c, (p->attr&1) | (p->attr>>4)<<8 | (p->attr>>1&7)<<16, railtype, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_BUILD_RAILROAD_STATION);
+				ret = DoCommand(c, (p->attr & 1) | (p->attr >> 4) << 8 | (p->attr >> 1 & 7) << 16, railtype, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_BUILD_RAILROAD_STATION);
 			}
 
 			if (CmdFailed(ret)) return CMD_ERROR;
@@ -1610,7 +1610,7 @@
 
 			// Build the rail
 			for (i = 0; i != 6; i++, j >>= 1) {
-				if (j&1) {
+				if (j & 1) {
 					k = i;
 					ret = DoCommand(c, railtype, i, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_SINGLE_RAIL);
 					if (CmdFailed(ret)) return CMD_ERROR;
@@ -1642,7 +1642,7 @@
 			total_cost += ret + _eco->GetPrice(CEconomy::PRICE_RAIL_BUILD, c);
 
 			if (flag & DC_EXEC) {
-				DoCommand(c, railtype, p->attr&1, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_BUILD_SINGLE_RAIL);
+				DoCommand(c, railtype, p->attr & 1, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_BUILD_SINGLE_RAIL);
 			}
 
 			goto clear_town_stuff;
@@ -1784,7 +1784,7 @@
 			if (rule == -1) {
 				// cannot build, terraform after a while
 				if (p->ai.state_counter >= 600) {
-					AiDoTerraformLand(aib->use_tile, Random()&3, 3, (int8)p->ai.state_mode);
+					AiDoTerraformLand(aib->use_tile, Random() & 3, 3, (int8)p->ai.state_mode);
 				}
 				// also try the other terraform direction
 				if (++p->ai.state_counter >= 1000) {
@@ -1804,7 +1804,7 @@
 				);
 				assert(!CmdFailed(r));
 			}
-		} while (++aib,--j);
+		} while (++aib, --j);
 	}
 
 	// check if we're done with all of them
@@ -1812,7 +1812,7 @@
 	j = p->ai.num_build_rec;
 	do {
 		if (aib->cur_building_rule == 255) return;
-	} while (++aib,--j);
+	} while (++aib, --j);
 
 	// yep, all are done. switch state to the rail building state.
 	p->ai.state = AIS_BUILD_RAIL;
@@ -1857,7 +1857,7 @@
 	arpfd.tile2 = p->ai.cur_tile_a;
 	arpfd.flag = false;
 	arpfd.count = 0;
-	FollowTrack(p->ai.cur_tile_a + TileOffsByDiagDir(p->ai.cur_dir_a), 0x2000 | TRANSPORT_RAIL, (DiagDirection)(p->ai.cur_dir_a^2),
+	FollowTrack(p->ai.cur_tile_a + TileOffsByDiagDir(p->ai.cur_dir_a), 0x2000 | TRANSPORT_RAIL, (DiagDirection)(p->ai.cur_dir_a ^ 2),
 		(TPFEnumProc*)AiEnumFollowTrack, NULL, &arpfd);
 	return arpfd.count > 8;
 }
@@ -2001,8 +2001,8 @@
 	if (GetTileSlope(tile, &z) == _dir_table_2[p[0] & 3] && z != 0) {
 		int32 cost = DoCommand(tile, arf->player->ai.railtype_to_use, 0, DC_AUTO, CMD_BUILD_TUNNEL);
 
-		if (!CmdFailed(cost) && cost <= (arf->player->player_money>>4)) {
-			AiBuildRailRecursive(arf, _build_tunnel_endtile, p[0]&3);
+		if (!CmdFailed(cost) && cost <= (arf->player->player_money >> 4)) {
+			AiBuildRailRecursive(arf, _build_tunnel_endtile, p[0] & 3);
 			if (arf->depth == 1) AiCheckRailPathBetter(arf, p);
 		}
 	}
@@ -2017,7 +2017,7 @@
 
 	// Reached destination?
 	if (tile == arf->final_tile) {
-		if (arf->final_dir != (dir^2)) {
+		if (arf->final_dir != (dir ^ 2)) {
 			if (arf->recursive_mode != 2) arf->recursive_mode = 1;
 		} else if (arf->recursive_mode != 2) {
 			arf->recursive_mode = 2;
@@ -2063,17 +2063,17 @@
 			if (arf->depth == 1) AiCheckRailPathBetter(arf, p);
 
 			p += 2;
-		} while (!(p[0]&0x80));
+		} while (!(p[0] & 0x80));
 	}
 
 	AiCheckBuildRailBridgeHere(arf, tile, p);
-	AiCheckBuildRailTunnelHere(arf, tile, p+1);
+	AiCheckBuildRailTunnelHere(arf, tile, p + 1);
 
 	arf->depth--;
 }
 
 
-static const byte _dir_table_3[]= {0x25, 0x2A, 0x19, 0x16};
+static const byte _dir_table_3[] = {0x25, 0x2A, 0x19, 0x16};
 
 static void AiBuildRailConstruct(Player *p)
 {
@@ -2324,23 +2324,23 @@
 	}
 
 	// Find first edge to build from.
-	tile = AiGetEdgeOfDefaultRailBlock(aib->cur_building_rule, aib->use_tile, cmd&3, &dir);
+	tile = AiGetEdgeOfDefaultRailBlock(aib->cur_building_rule, aib->use_tile, cmd & 3, &dir);
 	p->ai.start_tile_a = tile;
 	p->ai.cur_tile_a = tile;
 	p->ai.start_dir_a = dir;
 	p->ai.cur_dir_a = dir;
-	DoCommand(TILE_MASK(tile + TileOffsByDiagDir(dir)), 0, (dir&1)?1:0, DC_EXEC, CMD_REMOVE_SINGLE_RAIL);
+	DoCommand(TILE_MASK(tile + TileOffsByDiagDir(dir)), 0, (dir & 1) ? 1 : 0, DC_EXEC, CMD_REMOVE_SINGLE_RAIL);
 
 	assert(TILE_MASK(tile) != 0xFF00);
 
 	// Find second edge to build to
-	aib = (&p->ai.src) + ((cmd >> 4)&0xF);
-	tile = AiGetEdgeOfDefaultRailBlock(aib->cur_building_rule, aib->use_tile, (cmd>>2)&3, &dir);
+	aib = (&p->ai.src) + ((cmd >> 4) & 0xF);
+	tile = AiGetEdgeOfDefaultRailBlock(aib->cur_building_rule, aib->use_tile, (cmd >> 2) & 3, &dir);
 	p->ai.start_tile_b = tile;
 	p->ai.cur_tile_b = tile;
 	p->ai.start_dir_b = dir;
 	p->ai.cur_dir_b = dir;
-	DoCommand(TILE_MASK(tile + TileOffsByDiagDir(dir)), 0, (dir&1)?1:0, DC_EXEC, CMD_REMOVE_SINGLE_RAIL);
+	DoCommand(TILE_MASK(tile + TileOffsByDiagDir(dir)), 0, (dir & 1) ? 1 : 0, DC_EXEC, CMD_REMOVE_SINGLE_RAIL);
 
 	assert(TILE_MASK(tile) != 0xFF00);
 
@@ -2503,7 +2503,7 @@
 		for (b = _default_rail_track_data[aib->cur_building_rule]->data; b->mode != 4; b++) {
 			DoCommand(TILE_ADD(aib->use_tile, ToTileIndexDiff(b->tileoffs)), 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
 		}
-	} while (++aib,--num);
+	} while (++aib, --num);
 
 	p->ai.state = AIS_0;
 }
@@ -2682,14 +2682,14 @@
 			if (rule == -1) {
 				// cannot build, terraform after a while
 				if (p->ai.state_counter >= 600) {
-					AiDoTerraformLand(aib->use_tile, Random()&3, 3, (int8)p->ai.state_mode);
+					AiDoTerraformLand(aib->use_tile, Random() & 3, 3, (int8)p->ai.state_mode);
 				}
 				// also try the other terraform direction
 				if (++p->ai.state_counter >= 1000) {
 					p->ai.state_counter = 0;
 					p->ai.state_mode = -p->ai.state_mode;
 				}
-			} else if (CheckPlayerHasMoney(cost) && AiCheckBlockDistances(p,aib->use_tile)) {
+			} else if (CheckPlayerHasMoney(cost) && AiCheckBlockDistances(p, aib->use_tile)) {
 				int32 r;
 
 				// player has money, build it.
@@ -2702,7 +2702,7 @@
 				);
 				assert(!CmdFailed(r));
 			}
-		} while (++aib,--j);
+		} while (++aib, --j);
 	}
 
 	// check if we're done with all of them
@@ -2710,7 +2710,7 @@
 	j = p->ai.num_build_rec;
 	do {
 		if (aib->cur_building_rule == 255) return;
-	} while (++aib,--j);
+	} while (++aib, --j);
 
 	// yep, all are done. switch state to the rail building state.
 	p->ai.state = AIS_BUILD_ROAD;
@@ -2901,8 +2901,8 @@
 	if (GetTileSlope(tile, &z) == _dir_table_2[p[0] & 3] && z != 0) {
 		int32 cost = DoCommand(tile, 0x200, 0, DC_AUTO, CMD_BUILD_TUNNEL);
 
-		if (!CmdFailed(cost) && cost <= (arf->player->player_money>>4)) {
-			AiBuildRoadRecursive(arf, _build_tunnel_endtile, p[0]&3);
+		if (!CmdFailed(cost) && cost <= (arf->player->player_money >> 4)) {
+			AiBuildRoadRecursive(arf, _build_tunnel_endtile, p[0] & 3);
 			if (arf->depth == 1)  AiCheckRoadPathBetter(arf, p);
 		}
 	}
@@ -2918,7 +2918,7 @@
 
 	// Reached destination?
 	if (tile == arf->final_tile) {
-		if ((arf->final_dir^2) == dir) {
+		if ((arf->final_dir ^ 2) == dir) {
 			arf->recursive_mode = 2;
 			arf->cur_best_depth = arf->depth;
 		}
@@ -2962,7 +2962,7 @@
 	}
 
 	AiCheckBuildRoadBridgeHere(arf, tile, p);
-	AiCheckBuildRoadTunnelHere(arf, tile, p+1);
+	AiCheckBuildRoadTunnelHere(arf, tile, p + 1);
 
 	arf->depth--;
 }
@@ -3020,7 +3020,7 @@
 
 	tile = TILE_MASK(p->ai.cur_tile_a + TileOffsByDiagDir(p->ai.cur_dir_a));
 
-	if (arf.best_ptr[0]&0x80) {
+	if (arf.best_ptr[0] & 0x80) {
 		int i;
 		int32 bridge_len;
 		p->ai.cur_tile_a = arf.bridge_end_tile;
@@ -3042,7 +3042,7 @@
 		DoCommand(tile, p->ai.cur_tile_a, i + (0x80 << 8), DC_AUTO | DC_EXEC, CMD_BUILD_BRIDGE);
 
 		p->ai.state_counter = 0;
-	} else if (arf.best_ptr[0]&0x40) {
+	} else if (arf.best_ptr[0] & 0x40) {
 		// tunnel
 		DoCommand(tile, 0x200, 0, DC_AUTO | DC_EXEC, CMD_BUILD_TUNNEL);
 		p->ai.cur_tile_a = _build_tunnel_endtile;
@@ -3148,7 +3148,7 @@
 	p->ai.cur_dir_a = dir;
 
 	// Find second edge to build to
-	aib = (&p->ai.src) + (cmd&0xF);
+	aib = (&p->ai.src) + (cmd & 0xF);
 	tile = AiGetRoadBlockEdge(aib->cur_building_rule, aib->use_tile, &dir);
 	p->ai.start_tile_b = tile;
 	p->ai.cur_tile_b = tile;
@@ -3239,7 +3239,7 @@
 			if (b->mode > 1) continue;
 			DoCommand(TILE_ADD(aib->use_tile, ToTileIndexDiff(b->tileoffs)), 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
 		}
-	} while (++aib,--num);
+	} while (++aib, --num);
 
 	p->ai.state = AIS_0;
 }
@@ -3326,7 +3326,7 @@
 
 	for (; p->mode == 0; p++) {
 		if (!HASBIT(avail_airports, p->attr)) return CMD_ERROR;
-		ret = DoCommand(TILE_MASK(tile + ToTileIndexDiff(p->tileoffs)), p->attr,0,flag | DC_AUTO | DC_NO_WATER,CMD_BUILD_AIRPORT);
+		ret = DoCommand(TILE_MASK(tile + ToTileIndexDiff(p->tileoffs)), p->attr, 0, flag | DC_AUTO | DC_NO_WATER, CMD_BUILD_AIRPORT);
 		if (CmdFailed(ret)) return CMD_ERROR;
 		total_cost += ret;
 	}
@@ -3408,14 +3408,14 @@
 			if (rule == -1) {
 				// cannot build, terraform after a while
 				if (p->ai.state_counter >= 600) {
-					AiDoTerraformLand(aib->use_tile, Random()&3, 3, (int8)p->ai.state_mode);
+					AiDoTerraformLand(aib->use_tile, Random() & 3, 3, (int8)p->ai.state_mode);
 				}
 				// also try the other terraform direction
 				if (++p->ai.state_counter >= 1000) {
 					p->ai.state_counter = 0;
 					p->ai.state_mode = -p->ai.state_mode;
 				}
-			} else if (CheckPlayerHasMoney(cost) && AiCheckBlockDistances(p,aib->use_tile)) {
+			} else if (CheckPlayerHasMoney(cost) && AiCheckBlockDistances(p, aib->use_tile)) {
 				// player has money, build it.
 				int32 r;
 
@@ -3428,7 +3428,7 @@
 				);
 				assert(!CmdFailed(r));
 			}
-		} while (++aib,--j);
+		} while (++aib, --j);
 	} while (--i);
 
 	// check if we're done with all of them
@@ -3436,7 +3436,7 @@
 	j = p->ai.num_build_rec;
 	do {
 		if (aib->cur_building_rule == 255) return;
-	} while (++aib,--j);
+	} while (++aib, --j);
 
 	// yep, all are done. switch state.
 	p->ai.state = AIS_BUILD_AIRCRAFT_VEHICLES;
@@ -3650,7 +3650,7 @@
 				}
 			}
 		} else {
-			static const byte _depot_bits[] = {0x19,0x16,0x25,0x2A};
+			static const byte _depot_bits[] = {0x19, 0x16, 0x25, 0x2A};
 
 			DiagDirection dir = GetRailDepotDirection(tile);
 
@@ -3795,13 +3795,13 @@
 		// Ask the guy with the highest performance hist.
 		FOR_ALL_PLAYERS(pp) {
 			if (pp->is_active &&
-					!(asked&1) &&
+					!(asked & 1) &&
 					pp->bankrupt_asked == 0 &&
 					best_val < pp->old_economy[1].performance_history) {
 				best_val = pp->old_economy[1].performance_history;
 				best_pl = pp;
 			}
-			asked>>=1;
+			asked >>= 1;
 		}
 
 		// Asked all players?
@@ -3843,7 +3843,7 @@
 		// Increase loan
 		if (p->current_loan < _economy.max_loan &&
 				p->num_valid_stat_ent >= 2 &&
-				-(p->old_economy[0].expenses+p->old_economy[1].expenses) < base * 60) {
+				-(p->old_economy[0].expenses + p->old_economy[1].expenses) < base * 60) {
 			DoCommand(0, 0, 0, DC_EXEC, CMD_INCREASE_LOAN);
 		}
 	}
@@ -3872,7 +3872,7 @@
 	//  to the patch-setting
 	// Also, it takes into account the setting if the service-interval is in days
 	//  or in %
-	_ai_service_interval = _patches.servint_ispercent?80:180;
+	_ai_service_interval = _patches.servint_ispercent ? 80 : 180;
 
 	if (IsHumanPlayer(_current_player)) return;
 
@@ -3883,7 +3883,7 @@
 	{
 		static byte old_state = 99;
 		static bool hasdots = false;
-		char *_ai_state_names[]={
+		char *_ai_state_names[] = {
 			"AiCase0",
 			"AiCase1",
 			"AiStateVehLoop",
--- a/src/ai/trolly/build.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/ai/trolly/build.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -123,7 +123,7 @@
 		}
 		// Bridge code
 		if ((AI_PATHFINDER_FLAG_BRIDGE & route_extra[part]) != 0) {
-			cost += AiNew_Build_Bridge(p, route[part], route[part-1], flag);
+			cost += AiNew_Build_Bridge(p, route[part], route[part - 1], flag);
 			PathFinderInfo->position++;
 			// TODO: problems!
 			if (CmdFailed(cost)) {
@@ -173,7 +173,7 @@
 		}
 		// Bridge code
 		if ((AI_PATHFINDER_FLAG_BRIDGE & route_extra[part]) != 0) {
-			cost += AiNew_Build_Bridge(p, route[part], route[part+1], flag);
+			cost += AiNew_Build_Bridge(p, route[part], route[part + 1], flag);
 			PathFinderInfo->position++;
 			// TODO: problems!
 			if (CmdFailed(cost)) {
--- a/src/ai/trolly/trolly.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/ai/trolly/trolly.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -220,9 +220,9 @@
 
 		// Check if the rating in a city is high enough
 		//  If not, take a chance if we want to continue
-		if (t->ratings[_current_player] < 0 && AI_CHANCE16(1,4)) return false;
+		if (t->ratings[_current_player] < 0 && AI_CHANCE16(1, 4)) return false;
 
-		if (t->max_pass - t->act_pass < AI_CHECKCITY_NEEDED_CARGO && !AI_CHANCE16(1,AI_CHECKCITY_CITY_CHANCE)) return false;
+		if (t->max_pass - t->act_pass < AI_CHECKCITY_NEEDED_CARGO && !AI_CHANCE16(1, AI_CHECKCITY_CITY_CHANCE)) return false;
 
 		// Check if we have build a station in this town the last 6 months
 		//  else we don't do it. This is done, because stat updates can be slow
@@ -275,7 +275,7 @@
 		int count = 0;
 		int j = 0;
 
-		if (i->town != NULL && i->town->ratings[_current_player] < 0 && AI_CHANCE16(1,4)) return false;
+		if (i->town != NULL && i->town->ratings[_current_player] < 0 && AI_CHANCE16(1, 4)) return false;
 
 		// No limits on delevering stations!
 		//  Or for industry that does not give anything yet
@@ -642,8 +642,8 @@
 		int r;
 		uint best;
 		uint accepts[NUM_CARGO];
-		TileIndex found_spot[AI_FINDSTATION_TILE_RANGE*AI_FINDSTATION_TILE_RANGE*4];
-		uint found_best[AI_FINDSTATION_TILE_RANGE*AI_FINDSTATION_TILE_RANGE*4];
+		TileIndex found_spot[AI_FINDSTATION_TILE_RANGE*AI_FINDSTATION_TILE_RANGE * 4];
+		uint found_best[AI_FINDSTATION_TILE_RANGE*AI_FINDSTATION_TILE_RANGE * 4];
 		// To find a good spot we scan a range from the center, a get the point
 		//  where we get the most cargo and where it is buildable.
 		// TODO: also check for station of myself and make sure we are not
@@ -961,13 +961,13 @@
 
 	// Now we can build the route, check the direction of the stations!
 	if (p->ainew.from_direction == AI_PATHFINDER_NO_DIRECTION) {
-		p->ainew.from_direction = AiNew_GetDirection(p->ainew.path_info.route[p->ainew.path_info.route_length-1], p->ainew.path_info.route[p->ainew.path_info.route_length-2]);
+		p->ainew.from_direction = AiNew_GetDirection(p->ainew.path_info.route[p->ainew.path_info.route_length - 1], p->ainew.path_info.route[p->ainew.path_info.route_length - 2]);
 	}
 	if (p->ainew.to_direction == AI_PATHFINDER_NO_DIRECTION) {
 		p->ainew.to_direction = AiNew_GetDirection(p->ainew.path_info.route[0], p->ainew.path_info.route[1]);
 	}
 	if (p->ainew.from_tile == AI_STATION_RANGE)
-		p->ainew.from_tile = p->ainew.path_info.route[p->ainew.path_info.route_length-1];
+		p->ainew.from_tile = p->ainew.path_info.route[p->ainew.path_info.route_length - 1];
 	if (p->ainew.to_tile == AI_STATION_RANGE)
 		p->ainew.to_tile = p->ainew.path_info.route[0];
 
--- a/src/aircraft.h	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/aircraft.h	Wed Jun 13 11:17:30 2007 +0000
@@ -109,4 +109,10 @@
  */
 void UpdateAirplanesOnNewStation(const Station *st);
 
+/** Update cached values of an aircraft.
+ * Currently caches callback 36 max speed.
+ * @param v Vehicle
+ */
+void UpdateAircraftCache(Vehicle *v);
+
 #endif /* AIRCRAFT_H */
--- a/src/aircraft_cmd.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/aircraft_cmd.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -393,6 +393,8 @@
 		v->vehicle_flags = 0;
 		if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SETBIT(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE);
 
+		UpdateAircraftCache(v);
+
 		VehiclePositionChanged(v);
 		VehiclePositionChanged(u);
 
@@ -569,6 +571,8 @@
 		}
 
 		if (flags & DC_EXEC) {
+			if (v->current_order.type == OT_LOADING) v->LeaveStation();
+
 			v->current_order.type = OT_GOTO_DEPOT;
 			v->current_order.flags = OF_NON_STOP;
 			if (!(p2 & DEPOT_SERVICE)) SETBIT(v->current_order.flags, OFB_HALT_IN_DEPOT);
@@ -715,7 +719,8 @@
 
 	if (v->vehstatus & VS_STOPPED) return;
 
-	int32 cost = AircraftVehInfo(v->engine_type)->running_cost * _eco->GetPrice(CEconomy::AIRCRAFT_RUNNING) / 364;
+	int32 cost = GetVehicleProperty(v, 0x0E, AircraftVehInfo(v->engine_type)->running_cost) *
+		_eco->GetPrice(CEconomy::AIRCRAFT_RUNNING) / 364;
 
 	v->profit_this_year -= cost >> 8;
 
@@ -862,6 +867,21 @@
 	}
 }
 
+
+void UpdateAircraftCache(Vehicle *v)
+{
+	uint max_speed = GetVehicleProperty(v, 0x0C, 0);
+	if (max_speed != 0) {
+		/* Convert from original units to (approx) km/h */
+		max_speed = (max_speed * 129) / 10;
+
+		v->u.air.cached_max_speed = max_speed;
+	} else {
+		v->u.air.cached_max_speed = 0xFFFF;
+	}
+}
+
+
 /**
  * Special velocities for aircraft
  */
@@ -885,6 +905,11 @@
 	uint spd = v->acceleration * 16;
 	byte t;
 
+	if (v->u.air.cached_max_speed < speed_limit) {
+		if (v->cur_speed < speed_limit) hard_limit = false;
+		speed_limit = v->u.air.cached_max_speed;
+	}
+
 	speed_limit = min(speed_limit, v->max_speed);
 
 	v->subspeed = (t=v->subspeed) + (byte)spd;
@@ -1389,6 +1414,7 @@
 			}
 
 			Order b = v->current_order;
+			v->LeaveStation();
 			v->current_order.Free();
 			MarkAircraftDirty(v);
 			if (!(b.flags & OF_NON_STOP)) return;
@@ -1856,8 +1882,10 @@
 	/* we have arrived in an important state (eg terminal, hangar, etc.) */
 	if (current->heading == v->u.air.state) {
 		byte prev_pos = v->u.air.pos; // location could be changed in state, so save it before-hand
+		byte prev_state = v->u.air.state;
 		_aircraft_state_handlers[v->u.air.state](v, apc);
 		if (v->u.air.state != FLYING) v->u.air.previous_pos = prev_pos;
+		if (v->u.air.state != prev_state) UpdateAircraftCache(v);
 		return true;
 	}
 
--- a/src/airport_gui.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/airport_gui.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -105,7 +105,7 @@
 
 		w = FindWindowById(WC_BUILD_STATION, 0);
 		if (w != 0)
-			WP(w,def_d).close = true;
+			WP(w, def_d).close = true;
 		break;
 
 	case WE_DESTROY:
@@ -155,7 +155,7 @@
 		uint32 avail_airports;
 		const AirportFTAClass *airport;
 
-		if (WP(w,def_d).close) return;
+		if (WP(w, def_d).close) return;
 
 		avail_airports = GetValidAirports();
 
@@ -207,7 +207,7 @@
 	} break;
 
 	case WE_MOUSELOOP: {
-		if (WP(w,def_d).close) {
+		if (WP(w, def_d).close) {
 			DeleteWindow(w);
 			return;
 		}
@@ -216,7 +216,7 @@
 	} break;
 
 	case WE_DESTROY:
-		if (!WP(w,def_d).close) ResetObjectToPlace();
+		if (!WP(w, def_d).close) ResetObjectToPlace();
 		break;
 	}
 }
--- a/src/autoreplace_cmd.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/autoreplace_cmd.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -87,34 +87,9 @@
  */
 static CargoID GetNewCargoTypeForReplace(Vehicle *v, EngineID engine_type)
 {
-	bool new_cargo_capacity = true;
-	CargoID new_cargo_type = CT_INVALID;
-
-	switch (v->type) {
-		case VEH_TRAIN:
-			new_cargo_capacity = (RailVehInfo(engine_type)->capacity > 0);
-			new_cargo_type     = RailVehInfo(engine_type)->cargo_type;
-			break;
+	CargoID new_cargo_type = GetEngineCargoType(engine_type);
 
-		case VEH_ROAD:
-			new_cargo_capacity = (RoadVehInfo(engine_type)->capacity > 0);
-			new_cargo_type     = RoadVehInfo(engine_type)->cargo_type;
-			break;
-		case VEH_SHIP:
-			new_cargo_capacity = (ShipVehInfo(engine_type)->capacity > 0);
-			new_cargo_type     = ShipVehInfo(engine_type)->cargo_type;
-			break;
-
-		case VEH_AIRCRAFT:
-			/* all aircraft starts as passenger planes with cargo capacity
-			 * new_cargo_capacity is always true for aircraft, which is the init value. No need to set it here */
-			new_cargo_type     = CT_PASSENGERS;
-			break;
-
-		default: NOT_REACHED(); break;
-	}
-
-	if (!new_cargo_capacity) return CT_NO_REFIT; // Don't try to refit an engine with no cargo capacity
+	if (new_cargo_type == CT_INVALID) return CT_NO_REFIT; // Don't try to refit an engine with no cargo capacity
 
 	if (v->cargo_type == new_cargo_type || CanRefitTo(engine_type, v->cargo_type)) {
 		if (VerifyAutoreplaceRefitForOrders(v, engine_type)) {
@@ -137,7 +112,7 @@
 		/* Now we found a cargo type being carried on the train and we will see if it is possible to carry to this one */
 		if (v->cargo_type == new_cargo_type) return CT_NO_REFIT;
 		if (CanRefitTo(engine_type, v->cargo_type)) return v->cargo_type;
-	} while ((v=v->next) != NULL);
+	} while ((v = v->next) != NULL);
 	return CT_NO_REFIT; // We failed to find a cargo type on the old vehicle and we will not refit the new one
 }
 
--- a/src/build_vehicle_gui.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/build_vehicle_gui.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -342,19 +342,19 @@
 	&TrainEngineRunningCostSorter,
 	&TrainEnginePowerVsRunningCostSorter,
 	&EngineReliabilitySorter,
-},{
+}, {
 	/* Road vehicles */
 	&EngineNumberSorter,
 	&EngineIntroDateSorter,
 	&EngineNameSorter,
 	&EngineReliabilitySorter,
-},{
+}, {
 	/* Ships */
 	&EngineNumberSorter,
 	&EngineIntroDateSorter,
 	&EngineNameSorter,
 	&EngineReliabilitySorter,
-},{
+}, {
 	/* Aircraft */
 	&EngineNumberSorter,
 	&AircraftEngineCostSorter,
@@ -378,21 +378,21 @@
 	STR_ENGINE_SORT_POWER_VS_RUNNING_COST,
 	STR_SORT_BY_RELIABILITY,
 	INVALID_STRING_ID
-},{
+}, {
 	/* Road vehicles */
 	STR_ENGINE_SORT_ENGINE_ID,
 	STR_ENGINE_SORT_INTRO_DATE,
 	STR_SORT_BY_DROPDOWN_NAME,
 	STR_SORT_BY_RELIABILITY,
 	INVALID_STRING_ID
-},{
+}, {
 	/* Ships */
 	STR_ENGINE_SORT_ENGINE_ID,
 	STR_ENGINE_SORT_INTRO_DATE,
 	STR_SORT_BY_DROPDOWN_NAME,
 	STR_SORT_BY_RELIABILITY,
 	INVALID_STRING_ID
-},{
+}, {
 	/* Aircraft */
 	STR_ENGINE_SORT_ENGINE_ID,
 	STR_ENGINE_SORT_COST,
@@ -422,7 +422,7 @@
 	/* Wagon speed limit, displayed if above zero */
 	if (rvi->max_speed > 0 && _patches.wagon_speed_limits) {
 		SetDParam(0, rvi->max_speed * 10 / 16);
-		DrawString(x,y, STR_PURCHASE_INFO_SPEED, 0);
+		DrawString(x, y, STR_PURCHASE_INFO_SPEED, 0);
 		y += 10;
 	}
 	return y;
@@ -436,13 +436,13 @@
 	/* Purchase Cost - Engine weight */
 	SetDParam(0, rvi->base_cost * (_eco->GetPrice(CEconomy::BUILD_RAILVEHICLE) >> 3) >> 5);
 	SetDParam(1, rvi->weight << multihead);
-	DrawString(x,y, STR_PURCHASE_INFO_COST_WEIGHT, 0);
+	DrawString(x, y, STR_PURCHASE_INFO_COST_WEIGHT, 0);
 	y += 10;
 
 	/* Max speed - Engine power */
 	SetDParam(0, rvi->max_speed * 10 / 16);
 	SetDParam(1, rvi->power << multihead);
-	DrawString(x,y, STR_PURCHASE_INFO_SPEED_POWER, 0);
+	DrawString(x, y, STR_PURCHASE_INFO_SPEED_POWER, 0);
 	y += 10;
 
 	/* Max tractive effort - not applicable if old acceleration or maglev */
@@ -463,14 +463,14 @@
 
 	/* Running cost */
 	SetDParam(0, (rvi->running_cost_base * cost_class >> 8) << multihead);
-	DrawString(x,y, STR_PURCHASE_INFO_RUNNINGCOST, 0);
+	DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, 0);
 	y += 10;
 
 	/* Powered wagons power - Powered wagons extra weight */
 	if (rvi->pow_wag_power != 0) {
 		SetDParam(0, rvi->pow_wag_power);
 		SetDParam(1, rvi->pow_wag_weight);
-		DrawString(x,y, STR_PURCHASE_INFO_PWAGPOWER_PWAGWEIGHT, 0);
+		DrawString(x, y, STR_PURCHASE_INFO_PWAGPOWER_PWAGWEIGHT, 0);
 		y += 10;
 	};
 
@@ -509,19 +509,19 @@
 	/* Purchase cost - Max speed */
 	SetDParam(0, svi->base_cost * (_eco->GetPrice(CEconomy::SHIP_BASE) >> 3) >> 5);
 	SetDParam(1, svi->max_speed * 10 / 32);
-	DrawString(x,y, STR_PURCHASE_INFO_COST_SPEED, 0);
+	DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, 0);
 	y += 10;
 
 	/* Cargo type + capacity */
 	SetDParam(0, svi->cargo_type);
 	SetDParam(1, svi->capacity);
 	SetDParam(2, svi->refittable ? STR_9842_REFITTABLE : STR_EMPTY);
-	DrawString(x,y, STR_PURCHASE_INFO_CAPACITY, 0);
+	DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, 0);
 	y += 10;
 
 	/* Running cost */
 	SetDParam(0, svi->running_cost * _eco->GetPrice(CEconomy::SHIP_RUNNING) >> 8);
-	DrawString(x,y, STR_PURCHASE_INFO_RUNNINGCOST, 0);
+	DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, 0);
 	y += 10;
 
 	return y;
@@ -599,7 +599,7 @@
 				SetDParam(1, (rvi->capacity * (CountArticulatedParts(engine_number) + 1)) << multihead);
 				SetDParam(2, refitable ? STR_9842_REFITTABLE : STR_EMPTY);
 			}
-			DrawString(x,y, STR_PURCHASE_INFO_CAPACITY, 0);
+			DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, 0);
 			y += 10;
 		}
 			break;
@@ -1040,7 +1040,7 @@
 
 	switch (type) {
 		case VEH_TRAIN:
-			WP(w,buildvehicle_d).filter.railtype = (tile == 0) ? RAILTYPE_END : GetRailType(tile);
+			WP(w, buildvehicle_d).filter.railtype = (tile == 0) ? RAILTYPE_END : GetRailType(tile);
 			ResizeWindow(w, 0, 16);
 			break;
 		case VEH_ROAD:
--- a/src/clear_cmd.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/clear_cmd.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -80,7 +80,7 @@
 
 	if (count >= 625) return;
 
-	for (t = ts->tile_table; count != 0; count--,t++) {
+	for (t = ts->tile_table; count != 0; count--, t++) {
 		if (*t == tile) return;
 	}
 
@@ -142,7 +142,7 @@
 		}
 	}
 
-	ret = DoCommand(tile, 0,0, ts->flags & ~DC_EXEC, CMD_LANDSCAPE_CLEAR);
+	ret = DoCommand(tile, 0, 0, ts->flags & ~DC_EXEC, CMD_LANDSCAPE_CLEAR);
 
 	if (CmdFailed(ret)) {
 		_terraform_err_tile = tile;
@@ -216,8 +216,8 @@
 			tile += ToTileIndexDiff(*ttm);
 
 			r = TerraformGetHeightOfTile(ts, tile);
-			if (r != height && r-direction != height && r+direction != height) {
-				if (!TerraformTileHeight(ts, tile, r+direction))
+			if (r != height && r - direction != height && r + direction != height) {
+				if (!TerraformTileHeight(ts, tile, r + direction))
 					return false;
 			}
 		}
@@ -383,8 +383,8 @@
 	if (ey < sy) Swap(ey, sy);
 	tile = TileXY(sx, sy);
 
-	size_x = ex-sx+1;
-	size_y = ey-sy+1;
+	size_x = ex - sx + 1;
+	size_y = ey - sy + 1;
 
 	money = GetAvailableMoneyForCommand();
 	cost = 0;
--- a/src/command.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/command.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -407,7 +407,7 @@
  * the callback is called when the command succeeded or failed. */
 bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback, uint32 cmd)
 {
-	int32 res = 0,res2;
+	int32 res = 0, res2;
 	CommandProc *proc;
 	uint32 flags;
 	bool notest;
@@ -544,7 +544,7 @@
 		if (res2 != 0) ShowCostOrIncomeAnimation(x, y, GetSlopeZ(x, y), res2);
 		if (_additional_cash_required) {
 			SetDParam(0, _additional_cash_required);
-			ShowErrorMessage(STR_0003_NOT_ENOUGH_CASH_REQUIRES, error_part1, x,y);
+			ShowErrorMessage(STR_0003_NOT_ENOUGH_CASH_REQUIRES, error_part1, x, y);
 			if (res2 == 0) goto callb_err;
 		}
 	}
@@ -558,7 +558,7 @@
 show_error:
 	/* show error message if the command fails? */
 	if (IsLocalPlayer() && error_part1 != 0) {
-		ShowErrorMessage(_error_message, error_part1, x,y);
+		ShowErrorMessage(_error_message, error_part1, x, y);
 	}
 
 callb_err:
--- a/src/command.h	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/command.h	Wed Jun 13 11:17:30 2007 +0000
@@ -158,7 +158,7 @@
 	CMD_ERROR = ((int32)0x80000000),
 };
 
-#define CMD_MSG(x) ((x)<<16)
+#define CMD_MSG(x) ((x) << 16)
 
 enum {
 	CMD_AUTO                  = 0x0200,
--- a/src/depot_gui.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/depot_gui.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -535,9 +535,9 @@
 		case VEH_TRAIN:
 			w->widget[DEPOT_WIDGET_CAPTION].data      = STR_8800_TRAIN_DEPOT;
 			w->widget[DEPOT_WIDGET_STOP_ALL].tooltips = STR_MASS_STOP_DEPOT_TRAIN_TIP;
-			w->widget[DEPOT_WIDGET_START_ALL].tooltips=	STR_MASS_START_DEPOT_TRAIN_TIP;
+			w->widget[DEPOT_WIDGET_START_ALL].tooltips= STR_MASS_START_DEPOT_TRAIN_TIP;
 			w->widget[DEPOT_WIDGET_SELL].tooltips     = STR_8841_DRAG_TRAIN_VEHICLE_TO_HERE;
-			w->widget[DEPOT_WIDGET_SELL_ALL].tooltips =	STR_DEPOT_SELL_ALL_BUTTON_TRAIN_TIP;
+			w->widget[DEPOT_WIDGET_SELL_ALL].tooltips = STR_DEPOT_SELL_ALL_BUTTON_TRAIN_TIP;
 			w->widget[DEPOT_WIDGET_MATRIX].tooltips   = STR_883F_TRAINS_CLICK_ON_TRAIN_FOR;
 
 			w->widget[DEPOT_WIDGET_BUILD].data        = STR_8815_NEW_VEHICLES;
@@ -559,9 +559,9 @@
 		case VEH_ROAD:
 			w->widget[DEPOT_WIDGET_CAPTION].data      = STR_9003_ROAD_VEHICLE_DEPOT;
 			w->widget[DEPOT_WIDGET_STOP_ALL].tooltips = STR_MASS_STOP_DEPOT_ROADVEH_TIP;
-			w->widget[DEPOT_WIDGET_START_ALL].tooltips=	STR_MASS_START_DEPOT_ROADVEH_TIP;
+			w->widget[DEPOT_WIDGET_START_ALL].tooltips= STR_MASS_START_DEPOT_ROADVEH_TIP;
 			w->widget[DEPOT_WIDGET_SELL].tooltips     = STR_9024_DRAG_ROAD_VEHICLE_TO_HERE;
-			w->widget[DEPOT_WIDGET_SELL_ALL].tooltips =	STR_DEPOT_SELL_ALL_BUTTON_ROADVEH_TIP;
+			w->widget[DEPOT_WIDGET_SELL_ALL].tooltips = STR_DEPOT_SELL_ALL_BUTTON_ROADVEH_TIP;
 			w->widget[DEPOT_WIDGET_MATRIX].tooltips   = STR_9022_VEHICLES_CLICK_ON_VEHICLE;
 
 			w->widget[DEPOT_WIDGET_BUILD].data        = STR_9004_NEW_VEHICLES;
@@ -583,9 +583,9 @@
 		case VEH_SHIP:
 			w->widget[DEPOT_WIDGET_CAPTION].data      = STR_9803_SHIP_DEPOT;
 			w->widget[DEPOT_WIDGET_STOP_ALL].tooltips = STR_MASS_STOP_DEPOT_SHIP_TIP;
-			w->widget[DEPOT_WIDGET_START_ALL].tooltips=	STR_MASS_START_DEPOT_SHIP_TIP;
+			w->widget[DEPOT_WIDGET_START_ALL].tooltips= STR_MASS_START_DEPOT_SHIP_TIP;
 			w->widget[DEPOT_WIDGET_SELL].tooltips     = STR_9821_DRAG_SHIP_TO_HERE_TO_SELL;
-			w->widget[DEPOT_WIDGET_SELL_ALL].tooltips =	STR_DEPOT_SELL_ALL_BUTTON_SHIP_TIP;
+			w->widget[DEPOT_WIDGET_SELL_ALL].tooltips = STR_DEPOT_SELL_ALL_BUTTON_SHIP_TIP;
 			w->widget[DEPOT_WIDGET_MATRIX].tooltips   = STR_981F_SHIPS_CLICK_ON_SHIP_FOR;
 
 			w->widget[DEPOT_WIDGET_BUILD].data        = STR_9804_NEW_SHIPS;
@@ -607,9 +607,9 @@
 		case VEH_AIRCRAFT:
 			w->widget[DEPOT_WIDGET_CAPTION].data      = STR_A002_AIRCRAFT_HANGAR;
 			w->widget[DEPOT_WIDGET_STOP_ALL].tooltips = STR_MASS_STOP_HANGAR_TIP;
-			w->widget[DEPOT_WIDGET_START_ALL].tooltips=	STR_MASS_START_HANGAR_TIP;
+			w->widget[DEPOT_WIDGET_START_ALL].tooltips= STR_MASS_START_HANGAR_TIP;
 			w->widget[DEPOT_WIDGET_SELL].tooltips     = STR_A023_DRAG_AIRCRAFT_TO_HERE_TO;
-			w->widget[DEPOT_WIDGET_SELL_ALL].tooltips =	STR_DEPOT_SELL_ALL_BUTTON_AIRCRAFT_TIP;
+			w->widget[DEPOT_WIDGET_SELL_ALL].tooltips = STR_DEPOT_SELL_ALL_BUTTON_AIRCRAFT_TIP;
 			w->widget[DEPOT_WIDGET_MATRIX].tooltips   = STR_A021_AIRCRAFT_CLICK_ON_AIRCRAFT;
 
 			w->widget[DEPOT_WIDGET_BUILD].data        = STR_A003_NEW_AIRCRAFT;
--- a/src/disaster_cmd.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/disaster_cmd.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -233,7 +233,7 @@
 
 				SetDParam(0, GetStationIndex(tile));
 				AddNewsItem(STR_B000_ZEPPELIN_DISASTER_AT,
-					NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ACCIDENT, 0),
+					NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, 0),
 					v->index,
 					0);
 			}
@@ -263,7 +263,7 @@
 
 	x = v->x_pos;
 	y = v->y_pos;
-	z = GetSlopeZ(x,y);
+	z = GetSlopeZ(x, y);
 	if (z < v->z_pos) z = v->z_pos - 1;
 	SetDisasterVehiclePos(v, x, y, z);
 
@@ -359,14 +359,14 @@
 		if (dist <= TILE_SIZE && z > u->z_pos) z--;
 		SetDisasterVehiclePos(v, gp.x, gp.y, z);
 
-		if (z <= u->z_pos && (u->vehstatus & VS_HIDDEN)==0) {
+		if (z <= u->z_pos && (u->vehstatus & VS_HIDDEN) == 0) {
 			v->age++;
 			if (u->u.road.crashed_ctr == 0) {
 				u->u.road.crashed_ctr++;
 				u->vehstatus |= VS_CRASHED;
 
 				AddNewsItem(STR_B001_ROAD_VEHICLE_DESTROYED,
-					NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ACCIDENT, 0),
+					NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, 0),
 					u->index,
 					0);
 			}
@@ -441,7 +441,7 @@
 			DestructIndustry(i);
 
 			SetDParam(0, i->town->index);
-			AddNewsItem(STR_B002_OIL_REFINERY_EXPLOSION, NEWS_FLAGS(NM_THIN,NF_VIEWPORT|NF_TILE,NT_ACCIDENT,0), i->xy, 0);
+			AddNewsItem(STR_B002_OIL_REFINERY_EXPLOSION, NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, 0), i->xy, 0);
 			SndPlayTileFx(SND_12_EXPLOSION, i->xy);
 		}
 	} else if (v->current_order.dest == 0) {
@@ -514,7 +514,7 @@
 			DestructIndustry(i);
 
 			SetDParam(0, i->town->index);
-			AddNewsItem(STR_B003_FACTORY_DESTROYED_IN_SUSPICIOUS, NEWS_FLAGS(NM_THIN,NF_VIEWPORT|NF_TILE,NT_ACCIDENT,0), i->xy, 0);
+			AddNewsItem(STR_B003_FACTORY_DESTROYED_IN_SUSPICIOUS, NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, 0), i->xy, 0);
 			SndPlayTileFx(SND_12_EXPLOSION, i->xy);
 		}
 	} else if (v->current_order.dest == 0) {
@@ -600,7 +600,7 @@
 		t = ClosestTownFromTile(v->dest_tile, (uint)-1);
 		SetDParam(0, t->index);
 		AddNewsItem(STR_B004_UFO_LANDS_NEAR,
-			NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_ACCIDENT, 0),
+			NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, 0),
 			v->tile,
 			0);
 
@@ -951,7 +951,7 @@
 static void Disaster_Big_Submarine_Init()
 {
 	Vehicle *v = ForceAllocateSpecialVehicle();
-	int x,y;
+	int x, y;
 	Direction dir;
 	uint32 r;
 
@@ -986,7 +986,7 @@
 			if ((GetIndustrySpec(i->type)->behaviour & INDUSTRYBEH_CAN_SUBSIDENCE) && --index < 0) {
 				SetDParam(0, i->town->index);
 				AddNewsItem(STR_B005_COAL_MINE_SUBSIDENCE_LEAVES,
-					NEWS_FLAGS(NM_THIN,NF_VIEWPORT|NF_TILE,NT_ACCIDENT,0), i->xy + TileDiffXY(1, 1), 0);
+					NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, NT_ACCIDENT, 0), i->xy + TileDiffXY(1, 1), 0);
 
 				{
 					TileIndex tile = i->xy;
--- a/src/dock_gui.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/dock_gui.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -165,10 +165,10 @@
 		RaiseWindowButtons(w);
 
 		w = FindWindowById(WC_BUILD_STATION, 0);
-		if (w != NULL) WP(w,def_d).close = true;
+		if (w != NULL) WP(w, def_d).close = true;
 
 		w = FindWindowById(WC_BUILD_DEPOT, 0);
-		if (w != NULL) WP(w,def_d).close = true;
+		if (w != NULL) WP(w, def_d).close = true;
 		break;
 
 	case WE_PLACE_PRESIZE: {
@@ -233,7 +233,7 @@
 	case WE_PAINT: {
 		int rad;
 
-		if (WP(w,def_d).close) return;
+		if (WP(w, def_d).close) return;
 		DrawWindowWidgets(w);
 
 		rad = (_patches.modified_catchment) ? CA_DOCK : 4;
@@ -258,7 +258,7 @@
 		break;
 
 	case WE_MOUSELOOP:
-		if (WP(w,def_d).close) {
+		if (WP(w, def_d).close) {
 			DeleteWindow(w);
 			return;
 		}
@@ -267,7 +267,7 @@
 		break;
 
 	case WE_DESTROY:
-		if (!WP(w,def_d).close) ResetObjectToPlace();
+		if (!WP(w, def_d).close) ResetObjectToPlace();
 		break;
 	}
 }
@@ -333,11 +333,11 @@
 	} break;
 
 	case WE_MOUSELOOP:
-		if (WP(w,def_d).close) DeleteWindow(w);
+		if (WP(w, def_d).close) DeleteWindow(w);
 		break;
 
 	case WE_DESTROY:
-		if (!WP(w,def_d).close) ResetObjectToPlace();
+		if (!WP(w, def_d).close) ResetObjectToPlace();
 		break;
 	}
 }
--- a/src/economy.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/economy.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -1179,7 +1179,6 @@
 static bool LoadWait(const Vehicle* v, const Vehicle* u)
 {
 	const Vehicle *w;
-	const Vehicle *x;
 	bool has_any_cargo = false;
 
 	if (!(u->current_order.flags & OF_FULL_LOAD)) return false;
@@ -1194,12 +1193,11 @@
 		}
 	}
 
-	FOR_ALL_VEHICLES(x) {
-		if ((x->type != VEH_TRAIN || IsFrontEngine(x)) && // for all locs
-				u->last_station_visited == x->last_station_visited && // at the same station
-				!(x->vehstatus & (VS_STOPPED | VS_CRASHED)) && // not stopped or crashed
-				x->current_order.type == OT_LOADING && // loading
-				u != x) { // not itself
+	const Station *st = GetStation(u->last_station_visited);
+	std::list<Vehicle *>::const_iterator iter;
+	for (iter = st->loading_vehicles.begin(); iter != st->loading_vehicles.end(); ++iter) {
+		const Vehicle *x = *iter;
+		if (!(x->vehstatus & (VS_STOPPED | VS_CRASHED)) && u != x) {
 			bool other_has_any_cargo = false;
 			bool has_space_for_same_type = false;
 			bool other_has_same_type = false;
--- a/src/engine.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/engine.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -404,6 +404,35 @@
 	return true;
 }
 
+/** Get the default cargo type for a certain engine type
+ * @param engine The ID to get the cargo for
+ * @return The cargo type. CT_INVALID means no cargo capacity
+ */
+CargoID GetEngineCargoType(EngineID engine)
+{
+	assert(IsEngineIndex(engine));
+
+	switch (GetEngine(engine)->type) {
+		case VEH_TRAIN:
+			if (RailVehInfo(engine)->capacity == 0) return CT_INVALID;
+			return RailVehInfo(engine)->cargo_type;
+
+		case VEH_ROAD:
+			if (RoadVehInfo(engine)->capacity == 0) return CT_INVALID;
+			return RoadVehInfo(engine)->cargo_type;
+
+		case VEH_SHIP:
+			if (ShipVehInfo(engine)->capacity == 0) return CT_INVALID;
+			return ShipVehInfo(engine)->cargo_type;
+
+		case VEH_AIRCRAFT:
+			/* all aircraft starts as passenger planes with cargo capacity */
+			return CT_PASSENGERS;
+
+		default: NOT_REACHED(); return CT_INVALID;
+	}
+}
+
 /************************************************************************
  * Engine Replacement stuff
  ************************************************************************/
--- a/src/engine.h	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/engine.h	Wed Jun 13 11:17:30 2007 +0000
@@ -153,6 +153,7 @@
 void DeleteCustomEngineNames();
 
 bool IsEngineBuildable(EngineID engine, byte type, PlayerID player);
+CargoID GetEngineCargoType(EngineID engine);
 
 enum {
 	NUM_NORMAL_RAIL_ENGINES = 54,
--- a/src/gfx.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/gfx.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -201,7 +201,7 @@
 static void GfxSetPixel(int x, int y, int color)
 {
 	const DrawPixelInfo* dpi = _cur_dpi;
-	if ((x-=dpi->left) < 0 || x>=dpi->width || (y-=dpi->top)<0 || y>=dpi->height)
+	if ((x -= dpi->left) < 0 || x >= dpi->width || (y -= dpi->top)<0 || y >= dpi->height)
 		return;
 	dpi->dst_ptr[y * dpi->pitch + x] = color;
 }
@@ -461,7 +461,7 @@
 				switch (c) {
 					case '\0': return num + (size << 16); break;
 					case SCC_SETX:  str++; break;
-					case SCC_SETXY: str +=2; break;
+					case SCC_SETXY: str += 2; break;
 					case SCC_TINYFONT: size = FS_SMALL; break;
 					case SCC_BIGFONT:  size = FS_LARGE; break;
 					case '\n': goto end_of_inner_loop;
@@ -509,7 +509,7 @@
 
 	for (;;) {
 		w = GetStringBoundingBox(src).width;
-		DoDrawString(src, x - (w>>1), y, 0xFE);
+		DoDrawString(src, x - (w >> 1), y, 0xFE);
 		_cur_fontsize = _last_fontsize;
 
 		for (;;) {
@@ -524,7 +524,7 @@
 			} else if (c == SCC_SETX) {
 				src++;
 			} else if (c == SCC_SETXY) {
-				src+=2;
+				src += 2;
 			}
 		}
 	}
@@ -574,7 +574,7 @@
 			} else if (c == SCC_SETX) {
 				src++;
 			} else if (c == SCC_SETXY) {
-				src+=2;
+				src += 2;
 			}
 		}
 	}
@@ -643,7 +643,7 @@
 
 	if (color != 0xFE) {
 		if (x >= dpi->left + dpi->width ||
-				x + _screen.width*2 <= dpi->left ||
+				x + _screen.width * 2 <= dpi->left ||
 				y >= dpi->top + dpi->height ||
 				y + _screen.height <= dpi->top)
 					return x;
--- a/src/graph_gui.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/graph_gui.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -222,7 +222,7 @@
 					y = gw->top + x_axis_offset - (x_axis_offset * datapoint) / highest_value;
 
 					/* Draw the point. */
-					GfxFillRect(x-1, y-1, x+1, y+1, color);
+					GfxFillRect(x - 1, y - 1, x + 1, y + 1, color);
 
 					/* Draw the line connected to the previous point. */
 					if (prev_x != INVALID_DATAPOINT_POS) GfxDrawLine(prev_x, prev_y, x, y, color);
@@ -268,7 +268,7 @@
 			FOR_ALL_PLAYERS(p) {
 				if (!p->is_active) continue;
 
-				DrawPlayerIcon(p->index, 4, 18+p->index*12);
+				DrawPlayerIcon(p->index, 4, 18 + p->index * 12);
 
 				SetDParam(0, p->name_1);
 				SetDParam(1, p->name_2);
@@ -330,7 +330,7 @@
 	const Player* p;
 	uint excluded_players = _legend_excluded_players;
 	byte nums;
-	int mo,yr;
+	int mo, yr;
 
 	/* Exclude the players which aren't valid */
 	FOR_ALL_PLAYERS(p) {
@@ -908,7 +908,7 @@
 
 void ShowCompanyLeagueTable()
 {
-	AllocateWindowDescFront(&_company_league_desc,0);
+	AllocateWindowDescFront(&_company_league_desc, 0);
 }
 
 /*****************************/
--- a/src/industry.h	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/industry.h	Wed Jun 13 11:17:30 2007 +0000
@@ -13,6 +13,7 @@
 
 enum {
 	INVALID_INDUSTRY = 0xFFFF,
+	NUM_INDUSTRYTYPES = 37,
 	INDUTILE_NOANIM = 0xFF,        ///< flag to mark industry tiles as having no animation
 };
 
--- a/src/industry_cmd.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/industry_cmd.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -67,9 +67,9 @@
 
 	assert(IsTileType(tile, MP_INDUSTRY));
 
-	for (iloop = IT_COAL_MINE; iloop < IT_END; iloop += 1) {
+	for (iloop = IT_COAL_MINE; iloop < NUM_INDUSTRYTYPES; iloop += 1) {
 		if (IS_BYTE_INSIDE(this_type, industry_gfx_Solver[iloop].MinGfx,
-				industry_gfx_Solver[iloop].MaxGfx+1)) {
+				industry_gfx_Solver[iloop].MaxGfx + 1)) {
 			return iloop;
 		}
 	}
@@ -82,12 +82,12 @@
  * This will ensure at once : proper access and
  * not allowing modifications of it.
  * @param thistype of industry (which is the index in _industry_specs)
- * @pre thistype < IT_END
+ * @pre thistype < NUM_INDUSTRYTYPES
  * @return a pointer to the corresponding industry spec
  **/
 const IndustrySpec *GetIndustrySpec(IndustryType thistype)
 {
-	assert(thistype < IT_END);
+	assert(thistype < NUM_INDUSTRYTYPES);
 	return &_industry_specs[thistype];
 }
 
@@ -496,7 +496,7 @@
 	case GFX_OILWELL_ANIMATED_2:
 	case GFX_OILWELL_ANIMATED_3:
 		if ((_tick_counter & 7) == 0) {
-			bool b = CHANCE16(1,7);
+			bool b = CHANCE16(1, 7);
 			IndustryGfx gfx = GetIndustryGfx(tile);
 
 			m = GetIndustryAnimationState(tile) + 1;
@@ -705,7 +705,7 @@
 		break;
 
 	case GFX_POWERPLANT_SPARKS:
-		if (CHANCE16(1,3)) {
+		if (CHANCE16(1, 3)) {
 			SndPlayTileFx(SND_0C_ELECTRIC_SPARK, tile);
 			AddAnimatedTile(tile);
 		}
@@ -964,7 +964,7 @@
 
 	/* play a sound? */
 	if ((i->counter & 0x3F) == 0) {
-		if (CHANCE16R(1,14,r) && (num=_industry_sounds[i->type][0]) != 0) {
+		if (CHANCE16R(1, 14, r) && (num = _industry_sounds[i->type][0]) != 0) {
 			SndPlayTileFx(
 				(SoundFx)(_industry_sounds[i->type][1] + (((r >> 16) * num) >> 16)),
 				i->xy);
@@ -1590,7 +1590,7 @@
 	const IndustrySpec *ind_spc;
 
 	/* Find the total amount of industries */
-	for (it = IT_COAL_MINE; it < IT_END; it++) {
+	for (it = IT_COAL_MINE; it < NUM_INDUSTRYTYPES; it++) {
 		int num;
 
 		ind_spc = GetIndustrySpec(it);
@@ -1610,7 +1610,7 @@
 
 	SetGeneratingWorldProgress(GWP_INDUSTRY, i);
 
-	for (it = IT_COAL_MINE; it < IT_END; it++) {
+	for (it = IT_COAL_MINE; it < NUM_INDUSTRYTYPES; it++) {
 		/* Once the number of industries has been determined, let's really create them.
 		 * The test for chance allows us to try create industries that are available only
 		 * for this landscape.
@@ -1668,7 +1668,7 @@
 					SetDParam(1, i->index);
 					AddNewsItem(
 						percent >= 0 ? STR_INDUSTRY_PROD_GOUP : STR_INDUSTRY_PROD_GODOWN,
-						NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_ECONOMY, 0),
+						NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, NT_ECONOMY, 0),
 						i->xy + TileDiffXY(1, 1), 0
 					);
 				}
@@ -1682,7 +1682,7 @@
 		SetDParam(0, i->index);
 		AddNewsItem(
 			indspec->closure_text,
-			NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_OPENCLOSE, 0),
+			NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, NT_OPENCLOSE, 0),
 			i->xy + TileDiffXY(1, 1), 0
 		);
 	}
@@ -1698,7 +1698,7 @@
 		pct = 0;
 		if (i->last_mo_production[0] != 0) {
 			i->last_prod_year = _cur_year;
-			pct = min(i->last_mo_transported[0] * 256 / i->last_mo_production[0],255);
+			pct = min(i->last_mo_transported[0] * 256 / i->last_mo_production[0], 255);
 		}
 		i->pct_transported[0] = pct;
 
@@ -1714,7 +1714,7 @@
 		pct = 0;
 		if (i->last_mo_production[1] != 0) {
 			i->last_prod_year = _cur_year;
-			pct = min(i->last_mo_transported[1] * 256 / i->last_mo_production[1],255);
+			pct = min(i->last_mo_transported[1] * 256 / i->last_mo_production[1], 255);
 		}
 		i->pct_transported[1] = pct;
 
@@ -1752,11 +1752,11 @@
 	IndustryType rndtype, j;     // Loop controlers
 	const IndustrySpec *ind_spc;
 	uint num = 0;
-	ProbabilityHelper cumulative_probs[IT_END]; // probability collector
+	ProbabilityHelper cumulative_probs[NUM_INDUSTRYTYPES]; // probability collector
 	uint16 probability_max = 0;
 
 	/* Generate a list of all possible industries that can be built. */
-	for (j = 0; j < IT_END; j++) {
+	for (j = 0; j < NUM_INDUSTRYTYPES; j++) {
 		byte chance = GetIndustrySpec(j)->appear_ingame[_opt.landscape];
 
 		/* if appearing chance for this landscape is above 0, this industry can be chosen */
@@ -1770,7 +1770,7 @@
 
 	/* Find a random type, with maximum being what has been evaluate above*/
 	rndtype = RandomRange(probability_max);
-	for (j = 0; j < IT_END; j++) {
+	for (j = 0; j < NUM_INDUSTRYTYPES; j++) {
 		/* and choose the index of the industry that matches as close as possible this random type */
 		if (cumulative_probs[j].prob >= rndtype) break;
 	}
@@ -1791,7 +1791,7 @@
 	SetDParam(0, ind_spc->name);
 	SetDParam(1, ind->town->index);
 	AddNewsItem(ind_spc->new_industry_text,
-		NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_OPENCLOSE, 0), ind->xy, 0);
+		NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, NT_OPENCLOSE, 0), ind->xy, 0);
 }
 
 static void ChangeIndustryProduction(Industry *i)
@@ -1810,9 +1810,9 @@
 			if ((indspec->behaviour & INDUSTRYBEH_DONT_INCR_PROD) && _opt.landscape == LT_TEMPERATE)
 				only_decrease = true;
 
-			if (only_decrease || CHANCE16(1,3)) {
+			if (only_decrease || CHANCE16(1, 3)) {
 				/* If you transport > 60%, 66% chance we increase, else 33% chance we increase */
-				if (!only_decrease && (i->pct_transported[0] > 153) != CHANCE16(1,3)) {
+				if (!only_decrease && (i->pct_transported[0] > 153) != CHANCE16(1, 3)) {
 					/* Increase production */
 					if (i->prod_level != 0x80) {
 						byte b;
@@ -1849,7 +1849,7 @@
 
 		case INDUSTRYLIFE_CLOSABLE:
 			/* maybe close */
-			if ( (byte)(_cur_year - i->last_prod_year) >= 5 && CHANCE16(1,2)) {
+			if ( (byte)(_cur_year - i->last_prod_year) >= 5 && CHANCE16(1, 2)) {
 				i->prod_level = 0;
 				str = indspec->closure_text;
 			}
@@ -1858,7 +1858,7 @@
 
 	if (str != STR_NULL) {
 		SetDParam(0, i->index);
-		AddNewsItem(str, NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, str == indspec->closure_text ? NT_OPENCLOSE : NT_ECONOMY, 0), i->xy + TileDiffXY(1, 1), 0);
+		AddNewsItem(str, NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_TILE, str == indspec->closure_text ? NT_OPENCLOSE : NT_ECONOMY, 0), i->xy + TileDiffXY(1, 1), 0);
 	}
 }
 
--- a/src/industry_gui.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/industry_gui.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -37,7 +37,7 @@
 	case WE_PAINT:
 		DrawWindowWidgets(w);
 		if (_thd.place_mode == 1 && _thd.window_class == WC_BUILD_INDUSTRY) {
-			int ind_type = _build_industry_types[_opt_ptr->landscape][WP(w,def_d).data_1];
+			int ind_type = _build_industry_types[_opt_ptr->landscape][WP(w, def_d).data_1];
 
 			SetDParam(0, (_eco->GetPrice(CEconomy::BUILD_INDUSTRY) >> 5) * GetIndustrySpec(ind_type)->cost_multiplier);
 			DrawStringCentered(85, w->height - 21, STR_482F_COST, 0);
@@ -48,12 +48,12 @@
 		int wid = e->we.click.widget;
 		if (wid >= 3) {
 			if (HandlePlacePushButton(w, wid, SPR_CURSOR_INDUSTRY, 1, NULL))
-				WP(w,def_d).data_1 = wid - 3;
+				WP(w, def_d).data_1 = wid - 3;
 		}
 	} break;
 
 	case WE_PLACE_OBJ:
-		if (DoCommandP(e->we.place.tile, _build_industry_types[_opt_ptr->landscape][WP(w,def_d).data_1], 0, NULL, CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY)))
+		if (DoCommandP(e->we.place.tile, _build_industry_types[_opt_ptr->landscape][WP(w, def_d).data_1], 0, NULL, CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY)))
 			ResetObjectToPlace();
 		break;
 
@@ -274,7 +274,7 @@
 void ShowBuildIndustryWindow()
 {
 	if (!IsValidPlayer(_current_player)) return;
-	AllocateWindowDescFront(_industry_window_desc[_patches.build_rawmaterial_ind][_opt_ptr->landscape],0);
+	AllocateWindowDescFront(_industry_window_desc[_patches.build_rawmaterial_ind][_opt_ptr->landscape], 0);
 }
 
 static inline bool isProductionMinimum(const Industry *i, int pt) {
@@ -330,7 +330,7 @@
 			DrawString(4 + (IsProductionAlterable(i) ? 30 : 0), 127, STR_482B_TRANSPORTED, 0);
 			/* Let's put out those buttons.. */
 			if (IsProductionAlterable(i)) {
-				DrawArrowButtons(5, 127, 3, (WP(w,vp2_d).data_2 == 1) ? WP(w,vp2_d).data_3 : 0,
+				DrawArrowButtons(5, 127, 3, (WP(w, vp2_d).data_2 == 1) ? WP(w, vp2_d).data_3 : 0,
 						!isProductionMinimum(i, 0), !isProductionMaximum(i, 0));
 			}
 
@@ -341,7 +341,7 @@
 				DrawString(4 + (IsProductionAlterable(i) ? 30 : 0), 137, STR_482B_TRANSPORTED, 0);
 				/* Let's put out those buttons.. */
 				if (IsProductionAlterable(i)) {
-					DrawArrowButtons(5, 137, 3, (WP(w,vp2_d).data_2 == 2) ? WP(w,vp2_d).data_3 : 0,
+					DrawArrowButtons(5, 137, 3, (WP(w, vp2_d).data_2 == 2) ? WP(w, vp2_d).data_3 : 0,
 						!isProductionMinimum(i, 1), !isProductionMaximum(i, 1));
 				}
 			}
@@ -379,11 +379,11 @@
 					UpdateIndustryProduction(i);
 					SetWindowDirty(w);
 					w->flags4 |= 5 << WF_TIMEOUT_SHL;
-					WP(w,vp2_d).data_2 = line+1;
-					WP(w,vp2_d).data_3 = (x < 15 ? 1 : 2);
+					WP(w, vp2_d).data_2 = line + 1;
+					WP(w, vp2_d).data_3 = (x < 15 ? 1 : 2);
 				} else if (IS_INT_INSIDE(x, 34, 160)) {
 					/* clicked the text */
-					WP(w,vp2_d).data_1 = line;
+					WP(w, vp2_d).data_1 = line;
 					SetDParam(0, i->production_rate[line] * 8);
 					ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_CONFIG_GAME_PRODUCTION, 10, 100, w, CS_ALPHANUMERAL);
 				}
@@ -392,20 +392,20 @@
 		case 6:
 			i = GetIndustry(w->window_number);
 			ScrollMainWindowToTile(i->xy + TileDiffXY(1, 1));
-		}	break;
+		} break;
 
 		}
 		break;
 	case WE_TIMEOUT:
-		WP(w,vp2_d).data_2 = 0;
-		WP(w,vp2_d).data_3 = 0;
+		WP(w, vp2_d).data_2 = 0;
+		WP(w, vp2_d).data_3 = 0;
 		SetWindowDirty(w);
 		break;
 
 	case WE_ON_EDIT_TEXT:
 		if (e->we.edittext.str[0] != '\0') {
 			Industry* i = GetIndustry(w->window_number);
-			int line = WP(w,vp2_d).data_1;
+			int line = WP(w, vp2_d).data_1;
 
 			i->production_rate[line] = clampu(atoi(e->we.edittext.str), 0, 255);
 			UpdateIndustryProduction(i);
@@ -449,9 +449,9 @@
 
 	if (w != NULL) {
 		w->flags4 |= WF_DISABLE_VP_SCROLL;
-		WP(w,vp2_d).data_1 = 0;
-		WP(w,vp2_d).data_2 = 0;
-		WP(w,vp2_d).data_3 = 0;
+		WP(w, vp2_d).data_1 = 0;
+		WP(w, vp2_d).data_2 = 0;
+		WP(w, vp2_d).data_3 = 0;
 		AssignWindowViewport(w, 3, 17, 0xFE, 0x56, GetIndustry(w->window_number)->xy + TileDiffXY(1, 1), 1);
 	}
 }
@@ -599,7 +599,7 @@
 		SetVScrollCount(w, _num_industry_sort);
 
 		DrawWindowWidgets(w);
-		DoDrawString(_industry_sort_order & 1 ? DOWNARROW : UPARROW, _indicator_positions[_industry_sort_order>>1], 15, 0x10);
+		DoDrawString(_industry_sort_order & 1 ? DOWNARROW : UPARROW, _indicator_positions[_industry_sort_order >> 1], 15, 0x10);
 
 		p = w->vscroll.pos;
 		n = 0;
@@ -617,13 +617,13 @@
 					SetDParam(4, i->total_production[1]);
 					SetDParam(5, i->pct_transported[0] * 100 >> 8);
 					SetDParam(6, i->pct_transported[1] * 100 >> 8);
-					DrawString(4, 28+n*10, STR_INDUSTRYDIR_ITEM_TWO, 0);
+					DrawString(4, 28 + n * 10, STR_INDUSTRYDIR_ITEM_TWO, 0);
 				} else {
 					SetDParam(3, i->pct_transported[0] * 100 >> 8);
-					DrawString(4, 28+n*10, STR_INDUSTRYDIR_ITEM, 0);
+					DrawString(4, 28 + n * 10, STR_INDUSTRYDIR_ITEM, 0);
 				}
 			} else {
-				DrawString(4, 28+n*10, STR_INDUSTRYDIR_ITEM_NOPROD, 0);
+				DrawString(4, 28 + n * 10, STR_INDUSTRYDIR_ITEM_NOPROD, 0);
 			}
 			p++;
 			if (++n == w->vscroll.cap) break;
@@ -633,25 +633,25 @@
 	case WE_CLICK:
 		switch (e->we.click.widget) {
 		case 3: {
-			_industry_sort_order = _industry_sort_order==0 ? 1 : 0;
+			_industry_sort_order = _industry_sort_order == 0 ? 1 : 0;
 			_industry_sort_dirty = true;
 			SetWindowDirty(w);
 		} break;
 
 		case 4: {
-			_industry_sort_order = _industry_sort_order==2 ? 3 : 2;
+			_industry_sort_order = _industry_sort_order == 2 ? 3 : 2;
 			_industry_sort_dirty = true;
 			SetWindowDirty(w);
 		} break;
 
 		case 5: {
-			_industry_sort_order = _industry_sort_order==4 ? 5 : 4;
+			_industry_sort_order = _industry_sort_order == 4 ? 5 : 4;
 			_industry_sort_dirty = true;
 			SetWindowDirty(w);
 		} break;
 
 		case 6: {
-			_industry_sort_order = _industry_sort_order==6 ? 7 : 6;
+			_industry_sort_order = _industry_sort_order == 6 ? 7 : 6;
 			_industry_sort_dirty = true;
 			SetWindowDirty(w);
 		} break;
--- a/src/landscape.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/landscape.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -76,13 +76,13 @@
 		break;
 
 	case SLOPE_S:
-		y^=0xF;
+		y ^= 0xF;
 		if ( (x - y) >= 0)
 			z = (x - y) >> 1;
 		break;
 
 	case SLOPE_SW:
-		z = (x>>1) + 1;
+		z = (x >> 1) + 1;
 		break;
 
 	case SLOPE_E:
@@ -97,12 +97,12 @@
 		break;
 
 	case SLOPE_SE:
-		z = (y>>1) + 1;
+		z = (y >> 1) + 1;
 		break;
 
 	case SLOPE_WSE:
 		z = 8;
-		y^=0xF;
+		y ^= 0xF;
 		if (x - y < 0)
 			z += (x - y) >> 1;
 		break;
@@ -114,7 +114,7 @@
 		break;
 
 	case SLOPE_NW:
-		z = (y^0xF)>>1;
+		z = (y ^ 0xF) >> 1;
 		break;
 
 	case SLOPE_NWS:
@@ -124,7 +124,7 @@
 		break;
 
 	case SLOPE_NE:
-		z = (x^0xF)>>1;
+		z = (x ^ 0xF) >> 1;
 		break;
 
 	case SLOPE_ENW:
@@ -141,19 +141,19 @@
 		break;
 
 	case SLOPE_STEEP_S:
-		z = 1 + ((x+y)>>1);
+		z = 1 + ((x + y) >> 1);
 		break;
 
 	case SLOPE_STEEP_W:
-		z = 1 + ((x+(y^0xF))>>1);
+		z = 1 + ((x + (y ^ 0xF)) >> 1);
 		break;
 
 	case SLOPE_STEEP_N:
-		z = 1 + (((x^0xF)+(y^0xF))>>1);
+		z = 1 + (((x ^ 0xF) + (y ^ 0xF)) >> 1);
 		break;
 
 	case SLOPE_STEEP_E:
-		z = 1 + (((x^0xF)+(y^0xF))>>1);
+		z = 1 + (((x ^ 0xF) + (y ^ 0xF)) >> 1);
 		break;
 
 		default: break;
@@ -385,8 +385,8 @@
 	int32 cost, ret, money;
 	int ex;
 	int ey;
-	int sx,sy;
-	int x,y;
+	int sx, sy;
+	int x, y;
 	bool success = false;
 
 	if (p1 >= MapSize()) return CMD_ERROR;
@@ -435,7 +435,7 @@
 
 #define TILELOOP_BITS 4
 #define TILELOOP_SIZE (1 << TILELOOP_BITS)
-#define TILELOOP_ASSERTMASK ((TILELOOP_SIZE-1) + ((TILELOOP_SIZE-1) << MapLogX()))
+#define TILELOOP_ASSERTMASK ((TILELOOP_SIZE - 1) + ((TILELOOP_SIZE - 1) << MapLogX()))
 #define TILELOOP_CHKMASK (((1 << (MapLogX() - TILELOOP_BITS))-1) << TILELOOP_BITS)
 
 void RunTileLoop()
--- a/src/lang/bulgarian.txt	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/lang/bulgarian.txt	Wed Jun 13 11:17:30 2007 +0000
@@ -753,6 +753,7 @@
 STR_02A1_SMALL                                                  :{BLACK}Малък
 STR_02A2_MEDIUM                                                 :{BLACK}Среден
 STR_02A3_LARGE                                                  :{BLACK}Голям
+STR_SCENARIO_EDITOR_CITY                                        :{BLACK}Град
 STR_02A4_SELECT_TOWN_SIZE                                       :{BLACK}Избери големина на града
 STR_02A5_TOWN_SIZE                                              :{YELLOW}Големина на града:
 
@@ -1145,6 +1146,7 @@
 STR_CONFIG_PATCHES_TOWN_GROWTH_VERY_FAST                        :Много бърза
 STR_CONFIG_PATCHES_LARGER_TOWNS                                 :{LTBLUE}Съразмерност на градове който ще пораснат двойно по-бързо: {ORANGE}1 в {STRING}
 STR_CONFIG_PATCHES_LARGER_TOWNS_DISABLED                        :{LTBLUE}Съразмерност на градове който ще пораснат двойно по-бързо: {ORANGE}Нито един
+STR_CONFIG_PATCHES_CITY_SIZE_MULTIPLIER                         :{LTBLUE}Множител за големината на града: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_GUI                                          :{BLACK}Интерфейс
 STR_CONFIG_PATCHES_CONSTRUCTION                                 :{BLACK}Строене
--- a/src/lang/czech.txt	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/lang/czech.txt	Wed Jun 13 11:17:30 2007 +0000
@@ -809,6 +809,7 @@
 STR_02A1_SMALL                                                  :{BLACK}Malé
 STR_02A2_MEDIUM                                                 :{BLACK}Středni
 STR_02A3_LARGE                                                  :{BLACK}Velké
+STR_SCENARIO_EDITOR_CITY                                        :{BLACK}Město
 STR_02A4_SELECT_TOWN_SIZE                                       :{BLACK}Zvol velikost města:
 STR_02A5_TOWN_SIZE                                              :{YELLOW}Velikost města:
 
@@ -1201,6 +1202,7 @@
 STR_CONFIG_PATCHES_TOWN_GROWTH_VERY_FAST                        :velmi rychlá
 STR_CONFIG_PATCHES_LARGER_TOWNS                                 :{LTBLUE}Podíl měst, které budou růst dvakrát tak rychle: {ORANGE}1 z {STRING}
 STR_CONFIG_PATCHES_LARGER_TOWNS_DISABLED                        :{LTBLUE}Podíl měst, které budou růst dvakrát tak rychle: {ORANGE}žádné
+STR_CONFIG_PATCHES_CITY_SIZE_MULTIPLIER                         :{LTBLUE}Násobitel původní velikosti města: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_GUI                                          :{BLACK}Ovládaní
 STR_CONFIG_PATCHES_CONSTRUCTION                                 :{BLACK}Výstavba
--- a/src/lang/danish.txt	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/lang/danish.txt	Wed Jun 13 11:17:30 2007 +0000
@@ -751,6 +751,7 @@
 STR_02A1_SMALL                                                  :{BLACK}Lille
 STR_02A2_MEDIUM                                                 :{BLACK}Mellem
 STR_02A3_LARGE                                                  :{BLACK}Stor
+STR_SCENARIO_EDITOR_CITY                                        :{BLACK}By
 STR_02A4_SELECT_TOWN_SIZE                                       :{BLACK}Vælg bystørrelse
 STR_02A5_TOWN_SIZE                                              :{YELLOW}Bystørrelse:
 
@@ -1143,6 +1144,7 @@
 STR_CONFIG_PATCHES_TOWN_GROWTH_VERY_FAST                        :Meget hurtig
 STR_CONFIG_PATCHES_LARGER_TOWNS                                 :{LTBLUE}Andel af byer der vil vokse dobbelt så hurtigt: {ORANGE}1 af {STRING}
 STR_CONFIG_PATCHES_LARGER_TOWNS_DISABLED                        :{LTBLUE}Andel af byer der vil vokse dobbelt så hurtigt: {ORANGE}Ingen
+STR_CONFIG_PATCHES_CITY_SIZE_MULTIPLIER                         :{LTBLUE}Startværdi for bystørrelsesfaktor: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_GUI                                          :{BLACK}Brugerflade
 STR_CONFIG_PATCHES_CONSTRUCTION                                 :{BLACK}Konstruktion
--- a/src/lang/dutch.txt	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/lang/dutch.txt	Wed Jun 13 11:17:30 2007 +0000
@@ -751,6 +751,7 @@
 STR_02A1_SMALL                                                  :{BLACK}Klein
 STR_02A2_MEDIUM                                                 :{BLACK}Middel
 STR_02A3_LARGE                                                  :{BLACK}Groot
+STR_SCENARIO_EDITOR_CITY                                        :{BLACK}Stad
 STR_02A4_SELECT_TOWN_SIZE                                       :{BLACK}Kies stadsgrootte
 STR_02A5_TOWN_SIZE                                              :{YELLOW}Stadsgrootte:
 
@@ -1143,6 +1144,7 @@
 STR_CONFIG_PATCHES_TOWN_GROWTH_VERY_FAST                        :Heel snel
 STR_CONFIG_PATCHES_LARGER_TOWNS                                 :{LTBLUE}Verhouding van steden die twee keer zo snel groeien: {ORANGE}1 in {STRING}
 STR_CONFIG_PATCHES_LARGER_TOWNS_DISABLED                        :{LTBLUE}Verhouding van steden die twee keer zo snel groeien: {ORANGE}Niet
+STR_CONFIG_PATCHES_CITY_SIZE_MULTIPLIER                         :{LTBLUE}Stad groei indicator: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_GUI                                          :{BLACK}Interface
 STR_CONFIG_PATCHES_CONSTRUCTION                                 :{BLACK}Constructie
@@ -3112,7 +3114,7 @@
 STR_TREE_GENERATION                                             :{BLACK}Bos plaatsing
 STR_UNMOVABLE_GENERATION                                        :{BLACK}Onverplaatsbare generatie
 STR_CLEARING_TILES                                              :{BLACK}Ruig en
-STR_SETTINGUP_GAME                                              :{BLACK}Spel aan het instellen
+STR_SETTINGUP_GAME                                              :{BLACK}Spel aan het configureren
 STR_PREPARING_TILELOOP                                          :{BLACK}Bezig met vlakken
 STR_PREPARING_GAME                                              :{BLACK}Voorbereiden spel
 STR_DIFFICULTY_TO_CUSTOM                                        :{WHITE}Deze aktie past de moeilijkheidsgraag aan naam custom
--- a/src/lang/esperanto.txt	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/lang/esperanto.txt	Wed Jun 13 11:17:30 2007 +0000
@@ -752,6 +752,7 @@
 STR_02A1_SMALL                                                  :{BLACK}Malgranda
 STR_02A2_MEDIUM                                                 :{BLACK}Mezgranda
 STR_02A3_LARGE                                                  :{BLACK}Granda
+STR_SCENARIO_EDITOR_CITY                                        :{BLACK}Urbo
 STR_02A4_SELECT_TOWN_SIZE                                       :{BLACK}Elektu urban grandecon
 STR_02A5_TOWN_SIZE                                              :{YELLOW}Urba grandeco:
 
@@ -1144,6 +1145,7 @@
 STR_CONFIG_PATCHES_TOWN_GROWTH_VERY_FAST                        :Tre rapide
 STR_CONFIG_PATCHES_LARGER_TOWNS                                 :{LTBLUE}Grandeco de urboj kiuj duoble rapide kreskas: {ORANGE}1 en {STRING}
 STR_CONFIG_PATCHES_LARGER_TOWNS_DISABLED                        :{LTBLUE}Grandeco de urboj kiuj duoble rapide kreskas: {ORANGE}Ne
+STR_CONFIG_PATCHES_CITY_SIZE_MULTIPLIER                         :{LTBLUE}Komenca urbgrandeca multobligo: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_GUI                                          :{BLACK}Interfaco
 STR_CONFIG_PATCHES_CONSTRUCTION                                 :{BLACK}Konstruado
--- a/src/lang/estonian.txt	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/lang/estonian.txt	Wed Jun 13 11:17:30 2007 +0000
@@ -851,6 +851,7 @@
 STR_02A1_SMALL                                                  :{BLACK}Väike
 STR_02A2_MEDIUM                                                 :{BLACK}Keskmine
 STR_02A3_LARGE                                                  :{BLACK}Suur
+STR_SCENARIO_EDITOR_CITY                                        :{BLACK}Linn
 STR_02A4_SELECT_TOWN_SIZE                                       :{BLACK}Vali linna suurus
 STR_02A5_TOWN_SIZE                                              :{YELLOW}Linna suurus:
 
@@ -1243,6 +1244,7 @@
 STR_CONFIG_PATCHES_TOWN_GROWTH_VERY_FAST                        :Väga Kiire
 STR_CONFIG_PATCHES_LARGER_TOWNS                                 :{LTBLUE}Topeltkiirusel suurenevaid linnu: {ORANGE}1 iga {STRING} linna kohta
 STR_CONFIG_PATCHES_LARGER_TOWNS_DISABLED                        :{LTBLUE}Topeltkiirusel suurenevaid linnu: {ORANGE}puudub
+STR_CONFIG_PATCHES_CITY_SIZE_MULTIPLIER                         :{LTBLUE}Algne linna suuruse kordaja: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_GUI                                          :{BLACK}Välimus
 STR_CONFIG_PATCHES_CONSTRUCTION                                 :{BLACK}Ehitamine
--- a/src/lang/finnish.txt	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/lang/finnish.txt	Wed Jun 13 11:17:30 2007 +0000
@@ -751,6 +751,7 @@
 STR_02A1_SMALL                                                  :{BLACK}Pieni
 STR_02A2_MEDIUM                                                 :{BLACK}Keskisuuri
 STR_02A3_LARGE                                                  :{BLACK}Suuri
+STR_SCENARIO_EDITOR_CITY                                        :{BLACK}Kaupunki
 STR_02A4_SELECT_TOWN_SIZE                                       :{BLACK}Valitse kaupungin koko.
 STR_02A5_TOWN_SIZE                                              :{YELLOW}Kaupungin koko:
 
@@ -1143,6 +1144,7 @@
 STR_CONFIG_PATCHES_TOWN_GROWTH_VERY_FAST                        :Erittäin nopea
 STR_CONFIG_PATCHES_LARGER_TOWNS                                 :{LTBLUE}Kaksinkertaisella nopeudella kasvavien kaupunkien osuus: {ORANGE}1/{STRING}
 STR_CONFIG_PATCHES_LARGER_TOWNS_DISABLED                        :{LTBLUE}Kaksinkertaisella nopeudella kasvavien kaupunkien osuus: {ORANGE}0
+STR_CONFIG_PATCHES_CITY_SIZE_MULTIPLIER                         :{LTBLUE}Kasvukerroin alussa: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_GUI                                          :{BLACK}Käyttöliittymä
 STR_CONFIG_PATCHES_CONSTRUCTION                                 :{BLACK}Rakentaminen
@@ -1902,8 +1904,8 @@
 STR_4839_PRODUCTION_DOWN_BY_50                                  :{BLACK}{BIGFONT}{INDUSTRY}: tuotanto vähenee 50{NBSP}%:lla.
 STR_483A_INSECT_INFESTATION_CAUSES                              :{BLACK}{BIGFONT}{INDUSTRY}: hyönteisparvet aiheuttavat tuhoa!{}Tuotanto vähenee 50{NBSP}%:lla.
 STR_483B_CAN_ONLY_BE_POSITIONED                                 :{WHITE}...voidaan asettaa vain kartan reunoille.
-STR_INDUSTRY_PROD_GOUP                                          ::{BLACK}{BIGFONT}{1:INDUSTRY} tuottaa {0:STRING} {2:COMMA}{NBSP}% entistä enemmän!
-STR_INDUSTRY_PROD_GODOWN                                        ::{BLACK}{BIGFONT}{1:INDUSTRY} tuottaa {0:STRING} {2:COMMA}{NBSP}% entistä vähemmän!
+STR_INDUSTRY_PROD_GOUP                                          :{BLACK}{BIGFONT}{1:INDUSTRY} tuottaa {0:STRING} {2:COMMA}{NBSP}% entistä enemmän!
+STR_INDUSTRY_PROD_GODOWN                                        :{BLACK}{BIGFONT}{1:INDUSTRY} tuottaa {0:STRING} {2:COMMA}{NBSP}% entistä vähemmän!
 
 ##id 0x5000
 STR_5000_TRAIN_IN_TUNNEL                                        :{WHITE}Juna on tunnelissa.
--- a/src/lang/german.txt	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/lang/german.txt	Wed Jun 13 11:17:30 2007 +0000
@@ -752,6 +752,7 @@
 STR_02A1_SMALL                                                  :{BLACK}Klein
 STR_02A2_MEDIUM                                                 :{BLACK}Mittel
 STR_02A3_LARGE                                                  :{BLACK}Groß
+STR_SCENARIO_EDITOR_CITY                                        :{BLACK}Stadt
 STR_02A4_SELECT_TOWN_SIZE                                       :{BLACK}Stadtgröße bestimmen
 STR_02A5_TOWN_SIZE                                              :{YELLOW}Stadtgröße:
 
@@ -1143,6 +1144,7 @@
 STR_CONFIG_PATCHES_TOWN_GROWTH_VERY_FAST                        :Sehr schnell
 STR_CONFIG_PATCHES_LARGER_TOWNS                                 :{LTBLUE}Anteil der Städte die doppelt so schnell wachsen: {ORANGE}1 in {STRING}
 STR_CONFIG_PATCHES_LARGER_TOWNS_DISABLED                        :{LTBLUE}Anteil der Städte die doppelt so schnell wachsen: {ORANGE}Keine
+STR_CONFIG_PATCHES_CITY_SIZE_MULTIPLIER                         :{LTBLUE}Startmultiplikator der Stadtgröße: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_GUI                                          :{BLACK}Oberfläche
 STR_CONFIG_PATCHES_CONSTRUCTION                                 :{BLACK}Konstruktion
@@ -3161,6 +3163,7 @@
 
 STR_FEEDER_CARGO_VALUE                                          :{BLACK}Überweise Geld: {LTBLUE}{CURRENCY}
 STR_DRIVE_THROUGH_ERROR_ON_TOWN_ROAD                            :{WHITE}...diese Straße ist in kommunaler Trägerschaft
+STR_DRIVE_THROUGH_ERROR_DIRECTION                               :{WHITE}...Straße verläuft in die falsche Richtung
 
 STR_TRANSPARENCY_TOOLB                                          :{WHITE}Transparenzoptionen
 STR_TRANSPARENT_SIGNS_DESC                                      :{BLACK}Verändere die Transparenz für Stationsschilder
--- a/src/lang/italian.txt	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/lang/italian.txt	Wed Jun 13 11:17:30 2007 +0000
@@ -753,6 +753,7 @@
 STR_02A1_SMALL                                                  :{BLACK}Piccola
 STR_02A2_MEDIUM                                                 :{BLACK}Media
 STR_02A3_LARGE                                                  :{BLACK}Grande
+STR_SCENARIO_EDITOR_CITY                                        :{BLACK}Metropoli
 STR_02A4_SELECT_TOWN_SIZE                                       :{BLACK}Seleziona la dimensione della città
 STR_02A5_TOWN_SIZE                                              :{YELLOW}Dimensione città:
 
@@ -1143,8 +1144,9 @@
 STR_CONFIG_PATCHES_TOWN_GROWTH_NORMAL                           :Normale
 STR_CONFIG_PATCHES_TOWN_GROWTH_FAST                             :Veloce
 STR_CONFIG_PATCHES_TOWN_GROWTH_VERY_FAST                        :Molto veloce
-STR_CONFIG_PATCHES_LARGER_TOWNS                                 :{LTBLUE}Città che cresceranno a velocità doppia: {ORANGE}1 su {STRING}
-STR_CONFIG_PATCHES_LARGER_TOWNS_DISABLED                        :{LTBLUE}Città che cresceranno a velocità doppia: {ORANGE}Nessuna
+STR_CONFIG_PATCHES_LARGER_TOWNS                                 :{LTBLUE}Città che diventeranno metropoli: {ORANGE}1 su {STRING}
+STR_CONFIG_PATCHES_LARGER_TOWNS_DISABLED                        :{LTBLUE}Città che diventeranno metropoli: {ORANGE}Nessuna
+STR_CONFIG_PATCHES_CITY_SIZE_MULTIPLIER                         :{LTBLUE}Moltiplicatore iniziale dimensioni metropoli: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_GUI                                          :{BLACK}Interfaccia
 STR_CONFIG_PATCHES_CONSTRUCTION                                 :{BLACK}Costruzione
@@ -2047,9 +2049,25 @@
 STR_681E_FAST                                                   :Veloce
 STR_681F_VERY_FAST                                              :Molto veloce
 STR_VERY_LOW                                                    :Molto basso
+STR_VERY_LOW.ms                                                 :Molto basso
+STR_VERY_LOW.mp                                                 :Molto bassi
+STR_VERY_LOW.fp                                                 :Molto basse
+STR_VERY_LOW.fs                                                 :Molto bassa
 STR_6820_LOW                                                    :Basso
+STR_6820_LOW.ms                                                 :Basso
+STR_6820_LOW.mp                                                 :Bassi
+STR_6820_LOW.fs                                                 :Bassa
+STR_6820_LOW.fp                                                 :Basse
 STR_6821_MEDIUM                                                 :Medio
+STR_6821_MEDIUM.ms                                              :Medio
+STR_6821_MEDIUM.mp                                              :Medi
+STR_6821_MEDIUM.fs                                              :Media
+STR_6821_MEDIUM.fp                                              :Medie
 STR_6822_HIGH                                                   :Alto
+STR_6822_HIGH.ms                                                :Alto
+STR_6822_HIGH.mp                                                :Alti
+STR_6822_HIGH.fs                                                :Alta
+STR_6822_HIGH.fp                                                :Alte
 STR_6823_NONE                                                   :Nessuno
 STR_6824_REDUCED                                                :Ridotti
 STR_6825_NORMAL                                                 :Normali
--- a/src/lang/japanese.txt	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/lang/japanese.txt	Wed Jun 13 11:17:30 2007 +0000
@@ -751,6 +751,7 @@
 STR_02A1_SMALL                                                  :{BLACK}村
 STR_02A2_MEDIUM                                                 :{BLACK}町
 STR_02A3_LARGE                                                  :{BLACK}市
+STR_SCENARIO_EDITOR_CITY                                        :{BLACK}市町村
 STR_02A4_SELECT_TOWN_SIZE                                       :{BLACK}町のサイズを選択します
 STR_02A5_TOWN_SIZE                                              :{YELLOW}町のサイズ:
 
@@ -1135,6 +1136,15 @@
 STR_CONFIG_PATCHES_TOOLBAR_POS_RIGHT                            :右
 STR_CONFIG_PATCHES_SNAP_RADIUS                                  :{LTBLUE}ウィンドウスナップ範囲:{ORANGE}{STRING} px
 STR_CONFIG_PATCHES_SNAP_RADIUS_DISABLED                         :{LTBLUE}ウィンドウスナップ範囲:{ORANGE}切
+STR_CONFIG_PATCHES_TOWN_GROWTH                                  :{LTBLUE}市町村の展開:{ORANGE}{STRING}
+STR_CONFIG_PATCHES_TOWN_GROWTH_NONE                             :なし
+STR_CONFIG_PATCHES_TOWN_GROWTH_SLOW                             :遅い
+STR_CONFIG_PATCHES_TOWN_GROWTH_NORMAL                           :普通
+STR_CONFIG_PATCHES_TOWN_GROWTH_FAST                             :早い
+STR_CONFIG_PATCHES_TOWN_GROWTH_VERY_FAST                        :特に早い
+STR_CONFIG_PATCHES_LARGER_TOWNS                                 :{LTBLUE}市に展開する町の割合:{ORANGE}{STRING}の1
+STR_CONFIG_PATCHES_LARGER_TOWNS_DISABLED                        :{LTBLUE}市に展開する町の割合:{ORANGE}なし
+STR_CONFIG_PATCHES_CITY_SIZE_MULTIPLIER                         :{LTBLUE}初期の市町村のサイズの乗数:{ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_GUI                                          :{BLACK}インターフェース
 STR_CONFIG_PATCHES_CONSTRUCTION                                 :{BLACK}建設
--- a/src/lang/norwegian_bokmal.txt	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/lang/norwegian_bokmal.txt	Wed Jun 13 11:17:30 2007 +0000
@@ -727,6 +727,7 @@
 STR_028D_PLACE_LIGHTHOUSE                                       :{BLACK}Plasser fyrtårn
 STR_028E_PLACE_TRANSMITTER                                      :{BLACK}Plasser radiosender
 STR_028F_DEFINE_DESERT_AREA                                     :{BLACK}Definer ørkenområde.{}Trykk og hold inne CTRL for å fjerne den
+STR_CREATE_LAKE                                                 :{BLACK}Definer vannområde.{}Lag en kanal, untatt hvis CTRL holdes nede på havnivå, hvor områdene vil fylles istedenfor
 STR_0290_DELETE                                                 :{BLACK}Slett
 STR_0291_DELETE_THIS_TOWN_COMPLETELY                            :{BLACK}Slett denne byen fullstendig
 STR_0292_SAVE_SCENARIO                                          :Lagre scenario
@@ -750,6 +751,7 @@
 STR_02A1_SMALL                                                  :{BLACK}Liten
 STR_02A2_MEDIUM                                                 :{BLACK}Middels
 STR_02A3_LARGE                                                  :{BLACK}Stor
+STR_SCENARIO_EDITOR_CITY                                        :{BLACK}By
 STR_02A4_SELECT_TOWN_SIZE                                       :{BLACK}Velg bystørrelse
 STR_02A5_TOWN_SIZE                                              :{YELLOW}Bystørrelse:
 
@@ -801,6 +803,7 @@
 STR_02DE_MAP_OF_WORLD                                           :Verdenskart
 STR_EXTRA_VIEW_PORT                                             :Ekstra vindu
 STR_SIGN_LIST                                                   :Skiltliste
+STR_TRANSPARENCY_OPTIONS                                        :Instillinger for gjennomsiktighet
 STR_02DF_TOWN_DIRECTORY                                         :Byoversikt
 STR_TOWN_POPULATION                                             :{BLACK}Verdensbefolkning: {COMMA}
 STR_EXTRA_VIEW_PORT_TITLE                                       :{WHITE}Vindu {COMMA}
@@ -1133,6 +1136,15 @@
 STR_CONFIG_PATCHES_TOOLBAR_POS_RIGHT                            :Høyre
 STR_CONFIG_PATCHES_SNAP_RADIUS                                  :{LTBLUE}Knipseradius for vindu: {ORANGE}{STRING} px
 STR_CONFIG_PATCHES_SNAP_RADIUS_DISABLED                         :{LTBLUE}Knipseradius for vindu: {ORANGE}deaktivert
+STR_CONFIG_PATCHES_TOWN_GROWTH                                  :{LTBLUE}Hastighet for byenes vekst: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_TOWN_GROWTH_NONE                             :Ingen
+STR_CONFIG_PATCHES_TOWN_GROWTH_SLOW                             :Sakte
+STR_CONFIG_PATCHES_TOWN_GROWTH_NORMAL                           :Normal
+STR_CONFIG_PATCHES_TOWN_GROWTH_FAST                             :Rask
+STR_CONFIG_PATCHES_TOWN_GROWTH_VERY_FAST                        :Veldig rask
+STR_CONFIG_PATCHES_LARGER_TOWNS                                 :{LTBLUE}Andel tettsteder som kommer til å bli byer: {ORANGE}1 av {STRING}
+STR_CONFIG_PATCHES_LARGER_TOWNS_DISABLED                        :{LTBLUE}Andel tettsted som kommer til å bli byer: {ORANGE}Ingen
+STR_CONFIG_PATCHES_CITY_SIZE_MULTIPLIER                         :{LTBLUE}Innledende bystørrelse multiplikator: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_GUI                                          :{BLACK}Grensesnitt
 STR_CONFIG_PATCHES_CONSTRUCTION                                 :{BLACK}Konstruksjon
@@ -1212,6 +1224,7 @@
 STR_TREES_RANDOM_TYPE_TIP                                       :{BLACK}Plasser trær av tilfeldig type
 
 STR_CANT_BUILD_CANALS                                           :{WHITE}Kan ikke bygge kanaler her...
+STR_BUILD_CANALS_TIP                                            :{BLACK}Bygg kanaler.
 STR_LANDINFO_CANAL                                              :Kanal
 
 STR_CANT_BUILD_LOCKS                                            :{WHITE}Kan ikke bygge sluser her...
@@ -3009,6 +3022,10 @@
 STR_REPLACE_REMOVE_WAGON_HELP                                   :{BLACK}La den automatiske utskiftningen beholde lengen på toget ved å fjerne vogner (fra første vogn), hvis utskiftningen gjør toget lenger.
 STR_REPLACE_ENGINE_WAGON_SELECT                                 :{BLACK}Erstatter: {ORANGE}{SKIP}{SKIP}{STRING}
 STR_REPLACE_ENGINE_WAGON_SELECT_HELP                            :{BLACK} Eksperimentell del {}Skift mellom tog- og vognvinduet.{}Vognutskiftningen vil bare bli utført hvis den nye vognen kan ha samme last som den gamle. Dette blir sjekket når utskiftingen finner sted.
+STR_RAIL_VEHICLE_NOT_AVAILABLE                                  :{WHITE}Kjøretøyet er ikke tilgjengelig
+STR_ROAD_VEHICLE_NOT_AVAILABLE                                  :{WHITE}Kjøretøyet er ikke tilgjengelig
+STR_SHIP_NOT_AVAILABLE                                          :{WHITE}Skipet er ikke tilgjengelig
+STR_AIRCRAFT_NOT_AVAILABLE                                      :{WHITE}Flyfartøyet er ikke tilgjengelig
 
 STR_ENGINES                                                     :Motorer
 STR_WAGONS                                                      :Vogner
@@ -3145,3 +3162,14 @@
 ########
 
 STR_FEEDER_CARGO_VALUE                                          :{BLACK}Overfør kreditt: {LTBLUE}{CURRENCY}
+STR_DRIVE_THROUGH_ERROR_ON_TOWN_ROAD                            :{WHITE}...denne veien er eid av en by
+STR_DRIVE_THROUGH_ERROR_DIRECTION                               :{WHITE}...veien vender mot feil retning
+
+STR_TRANSPARENCY_TOOLB                                          :{WHITE}Instillinger for gjennomsiktighet
+STR_TRANSPARENT_SIGNS_DESC                                      :{BLACK}Skru på gjennomsiktighet for stasjonskilt
+STR_TRANSPARENT_TREES_DESC                                      :{BLACK}Skru på gjennomsiktighet for trær
+STR_TRANSPARENT_HOUSES_DESC                                     :{BLACK}Skru på gjennomsiktighet for hus
+STR_TRANSPARENT_INDUSTRIES_DESC                                 :{BLACK}Skru på gjennomsiktighet for industrier
+STR_TRANSPARENT_BUILDINGS_DESC                                  :{BLACK}Skru på gjennomsiktighet for stasjoner, depoter, lokalstasjoner og skinner
+STR_TRANSPARENT_BRIDGES_DESC                                    :{BLACK}Skru på gjennomsiktighet for broer
+STR_TRANSPARENT_STRUCTURES_DESC                                 :{BLACK}Skru på gjennomsiktighet for fyrtårn og antenner
--- a/src/lang/polish.txt	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/lang/polish.txt	Wed Jun 13 11:17:30 2007 +0000
@@ -838,6 +838,7 @@
 STR_02A1_SMALL                                                  :{BLACK}Male
 STR_02A2_MEDIUM                                                 :{BLACK}Średnie
 STR_02A3_LARGE                                                  :{BLACK}Duże
+STR_SCENARIO_EDITOR_CITY                                        :{BLACK}Metropolia
 STR_02A4_SELECT_TOWN_SIZE                                       :{BLACK}Wybierz wielkość miasta
 STR_02A5_TOWN_SIZE                                              :{YELLOW}Wielkość miasta:
 
@@ -1222,6 +1223,15 @@
 STR_CONFIG_PATCHES_TOOLBAR_POS_RIGHT                            :Z prawej strony
 STR_CONFIG_PATCHES_SNAP_RADIUS                                  :{LTBLUE}Strefa przyciągania okien: {ORANGE}{STRING} pkt
 STR_CONFIG_PATCHES_SNAP_RADIUS_DISABLED                         :{LTBLUE}Strefa przyciągania okien: {ORANGE}niedostępne
+STR_CONFIG_PATCHES_TOWN_GROWTH                                  :{LTBLUE}Szybkość rozwoju miast: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_TOWN_GROWTH_NONE                             :Brak
+STR_CONFIG_PATCHES_TOWN_GROWTH_SLOW                             :Mała
+STR_CONFIG_PATCHES_TOWN_GROWTH_NORMAL                           :Normalna
+STR_CONFIG_PATCHES_TOWN_GROWTH_FAST                             :Duża
+STR_CONFIG_PATCHES_TOWN_GROWTH_VERY_FAST                        :Bardzo duża
+STR_CONFIG_PATCHES_LARGER_TOWNS                                 :{LTBLUE}Ilość miast które staną się metropoliami: {ORANGE}1 na {STRING}
+STR_CONFIG_PATCHES_LARGER_TOWNS_DISABLED                        :{LTBLUE}Ilość miast które staną się metropoliami: {ORANGE}Brak
+STR_CONFIG_PATCHES_CITY_SIZE_MULTIPLIER                         :{LTBLUE}Początkowy mnożnik rozmiarów metropolii: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_GUI                                          :{BLACK}Interfejs
 STR_CONFIG_PATCHES_CONSTRUCTION                                 :{BLACK}Konstrukcje
--- a/src/lang/romanian.txt	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/lang/romanian.txt	Wed Jun 13 11:17:30 2007 +0000
@@ -751,6 +751,7 @@
 STR_02A1_SMALL                                                  :{BLACK}Mic
 STR_02A2_MEDIUM                                                 :{BLACK}Mediu
 STR_02A3_LARGE                                                  :{BLACK}Mare
+STR_SCENARIO_EDITOR_CITY                                        :{BLACK}Oras
 STR_02A4_SELECT_TOWN_SIZE                                       :{BLACK}Alege mãrimea orasului
 STR_02A5_TOWN_SIZE                                              :{YELLOW}Mãrime oras:
 
@@ -1143,6 +1144,7 @@
 STR_CONFIG_PATCHES_TOWN_GROWTH_VERY_FAST                        :Foarte rapida
 STR_CONFIG_PATCHES_LARGER_TOWNS                                 :{LTBLUE}Proportia oraselor care se vor dezvolta de doua ori mai repede: {ORANGE}1 in {STRING}
 STR_CONFIG_PATCHES_LARGER_TOWNS_DISABLED                        :{LTBLUE}Proportia oraselor care se vor dezvolta de doua ori mai repede: {ORANGE}None
+STR_CONFIG_PATCHES_CITY_SIZE_MULTIPLIER                         :{LTBLUE}Multiplicator initial dimensiune oras: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_GUI                                          :{BLACK}Interfatã
 STR_CONFIG_PATCHES_CONSTRUCTION                                 :{BLACK}Constructie
--- a/src/lang/russian.txt	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/lang/russian.txt	Wed Jun 13 11:17:30 2007 +0000
@@ -753,6 +753,7 @@
 STR_02A1_SMALL                                                  :{BLACK}Малый
 STR_02A2_MEDIUM                                                 :{BLACK}Средний
 STR_02A3_LARGE                                                  :{BLACK}Большой
+STR_SCENARIO_EDITOR_CITY                                        :{BLACK}Город
 STR_02A4_SELECT_TOWN_SIZE                                       :{BLACK}Выбор размера города
 STR_02A5_TOWN_SIZE                                              :{YELLOW}Размер города:
 
@@ -1145,6 +1146,7 @@
 STR_CONFIG_PATCHES_TOWN_GROWTH_VERY_FAST                        :очень быстрая
 STR_CONFIG_PATCHES_LARGER_TOWNS                                 :{LTBLUE}Соотношение городов, которые растут вдвое быстрее: {ORANGE}1 из {STRING}
 STR_CONFIG_PATCHES_LARGER_TOWNS_DISABLED                        :{LTBLUE}Соотношение городов, которые растут вдвое быстрее: {ORANGE}Выкл.
+STR_CONFIG_PATCHES_CITY_SIZE_MULTIPLIER                         :{LTBLUE}Изначальный множитель размера города: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_GUI                                          :{BLACK}Интерфейс
 STR_CONFIG_PATCHES_CONSTRUCTION                                 :{BLACK}Строительство
--- a/src/lang/simplified_chinese.txt	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/lang/simplified_chinese.txt	Wed Jun 13 11:17:30 2007 +0000
@@ -751,6 +751,7 @@
 STR_02A1_SMALL                                                  :{BLACK}小
 STR_02A2_MEDIUM                                                 :{BLACK}中
 STR_02A3_LARGE                                                  :{BLACK}大
+STR_SCENARIO_EDITOR_CITY                                        :{BLACK}城市
 STR_02A4_SELECT_TOWN_SIZE                                       :{BLACK}选择城镇规模
 STR_02A5_TOWN_SIZE                                              :{YELLOW}城镇规模:
 
@@ -1135,6 +1136,14 @@
 STR_CONFIG_PATCHES_TOOLBAR_POS_RIGHT                            :右侧
 STR_CONFIG_PATCHES_SNAP_RADIUS                                  :{LTBLUE}窗口依附半径:{ORANGE}{STRING} 像素
 STR_CONFIG_PATCHES_SNAP_RADIUS_DISABLED                         :{LTBLUE}窗口依附半径:{ORANGE}禁用
+STR_CONFIG_PATCHES_TOWN_GROWTH                                  :{LTBLUE}城镇发展速度:{ORANGE}{STRING}
+STR_CONFIG_PATCHES_TOWN_GROWTH_NONE                             :无
+STR_CONFIG_PATCHES_TOWN_GROWTH_SLOW                             :慢
+STR_CONFIG_PATCHES_TOWN_GROWTH_NORMAL                           :正常
+STR_CONFIG_PATCHES_TOWN_GROWTH_FAST                             :快
+STR_CONFIG_PATCHES_TOWN_GROWTH_VERY_FAST                        :非常快
+STR_CONFIG_PATCHES_LARGER_TOWNS                                 :{LTBLUE}城镇发展为城市的比例:{ORANGE}1 / {STRING}
+STR_CONFIG_PATCHES_LARGER_TOWNS_DISABLED                        :{LTBLUE}城镇发展为城市的比例:{ORANGE}无
 
 STR_CONFIG_PATCHES_GUI                                          :{BLACK}界面
 STR_CONFIG_PATCHES_CONSTRUCTION                                 :{BLACK}建设
--- a/src/lang/slovak.txt	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/lang/slovak.txt	Wed Jun 13 11:17:30 2007 +0000
@@ -815,6 +815,7 @@
 STR_02A1_SMALL                                                  :{BLACK}Male
 STR_02A2_MEDIUM                                                 :{BLACK}Stredne
 STR_02A3_LARGE                                                  :{BLACK}Velke
+STR_SCENARIO_EDITOR_CITY                                        :{BLACK}Mesto
 STR_02A4_SELECT_TOWN_SIZE                                       :{BLACK}Vyber velkost mesta
 STR_02A5_TOWN_SIZE                                              :{YELLOW}Velkost mesta:
 
@@ -1207,6 +1208,7 @@
 STR_CONFIG_PATCHES_TOWN_GROWTH_VERY_FAST                        :Velmi rýchly
 STR_CONFIG_PATCHES_LARGER_TOWNS                                 :{LTBLUE}Pomer miest, ktoré budú rást 2x rýchlejšie: {ORANGE}1 v {STRING}
 STR_CONFIG_PATCHES_LARGER_TOWNS_DISABLED                        :{LTBLUE}Pomer miest, ktoré budú rást 2x rýchlejšie: {ORANGE}Žiadny
+STR_CONFIG_PATCHES_CITY_SIZE_MULTIPLIER                         :{LTBLUE}Násobok pociatocnej velkosti mesta: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_GUI                                          :{BLACK}Rozhranie
 STR_CONFIG_PATCHES_CONSTRUCTION                                 :{BLACK}Vystavba
--- a/src/lang/slovenian.txt	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/lang/slovenian.txt	Wed Jun 13 11:17:30 2007 +0000
@@ -793,6 +793,7 @@
 STR_02A1_SMALL                                                  :{BLACK}Majhno
 STR_02A2_MEDIUM                                                 :{BLACK}Srednje
 STR_02A3_LARGE                                                  :{BLACK}Veliko
+STR_SCENARIO_EDITOR_CITY                                        :{BLACK}Mesto
 STR_02A4_SELECT_TOWN_SIZE                                       :{BLACK}Izberi velikost mesta
 STR_02A5_TOWN_SIZE                                              :{YELLOW}Velikost mesta:
 
@@ -1185,6 +1186,7 @@
 STR_CONFIG_PATCHES_TOWN_GROWTH_VERY_FAST                        :Zelo hitro
 STR_CONFIG_PATCHES_LARGER_TOWNS                                 :{LTBLUE}Razmerje mest, ki bodo rastla z dvakratno hitrostjo: {ORANGE}1 v {STRING}
 STR_CONFIG_PATCHES_LARGER_TOWNS_DISABLED                        :{LTBLUE}Razmerje mest, ki bodo rastla z dvakratno hitrostjo: {ORANGE}Brez
+STR_CONFIG_PATCHES_CITY_SIZE_MULTIPLIER                         :{LTBLUE}Začetni faktor rasti mesta: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_GUI                                          :{BLACK}Vmesnik
 STR_CONFIG_PATCHES_CONSTRUCTION                                 :{BLACK}Gradnja
--- a/src/lang/spanish.txt	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/lang/spanish.txt	Wed Jun 13 11:17:30 2007 +0000
@@ -752,6 +752,7 @@
 STR_02A1_SMALL                                                  :{BLACK}Pequeña
 STR_02A2_MEDIUM                                                 :{BLACK}Mediana
 STR_02A3_LARGE                                                  :{BLACK}Grande
+STR_SCENARIO_EDITOR_CITY                                        :{BLACK}Ciudad
 STR_02A4_SELECT_TOWN_SIZE                                       :{BLACK}Selecciona el tamaño de la población
 STR_02A5_TOWN_SIZE                                              :{YELLOW}Tamaño población:
 
@@ -1144,6 +1145,7 @@
 STR_CONFIG_PATCHES_TOWN_GROWTH_VERY_FAST                        :Muy rápida
 STR_CONFIG_PATCHES_LARGER_TOWNS                                 :{LTBLUE}Proporción de ciudades que crecerán el doble de rápido: {ORANGE}1 de {STRING}
 STR_CONFIG_PATCHES_LARGER_TOWNS_DISABLED                        :{LTBLUE}Proporción de ciudades que crecerán el doble de rápido: {ORANGE}Ninguna
+STR_CONFIG_PATCHES_CITY_SIZE_MULTIPLIER                         :{LTBLUE}Multiplicador inicial tamaño de ciudad: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_GUI                                          :{BLACK}Interfaz
 STR_CONFIG_PATCHES_CONSTRUCTION                                 :{BLACK}Construcción
--- a/src/lang/traditional_chinese.txt	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/lang/traditional_chinese.txt	Wed Jun 13 11:17:30 2007 +0000
@@ -37,7 +37,7 @@
 STR_001E_FOOD                                                   :食物
 STR_001F_PAPER                                                  :紙
 STR_0020_GOLD                                                   :金塊
-STR_0021_WATER                                                  :飲用水
+STR_0021_WATER                                                  :淡水
 STR_0022_WHEAT                                                  :小麥
 STR_0023_RUBBER                                                 :橡膠
 STR_0024_SUGAR                                                  :砂糖
@@ -69,7 +69,7 @@
 STR_003E_FOOD                                                   :食品
 STR_003F_PAPER                                                  :紙張
 STR_0040_GOLD                                                   :金塊
-STR_0041_WATER                                                  :飲用水
+STR_0041_WATER                                                  :淡水
 STR_0042_WHEAT                                                  :小麥
 STR_0043_RUBBER                                                 :橡膠
 STR_0044_SUGAR                                                  :砂糖
@@ -751,6 +751,7 @@
 STR_02A1_SMALL                                                  :{BLACK}小型
 STR_02A2_MEDIUM                                                 :{BLACK}中型
 STR_02A3_LARGE                                                  :{BLACK}大型
+STR_SCENARIO_EDITOR_CITY                                        :{BLACK}市鎮
 STR_02A4_SELECT_TOWN_SIZE                                       :{BLACK}選擇市鎮大小
 STR_02A5_TOWN_SIZE                                              :{YELLOW}市鎮大小:
 
@@ -1143,6 +1144,7 @@
 STR_CONFIG_PATCHES_TOWN_GROWTH_VERY_FAST                        :非常快
 STR_CONFIG_PATCHES_LARGER_TOWNS                                 :{LTBLUE}雙倍速增長城市比例: {ORANGE}{STRING} 分之一
 STR_CONFIG_PATCHES_LARGER_TOWNS_DISABLED                        :{LTBLUE}雙倍速增長城市比例: {ORANGE}沒有
+STR_CONFIG_PATCHES_CITY_SIZE_MULTIPLIER                         :{LTBLUE}市鎮規模初始倍率:{ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_GUI                                          :{BLACK}介面
 STR_CONFIG_PATCHES_CONSTRUCTION                                 :{BLACK}建築
--- a/src/lang/turkish.txt	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/lang/turkish.txt	Wed Jun 13 11:17:30 2007 +0000
@@ -751,6 +751,7 @@
 STR_02A1_SMALL                                                  :{BLACK}Küçük
 STR_02A2_MEDIUM                                                 :{BLACK}Orta
 STR_02A3_LARGE                                                  :{BLACK}Büyük
+STR_SCENARIO_EDITOR_CITY                                        :{BLACK}Şehir
 STR_02A4_SELECT_TOWN_SIZE                                       :{BLACK}Şehir büyüklüğü seç
 STR_02A5_TOWN_SIZE                                              :{YELLOW}Şehir büyüklüğü:
 
@@ -1135,6 +1136,11 @@
 STR_CONFIG_PATCHES_TOOLBAR_POS_RIGHT                            :Sağ
 STR_CONFIG_PATCHES_SNAP_RADIUS                                  :{LTBLUE}Pencere yapışma yarıçapı: {ORANGE}{STRING} piksel
 STR_CONFIG_PATCHES_SNAP_RADIUS_DISABLED                         :{LTBLUE}Pencere yapışma yarıçapı: {ORANGE}kapalı
+STR_CONFIG_PATCHES_TOWN_GROWTH_NONE                             :Hiçbiri
+STR_CONFIG_PATCHES_TOWN_GROWTH_SLOW                             :Yavaş
+STR_CONFIG_PATCHES_TOWN_GROWTH_NORMAL                           :Normal
+STR_CONFIG_PATCHES_TOWN_GROWTH_FAST                             :Hızlı
+STR_CONFIG_PATCHES_TOWN_GROWTH_VERY_FAST                        :Çok Hızlı
 
 STR_CONFIG_PATCHES_GUI                                          :{BLACK}Arayüz
 STR_CONFIG_PATCHES_CONSTRUCTION                                 :{BLACK}İnşaat
@@ -3011,6 +3017,10 @@
 STR_REPLACE_REMOVE_WAGON_HELP                                   :{BLACK}Otomatik yenilemede tren boyutunun artması gerekiyorsa vagonları kaldır(en önden başlayarak yeterli sayıda vagon silinir).
 STR_REPLACE_ENGINE_WAGON_SELECT                                 :{BLACK}Değiştiriyor: {ORANGE}{SKIP}{SKIP}{STRING}
 STR_REPLACE_ENGINE_WAGON_SELECT_HELP                            :{BLACK} DENEYSEL ÖZELLiK {}Lokomotif ve vagon değişimi pencereleri arasında geçiş yap.{}Vagon değişimi sadece yeni vagon eskisinin taşıdığı türde yükü taşıyabiliyorsa yapılir. Değiştirme işlemi sırasında tüm vagonlar için bu durum kontrol edilir.
+STR_RAIL_VEHICLE_NOT_AVAILABLE                                  :{WHITE}Tren kullanılamaz
+STR_ROAD_VEHICLE_NOT_AVAILABLE                                  :{WHITE}Araba kullanılamaz
+STR_SHIP_NOT_AVAILABLE                                          :{WHITE}Gemi kullanılamaz
+STR_AIRCRAFT_NOT_AVAILABLE                                      :{WHITE}Uçak kullanılamaz
 
 STR_ENGINES                                                     :Lokomotifler
 STR_WAGONS                                                      :Vagon
@@ -3148,6 +3158,7 @@
 
 STR_FEEDER_CARGO_VALUE                                          :{BLACK}Aktarma Maliyeti: {LTBLUE}{CURRENCY}
 STR_DRIVE_THROUGH_ERROR_ON_TOWN_ROAD                            :{WHITE}...bu yol belediyeye ait
+STR_DRIVE_THROUGH_ERROR_DIRECTION                               :{WHITE}...yol yanlış yönde
 
 STR_TRANSPARENCY_TOOLB                                          :{WHITE}Şeffaflık Seçenekleri
 STR_TRANSPARENT_SIGNS_DESC                                      :{BLACK}Durak tabelaları için şeffaflık
--- a/src/lang/ukrainian.txt	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/lang/ukrainian.txt	Wed Jun 13 11:17:30 2007 +0000
@@ -877,6 +877,7 @@
 STR_02A1_SMALL                                                  :{BLACK}Мале
 STR_02A2_MEDIUM                                                 :{BLACK}Середнє
 STR_02A3_LARGE                                                  :{BLACK}Велике
+STR_SCENARIO_EDITOR_CITY                                        :{BLACK}Місто
 STR_02A4_SELECT_TOWN_SIZE                                       :{BLACK}Вибір розміру міста
 STR_02A5_TOWN_SIZE                                              :{YELLOW}Розмір міста:
 
@@ -1262,13 +1263,14 @@
 STR_CONFIG_PATCHES_SNAP_RADIUS                                  :{LTBLUE}Радіус прилипання вікон: {ORANGE}{STRING} пікс.
 STR_CONFIG_PATCHES_SNAP_RADIUS_DISABLED                         :{LTBLUE}Прилипання вікон {ORANGE}вимкнено
 STR_CONFIG_PATCHES_TOWN_GROWTH                                  :{LTBLUE}Швидкість росту міста: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_TOWN_GROWTH_NONE                             :не росте
-STR_CONFIG_PATCHES_TOWN_GROWTH_SLOW                             :повільна
-STR_CONFIG_PATCHES_TOWN_GROWTH_NORMAL                           :нормальна
-STR_CONFIG_PATCHES_TOWN_GROWTH_FAST                             :швидка
-STR_CONFIG_PATCHES_TOWN_GROWTH_VERY_FAST                        :дуже швидка
+STR_CONFIG_PATCHES_TOWN_GROWTH_NONE                             :Немає
+STR_CONFIG_PATCHES_TOWN_GROWTH_SLOW                             :Повільна
+STR_CONFIG_PATCHES_TOWN_GROWTH_NORMAL                           :Середня
+STR_CONFIG_PATCHES_TOWN_GROWTH_FAST                             :Швидка
+STR_CONFIG_PATCHES_TOWN_GROWTH_VERY_FAST                        :Дуже швидка
 STR_CONFIG_PATCHES_LARGER_TOWNS                                 :{LTBLUE}Кількість міст, які будуть рости вдвічі швидше: {ORANGE}1 з {STRING}
 STR_CONFIG_PATCHES_LARGER_TOWNS_DISABLED                        :{LTBLUE}Кількість міст, які будуть рости вдвічі швидше: {ORANGE}нема
+STR_CONFIG_PATCHES_CITY_SIZE_MULTIPLIER                         :{LTBLUE}Початковий коєффіцієнт розміру міст: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_GUI                                          :{BLACK}Вигляд
 STR_CONFIG_PATCHES_CONSTRUCTION                                 :{BLACK}Споруди
--- a/src/macros.h	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/macros.h	Wed Jun 13 11:17:30 2007 +0000
@@ -82,9 +82,9 @@
 
 
 /* checking more bits. Maybe unneccessary, but easy to use */
-#define HASBITS(x,y) ((x) & (y))
-#define SETBITS(x,y) ((x) |= (y))
-#define CLRBITS(x,y) ((x) &= ~(y))
+#define HASBITS(x, y) ((x) & (y))
+#define SETBITS(x, y) ((x) |= (y))
+#define CLRBITS(x, y) ((x) &= ~(y))
 
 #define GENERAL_SPRITE_COLOR(color) ((color) + PALETTE_RECOLOR_START)
 #define PLAYER_SPRITE_COLOR(owner) (GENERAL_SPRITE_COLOR(_player_colors[owner]))
@@ -98,7 +98,7 @@
 /* Returns x with the first bit that is not zero, counted from the left, set
  * to zero. So, 10110100 returns 10110000, 00000001 returns 00000000, etc.
  */
-#define KILL_FIRST_BIT(x) _ffb_64[(x)+64]
+#define KILL_FIRST_BIT(x) _ffb_64[(x) + 64]
 
 static inline int FindFirstBit2x64(int value)
 {
@@ -133,13 +133,13 @@
 #define HAS_SINGLE_BIT(a) ( ((a) & ((a) - 1)) == 0)
 
 /* [min,max), strictly less than */
-#define IS_BYTE_INSIDE(a,min,max) ((byte)((a)-(min)) < (byte)((max)-(min)))
-#define IS_INT_INSIDE(a,min,max) ((uint)((a)-(min)) < (uint)((max)-(min)))
+#define IS_BYTE_INSIDE(a, min, max) ((byte)((a) - (min)) < (byte)((max) - (min)))
+#define IS_INT_INSIDE(a, min, max) ((uint)((a) - (min)) < (uint)((max) - (min)))
 
 
-#define CHANCE16(a,b) ((uint16)Random() <= (uint16)((65536 * (a)) / (b)))
-#define CHANCE16R(a,b,r) ((uint16)(r=Random()) <= (uint16)((65536 * (a)) / (b)))
-#define CHANCE16I(a,b,v) ((uint16)(v) <= (uint16)((65536 * (a)) / (b)))
+#define CHANCE16(a, b) ((uint16)Random() <= (uint16)((65536 * (a)) / (b)))
+#define CHANCE16R(a, b, r) ((uint16)(r = Random()) <= (uint16)((65536 * (a)) / (b)))
+#define CHANCE16I(a, b, v) ((uint16)(v) <= (uint16)((65536 * (a)) / (b)))
 
 
 #define for_each_bit(_i, _b)            \
--- a/src/main_gui.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/main_gui.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -89,7 +89,7 @@
 		} else {
 			NetworkServer_HandleChat(NETWORK_ACTION_GIVE_MONEY, DESTTYPE_TEAM, id, msg, NETWORK_SERVER_INDEX);
 		}
-	}	break;
+	} break;
 #endif /* ENABLE_NETWORK */
 		default: NOT_REACHED();
 	}
@@ -147,6 +147,22 @@
 }
 
 
+/** Toggle all transparency options, except for signs */
+static void ToggleTransparency()
+{
+	static byte trans_opt = ~0;
+
+	if (GB(_transparent_opt, 1, 7) == 0) {
+		SB(_transparent_opt, 1, 7, GB(trans_opt, 1, 7));
+	} else {
+		trans_opt = _transparent_opt;
+		SB(_transparent_opt, 1, 7, 0);
+	}
+
+	MarkWholeScreenDirty();
+}
+
+
 static void MenuClickSettings(int index)
 {
 	switch (index) {
@@ -161,8 +177,8 @@
 		case  8: _display_opt ^= DO_WAYPOINTS;          break;
 		case  9: _display_opt ^= DO_FULL_ANIMATION;     break;
 		case 10: _display_opt ^= DO_FULL_DETAIL;        break;
-		case 11: TOGGLEBIT(_transparent_opt, TO_BUILDINGS); break;
-		case 12: TOGGLEBIT(_transparent_opt, TO_SIGNS);     break;
+		case 11: ToggleTransparency(); break;
+		case 12: TOGGLEBIT(_transparent_opt, TO_SIGNS); break;
 	}
 	MarkWholeScreenDirty();
 }
@@ -964,8 +980,8 @@
 	if (_display_opt & DO_WAYPOINTS)          SETBIT(x,  8);
 	if (_display_opt & DO_FULL_ANIMATION)     SETBIT(x,  9);
 	if (_display_opt & DO_FULL_DETAIL)        SETBIT(x, 10);
-	if (HASBIT(_transparent_opt, TO_BUILDINGS)) SETBIT(x, 11);
-	if (HASBIT(_transparent_opt, TO_SIGNS))     SETBIT(x, 12);
+	if (GB(_transparent_opt, 1, 7) != 0)      SETBIT(x, 11);
+	if (HASBIT(_transparent_opt, TO_SIGNS))   SETBIT(x, 12);
 	WP(w,menu_d).checked_items = x;
 }
 
@@ -2355,18 +2371,9 @@
 				ShowTransparencyToolbar();
 				break;
 
-			case 'X': {
-				/* Toggle all transparency options except for signs */
-				static byte trans_opt = ~0;
-				if (GB(_transparent_opt, 1, 7) == 0) {
-					SB(_transparent_opt, 1, 7, GB(trans_opt, 1, 7));
-				} else {
-					trans_opt = _transparent_opt;
-					SB(_transparent_opt, 1, 7, 0);
-				}
-				MarkWholeScreenDirty();
+			case 'X':
+				ToggleTransparency();
 				break;
-			}
 
 #ifdef ENABLE_NETWORK
 			case WKC_RETURN: case 'T': // smart chat; send to team if any, otherwise to all
--- a/src/map.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/map.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -48,12 +48,12 @@
 	free(_me);
 
 	_m = CallocT<Tile>(_map_size);
- 	_me = CallocT<TileExtended>(_map_size);
+	_me = CallocT<TileExtended>(_map_size);
 
- 	/* XXX @todo handle memory shortage more gracefully
- 	 * Maybe some attemps could be made to try with smaller maps down to 64x64
- 	 * Maybe check for available memory before doing the calls, after all, we know how big
- 	 * the map is */
+	/* XXX @todo handle memory shortage more gracefully
+	 * Maybe some attemps could be made to try with smaller maps down to 64x64
+	 * Maybe check for available memory before doing the calls, after all, we know how big
+	 * the map is */
 	if ((_m == NULL) || (_me == NULL)) error("Failed to allocate memory for the map");
 }
 
@@ -86,9 +86,9 @@
 #endif
 	}
 
-	assert(TileXY(x,y) == TILE_MASK(tile + add));
+	assert(TileXY(x, y) == TILE_MASK(tile + add));
 
-	return TileXY(x,y);
+	return TileXY(x, y);
 }
 #endif
 
@@ -98,7 +98,7 @@
 	/* First shift by 12 to prevent integer overflow for large values of n.
 	 * >>12 is safe since the min mapsize is 64x64
 	 * Add (1<<4)-1 to round upwards. */
-	return (n * (MapSize() >> 12) + (1<<4) - 1) >> 4;
+	return (n * (MapSize() >> 12) + (1 << 4) - 1) >> 4;
 }
 
 
@@ -109,7 +109,7 @@
 	 * Note, not actually taking the full circumference into account,
 	 * just half of it.
 	 * (1<<9) - 1 is there to scale upwards. */
-	return (n * (MapSizeX() + MapSizeY()) + (1<<9) - 1) >> 9;
+	return (n * (MapSizeX() + MapSizeY()) + (1 << 9) - 1) >> 9;
 }
 
 
--- a/src/map.h	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/map.h	Wed Jun 13 11:17:30 2007 +0000
@@ -147,7 +147,7 @@
 uint DistanceFromEdge(TileIndex); ///< shortest distance from any edge of the map
 
 
-#define BEGIN_TILE_LOOP(var,w,h,tile)                      \
+#define BEGIN_TILE_LOOP(var, w, h, tile)                      \
 	{                                                        \
 		int h_cur = h;                                         \
 		uint var = tile;                                       \
@@ -155,7 +155,7 @@
 			int w_cur = w;                                       \
 			do {
 
-#define END_TILE_LOOP(var,w,h,tile)                        \
+#define END_TILE_LOOP(var, w, h, tile)                        \
 			} while (++var, --w_cur != 0);                       \
 		} while (var += TileDiffXY(0, 1) - (w), --h_cur != 0); \
 	}
--- a/src/misc.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/misc.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -288,7 +288,7 @@
 	int index;
 
 	while ((index = SlIterateArray()) != -1) {
-		SlArray(_name_array[index],SlGetFieldLength(),SLE_UINT8);
+		SlArray(_name_array[index], SlGetFieldLength(), SLE_UINT8);
 	}
 }
 
--- a/src/misc_gui.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/misc_gui.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -277,7 +277,7 @@
 
 		DoDrawStringCentered(210, w->height - 25, "Website: http://www.openttd.org", 16);
 		DrawStringCentered(210, w->height - 15, STR_00BA_COPYRIGHT_OPENTTD, 0);
-	}	break;
+	} break;
 	case WE_MOUSELOOP: // Timer to scroll the text and adjust the new top
 		if (WP(w, scroller_d).counter++ % 3 == 0) {
 			WP(w, scroller_d).height--;
@@ -1457,7 +1457,7 @@
 		}
 
 		if (_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO) {
-			DrawEditBox(w, &WP(w,querystr_d), 10);
+			DrawEditBox(w, &WP(w, querystr_d), 10);
 		}
 		break;
 	}
@@ -1550,7 +1550,7 @@
 		if (!(_saveload_mode == SLD_SAVE_GAME || _saveload_mode == SLD_SAVE_SCENARIO)) break;
 
 		if (IsWindowWidgetLowered(w, 11)) { // Delete button clicked
-			if (!FiosDelete(WP(w,querystr_d).text.buf)) {
+			if (!FiosDelete(WP(w, querystr_d).text.buf)) {
 				ShowErrorMessage(INVALID_STRING_ID, STR_4008_UNABLE_TO_DELETE_FILE, 0, 0);
 			} else {
 				BuildFileList();
@@ -1562,7 +1562,7 @@
 			SetWindowDirty(w);
 		} else if (IsWindowWidgetLowered(w, 12)) { // Save button clicked
 			_switch_mode = SM_SAVE;
-			FiosMakeSavegameName(_file_to_saveload.name, WP(w,querystr_d).text.buf, sizeof(_file_to_saveload.name));
+			FiosMakeSavegameName(_file_to_saveload.name, WP(w, querystr_d).text.buf, sizeof(_file_to_saveload.name));
 
 			/* In the editor set up the vehicle engines correctly (date might have changed) */
 			if (_game_mode == GM_EDITOR) StartupEngines();
--- a/src/music_gui.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/music_gui.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -207,8 +207,8 @@
 		LowerWindowWidget(w, 4);
 		DrawWindowWidgets(w);
 
-		GfxFillRect(3, 23, 3+177,23+191,0);
-		GfxFillRect(251, 23, 251+177,23+191,0);
+		GfxFillRect(3, 23, 3 + 177, 23 + 191, 0);
+		GfxFillRect(251, 23, 251 + 177, 23 + 191, 0);
 
 		DrawStringCentered(92, 15, STR_01EE_TRACK_INDEX, 0);
 
@@ -219,14 +219,14 @@
 			SetDParam(0, i);
 			SetDParam(2, i);
 			SetDParam(1, SPECSTR_SONGNAME);
-			DrawString(4, 23+(i-1)*6, (i < 10) ? STR_01EC_0 : STR_01ED, 0);
+			DrawString(4, 23 + (i - 1) * 6, (i < 10) ? STR_01EC_0 : STR_01ED, 0);
 		}
 
 		for (i = 0; i != 6; i++) {
 			DrawStringCentered(216, 45 + i * 8, STR_01D5_ALL + i, (i == msf.playlist) ? 0xC : 0x10);
 		}
 
-		DrawStringCentered(216, 45+8*6+16, STR_01F0_CLEAR, 0);
+		DrawStringCentered(216, 45 + 8 * 6 + 16, STR_01F0_CLEAR, 0);
 #if 0
 		DrawStringCentered(216, 45 + 8 * 6 + 16 * 2, STR_01F1_SAVE, 0);
 #endif
--- a/src/namegen.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/namegen.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -90,7 +90,7 @@
 	/* optional first segment */
 	i = SeedChanceBias(0, lengthof(name_additional_english_prefix), seed, 50);
 	if (i >= 0)
-		strecat(buf,name_additional_english_prefix[i], last);
+		strecat(buf, name_additional_english_prefix[i], last);
 
 	if (SeedChance(3, 20, seed) >= 14) {
 		strecat(buf, name_additional_english_1a[SeedChance(6, lengthof(name_additional_english_1a), seed)], last);
@@ -176,13 +176,13 @@
 	/* optional prefix */
 	if (seed_derivative == 12 || seed_derivative == 19) {
 		i = SeedChance(2, lengthof(name_german_pre), seed);
-		strecat(buf,name_german_pre[i], last);
+		strecat(buf, name_german_pre[i], last);
 	}
 
 	/* mandatory middle segments including option of hardcoded name */
 	i = SeedChance(3, lengthof(name_german_real) + lengthof(name_german_1), seed);
 	if (i < lengthof(name_german_real)) {
-		strecat(buf,name_german_real[i], last);
+		strecat(buf, name_german_real[i], last);
 	} else {
 		strecat(buf, name_german_1[i - lengthof(name_german_real)], last);
 
@@ -679,7 +679,7 @@
 
 		if (SeedModChance(3, 3, seed) == 0) {
 			strecat(buf, name_italian_2[SeedModChance(11, lengthof(name_italian_2), seed)], last);
-			strecat(buf,mascul_femin_italian[i], last);
+			strecat(buf, mascul_femin_italian[i], last);
 		} else {
 			strecat(buf, name_italian_2i[SeedModChance(16, lengthof(name_italian_2i), seed)], last);
 		}
--- a/src/network/core/os_abstraction.h	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/network/core/os_abstraction.h	Wed Jun 13 11:17:30 2007 +0000
@@ -161,7 +161,7 @@
 /* Make the names compatible */
 #	define closesocket(s) CloseSocket(s)
 #	define GET_LAST_ERROR() Errno()
-#	define ioctlsocket(s,request,status) IoctlSocket((LONG)s,(ULONG)request,(char*)status)
+#	define ioctlsocket(s, request, status) IoctlSocket((LONG)s, (ULONG)request, (char*)status)
 #	define ioctl ioctlsocket
 
 	typedef unsigned int in_addr_t;
--- a/src/network/network_client.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/network/network_client.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -523,7 +523,7 @@
 		if (_network_join_kbytes_total == 0) return NETWORK_RECV_STATUS_MALFORMED_PACKET;
 
 		_network_join_status = NETWORK_JOIN_STATUS_DOWNLOADING;
- 		InvalidateWindow(WC_NETWORK_STATUS_WINDOW, 0);
+		InvalidateWindow(WC_NETWORK_STATUS_WINDOW, 0);
 
 		// The first packet does not contain any more data
 		return NETWORK_RECV_STATUS_OKAY;
--- a/src/network/network_gui.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/network/network_gui.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -385,7 +385,7 @@
 
 			y += 10;
 		}
-	}	break;
+	} break;
 
 	case WE_CLICK:
 		nd->field = e->we.click.widget;
@@ -452,7 +452,7 @@
 			if (nd->server != NULL) ShowNewGRFSettings(false, false, false, &nd->server->info.grfconfig);
 			break;
 
-	}	break;
+	} break;
 
 	case WE_DROPDOWN_SELECT: /* we have selected a dropdown item in the list */
 		switch (e->we.dropdown.button) {
@@ -644,7 +644,7 @@
 
 			if (y >= w->vscroll.cap * NSSWND_ROWSIZE + NSSWND_START) break;
 		}
-	}	break;
+	} break;
 
 	case WE_CLICK:
 		nd->field = e->we.click.widget;
@@ -789,7 +789,7 @@
 	_saveload_mode = SLD_NEW_GAME;
 	BuildFileList();
 	w->vscroll.cap = 12;
-	w->vscroll.count = _fios_num+1;
+	w->vscroll.count = _fios_num + 1;
 
 	WP(w, network_ql_d).q.afilter = CS_ALPHANUMERAL;
 	InitializeTextBuffer(&WP(w, network_ql_d).q.text, _edit_str_buf, lengthof(_edit_str_buf), 160);
@@ -914,7 +914,7 @@
 			SetDParamStr(0, _network_player_info[nd->company].players);
 			DrawStringTruncated(x, y, STR_NETWORK_PLAYERS, 2, trunc_width); // players
 		}
-	}	break;
+	} break;
 
 	case WE_CLICK:
 		switch (e->we.click.widget) {
@@ -929,7 +929,7 @@
 			id_v += w->vscroll.pos;
 			nd->company = (id_v >= nd->server->info.companies_on) ? INVALID_PLAYER : NetworkLobbyFindCompanyIndex(id_v);
 			SetWindowDirty(w);
-		}	break;
+		} break;
 		case 7: /* Join company */
 			if (nd->company != (byte)-1) {
 				_network_playas = nd->company;
@@ -948,7 +948,7 @@
 			NetworkTCPQueryServer(_network_last_host, _network_last_port); // company info
 			NetworkUDPQueryServer(_network_last_host, _network_last_port); // general data
 			break;
-		}	break;
+		} break;
 
 	case WE_MESSAGE:
 		SetWindowDirty(w);
@@ -1265,7 +1265,7 @@
 
 			DoDrawString(_clientlist_action[i], 4, y, colour);
 		}
-	}	break;
+	} break;
 
 	case WE_POPUPMENU_SELECT: {
 		// We selected an action
@@ -1275,7 +1275,7 @@
 			HandleClientListPopupClick(index, WP(w,menu_d).main_button);
 
 		DeleteWindowById(WC_TOOLBAR_MENU, 0);
-	}	break;
+	} break;
 
 	case WE_POPUPMENU_OVER: {
 		// Our mouse hoovers over an action? Select it!
@@ -1327,7 +1327,7 @@
 
 			y += CLNWND_ROWSIZE;
 		}
-	}	break;
+	} break;
 
 	case WE_CLICK:
 		// Show the popup with option
@@ -1420,7 +1420,7 @@
 
 		/* Draw nice progress bar :) */
 		DrawFrameRect(20, 18, (int)((w->width - 20) * progress / 100), 28, 10, FR_NONE);
-	}	break;
+	} break;
 
 	case WE_CLICK:
 		switch (e->we.click.widget) {
--- a/src/network/network_udp.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/network/network_udp.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -240,7 +240,7 @@
 		/* The name could be an empty string, if so take the filename */
 		ttd_strlcpy(name, (in_reply[i]->name != NULL && !StrEmpty(in_reply[i]->name)) ?
 				in_reply[i]->name : in_reply[i]->filename, sizeof(name));
-	 	this->Send_GRFIdentifier(&packet, in_reply[i]);
+		this->Send_GRFIdentifier(&packet, in_reply[i]);
 		packet.Send_string(name);
 	}
 
--- a/src/newgrf.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/newgrf.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -1372,7 +1372,7 @@
 		case 0x17: // Four random colours to use
 			FOR_EACH_OBJECT {
 				uint j;
-				for (j = 0; j < 4; j++)	housespec[i]->random_colour[j] = grf_load_byte(&buf);
+				for (j = 0; j < 4; j++) housespec[i]->random_colour[j] = grf_load_byte(&buf);
 			}
 			break;
 
@@ -1523,7 +1523,7 @@
 				uint32 tempfix = grf_load_dword(&buf);
 
 				if (curidx < NUM_CURRENCY) {
-					memcpy(&_currency_specs[curidx].suffix,&tempfix,4);
+					memcpy(&_currency_specs[curidx].suffix, &tempfix, 4);
 					_currency_specs[curidx].suffix[4] = 0;
 				} else {
 					grfmsg(1, "GlobalVarChangeInfo: Currency symbol %d out of range, ignoring", curidx);
@@ -2796,7 +2796,7 @@
 				case GSF_CANAL :
 				case GSF_BRIDGE :
 					AddGRFString(_cur_spriteid, id, lang, name);
-					switch (GB(id, 8,8)) {
+					switch (GB(id, 8, 8)) {
 						case 0xC9: // House name
 						default:
 							grfmsg(7, "FeatureNewName: Unsupported ID (0x%04X)", id);
@@ -4104,16 +4104,17 @@
 	                   |                                        (0 << 0x0B)  // enhancedgui
 	                   |                                        (0 << 0x0C)  // newagerating
 	                   |       ((_patches.build_on_slopes ? 1 : 0) << 0x0D)  // buildonslopes
+	                   |         ((_patches.full_load_any ? 1 : 0) << 0x0E)  // fullloadany
 	                   |                                        (0 << 0x0F)  // planespeed
 	                   |                                        (0 << 0x10)  // moreindustriesperclimate - obsolete
 	                   |                                        (0 << 0x11)  // moretoylandfeatures
 	                   |                                        (1 << 0x12)  // newstations
 	                   |                                        (0 << 0x13)  // tracktypecostdiff
-	                   |                                        (0 << 0x14)  // manualconvert
+	                   |                                        (1 << 0x14)  // manualconvert
 	                   |       ((_patches.build_on_slopes ? 1 : 0) << 0x15)  // buildoncoasts
 	                   |                                        (1 << 0x16)  // canals
 	                   |                                        (1 << 0x17)  // newstartyear
-	                   |                                        (0 << 0x18)  // freighttrains
+	                   |    ((_patches.freight_trains > 1 ? 1 : 0) << 0x18)  // freighttrains
 	                   |                                        (1 << 0x19)  // newhouses
 	                   |                                        (1 << 0x1A)  // newbridges
 	                   |                                        (0 << 0x1B)  // newtownnames
@@ -4145,7 +4146,8 @@
 	                   |                                        (0 << 0x14)  // trams
 	                   |                                        (0 << 0x15)  // enhancetunnels
 	                   |                                        (0 << 0x16)  // shortrvs
-	                   |                                        (0 << 0x17); // articulatedrvs
+	                   |                                        (0 << 0x17)  // articulatedrvs
+	                   |                                        (1 << 0x1E); // variablerunningcosts
 }
 
 static void ResetCustomStations()
--- a/src/newgrf_callbacks.h	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/newgrf_callbacks.h	Wed Jun 13 11:17:30 2007 +0000
@@ -133,6 +133,10 @@
 	/* Called monthly on production changes, so it can be adjusted more frequently */
 	CBID_INDUSTRY_MONTHLYPROD_CHANGE= 0x35, // not yet implemented
 
+	/* Called to modify various vehicle properties. Callback parameter 1
+	 * specifies the property index, as used in Action 0, to change. */
+	CBID_VEHICLE_MODIFY_PROPERTY    = 0x36,
+
 	/* Called to determine text to display after cargo name */
 	CBID_INDUSTRY_CARGO_SUFFIX      = 0x37, // not yet implemented
 
--- a/src/newgrf_engine.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/newgrf_engine.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -935,6 +935,17 @@
 	return group->g.callback.result;
 }
 
+
+/* Callback 36 handler */
+uint GetVehicleProperty(const Vehicle *v, uint8 property, uint orig_value)
+{
+	uint16 callback = GetVehicleCallback(CBID_VEHICLE_MODIFY_PROPERTY, property, 0, v->engine_type, v);
+	if (callback != CALLBACK_FAILED) return callback;
+
+	return orig_value;
+}
+
+
 static void DoTriggerVehicle(Vehicle *v, VehicleTrigger trigger, byte base_random_bits, bool first)
 {
 	const SpriteGroup *group;
--- a/src/newgrf_engine.h	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/newgrf_engine.h	Wed Jun 13 11:17:30 2007 +0000
@@ -35,6 +35,10 @@
 #define GetCustomVehicleSprite(v, direction) GetCustomEngineSprite(v->engine_type, v, direction)
 #define GetCustomVehicleIcon(et, direction) GetCustomEngineSprite(et, NULL, direction)
 
+/* Handler to Evaluate callback 36. If the callback fails (i.e. most of the
+ * time) orig_value is returned */
+uint GetVehicleProperty(const Vehicle *v, uint8 property, uint orig_value);
+
 enum VehicleTrigger {
 	VEHICLE_TRIGGER_NEW_CARGO     = 1,
 	/* Externally triggered only for the first vehicle in chain */
--- a/src/news.h	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/news.h	Wed Jun 13 11:17:30 2007 +0000
@@ -24,7 +24,7 @@
 typedef void DrawNewsCallbackProc(Window *w);
 typedef StringID GetNewsStringCallbackProc(const NewsItem *ni);
 
-#define NEWS_FLAGS(mode,flag,type,cb) ((cb)<<24 | (type)<<16 | (flag)<<8 | (mode))
+#define NEWS_FLAGS(mode, flag, type, cb) ((cb) << 24 | (type) << 16 | (flag) << 8 | (mode))
 void AddNewsItem(StringID string, uint32 flags, uint data_a, uint data_b);
 void NewsLoop();
 void DrawNewsBorder(const Window *w);
--- a/src/oldloader.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/oldloader.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -150,7 +150,7 @@
 	/* Old savegames have a nice compression algorithm (RLE)
 	which means that we have a chunk, which starts with a length
 	byte. If that byte is negative, we have to repeat the next byte
-	that many times (+1). Else, we need to read that amount of bytes.
+	that many times ( + 1). Else, we need to read that amount of bytes.
 	Works pretty good if you have many zero's behind eachother */
 
 	if (ls->chunk_size == 0) {
@@ -434,7 +434,7 @@
 	OCL_SVAR( OC_UINT16, Town, ratings[7] ),
 
 	/* XXX - This is pretty odd.. we read 32bit, but only write 8bit.. sure there is
-	nothing changed?? */
+	nothing changed ? ? */
 	OCL_SVAR( OC_FILE_U32 | OC_VAR_U8, Town, have_ratings ),
 	OCL_SVAR( OC_FILE_U32 | OC_VAR_U8, Town, statues ),
 	OCL_SVAR( OC_UINT16, Town, num_houses ),
@@ -1221,8 +1221,8 @@
 
 static const OldChunks sign_chunk[] = {
 	OCL_SVAR( OC_UINT16, Sign, str ),
-	OCL_SVAR( OC_FILE_U16 | OC_VAR_I32,Sign, x ),
-	OCL_SVAR( OC_FILE_U16 | OC_VAR_I32,Sign, y ),
+	OCL_SVAR( OC_FILE_U16 | OC_VAR_I32, Sign, x ),
+	OCL_SVAR( OC_FILE_U16 | OC_VAR_I32, Sign, y ),
 	OCL_SVAR( OC_FILE_U16 | OC_VAR_I8, Sign, z ),
 
 	OCL_NULL( 6 ),         ///< Width of sign, no longer in use
--- a/src/openttd.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/openttd.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -348,7 +348,7 @@
 	int i;
 	const char *optformat;
 	char musicdriver[32], sounddriver[32], videodriver[32];
-	int resolution[2] = {0,0};
+	int resolution[2] = {0, 0};
 	Year startyear = INVALID_YEAR;
 	uint generation_seed = GENERATE_NEW_SEED;
 	bool save_config = true;
@@ -379,7 +379,7 @@
 #endif
 	;
 
-	MyGetOptData mgo(argc-1, argv+1, optformat);
+	MyGetOptData mgo(argc - 1, argv + 1, optformat);
 
 	while ((i = MyGetOpt(&mgo)) != -1) {
 		switch (i) {
@@ -1927,6 +1927,18 @@
 	}
 
 	if (CheckSavegameVersion(57)) {
+		Vehicle *v;
+		/* Added a FIFO queue of vehicles loading at stations */
+		FOR_ALL_VEHICLES(v) {
+			if ((v->type != VEH_TRAIN || IsFrontEngine(v)) &&  // for all locs
+					!(v->vehstatus & (VS_STOPPED | VS_CRASHED)) && // not stopped or crashed
+					v->current_order.type == OT_LOADING) {         // loading
+				GetStation(v->last_station_visited)->loading_vehicles.push_back(v);
+			}
+		}
+	}
+
+	if (CheckSavegameVersion(58)) {
 		Town *t;
 		FOR_ALL_TOWNS(t) t->SetActivity(1);
 	}
--- a/src/order_gui.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/order_gui.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -478,7 +478,7 @@
 			if (sel == WP(w,order_d).sel) sel = -1;
 			WP(w,order_d).sel = sel;
 			SetWindowDirty(w);
-		}	break;
+		} break;
 
 		case ORDER_WIDGET_SKIP:
 			OrderClick_Skip(w, v);
--- a/src/os2.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/os2.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -222,7 +222,7 @@
 void CSleep(int milliseconds)
 {
 #ifndef __INNOTEK_LIBC__
- 	delay(milliseconds);
+	delay(milliseconds);
 #else
 	usleep(milliseconds * 1000);
 #endif
--- a/src/pathfind.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/pathfind.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -821,7 +821,7 @@
 			}
 
 			/* If we reach here, the tile has exactly one track, and this
-			 track is reachable => Rail segment continues */
+			 track is reachable = > Rail segment continues */
 
 			track = _new_trackdir[FIND_FIRST_BIT(bits)][direction];
 			assert(track != INVALID_TRACKDIR);
--- a/src/player_gui.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/player_gui.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -29,7 +29,7 @@
 
 static void DrawPlayerEconomyStats(const Player *p, byte mode)
 {
-	int x,y,i,j,year;
+	int x, y, i, j, year;
 	const int64 (*tbl)[13];
 	int64 sum, cost;
 	StringID str;
@@ -38,8 +38,8 @@
 		/* draw categories */
 		DrawStringCenterUnderline(61, 15, STR_700F_EXPENDITURE_INCOME, 0);
 		for (i = 0; i != 13; i++)
-			DrawString(2, 27 + i*10, STR_7011_CONSTRUCTION + i, 0);
-		DrawStringRightAligned(111, 27 + 10*13 + 2, STR_7020_TOTAL, 0);
+			DrawString(2, 27 + i * 10, STR_7011_CONSTRUCTION + i, 0);
+		DrawStringRightAligned(111, 27 + 10 * 13 + 2, STR_7020_TOTAL, 0);
 
 		/* draw the price columns */
 		year = _cur_year - 2;
@@ -60,16 +60,16 @@
 						str = STR_701E;
 						if (cost < 0) { cost = -cost; str++; }
 						SetDParam64(0, cost);
-						DrawStringRightAligned(x, 27+i*10, str, 0);
+						DrawStringRightAligned(x, 27 + i * 10, str, 0);
 					}
 				}
 
 				str = STR_701E;
 				if (sum < 0) { sum = -sum; str++; }
 				SetDParam64(0, sum);
-				DrawStringRightAligned(x, 27 + 13*10 + 2, str, 0);
+				DrawStringRightAligned(x, 27 + 13 * 10 + 2, str, 0);
 
-				GfxFillRect(x - 75, 27 + 10*13, x, 27 + 10*13, 215);
+				GfxFillRect(x - 75, 27 + 10 * 13, x, 27 + 10 * 13, 215);
 				x += 95;
 			}
 			year++;
@@ -80,7 +80,7 @@
 
 		/* draw max loan aligned to loan below (y += 10) */
 		SetDParam64(0, (uint64)_economy.max_loan);
-		DrawString(202, y+10, STR_MAX_LOAN, 0);
+		DrawString(202, y + 10, STR_MAX_LOAN, 0);
 	} else {
 		y = 15;
 	}
@@ -97,7 +97,7 @@
 
 	y += 12;
 
-	GfxFillRect(182 - 75, y-2, 182, y-2, 215);
+	GfxFillRect(182 - 75, y - 2, 182, y - 2, 215);
 
 	SetDParam64(0, p->money64 - p->current_loan);
 	DrawStringRightAligned(182, y, STR_7028, 0);
@@ -166,13 +166,13 @@
 		SetDParam(4, 10000);
 		DrawWindowWidgets(w);
 
-		DrawPlayerEconomyStats(p, (byte)WP(w,def_d).data_1);
+		DrawPlayerEconomyStats(p, (byte)WP(w, def_d).data_1);
 	} break;
 
 	case WE_CLICK:
 		switch (e->we.click.widget) {
 		case 2: {/* toggle size */
-			byte mode = (byte)WP(w,def_d).data_1;
+			byte mode = (byte)WP(w, def_d).data_1;
 			bool stickied = !!(w->flags4 & WF_STICKY);
 			PlayerID player = (PlayerID)w->window_number;
 			DeleteWindow(w);
@@ -239,7 +239,7 @@
 	w = AllocateWindowDescFront(desc_table[mode], player);
 	if (w != NULL) {
 		w->caption_color = w->window_number;
-		WP(w,def_d).data_1 = mode;
+		WP(w, def_d).data_1 = mode;
 		if (show_stickied) w->flags4 |= WF_STICKY;
 	}
 }
@@ -554,14 +554,14 @@
 		LowerWindowWidget(w, WP(w, facesel_d).gender + 5);
 		DrawWindowWidgets(w);
 		p = GetPlayer((PlayerID)w->window_number);
-		DrawPlayerFace(WP(w,facesel_d).face, p->player_color, 2, 16);
+		DrawPlayerFace(WP(w, facesel_d).face, p->player_color, 2, 16);
 	} break;
 
 	case WE_CLICK:
 		switch (e->we.click.widget) {
 		case 3: DeleteWindow(w); break;
 		case 4: /* ok click */
-			DoCommandP(0, 0, WP(w,facesel_d).face, NULL, CMD_SET_PLAYER_FACE);
+			DoCommandP(0, 0, WP(w, facesel_d).face, NULL, CMD_SET_PLAYER_FACE);
 			DeleteWindow(w);
 			break;
 		case 5: /* male click */
@@ -572,7 +572,7 @@
 			SetWindowDirty(w);
 			break;
 		case 7:
-			WP(w,facesel_d).face = ConvertFromOldPlayerFace((WP(w, facesel_d).gender << 31) + GB(InteractiveRandom(), 0, 31));
+			WP(w, facesel_d).face = ConvertFromOldPlayerFace((WP(w, facesel_d).gender << 31) + GB(InteractiveRandom(), 0, 31));
 			SetWindowDirty(w);
 			break;
 		}
@@ -656,8 +656,8 @@
 		}
 	}
 
-	if (train+road+air+ship == 0) {
-		DrawString(x+70, y, STR_7042_NONE, 0);
+	if (train + road + air + ship == 0) {
+		DrawString(x + 70, y, STR_7042_NONE, 0);
 	} else {
 		if (train != 0) {
 			SetDParam(0, train);
@@ -762,7 +762,7 @@
 
 			DrawPlayerVehiclesAmount((PlayerID)w->window_number);
 
-			DrawString(110,48, STR_7006_COLOR_SCHEME, 0);
+			DrawString(110, 48, STR_7006_COLOR_SCHEME, 0);
 			/* Draw company-colour bus */
 			DrawSprite(SPR_VEH_BUS_SW_VIEW, PLAYER_SPRITE_COLOR(p->index), 215, 49);
 
@@ -786,8 +786,8 @@
 					Window *wf = AllocateWindowDescFront(&_select_player_face_desc, w->window_number);
 					if (wf != NULL) {
 						wf->caption_color = w->window_number;
-						WP(wf,facesel_d).face = GetPlayer((PlayerID)wf->window_number)->face;
-						WP(wf,facesel_d).gender = 0;
+						WP(wf, facesel_d).face = GetPlayer((PlayerID)wf->window_number)->face;
+						WP(wf, facesel_d).gender = 0;
 					}
 					break;
 				}
@@ -796,8 +796,8 @@
 					Window *wf = AllocateWindowDescFront(_have_2cc ? &_select_player_livery_2cc_desc : &_select_player_livery_desc, w->window_number);
 					if (wf != NULL) {
 						wf->caption_color = wf->window_number;
-						WP(wf,livery_d).livery_class = LC_OTHER;
-						WP(wf,livery_d).sel = 1;
+						WP(wf, livery_d).livery_class = LC_OTHER;
+						WP(wf, livery_d).sel = 1;
 						LowerWindowWidget(wf, 2);
 					}
 					break;
@@ -813,7 +813,7 @@
 
 				case PCW_WIDGET_COMPANY_NAME: {
 					Player *p = GetPlayer((PlayerID)w->window_number);
-					WP(w,def_d).byte_1 = 1;
+					WP(w, def_d).byte_1 = 1;
 					SetDParam(0, p->name_2);
 					ShowQueryString(p->name_1, STR_700A_COMPANY_NAME, 31, 150, w, CS_ALPHANUMERAL);
 					break;
@@ -852,7 +852,7 @@
 				#ifdef ENABLE_NETWORK
 				case PCW_WIDGET_COMPANY_PASSWORD:
 					if (w->window_number == _local_player) {
-						WP(w,def_d).byte_1 = 2;
+						WP(w, def_d).byte_1 = 2;
 						ShowQueryString(BindCString(_network_player_info[_local_player].password),
 							STR_SET_COMPANY_PASSWORD, sizeof(_network_player_info[_local_player].password), 250, w, CS_ALPHANUMERAL);
 					}
@@ -885,10 +885,10 @@
 			char *b = e->we.edittext.str;
 
 			/* empty string is allowed for password */
-			if (*b == '\0' && WP(w,def_d).byte_1 != 2) return;
+			if (*b == '\0' && WP(w, def_d).byte_1 != 2) return;
 
 			_cmd_text = b;
-			switch (WP(w,def_d).byte_1) {
+			switch (WP(w, def_d).byte_1) {
 				case 0: /* Change president name */
 					DoCommandP(0, 0, 0, NULL, CMD_CHANGE_PRESIDENT_NAME | CMD_MSG(STR_700D_CAN_T_CHANGE_PRESIDENT));
 					break;
--- a/src/rail.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/rail.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -68,8 +68,8 @@
 /* Maps a trackdir to the (4-way) direction the tile is exited when following
  * that trackdir */
 extern const DiagDirection _trackdir_to_exitdir[] = {
-	DIAGDIR_NE,DIAGDIR_SE,DIAGDIR_NE,DIAGDIR_SE,DIAGDIR_SW,DIAGDIR_SE, DIAGDIR_NE,DIAGDIR_NE,
-	DIAGDIR_SW,DIAGDIR_NW,DIAGDIR_NW,DIAGDIR_SW,DIAGDIR_NW,DIAGDIR_NE,
+	DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_SW, DIAGDIR_SE, DIAGDIR_NE, DIAGDIR_NE,
+	DIAGDIR_SW, DIAGDIR_NW, DIAGDIR_NW, DIAGDIR_SW, DIAGDIR_NW, DIAGDIR_NE,
 };
 
 extern const Trackdir _track_exitdir_to_trackdir[][DIAGDIR_END] = {
--- a/src/road_cmd.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/road_cmd.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -60,10 +60,10 @@
 	/* Get a bitmask of which neighbouring roads has a tile */
 	n = ROAD_NONE;
 	present = GetAnyRoadBits(tile);
-	if (present & ROAD_NE && GetAnyRoadBits(TILE_ADDXY(tile,-1, 0)) & ROAD_SW) n |= ROAD_NE;
+	if (present & ROAD_NE && GetAnyRoadBits(TILE_ADDXY(tile, -1, 0)) & ROAD_SW) n |= ROAD_NE;
 	if (present & ROAD_SE && GetAnyRoadBits(TILE_ADDXY(tile, 0, 1)) & ROAD_NW) n |= ROAD_SE;
 	if (present & ROAD_SW && GetAnyRoadBits(TILE_ADDXY(tile, 1, 0)) & ROAD_NE) n |= ROAD_SW;
-	if (present & ROAD_NW && GetAnyRoadBits(TILE_ADDXY(tile, 0,-1)) & ROAD_SE) n |= ROAD_NW;
+	if (present & ROAD_NW && GetAnyRoadBits(TILE_ADDXY(tile, 0, -1)) & ROAD_SE) n |= ROAD_NW;
 
 	/* If 0 or 1 bits are set in n, or if no bits that match the bits to remove,
 	 * then allow it */
@@ -435,7 +435,7 @@
 		TileIndex t = start_tile;
 		start_tile = end_tile;
 		end_tile = t;
-		p2 ^= IS_INT_INSIDE(p2&3, 1, 3) ? 3 : 0;
+		p2 ^= IS_INT_INSIDE(p2 & 3, 1, 3) ? 3 : 0;
 	}
 
 	cost = 0;
--- a/src/road_gui.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/road_gui.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -227,7 +227,7 @@
 
 	case WE_CLICK: {
 		if (e->we.click.widget >= 3) _build_road_button_proc[e->we.click.widget - 3](w);
-	}	break;
+	} break;
 
 	case WE_KEYPRESS:
 		switch (e->we.keypress.keycode) {
@@ -257,11 +257,11 @@
 		InvalidateWidget(w, RTW_REMOVE);
 
 		w = FindWindowById(WC_BUS_STATION, 0);
-		if (w != NULL) WP(w,def_d).close = true;
+		if (w != NULL) WP(w, def_d).close = true;
 		w = FindWindowById(WC_TRUCK_STATION, 0);
-		if (w != NULL) WP(w,def_d).close = true;
+		if (w != NULL) WP(w, def_d).close = true;
 		w = FindWindowById(WC_BUILD_DEPOT, 0);
-		if (w != NULL) WP(w,def_d).close = true;
+		if (w != NULL) WP(w, def_d).close = true;
 		break;
 
 	case WE_PLACE_DRAG: {
@@ -411,14 +411,14 @@
 			SetWindowDirty(w);
 			break;
 		}
-	}	break;
+	} break;
 
 	case WE_MOUSELOOP:
-		if (WP(w,def_d).close) DeleteWindow(w);
+		if (WP(w, def_d).close) DeleteWindow(w);
 		break;
 
 	case WE_DESTROY:
-		if (!WP(w,def_d).close) ResetObjectToPlace();
+		if (!WP(w, def_d).close) ResetObjectToPlace();
 		break;
 	}
 }
@@ -458,7 +458,7 @@
 	case WE_PAINT: {
 		int image;
 
-		if (WP(w,def_d).close) return;
+		if (WP(w, def_d).close) return;
 
 		DrawWindowWidgets(w);
 
@@ -472,9 +472,9 @@
 		image = (w->window_class == WC_BUS_STATION) ? GFX_BUS_BASE : GFX_TRUCK_BASE;
 
 		StationPickerDrawSprite(103, 35, RAILTYPE_BEGIN, image);
-		StationPickerDrawSprite(103, 85, RAILTYPE_BEGIN, image+1);
-		StationPickerDrawSprite(35, 85, RAILTYPE_BEGIN, image+2);
-		StationPickerDrawSprite(35, 35, RAILTYPE_BEGIN, image+3);
+		StationPickerDrawSprite(103, 85, RAILTYPE_BEGIN, image + 1);
+		StationPickerDrawSprite(35, 85, RAILTYPE_BEGIN, image + 2);
+		StationPickerDrawSprite(35, 35, RAILTYPE_BEGIN, image + 3);
 
 		image = (w->window_class == WC_BUS_STATION) ? GFX_BUS_BASE_EXT : GFX_TRUCK_BASE_EXT;
 
@@ -482,7 +482,7 @@
 		StationPickerDrawSprite(171, 85, RAILTYPE_BEGIN, image + 1);
 
 		DrawStationCoverageAreaText(2, 146,
-			((w->window_class == WC_BUS_STATION) ? (1<<CT_PASSENGERS) : ~(1<<CT_PASSENGERS)),
+			((w->window_class == WC_BUS_STATION) ? (1 << CT_PASSENGERS) : ~(1 << CT_PASSENGERS)),
 			3);
 
 	} break;
@@ -507,7 +507,7 @@
 	} break;
 
 	case WE_MOUSELOOP: {
-		if (WP(w,def_d).close) {
+		if (WP(w, def_d).close) {
 			DeleteWindow(w);
 			return;
 		}
@@ -516,7 +516,7 @@
 	} break;
 
 	case WE_DESTROY:
-		if (!WP(w,def_d).close) ResetObjectToPlace();
+		if (!WP(w, def_d).close) ResetObjectToPlace();
 		break;
 	}
 }
--- a/src/roadveh_cmd.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/roadveh_cmd.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -168,11 +168,11 @@
 		y = TileY(tile) * TILE_SIZE + TILE_SIZE / 2;
 		v->x_pos = x;
 		v->y_pos = y;
-		v->z_pos = GetSlopeZ(x,y);
+		v->z_pos = GetSlopeZ(x, y);
 		v->z_height = 6;
 
 		v->u.road.state = RVSB_IN_DEPOT;
-		v->vehstatus = VS_HIDDEN|VS_STOPPED|VS_DEFPAL;
+		v->vehstatus = VS_HIDDEN | VS_STOPPED | VS_DEFPAL;
 
 		v->spritenum = rvi->image_index;
 		v->cargo_type = rvi->cargo_type;
@@ -436,6 +436,8 @@
 	if (dep == NULL) return_cmd_error(STR_9019_UNABLE_TO_FIND_LOCAL_DEPOT);
 
 	if (flags & DC_EXEC) {
+		if (v->current_order.type == OT_LOADING) v->LeaveStation();
+
 		ClearSlot(v);
 		v->current_order.type = OT_GOTO_DEPOT;
 		v->current_order.flags = OF_NON_STOP;
--- a/src/saveload.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/saveload.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -27,8 +27,9 @@
 #include "network/network.h"
 #include "variables.h"
 #include <setjmp.h>
+#include <list>
 
-extern const uint16 SAVEGAME_VERSION = 57;
+extern const uint16 SAVEGAME_VERSION = 58;
 uint16 _sl_version;       ///< the major savegame version identifier
 byte   _sl_minor_version; ///< the minor savegame version, DO NOT USE!
 
@@ -251,14 +252,14 @@
 		if (i >= (1 << 14)) {
 			if (i >= (1 << 21)) {
 				assert(i < (1 << 28));
-				SlWriteByte((byte)0xE0 | (i>>24));
-				SlWriteByte((byte)(i>>16));
+				SlWriteByte((byte)0xE0 | (i >> 24));
+				SlWriteByte((byte)(i >> 16));
 			} else {
-				SlWriteByte((byte)0xC0 | (i>>16));
+				SlWriteByte((byte)0xC0 | (i >> 16));
 			}
-			SlWriteByte((byte)(i>>8));
+			SlWriteByte((byte)(i >> 8));
 		} else {
-			SlWriteByte((byte)(0x80 | (i>>8)));
+			SlWriteByte((byte)(0x80 | (i >> 8)));
 		}
 	}
 	SlWriteByte(i);
@@ -627,6 +628,61 @@
 	}
 }
 
+
+static uint ReferenceToInt(const void* obj, SLRefType rt);
+static void* IntToReference(uint index, SLRefType rt);
+
+
+/**
+ * Return the size in bytes of a list
+ * @param list The std::list to find the size of
+ */
+static inline size_t SlCalcListLen(const void *list)
+{
+	std::list<void *> *l = (std::list<void *> *) list;
+
+	/* Each entry is saved as 2 bytes, plus 2 bytes are used for the length
+	 * of the list */
+	return l->size() * 2 + 2;
+}
+
+
+/**
+ * Save/Load a list.
+ * @param list The list being manipulated
+ * @param conv SLRefType type of the list (Vehicle *, Station *, etc)
+ */
+void SlList(void *list, SLRefType conv)
+{
+	/* Automatically calculate the length? */
+	if (_sl.need_length != NL_NONE) {
+		SlSetLength(SlCalcListLen(list));
+		/* Determine length only? */
+		if (_sl.need_length == NL_CALCLENGTH) return;
+	}
+
+	std::list<void *> *l = (std::list<void *> *) list;
+
+	if (_sl.save) {
+		SlWriteUint16(l->size());
+
+		std::list<void *>::iterator iter;
+		for (iter = l->begin(); iter != l->end(); ++iter) {
+			void *ptr = *iter;
+			SlWriteUint16(ReferenceToInt(ptr, conv));
+		}
+	} else {
+		uint length = SlReadUint16();
+
+		/* Load each reference and push to the end of the list */
+		for (uint i = 0; i < length; i++) {
+			void *ptr = IntToReference(SlReadUint16(), conv);
+			l->push_back(ptr);
+		}
+	}
+}
+
+
 /** Are we going to save this object or not? */
 static inline bool SlIsObjectValidInSavegame(const SaveLoad *sld)
 {
@@ -675,6 +731,7 @@
 		case SL_REF:
 		case SL_ARR:
 		case SL_STR:
+		case SL_LST:
 			/* CONDITIONAL saveload types depend on the savegame version */
 			if (!SlIsObjectValidInSavegame(sld)) break;
 
@@ -683,6 +740,7 @@
 			case SL_REF: return SlCalcRefLen();
 			case SL_ARR: return SlCalcArrayLen(sld->length, sld->conv);
 			case SL_STR: return SlCalcStringLen(GetVariableAddress(object, sld), sld->length, sld->conv);
+			case SL_LST: return SlCalcListLen(GetVariableAddress(object, sld));
 			default: NOT_REACHED();
 			}
 			break;
@@ -694,10 +752,6 @@
 }
 
 
-static uint ReferenceToInt(const void* obj, SLRefType rt);
-static void* IntToReference(uint index, SLRefType rt);
-
-
 bool SlObjectMember(void *ptr, const SaveLoad *sld)
 {
 	VarType conv = GB(sld->conv, 0, 8);
@@ -706,6 +760,7 @@
 	case SL_REF:
 	case SL_ARR:
 	case SL_STR:
+	case SL_LST:
 		/* CONDITIONAL saveload types depend on the savegame version */
 		if (!SlIsObjectValidInSavegame(sld)) return false;
 		if (SlSkipVariableOnLoad(sld)) return false;
@@ -722,6 +777,7 @@
 			break;
 		case SL_ARR: SlArray(ptr, sld->length, conv); break;
 		case SL_STR: SlString(ptr, sld->length, conv); break;
+		case SL_LST: SlList(ptr, (SLRefType)conv); break;
 		default: NOT_REACHED();
 		}
 		break;
@@ -925,7 +981,7 @@
 {
 	const ChunkHandler *ch;
 	const ChunkHandler *const *chsc;
-	for (chsc = _sl.chs; (ch=*chsc++) != NULL;) {
+	for (chsc = _sl.chs; (ch = *chsc++) != NULL;) {
 		for (;;) {
 			if (ch->id == id) return ch;
 			if (ch->flags & CH_LAST) break;
@@ -1030,7 +1086,7 @@
 static bool InitNoComp()
 {
 	_sl.bufsize = LZO_SIZE;
-	_sl.buf = _sl.buf_ori =(byte*)malloc(LZO_SIZE);
+	_sl.buf = _sl.buf_ori = (byte*)malloc(LZO_SIZE);
 	return true;
 }
 
--- a/src/saveload.h	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/saveload.h	Wed Jun 13 11:17:30 2007 +0000
@@ -159,6 +159,7 @@
 	SL_REF       =  1,
 	SL_ARR       =  2,
 	SL_STR       =  3,
+	SL_LST       =  4,
 	// non-normal save-load types
 	SL_WRITEBYTE =  8,
 	SL_INCLUDE   =  9,
@@ -190,11 +191,13 @@
 #define SLE_CONDREF(base, variable, type, from, to) SLE_GENERAL(SL_REF, base, variable, type, 0, from, to)
 #define SLE_CONDARR(base, variable, type, length, from, to) SLE_GENERAL(SL_ARR, base, variable, type, length, from, to)
 #define SLE_CONDSTR(base, variable, type, length, from, to) SLE_GENERAL(SL_STR, base, variable, type, length, from, to)
+#define SLE_CONDLST(base, variable, type, from, to) SLE_GENERAL(SL_LST, base, variable, type, 0, from, to)
 
 #define SLE_VAR(base, variable, type) SLE_CONDVAR(base, variable, type, 0, SL_MAX_VERSION)
 #define SLE_REF(base, variable, type) SLE_CONDREF(base, variable, type, 0, SL_MAX_VERSION)
 #define SLE_ARR(base, variable, type, length) SLE_CONDARR(base, variable, type, length, 0, SL_MAX_VERSION)
 #define SLE_STR(base, variable, type, length) SLE_CONDSTR(base, variable, type, length, 0, SL_MAX_VERSION)
+#define SLE_LST(base, variable, type) SLE_CONDLST(base, variable, type, 0, SL_MAX_VERSION)
 
 #define SLE_CONDNULL(length, from, to) SLE_CONDARR(NullStruct, null, SLE_FILE_U8 | SLE_VAR_NULL | SLF_CONFIG_NO, length, from, to)
 
@@ -224,11 +227,13 @@
 #define SLEG_CONDREF(variable, type, from, to) SLEG_GENERAL(SL_REF, variable, type, 0, from, to)
 #define SLEG_CONDARR(variable, type, length, from, to) SLEG_GENERAL(SL_ARR, variable, type, length, from, to)
 #define SLEG_CONDSTR(variable, type, length, from, to) SLEG_GENERAL(SL_STR, variable, type, length, from, to)
+#define SLEG_CONDLST(variable, type, from, to) SLEG_GENERAL(SL_LST, variable, type, 0, from, to)
 
 #define SLEG_VAR(variable, type) SLEG_CONDVAR(variable, type, 0, SL_MAX_VERSION)
 #define SLEG_REF(variable, type) SLEG_CONDREF(variable, type, 0, SL_MAX_VERSION)
 #define SLEG_ARR(variable, type) SLEG_CONDARR(variable, type, lengthof(variable), 0, SL_MAX_VERSION)
 #define SLEG_STR(variable, type) SLEG_CONDSTR(variable, type, lengthof(variable), 0, SL_MAX_VERSION)
+#define SLEG_LST(variable, type) SLEG_CONDLST(variable, type, 0, SL_MAX_VERSION)
 
 #define SLEG_CONDNULL(length, from, to) {SL_ARR, SLE_FILE_U8 | SLE_VAR_NULL | SLF_CONFIG_NO, length, from, to, (void*)NULL}
 
--- a/src/screenshot.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/screenshot.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -268,7 +268,7 @@
 	uint32 unused;
 	uint16 xmax, ymax;
 	uint16 hdpi, vdpi;
-	byte pal_small[16*3];
+	byte pal_small[16 * 3];
 	byte reserved;
 	byte planes;
 	uint16 pitch;
--- a/src/settings.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/settings.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -1140,15 +1140,15 @@
 	const Patches *ptc = (_game_mode == GM_MENU) ? &_patches_newgame : &_patches;
 
 	if (p1) {
-		warning = ( (IS_INT_INSIDE(ptc->servint_trains,   5, 90+1) || ptc->servint_trains   == 0) &&
-								(IS_INT_INSIDE(ptc->servint_roadveh,  5, 90+1) || ptc->servint_roadveh  == 0) &&
-								(IS_INT_INSIDE(ptc->servint_aircraft, 5, 90+1) || ptc->servint_aircraft == 0) &&
-								(IS_INT_INSIDE(ptc->servint_ships,    5, 90+1) || ptc->servint_ships    == 0) );
+		warning = ( (IS_INT_INSIDE(ptc->servint_trains,   5, 90 + 1) || ptc->servint_trains   == 0) &&
+								(IS_INT_INSIDE(ptc->servint_roadveh,  5, 90 + 1) || ptc->servint_roadveh  == 0) &&
+								(IS_INT_INSIDE(ptc->servint_aircraft, 5, 90 + 1) || ptc->servint_aircraft == 0) &&
+								(IS_INT_INSIDE(ptc->servint_ships,    5, 90 + 1) || ptc->servint_ships    == 0) );
 	} else {
-		warning = ( (IS_INT_INSIDE(ptc->servint_trains,   30, 800+1) || ptc->servint_trains   == 0) &&
-								(IS_INT_INSIDE(ptc->servint_roadveh,  30, 800+1) || ptc->servint_roadveh  == 0) &&
-								(IS_INT_INSIDE(ptc->servint_aircraft, 30, 800+1) || ptc->servint_aircraft == 0) &&
-								(IS_INT_INSIDE(ptc->servint_ships,    30, 800+1) || ptc->servint_ships    == 0) );
+		warning = ( (IS_INT_INSIDE(ptc->servint_trains,   30, 800 + 1) || ptc->servint_trains   == 0) &&
+								(IS_INT_INSIDE(ptc->servint_roadveh,  30, 800 + 1) || ptc->servint_roadveh  == 0) &&
+								(IS_INT_INSIDE(ptc->servint_aircraft, 30, 800 + 1) || ptc->servint_aircraft == 0) &&
+								(IS_INT_INSIDE(ptc->servint_ships,    30, 800 + 1) || ptc->servint_ships    == 0) );
 	}
 
 	if (!warning)
@@ -1281,7 +1281,7 @@
 	SDT_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, (SLE_FILE_I16 | SLE_VAR_I32), 0, 0, GameOptions, diff, 17, 0, 0, 0, 0, NULL, STR_NULL, NULL, NULL,  0, 3),
 	SDT_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, (SLE_FILE_I16 | SLE_VAR_I32), 0, 0, GameOptions, diff, 18, 0, 0, 0, 0, NULL, STR_NULL, NULL, NULL,  4, 53),
 	SDT_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, (SLE_FILE_I16 | SLE_VAR_I32), 0, 0, GameOptions, diff, 20, 0, 0, 0, 0, NULL, STR_NULL, NULL, NULL, 54, SL_MAX_VERSION),
-	    SDT_VAR(GameOptions, diff_level,SLE_UINT8, 0, 0, 0, 0,  3, 0, STR_NULL, NULL),
+	    SDT_VAR(GameOptions, diff_level, SLE_UINT8, 0, 0, 0, 0,  3, 0, STR_NULL, NULL),
 	  SDT_OMANY(GameOptions, currency,  SLE_UINT8, N, 0, 0, CUSTOM_CURRENCY_ID, "GBP|USD|EUR|YEN|ATS|BEF|CHF|CZK|DEM|DKK|ESP|FIM|FRF|GRD|HUF|ISK|ITL|NLG|NOK|PLN|ROL|RUR|SIT|SEK|YTL|SKK|BRR|custom", STR_NULL, NULL, NULL),
 	  SDT_OMANY(GameOptions, units,     SLE_UINT8, N, 0, 1,     2, "imperial|metric|si", STR_NULL, NULL, NULL),
 	  SDT_OMANY(GameOptions, town_name, SLE_UINT8, 0, 0, 0,    20, "english|french|german|american|latin|silly|swedish|dutch|finnish|polish|slovakish|norwegian|hungarian|austrian|romanian|czech|swiss|danish|turkish|italian|catalan", STR_NULL, NULL, NULL),
@@ -1528,7 +1528,7 @@
 static const SettingDesc _currency_settings[] = {
 	SDT_VAR(CurrencySpec, rate,    SLE_UINT16, S, 0,  1, 0, 100, 0, STR_NULL, NULL),
 	SDT_CHR(CurrencySpec, separator,           S, 0,        ".",    STR_NULL, NULL),
-	SDT_VAR(CurrencySpec, to_euro,  SLE_INT32, S, 0,  0, 0,3000, 0, STR_NULL, NULL),
+	SDT_VAR(CurrencySpec, to_euro,  SLE_INT32, S, 0,  0, 0, 3000, 0, STR_NULL, NULL),
 	SDT_STR(CurrencySpec, prefix,   SLE_STRBQ, S, 0,       NULL,    STR_NULL, NULL),
 	SDT_STR(CurrencySpec, suffix,   SLE_STRBQ, S, 0, " credits",    STR_NULL, NULL),
 	SDT_END()
--- a/src/settings_gui.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/settings_gui.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -115,7 +115,7 @@
 
 		DrawWindowWidgets(w);
 		DrawString(20, 175, STR_OPTIONS_FULLSCREEN, 0); // fullscreen
-	}	break;
+	} break;
 
 	case WE_CLICK:
 		switch (e->we.click.widget) {
@@ -502,7 +502,7 @@
 			SetDifficultyLevel(3, &_opt_mod_temp); // set difficulty level to custom
 			LowerWindowWidget(w, _opt_mod_temp.diff_level + 3);
 			SetWindowDirty(w);
-		}	break;
+		} break;
 		case 3: case 4: case 5: case 6: /* Easy / Medium / Hard / Custom */
 			// temporarily change difficulty level
 			RaiseWindowWidget(w, _opt_mod_temp.diff_level + 3);
--- a/src/ship_cmd.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/ship_cmd.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -406,7 +406,7 @@
 	uint spd;
 	byte t;
 
-	spd = min(v->cur_speed + 1, v->max_speed);
+	spd = min(v->cur_speed + 1, GetVehicleProperty(v, 0x0B, v->max_speed));
 
 	/*updates statusbar only if speed have changed to save CPU time */
 	if (spd != v->cur_speed) {
@@ -551,7 +551,7 @@
  * direction in which we are entering the tile */
 static Track ChooseShipTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks)
 {
-	assert(enterdir>=0 && enterdir<=3);
+	assert(enterdir >= 0 && enterdir <= 3);
 
 	if (_patches.yapf.ship_use_yapf) {
 		Trackdir trackdir = YapfChooseShipTrack(v, tile, enterdir, tracks);
@@ -654,11 +654,11 @@
 	},
 	{
 		{ 0, 0, 0},
-		{ 8,15, 7},
+		{ 8, 15, 7},
 		{ 0, 0, 0},
-		{ 8,15, 6},
+		{ 8, 15, 6},
 		{ 0, 0, 0},
-		{ 7,15, 0},
+		{ 7, 15, 0},
 	}
 };
 
@@ -880,7 +880,7 @@
 		y = TileY(tile) * TILE_SIZE + TILE_SIZE / 2;
 		v->x_pos = x;
 		v->y_pos = y;
-		v->z_pos = GetSlopeZ(x,y);
+		v->z_pos = GetSlopeZ(x, y);
 
 		v->z_height = 6;
 		v->sprite_width = 6;
@@ -1065,6 +1065,8 @@
 	if (dep == NULL) return_cmd_error(STR_981A_UNABLE_TO_FIND_LOCAL_DEPOT);
 
 	if (flags & DC_EXEC) {
+		if (v->current_order.type == OT_LOADING) v->LeaveStation();
+
 		v->dest_tile = dep->xy;
 		v->current_order.type = OT_GOTO_DEPOT;
 		v->current_order.flags = OF_NON_STOP;
--- a/src/ship_gui.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/ship_gui.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -78,7 +78,7 @@
 		{
 			SetDParam(0, v->service_interval);
 			SetDParam(1, v->date_of_last_service);
-			DrawString(13, 102, _patches.servint_ispercent?STR_SERVICING_INTERVAL_PERCENT:STR_883C_SERVICING_INTERVAL_DAYS, 0);
+			DrawString(13, 102, _patches.servint_ispercent ? STR_SERVICING_INTERVAL_PERCENT : STR_883C_SERVICING_INTERVAL_DAYS, 0);
 		}
 
 		DrawShipImage(v, 3, 57, INVALID_VEHICLE);
@@ -120,7 +120,7 @@
 			mod = _ctrl_pressed? 5 : 10;
 			goto do_change_service_int;
 		case 6: /* decrease int */
-			mod = _ctrl_pressed?- 5 : -10;
+			mod = _ctrl_pressed ? - 5 : -10;
 do_change_service_int:
 			v = GetVehicle(w->window_number);
 
@@ -157,7 +157,7 @@
 
 static const WindowDesc _ship_details_desc = {
 	WDP_AUTO, WDP_AUTO, 405, 113,
-	WC_VEHICLE_DETAILS,WC_VEHICLE_VIEW,
+	WC_VEHICLE_DETAILS, WC_VEHICLE_VIEW,
 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
 	_ship_details_widgets,
 	ShipDetailsWndProc
@@ -326,7 +326,7 @@
 { WWT_PUSHIMGBTN, RESIZE_LR,    14, 232, 249,  32,  49, SPR_SEND_SHIP_TODEPOT,   STR_982A_SEND_SHIP_TO_DEPOT},
 { WWT_PUSHIMGBTN, RESIZE_LR,    14, 232, 249,  50,  67, SPR_REFIT_VEHICLE,       STR_983A_REFIT_CARGO_SHIP_TO_CARRY},
 { WWT_PUSHIMGBTN, RESIZE_LR,    14, 232, 249,  68,  85, SPR_SHOW_ORDERS,         STR_9828_SHOW_SHIP_S_ORDERS},
-{ WWT_PUSHIMGBTN, RESIZE_LR,    14, 232, 249,  86, 103, SPR_SHOW_VEHICLE_DETAILS,STR_982B_SHOW_SHIP_DETAILS},
+{ WWT_PUSHIMGBTN, RESIZE_LR,    14, 232, 249,  86, 103, SPR_SHOW_VEHICLE_DETAILS, STR_982B_SHOW_SHIP_DETAILS},
 { WWT_PUSHIMGBTN, RESIZE_LR,    14, 232, 249,  32,  49, SPR_CLONE_SHIP,          STR_CLONE_SHIP_INFO},
 {      WWT_PANEL, RESIZE_LRB,   14, 232, 249, 104, 103, 0x0,                     STR_NULL },
 {  WWT_RESIZEBOX, RESIZE_LRTB,  14, 238, 249, 104, 115, 0x0,                     STR_NULL },
--- a/src/signs.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/signs.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -136,7 +136,7 @@
 		si->x = x;
 		si->y = y;
 		si->owner = _current_player; // owner of the sign; just eyecandy
-		si->z = GetSlopeZ(x,y);
+		si->z = GetSlopeZ(x, y);
 		UpdateSignVirtCoords(si);
 		MarkSignDirty(si);
 		InvalidateWindow(WC_SIGN_LIST, 0);
--- a/src/station.h	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/station.h	Wed Jun 13 11:17:30 2007 +0000
@@ -11,6 +11,7 @@
 #include "sprite.h"
 #include "tile.h"
 #include "newgrf_station.h"
+#include <list>
 
 static const StationID INVALID_STATION = 0xFFFF;
 static const byte INITIAL_STATION_RATING = 175;
@@ -157,6 +158,7 @@
 	StationID index;
 
 	byte last_vehicle_type;
+	std::list<Vehicle *> loading_vehicles;
 	GoodsEntry goods[NUM_CARGO];
 
 	uint16 random_bits;
--- a/src/station_cmd.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/station_cmd.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -199,7 +199,7 @@
 		Station *s;
 
 		FOR_ALL_STATIONS(s) {
-			if (s != st && s->town==t) {
+			if (s != st && s->town == t) {
 				uint str = M(s->string_id);
 				if (str <= 0x20) {
 					if (str == M(STR_SV_STNAME_FOREST))
@@ -230,7 +230,7 @@
 	}
 
 	/* check close enough to town to get central as name? */
-	if (DistanceMax(tile,t->xy) < 8) {
+	if (DistanceMax(tile, t->xy) < 8) {
 		found = M(STR_SV_STNAME);
 		if (HASBIT(free_names, M(STR_SV_STNAME))) goto done;
 
@@ -272,10 +272,10 @@
 	/* check direction compared to town */
 	{
 		static const int8 _direction_and_table[] = {
-			~( (1<<M(STR_SV_STNAME_WEST)) | (1<<M(STR_SV_STNAME_EAST)) | (1<<M(STR_SV_STNAME_NORTH)) ),
-			~( (1<<M(STR_SV_STNAME_SOUTH)) | (1<<M(STR_SV_STNAME_WEST)) | (1<<M(STR_SV_STNAME_NORTH)) ),
-			~( (1<<M(STR_SV_STNAME_SOUTH)) | (1<<M(STR_SV_STNAME_EAST)) | (1<<M(STR_SV_STNAME_NORTH)) ),
-			~( (1<<M(STR_SV_STNAME_SOUTH)) | (1<<M(STR_SV_STNAME_WEST)) | (1<<M(STR_SV_STNAME_EAST)) ),
+			~( (1 << M(STR_SV_STNAME_WEST)) | (1 << M(STR_SV_STNAME_EAST)) | (1 << M(STR_SV_STNAME_NORTH)) ),
+			~( (1 << M(STR_SV_STNAME_SOUTH)) | (1 << M(STR_SV_STNAME_WEST)) | (1 << M(STR_SV_STNAME_NORTH)) ),
+			~( (1 << M(STR_SV_STNAME_SOUTH)) | (1 << M(STR_SV_STNAME_EAST)) | (1 << M(STR_SV_STNAME_NORTH)) ),
+			~( (1 << M(STR_SV_STNAME_SOUTH)) | (1 << M(STR_SV_STNAME_WEST)) | (1 << M(STR_SV_STNAME_EAST)) ),
 		};
 
 		free_names &= _direction_and_table[
@@ -283,7 +283,7 @@
 			(TileY(tile) < TileY(t->xy)) * 2];
 	}
 
-	tmp = free_names & ((1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<6)|(1<<7)|(1<<12)|(1<<26)|(1<<27)|(1<<28)|(1<<29)|(1<<30));
+	tmp = free_names & ((1 << 1) | (1 << 2) | (1 << 3) | (1 << 4) | (1 << 6) | (1 << 7) | (1 << 12) | (1 << 26) | (1 << 27) | (1 << 28) | (1 << 29) | (1 << 30));
 	if (tmp == 0) {
 		_error_message = STR_3007_TOO_MANY_STATIONS_LOADING;
 		return false;
@@ -368,7 +368,7 @@
 	}
 
 	SetDParam(0, st->index);
-	AddNewsItem(msg, NEWS_FLAGS(NM_SMALL, NF_VIEWPORT|NF_TILE, NT_ACCEPTANCE, 0), st->xy, 0);
+	AddNewsItem(msg, NEWS_FLAGS(NM_SMALL, NF_VIEWPORT | NF_TILE, NT_ACCEPTANCE, 0), st->xy, 0);
 }
 
 // Get a list of the cargo types being produced around the tile.
@@ -646,10 +646,10 @@
 		int flat_z = z;
 		if (tileh != SLOPE_FLAT) {
 			// need to check so the entrance to the station is not pointing at a slope.
-			if ((invalid_dirs&1 && !(tileh & SLOPE_NE) && (uint)w_cur == w) ||
-					(invalid_dirs&2 && !(tileh & SLOPE_SE) && h_cur == 1) ||
-					(invalid_dirs&4 && !(tileh & SLOPE_SW) && w_cur == 1) ||
-					(invalid_dirs&8 && !(tileh & SLOPE_NW) && (uint)h_cur == h)) {
+			if ((invalid_dirs & 1 && !(tileh & SLOPE_NE) && (uint)w_cur == w) ||
+					(invalid_dirs & 2 && !(tileh & SLOPE_SE) && h_cur == 1) ||
+					(invalid_dirs & 4 && !(tileh & SLOPE_SW) && w_cur == 1) ||
+					(invalid_dirs & 8 && !(tileh & SLOPE_NW) && (uint)h_cur == h)) {
 				return_cmd_error(STR_0007_FLAT_LAND_REQUIRED);
 			}
 			cost += _eco->GetPrice(CEconomy::TERRAFORM);
@@ -748,7 +748,7 @@
 {
 	int i = n;
 	do *layout++ = 0; while (--i);
-	layout[((n-1) >> 1)-n] = 2;
+	layout[((n - 1) >> 1) - n] = 2;
 	return layout;
 }
 
@@ -757,8 +757,8 @@
 	int i = n;
 	do *layout++ = b; while (--i);
 	if (n > 4) {
-		layout[0-n] = 0;
-		layout[n-1-n] = 0;
+		layout[0 - n] = 0;
+		layout[n - 1 - n] = 0;
 	}
 	return layout;
 }
@@ -1623,7 +1623,7 @@
 			DeleteAnimatedTile(tile_cur);
 			DoClearSquare(tile_cur);
 		}
-	} END_TILE_LOOP(tile_cur, w,h,tile)
+	} END_TILE_LOOP(tile_cur, w, h, tile)
 
 	if (flags & DC_EXEC) {
 		for (uint i = 0; i < afc->nof_depots; ++i) {
@@ -2795,6 +2795,8 @@
 	SLE_CONDVAR(Station, waiting_triggers,           SLE_UINT8,                  27, SL_MAX_VERSION),
 	SLE_CONDVAR(Station, num_specs,                  SLE_UINT8,                  27, SL_MAX_VERSION),
 
+	SLE_CONDLST(Station, loading_vehicles,           REF_VEHICLE,                57, SL_MAX_VERSION),
+
 	// reserve extra space in savegame here. (currently 32 bytes)
 	SLE_CONDNULL(32, 2, SL_MAX_VERSION),
 
--- a/src/strgen/strgen.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/strgen/strgen.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -730,7 +730,7 @@
 {
 	ParsedCommandStruct templ;
 	ParsedCommandStruct lang;
-	int i,j;
+	int i, j;
 	bool result = true;
 
 	ExtractCommandString(&templ, b, true);
@@ -914,7 +914,7 @@
 	in = fopen(file, "r");
 	if (in == NULL) fatal("Cannot open file");
 	_cur_line = 1;
-	while (fgets(buf, sizeof(buf),in) != NULL) {
+	while (fgets(buf, sizeof(buf), in) != NULL) {
 		rstrip(buf);
 		HandleString(buf, english);
 		_cur_line++;
--- a/src/strings.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/strings.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -63,7 +63,7 @@
 
 	assert(argv);
 	result = (uint32)(*argv)[0] + ((uint64)(uint32)(*argv)[1] << 32);
-	(*argv)+=2;
+	(*argv) += 2;
 	return result;
 }
 
@@ -421,37 +421,37 @@
 	 * Used in:
 	 *   Latvian */
 	case 3:
-		return n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2;
+		return n % 10 == 1 && n % 100 != 11 ? 0 : n != 0 ? 1 : 2;
 
 	/* Three forms, special case for one and two
 	 * Used in:
 	 *   Gaelige (Irish) */
 	case 4:
-		return n==1 ? 0 : n==2 ? 1 : 2;
+		return n == 1 ? 0 : n == 2 ? 1 : 2;
 
 	/* Three forms, special case for numbers ending in 1[2-9]
 	 * Used in:
 	 *   Lithuanian */
 	case 5:
-		return n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2;
+		return n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2;
 
 	/* Three forms, special cases for numbers ending in 1 and 2, 3, 4, except those ending in 1[1-4]
 	 * Used in:
 	 *   Croatian, Czech, Russian, Slovak, Ukrainian */
 	case 6:
-		return n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;
+		return n % 10 == 1 && n % 100 != 11 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2;
 
 	/* Three forms, special case for one and some numbers ending in 2, 3, or 4
 	 * Used in:
 	 *   Polish */
 	case 7:
-		return n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;
+		return n == 1 ? 0 : n % 10 >= 2 && n % 10 <= 4 && (n % 100 < 10 || n % 100 >= 20) ? 1 : 2;
 
 	/* Four forms, special case for one and all numbers ending in 02, 03, or 04
 	 * Used in:
 	 *   Slovenian */
 	case 8:
-		return n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3;
+		return n % 100 == 1 ? 0 : n % 100 == 2 ? 1 : n % 100 == 3 || n % 100 == 4 ? 2 : 3;
 	}
 }
 
@@ -459,7 +459,7 @@
 {
 	//<NUM> {Length of each string} {each string}
 	uint n = (byte)*b++;
-	uint pos,i, mylen=0,mypos=0;
+	uint pos, i, mylen = 0, mypos = 0;
 
 	for (i = pos = 0; i != n; i++) {
 		uint len = (byte)*b++;
--- a/src/table/ai_rail.h	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/table/ai_rail.h	Wed Jun 13 11:17:30 2007 +0000
@@ -21,7 +21,7 @@
 };
 
 
-#define MKHDR(a,b,c,d,e) a,b,c,d,e,
+#define MKHDR(a, b, c, d, e) a, b, c, d, e,
 #define MKDEPOT(a, b, c)   {0, a, {b, c}}
 #define MKSTATION(a, b, c) {1, a, {b, c}}
 #define MKRAIL(a, b, c)    {2, a, {b, c}}
@@ -424,17 +424,17 @@
 
 #undef MKHDR
 
-#define MKHDR(a) a,{
+#define MKHDR(a) a, {
 
 static const AiDefaultBlockData _roaddata_ai_0_data[] = {
-	MKDEPOT(2, -1,1),
-	MKSTATION(0x2, -1,0),
-	MKRAIL(0xC, 0,0),
-	MKRAIL(0x9, 0,1),
-	MKCLRRAIL(0, 0,-1),
-	MKCLRRAIL(0, 1,0),
-	MKCLRRAIL(0, 1,1),
-	MKCLRRAIL(0, 0,2),
+	MKDEPOT(2, -1, 1),
+	MKSTATION(0x2, -1, 0),
+	MKRAIL(0xC, 0, 0),
+	MKRAIL(0x9, 0, 1),
+	MKCLRRAIL(0, 0, -1),
+	MKCLRRAIL(0, 1, 0),
+	MKCLRRAIL(0, 1, 1),
+	MKCLRRAIL(0, 0, 2),
 	MKEND
 };
 
@@ -443,14 +443,14 @@
 };
 
 static const AiDefaultBlockData _roaddata_ai_1_data[] = {
-	MKDEPOT(1, 0,-1),
-	MKSTATION(0x1, 1,-1),
-	MKRAIL(0x3, 0,0),
-	MKRAIL(0x9, 1,0),
-	MKCLRRAIL(0, -1,0),
-	MKCLRRAIL(0, 0,1),
-	MKCLRRAIL(0, 1,1),
-	MKCLRRAIL(0, 2,0),
+	MKDEPOT(1, 0, -1),
+	MKSTATION(0x1, 1, -1),
+	MKRAIL(0x3, 0, 0),
+	MKRAIL(0x9, 1, 0),
+	MKCLRRAIL(0, -1, 0),
+	MKCLRRAIL(0, 0, 1),
+	MKCLRRAIL(0, 1, 1),
+	MKCLRRAIL(0, 2, 0),
 	MKEND
 };
 
@@ -459,14 +459,14 @@
 };
 
 static const AiDefaultBlockData _roaddata_ai_2_data[] = {
-	MKDEPOT(3, 1,1),
-	MKSTATION(0x3, 0,1),
-	MKRAIL(0x6, 0,0),
-	MKRAIL(0xC, 1,0),
-	MKCLRRAIL(0, -1,0),
-	MKCLRRAIL(0, 0,-1),
-	MKCLRRAIL(0, 1,-1),
-	MKCLRRAIL(0, 2,0),
+	MKDEPOT(3, 1, 1),
+	MKSTATION(0x3, 0, 1),
+	MKRAIL(0x6, 0, 0),
+	MKRAIL(0xC, 1, 0),
+	MKCLRRAIL(0, -1, 0),
+	MKCLRRAIL(0, 0, -1),
+	MKCLRRAIL(0, 1, -1),
+	MKCLRRAIL(0, 2, 0),
 	MKEND
 };
 
@@ -475,14 +475,14 @@
 };
 
 static const AiDefaultBlockData _roaddata_ai_3_data[] = {
-	MKDEPOT(0, 1,0),
-	MKSTATION(0x0, 1,1),
-	MKRAIL(0x6, 0,0),
-	MKRAIL(0x3, 0,1),
-	MKCLRRAIL(0, 0,-1),
-	MKCLRRAIL(0, -1,0),
-	MKCLRRAIL(0, -1,1),
-	MKCLRRAIL(0, 0,2),
+	MKDEPOT(0, 1, 0),
+	MKSTATION(0x0, 1, 1),
+	MKRAIL(0x6, 0, 0),
+	MKRAIL(0x3, 0, 1),
+	MKCLRRAIL(0, 0, -1),
+	MKCLRRAIL(0, -1, 0),
+	MKCLRRAIL(0, -1, 1),
+	MKCLRRAIL(0, 0, 2),
 	MKEND
 };
 
@@ -491,11 +491,11 @@
 };
 
 static const AiDefaultBlockData _roaddata_ai_4_data[] = {
-	MKSTATION(0x2, -1,0),
-	MKRAIL(0x8, 0,0),
-	MKCLRRAIL(0, 0,-1),
-	MKCLRRAIL(0, 1,0),
-	MKCLRRAIL(0, 0,1),
+	MKSTATION(0x2, -1, 0),
+	MKRAIL(0x8, 0, 0),
+	MKCLRRAIL(0, 0, -1),
+	MKCLRRAIL(0, 1, 0),
+	MKCLRRAIL(0, 0, 1),
 	MKEND
 };
 
@@ -504,11 +504,11 @@
 };
 
 static const AiDefaultBlockData _roaddata_ai_5_data[] = {
-	MKSTATION(0x3, 0,1),
-	MKRAIL(0x4, 0,0),
-	MKCLRRAIL(0, -1,0),
-	MKCLRRAIL(0, 0,-1),
-	MKCLRRAIL(0, 1,0),
+	MKSTATION(0x3, 0, 1),
+	MKRAIL(0x4, 0, 0),
+	MKCLRRAIL(0, -1, 0),
+	MKCLRRAIL(0, 0, -1),
+	MKCLRRAIL(0, 1, 0),
 	MKEND
 };
 
@@ -517,11 +517,11 @@
 };
 
 static const AiDefaultBlockData _roaddata_ai_6_data[] = {
-	MKSTATION(0x0, 1,1),
-	MKRAIL(0x2, 0,1),
-	MKCLRRAIL(0, 0,0),
-	MKCLRRAIL(0, -1,0),
-	MKCLRRAIL(0, 0,2),
+	MKSTATION(0x0, 1, 1),
+	MKRAIL(0x2, 0, 1),
+	MKCLRRAIL(0, 0, 0),
+	MKCLRRAIL(0, -1, 0),
+	MKCLRRAIL(0, 0, 2),
 	MKEND
 };
 
@@ -530,11 +530,11 @@
 };
 
 static const AiDefaultBlockData _roaddata_ai_7_data[] = {
-	MKSTATION(0x1, 1,-1),
-	MKRAIL(0x1, 1,0),
-	MKCLRRAIL(0, 0,0),
-	MKCLRRAIL(0, 1,1),
-	MKCLRRAIL(0, 2,0),
+	MKSTATION(0x1, 1, -1),
+	MKRAIL(0x1, 1, 0),
+	MKCLRRAIL(0, 0, 0),
+	MKCLRRAIL(0, 1, 1),
+	MKCLRRAIL(0, 2, 0),
 	MKEND
 };
 
--- a/src/table/build_industry.h	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/table/build_industry.h	Wed Jun 13 11:17:30 2007 +0000
@@ -5,54 +5,54 @@
 #ifndef BUILD_INDUSTRY_H
 #define BUILD_INDUSTRY_H
 
-#define MK(x,y, m) {{x, y}, m}
+#define MK(x, y, m) {{x, y}, m}
 
 #define MKEND {{-0x80, 0}, 0}
 
 static const IndustryTileTable _tile_table_coal_mine_0[] = {
-	MK(1,1, 0),
-	MK(1,2, 2),
-	MK(0,0, 5),
-	MK(1,0, 6),
-	MK(2,0, 3),
-	MK(2,2, 3),
+	MK(1, 1, 0),
+	MK(1, 2, 2),
+	MK(0, 0, 5),
+	MK(1, 0, 6),
+	MK(2, 0, 3),
+	MK(2, 2, 3),
 	MKEND
 };
 
 static const IndustryTileTable _tile_table_coal_mine_1[] = {
-	MK(1,1, 0),
-	MK(1,2, 2),
-	MK(2,0, 0),
-	MK(2,1, 2),
-	MK(1,0, 3),
-	MK(0,0, 3),
-	MK(0,1, 4),
-	MK(0,2, 4),
-	MK(2,2, 4),
+	MK(1, 1, 0),
+	MK(1, 2, 2),
+	MK(2, 0, 0),
+	MK(2, 1, 2),
+	MK(1, 0, 3),
+	MK(0, 0, 3),
+	MK(0, 1, 4),
+	MK(0, 2, 4),
+	MK(2, 2, 4),
 	MKEND
 };
 
 static const IndustryTileTable _tile_table_coal_mine_2[] = {
-	MK(0,0, 0),
-	MK(0,1, 2),
-	MK(0,2, 5),
-	MK(1,0, 3),
-	MK(1,1, 3),
-	MK(1,2, 6),
+	MK(0, 0, 0),
+	MK(0, 1, 2),
+	MK(0, 2, 5),
+	MK(1, 0, 3),
+	MK(1, 1, 3),
+	MK(1, 2, 6),
 	MKEND
 };
 
 static const IndustryTileTable _tile_table_coal_mine_3[] = {
-	MK(0,1, 0),
-	MK(0,2, 2),
-	MK(0,3, 4),
-	MK(1,0, 5),
-	MK(1,1, 0),
-	MK(1,2, 2),
-	MK(1,3, 3),
-	MK(2,0, 6),
-	MK(2,1, 4),
-	MK(2,2, 3),
+	MK(0, 1, 0),
+	MK(0, 2, 2),
+	MK(0, 3, 4),
+	MK(1, 0, 5),
+	MK(1, 1, 0),
+	MK(1, 2, 2),
+	MK(1, 3, 3),
+	MK(2, 0, 6),
+	MK(2, 1, 4),
+	MK(2, 2, 3),
 	MKEND
 };
 
@@ -64,36 +64,36 @@
 };
 
 static const IndustryTileTable _tile_table_power_station_0[] = {
-	MK(0,0, 7),
-	MK(0,1, 9),
-	MK(1,0, 7),
-	MK(1,1, 8),
-	MK(2,0, 7),
-	MK(2,1, 8),
-	MK(3,0, 10),
-	MK(3,1, 10),
+	MK(0, 0, 7),
+	MK(0, 1, 9),
+	MK(1, 0, 7),
+	MK(1, 1, 8),
+	MK(2, 0, 7),
+	MK(2, 1, 8),
+	MK(3, 0, 10),
+	MK(3, 1, 10),
 	MKEND
 };
 
 static const IndustryTileTable _tile_table_power_station_1[] = {
-	MK(0,1, 7),
-	MK(0,2, 7),
-	MK(1,0, 8),
-	MK(1,1, 8),
-	MK(1,2, 7),
-	MK(2,0, 9),
-	MK(2,1, 10),
-	MK(2,2, 9),
+	MK(0, 1, 7),
+	MK(0, 2, 7),
+	MK(1, 0, 8),
+	MK(1, 1, 8),
+	MK(1, 2, 7),
+	MK(2, 0, 9),
+	MK(2, 1, 10),
+	MK(2, 2, 9),
 	MKEND
 };
 
 static const IndustryTileTable _tile_table_power_station_2[] = {
-	MK(0,0, 7),
-	MK(0,1, 7),
-	MK(1,0, 9),
-	MK(1,1, 8),
-	MK(2,0, 10),
-	MK(2,1, 9),
+	MK(0, 0, 7),
+	MK(0, 1, 7),
+	MK(1, 0, 9),
+	MK(1, 1, 8),
+	MK(2, 0, 10),
+	MK(2, 1, 9),
 	MKEND
 };
 
@@ -104,26 +104,26 @@
 };
 
 static const IndustryTileTable _tile_table_sawmill_0[] = {
-	MK(1,0, 14),
-	MK(1,1, 12),
-	MK(1,2, 11),
-	MK(2,0, 14),
-	MK(2,1, 13),
-	MK(0,0, 15),
-	MK(0,1, 15),
-	MK(0,2, 12),
+	MK(1, 0, 14),
+	MK(1, 1, 12),
+	MK(1, 2, 11),
+	MK(2, 0, 14),
+	MK(2, 1, 13),
+	MK(0, 0, 15),
+	MK(0, 1, 15),
+	MK(0, 2, 12),
 	MKEND
 };
 
 static const IndustryTileTable _tile_table_sawmill_1[] = {
-	MK(0,0, 15),
-	MK(0,1, 11),
-	MK(0,2, 14),
-	MK(1,0, 15),
-	MK(1,1, 13),
-	MK(1,2, 12),
-	MK(2,0, 11),
-	MK(2,1, 13),
+	MK(0, 0, 15),
+	MK(0, 1, 11),
+	MK(0, 2, 14),
+	MK(1, 0, 15),
+	MK(1, 1, 13),
+	MK(1, 2, 12),
+	MK(2, 0, 11),
+	MK(2, 1, 13),
 	MKEND
 };
 
@@ -133,51 +133,51 @@
 };
 
 static const IndustryTileTable _tile_table_forest_0[] = {
-	MK(0,0, 16),
-	MK(0,1, 16),
-	MK(0,2, 16),
-	MK(0,3, 16),
-	MK(1,0, 16),
-	MK(1,1, 16),
-	MK(1,2, 16),
-	MK(1,3, 16),
-	MK(2,0, 16),
-	MK(2,1, 16),
-	MK(2,2, 16),
-	MK(2,3, 16),
-	MK(3,0, 16),
-	MK(3,1, 16),
-	MK(3,2, 16),
-	MK(3,3, 16),
-	MK(1,4, 16),
-	MK(2,4, 16),
+	MK(0, 0, 16),
+	MK(0, 1, 16),
+	MK(0, 2, 16),
+	MK(0, 3, 16),
+	MK(1, 0, 16),
+	MK(1, 1, 16),
+	MK(1, 2, 16),
+	MK(1, 3, 16),
+	MK(2, 0, 16),
+	MK(2, 1, 16),
+	MK(2, 2, 16),
+	MK(2, 3, 16),
+	MK(3, 0, 16),
+	MK(3, 1, 16),
+	MK(3, 2, 16),
+	MK(3, 3, 16),
+	MK(1, 4, 16),
+	MK(2, 4, 16),
 	MKEND
 };
 
 static const IndustryTileTable _tile_table_forest_1[] = {
-	MK(0,0, 16),
-	MK(1,0, 16),
-	MK(2,0, 16),
-	MK(3,0, 16),
-	MK(4,0, 16),
-	MK(0,1, 16),
-	MK(1,1, 16),
-	MK(2,1, 16),
-	MK(3,1, 16),
-	MK(4,1, 16),
-	MK(0,2, 16),
-	MK(1,2, 16),
-	MK(2,2, 16),
-	MK(3,2, 16),
-	MK(4,2, 16),
-	MK(0,3, 16),
-	MK(1,3, 16),
-	MK(2,3, 16),
-	MK(3,3, 16),
-	MK(4,3, 16),
-	MK(1,4, 16),
-	MK(2,4, 16),
-	MK(3,4, 16),
+	MK(0, 0, 16),
+	MK(1, 0, 16),
+	MK(2, 0, 16),
+	MK(3, 0, 16),
+	MK(4, 0, 16),
+	MK(0, 1, 16),
+	MK(1, 1, 16),
+	MK(2, 1, 16),
+	MK(3, 1, 16),
+	MK(4, 1, 16),
+	MK(0, 2, 16),
+	MK(1, 2, 16),
+	MK(2, 2, 16),
+	MK(3, 2, 16),
+	MK(4, 2, 16),
+	MK(0, 3, 16),
+	MK(1, 3, 16),
+	MK(2, 3, 16),
+	MK(3, 3, 16),
+	MK(4, 3, 16),
+	MK(1, 4, 16),
+	MK(2, 4, 16),
+	MK(3, 4, 16),
 	MKEND
 };
 
@@ -187,40 +187,40 @@
 };
 
 static const IndustryTileTable _tile_table_oil_refinery_0[] = {
-	MK(0,0, 20),
-	MK(0,1, 21),
-	MK(0,2, 22),
-	MK(0,3, 21),
-	MK(1,0, 20),
-	MK(1,1, 19),
-	MK(1,2, 22),
-	MK(1,3, 20),
-	MK(2,1, 18),
-	MK(2,2, 18),
-	MK(2,3, 18),
-	MK(3,2, 18),
-	MK(3,3, 18),
-	MK(2,0, 23),
-	MK(3,1, 23),
+	MK(0, 0, 20),
+	MK(0, 1, 21),
+	MK(0, 2, 22),
+	MK(0, 3, 21),
+	MK(1, 0, 20),
+	MK(1, 1, 19),
+	MK(1, 2, 22),
+	MK(1, 3, 20),
+	MK(2, 1, 18),
+	MK(2, 2, 18),
+	MK(2, 3, 18),
+	MK(3, 2, 18),
+	MK(3, 3, 18),
+	MK(2, 0, 23),
+	MK(3, 1, 23),
 	MKEND
 };
 
 static const IndustryTileTable _tile_table_oil_refinery_1[] = {
-	MK(0,0, 18),
-	MK(0,1, 18),
-	MK(0,2, 21),
-	MK(0,3, 22),
-	MK(0,4, 20),
-	MK(1,0, 18),
-	MK(1,1, 18),
-	MK(1,2, 19),
-	MK(1,3, 20),
-	MK(2,0, 18),
-	MK(2,1, 18),
-	MK(2,2, 19),
-	MK(2,3, 22),
-	MK(1,4, 23),
-	MK(2,4, 23),
+	MK(0, 0, 18),
+	MK(0, 1, 18),
+	MK(0, 2, 21),
+	MK(0, 3, 22),
+	MK(0, 4, 20),
+	MK(1, 0, 18),
+	MK(1, 1, 18),
+	MK(1, 2, 19),
+	MK(1, 3, 20),
+	MK(2, 0, 18),
+	MK(2, 1, 18),
+	MK(2, 2, 19),
+	MK(2, 3, 22),
+	MK(1, 4, 23),
+	MK(2, 4, 23),
 	MKEND
 };
 
@@ -230,51 +230,51 @@
 };
 
 static const IndustryTileTable _tile_table_oil_rig_0[] = {
-	MK(0,0, 24),
-	MK(0,1, 24),
-	MK(0,2, 25),
-	MK(1,0, 26),
-	MK(1,1, 27),
-	MK(1,2, 28),
-	MK(-4,-5, 255),
-	MK(-4,-4, 255),
-	MK(-4,-3, 255),
-	MK(-4,-2, 255),
-	MK(-4,-1, 255),
-	MK(-4,0, 255),
-	MK(-4,1, 255),
-	MK(-4,2, 255),
-	MK(-4,3, 255),
-	MK(-4,4, 255),
-	MK(-4,5, 255),
-	MK(-3,5, 255),
-	MK(-2,5, 255),
-	MK(-1,5, 255),
-	MK(0,6, 255),
-	MK(1,6, 255),
-	MK(2,6, 255),
-	MK(3,6, 255),
-	MK(4,6, 255),
-	MK(5,6, 255),
-	MK(5,5, 255),
-	MK(5,4, 255),
-	MK(5,3, 255),
-	MK(5,2, 255),
-	MK(5,1, 255),
-	MK(5,0, 255),
-	MK(5,-1, 255),
-	MK(5,-2, 255),
-	MK(5,-3, 255),
-	MK(5,-4, 255),
-	MK(4,-4, 255),
-	MK(3,-4, 255),
-	MK(2,-4, 255),
-	MK(1,-4, 255),
-	MK(0,-4, 255),
-	MK(-1,-5, 255),
-	MK(-2,-5, 255),
-	MK(-3,-5, 255),
-	MK(2,0, 255),
+	MK(0, 0, 24),
+	MK(0, 1, 24),
+	MK(0, 2, 25),
+	MK(1, 0, 26),
+	MK(1, 1, 27),
+	MK(1, 2, 28),
+	MK(-4, -5, 255),
+	MK(-4, -4, 255),
+	MK(-4, -3, 255),
+	MK(-4, -2, 255),
+	MK(-4, -1, 255),
+	MK(-4, 0, 255),
+	MK(-4, 1, 255),
+	MK(-4, 2, 255),
+	MK(-4, 3, 255),
+	MK(-4, 4, 255),
+	MK(-4, 5, 255),
+	MK(-3, 5, 255),
+	MK(-2, 5, 255),
+	MK(-1, 5, 255),
+	MK(0, 6, 255),
+	MK(1, 6, 255),
+	MK(2, 6, 255),
+	MK(3, 6, 255),
+	MK(4, 6, 255),
+	MK(5, 6, 255),
+	MK(5, 5, 255),
+	MK(5, 4, 255),
+	MK(5, 3, 255),
+	MK(5, 2, 255),
+	MK(5, 1, 255),
+	MK(5, 0, 255),
+	MK(5, -1, 255),
+	MK(5, -2, 255),
+	MK(5, -3, 255),
+	MK(5, -4, 255),
+	MK(4, -4, 255),
+	MK(3, -4, 255),
+	MK(2, -4, 255),
+	MK(1, -4, 255),
+	MK(0, -4, 255),
+	MK(-1, -5, 255),
+	MK(-2, -5, 255),
+	MK(-3, -5, 255),
+	MK(2, 0, 255),
 	MKEND
 };
 
@@ -283,34 +283,34 @@
 };
 
 static const IndustryTileTable _tile_table_factory_0[] = {
-	MK(0,0, 39),
-	MK(0,1, 40),
-	MK(1,0, 41),
-	MK(1,1, 42),
-	MK(0,2, 39),
-	MK(0,3, 40),
-	MK(1,2, 41),
-	MK(1,3, 42),
-	MK(2,1, 39),
-	MK(2,2, 40),
-	MK(3,1, 41),
-	MK(3,2, 42),
+	MK(0, 0, 39),
+	MK(0, 1, 40),
+	MK(1, 0, 41),
+	MK(1, 1, 42),
+	MK(0, 2, 39),
+	MK(0, 3, 40),
+	MK(1, 2, 41),
+	MK(1, 3, 42),
+	MK(2, 1, 39),
+	MK(2, 2, 40),
+	MK(3, 1, 41),
+	MK(3, 2, 42),
 	MKEND
 };
 
 static const IndustryTileTable _tile_table_factory_1[] = {
-	MK(0,0, 39),
-	MK(0,1, 40),
-	MK(1,0, 41),
-	MK(1,1, 42),
-	MK(2,0, 39),
-	MK(2,1, 40),
-	MK(3,0, 41),
-	MK(3,1, 42),
-	MK(1,2, 39),
-	MK(1,3, 40),
-	MK(2,2, 41),
-	MK(2,3, 42),
+	MK(0, 0, 39),
+	MK(0, 1, 40),
+	MK(1, 0, 41),
+	MK(1, 1, 42),
+	MK(2, 0, 39),
+	MK(2, 1, 40),
+	MK(3, 0, 41),
+	MK(3, 1, 42),
+	MK(1, 2, 39),
+	MK(1, 3, 40),
+	MK(2, 2, 41),
+	MK(2, 3, 42),
 	MKEND
 };
 
@@ -320,34 +320,34 @@
 };
 
 static const IndustryTileTable _tile_table_printing_works_0[] = {
-	MK(0,0, 43),
-	MK(0,1, 44),
-	MK(1,0, 45),
-	MK(1,1, 46),
-	MK(0,2, 43),
-	MK(0,3, 44),
-	MK(1,2, 45),
-	MK(1,3, 46),
-	MK(2,1, 43),
-	MK(2,2, 44),
-	MK(3,1, 45),
-	MK(3,2, 46),
+	MK(0, 0, 43),
+	MK(0, 1, 44),
+	MK(1, 0, 45),
+	MK(1, 1, 46),
+	MK(0, 2, 43),
+	MK(0, 3, 44),
+	MK(1, 2, 45),
+	MK(1, 3, 46),
+	MK(2, 1, 43),
+	MK(2, 2, 44),
+	MK(3, 1, 45),
+	MK(3, 2, 46),
 	MKEND
 };
 
 static const IndustryTileTable _tile_table_printing_works_1[] = {
-	MK(0,0, 43),
-	MK(0,1, 44),
-	MK(1,0, 45),
-	MK(1,1, 46),
-	MK(2,0, 43),
-	MK(2,1, 44),
-	MK(3,0, 45),
-	MK(3,1, 46),
-	MK(1,2, 43),
-	MK(1,3, 44),
-	MK(2,2, 45),
-	MK(2,3, 46),
+	MK(0, 0, 43),
+	MK(0, 1, 44),
+	MK(1, 0, 45),
+	MK(1, 1, 46),
+	MK(2, 0, 43),
+	MK(2, 1, 44),
+	MK(3, 0, 45),
+	MK(3, 1, 46),
+	MK(1, 2, 43),
+	MK(1, 3, 44),
+	MK(2, 2, 45),
+	MK(2, 3, 46),
 	MKEND
 };
 
@@ -357,36 +357,36 @@
 };
 
 static const IndustryTileTable _tile_table_steel_mill_0[] = {
-	MK(2,1, 52),
-	MK(2,2, 53),
-	MK(3,1, 54),
-	MK(3,2, 55),
-	MK(0,0, 56),
-	MK(1,0, 57),
-	MK(0,1, 56),
-	MK(1,1, 57),
-	MK(0,2, 56),
-	MK(1,2, 57),
-	MK(2,0, 56),
-	MK(3,0, 57),
+	MK(2, 1, 52),
+	MK(2, 2, 53),
+	MK(3, 1, 54),
+	MK(3, 2, 55),
+	MK(0, 0, 56),
+	MK(1, 0, 57),
+	MK(0, 1, 56),
+	MK(1, 1, 57),
+	MK(0, 2, 56),
+	MK(1, 2, 57),
+	MK(2, 0, 56),
+	MK(3, 0, 57),
 	MKEND
 };
 
 static const IndustryTileTable _tile_table_steel_mill_1[] = {
-	MK(0,0, 52),
-	MK(0,1, 53),
-	MK(1,0, 54),
-	MK(1,1, 55),
-	MK(2,0, 52),
-	MK(2,1, 53),
-	MK(3,0, 54),
-	MK(3,1, 55),
-	MK(0,2, 56),
-	MK(1,2, 57),
-	MK(2,2, 56),
-	MK(3,2, 57),
-	MK(1,3, 56),
-	MK(2,3, 57),
+	MK(0, 0, 52),
+	MK(0, 1, 53),
+	MK(1, 0, 54),
+	MK(1, 1, 55),
+	MK(2, 0, 52),
+	MK(2, 1, 53),
+	MK(3, 0, 54),
+	MK(3, 1, 55),
+	MK(0, 2, 56),
+	MK(1, 2, 57),
+	MK(2, 2, 56),
+	MK(3, 2, 57),
+	MK(1, 3, 56),
+	MK(2, 3, 57),
 	MKEND
 };
 
@@ -396,47 +396,47 @@
 };
 
 static const IndustryTileTable _tile_table_farm_0[] = {
-	MK(1,0, 33),
-	MK(1,1, 34),
-	MK(1,2, 36),
-	MK(0,0, 37),
-	MK(0,1, 37),
-	MK(0,2, 36),
-	MK(2,0, 35),
-	MK(2,1, 38),
-	MK(2,2, 38),
+	MK(1, 0, 33),
+	MK(1, 1, 34),
+	MK(1, 2, 36),
+	MK(0, 0, 37),
+	MK(0, 1, 37),
+	MK(0, 2, 36),
+	MK(2, 0, 35),
+	MK(2, 1, 38),
+	MK(2, 2, 38),
 	MKEND
 };
 
 static const IndustryTileTable _tile_table_farm_1[] = {
-	MK(1,1, 33),
-	MK(1,2, 34),
-	MK(0,0, 35),
-	MK(0,1, 36),
-	MK(0,2, 36),
-	MK(0,3, 35),
-	MK(1,0, 37),
-	MK(1,3, 38),
-	MK(2,0, 37),
-	MK(2,1, 37),
-	MK(2,2, 38),
-	MK(2,3, 38),
+	MK(1, 1, 33),
+	MK(1, 2, 34),
+	MK(0, 0, 35),
+	MK(0, 1, 36),
+	MK(0, 2, 36),
+	MK(0, 3, 35),
+	MK(1, 0, 37),
+	MK(1, 3, 38),
+	MK(2, 0, 37),
+	MK(2, 1, 37),
+	MK(2, 2, 38),
+	MK(2, 3, 38),
 	MKEND
 };
 
 static const IndustryTileTable _tile_table_farm_2[] = {
-	MK(2,0, 33),
-	MK(2,1, 34),
-	MK(0,0, 36),
-	MK(0,1, 36),
-	MK(0,2, 37),
-	MK(0,3, 37),
-	MK(1,0, 35),
-	MK(1,1, 38),
-	MK(1,2, 38),
-	MK(1,3, 37),
-	MK(2,2, 37),
-	MK(2,3, 35),
+	MK(2, 0, 33),
+	MK(2, 1, 34),
+	MK(0, 0, 36),
+	MK(0, 1, 36),
+	MK(0, 2, 37),
+	MK(0, 3, 37),
+	MK(1, 0, 35),
+	MK(1, 1, 38),
+	MK(1, 2, 38),
+	MK(1, 3, 37),
+	MK(2, 2, 37),
+	MK(2, 3, 35),
 	MKEND
 };
 
@@ -447,27 +447,27 @@
 };
 
 static const IndustryTileTable _tile_table_copper_mine_0[] = {
-	MK(0,0, 47),
-	MK(0,1, 49),
-	MK(0,2, 51),
-	MK(1,0, 47),
-	MK(1,1, 49),
-	MK(1,2, 50),
-	MK(2,0, 51),
-	MK(2,1, 51),
+	MK(0, 0, 47),
+	MK(0, 1, 49),
+	MK(0, 2, 51),
+	MK(1, 0, 47),
+	MK(1, 1, 49),
+	MK(1, 2, 50),
+	MK(2, 0, 51),
+	MK(2, 1, 51),
 	MKEND
 };
 
 static const IndustryTileTable _tile_table_copper_mine_1[] = {
-	MK(0,0, 50),
-	MK(0,1, 47),
-	MK(0,2, 49),
-	MK(1,0, 47),
-	MK(1,1, 49),
-	MK(1,2, 51),
-	MK(2,0, 51),
-	MK(2,1, 47),
-	MK(2,2, 49),
+	MK(0, 0, 50),
+	MK(0, 1, 47),
+	MK(0, 2, 49),
+	MK(1, 0, 47),
+	MK(1, 1, 49),
+	MK(1, 2, 51),
+	MK(2, 0, 51),
+	MK(2, 1, 47),
+	MK(2, 2, 49),
 	MKEND
 };
 
@@ -477,20 +477,20 @@
 };
 
 static const IndustryTileTable _tile_table_oil_well_0[] = {
-	MK(0,0, 29),
-	MK(1,0, 29),
-	MK(2,0, 29),
-	MK(0,1, 29),
-	MK(0,2, 29),
+	MK(0, 0, 29),
+	MK(1, 0, 29),
+	MK(2, 0, 29),
+	MK(0, 1, 29),
+	MK(0, 2, 29),
 	MKEND
 };
 
 static const IndustryTileTable _tile_table_oil_well_1[] = {
-	MK(0,0, 29),
-	MK(1,0, 29),
-	MK(1,1, 29),
-	MK(2,2, 29),
-	MK(2,3, 29),
+	MK(0, 0, 29),
+	MK(1, 0, 29),
+	MK(1, 1, 29),
+	MK(2, 2, 29),
+	MK(2, 3, 29),
 	MKEND
 };
 
@@ -500,8 +500,8 @@
 };
 
 static const IndustryTileTable _tile_table_bank_0[] = {
-	MK(0,0, 58),
-	MK(1,0, 59),
+	MK(0, 0, 58),
+	MK(1, 0, 59),
 	MKEND
 };
 
@@ -510,36 +510,36 @@
 };
 
 static const IndustryTileTable _tile_table_food_process_0[] = {
-	MK(0,0, 60),
-	MK(1,0, 60),
-	MK(2,0, 60),
-	MK(0,1, 60),
-	MK(1,1, 60),
-	MK(2,1, 60),
-	MK(0,2, 61),
-	MK(1,2, 61),
-	MK(2,2, 63),
-	MK(0,3, 62),
-	MK(1,3, 62),
-	MK(2,3, 63),
+	MK(0, 0, 60),
+	MK(1, 0, 60),
+	MK(2, 0, 60),
+	MK(0, 1, 60),
+	MK(1, 1, 60),
+	MK(2, 1, 60),
+	MK(0, 2, 61),
+	MK(1, 2, 61),
+	MK(2, 2, 63),
+	MK(0, 3, 62),
+	MK(1, 3, 62),
+	MK(2, 3, 63),
 	MKEND
 };
 
 static const IndustryTileTable _tile_table_food_process_1[] = {
-	MK(0,0, 61),
-	MK(1,0, 60),
-	MK(2,0, 61),
-	MK(3,0, 61),
-	MK(0,1, 62),
-	MK(1,1, 63),
-	MK(2,1, 63),
-	MK(3,1, 63),
-	MK(0,2, 60),
-	MK(1,2, 60),
-	MK(2,2, 60),
-	MK(3,2, 60),
-	MK(0,3, 62),
-	MK(1,3, 62),
+	MK(0, 0, 61),
+	MK(1, 0, 60),
+	MK(2, 0, 61),
+	MK(3, 0, 61),
+	MK(0, 1, 62),
+	MK(1, 1, 63),
+	MK(2, 1, 63),
+	MK(3, 1, 63),
+	MK(0, 2, 60),
+	MK(1, 2, 60),
+	MK(2, 2, 60),
+	MK(3, 2, 60),
+	MK(0, 3, 62),
+	MK(1, 3, 62),
 	MKEND
 };
 
@@ -549,18 +549,18 @@
 };
 
 static const IndustryTileTable _tile_table_paper_mill_0[] = {
-	MK(0,0, 64),
-	MK(1,0, 65),
-	MK(2,0, 66),
-	MK(3,0, 67),
-	MK(0,1, 68),
-	MK(1,1, 69),
-	MK(2,1, 67),
-	MK(3,1, 67),
-	MK(0,2, 66),
-	MK(1,2, 71),
-	MK(2,2, 71),
-	MK(3,2, 70),
+	MK(0, 0, 64),
+	MK(1, 0, 65),
+	MK(2, 0, 66),
+	MK(3, 0, 67),
+	MK(0, 1, 68),
+	MK(1, 1, 69),
+	MK(2, 1, 67),
+	MK(3, 1, 67),
+	MK(0, 2, 66),
+	MK(1, 2, 71),
+	MK(2, 2, 71),
+	MK(3, 2, 70),
 	MKEND
 };
 
@@ -569,22 +569,22 @@
 };
 
 static const IndustryTileTable _tile_table_gold_mine_0[] = {
-	MK(0,0, 72),
-	MK(0,1, 73),
-	MK(0,2, 74),
-	MK(0,3, 75),
-	MK(1,0, 76),
-	MK(1,1, 77),
-	MK(1,2, 78),
-	MK(1,3, 79),
-	MK(2,0, 80),
-	MK(2,1, 81),
-	MK(2,2, 82),
-	MK(2,3, 83),
-	MK(3,0, 84),
-	MK(3,1, 85),
-	MK(3,2, 86),
-	MK(3,3, 87),
+	MK(0, 0, 72),
+	MK(0, 1, 73),
+	MK(0, 2, 74),
+	MK(0, 3, 75),
+	MK(1, 0, 76),
+	MK(1, 1, 77),
+	MK(1, 2, 78),
+	MK(1, 3, 79),
+	MK(2, 0, 80),
+	MK(2, 1, 81),
+	MK(2, 2, 82),
+	MK(2, 3, 83),
+	MK(3, 0, 84),
+	MK(3, 1, 85),
+	MK(3, 2, 86),
+	MK(3, 3, 87),
 	MKEND
 };
 
@@ -593,8 +593,8 @@
 };
 
 static const IndustryTileTable _tile_table_bank2_0[] = {
-	MK(0,0, 89),
-	MK(1,0, 90),
+	MK(0, 0, 89),
+	MK(1, 0, 90),
 	MKEND
 };
 
@@ -603,15 +603,15 @@
 };
 
 static const IndustryTileTable _tile_table_diamond_mine_0[] = {
-	MK(0,0, 91),
-	MK(0,1, 92),
-	MK(0,2, 93),
-	MK(1,0, 94),
-	MK(1,1, 95),
-	MK(1,2, 96),
-	MK(2,0, 97),
-	MK(2,1, 98),
-	MK(2,2, 99),
+	MK(0, 0, 91),
+	MK(0, 1, 92),
+	MK(0, 2, 93),
+	MK(1, 0, 94),
+	MK(1, 1, 95),
+	MK(1, 2, 96),
+	MK(2, 0, 97),
+	MK(2, 1, 98),
+	MK(2, 2, 99),
 	MKEND
 };
 
@@ -620,22 +620,22 @@
 };
 
 static const IndustryTileTable _tile_table_iron_mine_0[] = {
-	MK(0,0, 100),
-	MK(0,1, 101),
-	MK(0,2, 102),
-	MK(0,3, 103),
-	MK(1,0, 104),
-	MK(1,1, 105),
-	MK(1,2, 106),
-	MK(1,3, 107),
-	MK(2,0, 108),
-	MK(2,1, 109),
-	MK(2,2, 110),
-	MK(2,3, 111),
-	MK(3,0, 112),
-	MK(3,1, 113),
-	MK(3,2, 114),
-	MK(3,3, 115),
+	MK(0, 0, 100),
+	MK(0, 1, 101),
+	MK(0, 2, 102),
+	MK(0, 3, 103),
+	MK(1, 0, 104),
+	MK(1, 1, 105),
+	MK(1, 2, 106),
+	MK(1, 3, 107),
+	MK(2, 0, 108),
+	MK(2, 1, 109),
+	MK(2, 2, 110),
+	MK(2, 3, 111),
+	MK(3, 0, 112),
+	MK(3, 1, 113),
+	MK(3, 2, 114),
+	MK(3, 3, 115),
 	MKEND
 };
 
@@ -644,26 +644,26 @@
 };
 
 static const IndustryTileTable _tile_table_fruit_plantation_0[] = {
-	MK(0,0, 116),
-	MK(0,1, 116),
-	MK(0,2, 116),
-	MK(0,3, 116),
-	MK(1,0, 116),
-	MK(1,1, 116),
-	MK(1,2, 116),
-	MK(1,3, 116),
-	MK(2,0, 116),
-	MK(2,1, 116),
-	MK(2,2, 116),
-	MK(2,3, 116),
-	MK(3,0, 116),
-	MK(3,1, 116),
-	MK(3,2, 116),
-	MK(3,3, 116),
-	MK(4,0, 116),
-	MK(4,1, 116),
-	MK(4,2, 116),
-	MK(4,3, 116),
+	MK(0, 0, 116),
+	MK(0, 1, 116),
+	MK(0, 2, 116),
+	MK(0, 3, 116),
+	MK(1, 0, 116),
+	MK(1, 1, 116),
+	MK(1, 2, 116),
+	MK(1, 3, 116),
+	MK(2, 0, 116),
+	MK(2, 1, 116),
+	MK(2, 2, 116),
+	MK(2, 3, 116),
+	MK(3, 0, 116),
+	MK(3, 1, 116),
+	MK(3, 2, 116),
+	MK(3, 3, 116),
+	MK(4, 0, 116),
+	MK(4, 1, 116),
+	MK(4, 2, 116),
+	MK(4, 3, 116),
 	MKEND
 };
 
@@ -672,26 +672,26 @@
 };
 
 static const IndustryTileTable _tile_table_rubber_plantation_0[] = {
-	MK(0,0, 117),
-	MK(0,1, 117),
-	MK(0,2, 117),
-	MK(0,3, 117),
-	MK(1,0, 117),
-	MK(1,1, 117),
-	MK(1,2, 117),
-	MK(1,3, 117),
-	MK(2,0, 117),
-	MK(2,1, 117),
-	MK(2,2, 117),
-	MK(2,3, 117),
-	MK(3,0, 117),
-	MK(3,1, 117),
-	MK(3,2, 117),
-	MK(3,3, 117),
-	MK(4,0, 117),
-	MK(4,1, 117),
-	MK(4,2, 117),
-	MK(4,3, 117),
+	MK(0, 0, 117),
+	MK(0, 1, 117),
+	MK(0, 2, 117),
+	MK(0, 3, 117),
+	MK(1, 0, 117),
+	MK(1, 1, 117),
+	MK(1, 2, 117),
+	MK(1, 3, 117),
+	MK(2, 0, 117),
+	MK(2, 1, 117),
+	MK(2, 2, 117),
+	MK(2, 3, 117),
+	MK(3, 0, 117),
+	MK(3, 1, 117),
+	MK(3, 2, 117),
+	MK(3, 3, 117),
+	MK(4, 0, 117),
+	MK(4, 1, 117),
+	MK(4, 2, 117),
+	MK(4, 3, 117),
 	MKEND
 };
 
@@ -700,10 +700,10 @@
 };
 
 static const IndustryTileTable _tile_table_water_supply_0[] = {
-	MK(0,0, 118),
-	MK(0,1, 119),
-	MK(1,0, 118),
-	MK(1,1, 119),
+	MK(0, 0, 118),
+	MK(0, 1, 119),
+	MK(1, 0, 118),
+	MK(1, 1, 119),
 	MKEND
 };
 
@@ -712,7 +712,7 @@
 };
 
 static const IndustryTileTable _tile_table_water_tower_0[] = {
-	MK(0,0, 120),
+	MK(0, 0, 120),
 	MKEND
 };
 
@@ -721,26 +721,26 @@
 };
 
 static const IndustryTileTable _tile_table_factory2_0[] = {
-	MK(0,0, 121),
-	MK(0,1, 122),
-	MK(1,0, 123),
-	MK(1,1, 124),
-	MK(0,2, 121),
-	MK(0,3, 122),
-	MK(1,2, 123),
-	MK(1,3, 124),
+	MK(0, 0, 121),
+	MK(0, 1, 122),
+	MK(1, 0, 123),
+	MK(1, 1, 124),
+	MK(0, 2, 121),
+	MK(0, 3, 122),
+	MK(1, 2, 123),
+	MK(1, 3, 124),
 	MKEND
 };
 
 static const IndustryTileTable _tile_table_factory2_1[] = {
-	MK(0,0, 121),
-	MK(0,1, 122),
-	MK(1,0, 123),
-	MK(1,1, 124),
-	MK(2,0, 121),
-	MK(2,1, 122),
-	MK(3,0, 123),
-	MK(3,1, 124),
+	MK(0, 0, 121),
+	MK(0, 1, 122),
+	MK(1, 0, 123),
+	MK(1, 1, 124),
+	MK(2, 0, 121),
+	MK(2, 1, 122),
+	MK(3, 0, 123),
+	MK(3, 1, 124),
 	MKEND
 };
 
@@ -750,47 +750,47 @@
 };
 
 static const IndustryTileTable _tile_table_farm2_0[] = {
-	MK(1,0, 33),
-	MK(1,1, 34),
-	MK(1,2, 36),
-	MK(0,0, 37),
-	MK(0,1, 37),
-	MK(0,2, 36),
-	MK(2,0, 35),
-	MK(2,1, 38),
-	MK(2,2, 38),
+	MK(1, 0, 33),
+	MK(1, 1, 34),
+	MK(1, 2, 36),
+	MK(0, 0, 37),
+	MK(0, 1, 37),
+	MK(0, 2, 36),
+	MK(2, 0, 35),
+	MK(2, 1, 38),
+	MK(2, 2, 38),
 	MKEND
 };
 
 static const IndustryTileTable _tile_table_farm2_1[] = {
-	MK(1,1, 33),
-	MK(1,2, 34),
-	MK(0,0, 35),
-	MK(0,1, 36),
-	MK(0,2, 36),
-	MK(0,3, 35),
-	MK(1,0, 37),
-	MK(1,3, 38),
-	MK(2,0, 37),
-	MK(2,1, 37),
-	MK(2,2, 38),
-	MK(2,3, 38),
+	MK(1, 1, 33),
+	MK(1, 2, 34),
+	MK(0, 0, 35),
+	MK(0, 1, 36),
+	MK(0, 2, 36),
+	MK(0, 3, 35),
+	MK(1, 0, 37),
+	MK(1, 3, 38),
+	MK(2, 0, 37),
+	MK(2, 1, 37),
+	MK(2, 2, 38),
+	MK(2, 3, 38),
 	MKEND
 };
 
 static const IndustryTileTable _tile_table_farm2_2[] = {
-	MK(2,0, 33),
-	MK(2,1, 34),
-	MK(0,0, 36),
-	MK(0,1, 36),
-	MK(0,2, 37),
-	MK(0,3, 37),
-	MK(1,0, 35),
-	MK(1,1, 38),
-	MK(1,2, 38),
-	MK(1,3, 37),
-	MK(2,2, 37),
-	MK(2,3, 35),
+	MK(2, 0, 33),
+	MK(2, 1, 34),
+	MK(0, 0, 36),
+	MK(0, 1, 36),
+	MK(0, 2, 37),
+	MK(0, 3, 37),
+	MK(1, 0, 35),
+	MK(1, 1, 38),
+	MK(1, 2, 38),
+	MK(1, 3, 37),
+	MK(2, 2, 37),
+	MK(2, 3, 35),
 	MKEND
 };
 
@@ -801,10 +801,10 @@
 };
 
 static const IndustryTileTable _tile_table_lumber_mill_0[] = {
-	MK(0,0, 125),
-	MK(0,1, 126),
-	MK(1,0, 127),
-	MK(1,1, 128),
+	MK(0, 0, 125),
+	MK(0, 1, 126),
+	MK(1, 0, 127),
+	MK(1, 1, 128),
 	MKEND
 };
 
@@ -813,51 +813,51 @@
 };
 
 static const IndustryTileTable _tile_table_cotton_candy_0[] = {
-	MK(0,0, 129),
-	MK(0,1, 129),
-	MK(0,2, 129),
-	MK(0,3, 129),
-	MK(1,0, 129),
-	MK(1,1, 129),
-	MK(1,2, 129),
-	MK(1,3, 129),
-	MK(2,0, 129),
-	MK(2,1, 129),
-	MK(2,2, 129),
-	MK(2,3, 129),
-	MK(3,0, 129),
-	MK(3,1, 129),
-	MK(3,2, 129),
-	MK(3,3, 129),
-	MK(1,4, 129),
-	MK(2,4, 129),
+	MK(0, 0, 129),
+	MK(0, 1, 129),
+	MK(0, 2, 129),
+	MK(0, 3, 129),
+	MK(1, 0, 129),
+	MK(1, 1, 129),
+	MK(1, 2, 129),
+	MK(1, 3, 129),
+	MK(2, 0, 129),
+	MK(2, 1, 129),
+	MK(2, 2, 129),
+	MK(2, 3, 129),
+	MK(3, 0, 129),
+	MK(3, 1, 129),
+	MK(3, 2, 129),
+	MK(3, 3, 129),
+	MK(1, 4, 129),
+	MK(2, 4, 129),
 	MKEND
 };
 
 static const IndustryTileTable _tile_table_cotton_candy_1[] = {
-	MK(0,0, 129),
-	MK(1,0, 129),
-	MK(2,0, 129),
-	MK(3,0, 129),
-	MK(4,0, 129),
-	MK(0,1, 129),
-	MK(1,1, 129),
-	MK(2,1, 129),
-	MK(3,1, 129),
-	MK(4,1, 129),
-	MK(0,2, 129),
-	MK(1,2, 129),
-	MK(2,2, 129),
-	MK(3,2, 129),
-	MK(4,2, 129),
-	MK(0,3, 129),
-	MK(1,3, 129),
-	MK(2,3, 129),
-	MK(3,3, 129),
-	MK(4,3, 129),
-	MK(1,4, 129),
-	MK(2,4, 129),
-	MK(3,4, 129),
+	MK(0, 0, 129),
+	MK(1, 0, 129),
+	MK(2, 0, 129),
+	MK(3, 0, 129),
+	MK(4, 0, 129),
+	MK(0, 1, 129),
+	MK(1, 1, 129),
+	MK(2, 1, 129),
+	MK(3, 1, 129),
+	MK(4, 1, 129),
+	MK(0, 2, 129),
+	MK(1, 2, 129),
+	MK(2, 2, 129),
+	MK(3, 2, 129),
+	MK(4, 2, 129),
+	MK(0, 3, 129),
+	MK(1, 3, 129),
+	MK(2, 3, 129),
+	MK(3, 3, 129),
+	MK(4, 3, 129),
+	MK(1, 4, 129),
+	MK(2, 4, 129),
+	MK(3, 4, 129),
 	MKEND
 };
 
@@ -867,34 +867,34 @@
 };
 
 static const IndustryTileTable _tile_table_candy_factory_0[] = {
-	MK(0,0, 131),
-	MK(0,1, 132),
-	MK(1,0, 133),
-	MK(1,1, 134),
-	MK(0,2, 131),
-	MK(0,3, 132),
-	MK(1,2, 133),
-	MK(1,3, 134),
-	MK(2,1, 131),
-	MK(2,2, 132),
-	MK(3,1, 133),
-	MK(3,2, 134),
+	MK(0, 0, 131),
+	MK(0, 1, 132),
+	MK(1, 0, 133),
+	MK(1, 1, 134),
+	MK(0, 2, 131),
+	MK(0, 3, 132),
+	MK(1, 2, 133),
+	MK(1, 3, 134),
+	MK(2, 1, 131),
+	MK(2, 2, 132),
+	MK(3, 1, 133),
+	MK(3, 2, 134),
 	MKEND
 };
 
 static const IndustryTileTable _tile_table_candy_factory_1[] = {
-	MK(0,0, 131),
-	MK(0,1, 132),
-	MK(1,0, 133),
-	MK(1,1, 134),
-	MK(2,0, 131),
-	MK(2,1, 132),
-	MK(3,0, 133),
-	MK(3,1, 134),
-	MK(1,2, 131),
-	MK(1,3, 132),
-	MK(2,2, 133),
-	MK(2,3, 134),
+	MK(0, 0, 131),
+	MK(0, 1, 132),
+	MK(1, 0, 133),
+	MK(1, 1, 134),
+	MK(2, 0, 131),
+	MK(2, 1, 132),
+	MK(3, 0, 133),
+	MK(3, 1, 134),
+	MK(1, 2, 131),
+	MK(1, 3, 132),
+	MK(2, 2, 133),
+	MK(2, 3, 134),
 	MKEND
 };
 
@@ -904,26 +904,26 @@
 };
 
 static const IndustryTileTable _tile_table_battery_farm_0[] = {
-	MK(0,0, 135),
-	MK(0,1, 135),
-	MK(0,2, 135),
-	MK(0,3, 135),
-	MK(1,0, 135),
-	MK(1,1, 135),
-	MK(1,2, 135),
-	MK(1,3, 135),
-	MK(2,0, 135),
-	MK(2,1, 135),
-	MK(2,2, 135),
-	MK(2,3, 135),
-	MK(3,0, 135),
-	MK(3,1, 135),
-	MK(3,2, 135),
-	MK(3,3, 135),
-	MK(4,0, 135),
-	MK(4,1, 135),
-	MK(4,2, 135),
-	MK(4,3, 135),
+	MK(0, 0, 135),
+	MK(0, 1, 135),
+	MK(0, 2, 135),
+	MK(0, 3, 135),
+	MK(1, 0, 135),
+	MK(1, 1, 135),
+	MK(1, 2, 135),
+	MK(1, 3, 135),
+	MK(2, 0, 135),
+	MK(2, 1, 135),
+	MK(2, 2, 135),
+	MK(2, 3, 135),
+	MK(3, 0, 135),
+	MK(3, 1, 135),
+	MK(3, 2, 135),
+	MK(3, 3, 135),
+	MK(4, 0, 135),
+	MK(4, 1, 135),
+	MK(4, 2, 135),
+	MK(4, 3, 135),
 	MKEND
 };
 
@@ -932,25 +932,25 @@
 };
 
 static const IndustryTileTable _tile_table_cola_wells_0[] = {
-	MK(0,0, 137),
-	MK(0,1, 137),
-	MK(0,2, 137),
-	MK(1,0, 137),
-	MK(1,1, 137),
-	MK(1,2, 137),
-	MK(2,1, 137),
-	MK(2,2, 137),
+	MK(0, 0, 137),
+	MK(0, 1, 137),
+	MK(0, 2, 137),
+	MK(1, 0, 137),
+	MK(1, 1, 137),
+	MK(1, 2, 137),
+	MK(2, 1, 137),
+	MK(2, 2, 137),
 	MKEND
 };
 
 static const IndustryTileTable _tile_table_cola_wells_1[] = {
-	MK(0,1, 137),
-	MK(0,2, 137),
-	MK(0,3, 137),
-	MK(1,0, 137),
-	MK(1,1, 137),
-	MK(1,2, 137),
-	MK(2,1, 137),
+	MK(0, 1, 137),
+	MK(0, 2, 137),
+	MK(0, 3, 137),
+	MK(1, 0, 137),
+	MK(1, 1, 137),
+	MK(1, 2, 137),
+	MK(2, 1, 137),
 	MKEND
 };
 
@@ -960,10 +960,10 @@
 };
 
 static const IndustryTileTable _tile_table_toy_shop_0[] = {
-	MK(0,0, 138),
-	MK(0,1, 139),
-	MK(1,0, 140),
-	MK(1,1, 141),
+	MK(0, 0, 138),
+	MK(0, 1, 139),
+	MK(1, 0, 140),
+	MK(1, 1, 141),
 	MKEND
 };
 
@@ -972,14 +972,14 @@
 };
 
 static const IndustryTileTable _tile_table_toy_factory_0[] = {
-	MK(0,0, 147),
-	MK(0,1, 142),
-	MK(1,0, 147),
-	MK(1,1, 143),
-	MK(2,0, 147),
-	MK(2,1, 144),
-	MK(3,0, 146),
-	MK(3,1, 145),
+	MK(0, 0, 147),
+	MK(0, 1, 142),
+	MK(1, 0, 147),
+	MK(1, 1, 143),
+	MK(2, 0, 147),
+	MK(2, 1, 144),
+	MK(3, 0, 146),
+	MK(3, 1, 145),
 	MKEND
 };
 
@@ -988,16 +988,16 @@
 };
 
 static const IndustryTileTable _tile_table_plastic_fountain_0[] = {
-	MK(0,0, 148),
-	MK(0,1, 151),
-	MK(0,2, 154),
+	MK(0, 0, 148),
+	MK(0, 1, 151),
+	MK(0, 2, 154),
 	MKEND
 };
 
 static const IndustryTileTable _tile_table_plastic_fountain_1[] = {
-	MK(0,0, 148),
-	MK(1,0, 151),
-	MK(2,0, 154),
+	MK(0, 0, 148),
+	MK(1, 0, 151),
+	MK(2, 0, 154),
 	MKEND
 };
 
@@ -1007,10 +1007,10 @@
 };
 
 static const IndustryTileTable _tile_table_fizzy_drink_0[] = {
-	MK(0,0, 156),
-	MK(0,1, 157),
-	MK(1,0, 158),
-	MK(1,1, 159),
+	MK(0, 0, 156),
+	MK(0, 1, 157),
+	MK(1, 0, 158),
+	MK(1, 1, 159),
 	MKEND
 };
 
@@ -1019,18 +1019,18 @@
 };
 
 static const IndustryTileTable _tile_table_bubble_generator_0[] = {
-	MK(0,0, 163),
-	MK(0,1, 160),
-	MK(1,0, 163),
-	MK(1,1, 161),
-	MK(2,0, 163),
-	MK(2,1, 162),
-	MK(0,2, 163),
-	MK(0,3, 160),
-	MK(1,2, 163),
-	MK(1,3, 161),
-	MK(2,2, 163),
-	MK(2,3, 162),
+	MK(0, 0, 163),
+	MK(0, 1, 160),
+	MK(1, 0, 163),
+	MK(1, 1, 161),
+	MK(2, 0, 163),
+	MK(2, 1, 162),
+	MK(0, 2, 163),
+	MK(0, 3, 160),
+	MK(1, 2, 163),
+	MK(1, 3, 161),
+	MK(2, 2, 163),
+	MK(2, 3, 162),
 	MKEND
 };
 
@@ -1039,9 +1039,9 @@
 };
 
 static const IndustryTileTable _tile_table_toffee_quarry_0[] = {
-	MK(0,0, 164),
-	MK(1,0, 165),
-	MK(2,0, 166),
+	MK(0, 0, 164),
+	MK(1, 0, 165),
+	MK(2, 0, 166),
 	MKEND
 };
 
@@ -1050,14 +1050,14 @@
 };
 
 static const IndustryTileTable _tile_table_sugar_mine_0[] = {
-	MK(0,0, 167),
-	MK(0,1, 168),
-	MK(1,0, 169),
-	MK(1,1, 170),
-	MK(2,0, 171),
-	MK(2,1, 172),
-	MK(3,0, 173),
-	MK(3,1, 174),
+	MK(0, 0, 167),
+	MK(0, 1, 168),
+	MK(1, 0, 169),
+	MK(1, 1, 170),
+	MK(2, 0, 171),
+	MK(2, 1, 172),
+	MK(3, 0, 173),
+	MK(3, 1, 174),
 	MKEND
 };
 
@@ -1103,7 +1103,7 @@
  * @param s3   text for production down
  */
 
-#define MI(tbl, d, ai1, ai2, ai3, ai4, ag1, ag2, ag3, ag4, col,\
+#define MI(tbl, d, ai1, ai2, ai3, ai4, ag1, ag2, ag3, ag4, col, \
            c1, c2, c3, proc, p1, r1, p2, r2, m, a1, a2, a3, pr, clim, bev, in, intx, s1, s2, s3) \
 	{tbl, lengthof(tbl), d, {c1, c2, c3}, proc, {p1, p2}, {r1, r2}, m,            \
 	 {a1, a2, a3}, pr, clim, bev, col, in, intx, s1, s2, s3, {ai1, ai2, ai3, ai4}, {ag1, ag2, ag3, ag4}, 0, 0, 0, 0}
--- a/src/table/namegen.h	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/table/namegen.h	Wed Jun 13 11:17:30 2007 +0000
@@ -1931,7 +1931,7 @@
 
 
 
-static const char *name_romanian_real[]= {
+static const char *name_romanian_real[] = {
 	"Adjud",
 	"Alba Iulia",
 	"Alexandria",
--- a/src/table/station_land.h	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/table/station_land.h	Wed Jun 13 11:17:30 2007 +0000
@@ -34,7 +34,7 @@
 	{  0,  0,  0, 16,  5,  7, SPR_RAIL_PLATFORM_PILLARS_X_REAR | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
 	{  0, 11,  0, 16,  5,  2, SPR_RAIL_PLATFORM_X_FRONT        | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
 	{  0,  0, 16, 16, 16, 10, SPR_RAIL_ROOF_STRUCTURE_X_TILE_A | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
-	{  0,  0,(byte)0x80, 0,  0,  0, SPR_RAIL_ROOF_GLASS_X_TILE_A     | (1 << PALETTE_MODIFIER_TRANSPARENT), PALETTE_TO_TRANSPARENT },
+	{  0,  0, (byte)0x80, 0,  0,  0, SPR_RAIL_ROOF_GLASS_X_TILE_A     | (1 << PALETTE_MODIFIER_TRANSPARENT), PALETTE_TO_TRANSPARENT },
 	TILE_SEQ_END()
 };
 
@@ -42,7 +42,7 @@
 	{  0,  0,  0,  5, 16,  2, SPR_RAIL_PLATFORM_PILLARS_Y_REAR | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
 	{ 11,  0,  0,  5, 16,  2, SPR_RAIL_PLATFORM_Y_FRONT        | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
 	{  0,  0, 16, 16, 16, 10, SPR_RAIL_ROOF_STRUCTURE_Y_TILE_A | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
-	{  0,  0,(byte)0x80, 0,  0,  0, SPR_RAIL_ROOF_GLASS_Y_TILE_A     | (1 << PALETTE_MODIFIER_TRANSPARENT), PALETTE_TO_TRANSPARENT },
+	{  0,  0, (byte)0x80, 0,  0,  0, SPR_RAIL_ROOF_GLASS_Y_TILE_A     | (1 << PALETTE_MODIFIER_TRANSPARENT), PALETTE_TO_TRANSPARENT },
 	TILE_SEQ_END()
 };
 
@@ -50,7 +50,7 @@
 	{  0,  0,  0, 16,  5,  2, SPR_RAIL_PLATFORM_X_REAR          | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
 	{  0, 11,  0, 16,  5,  2, SPR_RAIL_PLATFORM_PILLARS_X_FRONT | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
 	{  0,  0, 16, 16, 16, 10, SPR_RAIL_ROOF_STRUCTURE_X_TILE_B  | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
-	{  0,  0,(byte)0x80, 0,  0,  0, SPR_RAIL_ROOF_GLASS_X_TILE_B      | (1 << PALETTE_MODIFIER_TRANSPARENT), PALETTE_TO_TRANSPARENT },
+	{  0,  0, (byte)0x80, 0,  0,  0, SPR_RAIL_ROOF_GLASS_X_TILE_B      | (1 << PALETTE_MODIFIER_TRANSPARENT), PALETTE_TO_TRANSPARENT },
 	TILE_SEQ_END()
 };
 
@@ -58,7 +58,7 @@
 	{  0,  0,  0,  5, 16,  2, SPR_RAIL_PLATFORM_Y_REAR          | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
 	{ 11,  0,  0,  5, 16,  2, SPR_RAIL_PLATFORM_PILLARS_Y_FRONT | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
 	{  0,  0, 16, 16, 16, 10, SPR_RAIL_ROOF_STRUCTURE_Y_TILE_B  | (1 << PALETTE_MODIFIER_COLOR), PAL_NONE },
-	{  0,  0,(byte)0x80, 0,  0,  0, SPR_RAIL_ROOF_GLASS_Y_TILE_B      | (1 << PALETTE_MODIFIER_TRANSPARENT), PALETTE_TO_TRANSPARENT },
+	{  0,  0, (byte)0x80, 0,  0,  0, SPR_RAIL_ROOF_GLASS_Y_TILE_B      | (1 << PALETTE_MODIFIER_TRANSPARENT), PALETTE_TO_TRANSPARENT },
 	TILE_SEQ_END()
 };
 
--- a/src/table/tree_land.h	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/table/tree_land.h	Wed Jun 13 11:17:30 2007 +0000
@@ -25,7 +25,7 @@
 	{ { 3, 9 }, { 8, 2 }, { 9, 9 }, { 1, 5 } }
 };
 
-static const PalSpriteID _tree_layout_sprite[164+(79-48+1)][4] = {
+static const PalSpriteID _tree_layout_sprite[164 + (79 - 48 + 1)][4] = {
 	{ { 0x652, PAL_NONE }, { 0x659, PAL_NONE }, { 0x660, PAL_NONE }, { 0x667, PAL_NONE } }, /* 0 */
 	{ { 0x652, PAL_NONE }, { 0x667, PAL_NONE }, { 0x66e, PAL_NONE }, { 0x675, PAL_NONE } }, /* 1 */
 	{ { 0x652, PAL_NONE }, { 0x66e, PAL_NONE }, { 0x659, PAL_NONE }, { 0x675, PAL_NONE } }, /* 2 */
--- a/src/terraform_gui.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/terraform_gui.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -273,7 +273,7 @@
 };
 
 static const WindowDesc _terraform_desc = {
-	WDP_ALIGN_TBR, 22+36, 158, 36,
+	WDP_ALIGN_TBR, 22 + 36, 158, 36,
 	WC_SCEN_LAND_GEN, WC_NONE,
 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
 	_terraform_widgets,
--- a/src/texteff.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/texteff.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -246,7 +246,7 @@
 	/* Paint the messages starting with the lowest at the bottom */
 	for (uint y = 13; count-- != 0; y += 13) {
 		DoDrawString(_textmsg_list[count].message, _textmsg_box.x + 3, _screen.height - _textmsg_box.y - y + 1, _textmsg_list[count].color);
- 	}
+	}
 
 	/* Make sure the data is updated next flush */
 	_video_driver->make_dirty(x, y, width, height);
--- a/src/town_cmd.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/town_cmd.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -247,9 +247,9 @@
 static void MarkTownSignDirty(Town *t)
 {
 	MarkAllViewportsDirty(
-		t->sign.left-6,
-		t->sign.top-3,
-		t->sign.left+t->sign.width_1*4+12,
+		t->sign.left - 6,
+		t->sign.top - 3,
+		t->sign.left + t->sign.width_1 * 4 + 12,
 		t->sign.top + 45
 	);
 }
@@ -525,10 +525,10 @@
 no_slope:
 			/* Tile has no slope
 			 * Disallow the road if any neighboring tile has a road. */
-			if (HASBIT(GetTownRoadMask(TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[dir+1]))), dir^2) ||
-					HASBIT(GetTownRoadMask(TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[dir+3]))), dir^2) ||
-					HASBIT(GetTownRoadMask(TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[dir+1]) + ToTileIndexDiff(_roadblock_tileadd[dir+2]))), dir) ||
-					HASBIT(GetTownRoadMask(TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[dir+3]) + ToTileIndexDiff(_roadblock_tileadd[dir+2]))), dir))
+			if (HASBIT(GetTownRoadMask(TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[dir + 1]))), dir ^ 2) ||
+					HASBIT(GetTownRoadMask(TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[dir + 3]))), dir ^ 2) ||
+					HASBIT(GetTownRoadMask(TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[dir + 1]) + ToTileIndexDiff(_roadblock_tileadd[dir + 2]))), dir) ||
+					HASBIT(GetTownRoadMask(TILE_ADD(tile, ToTileIndexDiff(_roadblock_tileadd[dir + 3]) + ToTileIndexDiff(_roadblock_tileadd[dir + 2]))), dir))
 				return false;
 
 			/* Otherwise allow */
@@ -639,7 +639,7 @@
 		}
 		rcmd = (RoadBits)((1 << a) + (1 << b));
 
-	} else if (block < 5 && !HASBIT(mask,block^2)) {
+	} else if (block < 5 && !HASBIT(mask, block ^ 2)) {
 		/* Continue building on a partial road.
 		 * Always OK. */
 		_grow_town_result = 0;
@@ -766,7 +766,7 @@
 
 		/* Select a random bit from the blockmask, walk a step
 		 * and continue the search from there. */
-		do block = Random() & 3; while (!HASBIT(mask,block));
+		do block = Random() & 3; while (!HASBIT(mask, block));
 		tile += ToTileIndexDiff(_roadblock_tileadd[block]);
 
 		if (IsTileType(tile, MP_STREET)) {
--- a/src/train_cmd.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/train_cmd.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -63,7 +63,7 @@
  */
 void TrainPowerChanged(Vehicle* v)
 {
-	uint32 power = 0;
+	uint32 total_power = 0;
 	uint32 max_te = 0;
 
 	for (const Vehicle *u = v; u != NULL; u = u->next) {
@@ -76,19 +76,22 @@
 
 		const RailVehicleInfo *rvi_u = RailVehInfo(u->engine_type);
 
-		if (engine_has_power && rvi_u->power != 0) {
-			power += rvi_u->power;
-			/* Tractive effort in (tonnes * 1000 * 10 =) N */
-			max_te += (u->u.rail.cached_veh_weight * 10000 * rvi_u->tractive_effort) / 256;
+		if (engine_has_power) {
+			uint16 power = GetVehicleProperty(u, 0x0B, rvi_u->power);
+			if (power != 0) {
+				total_power += power;
+				/* Tractive effort in (tonnes * 1000 * 10 =) N */
+				max_te += (u->u.rail.cached_veh_weight * 10000 * GetVehicleProperty(u, 0x1F, rvi_u->tractive_effort)) / 256;
+			}
 		}
 
 		if (HASBIT(u->u.rail.flags, VRF_POWEREDWAGON) && (wagon_has_power)) {
-			power += RailVehInfo(u->u.rail.first_engine)->pow_wag_power;
+			total_power += RailVehInfo(u->u.rail.first_engine)->pow_wag_power;
 		}
 	}
 
-	if (v->u.rail.cached_power != power || v->u.rail.cached_max_te != max_te) {
-		v->u.rail.cached_power = power;
+	if (v->u.rail.cached_power != total_power || v->u.rail.cached_max_te != max_te) {
+		v->u.rail.cached_power = total_power;
 		v->u.rail.cached_max_te = max_te;
 		InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
 		InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
@@ -208,9 +211,10 @@
 			}
 
 			/* max speed is the minimum of the speed limits of all vehicles in the consist */
-			if ((rvi_u->railveh_type != RAILVEH_WAGON || _patches.wagon_speed_limits) &&
-				rvi_u->max_speed != 0 && !UsesWagonOverride(u))
-				max_speed = min(rvi_u->max_speed, max_speed);
+			if ((rvi_u->railveh_type != RAILVEH_WAGON || _patches.wagon_speed_limits) && !UsesWagonOverride(u)) {
+				uint16 speed = GetVehicleProperty(u, 0x09, rvi_u->max_speed);
+				if (speed != 0) max_speed = min(speed, max_speed);
+			}
 		}
 
 		/* check the vehicle length (callback) */
@@ -1981,6 +1985,8 @@
 	if (tfdd.best_length == (uint)-1) return_cmd_error(STR_883A_UNABLE_TO_FIND_ROUTE_TO);
 
 	if (flags & DC_EXEC) {
+		if (v->current_order.type == OT_LOADING) v->LeaveStation();
+
 		v->dest_tile = tfdd.tile;
 		v->current_order.type = OT_GOTO_DEPOT;
 		v->current_order.flags = OF_NON_STOP;
@@ -1989,8 +1995,7 @@
 		v->current_order.refit_cargo = CT_INVALID;
 		InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
 		/* If there is no depot in front, reverse automatically */
-		if (tfdd.reverse)
-			DoCommand(v->tile, v->index, 0, DC_EXEC, CMD_REVERSE_TRAIN_DIRECTION);
+		if (tfdd.reverse) DoCommand(v->tile, v->index, 0, DC_EXEC, CMD_REVERSE_TRAIN_DIRECTION);
 	}
 
 	return 0;
@@ -2984,7 +2989,7 @@
 						} else if (HasSignalOnTrackdir(gp.new_tile, i)) {
 							v->cur_speed = 0;
 							v->subspeed = 0;
-							v->progress = 255-10;
+							v->progress = 255 - 10;
 							if (++v->load_unload_time_rem < _patches.wait_twoway_signal * 73) {
 								TileIndex o_tile = gp.new_tile + TileOffsByDiagDir(enterdir);
 								VehicleAtSignalData vasd;
@@ -3473,16 +3478,17 @@
 
 	do {
 		const RailVehicleInfo *rvi = RailVehInfo(v->engine_type);
-		if (rvi->running_cost_base > 0) {
-			int32 cost_class;
-			switch (rvi->running_cost_class) {
-				default:
-				case 0: cost_class = _eco->GetPrice(CEconomy::RUNNING_RAIL0); break;
-				case 1: cost_class = _eco->GetPrice(CEconomy::RUNNING_RAIL0); break;
-				case 2: cost_class = _eco->GetPrice(CEconomy::RUNNING_RAIL0); break;
-			}
-			cost += rvi->running_cost_base * cost_class;
+
+		byte cost_factor = GetVehicleProperty(v, 0x0D, rvi->running_cost_base);
+		if (cost_factor == 0) continue;
+		switch (rvi->running_cost_class) {
+			default:
+			case 0: cost_factor *= _eco->GetPrice(CEconomy::RUNNING_RAIL0); break;
+			case 1: cost_factor *= _eco->GetPrice(CEconomy::RUNNING_RAIL0); break;
+			case 2: cost_factor *= _eco->GetPrice(CEconomy::RUNNING_RAIL0); break;
 		}
+		cost += rvi->running_cost_base * cost_factor;
+
 	} while ((v = GetNextVehicle(v)) != NULL);
 
 	return cost;
--- a/src/train_gui.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/train_gui.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -234,7 +234,7 @@
 		DrawSprite(v->vehstatus & VS_STOPPED ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, PAL_NONE, 2, w->widget[5].top + 1);
 		DrawStringCenteredTruncated(w->widget[5].left + 8, w->widget[5].right, w->widget[5].top + 1, str, 0);
 		DrawWindowViewport(w);
-	}	break;
+	} break;
 
 	case WE_CLICK: {
 		int wid = e->we.click.widget;
--- a/src/transparency_gui.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/transparency_gui.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -12,6 +12,23 @@
 #include "sound.h"
 #include "variables.h"
 
+enum TransparencyToolbarWidgets{
+	/* Widgets not toggled when pressing the X key */
+	TTW_WIDGET_SIGNS = 3,    ///< Make signs background transparent
+
+	/* Widgets toggled when pressing the X key */
+	TTW_WIDGET_TREES,        ///< Make trees transparent
+	TTW_WIDGET_HOUSES,       ///< Make houses transparent
+	TTW_WIDGET_INDUSTRIES,   ///< Make Industries transparent
+	TTW_WIDGET_BUILDINGS,    ///< Make player buildings and structures transparent
+	TTW_WIDGET_BRIDGES,      ///< Make bridges transparent
+	TTW_WIDGET_STRUCTURES,   ///< Make unmovable structures transparent
+};
+
+/** Toggle the bits of the transparencies variable
+ * when clicking on a widget, and play a sound
+ * @param widget been clicked.
+ */
 static void Transparent_Click(byte widget)
 {
 	TOGGLEBIT(_transparent_opt, widget);
@@ -22,15 +39,17 @@
 {
 	switch (e->event) {
 		case WE_PAINT:
-			for (uint i = 0; i < 7; i++) {
-				SetWindowWidgetLoweredState(w, i + 3, HASBIT(_transparent_opt, i));
+			/* must be sure that the widgets show the transparency variable changes
+			 * also when we use shortcuts */
+			for (uint i = TTW_WIDGET_SIGNS; i < TTW_WIDGET_STRUCTURES; i++) {
+				SetWindowWidgetLoweredState(w, i, HASBIT(_transparent_opt, i - TTW_WIDGET_SIGNS));
 			}
 			DrawWindowWidgets(w);
 			break;
 
 		case WE_CLICK:
-			if (e->we.click.widget >= 3) {
-				Transparent_Click(e->we.click.widget - 3);
+			if (e->we.click.widget >= TTW_WIDGET_SIGNS) {
+				Transparent_Click(e->we.click.widget - TTW_WIDGET_SIGNS);
 				MarkWholeScreenDirty();
 			}
 			break;
@@ -42,7 +61,8 @@
 {  WWT_CAPTION,   RESIZE_NONE,  7,  11, 162,   0,  13, STR_TRANSPARENCY_TOOLB,   STR_018C_WINDOW_TITLE_DRAG_THIS},
 {WWT_STICKYBOX,   RESIZE_NONE,  7, 163, 174,   0,  13, STR_NULL,                 STR_STICKY_BUTTON},
 
-/* transparency widgets: transparent signs, trees, houses, industries, player's buildings */
+/* transparency widgets:
+ * transparent signs, trees, houses, industries, player's buildings, bridges and unmovable structures */
 {   WWT_IMGBTN,   RESIZE_NONE,  7,   0,  21,  14,  35, SPR_IMG_PLACE_SIGN,   STR_TRANSPARENT_SIGNS_DESC},
 {   WWT_IMGBTN,   RESIZE_NONE,  7,  22,  43,  14,  35, SPR_IMG_PLANTTREES,   STR_TRANSPARENT_TREES_DESC},
 {   WWT_IMGBTN,   RESIZE_NONE,  7,  44,  65,  14,  35, SPR_IMG_TOWN,         STR_TRANSPARENT_HOUSES_DESC},
--- a/src/tree_cmd.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/tree_cmd.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -317,7 +317,7 @@
 struct TreeListEnt {
 	SpriteID image;
 	SpriteID pal;
-	byte x,y;
+	byte x, y;
 };
 
 static void DrawTile_Trees(TileInfo *ti)
--- a/src/variables.h	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/variables.h	Wed Jun 13 11:17:30 2007 +0000
@@ -386,8 +386,8 @@
 StringID BindCString(const char *str);
 
 
-#define COPY_IN_DPARAM(offs,src,num) memcpy(_decode_parameters + offs, src, sizeof(uint32) * (num))
-#define COPY_OUT_DPARAM(dst,offs,num) memcpy(dst,_decode_parameters + offs, sizeof(uint32) * (num))
+#define COPY_IN_DPARAM(offs, src, num) memcpy(_decode_parameters + offs, src, sizeof(uint32) * (num))
+#define COPY_OUT_DPARAM(dst, offs, num) memcpy(dst, _decode_parameters + offs, sizeof(uint32) * (num))
 
 
 #define SET_EXPENSES_TYPE(x) _yearly_expenses_type = x;
--- a/src/vehicle.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/vehicle.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -188,9 +188,9 @@
 	}
 	FOR_ALL_VEHICLES(veh) {
 		if (without_crashed && (veh->vehstatus & VS_CRASHED) != 0) continue;
-		if ((veh->type == VEH_TRAIN || veh->type == VEH_ROAD) && (z==0xFF || veh->z_pos == z)) {
-			if ((veh->x_pos>>4) >= x1 && (veh->x_pos>>4) <= x2 &&
-					(veh->y_pos>>4) >= y1 && (veh->y_pos>>4) <= y2) {
+		if ((veh->type == VEH_TRAIN || veh->type == VEH_ROAD) && (z == 0xFF || veh->z_pos == z)) {
+			if ((veh->x_pos >> 4) >= x1 && (veh->x_pos >> 4) <= x2 &&
+					(veh->y_pos >> 4) >= y1 && (veh->y_pos >> 4) <= y2) {
 				return veh;
 			}
 		}
@@ -251,6 +251,8 @@
 						Vehicle *rotor = shadow->next;
 						rotor->cur_image = GetRotorImage(v);
 					}
+
+					UpdateAircraftCache(v);
 				}
 				break;
 			default: break;
@@ -419,7 +421,7 @@
 	int old_x = v->left_coord;
 	int old_y = v->top_coord;
 
-	new_hash = (x == INVALID_COORD) ? NULL : &_vehicle_position_hash[GEN_HASH(x,y)];
+	new_hash = (x == INVALID_COORD) ? NULL : &_vehicle_position_hash[GEN_HASH(x, y)];
 	old_hash = (old_x == INVALID_COORD) ? NULL : &_vehicle_position_hash[GEN_HASH(old_x, old_y)];
 
 	if (old_hash == new_hash) return;
@@ -568,6 +570,10 @@
 
 void DestroyVehicle(Vehicle *v)
 {
+	if (IsValidStationID(v->last_station_visited)) {
+		GetStation(v->last_station_visited)->loading_vehicles.remove(v);
+	}
+
 	if (IsEngineCountable(v)) {
 		GetPlayer(v->owner)->num_engines[v->engine_type]--;
 		if (v->owner == _local_player) InvalidateAutoreplaceWindow(v->engine_type);
@@ -1837,6 +1843,17 @@
 
 	do {
 
+		if (!(flags & DC_EXEC)) {
+			/* Get the refit cost.
+			 * This is only needed when estimating as when the command is executed, the cost from the refit command is used.
+			 * This needs to be done for every single unit, so it should be done before checking if it's a multiheaded engine. */
+			CargoID new_cargo_type = GetEngineCargoType(v->engine_type);
+
+			if (new_cargo_type != v->cargo_type && new_cargo_type != CT_INVALID) {
+				total_cost += GetRefitCost(v->engine_type);
+			}
+		}
+
 		if (IsMultiheaded(v) && !IsTrainEngine(v)) {
 			/* we build the rear ends of multiheaded trains with the front ones */
 			continue;
@@ -1859,7 +1876,7 @@
 					/* We can't pay for refitting because we can't estimate refitting costs for a vehicle before it's build.
 					 * If we pay for it anyway, the cost and the estimated cost will not be the same and we will have an assert.
 					 * We need to check the whole chain if it is a train because some newgrf articulated engines can refit some units only (and not the front) */
-					DoCommand(0, w->index, v2->cargo_type | (v2->cargo_subtype << 8), flags, GetCmdRefitVeh(v));
+					total_cost += DoCommand(0, w->index, v2->cargo_type | (v2->cargo_subtype << 8), flags, GetCmdRefitVeh(v));
 					break; // We learned that the engine in question needed a refit. No need to check anymore
 				}
 			} while (v->type == VEH_TRAIN && (w2 = w2->next) != NULL && (v2 = v2->next) != NULL);
@@ -2221,7 +2238,7 @@
 				}
 
 				SetDParam(0, v->unitnumber);
-				AddNewsItem(string, NEWS_FLAGS(NM_SMALL, NF_VIEWPORT|NF_VEHICLE, NT_ADVICE, 0),	v->index, 0);
+				AddNewsItem(string, NEWS_FLAGS(NM_SMALL, NF_VIEWPORT|NF_VEHICLE, NT_ADVICE, 0), v->index, 0);
 			}
 		}
 	}
@@ -2901,6 +2918,7 @@
 {
 	assert(IsTileType(tile, MP_STATION) || type == VEH_SHIP);
 	current_order.type = OT_LOADING;
+	GetStation(this->last_station_visited)->loading_vehicles.push_back(this);
 }
 
 void Vehicle::LeaveStation()
@@ -2909,4 +2927,5 @@
 	assert(current_order.type == OT_LOADING);
 	current_order.type = OT_LEAVESTATION;
 	current_order.flags = 0;
+	GetStation(this->last_station_visited)->loading_vehicles.remove(this);
 }
--- a/src/vehicle.h	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/vehicle.h	Wed Jun 13 11:17:30 2007 +0000
@@ -166,6 +166,7 @@
 
 struct VehicleAir {
 	uint16 crashed_counter;
+	uint16 cached_max_speed;
 	byte pos;
 	byte previous_pos;
 	StationID targetairport;
@@ -407,7 +408,7 @@
 /* Flags to add to p2 for goto depot commands */
 /* Note: bits 8-10 are used for VLW flags */
 enum {
-	DEPOT_SERVICE       = (1 << 0),	// The vehicle will leave the depot right after arrival (serivce only)
+	DEPOT_SERVICE       = (1 << 0), // The vehicle will leave the depot right after arrival (serivce only)
 	DEPOT_MASS_SEND     = (1 << 1), // Tells that it's a mass send to depot command (type in VLW flag)
 	DEPOT_DONT_CANCEL   = (1 << 2), // Don't cancel current goto depot command if any
 	DEPOT_LOCATE_HANGAR = (1 << 3), // Find another airport if the target one lacks a hangar
--- a/src/vehicle_gui.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/vehicle_gui.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -343,34 +343,34 @@
 			SetDParam(1, v->unitnumber);
 			DrawWindowWidgets(w);
 
-			WP(w,refit_d).cargo = DrawVehicleRefitWindow(WP(w, refit_d).list, WP(w, refit_d).sel, w->vscroll.pos, w->vscroll.cap, w->resize.step_height);
+			WP(w, refit_d).cargo = DrawVehicleRefitWindow(WP(w, refit_d).list, WP(w, refit_d).sel, w->vscroll.pos, w->vscroll.cap, w->resize.step_height);
 
-			if (WP(w,refit_d).cargo != NULL) {
+			if (WP(w, refit_d).cargo != NULL) {
 				int32 cost;
 
-				cost = DoCommand(v->tile, v->index, WP(w,refit_d).cargo->cargo | WP(w,refit_d).cargo->subtype << 8,
+				cost = DoCommand(v->tile, v->index, WP(w, refit_d).cargo->cargo | WP(w, refit_d).cargo->subtype << 8,
 								 DC_QUERY_COST, GetCmdRefitVeh(GetVehicle(w->window_number)->type));
 
 				if (!CmdFailed(cost)) {
-					SetDParam(0, WP(w,refit_d).cargo->cargo);
+					SetDParam(0, WP(w, refit_d).cargo->cargo);
 					SetDParam(1, _returned_refit_capacity);
 					SetDParam(2, cost);
 					DrawString(2, w->widget[5].top + 1, STR_9840_NEW_CAPACITY_COST_OF_REFIT, 0);
 				}
 			}
-		}	break;
+		} break;
 
 		case WE_CLICK:
 			switch (e->we.click.widget) {
 				case 3: { // listbox
 					int y = e->we.click.pt.y - w->widget[3].top;
 					if (y >= 0) {
-						WP(w,refit_d).sel = (y / (int)w->resize.step_height) + w->vscroll.pos;
+						WP(w, refit_d).sel = (y / (int)w->resize.step_height) + w->vscroll.pos;
 						SetWindowDirty(w);
 					}
 				} break;
 				case 6: // refit button
-					if (WP(w,refit_d).cargo != NULL) {
+					if (WP(w, refit_d).cargo != NULL) {
 						const Vehicle *v = GetVehicle(w->window_number);
 
 						if (WP(w, refit_d).order == INVALID_VEH_ORDER_ID) {
@@ -382,9 +382,9 @@
 								case VEH_SHIP:     command = CMD_REFIT_SHIP         | CMD_MSG(STR_9841_CAN_T_REFIT_SHIP);     break;
 								case VEH_AIRCRAFT: command = CMD_REFIT_AIRCRAFT     | CMD_MSG(STR_A042_CAN_T_REFIT_AIRCRAFT); break;
 							}
-							if (DoCommandP(v->tile, v->index, WP(w,refit_d).cargo->cargo | WP(w,refit_d).cargo->subtype << 8, NULL, command)) DeleteWindow(w);
+							if (DoCommandP(v->tile, v->index, WP(w, refit_d).cargo->cargo | WP(w, refit_d).cargo->subtype << 8, NULL, command)) DeleteWindow(w);
 						} else {
-							if (DoCommandP(v->tile, v->index, WP(w,refit_d).cargo->cargo | WP(w,refit_d).cargo->subtype << 8 | WP(w, refit_d).order << 16, NULL, CMD_ORDER_REFIT)) DeleteWindow(w);
+							if (DoCommandP(v->tile, v->index, WP(w, refit_d).cargo->cargo | WP(w, refit_d).cargo->subtype << 8 | WP(w, refit_d).order << 16, NULL, CMD_ORDER_REFIT)) DeleteWindow(w);
 						}
 					}
 					break;
@@ -418,7 +418,7 @@
 
 static const WindowDesc _vehicle_refit_desc = {
 	WDP_AUTO, WDP_AUTO, 240, 174,
-	WC_VEHICLE_REFIT,WC_VEHICLE_VIEW,
+	WC_VEHICLE_REFIT, WC_VEHICLE_VIEW,
 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE,
 	_vehicle_refit_widgets,
 	VehicleRefitWndProc,
@@ -426,7 +426,7 @@
 
 /** Show the refit window for a vehicle
 * @param *v The vehicle to show the refit window for
-* @param order of the vehicle (?)
+* @param order of the vehicle ( ? )
 */
 void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order)
 {
@@ -922,7 +922,7 @@
 	vl->l.flags = VL_REBUILD | (vl->_sorting->order ? VL_DESC : VL_NONE);
 	vl->l.sort_type = vl->_sorting->criteria;
 	vl->sort_list = NULL;
-	vl->l.resort_timer = DAY_TICKS * PERIODIC_RESORT_DAYS;	// Set up resort timer
+	vl->l.resort_timer = DAY_TICKS * PERIODIC_RESORT_DAYS; // Set up resort timer
 }
 
 static void DrawSmallOrderList(const Vehicle *v, int x, int y)
@@ -1140,7 +1140,7 @@
 					DoCommandP(0, GB(w->window_number, 16, 16), (w->window_number & VLW_MASK) | (1 << 6) | (e->we.click.widget == VLW_WIDGET_START_ALL ? (1 << 5) : 0) | vl->vehicle_type, NULL, CMD_MASS_START_STOP);
 					break;
 			}
-		}	break;
+		} break;
 
 		case WE_DROPDOWN_SELECT: /* we have selected a dropdown item in the list */
 			switch (e->we.dropdown.button) {
--- a/src/video/win32_v.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/video/win32_v.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -45,7 +45,7 @@
 	LOGPALETTE *pal;
 	uint i;
 
-	pal = (LOGPALETTE*)alloca(sizeof(LOGPALETTE) + (256-1) * sizeof(PALETTEENTRY));
+	pal = (LOGPALETTE*)alloca(sizeof(LOGPALETTE) + (256 - 1) * sizeof(PALETTEENTRY));
 
 	pal->palVersion = 0x300;
 	pal->palNumEntries = 256;
@@ -653,8 +653,8 @@
 		_wnd.alloced_bits = NULL;
 	}
 
-	bi = (BITMAPINFO*)alloca(sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*256);
-	memset(bi, 0, sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*256);
+	bi = (BITMAPINFO*)alloca(sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 256);
+	memset(bi, 0, sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD) * 256);
 	bi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
 
 	if (_wnd.double_size) {
--- a/src/viewport.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/viewport.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -2050,7 +2050,7 @@
 * To correctly get the height difference we need the direction we are dragging
 * in, as well as with what kind of tool we are dragging. For example a horizontal
 * autorail tool that starts in bottom and ends at the top of a tile will need the
-* maximum of SW,S and SE,N corners respectively. This is handled by the lookup table below
+* maximum of SW, S and SE, N corners respectively. This is handled by the lookup table below
 * See _tileoffs_by_dir in map.c for the direction enums if you can't figure out
 * the values yourself.
 * @param style HightlightStyle of drag. This includes direction and style (autorail, rect, etc.)
@@ -2395,7 +2395,7 @@
 	e.we.place.userdata = _thd.userdata;
 
 	/* stop drag mode if the window has been closed */
-	w = FindWindowById(_thd.window_class,_thd.window_number);
+	w = FindWindowById(_thd.window_class, _thd.window_number);
 	if (w == NULL) {
 		ResetObjectToPlace();
 		return false;
--- a/src/water_cmd.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/water_cmd.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -651,7 +651,7 @@
 
 		SetDParam(0, pass);
 		AddNewsItem(STR_B006_FLOOD_VEHICLE_DESTROYED,
-			NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ACCIDENT, 0),
+			NEWS_FLAGS(NM_THIN, NF_VIEWPORT | NF_VEHICLE, NT_ACCIDENT, 0),
 			v->index,
 			0);
 		CreateEffectVehicleRel(v, 4, 4, 8, EV_EXPLOSION_LARGE);
--- a/src/win32.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/win32.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -335,7 +335,7 @@
 
 static void SetWndSize(HWND wnd, int mode)
 {
-	RECT r,r2;
+	RECT r, r2;
 	int offs;
 
 	GetWindowRect(wnd, &r);
@@ -368,7 +368,7 @@
 	return b;
 }
 
-static INT_PTR CALLBACK CrashDialogFunc(HWND wnd,UINT msg,WPARAM wParam,LPARAM lParam)
+static INT_PTR CALLBACK CrashDialogFunc(HWND wnd, UINT msg, WPARAM wParam, LPARAM lParam)
 {
 	switch (msg) {
 		case WM_INITDIALOG: {
@@ -418,7 +418,7 @@
 					EnableWindow(GetDlgItem(wnd, 14), FALSE);
 					SetCursor(LoadCursor(NULL, IDC_ARROW));
 					MessageBox(wnd, _T("Crash report submitted. Thank you."), _T("Crash Report"), MB_ICONINFORMATION);
-				}	break;
+				} break;
 #endif /* Disabled crash-submit procedures */
 				case 15: /* Expand window to show crash-message */
 					_expanded ^= 1;
@@ -549,7 +549,7 @@
 	}
 
 	{
-		int i,j;
+		int i, j;
 #ifdef _M_AMD64
 		uint32 *b = (uint32*)ep->ContextRecord->Rsp;
 #else
@@ -557,7 +557,7 @@
 #endif
 		for (j = 0; j != 24; j++) {
 			for (i = 0; i != 8; i++) {
-				if (IsBadReadPtr(b,sizeof(uint32))) {
+				if (IsBadReadPtr(b, sizeof(uint32))) {
 					output += sprintf(output, " ????????"); //OCR: WAS - , 0);
 				} else {
 					output += sprintf(output, " %.8X", *b);
--- a/src/window.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/window.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -235,25 +235,25 @@
 				bottom > v->top &&
 				left < v->left + v->width &&
 				top < v->top + v->height) {
-			if (left < (x=v->left)) {
+			if (left < (x = v->left)) {
 				DrawOverlappedWindow(wz, left, top, x, bottom);
 				DrawOverlappedWindow(wz, x, top, right, bottom);
 				return;
 			}
 
-			if (right > (x=v->left + v->width)) {
+			if (right > (x = v->left + v->width)) {
 				DrawOverlappedWindow(wz, left, top, x, bottom);
 				DrawOverlappedWindow(wz, x, top, right, bottom);
 				return;
 			}
 
-			if (top < (x=v->top)) {
+			if (top < (x = v->top)) {
 				DrawOverlappedWindow(wz, left, top, right, x);
 				DrawOverlappedWindow(wz, left, x, right, bottom);
 				return;
 			}
 
-			if (bottom > (x=v->top + v->height)) {
+			if (bottom > (x = v->top + v->height)) {
 				DrawOverlappedWindow(wz, left, top, right, x);
 				DrawOverlappedWindow(wz, left, x, right, bottom);
 				return;
@@ -823,7 +823,7 @@
 			case WDP_ALIGN_TBR: { /* Align the right side with the top toolbar */
 				w = FindWindowById(WC_MAIN_TOOLBAR, 0);
 				pt.x = (w->left + w->width) - desc->width;
-			}	break;
+			} break;
 			case WDP_ALIGN_TBL: /* Align the left side with the top toolbar */
 				pt.x = FindWindowById(WC_MAIN_TOOLBAR, 0)->left;
 				break;
--- a/src/yapf/yapf_base.hpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/yapf/yapf_base.hpp	Wed Jun 13 11:17:30 2007 +0000
@@ -117,7 +117,8 @@
 		while (true) {
 			m_num_steps++;
 			Node *n = m_nodes.GetBestOpenNode();
-			if (n == NULL) break;
+			if (n == NULL)
+				break;
 
 			// if the best open node was worse than the best path found, we can finish
 			if (m_pBestDestNode != NULL && m_pBestDestNode->GetCost() < n->GetCostEstimate())
@@ -160,9 +161,9 @@
 	/** If path was found return the best node that has reached the destination. Otherwise
 	 *  return the best visited node (which was nearest to the destination).
 	 */
-	FORCEINLINE Node& GetBestNode()
+	FORCEINLINE Node* GetBestNode()
 	{
-		return (m_pBestDestNode != NULL) ? *m_pBestDestNode : *m_pBestIntermediateNode;
+		return (m_pBestDestNode != NULL) ? m_pBestDestNode : m_pBestIntermediateNode;
 	}
 
 	/** Calls NodeList::CreateNewNode() - allocates new node that can be filled and used
--- a/src/yapf/yapf_rail.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/yapf/yapf_rail.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -61,11 +61,11 @@
 
 		// some path found
 		// get found depot tile
-		Node& n = Yapf().GetBestNode();
-		*depot_tile = n.GetLastTile();
+		Node *n = Yapf().GetBestNode();
+		*depot_tile = n->GetLastTile();
 
 		// walk through the path back to the origin
-		Node* pNode = &n;
+		Node *pNode = n;
 		while (pNode->m_parent != NULL) {
 			pNode = pNode->m_parent;
 		}
@@ -128,7 +128,7 @@
 
 		// if path not found - return INVALID_TRACKDIR
 		Trackdir next_trackdir = INVALID_TRACKDIR;
-		Node* pNode = &Yapf().GetBestNode();
+		Node *pNode = Yapf().GetBestNode();
 		if (pNode != NULL) {
 			// path was found or at least suggested
 			// walk through the path back to the origin
@@ -165,7 +165,7 @@
 
 		// path was found
 		// walk through the path back to the origin
-		Node* pNode = &Yapf().GetBestNode();
+		Node *pNode = Yapf().GetBestNode();
 		while (pNode->m_parent != NULL) {
 			pNode = pNode->m_parent;
 		}
--- a/src/yapf/yapf_road.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/yapf/yapf_road.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -287,7 +287,7 @@
 
 		// if path not found - return INVALID_TRACKDIR
 		Trackdir next_trackdir = INVALID_TRACKDIR;
-		Node* pNode = &Yapf().GetBestNode();
+		Node *pNode = Yapf().GetBestNode();
 		if (pNode != NULL) {
 			// path was found or at least suggested
 			// walk through the path back to its origin
@@ -329,7 +329,7 @@
 
 		// if path not found - return distance = UINT_MAX
 		uint dist = UINT_MAX;
-		Node* pNode = &Yapf().GetBestNode();
+		Node *pNode = Yapf().GetBestNode();
 		if (pNode != NULL) {
 			// path was found or at least suggested
 			// get the path cost estimate
@@ -371,8 +371,8 @@
 
 		// some path found
 		// get found depot tile
-		Node& n = Yapf().GetBestNode();
-		TileIndex depot_tile = n.m_segment_last_tile;
+		Node *n = Yapf().GetBestNode();
+		TileIndex depot_tile = n->m_segment_last_tile;
 		assert(IsTileDepotType(depot_tile, TRANSPORT_ROAD));
 		Depot* ret = GetDepotByTile(depot_tile);
 		return ret;
--- a/src/yapf/yapf_ship.cpp	Wed Jun 13 11:00:24 2007 +0000
+++ b/src/yapf/yapf_ship.cpp	Wed Jun 13 11:17:30 2007 +0000
@@ -61,13 +61,13 @@
 		pf.SetOrigin(src_tile, trackdirs);
 		pf.SetDestination(v->dest_tile, dest_trackdirs);
 		// find best path
-		bool bFound = pf.FindPath(v);
+		pf.FindPath(v);
 
 		Trackdir next_trackdir = INVALID_TRACKDIR; // this would mean "path not found"
-		if (bFound) {
-			// path was found
+
+		Node* pNode = pf.GetBestNode();
+		if (pNode != NULL) {
 			// walk through the path back to the origin
-			Node* pNode = &pf.GetBestNode();
 			Node* pPrevNode = NULL;
 			while (pNode->m_parent != NULL) {
 				pPrevNode = pNode;