(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
authortruelight
Fri, 10 Sep 2004 19:02:27 +0000
changeset 193 0a7025304867
parent 192 614bba52258d
child 194 2d857a5f1b5e
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
ai.c
ai_build.c
ai_pathfinder.c
aircraft_cmd.c
aircraft_gui.c
airport_gui.c
aystar.c
aystar.h
bridge_gui.c
clear_cmd.c
command.c
command.h
console.c
disaster_cmd.c
dock_gui.c
economy.c
economy.h
engine.c
engine_gui.c
fileio.c
gfx.c
gfx.h
graph_gui.c
grfspecial.c
hal.h
industry_gui.c
intro_gui.c
macros.h
main_gui.c
misc_cmd.c
misc_gui.c
music_gui.c
namegen.c
network.c
network_gui.c
news_gui.c
oldloader.c
order_cmd.c
order_gui.c
pathfind.c
road_gui.c
roadveh_cmd.c
roadveh_gui.c
saveload.c
screenshot.c
sdl.c
settings.c
settings_gui.c
ship_cmd.c
ship_gui.c
smallmap_gui.c
sound.c
station.h
station_cmd.c
station_gui.c
stdafx.h
strings.c
subsidy_gui.c
terraform_gui.c
texteff.c
town.h
town_cmd.c
town_gui.c
train_cmd.c
train_gui.c
tree_cmd.c
ttd.c
ttd.h
tunnelbridge_cmd.c
unix.c
unmovable_cmd.c
variables.h
vehicle.c
vehicle.h
vehicle_gui.c
viewport.c
viewport.h
w32dm2.cpp
water_cmd.c
widget.c
win32.c
window.c
--- a/ai.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/ai.c	Fri Sep 10 19:02:27 2004 +0000
@@ -68,7 +68,7 @@
 static void AiStateVehLoop(Player *p)
 {
 	Vehicle *v;
-	
+
 	v = p->ai.cur_veh == NULL ? _vehicles : p->ai.cur_veh+1;
 
 	for (;v != endof(_vehicles); v++) {
@@ -79,7 +79,7 @@
 				v->type == VEH_Road ||
 				(v->type == VEH_Aircraft && v->subtype <= 2) ||
 				v->type == VEH_Ship) {
-			
+
 			/* replace engine? */
 			if (v->type == VEH_Train && v->engine_type < 3 &&
 					(_price.build_railvehicle >> 3) < p->player_money) {
@@ -115,7 +115,7 @@
 
 // XXX
 static const byte _rail_locos_count[3] = {
-	27, 3, 5		
+	27, 3, 5
 };
 extern const byte _rail_engines_start[3];
 
@@ -130,14 +130,14 @@
 	Engine *e = &_engines[i];
 	do {
 		assert(!(_rail_vehicle_info[i].flags & RVI_WAGON));
-		
+
 		if (!HASBIT(e->player_avail, _current_player) || e->reliability < 0x8A3D)
 			continue;
 
 		r = DoCommandByTile(0, i, 0, 0, CMD_BUILD_RAIL_VEHICLE);
-		if (r != CMD_ERROR && 
-					(!(_cmd_build_rail_veh_var1&1) || !(flag&1)) && 
-					r <= money && 
+		if (r != CMD_ERROR &&
+					(!(_cmd_build_rail_veh_var1&1) || !(flag&1)) &&
+					r <= money &&
 				_cmd_build_rail_veh_score >= best_veh_score) {
 			best_veh_score = _cmd_build_rail_veh_score;
 			best_veh_index = i;
@@ -206,7 +206,7 @@
 	// adjust base price when more expensive vehicles are available
 	if (p->ai.railtype_to_use == 1) base = (base * 3) >> 1;
 	else if (p->ai.railtype_to_use == 2) base *= 2;
-	
+
 	return base;
 }
 
@@ -266,7 +266,7 @@
 		p->ai.cur_veh->next_order = OT_DUMMY;
 		InvalidateWindow(WC_VEHICLE_VIEW, p->ai.cur_veh->index);
 	}
-} 
+}
 
 static void AiRestoreVehicleOrders(Vehicle *v, BackuppedOrders *bak)
 {
@@ -296,7 +296,7 @@
 	if (veh != -1) {
 		BackupVehicleOrders(v, orderbak);
 		tile = v->tile;
-		
+
 		if (DoCommandByTile(0, v->index, 2, DC_EXEC, CMD_SELL_RAIL_WAGON) != CMD_ERROR &&
 			 DoCommandByTile(tile, veh, 0, DC_EXEC, CMD_BUILD_RAIL_VEHICLE) != CMD_ERROR) {
 			veh = _new_train_id;
@@ -324,7 +324,7 @@
 	if (veh != -1) {
 		BackupVehicleOrders(v, orderbak);
 		tile = v->tile;
-		
+
 		if (DoCommandByTile(0, v->index, 0, DC_EXEC, CMD_SELL_ROAD_VEH) != CMD_ERROR &&
 			 DoCommandByTile(tile, veh, 0, DC_EXEC, CMD_BUILD_ROAD_VEH) != CMD_ERROR) {
 			veh = _new_roadveh_id;
@@ -437,7 +437,7 @@
 	// initially error
 	fr->distance = -1;
 
-	// Randomize subsidy index.. 
+	// Randomize subsidy index..
 	i = RandomRange(lengthof(_subsidies) * 3);
 	if (i >= lengthof(_subsidies))
 		return;
@@ -476,7 +476,7 @@
 	// initially error
 	fr->distance = -1;
 
-	// Randomize subsidy index.. 
+	// Randomize subsidy index..
 	i = RandomRange(lengthof(_subsidies) * 3);
 	if (i >= lengthof(_subsidies))
 		return;
@@ -512,7 +512,7 @@
 
 	// pick a source
 	fr->from = i = AiFindRandomIndustry();
-	if (i == NULL)	
+	if (i == NULL)
 		return;
 
 	// pick a random produced cargo
@@ -539,7 +539,7 @@
 		t = AiFindRandomTown();
 		if (t == NULL || t->population < (uint32)(cargo == CT_FOOD ? 200 : 900))
 			return;
-		
+
 		fr->to = t;
 		fr->distance = GetTileDist(i->xy, t->xy);
 	}
@@ -558,7 +558,7 @@
 	fr->from = source = AiFindRandomTown();
 	if (source == NULL || source->population < 400)
 		return;
-	
+
 	fr->to = dest = AiFindRandomTown();
 	if (dest == NULL || source == dest || dest->population < 400)
 		return;
@@ -589,7 +589,7 @@
 		if (to_tile == from_tile && st->xy == to_tile)
 		    same_station++;
 	}
-	
+
 	// To prevent the AI from building ten busstations in the same town, do some calculations
 	//  For each road or airport station, we want 350 of population!
 	if ((bitmask == 2 || bitmask == 4) && same_station > 2 && ((Town *)(fr->from))->population < same_station * 350)
@@ -612,8 +612,8 @@
 			return false;
 	} else {
 		Industry *i = (Industry*)fr->from;
-		
-		if (i->pct_transported[fr->cargo != i->produced_cargo[0]] > 0x99 || 
+
+		if (i->pct_transported[fr->cargo != i->produced_cargo[0]] > 0x99 ||
 				i->total_production[fr->cargo != i->produced_cargo[0]] == 0)
 			return false;
 	}
@@ -680,7 +680,7 @@
 	p->ai.src.cargo = fr.cargo | 0x80;
 
 	// Fill the dest field
-	
+
 	p->ai.dst.use_tile = 0;
 	p->ai.dst.rand_rng = 9;
 	p->ai.dst.cur_building_rule = 0xFF;
@@ -751,7 +751,7 @@
 
 	i = 60;
 	for(;;) {
-		
+
 		// look for one from the subsidy list
 		AiFindSubsidyIndustryRoute(&fr);
 		if (IS_INT_INSIDE(fr.distance, 40, 60+1))
@@ -824,7 +824,7 @@
 
 	i = 60;
 	for(;;) {
-		
+
 		// look for one from the subsidy list
 		AiFindSubsidyIndustryRoute(&fr);
 		if (IS_INT_INSIDE(fr.distance, 15, 40+1))
@@ -897,7 +897,7 @@
 
 	i = 60;
 	for(;;) {
-		
+
 		// look for one from the subsidy list
 		AiFindSubsidyPassengerRoute(&fr);
 		if (IS_INT_INSIDE(fr.distance, 60, 110+1))
@@ -1003,7 +1003,7 @@
 
 	i = 60;
 	for(;;) {
-		
+
 		// look for one from the subsidy list
 		AiFindSubsidyPassengerRoute(&fr);
 		if (IS_INT_INSIDE(fr.distance, 0, 55+1))
@@ -1075,7 +1075,7 @@
 	uint16 r;
 	p->ai.railtype_to_use = p->max_railtype - 1;
 	r = (uint16)Random();
-	
+
 	if (r > 0xD000) {
 		AiWantLongIndustryRoute(p);
 	} else if (r > 0x6000) {
@@ -1096,7 +1096,7 @@
 
 	i = 60;
 	for(;;) {
-		
+
 		// look for one from the subsidy list
 		AiFindSubsidyIndustryRoute(&fr);
 		if (IS_INT_INSIDE(fr.distance, 35, 55+1))
@@ -1157,7 +1157,7 @@
 
 	i = 60;
 	for(;;) {
-		
+
 		// look for one from the subsidy list
 		AiFindSubsidyIndustryRoute(&fr);
 		if (IS_INT_INSIDE(fr.distance, 15, 40+1))
@@ -1218,7 +1218,7 @@
 
 	i = 60;
 	for(;;) {
-		
+
 		// look for one from the subsidy list
 		AiFindSubsidyPassengerRoute(&fr);
 		if (IS_INT_INSIDE(fr.distance, 55, 180+1))
@@ -1356,7 +1356,7 @@
 
 	i = 60;
 	for(;;) {
-		
+
 		// look for one from the subsidy list
 		AiFindSubsidyPassengerRoute(&fr);
 		if (IS_INT_INSIDE(fr.distance,0,95+1))
@@ -1401,7 +1401,7 @@
 	p->ai.order_list_blocks[0] = 0;
 	p->ai.order_list_blocks[1] = 1;
 	p->ai.order_list_blocks[2] = 255;
-	
+
 	p->ai.state = AIS_AIRPORT_STUFF;
 	p->ai.timeout_counter = 0;
 }
@@ -1498,11 +1498,11 @@
 	i = 200;
 	for(;;) {
 		r = (uint16)Random();
-		
+
 		if (_patches.ai_disable_veh_train && _patches.ai_disable_veh_roadveh &&
 			_patches.ai_disable_veh_aircraft && _patches.ai_disable_veh_ship)
 			return;
-		
+
 		if (r < 0x7626) {
 			if (_patches.ai_disable_veh_train) continue;
 			AiWantTrainRoute(p);
@@ -1516,7 +1516,7 @@
 			if (_patches.ai_disable_veh_ship) continue;
 			AiWantShipRoute(p);
 		}
-		
+
 		// got a route?
 		if (p->ai.state != AIS_WANT_NEW_ROUTE)
 			break;
@@ -1598,7 +1598,7 @@
 
 			j = p->attr;
 			k = 0;
-			
+
 			// Build the rail
 			for(i=0; i!=6; i++,j>>=1) {
 				if (j&1) {
@@ -1608,7 +1608,7 @@
 					total_cost += r;
 				}
 			}
-			
+
 			/* signals too? */
 			if (j&3) {
 				// Can't build signals on a road.
@@ -1643,7 +1643,7 @@
 			// Unk
 			break;
 		}
-		
+
 		p++;
 	}
 
@@ -1663,7 +1663,7 @@
 	const AiDefaultRailBlock *p;
 
 	for(i=0; (p = _default_rail_track_data[i]) != NULL; i++) {
-		if (p->p0 == p0 && p->p1 == p1 && p->p2 == p2 && p->p3 == p3 && 
+		if (p->p0 == p0 && p->p1 == p1 && p->p2 == p2 && p->p3 == p3 &&
 				(p->dir == 0xFF || p->dir == dir || ((p->dir-1)&3) == dir)) {
 			*cost = AiDoBuildDefaultRailTrack(tile, p->data, DC_NO_TOWN_RATING);
 			if (*cost != CMD_ERROR && AiCheckTrackResources(tile, p->data, cargo))
@@ -1723,7 +1723,7 @@
 	} while (--unk >= 0);
 
 	slope = GetTileSlope(tile, &h);
-	
+
 	if (slope != 0) {
 		if (mode > 0 || (mode == 0 && !(r&0xC))) {
 			// Terraform up
@@ -1731,9 +1731,9 @@
 				DC_EXEC | DC_AUTO | DC_NO_WATER, CMD_TERRAFORM_LAND);
 		} else if (h != 0) {
 			// Terraform down
-			DoCommandByTile(tile, _terraform_down_flags[slope-1], 0, 
+			DoCommandByTile(tile, _terraform_down_flags[slope-1], 0,
 				DC_EXEC | DC_AUTO | DC_NO_WATER, CMD_TERRAFORM_LAND);
-		}				
+		}
 	}
 
 	_current_player = old_player;
@@ -1850,7 +1850,7 @@
 	arpfd.tile2 = p->ai.cur_tile_a;
 	arpfd.flag = false;
 	arpfd.count = 0;
-	FollowTrack(p->ai.cur_tile_a + _tileoffs_by_dir[p->ai.cur_dir_a], 0x2000 | TRANSPORT_RAIL, p->ai.cur_dir_a^2, 
+	FollowTrack(p->ai.cur_tile_a + _tileoffs_by_dir[p->ai.cur_dir_a], 0x2000 | TRANSPORT_RAIL, p->ai.cur_dir_a^2,
 		(TPFEnumProc*)AiEnumFollowTrack, NULL, &arpfd);
 	return arpfd.count > 8;
 }
@@ -1888,7 +1888,7 @@
 	int i;
 
 	for(i=0; i!=p->ai.banned_tile_count; i++)
-		if (p->ai.banned_tiles[i] == tile && 
+		if (p->ai.banned_tiles[i] == tile &&
 				p->ai.banned_val[i] == val)
 					return true;
 	return false;
@@ -1924,7 +1924,7 @@
 			arf->best_ptr = p;
 			arf->best_tile = arf->cur_best_tile;
 			better = true;
-		}	
+		}
 	} else if (arf->recursive_mode > 1) {
 		// Mode is 2.
 		if (arf->best_dist != 0 || arf->cur_best_depth < arf->best_depth) {
@@ -1948,7 +1948,7 @@
 	bool flag;
 
 	int dir2 = p[0] & 3;
-	
+
 	FindLandscapeHeightByTile(&arf->ti, tile);
 
 	if (arf->ti.tileh == _dir_table_1[dir2] || (arf->ti.tileh==0 && arf->ti.z!=0)) {
@@ -1969,11 +1969,11 @@
 		}
 
 		// Is building a (rail)bridge possible at this place (type doesn't matter)?
-		if (DoCommandByTile(tile_new, tile, arf->player->ai.railtype_to_use<<8, 
+		if (DoCommandByTile(tile_new, tile, arf->player->ai.railtype_to_use<<8,
 			DC_AUTO, CMD_BUILD_BRIDGE) == CMD_ERROR)
 				return;
 		AiBuildRailRecursive(arf, tile_new, dir2);
-		
+
 		// At the bottom depth, check if the new path is better than the old one.
 		if (arf->depth == 1) {
 			if (AiCheckRailPathBetter(arf, p))
@@ -1986,7 +1986,7 @@
 {
 	FindLandscapeHeightByTile(&arf->ti, tile);
 
-	if (arf->ti.tileh == _dir_table_2[p[0]&3] && arf->ti.z!=0) { 
+	if (arf->ti.tileh == _dir_table_2[p[0]&3] && arf->ti.z!=0) {
 		int32 cost = DoCommandByTile(tile, arf->player->ai.railtype_to_use, 0, DC_AUTO, CMD_BUILD_TUNNEL);
 
 		if (cost != CMD_ERROR && cost <= (arf->player->player_money>>4)) {
@@ -2004,7 +2004,7 @@
 	const byte *p;
 
 	tile = TILE_MASK(tile + _tileoffs_by_dir[dir]);
-	
+
 	// Reached destination?
 	if (tile == arf->final_tile) {
 		if (arf->final_dir != (dir^2)) {
@@ -2067,7 +2067,7 @@
 }
 
 
-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)
 {
@@ -2078,7 +2078,7 @@
 	if (AiDoFollowTrack(p)) {
 		p->ai.state_counter = (Random()&0xE)+6; // Destruct this amount of blocks
 		p->ai.state_mode = 1; // Start destruct
-		
+
 		// Ban this tile and don't reach it for a while.
 		AiBanTile(p, p->ai.cur_tile_a, FindFirstBit(GetRailTrackStatus(p->ai.cur_tile_a)));
 		return;
@@ -2097,7 +2097,7 @@
 	arf.best_depth = 0xff;
 	arf.cur_best_tile = 0;
 	arf.best_tile = 0;
-	AiBuildRailRecursive(&arf, p->ai.cur_tile_a, p->ai.cur_dir_a);		
+	AiBuildRailRecursive(&arf, p->ai.cur_tile_a, p->ai.cur_dir_a);
 
 	// Reached destination?
 	if (arf.recursive_mode == 2 && arf.cur_best_depth == 0) {
@@ -2114,19 +2114,19 @@
 		if (++p->ai.state_counter == 21) {
 			p->ai.state_counter = 40;
 			p->ai.state_mode = 1;
-			
+
 			// Ban this tile
 			AiBanTile(p, p->ai.cur_tile_a, FindFirstBit(GetRailTrackStatus(p->ai.cur_tile_a)));
 		}
 		return;
 	}
-	
+
 	p->ai.cur_tile_a += _tileoffs_by_dir[p->ai.cur_dir_a];
 
 	if (arf.best_ptr[0]&0x80) {
 		int i;
 		int32 bridge_len = GetBridgeLength(arf.bridge_end_tile, p->ai.cur_tile_a);
-		
+
 		/*	Figure out what (rail)bridge type to build
 				start with best bridge, then go down to worse and worse bridges
 				unnecessary to check for worse bridge (i=0), since AI will always build that.
@@ -2153,7 +2153,7 @@
 	} else {
 		// rail
 		p->ai.cur_dir_a = arf.best_ptr[1];
-		DoCommandByTile(p->ai.cur_tile_a, p->ai.railtype_to_use, arf.best_ptr[0], 
+		DoCommandByTile(p->ai.cur_tile_a, p->ai.railtype_to_use, arf.best_ptr[0],
 			DC_EXEC | DC_AUTO | DC_NO_WATER | DC_NO_RAIL_OVERLAP, CMD_BUILD_SINGLE_RAIL);
 		p->ai.state_counter = 0;
 	}
@@ -2183,7 +2183,7 @@
 		}
 
 		if (!(_map5[tile] & 0x40)) {
-			
+
 			// Check if the bridge points in the right direction.
 			// This is not really needed the first place AiRemoveTileAndGoForward is called.
 			if ((_map5[tile]&1) != (p->ai.cur_dir_a&1))
@@ -2194,7 +2194,7 @@
 			do {
 				tile = TILE_MASK(tile - offs);
 			} while (_map5[tile] & 0x40);
-			
+
 			tilenew = TILE_MASK(tile - offs);
 			// And clear the bridge.
 			if (DoCommandByTile(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR) == CMD_ERROR)
@@ -2217,7 +2217,7 @@
 			(_map5[tile]&0xC0) == 0x40) {
 		DoCommandByTile(tile, 0, 0, DC_EXEC, CMD_REMOVE_SIGNALS);
 	}
-	
+
 	// And also remove the rail.
 	if (DoCommandByTile(tile, 0, bit, DC_EXEC, CMD_REMOVE_SINGLE_RAIL) == CMD_ERROR)
 		return false;
@@ -2226,7 +2226,7 @@
 	ptr = _ai_table_15[p->ai.cur_dir_a^2];
 	while (ptr[0] != bit) ptr+=2;
 	p->ai.cur_dir_a = ptr[1] ^ 2;
-	
+
 	// And then also switch tile.
 	p->ai.cur_tile_a = TILE_MASK(p->ai.cur_tile_a - _tileoffs_by_dir[p->ai.cur_dir_a]);
 
@@ -2246,7 +2246,7 @@
 	if (p->ai.cur_tile_a == p->ai.start_tile_a)
 		return;
 
-	AiRemoveTileAndGoForward(p);	
+	AiRemoveTileAndGoForward(p);
 }
 
 
@@ -2256,9 +2256,9 @@
 
 	if (p->ai.state_mode < 1) {
 		// Construct mode, build new rail.
-		AiBuildRailConstruct(p);		
+		AiBuildRailConstruct(p);
 	} else if (p->ai.state_mode == 1) {
-		
+
 		// Destruct mode, destroy the rail currently built.
 		AiBuildRailDestruct(p);
 	} else if (p->ai.state_mode == 2) {
@@ -2291,7 +2291,7 @@
 	// Currently building a rail between two points?
 	if (p->ai.state_mode != 255) {
 		AiBuildRail(p);
-		
+
 		// Alternate between edges
 		swap_tile(&p->ai.start_tile_a, &p->ai.start_tile_b);
 		swap_tile(&p->ai.cur_tile_a, &p->ai.cur_tile_b);
@@ -2425,7 +2425,7 @@
 		bool is_pass = (p->ai.cargo_type == CT_PASSENGERS ||
 							p->ai.cargo_type == CT_MAIL ||
 							(_opt.landscape==LT_NORMAL && p->ai.cargo_type == CT_VALUABLES));
-		
+
 		if (!is_pass && i == 1) flags |= OF_UNLOAD;
 		if (p->ai.num_want_fullload != 0 && (is_pass || i == 0)) flags |= OF_FULL_LOAD;
 
@@ -2453,7 +2453,7 @@
 	AiBuildRec *aib;
 	const AiDefaultBlockData *b;
 
-	num = p->ai.num_build_rec;	
+	num = p->ai.num_build_rec;
 	aib = &p->ai.src;
 	do {
 		if (aib->cur_building_rule != 255) {
@@ -2521,13 +2521,13 @@
 		uint c = TILE_MASK(tile+ p->tileoffs);
 
 		_cleared_town = NULL;
-	
+
 		if (p->mode == 2) {
 			if (IS_TILETYPE(c, MP_STREET) &&
 					(_map5[c]&0xF0)==0 &&
 					(_map5[c]&p->attr)!=0) {
 				roadflag |= 2;
-				
+
 				// all bits are already built?
 				if ((_map5[c]&p->attr)==p->attr)
 					continue;
@@ -2575,7 +2575,7 @@
 				r = DoCommandByTile(c, 0, 0, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_LANDSCAPE_CLEAR);
 				if (r == CMD_ERROR) return CMD_ERROR;
 			}
-		
+
 		}
 	}
 
@@ -2595,9 +2595,9 @@
 {
 	AiBuildRec *aib;
 	int num;
-	
+
 	num = p->ai.num_build_rec;
-	aib = &p->ai.src;	
+	aib = &p->ai.src;
 
 	do {
 		if (aib->cur_building_rule != 255) {
@@ -2720,7 +2720,7 @@
 	if (arf->recursive_mode < 1) {
 		// Mode is 0. This means destination has not been found yet.
 		// If the found path is shorter than the current one, remember it.
-		if (arf->cur_best_dist < arf->best_dist || 
+		if (arf->cur_best_dist < arf->best_dist ||
 			(arf->cur_best_dist == arf->best_dist && arf->cur_best_depth < arf->best_depth)) {
 			arf->best_depth = arf->cur_best_depth;
 			arf->best_dist = arf->cur_best_dist;
@@ -2728,7 +2728,7 @@
 			arf->best_ptr = p;
 			arf->best_tile = arf->cur_best_tile;
 			better = true;
-		}	
+		}
 	} else if (arf->recursive_mode > 1) {
 		// Mode is 2.
 		if (arf->best_dist != 0 || arf->cur_best_depth < arf->best_depth) {
@@ -2825,14 +2825,14 @@
 	bool flag;
 
 	int dir2 = p[0] & 3;
-	
+
 	FindLandscapeHeightByTile(&arf->ti, tile);
 	if (arf->ti.tileh == _dir_table_1[dir2] || (arf->ti.tileh==0 && arf->ti.z!=0)) {
 		tile_new = tile;
 		// Allow bridges directly over bottom tiles
 		flag = arf->ti.z == 0;
 		for(;;) {
-			if (tile_new < -_tileoffs_by_dir[dir2]) return; // Wraping around map, no bridge possible!		
+			if (tile_new < -_tileoffs_by_dir[dir2]) return; // Wraping around map, no bridge possible!
 			tile_new = TILE_MASK(tile_new + _tileoffs_by_dir[dir2]);
 			FindLandscapeHeightByTile(&arf->ti, tile_new);
 			if (arf->ti.tileh != 0 || arf->ti.type == MP_CLEAR || arf->ti.type == MP_TREES) {
@@ -2850,7 +2850,7 @@
 		if (DoCommandByTile(tile_new, tile, 0x8000, DC_AUTO, CMD_BUILD_BRIDGE) == CMD_ERROR)
 			return;
 		AiBuildRoadRecursive(arf, tile_new, dir2);
-		
+
 		// At the bottom depth, check if the new path is better than the old one.
 		if (arf->depth == 1) {
 			if (AiCheckRoadPathBetter(arf, p))
@@ -2863,7 +2863,7 @@
 {
 	FindLandscapeHeightByTile(&arf->ti, tile);
 
-	if (arf->ti.tileh == _dir_table_2[p[0]&3] && arf->ti.z!=0) { 
+	if (arf->ti.tileh == _dir_table_2[p[0]&3] && arf->ti.z!=0) {
 		int32 cost = DoCommandByTile(tile, 0x200, 0, DC_AUTO, CMD_BUILD_TUNNEL);
 
 		if (cost != CMD_ERROR && cost <= (arf->player->player_money>>4)) {
@@ -2882,13 +2882,13 @@
 	const byte *p;
 
 	tile = TILE_MASK(tile + _tileoffs_by_dir[dir]);
-	
+
 	// Reached destination?
 	if (tile == arf->final_tile) {
 		if ((arf->final_dir^2) == dir) {
 			arf->recursive_mode = 2;
 			arf->cur_best_depth = arf->depth;
-		} 
+		}
 		return;
 	}
 
@@ -2965,7 +2965,7 @@
 	arf.best_depth =  0xff;
 	arf.cur_best_tile = 0;
 	arf.best_tile = 0;
-	AiBuildRoadRecursive(&arf, p->ai.cur_tile_a, p->ai.cur_dir_a);		
+	AiBuildRoadRecursive(&arf, p->ai.cur_tile_a, p->ai.cur_dir_a);
 
 	// Reached destination?
 	if (arf.recursive_mode == 2 && arf.cur_best_depth == 0) {
@@ -3003,7 +3003,7 @@
 				unnecessary to check for worse bridge (i=0), since AI will always build that.
 				AI is so fucked up that fixing this small thing will probably not solve a thing
 		*/
-		for(i = 10; i != 0; i--) {                      
+		for(i = 10; i != 0; i--) {
 			if (CheckBridge_Stuff(i, bridge_len)) {
 				int32 cost = DoCommandByTile(tile, p->ai.cur_tile_a, i + (0x80 << 8), DC_AUTO, CMD_BUILD_BRIDGE);
 				if (cost != CMD_ERROR && cost < (p->player_money >> 5))
@@ -3021,7 +3021,7 @@
 		p->ai.cur_tile_a = _build_tunnel_endtile;
 		p->ai.state_counter = 0;
 	} else {
-		
+
 		// road
 		if (!AiBuildRoadHelper(tile, DC_EXEC | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, arf.best_ptr[0]))
 			goto do_some_terraform;
@@ -3044,7 +3044,7 @@
 
 	if (p->ai.state_mode < 1) {
 		// Construct mode, build new road.
-		AiBuildRoadConstruct(p);		
+		AiBuildRoadConstruct(p);
 	} else if (p->ai.state_mode == 1) {
 		// Destruct mode, not implemented for roads.
 		p->ai.state_mode = 2;
@@ -3088,7 +3088,7 @@
 	// Currently building a road between two points?
 	if (p->ai.state_mode != 255) {
 		AiBuildRoad(p);
-		
+
 		// Alternate between edges
 		swap_tile(&p->ai.start_tile_a, &p->ai.start_tile_b);
 		swap_tile(&p->ai.cur_tile_a, &p->ai.cur_tile_b);
@@ -3149,7 +3149,7 @@
 	uint tile,loco_id;
 	int veh, i;
 	int32 cost;
-	
+
 	ptr = _road_default_block_data[p->ai.src.cur_building_rule]->data;
 	for(;ptr->mode != 0;ptr++) {}
 	tile = TILE_ADD(p->ai.src.use_tile, ptr->tileoffs);
@@ -3197,7 +3197,7 @@
 	AiBuildRec *aib;
 	const AiDefaultBlockData *b;
 
-	num = p->ai.num_build_rec;	
+	num = p->ai.num_build_rec;
 	aib = &p->ai.src;
 	do {
 		if (aib->cur_building_rule != 255) {
@@ -3379,7 +3379,7 @@
 	// do the following 8 times
 	i = 8;
 	do {
-		// check if we can build the default 
+		// check if we can build the default
 		aib = &p->ai.src;
 		j = p->ai.num_build_rec;
 		do {
@@ -3399,7 +3399,7 @@
 					!IS_TILETYPE(aib->use_tile, MP_RAILWAY) &&
 					!IS_TILETYPE(aib->use_tile, MP_STATION)
 					) {
-				
+
 				_map_type_and_height[aib->use_tile] = 0xa1;
 				_map5[aib->use_tile] = 0x80;
 				MarkTileDirtyByTile(aib->use_tile);
@@ -3460,7 +3460,7 @@
 	int32 cost;
 	int i;
 	uint loco_id;
-	
+
 	ptr = _airport_default_block_data[p->ai.src.cur_building_rule];
 	for(;ptr->mode!=0;ptr++) {}
 
@@ -3523,7 +3523,7 @@
 
 	if (v->owner == _current_player) {
 		if (v->type == VEH_Train) {
-			
+
 			if (!IsTrainDepotTile(v->tile) || v->u.rail.track != 0x80 || !(v->vehstatus&VS_STOPPED)) {
 				if ((v->next_order & OT_MASK) != OT_GOTO_DEPOT)
 					DoCommandByTile(0, v->index, 0, DC_EXEC, CMD_TRAIN_GOTO_DEPOT);
@@ -3532,7 +3532,7 @@
 
 			// Sell whole train
 			DoCommandByTile(v->tile, v->index, 1, DC_EXEC, CMD_SELL_RAIL_WAGON);
-			
+
 		} else if (v->type == VEH_Road) {
 			if (!IsRoadDepotTile(v->tile) || v->u.road.state != 254 || !(v->vehstatus&VS_STOPPED)) {
 				if ((v->next_order & OT_MASK) != OT_GOTO_DEPOT)
@@ -3613,7 +3613,7 @@
 		if ((m5&~0x3) != 0xC0) {
 is_rail_crossing:;
 			m5 = GetRailTrackStatus(tile);
-			
+
 			if (m5 == 0xC || m5 == 0x30)
 				return;
 
@@ -3662,7 +3662,7 @@
 			m5 &= 3;
 			if (GetRailTrackStatus(tile + _tileoffs_by_dir[m5]) & _depot_bits[m5])
 				return;
-			
+
 			DoCommandByTile(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
 		}
 	} else if (IS_TILETYPE(tile, MP_STREET)) {
@@ -3707,7 +3707,7 @@
 
 		if (_map_owner[tile] != _current_player || (_map5[tile] & 0xC6) != 0x80)
 			return;
-		
+
 		m5 = 0;
 
 		b = _map5[tile] & 0x21;
@@ -3721,7 +3721,7 @@
 static void AiStateRemoveTrack(Player *p)
 {
 	int num = 1000;
-	
+
 	do {
 		uint tile = ++p->ai.state_counter;
 
@@ -3775,7 +3775,7 @@
 	AiStateSellVeh,
 	AiStateRemoveStation,
 	AiStateRemoveTrack,
-	
+
 	AiStateRemoveSingleRailTile
 };
 
@@ -3875,10 +3875,10 @@
 }
 
 
-void AiDoGameLoop(Player *p) 
+void AiDoGameLoop(Player *p)
 {
 	_cur_ai_player = p;
-	
+
 	if (p->bankrupt_asked != 0) {
 		AiHandleTakeover(p);
 		return;
@@ -3913,7 +3913,7 @@
 					return;
 			}
 		}
-	} 
+	}
 #if 0
 	{
 		static byte old_state = 99;
--- a/ai_build.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/ai_build.c	Fri Sep 10 19:02:27 2004 +0000
@@ -85,8 +85,8 @@
 	if (part < 1) part = 1;
 	// When we are done, stop it
 	if (part >= PathFinderInfo->route_length - 1) { PathFinderInfo->position = -2; return 0; }
-	
-	
+
+
 	if (PathFinderInfo->rail_or_road) {
 		// Tunnel code
      	if ((AI_PATHFINDER_FLAG_TUNNEL & route_extra[part]) != 0) {
@@ -198,7 +198,7 @@
 	    if (!EnsureNoVehicle(route[part]) && flag == DC_EXEC) part--;
      	PathFinderInfo->position = part;
     }
-    
+
     return cost;
 }
 
@@ -232,7 +232,7 @@
 int AiNew_Build_Vehicle(Player *p, uint tile, byte flag) {
 	int i = AiNew_PickVehicle(p);
 	if (i == -1) return CMD_ERROR;
-	
+
 	if (p->ainew.tbt == AI_TRAIN) {
 		return CMD_ERROR;
 	} else {
--- a/ai_pathfinder.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/ai_pathfinder.c	Fri Sep 10 19:02:27 2004 +0000
@@ -38,7 +38,7 @@
 		if (IS_TILETYPE(current->path.node.tile, MP_CLEAR) || IS_TILETYPE(current->path.node.tile, MP_TREES))
 			if (current->path.parent == NULL || TestCanBuildStationHere(current->path.node.tile,AiNew_GetDirection(current->path.parent->node.tile, current->path.node.tile)))
     			return AYSTAR_FOUND_END_NODE;
-		
+
 	return AYSTAR_DONE;
 }
 
@@ -103,7 +103,7 @@
 void clean_AyStar_AiPathFinder(AyStar *aystar, Ai_PathFinderInfo *PathFinderInfo) {
 	PathNode start_node;
 	uint x,y;
-	
+
 	aystar->clear(aystar);
 
 	// Set the user_data to the PathFinderInfo
@@ -149,7 +149,7 @@
 	Ai_PathFinderInfo *PathFinderInfo = (Ai_PathFinderInfo*)aystar->user_target;
 	int i = 0;
 	PathNode *parent = &current->path;
-	
+
 	do {
      	PathFinderInfo->route_extra[i] = parent->node.user_data[0];
 		PathFinderInfo->route[i++] = parent->node.tile;
@@ -169,16 +169,16 @@
 static void AyStar_AiPathFinder_GetNeighbours(AyStar *aystar, OpenListNode *current) {
     int i, r, dir;
    	Ai_PathFinderInfo *PathFinderInfo = (Ai_PathFinderInfo*)aystar->user_target;
-    
+
     aystar->num_neighbours = 0;
-    
+
   	// Go through all surrounding tiles and check if they are within the limits
    	for (i=0;i<4;i++) {
    		if (GET_TILE_X(_tiles_around[i] + current->path.node.tile) > 1 && GET_TILE_X(_tiles_around[i] + current->path.node.tile) < TILE_X_MAX - 1 &&
        		GET_TILE_Y(_tiles_around[i] + current->path.node.tile) > 1 && GET_TILE_Y(_tiles_around[i] + current->path.node.tile) < TILE_Y_MAX - 1) {
        		// We also directly test if the current tile can connect to this tile..
        		//  We do this simply by just building the tile!
-       		
+
        		// If the next step is a bridge, we have to enter it the right way
        		if (!PathFinderInfo->rail_or_road && AI_PATHFINDER_IS_ROAD(current->path.node.tile + _tiles_around[i])) {
        			if (IS_TILETYPE(current->path.node.tile + _tiles_around[i], MP_TUNNELBRIDGE)) {
@@ -198,7 +198,7 @@
        				if ((_map5[current->path.node.tile] & 1) != (i & 1)) continue;
        			}
        		}
-       		
+
        		if ((AI_PATHFINDER_FLAG_BRIDGE & current->path.node.user_data[0]) != 0 ||
        			(AI_PATHFINDER_FLAG_TUNNEL & current->path.node.user_data[0]) != 0) {
        			// We are a bridge/tunnel, how cool!!
@@ -206,7 +206,7 @@
        			if (i != (current->path.node.user_data[0] >> 8)) continue;
        		}
        		dir = 0;
-       		
+
        		// First, check if we have a parent
        		if (current->path.parent == NULL && current->path.node.user_data[0] == 0) {
        			// If not, this means we are at the starting station
@@ -254,16 +254,16 @@
        					if (r == CMD_ERROR) continue;
        				}
        			}
-       			
+
        		}
-       		
+
 			// The tile can be connected
    			aystar->neighbours[aystar->num_neighbours].tile = _tiles_around[i] + current->path.node.tile;
    			aystar->neighbours[aystar->num_neighbours].user_data[0] = 0;
    			aystar->neighbours[aystar->num_neighbours++].direction = 0;
        	}
     }
-    
+
     // Next step, check for bridges and tunnels
     if (current->path.parent != NULL && current->path.node.user_data[0] == 0) {
 
@@ -273,9 +273,9 @@
     	// It means we can only walk with the track, so the bridge has to be in the same direction
     	TileIndex tile = current->path.node.tile;
     	TileIndex new_tile = tile;
-    	
+
     	FindLandscapeHeightByTile(&ti, tile);
-    	
+
    		// Bridges can only be build on land that is not flat
    		//  And if there is a road or rail blocking
    		if (ti.tileh != 0 ||
@@ -284,10 +284,10 @@
 
     		for (;;) {
     			new_tile += _tiles_around[dir];
-    	
+
     	    	// Precheck, is the length allowed?
     	    	if (!CheckBridge_Stuff(0,GetBridgeLength(tile, new_tile))) break;
-    	    	
+
     	    	// Check if we hit the station-tile.. we don't like that!
     	    	if (TILES_BETWEEN(new_tile,PathFinderInfo->end_tile_tl,PathFinderInfo->end_tile_br)) break;
 
@@ -302,7 +302,7 @@
 				if (aystar->num_neighbours == 11) break;
 			}
     	}
-    	
+
     	// Next, check for tunnels!
     	// Tunnels can only be build with tileh of 3, 6, 9 or 12, depending on the direction
     	//  For now, we check both sides for this tile.. terraforming gives fuzzy result
@@ -334,11 +334,11 @@
 	Ai_PathFinderInfo *PathFinderInfo = (Ai_PathFinderInfo*)aystar->user_target;
 	int r, res = 0;
 	TileInfo ti, parent_ti;
-	
+
 	// Gather some information about the tile..
 	FindLandscapeHeightByTile(&ti, current->tile);
 	FindLandscapeHeightByTile(&parent_ti, parent->path.node.tile);
-	
+
 	// Check if we hit the end-tile
 	if (TILES_BETWEEN(current->tile,PathFinderInfo->end_tile_tl,PathFinderInfo->end_tile_br)) {
 		// We are at the end-tile, check if we had a direction or something...
@@ -348,7 +348,7 @@
 		// If it was valid, drop out.. we don't build on the endtile
 		return 0;
 	}
-	
+
 	// Give everything a small penalty
 	res += AI_PATHFINDER_PENALTY;
 
@@ -359,7 +359,7 @@
 			res -= AI_PATHFINDER_ROAD_ALREADY_EXISTS_BONUS;
 		}
 	}
-	
+
 	// We should give a penalty when the tile is going up or down.. this is one way to do so!
 	//  Too bad we have to count it from the parent.. but that is not so bad
 	if (parent_ti.tileh != 0 && parent->path.parent != NULL) {
@@ -380,7 +380,7 @@
 			}
 		}
 	}
-	
+
 	// Are we part of a tunnel?
 	if ((AI_PATHFINDER_FLAG_TUNNEL & current->user_data[0]) != 0) {
 		// Tunnels are very expensive when build on long routes..
@@ -409,7 +409,7 @@
 		if (ti.tileh == 0)
 			res += AI_PATHFINDER_BRIDGE_GOES_UP_PENALTY;
 	}
-	
+
 	//  To prevent the AI from taking the fastest way in tiles, but not the fastest way
 	//    in speed, we have to give a good penalty to direction changing
 	//  This way, we get almost the fastest way in tiles, and a very good speed on the track
@@ -448,7 +448,7 @@
 			}
 		}
 	}
-	
+
 	// Res should never be below zero.. if so, make it zero!
 	if (res < 0) { res = 0; }
 
--- a/aircraft_cmd.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/aircraft_cmd.c	Fri Sep 10 19:02:27 2004 +0000
@@ -275,8 +275,8 @@
 		// On hold for NewAI
 		v->u.air.pos = (!_patches.ainew_active && _is_ai_player) ? 0:MAX_ELEMENTS;
 
-		/* When we click on hangar we know the tile (it is in var 'tile')it is on. By that we know 
-			its position in the array of depots the airport has.....we can search 
+		/* When we click on hangar we know the tile (it is in var 'tile')it is on. By that we know
+			its position in the array of depots the airport has.....we can search
 			->layout for #th position of depot. Since layout must start with depots, it is simple
 		*/
 		{
@@ -542,7 +542,7 @@
 
  	if (_patches.gotodepot && ScheduleHasDepotOrders(v->schedule_ptr))
  		return;
- 
+
 	st = DEREF_STATION(v->next_order_param);
 	// only goto depot if the target airport has terminals (eg. it is airport)
 	if (st->xy != 0 && st->airport_tile != 0 && GetAirport(st->airport_type)->nofterminals != 0) {
@@ -621,7 +621,7 @@
 	if (u->vehstatus & VS_HIDDEN)
 		return;
 
-	// if true, helicopter rotors do not rotate. This should only be the case if a helicopter is 
+	// if true, helicopter rotors do not rotate. This should only be the case if a helicopter is
 	// loading/unloading at a terminal or stopped
 	if ((v->next_order&OT_MASK) == OT_LOADING || (v->vehstatus&VS_STOPPED)) {
 		if (u->cur_speed != 0) {
@@ -735,7 +735,7 @@
 
 	v->subspeed = (t=v->subspeed) + (byte)spd;
 	spd = min( v->cur_speed + (spd >> 8) + (v->subspeed < t), v->max_speed);
-		   
+
 	// adjust speed for broken vehicles
 	if(v->vehstatus&VS_AIRCRAFT_BROKEN) spd = min(spd, 27);
 
@@ -875,7 +875,7 @@
 
 		// Change direction smoothly to final direction.
 		dirdiff = amd->direction - v->direction;
-		// if distance is 0, and plane points in right direction, no point in calling 
+		// if distance is 0, and plane points in right direction, no point in calling
 		// UpdateAircraftSpeed(). So do it only afterwards
 		if (dirdiff == 0) {
 			v->cur_speed = 0;
@@ -1061,7 +1061,7 @@
  		if ((v->next_order & (OT_MASK|OF_UNLOAD)) != (OT_GOTO_DEPOT|OF_UNLOAD))
  			return;
  	}
- 
+
  	if ((v->next_order & (OT_MASK|OF_UNLOAD|OF_FULL_LOAD)) == (OT_GOTO_DEPOT|OF_UNLOAD|OF_FULL_LOAD) &&
  			SERVICE_INTERVAL) {
  		v->cur_order_index++;
@@ -1217,7 +1217,7 @@
 	byte old_order;
 
 	ServiceAircraft(v);
-	
+
 	MaybeRenewVehicle(v, EstimateAircraftCost(v->engine_type));
 
 	if ((v->next_order & OT_MASK) == OT_GOTO_DEPOT) {
@@ -1227,7 +1227,7 @@
 		v->next_order = OT_NOTHING;
 
  			if (old_order & OF_UNLOAD) { v->cur_order_index++; }
- 
+
  			else if (old_order & OF_FULL_LOAD) { // force depot visit
 			v->vehstatus |= VS_STOPPED;
 
@@ -1692,7 +1692,7 @@
 	return false;
 }
 
-static bool AirportFindFreeTerminal(Vehicle *v, const AirportFTAClass *Airport) 
+static bool AirportFindFreeTerminal(Vehicle *v, const AirportFTAClass *Airport)
 {
 	byte nofterminalspergroup, i;
 	AirportFTA *temp;
@@ -1703,9 +1703,9 @@
 		Heading 255 denotes a group. We see 2 groups here:
 		1. group 0 -- TERM_GROUP1_block (check block)
 		2. group 1 -- TERM_GROUP2_ENTER_block (check block)
-		First in line is checked first, group 0. If the block (TERM_GROUP1_block) is free, it 
-		looks	at the corresponding terminals of that group. If no free ones are found, other 
-		possible groups are checked	(in this case group 1, since that is after group 0). If that 
+		First in line is checked first, group 0. If the block (TERM_GROUP1_block) is free, it
+		looks	at the corresponding terminals of that group. If no free ones are found, other
+		possible groups are checked	(in this case group 1, since that is after group 0). If that
 		fails, then attempt fails and plane waits
 	*/
 	if (Airport->nofterminalgroups > 1) {
@@ -1731,7 +1731,7 @@
 	return FreeTerminal(v, 0, Airport->nofterminals);
 }
 
-static bool AirportFindFreeHelipad(Vehicle *v, const AirportFTAClass *Airport) 
+static bool AirportFindFreeHelipad(Vehicle *v, const AirportFTAClass *Airport)
 {
   Station *st;
   byte nofhelipadspergroup,  i;
@@ -1847,7 +1847,7 @@
 			AircraftNextAirportPos_and_Order(v_oldstyle); // move it to the entry point of the airport
 			GetNewVehiclePos(v_oldstyle, &gp); // get the position of the plane (to be used for setting)
 			v_oldstyle->tile = 0; // aircraft in air is tile=0
-			
+
 			// correct speed of helicopter-rotors
 			if (v_oldstyle->subtype == 0) {v_oldstyle->next->next->cur_speed = 32;}
 
@@ -1857,7 +1857,7 @@
 	}
 }
 
-void UpdateAirplanesOnNewStation(Station *st) 
+void UpdateAirplanesOnNewStation(Station *st)
 {
 	GetNewVehiclePosResult gp;
 	Vehicle *v;
--- a/aircraft_gui.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/aircraft_gui.c	Fri Sep 10 19:02:27 2004 +0000
@@ -891,7 +891,7 @@
 		// aircraft are stored as a cummulative index, eg 25, 41, 43. This means
 		// Player0: 25; Player1: (41-25) 16; Player2: (43-41) 2
 		for (i = &_num_aircraft_sort[1]; i != endof(_num_aircraft_sort); i++) {*i += *(i-1);}
-	
+
 		// sort by owner, then only subsort the requested owner-vehicles
 		qsort(_aircraft_sort, n, sizeof(_aircraft_sort[0]), GeneralOwnerSorter);
 
@@ -936,7 +936,7 @@
 		// Player0: 25; Player1: (41-25) 16; Player2: (43-41) 2 aircraft
 		i = (window_number == 0) ? 0 : _num_aircraft_sort[window_number-1];
 		SetVScrollCount(w, _num_aircraft_sort[window_number] - i);
-		
+
 		/* draw the widgets */
 		{
 			Player *p = DEREF_PLAYER(window_number);
@@ -980,7 +980,7 @@
 				SET_DPARAM32(0, v->profit_this_year);
 				SET_DPARAM32(1, v->profit_last_year);
 				DrawString(x+19, y + 28, STR_0198_PROFIT_THIS_YEAR_LAST_YEAR, 0);
-				
+
 				if (v->string_id != STR_SV_AIRCRAFT_NAME) {
 					SET_DPARAM16(0, v->string_id);
 					DrawString(x+19, y, STR_01AB, 0);
@@ -1007,7 +1007,7 @@
 			return;
 		case 6: { /* Matrix to show vehicles */
 			uint32 id_v = (e->click.pt.y - PLY_WND_PRC__OFFSET_TOP_WIDGET) / PLY_WND_PRC__SIZE_OF_ROW_BIG;
-			
+
 			if (id_v >= w->vscroll.cap) { return;} // click out of bounds
 
 			id_v += w->vscroll.pos;
--- a/airport_gui.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/airport_gui.c	Fri Sep 10 19:02:27 2004 +0000
@@ -77,12 +77,12 @@
 
 	case WE_CLICK:
 		if (e->click.widget-2 >= 0)
-			_build_air_button_proc[e->click.widget - 2](w);		
+			_build_air_button_proc[e->click.widget - 2](w);
 		break;
 
 	case WE_PLACE_OBJ:
 		_place_proc(e->place.tile);
-		break;	
+		break;
 
 	case WE_PLACE_DRAG: {
 		VpSelectTilesWithMethod(e->place.pt.x, e->place.pt.y, e->place.userdata);
@@ -160,7 +160,7 @@
     // strings such as 'Size' and 'Coverage Area'
 		DrawStringCentered(74, 16, STR_305B_SIZE, 0);
 		DrawStringCentered(74, 78, STR_3066_COVERAGE_AREA_HIGHLIGHT, 0);
-		DrawStationCoverageAreaText(2, 104, (uint)-1);		
+		DrawStationCoverageAreaText(2, 104, (uint)-1);
 		break;
 	}
 
--- a/aystar.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/aystar.c	Fri Sep 10 19:02:27 2004 +0000
@@ -5,7 +5,7 @@
  *  For more information about AyStar (A* Algorithm), you can look at
  *    http://en.wikipedia.org/wiki/A-star_search_algorithm
  */
- 
+
 /*
  * Friendly reminder:
  *  Call (AyStar).free() when you are done with Aystar. It reserves a lot of memory
@@ -46,7 +46,7 @@
 	OpenListNode* res = (OpenListNode*)aystar->OpenListQueue.pop(&aystar->OpenListQueue);
 	if (res != NULL)
 		Hash_Delete(&aystar->OpenListHash, res->path.node.tile, res->path.node.direction);
-	
+
 	return res;
 }
 
@@ -76,29 +76,29 @@
 
 	// Check the new node against the ClosedList
 	if (AyStarMain_ClosedList_IsInList(aystar, current) != NULL) return AYSTAR_DONE;
-	
+
 	// Calculate the G-value for this node
 	new_g = aystar->CalculateG(aystar, current, parent);
 	// If the value was INVALID_NODE, we don't do anything with this node
 	if (new_g == AYSTAR_INVALID_NODE) return AYSTAR_DONE;
-	
+
 	// There should not be given any other error-code..
 	assert(new_g >= 0);
 	// Add the parent g-value to the new g-value
 	new_g += parent->g;
 	if (aystar->max_path_cost != 0 && (uint)new_g > aystar->max_path_cost) return AYSTAR_DONE;
-	
+
 	// Calculate the h-value
 	new_h = aystar->CalculateH(aystar, current, parent);
 	// There should not be given any error-code..
 	assert(new_h >= 0);
-	
+
 	// The f-value if g + h
 	new_f = new_g + new_h;
-	
+
 	// Get the pointer to the parent in the ClosedList (the currentone is to a copy of the one in the OpenList)
 	closedlist_parent = AyStarMain_ClosedList_IsInList(aystar, &parent->path.node);
-	
+
 	// Check if this item is already in the OpenList
 	if ((check = AyStarMain_OpenList_IsInList(aystar, current)) != NULL) {
 		int i;
@@ -117,7 +117,7 @@
 		// A new node, add him to the OpenList
 		AyStarMain_OpenList_Add(aystar, closedlist_parent, current, new_f, new_g, 0);
 	}
-	
+
 	return AYSTAR_DONE;
 }
 
@@ -134,12 +134,12 @@
  */
 int AyStarMain_Loop(AyStar *aystar) {
 	int i, r;
-	
+
 	// Get the best node from OpenList
 	OpenListNode *current = AyStarMain_OpenList_Pop(aystar);
 	// If empty, drop an error
 	if (current == NULL) return AYSTAR_EMPTY_OPENLIST;
-	
+
 	// Check for end node and if found, return that code
 	if (aystar->EndNodeCheck(aystar, current) == AYSTAR_FOUND_END_NODE) {
 		if (aystar->FoundEndNode != NULL)
@@ -147,22 +147,22 @@
 		free(current);
 		return AYSTAR_FOUND_END_NODE;
 	}
-	
+
 	// Add the node to the ClosedList
 	AyStarMain_ClosedList_Add(aystar, &current->path);
 
 	// Load the neighbours
 	aystar->GetNeighbours(aystar, current);
-	
+
 	// Go through all neighbours
 	for (i=0;i<aystar->num_neighbours;i++) {
 		// Check and add them to the OpenList if needed
 		r = aystar->checktile(aystar, &aystar->neighbours[i], current);
 	}
-	
+
 	// Free the node
 	free(current);
-	
+
 	if (aystar->max_search_nodes != 0 && Hash_Size(&aystar->ClosedListHash) >= aystar->max_search_nodes)
 		/* We've expanded enough nodes */
 		return AYSTAR_LIMIT_REACHED;
@@ -228,7 +228,7 @@
 	if (r != AYSTAR_STILL_BUSY)
 		/* We're done, clean up */
 		aystar->clear(aystar);
-		
+
 	// Check result-value
 	if (r == AYSTAR_FOUND_END_NODE) return AYSTAR_FOUND_END_NODE;
 	// Check if we have some left in the OpenList
@@ -242,7 +242,7 @@
  * Adds a node from where to start an algorithm. Multiple nodes can be added
  * if wanted. You should make sure that clear() is called before adding nodes
  * if the AyStar has been used before (though the normal main loop calls
- * clear() automatically when the algorithm finishes 
+ * clear() automatically when the algorithm finishes
  */
 void AyStarMain_AddStartNode(AyStar *aystar, AyStarNode *start_node) {
 #ifdef AYSTAR_DEBUG
--- a/aystar.h	Fri Sep 10 18:54:23 2004 +0000
+++ b/aystar.h	Fri Sep 10 19:02:27 2004 +0000
@@ -107,7 +107,7 @@
 	AyStar_GetNeighbours* GetNeighbours;
 	AyStar_EndNodeCheck* EndNodeCheck;
 	AyStar_FoundEndNode* FoundEndNode;
-	
+
 	/* These are completely untouched by AyStar, they can be accesed by
 	 * the application specific routines to input and output data.
 	 * user_path should typically contain data about the resulting path
@@ -117,7 +117,7 @@
 	void *user_path;
 	void *user_target;
 	uint user_data[10];
-	
+
 	/* How many loops are there called before AyStarMain_Main gives
 	 * control back to the caller. 0 = until done */
 	byte loops_per_tick;
@@ -125,7 +125,7 @@
 	 *  0 = infinite */
 	uint max_path_cost;
 	/* The maximum amount of nodes that will be expanded, 0 = infinite */
-	uint max_search_nodes; 
+	uint max_search_nodes;
 
 	/* These should be filled with the neighbours of a tile by
 	 * GetNeighbours */
@@ -140,7 +140,7 @@
 	AyStar_Free* free;
 	AyStar_Clear* clear;
 	AyStar_CheckTile* checktile;
-	
+
 	/* These will contain the open and closed lists */
 
 	/* The actual closed list */
@@ -164,6 +164,6 @@
  * callling init_AyStar (see the declaration of AyStar for which fields are
  * internal */
 void init_AyStar(AyStar* aystar, Hash_HashProc hash, uint num_buckets);
-	
+
 
 #endif
--- a/bridge_gui.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/bridge_gui.c	Fri Sep 10 19:02:27 2004 +0000
@@ -30,7 +30,7 @@
 static void BuildBridge(Window *w, int i)
 {
 	DeleteWindow(w);
-	DoCommandP(_bridge.end_tile, _bridge.start_tile, _bridge.indexes[i] | (_bridge.type << 8), CcBuildBridge, 
+	DoCommandP(_bridge.end_tile, _bridge.start_tile, _bridge.indexes[i] | (_bridge.type << 8), CcBuildBridge,
 		CMD_BUILD_BRIDGE | CMD_AUTO | CMD_MSG(STR_5015_CAN_T_BUILD_BRIDGE_HERE));
 }
 
@@ -60,11 +60,11 @@
 			e->keypress.cont = false;
 			BuildBridge(w, i);
 		}
-		
+
 		break;
 	}
 
-	case WE_CLICK: 
+	case WE_CLICK:
 	 if (e->click.widget == 2) {
 			uint ind = ((int)e->click.pt.y - 14) / 22;
 			if (ind < 4 && (ind += w->vscroll.pos) < (uint)_bridge.count)
@@ -136,7 +136,7 @@
 
 		// get absolute bridge length
 		bridge_len = GetBridgeLength(start, end);
-		tot_bridge_len = bridge_len + 2;		
+		tot_bridge_len = bridge_len + 2;
 
 		tot_bridge_len = CalcBridgeLenCostFactor(tot_bridge_len);
 
@@ -155,7 +155,7 @@
 	_bridge.count = j;
 
 	if (j != 0) {
-		Window *w = AllocateWindowDesc((_bridge.type & 0x80) ? &_build_road_bridge_desc : &_build_bridge_desc);	
+		Window *w = AllocateWindowDesc((_bridge.type & 0x80) ? &_build_road_bridge_desc : &_build_bridge_desc);
 		w->vscroll.cap = 4;
 		w->vscroll.count = (byte)j;
 	} else {
--- a/clear_cmd.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/clear_cmd.c	Fri Sep 10 19:02:27 2004 +0000
@@ -15,7 +15,7 @@
 	int direction;
 	int modheight_count;
 	int tile_table_count;
-	
+
 	int32 cost;
 
 	TileIndex *tile_table;
@@ -44,7 +44,7 @@
 {
 	TerraformerHeightMod *mod = ts->modheight;
 	int count;
-	
+
 	for(count = ts->modheight_count; count != 0; count--, mod++) {
 		if (mod->tile == tile)
 			return mod->height;
@@ -85,10 +85,10 @@
 	int32 ret;
 
 	assert(tile < TILES_X * TILES_Y);
-	
+
 	if ((r=TerraformAllowTileProcess(ts, tile)) <= 0)
 		return r;
-	
+
 	if ((_map_type_and_height[tile] >> 4) == MP_RAILWAY) {
 		static const byte _railway_modes[4] = {8, 0x10, 4, 0x20};
 		static const byte _railway_dangslopes[4] = {0xd, 0xe, 7, 0xb};
@@ -128,7 +128,7 @@
 	int nh;
 	TerraformerHeightMod *mod;
 	int count;
-	
+
 	assert(tile < TILES_X * TILES_Y);
 
 	if (height < 0) {
@@ -140,11 +140,11 @@
 
 	if (height > 0xF)
 		return false;
-	
+
 	nh = TerraformGetHeightOfTile(ts, tile);
 	if (nh < 0 || height == nh)
-		return false; 
-	
+		return false;
+
 	if (TerraformProc(ts, tile, 0)<0)
 		return false;
 
@@ -227,7 +227,7 @@
 	tile = TILE_FROM_XY(x,y);
 
 	if (p1 & 1) {
-		if (!TerraformTileHeight(&ts, tile+TILE_XY(1,0),	
+		if (!TerraformTileHeight(&ts, tile+TILE_XY(1,0),
 				(_map_type_and_height[tile+TILE_XY(1,0)]&0xF) + direction))
 					return CMD_ERROR;
 	}
@@ -254,7 +254,7 @@
 		/* Check if tunnel would take damage */
 		int count;
 		TileIndex *ti = ts.tile_table;
-		
+
 		for(count = ts.tile_table_count; count != 0; count--, ti++) {
 			uint z, t;
 			uint tile = *ti;
@@ -280,7 +280,7 @@
 			for(count = ts.tile_table_count; count != 0; count--, ti++) {
 				DoCommandByTile(*ti, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
 			}
-		}	
+		}
 
 		/* change the height */
 		{
@@ -291,10 +291,10 @@
 			mod = ts.modheight;
 			for(count = ts.modheight_count; count != 0; count--, mod++) {
 				til = mod->tile;
-				
+
 				// Change tile height
 				_map_type_and_height[til] = (_map_type_and_height[til]&~0x0F)|mod->height;
-				
+
 				TerraformAddDirtyTileAround(&ts, til);
 			}
 		}
@@ -306,7 +306,7 @@
 			for(count = ts.tile_table_count; count != 0; count--, ti++) {
 				MarkTileDirtyByTile(*ti);
 			}
-		}	
+		}
 	}
 	return ts.cost;
 }
@@ -374,9 +374,9 @@
 {
 	uint tile;
 	int32 cost;
-	
+
 	SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
-		
+
 	tile = TILE_FROM_XY(x,y);
 
 	if (!EnsureNoVehicle(tile))
@@ -426,7 +426,7 @@
 int32 CmdSellLandArea(int x, int y, uint32 flags, uint32 p1, uint32 p2)
 {
 	uint tile;
-	
+
 	SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
 
 	tile = TILE_FROM_XY(x,y);
@@ -464,7 +464,7 @@
 void DrawClearLandFence(TileInfo *ti, byte img)
 {
 	byte z = ti->z;
-	
+
 	if (ti->tileh & 2) {
 		z += 8;
 		if (ti->tileh == 0x17)
@@ -508,7 +508,7 @@
 		DrawGroundSprite( _clear_land_sprites_3[ti->map5&3] + _tileh_to_sprite[ti->tileh]);
 		break;
 	}
-	
+
 	DrawClearLandFence(ti, _map3_hi[ti->tile] >> 2);
 }
 
@@ -521,7 +521,7 @@
 
 static void GetAcceptedCargo_Clear(uint tile, AcceptedCargo *ac)
 {
-	/* unused */	
+	/* unused */
 }
 
 static void AnimateTile_Clear(uint tile)
@@ -553,7 +553,7 @@
 		if ( (img_1&2) != (img_2&2) ) {
 			_map3_hi[tile] |= 3 << 5;
 			dirty = tile;
-		} 
+		}
 	} else {
 		if (img_1 == 1 && img_2 == 1) {
 			_map3_hi[tile] &= ~(3 << 5);
@@ -572,7 +572,7 @@
 		if ( (img_1&2) != (img_2&2) ) {
 			_map3_hi[tile] |= 3 << 2;
 			dirty = tile;
-		} 
+		}
 	} else {
 		if (img_1 == 1 && img_2 == 1) {
 			_map3_hi[tile] &= ~(3 << 2);
@@ -596,7 +596,7 @@
 
 	m5 = _map5[tile] & 0x1C;
 	tmp = _map5[tile] & 3;
-	
+
 	if (k < -8) {
 		/* snow_m2_down */
 		if (m5 != 0x10)
@@ -671,7 +671,7 @@
 	byte m5,m3;
 
 	TileLoopClearHelper(tile);
-	
+
 	if (_opt.landscape == LT_DESERT) {
 		TileLoopClearDesert(tile);
 	} else if (_opt.landscape == LT_HILLY) {
@@ -685,7 +685,7 @@
 	if ( (m5 & 0x1C) != 0xC) {
 		if ( (m5 & 3) == 3)
 			return;
-		
+
 		if (_game_mode != GM_EDITOR) {
 			m5 += 0x20;
 			if (m5 >= 0x20) {
@@ -727,7 +727,7 @@
 	/* add hills */
 	i = (Random() & 0x3FF) | 0x400;
 	do {
-		tile = TILE_MASK(Random());	
+		tile = TILE_MASK(Random());
 		if (IS_TILETYPE(tile, MP_CLEAR))
 			_map5[tile] = (byte)((_map5[tile] & ~(3<<2)) | (1<<2));
 	} while (--i);
@@ -736,7 +736,7 @@
 	i = (Random() & 0x7F) | 0x80;
 	do {
 		r = Random();
-		tile = TILE_MASK(r);	
+		tile = TILE_MASK(r);
 		if (IS_TILETYPE(tile, MP_CLEAR)) {
 			j = ((r >> 16) & 0xF) + 5;
 			for(;;) {
--- a/command.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/command.c	Fri Sep 10 19:02:27 2004 +0000
@@ -305,7 +305,7 @@
 int32 DoCommandByTile(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint procc)
 {
 	return DoCommand(GET_TILE_X(tile)*16, GET_TILE_Y(tile)*16, p1, p2, flags, procc);
-} 
+}
 
 
 //extern void _stdcall Sleep(int s);
@@ -314,7 +314,7 @@
 {
 	int32 res;
 	CommandProc *proc;
-	
+
 	proc = _command_proc_table[procc];
 
 	if (_docommand_recursive == 0) {
@@ -383,7 +383,7 @@
 	int x = GET_TILE_X(tile)*16;
 	int y = GET_TILE_Y(tile)*16;
 
-	assert(_docommand_recursive == 0);	
+	assert(_docommand_recursive == 0);
 
 	_error_message = INVALID_STRING_ID;
 	_error_message_2 = cmd >> 16;
@@ -404,9 +404,9 @@
 	proc = _command_proc_table[cmd & 0xFF];
 
 	// this command is a notest command?
-	notest = 
-		(cmd & 0xFF) == CMD_CLEAR_AREA || 
-		(cmd & 0xFF) == CMD_CONVERT_RAIL || 
+	notest =
+		(cmd & 0xFF) == CMD_CLEAR_AREA ||
+		(cmd & 0xFF) == CMD_CONVERT_RAIL ||
 		(cmd & 0xFF) == CMD_LEVEL_LAND ||
 		(cmd & 0xFF) == CMD_TRAIN_GOTO_DEPOT;
 
@@ -429,7 +429,7 @@
 		return false;
 	}
 
-	
+
 
 	// unless the command is a notest command, check if it can be executed.
 	if (!notest) {
@@ -456,7 +456,7 @@
 	// actually try and execute the command.
 	_yearly_expenses_type = 0;
 	res2 = proc(x,y, flags|DC_EXEC, p1, p2);
-	
+
 	if (!notest) {
 		assert(res == res2); // sanity check
 	} else {
@@ -479,7 +479,7 @@
 	}
 
 	_docommand_recursive = 0;
-	
+
 	if (callback) callback(true, tile, p1, p2);
 	return true;
 
@@ -490,7 +490,7 @@
 
 callb_err:
 	_docommand_recursive = 0;
-	
+
 	if (callback) callback(false, tile, p1, p2);
 	return false;
 }
--- a/command.h	Fri Sep 10 18:54:23 2004 +0000
+++ b/command.h	Fri Sep 10 19:02:27 2004 +0000
@@ -140,7 +140,7 @@
 	CMD_REFIT_RAIL_VEHICLE = 106,
 	CMD_RESTORE_ORDER_INDEX = 107,
 	CMD_BUILD_LOCK = 108,
-	
+
 	CMD_START_SCENARIO = 109,
 	CMD_BUILD_MANY_SIGNALS = 110,
 
@@ -157,7 +157,7 @@
 	DC_AI_BUILDING = 0x20,			// special building rules for AI
 	DC_NO_TOWN_RATING = 0x40,		// town rating does not disallow you from building
 	DC_FORCETEST = 0x80,				// force test too.
-	
+
 	CMD_ERROR = ((int32)0x80000000),
 };
 
--- a/console.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/console.c	Fri Sep 10 19:02:27 2004 +0000
@@ -44,7 +44,7 @@
 static _iconsole_cmd * _iconsole_cmds; // list of registred commands
 static _iconsole_var * _iconsole_vars; // list of registred vars
 
-// ** console std lib ** // 
+// ** console std lib ** //
 static byte _stdlib_developer=1;
 static bool _stdlib_con_developer=false;
 static void IConsoleStdLibRegister();
@@ -96,7 +96,7 @@
 				GfxFillRect(posx,posy,posx+5,posy+1,color);
 				_video_driver->make_dirty(posx,posy,5,1);
 			}
-			_icursor_counter=0;			
+			_icursor_counter=0;
 			}
 		break;
 
@@ -157,14 +157,14 @@
 			{
 			IConsoleSwitch();
 			} else
-		if (e->keypress.keycode == WKC_RETURN) 
+		if (e->keypress.keycode == WKC_RETURN)
 			{
 			IConsolePrintF(_iconsole_color_commands, "] %s", _iconsole_cmdline);
 			IConsoleCmdBufferAdd(_iconsole_cmdline);
 			IConsoleCmdExec((byte *) _iconsole_cmdline);
 			IConsoleClearCommand();
 			} else
-		if (e->keypress.keycode == WKC_BACKSPACE) 
+		if (e->keypress.keycode == WKC_BACKSPACE)
 			{
 			if (_iconsole_cmdpos!=0) _iconsole_cmdpos--;
 			_iconsole_cmdline[_iconsole_cmdpos]=0;
@@ -175,10 +175,10 @@
 			{
 			_iconsole_scroll=79;
 			_iconsole_cmdline[_iconsole_cmdpos]=e->keypress.ascii;
-			if (_iconsole_cmdpos!=255) _iconsole_cmdpos++;	
+			if (_iconsole_cmdpos!=255) _iconsole_cmdpos++;
 			SetWindowDirty(w);
 			_iconsole_cmdbufferpos=19;
-			} else e->keypress.cont=true;	
+			} else e->keypress.cont=true;
 		break;
 
 	}
@@ -211,9 +211,9 @@
 	}
 IConsoleStdLibRegister();
 #if defined(WITH_REV)
-IConsolePrintF(13,"OpenTTD Game Console Revision 3 - %s",_openttd_revision);	
+IConsolePrintF(13,"OpenTTD Game Console Revision 3 - %s",_openttd_revision);
 #else
-IConsolePrint(13,"OpenTTD Game Console Revision 3");	
+IConsolePrint(13,"OpenTTD Game Console Revision 3");
 #endif
 IConsolePrint(12,"---------------------------------");
 IConsolePrint(12,"use \"help\" for more info");
@@ -386,7 +386,7 @@
 _iconsole_cmd * item;
 
 item = _iconsole_cmds;
-while (item != NULL) { 
+while (item != NULL) {
 	if (strcmp(item->name,name)==0) return item->addr;
 	item = item->_next;
 	}
@@ -455,7 +455,7 @@
 _iconsole_var * item;
 
 item = _iconsole_vars;
-while (item != NULL) { 
+while (item != NULL) {
 	if (strcmp(item->name,name)==0) return item;
 	item = item->_next;
 	}
@@ -733,7 +733,7 @@
 if (!(*tokenstream==0)) {
 	c++;
 	tokenstream++;
-	*tokenstream = 0;	
+	*tokenstream = 0;
 	}
 
 //** interpreting **//
@@ -790,7 +790,7 @@
 //** executing **//
 if (_stdlib_con_developer) IConsolePrintF(_iconsole_color_debug,"CONDEBUG: execution_mode: %i",execution_mode);
 switch (execution_mode) {
-case 0: 
+case 0:
 	{
 	// not found
 	IConsoleError("command or variable not found");
@@ -830,7 +830,7 @@
 				else if (strcmp(tokens[1],"--")==0) {
 					*(bool *)var->addr=!*(bool *)var->addr;
 					IConsoleVarDump(var,NULL);
-					}	 
+					}
 				else { IConsoleError("operation not supported"); }
 				}
 				break;
@@ -852,7 +852,7 @@
 				else if (strcmp(tokens[1],"--")==0) {
 					(*(byte *)var->addr)--;
 					IConsoleVarDump(var,NULL);
-					}	 
+					}
 				else { IConsoleError("operation not supported"); }
 				}
 				break;
@@ -1083,7 +1083,7 @@
 			result = NULL;
 			}
 		}
-	
+
 	}
 	break;
 default:
@@ -1129,7 +1129,7 @@
 }
 
 static _iconsole_var * IConsoleStdLibScreenShot(byte argc, byte* argv[], byte argt[]) {
-	
+
 	if (argc<2) {
 		_make_screenshot=1;
 	} else {
@@ -1201,7 +1201,7 @@
 if (argv[1]!=NULL) l = strlen((char *) argv[1]);
 
 item = _iconsole_cmds;
-while (item != NULL) { 
+while (item != NULL) {
 	if (argv[1]!=NULL) {
 
 		if (memcmp((void *) item->name, (void *) argv[1],l)==0)
@@ -1225,7 +1225,7 @@
 if (argv[1]!=NULL) l = strlen((char *) argv[1]);
 
 item = _iconsole_vars;
-while (item != NULL) { 
+while (item != NULL) {
 	if (argv[1]!=NULL) {
 
 		if (memcmp((void *) item->name, (void *) argv[1],l)==0)
@@ -1249,7 +1249,7 @@
 if (argv[1]!=NULL) l = strlen((char *) argv[1]);
 
 item = _iconsole_vars;
-while (item != NULL) { 
+while (item != NULL) {
 	if (argv[1]!=NULL) {
 
 		if (memcmp((void *) item->name, (void *) argv[1],l)==0)
--- a/disaster_cmd.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/disaster_cmd.c	Fri Sep 10 19:02:27 2004 +0000
@@ -13,7 +13,7 @@
 static void DisasterClearSquare(uint tile)
 {
 	int type;
-		
+
 	if (!EnsureNoVehicle(tile))
 		return;
 
@@ -107,7 +107,7 @@
 
 	if ( (u=v->next) != NULL) {
 		BeginVehicleMove(u);
-	
+
 		u->x_pos = x;
 		u->y_pos = yt = y - 1 - (max(z - GetSlopeZ(x, y-1), 0) >> 3);
 		u->z_pos = GetSlopeZ(x,yt);
@@ -144,7 +144,7 @@
 			return;
 
 		GetNewVehiclePos(v, &gp);
-		
+
 		SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
 
 		if (v->next_order == 1) {
@@ -162,7 +162,7 @@
 			if (IS_TILETYPE(tile, MP_STATION) &&
 				IS_BYTE_INSIDE(_map5[tile], 8, 0x43) &&
 				IS_HUMAN_PLAYER(_map_owner[tile])) {
-				
+
 				v->next_order = 1;
 				v->age = 0;
 
@@ -176,12 +176,12 @@
 		if (v->y_pos >= (TILES_Y+9) * 16 - 1)
 			DeleteDisasterVeh(v);
 		return;
-	} 
-	
+	}
+
 	if (v->next_order > 2) {
 		if (++v->age <= 13320)
 			return;
-		
+
 		tile = v->tile; /**/
 
 		if (IS_TILETYPE(tile, MP_STATION) &&
@@ -245,9 +245,9 @@
 	byte z;
 
 	v->u.disaster.image_override = (++v->tick_counter & 8) ? 0xF45 : 0xF44;
-	
+
 	if (v->next_order == 0) {
-// fly around randomly 
+// fly around randomly
 		int x = GET_TILE_X(v->dest_tile)*16;
 		int y = GET_TILE_Y(v->dest_tile)*16;
 		if (abs(x - v->x_pos) +	abs(y - v->y_pos) >= 16) {
@@ -288,11 +288,11 @@
 
 		v->direction = GetDirectionTowards(v, u->x_pos, u->y_pos);
 		GetNewVehiclePos(v, &gp);
-		
+
 		z = v->z_pos;
 		if (dist <= 16 && z > u->z_pos) z--;
 		SetDisasterVehiclePos(v, gp.x, gp.y, z);
-			
+
 		if (z <= u->z_pos && (u->vehstatus&VS_HIDDEN)==0) {
 			v->age++;
 			if (u->u.road.crashed_ctr == 0) {
@@ -332,10 +332,10 @@
 static void DisasterTick_2(Vehicle *v)
 {
 	GetNewVehiclePosResult gp;
-	
+
 	v->tick_counter++;
 	v->u.disaster.image_override = (v->next_order == 1 && v->tick_counter&4) ? 0xF4F : 0;
-	
+
 	GetNewVehiclePos(v, &gp);
 	SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
 
@@ -386,7 +386,7 @@
 			return;
 
 		tile = TILE_FROM_XY(x,y);
-		if (!IS_TILETYPE(tile, MP_INDUSTRY))	
+		if (!IS_TILETYPE(tile, MP_INDUSTRY))
 			return;
 
 		v->dest_tile = ind = _map2[tile];
@@ -456,7 +456,7 @@
 			return;
 
 		tile = TILE_FROM_XY(x,y);
-		if (!IS_TILETYPE(tile, MP_INDUSTRY))	
+		if (!IS_TILETYPE(tile, MP_INDUSTRY))
 			return;
 
 		v->dest_tile = ind = _map2[tile];
@@ -546,7 +546,7 @@
 		InitializeDisasterVehicle(w, -6*16, v->y_pos, 0, 5, 12);
 		w->vehstatus |= VS_DISASTER;
 	} else if (v->next_order < 1) {
-		
+
 		int x = GET_TILE_X(v->dest_tile)*16;
 		int y = GET_TILE_Y(v->dest_tile)*16;
 		if (abs(x - v->x_pos) +	abs(y - v->y_pos) >= 16) {
@@ -593,7 +593,7 @@
 	}
 
 	if (v->next_order == 0) {
-		u = &_vehicles[v->u.disaster.unk2];	
+		u = &_vehicles[v->u.disaster.unk2];
 		if (abs(v->x_pos - u->x_pos) > 16)
 			return;
 		v->next_order = 1;
@@ -685,7 +685,7 @@
 typedef void DisasterInitProc();
 
 // Zeppeliner which crashes on a small airport
-static void Disaster0_Init() 
+static void Disaster0_Init()
 {
 	Vehicle *v = ForceAllocateSpecialVehicle(), *u;
 	Station *st;
@@ -695,7 +695,7 @@
 		return;
 
 	for(st=_stations;;) {
-		if (st->xy && st->airport_tile != 0 && 
+		if (st->xy && st->airport_tile != 0 &&
 				st->airport_type <= 1 &&
 				IS_HUMAN_PLAYER(st->owner)) {
 			x = (GET_TILE_X(st->xy) + 2) * 16;
@@ -714,12 +714,12 @@
 	u = ForceAllocateSpecialVehicle();
 	if (u != NULL) {
 		v->next = u;
-		InitializeDisasterVehicle(u,x,0,0,3,1); 
+		InitializeDisasterVehicle(u,x,0,0,3,1);
 		u->vehstatus |= VS_DISASTER;
 	}
 }
 
-static void Disaster1_Init() 
+static void Disaster1_Init()
 {
 	Vehicle *v = ForceAllocateSpecialVehicle(), *u;
 	int x;
@@ -737,12 +737,12 @@
 	u = ForceAllocateSpecialVehicle();
 	if (u != NULL) {
 		v->next = u;
-		InitializeDisasterVehicle(u,x,0,0,3,3); 
+		InitializeDisasterVehicle(u,x,0,0,3,3);
 		u->vehstatus |= VS_DISASTER;
 	}
 }
 
-static void Disaster2_Init() 
+static void Disaster2_Init()
 {
 	Industry *i, *found;
 	Vehicle *v,*u;
@@ -750,7 +750,7 @@
 
 	for(found=NULL,i=_industries; i != endof(_industries); i++) {
 		if (i->xy != 0 &&
-				i->type == IT_OIL_REFINERY && 
+				i->type == IT_OIL_REFINERY &&
 				(found==NULL || CHANCE16(1,2))) {
 			found = i;
 		}
@@ -771,12 +771,12 @@
 	u = ForceAllocateSpecialVehicle();
 	if (u != NULL) {
 		v->next = u;
-		InitializeDisasterVehicle(u,x,y,0,3,5); 
+		InitializeDisasterVehicle(u,x,y,0,3,5);
 		u->vehstatus |= VS_DISASTER;
 	}
 }
 
-static void Disaster3_Init() 
+static void Disaster3_Init()
 {
 	Industry *i, *found;
 	Vehicle *v,*u,*w;
@@ -784,7 +784,7 @@
 
 	for(found=NULL,i=_industries; i != endof(_industries); i++) {
 		if (i->xy != 0 &&
-				i->type == IT_FACTORY && 
+				i->type == IT_FACTORY &&
 				(found==NULL || CHANCE16(1,2))) {
 			found = i;
 		}
@@ -805,18 +805,18 @@
 	u = ForceAllocateSpecialVehicle();
 	if (u != NULL) {
 		v->next = u;
-		InitializeDisasterVehicle(u,x,y,0,5,7); 
+		InitializeDisasterVehicle(u,x,y,0,5,7);
 		u->vehstatus |= VS_DISASTER;
 
 		w = ForceAllocateSpecialVehicle();
 		if (w != NULL) {
 			u->next = w;
-			InitializeDisasterVehicle(w,x,y,140,5,8); 
+			InitializeDisasterVehicle(w,x,y,140,5,8);
 		}
 	}
 }
 
-static void Disaster4_Init() 
+static void Disaster4_Init()
 {
 	Vehicle *v = ForceAllocateSpecialVehicle(), *u;
 	int x,y;
@@ -835,13 +835,13 @@
 	u = ForceAllocateSpecialVehicle();
 	if (u != NULL) {
 		v->next = u;
-		InitializeDisasterVehicle(u,x,y,0,7,10); 
+		InitializeDisasterVehicle(u,x,y,0,7,10);
 		u->vehstatus |= VS_DISASTER;
 	}
 }
 
 // Submarine type 1
-static void Disaster5_Init() 
+static void Disaster5_Init()
 {
 	Vehicle *v = ForceAllocateSpecialVehicle();
 	int x,y;
@@ -862,7 +862,7 @@
 }
 
 // Submarine type 2
-static void Disaster6_Init() 
+static void Disaster6_Init()
 {
 	Vehicle *v = ForceAllocateSpecialVehicle();
 	int x,y;
@@ -882,20 +882,20 @@
 	v->age = 0;
 }
 
-static void Disaster7_Init() 
+static void Disaster7_Init()
 {
 	Industry *i;
 	int maxloop = 15;
 	int index = Random() & 0xF;
-	
+
 	do {
 		for(i=_industries; i != endof(_industries); i++) {
 			if (i->xy != 0 && i->type == IT_COAL_MINE	&& --index < 0) {
-				
+
 				SET_DPARAM16(0, i->town->index);
-				AddNewsItem(STR_B005_COAL_MINE_SUBSIDENCE_LEAVES, 
+				AddNewsItem(STR_B005_COAL_MINE_SUBSIDENCE_LEAVES,
 					NEWS_FLAGS(NM_THIN,NF_VIEWPORT|NF_TILE,NT_ACCIDENT,0), i->xy + TILE_XY(1,1), 0);
-				
+
 				{
 					uint tile = i->xy;
 					int step = _tileoffs_by_dir[Random() & 3];
--- a/dock_gui.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/dock_gui.c	Fri Sep 10 19:02:27 2004 +0000
@@ -129,7 +129,7 @@
 
 	case WE_PLACE_OBJ:
 		_place_proc(e->place.tile);
-		break;	
+		break;
 
 	case WE_PLACE_DRAG: {
 		VpSelectTilesWithMethod(e->place.pt.x, e->place.pt.y, e->place.userdata);
@@ -155,7 +155,7 @@
 		w = FindWindowById(WC_BUILD_DEPOT, 0);
 		if (w != NULL) WP(w,def_d).close=true;
 		break;
-	
+
 	case WE_PLACE_PRESIZE: {
 		uint tile_from, tile_to;
 
@@ -225,7 +225,7 @@
 		CheckRedrawStationCoverage(w);
 		break;
 	}
-	}	
+	}
 }
 
 static const Widget _build_dock_station_widgets[] = {
--- a/economy.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/economy.c	Fri Sep 10 19:02:27 2004 +0000
@@ -44,11 +44,11 @@
 uint32 CalculateCompanyValue(Player *p) {
 	byte owner = p->index;
 	uint32 value;
-	
+
 	{
 		Station *st;
 		uint num = 0;
-		
+
 		FOR_ALL_STATIONS(st) {
 			if (st->xy != 0 && st->owner == owner) {
 				uint facil = st->facilities;
@@ -194,7 +194,7 @@
 	{
 		_score_part[owner][SCORE_LOAN] = score_info[SCORE_LOAN].needed - p->current_loan;
 	}
-	
+
 	// Now we calculate the score for each item..
 	{
 		int i;
@@ -210,9 +210,9 @@
 			score += s;
 			total_score += score_info[i].score;
 		}
-		
+
 		_score_part[owner][SCORE_TOTAL] = score;
-		
+
 		// We always want the score scaled to SCORE_MAX (1000)
 		if (total_score != SCORE_MAX)
 			score = score * SCORE_MAX / total_score;
@@ -223,7 +223,7 @@
     	UpdatePlayerHouse(p, score);
     	p->old_economy[0].company_value = CalculateCompanyValue(p);
     }
-	
+
 	InvalidateWindow(WC_PERFORMANCE_DETAIL, 0);
 	return score;
 }
@@ -236,7 +236,7 @@
 
 	if (new_player == 255) {
 		Subsidy *s;
-		
+
 		for(s=_subsidies; s != endof(_subsidies); s++) {
 			if (s->cargo_type != 0xff && s->age >= 12) {
 				Station *st = DEREF_STATION(s->to);
@@ -249,7 +249,7 @@
 	// take care of rating in towns
 	{
 		Town *t;
-		
+
 		// if a player takes over, give the ratings to that player.
 		if (new_player != 255) {
 			FOR_ALL_TOWNS(t) if (t->xy && HASBIT(t->have_ratings, old_player)) {
@@ -269,7 +269,7 @@
 			CLRBIT(t->have_ratings, old_player);
 		}
 	}
-	
+
 	{
 		int num_train = 0;
 		int num_road = 0;
@@ -353,7 +353,7 @@
 
 	if (p->quarters_of_bankrupcy == 2) {
 year_2:
-		AddNewsItem( (StringID)(owner + 16), 
+		AddNewsItem( (StringID)(owner + 16),
 			NEWS_FLAGS(NM_CALLBACK, 0, NT_COMPANY_INFO, DNC_BANKRUPCY),0,0);
 
 	} else if (p->quarters_of_bankrupcy == 3) {
@@ -396,7 +396,7 @@
 {
 	Player *p;
 
-	DrawNewsBorder(w);		
+	DrawNewsBorder(w);
 
 	p = DEREF_PLAYER(WP(w,news_d).ni->string_id & 15);
 	DrawPlayerFace(p->face, p->player_color, 2, 23);
@@ -446,7 +446,7 @@
 			90,
 			STR_705D_HAS_BEEN_CLOSED_DOWN_BY,
 			w->width - 101);
-		break;		
+		break;
 
 	case 4:
 		DrawStringCentered(w->width>>1, 1, STR_705E_NEW_TRANSPORT_COMPANY_LAUNCHED, 0);
@@ -499,7 +499,7 @@
 	default:
 		NOT_REACHED();
 	}
-  
+
 	/* useless, but avoids compiler warning this way */
 	return 0;
 }
@@ -563,13 +563,13 @@
 	}
 
 	_economy.max_loan_unround += BIGMULUS(_economy.max_loan_unround, inf, 16);
-	
+
 	if (_economy.max_loan + 50000 <= _economy.max_loan_unround)
 		_economy.max_loan += 50000;
 
 	inf = _economy.infl_amount_pr * 54;
 	for(i=0; i!=NUM_CARGO; i++) {
-		AddSingleInflation( 
+		AddSingleInflation(
 			_cargo_payment_rates + i,
 			_cargo_payment_rates_frac + i,
 			inf
@@ -592,7 +592,7 @@
 
 		_current_player = p->index;
 		SET_EXPENSES_TYPE(EXPENSES_LOAN_INT);
-		
+
 		SubtractMoneyFromPlayer(BIGMULUS(p->current_loan, interest, 16));
 
 		SET_EXPENSES_TYPE(EXPENSES_OTHER);
@@ -767,28 +767,28 @@
 void DeleteSubsidyWithIndustry(byte index)
 {
 	Subsidy *s;
-	
+
 	for(s=_subsidies; s != endof(_subsidies); s++) {
 		if (s->cargo_type != 0xFF && s->age < 12 &&
 				s->cargo_type != CT_PASSENGERS && s->cargo_type != CT_MAIL &&
 				(index == s->from || (s->cargo_type!=CT_GOODS && s->cargo_type!=CT_FOOD && index==s->to))) {
 			s->cargo_type = 0xFF;
 		}
-	}	
+	}
 }
 
-void DeleteSubsidyWithStation(byte index) 
+void DeleteSubsidyWithStation(byte index)
 {
 	Subsidy *s;
 	bool dirty = false;
-	
+
 	for(s=_subsidies; s != endof(_subsidies); s++) {
 		if (s->cargo_type != 0xFF && s->age >= 12 &&
 				(s->from == index || s->to == index)) {
 			s->cargo_type = 0xFF;
 			dirty = true;
 		}
-	}	
+	}
 
 	if (dirty)
 		InvalidateWindow(WC_SUBSIDIES_LIST, 0);
@@ -852,7 +852,7 @@
 	if (cargo == CT_GOODS || cargo == CT_FOOD) {
 		// The destination is a town
 		Town *t = DEREF_TOWN(RandomRange(_total_towns));
-		
+
 		// Only want big towns
 		if (t->xy == 0 || t->population < 900)
 			return;
@@ -861,9 +861,9 @@
 	} else {
 		// The destination is an industry
 		Industry *i2 = DEREF_INDUSTRY(RandomRange(_total_industries));
-		
+
 		// The industry must accept the cargo
-		if (i == i2 || i2->xy == 0 || 
+		if (i == i2 || i2->xy == 0 ||
 				(cargo != i2->accepts_cargo[0] &&
 				cargo != i2->accepts_cargo[1] &&
 				cargo != i2->accepts_cargo[2]))
@@ -873,15 +873,15 @@
 	}
 }
 
-static bool CheckSubsidyDuplicate(Subsidy *s) 
+static bool CheckSubsidyDuplicate(Subsidy *s)
 {
 	Subsidy *ss;
 
 	for(ss=_subsidies; ss != endof(_subsidies); ss++) {
-		if (s != ss && 
-//				ss->age < 12 && 
-				ss->from == s->from && 
-				ss->to == s->to && 
+		if (s != ss &&
+//				ss->age < 12 &&
+				ss->from == s->from &&
+				ss->to == s->to &&
 				ss->cargo_type == s->cargo_type) {
 			s->cargo_type = 0xFF;
 			return true;
@@ -929,7 +929,7 @@
 			if (++s == endof(_subsidies))
 				goto no_add;
 		}
-		
+
 		n = 1000;
 		do {
 			FindSubsidyPassengerRoute(&fr);
@@ -1002,7 +1002,7 @@
 	if (transit_days > _cargoc.transit_days_1[cargo]) {
 		transit_days -= _cargoc.transit_days_1[cargo];
 		f -= transit_days;
-		
+
 		if (transit_days > _cargoc.transit_days_2[cargo]) {
 			transit_days -= _cargoc.transit_days_2[cargo];
 
@@ -1019,7 +1019,7 @@
 
 static void DeliverGoodsToIndustry(TileIndex xy, byte cargo_type, int num_pieces)
 {
-	Industry *ind, *best;	
+	Industry *ind, *best;
 	int t, u;
 
 	/* Check if there's an industry close to the station that accepts
@@ -1031,7 +1031,7 @@
 				 == ind->accepts_cargo[1] || cargo_type == ind->accepts_cargo[2]) &&
 				 ind->produced_cargo[0] != 0xFF &&
 				 ind->produced_cargo[0] != cargo_type &&
-				 (t=GetTileDist(ind->xy, xy)) < u) {			
+				 (t=GetTileDist(ind->xy, xy)) < u) {
 			u = t;
 			best = ind;
 		}
@@ -1063,7 +1063,7 @@
 	/* check if there's a new subsidy that applies.. */
 	for(s=_subsidies; s != endof(_subsidies); s++) {
 		if (s->cargo_type == cargo_type && s->age < 12) {
-		
+
 			/* Check distance from source */
 			if (cargo_type == CT_PASSENGERS || cargo_type == CT_MAIL) {
 				xy = DEREF_TOWN(s->from)->xy;
@@ -1072,7 +1072,7 @@
 			}
 			if (GetTileDist1D(xy, from->xy) > 9)
 				continue;
-			
+
 			/* Check distance from dest */
 			if (cargo_type == CT_PASSENGERS || cargo_type == CT_MAIL || cargo_type == CT_GOODS || cargo_type == CT_FOOD) {
 				xy = DEREF_TOWN(s->to)->xy;
@@ -1096,7 +1096,7 @@
 			SET_DPARAM16(0, p->name_1);
 			SET_DPARAM32(1, p->name_2);
 			AddNewsItem(
-				STR_2031_SERVICE_SUBSIDY_AWARDED + _opt.diff.subsidy_multiplier, 
+				STR_2031_SERVICE_SUBSIDY_AWARDED + _opt.diff.subsidy_multiplier,
 				NEWS_FLAGS(NM_NORMAL, NF_TILE, NT_SUBSIDIES, 0),
 				pair.a, pair.b);
 
@@ -1138,7 +1138,7 @@
 
 	// Give the goods to the industry.
 	DeliverGoodsToIndustry(s_to->xy, cargo_type, num_pieces);
-	
+
 	// Determine profit
 	{
 		int t = GetTileDist(s_from->xy, s_to->xy);
@@ -1197,7 +1197,7 @@
 	for(;;) {
 		if (v->cargo_cap == 0)
 			goto next_vehicle;
-		
+
 		ge = &st->goods[v->cargo_type];
 
 		/* unload? */
@@ -1211,7 +1211,7 @@
 			} else if (u->next_order & OF_UNLOAD) {
 				/* unload goods and let it wait at the station */
 				st->time_since_unload = 0;
-				
+
 				if ((t=ge->waiting_acceptance & 0xFFF) == 0) {
 					// No goods waiting at station
 					ge->enroute_time = v->cargo_days;
@@ -1229,7 +1229,7 @@
 				v->cargo_count = 0;
 			}
 		}
-	
+
 		/* don't pick up goods that we unloaded */
 		if (u->next_order & OF_UNLOAD)
 			goto next_vehicle;
@@ -1238,7 +1238,7 @@
 		ge->days_since_pickup = 0;
 		t = u->max_speed;
 		if (u->type == VEH_Road) t >>=1;
-		
+
 		// if last speed is 0, we treat that as if no vehicle has ever visited the station.
 		ge->last_speed = t < 255 ? t : 255;
 		ge->last_age = _cur_year - v->build_year;
@@ -1252,7 +1252,7 @@
 			ge->waiting_acceptance -= cap;
 			unloading_time += cap;
 			st->time_since_load = 0;
-			
+
 			// And record the source of the cargo, and the days in travel.
 			v->cargo_source = ge->enroute_from;
 			v->cargo_days = ge->enroute_time;
--- a/economy.h	Fri Sep 10 18:54:23 2004 +0000
+++ b/economy.h	Fri Sep 10 19:02:27 2004 +0000
@@ -36,7 +36,7 @@
     SCORE_TOTAL = 9, // This must always be the last entry
 
     NUM_SCORE = 10, // How many scores are there..
-    
+
     SCORE_MAX = 1000, 	// The max score that can be in the performance history
     					//  the scores together of score_info is allowed to be more!
 };
--- a/engine.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/engine.c	Fri Sep 10 19:02:27 2004 +0000
@@ -124,7 +124,7 @@
 		e->railtype = ei->railtype_climates >> 4;
 		e->flags = 0;
 		e->player_avail = 0;
-		
+
 		r = Random();
 		e->intro_date = (uint16)((r & 0x1FF) + ei->base_intro);
 		if (e->intro_date <= _date) {
@@ -191,7 +191,7 @@
 	wos->overrides_count++;
 	wos->overrides = realloc(wos->overrides,
 	                         wos->overrides_count * sizeof(struct WagonOverride));
-	
+
 	wo = &wos->overrides[wos->overrides_count - 1];
 	wo->superset = *superset;
 	wo->trains = trains;
@@ -246,7 +246,7 @@
 		overset = GetWagonOverrideSpriteSet(engine, overriding_engine);
 		if (overset) superset = overset;
 	}
-	
+
 	if (!superset->sprites_per_set && cargo != 29) {
 		// This superset is empty but perhaps there'll be a default one.
 		superset = &_engine_custom_sprites[engine][29];
@@ -307,7 +307,7 @@
 	SETBIT(e->player_avail, player);
 
 	p = DEREF_PLAYER(player);
-	
+
 	UPDATE_PLAYER_RAILTYPE(e,p);
 
 	e->preview_player = 0xFF;
@@ -333,7 +333,7 @@
 					e->flags &= ~ENGINE_PREVIEWING;
 					DeleteWindowById(WC_ENGINE_PREVIEW, i);
 					e->preview_player++;
-				}	
+				}
 			} else if (e->preview_player != 0xFF) {
 				num = e->preview_player;
 				mask = 0;
@@ -341,7 +341,7 @@
 					best_hist = -1;
 					best_player = -1;
 					FOR_ALL_PLAYERS(p) {
-						if (p->is_active && p->block_preview == 0 && !HASBIT(mask,p->index) && 
+						if (p->is_active && p->block_preview == 0 && !HASBIT(mask,p->index) &&
 								p->old_economy[0].performance_history > best_hist) {
 							best_hist = p->old_economy[0].performance_history;
 							best_player = p->index;
@@ -353,7 +353,7 @@
 					}
 					mask |= (1 << best_player);
 				} while (--num != 0);
-				
+
 				if (!IS_HUMAN_PLAYER(best_player)) {
 					/* TTDBUG: TTD has a bug here */
 					AcceptEnginePreview(e, best_player);
@@ -361,7 +361,7 @@
 					e->flags |= ENGINE_PREVIEWING;
 					e->preview_wait = 20;
 					if (IS_INTERACTIVE_PLAYER(best_player)) {
-						ShowEnginePreviewWindow(i);					
+						ShowEnginePreviewWindow(i);
 					}
 				}
 			}
@@ -390,7 +390,7 @@
 		FOR_ALL_PLAYERS(p) {
 			if (!HASBIT(e->player_avail,p->index))
 				continue;
-		
+
 			for(v=_vehicles;;) {
 				if (v->type == VEH_Train || v->type == VEH_Road || v->type == VEH_Ship ||
 						(v->type == VEH_Aircraft && v->subtype <= 2)) {
@@ -466,7 +466,7 @@
 	str = AllocateName((byte*)_decode_parameters, 0);
 	if (str == 0)
 		return CMD_ERROR;
-	
+
 	if (flags & DC_EXEC) {
 		StringID old_str = _engine_name_strings[p1];
 		_engine_name_strings[p1] = str;
--- a/engine_gui.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/engine_gui.c	Fri Sep 10 19:02:27 2004 +0000
@@ -88,7 +88,7 @@
 	case WE_CLICK:
 		switch(e->click.widget) {
 		case 3: DeleteWindow(w); break;
-		case 4: 
+		case 4:
 			DoCommandP(0, w->window_number, 0, NULL, CMD_WANT_ENGINE_PREVIEW);
 			DeleteWindow(w);
 			break;
@@ -150,7 +150,7 @@
 	DrawNewsBorder(w);
 
 	engine = WP(w,news_d).ni->string_id;
-	
+
 	DrawStringMultiCenter(w->width >> 1, 20, STR_A02C_NEW_AIRCRAFT_NOW_AVAILABLE, w->width - 2);
 	GfxFillRect(25, 56, w->width - 25, w->height - 2, 10);
 
@@ -203,7 +203,7 @@
 	DrawNewsBorder(w);
 
 	engine = WP(w,news_d).ni->string_id;
-	
+
 	DrawStringMultiCenter(w->width >> 1, 20, STR_982C_NEW_SHIP_NOW_AVAILABLE, w->width - 2);
 	GfxFillRect(25, 56, w->width - 25, w->height - 2, 10);
 
--- a/fileio.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/fileio.c	Fri Sep 10 19:02:27 2004 +0000
@@ -101,7 +101,7 @@
 	char buf[MAX_PATH];
 
 	sprintf(buf, "%s%s", _path.data_dir, filename);
-	
+
 	f = fopen(buf, "rb");
 #if !defined(WIN32)
 	if (f == NULL) {
@@ -115,7 +115,7 @@
 
 	if (f == NULL)
 		error("Cannot open file '%s'", buf);
-	
+
 	_fio.handles[slot] = f;
 	FioSeekToFile(slot << 24);
 }
--- a/gfx.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/gfx.c	Fri Sep 10 19:02:27 2004 +0000
@@ -242,17 +242,17 @@
 // 0 - end of string
 // 1 - SETX <BYTE>
 // 2 - SETXY <BYTE> <BYTE>
-// 3-7 - 
+// 3-7 -
 // 8 - TINYFONT
 // 9 - BIGFONT
 // 10 - newline
-// 11-14 - 
+// 11-14 -
 // 15-31 - 17 colors
 
 
 enum {
 	ASCII_LETTERSTART = 32,
-	
+
 	ASCII_SETX = 1,
 	ASCII_SETXY = 2,
 
@@ -510,7 +510,7 @@
 skip_char:;
 		for(;;) {
 			c = *string++;
-			if (c < ASCII_LETTERSTART) goto skip_cont;			
+			if (c < ASCII_LETTERSTART) goto skip_cont;
 		}
 	}
 
@@ -586,7 +586,7 @@
 
 	if (bp->mode & 1) {
 		src_o += READ_LE_UINT16(src_o + bp->start_y * 2);
-		
+
 		do {
 			do {
 				done = src_o[0];
@@ -1351,7 +1351,7 @@
 
 		if (dpi->zoom > 0) {
 			start_y += bp.height &~ zoom_mask;
-			bp.height &= zoom_mask; 
+			bp.height &= zoom_mask;
 			if (bp.height == 0) return;
 			y&=zoom_mask;
 		}
@@ -1622,7 +1622,7 @@
 			_screen.dst_ptr + _cursor.draw_pos.x + _cursor.draw_pos.y * _screen.pitch,
 			_cursor_backup,
 			_cursor.draw_size.x, _cursor.draw_size.y, _cursor.draw_size.x, _screen.pitch);
-		
+
 		_video_driver->make_dirty(_cursor.draw_pos.x, _cursor.draw_pos.y, _cursor.draw_size.x, _cursor.draw_size.y);
 	}
 }
@@ -1920,9 +1920,9 @@
 }
 
 bool ChangeResInGame(int w, int h)
-{	
+{
 	if ((_screen.width != w || _screen.height != h) && !_video_driver->change_resolution(w, h))
-		return false;
+		return false;
 
 	_cur_resolution[0] = w;
 	_cur_resolution[1] = h;
--- a/gfx.h	Fri Sep 10 18:54:23 2004 +0000
+++ b/gfx.h	Fri Sep 10 19:02:27 2004 +0000
@@ -13,7 +13,7 @@
 	byte *dst_ptr;
 	int left, top, width, height;
 	int pitch;
-	uint16 zoom;	
+	uint16 zoom;
 };
 
 
@@ -47,8 +47,8 @@
 void DrawStringCenterUnderline(int x, int y, uint16 str, byte color);
 int DoDrawString(const byte *string, int x, int y, byte color);
 void DrawStringRightAligned(int x, int y, uint16 str, byte color);
-void GfxFillRect(int left, int top, int right, int bottom, int color);	
-void GfxDrawLine(int left, int top, int right, int bottom, int color);	
+void GfxFillRect(int left, int top, int right, int bottom, int color);
+void GfxDrawLine(int left, int top, int right, int bottom, int color);
 void DrawFrameRect(int left, int top, int right, int bottom, int color, int flags);
 
 int GetStringWidth(const byte *str);
--- a/graph_gui.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/graph_gui.c	Fri Sep 10 19:02:27 2004 +0000
@@ -33,7 +33,7 @@
 
 void DrawGraph(GraphDrawer *gw)
 {
-	
+
 	int i,j,k;
 	int x,y,old_x,old_y;
 	int color;
@@ -57,7 +57,7 @@
 		GfxFillRect(x, gw->top, x, bottom, color);
 		x += 22;
 	} while (--i);
-	
+
 	/* draw the horizontal lines */
 	i = 9;
 	x = gw->left + 44;
@@ -95,7 +95,7 @@
 			}
 		} while (col_ptr++, --num_x);
 	} while (row_ptr+=24, --num_dataset);
-	
+
 	/* setup scaling */
 	y_scaling = 0x80000000;
 	value = adj_height * 2;
@@ -271,10 +271,10 @@
 	int nums;
 	int mo,yr;
 
-	// Exclude the players which aren't valid	
+	// Exclude the players which aren't valid
 	FOR_ALL_PLAYERS(p) {
 		if (!p->is_active) CLRBIT(showbits,p->index);
-	}	
+	}
 	gd->sel = showbits;
 	gd->num_vert_lines = 24;
 
@@ -305,7 +305,7 @@
 		int numd;
 
 		DrawWindowWidgets(w);
-		
+
 		gd.left = 2;
 		gd.top = 18;
 		gd.height = 136;
@@ -314,7 +314,7 @@
 		gd.color_3 = 0x10;
 		gd.color_2 = 0xD7;
 		gd.bg_line_color = 0xE;
-		
+
 		SetupGraphDrawerForPlayers(&gd);
 
 		numd = 0;
@@ -528,13 +528,13 @@
 		uint16 y=14;
 		int total_score = 0;
 		int color_done, color_notdone;
-		
+
 		// Draw standard stuff
 		DrawWindowWidgets(w);
-		
+
 		// The player of which we check the detail performance rating
 		owner = FindFirstBit(w->click_state) - 13;
-		
+
 		// Paint the player icons
 		for (i=0;i<MAX_PLAYERS;i++) {
        		if (!DEREF_PLAYER(i)->is_active) {
@@ -550,7 +550,7 @@
                 }
                	continue;
             }
-			
+
 			// Check if we have the player marked as inactive
 			if ((w->disabled_state & (1 << (i+13)))) {
 				// New player! Yippie :p
@@ -558,11 +558,11 @@
                	// We need a repaint
                	SetWindowDirty(w);
             }
-				
+
 			if (i == owner) x = 1; else x = 0;
 			DrawPlayerIcon(i, i*33+11+x, 16+x);
 		}
-		
+
 		// The colors used to show how the progress is going
 		color_done = _color_list[6].window_color_1b;
 		color_notdone = _color_list[4].window_color_1b;
@@ -579,44 +579,44 @@
     			score = SCORE_MAX;
     		} else
     			total_score += score;
-    			
+
     		DrawString(7, y, STR_PERFORMANCE_DETAIL_VEHICLES + i, 0);
 
     		// Draw the score
     		SET_DPARAM32(0, score);
     		DrawStringRightAligned(107, y, SET_PERFORMANCE_DETAIL_INT, 0);
-    		
+
     		// Calculate the %-bar
     		if (val > needed) x = 50;
     		else if (val == 0) x = 0;
     		else x = ((val * 50) / needed);
-    		
+
     		// SCORE_LOAN is inversed
     		if (val < 0 && i == SCORE_LOAN)
     			x = 0;
-    		
+
     		// Draw the bar
     		if (x != 0)
     			GfxFillRect(112, y-2, x + 112, y+10, color_done);
     		if (x != 50)
     			GfxFillRect(x + 112, y-2, 50 + 112, y+10, color_notdone);
-    			
+
    			// Calculate the %
     		if (val > needed) x = 100;
     		else x = ((val * 100) / needed);
-    		
+
     		// SCORE_LOAN is inversed
     		if (val < 0 && i == SCORE_LOAN)
     			x = 0;
-    		
+
     		// Draw it
     		SET_DPARAM32(0, x);
     		DrawStringCentered(137, y, STR_PERFORMANCE_DETAIL_PERCENT, 0);
-    		
+
     		// SCORE_LOAN is inversed
     		if (i == SCORE_LOAN)
 				val = needed - val;
-    		
+
     		// Draw the amount we have against what is needed
     		//  For some of them it is in currency format
     		SET_DPARAM32(0, val);
@@ -666,12 +666,12 @@
         	FOR_ALL_PLAYERS(p2)
         		if (p2->is_active)
         			UpdateCompanyRatingAndValue(p2, false);
-        		
+
         	w->custom[0] = DAY_TICKS;
         	w->custom[1] = 5;
-        	
+
         	w->click_state = 1 << 13;
-        	
+
 			SetWindowDirty(w);
         }
     	break;
@@ -927,7 +927,7 @@
 		gd.month = 0xFF;
 		gd.unk61A = 10;
 		gd.unk61C = 10;
-		
+
 		for(i=0; i!=NUM_CARGO; i++) {
 			gd.colors[i] = _cargo_legend_colors[i];
 			for(j=0; j!=20; j++) {
@@ -1031,14 +1031,14 @@
 		size_t pl_num, i;
 
 		DrawWindowWidgets(w);
-		
+
 		pl_num=0;
 		FOR_ALL_PLAYERS(p) {
 			if (p->is_active)
 				plist[pl_num++] = p;
 		}
 		assert(pl_num > 0);
-		
+
 		qsort(plist, pl_num, sizeof(Player*), _perf_hist_comp);
 
 		i = 0;
@@ -1047,12 +1047,12 @@
 			p = plist[i];
 			SET_DPARAM16(1, p->name_1);
 			SET_DPARAM32(2, p->name_2);
-			
+
 			SET_DPARAM16(3, GetPlayerNameString(p->index, 4));
 			/*	WARNING ugly hack!
 					GetPlayerNameString sets up (Player #) if the player is human in an extra DPARAM16
 					It seems that if player is non-human, nothing is set up, so param is 0. GetString doesn't like
-					that because there is another param after it. 
+					that because there is another param after it.
 					So we'll just shift the rating one back if player is AI and all is fine
 				*/
 			SET_DPARAM16((IS_HUMAN_PLAYER(p->index) ? 5 : 4), GetPerformanceTitleFromValue(p->old_economy[1].performance_history));
--- a/grfspecial.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/grfspecial.c	Fri Sep 10 19:02:27 2004 +0000
@@ -465,20 +465,20 @@
 			uint8 prop = grf_load_byte(&buf);
 
 			switch (prop) {
-			case 0x00: {	
+			case 0x00: {
 				/* Introduction date */
 				foreach_engine {
 					uint16 date = grf_load_word(&buf);
-					
+
 					ei[i].base_intro = date;
 				}
 				break;
 			}
-			case 0x02: {	
+			case 0x02: {
 				/* Decay speed */
 				foreach_engine {
 					uint8 decay = grf_load_byte(&buf);
-									
+
 					ei[i].unk2 &= 0x80;
 					ei[i].unk2 |= decay & 0x7f;
 				}
@@ -493,7 +493,7 @@
 				}
 				break;
 			}
-			case 0x04: {	
+			case 0x04: {
 				/* Model life */
 				foreach_engine {
 					uint8 life = grf_load_byte(&buf);
@@ -512,7 +512,7 @@
 				}
 				break;
 			}
-			case 0x07: {	
+			case 0x07: {
 				/* Loading speed */
 				/* Hyronymus explained me what does
 				 * this mean and insists on having a
@@ -636,7 +636,7 @@
 			uint8 nvar = buf[7];
 			//uint32 val;
 			uint16 def;
-			
+
 			grfmsg(GMS_WARN, "SpriteNewSuperset(0x81): Unsupported variable %x. Using default cid.", var);
 
 			//val = (0xff << shiftnum) & andmask;
--- a/hal.h	Fri Sep 10 18:54:23 2004 +0000
+++ b/hal.h	Fri Sep 10 19:02:27 2004 +0000
@@ -65,7 +65,7 @@
 
 #if defined(UNIX)
 extern const HalMusicDriver _extmidi_music_driver;
-#endif 
+#endif
 
 #if defined(__BEOS__)
 extern const HalMusicDriver _bemidi_music_driver;
--- a/industry_gui.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/industry_gui.c	Fri Sep 10 19:02:27 2004 +0000
@@ -42,7 +42,7 @@
 		if (DoCommandP(e->place.tile, _build_industry_types[_opt.landscape][WP(w,def_d).data_1], 0, NULL, CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY)))
 			ResetObjectToPlace();
 		break;
-		
+
 	case WE_ABORT_PLACE_OBJ:
 		w->click_state = 0;
 		SetWindowDirty(w);
@@ -259,7 +259,7 @@
 };
 
 void ShowBuildIndustryWindow()
-{	
+{
 	AllocateWindowDescFront(_industry_window_desc[_patches.build_rawmaterial_ind][_opt.landscape],0);
 }
 
@@ -291,20 +291,20 @@
 			}
 			DrawString(2, 107, str, 0);
 		}
-		
+
 		if (i->produced_cargo[0] != 0xFF) {
 			DrawString(2, 117, STR_482A_PRODUCTION_LAST_MONTH, 0);
 
 			SET_DPARAM16(1, i->total_production[0]);
-			SET_DPARAM16(0, _cargoc.names_long_s[i->produced_cargo[0]] + ((i->total_production[0]!=1)<<5)); 
+			SET_DPARAM16(0, _cargoc.names_long_s[i->produced_cargo[0]] + ((i->total_production[0]!=1)<<5));
 			SET_DPARAM16(2, i->pct_transported[0] * 100 >> 8);
 			DrawString(4, 127, STR_482B_TRANSPORTED, 0);
 
 			if (i->produced_cargo[1] != 0xFF) {
 				SET_DPARAM16(1, i->total_production[1]);
-				SET_DPARAM16(0, _cargoc.names_long_s[i->produced_cargo[1]] + ((i->total_production[1]!=1)<<5)); 
+				SET_DPARAM16(0, _cargoc.names_long_s[i->produced_cargo[1]] + ((i->total_production[1]!=1)<<5));
 				SET_DPARAM16(2, i->pct_transported[1] * 100 >> 8);
-				DrawString(4, 137, STR_482B_TRANSPORTED, 0);				
+				DrawString(4, 137, STR_482B_TRANSPORTED, 0);
 			}
 		}
 
@@ -323,7 +323,7 @@
 			/*	passing only i->xy is not safe if industry has a weird shape like:
 					_ X X
 					X X X
-					_ <--- grass, no industry, but i->xy points there (first top-left tile)!, 
+					_ <--- grass, no industry, but i->xy points there (first top-left tile)!,
 					so passing i->xy to destroy industry will fail in called procedure
 			*/
 			//DoCommandP(i->xy, w->window_number, 0, CcPlaySound10,  CMD_DESTROY_INDUSTRY | CMD_MSG(STR_00B5_CAN_T_CLEAR_THIS_AREA));
@@ -399,7 +399,7 @@
 	switch (_industry_sort_order >> 1) {
 	/* case 0: Sort by Name (handled later) */
 	case 1: /* Sort by Type */
-		r = i->type - j->type; 
+		r = i->type - j->type;
 		break;
 	// FIXME - Production & Transported sort need to be inversed...but, WTF it does not wanna!
 	// FIXME - And no simple --> "if (!(_industry_sort_order & 1)) r = -r;" hack at the bottom!!
@@ -407,7 +407,7 @@
 		if (i->produced_cargo[0] != 0xFF && j->produced_cargo[0] != 0xFF) { // both industries produce cargo?
 				if (i->produced_cargo[1] == 0xFF) // producing one or two things?
 					r = j->total_production[0] - i->total_production[0];
-				else	
+				else
 					r = (j->total_production[0] + j->total_production[1]) / 2 - (i->total_production[0] + i->total_production[1]) / 2;
 		} else if (i->produced_cargo[0] == 0xFF && j->produced_cargo[0] == 0xFF) // none of them producing anything, let them go to the name-sorting
 			r = 0;
@@ -421,7 +421,7 @@
 		if (i->produced_cargo[0] != 0xFF && j->produced_cargo[0] != 0xFF) { // both industries produce cargo?
 				if (i->produced_cargo[1] == 0xFF) // producing one or two things?
 					r = (j->pct_transported[0] * 100 >> 8) - (i->pct_transported[0] * 100 >> 8);
-				else 
+				else
 					r = ((j->pct_transported[0] * 100 >> 8) + (j->pct_transported[1] * 100 >> 8)) / 2 - ((i->pct_transported[0] * 100 >> 8) + (i->pct_transported[1] * 100 >> 8)) / 2;
 		} else if (i->produced_cargo[0] == 0xFF && j->produced_cargo[0] == 0xFF) // none of them producing anything, let them go to the name-sorting
 			r = 0;
@@ -444,8 +444,8 @@
 		}
 		r = strcmp(buf1, _bufcache);
 	}
-	
-	if (_industry_sort_order & 1) r = -r;	
+
+	if (_industry_sort_order & 1) r = -r;
 	return r;
 }
 
@@ -496,7 +496,7 @@
 			if (i->produced_cargo[0] != 0xFF) {
 				SET_DPARAM16(3, i->total_production[0] * 100 >> 8);
 				SET_DPARAM16(2, _cargoc.names_long_s[i->produced_cargo[0]] + ((i->total_production[0]!=1)<<5));
-				
+
 				if (i->produced_cargo[1] != 0xFF) {
 					SET_DPARAM16(5, i->total_production[1] * 100 >> 8);
 					SET_DPARAM16(4, _cargoc.names_long_s[i->produced_cargo[1]] + ((i->total_production[1]!=1)<<5));
@@ -541,7 +541,7 @@
 			_industry_sort_dirty = true;
 			SetWindowDirty(w);
 		} break;
-		
+
 		case 7: {
 			int y = (e->click.pt.y - 28) / 10;
 			byte p;
@@ -561,7 +561,7 @@
 	case WE_4:
 		SetWindowDirty(w);
 		break;
-	}  
+	}
 }
 
 
--- a/intro_gui.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/intro_gui.c	Fri Sep 10 19:02:27 2004 +0000
@@ -54,7 +54,7 @@
 		case 3: ShowSaveLoadDialog(SLD_LOAD_GAME); break;
 		case 4: ShowPatchesSelection(); break;
 		case 5: DoCommandP(0, InteractiveRandom(), 0, NULL, CMD_CREATE_SCENARIO); break;
-		case 6: 
+		case 6:
 			if (_networking)
 				DoCommandP(0, 0, 0, NULL, CMD_SET_SINGLE_PLAYER);
 			break;
@@ -113,7 +113,7 @@
 		DeleteWindowById(WC_SAVELOAD, 0);
 		break;
 	}
-	
+
 	return 0;
 }
 
@@ -216,7 +216,7 @@
 	case WE_KEYPRESS: /* Exit game on pressing 'Enter' */
 		if (e->keypress.keycode == WKC_RETURN)
 			_exit_game = true;
-		break; 
+		break;
 	}
 }
 
@@ -247,9 +247,9 @@
 	switch(e->event) {
 	case WE_PAINT:
 		DrawWindowWidgets(w);
-		DrawStringMultiCenter(0x5A, 0x26, 
-			_game_mode != GM_EDITOR ? STR_0160_ARE_YOU_SURE_YOU_WANT_TO : 
-				STR_029B_ARE_YOU_SURE_YOU_WANT_TO, 
+		DrawStringMultiCenter(0x5A, 0x26,
+			_game_mode != GM_EDITOR ? STR_0160_ARE_YOU_SURE_YOU_WANT_TO :
+				STR_029B_ARE_YOU_SURE_YOU_WANT_TO,
 			178);
 		return;
 
--- a/macros.h	Fri Sep 10 18:54:23 2004 +0000
+++ b/macros.h	Fri Sep 10 19:02:27 2004 +0000
@@ -3,7 +3,7 @@
 
 #define MAX_INT 0x7FFFFFFF
 
-#ifdef min 
+#ifdef min
 #undef min
 #endif
 
@@ -35,7 +35,7 @@
 }
 
 // Will crash if strings are equal
-static INLINE bool str_is_below(byte *a, byte *b) {		
+static INLINE bool str_is_below(byte *a, byte *b) {
 	while (*a <= *b) {
 		if (*a < *b) return true;
 		a++;
@@ -152,7 +152,7 @@
 
 
 #if TILE_X_BITS + TILE_Y_BITS <= 16
-	typedef uint16 TileIndex;	
+	typedef uint16 TileIndex;
 	typedef int16 TileIndexDiff;
 #else
 	typedef uint32 TileIndex;
@@ -210,7 +210,7 @@
 	static INLINE uint16 READ_LE_UINT16(const void *b) {
 		return ((byte*)b)[0] + (((byte*)b)[1] << 8);
 	}
-#	define ADD_WORD(x) ((x) >> 8)&0xFF, (x)&0xFF 
+#	define ADD_WORD(x) ((x) >> 8)&0xFF, (x)&0xFF
 #	define ADD_DWORD(x) ((x) >> 24)&0xFF, ((x) >> 16)&0xFF, ((x) >> 8)&0xFF,  (x)&0xFF
 #endif
 
--- a/main_gui.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/main_gui.c	Fri Sep 10 19:02:27 2004 +0000
@@ -36,7 +36,7 @@
 	memcpy(_decode_parameters, b, 32);
 
 	id = _rename_id;
-	
+
 	switch(_rename_what) {
 	case 0:
 		// for empty string send "remove sign" parameter
@@ -188,7 +188,7 @@
 {
 	ShowPlayerCompany(index);
 }
-	
+
 
 void MenuClickGraphs(int index)
 {
@@ -403,11 +403,11 @@
 			SetWindowDirty(v);
 			return;
 		}
-		
+
 	case WE_POPUPMENU_SELECT: {
 		int index = GetMenuItemIndex(w, e->popupmenu.pt.x, e->popupmenu.pt.y);
 		int action_id;
-		
+
 
 		if (index < 0) {
 			Window *w2 = FindWindowById(WC_MAIN_TOOLBAR,0);
@@ -417,10 +417,10 @@
 
 		action_id = WP(w,menu_d).action_id;
 		DeleteWindow(w);
-		
+
 		if (index >= 0)
 			_menu_clicked_procs[action_id](index);
-	
+
 		break;
 		}
 	case WE_POPUPMENU_OVER: {
@@ -458,7 +458,7 @@
 				if (--index < 0)
 					return p->index;
 			}
-		} 
+		}
 	}
 	return -1;
 }
@@ -472,7 +472,7 @@
 		if (p->is_active)
 			num++;
 	}
-	
+
 	if (WP(w,menu_d).item_count != num) {
 		WP(w,menu_d).item_count = num;
 		SetWindowDirty(w);
@@ -499,25 +499,25 @@
 		y = 1;
 		sel = WP(w,menu_d).sel_index;
 		chk = WP(w,menu_d).checked_items; // let this mean gray items.
-		
+
 		FOR_ALL_PLAYERS(p) {
 			if (p->is_active) {
 				if (p->index == sel) {
 					GfxFillRect(x, y, x + 0xEE, y + 9, 0);
 				}
 				DrawSprite( ((p->player_color + 0x307)<<16)+0x82EB, x+2, y+1);
-			
+
 				SET_DPARAM16(0, p->name_1);
 				SET_DPARAM32(1, p->name_2);
 				SET_DPARAM16(2, GetPlayerNameString(p->index, 3));
-							
+
 				color = (byte)((p->index==sel) ? 0xC : 0x10);
 				if (chk&1) color = 14;
 				DrawString(x+0x13, y, STR_7021, color);
-				
+
 				y += 10;
-			}	
-			chk >>= 1;		
+			}
+			chk >>= 1;
 		}
 		break;
 		}
@@ -528,7 +528,7 @@
 		SetWindowDirty(v);
 		return;
 		}
-		
+
 	case WE_POPUPMENU_SELECT: {
 		int index = GetPlayerIndexFromMenu(GetMenuItemIndex(w, e->popupmenu.pt.x, e->popupmenu.pt.y));
 		int action_id = WP(w,menu_d).action_id;
@@ -540,7 +540,7 @@
 		}
 
 		DeleteWindow(w);
-		
+
 		if (index >= 0) {
 			assert(index >= 0 && index < 30);
 			_menu_clicked_procs[action_id](index);
@@ -576,7 +576,7 @@
 	_menu_widgets[0].bottom = h = item_count * 10 + 1;
 	w = AllocateWindow(x, 0x16, 0xA0, h+1, MenuWndProc, WC_TOOLBAR_MENU, _menu_widgets);
 	w->flags4 &= ~WF_WHITE_BORDER_MASK;
-	
+
 	WP(w,menu_d).item_count = item_count;
 	WP(w,menu_d).sel_index = 0;
 	WP(w,menu_d).main_button = main_button;
@@ -585,7 +585,7 @@
 	WP(w,menu_d).checked_items = 0;
 
 	_popup_menu_active = true;
-	
+
 	SndPlayFx(0x13);
 
 	return w;
@@ -594,7 +594,7 @@
 static Window *PopupMainPlayerToolbMenu(Window *w, int x, int main_button, int gray)
 {
 	x += w->left;
-	
+
 	SETBIT(w->click_state, main_button);
 	InvalidateWidget(w, main_button);
 
@@ -703,7 +703,7 @@
 {
 	ViewPort *vp;
 	int button;
-	
+
 	switch(_game_mode) {
 	case GM_EDITOR: button = 9; break;
 	case GM_NORMAL: button = 17; break;
@@ -758,7 +758,7 @@
 		else if (vp->zoom == 2) SETBIT(wt->disabled_state, button + 1);
 		SetWindowDirty(wt);
 	}
-	
+
 	return true;
 }
 
@@ -855,7 +855,7 @@
 	if ((w->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
 		HandleButtonClick(w, 6);
 		InvalidateWidget(w, 5);
-		
+
 		if (_date > 0x2ACE) {
 			SetDate(ConvertYMDToDay(_cur_year - 1, 0, 1));
 		}
@@ -898,7 +898,7 @@
 	}
 }
 
-void ZoomInOrOutToCursorWindow(bool in, Window *w) 
+void ZoomInOrOutToCursorWindow(bool in, Window *w)
 {
 	ViewPort * vp;
 	Point pt;
@@ -924,10 +924,10 @@
 {
 	_random_seed_1 = InteractiveRandom();
 	_random_seed_2 = InteractiveRandom();
-	
+
 	GenerateWorld(1);
 	MarkWholeScreenDirty();
-} 
+}
 
 static const Widget _ask_reset_landscape_widgets[] = {
 {    WWT_TEXTBTN,     4,     0,    10,     0,    13, STR_00C5,									STR_NULL},
@@ -961,7 +961,7 @@
 				SndPlayFx(0x13);
 				_switch_mode = SM_GENRANDLAND;
 			}
-			
+
 			break;
 		}
 	}
@@ -1131,7 +1131,7 @@
 	case WE_PAINT:
 		// XXX: only show reset button when nothing was built
 		DrawWindowWidgets(w);
-		
+
 		{
 			int n = _terraform_size * _terraform_size;
 			const int8 *coords = &_multi_terraform_coords[0][0];
@@ -1190,7 +1190,7 @@
 		case 10: /* place rocky areas */
 			HandlePlacePushButton(w, 10, 0xFF7, 1, PlaceProc_RockyArea);
 			break;
-			
+
 		case 11: /* place lighthouse */
 			HandlePlacePushButton(w, 11, 0xFF8, 1, _opt.landscape == LT_DESERT ? PlaceProc_Desert : PlaceProc_LightHouse);
 			break;
@@ -1493,7 +1493,7 @@
 		break;
 
 	case WE_CLICK:
-		if ((button=e->click.widget) == 3) { 
+		if ((button=e->click.widget) == 3) {
 			HandleButtonClick(w, 3);
 
 		if (!AnyTownExists()) {
@@ -1505,7 +1505,7 @@
 			GenerateIndustries();
 			_generating_world = false;
 		}
-	
+
 		if ((button=e->click.widget) >= 4) {
 			if (HandlePlacePushButton(w, button, 0xFF1, 1, NULL))
 				_industry_type_to_place = _industry_type_list[_opt.landscape][button - 4];
@@ -1705,7 +1705,7 @@
 		case WKC_CTRL | WKC_ALT | 'C': if(!_networking) ShowCheatWindow(); break;
 		}
 	} break;
-	
+
 	case WE_PLACE_OBJ: {
 		_place_proc(e->place.tile);
 	} break;
@@ -1718,12 +1718,12 @@
 	case WE_ON_EDIT_TEXT: HandleOnEditText(e); break;
 
 	case WE_MOUSELOOP:
-		
+
 		if (((w->click_state) & 1) != (uint)!!_pause) {
 			w->click_state ^= (1 << 0);
 			SetWindowDirty(w);
 		}
-		
+
 		if (((w->click_state >> 1) & 1) != (uint)!!_fast_forward) {
 			w->click_state ^= (1 << 1);
 			SetWindowDirty(w);
@@ -1900,7 +1900,7 @@
 		}
 		break;
 	}
-	
+
 	case WE_PLACE_OBJ: {
 		_place_proc(e->place.tile);
 	} break;
@@ -1950,7 +1950,7 @@
 		str = _get_news_string_callback[ni->callback](ni);
 	} else {
 		COPY_IN_DPARAM(0, ni->params, lengthof(ni->params));
-		str = ni->string_id;	
+		str = ni->string_id;
 	}
 
 	GetString(str_buffr, str);
@@ -1992,7 +1992,7 @@
 		DrawWindowWidgets(w);
 		SET_DPARAM16(0, _date);
 		DrawStringCentered(70, 1, ((_pause||_patches.status_long_date)?STR_00AF:STR_00AE), 0);
-		
+
 		p = _local_player == OWNER_SPECTATOR ? NULL : DEREF_PLAYER(_local_player);
 
 		if (p) {
@@ -2092,7 +2092,7 @@
 			DrawSprite(0x12EA, off_x+275,50); // o
 			DrawSprite(0x12E5, off_x+307,50); // r
 			DrawSprite(0x12E4, off_x+337,50); // t
-			
+
 			DrawSprite(0x12E4, off_x+390,50); // t
 			DrawSprite(0x12EB, off_x+417,50); // y
 			DrawSprite(0x12EC, off_x+447,50); // c
@@ -2146,7 +2146,7 @@
 			}
 			break;
 		}
-		
+
 		case WKC_ESC: ResetObjectToPlace(); break;
 		case WKC_DELETE: DeleteNonVitalWindows(); break;
 		case 'Q' | WKC_CTRL: AskExitGame(); break;
@@ -2185,7 +2185,7 @@
 		}
 		e->keypress.cont = false;
 		break;
-				
+
 	}
 }
 
@@ -2224,7 +2224,7 @@
 		w = AllocateWindowDesc(&_toolb_normal_desc);
 		w->disabled_state = 1 << 17;
 		w->flags4 &= ~WF_WHITE_BORDER_MASK;
-		
+
 		PositionMainToolbar(w); // already WC_MAIN_TOOLBAR passed (&_toolb_normal_desc)
 
 		_main_status_desc.top = height - 12;
@@ -2241,7 +2241,7 @@
 		w = AllocateWindowDesc(&_toolb_scen_desc);
 		w->disabled_state = 1 << 9;
 		w->flags4 &= ~WF_WHITE_BORDER_MASK;
-		
+
 		PositionMainToolbar(w); // already WC_MAIN_TOOLBAR passed (&_toolb_scen_desc)
 		break;
 	default:
--- a/misc_cmd.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/misc_cmd.c	Fri Sep 10 19:02:27 2004 +0000
@@ -39,7 +39,7 @@
 		if (pp->is_active && pp != p && pp->player_color == (byte)p2)
 			return CMD_ERROR;
 	}
-	
+
 	if (flags & DC_EXEC) {
 		_player_colors[p1] = (byte)p2;
 		p->player_color = (byte)p2;
@@ -126,7 +126,7 @@
 	str = AllocateName((byte*)_decode_parameters, 4);
 	if (str == 0)
 		return CMD_ERROR;
-	
+
 	if (flags & DC_EXEC) {
 		p = DEREF_PLAYER(p1);
 		old_str = p->name_1;
@@ -148,7 +148,7 @@
 	str = AllocateName((byte*)_decode_parameters, 4);
 	if (str == 0)
 		return CMD_ERROR;
-	
+
 	if (flags & DC_EXEC) {
 		p = DEREF_PLAYER(p1);
 		old_str = p->president_name_1;
@@ -161,13 +161,13 @@
 			d--; do d++; while (*d);
 			do *d++ = b = *s++; while(d != (byte*)endof(_decode_parameters) && b != 0);
 			DoCommandByTile(0, p1, 0, DC_EXEC, CMD_CHANGE_COMPANY_NAME);
-		} 
+		}
 		MarkWholeScreenDirty();
 	} else {
 		DeleteName(str);
 	}
 
-	return 0;	
+	return 0;
 }
 
 static void UpdateSignVirtCoords(SignStruct *ss)
@@ -200,7 +200,7 @@
 int32 CmdPlaceSign(int x, int y, uint32 flags, uint32 p1, uint32 p2)
 {
 	SignStruct *ss;
-	
+
 	for(ss=_sign_list; ss != endof(_sign_list); ss++) {
 		if (ss->str == 0) {
 			if (flags & DC_EXEC) {
@@ -213,7 +213,7 @@
 				_new_sign_struct = ss;
 			}
 			return 0;
-		}	
+		}
 	}
 
 	return_cmd_error(STR_2808_TOO_MANY_SIGNS);
@@ -275,7 +275,7 @@
 
 int32 CmdMoneyCheat(int x, int y, uint32 flags, uint32 p1, uint32 p2)
 {
-	SET_EXPENSES_TYPE(EXPENSES_OTHER);	
+	SET_EXPENSES_TYPE(EXPENSES_OTHER);
 	return (int32)p1;
 }
 
@@ -290,7 +290,7 @@
 		}
 		InvalidateWindow(WC_GAME_OPTIONS, 0);
 	}
-	return 0;	
+	return 0;
 }
 
 static const byte _sign_desc[] = {
--- a/misc_gui.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/misc_gui.c	Fri Sep 10 19:02:27 2004 +0000
@@ -45,7 +45,7 @@
 
 		str = STR_01A4_COST_TO_CLEAR_N_A;
 		if (lid->costclear != CMD_ERROR) {
-			SET_DPARAM32(0, lid->costclear);	
+			SET_DPARAM32(0, lid->costclear);
 			str = STR_01A5_COST_TO_CLEAR;
 		}
 		DrawStringCentered(140, 38, str, 0);
@@ -102,7 +102,7 @@
 
 		if (str != (STR_01CE_CARGO_ACCEPTED - 1))
 			DrawStringMultiCenter(140, 76, str, 276);
-			
+
 		if (lid->td.build_date != 0) {
 			SET_DPARAM16(0,lid->td.build_date);
 			DrawStringCentered(140,71, STR_BUILD_DATE, 0);
@@ -136,7 +136,7 @@
 
 	w = AllocateWindowDesc(&_land_info_desc);
 	WP(w,void_d).data = &lid;
-	
+
 	lid.tile = tile;
 	lid.town = ClosestTownFromTile(tile, _patches.dist_local_authority);
 
@@ -150,13 +150,13 @@
 	lid.costclear = DoCommandByTile(tile, 0, 0, 0, CMD_LANDSCAPE_CLEAR);
 	p->money64 = old_money;
 	UpdatePlayerMoney32(p);
-	
+
 	// Becuase build_date is not set yet in every TileDesc, we make sure it is empty
 	lid.td.build_date = 0;
-	
+
 	GetAcceptedCargo(tile, &lid.ac);
 	GetTileDesc(tile, &lid.td);
-	
+
 	#if defined(_DEBUG)
 		DEBUG(misc, 0) ("TILE: %#x (%i,%i)", tile, GET_TILE_X(tile), GET_TILE_Y(tile));
 		DEBUG(misc, 0) ("TILE: %d ", tile);
@@ -273,7 +273,7 @@
 		case 11:case 12: case 13: case 14:
 			if ( (uint)(wid-3) >= (uint)WP(w,tree_d).count)
 				return;
-		
+
 			if (HandlePlacePushButton(w, wid, 0x7DA, 1, NULL))
 				_tree_to_plant = WP(w,tree_d).base + wid - 3;
 			break;
@@ -292,7 +292,7 @@
 			break;
 		}
 	} break;
-		
+
 	case WE_PLACE_OBJ:
 		VpStartPlaceSizing(e->place.tile, VPM_X_AND_Y_LIMITED);
 		VpSetPlaceSizingLimit(20);
@@ -304,7 +304,7 @@
 
 	case WE_PLACE_MOUSEUP:
 		if (e->click.pt.x != -1) {
-			DoCommandP(e->place.tile, _tree_to_plant, e->place.starttile, NULL, 
+			DoCommandP(e->place.tile, _tree_to_plant, e->place.starttile, NULL,
 				CMD_PLANT_TREE | CMD_AUTO | CMD_MSG(STR_2805_CAN_T_PLANT_TREE_HERE));
 		}
 		break;
@@ -377,7 +377,7 @@
 	BuildTreesWndProc
 };
 
-	
+
 void ShowBuildTreesToolbar()
 {
 	DeleteWindowById(WC_BUILD_TOOLBAR, 0);
@@ -418,7 +418,7 @@
 		if (w->widget != _errmsg_face_widgets) {
 			DrawStringMultiCenter(
 				120,
-				(_errmsg_message_1 == INVALID_STRING_ID ? 25 : 15), 
+				(_errmsg_message_1 == INVALID_STRING_ID ? 25 : 15),
 				_errmsg_message_2,
 				238);
 			if (_errmsg_message_1 != INVALID_STRING_ID)
@@ -433,7 +433,7 @@
 
 			DrawStringMultiCenter(
 				214,
-				(_errmsg_message_1 == INVALID_STRING_ID ? 65 : 45), 
+				(_errmsg_message_1 == INVALID_STRING_ID ? 65 : 45),
 				_errmsg_message_2,
 				238);
 			if (_errmsg_message_1 != INVALID_STRING_ID)
@@ -490,7 +490,7 @@
 	_errmsg_duration = _patches.errmsg_duration;
 	if (!_errmsg_duration)
 		return;
-	
+
 	if (_errmsg_message_1 != STR_013B_OWNED_BY || GET_DPARAMX8(_errmsg_decode_params,2) >= 8) {
 
 		if ( (x|y) != 0) {
@@ -501,11 +501,11 @@
 			// move x pos to opposite corner
 			pt.x = ((pt.x - vp->virtual_left) >> vp->zoom) + vp->left;
 			pt.x = (pt.x < (_screen.width >> 1)) ? _screen.width - 260 : 20;
-			
+
 			// move y pos to opposite corner
 			pt.y = ((pt.y - vp->virtual_top) >> vp->zoom) + vp->top;
 			pt.y = (pt.y < (_screen.height >> 1)) ? _screen.height - 80 : 100;
-			
+
 		} else {
 			pt.x = (_screen.width - 240) >> 1;
 			pt.y = (_screen.height - 46) >> 1;
@@ -566,7 +566,7 @@
 
 	switch(e->event) {
 	case WE_PAINT: {
-		GfxFillRect(0, 0, w->width - 1, w->height - 1, 0);	
+		GfxFillRect(0, 0, w->width - 1, w->height - 1, 0);
 		GfxFillRect(1, 1, w->width - 2, w->height - 2, 0x44);
 		DrawStringMultiCenter((w->width>>1), (w->height>>1)-5, WP(w,tooltips_d).string_id, 197);
 		break;
@@ -583,7 +583,7 @@
 	Window *w;
 	int right,bottom;
 	int x,y;
-	
+
 	if (string_id == 0)
 		return;
 
@@ -628,7 +628,7 @@
 {
 	int i;
 	byte *b;
-	
+
 	b = _userstring;
 	b[0] = 0x81;
 	b[1] = STR_000D_ACCEPTS;
@@ -734,7 +734,7 @@
 			count++;
 			width += _stringwidth_table[*p - 32];
 		} while (1);
-		
+
 		if (we->keypress.keycode == WKC_BACKSPACE) {
 			if (count != 0) {
 				WP(w,querystr_d).buf[count-1] = 0;
@@ -1067,7 +1067,7 @@
 				return;
 
 			file = _fios_list + y;
-			
+
 			if ((name = FiosBrowseTo(file)) != NULL) {
 				if (_saveload_mode == SLD_LOAD_GAME) {
 					_switch_mode = SM_LOAD;
@@ -1120,7 +1120,7 @@
 		_query_string_active = false;
 		FiosFreeSavegameList();
 		break;
-	}	
+	}
 }
 
 static const WindowDesc _load_dialog_desc = {
@@ -1226,7 +1226,7 @@
 			_savegame_sort_dirty = false;
 			MakeSortedSaveGameList();
 		}
-		
+
 		SetVScrollCount(w, _fios_num);
 
 		DrawWindowWidgets(w);
@@ -1272,7 +1272,7 @@
 					return;
 
 				file = _fios_list + y;
-			
+
 				if ((name = FiosBrowseTo(file)) != NULL) {
 					SetFiosType(file->type);
 					strcpy(_file_to_saveload.name, name);
@@ -1410,7 +1410,7 @@
 	default:
 		NOT_REACHED();
 	}
-  
+
 	/* useless, but avoids compiler warning this way */
 	return 0;
 }
@@ -1490,7 +1490,7 @@
 				DrawFrameRect(x+30, y+1, x+30+9, y+9, 3, clk == i*2+2 ? 0x20 : 0);
 				DrawStringCentered(x+25, y+1, STR_6819, 0);
 				DrawStringCentered(x+35, y+1, STR_681A, 0);
-				
+
 				val = ReadCE(ce);
 
 				// set correct string for switch climate cheat
@@ -1502,7 +1502,7 @@
 				// display date for change date cheat
 				if(ce->str==STR_CHEAT_CHANGE_DATE)
 					SET_DPARAM16(0, _date);
-				
+
 				// draw colored flag for change player cheat
 				if(ce->str==STR_CHEAT_CHANGE_PLAYER)
 					DrawPlayerIcon(_current_player, 156, y+2);
@@ -1579,7 +1579,7 @@
 		WP(w,def_d).data_1 = 0;
 		SetWindowDirty(w);
 		break;
-	}	
+	}
 }
 static const WindowDesc _cheats_desc = {
 	240, 22, 400, 148,
@@ -1593,7 +1593,7 @@
 void ShowCheatWindow()
 {
 	Window *w;
-	
+
 	DeleteWindowById(WC_CHEATS, 0);
 	w = AllocateWindowDesc(&_cheats_desc);
 
--- a/music_gui.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/music_gui.c	Fri Sep 10 19:02:27 2004 +0000
@@ -44,7 +44,7 @@
 	// empty playlist
 	if (b[0] == 0)
 		return;
-	
+
 	// find the end
 	do p++; while (p[0] != 0);
 
@@ -132,7 +132,7 @@
 	_music_wnd_cursong = _cur_playlist[0];
 	DoPlaySong();
 	_song_is_active = true;
-	
+
 	InvalidateWindowWidget(WC_MUSIC_WINDOW, 0, 9);
 }
 
@@ -190,7 +190,7 @@
 			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);
 		DrawStringCentered(216, 45+8*6+16*2, STR_01F1_SAVE, 0);
 
 		y = 23;
@@ -203,7 +203,7 @@
 		}
 		break;
 	}
-	
+
 	case WE_CLICK:
 		switch(e->click.widget) {
 		case 3: { /* add to playlist */
@@ -321,7 +321,7 @@
 
 
 		DrawString(60, 38, STR_01E8_TRACK_XTITLE, 0);
-		
+
 		for(i=0; i!=6; i++) {
 			DrawStringCentered(25+i*50, 59, STR_01D5_ALL+i, msf.playlist == i ? 0xC : 0x10);
 		}
@@ -336,14 +336,14 @@
 		DrawFrameRect(108, 23, 174, 26, 14, 0x20);
 		DrawFrameRect(214, 23, 280, 26, 14, 0x20);
 
-		DrawFrameRect(108 + (msf.music_vol>>1), 
+		DrawFrameRect(108 + (msf.music_vol>>1),
 									22,
 									111 + (msf.music_vol>>1),
 									28,
 									14,
 									0);
 
-		DrawFrameRect(214 + (msf.effect_vol>>1), 
+		DrawFrameRect(214 + (msf.effect_vol>>1),
 									22,
 									217 + (msf.effect_vol>>1),
 									28,
@@ -371,7 +371,7 @@
 			break;
 		case 6:{ // volume sliders
 			byte *vol,new_vol;
-			int x = e->click.pt.x - 88; 
+			int x = e->click.pt.x - 88;
 
 			if (x < 0)
 				return;
--- a/namegen.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/namegen.c	Fri Sep 10 19:02:27 2004 +0000
@@ -11,7 +11,7 @@
 	while (--num>=0) {
 		do names++; while (names[-1]);
 	}
-	
+
 	for(s=*buf; (*s++ = *names++) != 0;) {}
 	*buf = s - 1;
 }
@@ -19,14 +19,14 @@
 #define MK(x) x "\x0"
 
 #define NUM_ENGLISH_1 4
-static const char english_1[] = 
+static const char english_1[] =
 	MK("Great ")
 	MK("Little ")
 	MK("New ")
 	MK("Fort ")
 ;
 
-#define NUM_ENGLISH_2 26 
+#define NUM_ENGLISH_2 26
 static const char english_2[] =
 	MK("Wr")
 	MK("B")
@@ -57,7 +57,7 @@
 ;
 
 #define NUM_ENGLISH_3 8
-static const char english_3[] = 
+static const char english_3[] =
 	MK("ar")
 	MK("a")
 	MK("e")
@@ -69,7 +69,7 @@
 ;
 
 #define NUM_ENGLISH_4 7
-static const char english_4[] = 
+static const char english_4[] =
 	MK("n")
 	MK("ning")
 	MK("ding")
@@ -80,7 +80,7 @@
 ;
 
 #define NUM_ENGLISH_5 23
-static const char english_5[] = 
+static const char english_5[] =
 	MK("ville")
 	MK("ham")
 	MK("field")
@@ -107,7 +107,7 @@
 ;
 
 #define NUM_ENGLISH_6 9
-static const char english_6[] = 
+static const char english_6[] =
 	MK("-on-sea")
 	MK(" Bay")
 	MK(" Market")
@@ -130,7 +130,7 @@
 	i = GETNUM(0, 54) - 50;
 	if (i >= 0)
 		AppendPart(&buf, i, english_1);
-	
+
 	start = buf;
 
 	AppendPart(&buf, GETNUM(4, NUM_ENGLISH_2), english_2);
@@ -141,14 +141,14 @@
 	i = GETNUM(15, NUM_ENGLISH_6 + 60) - 60;
 
 	result = 0;
-	
+
 	if (i >= 0) {
 		if (i <= 1) result = NG_EDGE;
 		AppendPart(&buf, i, english_6);
 	}
 
 	if (start[0]=='C' && (start[1] == 'e' || start[1] == 'i'))
-		start[0] = 'K'; 
+		start[0] = 'K';
 
 	/* Replace certain words (routine identical to TTD now) */
 
@@ -167,7 +167,7 @@
 }
 
 #define NUM_AUSTRIAN_A1 6
-static const char austrian_a1[] = 
+static const char austrian_a1[] =
 	MK("Bad ")
 	MK("Deutsch ")
 	MK("Gross ")
@@ -177,7 +177,7 @@
 ;
 
 #define NUM_AUSTRIAN_A2 42
-static const char austrian_a2[] = 
+static const char austrian_a2[] =
 	MK("Aus")
 	MK("Alten")
 	MK("Braun")
@@ -223,7 +223,7 @@
 ;
 
 #define NUM_AUSTRIAN_A3 16
-static const char austrian_a3[] = 
+static const char austrian_a3[] =
 	MK("see")
 	MK("bach")
 	MK("dorf")
@@ -371,8 +371,8 @@
 }
 
 #define NUM_GERMAN_1 114
-#define NUM_GERMAN_1_HARDCODED 21 
-static const char german_1[] = 
+#define NUM_GERMAN_1_HARDCODED 21
+static const char german_1[] =
 	/* hardcoded names */
 	MK("Berlin")
 	MK("Bonn")
@@ -531,14 +531,14 @@
 	MK("Elbe")
 	/* use "am" */
 	MK("Main")
-	
+
 ;
 
 static byte MakeGermanTownName(byte *buf, uint32 seed)
 {
 	int i;
 	int ext;
-	
+
 	ext=GETNUM(7, 28); /* Extension - Prefix / Suffix */
 
 	if ((ext==12) || (ext==19)) {
@@ -571,7 +571,7 @@
 }
 
 #define NUM_SPANISH_1 86
-static const char spanish_1[] = 
+static const char spanish_1[] =
 	MK("Caracas")
 	MK("Maracay")
 	MK("Maracaibo")
@@ -662,11 +662,11 @@
 static byte MakeSpanishTownName(byte *buf, uint32 seed)
 {
 	AppendPart(&buf, GETNUM(0, NUM_SPANISH_1), spanish_1);
-	return 0;	
+	return 0;
 }
 
 #define NUM_FRENCH_1 70
-static const char french_1[] = 
+static const char french_1[] =
 	MK("Agincourt")
 	MK("Lille")
 	MK("Dinan")
@@ -684,7 +684,7 @@
 	MK("St. Tropez")
 	MK("Marseilles")
 	MK("Narbonne")
-	MK("Sète") 
+	MK("Sète")
 	MK("Aurillac")
 	MK("Gueret")
 	MK("Le Creusot")
@@ -751,7 +751,7 @@
 }
 
 #define NUM_SILLY_1 88
-static const char silly_1[] = 
+static const char silly_1[] =
 	MK("Binky")
 	MK("Blubber")
 	MK("Bumble")
@@ -851,7 +851,7 @@
 ;
 
 #define NUM_SILLY_2 15
-static const char silly_2[] = 
+static const char silly_2[] =
 	MK("ton")
 	MK("bury")
 	MK("bottom")
@@ -862,7 +862,7 @@
 	MK("wig")
 	MK("wick")
 	MK("wood")
-	
+
 	MK("pool")
 	MK("head")
 	MK("burg")
@@ -872,7 +872,7 @@
 
 
 static byte MakeSillyTownName(byte *buf, uint32 seed)
-{		
+{
 	AppendPart(&buf, GETNUM(0, NUM_SILLY_1), silly_1);
 	AppendPart(&buf, GETNUM(16, NUM_SILLY_2),silly_2);
 	return 0;
@@ -1081,7 +1081,7 @@
 	MK("Klein ");
 
 #define NUM_DUTCH_2 57
-static const char dutch_2[] = 
+static const char dutch_2[] =
 	MK("Hoog")
 	MK("Laag")
 	MK("Klein")
@@ -1141,7 +1141,7 @@
 	MK("Hil");
 
 #define NUM_DUTCH_3 20
-static const char dutch_3[] = 
+static const char dutch_3[] =
 	MK("Drog")
 	MK("Nat")
 	MK("Valk")
@@ -1162,10 +1162,10 @@
 	MK("Wams")
 	MK("Heerhug")
 	MK("Koning");
-	
+
 
 #define NUM_DUTCH_4 6
-static const char dutch_4[] = 
+static const char dutch_4[] =
 	MK("e")
 	MK("er")
 	MK("el")
@@ -1174,7 +1174,7 @@
 	MK("s");
 
 #define NUM_DUTCH_5 56
-static const char dutch_5[] = 
+static const char dutch_5[] =
 	MK("stad")
 	MK("vorst")
 	MK("dorp")
@@ -1231,13 +1231,13 @@
 	MK("schede")
 	MK("mere")
 	MK("end");
-	
+
 static byte MakeDutchTownName(byte *buf, uint32 seed)
 {
 	int i;
 
 	i = GETNUM(0, 50 + NUM_DUTCH_1) - 50;
-	if (i >= 0) 
+	if (i >= 0)
 		AppendPart(&buf, i, dutch_1);
 
 	i = GETNUM(6, 9);
@@ -1253,7 +1253,7 @@
 }
 
 #define NUM_FINNISH_1 25
-static const char finnish_1[] = 
+static const char finnish_1[] =
 	MK("Aijala")
 	MK("Kisko")
 	MK("Espoo")
@@ -1279,9 +1279,9 @@
 	MK("Imatra")
 	MK("Tapanila")
 	MK("Pasila");
- 
+
 #define NUM_FINNISH_2a 26
-static const char finnish_2a[] = 
+static const char finnish_2a[] =
 	MK("Hiekka")
 	MK("Haapa")
 	MK("Mylly")
@@ -1310,7 +1310,7 @@
 	MK("Koivu");
 
 #define NUM_FINNISH_2b 18
-static const char finnish_2b[] = 
+static const char finnish_2b[] =
 	MK("harju")
 	MK("linna")
 	MK("järvi")
@@ -1576,7 +1576,7 @@
 MK(" Podlaski")
 MK(" Lesny")
 ;
-static const char polish_3_f[] = 
+static const char polish_3_f[] =
 MK(" Wybudowanie")
 MK(" Swietokrzyska")
 MK(" Gorska")
@@ -1692,7 +1692,7 @@
 }
 
 #define NUM_CZECH_1 82
-static const char czech_1[] = 
+static const char czech_1[] =
 MK("As")
 MK("Benesov")
 MK("Beroun")
@@ -1780,7 +1780,7 @@
 static byte MakeCzechTownName(byte *buf, uint32 seed)
 {
 	AppendPart(&buf, GETNUM(0, NUM_CZECH_1), czech_1);
-	return 0;	
+	return 0;
 }
 
 
@@ -1879,12 +1879,12 @@
 static byte MakeSlovakishTownName(byte *buf, uint32 seed)
 {
 	AppendPart(&buf, GETNUM(0, NUM_SLOVAKISH_1), slovakish_1);
-	return 0;	
+	return 0;
 }
 
 // Modifiers
 #define NUM_HUNGARIAN_1 5
-static const char hungarian_1[] = 
+static const char hungarian_1[] =
 	MK("Nagy-")
 	MK("Kis-")
 	MK("Felsõ-")
@@ -1893,7 +1893,7 @@
 ;
 
 #define NUM_HUNGARIAN_2 54
-static const char hungarian_2[] = 
+static const char hungarian_2[] =
 // River modifiers
 // 1 - 10
 	MK("Bodrog")
@@ -1971,7 +1971,7 @@
 ;
 
 #define NUM_HUNGARIAN_3 16
-static const char hungarian_3[] = 
+static const char hungarian_3[] =
 	MK("apáti")
 	MK("bába")
 	MK("bikk")
@@ -1991,7 +1991,7 @@
 ;
 
 #define NUM_HUNGARIAN_4 5
-static const char hungarian_4[] = 
+static const char hungarian_4[] =
 	MK("alja")
 	MK("egyháza")
 	MK("háza")
@@ -2054,7 +2054,7 @@
 
 		AppendPart(&buf, GETNUM(3, NUM_HUNGARIAN_2), hungarian_2);
 		AppendPart(&buf, GETNUM(6, NUM_HUNGARIAN_3), hungarian_3);
-		
+
 		i = GETNUM(10, NUM_HUNGARIAN_4 * 3);
 		if (i < NUM_HUNGARIAN_4) AppendPart(&buf, i, hungarian_4);
 	}
--- a/network.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/network.c	Fri Sep 10 19:02:27 2004 +0000
@@ -232,7 +232,7 @@
 
 static FILE *_recv_file;
 
-typedef struct NetworkGameInfo {	
+typedef struct NetworkGameInfo {
 	char server_name[40];			// name of the game
 	char server_revision[8];	// server game version
 	byte server_lang;					// langid
@@ -263,17 +263,17 @@
 Sleep(milliseconds);
 #endif
 #if defined(UNIX)
-#if !defined(__BEOS__) && !defined(__MORPHOS__) && !defined(__AMIGAOS__) 
+#if !defined(__BEOS__) && !defined(__MORPHOS__) && !defined(__AMIGAOS__)
 usleep(milliseconds*1000);
 #endif
 #ifdef __BEOS__
 snooze(milliseconds*1000);
 #endif
-#if defined(__MORPHOS__) 
+#if defined(__MORPHOS__)
 usleep(milliseconds*1000);
 #endif
-#if defined(__AMIGAOS__) && !defined(__MORPHOS__) 
-{ 
+#if defined(__AMIGAOS__) && !defined(__MORPHOS__)
+{
 	ULONG signals;
 	ULONG TimerSigBit = 1 << TimerPort->mp_SigBit;
 
@@ -826,7 +826,7 @@
 		rp->packet_type = 5;
 		rp->packet_length = sizeof(rp);
 		SendBytes(c, rp, sizeof(rp));
-		_network_ready_sent = true;	
+		_network_ready_sent = true;
 	}
 }
 
@@ -955,7 +955,7 @@
 
 	b = 1;
 	setsockopt(s, IPPROTO_TCP, TCP_NODELAY, (const char*)&b, sizeof(b));
-	
+
 	sin.sin_family = AF_INET;
 	sin.sin_addr.s_addr = NetworkResolveHost(hostname);
 	sin.sin_port = htons(port);
@@ -980,7 +980,7 @@
 
 void NetworkListen()
 {
-		
+
 	SOCKET ls;
 	struct sockaddr_in sin;
 	int port;
@@ -992,7 +992,7 @@
 	ls = socket(AF_INET, SOCK_STREAM, 0);
 	if (ls == INVALID_SOCKET)
 		error("socket() on listen socket failed");
-	
+
 	// reuse the socket
 	{
 		int reuse = 1; if (setsockopt(ls, SOL_SOCKET, SO_REUSEADDR, (const char*)&reuse, sizeof(reuse)) == -1)
@@ -1021,7 +1021,7 @@
 	int n;
 	fd_set read_fd, write_fd;
 	struct timeval tv;
-	
+
 	FD_ZERO(&read_fd);
 	FD_ZERO(&write_fd);
 
@@ -1119,13 +1119,13 @@
 					CSleep(5);
 					}
 			}
-				
+
 			_not_packet = 0;
 
 			new_max = max(_frame_counter + (int)_network_ahead_frames, _frame_counter_max);
-			
+
 			DEBUG(net,3) ("net: serv: sync max=%i, seed1=%i, seed2=%i",new_max,_sync_seed_1,_sync_seed_2);
-			
+
 			sp.packet_length = sizeof(sp);
 			sp.packet_type = 1;
 			sp.frames = new_max - _frame_counter_max;
@@ -1196,7 +1196,7 @@
 
 void NetworkShutdown()
 {
-	_networking_server = false;	
+	_networking_server = false;
 	_networking = false;
 	_networking_sync = false;
 	_frame_counter = 0;
@@ -1255,10 +1255,10 @@
 	DEBUG(net, 1) ("[NET][UDP] listening on port %i", port);
 
 	udp = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
-	
+
 	// this disables network
 	_network_available = !(udp == INVALID_SOCKET);
-	
+
 	// set nonblocking mode for socket
 	{ unsigned long blocking = 1; ioctlsocket(udp, FIONBIO, &blocking); }
 
@@ -1268,7 +1268,7 @@
 
 	if (bind(udp, (struct sockaddr*)&sin, sizeof(sin)) != 0)
 		DEBUG(net, 1) ("[NET][UDP] error: bind failed on port %i", port);
-		
+
 
 	// enable broadcasting
 	{ unsigned long val=1; setsockopt(udp, SOL_SOCKET, SO_BROADCAST, (char *) &val , sizeof(val)); }
@@ -1280,7 +1280,7 @@
 }
 
 void NetworkUDPClose(bool client) {
-	if (client) { 
+	if (client) {
 		DEBUG(net, 1) ("[NET][UDP] closed listener on port %i", _network_client_port);
 		closesocket(_udp_client_socket);
 		_udp_client_socket = INVALID_SOCKET;
@@ -1301,17 +1301,17 @@
 	int nbytes;
 	struct UDPPacket packet;
 	int packet_len;
-	
+
 	SOCKET udp;
 	if (client) udp=_udp_client_socket; else udp=_udp_server_socket;
 
 	packet_len = sizeof(packet);
-	client_len = sizeof(client_addr);	
-	
+	client_len = sizeof(client_addr);
+
 	nbytes = recvfrom(udp, (char *) &packet, packet_len , 0, (struct sockaddr *) &client_addr, &client_len);
 	if (nbytes>0) {
 		if (packet.command_code==packet.command_check) switch (packet.command_code) {
-		
+
  		case NET_UDPCMD_SERVERSEARCH:
  			if (!client) {
 				packet.command_check=packet.command_code=NET_UDPCMD_SERVERINFO;
@@ -1335,7 +1335,7 @@
 				item = (NetworkGameList *) NetworkGameListAdd();
 				item -> ip = inet_addr(inet_ntoa(client_addr.sin_addr));
 				item -> port = ntohs(client_addr.sin_port);
-				
+
 				memcpy(item,&packet.data,packet.data_len);
  			}
  			break;
@@ -1365,14 +1365,14 @@
 		if (res==-1) DEBUG(net, 1)("udp: broadcast error: %i",GET_LAST_ERROR());
 		i++;
 	}
-	
+
 }
 
 void NetworkUDPSend(bool client, struct sockaddr_in recv,struct UDPPacket packet) {
 
 	SOCKET udp;
 	if (client) udp=_udp_client_socket; else udp=_udp_server_socket;
-	
+
 	sendto(udp,(char *) &packet,sizeof(packet),0,(struct sockaddr *) &recv,sizeof(recv));
 }
 
@@ -1380,13 +1380,13 @@
 bool NetworkUDPSearchGame(const byte ** _network_detected_serverip, unsigned short * _network_detected_serverport) {
 	struct UDPPacket packet;
 	int timeout=3000;
-	
+
 	NetworkGameListClear();
 
 	DEBUG(net, 0) ("[NET][UDP] searching server");
 	*_network_detected_serverip = "255.255.255.255";
 	*_network_detected_serverport = 0;
-	
+
 	packet.command_check=packet.command_code=NET_UDPCMD_SERVERSEARCH;
 	packet.data_len=0;
 	NetworkUDPBroadCast(true, packet);
@@ -1403,11 +1403,11 @@
  			timeout=-1;
  			DEBUG(net, 0) ("[NET][UDP] server found on %s", *_network_detected_serverip);
  			}
-	
+
 		}
 
 	return (*_network_detected_serverport>0);
-		
+
 }
 
 
@@ -1420,7 +1420,7 @@
 	char hostname[250];
 	uint32 bcaddr;
 	int i=0;
-		
+
 	gethostname(hostname,250);
 	DEBUG(net, 2) ("[NET][IP] init for host %s", hostname);
 	he=gethostbyname((char *) hostname);
@@ -1428,7 +1428,7 @@
 	if (he == NULL) {
 		he = gethostbyname("localhost");
 		}
-	
+
 	if (he == NULL) {
 		bcaddr = inet_addr("127.0.0.1");
 		he = gethostbyaddr(inet_ntoa(*(struct in_addr *) &bcaddr), sizeof(bcaddr), AF_INET);
@@ -1437,7 +1437,7 @@
 	if (he == NULL) {
 		DEBUG(net, 2) ("[NET][IP] cannot resolve %s", hostname);
 	} else {
-		while(he->h_addr_list[i]) { 
+		while(he->h_addr_list[i]) {
 			bcaddr = inet_addr(inet_ntoa(*(struct in_addr *) he->h_addr_list[i]));
 			_network_ip_list[i]=bcaddr;
 			DEBUG(net, 2) ("[NET][IP] add %s",inet_ntoa(*(struct in_addr *) he->h_addr_list[i]));
@@ -1446,7 +1446,7 @@
 
 	}
 	_network_ip_list[i]=0;
-	
+
 }
 
 /* *************************************************** */
@@ -1468,7 +1468,7 @@
 		_network_available=false;
 		}
 }
-#else 
+#else
 
 // [morphos/amigaos] bsd-socket startup
 
@@ -1486,14 +1486,14 @@
 		if ( (TimerRequest = (struct timerequest *) CreateIORequest(TimerPort, sizeof(struct timerequest))) ) {
 			if ( OpenDevice("timer.device", UNIT_MICROHZ, (struct IORequest *) TimerRequest, 0) == 0 ) {
 				if ( !(TimerBase = TimerRequest->tr_node.io_Device) ) {
-					// free ressources... 
+					// free ressources...
 					DEBUG(net, 3) ("[NET][Core] Couldn't initialize timer.");
 					_network_available=false;
 				}
 			}
 		}
 	}
-	#endif 
+	#endif
 
 }
 #else
@@ -1527,9 +1527,9 @@
 DEBUG(net, 3) ("[NET][Core] shutdown()");
 
 #if defined(__MORPHOS__) || defined(__AMIGA__)
-{	
+{
 	// free allocated ressources
-	#if !defined(__MORPHOS__) 
+	#if !defined(__MORPHOS__)
   if (TimerBase)    { CloseDevice((struct IORequest *) TimerRequest); }
   if (TimerRequest) { DeleteIORequest(TimerRequest); }
   if (TimerPort)    { DeleteMsgPort(TimerPort); }
@@ -1574,9 +1574,9 @@
 	if (_networking) {
 		NetworkLobbyShutdown();
 	} else {
-		if (_networking_override) 
+		if (_networking_override)
 			NetworkLobbyShutdown();
-		
+
 		ShowErrorMessage(-1, STR_NETWORK_ERR_NOCONNECTION,0,0);
 		_switch_mode_errorstr = STR_NETWORK_ERR_NOCONNECTION;
 	}
@@ -1607,13 +1607,13 @@
 	if (_networking_server) {
 		NetworkUDPClose(false);
 		NetworkClose(false);
-		} 
+		}
 
 	/* terminate client connection */
 	else if (_networking) {
 		NetworkClose(true);
 		}
-	
+
 	NetworkShutdown();
 }
 
@@ -1670,7 +1670,7 @@
 
 void NetworkGameListClear() {
 NetworkGameList * item;
-NetworkGameList * next; 
+NetworkGameList * next;
 
 DEBUG(net, 4) ("[NET][G-List] cleared server list");
 
@@ -1686,7 +1686,7 @@
 
 char * NetworkGameListAdd() {
 NetworkGameList * item;
-NetworkGameList * before; 
+NetworkGameList * before;
 
 DEBUG(net, 4) ("[NET][G-List] added server to list");
 
@@ -1726,7 +1726,7 @@
 
 char * NetworkGameListItem(uint16 index) {
 NetworkGameList * item;
-NetworkGameList * next; 
+NetworkGameList * next;
 uint16 cnt = 0;
 
 item = _network_game_list;
@@ -1749,7 +1749,7 @@
 #if defined(WITH_REV)
 	extern char _openttd_revision[];
 #endif
-	
+
 	DEBUG(net, 4) ("[NET][G-Info] setting defaults");
 
 	ttd_strlcpy(game->server_name,"OpenTTD Game",13);
@@ -1768,7 +1768,7 @@
 
 	game->players_max=8;
 	game->players_on=0;
-	
+
 	game->server_lang=_dynlang.curr;
 }
 
--- a/network_gui.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/network_gui.c	Fri Sep 10 19:02:27 2004 +0000
@@ -23,12 +23,12 @@
 };
 
 /* Should be _network_game->players_max but since network is not yet really done
-* we'll just use some dummy here 
+* we'll just use some dummy here
 * network.c -->> static NetworkGameInfo _network_game;
 */
 static byte _players_max;
 /* Should be ??????????? (something) but since network is not yet really done
-* we'll just use some dummy here 
+* we'll just use some dummy here
 */
 static byte _network_connection;
 
@@ -36,20 +36,20 @@
 {
 	switch(e->event) {
 	case WE_PAINT: {
-	
+
 		SET_DPARAM16(0, 0x00);
 		SET_DPARAM16(2, STR_NETWORK_LAN + _network_connection);
 		DrawWindowWidgets(w);
-		
+
 		DrawEditBox(w, 6);
-		
+
 		DrawString(9, 43, STR_NETWORK_PLAYER_NAME, 2);
 		DrawString(9, 63, STR_NETWORK_SELECT_CONNECTION, 2);
 
 		DrawString(15, 82, STR_NETWORK_GAME_NAME, 2);
 		DrawString(238, 82, STR_NETWORK_PLAYERS, 2);
 		DrawString(288, 82, STR_NETWORK_MAP_SIZE, 2);
-		
+
 	}	break;
 
 	case WE_CLICK:
@@ -65,7 +65,7 @@
 		case 4: { /* Connect via direct ip */
 				StringID str;
 				str = AllocateName((byte*)_decode_parameters, 0);
-				
+
 				ShowQueryString(
 				str,
 				STR_NETWORK_ENTER_IP,
@@ -93,7 +93,7 @@
 	case WE_MOUSELOOP:
 		if (_selected_field == 6)
 			HandleEditBox(w, 6);
-		
+
 		break;
 
 	case WE_KEYPRESS:
@@ -160,11 +160,11 @@
 	DeleteWindowById(WC_NETWORK_WINDOW, 0);
 
 	NetworkLobbyInit();
-	
+
 	w = AllocateWindowDesc(&_network_game_window_desc);
 	strcpy(_edit_str_buf, "Your name");
 
-	
+
 	WP(w,querystr_d).caret = 1;
 	WP(w,querystr_d).maxlen = MAX_QUERYSTR_LEN;
 	WP(w,querystr_d).maxwidth = 240;
@@ -186,7 +186,7 @@
 {
 	switch(e->event) {
 	case WE_PAINT: {
-	
+
 		SET_DPARAM16(7, STR_NETWORK_2_PLAYERS + _players_max);
 		DrawWindowWidgets(w);
 
@@ -194,13 +194,13 @@
 
 		DrawEditBox(w, 3);
 		DrawEditBox(w, 4);
-		
+
 		DrawString(10, 22, STR_NETWORK_NEW_GAME_NAME, 2);
 		DrawString(210, 22, STR_NETWORK_PASSWORD, 2);
 
 		DrawString(10, 43, STR_NETWORK_SELECT_MAP, 2);
 		DrawString(260, 63, STR_NETWORK_NUMBER_OF_PLAYERS, 2);
-		
+
 	}	break;
 
 	case WE_CLICK:
@@ -251,7 +251,7 @@
 			break;
 		}
 		break;
-		
+
 	}
 }
 
@@ -288,10 +288,10 @@
 {
 	Window *w;
 	DeleteWindowById(WC_NETWORK_WINDOW, 0);
-	
+
 	w = AllocateWindowDesc(&_network_start_server_window_desc);
 	strcpy(_edit_str_buf, "");
-	
+
 	WP(w,querystr_d).caret = 1;
 	WP(w,querystr_d).maxlen = MAX_QUERYSTR_LEN;
 	WP(w,querystr_d).maxwidth = 240;
@@ -303,7 +303,7 @@
 {
 	switch(e->event) {
 	case WE_PAINT: {
-	
+
 		SET_DPARAM16(7, STR_NETWORK_2_PLAYERS + _opt_mod_ptr->road_side);
 		DrawWindowWidgets(w);
 
@@ -312,7 +312,7 @@
 
 		DrawEditBox(w, 5);
 		DrawEditBox(w, 7);
-		
+
 		DrawString(10, 255, STR_NETWORK_COMPANY_NAME, 2);
 
 		break;
@@ -340,7 +340,7 @@
 			HandleEditBox(w, 7);
 			break;
 		}
-			
+
 		break;
 
 	case WE_KEYPRESS:
@@ -352,7 +352,7 @@
 			break;
 		}
 		break;
-		
+
 	}
 }
 
@@ -398,11 +398,11 @@
 {
 	Window *w;
 	DeleteWindowById(WC_NETWORK_WINDOW, 0);
-	
+
 	w = AllocateWindowDesc(&_network_lobby_window_desc);
 	strcpy(_edit_str_buf, "");
 
-	
+
 	WP(w,querystr_d).caret = 1;
 	WP(w,querystr_d).maxlen = MAX_QUERYSTR_LEN;
 	WP(w,querystr_d).maxwidth = 240;
--- a/news_gui.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/news_gui.c	Fri Sep 10 19:02:27 2004 +0000
@@ -12,7 +12,7 @@
 News system is realized as a FIFO queue (in an array)
 The positions in the queue can't be rearranged, we only access
 the array elements through pointers to the elements. Once the
-array is full, the oldest entry (_oldest_news) is being overwritten 
+array is full, the oldest entry (_oldest_news) is being overwritten
 by the newest (_latest news).
 
 oldest                   current   lastest
@@ -28,7 +28,7 @@
 static byte _current_news = 255; // points to news item that should be shown next
 static byte _oldest_news = 0;    // points to first item in fifo queue
 static byte _latest_news = 255;  // points to last item in fifo queue
-static byte _forced_news = 255;  // if the message being shown was forced by the user, its index is stored in _forced_news. 
+static byte _forced_news = 255;  // if the message being shown was forced by the user, its index is stored in _forced_news.
 																 //forced_news is 255 otherwise. (Users can force messages through history or "last message")
 
 static byte _total_news = 0; // total news count
@@ -80,13 +80,13 @@
 	int bottom = w->height - 1;
 
 	GfxFillRect(left, top, right, bottom, 0xF);
-	
+
 	GfxFillRect(left, top, left, bottom, 0xD7);
 	GfxFillRect(right, top, right, bottom, 0xD7);
 	GfxFillRect(left, top, right, top, 0xD7);
 	GfxFillRect(left, bottom, right, bottom, 0xD7);
-	
-	DrawString(left + 2, top + 1, STR_00C6, 0);	
+
+	DrawString(left + 2, top + 1, STR_00C6, 0);
 }
 
 static void NewsWindowProc(Window *w, WindowEvent *e)
@@ -115,7 +115,7 @@
 
 				/* Shade the viewport into gray, or color*/
 				vp = w->viewport;
-				GfxFillRect(vp->left - w->left, vp->top - w->top, vp->left - w->left + vp->width - 1, vp->top - w->top + vp->height - 1, 
+				GfxFillRect(vp->left - w->left, vp->top - w->top, vp->left - w->left + vp->width - 1, vp->top - w->top + vp->height - 1,
 					ni->flags & NF_INCOLOR ? 0x4322:0x4323
 				);
 
@@ -208,7 +208,7 @@
 
 	_forced_news = 255;
 	if(_total_news < MAX_NEWS) _total_news++;
-	
+
 	// make sure our pointer isn't overflowing
 	_latest_news = increaseIndex(_latest_news);
 
@@ -431,7 +431,7 @@
 	else if(_forced_news!=0)
 		ShowNewsMessage(_forced_news-1);
 	else {
-		if(_total_news != MAX_NEWS) 
+		if(_total_news != MAX_NEWS)
 			ShowNewsMessage(_latest_news);
 		else
 			ShowNewsMessage(MAX_NEWS-1);
@@ -443,7 +443,7 @@
 recent news. Returns 255 if end of queue reached. */
 static byte getNews(byte i)
 {
-	if(i>=_total_news) 
+	if(i>=_total_news)
 		return 255;
 
 	if(_latest_news < i)
@@ -459,17 +459,17 @@
 {
 	StringID str;
 	byte *s, *d;
-	
+
 	if (ni->display_mode == 3) {
 		str = _get_news_string_callback[ni->callback](ni);
 	} else {
 		COPY_IN_DPARAM(0, ni->params, lengthof(ni->params));
-		str = ni->string_id;	
+		str = ni->string_id;
 	}
 
 	GetString(str_buffr, str);
 	assert(strlen(str_buffr) < sizeof(str_buffr) - 1);
-	
+
 	s = str_buffr;
 	d = buffer;
 
@@ -611,7 +611,7 @@
 		for(i=STR_0206_ARRIVAL_OF_FIRST_VEHICLE; i <= STR_020F_GENERAL_INFORMATION; i++) {
 			DrawString(124, y, i, 0);
 			y += 12;
-		}		
+		}
 
 		break;
 		}
--- a/oldloader.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/oldloader.c	Fri Sep 10 19:02:27 2004 +0000
@@ -314,7 +314,7 @@
 	byte owner;
 	uint16 tile;
 	uint16 cur_image;
-	
+
 	int16 left_coord, right_coord, top_coord, bottom_coord; // NOLOAD, calculated automatically.
 	uint16 vehstatus;
 	uint16 cur_speed;
@@ -420,21 +420,21 @@
 	uint16 age_cargo_skip_counter;
 	uint16 tick_counter;
 	uint16 cur_tileloop_tile;
-	
+
 	OldPrice prices[49];
 	OldPaymentRate cargo_payment_rates[12];
-	
+
 	byte map_owner[256*256];
 	byte map2[256*256];
 	uint16 map3[256*256];
 	byte map_extra[256*256/4];
-	
+
 	OldStation stations[250];
 	OldIndustry industries[90];
 	OldPlayer players[8];
 	OldVehicle vehicles[850];
 	OldName names[500];
-		
+
 	uint16 vehicle_position_hash[0x1000]; // NOLOAD, calculated automatically.
 
 	OldSign signs[40];
@@ -455,7 +455,7 @@
 	uint16 cargo_sprites[12];
 
 	uint16 engine_name_strings[256];
-	
+
 	//NOLOAD. These are calculated from InitializeLandscapeVariables
 	uint16 railveh_by_cargo_1[12], railveh_by_cargo_2[12], railveh_by_cargo_3[12];
 	uint16 roadveh_by_cargo_start[12];
@@ -486,9 +486,9 @@
 	byte snow_line_height;
 
 	byte new_industry_randtable[32]; // NOLOAD. Not needed due to different code design.
-	
+
 	//NOLOAD. Initialized by InitializeLandscapeVariables
-	byte cargo_weights[12]; 
+	byte cargo_weights[12];
 	byte transit_days_table_1[12];
 	byte transit_days_table_2[12];
 
@@ -557,7 +557,7 @@
 			return GetSavegameByteFromBuffer();
 		}
 	}
-	
+
 	x = GetSavegameByteFromBuffer();
 	if (x >= 0) {
 		lss->count = x;
@@ -568,7 +568,7 @@
 		lss->count = -x;
 		lss->rep_char = GetSavegameByteFromBuffer();
 		return lss->rep_char;
-	}	
+	}
 }
 
 static void LoadSavegameBytes(void *p, size_t count)
@@ -642,7 +642,7 @@
 		i->prod_level = o->prod_level;
 		i->last_mo_production[0] = o->last_mo_production[0];
 		i->last_mo_production[1] = o->last_mo_production[1];
-		
+
 		i->last_mo_transported[0] = o->last_mo_transported[0];
 		i->last_mo_transported[1] = o->last_mo_transported[1];
 		i->last_mo_transported[2] = o->last_mo_transported[2];
@@ -652,7 +652,7 @@
 
 		i->total_production[0] = o->total_production[0];
 		i->total_production[1] = o->total_production[1];
-		
+
 		i->total_transported[0] = i->total_transported[0];
 		i->total_transported[1] = i->total_transported[1];
 
@@ -688,7 +688,7 @@
 		s->train_tile = o->train_tile;
 		s->airport_tile = o->airport_tile;
 		s->dock_tile = o->dock_tile;
-		
+
 		if (o->train_tile) {
 			int w = (o->platforms >> 3) & 0x7;
 			int h = (o->platforms & 0x7);
@@ -696,7 +696,7 @@
 			s->trainst_w = w;
 			s->trainst_h = h;
 		}
-		
+
 		s->string_id = RemapOldStringID(o->string_id);
 		s->had_vehicle_of_type = o->had_vehicle_of_type;
 		FixGoodsEntry(s->goods, o->goods, lengthof(o->goods));
@@ -727,7 +727,7 @@
 	do {
 		n->type = o->type;
 		n->subtype = o->subtype;
-		
+
 		if (o->schedule_ptr == 0xFFFFFFFF || o->schedule_ptr == 0) {
 			n->schedule_ptr = NULL;
 		} else {
@@ -758,7 +758,7 @@
 		n->owner = o->owner;
 		n->tile = o->tile;
 		n->cur_image = o->cur_image;
-	
+
 		n->vehstatus = o->vehstatus;
 		n->cur_speed = o->cur_speed;
 		n->subspeed = o->subspeed;
@@ -787,7 +787,7 @@
 		n->next = o->next_in_chain == 0xffff ? NULL : &_vehicles[o->next_in_chain];
 		n->value = o->value;
 		n->string_id = RemapOldStringID(o->string_id);
-		
+
 		switch(o->type) {
 		case VEH_Train:
 			n->u.rail.track = o->u.rail.track;
@@ -864,7 +864,7 @@
 {
 	int i, j;
 	int x = 0;
-	
+
 	do {
 		n->name_1 = RemapOldStringID(o->name_1);
 		n->name_2 = o->name_2;
@@ -882,15 +882,15 @@
 
 		if (o->name_1 != 0)
 			n->is_active = true;
-		
+
 		n->face = o->face;
 		n->president_name_1 = o->pres_name_1;
 		n->president_name_2 = o->pres_name_2;
-		
+
 		n->money64 = n->player_money = o->money;
 		n->current_loan = o->loan;
-		
-		// Correct money for scenario loading. 
+
+		// Correct money for scenario loading.
 		// It's always 893288 pounds (and no loan), if not corrected
 		if(o->money==0xda168)
 			n->money64 = n->player_money = n->current_loan =100000;
@@ -905,7 +905,7 @@
 		n->bankrupt_value = o->bankrupt_value;
 		n->bankrupt_timeout = o->bankrupt_timeout;
 		n->cargo_types = o->cargo_types;
-		
+
 		for(i=0; i!=3; i++)
 			for(j=0; j!=13; j++)
 				n->yearly_expenses[i][j] = o->expenses[i].cost[j];
@@ -916,7 +916,7 @@
 		n->last_build_coordinate = o->last_build_coordinate;
 		n->num_valid_stat_ent = o->num_valid_stat_ent;
 
-		/*	Not good, since AI doesn't have a vehicle assigned as 
+		/*	Not good, since AI doesn't have a vehicle assigned as
 		 *	in p->ai.cur_veh and thus will crash on certain actions.
 		 *	Best is to set state to AiStateVehLoop (2)
 		 *	n->ai.state = o->ai_state;
@@ -927,18 +927,18 @@
 		n->ai.timeout_counter = o->ai_timeout_counter;
 		n->ai.banned_tile_count = o->ai_banned_tile_count;
 		n->ai.railtype_to_use = o->ai_railtype_to_use;
-		
+
 		FixAiBuildRec(&n->ai.src, &o->ai_src);
 		FixAiBuildRec(&n->ai.dst, &o->ai_dst);
 		FixAiBuildRec(&n->ai.mid1, &o->ai_mid1);
 		FixAiBuildRec(&n->ai.mid2, &o->ai_mid2);
-		
+
 		n->ai.cargo_type = o->ai_cargo_type;
 		n->ai.num_wagons = o->ai_num_wagons;
 		n->ai.num_build_rec = o->ai_num_build_rec;
 		n->ai.num_loco_to_build = o->ai_num_loco_to_build;
 		n->ai.num_want_fullload = o->ai_num_want_fullload;
-		
+
 		for(i=0; i!=9; i++) n->ai.wagon_list[i] = o->ai_wagonlist[i];
 		memcpy(n->ai.order_list_blocks, o->ai_order_list_blocks, 20);
 		n->ai.start_tile_a = o->ai_start_tile_a;
@@ -949,7 +949,7 @@
 		n->ai.start_dir_b = o->ai_start_dir_b;
 		n->ai.cur_dir_a = o->ai_cur_dir_a;
 		n->ai.cur_dir_b = o->ai_cur_dir_b;
-		
+
 		for(i=0; i!=16; i++) {
 			n->ai.banned_tiles[i] = o->banned_tiles[i].tile;
 			n->ai.banned_val[i] = o->banned_tiles[i].data;
@@ -1081,7 +1081,7 @@
 	for(i=0; i!=256*256; i++) {
 		if (IS_TILETYPE(i, MP_RAILWAY) && (_map5[i] & 0xC0) == 0x40) {
 			// this byte is always zero in real ttd.
-			if (_map3_hi[i]) { 
+			if (_map3_hi[i]) {
 				// convert ttdpatch presignal format to openttd presignal format.
 				_map3_hi[i] = (_map3_hi[i] >> 1) & 7;
 			}
@@ -1098,7 +1098,7 @@
 	FixDepot(_depots, m->depots, lengthof(m->depots));
 	FixVehicle(_vehicles, m->vehicles, lengthof(m->vehicles));
 	FixSubsidy(_subsidies, m->subsidies, lengthof(m->subsidies));
-	
+
 	FixPlayer(_players, m->players, lengthof(m->players), m->town_name_type);
 	FixName(m->names, lengthof(m->names));
 	FixSign(_sign_list, m->signs, lengthof(m->signs));
@@ -1154,7 +1154,7 @@
 		_cargo_payment_rates[i] = -(int32)m->cargo_payment_rates[i].price;
 		_cargo_payment_rates_frac[i] = m->cargo_payment_rates[i].frac;
 	}
-	
+
 	free(m);
 	fclose(lss.fin);
 	return true;
--- a/order_cmd.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/order_cmd.c	Fri Sep 10 19:02:27 2004 +0000
@@ -23,7 +23,7 @@
 	// for ships, make sure that the station is not too far away from the previous destination.
 	if (v->type == VEH_Ship && IS_HUMAN_PLAYER(v->owner) &&
 			sel != 0 && ((t=v->schedule_ptr[sel-1])&OT_MASK) == OT_GOTO_STATION) {
-		
+
 		int dist = GetTileDist(DEREF_STATION(t >> 8)->xy, DEREF_STATION(p2 >> 8)->xy);
 		if (dist >= 130)
 			return_cmd_error(STR_0210_TOO_FAR_FROM_PREVIOUS_DESTINATIO);
@@ -39,7 +39,7 @@
 		s1[0] = (uint16)p2;
 
 		s1 = v->schedule_ptr;
-		
+
 		FOR_ALL_VEHICLES(u) {
 			if (u->type != 0 && u->schedule_ptr != NULL) {
 				if (s1 < u->schedule_ptr) {
@@ -69,10 +69,10 @@
 
 	if (flags & DC_EXEC) {
 		DeleteVehicleSchedule(dst);
-		
+
 		dst->num_orders = 0;
 		*(dst->schedule_ptr = _ptr_to_next_order++) = 0;
-		
+
 		InvalidateWindow(WC_VEHICLE_ORDERS, dst->index);
 	}
 	return 0;
@@ -92,7 +92,7 @@
 
 	if (flags & DC_EXEC) {
 		uint16 *s1;
-		
+
 		s1 = &v->schedule_ptr[sel];
 
 		// copy all orders to get rid of the hole
@@ -119,7 +119,7 @@
 			}
 		}
 	}
-	
+
 	return 0;
 }
 
@@ -133,7 +133,7 @@
 			byte b = v->cur_order_index + 1;
 			if (b >= v->num_orders) b = 0;
 			v->cur_order_index = b;
-			
+
 			if (v->type == VEH_Train)
 				v->u.rail.days_since_order_progr = 0;
 		}
@@ -160,7 +160,7 @@
 		return CMD_ERROR;
 
 	sched = &v->schedule_ptr[sel];
-	if (!((*sched & OT_MASK) == OT_GOTO_STATION || 
+	if (!((*sched & OT_MASK) == OT_GOTO_STATION ||
 			((*sched & OT_MASK) == OT_GOTO_DEPOT &&  (p2>>8) != 1)))
 		return CMD_ERROR;
 
@@ -185,9 +185,9 @@
 			if (v->schedule_ptr == sched)
 				InvalidateWindow(WC_VEHICLE_ORDERS, v->index);
 		}
-		
+
 	}
-	
+
 	return 0;
 }
 
@@ -204,12 +204,12 @@
 int32 CmdCloneOrder(int x, int y, uint32 flags, uint32 p1, uint32 p2)
 {
 	Vehicle *dst = &_vehicles[p1 & 0xFFFF];
-	
+
 	if (!(dst->type && dst->owner == _current_player))
 		return CMD_ERROR;
 
 	switch(p2) {
-	
+
 	// share vehicle orders?
 	case 0: {
 		Vehicle *src = &_vehicles[p1 >> 16];
@@ -217,7 +217,7 @@
 		// sanity checks
 		if (!(src->owner == _current_player && dst->type == src->type && dst != src))
 			return CMD_ERROR;
-			
+
 		// let's see what happens with road vehicles
 		if (src->type == VEH_Road) {
 			if (src->cargo_type != dst->cargo_type && (src->cargo_type == CT_PASSENGERS || dst->cargo_type == CT_PASSENGERS))
@@ -243,14 +243,14 @@
 		// sanity checks
 		if (!(src->owner == _current_player && dst->type == src->type && dst != src))
 			return CMD_ERROR;
-			
+
 		// let's see what happens with road vehicles
 		if (src->type == VEH_Road) {
 			uint16 ord;
 			int i;
 			Station *st;
 			TileIndex required_dst;
-			
+
 			for (i=0; (ord = src->schedule_ptr[i]) != 0; i++) {
 				if ( ( ord & OT_MASK ) == OT_GOTO_STATION ) {
 					st = DEREF_STATION(ord >> 8);
@@ -292,7 +292,7 @@
 
 	bak->orderindex = v->cur_order_index;
 	bak->service_interval = v->service_interval;
-	
+
 	if ((v->string_id & 0xF800) != 0x7800) {
 		bak->name[0] = 0;
 	} else {
@@ -306,7 +306,7 @@
 		os[1] = u->index;
 		return;
 	}
-	
+
 	sched = v->schedule_ptr;
 	do {
 		ord = *sched++;
@@ -325,7 +325,7 @@
 	}
 
 	DoCommandP(0, v->index, bak->orderindex|(bak->service_interval<<16) , NULL, CMD_RESTORE_ORDER_INDEX | CMD_ASYNC);
-	
+
 	os = bak->order;
 	if (os[0] == 0xFFFF) {
 		DoCommandP(0, v->index | os[1]<<16, 0, NULL, CMD_CLONE_ORDER);
@@ -359,7 +359,7 @@
 {
 	if (!_patches.order_review_system)	//User doesn't want things to be checked
 		return 0;
-		
+
 	if ( (_patches.order_review_system == 1) && (v->vehstatus & VS_STOPPED) )
 		return 0;
 
@@ -401,17 +401,17 @@
 		if ( (v->schedule_ptr[0] == v->schedule_ptr[i-2]) && ( i-2 != 0 ) ) {
 			problem_type = 2;
 		}
-		
+
 		if (n_st < 2) problem_type = 0;
-		
+
 		if (!required_tile) problem_type = 3;
 
 		SET_DPARAM16(0, v->unitnumber);
-		
+
 		message = (STR_TRAIN_HAS_TOO_FEW_ORDERS) + (((v->type) - VEH_Train) << 2) + problem_type;
-	
+
 		if (problem_type < 0) return 0;
-		
+
 		AddNewsItem(
 			message,
 			NEWS_FLAGS(NM_SMALL, NF_VIEWPORT|NF_VEHICLE, NT_ADVICE, 0),
--- a/order_gui.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/order_gui.c	Fri Sep 10 19:02:27 2004 +0000
@@ -58,7 +58,7 @@
 	SetVScrollCount(w, num+1);
 
 	sel = OrderGetSel(w);
-	
+
 	SET_DPARAM16(2,STR_8827_FULL_LOAD);
 	switch(v->schedule_ptr[sel] & 0x1F) {
 	case OT_GOTO_STATION:
@@ -70,7 +70,7 @@
 	default:
 		SETBIT(w->disabled_state, 6); /* nonstop */
 		SETBIT(w->disabled_state, 8);	/* full load */
-		SETBIT(w->disabled_state, 9);	/* unload */				
+		SETBIT(w->disabled_state, 9);	/* unload */
 	}
 
 	SET_DPARAM16(0, v->string_id);
@@ -82,11 +82,11 @@
 	i = 0;
 	for(;;) {
 		str = ((byte)v->cur_order_index == i) ? STR_8805 : STR_8804;
-		
+
 		ord = v->schedule_ptr[i];
 
 		if ( (uint)(i - w->vscroll.pos) < 6) {
-			
+
 			if (ord == 0) {
 				str = shared_schedule ? STR_END_OF_SHARED_ORDERS : STR_882A_END_OF_ORDERS;
 			} else {
@@ -149,7 +149,7 @@
 {
 	if (v->tile != f->tile || v->owner != f->owner || v->vehstatus & VS_HIDDEN ) return NULL;
 	return v;
-} 
+}
 
 Vehicle *GetVehicleOnTile(TileIndex tile, byte owner)
 {
@@ -231,7 +231,7 @@
 	// v is vehicle getting orders. Only copy/clone orders if vehicle doesn't have any orders yet
 	// obviously if you press CTRL on a non-empty orders vehicle you know what you are doing
 	if (v->num_orders != 0 && _ctrl_pressed == 0) {return false;}
-	
+
 	if (DoCommandP(v->tile, v->index | (u->index << 16), _ctrl_pressed ? 0 : 1, NULL,
 		_ctrl_pressed ? CMD_CLONE_ORDER | CMD_MSG(STR_CANT_SHARE_ORDER_LIST) : CMD_CLONE_ORDER | CMD_MSG(STR_CANT_COPY_ORDER_LIST))) {
 		WP(w,order_d).sel = -1;
@@ -245,7 +245,7 @@
 {
 	uint cmd;
 	Vehicle *u;
-	
+
 	// check if we're clicking on a vehicle first.. clone orders in that case.
 	u = CheckMouseOverVehicle();
 	if (u && HandleOrderVehClick(v, u, w))
@@ -273,7 +273,7 @@
 		Vehicle *v = &_vehicles[w->window_number];
 		int mode;
 		switch(e->click.widget) {
-		case 2:	{/* orders list */	
+		case 2:	{/* orders list */
 			int sel;
 			sel = (e->click.pt.y - 15) / 10;
 
@@ -298,7 +298,7 @@
 
 				if (xy)
 					ScrollMainWindowToTile(xy);
-				
+
 				return;
 			}
 
@@ -383,7 +383,7 @@
 			HandleOrderVehClick(&_vehicles[w->window_number], v, w);
 		}
 	} break;
-		
+
 	}
 }
 
@@ -556,7 +556,7 @@
 
 	DeleteWindowById(WC_VEHICLE_ORDERS, veh);
 	DeleteWindowById(WC_VEHICLE_DETAILS, veh);
-	
+
 	_alloc_wnd_parent_num = veh;
 	w = AllocateWindowDesc(
 		_order_window_desc[(v->type - VEH_Train)*2 + (v->owner != _local_player)]);
--- a/pathfind.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/pathfind.c	Fri Sep 10 19:02:27 2004 +0000
@@ -37,7 +37,7 @@
 			return true;
 		} else {
 			/* two tiles with the same hash, need to make a link */
-			
+
 			/* allocate a link. if out of links, handle this by returning
 			 * that a tile was already visisted. */
 			if (tpf->num_links_left == 0)
@@ -51,7 +51,7 @@
 			tpf->hash_tile[hash] = PATHFIND_GET_LINK_OFFS(tpf, link);
 
 			link->flags = tpf->hash_head[hash];
-			tpf->hash_head[hash] = 0xFFFF; /* multi link */ 
+			tpf->hash_head[hash] = 0xFFFF; /* multi link */
 
 			link->next = 0xFFFF;
 		}
@@ -59,7 +59,7 @@
 		/* a linked list of many tiles,
 		 * find the one corresponding to the tile, if it exists.
 		 * otherwise make a new link */
-		
+
 		offs = tpf->hash_tile[hash];
 		do {
 			link = PATHFIND_GET_LINK_PTR(tpf, offs);
@@ -74,7 +74,7 @@
 			}
 		} while ((offs=link->next) != 0xFFFF);
 	}
-	
+
 	/* get here if we need to add a new link to link,
 	 * first, allocate a new link, in the same way as before */
 	if (tpf->num_links_left == 0)
@@ -130,12 +130,12 @@
 
 	// This addition will sometimes overflow by a single tile.
 	// The use of TILE_MASK here makes sure that we still point at a valid
-	// tile, and then this tile will be in the sentinel row/col, so GetTileTrackStatus will fail. 
+	// tile, and then this tile will be in the sentinel row/col, so GetTileTrackStatus will fail.
 	tile = TILE_MASK(tile + _tileoffs_by_dir[direction]);
 
 	if (++tpf->rd.cur_length > 50)
 		return;
-	
+
 	bits = GetTileTrackStatus(tile, tpf->tracktype);
 	bits = (byte)((bits | (bits >> 8)) & _bits_mask[direction]);
 	if (bits == 0)
@@ -161,7 +161,7 @@
 		// Change direction 4 times only
 		if ((byte)i != tpf->rd.pft_var6) {
 			if(++tpf->rd.depth > 4) {
-				tpf->rd = rd;		
+				tpf->rd = rd;
 				return;
 			}
 			tpf->rd.pft_var6 = (byte)i;
@@ -169,7 +169,7 @@
 
 continue_here:;
 		tpf->the_dir = HASBIT(_otherdir_mask[direction],i) ? (i+8) : i;
-		
+
 #ifdef DEBUG_TILE_PUSH
 		dbg_push_tile(tile, tpf->the_dir);
 #endif
@@ -265,7 +265,7 @@
 	if (IS_TILETYPE(tile, MP_TUNNELBRIDGE) && (_map5[tile] & 0xF0)==0) {
 		if ((_map5[tile] & 3) != direction || ((_map5[tile]>>1)&6) != tpf->tracktype)
 			return;
-		tile = SkipToEndOfTunnel(tpf, tile, direction);		
+		tile = SkipToEndOfTunnel(tpf, tile, direction);
 	}
 	tile += _tileoffs_by_dir[direction];
 	tpf->rd.cur_length++;
@@ -286,7 +286,7 @@
 
 				tpf->the_dir = (_otherdir_mask[direction] & (byte)(1 << i)) ? (i+8) : i;
 				rd = tpf->rd;
-				
+
 #ifdef DEBUG_TILE_PUSH
 		dbg_push_tile(tile, tpf->the_dir);
 #endif
@@ -304,12 +304,12 @@
 
 	/* the next is only used when signals are checked.
 	 * seems to go in 2 directions simultaneously */
-	 
+
 	/* if i can get rid of this, tail end recursion can be used to minimize
-	 * stack space dramatically. */	
+	 * stack space dramatically. */
 	if (tpf->hasbit_13)
 		return;
-	
+
 	tile = tile_org;
 	direction ^= 2;
 
@@ -327,7 +327,7 @@
 	do {
 		i = FIND_FIRST_BIT(bits);
 		bits = KILL_FIRST_BIT(bits);
-		
+
 		tpf->the_dir = (_otherdir_mask[direction] & (byte)(1 << i)) ? (i+8) : i;
 		rd = tpf->rd;
 		if (TPFSetTileBit(tpf, tile, tpf->the_dir) &&
@@ -344,16 +344,16 @@
 
 	assert(direction < 4);
 
-	/* initialize path finder variables */	
+	/* initialize path finder variables */
 	tpf->userdata = data;
-	tpf->enum_proc = enum_proc;	
+	tpf->enum_proc = enum_proc;
 	tpf->new_link = tpf->links;
 	tpf->num_links_left = 0x400;
 
 	tpf->rd.cur_length = 0;
 	tpf->rd.depth = 0;
 	tpf->rd.pft_var6 = 0;
-	
+
 	tpf->var2 = HASBIT(flags, 15) ? 0x43 : 0xFF; /* 0x8000 */
 
 	tpf->disable_tile_hash = HASBIT(flags, 12) != 0;     /* 0x1000 */
@@ -362,10 +362,10 @@
 
 	tpf->tracktype = (byte)flags;
 
-	if (HASBIT(flags, 11)) {	
+	if (HASBIT(flags, 11)) {
 		tpf->rd.pft_var6 = 0xFF;
 		tpf->enum_proc(tile, data, 0, 0, 0);
-		TPFMode2(tpf, tile, direction);	
+		TPFMode2(tpf, tile, direction);
 	} else {
 		/* clear the hash_heads */
 		memset(tpf->hash_head, 0, sizeof(tpf->hash_head));
@@ -373,7 +373,7 @@
 	}
 
 	if (after_proc != NULL)
-		after_proc(tpf);	
+		after_proc(tpf);
 }
 
 typedef struct {
@@ -439,10 +439,10 @@
 {
 	StackedItem si;
 	int i = ++tpf->nstack;
-	
+
 	while (i != 1 && ARR(i).cur_length < ARR(i>>1).cur_length) {
 		// the child element is larger than the parent item.
-		// swap the child item and the parent item. 
+		// swap the child item and the parent item.
 		si = ARR(i); ARR(i) = ARR(i>>1); ARR(i>>1) = si;
 		i>>=1;
 	}
@@ -462,13 +462,13 @@
 
 	while ((j=i*2) <= n) {
 		// figure out which is smaller of the children.
-		if (j != n && ARR(j).cur_length > ARR(j+1).cur_length) 
+		if (j != n && ARR(j).cur_length > ARR(j+1).cur_length)
 			j++; // right item is smaller
 
 		assert(i <= n && j <= n);
 		if (ARR(i).cur_length <= ARR(j).cur_length)
 			break; // base elem smaller than smallest, done!
-	
+
 		// swap parent with the child
 		si = ARR(i); ARR(i) = ARR(j); ARR(j) = si;
 		i = j;
@@ -484,7 +484,7 @@
 	HashLink *link, *new_link;
 
 	assert(length < 1024);
-	
+
 	hash = PATHFIND_HASH_TILE(tile);
 
 	// never visited before?
@@ -496,10 +496,10 @@
 
 	if (head != 0xffff) {
 		if ( (TileIndex)tile == tpf->hash_tile[hash] && (head & 0x3) == dir ) {
-			
+
 			// longer length
 			if (length >= (head >> 2)) return false;
-			
+
 			tpf->hash_head[hash] = dir | (length << 2);
 			return true;
 		}
@@ -517,13 +517,13 @@
 		tpf->hash_tile[hash] = NTP_GET_LINK_OFFS(tpf, link);
 
 		link->typelength = tpf->hash_head[hash];
-		tpf->hash_head[hash] = 0xFFFF; /* multi link */ 
+		tpf->hash_head[hash] = 0xFFFF; /* multi link */
 		link->next = 0xFFFF;
 	} else {
 		// a linked list of many tiles,
 		// find the one corresponding to the tile, if it exists.
 		// otherwise make a new link
-		
+
 		uint offs = tpf->hash_tile[hash];
 		do {
 			link = NTP_GET_LINK_PTR(tpf, offs);
@@ -534,7 +534,7 @@
 			}
 		} while ((offs=link->next) != 0xFFFF);
 	}
-	
+
 	/* get here if we need to add a new link to link,
 	 * first, allocate a new link, in the same way as before */
 	if (tpf->num_links_left == 0)
@@ -613,7 +613,7 @@
 
 	for(;;) {
 		tile += _tileoffs_by_dir[direction];
-		
+
 		// too long search length? bail out.
 		if (++si.cur_length >= tpf->maxlength)
 			goto popnext;
@@ -628,7 +628,7 @@
 		// regular rail tile, determine the tracks that are actually reachable.
 		bits &= _bits_mask[direction];
 		if (bits == 0) goto popnext; // no tracks there? stop searching.
-		
+
 		// complex tile?, let the generic handler handle that..
 		if (KILL_FIRST_BIT(bits) != 0) break;
 
@@ -656,16 +656,16 @@
 	// too high recursion depth.. bail out..
 	if (si.depth >= _patches.pf_maxdepth)
 		goto popnext;
-	
+
 	si.depth++; // increase recursion depth.
 
 	// see if this tile was already visited..?
 	if (NtpVisit(tpf, tile, direction, si.cur_length)) {
-		// push all possible alternatives	
+		// push all possible alternatives
 		si.tile = tile;
 		do {
 			si.track = _new_track[FIND_FIRST_BIT(bits)][direction];
-			
+
 			// out of stack items, bail out?
 			if (tpf->nstack >= lengthof(tpf->stack))
 				break;
@@ -678,11 +678,11 @@
 		// also randomize the order in which we search through them.
 		if (si.depth == 1) {
 			uint32 r = Random();
-			assert(tpf->nstack == 2 || tpf->nstack == 3);			
-			if (r&1) swap_byte(&tpf->stack[0].track, &tpf->stack[1].track);	
+			assert(tpf->nstack == 2 || tpf->nstack == 3);
+			if (r&1) swap_byte(&tpf->stack[0].track, &tpf->stack[1].track);
 			if (tpf->nstack != 2) {
 				byte t = tpf->stack[2].track;
-				if (r&2) swap_byte(&tpf->stack[0].track, &t);	
+				if (r&2) swap_byte(&tpf->stack[0].track, &t);
 				if (r&4) swap_byte(&tpf->stack[1].track, &t);
 				tpf->stack[2].first_track = tpf->stack[2].track = t;
 			}
@@ -702,7 +702,7 @@
 		!NtpCheck(tpf, tile, _tpf_prev_direction[si.track], si.cur_length) || // already have better path to that tile?
 		tpf->enum_proc(tile, tpf->userdata, si.track, si.cur_length, &si.state)
 	);
-	
+
 	direction = _tpf_new_direction[si.track];
 	goto restart;
 }
@@ -718,7 +718,7 @@
 
 		tpf  = alloca(sizeof(NewTrackPathFinder));
 		tpf->userdata = data;
-		tpf->enum_proc = enum_proc;	
+		tpf->enum_proc = enum_proc;
 		tpf->tracktype = 0;
 		tpf->maxlength = _patches.pf_maxlength;
 		tpf->nstack = 0;
--- a/road_gui.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/road_gui.c	Fri Sep 10 19:02:27 2004 +0000
@@ -128,17 +128,17 @@
 
 static void BuildRoadClick_Depot(Window *w)
 {
-	if (HandlePlacePushButton(w, 7, 0x511, 1, PlaceRoad_Depot)) ShowRoadDepotPicker();	
+	if (HandlePlacePushButton(w, 7, 0x511, 1, PlaceRoad_Depot)) ShowRoadDepotPicker();
 }
 
 static void BuildRoadClick_BusStation(Window *w)
 {
-	if (HandlePlacePushButton(w, 8, 0xAA5, 1, PlaceRoad_BusStation)) ShowBusStationPicker();	
+	if (HandlePlacePushButton(w, 8, 0xAA5, 1, PlaceRoad_BusStation)) ShowBusStationPicker();
 }
 
 static void BuildRoadClick_TruckStation(Window *w)
 {
-	if (HandlePlacePushButton(w, 9, 0xAA6, 1, PlaceRoad_TruckStation)) ShowTruckStationPicker();	
+	if (HandlePlacePushButton(w, 9, 0xAA6, 1, PlaceRoad_TruckStation)) ShowTruckStationPicker();
 }
 
 static void BuildRoadClick_Bridge(Window *w)
@@ -244,7 +244,7 @@
 		} else {
 			sel_method = VPM_X_OR_Y;
 		}
-		
+
 		VpSelectTilesWithMethod(e->place.pt.x, e->place.pt.y, sel_method);
 		return;
 	}
@@ -257,8 +257,8 @@
 				ResetObjectToPlace();
 				ShowBuildBridgeWindow(start_tile, end_tile, 0x80);
 			} else if (e->place.userdata != 4) {
-				DoCommandP(end_tile, start_tile, _place_road_flag, CcPlaySound1D, 
-					_remove_button_clicked ? 
+				DoCommandP(end_tile, start_tile, _place_road_flag, CcPlaySound1D,
+					_remove_button_clicked ?
 					CMD_REMOVE_LONG_ROAD | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1805_CAN_T_REMOVE_ROAD_FROM) :
 					CMD_BUILD_LONG_ROAD | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1804_CAN_T_BUILD_ROAD_HERE));
 			} else {
@@ -363,9 +363,9 @@
 			SndPlayFx(0x13);
 			SetWindowDirty(w);
 			break;
-		}	
+		}
 	}	break;
-	
+
 	case WE_MOUSELOOP:
 		if (WP(w,def_d).close)
 			DeleteWindow(w);
@@ -445,7 +445,7 @@
 			break;
 		}
 	} break;
-	
+
 	case WE_MOUSELOOP: {
 		if (WP(w,def_d).close) {
 			DeleteWindow(w);
@@ -454,7 +454,7 @@
 
 		CheckRedrawStationCoverage(w);
 	} break;
-	}		
+	}
 }
 
 static const Widget _bus_station_picker_widgets[] = {
--- a/roadveh_cmd.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/roadveh_cmd.c	Fri Sep 10 19:02:27 2004 +0000
@@ -38,7 +38,7 @@
 	0, 17, 17, 34, 51, 51, 51, 1,
 	18, 35, 2, 19, 36, 57, 57, 57,
 	3, 20, 37, 4, 21, 38, 5, 22,
-	
+
 	39, 6, 23, 40, 7, 24, 41, 8,
 	25, 42, 9, 26, 43, 10, 27, 44,
 	11, 28, 45, 12, 29, 46, 13, 30,
@@ -47,7 +47,7 @@
 	33, 50, 52, 52, 52, 53, 53, 53,
 	54, 54, 54, 55, 55, 55, 56, 56,
 	56, 58, 58, 58, 59, 59, 59, 60,
-	60, 60, 61, 61, 61, 62, 62, 62,	
+	60, 60, 61, 61, 61, 62, 62, 62,
 };
 
 const byte _roadveh_speed[88] = {
@@ -164,7 +164,7 @@
 		img = _engine_original_sprites[v->engine_type];
 	}
 #endif
-	
+
 	image = direction + _roadveh_images[img];
 	if (v->cargo_count >= (v->cargo_cap >> 1))
 		image += _roadveh_full_adder[img];
@@ -186,7 +186,7 @@
 
 	SET_DPARAM16(4, _roadveh_capacity[engine]);
 	SET_DPARAM16(3, _cargoc.names_long_p[_roadveh_cargo_type[engine]]);
-		
+
 	DrawStringMultiCenter(x, y, STR_902A_COST_SPEED_RUNNING_COST, maxw);
 }
 
@@ -202,7 +202,7 @@
 	byte unit_num;
 	uint tile = TILE_FROM_XY(x,y);
 	Engine *e;
-	
+
 	SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
 
 	cost = EstimateRoadVehCost(p1);
@@ -256,7 +256,7 @@
 		v->reliability_spd_dec = e->reliability_spd_dec;
 		v->max_age = e->lifelength * 366;
 		_new_roadveh_id = v->index;
-		
+
 		v->string_id = STR_SV_ROADVEH_NAME;
 		*(v->schedule_ptr = _ptr_to_next_order++) = 0;
 
@@ -303,7 +303,7 @@
 	Vehicle *v;
 
 	SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
-	
+
 	v = &_vehicles[p1];
 
 	if (v->type != VEH_Road || !CheckOwnership(v->owner))
@@ -311,7 +311,7 @@
 
 	if (!IsRoadDepotTile(v->tile) || v->u.road.state != 254 || !(v->vehstatus&VS_STOPPED))
 		return_cmd_error(STR_9013_MUST_BE_STOPPED_INSIDE);
-	
+
 	if (flags & DC_EXEC) {
 		// Invalidate depot
 		InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
@@ -321,7 +321,7 @@
 		DeleteWindowById(WC_VEHICLE_VIEW, v->index);
 		DeleteVehicle(v);
 	}
-	
+
 	return -(int32)v->value;
 }
 
@@ -351,7 +351,7 @@
 	if (IS_TILETYPE(tile, MP_STREET) &&
 			(_map5[tile] & 0xF0) == 0x20 &&
 			_map_owner[tile] == rfdd->owner) {
-			
+
 		if (length < rfdd->best_length) {
 			rfdd->best_length = length;
 			rfdd->tile = tile;
@@ -365,7 +365,7 @@
 	uint tile = v->tile;
 	int i;
 	RoadFindDepotData rfdd;
-		
+
 	if (v->u.road.state == 255) { tile = GetVehicleOutOfTunnelTile(v); }
 
 	rfdd.owner = v->owner;
@@ -409,7 +409,7 @@
 		v->dest_tile = _depots[depot].xy;
 		InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, 4);
 	}
-	
+
 	return 0;
 }
 
@@ -430,10 +430,10 @@
 		_error_message = STR_EMPTY;
 		return CMD_ERROR;
 	}
-				
+
 	if (flags & DC_EXEC) {
 		v->u.road.reverse_ctr = 180;
-	}		
+	}
 
 	return 0;
 }
@@ -495,10 +495,10 @@
 
 	// mark station as not busy
 	bb &= ~0x80;
-	
+
 	// free parking bay
 	bb |= (v->u.road.state&0x02)?2:1;
-	
+
 	*b = bb;
 }
 
@@ -506,17 +506,17 @@
 {
 	DeleteWindowById(WC_VEHICLE_VIEW, v->index);
 	InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
-		
+
 	_vehicle_sort_dirty[VEHROAD] = true; // delete bus/truck (eg. crash for example)
 	InvalidateWindow(WC_ROADVEH_LIST, v->owner);
 	InvalidateWindow(WC_COMPANY, v->owner);
 
 	if(IS_TILETYPE(v->tile, MP_STATION))
 		ClearCrashedStation(v);
-	
+
 	BeginVehicleMove(v);
 	EndVehicleMove(v);
-	
+
 	DeleteVehicle(v);
 }
 
@@ -531,7 +531,7 @@
 
 	old_z = v->z_pos;
 	v->z_pos = new_z;
-	
+
 	VehiclePositionChanged(v);
 	EndVehicleMove(v);
 	return old_z;
@@ -621,10 +621,10 @@
 
 		if (v->breakdowns_since_last_service != 255)
 			v->breakdowns_since_last_service++;
-		
+
 		InvalidateWindow(WC_VEHICLE_VIEW, v->index);
 		InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
-		
+
 		SndPlayVehicleFx((_opt.landscape != LT_CANDY) ? 0xD : 0x34, v);
 
 		if (!(v->vehstatus & VS_HIDDEN)) {
@@ -693,7 +693,7 @@
 {
 	if (v->next_order == OT_NOTHING)
 		return;
-	
+
 	if (v->next_order != OT_DUMMY) {
 		if ((v->next_order&OT_MASK) != OT_LOADING)
 			return;
@@ -709,7 +709,7 @@
 			}
 			return;
 		}
-		
+
 		{
 			byte b = v->next_order;
 			v->next_order = OT_LEAVESTATION;
@@ -737,16 +737,16 @@
 
 void *EnumCheckRoadVehClose(Vehicle *v, RoadVehFindData *rvf)
 {
-	static const short _dists[] = { 
+	static const short _dists[] = {
 		-4, -8, -4, -1, 4, 8, 4, 1,
 		-4, -1, 4, 8, 4, 1, -4, -8,
 	};
-	
+
 	short x_diff = v->x_pos - rvf->x;
 	short y_diff = v->y_pos - rvf->y;
 
-	if (rvf->veh == v || 
-			v->type != VEH_Road || 
+	if (rvf->veh == v ||
+			v->type != VEH_Road ||
 			v->u.road.state == 254 ||
 			myabs(v->z_pos - rvf->veh->z_pos) > 6 ||
 			v->direction != rvf->dir ||
@@ -766,13 +766,13 @@
 
 	if (v->u.road.reverse_ctr != 0)
 		return NULL;
-	
+
 	rvf.x = x;
 	rvf.y = y;
 	rvf.dir = dir;
 	rvf.veh = v;
 	u = VehicleFromPos(TILE_FROM_XY(x,y), &rvf, (VehicleFromPosProc*)EnumCheckRoadVehClose);
-	
+
 	// This code protects a roadvehicle from being blocked for ever
 	//  If more then 1480 / 74 days a road vehicle is blocked, it will
 	//  drive just through it. The ultimate backup-code of TTD.
@@ -784,7 +784,7 @@
 
 	if (++v->u.road.unk2 > 1480)
 		return NULL;
-	
+
 	return u;
 }
 
@@ -825,13 +825,13 @@
 {
 	uint spd = v->cur_speed + 1 + ((v->u.road.overtaking != 0)?1:0);
 	byte t;
-	
+
 	// Clamp
 	spd = min(spd, v->max_speed);
 
 	//updates statusbar only if speed have changed to save CPU time
 	if (spd != v->cur_speed) {
-		v->cur_speed = spd;	
+		v->cur_speed = spd;
 		if (_patches.vehicle_speed)
 			InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, 4);
 	}
@@ -858,7 +858,7 @@
 		1, 0, 5, 0,
 		2, 3, 4
 	};
-	
+
 	x = x - v->x_pos + 1;
 	y = y - v->y_pos + 1;
 
@@ -878,7 +878,7 @@
 	if (b==d) return d;
 	if (b==((d-1)&7)) return d;
 	if (b==((d-2)&7)) return d;
-	return (d+2)&7;	
+	return (d+2)&7;
 }
 
 typedef struct OvertakeData {
@@ -890,11 +890,11 @@
 void *EnumFindVehToOvertake(Vehicle *v, OvertakeData *od)
 {
 	if (v->tile != (TileIndex)od->tile ||
-			v->type != VEH_Road || 
-			v == od->u || 
+			v->type != VEH_Road ||
+			v == od->u ||
 			v == od->v)
 				return NULL;
-	return v; 
+	return v;
 }
 
 static bool FindRoadVehToOvertake(OvertakeData *od)
@@ -1078,7 +1078,7 @@
 			if (desttile == tile && bitmask&_road_pf_table_3[m5&3]) {
 				return_track(FindFirstBit2x64(bitmask&_road_pf_table_3[m5&3]));
 			}
-		}		
+		}
 	}
 	// do pathfind
 	frd.dest = desttile;
@@ -1107,7 +1107,7 @@
 	if (HASBIT(signal, best_track))
 		return -1;
 
-	return best_track;		
+	return best_track;
 }
 
 typedef struct RoadDriveEntry {
@@ -1173,13 +1173,13 @@
 		byte rd2;
 
 		v->cur_speed = 0;
-		
+
 		dir = _map5[v->tile]&3;
 		v->direction = dir*2+1;
 
 		rd2 = _roadveh_data_2[dir];
 		rdp = _road_drive_data[(_opt.road_side<<4) + rd2];
-		
+
 		x = GET_TILE_X(v->tile)*16 + (rdp[6].x&0xF);
 		y = GET_TILE_Y(v->tile)*16 + (rdp[6].y&0xF);
 
@@ -1193,7 +1193,7 @@
 		v->vehstatus &= ~VS_HIDDEN;
 		v->u.road.state = rd2;
 		v->u.road.frame = 6;
-		
+
 		v->cur_image = GetRoadVehImage(v, v->direction);
 		UpdateRoadVehDeltaXY(v);
 		SetRoadVehPosition(v,x,y);
@@ -1223,7 +1223,7 @@
 		if (IS_TILETYPE(gp.new_tile, MP_TUNNELBRIDGE) &&
 				(_map5[gp.new_tile]&0xF0) == 0 &&
 				(VehicleEnterTile(v, gp.new_tile, gp.x, gp.y)&4)) {
-			
+
 			//new_dir = RoadGetNewDirection(v, gp.x, gp.y)
 			v->cur_image = GetRoadVehImage(v, v->direction);
 			UpdateRoadVehDeltaXY(v);
@@ -1353,7 +1353,7 @@
 
 	x = (v->x_pos&~15)+(rd.x&15);
 	y = (v->y_pos&~15)+(rd.y&15);
-	
+
 	new_dir = RoadVehGetSlidingDirection(v, x, y);
 
 	if (!IS_BYTE_INSIDE(v->u.road.state, 0x20, 0x30) && (u=RoadVehFindCloseTo(v, x, y, new_dir)) != NULL) {
@@ -1383,7 +1383,7 @@
 
 		if ( (v->next_order&OT_MASK) != OT_LEAVESTATION &&
 				(v->next_order&OT_MASK) != OT_GOTO_DEPOT) {
-			
+
 			*b &= ~0x80;
 
 			v->last_station_visited = _map2[v->tile];
@@ -1393,7 +1393,7 @@
 			old_order = v->next_order;
 			v->next_order = OT_LOADING;
 
-			if ((old_order & OT_MASK) == OT_GOTO_STATION && 
+			if ((old_order & OT_MASK) == OT_GOTO_STATION &&
 					v->next_order_param == v->last_station_visited) {
 				v->next_order = OT_LOADING | OF_NON_STOP | (old_order & (OF_FULL_LOAD|OF_UNLOAD));
 			}
@@ -1449,10 +1449,10 @@
 
 	MaybeRenewVehicle(v, EstimateRoadVehCost(v->engine_type));
 
-	
+
 	if ((v->next_order&OT_MASK) == OT_GOTO_DEPOT) {
 		InvalidateWindow(WC_VEHICLE_VIEW, v->index);
-	
+
 		t = v->next_order;
 		v->next_order = OT_DUMMY;
 
@@ -1504,7 +1504,7 @@
 
 	if (_patches.gotodepot && ScheduleHasDepotOrders(v->schedule_ptr))
 		return;
-	
+
 	// Don't interfere with a depot visit scheduled by the user, or a
 	// depot visit by the order list.
 	if ((v->next_order & OT_MASK) == OT_GOTO_DEPOT &&
@@ -1527,7 +1527,7 @@
 	v->next_order = OT_GOTO_DEPOT | OF_NON_STOP;
 	v->next_order_param = (byte)i;
 	v->dest_tile = (&_depots[i])->xy;
-	InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, 4);		
+	InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, 4);
 }
 
 void OnNewDay_RoadVeh(Vehicle *v)
--- a/roadveh_gui.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/roadveh_gui.c	Fri Sep 10 19:02:27 2004 +0000
@@ -51,7 +51,7 @@
 			StringID str;
 
 			SET_DPARAM16(1, year);
-			
+
 			str = STR_0199_YEAR;
 			if (year != 1) {
 				str++;
@@ -97,7 +97,7 @@
 		SET_DPARAM16(1, 1920 + v->build_year);
 		SET_DPARAM32(2, v->value);
 		DrawString(34, 57, STR_9011_BUILT_VALUE, 0);
-		
+
 		SET_DPARAM16(0, _cargoc.names_long_p[v->cargo_type]);
 		SET_DPARAM16(1, v->cargo_cap);
 		DrawString(34, 67, STR_9012_CAPACITY, 0);
@@ -180,7 +180,7 @@
 	VehicleID veh = v->index;
 	DeleteWindowById(WC_VEHICLE_ORDERS, veh);
 	DeleteWindowById(WC_VEHICLE_DETAILS, veh);
-	_alloc_wnd_parent_num = veh;	
+	_alloc_wnd_parent_num = veh;
 	w = AllocateWindowDesc(&_roadveh_details_desc);
 	w->window_number = veh;
 	w->caption_color = v->owner;
@@ -242,13 +242,13 @@
 		DrawStringCentered(125, 105, str, 0);
 		DrawWindowViewport(w);
 	} break;
-		
+
 	case WE_CLICK: {
 		Vehicle *v = &_vehicles[w->window_number];
 
 		switch(e->click.widget) {
 		case 4: /* start stop */
-			DoCommandP(v->tile, v->index, 0, NULL, CMD_START_STOP_ROADVEH | CMD_MSG(STR_9015_CAN_T_STOP_START_ROAD_VEHICLE)); 
+			DoCommandP(v->tile, v->index, 0, NULL, CMD_START_STOP_ROADVEH | CMD_MSG(STR_9015_CAN_T_STOP_START_ROAD_VEHICLE));
 			break;
 		case 5: /* center main view */
 			ScrollMainWindowTo(v->x_pos, v->y_pos);
@@ -267,11 +267,11 @@
 			break;
 		}
 	} break;
-		
+
 	case WE_DESTROY:
 		DeleteWindowById(WC_VEHICLE_ORDERS, w->window_number);
 		DeleteWindowById(WC_VEHICLE_DETAILS, w->window_number);
-		break;	
+		break;
 	}
 }
 
@@ -348,7 +348,7 @@
 					DrawRoadVehEngine(x+29, y+6, engine_id, SPRITE_PALETTE(PLAYER_SPRITE_COLOR(_local_player)));
 					y += 14;
 				}
-				sel--; 
+				sel--;
 			}
 		} while (++engine_id, ++e,--num);
 
@@ -362,12 +362,12 @@
 			SET_DPARAM16(4, _roadveh_capacity[selected_id - ROAD_ENGINES_INDEX]);
 			SET_DPARAM16(3, _cargoc.names_long_p[_roadveh_cargo_type[selected_id - ROAD_ENGINES_INDEX]]);
 
-			e = &_engines[selected_id];	
+			e = &_engines[selected_id];
 			SET_DPARAM16(6, e->lifelength);
 			SET_DPARAM8(7, e->reliability * 100 >> 16);
 			ConvertDayToYMD(&ymd, e->intro_date);
 			SET_DPARAM16(5, ymd.year + 1920);
-			
+
 			DrawString(2, 127, STR_9008_COST_SPEED_RUNNING_COST, 0);
 		}
 	}
@@ -419,7 +419,7 @@
 				160,
 				w->window_class,
 				w->window_number);
-			break;		
+			break;
 		}
 		break;
 
@@ -436,8 +436,8 @@
 		memcpy(_decode_parameters, b, 32);
 		DoCommandP(0, WP(w,buildtrain_d).rename_engine, 0, NULL, CMD_RENAME_ENGINE | CMD_MSG(STR_9037_CAN_T_RENAME_ROAD_VEHICLE));
 	} break;
-		
-	}	
+
+	}
 }
 
 static const Widget _new_road_veh_widgets[] = {
@@ -468,7 +468,7 @@
 	w = AllocateWindowDesc(&_new_road_veh_desc);
 	w->window_number = tile;
 	w->vscroll.cap = 8;
-	
+
 	if (tile != 0) {
 		w->caption_color = _map_owner[tile];
 	} else {
@@ -509,17 +509,17 @@
 
 	FOR_ALL_VEHICLES(v) {
 		if (v->type == VEH_Road &&
-				v->u.road.state == 254 && 
+				v->u.road.state == 254 &&
 				v->tile == (TileIndex)tile &&
 				--num < 0 && num >=	-15) {
 
 			DrawRoadVehImage(v, x+24, y, WP(w,traindepot_d).sel);
-			
+
 			SET_DPARAM16(0, v->unitnumber);
 			DrawString(x, y+2, (uint16)(v->max_age-366) >= v->age ? STR_00E2 : STR_00E3, 0);
 
 			DrawSprite( (v->vehstatus & VS_STOPPED) ? 0xC12 : 0xC13, x + 16, y);
-			
+
 			if ((x+=56) == 2+56*5) {
 				x = 2;
 				y += 14;
@@ -534,7 +534,7 @@
 	TileIndex tile;
 	Vehicle *v;
 	int pos;
-		
+
 	xt = x / 56;
 	xm = x % 56;
 	if (xt >= 5)
@@ -549,7 +549,7 @@
 	tile = w->window_number;
 	FOR_ALL_VEHICLES(v) {
 		if (v->type == VEH_Road &&
-				v->u.road.state == 254 && 
+				v->u.road.state == 254 &&
 				v->tile == (TileIndex)tile &&
 				--pos < 0) {
 					*veh = v;
@@ -611,7 +611,7 @@
 		case 2:
 			RoadDepotClickVeh(w, e->click.pt.x, e->click.pt.y);
 			break;
-			
+
 		case 5:
 			ShowBuildRoadVehWindow(w->window_number);
 			break;
@@ -621,7 +621,7 @@
 			break;
 		}
 	} break;
-	
+
 	case WE_DESTROY:
 		DeleteWindowById(WC_BUILD_VEHICLE, w->window_number);
 		break;
@@ -641,12 +641,12 @@
 				ShowRoadVehViewWindow(v);
 			}
 		} break;
-					
+
 		case 3:
 			if (!HASBIT(w->disabled_state, 3) &&
 					WP(w,traindepot_d).sel != INVALID_VEHICLE)	{
 				Vehicle *v;
-				
+
 				HandleButtonClick(w, 3);
 
 				v = &_vehicles[WP(w,traindepot_d).sel];
@@ -654,7 +654,7 @@
 
 				_backup_orders_tile = v->tile;
 				BackupVehicleOrders(v, _backup_orders_data);
-	
+
 				if (!DoCommandP(v->tile, v->index, 0, NULL, CMD_SELL_ROAD_VEH | CMD_MSG(STR_9014_CAN_T_SELL_ROAD_VEHICLE)))
 					_backup_orders_tile = 0;
 			}
@@ -693,7 +693,7 @@
 void ShowRoadDepotWindow(uint tile)
 {
 	Window *w;
-	
+
 	w = AllocateWindowDescFront(&_road_depot_desc, tile);
 	if (w) {
 		w->caption_color = _map_owner[w->window_number];
@@ -730,7 +730,7 @@
 		// roads are stored as a cummulative index, eg 25, 41, 43. This means
 		// Player0: 25; Player1: (41-25) 16; Player2: (43-41) 2
 		for (i = &_num_road_sort[1]; i != endof(_num_road_sort); i++) {*i += *(i-1);}
-	
+
 		// sort by owner, then only subsort the requested owner-vehicles
 		qsort(_road_sort, n, sizeof(_road_sort[0]), GeneralOwnerSorter);
 
@@ -775,7 +775,7 @@
 		// Player0: 25; Player1: (41-25) 16; Player2: (43-41) 2 roads
 		i = (window_number == 0) ? 0 : _num_road_sort[window_number-1];
 		SetVScrollCount(w, _num_road_sort[window_number] - i);
-		
+
 		/* draw the widgets */
 		{
 			Player *p = DEREF_PLAYER(window_number);
@@ -818,7 +818,7 @@
 				SET_DPARAM32(0, v->profit_this_year);
 				SET_DPARAM32(1, v->profit_last_year);
 				DrawString(x + 24, y + 18, STR_0198_PROFIT_THIS_YEAR_LAST_YEAR, 0);
-				
+
 				if (v->string_id != STR_SV_ROADVEH_NAME) {
 					SET_DPARAM16(0, v->string_id);
 					DrawString(x+24, y, STR_01AB, 0);
@@ -843,7 +843,7 @@
 			return;
 		case 6: { /* Matrix to show vehicles */
 			uint32 id_v = (e->click.pt.y - PLY_WND_PRC__OFFSET_TOP_WIDGET) / PLY_WND_PRC__SIZE_OF_ROW_SMALL;
-			
+
 			if (id_v >= w->vscroll.cap) { return;} // click out of bounds
 
 			id_v += w->vscroll.pos;
@@ -868,15 +868,15 @@
 
 			tile = _last_built_road_depot_tile;
 			do {
-				if (_map_owner[tile] == _local_player && IsRoadDepotTile(tile)) {					
+				if (_map_owner[tile] == _local_player && IsRoadDepotTile(tile)) {
 					ShowRoadDepotWindow(tile);
 					ShowBuildRoadVehWindow(tile);
 					return;
 				}
-				
+
 				tile = TILE_MASK(tile + 1);
 			} while(tile != _last_built_road_depot_tile);
-			
+
 			ShowBuildRoadVehWindow(0);
 		} break;
 		}
--- a/saveload.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/saveload.c	Fri Sep 10 19:02:27 2004 +0000
@@ -88,7 +88,7 @@
 		_sl.offs_base += len;
 		if (len) _sl.write_bytes(len);
 	}
-	
+
 	// setup next buffer
 	_sl.bufp = _sl.buf;
 	_sl.bufe = _sl.buf + _sl.bufsize;
@@ -203,7 +203,7 @@
 {
 	int ind;
 	static uint32 next_offs;
-	
+
 	// Must be at end of current block.
 	assert(next_offs == 0 || SlGetOffs() == next_offs);
 
@@ -224,7 +224,7 @@
 			DEBUG(misc, 0) ("SlIterateArray: error\n");
 			return -1; // error
 		}
-		
+
 		if (len != 0)
 			return ind;
 	}
@@ -300,7 +300,7 @@
 static void SlSaveLoadConv(void *ptr, uint conv)
 {
 	int64 x = 0;
-	
+
 	if (_sl.save) {
 		// Read a value from the struct. These ARE endian safe.
 		switch((conv >> 4)&0xf) {
@@ -310,7 +310,7 @@
 		case SLE_VAR_U16>>4: x = *(uint16*)ptr; break;
 		case SLE_VAR_I32>>4: x = *(int32*)ptr; break;
 		case SLE_VAR_U32>>4: x = *(uint32*)ptr; break;
-		case SLE_VAR_I64>>4: x = *(int64*)ptr; break; 
+		case SLE_VAR_I64>>4: x = *(int64*)ptr; break;
 		case SLE_VAR_U64>>4: x = *(uint64*)ptr; break;
 		case SLE_VAR_NULL>>4: x = 0; break;
 		default:
@@ -333,7 +333,7 @@
 			NOT_REACHED();
 		}
 	} else {
-		
+
 		// Read a value from the file
 		switch(conv & 0xF) {
 		case SLE_FILE_I8: x = (int8)SlReadByte();	break;
@@ -441,7 +441,7 @@
 
 			switch(cmd&3) {
 			// Normal variable
-			case 0: length += SlCalcConvLen(conv, NULL);break;			
+			case 0: length += SlCalcConvLen(conv, NULL);break;
 			// Reference
 			case 1: length += 2; break;
 			// Array
@@ -509,7 +509,7 @@
 			case 2:	SlArray(ptr, *d++, conv); break;
 			default:NOT_REACHED();
 			}
-	
+
 		// Write byte.
 		} else if (cmd == 8) {
 			if (_sl.save) {
@@ -592,7 +592,7 @@
 
 	_sl.block_mode = m;
 	_sl.obj_len = 0;
-	
+
 	switch(m) {
 	case CH_ARRAY:
 		_sl.array_index = 0;
@@ -641,7 +641,7 @@
 		_tmp_proc_1 = proc;
 		proc = SlStubSaveProc;
 	}
-	
+
 	_sl.block_mode = ch->flags & CH_TYPE_MASK;
 	switch(ch->flags & CH_TYPE_MASK) {
 	case CH_RIFF:
@@ -674,7 +674,7 @@
 		for(chsc=_sl.chs;(ch=*chsc++) != NULL;) {
 			while(true) {
 				if (((ch->flags >> CH_PRI_SHL) & (CH_NUM_PRI_LEVELS - 1)) == p)
-					SlSaveChunk(ch);	
+					SlSaveChunk(ch);
 				if (ch->flags & CH_LAST)
 					break;
 				ch++;
@@ -741,7 +741,7 @@
 
 	// Check if size is bad
 	((uint32*)out)[0] = size = tmp[1];
-	
+
 	if (_sl.version != 0) {
 		tmp[0] = TO_BE32(tmp[0]);
 		size = TO_BE32(size);
@@ -754,7 +754,7 @@
 
 	// Verify checksum
 	if (tmp[0] != lzo_adler32(0, out, size + sizeof(uint32))) SlError("bad checksum");
-	
+
 	// Decompress
 	lzo1x_decompress(out + sizeof(uint32)*1, size, _sl.buf, &len, NULL);
 	return len;
@@ -767,7 +767,7 @@
 	byte out[LZO_SIZE + LZO_SIZE / 64 + 16 + 3 + 8];
 	byte wrkmem[sizeof(byte*)*4096];
 	uint outlen;
-	
+
 	lzo1x_1_compress(_sl.buf, size, out + sizeof(uint32)*2, &outlen, wrkmem);
 	((uint32*)out)[1] = TO_BE32(outlen);
 	((uint32*)out)[0] = TO_BE32(lzo_adler32(0, out + sizeof(uint32), outlen + sizeof(uint32)));
@@ -821,7 +821,7 @@
 {
 	memset(&_z, 0, sizeof(_z));
 	if (inflateInit(&_z) != Z_OK) return false;
-	
+
 	_sl.bufsize = 4096;
 	_sl.buf = (byte*)malloc(4096 + 4096); // also contains fread buffer
 	return true;
@@ -845,7 +845,7 @@
 		if (r == Z_STREAM_END)
 			break;
 
-		if (r != Z_OK) 
+		if (r != Z_OK)
 			SlError("inflate() failed");
 	} while (_z.avail_out);
 
@@ -1020,7 +1020,7 @@
 	uint32 hdr[2];
 	const SaveLoadFormat *fmt;
   uint version;
-		
+
 	// old style load
 	if (mode == SL_OLD_LOAD) {
 		InitializeGame();
@@ -1028,11 +1028,11 @@
 		AfterLoadGame(0);
 		return SL_OK;
 	}
-	
+
 	_sl.fh = fopen(filename, mode?"wb":"rb");
 	if (_sl.fh == NULL)
 		return SL_ERROR;
-	
+
 	_sl.bufe = _sl.bufp = NULL;
 	_sl.offs_base = 0;
 	_sl.int_to_ref_proc = IntToReference;
@@ -1060,23 +1060,23 @@
 		}
 	}
 
-  // we first initialize here to avoid: "warning: variable `version' might 
+  // we first initialize here to avoid: "warning: variable `version' might
   // be clobbered by `longjmp' or `vfork'"
 	version = 0;
 
 	if (mode != SL_LOAD) {
 		fmt = GetSavegameFormat(_savegame_format);
-		
+
 		_sl.write_bytes = fmt->writer;
 		_sl.excpt_uninit = fmt->uninit_write;
 		if (!fmt->init_write()) goto init_err;
-		
+
 		hdr[0] = fmt->tag;
 		hdr[1] = TO_BE32((SAVEGAME_MAJOR_VERSION<<16) + (SAVEGAME_MINOR_VERSION << 8));
 		if (fwrite(hdr, sizeof(hdr), 1, _sl.fh) != 1) SlError("file write failed");
-		
+
 		_sl.version = SAVEGAME_MAJOR_VERSION;
-		
+
 		BeforeSaveGame();
 		SlSaveChunks();
 		SlWriteFill(); // flush the save buffer
@@ -1104,7 +1104,7 @@
 			if (fmt->tag == hdr[0]) {
 				// check version number
 				version = TO_BE32(hdr[1]) >> 8;
-				
+
 				// incompatible version?
 				if (version > SAVEGAME_LOADABLE_VERSION) goto read_err;
 				_sl.version = (version>>8);
--- a/screenshot.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/screenshot.c	Fri Sep 10 19:02:27 2004 +0000
@@ -23,7 +23,7 @@
 #pragma pack(push, 1)
 #endif
 
-typedef struct BitmapFileHeader { 
+typedef struct BitmapFileHeader {
 	uint16 type;
 	uint32 size;
 	uint32 reserved;
@@ -113,12 +113,12 @@
 		// determine # lines
 		n = min(h, maxlines);
 		h -= n;
-		
+
 		// render the pixels
 		callb(userdata, buff, h, padw, n);
-		
-		// write each line 
-		while (n) 
+
+		// write each line
+		while (n)
 			fwrite(buff + (--n) * padw, 1, padw, f);
 	} while (h);
 
@@ -182,10 +182,10 @@
 	}
 
 	png_init_io(png_ptr, f);
-	
+
 	png_set_filter(png_ptr, 0, PNG_FILTER_NONE);
 
-	png_set_IHDR(png_ptr, info_ptr, w, h, pixelformat, PNG_COLOR_TYPE_PALETTE, PNG_INTERLACE_NONE, 
+	png_set_IHDR(png_ptr, info_ptr, w, h, pixelformat, PNG_COLOR_TYPE_PALETTE, PNG_INTERLACE_NONE,
 		PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
 
 	// convert the palette to the .PNG format.
@@ -215,7 +215,7 @@
 	do {
 		// determine # lines to write
 		n = min(h - y, maxlines);
-		
+
 		// render the pixels into the buffer
 		callb(userdata, buff, y, w, n);
 		y += n;
@@ -272,7 +272,7 @@
 	if (f == NULL) return false;
 
 	memset(&pcx, 0, sizeof(pcx));
-	
+
 	// setup pcx header
 	pcx.manufacturer = 10;
 	pcx.version = 5;
@@ -287,7 +287,7 @@
 	pcx.cpal = TO_LE16(1);
 	pcx.width = pcx.pitch = TO_LE16(w);
 	pcx.height = TO_LE16(h);
-	
+
 	// write pcx header
 	fwrite(&pcx, sizeof(pcx), 1, f);
 
@@ -302,7 +302,7 @@
 	do {
 		// determine # lines to write
 		uint n = min(h - y, maxlines), i;
-		
+
 		// render the pixels into the buffer
 		callb(userdata, buff, y, w, n);
 		y += n;
@@ -314,7 +314,7 @@
 			byte runchar = buff[0];
 			uint left = w - 1;
 
-			// for each pixel... 
+			// for each pixel...
 			while (left) {
 				byte ch = *bufp++;
 				if (ch != runchar || runcount >= 0x3f) {
@@ -334,7 +334,7 @@
 	} while (y != h);
 
 	// write 8-bit color palette
-	fputc(12, f); 
+	fputc(12, f);
 	fwrite(palette, 256*3, 1, f);
 	fclose(f);
 
@@ -404,8 +404,8 @@
 	while (vp->width - left != 0) {
 		wx = min(vp->width - left, 1600);
 		left += wx;
-		
-		ViewportDoDraw(vp, 
+
+		ViewportDoDraw(vp,
 			((left - wx - vp->left) << vp->zoom) + vp->virtual_left,
 			((y - vp->top) << vp->zoom) + vp->virtual_top,
 			((left - vp->left) << vp->zoom) + vp->virtual_left,
@@ -437,7 +437,7 @@
 
 	serial = 0;
 	for(;;) {
-		snprintf(filename, sizeof(filename), "%s%s", _path.personal_dir, _screenshot_name);	
+		snprintf(filename, sizeof(filename), "%s%s", _path.personal_dir, _screenshot_name);
 		if (!FileExists(filename))
 			break;
 		sprintf(base, " #%d.%s", ++serial, ext);
@@ -451,7 +451,7 @@
 bool MakeScreenshot()
 {
 	const ScreenshotFormat *sf = _screenshot_formats + _cur_screenshot_format;
-	return sf->proc(MakeScreenshotName(sf->extension), CurrentScreenCallback, NULL, _screen.width, _screen.height, 8, _cur_palette); 
+	return sf->proc(MakeScreenshotName(sf->extension), CurrentScreenCallback, NULL, _screen.width, _screen.height, 8, _cur_palette);
 }
 
 bool MakeWorldScreenshot(int left, int top, int width, int height, int zoom)
--- a/sdl.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/sdl.c	Fri Sep 10 19:02:27 2004 +0000
@@ -23,7 +23,7 @@
 static SDL_Rect _dirty_rects[MAX_DIRTY_RECTS];
 static int _num_dirty_rects;
 
-#define SDL_CALL    
+#define SDL_CALL
 
 #if defined(DYNAMICALLY_LOADED_SDL) && defined(WIN32)
 
@@ -60,7 +60,7 @@
 } SDLProcs;
 
 #define M(x) x "\0"
-static const char sdl_files[] = 
+static const char sdl_files[] =
 	M("sdl.dll")
 	M("SDL_Init")
 	M("SDL_InitSubSystem")
@@ -97,7 +97,7 @@
 
 static char *LoadSdlDLL()
 {
-	if (_proc.SDL_Init != NULL) 
+	if (_proc.SDL_Init != NULL)
 		return NULL;
 	if (!LoadLibraryList((void**)&_proc, sdl_files))
 		return "Unable to load sdl.dll";
@@ -247,7 +247,7 @@
 		for(i = 0; modes[i]; i++) {
 			int w = modes[i]->w;
 			int h = modes[i]->h;
-			if (IS_INT_INSIDE(w, 640, MAX_SCREEN_WIDTH+1) && 
+			if (IS_INT_INSIDE(w, 640, MAX_SCREEN_WIDTH+1) &&
 					IS_INT_INSIDE(h, 480, MAX_SCREEN_HEIGHT+1) &&
 					w%8 == 0 && h%8 == 0) { // disable screen resolutions which are not multiples of 8
 				int j;
@@ -363,7 +363,7 @@
 	AS(SDLK_KP_PLUS,			WKC_NUM_PLUS),
 	AS(SDLK_KP_ENTER,			WKC_NUM_ENTER),
 	AS(SDLK_KP_PERIOD,		WKC_NUM_DECIMAL),
-	{0, 0, 0}	
+	{0, 0, 0}
 };
 
 static uint32 ConvertSdlKeyIntoMy(SDL_keysym *sym)
@@ -376,7 +376,7 @@
 		from = map->vk_from;
 		if (from == 0) {
 			key = 0;
-			break;		
+			break;
 		}
 		if ((uint)(key - from) <= map->vk_count) {
 			key = key - from + map->map_to;
@@ -444,7 +444,7 @@
 			_right_button_down = true;
 			_right_button_clicked = true;
 		}
-#if !defined(WIN32)		
+#if !defined(WIN32)
 		 else if (ev.button.button == SDL_BUTTON_WHEELUP) {
 			_cursor.wheel--;
 		} else if (ev.button.button == SDL_BUTTON_WHEELDOWN) {
@@ -479,17 +479,17 @@
 			_pressed_key = ConvertSdlKeyIntoMy(&ev.key.keysym);
 		}
 		break;
-		
+
 	case SDL_VIDEORESIZE: {
 			int w, h;
 			w = ev.resize.w;
 			h = ev.resize.h;
-			
+
 			w = clamp(w & ~0x7, 64, MAX_SCREEN_WIDTH);
 			h = clamp(h & ~0x7, 64, MAX_SCREEN_HEIGHT);
-			
+
 			ChangeResInGame(w, h);
-			
+
 			break;
 		}
 	}
@@ -529,14 +529,14 @@
 
 	while (true) {
 		InteractiveRandom(); // randomness
-		
+
 		while ((i=PollEvent()) == -1) {}
 		if (i>=0) return i;
 
 		if (_exit_game)	return ML_QUIT;
 
 		mod = SDL_CALL SDL_GetModState();
-		keys = SDL_CALL SDL_GetKeyState(&numkeys);		
+		keys = SDL_CALL SDL_GetKeyState(&numkeys);
 #if defined(_DEBUG)
 		if (_shift_pressed) {
 #else
@@ -556,12 +556,12 @@
 
 			_ctrl_pressed = !!(mod & (KMOD_LCTRL | KMOD_RCTRL));
 			_shift_pressed = !!(mod & (KMOD_LSHIFT | KMOD_RSHIFT));
-			
+
 			// determine which directional keys are down
-			_dirkeys = 
-			    (keys[SDLK_LEFT] ? 1 : 0) + 
-			    (keys[SDLK_UP] ? 2 : 0) + 
-			    (keys[SDLK_RIGHT] ? 4 : 0) + 
+			_dirkeys =
+			    (keys[SDLK_LEFT] ? 1 : 0) +
+			    (keys[SDLK_UP] ? 2 : 0) +
+			    (keys[SDLK_RIGHT] ? 4 : 0) +
 			    (keys[SDLK_DOWN] ? 8 : 0);
 			GameLoop();
 
@@ -607,7 +607,7 @@
 static char *SdlSoundStart(char **parm)
 {
 	SDL_AudioSpec spec;
-	
+
 	{char *s;if ((s = SdlOpen(SDL_INIT_AUDIO)) != NULL) return s;}
 	spec.freq = GetDriverParamInt(parm, "hz", 11025);
 	spec.format = AUDIO_S16SYS;
--- a/settings.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/settings.c	Fri Sep 10 19:02:27 2004 +0000
@@ -50,7 +50,7 @@
 {
 	MemoryPool *p;
 	if (minsize < 4096 - 12) minsize = 4096 - 12;
-	
+
 	p = malloc(sizeof(MemoryPool) - 1 + minsize);
 	p->pos = 0;
 	p->size = minsize;
@@ -78,7 +78,7 @@
 		MemoryPool *n = pool_new(size);
 		*pool = n;
 		n->next = p;
-		p = n;		
+		p = n;
 	}
 
 	pos = p->pos;
@@ -188,7 +188,7 @@
 
 	// for each line in the file
 	while (fgets(buffer, sizeof(buffer), in)) {
-		
+
 		// trim whitespace from the left side
 		for(s=buffer; *s == ' ' || *s == '\t'; s++);
 
@@ -230,7 +230,7 @@
 		} else if (group) {
 			// find end of keyname
 			for(t=s; *t != 0 && *t != '=' && *t != '\t' && *t != ' '; t++) {}
-						
+
 			// it's an item in an existing group
 			item = ini_item_alloc(group, s, t-s);
 			if (comment_size) {
@@ -285,7 +285,7 @@
 	for(item = group->item; item; item = item->next)
 		if (!strcmp(item->name, name))
 			return item;
-	
+
 	if (!create) return NULL;
 
 	// otherwise make a new one
@@ -299,7 +299,7 @@
 	FILE *f;
 	IniGroup *group;
 	IniItem *item;
-	
+
 	f = fopen(filename, "w");
 	if (f == NULL) return false;
 
@@ -328,7 +328,7 @@
 	void *def;
 	void *ptr;
 	void *b;
-	
+
 };
 
 static int lookup_oneofmany(const char *many, const char *one, int onelen)
@@ -341,7 +341,7 @@
 	// check if it's an integer
 	if (*one >= '0' && *one <= '9')
 		return strtoul(one, NULL, 0);
-		
+
 	idx = 0;
 	for(;;) {
 		// find end of item
@@ -400,7 +400,7 @@
 {
 	int items[64];
 	int i,nitems;
-	
+
 	if (str == NULL) {
 		memset(items, 0, sizeof(items));
 		nitems = nelems;
@@ -522,7 +522,7 @@
 			return (void*)false;
 		ShowInfoF("ini: invalid setting value '%s' for '%s'", str, desc->name);
 		break;
-	
+
 	case SDT_STRING:
 	case SDT_STRINGBUF:
 	case SDT_INTLIST:
@@ -549,14 +549,14 @@
 			s = desc->name;
 			group = group_def;
 		}
-		
+
 		item = ini_getitem(group, s, false);
 		if (!item) {
 			p = desc->def;
 		} else {
 			p = string_to_val(desc, item->value);
 		}
-		
+
 		// get ptr to array
 		ptr = desc->ptr;
 		if ( (uint32)ptr < 0x10000)
@@ -600,7 +600,7 @@
 		default:
 			NOT_REACHED();
 		}
-	}	
+	}
 }
 
 static void save_setting_desc(IniFile *ini, const SettingDesc *desc, void *grpname, void *base)
@@ -615,7 +615,7 @@
 	for (;desc->name;desc++) {
 		if (desc->flags & SDT_NOSAVE)
 			continue;
-		
+
 		// group override?
 		s = strchr(desc->name, '.');
 		if (s) {
@@ -627,16 +627,16 @@
 			s = desc->name;
 			group = group_def;
 		}
-		
+
 		item = ini_getitem(group, s, true);
 
 		// get ptr to array
 		ptr = desc->ptr;
 		if ( (uint32)ptr < 0x10000)
 			ptr = (byte*)base + (uint32)ptr;
-		
+
 		if (item->value != NULL) {
-			// check if the value is the same as the old value	
+			// check if the value is the same as the old value
 			p = string_to_val(desc, item->value);
 
 			switch(desc->flags & 0xF) {
@@ -658,7 +658,7 @@
 				case SDT_INT32 >> 4:
 				case SDT_UINT32 >> 4:
 					if (*(uint32*)ptr == (uint32)p)
-						continue;	
+						continue;
 					break;
 				default:
 					NOT_REACHED();
@@ -717,7 +717,7 @@
 		}
 		// the value is different, that means we have to write it to the ini
 		item->value = pool_strdup(&ini->pool, buf, strlen(buf));
-	}	
+	}
 }
 
 //***************************
@@ -826,7 +826,7 @@
 	{"nonuniform_stations",	SDT_BOOL,		(void*)false, (void*)offsetof(Patches, nonuniform_stations),	NULL},
 	{"always_small_airport",SDT_BOOL,		(void*)false, (void*)offsetof(Patches, always_small_airport),	NULL},
 	{"realistic_acceleration",SDT_BOOL, (void*)false, (void*)offsetof(Patches, realistic_acceleration),	NULL},
-	
+
 	{"toolbar_pos",					SDT_UINT8,	(void*)0,			(void*)offsetof(Patches, toolbar_pos),					NULL},
 
 	{"max_trains",					SDT_UINT8,	(void*)80,		(void*)offsetof(Patches, max_trains),						NULL},
@@ -848,7 +848,7 @@
 	{"pf_maxlength",				SDT_UINT16, (void*)512,		(void*)offsetof(Patches, pf_maxlength),					NULL},
 	{"pf_maxdepth",					SDT_UINT8,	(void*)16,		(void*)offsetof(Patches, pf_maxdepth),					NULL},
 
-	
+
 	{"ai_disable_veh_train",SDT_BOOL,		(void*)false, (void*)offsetof(Patches, ai_disable_veh_train),	NULL},
 	{"ai_disable_veh_roadveh",SDT_BOOL,	(void*)false, (void*)offsetof(Patches, ai_disable_veh_roadveh),	NULL},
 	{"ai_disable_veh_aircraft",SDT_BOOL,(void*)false, (void*)offsetof(Patches, ai_disable_veh_aircraft),NULL},
@@ -875,7 +875,7 @@
 
 	{"wait_oneway_signal",	SDT_UINT8,	(void*)15,		(void*)offsetof(Patches, wait_oneway_signal),		NULL},
 	{"wait_twoway_signal",	SDT_UINT8,	(void*)41,		(void*)offsetof(Patches, wait_twoway_signal),		NULL},
-	
+
 	{"ainew_active",				SDT_BOOL,		(void*)false, (void*)offsetof(Patches, ainew_active),					NULL},
 
 	{"drag_signals_density",SDT_UINT8,	(void*)4,			(void*)offsetof(Patches, drag_signals_density), NULL},
--- a/settings_gui.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/settings_gui.c	Fri Sep 10 19:02:27 2004 +0000
@@ -117,11 +117,11 @@
 			// setup screenshot format dropdown
 			ShowDropDownMenu(w, BuildDynamicDropdown(SPECSTR_SCREENSHOT_START, _num_screenshot_formats), _cur_screenshot_format, e->click.widget, 0);
 			return;
-			
+
 		}
 		break;
 
-	case WE_DROPDOWN_SELECT: 
+	case WE_DROPDOWN_SELECT:
 		switch(e->dropdown.button) {
 		case 20:
 			if (e->dropdown.index == 0) {
@@ -220,7 +220,7 @@
 {   WWT_CLOSEBOX,    14,   130,   349,   202,   213, STR_02C0_SAVE_CUSTOM_NAMES_TO_DISK,	STR_02C2_SAVE_CUSTOMIZED_VEHICLE},
 
 {      WWT_FRAME,    14,   190,   359,   104,   139, STR_OPTIONS_LANG,				STR_NULL},
-{          WWT_6,    14,   200,   349,   118,   129, STR_OPTIONS_LANG_CBO,		STR_OPTIONS_LANG_TIP}, 
+{          WWT_6,    14,   200,   349,   118,   129, STR_OPTIONS_LANG_CBO,		STR_OPTIONS_LANG_TIP},
 {   WWT_CLOSEBOX,    14,   338,   348,   119,   128, STR_0225,								STR_OPTIONS_LANG_TIP},
 {      WWT_FRAME,    14,    10,   179,   146,   181, STR_OPTIONS_RES,					STR_NULL},
 {          WWT_6,    14,    20,   169,   160,   171, STR_OPTIONS_RES_CBO,			STR_OPTIONS_RES_TIP},
@@ -354,7 +354,7 @@
 			uint btn, dis;
 			int val;
 			const GameSettingData *info;
-			
+
 			x = e->click.pt.x - 5;
 			if (!IS_INT_INSIDE(x, 0, 21))
 				return;
@@ -470,7 +470,7 @@
 	 */
 	memcpy(&_opt_mod_temp, _opt_mod_ptr, sizeof(GameOptions));
 	AllocateWindowDesc(&_game_difficulty_desc);
-}	
+}
 
 void ShowHighscoreTable(int tbl)
 {
@@ -490,7 +490,7 @@
 {
   if (p1 == 1)
     ShowErrorMessage(-1, TEMP_AI_ACTIVATED, 0, 0);
-    
+
   return 0;
 }
 
@@ -511,14 +511,14 @@
 {
 	bool warning;
 	if (p1) {
-		warning = ( (IS_INT_INSIDE(_patches.servint_trains,   5, 90+1) || _patches.servint_trains   == 0) && 
+		warning = ( (IS_INT_INSIDE(_patches.servint_trains,   5, 90+1) || _patches.servint_trains   == 0) &&
 								(IS_INT_INSIDE(_patches.servint_roadveh,  5, 90+1) || _patches.servint_roadveh  == 0) &&
-								(IS_INT_INSIDE(_patches.servint_aircraft, 5, 90+1) || _patches.servint_aircraft == 0) && 
+								(IS_INT_INSIDE(_patches.servint_aircraft, 5, 90+1) || _patches.servint_aircraft == 0) &&
 								(IS_INT_INSIDE(_patches.servint_ships,    5, 90+1) || _patches.servint_ships    == 0) );
 	} else {
-		warning = ( (IS_INT_INSIDE(_patches.servint_trains,   30, 800+1) || _patches.servint_trains   == 0) && 
+		warning = ( (IS_INT_INSIDE(_patches.servint_trains,   30, 800+1) || _patches.servint_trains   == 0) &&
 								(IS_INT_INSIDE(_patches.servint_roadveh,  30, 800+1) || _patches.servint_roadveh  == 0) &&
-								(IS_INT_INSIDE(_patches.servint_aircraft, 30, 800+1) || _patches.servint_aircraft == 0) && 
+								(IS_INT_INSIDE(_patches.servint_aircraft, 30, 800+1) || _patches.servint_aircraft == 0) &&
 								(IS_INT_INSIDE(_patches.servint_ships,    30, 800+1) || _patches.servint_ships    == 0) );
 	}
 
@@ -560,7 +560,7 @@
 	{PE_BOOL,		0, STR_CONFIG_PATCHES_AUTOSCROLL,				&_patches.autoscroll,								0,  0,  0, NULL},
 
 	{PE_UINT8,	0, STR_CONFIG_PATCHES_ERRMSG_DURATION,	&_patches.errmsg_duration,					0, 20,  1, NULL},
-	
+
 	{PE_UINT8,	PF_MULTISTRING, STR_CONFIG_PATCHES_TOOLBAR_POS, &_patches.toolbar_pos,			0,  2,  1, &v_PositionMainToolbar},
 	{PE_BOOL,		0, STR_CONFIG_PATCHES_INVISIBLE_TREES,	&_patches.invisible_trees,					0,  1,  1, &InvisibleTreesActive},
 };
@@ -570,7 +570,7 @@
 	{PE_BOOL,		0, STR_CONFIG_PATCHES_EXTRADYNAMITE,		&_patches.extra_dynamite,						0,  0,  0, NULL},
 	{PE_BOOL,		0, STR_CONFIG_PATCHES_LONGBRIDGES,			&_patches.longbridges,							0,  0,  0, NULL},
 	{PE_BOOL,		0, STR_CONFIG_PATCHES_SIGNALSIDE,				&_patches.signal_side,							0,  0,  0, NULL},
-	
+
 	{PE_BOOL,		0, STR_CONFIG_PATCHES_SMALL_AIRPORTS,		&_patches.always_small_airport,			0,  0,  0, NULL},
 	{PE_UINT8,	0, STR_CONFIG_PATCHES_DRAG_SIGNALS_DENSITY, &_patches.drag_signals_density, 1, 20,  1, NULL},
 
@@ -622,7 +622,7 @@
 	{PE_BOOL,		0, STR_CONFIG_PATCHES_SAMEINDCLOSE,			&_patches.same_industry_close,			0,  0,  0, NULL},
 	{PE_BOOL,		0, STR_CONFIG_PATCHES_BRIBE,						&_patches.bribe,										0,  0,  0, NULL},
 	{PE_UINT8,	0, STR_CONFIG_PATCHES_SNOWLINE_HEIGHT,	&_patches.snow_line_height,					2, 13,  1, NULL},
-	
+
 	{PE_INT32,	PF_NOCOMMA, STR_CONFIG_PATCHES_COLORED_NEWS_DATE, &_patches.colored_news_date, 1900, 2200, 5, NULL},
 	{PE_INT32,	PF_NOCOMMA, STR_CONFIG_PATCHES_STARTING_DATE, &_patches.starting_date,	 1920,2100, 1, NULL},
 
@@ -666,7 +666,7 @@
 	default:
 		NOT_REACHED();
 	}
-  
+
 	/* useless, but avoids compiler warning this way */
 	return 0;
 }
@@ -682,36 +682,36 @@
 	switch(pe->type) {
 	case PE_BOOL: *(bool*)pe->variable = (bool)val; break;
 
-	case PE_UINT8: if ((uint8)val > (uint8)pe->max) 
+	case PE_UINT8: if ((uint8)val > (uint8)pe->max)
 									*(uint8*)pe->variable = (uint8)pe->max;
 								else if ((uint8)val < (uint8)pe->min)
 									*(uint8*)pe->variable = (uint8)pe->min;
 								else
-									*(uint8*)pe->variable = (uint8)val; 
+									*(uint8*)pe->variable = (uint8)val;
 								break;
 
-	case PE_INT16: if ((int16)val > (int16)pe->max) 
+	case PE_INT16: if ((int16)val > (int16)pe->max)
 									*(int16*)pe->variable = (int16)pe->max;
 								else if ((int16)val < (int16)pe->min)
 									*(int16*)pe->variable = (int16)pe->min;
 								else
-									*(int16*)pe->variable = (int16)val; 
+									*(int16*)pe->variable = (int16)val;
 								break;
 
-	case PE_UINT16: if ((uint16)val > (uint16)pe->max) 
+	case PE_UINT16: if ((uint16)val > (uint16)pe->max)
 									*(uint16*)pe->variable = (uint16)pe->max;
 								else if ((uint16)val < (uint16)pe->min)
 									*(uint16*)pe->variable = (uint16)pe->min;
 								else
-									*(uint16*)pe->variable = (uint16)val; 
+									*(uint16*)pe->variable = (uint16)val;
 								break;
 
-	case PE_INT32: if ((int32)val > (int32)pe->max) 
+	case PE_INT32: if ((int32)val > (int32)pe->max)
 									*(int32*)pe->variable = (int32)pe->max;
 								else if ((int32)val < (int32)pe->min)
 									*(int32*)pe->variable = (int32)pe->min;
 								else
-									*(int32*)pe->variable = val; 
+									*(int32*)pe->variable = val;
 								break;
 
 	case PE_CURRENCY: val /= GetCurrentCurrencyRate();
@@ -791,7 +791,7 @@
 
 			y = e->click.pt.y - 46 - 1;
 			if (y < 0) return;
-			
+
 			btn = y / 11;
 			if (y % 11 > 9) return;
 
@@ -836,13 +836,13 @@
 							if (val < pe->min) val = pe->min;
 						}
 					}
-					
+
 					if (val != oval) {
 						WP(w,def_d).data_2 = btn * 2 + 1 + ((x>=10) ? 1 : 0);
 						w->flags4 |= 5 << WF_TIMEOUT_SHL;
 						_left_button_clicked = false;
 					}
-					break;				
+					break;
 				}
 				if (val != oval) {
 					WritePE(pe, val);
@@ -858,7 +858,7 @@
 					ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_CONFIG_PATCHES_QUERY_CAPT, 10, 100, WC_GAME_OPTIONS, 0);
 				}
 			}
-			
+
 			break;
 		}
 		case 4: case 5: case 6: case 7: case 8: case 9:
@@ -878,7 +878,7 @@
 		if (*e->edittext.str) {
 			const PatchPage *page = &_patches_page[WP(w,def_d).data_1];
 			const PatchEntry *pe = &page->entries[WP(w,def_d).data_3];
-			WritePE(pe, atoi(e->edittext.str)); 
+			WritePE(pe, atoi(e->edittext.str));
 			SetWindowDirty(w);
 
 			if (pe->click_proc != NULL) // call callback function
--- a/ship_cmd.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/ship_cmd.c	Fri Sep 10 19:02:27 2004 +0000
@@ -93,7 +93,7 @@
 
 	if (v->vehstatus & VS_STOPPED)
 		return;
-	
+
 	if ((v->next_order & (OT_MASK | OF_FULL_LOAD)) == (OT_GOTO_DEPOT | OF_FULL_LOAD))
 		return;
 
@@ -113,7 +113,7 @@
 	v->next_order = OT_GOTO_DEPOT | OF_NON_STOP;
 	v->next_order_param = (byte)i;
 	v->dest_tile = (&_depots[i])->xy;
-	InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, 4);		
+	InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, 4);
 }
 
 void OnNewDay_Ship(Vehicle *v)
@@ -128,11 +128,11 @@
 	CheckIfShipNeedsService(v);
 
 	CheckOrders(v);
-	
+
 	if (v->vehstatus & VS_STOPPED)
 		return;
 
-	
+
 
 	cost = ship_vehicle_info(v->engine_type).running_cost * _price.ship_running / 364;
 	v->profit_this_year -= cost >> 8;
@@ -152,10 +152,10 @@
 
 		if (v->breakdowns_since_last_service != 255)
 			v->breakdowns_since_last_service++;
-		
+
 		InvalidateWindow(WC_VEHICLE_VIEW, v->index);
 		InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
-		
+
 		SndPlayVehicleFx((_opt.landscape != LT_CANDY) ? 0xE : 0x3A, v);
 
 		if (!(v->vehstatus & VS_HIDDEN)) {
@@ -231,7 +231,7 @@
 	if ((order & OT_MASK) == OT_GOTO_STATION) {
 		if ( (byte)(order >> 8) == v->last_station_visited)
 			v->last_station_visited = 0xFF;
-		
+
 		st = DEREF_STATION(order >> 8);
 		if (st->dock_tile != 0) {
 			v->dest_tile = TILE_ADD(st->dock_tile, _dock_offs[_map5[st->dock_tile]-0x4B]);
@@ -248,7 +248,7 @@
 {
 	if (v->next_order == OT_NOTHING)
 		return;
-	
+
 	if (v->next_order != OT_DUMMY) {
 		if ((v->next_order&OT_MASK) != OT_LOADING)
 			return;
@@ -265,7 +265,7 @@
 			return;
 		}
 		PlayShipSound(v);
-		
+
 		{
 			byte b = v->next_order;
 			v->next_order = OT_LEAVESTATION;
@@ -352,7 +352,7 @@
 
 	//updates statusbar only if speed have changed to save CPU time
 	if (spd != v->cur_speed) {
-		v->cur_speed = spd;	
+		v->cur_speed = spd;
 		if (_patches.vehicle_speed)
 			InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, 4);
 	}
@@ -384,7 +384,7 @@
 	v->vehstatus |= VS_HIDDEN;
 	v->cur_speed = 0;
 	RecalcShipStuff(v);
-	
+
 	v->date_of_last_service = _date;
 	v->breakdowns_since_last_service = 0;
 	v->reliability = _engines[v->engine_type].reliability;
@@ -394,7 +394,7 @@
 
 	if ((v->next_order&OT_MASK) == OT_GOTO_DEPOT) {
 		InvalidateWindow(WC_VEHICLE_VIEW, v->index);
-	
+
 		t = v->next_order;
 		v->next_order = OT_DUMMY;
 
@@ -444,7 +444,7 @@
 	// Found dest?
 	if (tile == pfs->dest_coords) {
 		pfs->best_bird_dist = 0;
-		
+
 //		if (length < pfs->best_length)
 //			dbg_store_path();
 
@@ -456,7 +456,7 @@
 	if (tile != pfs->skiptile) {
 		pfs->best_bird_dist = minu(pfs->best_bird_dist, GetTileDist1Db(pfs->dest_coords, tile));
 	}
-	
+
 	return false;
 }
 
@@ -488,12 +488,12 @@
 	do {
 		i = FIND_FIRST_BIT(bits);
 		bits = KILL_FIRST_BIT(bits);
-		
+
 		pfs.best_bird_dist = (uint)-1;
 		pfs.best_length = (uint)-1;
 
 		FollowTrack(tile, 0x3800 | TRANSPORT_WATER, _ship_search_directions[i][dir], (TPFEnumProc*)ShipTrackFollower, NULL, &pfs);
-		
+
 		if (best_track >= 0) {
 			if (pfs.best_bird_dist != 0) {
 				/* neither reached the destination, pick the one with the smallest bird dist */
@@ -503,8 +503,8 @@
 				if (pfs.best_length > best_length) goto bad;
 				if (pfs.best_length < best_length) goto good;
 			}
-			
-			/* if we reach this position, there's two paths of equal value so far. 
+
+			/* if we reach this position, there's two paths of equal value so far.
 			 * pick one randomly. */
 			r = (byte)Random();
 			if (_pick_shiptrack_table[i] == ship_dir) r += 80;
@@ -554,7 +554,7 @@
 
 static int ShipGetNewDirectionFromTiles(uint new_tile, uint old_tile)
 {
-	uint offs = (GET_TILE_Y(new_tile) - GET_TILE_Y(old_tile) + 1) * 4 + 
+	uint offs = (GET_TILE_Y(new_tile) - GET_TILE_Y(old_tile) + 1) * 4 +
 							GET_TILE_X(new_tile) - GET_TILE_X(old_tile) + 1;
 	assert(offs < 11 && offs != 3 && offs != 7);
 	return _new_vehicle_direction_table[offs];
@@ -707,7 +707,7 @@
 			goto reverse_direction;
 
 		b = _ship_subcoord[dir][track];
-	
+
 		gp.x = (gp.x&~0xF) | b[0];
 		gp.y = (gp.y&~0xF) | b[1];
 
@@ -794,7 +794,7 @@
 	uint unit_num;
 	uint tile = TILE_FROM_XY(x,y);
 	Engine *e;
-	
+
 	SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
 
 	value = EstimateShipCost(p1);
@@ -802,10 +802,10 @@
 		return value;
 
 	v = AllocateVehicle();
-	if (v == NULL || _ptr_to_next_order >= endof(_order_array) || 
+	if (v == NULL || _ptr_to_next_order >= endof(_order_array) ||
 			(unit_num = GetFreeUnitNumber(VEH_Ship)) > _patches.max_ships)
 		return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
-	
+
 	if (flags & DC_EXEC) {
 		v->unitnumber = unit_num;
 
@@ -823,12 +823,12 @@
 		v->x_offs = -3;
 		v->y_offs = -3;
 		v->vehstatus = VS_HIDDEN | VS_STOPPED | VS_DEFPAL;
-		
+
 		v->spritenum = ship_vehicle_info(p1).image_index;
 		v->cargo_type = ship_vehicle_info(p1).cargo_type;
 		v->cargo_cap = ship_vehicle_info(p1).capacity;
 		v->value = value;
-		
+
 		v->last_station_visited = 255;
 		v->max_speed = ship_vehicle_info(p1).max_speed;
 		v->engine_type = (byte)p1;
@@ -856,7 +856,7 @@
 		InvalidateWindow(WC_SHIPS_LIST, v->owner);
 		InvalidateWindow(WC_COMPANY, v->owner);
 	}
-	
+
 	return value;
 }
 
@@ -865,7 +865,7 @@
 	Vehicle *v;
 
 	SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
-	
+
 	v = &_vehicles[p1];
 
 	if (!CheckOwnership(v->owner))
@@ -873,7 +873,7 @@
 
 	if (!IsShipDepotTile(v->tile) || v->u.road.state != 0x80 || !(v->vehstatus&VS_STOPPED))
 		return_cmd_error(STR_980B_SHIP_MUST_BE_STOPPED_IN);
-	
+
 	if (flags & DC_EXEC) {
 		InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
 		_vehicle_sort_dirty[VEHSHIP] = true; // sell a ship
@@ -882,7 +882,7 @@
 		DeleteWindowById(WC_VEHICLE_VIEW, v->index);
 		DeleteVehicle(v);
 	}
-	
+
 	return -(int32)v->value;
 }
 
@@ -919,7 +919,7 @@
 		if (flags & DC_EXEC) {
 			if (v->next_order&OF_UNLOAD) {v->cur_order_index++;}
 			v->next_order = OT_DUMMY;
-			InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, 4);			
+			InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, 4);
 		}
 	} else {
 		depot = FindClosestShipDepot(v);
@@ -963,7 +963,7 @@
 	int32 cost;
 
 	SET_EXPENSES_TYPE(EXPENSES_SHIP_RUN);
-	
+
 	v = &_vehicles[p1];
 	if (!CheckOwnership(v->owner))
 		return CMD_ERROR;
--- a/ship_gui.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/ship_gui.c	Fri Sep 10 19:02:27 2004 +0000
@@ -26,7 +26,7 @@
 {
 	switch(e->event) {
 	case WE_PAINT: {
-		Vehicle *v = &_vehicles[w->window_number];	
+		Vehicle *v = &_vehicles[w->window_number];
 		const byte *b;
 		int sel;
 		int x,y;
@@ -38,7 +38,7 @@
 		DrawWindowWidgets(w);
 
 		DrawString(1, 15, STR_983F_SELECT_CARGO_TYPE_TO_CARRY, 0);
-		
+
 		cargo = -1;
 		x = 6;
 		y = 25;
@@ -103,7 +103,7 @@
 			} break;
 		case 4: /* refit button */
 			if (WP(w,refit_d).cargo != 0xFF) {
-				Vehicle *v = &_vehicles[w->window_number];	
+				Vehicle *v = &_vehicles[w->window_number];
 				if (DoCommandP(v->tile, v->index, WP(w,refit_d).cargo, NULL, CMD_REFIT_SHIP | CMD_MSG(STR_9841_CAN_T_REFIT_SHIP)))
 					DeleteWindow(w);
 			}
@@ -136,8 +136,8 @@
 	Window *w;
 
 	DeleteWindowById(WC_VEHICLE_REFIT, v->index);
-	
-	_alloc_wnd_parent_num = v->index;	
+
+	_alloc_wnd_parent_num = v->index;
 	w = AllocateWindowDesc(&_ship_refit_desc);
 	w->window_number = v->index;
 	w->caption_color = v->owner;
@@ -166,7 +166,7 @@
 			StringID str;
 
 			SET_DPARAM16(1, year);
-			
+
 			str = STR_0199_YEAR;
 			if (year != 1) {
 				str++;
@@ -212,7 +212,7 @@
 		SET_DPARAM16(0, GetCustomEngineName(v->engine_type));
 		SET_DPARAM32(2, v->value);
 		DrawString(74, 57, STR_9816_BUILT_VALUE, 0);
-		
+
 		SET_DPARAM16(0, _cargoc.names_long_p[v->cargo_type]);
 		SET_DPARAM16(1, v->cargo_cap);
 		DrawString(74, 67, STR_9817_CAPACITY, 0);
@@ -295,7 +295,7 @@
 	VehicleID veh = v->index;
 	DeleteWindowById(WC_VEHICLE_ORDERS, veh);
 	DeleteWindowById(WC_VEHICLE_DETAILS, veh);
-	_alloc_wnd_parent_num = veh;	
+	_alloc_wnd_parent_num = veh;
 	w = AllocateWindowDesc(&_ship_details_desc);
 	w->window_number = veh;
 	w->caption_color = v->owner;
@@ -314,7 +314,7 @@
 	ShowShipViewWindow(v);
 }
 
-static void NewShipWndProc(Window *w, WindowEvent *e) 
+static void NewShipWndProc(Window *w, WindowEvent *e)
 {
 	YearMonthDay ymd;
 	switch(e->event) {
@@ -354,7 +354,7 @@
 						DrawShipEngine(x+35, y+10, engine_id, SPRITE_PALETTE(PLAYER_SPRITE_COLOR(_local_player)));
 						y += 24;
 					}
-					sel--; 
+					sel--;
 				}
 			} while (++engine_id, ++e,--num);
 
@@ -370,12 +370,12 @@
 				SET_DPARAM16(4, ship_vehicle_info(selected_id).refittable ? STR_9842_REFITTABLE : STR_EMPTY);
 				SET_DPARAM32(5, ship_vehicle_info(selected_id).running_cost * _price.ship_running >> 8);
 
-				e = &_engines[selected_id];	
+				e = &_engines[selected_id];
 				SET_DPARAM16(7, e->lifelength);
 				SET_DPARAM8(8, e->reliability * 100 >> 16);
 				ConvertDayToYMD(&ymd, e->intro_date);
 				SET_DPARAM16(6, ymd.year + 1920);
-				
+
 				DrawString(2, 111, STR_980A_COST_SPEED_CAPACITY_RUNNING, 0);
 			}
 		}
@@ -456,13 +456,13 @@
 	w = AllocateWindowDesc(&_new_ship_desc);
 	w->window_number = tile;
 	w->vscroll.cap = 4;
-	
+
 	if (tile != 0) {
 		w->caption_color = _map_owner[tile];
 	} else {
 		w->caption_color = _local_player;
 	}
-	
+
 }
 
 
@@ -479,7 +479,7 @@
 				v->u.ship.state == 0x80 &&
 				IsShipDepotTile(v->tile))
 			disabled = 0;
-					
+
 		if (v->owner != _local_player)
 			disabled |= 1<<7 | 1<<6;
 		w->disabled_state = disabled;
@@ -535,13 +535,13 @@
 
 		switch(e->click.widget) {
 		case 4: /* start stop */
-			DoCommandP(v->tile, v->index, 0, NULL, CMD_START_STOP_SHIP | CMD_MSG(STR_9818_CAN_T_STOP_START_SHIP)); 
+			DoCommandP(v->tile, v->index, 0, NULL, CMD_START_STOP_SHIP | CMD_MSG(STR_9818_CAN_T_STOP_START_SHIP));
 			break;
 		case 5: /* center main view */
 			ScrollMainWindowTo(v->x_pos, v->y_pos);
 			break;
 		case 6: /* goto hangar */
-			DoCommandP(v->tile, v->index, 0, NULL, CMD_SEND_SHIP_TO_DEPOT | CMD_MSG(STR_9819_CAN_T_SEND_SHIP_TO_DEPOT)); 
+			DoCommandP(v->tile, v->index, 0, NULL, CMD_SEND_SHIP_TO_DEPOT | CMD_MSG(STR_9819_CAN_T_SEND_SHIP_TO_DEPOT));
 			break;
 		case 7: /* refit */
 			ShowShipRefitWindow(v);
@@ -557,7 +557,7 @@
 
 	case WE_DESTROY:
 		DeleteWindowById(WC_VEHICLE_ORDERS, w->window_number);
-		DeleteWindowById(WC_VEHICLE_REFIT, w->window_number);		
+		DeleteWindowById(WC_VEHICLE_REFIT, w->window_number);
 		DeleteWindowById(WC_VEHICLE_DETAILS, w->window_number);
 		break;
 	}
@@ -641,17 +641,17 @@
 
 	FOR_ALL_VEHICLES(v) {
 		if (v->type == VEH_Ship &&
-				v->u.ship.state == 0x80 && 
+				v->u.ship.state == 0x80 &&
 				v->tile == (TileIndex)tile &&
 				--num < 0 && num >=	-6) {
 
 			DrawShipImage(v, x+19, y, WP(w,traindepot_d).sel);
-			
+
 			SET_DPARAM16(0, v->unitnumber);
 			DrawString(x, y, (uint16)(v->max_age-366) >= v->age ? STR_00E2 : STR_00E3, 0);
 
 			DrawSprite( (v->vehstatus & VS_STOPPED) ? 0xC12 : 0xC13, x, y + 9);
-			
+
 			if ((x+=90) == 2+90*3) {
 				x = 2;
 				y += 24;
@@ -666,7 +666,7 @@
 	TileIndex tile;
 	Vehicle *v;
 	int pos;
-		
+
 	xt = x / 90;
 	xm = x % 90;
 	if (xt >= 5)
@@ -682,7 +682,7 @@
 	tile = w->window_number;
 	FOR_ALL_VEHICLES(v) {
 		if (v->type == VEH_Ship &&
-				v->vehstatus&VS_HIDDEN && 
+				v->vehstatus&VS_HIDDEN &&
 				v->tile == (TileIndex)tile &&
 				--pos < 0) {
 					*veh = v;
@@ -695,7 +695,7 @@
 	}
 
 	return 1; /* outside */
-	
+
 }
 
 static void ShipDepotClick(Window *w, int x, int y)
@@ -714,7 +714,7 @@
 		if (v != NULL) {
 			WP(w,traindepot_d).sel = v->index;
 			SetWindowDirty(w);
-			SetObjectToPlaceWnd( SPRITE_PALETTE(PLAYER_SPRITE_COLOR(v->owner)) + 
+			SetObjectToPlaceWnd( SPRITE_PALETTE(PLAYER_SPRITE_COLOR(v->owner)) +
 				GetShipImage(v, 6), 4, w);
 		}
 		break;
@@ -743,7 +743,7 @@
 		case 2:
 			ShipDepotClick(w, e->click.pt.x, e->click.pt.y);
 			break;
-			
+
 		case 5:
 			ShowBuildShipWindow(w->window_number);
 			break;
@@ -773,12 +773,12 @@
 				ShowShipViewWindow(v);
 			}
 		} break;
-					
+
 		case 3:
 			if (!HASBIT(w->disabled_state, 3) &&
 					WP(w,traindepot_d).sel != INVALID_VEHICLE)	{
 				Vehicle *v;
-				
+
 				HandleButtonClick(w, 3);
 
 				v = &_vehicles[WP(w,traindepot_d).sel];
@@ -786,7 +786,7 @@
 
 				_backup_orders_tile = v->tile;
 				BackupVehicleOrders(v, _backup_orders_data);
-	
+
 				if (!DoCommandP(v->tile, v->index, 0, NULL, CMD_SELL_SHIP | CMD_MSG(STR_980C_CAN_T_SELL_SHIP)))
 					_backup_orders_tile = 0;
 			}
@@ -854,7 +854,7 @@
 
 		if ((ord & OT_MASK) == OT_GOTO_STATION) {
 			st = DEREF_STATION(ord >> 8);
-			
+
 			if (!(st->had_vehicle_of_type & HVOT_BUOY)) {
 				SET_DPARAM16(0, ord >> 8);
 				DrawString(x, y, STR_A036, 0);
@@ -894,7 +894,7 @@
 		// ships are stored as a cummulative index, eg 25, 41, 43. This means
 		// Player0: 25; Player1: (41-25) 16; Player2: (43-41) 2
 		for (i = &_num_ship_sort[1]; i != endof(_num_ship_sort); i++) {*i += *(i-1);}
-	
+
 		// sort by owner, then only subsort the requested owner-vehicles
 		qsort(_ship_sort, n, sizeof(_ship_sort[0]), GeneralOwnerSorter);
 
@@ -939,7 +939,7 @@
 		// Player0: 25; Player1: (41-25) 16; Player2: (43-41) 2 ships
 		i = (window_number == 0) ? 0 : _num_ship_sort[window_number-1];
 		SetVScrollCount(w, _num_ship_sort[window_number] - i);
-		
+
 		/* draw the widgets */
 		{
 			Player *p = DEREF_PLAYER(window_number);
@@ -982,7 +982,7 @@
 				SET_DPARAM32(0, v->profit_this_year);
 				SET_DPARAM32(1, v->profit_last_year);
 				DrawString(x + 12, y + 28, STR_0198_PROFIT_THIS_YEAR_LAST_YEAR, 0);
-				
+
 				if (v->string_id != STR_SV_SHIP_NAME) {
 					SET_DPARAM16(0, v->string_id);
 					DrawString(x+12, y, STR_01AB, 0);
@@ -1010,7 +1010,7 @@
 			return;
 		case 6: { /* Matrix to show vehicles */
 			uint32 id_v = (e->click.pt.y - PLY_WND_PRC__OFFSET_TOP_WIDGET) / PLY_WND_PRC__SIZE_OF_ROW_BIG;
-			
+
 			if (id_v >= w->vscroll.cap) { return;} // click out of bounds
 
 			id_v += w->vscroll.pos;
@@ -1035,15 +1035,15 @@
 
 			tile = _last_built_ship_depot_tile;
 			do {
-				if (_map_owner[tile] == _local_player && IsShipDepotTile(tile)) {					
+				if (_map_owner[tile] == _local_player && IsShipDepotTile(tile)) {
 					ShowShipDepotWindow(tile);
 					ShowBuildShipWindow(tile);
 					return;
 				}
-				
+
 				tile = TILE_MASK(tile + 1);
 			} while(tile != _last_built_ship_depot_tile);
-			
+
 			ShowBuildShipWindow(0);
 		} break;
 		}
--- a/smallmap_gui.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/smallmap_gui.c	Fri Sep 10 19:02:27 2004 +0000
@@ -78,7 +78,7 @@
 	MK(0x5E,STR_00F2_300M),
 	MK(0x1F,STR_00F3_400M),
 	MK(0x27,STR_00F4_500M),
-	
+
 	MS(0xD7,STR_00EB_ROADS),
 	MK(0x0A,STR_00EC_RAILROADS),
 	MK(0x98,STR_00ED_STATIONS_AIRPORTS_DOCKS),
@@ -509,7 +509,7 @@
 		if (i >= 0) i = (i >> 2);
 		bits = _vegetation_clear_bits[i + 4];
 	} else if (t == MP_INDUSTRY) {
-		bits = IS_BYTE_INSIDE(_map5[tile], 0x10, 0x12) ? MKCOLOR(0xD0D0D0D0) : MKCOLOR(0xB5B5B5B5); 
+		bits = IS_BYTE_INSIDE(_map5[tile], 0x10, 0x12) ? MKCOLOR(0xD0D0D0D0) : MKCOLOR(0xB5B5B5B5);
 	} else if (t == MP_TREES) {
 		bits = MKCOLOR(0x54575754);
 		if ((_map2[tile] & 0x30) == 0x20)
@@ -550,7 +550,7 @@
 
 	t = GET_TILETYPE(tile);
 	if (t == MP_HOUSE || _map_owner[tile] == OWNER_TOWN) {
-		t = 0x80;				
+		t = 0x80;
 	} else if (t == MP_INDUSTRY) {
 		t = 0xff;
 	} else {
@@ -641,10 +641,10 @@
 
 		/* setup owners ptr */
 		_owner_colors = tbl = alloca(256 * sizeof(*_owner_colors));
-		
+
 		/* clear the town colors */
 		memset(tbl + 128, 0xB4, 128 * sizeof(*_owner_colors));
-		
+
 		/* fill with some special colors */
 		tbl[0x10] = MKCOLOR(0x54545454);
 		tbl[0x11] = MKCOLOR(0xCACACACA);
@@ -655,7 +655,7 @@
 			if (p->is_active) {
 				tbl[p->index] = dup_byte32(GetSpritePtr(0x307 + p->player_color)[0xCB]);
 			}
-		}	
+		}
 	}
 
 	tile_x = (int)WP(w,smallmap_d).scroll_x >> 4;
@@ -712,7 +712,7 @@
 			proc(ptr, tile_x, tile_y, dpi->pitch*2, reps, mask);
 		}
 
-skip_column:		
+skip_column:
 		if (y == 0) {
 			tile_y++;
 			y++;
@@ -736,7 +736,7 @@
 			if (v->type != 0 && v->type != 0x14 && (v->vehstatus & (VS_HIDDEN|VS_UNCLICKABLE)) == 0) {
 				// Remap into flat coordinates.
 				Point pt = RemapCoords(
-					(int)(v->x_pos - WP(w,smallmap_d).scroll_x) >> 4, 
+					(int)(v->x_pos - WP(w,smallmap_d).scroll_x) >> 4,
 					(int)(v->y_pos - WP(w,smallmap_d).scroll_y) >> 4,
 					0);
 				x = pt.x;
@@ -765,11 +765,11 @@
 						continue;
 					skip = true;
 				}
-				
+
 				// Calculate pointer to pixel and the color
 				ptr = dpi->dst_ptr + y * dpi->pitch + x;
 				color = (type == 1) ? _vehicle_type_colors[v->type-0x10] : 0xF;
-				
+
 				// And draw either one or two pixels depending on clipping
 				ptr[0] = color;
 				if (!skip)
@@ -789,11 +789,11 @@
 					0);
 				x = pt.x - WP(w,smallmap_d).subscroll + 3 - (t->sign.width_2 >> 1);
 				y = pt.y;
-								
+
 				// Check if the town sign is within bounds
 				if (x + t->sign.width_2 > dpi->left &&
 						x < dpi->left + dpi->width &&
-						y + 6 > dpi->top && 
+						y + 6 > dpi->top &&
 						y < dpi->top + dpi->height) {
 					// And draw it.
 					SET_DPARAM16(0, t->index);
@@ -801,7 +801,7 @@
 				}
 			}
 		}
-	} 
+	}
 
 	// Draw map indicators
 	{
@@ -809,7 +809,7 @@
 
 		// Find main viewport.
 		vp = FindWindowById(WC_MAIN_WINDOW,0)->viewport;
-		
+
 		pt = RemapCoords(
 			WP(w,smallmap_d).scroll_x,
 			WP(w,smallmap_d).scroll_y,
@@ -846,7 +846,7 @@
 		/* draw the window */
 		SET_DPARAM16(0, STR_00E5_CONTOURS + _smallmap_type);
 		DrawWindowWidgets(w);
-		
+
 		/* draw the legend */
 		tbl = _legend_table[(_smallmap_type != 2) ? _smallmap_type : (_opt.landscape + IND_OFFS)];
 		x = 4;
@@ -877,7 +877,7 @@
 	case WE_CLICK:
 		switch(e->click.widget) {
 		case 2: {/* big/small size */
-			// const Widget *wi = w->widget; 
+			// const Widget *wi = w->widget;
 			DeleteWindow(w);
 			SndPlayFx(0x13);
 			{
@@ -903,7 +903,7 @@
 		case 5: /* show land contours */
 		case 6: /* show vehicles */
 		case 7: /* show industries */
-		case 8: /* show transport routes */			
+		case 8: /* show transport routes */
 		case 9: /* show vegetation */
 		case 10: /* show land owners */
 			w->click_state &= ~(1<<5|1<<6|1<<7|1<<8|1<<9|1<<10);
@@ -978,7 +978,7 @@
 	int x,y;
 
 	_smallmap_size = big;
-	
+
 	w = AllocateWindowDescFront(_smallmap_descs[big], 0);
 	if (w) {
 		w->click_state = (1<<5) << _smallmap_type | _smallmap_show_towns << 11;
@@ -1039,7 +1039,7 @@
 
 			// set this view to same location. Based on the center, adjusting for zoom
 			WP(w2,vp_d).scrollpos_x =  x - (w2->viewport->virtual_width - (294 <<vp->zoom) )/2;
-			WP(w2,vp_d).scrollpos_y =  y - (w2->viewport->virtual_height - (214 << vp->zoom) )/2;			
+			WP(w2,vp_d).scrollpos_y =  y - (w2->viewport->virtual_height - (214 << vp->zoom) )/2;
 		} break;
 		case 7: { /* inverse location button (move this view to same spot as main view) */
 			Window * w2 = FindWindowById(WC_MAIN_WINDOW, 0);
@@ -1047,9 +1047,9 @@
 			int y = WP(w2,vp_d).scrollpos_y;
 
 			WP(w,vp_d).scrollpos_x =  x + (w2->viewport->virtual_width - (294 <<vp->zoom) )/2;
-			WP(w,vp_d).scrollpos_y =  y + (w2->viewport->virtual_height - (214 << vp->zoom) )/2;			
+			WP(w,vp_d).scrollpos_y =  y + (w2->viewport->virtual_height - (214 << vp->zoom) )/2;
 		} break;
-		}	
+		}
 	} break;
 	}
 }
@@ -1066,7 +1066,7 @@
 {
 	Window *w, *v;
 	int i = 0;
-	
+
 	// find next free window number for extra viewport
 	while (FindWindowById(WC_EXTRA_VIEW_PORT,i) ) {
 		i++;
@@ -1078,8 +1078,8 @@
 		// disable zoom in button
 		w->disabled_state = 1 << 4;
 		// the main window with the main view
-		v = FindWindowById(WC_MAIN_WINDOW, 0); 
-		// New viewport start ats (zero,zero) 
+		v = FindWindowById(WC_MAIN_WINDOW, 0);
+		// New viewport start ats (zero,zero)
 		AssignWindowViewport(w, 3, 17, 294, 214, 0 , 0);
 
 		// center on same place as main window (zoom is maximum, no adjustment needed)
--- a/sound.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/sound.c	Fri Sep 10 19:02:27 2004 +0000
@@ -73,7 +73,7 @@
 	volume_left = sc->volume_left;
 	volume_right = sc->volume_right;
 
-	if (frac_speed == 0x10000) { 
+	if (frac_speed == 0x10000) {
 		// Special case when frac_speed is 0x10000
 		do {
 			buffer[0]+= *b * volume_left >> 8;
@@ -110,10 +110,10 @@
 {
 	int i;
 	MixerChannel *mc;
-	
+
 	// Clear the buffer
 	memset(buffer, 0, sizeof(int16)*2*samples);
-	
+
 	// Mix each channel
 	for(i=0,mc=mx->channels; i!=lengthof(mx->channels); i++,mc++) {
 		if (mc->active) {
@@ -154,7 +154,7 @@
 	// adjust the magnitude to prevent overflow
 	while (size & 0xFFFF0000)
 		size >>= 1, rate = (rate >> 1) + 1;
-	
+
 	mc->samples_left = size * mc->mx->play_rate / rate;
 }
 
@@ -180,7 +180,7 @@
 		fe->file_offset = FioReadDword();
 		fe->file_size = FioReadDword();
 	}
-	
+
 	fe = mx->files;
 	for(i=0; i!=count; i++,fe++) {
 		FioSeekTo(fe->file_offset, SEEK_SET);
@@ -221,7 +221,7 @@
 
 	if (fe->file_size == 0)
 		return false;
-		
+
 	mem = malloc(fe->file_size);
 	FioSeekToFile(fe->file_offset);
 	FioReadBlock(mem, fe->file_size);
@@ -229,7 +229,7 @@
 	for(i=0; i!=fe->file_size; i++) {
 		((byte*)mem)[i] ^= 0x80;
 	}
-	
+
 	assert(fe->bits_per_sample == 8 && fe->channels == 1 && fe->file_size != 0 && fe->rate != 0);
 
 	MxSetChannelRawSrc(mc, mem, fe->file_size, fe->rate, MX_AUTOFREE | MX_UNSIGNED);
@@ -302,10 +302,10 @@
 		if ((vp=w->viewport) &&
 				IS_INSIDE_1D(x, vp->virtual_left, vp->virtual_width) &&
 				IS_INSIDE_1D(y, vp->virtual_top, vp->virtual_height)) {
-		
+
 			left = ((x - vp->virtual_left) >> vp->zoom) + vp->left;
 			StartSound(
-				_sound_idx[sound], 
+				_sound_idx[sound],
 				clamp(left / 71, 0, 8),
 				(_sound_base_vol[sound] * msf.effect_vol * _vol_factor_by_zoom[vp->zoom]) >> 15
 			);
@@ -334,8 +334,8 @@
 void SndPlayFx(int sound)
 {
 	StartSound(
-		_sound_idx[sound], 
-		4, 
+		_sound_idx[sound],
+		4,
 		(_sound_base_vol[sound] * msf.effect_vol) >> 7
 	);
 }
--- a/station.h	Fri Sep 10 18:54:23 2004 +0000
+++ b/station.h	Fri Sep 10 19:02:27 2004 +0000
@@ -28,7 +28,7 @@
 	ViewportSign sign;
 
 	uint16 had_vehicle_of_type;
-	
+
 	byte time_since_load;
 	byte time_since_unload;
 	byte delete_ctr;
--- a/station_cmd.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/station_cmd.c	Fri Sep 10 19:02:27 2004 +0000
@@ -126,7 +126,7 @@
 		return NULL;
 	}
 
-	i = a_free->index;	
+	i = a_free->index;
 	memset(a_free, 0, sizeof(Station));
 	a_free->index = i;
 	return a_free;
@@ -143,7 +143,7 @@
 		TILE_XY(-6,1),  1, 1, 1, 1, 1, 1,
 		TILE_XY(-6,1),  1, 1, 1, 1, 1, 1,
 		0,
-	};	
+	};
 	int j;
 	const TileIndexDiff *p = _count_square_table;
 	int num = 0;
@@ -189,9 +189,9 @@
 					CLRBIT(free_names, str);
 				}
 			}
-		}	
+		}
 	}
-	
+
 	/* check default names */
 	tmp = free_names & _gen_station_name_bits[flag];
 	if (tmp != 0) {
@@ -255,9 +255,9 @@
 			~( (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[ 
-			(GET_TILE_X(tile) < GET_TILE_X(t->xy)) + 
+
+		free_names &= _direction_and_table[
+			(GET_TILE_X(tile) < GET_TILE_X(t->xy)) +
 			(GET_TILE_Y(tile) < GET_TILE_Y(t->xy))*2];
 	}
 
@@ -335,7 +335,7 @@
 	Station *st;
 	FOR_ALL_STATIONS(st) {
 		if (st->xy != 0)
-			UpdateStationVirtCoord(st);			
+			UpdateStationVirtCoord(st);
 	}
 }
 
@@ -488,7 +488,7 @@
 	}
 	span[4] = st->airport_tile;
 	if (st->airport_tile != 0) {
-		span[5] = st->airport_tile + TILE_XY(_airport_size_x[st->airport_type]-1, _airport_size_y[st->airport_type]-1); 
+		span[5] = st->airport_tile + TILE_XY(_airport_size_x[st->airport_type]-1, _airport_size_y[st->airport_type]-1);
 	}
 	span[6] = st->dock_tile;
 
@@ -529,7 +529,7 @@
 	new_acc = GetAcceptanceMask(st);
 	if (old_acc == new_acc)
 		return;
-	
+
 	// show a message to report that the acceptance was changed?
 	if (show_msg && st->owner == _local_player && st->facilities) {
 		uint32 accept=0, reject=0; /* these contain two string ids each */
@@ -537,7 +537,7 @@
 
 		do {
 			if (new_acc & 1) {
-				if (!(old_acc & 1)) accept = (accept << 16) | *str; 
+				if (!(old_acc & 1)) accept = (accept << 16) | *str;
 			} else {
 				if (old_acc & 1) reject = (reject << 16) | *str;
 			}
@@ -595,7 +595,7 @@
 			cost += _price.terraform;
 			flat_z += 8;
 		}
-		
+
 		// get corresponding flat level and make sure that all parts of the station have the same level.
 		if (allowed_z == -1) {
 			// first tile
@@ -605,7 +605,7 @@
 			return CMD_ERROR;
 		}
 
-		// if station is set, then we have special handling to allow building on top of already existing stations. 
+		// if station is set, then we have special handling to allow building on top of already existing stations.
 		// so station points to -1 if we can build on any station. or it points to a station if we're only allowed to build
 		// on exactly that station.
 		if (station && IS_TILETYPE(tile_cur, MP_STATION)) {
@@ -795,7 +795,7 @@
 		st = AllocateStation();
 		if (st == NULL)
 			return CMD_ERROR;
-		
+
 		st->town = ClosestTownFromTile(tile_org, (uint)-1);
 		if (_current_player < MAX_PLAYERS && flags&DC_EXEC)
 			SETBIT(st->town->have_ratings, _current_player);
@@ -819,20 +819,20 @@
 
 		st->trainst_w = finalvalues[1];
 		st->trainst_h = finalvalues[2];
-		
+
 		st->build_date = _date;
-		
+
 		tile_delta = direction ? TILE_XY(0,1) : TILE_XY(1,0);
-		
+
 		layout_ptr = alloca(numtracks * plat_len);
 		GetStationLayout(layout_ptr, numtracks, plat_len);
-		
+
 		do {
 			int tile = tile_org;
 			int w = plat_len;
 			do {
 
-				ModifyTile(tile, 
+				ModifyTile(tile,
 					MP_SETTYPE(MP_STATION) | MP_MAPOWNER_CURRENT |
 					MP_MAP2 | MP_MAP5 | MP_MAP3LO | MP_MAP3HI_CLEAR,
 					station_index, /* map2 parameter */
@@ -866,7 +866,7 @@
 	uint i;
 
 restart:
-	
+
 	// too small?
 	if (w != 0 && h != 0) {
 		// check the left side, x = constant, y changes
@@ -966,7 +966,7 @@
 	tile = st->train_tile;
 	w = st->trainst_w;
 	h = st->trainst_h;
-	
+
 	assert(w != 0 && h != 0);
 
 	/* cost is area * constant */
@@ -996,7 +996,7 @@
 		UpdateStationVirtCoordDirty(st);
 		DeleteStationIfEmpty(st);
 	}
-	
+
 	return cost;
 }
 
@@ -1056,7 +1056,7 @@
 	if (st != NULL) {
 		if (st->owner != OWNER_NONE && st->owner != _current_player)
 			return_cmd_error(STR_3009_TOO_CLOSE_TO_ANOTHER_STATION);
-		
+
 		if (!CheckStationSpreadOut(st, tile, 1, 1))
 			return CMD_ERROR;
 
@@ -1091,10 +1091,10 @@
 		st->facilities |= FACIL_BUS_STOP;
 		st->bus_stop_status = 3;
 		st->owner = _current_player;
-		
+
 		st->build_date = _date;
 
-		ModifyTile(tile, 
+		ModifyTile(tile,
 			MP_SETTYPE(MP_STATION) | MP_MAPOWNER_CURRENT |
 			MP_MAP2 | MP_MAP5 | MP_MAP3LO_CLEAR | MP_MAP3HI_CLEAR,
 			st->index,			/* map2 parameter */
@@ -1117,7 +1117,7 @@
 		return CMD_ERROR;
 
 	tile = st->bus_tile;
-	
+
 	if (!EnsureNoVehicle(tile))
 		return CMD_ERROR;
 
@@ -1131,7 +1131,7 @@
 		DeleteStationIfEmpty(st);
 	}
 
-	return _price.remove_bus_station;	
+	return _price.remove_bus_station;
 }
 
 
@@ -1168,7 +1168,7 @@
 	if (st != NULL) {
 		if (st->owner != OWNER_NONE && st->owner != _current_player)
 			return_cmd_error(STR_3009_TOO_CLOSE_TO_ANOTHER_STATION);
-		
+
 		if (!CheckStationSpreadOut(st, tile, 1, 1))
 			return CMD_ERROR;
 
@@ -1206,8 +1206,8 @@
 
 		st->build_date = _date;
 
-		ModifyTile(tile, 
-			MP_SETTYPE(MP_STATION) | MP_MAPOWNER_CURRENT | 
+		ModifyTile(tile,
+			MP_SETTYPE(MP_STATION) | MP_MAPOWNER_CURRENT |
 			MP_MAP2 | MP_MAP3LO_CLEAR | MP_MAP3HI_CLEAR | MP_MAP5,
 			st->index,			/* map2 parameter */
 			p1 + 0x43       /* map5 parameter */
@@ -1227,7 +1227,7 @@
 
 	if (_current_player != OWNER_WATER && !CheckOwnership(st->owner))
 		return CMD_ERROR;
-	
+
 	tile = st->lorry_tile;
 
 	if (!EnsureNoVehicle(tile))
@@ -1235,7 +1235,7 @@
 
 	if (flags & DC_EXEC) {
 		DoClearSquare(tile);
-		
+
 		st->lorry_tile = 0;
 		st->facilities &= ~FACIL_TRUCK_STOP;
 
@@ -1243,7 +1243,7 @@
 		DeleteStationIfEmpty(st);
 	}
 
-	return _price.remove_truck_station;	
+	return _price.remove_truck_station;
 }
 
 // FIXME -- need to move to its corresponding Airport variable
@@ -1294,7 +1294,7 @@
 	_airport_map5_tiles_country,				// Country Airfield (small)
 	_airport_map5_tiles_town,						// City Airport (large)
 	_airport_map5_tiles_heliport,				// Heliport
-	_airport_map5_tiles_metropolitan,   // Metropolitain Airport (large) 
+	_airport_map5_tiles_metropolitan,   // Metropolitain Airport (large)
 	_airport_map5_tiles_international,	// International Airport (xlarge)
 };
 
@@ -1309,12 +1309,12 @@
 	Station *st;
 	int32 cost;
 	int w,h;
-	bool airport_upgrade = true;	
+	bool airport_upgrade = true;
 
 	SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
 
 	tile = TILE_FROM_XY(x,y);
-	
+
 	if (!(flags & DC_NO_TOWN_RATING) && !CheckIfAuthorityAllows(tile))
 		return CMD_ERROR;
 
@@ -1353,7 +1353,7 @@
 	if (st != NULL) {
 		if (st->owner != OWNER_NONE && st->owner != _current_player)
 			return_cmd_error(STR_3009_TOO_CLOSE_TO_ANOTHER_STATION);
-		
+
 		if (!CheckStationSpreadOut(st, tile, 1, 1))
 			return CMD_ERROR;
 
@@ -1397,7 +1397,7 @@
 		st->facilities |= FACIL_AIRPORT;
 		st->airport_type = (byte)p1;
 		st->airport_flags = 0;
-		
+
 		st->build_date = _date;
 
 		/*	if airport was demolished while planes were en-route to it, the positions can no longer
@@ -1407,11 +1407,11 @@
 				2. airport is added to existing station (unfortunately unavoideable)
 		*/
 		if (airport_upgrade) {UpdateAirplanesOnNewStation(st);}
-	
+
 		{
 			const byte *b = _airport_map5_tiles[p1];
 BEGIN_TILE_LOOP(tile_cur,w,h,tile)
-				ModifyTile(tile_cur, 
+				ModifyTile(tile_cur,
 					MP_SETTYPE(MP_STATION) | MP_MAPOWNER_CURRENT |
 					MP_MAP2 | MP_MAP3LO_CLEAR | MP_MAP3HI_CLEAR | MP_MAP5,
 					st->index, *b++);
@@ -1467,7 +1467,7 @@
 	return cost;
 }
 
-/* Build a buoy 
+/* Build a buoy
  * p1,p2 unused
  */
 
@@ -1499,7 +1499,7 @@
 		st->facilities |= FACIL_DOCK;
 		st->had_vehicle_of_type |= HVOT_BUOY;
 		st->owner = OWNER_NONE;
-		
+
 		st->build_date = _date;
 
 		ModifyTile(ti.tile,
@@ -1511,7 +1511,7 @@
 		);
 
 		UpdateStationVirtCoordDirty(st);
-		
+
 		UpdateStationAcceptance(st, false);
 		InvalidateWindow(WC_STATION_LIST, st->owner);
 	}
@@ -1538,7 +1538,7 @@
 		st->facilities &= ~FACIL_DOCK;
 		st->had_vehicle_of_type &= ~HVOT_BUOY;
 
-		ModifyTile(tile, 
+		ModifyTile(tile,
 			MP_SETTYPE(MP_WATER) |
 			MP_MAP2_CLEAR | MP_MAP3LO_CLEAR | MP_MAP3HI_CLEAR | MP_MAPOWNER | MP_MAP5 | MP_MAP2_CLEAR,
 			OWNER_WATER, /* map_owner */
@@ -1602,13 +1602,13 @@
 	FindLandscapeHeightByTile(&ti, tile_cur);
 	if (ti.tileh != 0 || ti.type != MP_WATER)
 		return_cmd_error(STR_304B_SITE_UNSUITABLE);
-	
+
 	/* middle */
-	st = GetStationAround(tile + _dock_tileoffs_chkaround[direction], 
+	st = GetStationAround(tile + _dock_tileoffs_chkaround[direction],
 		_dock_w_chk[direction], _dock_h_chk[direction], -1);
 	if (st == CHECK_STATIONS_ERR)
 		return CMD_ERROR;
-	
+
 	/* Find a station close to us */
 	if (st == NULL) {
 		st = GetClosestStationFromTile(tile, 8, _current_player);
@@ -1618,7 +1618,7 @@
 	if (st != NULL) {
 		if (st->owner != OWNER_NONE && st->owner != _current_player)
 			return_cmd_error(STR_3009_TOO_CLOSE_TO_ANOTHER_STATION);
-		
+
 		if (!CheckStationSpreadOut(st, tile, 1, 1))
 			return CMD_ERROR;
 
@@ -1650,23 +1650,23 @@
 		if (!st->facilities) st->xy = tile;
 		st->facilities |= FACIL_DOCK;
 		st->owner = _current_player;
-		
+
 		st->build_date = _date;
 
-		ModifyTile(tile, 
-			MP_SETTYPE(MP_STATION) | MP_MAPOWNER_CURRENT | 
+		ModifyTile(tile,
+			MP_SETTYPE(MP_STATION) | MP_MAPOWNER_CURRENT |
 			MP_MAP2 | MP_MAP3LO_CLEAR | MP_MAP3HI_CLEAR |
 			MP_MAP5,
 			st->index,
 			direction + 0x4C);
 
-		ModifyTile(tile + _tileoffs_by_dir[direction], 
-			MP_SETTYPE(MP_STATION) | MP_MAPOWNER_CURRENT | 
+		ModifyTile(tile + _tileoffs_by_dir[direction],
+			MP_SETTYPE(MP_STATION) | MP_MAPOWNER_CURRENT |
 			MP_MAP2 | MP_MAP3LO_CLEAR | MP_MAP3HI_CLEAR |
 			MP_MAP5,
 			st->index,
 			(direction&1) + 0x50);
-		
+
 		UpdateStationVirtCoordDirty(st);
 		UpdateStationAcceptance(st, false);
 		InvalidateWindow(WC_STATION_LIST, st->owner);
@@ -1747,13 +1747,13 @@
 	t += sizeof(uint32);
 	if (image & 0x8000)
 		image |= image_or_modificator;
-	DrawGroundSprite(image + base_img);	
+	DrawGroundSprite(image + base_img);
 
 	for(dtss = (DrawTileSeqStruct *)t; (byte)dtss->delta_x != 0x80; dtss++) {
 		if ((byte)dtss->delta_z != 0x80) {
 			image =	dtss->image + base_img;
 			if (_display_opt & DO_TRANS_BUILDINGS) {
-				if (image&0x8000) image |= image_or_modificator;	
+				if (image&0x8000) image |= image_or_modificator;
 			} else {
 				image = (image & 0x3FFF) | 0x03224000;
 			}
@@ -1763,7 +1763,7 @@
 			image = *(uint32*)&dtss->height + base_img; /* endian ok */
 
 			if (_display_opt & DO_TRANS_BUILDINGS) {
-				if (image&0x8000) image |= image_or_modificator;	
+				if (image&0x8000) image |= image_or_modificator;
 			} else {
 				image = (image & 0x3FFF) | 0x03224000;
 			}
@@ -1852,7 +1852,7 @@
 		(IS_BYTE_INSIDE(i, 0x47, 0x4B) && (_patches.roadveh_queue || st->bus_stop_status&3)) ) {
 			/* This is a bus/truck stop, and there is free space
 			 * (or we allow queueing) */
-			
+
 			/* We reverse the dir because it points out of the
 			 * exit, and we want to get in. Maybe we should return
 			 * both dirs here? */
@@ -1878,7 +1878,7 @@
   // 0x3A - flag small airport (58)
 	if (_map5[tile] == 39 || _map5[tile] == 58 || _map5[tile] == 90 || _map5[tile] == 102)
 		AddAnimatedTile(tile);
-	
+
 	// treat a bouy tile as water.
 	else if (_map5[tile] == 0x52)
 		TileLoop_Water(tile);
@@ -1900,7 +1900,7 @@
 	if (m5 >= 39 && m5 <= 50) { // turning radar (39 - 50)
 		if (_tick_counter & 3)
 			return;
-		
+
 		if (++m5 == 50+1)
 			m5 = 39;
 
@@ -1910,14 +1910,14 @@
 	} else if (m5 >= 90 && m5 <= 113) { // turning radar with ground under it (different fences) (90 - 101 | 102 - 113)
 		if (_tick_counter & 3)
 			return;
-		
+
 		m5++;
-		
+
 		if (m5 == 101+1) {m5 = 90;}  // radar with fences in south
 		else if (m5 == 113+1) {m5 = 102;} // radar with fences in north
 
 		_map5[tile] = m5;
-		MarkTileDirtyByTile(tile);		
+		MarkTileDirtyByTile(tile);
 	//added - end
 	} else if (m5 >= 0x3A && m5 <= 0x3D) {  // windsack (58 - 61)
 		if (_tick_counter & 1)
@@ -1925,7 +1925,7 @@
 
 		if (++m5 == 0x3D+1)
 			m5 = 0x3A;
-		
+
 		_map5[tile] = m5;
 		MarkTileDirtyByTile(tile);
 	}
@@ -1957,17 +1957,17 @@
 	uint16 spd;
 
 	if (v->type == VEH_Train) {
-		if (IS_BYTE_INSIDE(_map5[tile], 0, 8) && v->subtype == 0 && 
+		if (IS_BYTE_INSIDE(_map5[tile], 0, 8) && v->subtype == 0 &&
 			!IsTrainStationTile(tile + _tileoffs_by_dir[v->direction >> 1])) {
-			
+
 			station_id = _map2[tile];
-			if ((!(v->next_order & OF_NON_STOP) && !_patches.new_nonstop) || 
+			if ((!(v->next_order & OF_NON_STOP) && !_patches.new_nonstop) ||
 					 (((v->next_order & OT_MASK) == OT_GOTO_STATION && v->next_order_param == station_id))) {
 
 				if (!(_patches.new_nonstop && (v->next_order & OF_NON_STOP)) && v->next_order != OT_LEAVESTATION && v->last_station_visited != station_id) {
 					x &= 0xF;
 					y &= 0xF;
-					
+
 					dir = v->direction & 6;
 					if (dir & 2) intswap(x,y);
 					if (y == 8) {
@@ -1983,7 +1983,7 @@
 						}
 					}
 				}
-			}	
+			}
 		}
 	} else if (v->type == VEH_Road) {
 		if (v->u.road.state < 16 && (v->u.road.state&4)==0 && v->u.road.frame==0) {
@@ -2015,7 +2015,7 @@
 			}
 		}
 	}
-	
+
 	return 0;
 }
 
@@ -2041,7 +2041,7 @@
 
 	FOR_ALL_STATIONS(st) {
 		if (st->xy && st->owner < MAX_PLAYERS)
-			DeleteStation(st);		
+			DeleteStation(st);
 	}
 }
 
@@ -2111,7 +2111,7 @@
 				(rating += 45, days > 3) ||
 				(rating += 35, true);
 			}
-			
+
 			{
 				waiting = ge->waiting_acceptance & 0xFFF;
 				(rating -= 90, waiting > 1500) ||
@@ -2127,7 +2127,7 @@
 
 				// only modify rating in steps of -2, -1, 0, 1 or 2
 				ge->rating = rating = or + clamp(clamp(rating, 0, 255) - or, -2, 2);
-				
+
 				// if rating is <= 64 and more than 200 items waiting, remove some random amount of goods from the station
 				if (rating <= 64 && waiting >= 200) {
 					int dec = Random() & 0x1F;
@@ -2150,7 +2150,7 @@
 			}
 		}
 	} while (++ge != endof(st->goods));
-	
+
 	index = st->index;
 
 	if (waiting_changed)
@@ -2223,8 +2223,8 @@
 
 static void UpdateStationWaiting(Station *st, int type, uint amount)
 {
-	st->goods[type].waiting_acceptance = 
-		(st->goods[type].waiting_acceptance & ~0xFFF) + 
+	st->goods[type].waiting_acceptance =
+		(st->goods[type].waiting_acceptance & ~0xFFF) +
 			min(0xFFF, (st->goods[type].waiting_acceptance & 0xFFF) + amount);
 
 	st->goods[type].enroute_time = 0;
@@ -2240,7 +2240,7 @@
 	str = AllocateName((byte*)_decode_parameters, 6);
 	if (str == 0)
 		return CMD_ERROR;
-	
+
 	if (flags & DC_EXEC) {
 		st = DEREF_STATION(p1);
 		old_str = st->string_id;
@@ -2282,11 +2282,11 @@
 					st = DEREF_STATION(st_index);
 					if ((st->had_vehicle_of_type & HVOT_BUOY) == 0 &&
 							( !st->town->exclusive_counter || (st->town->exclusivity == st->owner) ) && // check exclusive transport rights
-							st->goods[type].rating != 0 && 
+							st->goods[type].rating != 0 &&
 							(!_patches.selectgoods || st->goods[type].last_speed) && // if last_speed is 0, no vehicle has been there.
 							((st->facilities & (byte)~FACIL_BUS_STOP)!=0 || type==CT_PASSENGERS) && // if we have other fac. than a bus stop, or the cargo is passengers
 							((st->facilities & (byte)~FACIL_TRUCK_STOP)!=0 || type!=CT_PASSENGERS)) { // if we have other fac. than a cargo bay or the cargo is not passengers
-						
+
 						around[i] = st_index;
 						around_ptr[i] = st;
 					}
@@ -2320,10 +2320,10 @@
 			st1 = around_ptr[i];
 		} else if (around_ptr[i]->goods[type].rating >= best_rating2) {
 			best_rating2 = around_ptr[i]->goods[type].rating;
-			st2 = around_ptr[i];			
+			st2 = around_ptr[i];
 		}
 	}
-	
+
 	assert(st1 != NULL);
 	assert(st2 != NULL);
 	assert(best_rating != 0 || best_rating2 != 0);
@@ -2338,7 +2338,7 @@
 	if (t != 0) {
 		moved = (t * best_rating >> 8) + 1;
 		amount -= t;
-		UpdateStationWaiting(st1, type, moved); 
+		UpdateStationWaiting(st1, type, moved);
 	}
 
 	assert(amount >= 0);
@@ -2398,7 +2398,7 @@
 
 			UpdateStationVirtCoordDirty(st);
 			UpdateStationAcceptance(st, false);
-			return;		
+			return;
 		}
 	}
 }
@@ -2456,10 +2456,10 @@
 	// original airports < 67, new airports between 83 - 114
 	if (m5 < 0x43 || ( m5 >= 83 && m5 <= 114) )
 		return RemoveAirport(st, flags);
-		
+
 	if (m5 < 0x47)
 		return RemoveTruckStation(st, flags);
-	
+
 	if (m5 < 0x4B)
 		return RemoveBusStation(st, flags);
 
@@ -2527,7 +2527,7 @@
 	SLE_VAR(Station,airport_type,				SLE_UINT8),
 	SLE_VAR(Station,truck_stop_status,	SLE_UINT8),
 	SLE_VAR(Station,bus_stop_status,		SLE_UINT8),
-			
+
 	// blocked_months was stored here in savegame format 0 - 4.0
 	SLE_CONDVAR(Station,blocked_months_obsolete,	SLE_UINT8, 0, 4),
 
--- a/station_gui.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/station_gui.c	Fri Sep 10 19:02:27 2004 +0000
@@ -16,7 +16,7 @@
 
 	if (acceptance > 575)
 		acceptance = 575;
-	
+
 	acceptance = (acceptance + 7) >> 3;
 
 	/* draw cargo */
@@ -31,12 +31,12 @@
 	}
 
 	x -= (acceptance>>3);
-	
+
 	DrawString(x+1, y, _cargoc.names_short[type], 0x10);
 
 	/* draw green/red ratings bar */
 	GfxFillRect(x+1, y+8, x+7, y+8, 0xB8);
-	
+
 	rating = (rating >> 5);
 
 	if (rating != 0) {
@@ -110,7 +110,7 @@
 	}
 
 	qsort(firstelement, n, sizeof(_station_sort[0]), StationNameSorter);
-	
+
 	DEBUG(misc, 1) ("Resorting Stations list...");
 }
 
@@ -151,7 +151,7 @@
 				DrawString(xb, y, STR_304A_NONE, 0);
 				return;
 			}
-				
+
 			i += w->vscroll.pos;	// offset from sorted station list of current player
 			assert(i < _num_station_sort[window_number]); // at least one station must exist
 
@@ -318,7 +318,7 @@
 		uint waiting = (st->goods[i].waiting_acceptance & 0xFFF);
 		if (waiting == 0)
 			continue;
-		
+
 		num = (waiting + 5) / 10;
 		if (num != 0) {
 			int cur_x = x;
@@ -352,7 +352,7 @@
 			}
 		}
 	} while (pos > -5 && ++i != 12);
-	
+
 	if (w->widget == _station_view_widgets) {
 		b = _userstring;
 		b[0] = 0x81;
@@ -368,7 +368,7 @@
 				b += 5;
 			}
 		}
-		
+
 		if (b == (byte*)&_userstring[3]) {
 			b[0] = 0x81;
 			b[1] = STR_00D0_NOTHING;
@@ -380,7 +380,7 @@
 
 		DrawStringMultiLine(2, 67, STR_SPEC_USERSTRING, 245);
 	} else {
-		
+
 		DrawString(2, 67, STR_3034_LOCAL_RATING_OF_TRANSPORT, 0);
 
 		y = 77;
@@ -412,7 +412,7 @@
 
 		case 7:
 			SetWindowDirty(w);
-			
+
 			/* toggle height/widget set */
 			w->height ^= (210 ^ 110);
 			*(uint32*)&w->widget ^= (uint32)_station_view_expanded_widgets ^ (uint32)_station_view_widgets;
@@ -438,7 +438,7 @@
 
 		st = DEREF_STATION(w->window_number);
 		DoCommandP(st->xy, w->window_number, 0, NULL, CMD_RENAME_STATION | CMD_MSG(STR_3031_CAN_T_RENAME_STATION));
-	} break;	
+	} break;
 	}
 }
 
--- a/stdafx.h	Fri Sep 10 18:54:23 2004 +0000
+++ b/stdafx.h	Fri Sep 10 19:02:27 2004 +0000
@@ -119,7 +119,7 @@
 static uint16 INLINE TO_LE16(uint16 x) { return BSWAP16(x); }
 # define TO_BE32(x) x
 # define TO_BE16(x) x
-#define TO_BE32X(x) x 
+#define TO_BE32X(x) x
 #else
 # define TO_LE32(x) x
 # define TO_LE16(x) x
--- a/strings.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/strings.c	Fri Sep 10 19:02:27 2004 +0000
@@ -68,7 +68,7 @@
 	{ 3,   ',', CF_TOEURO_2002, "NLG ", "" },
 	{ 2730,',', CF_TOEURO_2002, "ITL ", "" },
 	{ 13,  '.', 0,              "",     " kr" },
-	{ 5,   ' ', 0,              "",     " rur" },	
+	{ 5,   ' ', 0,              "",     " rur" },
 	{ 50,  ',', 0,              "",     " Kc" },
 	{ 130, '.', 0,              "",     " kr" },
 	{ 11,  '.', 0,              "",     " kr" },
@@ -171,9 +171,9 @@
 	return DecodeString(buffr, GetStringPtr(string));
 }
 
-void InjectDparam(int amount) 
+void InjectDparam(int amount)
 {
-	memmove(_decode_parameters + amount, _decode_parameters, sizeof(_decode_parameters) - amount * sizeof(uint32)); 
+	memmove(_decode_parameters + amount, _decode_parameters, sizeof(_decode_parameters) - amount * sizeof(uint32));
 }
 
 
@@ -301,7 +301,7 @@
 	ConvertDayToYMD(&ymd, number);
 
 	for(src = GetStringPtr(ymd.day+STR_01AC_1ST-1); (*buff++=*src++) != 0;) {}
-	
+
 	buff[-1] = ' ';
 	memcpy(buff, GetStringPtr(STR_0162_JAN + ymd.month), 4);
 	buff[3] = ' ';
@@ -338,7 +338,7 @@
 
 	// convert from negative
 	if (number < 0) { *buff++ = '-'; number = -number; }
-	
+
 	// add pre part
 	s = spec->pre;
 	while (s != spec->pre + lengthof(spec->pre) && (c=*s++)) *buff++ = c;
@@ -352,13 +352,13 @@
 		} else if (number >= 1000000) {
 			number = (number + 500) / 1000;
 			compact = 'k';
-		}	
+		}
 	}
-	
+
 	// convert to ascii number and add commas
 	p = buf;
 	j = 4;
-	do { 
+	do {
 		if (--j == 0) { *p++ = spec->separator; j = 3; }
 		*p++ = '0' + number % 10;
 	} while (number /= 10);
@@ -427,8 +427,8 @@
 			}
 			break;
 		}
-		
-		// 0x85 is used as escape character.. 
+
+		// 0x85 is used as escape character..
 		case 0x85:
 			switch(*str++) {
 			case 0:
@@ -453,7 +453,7 @@
 				// liquid type of cargo is multiplied by 100 to get correct amount
 				buff = FormatCommaNumber(buff, GetParamInt16() * multiplier );
 				s = GetStringPtr(cargo_str);
-				
+
 				memcpy(buff++, " ", 1);
 				while (*s) *buff++ = *s++;
 				break;
@@ -476,7 +476,7 @@
 			while (*s) *buff++ = *s++;
 			break;
 		}
-		
+
 		case 0x88: // {STRING}
 			buff = GetString(buff, (uint16)GetParamUint16());
 			break;
@@ -515,7 +515,7 @@
 		}
 
 		case 0x9C: { // {CURRENCY64}
-			buff = FormatGenericCurrency(buff, &_currency_specs[_opt.currency], GetParamInt64(), false);	
+			buff = FormatGenericCurrency(buff, &_currency_specs[_opt.currency], GetParamInt64(), false);
 			break;
 		}
 
@@ -567,7 +567,7 @@
 
 static byte *GetSpecialTownNameString(byte *buff, int ind) {
 	uint32 x = GetParamInt32();
-	
+
 	_town_name_generators[ind](buff, x);
 
 	while (*buff != 0) buff++;
@@ -669,7 +669,7 @@
 	if (i < sizeof(_initial_name_letters)) {
 		buff[0] = _initial_name_letters[i];
 		buff[1] = '.';
-		buff += 2;		
+		buff += 2;
 	}
 
 	base = 0;
@@ -712,7 +712,7 @@
 static byte *GetSpecialPlayerNameString(byte *buff, int ind)
 {
 	switch(ind) {
-	
+
 	// not used
 	case 1: {
 		int i = GetParamInt32() & 0xFFFF;
@@ -789,14 +789,14 @@
 		free(lang);
 	}
 	if (lang_pack == NULL) return false;
-	if (len < sizeof(LanguagePackHeader) || 
+	if (len < sizeof(LanguagePackHeader) ||
 			HDR->ident != TO_LE32(LANGUAGE_PACK_IDENT) ||
 			HDR->version != TO_LE32(LANGUAGE_PACK_VERSION)) {
 		free(lang_pack);
 		return false;
 	}
 #undef HDR
-	
+
 #if defined(TTD_BIG_ENDIAN)
 	for(i=0; i!=32; i++) {
 		((LanguagePackHeader*)lang_pack)->offsets[i] = READ_LE_UINT16(&((LanguagePackHeader*)lang_pack)->offsets[i]);
@@ -855,7 +855,7 @@
 		char *s = str_fmt("%s%s", _path.lang_dir, files[i]);
 		in = fopen(s, "rb");
 		free(s);
-		if (!in || 
+		if (!in ||
 				(j = fread(&hdr, sizeof(hdr), 1, in), fclose(in), j) != 1 ||
 				hdr.ident != TO_LE32(LANGUAGE_PACK_IDENT) ||
 				hdr.version != TO_LE32(LANGUAGE_PACK_VERSION)) {
@@ -865,7 +865,7 @@
 
 		dl->ent[m].file = files[i];
 		dl->ent[m].name = strdup(hdr.name);
-		
+
 		if (!strcmp(hdr.name, "English")) def = m;
 
 		m++;
@@ -873,7 +873,7 @@
 
 	if (m == 0)
 		error(n == 0 ? "No available language packs" : "Invalid version of language packs");
-		
+
 	dl->num = m;
 	for(i=0; i!=dl->num; i++)
 		dl->dropdown[i] = SPECSTR_LANGUAGE_START + i;
--- a/subsidy_gui.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/subsidy_gui.c	Fri Sep 10 19:02:27 2004 +0000
@@ -10,7 +10,7 @@
 #include "economy.h"
 
 static void HandleSubsidyClick(int y)
-{			
+{
 	Subsidy *s;
 	int num,offs;
 	TileIndex xy;
@@ -42,7 +42,7 @@
 		}
 	}
 	return;
-	
+
 handle_click:
 
 	/* determine from coordinate for subsidy and try to scroll to it */
@@ -53,7 +53,7 @@
 		xy = DEREF_TOWN(offs)->xy;
 	} else {
 		xy = _industries[offs].xy;
-		
+
 	}
 	if (!ScrollMainWindowToTile(xy)) {
 		/* otherwise determine to coordinate for subsidy and scroll to it */
@@ -90,7 +90,7 @@
 		if (s->cargo_type != 0xFF && s->age < 12) {
 			SetupSubsidyDecodeParam(s, 1);
 			x2 = DrawString(x+2, y, STR_2027_FROM_TO, 0);
-			
+
 			SET_DPARAM16(0, _date - ymd.day + 384 - s->age * 32);
 			DrawString(x2, y, STR_2028_BY, 0);
 			y += 10;
--- a/terraform_gui.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/terraform_gui.c	Fri Sep 10 19:02:27 2004 +0000
@@ -21,9 +21,9 @@
 static void GenericRaiseLowerLand(uint tile, int mode)
 {
 	if (mode) {
-		DoCommandP(tile, 8, (uint32)mode, CcTerraform, CMD_TERRAFORM_LAND | CMD_AUTO | CMD_MSG(STR_0808_CAN_T_RAISE_LAND_HERE)); 
+		DoCommandP(tile, 8, (uint32)mode, CcTerraform, CMD_TERRAFORM_LAND | CMD_AUTO | CMD_MSG(STR_0808_CAN_T_RAISE_LAND_HERE));
 	} else {
-		DoCommandP(tile, 8, (uint32)mode, CcTerraform, CMD_TERRAFORM_LAND | CMD_AUTO | CMD_MSG(STR_0809_CAN_T_LOWER_LAND_HERE)); 
+		DoCommandP(tile, 8, (uint32)mode, CcTerraform, CMD_TERRAFORM_LAND | CMD_AUTO | CMD_MSG(STR_0809_CAN_T_LOWER_LAND_HERE));
 	}
 }
 
@@ -94,7 +94,7 @@
 
 static void TerraformClick_Trees(Window *w)
 {
-	if (HandlePlacePushButton(w, 8, 0, 1, PlaceProc_PlantTree)) ShowBuildTreesToolbar();	
+	if (HandlePlacePushButton(w, 8, 0, 1, PlaceProc_PlantTree)) ShowBuildTreesToolbar();
 }
 
 static void TerraformClick_PlaceSign(Window *w)
@@ -159,7 +159,7 @@
 				DoCommandP(end_tile, start_tile, 0, CcPlaySound10, CMD_LEVEL_LAND | CMD_AUTO);
 			} else if (e->place.userdata == VPM_X_AND_Y_LIMITED) {
 //				if (e->click.pt.x != -1) {
-//					DoCommandP(e->place.tile, _tree_to_plant, e->place.starttile, NULL, 
+//					DoCommandP(e->place.tile, _tree_to_plant, e->place.starttile, NULL,
 //						CMD_PLANT_TREE | CMD_AUTO | CMD_MSG(STR_2805_CAN_T_PLANT_TREE_HERE));
 			} else {
 				assert(true);
--- a/texteff.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/texteff.c	Fri Sep 10 19:02:27 2004 +0000
@@ -33,7 +33,7 @@
 
 	if (_game_mode == GM_MENU)
 		return;
-	
+
 	for (te = _text_effect_list; te->string_id != 0xFFFF; ) {
 		if (++te == endof(_text_effect_list))
 			return;
@@ -115,7 +115,7 @@
 						continue;
 			AddStringToDraw(te->x, te->y, (StringID)(te->string_id-1), te->params_1, te->params_2);
 		}
-		
+
 	}
 }
 
@@ -131,7 +131,7 @@
 			endof(_animated_tile_list)[-1] = 0;
 			MarkTileDirtyByTile(tile);
 			return;
-		}	
+		}
 	}
 }
 
@@ -145,7 +145,7 @@
 			MarkTileDirtyByTile(tile);
 			return true;
 		}
-	}	
+	}
 
 	return false;
 }
--- a/town.h	Fri Sep 10 18:54:23 2004 +0000
+++ b/town.h	Fri Sep 10 19:02:27 2004 +0000
@@ -9,14 +9,14 @@
 	// Current population of people and amount of houses.
 	uint16 num_houses;
 	uint32 population;
-	
+
 	// Town name
 	uint16 townnametype;
 	uint32 townnameparts;
-	
-	// NOSAVE: Location of name sign, UpdateTownVirtCoord updates this. 
+
+	// NOSAVE: Location of name sign, UpdateTownVirtCoord updates this.
 	ViewportSign sign;
-	
+
 	// Makes sure we don't build certain house types twice.
 	byte flags12;
 
@@ -32,7 +32,7 @@
 	uint8 exclusivity;	     // which player has exslusivity
 	uint8 exclusive_counter;     // months till the exclusivity expires
 	int16 ratings[MAX_PLAYERS];
-		
+
 	// Maximum amount of passengers and mail that can be transported.
 	uint16 max_pass;
 	uint16 max_mail;
@@ -52,17 +52,17 @@
 	uint16 act_water;
 	uint16 new_act_food;
 	uint16 new_act_water;
-	
+
 	// Time until we rebuild a house.
 	byte time_until_rebuild;
 
 	// When to grow town next time.
 	byte grow_counter;
-	byte growth_rate;	
+	byte growth_rate;
 
 	// Fund buildings program in action?
 	byte fund_buildings_months;
-	
+
 	// Fund road reconstruction in action?
 	byte road_build_months;
 
--- a/town_cmd.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/town_cmd.c	Fri Sep 10 19:02:27 2004 +0000
@@ -76,8 +76,8 @@
 	if ((image = dcts->sprite_2) != 0) {
 		if (!(_display_opt & DO_TRANS_BUILDINGS))
 			image = (image & 0x3FFF) | 0x3224000;
-		
-		AddSortableSpriteToDraw(image, 
+
+		AddSortableSpriteToDraw(image,
 			ti->x | (dcts->subtile_xy>>4),
 			ti->y | (dcts->subtile_xy&0xF),
 			(dcts->width_height>>4)+1,
@@ -100,7 +100,7 @@
 {
 	uint z = GetPartialZ(ti->x&0xF, ti->y&0xF, ti->tileh) + ti->z;
 	if (ti->tileh != 0) z = (z & ~7) + 4;
-	return (uint16) z;	
+	return (uint16) z;
 }
 
 static uint GetSlopeTileh_Town(TileInfo *ti)
@@ -140,7 +140,7 @@
 		_map_owner[tile] &= 0x7F;
 		DeleteAnimatedTile(tile);
 	}
-	
+
 	MarkTileDirtyByTile(tile);
 }
 
@@ -169,9 +169,9 @@
 static void MakeSingleHouseBigger(uint tile)
 {
 	byte b;
-	
+
 	assert(IS_TILETYPE(tile, MP_HOUSE));
-	
+
 	b = _map5[tile];
 	if (b & 0x80)
 		return;
@@ -185,14 +185,14 @@
 
 	if ( (_map3_lo[tile] & 0xC0) == 0xC0) {
 		Town *t = ClosestTownFromTile(tile, (uint)-1);
-		ChangePopulation(t, _housetype_population[_map2[tile]]); 
+		ChangePopulation(t, _housetype_population[_map2[tile]]);
 	}
 	MarkTileDirtyByTile(tile);
 }
 
 static void MakeTownHouseBigger(uint tile)
 {
-	uint flags = _house_more_flags[_map2[tile]]; 
+	uint flags = _house_more_flags[_map2[tile]];
 	if (flags & 8) MakeSingleHouseBigger(TILE_ADDXY(tile, 0, 0));
 	if (flags & 4) MakeSingleHouseBigger(TILE_ADDXY(tile, 0, 1));
 	if (flags & 2) MakeSingleHouseBigger(TILE_ADDXY(tile, 1, 0));
@@ -245,7 +245,7 @@
 		_current_player = OWNER_TOWN;
 
 		ClearTownHouse(t, tile);
-		
+
 		// rebuild with another house?
 		if ( (byte) (r >> 8) >= 12) {
 			DoBuildTownHouse(t, tile);
@@ -274,12 +274,12 @@
 	rating = _housetype_remove_ratingmod[house];
 	_cleared_town_rating += rating;
 	_cleared_town = t = ClosestTownFromTile(tile, (uint)-1);
-	
+
 	if (_current_player < MAX_PLAYERS) {
 		if (rating > t->ratings[_current_player] && !(flags & DC_NO_TOWN_RATING) && !_cheats.magic_bulldozer.value) {
 			SET_DPARAM16(0, t->index);
 			return_cmd_error(STR_2009_LOCAL_AUTHORITY_REFUSES);
-		}	
+		}
 	}
 
 	if (flags & DC_EXEC) {
@@ -293,7 +293,7 @@
 static void GetAcceptedCargo_Town(uint tile, AcceptedCargo *ac)
 {
 	int type = _map2[tile];
-	
+
 	ac->type_1 = CT_PASSENGERS;
 	ac->amount_1 = _housetype_cargo_passengers[type];
 
@@ -336,7 +336,7 @@
 	TILE_XY(1,0),
 	TILE_XY(0,1),
 	TILE_XY(-1,0),
-	
+
 	// Store the first 3 elements again.
 	// Lets us rotate without using &3.
 	TILE_XY(0,-1),
@@ -352,7 +352,7 @@
 			if (GrowTown(t)) {
 				i = t->growth_rate;
 			} else {
-				i = 0;	
+				i = 0;
 			}
 		}
 		t->grow_counter = i;
@@ -400,7 +400,7 @@
 	// If this assertion fails, it might be because the world contains
 	//  land at the edges. This is not ok.
 	TILE_ASSERT(tile);
-	
+
 	for(;;) {
 		// Check if there already is a road at this point?
 		if (GetRoadBitsByTile(tile) == 0) {
@@ -421,11 +421,11 @@
 					HASBIT(GetTownRoadMask(TILE_ADD(tile, _roadblock_tileadd[dir+1] + _roadblock_tileadd[dir+2])), dir) ||
 					HASBIT(GetTownRoadMask(TILE_ADD(tile, _roadblock_tileadd[dir+3] + _roadblock_tileadd[dir+2])), dir))
 				return false;
-			
+
 			// Otherwise allow
 			return true;
 		}
-		
+
 		// If the tile is not a slope in the right direction, then
 		// maybe terraform some.
 		if ((k = (dir&1)?0xC:0x9) != slope && (k^0xF) != slope) {
@@ -447,7 +447,7 @@
 static bool TerraformTownTile(uint tile, int edges, int dir)
 {
 	int32 r;
-	
+
 	TILE_ASSERT(tile);
 
 	r = DoCommandByTile(tile, edges, dir, DC_AUTO | DC_NO_WATER, CMD_TERRAFORM_LAND);
@@ -491,7 +491,7 @@
 
 	if (mask == 0) {
 		// Tile has no road. First reset the status counter
-		// to say that this is the last iteration.	
+		// to say that this is the last iteration.
 		_grow_town_result = 0;
 
 		// Then check if the tile we are at belongs to the town,
@@ -520,7 +520,7 @@
 			//   return if the road we're trying to build is curved.
 			if ( a != (b^2))
 				return;
-			
+
 			// Return if neither side of the new road is a house
 			if (!IS_TILETYPE(TILE_ADD(tile,_roadblock_tileadd[a+1]), MP_HOUSE) &&
 					!IS_TILETYPE(TILE_ADD(tile,_roadblock_tileadd[a+3]), MP_HOUSE))
@@ -544,7 +544,7 @@
 			*tile_ptr = flotr.tile;
 			return;
 		}
-		
+
 		// For any other kind of tunnel/bridge, bail out.
 		if (IS_TILETYPE(tile, MP_TUNNELBRIDGE))
 			return;
@@ -557,7 +557,7 @@
 
 		// This is the tile we will reach if we extend to this direction.
 		tmptile = TILE_ADD(tile,_roadblock_tileadd[i]);
-		
+
 		// Don't do it if it reaches to water.
 		if (IS_WATER_TILE(tmptile))
 			return;
@@ -569,7 +569,7 @@
 			return;
 		}
 
-		// Build a house at the edge. 60% chance or 
+		// Build a house at the edge. 60% chance or
 		//  always ok if no road allowed.
 		if (!IsRoadAllowedHere(tmptile, i) || CHANCE16(6,10)) {
 			// But not if there already is a house there.
@@ -722,7 +722,7 @@
 			return GrowTownAtRoad(t, tile);
 		}
 		offs = *ptr++;
-		
+
 		tile = TILE_ADD(tile, offs);
 	} while (offs);
 
@@ -732,7 +732,7 @@
 	ptr = _town_coord_mod;
 	do {
 		FindLandscapeHeightByTile(&ti, tile);
-		
+
 		// Only work with plain land that not already has a house with map5=0
 		if (ti.tileh == 0 && !(ti.type==MP_HOUSE && ti.map5==0)) {
 			if (DoCommandByTile(tile, 0, 0, DC_AUTO, CMD_LANDSCAPE_CLEAR) != CMD_ERROR) {
@@ -800,7 +800,7 @@
 
 		SET_DPARAM32(0, r);
 		GetString(buf1, t1->townnametype);
-			
+
 		// Check size and width
 		if (strlen(buf1) >= 31 || GetStringWidth(buf1) > 130)
 			continue;
@@ -814,7 +814,7 @@
 			}
 		}
 		t1->townnameparts = r;
-		
+
 		return;
 	}
 }
@@ -868,7 +868,7 @@
 	t->statues = 0;
 
 	CreateTownName(t);
-		
+
 	UpdateTownVirtCoord(t);
 	_town_sort_dirty = true;
 
@@ -906,7 +906,7 @@
 	uint tile = TILE_FROM_XY(x,y);
 	TileInfo ti;
 	Town *t;
-	
+
 	SET_EXPENSES_TYPE(EXPENSES_OTHER);
 
 	// Check if too close to the edge of map
@@ -925,7 +925,7 @@
 	// Allocate town struct
 	t = AllocateTown();
 	if (t == NULL)
-		return_cmd_error(STR_023A_TOO_MANY_TOWNS);	
+		return_cmd_error(STR_023A_TOO_MANY_TOWNS);
 
 	// Create the town
 	if (flags & DC_EXEC) {
@@ -959,7 +959,7 @@
 		// Check not too close to a town
 		if (IsCloseToTown(tile, 20))
 			continue;
-		
+
 		// Allocate a town struct
 		t = AllocateTown();
 		if (t == NULL)
@@ -1042,7 +1042,7 @@
 		tile += _tile_add[i];
 
 		t = ClosestTownFromTile(tile, (uint)-1);
-		if (t1 != t) 
+		if (t1 != t)
 			return false;
 
 		if (GetTileSlope(tile, NULL))
@@ -1063,7 +1063,7 @@
 	uint slope;
 	int z;
 	uint oneof;
-	
+
 	// Above snow?
 	slope = GetTileSlope(tile, &z);
 
@@ -1110,7 +1110,7 @@
 			// Make sure there is no slope?
 			if (_housetype_extra_flags[house]&0x12 && slope)
 				continue;
-			
+
 			if (_housetype_extra_flags[house]&0x10) {
 				if (CheckFree2x2Area(t,tile) ||
 						CheckFree2x2Area(t,(tile+=TILE_XY(-1,0))) ||
@@ -1121,7 +1121,7 @@
 			} else if (_housetype_extra_flags[house]&4) {
 				if (CheckBuildHouseMode(t, tile+TILE_XY(1,0), slope, 0))
 					break;
-				
+
 				if (CheckBuildHouseMode(t, tile+TILE_XY(-1,0), slope, 1)) {
 					tile += TILE_XY(-1,0);
 					break;
@@ -1143,7 +1143,7 @@
 
 	// Special houses that there can be only one of.
 	t->flags12 |= oneof;
-	
+
 	{
 		int m3lo,m5,eflags;
 
@@ -1152,21 +1152,21 @@
 		m5 = 0;
 		if (_generating_world) {
 			uint32 r = Random();
-			
+
 			// Value for map3lo
 			m3lo = 0xC0;
 			if ((byte)r >= 220) m3lo &= (r>>8);
 
 			if (m3lo == 0xC0)
 				ChangePopulation(t, _housetype_population[house]);
-			
+
 			// Initial value for map5.
 			m5 = (r >> 16) & 0x3F;
 		}
-		
+
 		assert(IS_TILETYPE(tile, MP_CLEAR));
 
-		ModifyTile(tile, 
+		ModifyTile(tile,
 			MP_SETTYPE(MP_HOUSE) | MP_MAP2 | MP_MAP3LO | MP_MAP3HI_CLEAR | MP_MAP5 | MP_MAPOWNER,
 			house, /* map2 */
 			m3lo,  /* map3_lo */
@@ -1216,7 +1216,7 @@
 static bool BuildTownHouse(Town *t, uint tile)
 {
 	int32 r;
-		
+
 	// make sure it's possible
 	if (!EnsureNoVehicle(tile)) return false;
 	if (GetTileSlope(tile, NULL) & 0x10) return false;
@@ -1258,7 +1258,7 @@
 			tile += TILE_XY(-1,-1);
 		}
 	}
-		
+
 	// Remove population from the town if the
 	// house is finished.
 	if ((~_map3_lo[tile] & 0xC0) == 0) {
@@ -1273,7 +1273,7 @@
 		t->flags12 &= ~2;
 	if (house == 0x14 || house == 0x20)
 		t->flags12 &= ~4;
-	
+
 	// Do the actual clearing of tiles
 	eflags = _housetype_extra_flags[house];
 	DoClearTownHouseHelper(tile);
@@ -1286,7 +1286,7 @@
 {
 	StringID str;
 	Town *t = DEREF_TOWN(p1);
-		
+
 	str = AllocateName((byte*)_decode_parameters, 4);
 	if (str == 0)
 		return CMD_ERROR;
@@ -1349,7 +1349,7 @@
 	int amount, n;
 
 	_generating_world = true;
-	
+
 	amount = ((int)Random()&3) + 3;
 	t->num_houses += amount;
 	UpdateTownRadius(t);
@@ -1374,7 +1374,7 @@
 {
 	static const byte _advertising_amount[3] = {0x40, 0x70, 0xA0};
 	static const byte _advertising_radius[3] = {10,15,20};
-	ModifyStationRatingAround(t->xy, _current_player, 
+	ModifyStationRatingAround(t->xy, _current_player,
 		_advertising_amount[action],
 		_advertising_radius[action]);
 }
@@ -1384,14 +1384,14 @@
 	Player *p;
 
 	t->road_build_months = 6;
-	
+
 	SET_DPARAM16(0, t->index);
 
 	p = DEREF_PLAYER(_current_player);
 	SET_DPARAM16(1, p->name_1);
 	SET_DPARAM32(2, p->name_2);
 
-	AddNewsItem(STR_2055_TRAFFIC_CHAOS_IN_ROAD_REBUILDING, 
+	AddNewsItem(STR_2055_TRAFFIC_CHAOS_IN_ROAD_REBUILDING,
 		NEWS_FLAGS(NM_NORMAL, NF_TILE, NT_GENERAL, 0), t->xy, 0);
 }
 
@@ -1429,7 +1429,7 @@
 	// Layouted as an outward spiral
 	static const TileIndexDiff _statue_tiles[] = {
 	  TILE_XY(-1,0), TILE_XY(0,1),  TILE_XY(1,0),  TILE_XY(1,0),
-	  TILE_XY(0,-1), TILE_XY(0,-1), TILE_XY(-1,0), TILE_XY(-1,0), 
+	  TILE_XY(0,-1), TILE_XY(0,-1), TILE_XY(-1,0), TILE_XY(-1,0),
 	  TILE_XY(-1,0), TILE_XY(0,1),  TILE_XY(0,1),  TILE_XY(0,1),
 	  TILE_XY(1,0),  TILE_XY(1,0),  TILE_XY(1,0),  TILE_XY(1,0),
 	  TILE_XY(0,-1), TILE_XY(0,-1), TILE_XY(0,-1), TILE_XY(0,-1),
@@ -1437,7 +1437,7 @@
 	  TILE_XY(-1,0), TILE_XY(0,1),  TILE_XY(0,1),  TILE_XY(0,1),
 	  TILE_XY(0,1),  TILE_XY(0,1),  TILE_XY(1,0),  TILE_XY(1,0),
 	  TILE_XY(1,0),  TILE_XY(1,0),  TILE_XY(1,0),  TILE_XY(1,0),
-	  TILE_XY(0,-1), TILE_XY(0,-1), TILE_XY(0,-1), TILE_XY(0,-1), 
+	  TILE_XY(0,-1), TILE_XY(0,-1), TILE_XY(0,-1), TILE_XY(0,-1),
 	  TILE_XY(0,-1), TILE_XY(0,-1), TILE_XY(-1,0), TILE_XY(-1,0),
 	  TILE_XY(-1,0), TILE_XY(-1,0), TILE_XY(-1,0), TILE_XY(-1,0),
 	  TILE_XY(-1,0), TILE_XY(0,1),  TILE_XY(0,1),  TILE_XY(0,1),
@@ -1445,7 +1445,7 @@
 	  TILE_XY(1,0),  TILE_XY(1,0),  TILE_XY(1,0),  TILE_XY(1,0),
 	  TILE_XY(1,0),  TILE_XY(1,0),  TILE_XY(1,0),  TILE_XY(1,0),
 	  TILE_XY(0,-1), TILE_XY(0,-1), TILE_XY(0,-1), TILE_XY(0,-1),
-	  TILE_XY(0,-1), TILE_XY(0,-1), TILE_XY(0,-1), TILE_XY(0,-1), 
+	  TILE_XY(0,-1), TILE_XY(0,-1), TILE_XY(0,-1), TILE_XY(0,-1),
 	  TILE_XY(-1,0), TILE_XY(-1,0), TILE_XY(-1,0), TILE_XY(-1,0),
 	  TILE_XY(-1,0), TILE_XY(-1,0), TILE_XY(-1,0), TILE_XY(-1,0),
 	  0,
@@ -1657,7 +1657,7 @@
 	Town *t;
 	uint dist, best = threshold;
 	Town *best_town = NULL;
-	
+
 	FOR_ALL_TOWNS(t) {
 		if (t->xy != 0) {
 			dist = GetTileDist(tile, t->xy);
@@ -1680,9 +1680,9 @@
 		return;
 
 	SETBIT(t->have_ratings, _current_player);
-	
+
 	rating = t->ratings[_current_player];
-	
+
 	if (add < 0) {
 		if (rating > max) {
 			rating += add;
@@ -1714,7 +1714,7 @@
 		return true;
 
 	/*	check if you're allowed to remove the street/bridge/tunnel/industry
-	 *	owned by a town	no removal if rating is lower than ... depends now on 
+	 *	owned by a town	no removal if rating is lower than ... depends now on
 	 *	difficulty setting. Minimum town rating selected by difficulty level
 	 */
 	modemod = _default_rating_settings[_opt_mod_ptr->diff.town_council_tolerance][type];
@@ -1785,7 +1785,7 @@
 // Save and load of towns.
 static const byte _town_desc[] = {
 	SLE_VAR(Town,xy,					SLE_UINT16),
-	
+
 	SLE_CONDVAR(Town,population,	SLE_FILE_U16 | SLE_VAR_U32, 0, 2),
 	SLE_CONDVAR(Town,population,	SLE_UINT32, 3, 255),
 
--- a/town_gui.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/town_gui.c	Fri Sep 10 19:02:27 2004 +0000
@@ -84,7 +84,7 @@
 	uint buttons;
 	int numact;
 	Town *t = DEREF_TOWN(w->window_number);
-		
+
 	switch(e->event) {
 	case WE_PAINT:
 		buttons = GetMaskOfTownActions(&numact, t);
@@ -129,7 +129,7 @@
 					/*	WARNING ugly hack!
 							GetPlayerNameString sets up (Player #) if the player is human in an extra DPARAM16
 							It seems that if player is non-human, nothing is set up, so param is 0. GetString doesn't like
-							that because there is another param after it. 
+							that because there is another param after it.
 							So we'll just shift the rating one back if player is AI and all is fine
 						*/
 					SET_DPARAM16((IS_HUMAN_PLAYER(p->index) ? 4 : 3), str);
@@ -167,7 +167,7 @@
 				DrawStringMultiLine(2, 159, STR_204D_INITIATE_A_SMALL_LOCAL + i, 313);
 			}
 		}
-	
+
 		break;
 
 	case WE_CLICK:
@@ -225,11 +225,11 @@
 	case WE_PAINT:
 		SET_DPARAM16(0, t->index);
 		DrawWindowWidgets(w);
-		
+
 		SET_DPARAM32(0, t->population);
 		SET_DPARAM32(1, t->num_houses);
 		DrawString(2,107,STR_2006_POPULATION,0);
-		
+
 		SET_DPARAM16(0, t->act_pass);
 		SET_DPARAM16(1, t->max_pass);
 		DrawString(2,117,STR_200D_PASSENGERS_LAST_MONTH_MAX,0);
@@ -237,7 +237,7 @@
 		SET_DPARAM16(0, t->act_mail);
 		SET_DPARAM16(1, t->max_mail);
 		DrawString(2,127,STR_200E_MAIL_LAST_MONTH_MAX,0);
-			
+
 		DrawWindowViewport(w);
 		break;
 
@@ -411,7 +411,7 @@
 
 		DrawWindowWidgets(w);
 		DoDrawString(_town_sort_order & 1 ? "\xAA" : "\xA0", (_town_sort_order <= 1) ? 88 : 187, 15, 0x10);
-			
+
 		{
 			Town *t;
 			int n = 0;
@@ -447,7 +447,7 @@
 			_town_sort_dirty = true;
 			SetWindowDirty(w);
 		} break;
-		
+
 		case 4: { /* Click on Town Matrix */
 			uint16 id_v = (e->click.pt.y - 28) / 10;
 
@@ -460,17 +460,17 @@
 			{
 				Town *t = DEREF_TOWN(_town_sort[id_v]);
 				assert(t->xy);
-				
+
 				ScrollMainWindowToTile(t->xy);
 			}
 		}	break;
 		}
 		break;
-		
+
 	case WE_4:
 		SetWindowDirty(w);
 		break;
-	}	
+	}
 }
 
 static const WindowDesc _town_directory_desc = {
--- a/train_cmd.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/train_cmd.c	Fri Sep 10 19:02:27 2004 +0000
@@ -22,7 +22,7 @@
 static const byte _state_dir_table[4] = { 0x20, 8, 0x10, 4 };
 
 static const byte _signal_onedir[14] = {
-	0x80, 0x80, 0x80, 0x20, 0x40, 0x10, 0, 0, 
+	0x80, 0x80, 0x80, 0x20, 0x40, 0x10, 0, 0,
 	0x40, 0x40, 0x40, 0x10, 0x80, 0x20
 };
 
@@ -41,7 +41,7 @@
 	// compute stuff like max speed, power, and weight.
 	do {
 		const RailVehicleInfo *rvi = &_rail_vehicle_info[u->engine_type];
-		
+
 		// power is sum of the power for all engines
 		power += rvi->power;
 
@@ -53,7 +53,7 @@
 		weight += (_cargoc.weights[u->cargo_type] * u->cargo_count) >> 4;
 
 	} while ( (u=u->next) != NULL);
-	
+
 	// these are shown in the UI
 	v->u.rail.cached_weight = weight;
 	v->u.rail.cached_power = power;
@@ -123,15 +123,15 @@
 		if (te > te2) te = te2;
 		f += te;
 	}
-		
+
 	// add air resistance
 	{
 		float cx = 1.0f; // NOT DONE
-		
+
 		// air resistance is doubled in tunnels.
 		if (v->vehstatus == 0x40) cx *= 2;
 
-		f -= cx * spd * spd * (F_KPH_MS * F_KPH_MS * 0.001f); 
+		f -= cx * spd * spd * (F_KPH_MS * F_KPH_MS * 0.001f);
 	}
 
 	// after this f contains the acceleration.
@@ -158,7 +158,7 @@
 		if (base) return base;
 		img = _engine_original_sprites[v->engine_type];
 	}
-	
+
 	base = _engine_sprite_base[img] + ((direction + _engine_sprite_add[img]) & _engine_sprite_and[img]);
 
 	if (v->cargo_count >= (v->cargo_cap >> 1))
@@ -169,7 +169,7 @@
 void DrawTrainEngine(int x, int y, int engine, uint32 image_ormod)
 {
 	const RailVehicleInfo *rvi = &_rail_vehicle_info[engine];
-	
+
 	int img = rvi->image_index;
 	uint32 image = 0;
 
@@ -190,7 +190,7 @@
 			if (!image) img = _engine_original_sprites[engine];
 		}
 		if (!image) {
-			image = ((6 + _engine_sprite_add[img+1]) & _engine_sprite_and[img+1]) + _engine_sprite_base[img+1];	
+			image = ((6 + _engine_sprite_add[img+1]) & _engine_sprite_and[img+1]) + _engine_sprite_base[img+1];
 		}
 	}
 	DrawSprite(image | image_ormod, x, y);
@@ -208,7 +208,7 @@
 	SET_DPARAM16(1, rvi->weight << multihead);
 
 	SET_DPARAM32(4, (rvi->running_cost_base * _price.running_rail[rvi->engclass] >> 8) << multihead);
-	
+
 	cap = rvi->capacity;
 	SET_DPARAM16(5, STR_8838_N_A);
 	if (cap != 0) {
@@ -264,7 +264,7 @@
 
 			v->direction = (byte)(dir*2+1);
 			v->tile = (TileIndex)tile;
-			
+
 			x = GET_TILE_X(tile)*16 | _vehicle_initial_x_fract[dir];
 			y = GET_TILE_Y(tile)*16 | _vehicle_initial_y_fract[dir];
 
@@ -294,11 +294,11 @@
 
 			e = &_engines[engine];
 			v->u.rail.railtype = e->railtype;
-			
+
 			v->build_year = _cur_year;
 			v->type = VEH_Train;
 			v->cur_image = 0xAC2;
-	
+
 			_new_wagon_id = v->index;
 
 			VehiclePositionChanged(v);
@@ -380,12 +380,12 @@
 	uint tile;
 
 	_cmd_build_rail_veh_var1 = 0;
-	
+
 	SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
 
 	tile = TILE_FROM_XY(x,y);
 	rvi = &_rail_vehicle_info[p1];
-	
+
 	if (rvi->flags & RVI_WAGON) {
 		return CmdBuildRailWagon(p1, tile, flags);
 	}
@@ -434,14 +434,14 @@
 			v->dest_tile = 0;
 //			v->profit_last_year = 0;
 //			v->profit_this_year = 0;
-			
+
 			v->engine_type = (byte)p1;
 			e = &_engines[p1];
 
 			v->reliability = e->reliability;
 			v->reliability_spd_dec = e->reliability_spd_dec;
 			v->max_age = e->lifelength * 366;
-			
+
 			v->string_id = STR_SV_TRAIN_NAME;
 //			v->cur_speed = 0;
 //			v->subspeed = 0;
@@ -449,11 +449,11 @@
 			_new_train_id = v->index;
 //			v->cur_order_index = 0;
 //			v->num_orders = 0;
-			
+
 			*(v->schedule_ptr = _ptr_to_next_order++) = 0;
 //			v->next_in_chain = 0xffff;
 //			v->next = NULL;
-			
+
 			v->service_interval = _patches.servint_trains;
 //			v->breakdown_ctr = 0;
 //			v->breakdowns_since_last_service = 0;
@@ -503,7 +503,7 @@
 	}
 	_cmd_build_rail_veh_var1 = _railveh_unk1[p1];
 	_cmd_build_rail_veh_score = _railveh_score[p1];
-	return value;		
+	return value;
 }
 
 
@@ -524,7 +524,7 @@
 {
 	int count;
 	TileIndex tile = v->tile;
-	
+
 	/* check if stopped in a depot */
 	if (!IsTrainDepotTile(tile) || v->cur_speed != 0) {
 errmsg:
@@ -535,7 +535,7 @@
 	count = 0;
 	do {
 		count++;
-		if (v->u.rail.track != 0x80 || v->tile != (TileIndex)tile || 
+		if (v->u.rail.track != 0x80 || v->tile != (TileIndex)tile ||
 				(v->subtype==0 && !(v->vehstatus&VS_STOPPED)))
 			goto errmsg;
 	} while ( (v=v->next) != NULL);
@@ -599,7 +599,7 @@
 	          && is_firsthead_sprite(src->spritenum);
 
 	// if nothing is selected as destination, try and find a matching vehicle to drag to.
-	if (((int32)p1 >> 16) == -1) {	
+	if (((int32)p1 >> 16) == -1) {
 		dst = NULL;
 		if (!is_loco) dst = FindGoodVehiclePos(src);
 	} else {
@@ -609,7 +609,7 @@
 	// don't move the same vehicle..
 	if (src == dst)
 		return 0;
-	
+
 	/* the player must be the owner */
 	if (!CheckOwnership(src->owner) || (dst!=NULL && !CheckOwnership(dst->owner)))
 		return CMD_ERROR;
@@ -618,7 +618,7 @@
 	src_head = GetFirstVehicleInChain(src);
 	dst_head = NULL;
 	if (dst != NULL) dst_head = GetFirstVehicleInChain(dst);
-	
+
 	/* check if all vehicles in the source train are stopped */
 	if (CheckStoppedInDepot(src_head) < 0)
 		return CMD_ERROR;
@@ -695,7 +695,7 @@
 				DeleteWindowById(WC_VEHICLE_VIEW, src->index);
 				DeleteVehicleSchedule(src);
 			}
-			
+
 			src->subtype = 2;
 			src->unitnumber = 0; // doesn't occupy a unitnumber anymore.
 
@@ -785,7 +785,7 @@
 			last = NULL;
 		}
 	}
-	
+
 	// make sure the vehicle is stopped in the depot
 	if (CheckStoppedInDepot(first) < 0)
 		return CMD_ERROR;
@@ -801,7 +801,7 @@
 		// when selling an attached locomotive. we need to delete its window.
 		if (v->subtype == 0) {
 			DeleteWindowById(WC_VEHICLE_VIEW, v->index);
-			
+
 			// rearrange all vehicles that follow to separate lines.
 			if (p2 == 2) {
 				Vehicle *u,*tmp;
@@ -809,7 +809,7 @@
 				while (u != last) {
 					tmp = u;
 					u = u->next;
-					DoCommandByTile(tmp->tile, tmp->index | ((-1)<<16), 0, DC_EXEC, CMD_MOVE_RAIL_VEHICLE);		
+					DoCommandByTile(tmp->tile, tmp->index | ((-1)<<16), 0, DC_EXEC, CMD_MOVE_RAIL_VEHICLE);
 				}
 			}
 		}
@@ -834,7 +834,7 @@
 			cost -= last->value;
 			DeleteVehicle(last);
 		}
-		
+
 		// an attached train changed?
 		if (first && first->subtype == 0) {
 			UpdateTrainAcceleration(first);
@@ -884,7 +884,7 @@
 	EndVehicleMove(v);
 }
 
-static void SetLastSpeed(Vehicle *v, int spd) {	
+static void SetLastSpeed(Vehicle *v, int spd) {
 	int old = v->u.rail.last_speed;
 	if (spd != old) {
 		v->u.rail.last_speed = spd;
@@ -908,7 +908,7 @@
 			b->vehstatus = (b->vehstatus & ~VS_HIDDEN) | (a->vehstatus&VS_HIDDEN);
 			a->vehstatus = tmp;
 		}
-		
+
 		/* swap variables */
 		swap_byte(&a->u.rail.track, &b->u.rail.track);
 		swap_byte(&a->direction, &b->direction);
@@ -916,7 +916,7 @@
 		/* toggle direction */
 		if (!(a->u.rail.track & 0x80)) a->direction ^= 4;
 		if (!(b->u.rail.track & 0x80)) b->direction ^= 4;
-		
+
 		/* swap more variables */
 		swap_int16(&a->x_pos, &b->x_pos);
 		swap_int16(&a->y_pos, &b->y_pos);
@@ -928,7 +928,7 @@
 		UpdateVarsAfterSwap(b);
 	} else {
 		if (!(a->u.rail.track & 0x80)) a->direction ^= 4;
-		UpdateVarsAfterSwap(a);		
+		UpdateVarsAfterSwap(a);
 	}
 }
 
@@ -996,7 +996,7 @@
 
 	if (flags & DC_EXEC)
 		v->u.rail.force_proceed = 0x50;
-	
+
 	return 0;
 }
 
@@ -1027,7 +1027,7 @@
 				v->cargo_type = (byte)p2;
 				InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
 			}
-		}	
+		}
 	} while ( (v=v->next) != NULL);
 
 	_returned_refit_amount = num;
@@ -1082,7 +1082,7 @@
 		return tile;
 
 	if (v->u.rail.track == 0x40) { tile = GetVehicleOutOfTunnelTile(v); }
-		
+
 	tfdd.owner = v->owner;
 	tfdd.best_length = (uint)-1;
 
@@ -1107,7 +1107,7 @@
 		if (tfdd.best_length != (uint)-1)
 			return tfdd.tile;
 	}
-	
+
 	return (uint)-1;
 }
 
@@ -1122,7 +1122,7 @@
 				v->u.rail.days_since_order_progr = 0;
 				v->cur_order_index++;
 			}
-			
+
 			v->next_order = OT_DUMMY;
 			InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, 4);
 		}
@@ -1139,7 +1139,7 @@
 		v->next_order_param = GetDepotByTile(depot_tile);
 		InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, 4);
 	}
-	
+
 	return 0;
 }
 
@@ -1157,7 +1157,7 @@
 		v->service_interval = (uint16)p2;
 		InvalidateWindowWidget(WC_VEHICLE_DETAILS, v->index, 8);
 	}
-	
+
 	return 0;
 }
 
@@ -1193,7 +1193,7 @@
 		case 0:
 			// steam smoke.
 			if ( (v->tick_counter&0xF) == 0 && !IsTrainDepotTile(v->tile) && !IsTunnelTile(v->tile)) {
-				CreateEffectVehicleRel(v, 
+				CreateEffectVehicleRel(v,
 					(_vehicle_smoke_pos[v->direction]),
 					(_vehicle_smoke_pos[v->direction+8]),
 					10,
@@ -1257,14 +1257,14 @@
 	}
 
 	TrainPlayLeaveStationSound(v);
-	
+
 	v->u.rail.track = 1;
 	if (v->direction & 2)
 		v->u.rail.track = 2;
-	
+
 	v->vehstatus &= ~VS_HIDDEN;
 	v->cur_speed = 0;
-	
+
 	UpdateTrainDeltaXY(v, v->direction);
 	v->cur_image = GetTrainImage(v, v->direction);
 	VehiclePositionChanged(v);
@@ -1324,7 +1324,7 @@
 		// we've actually found the destination already. no point searching in directions longer than this.
 		if (ttfd->best_track_dist != (uint)-1)
 			return length >= ttfd->best_track_dist;
-		
+
 		// didn't find station
 		dist = GetTileDist(tile, ttfd->dest_coords);
 		if (dist < ttfd->best_bird_dist) {
@@ -1374,7 +1374,7 @@
 
 /* choose a track */
 static byte ChooseTrainTrack(Vehicle *v, uint tile, int direction, byte trackbits)
-{	
+{
 	TrainTrackFollowerData fd;
 	int bits = trackbits;
 	uint best_track;
@@ -1420,7 +1420,7 @@
 
 			fd.best_bird_dist = (uint)-1;
 			fd.best_track_dist = (uint)-1;
-			
+
 			NewTrainPathfind(tile, _search_directions[i][direction], (TPFEnumProc*)TrainTrackFollower, &fd, NULL);
 			if (best_track != -1) {
 				if (best_track_dist == -1) {
@@ -1430,7 +1430,7 @@
 						if (fd.best_bird_dist < best_bird_dist) goto good;
 					} else {
 						/* we found the destination for the first time */
-						goto good;		
+						goto good;
 					}
 				} else {
 					if (fd.best_track_dist == -1) {
@@ -1442,13 +1442,13 @@
 						if (fd.best_track_dist < best_track_dist) goto good;
 					}
 				}
-				
-				/* if we reach this position, there's two paths of equal value so far. 
+
+				/* if we reach this position, there's two paths of equal value so far.
 				 * pick one randomly. */
 				r = (byte)Random();
 				if (_pick_track_table[i] == train_dir) r += 80;
 				if (_pick_track_table[best_track] == train_dir) r -= 80;
-		
+
 				if (r <= 127) goto bad;
 			}
 	good:;
@@ -1508,7 +1508,7 @@
 					if (fd.best_bird_dist < best_bird_dist) goto good;
 				} else {
 					/* we found the destination for the first time */
-					goto good;		
+					goto good;
 				}
 			} else {
 				if (fd.best_bird_dist != 0) {
@@ -1520,8 +1520,8 @@
 					if (fd.best_track_dist < best_track_dist) goto good;
 				}
 			}
-			
-			/* if we reach this position, there's two paths of equal value so far. 
+
+			/* if we reach this position, there's two paths of equal value so far.
 			 * pick one randomly. */
 			r = (byte)Random();
 			if (_pick_track_table[i] == (v->direction & 3)) r += 80;
@@ -1549,7 +1549,7 @@
 
 	// These are un-interruptible
 	if ((v->next_order & OT_MASK) >= OT_GOTO_DEPOT && (v->next_order & OT_MASK) <= OT_LEAVESTATION) {
-		
+
 		// Let a depot order in the schedule interrupt.
 		if ((v->next_order & (OT_MASK|OF_UNLOAD)) != (OT_GOTO_DEPOT|OF_UNLOAD))
 			return false;
@@ -1565,9 +1565,9 @@
 		v->cur_order_index++;
 	}
 
-	// check if we've reached a non-stop station while TTDPatch nonstop is enabled.. 
-	if (_patches.new_nonstop && (v->next_order & OF_NON_STOP) && v->next_order_param == _map2[v->tile]) { 
-		v->cur_order_index++; 
+	// check if we've reached a non-stop station while TTDPatch nonstop is enabled..
+	if (_patches.new_nonstop && (v->next_order & OF_NON_STOP) && v->next_order_param == _map2[v->tile]) {
+		v->cur_order_index++;
 	}
 
 	// Get the current order
@@ -1623,7 +1623,7 @@
 {
 	if (v->next_order == OT_NOTHING)
 		return;
-	
+
 	if (v->next_order != OT_DUMMY) {
 		if ((v->next_order&OT_MASK) != OT_LOADING)
 			return;
@@ -1643,19 +1643,19 @@
 			if (LoadUnloadVehicle(v)) {
 				InvalidateWindow(WC_TRAINS_LIST, v->owner);
 				MarkTrainDirty(v);
-				
+
 				// need to update acceleration since the goods on the train changed.
 				UpdateTrainAcceleration(v);
 			}
 			return;
 		}
-		
+
 		TrainPlayLeaveStationSound(v);
-		
+
 		{
 			byte b = v->next_order;
 			v->next_order = OT_LEAVESTATION;
-			
+
 			// If this was not the final order, don't remove it from the list.
 			if (!(b & OF_NON_STOP))
 				return;
@@ -1735,7 +1735,7 @@
 static byte AfterSetTrainPos(Vehicle *v)
 {
 	byte new_z, old_z;
-	
+
 	// need this hint so it returns the right z coordinate on bridges.
 	_get_z_hint = v->z_pos;
 	new_z = GetSlopeZ(v->x_pos, v->y_pos);
@@ -1763,7 +1763,7 @@
 
 static int GetNewVehicleDirectionByTile(uint new_tile, uint old_tile)
 {
-	uint offs = (GET_TILE_Y(new_tile) - GET_TILE_Y(old_tile) + 1) * 4 + 
+	uint offs = (GET_TILE_Y(new_tile) - GET_TILE_Y(old_tile) + 1) * 4 +
 							GET_TILE_X(new_tile) - GET_TILE_X(old_tile) + 1;
 	assert(offs < 11);
 	return _new_vehicle_direction_table[offs];
@@ -1812,7 +1812,7 @@
 			// correct Z position of a train going under a bridge on slopes
 			if (CORRECT_Z(ti.tileh))
 				ti.z += 8;
-			
+
 			if(v->z_pos != ti.z) // train is going over bridge
 				return true;
 		}
@@ -1822,7 +1822,7 @@
 	if (_map_owner[tile] != v->owner ||
 			(v->subtype == 0 && (_map3_lo[tile] & 0xF) != v->u.rail.railtype))
 		return false;
-	
+
 	return true;
 }
 
@@ -1910,7 +1910,7 @@
 		return;
 
 	v->u.rail.crash_anim_pos++;
-	
+
 	u = v;
 	BEGIN_ENUM_WAGONS(v)
 		v->vehstatus |= VS_CRASHED;
@@ -1921,7 +1921,7 @@
 
 static int CountPassengersInTrain(Vehicle *v)
 {
-	int num = 0;	
+	int num = 0;
 	BEGIN_ENUM_WAGONS(v)
 		if (v->cargo_type == 0) num += v->cargo_count;
 	END_ENUM_WAGONS(v)
@@ -1943,8 +1943,8 @@
 	/* can't collide in depot */
 	if (v->u.rail.track == 0x80)
 		return;
-	
-	if ( !(v->u.rail.track == 0x40) ) 
+
+	if ( !(v->u.rail.track == 0x40) )
 		assert((uint)TILE_FROM_XY(v->x_pos, v->y_pos) == v->tile);
 
 	tcc.v = v;
@@ -1954,27 +1954,27 @@
 	realcoll = coll = VehicleFromPos(TILE_FROM_XY(v->x_pos, v->y_pos), &tcc, (VehicleFromPosProc*)FindTrainCollideEnum);
 	if (coll == NULL)
 		return;
-		
-	
+
+
 	coll = GetFirstVehicleInChain(coll);
-	
+
 	/* it can't collide with its own wagons */
 	if ( (v == coll) || ( (v->u.rail.track & 0x40) && ( (v->direction & 2) != (realcoll->direction & 2) ) ) )
 		return;
 
-	//two drivers + passangers killed in train v 
+	//two drivers + passangers killed in train v
 	num = 2 + CountPassengersInTrain(v);
-	if(!(coll->vehstatus&VS_CRASHED)) 
+	if(!(coll->vehstatus&VS_CRASHED))
 		//two drivers + passangers killed in train coll (if it was not crashed already)
 		num += 2 + CountPassengersInTrain(coll);
 
 	SetVehicleCrashed(v);
 	if (coll->subtype == 0)
 		SetVehicleCrashed(coll);
-	
-	
+
+
 	SET_DPARAM16(0, num);
-	
+
 	AddNewsItem(STR_8868_TRAIN_CRASH_DIE_IN_FIREBALL,
 		NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ACCIDENT, 0),
 		v->index,
@@ -2009,7 +2009,7 @@
 	/* For every vehicle after and including the given vehicle */
 	for(;;) {
 		BeginVehicleMove(v);
-		
+
 		if (v->u.rail.track != 0x40) {
 			/* Not inside tunnel */
 			if (GetNewVehiclePos(v, &gp)) {
@@ -2039,7 +2039,7 @@
 				/* Determine what direction we're entering the new tile from */
 				dir = GetNewVehicleDirectionByTile(gp.new_tile, gp.old_tile);
 				assert(dir==1 || dir==3 || dir==5 || dir==7);
-				
+
 				/* Get the status of the tracks in the new tile and mask
 				 * away the bits that aren't reachable. */
 				ts = GetTileTrackStatus(gp.new_tile, TRANSPORT_RAIL) & _reachable_tracks[dir >> 1];
@@ -2065,7 +2065,7 @@
 					if ( (tracks>>16)&chosen_track && v->u.rail.force_proceed == 0) goto red_light;
 				} else {
 					static byte _matching_tracks[8] = {0x30, 1, 0xC, 2, 0x30, 1, 0xC, 2};
-					
+
 					/* The wagon is active, simply follow the prev vehicle. */
 					chosen_track = (byte)(_matching_tracks[GetDirectionToVehicle(prev, gp.x, gp.y)] & tracks);
 				}
@@ -2080,7 +2080,7 @@
 					gp.y = (gp.y & ~0xF) | b[1];
 					chosen_dir = b[2];
 				}
-				
+
 				/* Call the landscape function and tell it that the vehicle entered the tile */
 				r = VehicleEnterTile(v, gp.new_tile, gp.x, gp.y);
 				if (r&0x8)
@@ -2100,7 +2100,7 @@
 				 * (above) or the last vehicle moves. */
 				if (v->next == NULL)
 					TrainMovedChangeSignals(gp.old_tile, (dir>>1) ^ 2);
-				
+
 				if (prev == NULL) {
 					AffectSpeedByDirChange(v, chosen_dir);
 				}
@@ -2110,7 +2110,7 @@
 		} else {
 			/* in tunnel */
 			GetNewVehiclePos(v, &gp);
-			
+
 			if (IS_TILETYPE(gp.new_tile, MP_TUNNELBRIDGE) &&
 					!(_map5[gp.new_tile] & 0xF0)) {
 				r = VehicleEnterTile(v, gp.new_tile, gp.x, gp.y);
@@ -2136,7 +2136,7 @@
 
 		/* update the Z position of the vehicle */
 		old_z = AfterSetTrainPos(v);
-		
+
 		if (prev == NULL) {
 			/* This is the first vehicle in the train */
 			AffectSpeedByZChange(v, old_z);
@@ -2162,7 +2162,7 @@
 		/* find the first set bit in ts. need to do it in 2 steps, since
 		 * FIND_FIRST_BIT only handles 6 bits at a time. */
 		i = FindFirstBit2x64(ts);
-		
+
 		if (!(_map3_lo[gp.new_tile] & _signal_otherdir[i])) {
 			v->cur_speed = 0;
 			v->subspeed = 0;
@@ -2181,7 +2181,7 @@
 			}
 		}
 	}
-		
+
 reverse_train_direction:
 	v->load_unload_time_rem = 0;
 	v->cur_speed = 0;
@@ -2216,7 +2216,7 @@
 	if (!((t=v->u.rail.track) & 0xC0)) {
 		SetSignalsOnBothDir(v->tile, FIND_FIRST_BIT(t));
 	}
-	
+
 	if (v->u.rail.track == 0x40) {
 		int length;
 		TileIndex endtile = CheckTunnelBusy(v->tile, &length);
@@ -2232,10 +2232,10 @@
 static void ChangeTrainDirRandomly(Vehicle *v)
 {
 	static int8 _random_dir_change[4] = { -1, 0, 0, 1};
-	
+
 	do {
 		//I need to buffer the train direction
-		if (!v->u.rail.track & 0x40) 
+		if (!v->u.rail.track & 0x40)
 			v->direction = (v->direction + _random_dir_change[Random()&3]) & 7;
 		if (!(v->vehstatus & VS_HIDDEN)) {
 			BeginVehicleMove(v);
@@ -2251,7 +2251,7 @@
 	int state = ++v->u.rail.crash_anim_pos, index;
 	uint32 r;
 	Vehicle *u;
-	
+
 	if ( (state == 4) && (v->u.rail.track != 0x40) ) {
 		CreateEffectVehicleRel(v, 4, 4, 8, EV_CRASHED_SMOKE);
 	}
@@ -2290,10 +2290,10 @@
 
 		if (v->breakdowns_since_last_service != 255)
 			v->breakdowns_since_last_service++;
-		
+
 		InvalidateWindow(WC_VEHICLE_VIEW, v->index);
 		InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
-		
+
 		SndPlayVehicleFx((_opt.landscape != LT_CANDY) ? 0xE : 0x3A, v);
 
 		if (!(v->vehstatus & VS_HIDDEN)) {
@@ -2324,7 +2324,7 @@
 
 	if ((uint)(t=v->breakdown_ctr) > 1) {
 		v->vehstatus |= VS_TRAIN_SLOWING;
-		
+
 		t = _breakdown_speeds[ ((~t) >> 4) & 0xF];
 		if ((uint16)t <= v->cur_speed)
 			v->cur_speed = t;
@@ -2342,7 +2342,7 @@
 	if (IS_TILETYPE(tile, MP_TUNNELBRIDGE) &&
 			(_map5[tile] & 0xF0) == 0 && (byte)((_map5[tile] & 3)*2+1) == v->direction)
 				return;
-	
+
 	// depot?
 	if (IS_TILETYPE(tile, MP_RAILWAY) && (_map5[tile] & 0xFC) == 0xC0)
 		return;
@@ -2356,11 +2356,11 @@
 	tile += _tileoffs_by_dir[t];
 	// determine the track status on the next tile.
  	ts = GetTileTrackStatus(tile, TRANSPORT_RAIL) & _reachable_tracks[t];
-	
+
 	/* Calc position within the current tile ?? */
 	x = v->x_pos & 0xF;
 	y = v->y_pos & 0xF;
-	
+
 	switch(v->direction) {
 	case 0:
 		x = (~x) + (~y) + 24;
@@ -2488,7 +2488,7 @@
 
 	if (v->subtype == 0) {
 		TrainLocoHandler(v, false);
-		
+
 		// make sure vehicle wasn't deleted.
 		if (v->type == VEH_Train && v->subtype == 0)
 			TrainLocoHandler(v, true);
@@ -2519,7 +2519,7 @@
 
 	if ((v->next_order&OT_MASK) == OT_GOTO_DEPOT) {
 		InvalidateWindow(WC_VEHICLE_VIEW, v->index);
-	
+
 		t = v->next_order;
 		v->next_order = OT_DUMMY;
 
@@ -2557,7 +2557,7 @@
 
 	if (_patches.gotodepot && ScheduleHasDepotOrders(v->schedule_ptr))
 		return;
-	
+
 	// Don't interfere with a depot visit scheduled by the user, or a
 	// depot visit by the order list.
 	if ((v->next_order & OT_MASK) == OT_GOTO_DEPOT &&
@@ -2607,9 +2607,9 @@
 	if (v->subtype == 0) {
 		CheckVehicleBreakdown(v);
 		AgeVehicle(v);
-		
+
 		CheckIfTrainNeedsService(v);
-		
+
 		// check if train hasn't advanced in its order list for a set number of days
 		if (_patches.lost_train_days && v->num_orders && !(v->vehstatus & VS_STOPPED) && ++v->u.rail.days_since_order_progr >= _patches.lost_train_days && v->owner == _local_player) {
 			v->u.rail.days_since_order_progr = 0;
@@ -2622,7 +2622,7 @@
 		}
 
 		CheckOrders(v);
-				
+
 		/* update destination */
 		if ((v->next_order & OT_MASK) == OT_GOTO_STATION &&
 				(tile=DEREF_STATION(v->next_order_param)->train_tile) != 0)
@@ -2649,7 +2649,7 @@
 
 	FOR_ALL_VEHICLES(v) {
 		if (v->type == VEH_Train && v->subtype == 0) {
-			
+
 			// show warning if train is not generating enough income last 2 years (corresponds to a red icon in the vehicle list)
 			if (_patches.train_income_warn && v->owner == _local_player && v->age >= 730 && v->profit_this_year < 0) {
 				SET_DPARAM32(1, v->profit_this_year);
--- a/train_gui.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/train_gui.c	Fri Sep 10 19:02:27 2004 +0000
@@ -63,7 +63,7 @@
 
 	if (!success)
 		return;
-				
+
 	v = &_vehicles[_new_train_id];
 	if (tile == _backup_orders_tile) {
 		_backup_orders_tile = 0;
@@ -76,7 +76,7 @@
 {
 	switch(e->event) {
 	case WE_PAINT:
-	
+
 		if (w->window_number == 0)
 			SETBIT(w->disabled_state, 5);
 
@@ -93,7 +93,7 @@
 
 		SET_DPARAM16(0, WP(w,buildtrain_d).railtype + STR_881C_NEW_RAIL_VEHICLES);
 		DrawWindowWidgets(w);
-		
+
 		{
 			int num = _rail_engines_count[WP(w,buildtrain_d).railtype];
 			Engine *e = _rail_engines[WP(w,buildtrain_d).railtype];
@@ -112,7 +112,7 @@
 						DrawTrainEngine(x+29, y+6, engine_id, SPRITE_PALETTE(PLAYER_SPRITE_COLOR(_local_player)));
 						y += 14;
 					}
-					sel--; 
+					sel--;
 				}
 			} while (++engine_id, ++e,--num);
 
@@ -132,15 +132,15 @@
 					SET_DPARAM16(3, rvi->power << multihead);
 					SET_DPARAM16(1, rvi->weight << multihead);
 					SET_DPARAM32(4, (rvi->running_cost_base * _price.running_rail[rvi->engclass] >> 8) << multihead);
-					
+
 					SET_DPARAM16(5, STR_8838_N_A);
 					if (rvi->capacity != 0) {
 						SET_DPARAM16(6, rvi->capacity << multihead);
 						SET_DPARAM16(5, _cargoc.names_long_p[rvi->cargo_type]);
 					}
 
-					e = &_engines[selected_id];	
-					
+					e = &_engines[selected_id];
+
 					SET_DPARAM16(8, e->lifelength);
 					SET_DPARAM8(9, e->reliability * 100 >> 16);
 					ConvertDayToYMD(&ymd, e->intro_date);
@@ -207,7 +207,7 @@
 	} break;
 	}
 }
-	
+
 static const Widget _new_rail_vehicle_widgets[] = {
 {   WWT_CLOSEBOX,    14,     0,    10,     0,    13, STR_00C5,	STR_018B_CLOSE_WINDOW},
 {    WWT_CAPTION,    14,    11,   227,     0,    13, STR_0315,	STR_018C_WINDOW_TITLE_DRAG_THIS},
@@ -236,7 +236,7 @@
 	w = AllocateWindowDesc(&_new_rail_vehicle_desc);
 	w->window_number = tile;
 	w->vscroll.cap = 8;
-	
+
 	if (tile != 0) {
 		w->caption_color = _map_owner[tile];
 		WP(w,buildtrain_d).railtype = _map3_lo[tile] & 0xF;
@@ -296,7 +296,7 @@
 	}
 	SetVScrollCount(w, num);
 	SetHScrollCount(w, hnum);
-	
+
 	/* locate the depot struct */
 	for(d=_depots; d->xy != (TileIndex)tile; d++) {}
 
@@ -312,7 +312,7 @@
 		if (v->type == VEH_Train &&
 				v->subtype == 0 &&
 				v->tile == (TileIndex)tile &&
-				v->u.rail.track == 0x80 && 
+				v->u.rail.track == 0x80 &&
 				--num < 0 && num >= -6) {
 
 			DrawTrainImage(v, x+21, y, 10, w->hscroll.pos, WP(w,traindepot_d).sel);
@@ -331,7 +331,7 @@
 		if (v->type == VEH_Train &&
 				v->subtype == 4 &&
 				v->tile == (TileIndex)tile &&
-				v->u.rail.track == 0x80 && 
+				v->u.rail.track == 0x80 &&
 				--num < 0 && num >= -6) {
 
 			DrawTrainImage(v, x+50, y, 9, 0, WP(w,traindepot_d).sel);
@@ -395,20 +395,20 @@
 	/* didn't find anything, get out */
 	return 0;
 
-found_it:	
+found_it:
 	d->head = d->wagon = v;
 
 	/* either pressed the flag or the number, but only when it's a loco */
 	if (area_x < 0 && v->subtype==0)
 		return area_x;
-	
+
 	/* find the vehicle in this row that was clicked */
 	while (--area_x >= 0) {
 		v = v->next;
 		if (v == NULL) break;
 	}
 
-	d->wagon = v;	
+	d->wagon = v;
 
 	return 0;
 }
@@ -447,7 +447,7 @@
 
 	// share / copy orders
 	if (_thd.place_mode && mode <= 0) { _place_clicked_vehicle = gdvp.head; return; }
-	
+
 	v = gdvp.wagon;
 
 	switch(mode) {
@@ -482,10 +482,10 @@
 
 	case WE_CLICK: {
 		switch(e->click.widget) {
-		case 6: 
+		case 6:
 			ShowBuildTrainWindow(w->window_number);
 			break;
-		case 7: 
+		case 7:
 			ScrollMainWindowToTile(w->window_number);
 			break;
 		case 2:
@@ -513,7 +513,7 @@
 				return;
 
 			v = &_vehicles[WP(w,traindepot_d).sel];
-			
+
 			WP(w,traindepot_d).sel = INVALID_VEHICLE;
 			SetWindowDirty(w);
 
@@ -538,14 +538,14 @@
 				WP(w,traindepot_d).sel = INVALID_VEHICLE;
 				SetWindowDirty(w);
 
-				if (GetVehicleFromTrainDepotWndPt(w, e->dragdrop.pt.x, e->dragdrop.pt.y, &gdvp) == 0 && 
+				if (GetVehicleFromTrainDepotWndPt(w, e->dragdrop.pt.x, e->dragdrop.pt.y, &gdvp) == 0 &&
 						sel != INVALID_VEHICLE) {
 					if (gdvp.wagon == NULL || gdvp.wagon->index != sel) {
 						TrainDepotMoveVehicle(gdvp.wagon, sel, gdvp.head);
 					} else if (gdvp.head != NULL && gdvp.head->subtype==0) {
 						ShowTrainViewWindow(gdvp.head);
 					}
-				}			
+				}
 			} break;
 
 		default:
@@ -722,11 +722,11 @@
 		Vehicle *v;
 		StringID str;
 
-		v = &_vehicles[w->window_number];	
-	
+		v = &_vehicles[w->window_number];
+
 		w->disabled_state = (v->owner == _local_player) ? 0 : 0x1C0;
-		
-		
+
+
 		/* draw widgets & caption */
 		SET_DPARAM16(0, v->string_id);
 		SET_DPARAM16(1, v->unitnumber);
@@ -734,7 +734,7 @@
 
 		/* draw the flag */
 		DrawSprite( (v->vehstatus&VS_STOPPED) ? 0xC12 : 0xC13, 2, 123);
-		
+
 		if (v->u.rail.crash_anim_pos != 0) {
 			str = STR_8863_CRASHED;
 		} else if (v->breakdown_ctr == 1) {
@@ -772,7 +772,7 @@
 				SET_DPARAM16(1, v->u.rail.last_speed * 10 >> 4);
 				break;
 			}
-			
+
 			default:
 				if (v->num_orders == 0) {
 					str = STR_NO_ORDERS + _patches.vehicle_speed;
@@ -792,20 +792,20 @@
 		Vehicle *v = &_vehicles[w->window_number];
 
 		switch(wid) {
-		case 4: /* start/stop train */ 
-			DoCommandP(v->tile, v->index, 0, NULL, CMD_START_STOP_TRAIN | CMD_MSG(STR_883B_CAN_T_STOP_START_TRAIN)); 
+		case 4: /* start/stop train */
+			DoCommandP(v->tile, v->index, 0, NULL, CMD_START_STOP_TRAIN | CMD_MSG(STR_883B_CAN_T_STOP_START_TRAIN));
 			break;
 		case 5:	/* center main view */
 			ScrollMainWindowTo(v->x_pos, v->y_pos);
 			break;
 		case 6:	/* goto depot */
-			DoCommandP(v->tile, v->index, 0, NULL, CMD_TRAIN_GOTO_DEPOT | CMD_MSG(STR_8830_CAN_T_SEND_TRAIN_TO_DEPOT)); 
+			DoCommandP(v->tile, v->index, 0, NULL, CMD_TRAIN_GOTO_DEPOT | CMD_MSG(STR_8830_CAN_T_SEND_TRAIN_TO_DEPOT));
 			break;
 		case 7: /* force proceed */
-			DoCommandP(v->tile, v->index, 0, NULL, CMD_FORCE_TRAIN_PROCEED | CMD_MSG(STR_8862_CAN_T_MAKE_TRAIN_PASS_SIGNAL)); 
+			DoCommandP(v->tile, v->index, 0, NULL, CMD_FORCE_TRAIN_PROCEED | CMD_MSG(STR_8862_CAN_T_MAKE_TRAIN_PASS_SIGNAL));
 			break;
 		case 8: /* reverse direction */
-			DoCommandP(v->tile, v->index, 0, NULL, CMD_REVERSE_TRAIN_DIRECTION | CMD_MSG(STR_8869_CAN_T_REVERSE_DIRECTION)); 
+			DoCommandP(v->tile, v->index, 0, NULL, CMD_REVERSE_TRAIN_DIRECTION | CMD_MSG(STR_8869_CAN_T_REVERSE_DIRECTION));
 			break;
 		case 9: /* show train orders */
 			ShowOrdersWindow(v);
@@ -828,7 +828,7 @@
 		Vehicle *v;
 		uint32 h;
 
-		v = &_vehicles[w->window_number];		
+		v = &_vehicles[w->window_number];
 		assert(v->type == VEH_Train);
 		h = CheckStoppedInDepot(v) >= 0 ? (1 << 8) : (1 << 11);
 		if (h != w->hidden_state) {
@@ -893,7 +893,7 @@
 		SET_DPARAM16(0, GetCustomEngineName(v->engine_type));
 		SET_DPARAM32(1, v->value);
 		DrawString(x, y, STR_882D_VALUE, 0x10);
-	}	
+	}
 }
 
 static void TrainDetailsCapacityTab(Vehicle *v, int x, int y)
@@ -927,7 +927,7 @@
 	// det_tab == 3 <-- Total Cargo tab
 	if (det_tab == 3)	// reset tot_cargo array to 0 values
 		memset(tot_cargo, 0, sizeof(tot_cargo));
-	
+
 	u = v = &_vehicles[w->window_number];
 	do {
 		if (det_tab != 3)
@@ -964,9 +964,9 @@
 
 	num = v->age / 366;
 	SET_DPARAM16(1, num);
-	
+
 	x = 2;
-	
+
 	str = STR_0199_YEAR;
 	if (num != 1) {
 		str += STR_019A_YEARS - STR_0199_YEAR;
@@ -975,7 +975,7 @@
 	}
 	SET_DPARAM16(0, str);
 	SET_DPARAM16(2, v->max_age / 366);
-	SET_DPARAM32(3, GetTrainRunningCost(v) >> 8);	
+	SET_DPARAM32(3, GetTrainRunningCost(v) >> 8);
 	DrawString(x, 15, STR_885D_AGE_RUNNING_COST_YR, 0);
 
 	SET_DPARAM16(2, v->max_speed * 10 >> 4);
@@ -998,7 +998,7 @@
 	x = 1;
 	y = 57;
 	sel = w->vscroll.pos;
-	
+
 	// draw the first 3 details tabs
 	if (det_tab != 3) {
 		for(;;) {
@@ -1058,7 +1058,7 @@
 				mod = _patches.servint_ispercent ? clamp(mod, MIN_SERVINT_PERCENT, MAX_SERVINT_PERCENT) : clamp(mod, MIN_SERVINT_DAYS, MAX_SERVINT_DAYS+1);
 				if (mod == v->service_interval)
 					return;
-			
+
 			DoCommandP(v->tile, v->index, mod, NULL, CMD_CHANGE_TRAIN_SERVICE_INT | CMD_MSG(STR_018A_CAN_T_CHANGE_SERVICING));
 			break;
 		/* details buttons*/
@@ -1127,7 +1127,7 @@
 	DeleteWindowById(WC_VEHICLE_ORDERS, veh);
 	DeleteWindowById(WC_VEHICLE_DETAILS, veh);
 
-	_alloc_wnd_parent_num = veh;	
+	_alloc_wnd_parent_num = veh;
 	w = AllocateWindowDesc(&_train_details_desc);
 
 	w->window_number = veh;
@@ -1163,7 +1163,7 @@
 		// trains are stored as a cummulative index, eg 25, 41, 43. This means
 		// Player0: 25; Player1: (41-25) 16; Player2: (43-41) 2
 		for (i = &_num_train_sort[1]; i != endof(_num_train_sort); i++) {*i += *(i-1);}
-	
+
 		// sort by owner, then only subsort the requested owner-vehicles
 		qsort(_train_sort, n, sizeof(_train_sort[0]), GeneralOwnerSorter);
 
@@ -1208,7 +1208,7 @@
 		// Player0: 25; Player1: (41-25) 16; Player2: (43-41) 2 trains
 		i = (window_number == 0) ? 0 : _num_train_sort[window_number-1];
 		SetVScrollCount(w, _num_train_sort[window_number] - i);
-		
+
 		/* draw the widgets */
 		{
 			Player *p = DEREF_PLAYER(window_number);
@@ -1251,7 +1251,7 @@
 				SET_DPARAM32(0, v->profit_this_year);
 				SET_DPARAM32(1, v->profit_last_year);
 				DrawString(x + 21, y + 18, STR_0198_PROFIT_THIS_YEAR_LAST_YEAR, 0);
-				
+
 				if (v->string_id != STR_SV_TRAIN_NAME) {
 					SET_DPARAM16(0, v->string_id);
 					DrawString(x+21, y, STR_01AB, 0);
@@ -1276,7 +1276,7 @@
 			return;
 		case 6: { /* Matrix to show vehicles */
 			uint32 id_v = (e->click.pt.y - PLY_WND_PRC__OFFSET_TOP_WIDGET) / PLY_WND_PRC__SIZE_OF_ROW_SMALL;
-			
+
 			if (id_v >= w->vscroll.cap) { return;} // click out of bounds
 
 			id_v += w->vscroll.pos;
@@ -1301,15 +1301,15 @@
 
 			tile = _last_built_train_depot_tile;
 			do {
-				if (_map_owner[tile] == _local_player && IsTrainDepotTile(tile)) {			
+				if (_map_owner[tile] == _local_player && IsTrainDepotTile(tile)) {
 					ShowTrainDepotWindow(tile);
 					ShowBuildTrainWindow(tile);
 					return;
 				}
-				
+
 				tile = TILE_MASK(tile + 1);
 			} while(tile != _last_built_train_depot_tile);
-			
+
 			ShowBuildTrainWindow(0);
 		} break;
 		}
--- a/tree_cmd.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/tree_cmd.c	Fri Sep 10 19:02:27 2004 +0000
@@ -18,7 +18,7 @@
 			return (seed >> 6) + 28;
 		} else if (i == 1) {
 			if (seed > 12)
-				return -1;	
+				return -1;
 			return 27;
 		} else {
 			return (seed * 7 >> 8) + 20;
@@ -144,7 +144,7 @@
 	int32 cost;
 	int sx,sy,x,y;
 	int treetype;
-	
+
 	SET_EXPENSES_TYPE(EXPENSES_OTHER);
 
 	// make sure sx,sy are smaller than ex,ey
@@ -152,7 +152,7 @@
 	sy = GET_TILE_Y(p2)*16;
 	if (ex < sx) intswap(ex, sx);
 	if (ey < sy) intswap(ey, sy);
-	
+
 	cost = 0; // total cost
 
 	for(x=sx; x<=ex; x+=16) {
@@ -174,7 +174,7 @@
 				}
 				// 2x as expensive to add more trees to an existing tile
 				cost += _price.build_trees * 2;
-			} else {		
+			} else {
 				// don't allow building on rocks
 				if (ti.type != MP_CLEAR || _map_owner[ti.tile] != OWNER_NONE || (ti.map5 & 0x1C) == 8) {
 					_error_message = STR_2804_SITE_UNSUITABLE;
@@ -204,9 +204,9 @@
 						treetype = GetRandomTreeType(ti.tile, Random()>>24);
 						if (treetype==-1) treetype=27;
 					}
-					
+
 					ModifyTile(ti.tile,
-						MP_SETTYPE(MP_TREES) | 
+						MP_SETTYPE(MP_TREES) |
 						MP_MAP2 | MP_MAP3LO | MP_MAP3HI_CLEAR | MP_MAP5,
 						m2, /* map2 */
 						treetype, /* map3lo */
@@ -221,7 +221,7 @@
 			}
 		}
 	}
-	
+
 	if (cost == 0) return CMD_ERROR;
 	return cost;
 }
@@ -276,12 +276,12 @@
 		d = _tree_layout_xy[(tmp & 0x30) >> 4];
 
 		index = ((tmp>>6)&3) + (_map3_lo[ti->tile]<<2);
-		
+
 		/* different tree styles above one of the grounds */
 		if ((m2 & 0xB0) == 0xA0 && index >= 48 && index < 80)
 			index += 164 - 48;
-		
-		assert(index < lengthof(_tree_layout_sprite));		
+
+		assert(index < lengthof(_tree_layout_sprite));
 		s = _tree_layout_sprite[index];
 	}
 
@@ -342,7 +342,7 @@
 
 	if (flags & DC_EXEC && _current_player < MAX_PLAYERS) {
 		Town *t = ClosestTownFromTile(tile, _patches.dist_local_authority);
-		if (t != NULL) 
+		if (t != NULL)
 			ChangeTownRating(t, -35, -1000);
 	}
 
@@ -372,7 +372,7 @@
 	(str=STR_2810_CACTUS_PLANTS, b==0x1B) ||
 	(str=STR_280F_RAINFOREST, IS_BYTE_INSIDE(b, 0x14, 0x1A+1)) ||
 	(str=STR_280E_TREES, true);
-	td->str = str; 
+	td->str = str;
 }
 
 static void AnimateTile_Trees(uint tile)
@@ -420,7 +420,7 @@
 		m2 = 0;
 	} else if (k == -8) {
 		/* snow_m1 */
-		m2 = 0x20; 
+		m2 = 0x20;
 		if (tmp == m2)
 			return;
 	} else if (k < 8) {
@@ -492,7 +492,7 @@
 			case 0: /* start destructing */
 				m5++;
 				break;
-			
+
 			case 1: /* add a tree */
 				if (m5 < 0xC0) {
 					m5 = (m5 + 0x40) & ~7;
@@ -502,7 +502,7 @@
 
 			case 2: { /* add a neighbouring tree */
 				byte m3 = _map3_lo[tile];
-				
+
 				tile += _tileloop_trees_dir[Random() & 7];
 
 				if (!IS_TILETYPE(tile, MP_CLEAR))
@@ -525,7 +525,7 @@
 
 				m5 = 0;
 				break;
-			}	
+			}
 
 			default:
 				return;
@@ -566,14 +566,14 @@
 	int tree;
 
 	/* place a tree at a random rainforest spot */
-	if (_opt.landscape == LT_DESERT && 
+	if (_opt.landscape == LT_DESERT &&
 			(r=Random(),tile=TILE_MASK(r),GetMapExtraBits(tile)==2) &&
 			IS_TILETYPE(tile, MP_CLEAR) &&
 			(m=_map5[tile]&0x1C, m<=4) &&
 			(tree=GetRandomTreeType(tile, r>>24)) >= 0) {
-		
+
 		ModifyTile(tile,
-			MP_SETTYPE(MP_TREES) | 
+			MP_SETTYPE(MP_TREES) |
 			MP_MAP2 | MP_MAP3LO | MP_MAP3HI | MP_MAP5,
 			(m == 4 ? 0x10 : 0),
 			tree,
@@ -585,7 +585,7 @@
 	// byte underflow
 	if (--_trees_tick_ctr)
 		return;
-	
+
 	/* place a tree at a random spot */
 	r = Random();
 	tile = TILE_MASK(r);
@@ -593,7 +593,7 @@
 			(m=_map5[tile]&0x1C, m==0 || m==4 || m==0x10) &&
 			(tree=GetRandomTreeType(tile, r>>24)) >= 0) {
 		int m2;
-			
+
 		if (m == 0) {
 			m2 = 0;
 		} else if (m == 4) {
@@ -603,7 +603,7 @@
 		}
 
 		ModifyTile(tile,
-			MP_SETTYPE(MP_TREES) | 
+			MP_SETTYPE(MP_TREES) |
 			MP_MAP2 | MP_MAP3LO | MP_MAP3HI | MP_MAP5,
 			m2,
 			tree,
--- a/ttd.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/ttd.c	Fri Sep 10 19:02:27 2004 +0000
@@ -59,7 +59,7 @@
 	va_start(va, s);
 	vsprintf(buf, s, va);
 	va_end(va);
-	
+
 	ShowOSErrorBox(buf);
 	if (_video_driver)
 		_video_driver->stop();
@@ -145,7 +145,7 @@
 
 static bool NullVideoChangeRes(int w, int h) { return false; }
 
-	
+
 const HalVideoDriver _null_video_driver = {
 	NullVideoStart,
 	NullVideoStop,
@@ -298,7 +298,7 @@
 	const DriverDesc *dd;
 	int i;
 
-	p = strecpy(buf, 
+	p = strecpy(buf,
 		"Command line options:\n"
 		"  -v drv = Set video driver (see below)\n"
 		"  -s drv = Set sound driver (see below)\n"
@@ -313,7 +313,7 @@
 		"  -G seed= Set random seed\n"
 	);
 
-	for(i=0; i!=lengthof(_driver_classes); i++,dc++) { 
+	for(i=0; i!=lengthof(_driver_classes); i++,dc++) {
 		p += sprintf(p, "List of %s drivers:\n", dc->name);
 		dd = dc->descs;
 		do {
@@ -427,7 +427,7 @@
 	if (*s >= '0' && *s <= '9') {
 		v = strtoul(s, &end, 0);
 		s = end;
-		
+
 		_debug_spritecache_level = v;
 		_debug_misc_level = v;
 		_debug_grf_level = v;
@@ -460,7 +460,7 @@
 		v = strtoul(s, &end, 0);
 		s = end;
 		if (p) *p = v;
-	}		
+	}
 }
 
 void ParseResolution(int res[2], char *s)
@@ -473,7 +473,7 @@
 
 	res[0] = (strtoul(s, NULL, 0) + 7) & ~7;
 	res[1] = (strtoul(t+1, NULL, 0) + 7) & ~7;
-} 
+}
 
 int ttd_main(int argc, char* argv[])
 {
@@ -500,10 +500,10 @@
 		case 's': ttd_strlcpy(sounddriver, mgo.opt, sizeof(sounddriver)); break;
 		case 'v': ttd_strlcpy(videodriver, mgo.opt, sizeof(videodriver)); break;
 		case 'n': {
-				network = 1; 
+				network = 1;
 				_networking_override=true;
 				if (mgo.opt) {
-					network_conn = mgo.opt; 
+					network_conn = mgo.opt;
 					network++;
 				}
 				else
@@ -525,7 +525,7 @@
 			} break;
 		case 'e': _switch_mode = SM_EDITOR; break;
 		case 'i': _ignore_wrong_grf = true; break;
-		case 'g': 
+		case 'g':
 			if (mgo.opt) {
 				strcpy(_file_to_saveload.name, mgo.opt);
 				_switch_mode = SM_LOAD;
@@ -568,10 +568,10 @@
 
 	// initialize airport state machines
 	InitializeAirports();
-	
+
 	// Sample catalogue
 	DEBUG(misc, 1) ("Loading sound effects...");
-	MxInitialize(11025, "sample.cat"); 
+	MxInitialize(11025, "sample.cat");
 
 	// This must be done early, since functions use the InvalidateWindow* calls
 	InitWindowSystem();
@@ -588,7 +588,7 @@
 
 	// Default difficulty level
 	_opt_mod_ptr = &_new_opt;
-	
+
 	// ugly hack, if diff_level is 9, it means we got no setting from the config file, so we load the default settings.
 	if (_opt_mod_ptr->diff_level == 9)
 		SetDifficultyLevel(0, _opt_mod_ptr);
@@ -646,7 +646,7 @@
 	_opt_mod_ptr = &_new_opt;
 	GfxLoadSprites();
 	LoadStringWidthTable();
-	
+
 	// Setup main window
 	InitWindowSystem();
 	SetupColorsAndInitialWindow();
@@ -655,7 +655,7 @@
 	sprintf(filename, "%sopntitle.dat",  _path.data_dir);
 	if (SaveOrLoad(filename, SL_LOAD) != SL_OK)
 		GenerateWorld(1); // if failed loading, make empty world.
-	
+
 	_opt.currency = _new_opt.currency;
 
 	_pause = 0;
@@ -687,7 +687,7 @@
 
 	// Create a single player
 	DoStartupNewPlayer(false);
-	
+
 	_local_player = 0;
 
 	MarkWholeScreenDirty();
@@ -700,7 +700,7 @@
 	// Copy in game options
 	_opt_mod_ptr = &_opt;
 	memcpy(&_opt, &_new_opt, sizeof(_opt));
-	
+
 	GfxLoadSprites();
 
 	// Re-init the windowing system
@@ -758,7 +758,7 @@
 	//  and in AfterLoad a player is started when it is
 	//  a scenario.. so we do not need it here.
 //	DoStartupNewPlayer(false);
-	
+
 	_local_player = 0;
 
 	MarkWholeScreenDirty();
@@ -781,7 +781,7 @@
 		return false;
 	} else if (r != SL_OK) {
 		_game_mode = ogm;
-		return false;		
+		return false;
 	} else
 		return true;
 }
@@ -789,7 +789,7 @@
 static void SwitchMode(int new_mode)
 {
 	_in_state_game_loop = true;
-	
+
 	switch(new_mode) {
 	case SM_EDITOR: // Switch to scenario editor
 		MakeNewEditorWorld();
@@ -842,7 +842,7 @@
 
 
 	case SM_MENU: // Switch to game menu
-		
+
 		if ((_networking) && (!_networking_override)) NetworkCoreDisconnect();
 		_networking_override=false;
 
@@ -863,8 +863,8 @@
 		MarkWholeScreenDirty();
 		break;
 	}
-	
-	if (_switch_mode_errorstr!=INVALID_STRING_ID) 
+
+	if (_switch_mode_errorstr!=INVALID_STRING_ID)
 		ShowErrorMessage(INVALID_STRING_ID,_switch_mode_errorstr,0,0);
 
 	_in_state_game_loop = false;
@@ -885,10 +885,10 @@
 	_sync_seed_2 = _random_seed_2;
 	if (_networking) disable_computer=true;
 
-	if (_savedump_path[0] && (uint)_frame_counter >= _savedump_first && (uint)(_frame_counter -_savedump_first) % _savedump_freq == 0 ) { 
-		char buf[100]; 
-		sprintf(buf, "%s%.5d.sav", _savedump_path, _frame_counter); 
-		SaveOrLoad(buf, SL_SAVE); 
+	if (_savedump_path[0] && (uint)_frame_counter >= _savedump_first && (uint)(_frame_counter -_savedump_first) % _savedump_freq == 0 ) {
+		char buf[100];
+		sprintf(buf, "%s%.5d.sav", _savedump_path, _frame_counter);
+		SaveOrLoad(buf, SL_SAVE);
 		if ((uint)_frame_counter >= _savedump_last) exit(1);
 	}
 
@@ -917,7 +917,7 @@
 static void DoAutosave()
 {
 	char buf[200];
-	
+
 	if (_patches.keep_all_autosave && _local_player != OWNER_SPECTATOR) {
 		Player *p;
 		char *s;
@@ -1063,7 +1063,7 @@
 	FOR_ALL_TOWNS(t) if (t->xy != 0) {
 		t->exclusivity=(byte)-1;
 	}
-	
+
 	/* FIXME old exclusive rights status is not being imported (stored in s->blocked_months_obsolete)
 			could be implemented this way:
 			1.) Go through all stations
@@ -1090,7 +1090,7 @@
 	if (version <= 0x400) {
 		UpdateExclusiveRights();
 	}
-	
+
 	// convert road side to my format.
 	if (_opt.road_side) _opt.road_side = 1;
 
@@ -1102,7 +1102,7 @@
 
 	// reinit the landscape variables (landscape might have changed)
 	InitializeLandscapeVariables(true);
-	
+
 	// Update all vehicles
 	AfterLoadVehicles();
 	// in version 2.2 of the savegame, we have new airports
@@ -1131,7 +1131,7 @@
 
 	WP(w,vp_d).scrollpos_x = _saved_scrollpos_x;
 	WP(w,vp_d).scrollpos_y = _saved_scrollpos_y;
-	
+
 	vp = w->viewport;
 	vp->zoom = _saved_scrollpos_zoom;
 	vp->virtual_width = vp->width << vp->zoom;
@@ -1143,8 +1143,8 @@
 	if (version <= 0x400) {
 		CheckIsPlayerActive();
 	}
-	
-	// If Load Scenario / New (Scenario) Game is used, 
+
+	// If Load Scenario / New (Scenario) Game is used,
 	//  a player does not exist yet. So create one here.
 	if (!_players[0].is_active)
 		DoStartupNewPlayer(false);
--- a/ttd.h	Fri Sep 10 18:54:23 2004 +0000
+++ b/ttd.h	Fri Sep 10 19:02:27 2004 +0000
@@ -9,7 +9,7 @@
 #endif
 
 // use this on non static functions
-#define PUBLIC 
+#define PUBLIC
 
 typedef struct Rect {
 	int left,top,right,bottom;
@@ -34,10 +34,10 @@
 
 /* --- 1 Day is 74 ticks ---
 * The game's internal structure is dictated by ticks. The date counter (date_fract) is an integer of
-* uint16 type, so it can have a max value of 65536. Every tick this variable (date_fract) is 
-* increased by 885. When it overflows, the new day loop is called. 
+* uint16 type, so it can have a max value of 65536. Every tick this variable (date_fract) is
+* increased by 885. When it overflows, the new day loop is called.
 * * this that means 1 day is : 65536 / 885 = 74 ticks
-* * 1 tick is approximately 27ms. 
+* * 1 tick is approximately 27ms.
 * * 1 day is thus about 2 seconds (74*27 = 1998) on a machine that can run OpenTTD normally
 */
 #define DAY_TICKS 74
@@ -196,7 +196,7 @@
 	int32 aircraft_running;
 	int32 roadveh_running;
 	int32 ship_running;
-	int32 build_industry;	
+	int32 build_industry;
 } Prices;
 
 #define GAME_DIFFICULTY_NUM 18
@@ -267,12 +267,12 @@
  * tracks = (byte)(ts | ts >>8)
  * This effectively converts the present part of the result (ccdd) to a
  * track bitmask, which disregards directions. Normally, this is the same as just
- * doing (byte)ts I think, although I am not really sure 
+ * doing (byte)ts I think, although I am not really sure
  *
  * A trackdir is combination of a track and a dir, where the lower three bits
  * are a track, the fourth bit is the direction. these give 12 (or 14)
  * possible options: 0-5 and 8-13, so we need 14 bits for a trackdir bitmask
- * above. 
+ * above.
  */
 typedef uint32 GetTileTrackStatusProc(uint tile, TransportType mode);
 typedef void GetProducedCargoProc(uint tile, byte *b);
@@ -316,7 +316,7 @@
 	MP_MAP5 = 1<<3,
 	MP_MAPOWNER_CURRENT = 1<<4,
 	MP_MAPOWNER = 1<<5,
-		
+
 	MP_TYPE_MASK = 0xF << 8,
 
 	MP_MAP2_CLEAR = 1 << 12,
@@ -466,7 +466,7 @@
 
 // special string constants
 enum SpecialStrings {
-	
+
 	// special strings for town names. the town name is generated dynamically on request.
 	SPECSTR_TOWNNAME_START = 0x20C0,
 	SPECSTR_TOWNNAME_ENGLISH = SPECSTR_TOWNNAME_START,
@@ -493,7 +493,7 @@
 	SPECSTR_PLAYERNAME_AMERICAN,
 	SPECSTR_PLAYERNAME_LATIN,
 	SPECSTR_PLAYERNAME_SILLY,
-	SPECSTR_PLAYERNAME_LAST = SPECSTR_PLAYERNAME_SILLY, 
+	SPECSTR_PLAYERNAME_LAST = SPECSTR_PLAYERNAME_SILLY,
 
 	SPECSTR_ANDCO_NAME = 0x70E6,
 	SPECSTR_PRESIDENT_NAME = 0x70E7,
--- a/tunnelbridge_cmd.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/tunnelbridge_cmd.c	Fri Sep 10 19:02:27 2004 +0000
@@ -17,7 +17,7 @@
 };
 
 static const byte _bridge_maxlen[MAX_BRIDGES] = {
-	16, 2, 5, 10, 16, 16, 7, 8, 9, 2, 16, 32, 32, 
+	16, 2, 5, 10, 16, 16, 7, 8, 9, 2, 16, 32, 32,
 };
 
 const uint16 _bridge_type_price_mod[MAX_BRIDGES] = {
@@ -31,8 +31,8 @@
 const PalSpriteID _bridge_sprites[MAX_BRIDGES] = {
 	0x0A24, 0x31E8A26, 0x0A25, 0x3208A22,
 	0x0A22, 0x3218A22, 0x0A23, 0x31C8A23,
-	0x31E8A23, 0x0A27, 0x0A28, 0x3218A28, 
-	0x3238A28, 
+	0x31E8A23, 0x0A27, 0x0A28, 0x3218A28,
+	0x3238A28,
 };
 
 const StringID _bridge_material[MAX_BRIDGES] = {
@@ -88,11 +88,11 @@
 					- no extra cost
 					- direction X: tiles 0,12
 					- direction Y: tiles 0, 9
-			*/		
+			*/
 			if ((direction?0x201:0x1001) & (1 << tileh))
 				return 0;
-			
-			// disallow certain start tiles to avoid certain crooked bridges	
+
+			// disallow certain start tiles to avoid certain crooked bridges
 			if (tileh == 2)
 				return CMD_ERROR;
 
@@ -106,7 +106,7 @@
 			if ((direction?0x41:0x9) & (1 << tileh))
 				return 0;
 
-			// disallow certain end tiles to avoid certain crooked bridges	
+			// disallow certain end tiles to avoid certain crooked bridges
 			if (tileh == 8)
 				return CMD_ERROR;
 
@@ -116,7 +116,7 @@
 		 *	start-tile:	X 2,1 Y 2,4 (2 was disabled before)
 		 *	end-tile:		X 8,4 Y 8,1 (8 was disabled before)
 		 */
-		if ( (tileh == 1 && (is_start_tile != (bool)direction)) || 
+		if ( (tileh == 1 && (is_start_tile != (bool)direction)) ||
 			   (tileh == 4 && (is_start_tile == (bool)direction))    )
 			return CMD_ERROR;
 
@@ -135,7 +135,7 @@
 	y1 = GET_TILE_Y(begin);
 	x2 = GET_TILE_X(end);
 	y2 = GET_TILE_Y(end);
-	
+
 	return abs((x2 + y2 - x1 - y1)) - 1;
 }
 
@@ -156,7 +156,7 @@
 	return true;
 }
 
-/* Build a Bridge 
+/* Build a Bridge
  * x,y - end tile coord
  * p1  - packed start tile coords (~ dx)
  * p2&0xFF - bridge type (hi bh)
@@ -174,11 +174,11 @@
 	int32 cost, terraformcost, ret;
 
 	SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
-	
+
 	/* unpack parameters */
 	bridge_type = p2 & 0xFF;
 	railtype = (byte)(p2 >> 8);
-	
+
 	// type of bridge
 	if (railtype & 0x80) {
 		railtype = 0;
@@ -238,9 +238,9 @@
 	cost = ret;
 
 	terraformcost = CheckBridgeSlope(direction, ti_start.tileh, true);	// true - bridge-start-tile, false - bridge-end-tile
-	
+
 	// towns are not allowed to use bridges on slopes.
-	if (terraformcost == CMD_ERROR || 
+	if (terraformcost == CMD_ERROR ||
 		 (terraformcost && ((!_patches.ainew_active && _is_ai_player) || _current_player == OWNER_TOWN || !_patches.build_on_slopes)))
 		return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
 
@@ -250,11 +250,11 @@
 	if ((ret=DoCommandByTile(ti_end.tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR)) == CMD_ERROR)
 		return CMD_ERROR;
 	cost += ret;
-	
+
 	terraformcost = CheckBridgeSlope(direction, ti_end.tileh, false);	// false - end tile slope check
 
 	// towns are not allowed to use bridges on slopes.
-	if (terraformcost == CMD_ERROR || 
+	if (terraformcost == CMD_ERROR ||
 		 (terraformcost && ((!_patches.ainew_active && _is_ai_player) || _current_player == OWNER_TOWN || !_patches.build_on_slopes)))
 		return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
 
@@ -299,7 +299,7 @@
 		if (ti.tileh != 0 && ti.z >= ti_start.z)
 			return CMD_ERROR;
 
-		// Find ship below 
+		// Find ship below
 		if ( ti.type == MP_WATER && !EnsureNoVehicle(ti.tile) )
 		{
 			_error_message = STR_980E_SHIP_IN_THE_WAY;
@@ -339,26 +339,26 @@
 			_map_type_and_height[ti.tile] |= MP_TUNNELBRIDGE << 4;
 
 			//bridges pieces sequence (middle parts)
-			// bridge len 1: 0 
+			// bridge len 1: 0
 			// bridge len 2: 0 1
 			// bridge len 3: 0 4 1
 			// bridge len 4: 0 2 3 1
 			// bridge len 5: 0 2 5 3 1
 			// bridge len 6: 0 2 3 2 3 1
 			// bridge len 7: 0 2 3 4 2 3 1
-			// #0 - alwats as first, #1 - always as last (if len>1) 
+			// #0 - alwats as first, #1 - always as last (if len>1)
 			// #2,#3 are to pair in order
 			// for odd bridges: #5 is going in the bridge middle if on even position, #4 on odd (counting from 0)
 
 			if(i==0)                    //first tile
-				m5 = 0; 
+				m5 = 0;
 			else if (i==bridge_len-1)   //last tile
 				m5 = 1;
 			else if(i==odd_middle_part) //we are on the middle of odd bridge: #5 on even pos, #4 on odd
 				m5 = 5 - (i%2);
 			else {
 					// generate #2 and #3 in turns [i%2==0], after the middle of odd bridge
-					// this sequence swaps [... XOR (i>odd_middle_part)], 
+					// this sequence swaps [... XOR (i>odd_middle_part)],
 					// for even bridges XOR does not apply as odd_middle_part==bridge_len
 					m5 = 2 + ((i%2==0)^(i>odd_middle_part));
 			}
@@ -377,7 +377,7 @@
 			It's unnecessary to execute this command every time for every bridge. So it is done only
 			and cost is computed in "bridge_gui.c". For AI, Towns this has to be of course calculated
 	*/
-	if (!(flags & DC_QUERY_COST)) {	
+	if (!(flags & DC_QUERY_COST)) {
 		bridge_len += 2;	// begin and end tiles/ramps
 
 		if (_current_player < MAX_PLAYERS && !(_is_ai_player && !_patches.ainew_active))
@@ -575,7 +575,7 @@
 
 	if (flags & DC_EXEC && DoBuildTunnel(x,y,tiorg.x,tiorg.y,flags&~DC_EXEC,excavated_tile) == CMD_ERROR)
 		return CMD_ERROR;
-	
+
 	return DoBuildTunnel(x,y,tiorg.x, tiorg.y,flags,excavated_tile);
 }
 
@@ -588,14 +588,14 @@
 	int delta = _tileoffs_by_dir[m5 & 3], len = 0;
 	uint starttile = tile;
 	Vehicle *v;
-	
+
 	do { tile += delta; len++; } while (!IS_TILETYPE(tile, MP_TUNNELBRIDGE) || _map5[tile]&0xF0 || (byte)(_map5[tile] ^ 2) != m5 || GetTileZ(tile) != z);
 
 	if ((v=FindVehicleBetween(starttile, tile, z)) != NULL) {
 		_error_message = v->type == VEH_Train ? STR_5000_TRAIN_IN_TUNNEL : STR_5001_ROAD_VEHICLE_IN_TUNNEL;
 		return (uint)-1;
 	}
-	
+
 	if (length) *length = len;
 	return tile;
 }
@@ -618,7 +618,7 @@
 	if (endtile == (uint)-1) return CMD_ERROR;
 
 	_build_tunnel_endtile = endtile;
-	
+
 	t = ClosestTownFromTile(tile, (uint)-1); //needed for town rating penalty
 	// check if you're allowed to remove the tunnel owned by a town
 	// removal allowal depends on difficulty settings
@@ -638,7 +638,7 @@
 		DoClearSquare(endtile);
 		UpdateSignalsOnSegment(tile, _updsignals_tunnel_dir[tile_dir]);
 		UpdateSignalsOnSegment(endtile, _updsignals_tunnel_dir[endtile_dir]);
-		if (_map_owner[tile] == OWNER_TOWN && _game_mode != GM_EDITOR) 
+		if (_map_owner[tile] == OWNER_TOWN && _game_mode != GM_EDITOR)
 			ChangeTownRating(t, -250, 0);
 	}
 	return  _price.clear_tunnel * (length + 1);
@@ -676,7 +676,7 @@
 	Vehicle *v;
 	Town *t;
 	int direction;
-	
+
 	SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
 
 	direction = _map5[tile]&1;
@@ -688,7 +688,7 @@
 		// check if we own the tile below the bridge..
 		if (_current_player != OWNER_WATER && (!CheckTileOwnership(tile) || !EnsureNoVehicleZ(tile, GET_TILEHEIGHT(tile)) ))
 			return CMD_ERROR;
-		
+
 		cost = (_map5[tile] & 8) ? _price.remove_road * 2 : _price.remove_rail;
 
 		if (flags & DC_EXEC) {
@@ -697,11 +697,11 @@
 			MarkTileDirtyByTile(tile);
 		}
 		return cost;
-		
+
 	/* delete canal under bridge */
 	} else if(_map5[tile]==0xC8 && GET_TILEHEIGHT(tile)!=0) {
 		int32 cost;
-		
+
 		// check for vehicles under bridge
 		if ( !EnsureNoVehicleZ(tile, GET_TILEHEIGHT(tile)) )
 			return CMD_ERROR;
@@ -732,7 +732,7 @@
 	tile		+= direction ? TILE_XY(0, 1) : TILE_XY( 1,0);
 	endtile	-= direction ? TILE_XY(0, 1) : TILE_XY( 1,0);
 	if ((v=FindVehicleBetween(tile, endtile, GET_TILEHEIGHT(tile) + 8)) != NULL) {
-		VehicleInTheWayErrMsg(v);		
+		VehicleInTheWayErrMsg(v);
 		return CMD_ERROR;
 	}
 
@@ -740,12 +740,12 @@
 	tile		-= direction ? TILE_XY(0, 1) : TILE_XY( 1,0);
 	endtile	+= direction ? TILE_XY(0, 1) : TILE_XY( 1,0);
 
-	
+
 	t = ClosestTownFromTile(tile, (uint)-1); //needed for town rating penalty
-	// check if you're allowed to remove the bridge owned by a town. 
+	// check if you're allowed to remove the bridge owned by a town.
 	// removal allowal depends on difficulty settings
 	if(_map_owner[tile] == OWNER_TOWN && _game_mode != GM_EDITOR) {
-		if (!CheckforTownRating(tile, flags, t, TUNNELBRIDGE_REMOVE)) 
+		if (!CheckforTownRating(tile, flags, t, TUNNELBRIDGE_REMOVE))
 			return CMD_ERROR;
 	}
 
@@ -756,8 +756,8 @@
 
 		//checks if the owner is town then decrease town rating by 250 until
 		// you have a "Poor" (0) town rating
-		if (_map_owner[tile] == OWNER_TOWN && _game_mode != GM_EDITOR) 
-			ChangeTownRating(t, -250, 0); 
+		if (_map_owner[tile] == OWNER_TOWN && _game_mode != GM_EDITOR)
+			ChangeTownRating(t, -250, 0);
 
 		do {
 			m5 = _map5[c];
@@ -787,7 +787,7 @@
 
 		SetSignalsOnBothDir(tile, direction);
 		SetSignalsOnBothDir(endtile, direction);
-		
+
 	}
 
 	return ((((endtile - tile) >> (direction?8:0))&0xFF)+1) * _price.clear_bridge;
@@ -826,7 +826,7 @@
 		if (!CheckTileOwnership(tile)) return CMD_ERROR;
 
 		if ( (uint)(_map3_lo[tile] & 0xF) == totype) return CMD_ERROR;
-		
+
 		endtile = CheckTunnelBusy(tile, &length);
 		if (endtile == (uint)-1) return CMD_ERROR;
 
@@ -861,7 +861,7 @@
 		starttile = tile = FindEdgesOfBridge(tile, &endtile);
 		// Make sure there's no vehicle on the bridge
 		if ((v=FindVehicleBetween(tile, endtile, 0xff)) != NULL) {
-			VehicleInTheWayErrMsg(v);		
+			VehicleInTheWayErrMsg(v);
 			return CMD_ERROR;
 		}
 
@@ -881,7 +881,7 @@
 		} while (tile <= endtile);
 
 		return cost;
-	} else 
+	} else
 		return CMD_ERROR;
 }
 
@@ -906,7 +906,7 @@
 	FindLandscapeHeightByTile(&ti_end, tile);
 	if (HASBIT(1 << 7, ti_end.tileh))
 		z_correction += 8;
-	
+
 	// return the height there (the height of the NORTH CORNER)
 	return GET_TILEHEIGHT(tile) + z_correction;
 }
@@ -973,7 +973,7 @@
 		return tileh;
 
 	// inclined sloped building
-	if (	((i=0, tileh == 1) || (i+=2, tileh == 2) || (i+=2, tileh == 4) || (i+=2, tileh == 8)) && 
+	if (	((i=0, tileh == 1) || (i+=2, tileh == 2) || (i+=2, tileh == 4) || (i+=2, tileh == 8)) &&
 				( direction == 0 || (i++, direction == 1)) )
 		return i + 15;
 
@@ -986,8 +986,8 @@
 	uint tmp;
 	const uint32 *b;
 	bool ice = _map3_hi[ti->tile] & 0x80;
-	
-	// draw tunnel? 
+
+	// draw tunnel?
 	if ( (byte)(ti->map5&0xF0) == 0) {
 		/* railway type */
 		image = (_map3_lo[ti->tile] & 0xF) * 8;
@@ -1018,11 +1018,11 @@
 		tmp = (ti->map5&3) + (tmp*2);
 
 		if (!(ti->map5 & 0x40)) {	// bridge ramps
-			
+
 			if (!(BRIDGE_NO_FOUNDATION & (1 << ti->tileh))) {	// no foundations for 0, 3, 6, 9, 12
 				int f = GetBridgeFoundation(ti->tileh, ti->map5 & 0x1);	// pass direction
 				if (f) DrawFoundation(ti, f);
-				
+
 				// default sloped sprites..
 				if (ti->tileh != 0) image = _track_sloped_sprites[ti->tileh - 1] + 0x3F3;
 			}
@@ -1033,8 +1033,8 @@
 			b += (tmp&1); // direction
 			if (ti->tileh == 0) b += 4; // sloped "entrance" ?
 			if (ti->map5 & 0x20) b += 2; // which side
-				
-			image = *b; 
+
+			image = *b;
 
 			if (!ice) {
 				DrawClearLandTile(ti, 3);
@@ -1062,7 +1062,7 @@
 				if (ti->map5 & 8 && ti->z != 0) DrawCanalWater(ti->tile);
 			} else {
 				// draw transport route under bridge
-			
+
 				// draw foundation?
 				if (ti->tileh) {
 					int f = _bridge_foundations[ti->map5&1][ti->tileh];
@@ -1087,7 +1087,7 @@
 			b = _bridge_sprite_table[_map2[ti->tile]>>4][_map2[ti->tile]&0xF] + tmp * 4;
 
 			z = GetBridgeHeight(ti) + 5;
-			
+
 			// draw rail
 			image = b[0];
 			if (!(_display_opt & DO_TRANS_BUILDINGS)) image = (image & 0x3FFF) | 0x03224000;
@@ -1106,7 +1106,7 @@
 				y += 12;
 				if (image&0x3FFF) AddSortableSpriteToDraw(image, x,y, 16, 1, 0x28, z);
 			}
-			
+
 			if (ti->z + 5 == z ) {
 				// draw poles below for small bridges
 				image = b[2];
@@ -1136,7 +1136,7 @@
 		if ( (ti->map5 & 0xF0) == 0)
 			return z;
 
-		// bridge?	
+		// bridge?
 		if ( ti->map5 & 0x80 ) {
 			// bridge ending?
 			if (!(ti->map5 & 0x40)) {
@@ -1154,18 +1154,18 @@
 					// ramp in opposite dir
 					return (z + ((x^0xF)>>1));
 				}
-			
+
 			// bridge middle part
 			} else {
 				// build on slopes?
 				if (ti->tileh) z+=8;
 
 				// keep the same elevation because we're on the bridge?
-				if (_get_z_hint >= z + 8) 
+				if (_get_z_hint >= z + 8)
 					return _get_z_hint;
-				
+
 				// actually on the bridge, but not yet in the shared area.
-				if (!IS_INT_INSIDE(x, 5, 10+1)) 
+				if (!IS_INT_INSIDE(x, 5, 10+1))
 					return GetBridgeHeight(ti) + 8;
 
 				// in the shared area, assume that we're below the bridge, cause otherwise the hint would've caught it.
@@ -1174,11 +1174,11 @@
 					uint f = _bridge_foundations[ti->map5&1][ti->tileh];
 					// make sure that the slope is not inclined foundation
 					if (IS_BYTE_INSIDE(f, 1, 15)) return z;
-					
+
 					// change foundation type?
 					if (f) ti->tileh = _inclined_tileh[f - 15];
 				}
-	
+
 				// no transport route, fallback to default
 			}
 		}
@@ -1282,7 +1282,7 @@
 	} else if (_opt.landscape == LT_DESERT) {
 		if (GetMapExtraBits(tile) == 1 && !(_map3_hi[tile]&0x80)) {
 			_map3_hi[tile] |= 0x80;
-			MarkTileDirtyByTile(tile);			
+			MarkTileDirtyByTile(tile);
 		}
 	}
 
@@ -1303,7 +1303,7 @@
 
 	if ((m5 & 0xF0) == 0) {
 		/* This is a tunnel */
-		if (((m5 & 0xC) >> 2) == mode) { 
+		if (((m5 & 0xC) >> 2) == mode) {
 			/* Tranport in the tunnel is compatible */
 			return m5&1 ? 0x202 : 0x101;
 		}
@@ -1321,7 +1321,7 @@
 				if ((m5 &= 0x18) != 8)
 					/* Clear ground */
 					return result;
-				else	
+				else
 					if (mode != TRANSPORT_WATER)
 						return result;
 			} else {
@@ -1347,7 +1347,7 @@
 {
 	if (_map_owner[tile] != old_player)
 		return;
-	
+
 	if (new_player != 255) {
 		_map_owner[tile] = new_player;
 	}	else {
@@ -1394,7 +1394,7 @@
 
 		if (v->type == VEH_Train) {
 			fc = (x&0xF)+(y<<4);
-			
+
 			dir = _map5[tile] & 3;
 			vdir = v->direction >> 1;
 
@@ -1428,10 +1428,10 @@
 			if (v->u.road.state != 0xFF && dir == vdir) {
 				if (fc == _tunnel_fractcoord_4[dir] ||
 						fc == _tunnel_fractcoord_5[dir]) {
-					
+
 					v->tile = tile;
 					v->u.road.state = 0xFF;
-					v->vehstatus |= VS_HIDDEN;	
+					v->vehstatus |= VS_HIDDEN;
 					return 4;
 				} else {
 					return 0;
--- a/unix.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/unix.c	Fri Sep 10 19:02:27 2004 +0000
@@ -44,7 +44,7 @@
 
 	if (_savegame_sort_order < 2) // sort by date
     r = da->mtime < db->mtime ? -1 : 1;
-	else	
+	else
 		r = strcmp(da->title[0] ? da->title : da->name, db->title[0] ? db->title : db->name);
 
 	if (_savegame_sort_order & 1) r = -r;
@@ -71,7 +71,7 @@
 		_fios_path = _fios_scn_path;
 	else
 		_fios_path = _fios_save_path;
-	
+
 	// Parent directory, only if not in root already.
 	if (_fios_path[1] != 0) {
 		fios = FiosAlloc();
@@ -263,11 +263,11 @@
 	case FIOS_TYPE_OLDFILE:
 		sprintf(str_buffr, "%s/%s.%s", _fios_path, item->name, _old_extensions[item->old_extension]);
 		return str_buffr;
-	
+
 	case FIOS_TYPE_SCENARIO:
 		sprintf(str_buffr, "%s/%s.scn", path, item->name);
 		return str_buffr;
-	
+
 	case FIOS_TYPE_OLD_SCENARIO:
 		sprintf(str_buffr, "%s/%s.%s", path, item->name, _old_extensions[item->old_extension]);
 		return str_buffr;
@@ -291,14 +291,14 @@
 	{
 		uint64 tot = (uint64)s.f_bsize * s.f_bavail;
 		SET_DPARAM32(0, (uint32)(tot >> 20));
-		return STR_4005_BYTES_FREE; 
+		return STR_4005_BYTES_FREE;
 	}
 	else
 		return STR_4006_UNABLE_TO_READ_DRIVE;
 	}
 #else
 	SET_DPARAM32(0, 0);
-	return STR_4005_BYTES_FREE; 
+	return STR_4005_BYTES_FREE;
 #endif
 }
 
@@ -348,14 +348,14 @@
 #endif
 #ifdef __BEOS__
 	{ "bemidi",	"BeOS MIDI Driver",			&_bemidi_music_driver,	1},
-#endif	
+#endif
 	{   "null",	"Null Music Driver",		&_null_music_driver,		1},
 	{     NULL,	NULL,										NULL,										0}
 };
 
 bool FileExists(const char *filename)
 {
-	return access(filename, 0) == 0;	
+	return access(filename, 0) == 0;
 }
 
 static int LanguageCompareFunc(const void *a, const void *b)
@@ -380,7 +380,7 @@
 		}
 		closedir(dir);
 	}
-	
+
 	qsort(languages, num, sizeof(char*), LanguageCompareFunc);
 	return num;
 }
@@ -403,7 +403,7 @@
 void ShowOSErrorBox(const char *buf)
 {
 	fprintf(stderr, "\033[1;31mError: %s\033[0;39m\n", buf);
-	
+
 #if defined(__APPLE__)
 	// this opens the crash log opener script
 	system("./Crash_Log_Opener.app");
@@ -435,25 +435,25 @@
 
 #if defined(USE_HOMEDIR)
 	{
-		char *homedir; 
+		char *homedir;
 		homedir = getenv("HOME");
-		
+
 		if(!homedir) {
 			struct passwd *pw = getpwuid(getuid());
 			if (pw) homedir = pw->pw_dir;
 		}
-		
+
 		_path.personal_dir = str_fmt("%s" PATHSEP "%s", homedir, PERSONAL_DIR);
 	}
-	
+
 #else /* not defined(USE_HOMEDIR) */
 
 	_path.personal_dir = malloc( MAX_PATH );
 	strcpy(_path.personal_dir, PERSONAL_DIR);
-	
+
 	// check if absolute or relative path
 	s = strchr(_path.personal_dir, '/');
-	
+
 	// add absolute path
 	if (s==NULL || _path.personal_dir != s) {
 		getcwd(_path.personal_dir, MAX_PATH);
@@ -461,23 +461,23 @@
 		*s++ = '/';
 		strcpy(s, PERSONAL_DIR);
 	}
-	
+
 #endif /* defined(USE_HOMEDIR) */
 
 	s = strchr(_path.personal_dir, 0);
-	
+
 	// append a / ?
 	if (s[-1] != '/') { s[0] = '/'; s[1] = 0; }
-	
+
 	_path.save_dir = str_fmt("%ssave", _path.personal_dir);
 	_path.autosave_dir = str_fmt("%s/autosave", _path.save_dir);
 	_path.scenario_dir = str_fmt("%sscenario", _path.personal_dir);
 	_path.gm_dir = str_fmt("%sgm/", _path.game_data_dir);
 	_path.data_dir = str_fmt("%sdata/", _path.game_data_dir);
 	_path.lang_dir = str_fmt("%slang/", _path.game_data_dir);
-	
+
 	_config_file = str_fmt("%sopenttd.cfg", _path.personal_dir);
-	
+
 	// make (auto)save and scenario folder
 	mkdir(_path.save_dir, 0755);
 	mkdir(_path.autosave_dir, 0755);
--- a/unmovable_cmd.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/unmovable_cmd.c	Fri Sep 10 19:02:27 2004 +0000
@@ -31,10 +31,10 @@
 static void DrawTile_Unmovable(TileInfo *ti)
 {
 	uint32 image, ormod;
-	
+
 	if (!(ti->map5 & 0x80)) {
 		if (ti->map5 == 2) {
-			
+
 			// statue
 			DrawGroundSprite(0x58C);
 
@@ -44,32 +44,32 @@
 				image = (image & 0x3FFF) | 0x3224000;
 			AddSortableSpriteToDraw(image, ti->x, ti->y, 16, 16, 25, ti->z);
 		} else if (ti->map5 == 3) {
-			
+
 			// "owned by" sign
 			DrawClearLandTile(ti, 0);
-			
+
 			AddSortableSpriteToDraw(
 				PLAYER_SPRITE_COLOR(_map_owner[ti->tile]) + 0x92B6,
 				ti->x+8, ti->y+8,
-				1, 1, 
-				10, 
+				1, 1,
+				10,
 				GetSlopeZ(ti->x+8, ti->y+8)
 			);
 		} else {
 			// lighthouse or transmitter
-			
+
 			const DrawTileUnmovableStruct *dtus;
 
 			if (ti->tileh) DrawFoundation(ti, ti->tileh);
 			DrawClearLandTile(ti, 2);
-			
-			dtus = &_draw_tile_unmovable_data[ti->map5];		
+
+			dtus = &_draw_tile_unmovable_data[ti->map5];
 
 			image = dtus->image;
 			if (!(_display_opt & DO_TRANS_BUILDINGS))
 				image = (image & 0x3FFF) | 0x3224000;
-			
-			AddSortableSpriteToDraw(image, 
+
+			AddSortableSpriteToDraw(image,
 				ti->x | dtus->subcoord_x,
 				ti->y | dtus->subcoord_y,
 				dtus->width, dtus->height,
@@ -87,7 +87,7 @@
 		DrawGroundSprite(*(uint16*)t | ormod);
 
 		t += sizeof(uint16);
-			
+
 		for(dtss = (DrawTileSeqStruct *)t; (byte)dtss->delta_x != 0x80; dtss++) {
 			image =	dtss->image;
 			if (_display_opt & DO_TRANS_BUILDINGS) {
@@ -101,12 +101,12 @@
 	}
 }
 
-static uint GetSlopeZ_Unmovable(TileInfo *ti) 
+static uint GetSlopeZ_Unmovable(TileInfo *ti)
 {
 	return GetPartialZ(ti->x&0xF, ti->y&0xF, ti->tileh) + ti->z;
 }
 
-static uint GetSlopeTileh_Unmovable(TileInfo *ti) 
+static uint GetSlopeTileh_Unmovable(TileInfo *ti)
 {
 	return 0;
 }
@@ -114,12 +114,12 @@
 static int32 ClearTile_Unmovable(uint tile, byte flags)
 {
 	byte m5 = _map5[tile];
-		
+
 	if (m5 & 0x80) {
-		if (_current_player == OWNER_WATER) 
+		if (_current_player == OWNER_WATER)
 			return DoCommandByTile(tile, OWNER_WATER, 0, DC_EXEC, CMD_DESTROY_COMPANY_HQ);
 		return_cmd_error(STR_5804_COMPANY_HEADQUARTERS_IN);
-	}	
+	}
 
 	if (m5 == 3)	// company owned land
 		return DoCommandByTile(tile, 0, 0, flags, CMD_SELL_LAND_AREA);
@@ -127,8 +127,8 @@
 	// checks if you're allowed to remove unmovable things
 	if (_game_mode != GM_EDITOR && _current_player != OWNER_WATER && ((flags & DC_AUTO || !_cheats.magic_bulldozer.value)) )
 		return_cmd_error(STR_5800_OBJECT_IN_THE_WAY);
-	
-	if (flags & DC_EXEC) {	
+
+	if (flags & DC_EXEC) {
 		DoClearSquare(tile);
 	}
 
@@ -171,7 +171,7 @@
 	STR_5802_LIGHTHOUSE,
 	STR_2016_STATUE,
 	STR_5805_COMPANY_OWNED_LAND,
-};	
+};
 
 static void GetTileDesc_Unmovable(uint tile, TileDesc *td)
 {
@@ -289,7 +289,7 @@
 
 	if (_opt.landscape == LT_DESERT)
 		return;
-		
+
 	/* add lighthouses */
 	i = (Random()&3) + 7;
 	do {
@@ -297,7 +297,7 @@
 		r = Random();
 		dir = r >> 30;
 		r = r%((dir==0 || dir== 2)?TILE_Y_MAX:TILE_X_MAX);
-		tile = 
+		tile =
           (dir==0)?TILE_XY(0,r):0 +             // left
           (dir==1)?TILE_XY(r,0):0 +             // top
           (dir==2)?TILE_XY(TILE_X_MAX,r):0 +    // right
@@ -308,7 +308,7 @@
 				goto restart;
 			tile = TILE_MASK(tile + _tile_add[dir]);
 		} while (!(IS_TILETYPE(tile, MP_CLEAR) && GetTileSlope(tile, &h) == 0 && h <= 16));
-		
+
 		assert(tile == TILE_MASK(tile));
 
 		_map_type_and_height[tile] |= MP_UNMOVABLE << 4;
@@ -328,7 +328,7 @@
 	Player *p = DEREF_PLAYER(_current_player);
 	int score;
 	int32 cost = 0;
-	
+
 	if (CheckFlatLandBelow(tile, 2, 2, flags, 0, NULL) == CMD_ERROR)
 		return CMD_ERROR;
 
@@ -404,7 +404,7 @@
 {
 	if (_map_owner[tile] != old_player)
 		return;
-	
+
 	if (_map5[tile]==3 && new_player != 255) {
 		_map_owner[tile] = new_player;
 	}	else {
--- a/variables.h	Fri Sep 10 18:54:23 2004 +0000
+++ b/variables.h	Fri Sep 10 19:02:27 2004 +0000
@@ -110,7 +110,7 @@
 	bool always_small_airport; // always allow small airports
 	bool realistic_acceleration; // realistic acceleration for trains
 	bool invisible_trees; // don't show trees when buildings are transparent
-	
+
 	uint8 toolbar_pos;			// position of toolbars, 0=left, 1=center, 2=right
 
 	byte max_trains;				//max trains in game per player (these are 8bit because the unitnumber field can't hold more)
@@ -132,7 +132,7 @@
 	byte pf_maxdepth;				// maximum recursion depth when searching for a train route for new pathfinder
 	uint16 pf_maxlength;		// maximum length when searching for a train route for new pathfinder
 
-	
+
 	bool bridge_pillars;		// show bridge pillars for high bridges
 
 	bool ai_disable_veh_train;		// disable types for AI
@@ -169,7 +169,7 @@
 } Cheat;
 
 
-// WARNING! Do _not_ remove entries in Cheats struct or change the order 
+// WARNING! Do _not_ remove entries in Cheats struct or change the order
 // of the existing ones! Would break downward compatibility.
 // Only add new entries at the end of the struct!
 
@@ -187,7 +187,7 @@
 VARDEF Cheats _cheats;
 
 typedef struct Paths {
-	char *personal_dir;  // includes cfg file and save folder 
+	char *personal_dir;  // includes cfg file and save folder
 	char *game_data_dir; // includes data, gm, lang
 	char *data_dir;
 	char *gm_dir;
--- a/vehicle.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/vehicle.c	Fri Sep 10 19:02:27 2004 +0000
@@ -30,10 +30,10 @@
 {
 	if (v->tile != (TileIndex)(int)data || v->type == VEH_Disaster)
 		return NULL;
-	
-	VehicleInTheWayErrMsg(v);	
+
+	VehicleInTheWayErrMsg(v);
 	return (void*)1;
-} 
+}
 
 bool EnsureNoVehicle(TileIndex tile)
 {
@@ -169,7 +169,7 @@
 Vehicle *ForceAllocateSpecialVehicle()
 {
 	Vehicle *v;
-	for(v=_vehicles + NUM_NORMAL_VEHICLES; 
+	for(v=_vehicles + NUM_NORMAL_VEHICLES;
 			v!=&_vehicles[NUM_NORMAL_VEHICLES+NUM_SPECIAL_VEHICLES]; v++) {
 		if (v->type == 0)
 			return InitializeVehicle(v);
@@ -227,7 +227,7 @@
 			while (veh != INVALID_VEHICLE) {
 				Vehicle *v = &_vehicles[veh];
 				void *a;
-				
+
 				if ((a = proc(v, data)) != NULL)
 					return a;
 				veh = v->next_hash;
@@ -259,7 +259,7 @@
 
 	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;
 
@@ -295,7 +295,7 @@
 	memset(&_vehicles, 0, sizeof(_vehicles));
 	memset(&_checkpoints, 0, sizeof(_checkpoints));
 	memset(&_depots, 0, sizeof(_depots));
-	
+
 	// setup indexes..
 	i = 0;
 	FOR_ALL_VEHICLES(v)
@@ -334,7 +334,7 @@
 			if (++v == endof(_vehicles))
 				return u;
 		}
-	}	
+	}
 }
 
 int CountVehiclesInChain(Vehicle *v)
@@ -358,13 +358,13 @@
 		}
 	}
 
-	if (free_dep == NULL || 
+	if (free_dep == NULL ||
 			(num_free < 30 && IS_HUMAN_PLAYER(_current_player))) {
 		_error_message = STR_1009_TOO_MANY_DEPOTS;
 		return NULL;
 	}
 
-	return free_dep;	
+	return free_dep;
 }
 
 Checkpoint *AllocateCheckpoint()
@@ -443,7 +443,7 @@
 
 	FOR_ALL_VEHICLES(v) {
 		if (v->type != 0 && v->schedule_ptr != NULL) {
-			
+
 			// clear last station visited
 			if (v->last_station_visited == (cmd>>8) && (cmd & OT_MASK) == OT_GOTO_STATION)
 				v->last_station_visited = 0xFF;
@@ -459,7 +459,7 @@
 			sched = v->schedule_ptr;
 			while ((order=*sched++) != 0) {
 				if ( (order & (OT_MASK|0xFF00)) == cmd) {
-					sched[-1] = OT_DUMMY;		
+					sched[-1] = OT_DUMMY;
 					need_invalidate = true;
 				}
 			}
@@ -538,7 +538,7 @@
 static bool CanFillVehicle_FullLoadAny(Vehicle *v)
 {
 	uint32 full = 0, not_full = 0;
-	
+
 	// patch should return "true" to continue loading, i.e. when there is no cargo type that is fully loaded.
 	do {
 		//Should never happen, but just in case future additions change this
@@ -559,7 +559,7 @@
 	byte *t = &_map_type_and_height[v->tile];
 
 	if (t[0] >> 4 == MP_STATION ||
-			(v->type == VEH_Ship && 
+			(v->type == VEH_Ship &&
 			(t[TILE_XY(1,0)] >> 4 == MP_STATION ||
 				t[TILE_XY(-1,0)] >> 4 == MP_STATION ||
 				t[TILE_XY(0,1)] >> 4 == MP_STATION ||
@@ -581,14 +581,14 @@
 static void DoDrawVehicle(Vehicle *v)
 {
 	uint32 image = v->cur_image;
-	
+
 	if (v->vehstatus & VS_DISASTER) {
 		image |= 0x3224000;
 	} else if (v->vehstatus & VS_DEFPAL) {
 		image |= (v->vehstatus & VS_CRASHED) ? 0x3248000 : SPRITE_PALETTE(PLAYER_SPRITE_COLOR(v->owner));
-	} 
+	}
 
-	AddSortableSpriteToDraw(image, v->x_pos + v->x_offs, v->y_pos + v->y_offs, 
+	AddSortableSpriteToDraw(image, v->x_pos + v->x_offs, v->y_pos + v->y_offs,
 		v->sprite_width, v->sprite_height, v->z_height, v->z_pos);
 }
 
@@ -610,12 +610,12 @@
 			veh = _vehicle_position_hash[ (x+y)&0xFFFF ];
 			while (veh != INVALID_VEHICLE) {
 				v = &_vehicles[veh];
-				
-				if (!(v->vehstatus & VS_HIDDEN) && 
+
+				if (!(v->vehstatus & VS_HIDDEN) &&
 						dpi->left <= v->right_coord &&
 						dpi->top <= v->bottom_coord &&
 						dpi->left + dpi->width >= v->left_coord &&
-						dpi->top + dpi->height >= v->top_coord) {				
+						dpi->top + dpi->height >= v->top_coord) {
 					DoDrawVehicle(v);
 				}
 				veh = v->next_hash;
@@ -647,7 +647,7 @@
 
 	if (--v->progress & 0x80) {
 		BeginVehicleMove(v);
-		
+
 		tile = TILE_FROM_XY(v->x_pos, v->y_pos);
 		if (!IS_TILETYPE(tile, MP_INDUSTRY)) {
 			EndVehicleMove(v);
@@ -673,11 +673,11 @@
 static void EffectTick_1(Vehicle *v)
 {
 	bool moved;
-	
+
 	BeginVehicleMove(v);
-	
+
 	moved = false;
-	
+
 	if ((++v->progress & 7) == 0) {
 		v->z_pos++;
 		moved = true;
@@ -753,11 +753,11 @@
 static void EffectTick_4(Vehicle *v)
 {
 	bool moved;
-	
+
 	BeginVehicleMove(v);
-	
+
 	moved = false;
-	
+
 	if ((++v->progress & 3) == 0) {
 		v->z_pos++;
 		moved = true;
@@ -1095,8 +1095,8 @@
 		EndVehicleMove(v);
 		DeleteVehicle(v);
 		return;
-	} 
-	
+	}
+
 	if (*b == 0x81) {
 		if (v->z_pos > 180 || CHANCE16(1,96)) {
 			v->spritenum = 5;
@@ -1104,8 +1104,8 @@
 		}
 		et = 0;
 		goto again;
-	} 
-	
+	}
+
 	if (*b == 0x82) {
 		uint tile;
 
@@ -1163,7 +1163,7 @@
 Vehicle *CreateEffectVehicle(int x, int y, int z, int type)
 {
 	Vehicle *v;
-	
+
 	v = ForceAllocateSpecialVehicle();
 	if (v != NULL) {
 		v->type = VEH_Special;
@@ -1213,10 +1213,10 @@
 	y = (y << vp->zoom) + vp->virtual_top;
 
 	FOR_ALL_VEHICLES(v) {
-		if (v->type != 0 && (v->vehstatus & (VS_HIDDEN|VS_UNCLICKABLE)) == 0 && 
+		if (v->type != 0 && (v->vehstatus & (VS_HIDDEN|VS_UNCLICKABLE)) == 0 &&
 				x >= v->left_coord && x <= v->right_coord &&
 				y >= v->top_coord && y <= v->bottom_coord) {
-			
+
 			dist = max(
 				myabs( ((v->left_coord + v->right_coord)>>1) - x ),
 				myabs( ((v->top_coord + v->bottom_coord)>>1) - y )
@@ -1275,7 +1275,7 @@
 	/* calculate reliability value to use in comparison */
 	rel = v->reliability;
 	if (v->type == VEH_Ship) rel += 0x6666;
-	
+
 	/* disabled breakdowns? */
 	if (_opt.diff.vehicle_breakdowns < 1)
 		return;
@@ -1320,8 +1320,8 @@
 
 	age = v->age - v->max_age;
 	if (age == 366*0 || age == 366*1 || age == 366*2 || age == 366*3 || age == 366*4)
-		v->reliability_spd_dec <<= 1; 
-	
+		v->reliability_spd_dec <<= 1;
+
 	InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
 
 	if (age == -366) {
@@ -1343,7 +1343,7 @@
 	//  It can be any value between -12 and 12.
 	if (!_patches.autorenew || v->age - v->max_age < (_patches.autorenew_months * 30))
 		return;
-		
+
 	if (DEREF_PLAYER(v->owner)->money64 < _patches.autorenew_money + build_cost - v->value) {
 		if (v->owner == _local_player) {
 			int message;
@@ -1361,7 +1361,7 @@
 		}
 		return;
 	}
-	
+
 	// Withdraw the money from the right player ;)
 	_current_player = v->owner;
 
@@ -1376,7 +1376,7 @@
 	SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
 	SubtractMoneyFromPlayer(build_cost - v->value);
 	v->value = build_cost;
-	
+
 	InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
 }
 
@@ -1394,7 +1394,7 @@
 	str = AllocateName((byte*)_decode_parameters, 2);
 	if (str == 0)
 		return CMD_ERROR;
-	
+
 	if (flags & DC_EXEC) {
 		StringID old_str = v->string_id;
 		v->string_id = str;
@@ -1490,10 +1490,10 @@
  * bit 0x8 set, the vehicle could not and did not enter the tile. Are there
  * other bits that can be set? */
 uint32 VehicleEnterTile(Vehicle *v, uint tile, int x, int y)
-{	
+{
 	uint old_tile = v->tile;
 	uint32 result = _tile_type_procs[GET_TILETYPE(tile)]->vehicle_enter_tile_proc(v, tile, x, y);
-	
+
 	/* When vehicle_enter_tile_proc returns 8, that apparently means that
 	 * we cannot enter the tile at all. In that case, don't call
 	 * leave_tile. */
@@ -1513,7 +1513,7 @@
 restart:
 	unit_num++;
 	FOR_ALL_VEHICLES(u) {
-		if (u->type == type && u->owner == _current_player && 
+		if (u->type == type && u->owner == _current_player &&
 		    unit_num == u->unitnumber)
 					goto restart;
 	}
@@ -1524,7 +1524,7 @@
 // Save and load of vehicles
 const byte _common_veh_desc[] = {
 	SLE_VAR(Vehicle,subtype,					SLE_UINT8),
-		
+
 	SLE_VAR(Vehicle,next_in_chain_old, SLE_UINT16),
 	SLE_VAR(Vehicle,string_id,				SLE_STRINGID),
 	SLE_VAR(Vehicle,unitnumber,				SLE_UINT8),
@@ -1589,7 +1589,7 @@
 
 	// reserve extra space in savegame here. (currently 16 bytes)
 	SLE_CONDARR(NullStruct,null,SLE_FILE_U64 | SLE_VAR_NULL, 2, 2, 255),
-	
+
 	SLE_END()
 };
 
@@ -1646,7 +1646,7 @@
 	SLE_VARX(offsetof(Vehicle,u)+offsetof(VehicleAir,pos),							SLE_UINT8),
 	SLE_VARX(offsetof(Vehicle,u)+offsetof(VehicleAir,targetairport),		SLE_UINT8),
 	SLE_VARX(offsetof(Vehicle,u)+offsetof(VehicleAir,state),						SLE_UINT8),
-	
+
 	SLE_CONDVARX(offsetof(Vehicle,u)+offsetof(VehicleAir,previous_pos),			SLE_UINT8, 2, 255),
 
 	// reserve extra space in savegame here. (currently 15 bytes)
@@ -1659,7 +1659,7 @@
 	SLE_WRITEBYTE(Vehicle,type,VEH_Special, 4),
 
 	SLE_VAR(Vehicle,subtype,					SLE_UINT8),
-		
+
 	SLE_VAR(Vehicle,tile,							SLE_UINT16),
 
 	SLE_VAR(Vehicle,x_pos,						SLE_INT16),
--- a/vehicle.h	Fri Sep 10 18:54:23 2004 +0000
+++ b/vehicle.h	Fri Sep 10 19:02:27 2004 +0000
@@ -6,8 +6,8 @@
 typedef struct VehicleRail {
 	uint16 last_speed;		// NOSAVE: only used in UI
 	uint16 crash_anim_pos;
-	uint16 days_since_order_progr; 
-	
+	uint16 days_since_order_progr;
+
 	uint16 cached_weight; // cached power and weight for the vehicle.
 	uint32 cached_power;  // no need to save those, they are recomputed on load.
 
@@ -69,7 +69,7 @@
 
 	// screen coordinates
 	int16 left, top, right, bottom;
-	
+
 	// world coordinates
 	int16 x;
 	int16 y;
@@ -126,7 +126,7 @@
 
 	byte vehstatus;		// Status
 	byte last_station_visited;
-	
+
 	byte cargo_type;	// type of cargo this vehicle is carrying
 	byte cargo_days; // how many days have the pieces been in transit
 	byte cargo_source;// source of cargo
@@ -162,7 +162,7 @@
 	byte build_year;
 
 	uint16 load_unload_time_rem;
-	
+
 	int32 profit_this_year;
 	int32 profit_last_year;
 	uint32 value;
@@ -379,7 +379,7 @@
 	NUM_NORMAL_VEHICLES = 2048,
 	NUM_SPECIAL_VEHICLES = 512,
 	NUM_VEHICLES = NUM_NORMAL_VEHICLES + NUM_SPECIAL_VEHICLES
-};	
+};
 
 VARDEF Vehicle _vehicles[NUM_VEHICLES];
 
--- a/vehicle_gui.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/vehicle_gui.c	Fri Sep 10 19:02:27 2004 +0000
@@ -96,7 +96,7 @@
 	}
 
 	r =  strcmp(buf1, _bufcache);	// sort by name
-	
+
 	if (r == 0) // if the sorting criteria had the same value, sort by unitnumber
 		r = va->unitnumber - vb->unitnumber;
 
@@ -120,7 +120,7 @@
 	const Vehicle *va = DEREF_VEHICLE((*(const SortStruct*)a).index);
 	const Vehicle *vb = DEREF_VEHICLE((*(const SortStruct*)b).index);
 	int r = va->profit_this_year - vb->profit_this_year;
-	
+
 	if (r == 0) // if the sorting criteria had the same value, sort by unitnumber
 		r = va->unitnumber - vb->unitnumber;
 
@@ -191,4 +191,4 @@
 		r = va->unitnumber - vb->unitnumber;
 
 	return (_internal_sort_order & 1) ? -r : r;
-}
\ No newline at end of file
+}
--- a/viewport.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/viewport.c	Fri Sep 10 19:02:27 2004 +0000
@@ -48,9 +48,9 @@
 
 typedef struct ViewportDrawer {
 	DrawPixelInfo dpi;
-	
+
 	byte *spritelist_mem, *eof_spritelist_mem;
-	
+
 	StringSpriteToDraw **last_string, *first_string;
 	TileSpriteToDraw **last_tile, *first_tile;
 
@@ -79,7 +79,7 @@
 	return p;
 }
 
-void AssignWindowViewport(Window *w, int x, int y, 
+void AssignWindowViewport(Window *w, int x, int y,
 	int width, int height, uint32 follow_flags, byte zoom)
 {
 	ViewPort *vp;
@@ -98,7 +98,7 @@
 	vp->top = y + w->top;
 	vp->width = width;
 	vp->height = height;
-	
+
 	vp->zoom = zoom;
 
 	vp->virtual_width = width << zoom;
@@ -133,7 +133,7 @@
 				w->left+w->width > left &&
 				top + height > w->top &&
 				w->top+w->height > top) {
-		
+
 			if (left < w->left) {
 				DoSetViewportPosition(w, left, top, w->left - left, height);
 				DoSetViewportPosition(w, left + (w->left - left), top, width - (w->left - left), height);
@@ -234,7 +234,7 @@
 			height += top;
 			top = 0;
 		}
-			
+
 		if ( (i=(top + height - _screen.height)) >= 0) {
 			height -= i;
 		}
@@ -285,7 +285,7 @@
 
 	pt.x = a+z;
 	pt.y = b+z;
-	
+
 	if ((uint)pt.x >= TILE_X_MAX*16 || (uint)pt.y >= TILE_Y_MAX*16) {
 		pt.x = pt.y = -1;
 	}
@@ -294,12 +294,12 @@
 }
 
 static Point GetTileFromScreenXY(int x, int y)
-{	
+{
 	Window *w;
 	ViewPort *vp;
 	Point pt;
-	
-	if ( (w = FindWindowFromPt(x, y)) != NULL && 
+
+	if ( (w = FindWindowFromPt(x, y)) != NULL &&
 			 (vp = IsPtInWindowViewport(w, x, y)) != NULL)
 				return TranslateXYToTileCoord(vp, x, y);
 
@@ -335,7 +335,7 @@
 {
 	ViewportDrawer *vd = _cur_vd;
 	TileSpriteToDraw *ts;
-	
+
 	assert( (image & 0x3fff) < NUM_SPRITES);
 
 	ts = (TileSpriteToDraw*)vd->spritelist_mem;
@@ -345,14 +345,14 @@
 	}
 
 	vd->spritelist_mem += sizeof(TileSpriteToDraw);
-	
+
 	ts->image = image;
 	ts->next = NULL;
 	ts->x = x;
 	ts->y = y;
 	ts->z = z;
 	*vd->last_tile = ts;
-	vd->last_tile = &ts->next;	
+	vd->last_tile = &ts->next;
 }
 
 void DrawGroundSprite(uint32 image)
@@ -384,7 +384,7 @@
 
 	sd = GetSpriteDimension(image & 0x3FFF);
 
-	if ((t = pt.x + sd->xoffs) >= vd->dpi.left + vd->dpi.width || 
+	if ((t = pt.x + sd->xoffs) >= vd->dpi.left + vd->dpi.width ||
 			(t + sd->xsize) <= vd->dpi.left ||
 			(t = pt.y + sd->yoffs) >= vd->dpi.top + vd->dpi.height ||
 			(t + sd->ysize) <= vd->dpi.top)
@@ -417,16 +417,16 @@
 	}
 	if (vd->parent_list >= vd->eof_parent_list) {
 		// This can happen rarely, mostly when you zoom out completely
-		//  and have a lot of stuff that moves (and is added to the 
+		//  and have a lot of stuff that moves (and is added to the
 		//  sort-list, this function). To solve it, increase
 		//  parent_list somewhere below to a higher number.
 		// This can not really hurt you, it just gives some black
 		//  spots on the screen ;)
 		DEBUG(misc, 0) ("Out of sprite mem (parent_list)\n");
 		return;
-	}	
-	
-	vd->spritelist_mem += sizeof(ParentSpriteToDraw);	
+	}
+
+	vd->spritelist_mem += sizeof(ParentSpriteToDraw);
 
 	ps->image = image;
 	ps->tile_x = x;
@@ -441,7 +441,7 @@
 	pt = RemapCoords(x, y, z);
 
 	sd = GetSpriteDimension(image & 0x3FFF);
-	if ((ps->left = (pt.x += sd->xoffs)) >= vd->dpi.left + vd->dpi.width || 
+	if ((ps->left = (pt.x += sd->xoffs)) >= vd->dpi.left + vd->dpi.width ||
 			(ps->right = (pt.x + sd->xsize)) <= vd->dpi.left ||
 			(ps->top = (pt.y += sd->yoffs)) >= vd->dpi.top + vd->dpi.height ||
 			(ps->bottom = (pt.y + sd->ysize)) <= vd->dpi.top) {
@@ -473,7 +473,7 @@
 {
 	ViewportDrawer *vd = _cur_vd;
 	ChildScreenSpriteToDraw *cs;
-	
+
 	assert( (image & 0x3fff) < NUM_SPRITES);
 
 	cs = (ChildScreenSpriteToDraw*) vd->spritelist_mem;
@@ -484,8 +484,8 @@
 
 	if (vd->last_child == NULL)
 		return;
-	
-	vd->spritelist_mem += sizeof(ChildScreenSpriteToDraw);	
+
+	vd->spritelist_mem += sizeof(ChildScreenSpriteToDraw);
 
 	*vd->last_child = cs;
 	vd->last_child = &cs->next;
@@ -602,7 +602,7 @@
 	default:
 		NOT_REACHED();
 	}
-  
+
 	/* useless, but avoids compiler warning this way */
 	return 0;
 }
@@ -615,7 +615,7 @@
 #ifdef DEBUG_TILE_PUSH
 	dbg_draw_pushed(ti);
 #endif
-	
+
 	// Draw a red error square?
 	if (thd->redsq != 0 && thd->redsq == (TileIndex)ti->tile) {
 		DrawSelectionSprite(0x030382F0 | _tileh_to_sprite[ti->tileh], ti);
@@ -636,8 +636,8 @@
 			// Figure out the Z coordinate for the single dot.
 			byte z = ti->z;
 			if (ti->tileh & 8) {
-				z += 8;				
-				if (!(ti->tileh & 2) && (ti->tileh & 0x10)) {	
+				z += 8;
+				if (!(ti->tileh & 2) && (ti->tileh & 0x10)) {
 					z += 8;
 				}
 			}
@@ -689,14 +689,14 @@
 
 	assert(width > 0);
 	assert(height > 0);
-	
+
 	direction = false;
 
 	do {
 		int width_cur = width;
 		int x_cur = x;
 		int y_cur = y;
-		
+
 		do {
 			FindLandscapeHeight(&ti, x_cur, y_cur);
 #if !defined(NEW_ROTATION)
@@ -708,11 +708,11 @@
 #endif
 			_added_tile_sprite = false;
 			_offset_ground_sprites = false;
-		
+
 			DrawTile(&ti);
 			DrawTileSelection(&ti);
 		} while (--width_cur);
-	
+
 #if !defined(NEW_ROTATION)
 		if ( (direction^=1) != 0)
 			y += 0x10;
@@ -724,7 +724,7 @@
 		else
 			y -= 0x10;
 #endif
-	} while (--height);	
+	} while (--height);
 }
 
 
@@ -748,7 +748,7 @@
 					top < t->sign.top + 12 &&
 					right > t->sign.left &&
 					left < t->sign.left + t->sign.width_1) {
-				
+
 				AddStringToDraw(t->sign.left + 1, t->sign.top + 1, STR_2001, t->townnametype, t->townnameparts);
 			}
 		}
@@ -762,9 +762,9 @@
 					top < t->sign.top + 24 &&
 					right > t->sign.left &&
 					left < t->sign.left + t->sign.width_1*2) {
-				
+
 				AddStringToDraw(t->sign.left + 1, t->sign.top + 1, STR_2001, t->townnametype, t->townnameparts);
-			}	
+			}
 		}
 	} else {
 		right += 4;
@@ -777,10 +777,10 @@
 					top < t->sign.top + 24 &&
 					right > t->sign.left &&
 					left < t->sign.left + t->sign.width_2*4) {
-				
+
 				AddStringToDraw(t->sign.left + 5, t->sign.top + 1, STR_2002, t->townnametype, t->townnameparts);
 				AddStringToDraw(t->sign.left + 1, t->sign.top - 3, STR_2003, t->townnametype, t->townnameparts);
-			}				
+			}
 		}
 	}
 }
@@ -806,7 +806,7 @@
 					top < st->sign.top + 12 &&
 					right > st->sign.left &&
 					left < st->sign.left + st->sign.width_1) {
-				
+
 				sstd=AddStringToDraw(st->sign.left + 1, st->sign.top + 1, STR_305C_0, st->index, st->facilities);
 				if (sstd != NULL) {
 					sstd->color = (st->owner == OWNER_NONE || !st->facilities) ? 0xE : _player_colors[st->owner];
@@ -824,7 +824,7 @@
 					top < st->sign.top + 24 &&
 					right > st->sign.left &&
 					left < st->sign.left + st->sign.width_1*2) {
-				
+
 				sstd=AddStringToDraw(st->sign.left + 1, st->sign.top + 1, STR_305C_0, st->index, st->facilities);
 				if (sstd != NULL) {
 					sstd->color = (st->owner == OWNER_NONE || !st->facilities) ? 0xE : _player_colors[st->owner];
@@ -845,7 +845,7 @@
 					top < st->sign.top + 24 &&
 					right > st->sign.left &&
 					left < st->sign.left + st->sign.width_2*4) {
-				
+
 				sstd=AddStringToDraw(st->sign.left + 1, st->sign.top + 1, STR_305D_0, st->index, st->facilities);
 				if (sstd != NULL) {
 					sstd->color = (st->owner == OWNER_NONE || !st->facilities) ? 0xE : _player_colors[st->owner];
@@ -877,14 +877,14 @@
 					top < ss->sign.top + 12 &&
 					right > ss->sign.left &&
 					left < ss->sign.left + ss->sign.width_1) {
-				
+
 				sstd=AddStringToDraw(ss->sign.left + 1, ss->sign.top + 1, STR_2806, ss->str, 0);
 				if (sstd != NULL) {
 					sstd->width = ss->sign.width_1;
 					sstd->color = 14;
 				}
 			}
-		}	
+		}
 	} else if (dpi->zoom == 1) {
 		right += 2;
 		bottom += 2;
@@ -894,14 +894,14 @@
 					top < ss->sign.top + 24 &&
 					right > ss->sign.left &&
 					left < ss->sign.left + ss->sign.width_1*2) {
-				
+
 				sstd=AddStringToDraw(ss->sign.left + 1, ss->sign.top + 1, STR_2806, ss->str, 0);
 				if (sstd != NULL) {
 					sstd->width = ss->sign.width_1;
 					sstd->color = 14;
 				}
 			}
-		}	
+		}
 	} else {
 		right += 4;
 		bottom += 5;
@@ -912,14 +912,14 @@
 					top < ss->sign.top + 24 &&
 					right > ss->sign.left &&
 					left < ss->sign.left + ss->sign.width_2*4) {
-				
+
 				sstd=AddStringToDraw(ss->sign.left + 1, ss->sign.top + 1, STR_2807, ss->str, 0);
 				if (sstd != NULL) {
 					sstd->width = ss->sign.width_2 | 0x8000;
 					sstd->color = 14;
 				}
 			}
-		}	
+		}
 	}
 }
 
@@ -945,14 +945,14 @@
 					top < cp->sign.top + 12 &&
 					right > cp->sign.left &&
 					left < cp->sign.left + cp->sign.width_1) {
-				
+
 				sstd=AddStringToDraw(cp->sign.left + 1, cp->sign.top + 1, STR_CHECKPOINT_VIEWPORT, cp - _checkpoints, 0);
 				if (sstd != NULL) {
 					sstd->width = cp->sign.width_1;
 					sstd->color = (cp->deleted ? 0xE : 11);
 				}
 			}
-		}	
+		}
 	} else if (dpi->zoom == 1) {
 		right += 2;
 		bottom += 2;
@@ -962,14 +962,14 @@
 					top < cp->sign.top + 24 &&
 					right > cp->sign.left &&
 					left < cp->sign.left + cp->sign.width_1*2) {
-				
+
 				sstd=AddStringToDraw(cp->sign.left + 1, cp->sign.top + 1, STR_CHECKPOINT_VIEWPORT, cp - _checkpoints, 0);
 				if (sstd != NULL) {
 					sstd->width = cp->sign.width_1;
 					sstd->color = (cp->deleted ? 0xE : 11);
 				}
 			}
-		}	
+		}
 	} else {
 		right += 4;
 		bottom += 5;
@@ -980,14 +980,14 @@
 					top < cp->sign.top + 24 &&
 					right > cp->sign.left &&
 					left < cp->sign.left + cp->sign.width_2*4) {
-				
+
 				sstd=AddStringToDraw(cp->sign.left + 1, cp->sign.top + 1, STR_CHECKPOINT_VIEWPORT_TINY, cp - _checkpoints, 0);
 				if (sstd != NULL) {
 					sstd->width = cp->sign.width_2 | 0x8000;
 					sstd->color = (cp->deleted ? 0xE : 11);
 				}
 			}
-		}	
+		}
 	}
 }
 
@@ -1011,7 +1011,7 @@
 
 
 void ViewportDrawTileSprites(TileSpriteToDraw *ts)
-{	
+{
 	do {
 		Point pt = RemapCoords(ts->x, ts->y, ts->z);
 		DrawSprite(ts->image, pt.x, pt.y);
@@ -1026,7 +1026,7 @@
 		if (!(ps->unk16 & 1)) {
 			ps->unk16 |= 1;
 			psd2 = psd;
-			
+
 			while ( (ps2=*++psd2) != NULL) {
 				if (ps2->unk16 & 1)
 					continue;
@@ -1075,7 +1075,7 @@
 {
 	DrawPixelInfo dp;
 	byte zoom;
-	
+
 	_cur_dpi = &dp;
 	dp = *dpi;
 
@@ -1090,7 +1090,7 @@
 	do {
 		if (ss->width != 0) {
 			int x, y, w, bottom;
-			
+
 			x = (ss->x >> zoom) - 1;
 			y = (ss->y >> zoom) - 1;
 
@@ -1172,7 +1172,7 @@
 	vd.first_string = NULL;
 	vd.last_tile = &vd.first_tile;
 	vd.first_tile = NULL;
- 
+
 	ViewportAddLandscape();
 #if !defined(NEW_ROTATION)
 	ViewportAddVehicles(&vd.dpi);
@@ -1196,10 +1196,10 @@
 
 	ViewportSortParentSprites(parent_list);
 	ViewportDrawParentSprites(parent_list);
-	
+
 	if (vd.first_string != NULL)
 		ViewportDrawStrings(&vd.dpi, vd.first_string);
-		
+
 	_cur_dpi = old_dpi;
 }
 
@@ -1218,7 +1218,7 @@
 			ViewportDrawChk(vp, t, top, right, bottom);
 		}
 	} else {
-		ViewportDoDraw(vp, 
+		ViewportDoDraw(vp,
 			((left - vp->left) << vp->zoom) + vp->virtual_left,
 			((top - vp->top) << vp->zoom) + vp->virtual_top,
 			((right - vp->left) << vp->zoom) + vp->virtual_left,
@@ -1285,7 +1285,7 @@
 		t = x;
 		x = y - t;
 		y = y + t;
-		
+
 		// check if inside bounds?
 		t = (-130) << vp->zoom;
 		err = 0;
@@ -1301,7 +1301,7 @@
 		if (err != 0) {
 			/* coordinate remap */
 			Point pt = RemapCoords(x, y, 0);
-			t = (-1) << vp->zoom; 
+			t = (-1) << vp->zoom;
 			WP(w,vp_d).scrollpos_x = pt.x & t;
 			WP(w,vp_d).scrollpos_y = pt.y & t;
 		}
@@ -1373,7 +1373,7 @@
 		pt.x - 31 + 67,
 		pt.y - 122 + 154
 	);
-}	
+}
 
 void SetSelectionTilesDirty()
 {
@@ -1417,8 +1417,8 @@
 
 	if (vp->zoom < 1) {
 		x = x - vp->left + vp->virtual_left;
-		y = y - vp->top + vp->virtual_top;	
-		
+		y = y - vp->top + vp->virtual_top;
+
 		FOR_ALL_TOWNS(t) {
 			if (t->xy &&
 			    y >= t->sign.top &&
@@ -1431,7 +1431,7 @@
 		}
 	} else if (vp->zoom == 1) {
 		x = (x - vp->left + 1) * 2 + vp->virtual_left;
-		y = (y - vp->top + 1) * 2 + vp->virtual_top;	
+		y = (y - vp->top + 1) * 2 + vp->virtual_top;
 		FOR_ALL_TOWNS(t) {
 			if (t->xy &&
 			    y >= t->sign.top &&
@@ -1444,7 +1444,7 @@
 		}
 	} else {
 		x = (x - vp->left + 3) * 4 + vp->virtual_left;
-		y = (y - vp->top + 3) * 4 + vp->virtual_top;	
+		y = (y - vp->top + 3) * 4 + vp->virtual_top;
 		FOR_ALL_TOWNS(t) {
 			if (t->xy &&
 			    y >= t->sign.top &&
@@ -1469,7 +1469,7 @@
 
 	if (vp->zoom < 1) {
 		x = x - vp->left + vp->virtual_left;
-		y = y - vp->top + vp->virtual_top;	
+		y = y - vp->top + vp->virtual_top;
 
 		FOR_ALL_STATIONS(st) {
 			if (st->xy &&
@@ -1483,7 +1483,7 @@
 		}
 	} else if (vp->zoom == 1) {
 		x = (x - vp->left + 1) * 2 + vp->virtual_left;
-		y = (y - vp->top + 1) * 2 + vp->virtual_top;	
+		y = (y - vp->top + 1) * 2 + vp->virtual_top;
 		FOR_ALL_STATIONS(st) {
 			if (st->xy &&
 			    y >= st->sign.top &&
@@ -1496,7 +1496,7 @@
 		}
 	} else {
 		x = (x - vp->left + 3) * 4 + vp->virtual_left;
-		y = (y - vp->top + 3) * 4 + vp->virtual_top;	
+		y = (y - vp->top + 3) * 4 + vp->virtual_top;
 		FOR_ALL_STATIONS(st) {
 			if (st->xy &&
 			    y >= st->sign.top &&
@@ -1521,7 +1521,7 @@
 
 	if (vp->zoom < 1) {
 		x = x - vp->left + vp->virtual_left;
-		y = y - vp->top + vp->virtual_top;	
+		y = y - vp->top + vp->virtual_top;
 
 		for(ss = _sign_list; ss != endof(_sign_list); ss++) {
 			if (ss->str &&
@@ -1535,7 +1535,7 @@
 		}
 	} else if (vp->zoom == 1) {
 		x = (x - vp->left + 1) * 2 + vp->virtual_left;
-		y = (y - vp->top + 1) * 2 + vp->virtual_top;	
+		y = (y - vp->top + 1) * 2 + vp->virtual_top;
 		for(ss = _sign_list; ss != endof(_sign_list); ss++) {
 			if (ss->str &&
 			    y >= ss->sign.top &&
@@ -1548,7 +1548,7 @@
 		}
 	} else {
 		x = (x - vp->left + 3) * 4 + vp->virtual_left;
-		y = (y - vp->top + 3) * 4 + vp->virtual_top;	
+		y = (y - vp->top + 3) * 4 + vp->virtual_top;
 		for(ss = _sign_list; ss != endof(_sign_list); ss++) {
 			if (ss->str &&
 			    y >= ss->sign.top &&
@@ -1573,7 +1573,7 @@
 
 	if (vp->zoom < 1) {
 		x = x - vp->left + vp->virtual_left;
-		y = y - vp->top + vp->virtual_top;	
+		y = y - vp->top + vp->virtual_top;
 
 		for(cp = _checkpoints; cp != endof(_checkpoints); cp++) {
 			if (cp->xy &&
@@ -1587,7 +1587,7 @@
 		}
 	} else if (vp->zoom == 1) {
 		x = (x - vp->left + 1) * 2 + vp->virtual_left;
-		y = (y - vp->top + 1) * 2 + vp->virtual_top;	
+		y = (y - vp->top + 1) * 2 + vp->virtual_top;
 		for(cp = _checkpoints; cp != endof(_checkpoints); cp++) {
 			if (cp->xy &&
 			    y >= cp->sign.top &&
@@ -1600,7 +1600,7 @@
 		}
 	} else {
 		x = (x - vp->left + 3) * 4 + vp->virtual_left;
-		y = (y - vp->top + 3) * 4 + vp->virtual_top;	
+		y = (y - vp->top + 3) * 4 + vp->virtual_top;
 		for(cp = _checkpoints; cp != endof(_checkpoints); cp++) {
 			if (cp->xy &&
 			    y >= cp->sign.top &&
@@ -1691,7 +1691,7 @@
 	Point pt;
 	Window *w;
 	WindowEvent e;
-	
+
 	pt = GetTileBelowCursor();
 	if (pt.x == -1)
 		return;
@@ -1808,7 +1808,7 @@
 			int y2 = thd->selstart.y;
 			x1 &= ~0xF;
 			y1 &= ~0xF;
-			
+
 			if (x1 >= x2) intswap(x1,x2);
 			if (y1 >= y2) intswap(y1,y2);
 			thd->new_pos.x = x1;
@@ -1834,10 +1834,10 @@
 		}
 	}
 
-	if (thd->drawstyle != thd->new_drawstyle || 
-			thd->pos.x != thd->new_pos.x || thd->pos.y != thd->new_pos.y || 
+	if (thd->drawstyle != thd->new_drawstyle ||
+			thd->pos.x != thd->new_pos.x || thd->pos.y != thd->new_pos.y ||
 			thd->size.x != thd->new_size.x || thd->size.y != thd->new_size.y) {
-		
+
 		// clear the old selection?
 		if (thd->drawstyle) SetSelectionTilesDirty();
 
@@ -1898,7 +1898,7 @@
 	int d;
 	bool b;
 	uint w,h;
-	
+
 	w =	myabs((x & ~0xF) - thd->selstart.x) + 16;
 	h = myabs((y & ~0xF) - thd->selstart.y) + 16;
 
@@ -2002,7 +2002,7 @@
 {
 	Window *w;
 	WindowEvent e;
-	
+
 	if (_special_mouse_mode != WSM_SIZING)
 		return true;
 
@@ -2024,9 +2024,9 @@
 
 	// mouse button released..
 	// keep the selected tool, but reset it to the original mode.
-	_special_mouse_mode = WSM_NONE;	
+	_special_mouse_mode = WSM_NONE;
 	_thd.place_mode = (_thd.next_drawstyle == HT_RECT || _thd.next_drawstyle & HT_LINE) ? 1 : 2;
-	
+
 	SetTileSelectSize(1, 1);
 
 	// and call the mouseup event.
@@ -2035,7 +2035,7 @@
 	e.place.tile = TILE_FROM_XY(e.place.pt.x, e.place.pt.y);
 	e.place.starttile = TILE_FROM_XY(_thd.selstart.x, _thd.selstart.y);
 	w->wndproc(w, &e);
-		
+
 	return false;
 }
 
@@ -2057,9 +2057,9 @@
 		if (w != NULL)
 			CallWindowEventNP(w, WE_ABORT_PLACE_OBJ);
 	}
-	
+
 	SetTileSelectSize(1, 1);
-	
+
 	thd->make_square_red = false;
 
 	if (mode == 4) {
@@ -2075,7 +2075,7 @@
 
 	if (mode == 3)
 		VpStartPreSizing();
-	
+
 	if ( (int)icon < 0)
 		SetAnimatedMouseCursor(_animcursors[~icon]);
 	else
--- a/viewport.h	Fri Sep 10 18:54:23 2004 +0000
+++ b/viewport.h	Fri Sep 10 19:02:27 2004 +0000
@@ -8,12 +8,12 @@
 	int virtual_left, virtual_top;			// virtual coordinates
 	int virtual_width, virtual_height;	// these are just width << zoom, height << zoom
 
-	byte zoom;	
+	byte zoom;
 };
 
 /* viewport.c */
 Point MapXYZToViewport(ViewPort *vp, uint x, uint y, uint z);
-void AssignWindowViewport(Window *w, int x, int y, 
+void AssignWindowViewport(Window *w, int x, int y,
 	int width, int height, uint32 follow_flags, byte zoom);
 void SetViewportPosition(Window *w, int x, int y);
 ViewPort *IsPtInWindowViewport(Window *w, int x, int y);
--- a/w32dm2.cpp	Fri Sep 10 18:54:23 2004 +0000
+++ b/w32dm2.cpp	Fri Sep 10 19:02:27 2004 +0000
@@ -65,7 +65,7 @@
 IDirectMusicSegment *segment = NULL;
 
 // the loader bject can load many types of DMusic related files
-IDirectMusicLoader *loader = NULL;						
+IDirectMusicLoader *loader = NULL;
 
 // whether we've initialized COM or not (when deciding whether to shut down)
 int COMInitialized = 0;
@@ -81,7 +81,7 @@
 };
 
 #define M(x) x "\0"
-static const char ole_files[] = 
+static const char ole_files[] =
 	M("ole32.dll")
 	M("CoCreateInstance")
 	M("CoInitialize")
@@ -95,7 +95,7 @@
 
 static bool LoadOleDLL()
 {
-	if (_proc.CoCreateInstance != NULL) 
+	if (_proc.CoCreateInstance != NULL)
 		return true;
 	if (!LoadLibraryList((void**)&_proc, ole_files))
 		return false;
@@ -151,7 +151,7 @@
 	// midi file for our demo. Again, we need to use CoCreateInstance
 	// and pass the appropriate ID parameters
 	if (FAILED(_proc.CoCreateInstance((REFCLSID)CLSID_DirectMusicLoader,
-			NULL, CLSCTX_INPROC, 
+			NULL, CLSCTX_INPROC,
 			(REFIID)IID_IDirectMusicLoader,
 			(LPVOID *)&loader))) {
 		MSGBOX("Failed to create loader object");
@@ -163,7 +163,7 @@
 	return true;
 }
 
-// Releases memory used by all of the initialized 
+// Releases memory used by all of the initialized
 // DirectMusic objects in the program
 void ReleaseSegment (void)
 {
@@ -174,8 +174,8 @@
 }
 void ShutdownDirectMusic (void)
 {
-	// release everything but the segment, which the performance 
-	// will release automatically (and it'll crash if it's been 
+	// release everything but the segment, which the performance
+	// will release automatically (and it'll crash if it's been
 	// released already)
 
 	if (NULL != loader) {
@@ -196,7 +196,7 @@
 	}
 }
 
-// Load MIDI file for playing 
+// Load MIDI file for playing
 bool LoadMIDI (char *directory, char *filename)
 {
 	DMUS_OBJECTDESC obj_desc;
@@ -229,8 +229,8 @@
 		ReleaseSegment();
 
 	// and make a new segment
-	if (FAILED(loader->GetObject(&obj_desc, 
-			(REFIID)IID_IDirectMusicSegment, 
+	if (FAILED(loader->GetObject(&obj_desc,
+			(REFIID)IID_IDirectMusicSegment,
 			(LPVOID *) &segment))) {
 		MSGBOX("LoadMIDI: Get object failed");
 		return FALSE;
--- a/water_cmd.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/water_cmd.c	Fri Sep 10 19:02:27 2004 +0000
@@ -27,7 +27,7 @@
 int32 CmdBuildShipDepot(int x, int y, uint32 flags, uint32 p1, uint32 p2)
 {
 	uint tile, tile2;
-	
+
 	int32 cost, ret;
 	Depot *dep;
 
@@ -49,7 +49,7 @@
 	ret = DoCommandByTile(tile2, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
 	if (ret == CMD_ERROR)
 		return CMD_ERROR;
-	
+
 	// pretend that we're not making land from the water even though we actually are.
 	cost = 0;
 
@@ -62,12 +62,12 @@
 		_last_built_ship_depot_tile = tile;
 		dep->town_index = ClosestTownFromTile(tile, (uint)-1)->index;
 
-		ModifyTile(tile, 
+		ModifyTile(tile,
 			MP_SETTYPE(MP_WATER) | MP_MAPOWNER_CURRENT | MP_MAP5 | MP_MAP2_CLEAR | MP_MAP3LO_CLEAR | MP_MAP3HI_CLEAR,
 			(0x80 + p1*2)
 		);
-	
-		ModifyTile(tile2, 
+
+		ModifyTile(tile2,
 			MP_SETTYPE(MP_WATER) | MP_MAPOWNER_CURRENT | MP_MAP5 | MP_MAP2_CLEAR | MP_MAP3LO_CLEAR | MP_MAP3HI_CLEAR,
 			(0x81 + p1*2)
 		);
@@ -101,8 +101,8 @@
 		// Kill the entry from the depot table
 		for(d=_depots; d->xy != tile; d++) {}
 		d->xy = 0;
-				
-		DeleteWindowById(WC_VEHICLE_DEPOT, tile);		
+
+		DeleteWindowById(WC_VEHICLE_DEPOT, tile);
 	}
 
 	return _price.remove_ship_depot;
@@ -117,7 +117,7 @@
 	// middle tile
 	ret = DoCommandByTile(tile, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
 	if (ret == CMD_ERROR) return CMD_ERROR;
-	
+
 	delta = _tileoffs_by_dir[dir];
 	// lower tile
 	ret = DoCommandByTile(tile - delta, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
@@ -151,7 +151,7 @@
 		DoClearSquare(tile + delta);
 		DoClearSquare(tile - delta);
 	}
-	
+
 	return _price.clear_water * 2;
 }
 
@@ -168,7 +168,7 @@
 	uint tile = TILE_FROM_XY(x,y);
 	int32 ret;
 	uint th;
-	th = GetTileSlope(tile, NULL); 
+	th = GetTileSlope(tile, NULL);
 
 	if (th==3 || th==6 || th==9 || th==12) {
 		static const byte _shiplift_dirs[16] = {0,0,0,2,0,0,1,0,0,3,0,0,0};
@@ -194,7 +194,7 @@
 	// move in which direction?
 	delta = (GET_TILE_X(tile) == GET_TILE_X(endtile)) ? TILE_XY(0,1) : TILE_XY(1,0);
 	if (endtile < tile) delta = -delta;
-	
+
 	cost = 0;
 	for(;;) {
 		ret = 0;
@@ -277,7 +277,7 @@
 					DoClearSquare(tile);
 				return _price.clear_water;
 			}
-			if (flags & DC_EXEC)			
+			if (flags & DC_EXEC)
 				DoClearSquare(tile);
 			return _price.purchase_land;
 		} else
@@ -290,7 +290,7 @@
 			TILE_XY(-1, 0),TILE_XY(0, 1),TILE_XY(1, 0),TILE_XY(0, -1), // lower
 			TILE_XY(1, 0),TILE_XY(0, -1),TILE_XY(-1, 0),TILE_XY(0, 1), // upper
 		};
-				
+
 		if (flags & DC_AUTO) return_cmd_error(STR_2004_BUILDING_MUST_BE_DEMOLISHED);
 		// don't allow water to delete it.
 		if (_current_player == OWNER_WATER) return CMD_ERROR;
@@ -316,9 +316,9 @@
 {
 	byte m5 = _map5[tile];
 	if (IS_TILETYPE(tile, MP_WATER)) {
-		return m5 != 1;	
+		return m5 != 1;
 	} else if (IS_TILETYPE(tile, MP_STATION)) {
-		// returns true if it is a dock-station (m5 inside values is m5<75 all stations, 
+		// returns true if it is a dock-station (m5 inside values is m5<75 all stations,
 		// 83<=m5<=114 new airports
 		return !(m5 < 75 || (m5 >= 83 && m5 <= 114));
 	} else if (IS_TILETYPE(tile, MP_TUNNELBRIDGE)) {
@@ -331,13 +331,13 @@
 void DrawCanalWater(uint tile)
 {
 	uint wa;
-	
+
 	// determine the edges around with water.
 	wa = IsWateredTile(TILE_ADDXY(tile, -1, 0)) << 0;
 	wa += IsWateredTile(TILE_ADDXY(tile, 0, 1)) << 1;
 	wa += IsWateredTile(TILE_ADDXY(tile, 1, 0)) << 2;
 	wa += IsWateredTile(TILE_ADDXY(tile, 0, -1)) << 3;
-	
+
 	if (!(wa & 1)) DrawGroundSprite(SPR_CANALS_BASE + 57);
 	if (!(wa & 2)) DrawGroundSprite(SPR_CANALS_BASE + 58);
 	if (!(wa & 4)) DrawGroundSprite(SPR_CANALS_BASE + 59);
@@ -383,9 +383,9 @@
 	const WaterDrawTileStruct *wdts;
 	uint32 image;
 
-	DrawGroundSprite(*(uint16*)t);	
+	DrawGroundSprite(*(uint16*)t);
 	t += sizeof(uint16);
-		
+
 	for(wdts = (WaterDrawTileStruct *)t; (byte)wdts->delta_x != 0x80; wdts++) {
 		image =	wdts->image + base;
 		if (_display_opt & DO_TRANS_BUILDINGS) {
@@ -431,7 +431,7 @@
 	t = _shipdepot_display_seq[image];
 	DrawSprite(*(uint16*)t, x, y);
 	t += sizeof(uint16);
-		
+
 	for(wdts = (WaterDrawTileStruct *)t; (byte)wdts->delta_x != 0x80; wdts++) {
 		Point pt = RemapCoords(wdts->delta_x, wdts->delta_y, wdts->delta_z);
 		DrawSprite(wdts->image + PLAYER_SPRITE_COLOR(_local_player), x + pt.x, y + pt.y);
@@ -440,12 +440,12 @@
 
 
 uint GetSlopeZ_Water(TileInfo *ti)
-{ 
+{
 	return GetPartialZ(ti->x&0xF, ti->y&0xF, ti->tileh) + ti->z;
 }
 
 uint GetSlopeTileh_Water(TileInfo *ti)
-{ 
+{
 	return ti->tileh;
 }
 
@@ -534,7 +534,7 @@
 			_vehicle_sort_dirty[VEHROAD] = true;
 			InvalidateWindow(WC_ROADVEH_LIST, v->owner);
 		}
-		
+
 		else if (v->type == VEH_Train) {
 			v = GetFirstVehicleInChain(v);
 			u = v;
@@ -549,13 +549,13 @@
 			v = u;
 			v->u.rail.crash_anim_pos = 4000; // max 4440, disappear pretty fast
 			_vehicle_sort_dirty[VEHTRAIN] = true;
-			InvalidateWindow(WC_TRAINS_LIST, v->owner);						
+			InvalidateWindow(WC_TRAINS_LIST, v->owner);
 		} else
 			return;
 
 		InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, 4);
 		InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
-		
+
 		SET_DPARAM16(0, pass);
 		AddNewsItem(STR_B006_FLOOD_VEHICLE_DESTROYED,
 			NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ACCIDENT, 0),
@@ -621,7 +621,7 @@
 	}
 
 	if ( (m5 & 0x10) == 0x10) {
-		// 
+		//
 		b = _shiplift_tracks[m5 & 0xF];
 		return b + (b<<8);
 	}
@@ -638,7 +638,7 @@
 static void ClickTile_Water(uint tile)
 {
 	byte m5 = _map5[tile] - 0x80;
-	
+
 	if (IS_BYTE_INSIDE(m5, 0, 3+1)) {
 		if (m5 & 1)
 			tile += (m5==1) ? TILE_XY(-1,0) : TILE_XY(0,-1);
--- a/widget.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/widget.c	Fri Sep 10 19:02:27 2004 +0000
@@ -11,7 +11,7 @@
 
 	top += 10;
 	bottom -= 9;
-	
+
 	height = (bottom - top);
 
 	pos = sb->pos;
@@ -19,7 +19,7 @@
 	cap = sb->cap;
 
 	if (count != 0)	top += height * pos / count;
-	
+
 	if (cap > count) cap = count;
 	if (count != 0)
 		bottom -= (count - pos - cap) * height / count;
@@ -61,7 +61,7 @@
 		pos = x;
 		sb = &w->hscroll;
 	}
-	
+
 	if (pos <= mi+9) {
 		// Pressing the upper button?
 		if (!_demo_mode) {
@@ -76,7 +76,7 @@
 		// Pressing the lower button?
 		if (!_demo_mode) {
 			w->flags4 |= WF_SCROLL_DOWN;
-			
+
 			if (_scroller_click_timeout == 0) {
 				_scroller_click_timeout = 6;
 				if ((byte)(sb->pos + sb->cap) < sb->count)
@@ -85,14 +85,14 @@
 			_left_button_clicked = false;
 		}
 	} else {
-		// 
+		//
 		Point pt = HandleScrollbarHittest(sb, mi, ma);
 
 		if (pos < pt.x) {
 			sb->pos = max(sb->pos - sb->cap, 0);
 		} else if (pos > pt.y) {
 			sb->pos = min(
-				sb->pos + sb->cap, 
+				sb->pos + sb->cap,
 				max(sb->count - sb->cap, 0)
 			);
 		} else {
@@ -147,9 +147,9 @@
 	Rect r;
 	uint32 dparam_backup[10];
 	uint32 cur_click, cur_disabled, cur_hidden;
-	
+
 	if (w->desc_flags & WDF_RESTORE_DPARAM)	COPY_OUT_DPARAM(dparam_backup, 0, lengthof(dparam_backup));
-	
+
 	wi = w->widget;
 
 	cur_click = w->click_state;
@@ -190,7 +190,7 @@
 			StringID str = wi->unkA;
 
 			if ((wi->type&WWT_MASK) == WWT_4 && (cur_click&1)) str++;
-			
+
 			DrawStringCentered((r.left + r.right+1)>>1, ((r.top+r.bottom + 1)>>1) - 5, str, 0);
 			goto restore_dparam;
 		}
@@ -207,13 +207,13 @@
 		}
 
 		case WWT_MATRIX: {
-			int c, d, ctr;	
+			int c, d, ctr;
 			int x, amt1, amt2;
 			int color;
-		
+
 			DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color,
 					(cur_click & 1) ? 0x20 : 0);
-			
+
 			c = (wi->unkA&0xFF);
 			amt1 = (wi->right - wi->left + 1) / c;
 
@@ -221,7 +221,7 @@
 			amt2 = (wi->bottom - wi->top + 1) / d;
 
 			color = _color_list[wi->color&0xF].window_color_bgb;
-			
+
 			x = r.left;
 			for(ctr=c; --ctr; ) {
 				x += amt1;
@@ -248,7 +248,7 @@
 				GfxFillRect(r.left+1, x, r.right-1, x, color);
 			}
 
-			goto draw_default;			
+			goto draw_default;
 		}
 
 		// vertical scrollbar
@@ -276,7 +276,7 @@
 			GfxFillRect(r.left+3, r.top+10, r.left+3, r.bottom-10, c2);
 			GfxFillRect(r.left+7, r.top+10, r.left+7, r.bottom-10, c1);
 			GfxFillRect(r.left+8, r.top+10, r.left+8, r.bottom-10, c2);
-			
+
 			pt = HandleScrollbarHittest(&w->vscroll, r.top, r.bottom);
 			DrawFrameRect(r.left, pt.x, r.right, pt.y, wi->color, (w->flags4 & (WF_SCROLL_MIDDLE | WF_HSCROLL)) == WF_SCROLL_MIDDLE ? 0x20 : 0);
 			break;
@@ -350,7 +350,7 @@
 		case WWT_CAPTION: {
 			DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, 0x10);
 			DrawFrameRect(r.left+1, r.top+1, r.right-1, r.bottom-1, wi->color, (w->caption_color == 0xFF) ? 0x60 : 0x70);
-			
+
 			if (w->caption_color != 0xFF) {
 				GfxFillRect(r.left+2, r.top+2, r.right-2, r.bottom-2, _color_list[_player_colors[w->caption_color]].window_color_1b);
 			}
@@ -365,7 +365,7 @@
 		}
 		}
 	} while (cur_click>>=1, cur_disabled>>=1, cur_hidden >>= 1, (++wi)->type != WWT_LAST);
-	
+
 
 	if (w->flags4 & WF_WHITE_BORDER_MASK) {
 		//DrawFrameRect(w->left, w->top, w->left + w->width-1, w->top+w->height-1, 0xF, 0x10);
@@ -396,7 +396,7 @@
 
 	if (GetWidgetFromPos(w, _cursor.pos.x - w->left, _cursor.pos.y - w->top) < 0)
 		return -1;
-	
+
 	y = _cursor.pos.y - w->top - 2;
 
 	if (y < 0)
@@ -433,7 +433,7 @@
 				DrawString(x+2, y, _dropdown_items[i], sel==0 ? 12 : 16);
 
 				if (dis & 1) {
-					GfxFillRect(x, y, x+w->width-3, y + 9, 0x8000 + 
+					GfxFillRect(x, y, x+w->width-3, y + 9, 0x8000 +
 						_color_list[_dropdown_menu_widgets[0].color].window_color_bga);
 				}
 			} else {
@@ -491,7 +491,7 @@
 			SetWindowDirty(w);
 		}
 	} break;
-		
+
 	case WE_DESTROY: {
 		Window *w2 = FindWindowById(_dropdown_windowclass, _dropdown_windownum);
 		if (w2 != NULL) {
@@ -510,7 +510,7 @@
 	const Widget *wi;
 	Window *w2;
 	uint32 old_click_state = w->click_state;
-	
+
 	_dropdown_disabled = disabled_mask;
 
 	cls = w->window_class;
@@ -524,7 +524,7 @@
 	SETBIT(w->click_state, button);
 
 	InvalidateWidget(w, button);
-	
+
 	for(i=0;strings[i] != INVALID_STRING_ID;i++);
 	if (i == 0)
 		return;
@@ -532,11 +532,11 @@
 	_dropdown_items = strings;
 	_dropdown_item_count = i;
 	_dropdown_selindex = selected;
-	
+
 	_dropdown_windowclass = w->window_class;
 	_dropdown_windownum = w->window_number;
 	_dropdown_button = button;
-	
+
 	_dropdown_var1 = 0;
 	_dropdown_var2 = 1;
 
@@ -547,8 +547,8 @@
 	w2 = AllocateWindow(
 		w->left + wi[-1].left + 1,
 		w->top + wi->bottom + 2,
-		(_dropdown_menu_widgets[0].right=t1=wi->right - wi[-1].left, t1 + 1), 
-		(_dropdown_menu_widgets[0].bottom=t2=i*10+3, t2+1), 
+		(_dropdown_menu_widgets[0].right=t1=wi->right - wi[-1].left, t1 + 1),
+		(_dropdown_menu_widgets[0].bottom=t2=i*10+3, t2+1),
 		DropdownMenuWndProc,
 		0x3F,
 		_dropdown_menu_widgets);
--- a/win32.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/win32.c	Fri Sep 10 19:02:27 2004 +0000
@@ -51,7 +51,7 @@
 
 	pal->palVersion = 0x300;
 	pal->palNumEntries = 256;
-	
+
 	for(i=0,b=_cur_palette; i!=256;i++,b+=3) {
 		pal->palPalEntry[i].peRed = b[0];
 		pal->palPalEntry[i].peGreen = b[1];
@@ -60,7 +60,7 @@
 
 	}
 	_wnd.gdi_palette = CreatePalette(pal);
-	if (_wnd.gdi_palette == NULL)	
+	if (_wnd.gdi_palette == NULL)
 		error("CreatePalette failed!\n");
 }
 
@@ -133,7 +133,7 @@
 	AS(VK_SUBTRACT,		WKC_NUM_MINUS),
 	AS(VK_ADD,				WKC_NUM_PLUS),
 	AS(VK_DECIMAL,		WKC_NUM_DECIMAL),
-	{0}	
+	{0}
 };
 
 static uint MapWindowsKey(uint key)
@@ -162,14 +162,14 @@
 static void ClientSizeChanged(int w, int h)
 {
 	if (_wnd.double_size) { w >>= 1; h >>= 1; }
-	
+
 	// allocate new dib section of the new size
 	if (AllocateDibSection(w, h)) {
 		// mark all palette colors dirty
 		_pal_first_dirty = 0;
 		_pal_last_dirty = 255;
 		GameSizeChanged();
-		
+
 		// redraw screen
 		if (_wnd.running) {
 			_screen.dst_ptr = _wnd.buffer_bits;
@@ -191,12 +191,12 @@
 		dc2 = CreateCompatibleDC(dc);
 		old_bmp = SelectObject(dc2, _wnd.dib_sect);
 		old_palette = SelectPalette(dc, _wnd.gdi_palette, FALSE);
-		
+
 		if (_pal_last_dirty != -1) {
 			UpdatePalette(dc2, _pal_first_dirty, _pal_last_dirty - _pal_first_dirty + 1);
 			_pal_last_dirty = -1;
 		}
-				
+
 		BitBlt(dc, 0, 0, _wnd.width, _wnd.height, dc2, 0, 0, SRCCOPY);
 		SelectPalette(dc, old_palette, TRUE);
 		SelectObject(dc2, old_bmp);
@@ -219,7 +219,7 @@
 			InvalidateRect(hwnd, NULL, FALSE);
 		return 0;
 	}
-		
+
 	case WM_CLOSE:
 		AskExitGame();
 		return 0;
@@ -255,7 +255,7 @@
 			x >>= 1;
 			y >>= 1;
 		}
-		
+
 		if (_cursor.fix_at) {
 			int dx = x - _cursor.pos.x;
 			int dy = y - _cursor.pos.y;
@@ -285,7 +285,7 @@
 	}
 
 	case WM_KEYDOWN:
-		{         
+		{
 		// this is the rewritten ascii input function
 		// it disables windows deadkey handling --> more linux like :D
         unsigned short w = 0;
@@ -304,7 +304,7 @@
 			ClientSizeChanged(_wnd.width, _wnd.height);
 			MarkWholeScreenDirty();
 		}
-		break;	
+		break;
 
 
 	case WM_SYSKEYDOWN:
@@ -334,7 +334,7 @@
 
 		SetRect(&r2, 0, 0, 0, 0);
 		AdjustWindowRect(&r2, GetWindowLong(hwnd, GWL_STYLE), FALSE);
-		
+
 		w = r->right - r->left - (r2.right - r2.left);
 		h = r->bottom - r->top - (r2.bottom - r2.top);
 		if (_wnd.double_size) { w >>= 1; h >>= 1; }
@@ -389,7 +389,7 @@
 #endif  //GET_WHEEL_DELTA_WPARAM
 
 	case WM_MOUSEWHEEL: {
-		int delta = GET_WHEEL_DELTA_WPARAM(wParam);	
+		int delta = GET_WHEEL_DELTA_WPARAM(wParam);
 		if (delta < 0) {
 			_cursor.wheel++;
 		} else if (delta > 0) {
@@ -433,13 +433,13 @@
 	_fullscreen = full_screen;
 
 	_wnd.double_size = _double_size && !full_screen;
-	
+
 	// recreate window?
 	if ((full_screen|_wnd.fullscreen) && _wnd.main_wnd) {
 		DestroyWindow(_wnd.main_wnd);
 		_wnd.main_wnd = 0;
 	}
-	
+
 	if (full_screen) {
 		DEVMODE settings;
 		memset(&settings, 0, sizeof(DEVMODE));
@@ -467,7 +467,7 @@
 		RECT r;
 		uint style;
 		int x, y, w, h;
-	
+
 		if ((_wnd.fullscreen=full_screen) != false) {
 			style = WS_POPUP | WS_VISIBLE;
 			SetRect(&r, 0, 0, _wnd.width_org, _wnd.height_org);
@@ -510,11 +510,11 @@
 		free(_wnd.alloced_bits);
 		_wnd.alloced_bits = NULL;
 	}
-	
+
 	bi = alloca(sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*256);
 	memset(bi, 0, sizeof(BITMAPINFOHEADER) + sizeof(RGBQUAD)*256);
 	bi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
-	
+
 	{
 		if (_wnd.double_size) {
 			_wnd.alloced_bits = _wnd.buffer_bits = (byte*)malloc(w * h);
@@ -525,7 +525,7 @@
 		bi->bmiHeader.biWidth = _wnd.width = w;
 		bi->bmiHeader.biHeight = -(_wnd.height = h);
 	}
-	
+
 	bi->bmiHeader.biPlanes = 1;
 	bi->bmiHeader.biBitCount = 8;
 	bi->bmiHeader.biCompression = BI_RGB;
@@ -539,7 +539,7 @@
 		error("CreateDIBSection failed");
 	ReleaseDC(0, dc);
 
-	if (!_wnd.double_size) 
+	if (!_wnd.double_size)
 		_wnd.buffer_bits = _wnd.bitmap_bits;
 
 	return true;
@@ -562,7 +562,7 @@
 	DEVMODE dm;
 
 	while (EnumDisplaySettings(NULL, i++, &dm)) {
-		if (dm.dmBitsPerPel == 8 && 
+		if (dm.dmBitsPerPel == 8 &&
 				IS_INT_INSIDE(dm.dmPelsWidth, 640, MAX_SCREEN_WIDTH+1) &&
 				IS_INT_INSIDE(dm.dmPelsHeight, 480, MAX_SCREEN_HEIGHT+1) &&
 				(n == 0 || _resolutions[n-1][0] != dm.dmPelsWidth || _resolutions[n-1][1] != dm.dmPelsHeight)) {
@@ -625,7 +625,7 @@
 
 	while (height) {
 		for(i=0; i!=width; i++) {
-			d[i*2] = d[i*2+1] = d[i*2+p*2] = d[i*2+1+p*2] = s[i];  
+			d[i*2] = d[i*2+1] = d[i*2+p*2] = d[i*2+1+p*2] = s[i];
 		}
 		s += p;
 		d += p * 4;
@@ -676,7 +676,7 @@
 		} else if (_fast_forward&2) {
 			_fast_forward = 0;
 		}
-		
+
 
 		cur_ticks=GetTickCount();
 		if ((_fast_forward && !_pause) || cur_ticks > next_tick)
@@ -687,15 +687,15 @@
 			_ctrl_pressed = _wnd.has_focus && GetAsyncKeyState(VK_CONTROL)<0;
 			_shift_pressed = _wnd.has_focus && GetAsyncKeyState(VK_SHIFT)<0;
 			_dbg_screen_rect = _wnd.has_focus && GetAsyncKeyState(VK_CAPITAL)<0;
-			
+
 			// determine which directional keys are down
-			_dirkeys = 
-				(GetAsyncKeyState(VK_LEFT) < 0 ? 1 : 0) + 
-				(GetAsyncKeyState(VK_UP) < 0 ? 2 : 0) + 
-				(GetAsyncKeyState(VK_RIGHT) < 0 ? 4 : 0) + 
+			_dirkeys =
+				(GetAsyncKeyState(VK_LEFT) < 0 ? 1 : 0) +
+				(GetAsyncKeyState(VK_UP) < 0 ? 2 : 0) +
+				(GetAsyncKeyState(VK_RIGHT) < 0 ? 4 : 0) +
 				(GetAsyncKeyState(VK_DOWN) < 0 ? 8 : 0);
 
-			GameLoop();	
+			GameLoop();
 			_cursor.delta.x = _cursor.delta.y = 0;
 
 			if (_force_full_redraw)
@@ -718,9 +718,9 @@
 {
 	_wnd.width = _wnd.width_org = w;
 	_wnd.height = _wnd.height_org = h;
-		
+
 	MakeWindow(_wnd.fullscreen);
-		
+
 	return true;
 }
 
@@ -823,15 +823,15 @@
 		if ((vol=_midi.new_vol) != -1) {
 			_midi.new_vol = -1;
 			MidiIntSetVolume(vol);
-			
+
 		}
 		if ((s=_midi.start_song)[0]) {
 			_midi.playing = MidiIntPlaySong(s);
 			s[0] = 0;
-			
+
 			// Delay somewhat in case we don't manage to play.
 			if (!_midi.playing) {
-				Sleep(5000);	
+				Sleep(5000);
 			}
 		}
 		if (_midi.stop_song != false && _midi.playing) {
@@ -893,7 +893,7 @@
 	WAVEHDR *hdr;
 	for(hdr=_wave_hdr; hdr != endof(_wave_hdr); hdr++) {
 		if (!(hdr->dwFlags & WHDR_INQUEUE)) {
-			MxMixSamples(_mixer, hdr->lpData, hdr->dwBufferLength >> 2);		
+			MxMixSamples(_mixer, hdr->lpData, hdr->dwBufferLength >> 2);
 			if (waveOutWrite(_waveout, hdr, sizeof(WAVEHDR)) != MMSYSERR_NOERROR)
 				error("waveOutWrite failed");
 		}
@@ -914,7 +914,7 @@
 {
 	WAVEFORMATEX wfex;
 	int hz;
-	
+
 	_bufsize = GetDriverParamInt(parm, "bufsize", 1024);
 	hz = GetDriverParamInt(parm, "hz", 11025);
 	wfex.wFormatTag = WAVE_FORMAT_PCM;
@@ -1007,7 +1007,7 @@
 static void MakeCRCTable(uint32 *table) {
 	uint32 crc, poly = 0xEDB88320L;
 	int	i, j;
-	
+
 	_crc_table = table;
 
 	for (i=0; i!=256; i++) {
@@ -1051,7 +1051,7 @@
 			}
 			dfi->size = filesize;
 			dfi->crc32 = crc ^ (uint32)-1;
-			
+
 			if (GetFileTime(file, NULL, NULL, &write_time)) {
 				FileTimeToSystemTime(&write_time, &dfi->file_time);
 			}
@@ -1108,14 +1108,14 @@
 	return output;
 }
 
-static const char _crash_desc[] = 
+static const char _crash_desc[] =
 	"A serious fault condition occured in the game. The game will shut down.\n"
 	"Press \"Submit report\" to send crash information to the developers. "
 	"This will greatly help debugging. The information contained in the report is "
 	"displayed below.\n"
 	"Press \"Emergency save\" to attempt saving the game.";
 
-static const char _save_succeeded[] = 
+static const char _save_succeeded[] =
 	"Emergency save succeeded.\nBe aware that critical parts of the internal game state "
 	"may have become corrupted. The saved game is not guaranteed to work.";
 
@@ -1132,7 +1132,7 @@
 } WinInetProcs;
 
 #define M(x) x "\0"
-static const char wininet_files[] = 
+static const char wininet_files[] =
 	M("wininet.dll")
 	M("InternetOpenA")
 	M("InternetConnectA")
@@ -1153,7 +1153,7 @@
 	DWORD code, len;
 	static char buf[100];
 	char buff[100];
-	
+
 	if (_wininet.InternetOpen == NULL && !LoadLibraryList((void**)&_wininet, wininet_files)) return "can't load wininet.dll";
 
 	inet = _wininet.InternetOpen("TTD", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0 );
@@ -1171,7 +1171,7 @@
 
 	len = sizeof(code);
 	if (!_wininet.HttpQueryInfo(http, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &code, &len, 0)) { err = "httpqueryinfo failed"; goto error4; }
-	
+
 	if (code != 200) {
 		int l = sprintf(buf, "Server said: %d ", code);
 		len = sizeof(buf) - l;
@@ -1201,13 +1201,13 @@
 
 	size = GetFileSize(h, NULL);
 	if (size > 500000) goto error1;
-	
+
 	mem = malloc(size);
 	if (mem == NULL) goto error1;
 
 	if (!ReadFile(h, mem, size, &read, NULL) || read != size) goto error2;
 
-	SubmitCrashReport(wnd, mem, size, file);		
+	SubmitCrashReport(wnd, mem, size, file);
 
 error2:
 	free(mem);
@@ -1223,16 +1223,16 @@
 	int offs;
 
 	GetWindowRect(wnd, &r);
-	
+
 	SetDlgItemText(wnd, 15, _expand_texts[mode == 1]);
-	
+
 	if (mode >= 0) {
 		GetWindowRect(GetDlgItem(wnd, 11), &r2);
 		offs = r2.bottom - r2.top + 10;
 		if (!mode) offs=-offs;
 		SetWindowPos(wnd, HWND_TOPMOST, 0, 0, r.right - r.left, r.bottom - r.top + offs, SWP_NOMOVE | SWP_NOZORDER);
 	} else {
-		SetWindowPos(wnd, HWND_TOPMOST, 
+		SetWindowPos(wnd, HWND_TOPMOST,
 			(GetSystemMetrics(SM_CXSCREEN) - (r.right - r.left)) >> 1,
 			(GetSystemMetrics(SM_CYSCREEN) - (r.bottom - r.top)) >> 1,
 			0, 0, SWP_NOSIZE);
@@ -1273,7 +1273,7 @@
 		}
 		case 14: { // Submit crash report
 			char *s;
-			
+
 			SetCursor(LoadCursor(NULL, IDC_WAIT));
 
 			s = SubmitCrashReport(wnd, _crash_msg, strlen(_crash_msg), "");
@@ -1281,7 +1281,7 @@
 				MessageBoxA(wnd, s, "Error", MB_ICONSTOP);
 				break;
 			}
-			
+
 			// try to submit emergency savegame
 			if (_did_emerg_save || DoEmergencySave(wnd)) {
 				SubmitFile(wnd, "crash.sav");
@@ -1324,7 +1324,7 @@
 
 	if (had_exception) { ExitProcess(0); }
 	had_exception = true;
-	
+
 	_ident = GetTickCount(); // something pretty unique
 
 	MakeCRCTable(alloca(256 * sizeof(uint32)));
@@ -1333,7 +1333,7 @@
 	{
 		SYSTEMTIME time;
 		GetLocalTime(&time);
-		output += sprintf(output, 
+		output += sprintf(output,
 			"*** OpenTTD Crash Report ***\r\n"
 			"Date: %d-%.2d-%.2d %.2d:%.2d:%.2d\r\n"
 			"Build: %s built on " __TIMESTAMP__ "\r\n",
@@ -1436,7 +1436,7 @@
 	_asm {
 		mov _safe_esp,esp
 	}
-	
+
 	SetUnhandledExceptionFilter(ExceptionHandler);
 }
 #endif
@@ -1459,7 +1459,7 @@
 static HANDLE MyFindFirstFile(char *path, char *file, WIN32_FIND_DATA *fd)
 {
 	char paths[MAX_PATH];
-	
+
 	sprintf(paths, "%s\\%s", path, file);
 	return FindFirstFile(paths, fd);
 }
@@ -1471,7 +1471,7 @@
 
 	if (_savegame_sort_order < 2) // sort by date
     r = da->mtime < db->mtime ? -1 : 1;
-	else	
+	else
 		r = stricmp(da->title[0] ? da->title : da->name, db->title[0] ? db->title : db->name);
 
 	if (_savegame_sort_order & 1) r = -r;
@@ -1503,7 +1503,7 @@
 		fios->type = FIOS_TYPE_PARENT;
 		strcpy(fios->title, ".. (Parent directory)");
 	}
-	
+
 
 	// Show subdirectories first
 	h = MyFindFirstFile(_fios_path, "*.*", &fd);
@@ -1695,7 +1695,7 @@
 	case FIOS_TYPE_DRIVE:
 		sprintf(path, "%c:\\", item->title[0]);
 		break;
-	
+
 	case FIOS_TYPE_PARENT:
 		// Skip drive part
 		path += 3;
@@ -1713,7 +1713,7 @@
 		while (*++path);
 		// Add backslash?
 		if (path[-1] != '\\') *path++ = '\\';
-		
+
 		strcpy(path, item->name);
 		break;
 
@@ -1752,7 +1752,7 @@
 	if (GetDiskFreeSpace(root, &spc, &bps, &nfc, &tnc)) {
 		uint32 tot = ((spc*bps)*(uint64)nfc) >> 20;
 		SET_DPARAM32(0, tot);
-		return STR_4005_BYTES_FREE; 
+		return STR_4005_BYTES_FREE;
 	} else {
 		return STR_4006_UNABLE_TO_READ_DRIVE;
 	}
@@ -1848,7 +1848,7 @@
 		// end?
 		if (*line == 0)
 			break;
-		
+
 		// special handling when quoted
 		if (*line == '"') {
 			argv[n++] = ++line;
@@ -1863,7 +1863,7 @@
 				line++;
 			}
 		}
-		*line++ = 0;	
+		*line++ = 0;
 	} while (n != max_argc);
 
 	return n;
@@ -1890,12 +1890,12 @@
 	_has_console = true;
 
 	AllocConsole();
-	
+
 	hand = GetStdHandle(STD_OUTPUT_HANDLE);
 	GetConsoleScreenBufferInfo(hand, &coninfo);
 	coninfo.dwSize.Y = 500;
 	SetConsoleScreenBufferSize(hand, coninfo.dwSize);
-    
+
 	// redirect unbuffered STDIN, STDOUT, STDERR to the console
 #if !defined(__CYGWIN__)
 	*stdout = *_fdopen( _open_osfhandle((long)hand, _O_TEXT), "w" );
@@ -1905,11 +1905,11 @@
 	// open_osfhandle is not in cygwin
 	*stdout = *fdopen(1, "w" );
 	*stdin = *fdopen(0, "w" );
-	*stderr = *fdopen(2, "w" );    
+	*stderr = *fdopen(2, "w" );
 #endif
-    
-	setvbuf( stdin, NULL, _IONBF, 0 );    
-	setvbuf( stdout, NULL, _IONBF, 0 );    
+
+	setvbuf( stdin, NULL, _IONBF, 0 );
+	setvbuf( stdout, NULL, _IONBF, 0 );
 	setvbuf( stderr, NULL, _IONBF, 0 );
 }
 
@@ -1919,10 +1919,10 @@
 		puts(str);
 	else {
 		bool old;
-		
+
 		ReleaseCapture();
 		_left_button_clicked =_left_button_down = false;
-		
+
 		old = MyShowCursor(true);
 		if (MessageBoxA(GetActiveWindow(), str, "OpenTTD", MB_ICONINFORMATION | MB_OKCANCEL) == IDCANCEL) {
 			CreateConsole();
@@ -1960,7 +1960,7 @@
 	argc = ParseCommandLine(GetCommandLine(), argv, lengthof(argv));
 
 #if defined(WIN32_EXCEPTION_TRACKER)
-	{	
+	{
 		Win32InitializeExceptions();
 	}
 #endif
@@ -1985,7 +1985,7 @@
 
 	_path.personal_dir = _path.game_data_dir = cfg = malloc(MAX_PATH);
 	GetCurrentDirectory(MAX_PATH - 1, cfg);
-	
+
 
 	s = strchr(cfg, 0);
 	if (s[-1] != '\\') { s[0] = '\\'; s[1] = 0; }
--- a/window.c	Fri Sep 10 18:54:23 2004 +0000
+++ b/window.c	Fri Sep 10 19:02:27 2004 +0000
@@ -1021,7 +1021,7 @@
 			return;
 
 		// only allow zooming in-out in main window, or in viewports
-		if ( mousewheel && !(w->flags4 & WF_DISABLE_VP_SCROLL) && 
+		if ( mousewheel && !(w->flags4 & WF_DISABLE_VP_SCROLL) &&
 			   (w->window_class == WC_MAIN_WINDOW || w->window_class == WC_EXTRA_VIEW_PORT) ) {
 			ZoomInOrOutToCursorWindow(mousewheel < 0,w);
 		}