(svn r13545) [NewGRF_ports] -Sync: with trunk r13281:13411. NewGRF_ports
authorrichk
Tue, 17 Jun 2008 10:32:49 +0000
branchNewGRF_ports
changeset 10991 d8811e327d12
parent 10731 67db0d431d5e
child 10994 cd9968b6f96b
(svn r13545) [NewGRF_ports] -Sync: with trunk r13281:13411.
Makefile.src.in
bin/data/openttdd.grf
bin/data/openttdw.grf
config.lib
projects/determineversion.vbs
projects/openttd_vs80.vcproj
projects/openttd_vs90.vcproj
readme.txt
source.list
src/ai/ai.cpp
src/ai/ai.h
src/ai/default/default.cpp
src/ai/trolly/trolly.cpp
src/aircraft_cmd.cpp
src/airport_gui.cpp
src/animated_tile.cpp
src/articulated_vehicles.cpp
src/autoreplace_gui.cpp
src/autoslope.h
src/blitter/8bpp_optimized.cpp
src/blitter/factory.hpp
src/build_vehicle_gui.cpp
src/cheat.cpp
src/cheat_gui.cpp
src/clear_cmd.cpp
src/console.cpp
src/console_cmds.cpp
src/console_func.h
src/console_internal.h
src/currency.cpp
src/currency.h
src/date.cpp
src/debug.cpp
src/debug.h
src/depot_gui.cpp
src/disaster_cmd.cpp
src/dock_gui.cpp
src/driver.cpp
src/economy.cpp
src/economy_type.h
src/effectvehicle.cpp
src/elrail_func.h
src/engine.cpp
src/engine_func.h
src/engine_gui.cpp
src/engine_gui.h
src/engine_type.h
src/fiber_thread.cpp
src/fileio.cpp
src/fileio.h
src/fios.cpp
src/fios.h
src/gamelog.cpp
src/gamelog.h
src/genworld.cpp
src/genworld.h
src/genworld_gui.cpp
src/gfx.cpp
src/gfxinit.cpp
src/group_gui.cpp
src/gui.h
src/heightmap.cpp
src/industry_cmd.cpp
src/industry_gui.cpp
src/landscape.cpp
src/lang/afrikaans.txt
src/lang/brazilian_portuguese.txt
src/lang/bulgarian.txt
src/lang/catalan.txt
src/lang/croatian.txt
src/lang/czech.txt
src/lang/danish.txt
src/lang/dutch.txt
src/lang/english.txt
src/lang/english_US.txt
src/lang/esperanto.txt
src/lang/estonian.txt
src/lang/finnish.txt
src/lang/french.txt
src/lang/galician.txt
src/lang/german.txt
src/lang/hungarian.txt
src/lang/icelandic.txt
src/lang/italian.txt
src/lang/japanese.txt
src/lang/korean.txt
src/lang/lithuanian.txt
src/lang/norwegian_bokmal.txt
src/lang/norwegian_nynorsk.txt
src/lang/piglatin.txt
src/lang/polish.txt
src/lang/portuguese.txt
src/lang/romanian.txt
src/lang/russian.txt
src/lang/simplified_chinese.txt
src/lang/slovak.txt
src/lang/slovenian.txt
src/lang/spanish.txt
src/lang/swedish.txt
src/lang/traditional_chinese.txt
src/lang/turkish.txt
src/lang/ukrainian.txt
src/lang/unfinished/greek.txt
src/lang/unfinished/latvian.txt
src/main_gui.cpp
src/map.cpp
src/map_func.h
src/minilzo.cpp
src/misc.cpp
src/misc/smallvec.h
src/misc_cmd.cpp
src/misc_gui.cpp
src/mixer.cpp
src/mixer.h
src/network/core/config.h
src/network/core/core.h
src/network/core/game.h
src/network/core/tcp.cpp
src/network/network.cpp
src/network/network.h
src/network/network_client.cpp
src/network/network_data.cpp
src/network/network_data.h
src/network/network_func.h
src/network/network_gamelist.cpp
src/network/network_gamelist.h
src/network/network_gui.cpp
src/network/network_gui.h
src/network/network_internal.h
src/network/network_server.cpp
src/network/network_server.h
src/network/network_type.h
src/network/network_udp.cpp
src/newgrf.cpp
src/newgrf.h
src/newgrf_commons.cpp
src/newgrf_config.cpp
src/newgrf_engine.cpp
src/newgrf_gui.cpp
src/newgrf_town.cpp
src/news_gui.cpp
src/news_type.h
src/npf.cpp
src/oldloader.cpp
src/openttd.cpp
src/openttd.h
src/order_cmd.cpp
src/order_gui.cpp
src/os2.cpp
src/osk_gui.cpp
src/ottdres.rc.in
src/pathfind.cpp
src/player_gui.cpp
src/players.cpp
src/rail.cpp
src/rail_cmd.cpp
src/rail_gui.cpp
src/rev.cpp.in
src/rev.h
src/road.cpp
src/road_cmd.cpp
src/road_gui.cpp
src/roadveh_cmd.cpp
src/saveload.cpp
src/saveload.h
src/settings.cpp
src/settings_func.h
src/settings_gui.cpp
src/settings_internal.h
src/settings_type.h
src/ship_cmd.cpp
src/signs.cpp
src/signs_base.h
src/smallmap_gui.cpp
src/sortlist_type.h
src/sound.cpp
src/sound/win32_s.cpp
src/sound_type.h
src/spritecache.cpp
src/spriteloader/grf.cpp
src/spriteloader/grf.hpp
src/spriteloader/png.cpp
src/spriteloader/png.hpp
src/spriteloader/spriteloader.hpp
src/station.cpp
src/station_cmd.cpp
src/station_gui.cpp
src/station_type.h
src/statusbar_gui.cpp
src/stdafx.h
src/string_func.h
src/strings.cpp
src/subsidy_gui.cpp
src/table/engines.h
src/table/files.h
src/table/sprites.h
src/table/town_land.h
src/terraform_gui.cpp
src/texteff.cpp
src/tgp.cpp
src/thread.h
src/thread_morphos.cpp
src/thread_pthread.cpp
src/thread_win32.cpp
src/timetable_cmd.cpp
src/timetable_gui.cpp
src/toolbar_gui.cpp
src/town.h
src/town_cmd.cpp
src/town_gui.cpp
src/train_cmd.cpp
src/train_gui.cpp
src/tree_cmd.cpp
src/tree_gui.cpp
src/tunnelbridge_cmd.cpp
src/unix.cpp
src/unmovable_cmd.cpp
src/variables.h
src/vehicle.cpp
src/vehicle_func.h
src/vehicle_gui.cpp
src/vehicle_type.h
src/vehiclelist.cpp
src/vehiclelist.h
src/video/cocoa/event.mm
src/video/dedicated_v.cpp
src/video/sdl_v.cpp
src/video/win32_v.cpp
src/viewport.cpp
src/water_cmd.cpp
src/waypoint.cpp
src/widgets/dropdown.cpp
src/win32.cpp
src/window.cpp
src/window_gui.h
src/yapf/follow_track.hpp
src/yapf/yapf.h
src/yapf/yapf_base.hpp
src/yapf/yapf_costrail.hpp
src/yapf/yapf_destrail.hpp
src/yapf/yapf_rail.cpp
src/yapf/yapf_road.cpp
src/yapf/yapf_ship.cpp
--- a/Makefile.src.in	Tue May 27 00:50:55 2008 +0000
+++ b/Makefile.src.in	Tue Jun 17 10:32:49 2008 +0000
@@ -89,6 +89,32 @@
 $(LANG_OBJS_DIR)/table/strings.h: $(LANG_DIR)/english.txt $(LANG_OBJS_DIR)/$(STRGEN)
 	$(MAKE) -C $(LANG_OBJS_DIR) table/strings.h
 
+
+# Determine if we are using a modified version
+ifeq ($(shell if test -d $(SRC_DIR)/.svn; then echo 1; fi), 1)
+REV_MODIFIED := $(shell svnversion $(SRC_DIR) | sed -n 's/.*\(M\).*/\1/p' )
+else
+# Are we a git dir?
+ifeq ($(shell if test -d $(SRC_DIR)/../.git; then echo 1; fi), 1)
+REV_MODIFIED := $(shell if cd "$(SRC_DIR)/.." && git diff-index HEAD src | read dummy; then echo M; fi)
+else
+# Are we a hg (Mercurial) dir?
+ifeq ($(shell if test -d $(SRC_DIR)/../.hg; then echo 1; fi), 1)
+REV_MODIFIED := $(shell if hg status $(SRC_DIR) | grep -v '^?' | read dummy; then echo M; fi)
+else
+MODIFIED="1"
+endif
+endif
+endif
+
+ifneq ($(MODIFIED),"1")
+ifeq ($(REV_MODIFIED),)
+MODIFIED="0"
+else
+MODIFIED="2"
+endif
+endif
+
 # Make the revision number
 ifdef REVISION
 REV := $(REVISION)
@@ -97,7 +123,6 @@
 # Are we a SVN dir?
 ifeq ($(shell if test -d $(SRC_DIR)/.svn; then echo 1; fi), 1)
 # Find if the local source if modified
-REV_MODIFIED := $(shell svnversion $(SRC_DIR) | sed -n 's/.*\(M\).*/\1/p' )
 # Find the revision like: rXXXX-branch
 REV := $(shell LC_ALL=C svn info $(SRC_DIR) | $(AWK) '/^URL:.*branch/ { split($$2, a, "/"); BRANCH="-"a[5] } /^Last Changed Rev:/ { REV="r"$$4"$(REV_MODIFIED)" } END { print REV BRANCH }')
 REV_NR := $(shell LC_ALL=C svn info $(SRC_DIR) | $(AWK) '/^Last Changed Rev:/ { print $$4 }')
@@ -105,13 +130,13 @@
 # Are we a git dir?
 ifeq ($(shell if test -d $(SRC_DIR)/../.git; then echo 1; fi), 1)
 # Find the revision like: gXXXXM-branch
-REV := g$(shell if head=`LC_ALL=C git rev-parse --verify HEAD 2>/dev/null`; then echo "$$head" | cut -c1-8; fi)$(shell if cd "$(SRC_DIR)/.." && git diff-index HEAD src | read dummy; then echo M; fi)$(shell git branch|grep '[*]' | sed 's/\* /-/;s/^-master$$//')
+REV := g$(shell if head=`LC_ALL=C git rev-parse --verify HEAD 2>/dev/null`; then echo "$$head" | cut -c1-8; fi)$(REV_MODIFIED)$(shell git branch|grep '[*]' | sed 's/\* /-/;s/^-master$$//')
 REV_NR := $(shell LC_ALL=C cd "$(SRC_DIR)/.." && git log --pretty=format:%s src | grep -m 1 "^(svn r[0-9]*)" | sed "s/.*(svn r\([0-9]*\)).*/\1/" )
 else
 # Are we a hg (Mercurial) dir?
 ifeq ($(shell if test -d $(SRC_DIR)/../.hg; then echo 1; fi), 1)
 # Find the revision like: hXXXXM-branch
-REV := h$(shell if head=`LC_ALL=C hg tip 2>/dev/null`; then echo "$$head" | head -n 1 | cut -c19-26; fi)$(shell if hg status $(SRC_DIR) | grep -v '^?' | read dummy; then echo M; fi)$(shell hg branch | sed 's/^/-/;s/^-default$$//')
+REV := h$(shell if head=`LC_ALL=C hg tip 2>/dev/null`; then echo "$$head" | head -n 1 | cut -c19-26; fi)$(REV_MODIFIED)$(shell hg branch | sed 's/^/-/;s/^-default$$//')
 REV_NR := $(shell LC_ALL=C hg log -k "svn" -l 1 --template "{desc}\n" $(SRC_DIR) | grep -m 1 "^(svn r[0-9]*)" | sed "s/.*(svn r\([0-9]*\)).*/\1/" )
 endif
 endif
@@ -287,7 +312,7 @@
 # Revision files
 
 $(SRC_DIR)/rev.cpp: $(CONFIG_CACHE_VERSION) $(SRC_DIR)/rev.cpp.in
-	$(Q)cat $(SRC_DIR)/rev.cpp.in      | sed "s#@@REVISION@@#$(REV_NR)#g;s#@@VERSION@@#$(REV)#g;s#@@DATE@@#`date +%d.%m.%y`#g" > $(SRC_DIR)/rev.cpp
+	$(Q)cat $(SRC_DIR)/rev.cpp.in      | sed "s#@@REVISION@@#$(REV_NR)#g;s#@@VERSION@@#$(REV)#g;s#@@MODIFIED@@#$(MODIFIED)#g;s#@@DATE@@#`date +%d.%m.%y`#g" > $(SRC_DIR)/rev.cpp
 
 $(SRC_DIR)/ottdres.rc: $(CONFIG_CACHE_VERSION) $(SRC_DIR)/ottdres.rc.in
 	$(Q)cat $(SRC_DIR)/ottdres.rc.in | sed "s#@@REVISION@@#$(REV_NR)#g;s#@@VERSION@@#$(REV)#g;s#@@DATE@@#`date +%d.%m.%y`#g" > $(SRC_DIR)/ottdres.rc
Binary file bin/data/openttdd.grf has changed
Binary file bin/data/openttdw.grf has changed
--- a/config.lib	Tue May 27 00:50:55 2008 +0000
+++ b/config.lib	Tue Jun 17 10:32:49 2008 +0000
@@ -936,6 +936,10 @@
 		if [ $cc_version -ge 30 ]; then
 			CFLAGS="$CFLAGS -W -Wno-unused-parameter -Wformat=2"
 			CFLAGS="$CFLAGS -Wredundant-decls"
+			# Do not warn about unused variables when building without asserts
+			if [ $enable_assert -eq 0 ]; then
+				CFLAGS="$CFLAGS -Wno-unused-variable"
+			fi
 		fi
 
 		if [ $cc_version -ge 34 ]; then
--- a/projects/determineversion.vbs	Tue May 27 00:50:55 2008 +0000
+++ b/projects/determineversion.vbs	Tue Jun 17 10:32:49 2008 +0000
@@ -14,23 +14,28 @@
 	file.Close
 End Sub
 
-Sub UpdateFile(revision, version, cur_date, filename)
+Sub UpdateFile(modified, revision, version, cur_date, filename)
 	FSO.CopyFile filename & ".in", filename
+	FindReplaceInFile filename, "@@MODIFIED@@", modified
 	FindReplaceInFile filename, "@@REVISION@@", revision
 	FindReplaceInFile filename, "@@VERSION@@", version
 	FindReplaceInFile filename, "@@DATE@@", cur_date
 End Sub
 
 Sub UpdateFiles(version)
-	Dim WshShell, cur_date, revision, oExec
+	Dim WshShell, cur_date, modified, revision, oExec
 	Set WshShell = CreateObject("WScript.Shell")
 	cur_date = DatePart("D", Date) & "." & DatePart("M", Date) & "." & DatePart("YYYY", Date)
 	revision = 0
+	modified = 1
 	Select Case Mid(version, 1, 1)
 		Case "r" ' svn
 			revision = Mid(version, 2)
 			If InStr(revision, "M") Then
 				revision = Mid(revision, 1, InStr(revision, "M") - 1)
+				modified = 2
+			Else
+				modified = 0
 			End If
 			If InStr(revision, "-") Then
 				revision = Mid(revision, 1, InStr(revision, "-") - 1)
@@ -49,8 +54,8 @@
 			End If
 	End Select
 
-	UpdateFile revision, version, cur_date, "../src/rev.cpp"
-	UpdateFile revision, version, cur_date, "../src/ottdres.rc"
+	UpdateFile modified, revision, version, cur_date, "../src/rev.cpp"
+	UpdateFile modified, revision, version, cur_date, "../src/ottdres.rc"
 End Sub
 
 Function ReadRegistryKey(shive, subkey, valuename, architecture)
--- a/projects/openttd_vs80.vcproj	Tue May 27 00:50:55 2008 +0000
+++ b/projects/openttd_vs80.vcproj	Tue Jun 17 10:32:49 2008 +0000
@@ -576,6 +576,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\..\src\gamelog.cpp"
+				>
+			</File>
+			<File
 				RelativePath=".\..\src\genworld.cpp"
 				>
 			</File>
@@ -768,6 +772,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\..\src\vehiclelist.cpp"
+				>
+			</File>
+			<File
 				RelativePath=".\..\src\viewport.cpp"
 				>
 			</File>
@@ -1004,6 +1012,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\..\src\engine_gui.h"
+				>
+			</File>
+			<File
 				RelativePath=".\..\src\engine_type.h"
 				>
 			</File>
@@ -1040,6 +1052,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\..\src\gamelog.h"
+				>
+			</File>
+			<File
 				RelativePath=".\..\src\genworld.h"
 				>
 			</File>
@@ -1144,7 +1160,7 @@
 				>
 			</File>
 			<File
-				RelativePath=".\..\src\network\network_data.h"
+				RelativePath=".\..\src\network\network_func.h"
 				>
 			</File>
 			<File
@@ -1164,6 +1180,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\..\src\network\network_type.h"
+				>
+			</File>
+			<File
 				RelativePath=".\..\src\network\network_udp.h"
 				>
 			</File>
@@ -1608,6 +1628,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\..\src\vehiclelist.h"
+				>
+			</File>
+			<File
 				RelativePath=".\..\src\viewport_func.h"
 				>
 			</File>
--- a/projects/openttd_vs90.vcproj	Tue May 27 00:50:55 2008 +0000
+++ b/projects/openttd_vs90.vcproj	Tue Jun 17 10:32:49 2008 +0000
@@ -565,6 +565,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\..\src\gamelog.cpp"
+				>
+			</File>
+			<File
 				RelativePath=".\..\src\genworld.cpp"
 				>
 			</File>
@@ -757,6 +761,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\..\src\vehiclelist.cpp"
+				>
+			</File>
+			<File
 				RelativePath=".\..\src\viewport.cpp"
 				>
 			</File>
@@ -997,6 +1005,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\..\src\engine_gui.h"
+				>
+			</File>
+			<File
 				RelativePath=".\..\src\engine_type.h"
 				>
 			</File>
@@ -1025,6 +1037,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\..\src\gamelog.h"
+				>
+			</File>
+			<File
 				RelativePath=".\..\src\genworld.h"
 				>
 			</File>
@@ -1129,7 +1145,7 @@
 				>
 			</File>
 			<File
-				RelativePath=".\..\src\network\network_data.h"
+				RelativePath=".\..\src\network\network_func.h"
 				>
 			</File>
 			<File
@@ -1149,6 +1165,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\..\src\network\network_type.h"
+				>
+			</File>
+			<File
 				RelativePath=".\..\src\network\network_udp.h"
 				>
 			</File>
@@ -1589,6 +1609,10 @@
 				>
 			</File>
 			<File
+				RelativePath=".\..\src\vehiclelist.h"
+				>
+			</File>
+			<File
 				RelativePath=".\..\src\viewport_func.h"
 				>
 			</File>
--- a/readme.txt	Tue May 27 00:50:55 2008 +0000
+++ b/readme.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -203,6 +203,35 @@
   http://wiki.openttd.org/index.php/Console
 
 
+5.1) Logging of potentially dangerous actions:
+---- ----------------------------------------
+
+OpenTTD is a complex program, and together with NewGRF, it may show a buggy
+behaviour. But not only bugs in code can cause problems. There are several
+ways to affect game state possibly resulting in program crash or multiplayer
+desyncs.
+Easier way would be to forbid all these unsafe actions, but that would affect
+game usability for many players. We certainly do not want that.
+However, we receive bugreports because of this. To reduce time spent with
+solving these problems, these potentially unsafe actions are logged in
+the savegame (including crash.sav). Log is stored in crash logs, too.
+
+Information logged:
+
+* Adding / removing / changing order of NewGRFs
+* Changing NewGRF parameters, loading compatible NewGRF
+* Changing game mode (scenario editor <-> normal game)
+* Loading game saved in a different OTTD / TTDPatch / TTD version
+* Running a modified OTTD build
+* Changing patch settings affecting NewGRF behaviour (non-networksafe patches)
+* Changing landscape (by cheat)
+
+No personal information is stored.
+
+You can show the gamelog by typing 'gamelog' in the console or by running
+OpenTTD in debug mode.
+
+
 6.0) Configuration File:
 ---- -------------------
 The configuration file for OpenTTD (openttd.cfg) is in a simple Windows-like
--- a/source.list	Tue May 27 00:50:55 2008 +0000
+++ b/source.list	Tue Jun 17 10:32:49 2008 +0000
@@ -30,6 +30,7 @@
 fontcache.cpp
 fsmblockmap.cpp
 fsmport.cpp
+gamelog.cpp
 genworld.cpp
 gfx.cpp
 gfxinit.cpp
@@ -114,6 +115,7 @@
 	#end
 #end
 vehicle.cpp
+vehiclelist.cpp
 viewport.cpp
 waypoint.cpp
 widget.cpp
@@ -176,6 +178,7 @@
 core/endian_func.hpp
 engine_base.h
 engine_func.h
+engine_gui.h
 engine_type.h
 core/enum_type.hpp
 fiber.hpp
@@ -185,6 +188,7 @@
 fsmblockmap.h
 fsmport.h
 functions.h
+gamelog.h
 genworld.h
 core/geometry_type.hpp
 gfx_func.h
@@ -211,11 +215,12 @@
 namegen_func.h
 network/network.h
 network/network_client.h
-network/network_data.h
+network/network_func.h
 network/network_gamelist.h
 network/network_gui.h
 network/network_internal.h
 network/network_server.h
+network/network_type.h
 network/network_udp.h
 newgrf.h
 newgrf_callbacks.h
@@ -327,6 +332,7 @@
 vehicle_func.h
 vehicle_gui.h
 vehicle_type.h
+vehiclelist.h
 viewport_func.h
 viewport_type.h
 waypoint.h
--- a/src/ai/ai.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/ai/ai.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -154,7 +154,7 @@
 	Player *p = GetPlayer(player);
 	_current_player = player;
 
-	if (_settings.ai.ainew_active) {
+	if (_settings_game.ai.ainew_active) {
 		AiNewDoGameLoop(p);
 	} else {
 		/* Enable all kind of cheats the old AI needs in order to operate correctly... */
@@ -178,14 +178,14 @@
 	if (!_ai.enabled) return;
 
 	/* Don't do anything if we are a network-client, or the AI has been disabled */
-	if (_networking && (!_network_server || !_settings.ai.ai_in_multiplayer)) return;
+	if (_networking && (!_network_server || !_settings_game.ai.ai_in_multiplayer)) return;
 
 	/* New tick */
 	_ai.tick++;
 
 	/* Make sure the AI follows the difficulty rule.. */
-	assert(_settings.difficulty.competitor_speed <= 4);
-	if ((_ai.tick & ((1 << (4 - _settings.difficulty.competitor_speed)) - 1)) != 0) return;
+	assert(_settings_game.difficulty.competitor_speed <= 4);
+	if ((_ai.tick & ((1 << (4 - _settings_game.difficulty.competitor_speed)) - 1)) != 0) return;
 
 	/* Check for AI-client (so joining a network with an AI) */
 	if (!_networking || _network_server) {
--- a/src/ai/ai.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/ai/ai.h	Tue Jun 17 10:32:49 2008 +0000
@@ -67,14 +67,14 @@
 	/* If in network, and server, possible AI */
 	if (_networking && _network_server) {
 		/* Do we want AIs in multiplayer? */
-		if (!_settings.ai.ai_in_multiplayer)
+		if (!_settings_game.ai.ai_in_multiplayer)
 			return false;
 
 		/* Only the NewAI is allowed... sadly enough the old AI just doesn't support this
 		 *  system, because all commands are delayed by at least 1 tick, which causes
 		 *  a big problem, because it uses variables that are only set AFTER the command
 		 *  is really executed... */
-		if (!_settings.ai.ainew_active)
+		if (!_settings_game.ai.ainew_active)
 			return false;
 	}
 
--- a/src/ai/default/default.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/ai/default/default.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -1570,21 +1570,21 @@
 	for (;;) {
 		r = (uint16)Random();
 
-		if (_settings.ai.ai_disable_veh_train &&
-				_settings.ai.ai_disable_veh_roadveh &&
-				_settings.ai.ai_disable_veh_aircraft &&
-				_settings.ai.ai_disable_veh_ship) {
+		if (_settings_game.ai.ai_disable_veh_train &&
+				_settings_game.ai.ai_disable_veh_roadveh &&
+				_settings_game.ai.ai_disable_veh_aircraft &&
+				_settings_game.ai.ai_disable_veh_ship) {
 			return;
 		}
 
 		if (r < 0x7626) {
-			if (_settings.ai.ai_disable_veh_train) continue;
+			if (_settings_game.ai.ai_disable_veh_train) continue;
 			AiWantTrainRoute(p);
 		} else if (r < 0xC4EA) {
-			if (_settings.ai.ai_disable_veh_roadveh) continue;
+			if (_settings_game.ai.ai_disable_veh_roadveh) continue;
 			AiWantRoadRoute(p);
 		} else if (r < 0xD89B) {
-			if (_settings.ai.ai_disable_veh_aircraft) continue;
+			if (_settings_game.ai.ai_disable_veh_aircraft) continue;
 			AiWantAircraftRoute(p);
 		} else {
 			/* Ships are not implemented in this (broken) AI */
@@ -1603,7 +1603,7 @@
 
 static bool AiCheckTrackResources(TileIndex tile, const AiDefaultBlockData *p, byte cargo)
 {
-	uint rad = (_settings.station.modified_catchment) ? CA_TRAIN : CA_UNMODIFIED;
+	uint rad = (_settings_game.station.modified_catchment) ? CA_TRAIN : CA_UNMODIFIED;
 
 	for (; p->mode != 4; p++) {
 		AcceptedCargo values;
@@ -2550,7 +2550,7 @@
 		bool is_pass = (
 			_players_ai[p->index].cargo_type == CT_PASSENGERS ||
 			_players_ai[p->index].cargo_type == CT_MAIL ||
-			(_settings.game_creation.landscape == LT_TEMPERATE && _players_ai[p->index].cargo_type == CT_VALUABLES)
+			(_settings_game.game_creation.landscape == LT_TEMPERATE && _players_ai[p->index].cargo_type == CT_VALUABLES)
 		);
 		Order order;
 
@@ -2599,7 +2599,7 @@
 	uint values[NUM_CARGO];
 	int rad;
 
-	if (_settings.station.modified_catchment) {
+	if (_settings_game.station.modified_catchment) {
 		rad = CA_TRUCK; // Same as CA_BUS at the moment?
 	} else { // change that at some point?
 		rad = 4;
@@ -3285,7 +3285,7 @@
 		bool is_pass = (
 			_players_ai[p->index].cargo_type == CT_PASSENGERS ||
 			_players_ai[p->index].cargo_type == CT_MAIL ||
-			(_settings.game_creation.landscape == LT_TEMPERATE && _players_ai[p->index].cargo_type == CT_VALUABLES)
+			(_settings_game.game_creation.landscape == LT_TEMPERATE && _players_ai[p->index].cargo_type == CT_VALUABLES)
 		);
 		Order order;
 
@@ -3416,7 +3416,7 @@
 
 	uint w = p->size_x[0];
 	uint h = p->size_y[0];
-	uint rad = _settings.station.modified_catchment ? p->portFSM->catchment : (uint)CA_UNMODIFIED;
+	uint rad = _settings_game.station.modified_catchment ? p->portFSM->catchment : (uint)CA_UNMODIFIED;
 
 	if (cargo & 0x80) {
 		GetProductionAroundTiles(values, tile, w, h, rad);
@@ -3953,7 +3953,7 @@
 	//  to the patch-setting
 	// Also, it takes into account the setting if the service-interval is in days
 	//  or in %
-	_ai_service_interval = _settings.vehicle.servint_ispercent ? 80 : 180;
+	_ai_service_interval = _settings_game.vehicle.servint_ispercent ? 80 : 180;
 
 	if (IsHumanPlayer(_current_player)) return;
 
--- a/src/ai/trolly/trolly.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/ai/trolly/trolly.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -130,9 +130,9 @@
 			// Check all vehicles once in a while
 			_players_ainew[p->index].action = AI_ACTION_CHECK_ALL_VEHICLES;
 			_players_ainew[p->index].last_vehiclecheck_date = _date;
-		} else if (c < 100 && !_settings.ai.ai_disable_veh_roadveh) {
+		} else if (c < 100 && !_settings_game.ai.ai_disable_veh_roadveh) {
 			// Do we have any spots for road-vehicles left open?
-			if (GetFreeUnitNumber(VEH_ROAD) <= _settings.vehicle.max_roadveh) {
+			if (GetFreeUnitNumber(VEH_ROAD) <= _settings_game.vehicle.max_roadveh) {
 				if (c < 85) {
 					_players_ainew[p->index].action = AI_ACTION_TRUCK_ROUTE;
 				} else {
@@ -140,8 +140,8 @@
 				}
 			}
 #if 0
-		} else if (c < 200 && !_settings.ai.ai_disable_veh_train) {
-			if (GetFreeUnitNumber(VEH_TRAIN) <= _settings.vehicle.max_trains) {
+		} else if (c < 200 && !_settings_game.ai.ai_disable_veh_train) {
+			if (GetFreeUnitNumber(VEH_TRAIN) <= _settings_game.vehicle.max_trains) {
 				_players_ainew[p->index].action = AI_ACTION_TRAIN_ROUTE;
 			}
 #endif
@@ -155,7 +155,7 @@
 		return;
 	}
 
-	if (_settings.ai.ai_disable_veh_roadveh && (
+	if (_settings_game.ai.ai_disable_veh_roadveh && (
 				_players_ainew[p->index].action == AI_ACTION_BUS_ROUTE ||
 				_players_ainew[p->index].action == AI_ACTION_TRUCK_ROUTE
 			)) {
@@ -179,7 +179,7 @@
 	//  to build the route anyway..
 	if (_players_ainew[p->index].action == AI_ACTION_BUS_ROUTE &&
 			money > AI_MINIMUM_BUS_ROUTE_MONEY) {
-		if (GetFreeUnitNumber(VEH_ROAD) > _settings.vehicle.max_roadveh) {
+		if (GetFreeUnitNumber(VEH_ROAD) > _settings_game.vehicle.max_roadveh) {
 			_players_ainew[p->index].action = AI_ACTION_NONE;
 			return;
 		}
@@ -190,7 +190,7 @@
 	}
 	if (_players_ainew[p->index].action == AI_ACTION_TRUCK_ROUTE &&
 			money > AI_MINIMUM_TRUCK_ROUTE_MONEY) {
-		if (GetFreeUnitNumber(VEH_ROAD) > _settings.vehicle.max_roadveh) {
+		if (GetFreeUnitNumber(VEH_ROAD) > _settings_game.vehicle.max_roadveh) {
 			_players_ainew[p->index].action = AI_ACTION_NONE;
 			return;
 		}
@@ -1017,7 +1017,7 @@
 	if (_players_ainew[p->index].temp == -1) {
 		DEBUG(ai, 1, "Starting to build new path");
 		// Init the counter
-		_players_ainew[p->index].counter = (4 - _settings.difficulty.competitor_speed) * AI_BUILDPATH_PAUSE + 1;
+		_players_ainew[p->index].counter = (4 - _settings_game.difficulty.competitor_speed) * AI_BUILDPATH_PAUSE + 1;
 		// Set the position to the startingplace (-1 because in a minute we do ++)
 		_players_ainew[p->index].path_info.position = -1;
 		// And don't do this again
@@ -1026,7 +1026,7 @@
 	// Building goes very fast on normal rate, so we are going to slow it down..
 	//  By let the counter count from AI_BUILDPATH_PAUSE to 0, we have a nice way :)
 	if (--_players_ainew[p->index].counter != 0) return;
-	_players_ainew[p->index].counter = (4 - _settings.difficulty.competitor_speed) * AI_BUILDPATH_PAUSE + 1;
+	_players_ainew[p->index].counter = (4 - _settings_game.difficulty.competitor_speed) * AI_BUILDPATH_PAUSE + 1;
 
 	// Increase the building position
 	_players_ainew[p->index].path_info.position++;
@@ -1035,7 +1035,7 @@
 	if (_players_ainew[p->index].path_info.position == -2) {
 		// This means we are done building!
 
-		if (_players_ainew[p->index].tbt == AI_TRUCK && !_settings.pf.roadveh_queue) {
+		if (_players_ainew[p->index].tbt == AI_TRUCK && !_settings_game.pf.roadveh_queue) {
 			// If they not queue, they have to go up and down to try again at a station...
 			// We don't want that, so try building some road left or right of the station
 			DiagDirection dir1, dir2, dir3;
@@ -1186,7 +1186,7 @@
 	}
 
 	// Very handy for AI, goto depot.. but yeah, it needs to be activated ;)
-	if (_settings.order.gotodepot) {
+	if (_settings_game.order.gotodepot) {
 		idx = 0;
 		order.MakeGoToDepot(GetDepotByTile(_players_ainew[p->index].depot_tile)->index, ODTFB_PART_OF_ORDERS);
 		AI_DoCommand(0, _players_ainew[p->index].veh_id + (idx << 16), order.Pack(), DC_EXEC, CMD_INSERT_ORDER);
--- a/src/aircraft_cmd.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/aircraft_cmd.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -317,7 +317,7 @@
 	}
 
 	UnitID unit_num = HasBit(p2, 0) ? 0 : GetFreeUnitNumber(VEH_AIRCRAFT);
-	if (unit_num > _settings.vehicle.max_aircraft)
+	if (unit_num > _settings_game.vehicle.max_aircraft)
 		return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
 
 	if (flags & DC_EXEC) {
@@ -443,7 +443,7 @@
 		v->u.air.targetairport = GetStationIndex(tile);
 		v->SetNext(u);
 
-		v->service_interval = _settings.vehicle.servint_aircraft;
+		v->service_interval = _settings_game.vehicle.servint_aircraft;
 
 		v->date_of_last_service = _date;
 		v->build_year = u->build_year = _cur_year;
@@ -705,7 +705,7 @@
 
 static void CheckIfAircraftNeedsService(Vehicle *v)
 {
-	if (_settings.vehicle.servint_aircraft == 0 || !v->NeedsAutomaticServicing()) return;
+	if (_settings_game.vehicle.servint_aircraft == 0 || !v->NeedsAutomaticServicing()) return;
 	if (v->IsInDepot()) {
 		VehicleServiceInDepot(v);
 		return;
@@ -943,7 +943,7 @@
 
 	/* Adjust speed limits by plane speed factor to prevent taxiing
 	 * and take-off speeds being too low. */
-	speed_limit *= _settings.vehicle.plane_speed;
+	speed_limit *= _settings_game.vehicle.plane_speed;
 
 	if (v->u.air.cached_max_speed < speed_limit) {
 		if (v->cur_speed < speed_limit) hard_limit = false;
@@ -961,7 +961,7 @@
 	 * speeds to that aircraft do not get to taxi speed straight after
 	 * touchdown. */
 	if (!hard_limit && v->cur_speed > speed_limit) {
-		speed_limit = v->cur_speed - max(1, ((v->cur_speed * v->cur_speed) / 16384) / _settings.vehicle.plane_speed);
+		speed_limit = v->cur_speed - max(1, ((v->cur_speed * v->cur_speed) / 16384) / _settings_game.vehicle.plane_speed);
 	}
 
 	spd = min(v->cur_speed + (spd >> 8) + (v->subspeed < t), speed_limit);
@@ -972,12 +972,12 @@
 	/* updates statusbar only if speed have changed to save CPU time */
 	if (spd != v->cur_speed) {
 		v->cur_speed = spd;
-		if (_settings.gui.vehicle_speed)
+		if (_settings_client.gui.vehicle_speed)
 			InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 	}
 
 	/* Adjust distance moved by plane speed setting */
-	if (_settings.vehicle.plane_speed > 1) spd /= _settings.vehicle.plane_speed;
+	if (_settings_game.vehicle.plane_speed > 1) spd /= _settings_game.vehicle.plane_speed;
 
 	if (!(v->direction & 1)) spd = spd * 3 / 4;
 
@@ -1739,7 +1739,7 @@
 		AircraftEventHandler_EnterTerminal(v, apc);
 		/* on an airport with helipads, a helicopter will always land there
 		 * and get serviced at the same time - patch setting */
-		if (_settings.order.serviceathelipad) {
+		if (_settings_game.order.serviceathelipad) {
 			if (v->subtype == AIR_HELICOPTER && apc->helipads != NULL) {
 				/* an exerpt of ServiceAircraft, without the invisibility stuff */
 				v->date_of_last_service = _date;
--- a/src/airport_gui.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/airport_gui.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -90,12 +90,12 @@
 	BuildAirToolbarWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number)
 	{
 		this->FindWindowPlacementAndResize(desc);
-		if (_settings.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
+		if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
 	}
 
 	~BuildAirToolbarWindow()
 	{
-		if (_settings.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0);
+		if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0);
 	}
 
 	virtual void OnPaint()
@@ -201,7 +201,7 @@
 		_airport.direction = DIR_NE;
 		_airport.station_count = GetNumCustomFSMports(_airport.fsmports_class);
 
-		if (_settings.economy.station_noise_level) {
+		if (_settings_game.economy.station_noise_level) {
 			ResizeWindowForWidget(this, BAPW_BACKGROUND, 0, 10);
 		}
 
@@ -261,10 +261,18 @@
 		}
 
 		SetDParam(0, GetFSMportsClassName(_airport.fsmports_class));
-		this->DrawWidgets();
 
 		/* strings such as 'Size' and 'Coverage Area' */
 
+		this->DrawWidgets();
+
+		/* only show the station (airport) noise, if the noise option is activated */
+		if (_settings_game.economy.station_noise_level) {
+			/* show the noise of the selected airport */
+			SetDParam(0, fsmportspec->portFSM->noise_level);
+			DrawString(2, 206, STR_STATION_NOISE, 0);
+			y_noise_offset = 10;
+		}
 		if (_airport.station_type != 0xFF) {
 			/* draw the preview image if the station is available */
 			if (!HasBit(fsmportspec->callbackmask, CBM_STATION_AVAIL) || GetFSMportsCallback(CBID_STATION_AVAILABILITY, 0, 0, fsmportspec, NULL, INVALID_TILE) != 0) {
@@ -273,10 +281,11 @@
 			_thd.FSMportLayout = &fsmportspec->layouts[_airport.layout_set];  // irregular airport support
 			_thd.FSMportMask = NULL;
 			if (fsmportspec->layout_mask != NULL) _thd.FSMportMask = &fsmportspec->layout_mask[_airport.layout_set];  // irregular airport support
-			int rad = _settings.station.modified_catchment ? fsmportspec->portFSM->catchment : 4;
+			int rad = _settings_game.station.modified_catchment ? fsmportspec->portFSM->catchment : 4;
 			if (_station_show_coverage) SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
-			int text_end = DrawStationCoverageAreaText(2, 206, SCT_ALL, rad, false);
-			text_end = DrawStationCoverageAreaText(2, text_end + 4, SCT_ALL, rad, true) + 4;
+			//int text_end = DrawStationCoverageAreaText(2, 206, SCT_ALL, rad, false);
+			//text_end = DrawStationCoverageAreaText(2, text_end + 4, SCT_ALL, rad, true) + 4;
+			int text_end = DrawStationCoverageAreaText(2, this->widget[BAPW_HIGHLIGHT_ON].bottom + 4 + y_noise_offset, SCT_ALL, rad, false);
 			if (text_end > this->widget[BAPW_BACKGROUND].bottom) {
 				this->SetDirty();
 				ResizeWindowForWidget(this, BAPW_BACKGROUND, 0, text_end - this->widget[BAPW_BACKGROUND].bottom);
--- a/src/animated_tile.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/animated_tile.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -1,135 +1,135 @@
-/* $Id: animated_tile.cpp 12800 2008-04-20 08:22:59Z rubidium $ */
-
-/** @file animated_tile.cpp Everything related to animated tiles. */
-
-#include "stdafx.h"
-#include "openttd.h"
-#include "saveload.h"
-#include "landscape.h"
-#include "core/alloc_func.hpp"
-#include "functions.h"
-
-/** The table/list with animated tiles. */
-TileIndex *_animated_tile_list = NULL;
-/** The number of animated tiles in the current state. */
-uint _animated_tile_count = 0;
-/** The number of slots for animated tiles allocated currently. */
-static uint _animated_tile_allocated = 0;
-
-/**
- * Removes the given tile from the animated tile table.
- * @param tile the tile to remove
- */
-void DeleteAnimatedTile(TileIndex tile)
-{
-	for (TileIndex *ti = _animated_tile_list; ti < _animated_tile_list + _animated_tile_count; ti++) {
-		if (tile == *ti) {
-			/* Remove the hole
-			 * The order of the remaining elements must stay the same, otherwise the animation loop
-			 * may miss a tile; that's why we must use memmove instead of just moving the last element.
-			 */
-			memmove(ti, ti + 1, (_animated_tile_list + _animated_tile_count - (ti + 1)) * sizeof(*ti));
-			_animated_tile_count--;
-			MarkTileDirtyByTile(tile);
-			return;
-		}
-	}
-}
-
-/**
- * Add the given tile to the animated tile table (if it does not exist
- * on that table yet). Also increases the size of the table if necessary.
- * @param tile the tile to make animated
- */
-void AddAnimatedTile(TileIndex tile)
-{
-	MarkTileDirtyByTile(tile);
-
-	for (const TileIndex *ti = _animated_tile_list; ti < _animated_tile_list + _animated_tile_count; ti++) {
-		if (tile == *ti) return;
-	}
-
-	/* Table not large enough, so make it larger */
-	if (_animated_tile_count == _animated_tile_allocated) {
-		_animated_tile_allocated *= 2;
-		_animated_tile_list = ReallocT<TileIndex>(_animated_tile_list, _animated_tile_allocated);
-	}
-
-	_animated_tile_list[_animated_tile_count] = tile;
-	_animated_tile_count++;
-}
-
-/**
- * Animate all tiles in the animated tile list, i.e.\ call AnimateTile on them.
- */
-void AnimateAnimatedTiles()
-{
-	const TileIndex *ti = _animated_tile_list;
-	while (ti < _animated_tile_list + _animated_tile_count) {
-		const TileIndex curr = *ti;
-		AnimateTile(curr);
-		/* During the AnimateTile call, DeleteAnimatedTile could have been called,
-		 * deleting an element we've already processed and pushing the rest one
-		 * slot to the left. We can detect this by checking whether the index
-		 * in the current slot has changed - if it has, an element has been deleted,
-		 * and we should process the current slot again instead of going forward.
-		 * NOTE: this will still break if more than one animated tile is being
-		 *       deleted during the same AnimateTile call, but no code seems to
-		 *       be doing this anyway.
-		 */
-		if (*ti == curr) ++ti;
-	}
-}
-
-/**
- * Initialize all animated tile variables to some known begin point
- */
-void InitializeAnimatedTiles()
-{
-	_animated_tile_list = ReallocT<TileIndex>(_animated_tile_list, 256);
-	_animated_tile_count = 0;
-	_animated_tile_allocated = 256;
-}
-
-/**
- * Save the ANIT chunk.
- */
-static void Save_ANIT()
-{
-	SlSetLength(_animated_tile_count * sizeof(*_animated_tile_list));
-	SlArray(_animated_tile_list, _animated_tile_count, SLE_UINT32);
-}
-
-/**
- * Load the ANIT chunk; the chunk containing the animated tiles.
- */
-static void Load_ANIT()
-{
-	/* Before version 80 we did NOT have a variable length animated tile table */
-	if (CheckSavegameVersion(80)) {
-		/* In pre version 6, we has 16bit per tile, now we have 32bit per tile, convert it ;) */
-		SlArray(_animated_tile_list, 256, CheckSavegameVersion(6) ? (SLE_FILE_U16 | SLE_VAR_U32) : SLE_UINT32);
-
-		for (_animated_tile_count = 0; _animated_tile_count < 256; _animated_tile_count++) {
-			if (_animated_tile_list[_animated_tile_count] == 0) break;
-		}
-		return;
-	}
-
-	_animated_tile_count = SlGetFieldLength() / sizeof(*_animated_tile_list);
-
-	/* Determine a nice rounded size for the amount of allocated tiles */
-	_animated_tile_allocated = 256;
-	while (_animated_tile_allocated < _animated_tile_count) _animated_tile_allocated *= 2;
-
-	_animated_tile_list = ReallocT<TileIndex>(_animated_tile_list, _animated_tile_allocated);
-	SlArray(_animated_tile_list, _animated_tile_count, SLE_UINT32);
-}
-
-/**
- * "Definition" imported by the saveload code to be able to load and save
- * the animated tile table.
- */
-extern const ChunkHandler _animated_tile_chunk_handlers[] = {
-	{ 'ANIT', Save_ANIT, Load_ANIT, CH_RIFF | CH_LAST},
-};
+/* $Id: animated_tile.cpp 12800 2008-04-20 08:22:59Z rubidium $ */
+
+/** @file animated_tile.cpp Everything related to animated tiles. */
+
+#include "stdafx.h"
+#include "openttd.h"
+#include "saveload.h"
+#include "landscape.h"
+#include "core/alloc_func.hpp"
+#include "functions.h"
+
+/** The table/list with animated tiles. */
+TileIndex *_animated_tile_list = NULL;
+/** The number of animated tiles in the current state. */
+uint _animated_tile_count = 0;
+/** The number of slots for animated tiles allocated currently. */
+static uint _animated_tile_allocated = 0;
+
+/**
+ * Removes the given tile from the animated tile table.
+ * @param tile the tile to remove
+ */
+void DeleteAnimatedTile(TileIndex tile)
+{
+	for (TileIndex *ti = _animated_tile_list; ti < _animated_tile_list + _animated_tile_count; ti++) {
+		if (tile == *ti) {
+			/* Remove the hole
+			 * The order of the remaining elements must stay the same, otherwise the animation loop
+			 * may miss a tile; that's why we must use memmove instead of just moving the last element.
+			 */
+			memmove(ti, ti + 1, (_animated_tile_list + _animated_tile_count - (ti + 1)) * sizeof(*ti));
+			_animated_tile_count--;
+			MarkTileDirtyByTile(tile);
+			return;
+		}
+	}
+}
+
+/**
+ * Add the given tile to the animated tile table (if it does not exist
+ * on that table yet). Also increases the size of the table if necessary.
+ * @param tile the tile to make animated
+ */
+void AddAnimatedTile(TileIndex tile)
+{
+	MarkTileDirtyByTile(tile);
+
+	for (const TileIndex *ti = _animated_tile_list; ti < _animated_tile_list + _animated_tile_count; ti++) {
+		if (tile == *ti) return;
+	}
+
+	/* Table not large enough, so make it larger */
+	if (_animated_tile_count == _animated_tile_allocated) {
+		_animated_tile_allocated *= 2;
+		_animated_tile_list = ReallocT<TileIndex>(_animated_tile_list, _animated_tile_allocated);
+	}
+
+	_animated_tile_list[_animated_tile_count] = tile;
+	_animated_tile_count++;
+}
+
+/**
+ * Animate all tiles in the animated tile list, i.e.\ call AnimateTile on them.
+ */
+void AnimateAnimatedTiles()
+{
+	const TileIndex *ti = _animated_tile_list;
+	while (ti < _animated_tile_list + _animated_tile_count) {
+		const TileIndex curr = *ti;
+		AnimateTile(curr);
+		/* During the AnimateTile call, DeleteAnimatedTile could have been called,
+		 * deleting an element we've already processed and pushing the rest one
+		 * slot to the left. We can detect this by checking whether the index
+		 * in the current slot has changed - if it has, an element has been deleted,
+		 * and we should process the current slot again instead of going forward.
+		 * NOTE: this will still break if more than one animated tile is being
+		 *       deleted during the same AnimateTile call, but no code seems to
+		 *       be doing this anyway.
+		 */
+		if (*ti == curr) ++ti;
+	}
+}
+
+/**
+ * Initialize all animated tile variables to some known begin point
+ */
+void InitializeAnimatedTiles()
+{
+	_animated_tile_list = ReallocT<TileIndex>(_animated_tile_list, 256);
+	_animated_tile_count = 0;
+	_animated_tile_allocated = 256;
+}
+
+/**
+ * Save the ANIT chunk.
+ */
+static void Save_ANIT()
+{
+	SlSetLength(_animated_tile_count * sizeof(*_animated_tile_list));
+	SlArray(_animated_tile_list, _animated_tile_count, SLE_UINT32);
+}
+
+/**
+ * Load the ANIT chunk; the chunk containing the animated tiles.
+ */
+static void Load_ANIT()
+{
+	/* Before version 80 we did NOT have a variable length animated tile table */
+	if (CheckSavegameVersion(80)) {
+		/* In pre version 6, we has 16bit per tile, now we have 32bit per tile, convert it ;) */
+		SlArray(_animated_tile_list, 256, CheckSavegameVersion(6) ? (SLE_FILE_U16 | SLE_VAR_U32) : SLE_UINT32);
+
+		for (_animated_tile_count = 0; _animated_tile_count < 256; _animated_tile_count++) {
+			if (_animated_tile_list[_animated_tile_count] == 0) break;
+		}
+		return;
+	}
+
+	_animated_tile_count = (uint)SlGetFieldLength() / sizeof(*_animated_tile_list);
+
+	/* Determine a nice rounded size for the amount of allocated tiles */
+	_animated_tile_allocated = 256;
+	while (_animated_tile_allocated < _animated_tile_count) _animated_tile_allocated *= 2;
+
+	_animated_tile_list = ReallocT<TileIndex>(_animated_tile_list, _animated_tile_allocated);
+	SlArray(_animated_tile_list, _animated_tile_count, SLE_UINT32);
+}
+
+/**
+ * "Definition" imported by the saveload code to be able to load and save
+ * the animated tile table.
+ */
+extern const ChunkHandler _animated_tile_chunk_handlers[] = {
+	{ 'ANIT', Save_ANIT, Load_ANIT, CH_RIFF | CH_LAST},
+};
--- a/src/articulated_vehicles.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/articulated_vehicles.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -40,11 +40,11 @@
 
 	if (type == VEH_TRAIN) {
 		const RailVehicleInfo *rvi = RailVehInfo(engine);
-		capacity[rvi->cargo_type] = rvi->capacity;
+		capacity[rvi->cargo_type] = GetEngineProperty(engine, 0x14, rvi->capacity);
 		if (rvi->railveh_type == RAILVEH_MULTIHEAD) capacity[rvi->cargo_type] += rvi->capacity;
 	} else if (type == VEH_ROAD) {
 		const RoadVehicleInfo *rvi = RoadVehInfo(engine);
-		capacity[rvi->cargo_type] = rvi->capacity;
+		capacity[rvi->cargo_type] = GetEngineProperty(engine, 0x0F, rvi->capacity);
 	}
 
 	if (!HasBit(EngInfo(engine)->callbackmask, CBM_VEHICLE_ARTIC_ENGINE)) return capacity;
--- a/src/autoreplace_gui.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/autoreplace_gui.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -22,11 +22,12 @@
 #include "engine_func.h"
 #include "engine_base.h"
 #include "window_gui.h"
+#include "engine_gui.h"
 
 #include "table/sprites.h"
 #include "table/strings.h"
 
-void DrawEngineList(VehicleType type, int x, int y, const EngineList eng_list, uint16 min, uint16 max, EngineID selected_id, int count_location, GroupID selected_group);
+void DrawEngineList(VehicleType type, int x, int y, const GUIEngineList *eng_list, uint16 min, uint16 max, EngineID selected_id, int count_location, GroupID selected_group);
 
 static const StringID _rail_types_list[] = {
 	STR_RAIL_VEHICLES,
@@ -142,7 +143,7 @@
 	EngineID sel_engine[2];
 	uint16 count[2];
 	bool wagon_btnstate; ///< true means engine is selected
-	EngineList list[2];
+	GUIEngineList list[2];
 	bool update_left;
 	bool update_right;
 	bool init_lists;
@@ -184,8 +185,8 @@
 		VehicleType type = (VehicleType)this->window_number;
 		byte i = draw_left ? 0 : 1;
 
-		EngineList *list = &this->list[i];
-		list->clear();
+		GUIEngineList *list = &this->list[i];
+		list->Clear();
 
 		const Engine *e;
 		FOR_ALL_ENGINES_OF_TYPE(e, type) {
@@ -208,7 +209,7 @@
 				if (eid == this->sel_engine[0]) continue; // we can't replace an engine into itself (that would be autorenew)
 			}
 
-			list->push_back(eid);
+			*list->Append() = eid;
 			if (eid == this->sel_engine[i]) selected_engine = eid; // The selected engine is still in the list
 		}
 		this->sel_engine[i] = selected_engine; // update which engine we selected (the same or none, if it's not in the list anymore)
@@ -223,8 +224,8 @@
 		if (this->update_left == true) {
 			/* We need to rebuild the left list */
 			GenerateReplaceVehList(this, true);
-			SetVScrollCount(this, this->list[0].size());
-			if (this->init_lists && this->sel_engine[0] == INVALID_ENGINE && this->list[0].size() != 0) {
+			SetVScrollCount(this, this->list[0].Length());
+			if (this->init_lists && this->sel_engine[0] == INVALID_ENGINE && this->list[0].Length() != 0) {
 				this->sel_engine[0] = this->list[0][0];
 			}
 		}
@@ -233,12 +234,12 @@
 			/* Either we got a request to rebuild the right list or the left list selected a different engine */
 			if (this->sel_engine[0] == INVALID_ENGINE) {
 				/* Always empty the right list when nothing is selected in the left list */
-				this->list[1].clear();
+				this->list[1].Clear();
 				this->sel_engine[1] = INVALID_ENGINE;
 			} else {
 				GenerateReplaceVehList(this, false);
-				SetVScroll2Count(this, this->list[1].size());
-				if (this->init_lists && this->sel_engine[1] == INVALID_ENGINE && this->list[1].size() != 0) {
+				SetVScroll2Count(this, this->list[1].Length());
+				if (this->init_lists && this->sel_engine[1] == INVALID_ENGINE && this->list[1].Length() != 0) {
 					this->sel_engine[1] = this->list[1][0];
 				}
 			}
@@ -253,8 +254,6 @@
 	ReplaceVehicleWindow(const WindowDesc *desc, VehicleType vehicletype, GroupID id_g) : Window(desc, vehicletype)
 	{
 		this->wagon_btnstate = true; // start with locomotives (all other vehicles will not read this bool)
-		new (&this->list[0]) EngineList();
-		new (&this->list[1]) EngineList();
 		this->update_left   = true;
 		this->update_right  = true;
 		this->init_lists    = true;
@@ -380,9 +379,9 @@
 		/* Draw the lists */
 		for (byte i = 0; i < 2; i++) {
 			uint widget     = (i == 0) ? RVW_WIDGET_LEFT_MATRIX : RVW_WIDGET_RIGHT_MATRIX;
-			EngineList list = this->list[i]; // which list to draw
+			GUIEngineList *list = &this->list[i]; // which list to draw
 			EngineID start  = i == 0 ? this->vscroll.pos : this->vscroll2.pos; // what is the offset for the start (scrolling)
-			EngineID end    = min((i == 0 ? this->vscroll.cap : this->vscroll2.cap) + start, list.size());
+			EngineID end    = min((i == 0 ? this->vscroll.cap : this->vscroll2.cap) + start, list->Length());
 
 			/* Do the actual drawing */
 			DrawEngineList((VehicleType)this->window_number, this->widget[widget].left + 2, this->widget[widget].top + 1, list, start, end, this->sel_engine[i], i == 0 ? this->widget[RVW_WIDGET_LEFT_MATRIX].right - 2 : 0, selected_group);
@@ -436,7 +435,7 @@
 				uint16 click_scroll_pos = widget == RVW_WIDGET_LEFT_MATRIX ? this->vscroll.pos : this->vscroll2.pos;
 				uint16 click_scroll_cap = widget == RVW_WIDGET_LEFT_MATRIX ? this->vscroll.cap : this->vscroll2.cap;
 				byte click_side         = widget == RVW_WIDGET_LEFT_MATRIX ? 0 : 1;
-				size_t engine_count     = this->list[click_side].size();
+				size_t engine_count     = this->list[click_side].Length();
 
 				if (i < click_scroll_cap) {
 					i += click_scroll_pos;
--- a/src/autoslope.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/autoslope.h	Tue Jun 17 10:32:49 2008 +0000
@@ -38,7 +38,7 @@
  */
 static inline bool AutoslopeEnabled()
 {
-	return (_settings.construction.autoslope &&
+	return (_settings_game.construction.autoslope &&
 	        ((IsValidPlayer(_current_player) && !_is_old_ai_player) ||
 	         (_current_player == OWNER_NONE && _game_mode == GM_EDITOR)));
 }
--- a/src/blitter/8bpp_optimized.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/blitter/8bpp_optimized.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -6,38 +6,34 @@
 #include "../zoom_func.h"
 #include "../debug.h"
 #include "../core/alloc_func.hpp"
+#include "../core/math_func.hpp"
 #include "8bpp_optimized.hpp"
 
 static FBlitter_8bppOptimized iFBlitter_8bppOptimized;
 
 void Blitter_8bppOptimized::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
 {
-	const uint8 *src, *src_next;
-	uint8 *dst, *dst_line;
-	uint offset = 0;
-
 	/* Find the offset of this zoom-level */
-	offset = ((const uint8 *)bp->sprite)[(int)(zoom - ZOOM_LVL_BEGIN) * 2] | ((const byte *)bp->sprite)[(int)(zoom - ZOOM_LVL_BEGIN) * 2 + 1] << 8;
+	uint offset = ((const uint8 *)bp->sprite)[(int)(zoom - ZOOM_LVL_BEGIN) * 2] | ((const byte *)bp->sprite)[(int)(zoom - ZOOM_LVL_BEGIN) * 2 + 1] << 8;
 
 	/* Find where to start reading in the source sprite */
-	src = (const uint8 *)bp->sprite + offset;
-	dst_line = (uint8 *)bp->dst + bp->top * bp->pitch + bp->left;
+	const uint8 *src = (const uint8 *)bp->sprite + offset;
+	uint8 *dst_line = (uint8 *)bp->dst + bp->top * bp->pitch + bp->left;
 
 	/* Skip over the top lines in the source image */
 	for (int y = 0; y < bp->skip_top; y++) {
-		uint trans, pixels;
 		for (;;) {
-			trans = *src++;
-			pixels = *src++;
+			uint trans = *src++;
+			uint pixels = *src++;
 			if (trans == 0 && pixels == 0) break;
 			src += pixels;
 		}
 	}
 
-	src_next = src;
+	const uint8 *src_next = src;
 
 	for (int y = 0; y < bp->height; y++) {
-		dst = dst_line;
+		uint8 *dst = dst_line;
 		dst_line += bp->pitch;
 
 		uint skip_left = bp->skip_left;
@@ -45,8 +41,8 @@
 
 		for (;;) {
 			src = src_next;
-			uint8 trans = *src++;
-			uint8 pixels = *src++;
+			uint trans = *src++;
+			uint pixels = *src++;
 			src_next = src + pixels;
 			if (trans == 0 && pixels == 0) break;
 			if (width <= 0) continue;
@@ -75,7 +71,7 @@
 			dst += trans;
 			width -= trans;
 			if (width <= 0) continue;
-			if (pixels > width) pixels = width;
+			pixels = min<uint>(pixels, (uint)width);
 			width -= pixels;
 
 			switch (mode) {
@@ -104,99 +100,98 @@
 
 Sprite *Blitter_8bppOptimized::Encode(SpriteLoader::Sprite *sprite, Blitter::AllocatorProc *allocator)
 {
-	Sprite *dest_sprite;
-	byte *temp_dst;
-	uint memory = 0;
-	uint index = 0;
+	/* Make memory for all zoom-levels */
+	uint memory = (int)(ZOOM_LVL_END - ZOOM_LVL_BEGIN) * sizeof(uint16);
 
-	/* Make memory for all zoom-levels */
-	memory += (int)(ZOOM_LVL_END - ZOOM_LVL_BEGIN) * sizeof(uint16);
 	for (ZoomLevel i = ZOOM_LVL_BEGIN; i < ZOOM_LVL_END; i++) {
 		memory += UnScaleByZoom(sprite->height, i) * UnScaleByZoom(sprite->width, i);
-		index += 2;
 	}
 
 	/* We have no idea how much memory we really need, so just guess something */
 	memory *= 5;
-	temp_dst = MallocT<byte>(memory);
+	byte *temp_dst = MallocT<byte>(memory);
+	byte *dst = &temp_dst[(ZOOM_LVL_END - ZOOM_LVL_BEGIN) * 2];
 
 	/* Make the sprites per zoom-level */
 	for (ZoomLevel i = ZOOM_LVL_BEGIN; i < ZOOM_LVL_END; i++) {
-		/* Store the scaled image */
-		const SpriteLoader::CommonPixel *src;
-
 		/* Store the index table */
+		uint index = dst - temp_dst;
 		temp_dst[i * 2] = index & 0xFF;
 		temp_dst[i * 2 + 1] = (index >> 8) & 0xFF;
 
-		byte *dst = &temp_dst[index];
+		/* cache values, because compiler can't cache it */
+		int scaled_height = UnScaleByZoom(sprite->height, i);
+		int scaled_width  = UnScaleByZoom(sprite->width,  i);
+		int scaled_1      =   ScaleByZoom(1,              i);
 
-		for (int y = 0; y < UnScaleByZoom(sprite->height, i); y++) {
+		for (int y = 0; y < scaled_height; y++) {
 			uint trans = 0;
 			uint pixels = 0;
-			uint last_color = 0;
-			uint count_index = 0;
-			uint rx = 0;
-			src = &sprite->data[ScaleByZoom(y, i) * sprite->width];
+			uint last_colour = 0;
+			byte *count_dst = NULL;
 
-			for (int x = 0; x < UnScaleByZoom(sprite->width, i); x++) {
-				uint color = 0;
+			/* Store the scaled image */
+			const SpriteLoader::CommonPixel *src = &sprite->data[ScaleByZoom(y, i) * sprite->width];
+			const SpriteLoader::CommonPixel *src_end = &src[sprite->width];
+
+			for (int x = 0; x < scaled_width; x++) {
+				uint colour = 0;
 
 				/* Get the color keeping in mind the zoom-level */
-				for (int j = 0; j < ScaleByZoom(1, i); j++) {
-					if (src->m != 0) color = src->m;
-					src++;
-					rx++;
+				for (int j = 0; j < scaled_1; j++) {
+					if (src->m != 0) colour = src->m;
 					/* Because of the scaling it might happen we read outside the buffer. Avoid that. */
-					if (rx == sprite->width) break;
+					if (++src == src_end) break;
 				}
 
-				if (last_color == 0 || color == 0 || pixels == 255) {
-					if (count_index != 0) {
+				if (last_colour == 0 || colour == 0 || pixels == 255) {
+					if (count_dst != NULL) {
 						/* Write how many non-transparent bytes we get */
-						temp_dst[count_index] = pixels;
+						*count_dst = pixels;
 						pixels = 0;
-						count_index = 0;
+						count_dst = NULL;
 					}
 					/* As long as we find transparency bytes, keep counting */
-					if (color == 0) {
-						last_color = 0;
+					if (colour == 0) {
+						last_colour = 0;
 						trans++;
 						continue;
 					}
 					/* No longer transparency, so write the amount of transparent bytes */
 					*dst = trans;
-					dst++; index++;
+					dst++;
 					trans = 0;
 					/* Reserve a byte for the pixel counter */
-					count_index = index;
-					dst++; index++;
+					count_dst = dst;
+					dst++;
 				}
-				last_color = color;
+				last_colour = colour;
 				pixels++;
-				*dst = color;
-				dst++; index++;
+				*dst = colour;
+				dst++;
 			}
 
-			if (count_index != 0) temp_dst[count_index] = pixels;
+			if (count_dst != NULL) *count_dst = pixels;
 
 			/* Write line-ending */
-			*dst = 0; dst++; index++;
-			*dst = 0; dst++; index++;
+			*dst = 0; dst++;
+			*dst = 0; dst++;
 		}
 	}
 
+	uint size = dst - temp_dst;
+
 	/* Safety check, to make sure we guessed the size correctly */
-	assert(index < memory);
+	assert(size < memory);
 
 	/* Allocate the exact amount of memory we need */
-	dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + index);
+	Sprite *dest_sprite = (Sprite *)allocator(sizeof(*dest_sprite) + size);
 
 	dest_sprite->height = sprite->height;
 	dest_sprite->width  = sprite->width;
 	dest_sprite->x_offs = sprite->x_offs;
 	dest_sprite->y_offs = sprite->y_offs;
-	memcpy(dest_sprite->data, temp_dst, index);
+	memcpy(dest_sprite->data, temp_dst, size);
 	free(temp_dst);
 
 	return dest_sprite;
--- a/src/blitter/factory.hpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/blitter/factory.hpp	Tue Jun 17 10:32:49 2008 +0000
@@ -43,11 +43,8 @@
 		if (name == NULL) return;
 
 		this->name = strdup(name);
-#if !defined(NDEBUG) || defined(WITH_ASSERT)
-		/* NDEBUG disables asserts and gives a warning: unused variable 'P' */
-		std::pair<Blitters::iterator, bool> P =
-#endif /* !NDEBUG */
-		GetBlitters().insert(Blitters::value_type(name, this));
+
+		std::pair<Blitters::iterator, bool> P = GetBlitters().insert(Blitters::value_type(name, this));
 		assert(P.second);
 	}
 
--- a/src/build_vehicle_gui.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/build_vehicle_gui.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -29,6 +29,7 @@
 #include "widgets/dropdown_func.h"
 #include "string_func.h"
 #include "window_gui.h"
+#include "engine_gui.h"
 
 #include "table/sprites.h"
 #include "table/strings.h"
@@ -506,7 +507,7 @@
 	y += 10;
 
 	/* Wagon speed limit, displayed if above zero */
-	if (_settings.vehicle.wagon_speed_limits) {
+	if (_settings_game.vehicle.wagon_speed_limits) {
 		uint max_speed = GetEngineProperty(engine_number, 0x09, rvi->max_speed);
 		if (max_speed > 0) {
 			SetDParam(0, max_speed * 10 / 16);
@@ -544,7 +545,7 @@
 	y += 10;
 
 	/* Max tractive effort - not applicable if old acceleration or maglev */
-	if (_settings.vehicle.realistic_acceleration && rvi->railtype != RAILTYPE_MAGLEV) {
+	if (_settings_game.vehicle.realistic_acceleration && rvi->railtype != RAILTYPE_MAGLEV) {
 		SetDParam(0, ((weight << multihead) * 10 * GetEngineProperty(engine_number, 0x1F, rvi->tractive_effort)) / 256);
 		DrawString(x, y, STR_PURCHASE_INFO_MAX_TE, TC_FROMSTRING);
 		y += 10;
@@ -744,13 +745,13 @@
  * @param selected_id what engine to highlight as selected, if any
  * @param count_location Offset to print the engine count (used by autoreplace). 0 means it's off
  */
-void DrawEngineList(VehicleType type, int x, int y, const EngineList eng_list, uint16 min, uint16 max, EngineID selected_id, int count_location, GroupID selected_group)
+void DrawEngineList(VehicleType type, int x, int y, const GUIEngineList *eng_list, uint16 min, uint16 max, EngineID selected_id, int count_location, GroupID selected_group)
 {
 	byte step_size = GetVehicleListHeight(type);
 	byte x_offset = 0;
 	byte y_offset = 0;
 
-	assert(max <= eng_list.size());
+	assert(max <= eng_list->Length());
 
 	switch (type) {
 		case VEH_TRAIN:
@@ -778,7 +779,7 @@
 	}
 
 	for (; min < max; min++, y += step_size) {
-		const EngineID engine = eng_list[min];
+		const EngineID engine = (*eng_list)[min];
 		/* Note: num_engines is only used in the autoreplace GUI, so it is correct to use _local_player here. */
 		const uint num_engines = GetGroupNumEngines(_local_player, selected_group, engine);
 
@@ -805,7 +806,7 @@
 	bool regenerate_list;
 	EngineID sel_engine;
 	EngineID rename_engine;
-	EngineList eng_list;
+	GUIEngineList eng_list;
 
 	BuildVehicleWindow(const WindowDesc *desc, TileIndex tile, VehicleType type) : Window(desc, tile == 0 ? (int)type : tile)
 	{
@@ -847,7 +848,7 @@
 
 		this->GenerateBuildList(); // generate the list, since we need it in the next line
 		/* Select the first engine in the list as default when opening the window */
-		if (this->eng_list.size() > 0) this->sel_engine = this->eng_list[0];
+		if (this->eng_list.Length() > 0) this->sel_engine = this->eng_list[0];
 
 		this->FindWindowPlacementAndResize(desc);
 	}
@@ -905,7 +906,7 @@
 
 		this->filter.railtype = (this->window_number <= VEH_END) ? RAILTYPE_END : GetRailType(this->window_number);
 
-		this->eng_list.clear();
+		this->eng_list.Clear();
 
 		/* Make list of all available train engines and wagons.
 		* Also check to see if the previously selected engine is still available,
@@ -919,7 +920,8 @@
 			if (this->filter.railtype != RAILTYPE_END && !HasPowerOnRail(rvi->railtype, this->filter.railtype)) continue;
 			if (!IsEngineBuildable(eid, VEH_TRAIN, _local_player)) continue;
 
-			this->eng_list.push_back(eid);
+			*this->eng_list.Append() = eid;
+
 			if (rvi->railveh_type != RAILVEH_WAGON) {
 				num_engines++;
 			} else {
@@ -948,14 +950,14 @@
 	{
 		EngineID sel_id = INVALID_ENGINE;
 
-		this->eng_list.clear();
+		this->eng_list.Clear();
 
 		const Engine *e;
 		FOR_ALL_ENGINES_OF_TYPE(e, VEH_ROAD) {
 			EngineID eid = e->index;
 			if (!IsEngineBuildable(eid, VEH_ROAD, _local_player)) continue;
 			if (!HasBit(this->filter.roadtypes, HasBit(EngInfo(eid)->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD)) continue;
-			this->eng_list.push_back(eid);
+			*this->eng_list.Append() = eid;
 
 			if (eid == this->sel_engine) sel_id = eid;
 		}
@@ -966,13 +968,13 @@
 	void GenerateBuildShipList()
 	{
 		EngineID sel_id = INVALID_ENGINE;
-		this->eng_list.clear();
+		this->eng_list.Clear();
 
 		const Engine *e;
 		FOR_ALL_ENGINES_OF_TYPE(e, VEH_SHIP) {
 			EngineID eid = e->index;
 			if (!IsEngineBuildable(eid, VEH_SHIP, _local_player)) continue;
-			this->eng_list.push_back(eid);
+			*this->eng_list.Append() = eid;
 
 			if (eid == this->sel_engine) sel_id = eid;
 		}
@@ -984,7 +986,7 @@
 	{
 		EngineID sel_id = INVALID_ENGINE;
 
-		this->eng_list.clear();
+		this->eng_list.Clear();
 
 		/* Make list of all available planes.
 		* Also check to see if the previously selected plane is still available,
@@ -997,7 +999,7 @@
 			/* First VEH_END window_numbers are fake to allow a window open for all different types at once */
 			if (this->window_number > VEH_END && !CanAircraftUseStation(eid, this->window_number)) continue;
 
-			this->eng_list.push_back(eid);
+			*this->eng_list.Append() = eid;
 			if (eid == this->sel_engine) sel_id = eid;
 		}
 
@@ -1038,7 +1040,7 @@
 
 			case BUILD_VEHICLE_WIDGET_LIST: {
 				uint i = (pt.y - this->widget[BUILD_VEHICLE_WIDGET_LIST].top) / GetVehicleListHeight(this->vehicle_type) + this->vscroll.pos;
-				size_t num_items = this->eng_list.size();
+				size_t num_items = this->eng_list.Length();
 				this->sel_engine = (i < num_items) ? this->eng_list[i] : INVALID_ENGINE;
 				this->SetDirty();
 				break;
@@ -1104,11 +1106,11 @@
 			this->GenerateBuildList();
 		}
 
-		uint max = min(this->vscroll.pos + this->vscroll.cap, this->eng_list.size());
+		uint max = min(this->vscroll.pos + this->vscroll.cap, this->eng_list.Length());
 
 		this->SetWidgetDisabledState(BUILD_VEHICLE_WIDGET_BUILD, this->window_number <= VEH_END);
 
-		SetVScrollCount(this, this->eng_list.size());
+		SetVScrollCount(this, this->eng_list.Length());
 		SetDParam(0, this->filter.railtype + STR_881C_NEW_RAIL_VEHICLES); // This should only affect rail vehicles
 
 		/* Set text of sort by dropdown */
@@ -1116,7 +1118,7 @@
 
 		this->DrawWidgets();
 
-		DrawEngineList(this->vehicle_type, this->widget[BUILD_VEHICLE_WIDGET_LIST].left + 2, this->widget[BUILD_VEHICLE_WIDGET_LIST].top + 1, this->eng_list, this->vscroll.pos, max, this->sel_engine, 0, DEFAULT_GROUP);
+		DrawEngineList(this->vehicle_type, this->widget[BUILD_VEHICLE_WIDGET_LIST].left + 2, this->widget[BUILD_VEHICLE_WIDGET_LIST].top + 1, &this->eng_list, this->vscroll.pos, max, this->sel_engine, 0, DEFAULT_GROUP);
 
 		if (this->sel_engine != INVALID_ENGINE) {
 			const Widget *wi = &this->widget[BUILD_VEHICLE_WIDGET_PANEL];
--- a/src/cheat.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/cheat.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -30,7 +30,7 @@
 static void Load_CHTS()
 {
 	Cheat *cht = (Cheat*)&_cheats;
-	uint count = SlGetFieldLength() / 2;
+	size_t count = SlGetFieldLength() / 2;
 
 	for (uint i = 0; i < count; i++) {
 		cht[i].been_used = (SlReadByte() != 0);
--- a/src/cheat_gui.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/cheat_gui.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -19,6 +19,7 @@
 #include "rail_gui.h"
 #include "gui.h"
 #include "player_gui.h"
+#include "gamelog.h"
 
 #include "table/strings.h"
 #include "table/sprites.h"
@@ -64,9 +65,14 @@
 {
 	if (p1 == -1) p1 = 3;
 	if (p1 ==  4) p1 = 0;
-	_settings.game_creation.landscape = p1;
+	_settings_game.game_creation.landscape = p1;
+
+	GamelogStartAction(GLAT_CHEAT);
+	GamelogTestMode();
 	ReloadNewGRFData();
-	return _settings.game_creation.landscape;
+	GamelogStopAction();
+
+	return _settings_game.game_creation.landscape;
 }
 
 extern void EnginesMonthlyLoop();
@@ -107,7 +113,7 @@
 	{SLE_BOOL,  STR_CHEAT_BUILD_IN_PAUSE,  &_cheats.build_in_pause.value,      &_cheats.build_in_pause.been_used,   NULL                    },
 	{SLE_BOOL,  STR_CHEAT_NO_JETCRASH,     &_cheats.no_jetcrash.value,         &_cheats.no_jetcrash.been_used,      NULL                    },
 	{SLE_BOOL,  STR_CHEAT_SETUP_PROD,      &_cheats.setup_prod.value,          &_cheats.setup_prod.been_used,       NULL                    },
-	{SLE_UINT8, STR_CHEAT_SWITCH_CLIMATE,  &_settings.game_creation.landscape, &_cheats.switch_climate.been_used,   &ClickChangeClimateCheat},
+	{SLE_UINT8, STR_CHEAT_SWITCH_CLIMATE,  &_settings_game.game_creation.landscape, &_cheats.switch_climate.been_used,   &ClickChangeClimateCheat},
 	{SLE_INT32, STR_CHEAT_CHANGE_DATE,     &_cur_year,                         &_cheats.change_date.been_used,      &ClickChangeDateCheat   },
 };
 
--- a/src/clear_cmd.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/clear_cmd.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -218,7 +218,7 @@
 {
 	TileLoopClearHelper(tile);
 
-	switch (_settings.game_creation.landscape) {
+	switch (_settings_game.game_creation.landscape) {
 		case LT_TROPIC: TileLoopClearDesert(tile); break;
 		case LT_ARCTIC: TileLoopClearAlps(tile);   break;
 	}
@@ -346,7 +346,7 @@
 
 void InitializeClearLand()
 {
-	_settings.game_creation.snow_line = _settings.game_creation.snow_line_height * TILE_HEIGHT;
+	_settings_game.game_creation.snow_line = _settings_game.game_creation.snow_line_height * TILE_HEIGHT;
 }
 
 static CommandCost TerraformTile_Clear(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
--- a/src/console.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/console.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -3,11 +3,13 @@
 /** @file console.cpp Handling of the in-game console. */
 
 #include "stdafx.h"
-#include "console_internal.h"
-#include "network/network_data.h"
-#include "network/network_server.h"
 #include "core/alloc_func.hpp"
 #include "string_func.h"
+#include "strings_type.h"
+#include "core/math_func.hpp"
+#include "console_internal.h"
+#include "network/network.h"
+#include "network/network_func.h"
 #include "rev.h"
 
 #include <stdarg.h>
@@ -90,7 +92,7 @@
 #ifdef ENABLE_NETWORK
 	if (_redirect_console_to_client != 0) {
 		/* Redirect the string to the client */
-		SEND_COMMAND(PACKET_SERVER_RCON)(NetworkFindClientStateFromIndex(_redirect_console_to_client), color_code, string);
+		NetworkServerSendRcon(_redirect_console_to_client, color_code, string);
 		return;
 	}
 #endif
--- a/src/console_cmds.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/console_cmds.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -10,17 +10,14 @@
 #include "landscape.h"
 #include "saveload.h"
 #include "variables.h"
-#include "network/network_data.h"
-#include "network/network_client.h"
-#include "network/network_server.h"
-#include "network/network_udp.h"
+#include "network/network.h"
+#include "network/network_func.h"
 #include "command_func.h"
 #include "settings_func.h"
 #include "fios.h"
 #include "fileio.h"
 #include "screenshot.h"
 #include "genworld.h"
-#include "network/network.h"
 #include "strings_func.h"
 #include "viewport_func.h"
 #include "window_func.h"
@@ -32,6 +29,7 @@
 #include "player_func.h"
 #include "player_base.h"
 #include "settings_type.h"
+#include "gamelog.h"
 
 #ifdef ENABLE_NETWORK
 	#include "table/strings.h"
@@ -218,32 +216,25 @@
 
 static const FiosItem* GetFiosItem(const char* file)
 {
-	int i;
-
 	_saveload_mode = SLD_LOAD_GAME;
 	BuildFileList();
 
-	for (i = 0; i < _fios_num; i++) {
-		if (strcmp(file, _fios_list[i].name) == 0) break;
-		if (strcmp(file, _fios_list[i].title) == 0) break;
+	for (const FiosItem *item = _fios_items.Begin(); item != _fios_items.End(); item++) {
+		if (strcmp(file, item->name) == 0) return item;
+		if (strcmp(file, item->title) == 0) return item;
 	}
 
-	if (i == _fios_num) { // If no name matches, try to parse it as number
-		char* endptr;
+	/* If no name matches, try to parse it as number */
+	char *endptr;
+	int i = strtol(file, &endptr, 10);
+	if (file == endptr || *endptr != '\0') i = -1;
 
-		i = strtol(file, &endptr, 10);
-		if (file == endptr || *endptr != '\0') i = -1;
-	}
-
-	return IsInsideMM(i, 0, _fios_num) ? &_fios_list[i] : NULL;
+	return IsInsideMM(i, 0, _fios_items.Length()) ? _fios_items.Get(i) : NULL;
 }
 
 
 DEF_CONSOLE_CMD(ConLoad)
 {
-	const FiosItem *item;
-	const char *file;
-
 	if (argc == 0) {
 		IConsoleHelp("Load a game by name or index. Usage: 'load <file | number>'");
 		return true;
@@ -251,8 +242,8 @@
 
 	if (argc != 2) return false;
 
-	file = argv[1];
-	item = GetFiosItem(file);
+	const char *file = argv[1];
+	const FiosItem *item = GetFiosItem(file);
 	if (item != NULL) {
 		switch (item->type) {
 			case FIOS_TYPE_FILE: case FIOS_TYPE_OLDFILE: {
@@ -275,9 +266,6 @@
 
 DEF_CONSOLE_CMD(ConRemove)
 {
-	const FiosItem* item;
-	const char* file;
-
 	if (argc == 0) {
 		IConsoleHelp("Remove a savegame by name or index. Usage: 'rm <file | number>'");
 		return true;
@@ -285,8 +273,8 @@
 
 	if (argc != 2) return false;
 
-	file = argv[1];
-	item = GetFiosItem(file);
+	const char *file = argv[1];
+	const FiosItem *item = GetFiosItem(file);
 	if (item != NULL) {
 		if (!FiosDelete(item->name))
 			IConsolePrintF(CC_ERROR, "%s: Failed to delete file", file);
@@ -302,8 +290,6 @@
 /* List all the files in the current dir via console */
 DEF_CONSOLE_CMD(ConListFiles)
 {
-	int i;
-
 	if (argc == 0) {
 		IConsoleHelp("List all loadable savegames and directories in the current dir via console. Usage: 'ls | dir'");
 		return true;
@@ -311,9 +297,8 @@
 
 	BuildFileList();
 
-	for (i = 0; i < _fios_num; i++) {
-		const FiosItem *item = &_fios_list[i];
-		IConsolePrintF(CC_DEFAULT, "%d) %s", i, item->title);
+	for (uint i = 0; i < _fios_items.Length(); i++) {
+		IConsolePrintF(CC_DEFAULT, "%d) %s", i, _fios_items[i].title);
 	}
 
 	FiosFreeSavegameList();
@@ -323,9 +308,6 @@
 /* Change the dir via console */
 DEF_CONSOLE_CMD(ConChangeDirectory)
 {
-	const FiosItem *item;
-	const char *file;
-
 	if (argc == 0) {
 		IConsoleHelp("Change the dir via console. Usage: 'cd <directory | number>'");
 		return true;
@@ -333,8 +315,8 @@
 
 	if (argc != 2) return false;
 
-	file = argv[1];
-	item = GetFiosItem(file);
+	const char *file = argv[1];
+	const FiosItem *item = GetFiosItem(file);
 	if (item != NULL) {
 		switch (item->type) {
 			case FIOS_TYPE_DIR: case FIOS_TYPE_DRIVE: case FIOS_TYPE_PARENT:
@@ -425,8 +407,8 @@
 	}
 
 	if (ci != NULL) {
-		banip = inet_ntoa(*(struct in_addr *)&ci->client_ip);
-		SEND_COMMAND(PACKET_SERVER_ERROR)(NetworkFindClientStateFromIndex(index), NETWORK_ERROR_KICKED);
+		banip = GetPlayerIP(ci);
+		NetworkServerSendError(index, NETWORK_ERROR_KICKED);
 		IConsolePrint(CC_DEFAULT, "Client banned");
 	} else {
 		IConsolePrint(CC_DEFAULT, "Client not online, banned IP");
@@ -539,98 +521,34 @@
 	if (_network_server) {
 		IConsoleCmdExec(argv[2]);
 	} else {
-		SEND_COMMAND(PACKET_CLIENT_RCON)(argv[1], argv[2]);
+		NetworkClientSendRcon(argv[1], argv[2]);
 	}
 	return true;
 }
 
 DEF_CONSOLE_CMD(ConStatus)
 {
-	static const char* const stat_str[] = {
-		"inactive",
-		"authorizing",
-		"authorized",
-		"waiting",
-		"loading map",
-		"map done",
-		"ready",
-		"active"
-	};
-
-	NetworkTCPSocketHandler *cs;
-
 	if (argc == 0) {
 		IConsoleHelp("List the status of all clients connected to the server. Usage 'status'");
 		return true;
 	}
 
-	FOR_ALL_CLIENTS(cs) {
-		int lag = NetworkCalculateLag(cs);
-		const NetworkClientInfo *ci = DEREF_CLIENT_INFO(cs);
-		const char* status;
-
-		status = (cs->status < (ptrdiff_t)lengthof(stat_str) ? stat_str[cs->status] : "unknown");
-		IConsolePrintF(CC_INFO, "Client #%1d  name: '%s'  status: '%s'  frame-lag: %3d  company: %1d  IP: %s  unique-id: '%s'",
-			cs->index, ci->client_name, status, lag,
-			ci->client_playas + (IsValidPlayer(ci->client_playas) ? 1 : 0),
-			GetPlayerIP(ci), ci->unique_id);
-	}
-
+	NetworkServerShowStatusToConsole();
 	return true;
 }
 
 DEF_CONSOLE_CMD(ConServerInfo)
 {
-	const NetworkGameInfo *gi;
-
 	if (argc == 0) {
 		IConsoleHelp("List current and maximum client/player limits. Usage 'server_info'");
 		IConsoleHelp("You can change these values by setting the variables 'max_clients', 'max_companies' and 'max_spectators'");
 		return true;
 	}
 
-	gi = &_network_game_info;
-	IConsolePrintF(CC_DEFAULT, "Current/maximum clients:    %2d/%2d", gi->clients_on, gi->clients_max);
-	IConsolePrintF(CC_DEFAULT, "Current/maximum companies:  %2d/%2d", ActivePlayerCount(), gi->companies_max);
-	IConsolePrintF(CC_DEFAULT, "Current/maximum spectators: %2d/%2d", NetworkSpectatorCount(), gi->spectators_max);
-
-	return true;
-}
-
-DEF_CONSOLE_HOOK(ConHookValidateMaxClientsCount)
-{
-	if (_network_game_info.clients_max > MAX_CLIENTS) {
-		_network_game_info.clients_max = MAX_CLIENTS;
-		IConsoleError("Maximum clients out of bounds, truncating to limit.");
-	}
-
-	return true;
-}
+	IConsolePrintF(CC_DEFAULT, "Current/maximum clients:    %2d/%2d", _network_game_info.clients_on, _settings_client.network.max_clients);
+	IConsolePrintF(CC_DEFAULT, "Current/maximum companies:  %2d/%2d", ActivePlayerCount(), _settings_client.network.max_companies);
+	IConsolePrintF(CC_DEFAULT, "Current/maximum spectators: %2d/%2d", NetworkSpectatorCount(), _settings_client.network.max_spectators);
 
-DEF_CONSOLE_HOOK(ConHookValidateMaxCompaniesCount)
-{
-	if (_network_game_info.companies_max > MAX_PLAYERS) {
-		_network_game_info.companies_max = MAX_PLAYERS;
-		IConsoleError("Maximum companies out of bounds, truncating to limit.");
-	}
-
-	return true;
-}
-
-DEF_CONSOLE_HOOK(ConHookValidateMaxSpectatorsCount)
-{
-	/* XXX see ConHookValidateMaxClientsCount */
-	if (_network_game_info.spectators_max > 10) {
-		_network_game_info.spectators_max = 10;
-		IConsoleError("Maximum spectators out of bounds, truncating to limit.");
-	}
-
-	return true;
-}
-
-DEF_CONSOLE_HOOK(ConHookCheckMinPlayers)
-{
-	CheckMinPlayers();
 	return true;
 }
 
@@ -666,7 +584,7 @@
 	}
 
 	if (ci != NULL) {
-		SEND_COMMAND(PACKET_SERVER_ERROR)(NetworkFindClientStateFromIndex(index), NETWORK_ERROR_KICKED);
+		NetworkServerSendError(index, NETWORK_ERROR_KICKED);
 	} else {
 		IConsoleError("Client not found");
 	}
@@ -677,8 +595,6 @@
 DEF_CONSOLE_CMD(ConResetCompany)
 {
 	const Player *p;
-	NetworkTCPSocketHandler *cs;
-	const NetworkClientInfo *ci;
 	PlayerID index;
 
 	if (argc == 0) {
@@ -709,15 +625,11 @@
 		return true;
 	}
 
-	/* Check if the company has active players */
-	FOR_ALL_CLIENTS(cs) {
-		ci = DEREF_CLIENT_INFO(cs);
-		if (ci->client_playas == index) {
-			IConsoleError("Cannot remove company: a client is connected to that company.");
-			return true;
-		}
+	if (NetworkCompanyHasPlayers(index)) {
+		IConsoleError("Cannot remove company: a client is connected to that company.");
+		return false;
 	}
-	ci = NetworkFindClientInfoFromIndex(NETWORK_SERVER_INDEX);
+	const NetworkClientInfo *ci = NetworkFindClientInfoFromIndex(NETWORK_SERVER_INDEX);
 	if (ci->client_playas == index) {
 		IConsoleError("Cannot remove company: the server is connected to that company.");
 		return true;
@@ -926,8 +838,8 @@
 	}
 
 	/* Don't copy the _newgame pointers to the real pointers, so call SwitchMode directly */
-	_settings.game_creation.map_x = MapLogX();
-	_settings.game_creation.map_y = FindFirstBit(MapSizeY());
+	_settings_game.game_creation.map_x = MapLogX();
+	_settings_game.game_creation.map_y = FindFirstBit(MapSizeY());
 	SwitchMode(SM_NEWGAME);
 	return true;
 }
@@ -940,7 +852,7 @@
 		return true;
 	}
 
-	IConsolePrintF(CC_DEFAULT, "Generation Seed: %u", _settings.game_creation.generation_seed);
+	IConsolePrintF(CC_DEFAULT, "Generation Seed: %u", _settings_game.game_creation.generation_seed);
 	return true;
 }
 
@@ -1083,7 +995,7 @@
 		return true;
 	}
 
-	if (_game_mode == GM_NORMAL && _settings.gui.autosave_on_exit) DoExitSave();
+	if (_game_mode == GM_NORMAL && _settings_client.gui.autosave_on_exit) DoExitSave();
 
 	_exit_game = true;
 	return true;
@@ -1224,9 +1136,9 @@
 	if (argc != 2) return false;
 
 	if (!_network_server) {
-		SEND_COMMAND(PACKET_CLIENT_CHAT)(NETWORK_ACTION_CHAT, DESTTYPE_BROADCAST, 0 /* param does not matter */, argv[1]);
+		NetworkClientSendChat(NETWORK_ACTION_CHAT, DESTTYPE_BROADCAST, 0 /* param does not matter */, argv[1]);
 	} else {
-		NetworkServer_HandleChat(NETWORK_ACTION_CHAT, DESTTYPE_BROADCAST, 0, argv[1], NETWORK_SERVER_INDEX);
+		NetworkServerSendChat(NETWORK_ACTION_CHAT, DESTTYPE_BROADCAST, 0, argv[1], NETWORK_SERVER_INDEX);
 	}
 
 	return true;
@@ -1278,9 +1190,9 @@
 	}
 
 	if (!_network_server) {
-		SEND_COMMAND(PACKET_CLIENT_CHAT)(NETWORK_ACTION_CHAT_COMPANY, DESTTYPE_TEAM, atoi(argv[1]), argv[2]);
+		NetworkClientSendChat(NETWORK_ACTION_CHAT_COMPANY, DESTTYPE_TEAM, atoi(argv[1]), argv[2]);
 	} else {
-		NetworkServer_HandleChat(NETWORK_ACTION_CHAT_COMPANY, DESTTYPE_TEAM, atoi(argv[1]), argv[2], NETWORK_SERVER_INDEX);
+		NetworkServerSendChat(NETWORK_ACTION_CHAT_COMPANY, DESTTYPE_TEAM, atoi(argv[1]), argv[2], NETWORK_SERVER_INDEX);
 	}
 
 	return true;
@@ -1297,37 +1209,14 @@
 	if (argc != 3) return false;
 
 	if (!_network_server) {
-		SEND_COMMAND(PACKET_CLIENT_CHAT)(NETWORK_ACTION_CHAT_CLIENT, DESTTYPE_CLIENT, atoi(argv[1]), argv[2]);
+		NetworkClientSendChat(NETWORK_ACTION_CHAT_CLIENT, DESTTYPE_CLIENT, atoi(argv[1]), argv[2]);
 	} else {
-		NetworkServer_HandleChat(NETWORK_ACTION_CHAT_CLIENT, DESTTYPE_CLIENT, atoi(argv[1]), argv[2], NETWORK_SERVER_INDEX);
+		NetworkServerSendChat(NETWORK_ACTION_CHAT_CLIENT, DESTTYPE_CLIENT, atoi(argv[1]), argv[2], NETWORK_SERVER_INDEX);
 	}
 
 	return true;
 }
 
-DEF_CONSOLE_HOOK(ConHookServerPW)
-{
-	if (strcmp(_network_server_password, "*") == 0) {
-		_network_server_password[0] = '\0';
-		_network_game_info.use_password = 0;
-	} else {
-		ttd_strlcpy(_network_game_info.server_password, _network_server_password, sizeof(_network_server_password));
-		_network_game_info.use_password = 1;
-	}
-
-	return true;
-}
-
-DEF_CONSOLE_HOOK(ConHookRconPW)
-{
-	if (strcmp(_network_rcon_password, "*") == 0)
-		_network_rcon_password[0] = '\0';
-
-	ttd_strlcpy(_network_game_info.rcon_password, _network_rcon_password, sizeof(_network_game_info.rcon_password));
-
-	return true;
-}
-
 extern void HashCurrentCompanyPassword();
 
 /* Also use from within player_gui to change the password graphically */
@@ -1351,7 +1240,7 @@
 	ttd_strlcpy(_network_player_info[_local_player].password, argv[0], sizeof(_network_player_info[_local_player].password));
 
 	if (!_network_server) {
-		SEND_COMMAND(PACKET_CLIENT_SET_PASSWORD)(_network_player_info[_local_player].password);
+		NetworkClientSetPassword();
 	} else {
 		HashCurrentCompanyPassword();
 	}
@@ -1361,56 +1250,6 @@
 	return true;
 }
 
-DEF_CONSOLE_HOOK(ConProcPlayerName)
-{
-	NetworkClientInfo *ci = NetworkFindClientInfoFromIndex(_network_own_client_index);
-
-	if (ci == NULL) return false;
-
-	/* Don't change the name if it is the same as the old name */
-	if (strcmp(ci->client_name, _network_player_name) != 0) {
-		if (!_network_server) {
-			SEND_COMMAND(PACKET_CLIENT_SET_NAME)(_network_player_name);
-		} else {
-			if (NetworkFindName(_network_player_name)) {
-				NetworkTextMessage(NETWORK_ACTION_NAME_CHANGE, CC_DEFAULT, false, ci->client_name, "%s", _network_player_name);
-				ttd_strlcpy(ci->client_name, _network_player_name, sizeof(ci->client_name));
-				NetworkUpdateClientInfo(NETWORK_SERVER_INDEX);
-			}
-		}
-	}
-
-	return true;
-}
-
-DEF_CONSOLE_HOOK(ConHookServerName)
-{
-	ttd_strlcpy(_network_game_info.server_name, _network_server_name, sizeof(_network_game_info.server_name));
-	return true;
-}
-
-DEF_CONSOLE_HOOK(ConHookServerAdvertise)
-{
-	if (!_network_advertise) // remove us from advertising
-		NetworkUDPRemoveAdvertise();
-
-	return true;
-}
-
-DEF_CONSOLE_CMD(ConProcServerIP)
-{
-	if (argc == 0) {
-		IConsolePrintF(CC_WARNING, "Current value for 'server_ip': %s", inet_ntoa(*(struct in_addr *)&_network_server_bind_ip));
-		return true;
-	}
-
-	if (argc != 1) return false;
-
-	_network_server_bind_ip = (strcmp(argv[0], "all") == 0) ? inet_addr("0.0.0.0") : inet_addr(argv[0]);
-	snprintf(_network_server_bind_ip_host, sizeof(_network_server_bind_ip_host), "%s", inet_ntoa(*(struct in_addr *)&_network_server_bind_ip));
-	IConsolePrintF(CC_WARNING, "'server_ip' changed to:  %s", inet_ntoa(*(struct in_addr *)&_network_server_bind_ip));
-	return true;
-}
 #endif /* ENABLE_NETWORK */
 
 DEF_CONSOLE_CMD(ConPatch)
@@ -1426,17 +1265,7 @@
 	if (argc == 2) {
 		IConsoleGetPatchSetting(argv[1]);
 	} else {
-		uint32 val;
-
-		if (GetArgumentInteger(&val, argv[2])) {
-			if (!IConsoleSetPatchSetting(argv[1], val)) {
-				if (_network_server) {
-					IConsoleError("This command/variable is not available during network games.");
-				} else {
-					IConsoleError("This command/variable is only available to a network server.");
-				}
-			}
-		}
+		IConsoleSetPatchSetting(argv[1], argv[2]);
 	}
 
 	return true;
@@ -1475,6 +1304,11 @@
 	return true;
 }
 
+DEF_CONSOLE_CMD(ConGamelogPrint)
+{
+	GamelogPrintConsole();
+	return true;
+}
 
 #ifdef _DEBUG
 /* ****************************************** */
@@ -1538,6 +1372,7 @@
 	IConsoleCmdRegister("clear",        ConClearBuffer);
 	IConsoleCmdRegister("patch",        ConPatch);
 	IConsoleCmdRegister("list_patches", ConListPatches);
+	IConsoleCmdRegister("gamelog",      ConGamelogPrint);
 
 	IConsoleAliasRegister("dir",      "ls");
 	IConsoleAliasRegister("del",      "rm %+");
@@ -1594,71 +1429,36 @@
 	IConsoleCmdHookAdd("unpause",          ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
 
 	/*** Networking variables ***/
-	IConsoleVarRegister("net_frame_freq",        &_network_frame_freq, ICONSOLE_VAR_BYTE, "The amount of frames before a command will be (visibly) executed. Default value: 1");
-	IConsoleVarHookAdd("net_frame_freq",         ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
-	IConsoleVarRegister("net_sync_freq",         &_network_sync_freq,  ICONSOLE_VAR_UINT16, "The amount of frames to check if the game is still in sync. Default value: 100");
-	IConsoleVarHookAdd("net_sync_freq",          ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
-
-	IConsoleVarStringRegister("server_pw",       &_network_server_password, sizeof(_network_server_password), "Set the server password to protect your server. Use '*' to clear the password");
-	IConsoleVarHookAdd("server_pw",              ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
-	IConsoleVarHookAdd("server_pw",              ICONSOLE_HOOK_POST_ACTION, ConHookServerPW);
-	IConsoleAliasRegister("server_password",     "server_pw %+");
-	IConsoleVarStringRegister("rcon_pw",         &_network_rcon_password, sizeof(_network_rcon_password), "Set the rcon-password to change server behaviour. Use '*' to disable rcon");
-	IConsoleVarHookAdd("rcon_pw",                ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
-	IConsoleVarHookAdd("rcon_pw",                ICONSOLE_HOOK_POST_ACTION, ConHookRconPW);
-	IConsoleAliasRegister("rcon_password",       "rcon_pw %+");
 	IConsoleVarStringRegister("company_pw",      NULL, 0, "Set a password for your company, so no one without the correct password can join. Use '*' to clear the password");
 	IConsoleVarHookAdd("company_pw",             ICONSOLE_HOOK_ACCESS, ConHookNeedNetwork);
 	IConsoleVarProcAdd("company_pw",             NetworkChangeCompanyPassword);
 	IConsoleAliasRegister("company_password",    "company_pw %+");
 
-	IConsoleVarStringRegister("name",            &_network_player_name, sizeof(_network_player_name), "Set your name for multiplayer");
-	IConsoleVarHookAdd("name",                   ICONSOLE_HOOK_ACCESS, ConHookNeedNetwork);
-	IConsoleVarHookAdd("name",                   ICONSOLE_HOOK_POST_ACTION, ConProcPlayerName);
-	IConsoleVarStringRegister("server_name",     &_network_server_name, sizeof(_network_server_name), "Set the name of the server for multiplayer");
-	IConsoleVarHookAdd("server_name",            ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
-	IConsoleVarHookAdd("server_name",            ICONSOLE_HOOK_POST_ACTION, ConHookServerName);
-
-	IConsoleVarRegister("server_port",           &_network_server_port, ICONSOLE_VAR_UINT32, "Set the server port. Changes take effect the next time you start a server");
-	IConsoleVarRegister("server_ip",             &_network_server_bind_ip, ICONSOLE_VAR_UINT32, "Set the IP the server binds to. Changes take effect the next time you start a server. Use 'all' to bind to any IP.");
-	IConsoleVarProcAdd("server_ip",              ConProcServerIP);
-	IConsoleAliasRegister("server_bind_ip",      "server_ip %+");
-	IConsoleAliasRegister("server_ip_bind",      "server_ip %+");
-	IConsoleAliasRegister("server_bind",         "server_ip %+");
-	IConsoleVarRegister("server_advertise",      &_network_advertise, ICONSOLE_VAR_BOOLEAN, "Set if the server will advertise to the master server and show up there");
-	IConsoleVarHookAdd("server_advertise",       ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
-	IConsoleVarHookAdd("server_advertise",       ICONSOLE_HOOK_POST_ACTION, ConHookServerAdvertise);
-
-	IConsoleVarRegister("max_clients",           &_network_game_info.clients_max, ICONSOLE_VAR_BYTE, "Control the maximum amount of connected players during runtime. Default value: 10");
-	IConsoleVarHookAdd("max_clients",            ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
-	IConsoleVarHookAdd("max_clients",            ICONSOLE_HOOK_POST_ACTION, ConHookValidateMaxClientsCount);
-	IConsoleVarRegister("max_companies",         &_network_game_info.companies_max, ICONSOLE_VAR_BYTE, "Control the maximum amount of active companies during runtime. Default value: 8");
-	IConsoleVarHookAdd("max_companies",          ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
-	IConsoleVarHookAdd("max_companies",          ICONSOLE_HOOK_POST_ACTION, ConHookValidateMaxCompaniesCount);
-	IConsoleVarRegister("max_spectators",        &_network_game_info.spectators_max, ICONSOLE_VAR_BYTE, "Control the maximum amount of active spectators during runtime. Default value: 9");
-	IConsoleVarHookAdd("max_spectators",         ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
-	IConsoleVarHookAdd("max_spectators",         ICONSOLE_HOOK_POST_ACTION, ConHookValidateMaxSpectatorsCount);
-
-	IConsoleVarRegister("max_join_time",         &_network_max_join_time, ICONSOLE_VAR_UINT16, "Set the maximum amount of time (ticks) a client is allowed to join. Default value: 500");
-
-	IConsoleVarRegister("pause_on_join",         &_network_pause_on_join, ICONSOLE_VAR_BOOLEAN, "Set if the server should pause gameplay while a client is joining. This might help slow users");
-	IConsoleVarHookAdd("pause_on_join",          ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
-
-	IConsoleVarRegister("autoclean_companies",   &_network_autoclean_companies, ICONSOLE_VAR_BOOLEAN, "Automatically shut down inactive companies to free them up for other players. Customize with 'autoclean_(un)protected'");
-	IConsoleVarHookAdd("autoclean_companies",    ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
-	IConsoleVarRegister("autoclean_protected",   &_network_autoclean_protected, ICONSOLE_VAR_BYTE, "Automatically remove the password from an inactive company after the given amount of months");
-	IConsoleVarHookAdd("autoclean_protected",    ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
-	IConsoleVarRegister("autoclean_unprotected", &_network_autoclean_unprotected, ICONSOLE_VAR_BYTE, "Automatically shut down inactive companies after the given amount of months");
-	IConsoleVarHookAdd("autoclean_unprotected",  ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
-	IConsoleVarRegister("restart_game_year",     &_network_restart_game_year, ICONSOLE_VAR_UINT16, "Auto-restart the server when Jan 1st of the set year is reached. Use '0' to disable this");
-	IConsoleVarHookAdd("restart_game_year",      ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
-
-	IConsoleVarRegister("min_players",           &_network_min_players, ICONSOLE_VAR_BYTE, "Automatically pause the game when the number of active players passes below the given amount");
-	IConsoleVarHookAdd("min_players",            ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
-	IConsoleVarHookAdd("min_players",            ICONSOLE_HOOK_POST_ACTION, ConHookCheckMinPlayers);
-	IConsoleVarRegister("reload_cfg",            &_network_reload_cfg, ICONSOLE_VAR_BOOLEAN, "reload the entire config file between the end of this game, and starting the next new game - dedicated servers");
-	IConsoleVarHookAdd("reload_cfg",             ICONSOLE_HOOK_ACCESS, ConHookServerOnly);
-
+	IConsoleAliasRegister("net_frame_freq",        "patch frame_freq %+");
+	IConsoleAliasRegister("net_sync_freq",         "patch sync_freq %+");
+	IConsoleAliasRegister("server_pw",             "patch server_password %+");
+	IConsoleAliasRegister("server_password",       "patch server_password %+");
+	IConsoleAliasRegister("rcon_pw",               "patch rcon_password %+");
+	IConsoleAliasRegister("rcon_password",         "patch rcon_password %+");
+	IConsoleAliasRegister("name",                  "patch player_name %+");
+	IConsoleAliasRegister("server_name",           "patch server_name %+");
+	IConsoleAliasRegister("server_port",           "patch server_port %+");
+	IConsoleAliasRegister("server_ip",             "patch server_bind_ip %+");
+	IConsoleAliasRegister("server_bind_ip",        "patch server_bind_ip %+");
+	IConsoleAliasRegister("server_ip_bind",        "patch server_bind_ip %+");
+	IConsoleAliasRegister("server_bind",           "patch server_bind_ip %+");
+	IConsoleAliasRegister("server_advertise",      "patch server_advertise %+");
+	IConsoleAliasRegister("max_clients",           "patch max_clients %+");
+	IConsoleAliasRegister("max_companies",         "patch max_companies %+");
+	IConsoleAliasRegister("max_spectators",        "patch max_spectators %+");
+	IConsoleAliasRegister("max_join_time",         "patch max_join_time %+");
+	IConsoleAliasRegister("pause_on_join",         "patch pause_on_join %+");
+	IConsoleAliasRegister("autoclean_companies",   "patch autoclean_companies %+");
+	IConsoleAliasRegister("autoclean_protected",   "patch autoclean_protected %+");
+	IConsoleAliasRegister("autoclean_unprotected", "patch autoclean_unprotected %+");
+	IConsoleAliasRegister("restart_game_year",     "patch restart_game_year %+");
+	IConsoleAliasRegister("min_players",           "patch min_players %+");
+	IConsoleAliasRegister("reload_cfg",            "patch reload_cfg %+");
 #endif /* ENABLE_NETWORK */
 
 	// debugging stuff
--- a/src/console_func.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/console_func.h	Tue Jun 17 10:32:49 2008 +0000
@@ -19,6 +19,8 @@
 void IConsolePrint(ConsoleColour color_code, const char *string);
 void CDECL IConsolePrintF(ConsoleColour color_code, const char *s, ...);
 void IConsoleDebug(const char *dbg, const char *string);
+void IConsoleWarning(const char *string);
+void IConsoleError(const char *string);
 
 /* Parser */
 void IConsoleCmdExec(const char *cmdstr);
--- a/src/console_internal.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/console_internal.h	Tue Jun 17 10:32:49 2008 +0000
@@ -105,10 +105,6 @@
 void IConsoleClearBuffer();
 void IConsoleOpen();
 
-/* console output */
-void IConsoleWarning(const char *string);
-void IConsoleError(const char *string);
-
 /* Commands */
 void IConsoleCmdRegister(const char *name, IConsoleCmdProc *proc);
 void IConsoleAliasRegister(const char *name, const char *cmd);
--- a/src/currency.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/currency.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -150,10 +150,10 @@
  **/
 void CheckSwitchToEuro()
 {
-	if (_currency_specs[_settings.gui.currency].to_euro != CF_NOEURO &&
-			_currency_specs[_settings.gui.currency].to_euro != CF_ISEURO &&
-			_cur_year >= _currency_specs[_settings.gui.currency].to_euro) {
-		_settings.gui.currency = 2; // this is the index of euro above.
+	if (_currency_specs[_settings_game.locale.currency].to_euro != CF_NOEURO &&
+			_currency_specs[_settings_game.locale.currency].to_euro != CF_ISEURO &&
+			_cur_year >= _currency_specs[_settings_game.locale.currency].to_euro) {
+		_settings_game.locale.currency = 2; // this is the index of euro above.
 		AddNewsItem(STR_EURO_INTRODUCE, NS_ECONOMY, 0, 0);
 	}
 }
--- a/src/currency.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/currency.h	Tue Jun 17 10:32:49 2008 +0000
@@ -39,7 +39,7 @@
 
 // XXX small hack, but makes the rest of the code a bit nicer to read
 #define _custom_currency (_currency_specs[CUSTOM_CURRENCY_ID])
-#define _currency ((const CurrencySpec*)&_currency_specs[(_game_mode == GM_MENU) ? _settings_newgame.gui.currency : _settings.gui.currency])
+#define _currency ((const CurrencySpec*)&_currency_specs[_game_mode == GM_MENU ? _settings_newgame.locale.currency : _settings_game.locale.currency])
 
 uint GetMaskOfAllowedCurrencies();
 void CheckSwitchToEuro();
--- a/src/date.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/date.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -7,8 +7,7 @@
 #include "variables.h"
 #include "settings_type.h"
 #include "network/network.h"
-#include "network/network_data.h"
-#include "network/network_server.h"
+#include "network/network_func.h"
 #include "currency.h"
 #include "window_func.h"
 #include "functions.h"
@@ -257,7 +256,7 @@
 		SaveOrLoad(name, SL_SAVE, AUTOSAVE_DIR);
 		DebugDumpCommands("ddc:save:%s\n", name);
 #endif /* DUMP_COMMANDS */
-		if (_settings.gui.autosave != 0 && (_cur_month % _autosave_months[_settings.gui.autosave]) == 0) {
+		if (_settings_client.gui.autosave != 0 && (_cur_month % _autosave_months[_settings_client.gui.autosave]) == 0) {
 			_do_autosave = true;
 			RedrawAutosave();
 		}
@@ -268,7 +267,9 @@
 		TownsMonthlyLoop();
 		IndustryMonthlyLoop();
 		StationMonthlyLoop();
+#ifdef ENABLE_NETWORK
 		if (_network_server) NetworkServerMonthlyLoop();
+#endif /* ENABLE_NETWORK */
 	}
 
 	/* check if we entered a new year? */
@@ -281,12 +282,14 @@
 	RoadVehiclesYearlyLoop();
 	AircraftYearlyLoop();
 	ShipsYearlyLoop();
+#ifdef ENABLE_NETWORK
 	if (_network_server) NetworkServerYearlyLoop();
+#endif /* ENABLE_NETWORK */
 
-	if (_cur_year == _settings.gui.semaphore_build_before) ResetSignalVariant();
+	if (_cur_year == _settings_client.gui.semaphore_build_before) ResetSignalVariant();
 
 	/* check if we reached end of the game */
-	if (_cur_year == _settings.gui.ending_year) {
+	if (_cur_year == _settings_client.gui.ending_year) {
 			ShowEndGameChart();
 	/* check if we reached the maximum year, decrement dates by a year */
 	} else if (_cur_year == MAX_YEAR + 1) {
@@ -303,5 +306,5 @@
 		InitChatMessage();
 	}
 
-	if (_settings.gui.auto_euro) CheckSwitchToEuro();
+	if (_settings_client.gui.auto_euro) CheckSwitchToEuro();
 }
--- a/src/debug.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/debug.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -30,6 +30,7 @@
 int _debug_freetype_level;
 int _debug_sl_level;
 int _debug_station_level;
+int _debug_gamelog_level;
 
 
 struct DebugLevel {
@@ -54,27 +55,20 @@
 	DEBUG_LEVEL(freetype),
 	DEBUG_LEVEL(sl),
 	DEBUG_LEVEL(station),
+	DEBUG_LEVEL(gamelog),
 	};
 #undef DEBUG_LEVEL
 
 #if !defined(NO_DEBUG_MESSAGES)
 
-void CDECL debug(const char *dbg, ...)
+void CDECL debug_print(const char *dbg, const char *buf)
 {
-	va_list va;
-	va_start(va, dbg);
-	const char *s;
-	char buf[1024];
-
-	s = va_arg(va, const char*);
-	vsnprintf(buf, lengthof(buf), s, va);
-	va_end(va);
 #if defined(ENABLE_NETWORK)
 	if (_debug_socket != INVALID_SOCKET) {
-		char buf2[lengthof(buf) + 32];
+		char buf2[1024 + 32];
 
 		snprintf(buf2, lengthof(buf2), "dbg: [%s] %s\n", dbg, buf);
-		send(_debug_socket, buf2, strlen(buf2), 0);
+		send(_debug_socket, buf2, (int)strlen(buf2), 0);
 	} else
 #endif /* ENABLE_NETWORK */
 	{
@@ -89,6 +83,20 @@
 		IConsoleDebug(dbg, buf);
 	}
 }
+
+void CDECL debug(const char *dbg, ...)
+{
+	va_list va;
+	va_start(va, dbg);
+	const char *s;
+	char buf[1024];
+
+	s = va_arg(va, const char*);
+	vsnprintf(buf, lengthof(buf), s, va);
+	va_end(va);
+
+	debug_print(dbg, buf);
+}
 #endif /* NO_DEBUG_MESSAGES */
 
 void SetDebugString(const char *s)
--- a/src/debug.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/debug.h	Tue Jun 17 10:32:49 2008 +0000
@@ -47,8 +47,10 @@
 	extern int _debug_freetype_level;
 	extern int _debug_sl_level;
 	extern int _debug_station_level;
+	extern int _debug_gamelog_level;
 
 	void CDECL debug(const char *dbg, ...);
+	void CDECL debug_print(const char *dbg, const char *buf);
 #endif /* NO_DEBUG_MESSAGES */
 
 void SetDebugString(const char *s);
--- a/src/depot_gui.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/depot_gui.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -26,6 +26,7 @@
 #include "depot_base.h"
 #include "tilehighlight_func.h"
 #include "window_gui.h"
+#include "vehiclelist.h"
 
 #include "table/strings.h"
 #include "table/sprites.h"
--- a/src/disaster_cmd.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/disaster_cmd.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -1053,7 +1053,7 @@
 
 	ResetDisasterDelay();
 
-	if (_settings.difficulty.disasters != 0) DoDisaster();
+	if (_settings_game.difficulty.disasters != 0) DoDisaster();
 }
 
 void StartupDisasters()
--- a/src/dock_gui.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/dock_gui.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -136,12 +136,12 @@
 	BuildDocksToolbarWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number)
 	{
 		this->FindWindowPlacementAndResize(desc);
-		if (_settings.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
+		if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
 	}
 
 	~BuildDocksToolbarWindow()
 	{
-		if (_settings.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0);
+		if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0);
 	}
 
 	virtual void OnPaint()
@@ -263,7 +263,7 @@
 
 	virtual void OnPaint()
 	{
-		int rad = (_settings.station.modified_catchment) ? CA_DOCK : CA_UNMODIFIED;
+		int rad = (_settings_game.station.modified_catchment) ? CA_DOCK : CA_UNMODIFIED;
 
 		this->DrawWidgets();
 
--- a/src/driver.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/driver.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -87,7 +87,7 @@
 				delete newd;
 			}
 		}
-		error("Couldn't find any suitable %s driver", GetDriverTypeName(type));
+		usererror("Couldn't find any suitable %s driver", GetDriverTypeName(type));
 	} else {
 		char *parm;
 		char buffer[256];
@@ -125,7 +125,7 @@
 			const char *err = newd->Start(parms);
 			if (err != NULL) {
 				delete newd;
-				error("Unable to load driver '%s'. The error was: %s", d->name, err);
+				usererror("Unable to load driver '%s'. The error was: %s", d->name, err);
 			}
 
 			DEBUG(driver, 1, "Successfully loaded %s driver '%s'", GetDriverTypeName(type), d->name);
@@ -133,7 +133,7 @@
 			*GetActiveDriver(type) = newd;
 			return newd;
 		}
-		error("No such %s driver: %s\n", GetDriverTypeName(type), buffer);
+		usererror("No such %s driver: %s\n", GetDriverTypeName(type), buffer);
 	}
 }
 
@@ -156,11 +156,7 @@
 	strecpy(buf, GetDriverTypeName(type), lastof(buf));
 	strecpy(buf + 5, name, lastof(buf));
 
-#if !defined(NDEBUG) || defined(WITH_ASSERT)
-	/* NDEBUG disables asserts and gives a warning: unused variable 'P' */
-	std::pair<Drivers::iterator, bool> P =
-#endif /* !NDEBUG */
-	GetDrivers().insert(Drivers::value_type(buf, this));
+	std::pair<Drivers::iterator, bool> P = GetDrivers().insert(Drivers::value_type(buf, this));
 	assert(P.second);
 }
 
--- a/src/economy.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/economy.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -14,7 +14,7 @@
 #include "town.h"
 #include "news_func.h"
 #include "network/network.h"
-#include "network/network_data.h"
+#include "network/network_func.h"
 #include "variables.h"
 #include "vehicle_gui.h"
 #include "ai/ai.h"
@@ -488,25 +488,7 @@
 
 	if (!_network_server) return;
 
-	/* The server has to handle all administrative issues, for example
-	* updating and notifying all clients of what has happened */
-	NetworkTCPSocketHandler *cs;
-	NetworkClientInfo *ci = NetworkFindClientInfoFromIndex(NETWORK_SERVER_INDEX);
-
-	/* The server has just changed from player */
-	if (current_player == ci->client_playas) {
-		ci->client_playas = new_player;
-		NetworkUpdateClientInfo(NETWORK_SERVER_INDEX);
-	}
-
-	/* Find all clients that were in control of this company, and mark them as new_player */
-	FOR_ALL_CLIENTS(cs) {
-		ci = DEREF_CLIENT_INFO(cs);
-		if (current_player == ci->client_playas) {
-			ci->client_playas = new_player;
-			NetworkUpdateClientInfo(ci->client_index);
-		}
-	}
+	NetworkServerChangeOwner(current_player, new_player);
 #endif /* ENABLE_NETWORK */
 }
 
@@ -654,14 +636,14 @@
 	 * inflation doesn't add anything after that either; it even makes playing
 	 * it impossible due to the diverging cost and income rates.
 	 */
-	if ((_cur_year - _settings.game_creation.starting_year) >= (ORIGINAL_MAX_YEAR - ORIGINAL_BASE_YEAR)) return;
+	if ((_cur_year - _settings_game.game_creation.starting_year) >= (ORIGINAL_MAX_YEAR - ORIGINAL_BASE_YEAR)) return;
 
 	/* Approximation for (100 + infl_amount)% ** (1 / 12) - 100%
 	 * scaled by 65536
 	 * 12 -> months per year
 	 * This is only a good approxiamtion for small values
 	 */
-	Money inf = _economy.infl_amount * 54;
+	int32 inf = _economy.infl_amount * 54;
 
 	for (uint i = 0; i != NUM_PRICES; i++) {
 		AddSingleInflation((Money*)&_price + i, _price_frac + i, inf);
@@ -704,7 +686,7 @@
 
 static void HandleEconomyFluctuations()
 {
-	if (_settings.difficulty.economy == 0) return;
+	if (_settings_game.difficulty.economy == 0) return;
 
 	if (--_economy.fluct == 0) {
 		_economy.fluct = -(int)GB(Random(), 0, 2);
@@ -813,7 +795,7 @@
 	for (i = 0; i != NUM_PRICES; i++) {
 		Money price = _price_base[i];
 		if (_price_category[i] != 0) {
-			uint mod = _price_category[i] == 1 ? _settings.difficulty.vehicle_costs : _settings.difficulty.construction_cost;
+			uint mod = _price_category[i] == 1 ? _settings_game.difficulty.vehicle_costs : _settings_game.difficulty.construction_cost;
 			if (mod < 1) {
 				price = price * 3 >> 2;
 			} else if (mod > 1) {
@@ -829,10 +811,10 @@
 		_price_frac[i] = 0;
 	}
 
-	_economy.interest_rate = _settings.difficulty.initial_interest;
-	_economy.infl_amount = _settings.difficulty.initial_interest;
-	_economy.infl_amount_pr = max(0, _settings.difficulty.initial_interest - 1);
-	_economy.max_loan_unround = _economy.max_loan = _settings.difficulty.max_loan;
+	_economy.interest_rate = _settings_game.difficulty.initial_interest;
+	_economy.infl_amount = _settings_game.difficulty.initial_interest;
+	_economy.infl_amount_pr = max(0, _settings_game.difficulty.initial_interest - 1);
+	_economy.max_loan_unround = _economy.max_loan = _settings_game.difficulty.max_loan;
 	_economy.fluct = GB(Random(), 0, 8) + 168;
 }
 
@@ -1162,7 +1144,7 @@
 	}
 
 	/* zero the distance (thus income) if it's the bank and very short transport. */
-	if (_settings.game_creation.landscape == LT_TEMPERATE && cs->label == 'VALU' && dist < 10) return 0;
+	if (_settings_game.game_creation.landscape == LT_TEMPERATE && cs->label == 'VALU' && dist < 10) return 0;
 
 
 	static const int MIN_TIME_FACTOR = 31;
@@ -1208,7 +1190,7 @@
 	 * XXX - Think of something better to
 	 *       1) Only deliver to industries which are withing the catchment radius
 	 *       2) Distribute between industries if more then one is present */
-	best_dist = (_settings.station.station_spread + 8) * 2;
+	best_dist = (_settings_game.station.station_spread + 8) * 2;
 	FOR_ALL_INDUSTRIES(ind) {
 		indspec = GetIndustrySpec(ind->type);
 		uint i;
@@ -1313,7 +1295,7 @@
 
 			SetDParam(0, _current_player);
 			AddNewsItem(
-				STR_2031_SERVICE_SUBSIDY_AWARDED + _settings.difficulty.subsidy_multiplier,
+				STR_2031_SERVICE_SUBSIDY_AWARDED + _settings_game.difficulty.subsidy_multiplier,
 				NS_SUBSIDIES,
 				pair.a, pair.b
 			);
@@ -1360,7 +1342,7 @@
 
 	/* Modify profit if a subsidy is in effect */
 	if (subsidised) {
-		switch (_settings.difficulty.subsidy_multiplier) {
+		switch (_settings_game.difficulty.subsidy_multiplier) {
 			case 0:  profit += profit >> 1; break;
 			case 1:  profit *= 2; break;
 			case 2:  profit *= 3; break;
@@ -1481,7 +1463,7 @@
 
 	/* We have not waited enough time till the next round of loading/unloading */
 	if (--v->load_unload_time_rem != 0) {
-		if (_settings.order.improved_load && (v->current_order.GetLoadType() & OLFB_FULL_LOAD)) {
+		if (_settings_game.order.improved_load && (v->current_order.GetLoadType() & OLFB_FULL_LOAD)) {
 			/* 'Reserve' this cargo for this vehicle, because we were first. */
 			for (; v != NULL; v = v->Next()) {
 				if (v->cargo_cap != 0) cargo_left[v->cargo_type] -= v->cargo_cap - v->cargo.Count();
@@ -1517,7 +1499,7 @@
 		if (v->cargo_cap == 0) continue;
 
 		byte load_amount = EngInfo(v->engine_type)->load_amount;
-		if (_settings.order.gradual_loading && HasBit(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_LOAD_AMOUNT)) {
+		if (_settings_game.order.gradual_loading && HasBit(EngInfo(v->engine_type)->callbackmask, CBM_VEHICLE_LOAD_AMOUNT)) {
 			uint16 cb_load_amount = GetVehicleCallback(CBID_VEHICLE_LOAD_AMOUNT, 0, 0, v->engine_type, v);
 			if (cb_load_amount != CALLBACK_FAILED && GB(cb_load_amount, 0, 8) != 0) load_amount = GB(cb_load_amount, 0, 8);
 		}
@@ -1526,7 +1508,7 @@
 
 		if (HasBit(v->vehicle_flags, VF_CARGO_UNLOADING) && (u->current_order.GetUnloadType() & OUFB_NO_UNLOAD) == 0) {
 			uint cargo_count = v->cargo.Count();
-			uint amount_unloaded = _settings.order.gradual_loading ? min(cargo_count, load_amount) : cargo_count;
+			uint amount_unloaded = _settings_game.order.gradual_loading ? min(cargo_count, load_amount) : cargo_count;
 			bool remaining; // Are there cargo entities in this vehicle that can still be unloaded here?
 
 			if (HasBit(ge->acceptance_pickup, GoodsEntry::ACCEPTANCE) && !(u->current_order.GetUnloadType() & OUFB_TRANSFER)) {
@@ -1552,7 +1534,7 @@
 			unloading_time += amount_unloaded;
 
 			anything_unloaded = true;
-			if (_settings.order.gradual_loading && remaining) {
+			if (_settings_game.order.gradual_loading && remaining) {
 				completely_emptied = false;
 			} else {
 				/* We have finished unloading (cargo count == 0) */
@@ -1586,14 +1568,14 @@
 
 			/* Skip loading this vehicle if another train/vehicle is already handling
 			 * the same cargo type at this station */
-			if (_settings.order.improved_load && cargo_left[v->cargo_type] <= 0) {
+			if (_settings_game.order.improved_load && cargo_left[v->cargo_type] <= 0) {
 				SetBit(cargo_not_full, v->cargo_type);
 				continue;
 			}
 
 			if (cap > count) cap = count;
-			if (_settings.order.gradual_loading) cap = min(cap, load_amount);
-			if (_settings.order.improved_load) {
+			if (_settings_game.order.gradual_loading) cap = min(cap, load_amount);
+			if (_settings_game.order.improved_load) {
 				/* Don't load stuff that is already 'reserved' for other vehicles */
 				cap = min((uint)cargo_left[v->cargo_type], cap);
 				cargo_left[v->cargo_type] -= cap;
@@ -1637,7 +1619,7 @@
 	 * all wagons at the same time instead of using the same 'improved'
 	 * loading algorithm for the wagons (only fill wagon when there is
 	 * enough to fill the previous wagons) */
-	if (_settings.order.improved_load && (u->current_order.GetLoadType() & OLFB_FULL_LOAD)) {
+	if (_settings_game.order.improved_load && (u->current_order.GetLoadType() & OLFB_FULL_LOAD)) {
 		/* Update left cargo */
 		for (v = u; v != NULL; v = v->Next()) {
 			if (v->cargo_cap != 0) cargo_left[v->cargo_type] -= v->cargo_cap - v->cargo.Count();
@@ -1647,7 +1629,7 @@
 	v = u;
 
 	if (anything_loaded || anything_unloaded) {
-		if (_settings.order.gradual_loading) {
+		if (_settings_game.order.gradual_loading) {
 			/* The time it takes to load one 'slice' of cargo or passengers depends
 			* on the vehicle type - the values here are those found in TTDPatch */
 			const uint gradual_loading_wait_time[] = { 40, 20, 10, 20 };
@@ -1684,11 +1666,11 @@
 
 	/* Calculate the loading indicator fill percent and display
 	 * In the Game Menu do not display indicators
-	 * If _settings.gui.loading_indicators == 2, show indicators (bool can be promoted to int as 0 or 1 - results in 2 > 0,1 )
-	 * if _settings.gui.loading_indicators == 1, _local_player must be the owner or must be a spectator to show ind., so 1 > 0
-	 * if _settings.gui.loading_indicators == 0, do not display indicators ... 0 is never greater than anything
+	 * If _settings_client.gui.loading_indicators == 2, show indicators (bool can be promoted to int as 0 or 1 - results in 2 > 0,1 )
+	 * if _settings_client.gui.loading_indicators == 1, _local_player must be the owner or must be a spectator to show ind., so 1 > 0
+	 * if _settings_client.gui.loading_indicators == 0, do not display indicators ... 0 is never greater than anything
 	 */
-	if (_game_mode != GM_MENU && (_settings.gui.loading_indicators > (uint)(v->owner != _local_player && _local_player != PLAYER_SPECTATOR))) {
+	if (_game_mode != GM_MENU && (_settings_client.gui.loading_indicators > (uint)(v->owner != _local_player && _local_player != PLAYER_SPECTATOR))) {
 		StringID percent_up_down = STR_NULL;
 		int percent = CalcPercentVehicleFilled(v, &percent_up_down);
 		if (v->fill_percent_te_id == INVALID_TE_ID) {
@@ -1736,7 +1718,7 @@
 void PlayersMonthlyLoop()
 {
 	PlayersGenStatistics();
-	if (_settings.economy.inflation && _cur_year < MAX_YEAR)
+	if (_settings_game.economy.inflation && _cur_year < MAX_YEAR)
 		AddInflation();
 	PlayersPayInterest();
 	/* Reset the _current_player flag */
@@ -1802,7 +1784,7 @@
 
 	/* Check if buying shares is allowed (protection against modified clients) */
 	/* Cannot buy own shares */
-	if (!IsValidPlayer((PlayerID)p1) || !_settings.economy.allow_shares || _current_player == (PlayerID)p1) return CMD_ERROR;
+	if (!IsValidPlayer((PlayerID)p1) || !_settings_game.economy.allow_shares || _current_player == (PlayerID)p1) return CMD_ERROR;
 
 	p = GetPlayer((PlayerID)p1);
 
@@ -1851,7 +1833,7 @@
 
 	/* Check if selling shares is allowed (protection against modified clients) */
 	/* Cannot sell own shares */
-	if (!IsValidPlayer((PlayerID)p1) || !_settings.economy.allow_shares || _current_player == (PlayerID)p1) return CMD_ERROR;
+	if (!IsValidPlayer((PlayerID)p1) || !_settings_game.economy.allow_shares || _current_player == (PlayerID)p1) return CMD_ERROR;
 
 	p = GetPlayer((PlayerID)p1);
 
--- a/src/economy_type.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/economy_type.h	Tue Jun 17 10:32:49 2008 +0000
@@ -18,7 +18,7 @@
 	int fluct;
 	byte interest_rate;     ///< Interest
 	byte infl_amount;       ///< inflation amount
-	byte infl_amount_pr;    ///< "floating" portion of inflation
+	byte infl_amount_pr;    ///< inflation rate for payment rates
 };
 
 struct Subsidy {
--- a/src/effectvehicle.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/effectvehicle.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -25,7 +25,6 @@
 #include "industry_map.h"
 #include "station_map.h"
 #include "water_map.h"
-#include "network/network.h"
 #include "yapf/yapf.h"
 #include "newgrf_callbacks.h"
 #include "newgrf_engine.h"
--- a/src/elrail_func.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/elrail_func.h	Tue Jun 17 10:32:49 2008 +0000
@@ -25,7 +25,7 @@
  */
 static inline bool HasCatenaryDrawn(RailType rt)
 {
-	return HasCatenary(rt) && !IsInvisibilitySet(TO_CATENARY) && !_settings.vehicle.disable_elrails;
+	return HasCatenary(rt) && !IsInvisibilitySet(TO_CATENARY) && !_settings_game.vehicle.disable_elrails;
 }
 
 /**
@@ -37,6 +37,6 @@
 void DrawCatenaryOnTunnel(const TileInfo *ti);
 void DrawCatenaryOnBridge(const TileInfo *ti);
 
-int32 SettingsDisableElrail(int32 p1); ///< _settings.disable_elrail callback
+int32 SettingsDisableElrail(int32 p1); ///< _settings_game.disable_elrail callback
 
 #endif /* ELRAIL_FUNC_H */
--- a/src/engine.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/engine.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -28,7 +28,7 @@
 #include "oldpool_func.h"
 #include "core/alloc_func.hpp"
 #include "vehicle_func.h"
-#include "map"
+#include <map>
 
 #include "table/strings.h"
 #include "table/engines.h"
@@ -115,34 +115,6 @@
 	free(this->name);
 }
 
-/** Sort all items using qsort() and given 'CompareItems' function
- * @param el list to be sorted
- * @param compare function for evaluation of the quicksort
- */
-void EngList_Sort(EngineList *el, EngList_SortTypeFunction compare)
-{
-	size_t size = el->size();
-	/* out-of-bounds access at the next line for size == 0 (even with operator[] at some systems)
-	 * generally, do not sort if there are less than 2 items */
-	if (size < 2) return;
-	qsort(&((*el)[0]), size, sizeof(EngineID), compare); // MorphOS doesn't know vector::at(int) ...
-}
-
-/** Sort selected range of items (on indices @ <begin, begin+num_items-1>)
- * @param el list to be sorted
- * @param compare function for evaluation of the quicksort
- * @param begin start of sorting
- * @param num_items count of items to be sorted
- */
-void EngList_SortPartial(EngineList *el, EngList_SortTypeFunction compare, uint begin, uint num_items)
-{
-	assert(begin <= (uint)el->size());
-	assert(begin + num_items <= (uint)el->size());
-	if (num_items < 2) return;
-	qsort(&((*el)[begin]), num_items, sizeof(EngineID), compare);
-}
-
-
 /** Sets cached values in Player::num_vehicles and Group::num_vehicles
  */
 void SetCachedEngineCounts()
@@ -212,12 +184,19 @@
 	DEBUG(misc, 1, "LoadCustomEngineNames: not done");
 }
 
+/* Determine if an engine type is a wagon (and not a loco) */
+static bool IsWagon(EngineID index)
+{
+	const Engine *e = GetEngine(index);
+	return e->type == VEH_TRAIN && e->u.rail.railveh_type == RAILVEH_WAGON;
+}
+
 static void CalcEngineReliability(Engine *e)
 {
 	uint age = e->age;
 
 	/* Check for early retirement */
-	if (e->player_avail != 0 && !_settings.vehicle.never_expire_vehicles) {
+	if (e->player_avail != 0 && !_settings_game.vehicle.never_expire_vehicles) {
 		int retire_early = e->info.retire_early;
 		uint retire_early_max_age = max(0, e->duration_phase_1 + e->duration_phase_2 - retire_early * 12);
 		if (retire_early != 0 && age >= retire_early_max_age) {
@@ -230,7 +209,7 @@
 	if (age < e->duration_phase_1) {
 		uint start = e->reliability_start;
 		e->reliability = age * (e->reliability_max - start) / e->duration_phase_1 + start;
-	} else if ((age -= e->duration_phase_1) < e->duration_phase_2 || _settings.vehicle.never_expire_vehicles) {
+	} else if ((age -= e->duration_phase_1) < e->duration_phase_2 || _settings_game.vehicle.never_expire_vehicles) {
 		/* We are at the peak of this engines life. It will have max reliability.
 		 * This is also true if the engines never expire. They will not go bad over time */
 		e->reliability = e->reliability_max;
@@ -284,19 +263,18 @@
 		e->duration_phase_2 = GB(r, 5, 4) + ei->base_life * 12 - 96;
 		e->duration_phase_3 = GB(r, 9, 7) + 120;
 
-		e->reliability_spd_dec = (ei->unk2&0x7F) << 2;
+		e->reliability_spd_dec = ei->decay_speed << 2;
 
-		/* my invented flag for something that is a wagon */
-		if (ei->unk2 & 0x80) {
+		if (IsWagon(e->index)) {
 			e->age = 0xFFFF;
 		} else {
 			CalcEngineReliability(e);
 		}
 
-		e->lifelength = ei->lifelength + _settings.vehicle.extend_vehicle_life;
+		e->lifelength = ei->lifelength + _settings_game.vehicle.extend_vehicle_life;
 
 		/* prevent certain engines from ever appearing. */
-		if (!HasBit(ei->climates, _settings.game_creation.landscape)) {
+		if (!HasBit(ei->climates, _settings_game.game_creation.landscape)) {
 			e->flags |= ENGINE_AVAILABLE;
 			e->player_avail = 0;
 		}
@@ -405,13 +383,6 @@
 	return CommandCost();
 }
 
-/* Determine if an engine type is a wagon (and not a loco) */
-static bool IsWagon(EngineID index)
-{
-	const Engine *e = GetEngine(index);
-	return e->type == VEH_TRAIN && e->u.rail.railveh_type == RAILVEH_WAGON;
-}
-
 StringID GetEngineCategoryName(EngineID engine);
 
 static void NewVehicleAvailable(Engine *e)
--- a/src/engine_func.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/engine_func.h	Tue Jun 17 10:32:49 2008 +0000
@@ -29,8 +29,4 @@
 CargoID GetEngineCargoType(EngineID engine);
 void SetCachedEngineCounts();
 
-typedef int CDECL EngList_SortTypeFunction(const void*, const void*); ///< argument type for EngList_Sort()
-void EngList_Sort(EngineList *el, EngList_SortTypeFunction compare);  ///< qsort of the engine list
-void EngList_SortPartial(EngineList *el, EngList_SortTypeFunction compare, uint begin, uint num_items); ///< qsort of specified portion of the engine list
-
 #endif /* ENGINE_H */
--- a/src/engine_gui.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/engine_gui.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -15,6 +15,7 @@
 #include "variables.h"
 #include "newgrf_engine.h"
 #include "strings_func.h"
+#include "engine_gui.h"
 
 #include "table/strings.h"
 #include "table/sprites.h"
@@ -190,3 +191,32 @@
 	GfxFillRect(25, 56, w->width - 56, 112, PALETTE_TO_STRUCT_GREY | (1 << USE_COLORTABLE));
 	dei->info_proc(engine, w->width >> 1, 129, w->width - 52);
 }
+
+
+/** Sort all items using qsort() and given 'CompareItems' function
+ * @param el list to be sorted
+ * @param compare function for evaluation of the quicksort
+ */
+void EngList_Sort(GUIEngineList *el, EngList_SortTypeFunction compare)
+{
+	uint size = el->Length();
+	/* out-of-bounds access at the next line for size == 0 (even with operator[] at some systems)
+	 * generally, do not sort if there are less than 2 items */
+	if (size < 2) return;
+	qsort(el->Begin(), size, sizeof(*el->Begin()), compare); // MorphOS doesn't know vector::at(int) ...
+}
+
+/** Sort selected range of items (on indices @ <begin, begin+num_items-1>)
+ * @param el list to be sorted
+ * @param compare function for evaluation of the quicksort
+ * @param begin start of sorting
+ * @param num_items count of items to be sorted
+ */
+void EngList_SortPartial(GUIEngineList *el, EngList_SortTypeFunction compare, uint begin, uint num_items)
+{
+	if (num_items < 2) return;
+	assert(begin < el->Length());
+	assert(begin + num_items <= el->Length());
+	qsort(el->Get(begin), num_items, sizeof(*el->Begin()), compare);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/engine_gui.h	Tue Jun 17 10:32:49 2008 +0000
@@ -0,0 +1,16 @@
+/* $Id$ */
+
+/** @file engine_gui.h Engine GUI functions, used by build_vehicle_gui and autoreplace_gui */
+
+#ifndef ENGINE_GUI_H
+#define ENGINE_GUI_H
+
+#include "sortlist_type.h"
+
+typedef GUIList<EngineID> GUIEngineList;
+
+typedef int CDECL EngList_SortTypeFunction(const void*, const void*); ///< argument type for EngList_Sort()
+void EngList_Sort(GUIEngineList *el, EngList_SortTypeFunction compare);  ///< qsort of the engine list
+void EngList_SortPartial(GUIEngineList *el, EngList_SortTypeFunction compare, uint begin, uint num_items); ///< qsort of specified portion of the engine list
+
+#endif /* ENGINE_GUI_H */
--- a/src/engine_type.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/engine_type.h	Tue Jun 17 10:32:49 2008 +0000
@@ -14,11 +14,8 @@
 #include "player_type.h"
 #include "strings_type.h"
 
-#include <vector>
-
 typedef uint16 EngineID;
 typedef uint16 EngineRenewID;
-typedef std::vector<EngineID> EngineList; ///< engine list type
 
 struct Engine;
 
@@ -123,7 +120,7 @@
 	Date base_intro;
 	Year lifelength;
 	Year base_life;
-	byte unk2;         ///< flag for carriage(bit 7) and decay speed(bits0..6)
+	byte decay_speed;
 	byte load_amount;
 	byte climates;
 	uint32 refit_mask;
--- a/src/fiber_thread.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/fiber_thread.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -109,7 +109,7 @@
 	/**
 	 * First function which is called within the fiber.
 	 */
-	static void * CDECL stFiberProc(void *fiber)
+	static void stFiberProc(void *fiber)
 	{
 		Fiber_Thread *cur = (Fiber_Thread *)fiber;
 		/* Now suspend the thread until we get SwitchToFiber() for the first time */
@@ -124,8 +124,6 @@
 			s_main->m_sem->Set();
 			throw;
 		}
-
-		return NULL;
 	}
 };
 
--- a/src/fileio.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/fileio.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -43,7 +43,7 @@
 static Fio _fio;
 
 /* Get current position in file */
-uint32 FioGetPos()
+size_t FioGetPos()
 {
 	return _fio.pos + (_fio.buffer - _fio.buffer_end);
 }
@@ -53,7 +53,7 @@
 	return _fio.shortnames[slot];
 }
 
-void FioSeekTo(uint32 pos, int mode)
+void FioSeekTo(size_t pos, int mode)
 {
 	if (mode == SEEK_CUR) pos += FioGetPos();
 	_fio.buffer = _fio.buffer_end = _fio.buffer_start + FIO_BUFFER_SIZE;
@@ -74,7 +74,7 @@
 #endif /* LIMITED_FDS */
 
 /* Seek to a file and a position */
-void FioSeekToFile(uint8 slot, uint32 pos)
+void FioSeekToFile(uint8 slot, size_t pos)
 {
 	FILE *f;
 #if defined(LIMITED_FDS)
@@ -186,7 +186,7 @@
 	FioFreeHandle();
 #endif /* LIMITED_FDS */
 	f = FioFOpenFile(filename);
-	if (f == NULL) error("Cannot open file '%s'", filename);
+	if (f == NULL) usererror("Cannot open file '%s'", filename);
 	uint32 pos = ftell(f);
 
 	FioCloseFile(slot); // if file was opened before, close it
--- a/src/fileio.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/fileio.h	Tue Jun 17 10:32:49 2008 +0000
@@ -9,9 +9,9 @@
 #include <string>
 #include "core/enum_type.hpp"
 
-void FioSeekTo(uint32 pos, int mode);
-void FioSeekToFile(uint8 slot, uint32 pos);
-uint32 FioGetPos();
+void FioSeekTo(size_t pos, int mode);
+void FioSeekToFile(uint8 slot, size_t pos);
+size_t FioGetPos();
 const char *FioGetFilename(uint8 slot);
 byte FioReadByte();
 uint16 FioReadWord();
--- a/src/fios.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/fios.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -10,7 +10,6 @@
 #include "heightmap.h"
 #include "fios.h"
 #include "fileio.h"
-#include "core/alloc_func.hpp"
 #include "functions.h"
 #include "string_func.h"
 #include <sys/types.h>
@@ -30,12 +29,9 @@
 #include "table/strings.h"
 
 /* Variables to display file lists */
-int _fios_num;
-
+SmallVector<FiosItem, 32> _fios_items;
 static char *_fios_path;
-static FiosItem *_fios_items;
 SmallFiosItem _file_to_saveload;
-static int _fios_count, _fios_alloc;
 
 /* OS-specific functions are taken from their respective files (win32/unix/os2 .c) */
 extern bool FiosIsRoot(const char *path);
@@ -48,19 +44,6 @@
 extern void GetOldSaveGameName(char *title, const char *path, const char *file);
 
 /**
- * Allocate a new FiosItem.
- * @return A pointer to the newly allocated FiosItem.
- */
-FiosItem *FiosAlloc()
-{
-	if (_fios_count == _fios_alloc) {
-		_fios_alloc += 256;
-		_fios_items = ReallocT(_fios_items, _fios_alloc);
-	}
-	return &_fios_items[_fios_count++];
-}
-
-/**
  * Compare two FiosItem's. Used with qsort when sorting the file list.
  * @param a A pointer to the first FiosItem to compare.
  * @param b A pointer to the second FiosItem to compare.
@@ -82,15 +65,12 @@
 	return r;
 }
 
-/**
- * Free the list of savegames
- */
+/** Clear the list */
 void FiosFreeSavegameList()
 {
-	free(_fios_items);
-	_fios_items = NULL;
-	_fios_alloc = _fios_count = 0;
-}
+	_fios_items.Clear();
+	_fios_items.Compact();
+};
 
 /**
  * Get descriptive texts. Returns the path and free space
@@ -229,9 +209,11 @@
 	int sort_start;
 	char d_name[sizeof(fios->name)];
 
+	_fios_items.Clear();
+
 	/* A parent directory link exists if we are not in the root directory */
 	if (!FiosIsRoot(_fios_path) && mode != SLD_NEW_GAME) {
-		fios = FiosAlloc();
+		fios = _fios_items.Append();
 		fios->type = FIOS_TYPE_PARENT;
 		fios->mtime = 0;
 		ttd_strlcpy(fios->name, "..", lengthof(fios->name));
@@ -247,7 +229,7 @@
 			if (FiosIsValidFile(_fios_path, dirent, &sb) && (sb.st_mode & S_IFDIR) &&
 					(!FiosIsHiddenFile(dirent) || strncasecmp(d_name, PERSONAL_DIR, strlen(d_name)) == 0) &&
 					strcmp(d_name, ".") != 0 && strcmp(d_name, "..") != 0) {
-				fios = FiosAlloc();
+				fios = _fios_items.Append();
 				fios->type = FIOS_TYPE_DIR;
 				fios->mtime = 0;
 				ttd_strlcpy(fios->name, d_name, lengthof(fios->name));
@@ -262,12 +244,12 @@
 	{
 		byte order = _savegame_sort_order;
 		_savegame_sort_order = SORT_BY_NAME | SORT_ASCENDING;
-		qsort(_fios_items, _fios_count, sizeof(FiosItem), compare_FiosItems);
+		qsort(_fios_items.Begin(), _fios_items.Length(), sizeof(FiosItem), compare_FiosItems);
 		_savegame_sort_order = order;
 	}
 
 	/* This is where to start sorting for the filenames */
-	sort_start = _fios_count;
+	sort_start = _fios_items.Length();
 
 	/* Show files */
 	dir = ttd_opendir(_fios_path);
@@ -285,7 +267,7 @@
 
 			FiosType type = callback_proc(mode, d_name, t, fios_title);
 			if (type != FIOS_TYPE_INVALID) {
-				fios = FiosAlloc();
+				fios = _fios_items.Append();
 				fios->mtime = sb.st_mtime;
 				fios->type = type;
 				ttd_strlcpy(fios->name, d_name, lengthof(fios->name));
@@ -300,13 +282,14 @@
 		closedir(dir);
 	}
 
-	qsort(_fios_items + sort_start, _fios_count - sort_start, sizeof(FiosItem), compare_FiosItems);
+	qsort(_fios_items.Get(sort_start), _fios_items.Length() - sort_start, sizeof(FiosItem), compare_FiosItems);
 
 	/* Show drives */
 	if (mode != SLD_NEW_GAME) FiosGetDrives();
 
-	_fios_num = _fios_count;
-	return _fios_items;
+	_fios_items.Compact();
+
+	return _fios_items.Begin();
 }
 
 /**
@@ -345,7 +328,7 @@
  * @return A pointer to an array of FiosItem representing all the files to be shown in the save/load dialog.
  * @see FiosGetFileList
  */
-FiosItem *FiosGetSavegameList(SaveLoadDialogMode mode)
+void FiosGetSavegameList(SaveLoadDialogMode mode)
 {
 	static char *fios_save_path = NULL;
 
@@ -356,7 +339,7 @@
 
 	_fios_path = fios_save_path;
 
-	return FiosGetFileList(mode, &FiosGetSavegameListCallback);
+	FiosGetFileList(mode, &FiosGetSavegameListCallback);
 }
 
 /**
@@ -393,7 +376,7 @@
  * @return A pointer to an array of FiosItem representing all the files to be shown in the save/load dialog.
  * @see FiosGetFileList
  */
-FiosItem *FiosGetScenarioList(SaveLoadDialogMode mode)
+void FiosGetScenarioList(SaveLoadDialogMode mode)
 {
 	static char *fios_scn_path = NULL;
 
@@ -405,7 +388,7 @@
 
 	_fios_path = fios_scn_path;
 
-	return FiosGetFileList(mode, &FiosGetScenarioListCallback);
+	FiosGetFileList(mode, &FiosGetScenarioListCallback);
 }
 
 static FiosType FiosGetHeightmapListCallback(SaveLoadDialogMode mode, const char *file, const char *ext, char *title)
@@ -425,7 +408,7 @@
 }
 
 /* Get a list of Heightmaps */
-FiosItem *FiosGetHeightmapList(SaveLoadDialogMode mode)
+void FiosGetHeightmapList(SaveLoadDialogMode mode)
 {
 	static char *fios_hmap_path = NULL;
 
@@ -436,5 +419,5 @@
 
 	_fios_path = fios_hmap_path;
 
-	return FiosGetFileList(mode, &FiosGetHeightmapListCallback);
+	FiosGetFileList(mode, &FiosGetHeightmapListCallback);
 }
--- a/src/fios.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/fios.h	Tue Jun 17 10:32:49 2008 +0000
@@ -6,6 +6,7 @@
 #define FIOS_H
 
 #include "strings_type.h"
+#include "misc/smallvec.h"
 
 enum {
 	/**
@@ -72,21 +73,28 @@
 	char title[255];      ///< internal name of the game
 };
 
+enum {
+	SORT_ASCENDING  = 0,
+	SORT_DESCENDING = 1,
+	SORT_BY_DATE    = 0,
+	SORT_BY_NAME    = 2
+};
+
 /* Variables to display file lists */
-extern FiosItem *_fios_list; ///< defined in misc_gui.cpp
-extern int _fios_num;        ///< defined in fios.cpp, read_only version of _fios_count
+extern SmallVector<FiosItem, 32> _fios_items; ///< defined in fios.cpp
 extern SmallFiosItem _file_to_saveload;
 extern SaveLoadDialogMode _saveload_mode;   ///< defined in misc_gui.cpp
+extern byte _savegame_sort_order;
 
 /* Launch save/load dialog */
 void ShowSaveLoadDialog(SaveLoadDialogMode mode);
 
 /* Get a list of savegames */
-FiosItem *FiosGetSavegameList(SaveLoadDialogMode mode);
+void FiosGetSavegameList(SaveLoadDialogMode mode);
 /* Get a list of scenarios */
-FiosItem *FiosGetScenarioList(SaveLoadDialogMode mode);
+void FiosGetScenarioList(SaveLoadDialogMode mode);
 /* Get a list of Heightmaps */
-FiosItem *FiosGetHeightmapList(SaveLoadDialogMode mode);
+void FiosGetHeightmapList(SaveLoadDialogMode mode);
 /* Free the list of savegames */
 void FiosFreeSavegameList();
 /* Browse to. Returns a filename w/path if we reached a file. */
@@ -97,8 +105,6 @@
 bool FiosDelete(const char *name);
 /* Make a filename from a name */
 void FiosMakeSavegameName(char *buf, const char *name, size_t size);
-/* Allocate a new FiosItem */
-FiosItem *FiosAlloc();
 
 int CDECL compare_FiosItems(const void *a, const void *b);
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gamelog.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -0,0 +1,801 @@
+/* $Id$ */
+
+/** @file gamelog.cpp Definition of functions used for logging of important changes in the game */
+
+#include "stdafx.h"
+#include "openttd.h"
+#include "saveload.h"
+#include "core/alloc_func.hpp"
+#include "core/bitmath_func.hpp"
+#include "core/math_func.hpp"
+#include "network/core/config.h"
+#include "variables.h"
+#include "string_func.h"
+#include "settings_type.h"
+#include "newgrf_config.h"
+#include <string.h>
+#include <stdarg.h>
+#include "gamelog.h"
+#include "console_func.h"
+#include "debug.h"
+#include "rev.h"
+
+extern const uint16 SAVEGAME_VERSION;  ///< current savegame version
+
+extern SavegameType _savegame_type; ///< type of savegame we are loading
+
+extern uint32 _ttdp_version;     ///< version of TTDP savegame (if applicable)
+extern uint16 _sl_version;       ///< the major savegame version identifier
+extern byte   _sl_minor_version; ///< the minor savegame version, DO NOT USE!
+
+/** Type of logged change */
+enum GamelogChangeType {
+	GLCT_MODE,        ///< Scenario editor x Game, different landscape
+	GLCT_REVISION,    ///< Changed game revision string
+	GLCT_OLDVER,      ///< Loaded from savegame without logged data
+	GLCT_PATCH,       ///< Non-networksafe patch value changed
+	GLCT_GRFADD,      ///< Removed GRF
+	GLCT_GRFREM,      ///< Added GRF
+	GLCT_GRFCOMPAT,   ///< Loading compatible GRF
+	GLCT_GRFPARAM,    ///< GRF parameter changed
+	GLCT_GRFMOVE,     ///< GRF order changed
+	GLCT_END,         ///< So we know how many GLCTs are there
+	GLCT_NONE = 0xFF, ///< In savegames, end of list
+};
+
+
+/** Contains information about one logged change */
+struct LoggedChange {
+	GamelogChangeType ct; ///< Type of change logged in this struct
+	union {
+		struct {
+			byte mode;       ///< new game mode - Editor x Game
+			byte landscape;  ///< landscape (temperate, arctic, ...)
+		} mode;
+		struct {
+			char text[NETWORK_REVISION_LENGTH]; ///< revision string, _openttd_revision
+			uint32 newgrf;   ///< _openttd_newgrf_version
+			uint16 slver;    ///< _sl_version
+			byte modified;   ///< _openttd_revision_modified
+		} revision;
+		struct {
+			uint32 type;     ///< type of savegame, @see SavegameType
+			uint32 version;  ///< major and minor version OR ttdp version
+		} oldver;
+		GRFIdentifier grfadd;    ///< ID and md5sum of added GRF
+		struct {
+			uint32 grfid;    ///< ID of removed GRF
+		} grfrem;
+		GRFIdentifier grfcompat; ///< ID and new md5sum of changed GRF
+		struct {
+			uint32 grfid;    ///< ID of GRF with changed parameters
+		} grfparam;
+		struct {
+			uint32 grfid;    ///< ID of moved GRF
+			int32 offset;    ///< offset, positive = move down
+		} grfmove;
+		struct {
+			char *name;      ///< name of the patch
+			int32 oldval;    ///< old value
+			int32 newval;    ///< new value
+		} patch;
+	};
+};
+
+
+/** Contains information about one logged action that caused at least one logged change */
+struct LoggedAction {
+	LoggedChange *change; ///< First logged change in this action
+	uint32 changes;       ///< Number of changes in this action
+	GamelogActionType at; ///< Type of action
+	uint16 tick;          ///< Tick when it happened
+};
+
+static GamelogActionType _gamelog_action_type = GLAT_NONE; ///< action to record if anything changes
+
+static LoggedAction *_gamelog_action = NULL; ///< first logged action
+static uint _gamelog_actions         = 0;    ///< number of actions
+static LoggedAction *_current_action = NULL; ///< current action we are logging, NULL when there is no action active
+
+
+/** Stores information about new action, but doesn't allocate it
+ * Action is allocated only when there is at least one change
+ * @param at type of action
+ */
+void GamelogStartAction(GamelogActionType at)
+{
+	assert(_gamelog_action_type == GLAT_NONE); // do not allow starting new action without stopping the previous first
+	_gamelog_action_type = at;
+}
+
+/** Stops logging of any changes
+ */
+void GamelogStopAction()
+{
+	assert(_gamelog_action_type != GLAT_NONE); // nobody should try to stop if there is no action in progress
+
+	_current_action = NULL;
+	_gamelog_action_type = GLAT_NONE;
+
+	if (_debug_gamelog_level > 4) GamelogPrintDebug();
+}
+
+/** Resets and frees all memory allocated - used before loading or starting a new game
+ */
+void GamelogReset()
+{
+	assert(_gamelog_action_type == GLAT_NONE);
+
+	for (uint i = 0; i < _gamelog_actions; i++) {
+		const LoggedAction *la = &_gamelog_action[i];
+		for (uint j = 0; j < la->changes; j++) {
+			const LoggedChange *lc = &la->change[j];
+			if (lc->ct == GLCT_PATCH) free(lc->patch.name);
+		}
+		free(la->change);
+	}
+
+	free(_gamelog_action);
+
+	_gamelog_action  = NULL;
+	_gamelog_actions = 0;
+	_current_action  = NULL;
+}
+
+enum {
+	GAMELOG_BUF_LEN = 1024 ///< length of buffer for one line of text
+};
+
+static int _dbgofs = 0; ///< offset in current output buffer
+
+static void AddDebugText(char *buf, const char *s, ...)
+{
+	if (GAMELOG_BUF_LEN <= _dbgofs) return;
+
+	va_list va;
+
+	va_start(va, s);
+	_dbgofs += vsnprintf(buf + _dbgofs, GAMELOG_BUF_LEN - _dbgofs, s, va);
+	va_end(va);
+}
+
+
+/** Prints GRF filename if found
+ * @param grfid GRF which filename to print
+ */
+static void PrintGrfFilename(char *buf, uint grfid)
+{
+	const GRFConfig *gc = FindGRFConfig(grfid);
+
+	if (gc == NULL) return;
+
+	AddDebugText(buf, ", filename: %s", gc->filename);
+}
+
+/** Prints GRF ID, checksum and filename if found
+ * @param grfid GRF ID
+ * @param md5sum array of md5sum to print
+ */
+static void PrintGrfInfo(char *buf, uint grfid, const uint8 *md5sum)
+{
+	char txt[40];
+
+	md5sumToString(txt, lastof(txt), md5sum);
+
+	AddDebugText(buf, "GRF ID %08X, checksum %s", BSWAP32(grfid), txt);
+
+	PrintGrfFilename(buf, grfid);
+
+	return;
+}
+
+
+/** Text messages for various logged actions */
+static const char *la_text[] = {
+	"new game started",
+	"game loaded",
+	"GRF config changed",
+	"cheat was used",
+	"patch settings changed"
+};
+
+assert_compile(lengthof(la_text) == GLAT_END);
+
+
+/** Prints active gamelog */
+void GamelogPrint(GamelogPrintProc *proc)
+{
+	char buf[GAMELOG_BUF_LEN];
+
+	proc("---- gamelog start ----");
+
+	const LoggedAction *laend = &_gamelog_action[_gamelog_actions];
+
+	for (const LoggedAction *la = _gamelog_action; la != laend; la++) {
+		assert((uint)la->at < GLAT_END);
+
+		snprintf(buf, GAMELOG_BUF_LEN, "Tick %u: %s", (uint)la->tick, la_text[(uint)la->at]);
+		proc(buf);
+
+		const LoggedChange *lcend = &la->change[la->changes];
+
+		for (const LoggedChange *lc = la->change; lc != lcend; lc++) {
+			_dbgofs = 0;
+			AddDebugText(buf, "     ");
+
+			switch (lc->ct) {
+				default: NOT_REACHED();
+				case GLCT_MODE:
+					AddDebugText(buf, "New game mode: %u landscape: %u",
+						(uint)lc->mode.mode, (uint)lc->mode.landscape);
+					break;
+
+				case GLCT_REVISION:
+					AddDebugText(buf, "Revision text changed to %s, savegame version %u, ",
+						lc->revision.text, lc->revision.slver);
+
+					switch (lc->revision.modified) {
+						case 0: AddDebugText(buf, "not "); break;
+						case 1: AddDebugText(buf, "maybe "); break;
+						default: break;
+					}
+
+					AddDebugText(buf, "modified, _openttd_newgrf_version = 0x%08x", lc->revision.newgrf);
+					break;
+
+				case GLCT_OLDVER:
+					AddDebugText(buf, "Conversion from ");
+					switch (lc->oldver.type) {
+						default: NOT_REACHED();
+						case SGT_OTTD:
+							AddDebugText(buf, "OTTD savegame without gamelog: version %u, %u",
+								GB(lc->oldver.version, 8, 16), GB(lc->oldver.version, 0, 8));
+							break;
+
+						case SGT_TTD:
+							AddDebugText(buf, "TTD savegame");
+							break;
+
+						case SGT_TTDP1:
+						case SGT_TTDP2:
+							AddDebugText(buf, "TTDP savegame, %s format",
+								lc->oldver.type == SGT_TTDP1 ? "old" : "new");
+							if (lc->oldver.version != 0) {
+								AddDebugText(buf, ", TTDP version %u.%u.%u.%u",
+									GB(lc->oldver.version, 24, 8), GB(lc->oldver.version, 20, 4),
+									GB(lc->oldver.version, 16, 4), GB(lc->oldver.version, 0, 16));
+							}
+							break;
+					}
+					break;
+
+				case GLCT_PATCH:
+					AddDebugText(buf, "Patch setting changed: %s : %d -> %d", lc->patch.name, lc->patch.oldval, lc->patch.newval);
+					break;
+
+				case GLCT_GRFADD:
+					AddDebugText(buf, "Added NewGRF: ");
+					PrintGrfInfo(buf, lc->grfadd.grfid, lc->grfadd.md5sum);
+					break;
+
+				case GLCT_GRFREM:
+					AddDebugText(buf, "Removed NewGRF: %08X", BSWAP32(lc->grfrem.grfid));
+					PrintGrfFilename(buf, lc->grfrem.grfid);
+					break;
+
+				case GLCT_GRFCOMPAT:
+					AddDebugText(buf, "Compatible NewGRF loaded: ");
+					PrintGrfInfo(buf, lc->grfcompat.grfid, lc->grfcompat.md5sum);
+					break;
+
+				case GLCT_GRFPARAM:
+					AddDebugText(buf, "GRF parameter changed: %08X", BSWAP32(lc->grfparam.grfid));
+					PrintGrfFilename(buf, lc->grfparam.grfid);
+					break;
+
+				case GLCT_GRFMOVE:
+					AddDebugText(buf, "GRF order changed: %08X moved %d places %s",
+						BSWAP32(lc->grfmove.grfid), abs(lc->grfmove.offset), lc->grfmove.offset >= 0 ? "down" : "up" );
+					PrintGrfFilename(buf, lc->grfmove.grfid);
+					break;
+			}
+
+			proc(buf);
+		}
+	}
+
+	proc("---- gamelog end ----");
+}
+
+
+static void GamelogPrintConsoleProc(const char *s)
+{
+	IConsolePrint(CC_WARNING, s);
+}
+
+void GamelogPrintConsole()
+{
+	GamelogPrint(&GamelogPrintConsoleProc);
+}
+
+
+static void GamelogPrintDebugProc(const char *s)
+{
+	debug_print("gamelog", s);
+}
+
+void GamelogPrintDebug()
+{
+	GamelogPrint(&GamelogPrintDebugProc);
+}
+
+
+/** Allocates new LoggedChange and new LoggedAction if needed.
+ * If there is no action active, NULL is returned.
+ * @param ct type of change
+ * @return new LoggedChange, or NULL if there is no action active
+ */
+static LoggedChange *GamelogChange(GamelogChangeType ct)
+{
+	if (_current_action == NULL) {
+		if (_gamelog_action_type == GLAT_NONE) return NULL;
+
+		_gamelog_action  = ReallocT(_gamelog_action, _gamelog_actions + 1);
+		_current_action  = &_gamelog_action[_gamelog_actions++];
+
+		_current_action->at      = _gamelog_action_type;
+		_current_action->tick    = _tick_counter;
+		_current_action->change  = NULL;
+		_current_action->changes = 0;
+	}
+
+	_current_action->change = ReallocT(_current_action->change, _current_action->changes + 1);
+
+	LoggedChange *lc = &_current_action->change[_current_action->changes++];
+	lc->ct = ct;
+
+	return lc;
+}
+
+
+/** Logs a change in game revision
+ * @param revision new revision string
+ */
+void GamelogRevision()
+{
+	assert(_gamelog_action_type == GLAT_START || _gamelog_action_type == GLAT_LOAD);
+
+	LoggedChange *lc = GamelogChange(GLCT_REVISION);
+	if (lc == NULL) return;
+
+	strncpy(lc->revision.text, _openttd_revision, lengthof(lc->revision.text));
+	lc->revision.slver = SAVEGAME_VERSION;
+	lc->revision.modified = _openttd_revision_modified;
+	lc->revision.newgrf = _openttd_newgrf_version;
+}
+
+/** Logs a change in game mode (scenario editor or game)
+ */
+void GamelogMode()
+{
+	assert(_gamelog_action_type == GLAT_START || _gamelog_action_type == GLAT_LOAD || _gamelog_action_type == GLAT_CHEAT);
+
+	LoggedChange *lc = GamelogChange(GLCT_MODE);
+	if (lc == NULL) return;
+
+	lc->mode.mode      = _game_mode;
+	lc->mode.landscape = _settings_game.game_creation.landscape;
+}
+
+/** Logs loading from savegame without gamelog
+ */
+void GamelogOldver()
+{
+	assert(_gamelog_action_type == GLAT_LOAD);
+
+	LoggedChange *lc = GamelogChange(GLCT_OLDVER);
+	if (lc == NULL) return;
+
+	lc->oldver.type = _savegame_type;
+	lc->oldver.version = (_savegame_type == SGT_OTTD ? ((uint32)_sl_version << 8 | _sl_minor_version) : _ttdp_version);
+}
+
+/** Logs change in game patches. Only non-networksafe patches are logged
+ * @param name patch name
+ * @param oldval old patch value
+ * @param newval new patch value
+ */
+void GamelogPatch(const char *name, int32 oldval, int32 newval)
+{
+	assert(_gamelog_action_type == GLAT_PATCH);
+
+	LoggedChange *lc = GamelogChange(GLCT_PATCH);
+	if (lc == NULL) return;
+
+	lc->patch.name = strdup(name);
+	lc->patch.oldval = oldval;
+	lc->patch.newval = newval;
+}
+
+
+/** Finds out if current revision is different than last revision stored in the savegame.
+ * Appends GLCT_REVISION when the revision string changed
+ */
+void GamelogTestRevision()
+{
+	const LoggedChange *rev = NULL;
+
+	const LoggedAction *laend = &_gamelog_action[_gamelog_actions];
+	for (const LoggedAction *la = _gamelog_action; la != laend; la++) {
+		const LoggedChange *lcend = &la->change[la->changes];
+		for (const LoggedChange *lc = la->change; lc != lcend; lc++) {
+			if (lc->ct == GLCT_REVISION) rev = lc;
+		}
+	}
+
+	if (rev == NULL || strcmp(rev->revision.text, _openttd_revision) != 0 ||
+			rev->revision.modified != _openttd_revision_modified ||
+			rev->revision.newgrf != _openttd_newgrf_version) {
+		GamelogRevision();
+	}
+}
+
+/** Finds last stored game mode or landscape.
+ * Any change is logged
+ */
+void GamelogTestMode()
+{
+	const LoggedChange *mode = NULL;
+
+	const LoggedAction *laend = &_gamelog_action[_gamelog_actions];
+	for (const LoggedAction *la = _gamelog_action; la != laend; la++) {
+		const LoggedChange *lcend = &la->change[la->changes];
+		for (const LoggedChange *lc = la->change; lc != lcend; lc++) {
+			if (lc->ct == GLCT_MODE) mode = lc;
+		}
+	}
+
+	if (mode == NULL || mode->mode.mode != _game_mode || mode->mode.landscape != _settings_game.game_creation.landscape) GamelogMode();
+}
+
+
+/** Decides if GRF should be logged
+ * @param g grf to determine
+ * @return true iff GRF is not static and is loaded
+ */
+static inline bool IsLoggableGrfConfig(const GRFConfig *g)
+{
+	return !HasBit(g->flags, GCF_STATIC) && g->status != GCS_NOT_FOUND;
+}
+
+/** Logs removal of a GRF
+ * @param grfid ID of removed GRF
+ */
+void GamelogGRFRemove(uint32 grfid)
+{
+	assert(_gamelog_action_type == GLAT_LOAD || _gamelog_action_type == GLAT_GRF);
+
+	LoggedChange *lc = GamelogChange(GLCT_GRFREM);
+	if (lc == NULL) return;
+
+	lc->grfrem.grfid = grfid;
+}
+
+/** Logs adding of a GRF
+ * @param newg added GRF
+ */
+void GamelogGRFAdd(const GRFConfig *newg)
+{
+	assert(_gamelog_action_type == GLAT_LOAD || _gamelog_action_type == GLAT_START || _gamelog_action_type == GLAT_GRF);
+
+	if (!IsLoggableGrfConfig(newg)) return;
+
+	LoggedChange *lc = GamelogChange(GLCT_GRFADD);
+	if (lc == NULL) return;
+
+	memcpy(&lc->grfadd, newg, sizeof(GRFIdentifier));
+}
+
+/** Logs loading compatible GRF
+ * (the same ID, but different MD5 hash)
+ * @param newg new (updated) GRF
+ */
+void GamelogGRFCompatible(const GRFIdentifier *newg)
+{
+	assert(_gamelog_action_type == GLAT_LOAD || _gamelog_action_type == GLAT_GRF);
+
+	LoggedChange *lc = GamelogChange(GLCT_GRFCOMPAT);
+	if (lc == NULL) return;
+
+	memcpy(&lc->grfcompat, newg, sizeof(GRFIdentifier));
+}
+
+/** Logs changing GRF order
+ * @param grfid GRF that is moved
+ * @param offset how far it is moved, positive = moved down
+ */
+static void GamelogGRFMove(uint32 grfid, int32 offset)
+{
+	assert(_gamelog_action_type == GLAT_GRF);
+
+	LoggedChange *lc = GamelogChange(GLCT_GRFMOVE);
+	if (lc == NULL) return;
+
+	lc->grfmove.grfid  = grfid;
+	lc->grfmove.offset = offset;
+}
+
+/** Logs change in GRF parameters.
+ * Details about parameters changed are not stored
+ * @param grfid ID of GRF to store
+ */
+static void GamelogGRFParameters(uint32 grfid)
+{
+	assert(_gamelog_action_type == GLAT_GRF);
+
+	LoggedChange *lc = GamelogChange(GLCT_GRFPARAM);
+	if (lc == NULL) return;
+
+	lc->grfparam.grfid = grfid;
+}
+
+/** Logs adding of list of GRFs.
+ * Useful when old savegame is loaded or when new game is started
+ * @param newg head of GRF linked list
+ */
+void GamelogGRFAddList(const GRFConfig *newg)
+{
+	assert(_gamelog_action_type == GLAT_START || _gamelog_action_type == GLAT_LOAD);
+
+	for (; newg != NULL; newg = newg->next) {
+		GamelogGRFAdd(newg);
+	}
+}
+
+/** List of GRFs using array of pointers instead of linked list */
+struct GRFList {
+	uint n;
+	const GRFConfig *grf[VARARRAY_SIZE];
+};
+
+/** Generates GRFList
+ * @param grfc head of GRF linked list
+ */
+static GRFList *GenerateGRFList(const GRFConfig *grfc)
+{
+	uint n = 0;
+	for (const GRFConfig *g = grfc; g != NULL; g = g->next) {
+		if (IsLoggableGrfConfig(g)) n++;
+	}
+
+	GRFList *list = (GRFList*)MallocT<byte>(sizeof(GRFList) + n * sizeof(GRFConfig*));
+
+	list->n = 0;
+	for (const GRFConfig *g = grfc; g != NULL; g = g->next) {
+		if (IsLoggableGrfConfig(g)) list->grf[list->n++] = g;
+	}
+
+	return list;
+}
+
+/** Compares two NewGRF lists and logs any change
+ * @param oldc original GRF list
+ * @param newc new GRF list
+ */
+void GamelogGRFUpdate(const GRFConfig *oldc, const GRFConfig *newc)
+{
+	GRFList *ol = GenerateGRFList(oldc);
+	GRFList *nl = GenerateGRFList(newc);
+
+	uint o = 0, n = 0;
+
+	while (o < ol->n && n < nl->n) {
+		const GRFConfig *og = ol->grf[o];
+		const GRFConfig *ng = nl->grf[n];
+
+		if (og->grfid != ng->grfid) {
+			uint oi, ni;
+			for (oi = 0; oi < ol->n; oi++) {
+				if (ol->grf[oi]->grfid == nl->grf[n]->grfid) break;
+			}
+			if (oi < o) {
+				/* GRF was moved, this change has been logged already */
+				n++;
+				continue;
+			}
+			if (oi == ol->n) {
+				/* GRF couldn't be found in the OLD list, GRF was ADDED */
+				GamelogGRFAdd(nl->grf[n++]);
+				continue;
+			}
+			for (ni = 0; ni < nl->n; ni++) {
+				if (nl->grf[ni]->grfid == ol->grf[o]->grfid) break;
+			}
+			if (ni < n) {
+				/* GRF was moved, this change has been logged already */
+				o++;
+				continue;
+			}
+			if (ni == nl->n) {
+				/* GRF couldn't be found in the NEW list, GRF was REMOVED */
+				GamelogGRFRemove(ol->grf[o++]->grfid);
+				continue;
+			}
+
+			/* o < oi < ol->n
+			 * n < ni < nl->n */
+			assert(ni > n && ni < nl->n);
+			assert(oi > o && oi < ol->n);
+
+			ni -= n; // number of GRFs it was moved downwards
+			oi -= o; // number of GRFs it was moved upwards
+
+			if (ni >= oi) { // prefer the one that is moved further
+				/* GRF was moved down */
+				GamelogGRFMove(ol->grf[o++]->grfid, ni);
+			} else {
+				GamelogGRFMove(nl->grf[n++]->grfid, -(int)oi);
+			}
+		} else {
+			if (memcmp(og->md5sum, ng->md5sum, sizeof(og->md5sum)) != 0) {
+				/* md5sum changed, probably loading 'compatible' GRF */
+				GamelogGRFCompatible(nl->grf[n]);
+			}
+
+			if (og->num_params != ng->num_params || memcmp(og->param, ng->param, og->num_params * sizeof(og->param[0])) != 0) {
+				GamelogGRFParameters(ol->grf[o]->grfid);
+			}
+
+			o++;
+			n++;
+		}
+	}
+
+	while (o < ol->n) GamelogGRFRemove(ol->grf[o++]->grfid); // remaining GRFs were removed ...
+	while (n < nl->n) GamelogGRFAdd   (nl->grf[n++]);    // ... or added
+
+	free(ol);
+	free(nl);
+}
+
+
+static const SaveLoad _glog_action_desc[] = {
+	SLE_VAR(LoggedAction, tick,              SLE_UINT16),
+	SLE_END()
+};
+
+static const SaveLoad _glog_mode_desc[] = {
+	SLE_VAR(LoggedChange, mode.mode,         SLE_UINT8),
+	SLE_VAR(LoggedChange, mode.landscape,    SLE_UINT8),
+	SLE_END()
+};
+
+static const SaveLoad _glog_revision_desc[] = {
+	SLE_ARR(LoggedChange, revision.text,     SLE_UINT8,  NETWORK_REVISION_LENGTH),
+	SLE_VAR(LoggedChange, revision.newgrf,   SLE_UINT32),
+	SLE_VAR(LoggedChange, revision.slver,    SLE_UINT16),
+	SLE_VAR(LoggedChange, revision.modified, SLE_UINT8),
+	SLE_END()
+};
+
+static const SaveLoad _glog_oldver_desc[] = {
+	SLE_VAR(LoggedChange, oldver.type,       SLE_UINT32),
+	SLE_VAR(LoggedChange, oldver.version,    SLE_UINT32),
+	SLE_END()
+};
+
+static const SaveLoad _glog_patch_desc[] = {
+	SLE_STR(LoggedChange, patch.name,        SLE_STR,    128),
+	SLE_VAR(LoggedChange, patch.oldval,      SLE_INT32),
+	SLE_VAR(LoggedChange, patch.newval,      SLE_INT32),
+	SLE_END()
+};
+
+static const SaveLoad _glog_grfadd_desc[] = {
+	SLE_VAR(LoggedChange, grfadd.grfid,      SLE_UINT32    ),
+	SLE_ARR(LoggedChange, grfadd.md5sum,     SLE_UINT8,  16),
+	SLE_END()
+};
+
+static const SaveLoad _glog_grfrem_desc[] = {
+	SLE_VAR(LoggedChange, grfrem.grfid,      SLE_UINT32),
+	SLE_END()
+};
+
+static const SaveLoad _glog_grfcompat_desc[] = {
+	SLE_VAR(LoggedChange, grfcompat.grfid,   SLE_UINT32    ),
+	SLE_ARR(LoggedChange, grfcompat.md5sum,  SLE_UINT8,  16),
+	SLE_END()
+};
+
+static const SaveLoad _glog_grfparam_desc[] = {
+	SLE_VAR(LoggedChange, grfparam.grfid,    SLE_UINT32),
+	SLE_END()
+};
+
+static const SaveLoad _glog_grfmove_desc[] = {
+	SLE_VAR(LoggedChange, grfmove.grfid,    SLE_UINT32),
+	SLE_VAR(LoggedChange, grfmove.offset,   SLE_INT32),
+	SLE_END()
+};
+
+static const SaveLoad *_glog_desc[] = {
+	_glog_mode_desc,
+	_glog_revision_desc,
+	_glog_oldver_desc,
+	_glog_patch_desc,
+	_glog_grfadd_desc,
+	_glog_grfrem_desc,
+	_glog_grfcompat_desc,
+	_glog_grfparam_desc,
+	_glog_grfmove_desc
+};
+
+assert_compile(lengthof(_glog_desc) == GLCT_END);
+
+static void Load_GLOG()
+{
+	assert(_gamelog_action == NULL);
+	assert(_gamelog_actions == 0);
+
+	GamelogActionType at;
+	while ((at = (GamelogActionType)SlReadByte()) != GLAT_NONE) {
+		_gamelog_action = ReallocT(_gamelog_action, _gamelog_actions + 1);
+		LoggedAction *la = &_gamelog_action[_gamelog_actions++];
+
+		la->at = at;
+
+		SlObject(la, _glog_action_desc); // has to be saved after 'DATE'!
+		la->change = NULL;
+		la->changes = 0;
+
+		GamelogChangeType ct;
+		while ((ct = (GamelogChangeType)SlReadByte()) != GLCT_NONE) {
+			la->change = ReallocT(la->change, la->changes + 1);
+
+			LoggedChange *lc = &la->change[la->changes++];
+			lc->ct = ct;
+
+			assert((uint)ct < GLCT_END);
+
+			SlObject(lc, _glog_desc[ct]);
+		}
+	}
+}
+
+static void Save_GLOG()
+{
+	const LoggedAction *laend = &_gamelog_action[_gamelog_actions];
+	size_t length = 0;
+
+	for (const LoggedAction *la = _gamelog_action; la != laend; la++) {
+		const LoggedChange *lcend = &la->change[la->changes];
+		for (LoggedChange *lc = la->change; lc != lcend; lc++) {
+			assert((uint)lc->ct < lengthof(_glog_desc));
+			length += SlCalcObjLength(lc, _glog_desc[lc->ct]) + 1;
+		}
+		length += 4;
+	}
+	length++;
+
+	SlSetLength(length);
+
+	for (LoggedAction *la = _gamelog_action; la != laend; la++) {
+		SlWriteByte(la->at);
+		SlObject(la, _glog_action_desc);
+
+		const LoggedChange *lcend = &la->change[la->changes];
+		for (LoggedChange *lc = la->change; lc != lcend; lc++) {
+			SlWriteByte(lc->ct);
+			assert((uint)lc->ct < GLCT_END);
+			SlObject(lc, _glog_desc[lc->ct]);
+		}
+		SlWriteByte(GLCT_NONE);
+	}
+	SlWriteByte(GLAT_NONE);
+}
+
+
+extern const ChunkHandler _gamelog_chunk_handlers[] = {
+	{ 'GLOG', Save_GLOG, Load_GLOG, CH_RIFF | CH_LAST }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gamelog.h	Tue Jun 17 10:32:49 2008 +0000
@@ -0,0 +1,46 @@
+/* $Id$ */
+
+/** @file gamelog.h Functions to be called to log possibly unsafe game events */
+
+#ifndef GAMELOG_H
+#define GAMELOG_H
+
+#include "newgrf_config.h"
+
+enum GamelogActionType {
+	GLAT_START,        ///< Game created
+	GLAT_LOAD,         ///< Game loaded
+	GLAT_GRF,          ///< GRF changed
+	GLAT_CHEAT,        ///< Cheat was used
+	GLAT_PATCH,        ///< Patches setting changed
+	GLAT_END,          ///< So we know how many GLATs are there
+	GLAT_NONE  = 0xFF, ///< No logging active; in savegames, end of list
+};
+
+void GamelogStartAction(GamelogActionType at);
+void GamelogStopAction();
+
+void GamelogReset();
+
+typedef void GamelogPrintProc(const char *s);
+void GamelogPrint(GamelogPrintProc *proc); // needed for WIN32 / WINCE crash.log
+
+void GamelogPrintDebug();
+void GamelogPrintConsole();
+
+void GamelogRevision();
+void GamelogMode();
+void GamelogOldver();
+void GamelogPatch(const char *name, int32 oldval, int32 newval);
+
+void GamelogGRFUpdate(const GRFConfig *oldg, const GRFConfig *newg);
+void GamelogGRFAddList(const GRFConfig *newg);
+void GamelogGRFRemove(uint32 grfid);
+void GamelogGRFAdd(const GRFConfig *newg);
+void GamelogGRFCompatible(const GRFIdentifier *newg);
+
+void GamelogTestRevision();
+void GamelogTestMode();
+void GamelogTestGRF();
+
+#endif /* GAMELOG_H */
--- a/src/genworld.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/genworld.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -39,7 +39,7 @@
 void StartupPlayers();
 void StartupDisasters();
 
-void InitializeGame(int mode, uint size_x, uint size_y);
+void InitializeGame(uint size_x, uint size_y, bool reset_date);
 
 /* Please only use this variable in genworld.h and genworld.c and
  *  nowhere else. For speed improvements we need it to be global, but
@@ -85,14 +85,14 @@
 /**
  * The internal, real, generate function.
  */
-static void * CDECL _GenerateWorld(void *arg)
+static void _GenerateWorld(void *arg)
 {
 	try {
 		_generating_world = true;
 		if (_network_dedicated) DEBUG(net, 0, "Generating map, please wait...");
 		/* Set the Random() seed to generation_seed so we produce the same map with the same seed */
-		if (_settings.game_creation.generation_seed == GENERATE_NEW_SEED) _settings.game_creation.generation_seed = _settings_newgame.game_creation.generation_seed = InteractiveRandom();
-		_random.SetSeed(_settings.game_creation.generation_seed);
+		if (_settings_game.game_creation.generation_seed == GENERATE_NEW_SEED) _settings_game.game_creation.generation_seed = _settings_newgame.game_creation.generation_seed = InteractiveRandom();
+		_random.SetSeed(_settings_game.game_creation.generation_seed);
 		SetGeneratingWorldProgress(GWP_MAP_INIT, 2);
 		SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, VHM_NONE, WC_MAIN_WINDOW, 0);
 
@@ -105,7 +105,7 @@
 			SetGeneratingWorldProgress(GWP_UNMOVABLE, 1);
 
 			/* Make the map the height of the patch setting */
-			if (_game_mode != GM_MENU) FlatEmptyWorld(_settings.game_creation.se_flat_world_height);
+			if (_game_mode != GM_MENU) FlatEmptyWorld(_settings_game.game_creation.se_flat_world_height);
 
 			ConvertGroundTilesIntoWaterTiles();
 			IncreaseGeneratingWorldProgress(GWP_UNMOVABLE);
@@ -165,12 +165,11 @@
 
 		if (_network_dedicated) DEBUG(net, 0, "Map generated, starting game");
 
-		if (_settings.gui.pause_on_newgame && _game_mode == GM_NORMAL) DoCommandP(0, 1, 0, NULL, CMD_PAUSE);
+		if (_settings_client.gui.pause_on_newgame && _game_mode == GM_NORMAL) DoCommandP(0, 1, 0, NULL, CMD_PAUSE);
 	} catch (...) {
 		_generating_world = false;
 		throw;
 	}
-	return NULL;
 }
 
 /**
@@ -253,7 +252,7 @@
  * @param size_x The X-size of the map.
  * @param size_y The Y-size of the map.
  */
-void GenerateWorld(int mode, uint size_x, uint size_y)
+void GenerateWorld(GenerateWorldMode mode, uint size_x, uint size_y)
 {
 	if (_gw.active) return;
 	_gw.mode   = mode;
@@ -273,13 +272,13 @@
 	_current_player = OWNER_NONE;
 
 	/* Set the date before loading sprites as some newgrfs check it */
-	SetDate(ConvertYMDToDate(_settings.game_creation.starting_year, 0, 1));
+	SetDate(ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1));
 
 	/* Load the right landscape stuff */
 	GfxLoadSprites();
 	LoadStringWidthTable();
 
-	InitializeGame(IG_NONE, _gw.size_x, _gw.size_y);
+	InitializeGame(_gw.size_x, _gw.size_y, false);
 	PrepareGenerateWorldProgress();
 
 	/* Re-init the windowing system */
--- a/src/genworld.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/genworld.h	Tue Jun 17 10:32:49 2008 +0000
@@ -18,6 +18,14 @@
 	GENERATE_NEW_SEED = (uint)-1, ///< Create a new random seed
 };
 
+/* Modes for GenerateWorld */
+enum GenerateWorldMode {
+	GW_NEWGAME   = 0,    /* Generate a map for a new game */
+	GW_EMPTY     = 1,    /* Generate an empty map (sea-level) */
+	GW_RANDOM    = 2,    /* Generate a random map for SE */
+	GW_HEIGHTMAP = 3,    /* Generate a newgame from a heightmap */
+};
+
 typedef void gw_done_proc();
 typedef void gw_abort_proc();
 
@@ -27,7 +35,7 @@
 	bool wait_for_draw;    ///< Are we waiting on a draw event
 	bool quit_thread;      ///< Do we want to quit the active thread
 	bool threaded;         ///< Whether we run _GenerateWorld threaded
-	int mode;              ///< What mode are we making a world in
+	GenerateWorldMode mode;///< What mode are we making a world in
 	PlayerID lp;           ///< The local_player before generating
 	uint size_x;           ///< X-size of the map
 	uint size_y;           ///< Y-size of the map
@@ -67,7 +75,7 @@
 void GenerateWorldSetCallback(gw_done_proc *proc);
 void GenerateWorldSetAbortCallback(gw_abort_proc *proc);
 void WaitTillGeneratedWorld();
-void GenerateWorld(int mode, uint size_x, uint size_y);
+void GenerateWorld(GenerateWorldMode mode, uint size_x, uint size_y);
 void AbortGeneratingWorld();
 bool IsGeneratingWorldAborted();
 void HandleGeneratingWorldAbortion();
--- a/src/genworld_gui.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/genworld_gui.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -205,7 +205,7 @@
 	DeleteAllNonVitalWindows();
 
 	/* Copy all XXX_newgame to XXX when coming from outside the editor */
-	_settings = _settings_newgame;
+	_settings_game = _settings_newgame;
 	ResetGRFConfig(true);
 
 	SndPlayFx(SND_15_BEEP);
@@ -377,9 +377,9 @@
 				break;
 
 			case GLAND_GENERATE_BUTTON: // Generate
-				_settings = _settings_newgame;
+				_settings_game = _settings_newgame;
 
-				if (_settings.economy.town_layout == TL_NO_ROADS) {
+				if (_settings_game.economy.town_layout == TL_NO_ROADS) {
 					ShowQuery(
 						STR_TOWN_LAYOUT_WARNING_CAPTION,
 						STR_TOWN_LAYOUT_WARNING_MESSAGE,
--- a/src/gfx.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/gfx.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -807,7 +807,7 @@
 	memcpy(old_val, d, c * sizeof(*old_val));
 
 	/* Dark blue water */
-	s = (_settings.game_creation.landscape == LT_TOYLAND) ? ev->ac : ev->a;
+	s = (_settings_game.game_creation.landscape == LT_TOYLAND) ? ev->ac : ev->a;
 	j = EXTR(320, 5);
 	for (i = 0; i != 5; i++) {
 		*d++ = s[j];
@@ -816,7 +816,7 @@
 	}
 
 	/* Glittery water */
-	s = (_settings.game_creation.landscape == LT_TOYLAND) ? ev->bc : ev->b;
+	s = (_settings_game.game_creation.landscape == LT_TOYLAND) ? ev->bc : ev->b;
 	j = EXTR(128, 15);
 	for (i = 0; i != 5; i++) {
 		*d++ = s[j];
@@ -876,7 +876,7 @@
 	/* Animate water for old DOS graphics */
 	if (_use_dos_palette) {
 		/* Dark blue water DOS */
-		s = (_settings.game_creation.landscape == LT_TOYLAND) ? ev->ac : ev->a;
+		s = (_settings_game.game_creation.landscape == LT_TOYLAND) ? ev->ac : ev->a;
 		j = EXTR(320, 5);
 		for (i = 0; i != 5; i++) {
 			*d++ = s[j];
@@ -885,7 +885,7 @@
 		}
 
 		/* Glittery water DOS */
-		s = (_settings.game_creation.landscape == LT_TOYLAND) ? ev->bc : ev->b;
+		s = (_settings_game.game_creation.landscape == LT_TOYLAND) ? ev->bc : ev->b;
 		j = EXTR(128, 15);
 		for (i = 0; i != 5; i++) {
 			*d++ = s[j];
--- a/src/gfxinit.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/gfxinit.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -55,7 +55,7 @@
 		load_index++;
 		sprite_id++;
 		if (load_index >= MAX_SPRITES) {
-			error("Too many sprites. Recompile with higher MAX_SPRITES value or remove some custom GRF files.");
+			usererror("Too many sprites. Recompile with higher MAX_SPRITES value or remove some custom GRF files.");
 		}
 	}
 	DEBUG(sprite, 2, "Currently %i sprites are loaded", load_index);
@@ -71,12 +71,8 @@
 		uint end = *index_tbl++;
 
 		do {
-		#ifdef NDEBUG
-			LoadNextSprite(start, file_index, *sprite_id);
-		#else
 			bool b = LoadNextSprite(start, file_index, *sprite_id);
 			assert(b);
-		#endif
 			(*sprite_id)++;
 		} while (++start <= end);
 	}
@@ -214,10 +210,10 @@
 	 * This overwrites some of the temperate sprites, such as foundations
 	 * and the ground sprites.
 	 */
-	if (_settings.game_creation.landscape != LT_TEMPERATE) {
+	if (_settings_game.game_creation.landscape != LT_TEMPERATE) {
 		LoadGrfIndexed(
-			files->landscape[_settings.game_creation.landscape - 1].filename,
-			_landscape_spriteindexes[_settings.game_creation.landscape - 1],
+			files->landscape[_settings_game.game_creation.landscape - 1].filename,
+			_landscape_spriteindexes[_settings_game.game_creation.landscape - 1],
 			i++
 		);
 	}
@@ -248,7 +244,7 @@
 
 void GfxLoadSprites()
 {
-	DEBUG(sprite, 2, "Loading sprite set %d", _settings.game_creation.landscape);
+	DEBUG(sprite, 2, "Loading sprite set %d", _settings_game.game_creation.landscape);
 
 	GfxInitSpriteMem();
 	LoadSpriteTables();
--- a/src/group_gui.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/group_gui.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -176,7 +176,6 @@
 		this->vehicle_type = (VehicleType)GB(this->window_number, 11, 5);
 
 		this->caption_color = owner;
-		this->hscroll.cap = 224;
 		this->resize.step_width = 1;
 
 		switch (this->vehicle_type) {
@@ -283,7 +282,7 @@
 	virtual void OnPaint()
 	{
 		const PlayerID owner = (PlayerID)GB(this->window_number, 0, 8);
-		int x = 203;
+		int x = this->widget[GRP_WIDGET_LIST_VEHICLE].left + 2;
 		int y2 = PLY_WND_PRC__OFFSET_TOP_WIDGET;
 		int y1 = PLY_WND_PRC__OFFSET_TOP_WIDGET + 2;
 		int max;
@@ -437,6 +436,8 @@
 
 		this->DrawSortButtonState(GRP_WIDGET_SORT_BY_ORDER, this->vehicles.flags & VL_DESC ? SBS_DOWN : SBS_UP);
 
+		int list_width = this->widget[GRP_WIDGET_LIST_VEHICLE].right - this->widget[GRP_WIDGET_LIST_VEHICLE].left - 20;
+
 		/* Draw Matrix Vehicle according to the vehicle list built before */
 		max = min(this->vscroll2.pos + this->vscroll2.cap, this->vehicles.Length());
 		for (i = this->vscroll2.pos ; i < max ; ++i) {
@@ -444,7 +445,7 @@
 
 			assert(v->type == this->vehicle_type && v->owner == owner);
 
-			DrawVehicleImage(v, x + 19, y2 + 6, this->vehicle_sel, this->hscroll.cap, 0);
+			DrawVehicleImage(v, x + 19, y2 + 6, this->vehicle_sel, list_width, 0);
 			DrawVehicleProfitButton(v, x, y2 + 13);
 
 			SetDParam(0, v->unitnumber);
@@ -657,7 +658,6 @@
 
 	virtual void OnResize(Point new_size, Point delta)
 	{
-		this->hscroll.cap += delta.x;
 		this->vscroll.cap += delta.y / PLY_WND_PRC__SIZE_OF_ROW_TINY;
 		this->vscroll2.cap += delta.y / (int)this->resize.step_height;
 
--- a/src/gui.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/gui.h	Tue Jun 17 10:32:49 2008 +0000
@@ -61,9 +61,6 @@
 
 void ShowSmallMap();
 void ShowExtraViewPortWindow(TileIndex tile = INVALID_TILE);
-void SetVScrollCount(Window *w, int num);
-void SetVScroll2Count(Window *w, int num);
-void SetHScrollCount(Window *w, int num);
 
 void BuildFileList();
 void SetFiosType(const byte fiostype);
--- a/src/heightmap.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/heightmap.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -297,7 +297,7 @@
 	TileIndex tile;
 
 	/* Get map size and calculate scale and padding values */
-	switch (_settings.game_creation.heightmap_rotation) {
+	switch (_settings_game.game_creation.heightmap_rotation) {
 		default: NOT_REACHED();
 		case HM_COUNTER_CLOCKWISE:
 			width   = MapSizeX();
@@ -322,7 +322,7 @@
 	/* Form the landscape */
 	for (row = 0; row < height - 1; row++) {
 		for (col = 0; col < width - 1; col++) {
-			switch (_settings.game_creation.heightmap_rotation) {
+			switch (_settings_game.game_creation.heightmap_rotation) {
 				default: NOT_REACHED();
 				case HM_COUNTER_CLOCKWISE: tile = TileXY(col, row); break;
 				case HM_CLOCKWISE:         tile = TileXY(row, col); break;
@@ -337,7 +337,7 @@
 				/* Use nearest neighbor resizing to scale map data.
 				 *  We rotate the map 45 degrees (counter)clockwise */
 				img_row = (((row - row_pad) * num_div) / img_scale);
-				switch (_settings.game_creation.heightmap_rotation) {
+				switch (_settings_game.game_creation.heightmap_rotation) {
 					default: NOT_REACHED();
 					case HM_COUNTER_CLOCKWISE:
 						img_col = (((width - 1 - col - col_pad) * num_div) / img_scale);
--- a/src/industry_cmd.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/industry_cmd.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -70,7 +70,7 @@
 	/* once performed, enable only the current climate industries */
 	for (IndustryType i = 0; i < NUM_INDUSTRYTYPES; i++) {
 		_industry_specs[i].enabled = i < NEW_INDUSTRYOFFSET &&
-				HasBit(_origin_industry_specs[i].climate_availability, _settings.game_creation.landscape);
+				HasBit(_origin_industry_specs[i].climate_availability, _settings_game.game_creation.landscape);
 	}
 
 	memset(&_industry_tile_specs, 0, sizeof(_industry_tile_specs));
@@ -84,7 +84,7 @@
 void ResetIndustryCreationProbility(IndustryType type)
 {
 	assert(type < INVALID_INDUSTRYTYPE);
-	_industry_specs[type].appear_creation[_settings.game_creation.landscape] = 0;
+	_industry_specs[type].appear_creation[_settings_game.game_creation.landscape] = 0;
 }
 
 DEFINE_OLD_POOL_GENERIC(Industry, Industry)
@@ -334,6 +334,20 @@
 
 static Foundation GetFoundation_Industry(TileIndex tile, Slope tileh)
 {
+	IndustryGfx gfx = GetIndustryGfx(tile);
+
+	/* For NewGRF industry tiles we might not be drawing a foundation. We need to
+	 * account for this, otherwise we might be applying a FOUNDATION_LEVELED
+	 * on a steep slope which is not allowed. Furthermore other structures should
+	 * draw the wall of the foundation in this case.
+	 */
+	if (gfx >= NEW_INDUSTRYTILEOFFSET) {
+		const IndustryTileSpec *indts = GetIndustryTileSpec(gfx);
+		if (indts->grf_prop.spritegroup != NULL && HasBit(indts->callback_flags, CBM_INDT_DRAW_FOUNDATIONS)) {
+			uint32 callback_res = GetIndustryTileCallback(CBID_INDUSTRY_DRAW_FOUNDATIONS, 0, 0, gfx, GetIndustryByTile(tile), tile);
+			if (callback_res == 0) return FOUNDATION_NONE;
+		}
+	}
 	return FlatteningFoundation(tileh);
 }
 
@@ -888,14 +902,14 @@
 	uint field_type;
 	int type;
 
-	if (_settings.game_creation.landscape == LT_ARCTIC) {
+	if (_settings_game.game_creation.landscape == LT_ARCTIC) {
 		if (GetTileZ(tile) + TILE_HEIGHT * 2 >= GetSnowLine())
 			return;
 	}
 
 	/* determine field size */
 	r = (Random() & 0x303) + 0x404;
-	if (_settings.game_creation.landscape == LT_ARCTIC) r += 0x404;
+	if (_settings_game.game_creation.landscape == LT_ARCTIC) r += 0x404;
 	size_x = GB(r, 0, 8);
 	size_y = GB(r, 8, 8);
 
@@ -926,7 +940,7 @@
 	END_TILE_LOOP(cur_tile, size_x, size_y, tile)
 
 	type = 3;
-	if (_settings.game_creation.landscape != LT_ARCTIC && _settings.game_creation.landscape != LT_TROPIC) {
+	if (_settings_game.game_creation.landscape != LT_ARCTIC && _settings_game.game_creation.landscape != LT_TROPIC) {
 		type = _plantfarmfield_type[Random() & 0xF];
 	}
 
@@ -981,7 +995,7 @@
 
 	if (!IsIndustryCompleted(tile)) return;  ///< Can't proceed if not completed
 
-	if (CircularTileSearch(tile, 40, SearchLumberMillTrees, 0)) ///< 40x40 tiles  to search
+	if (CircularTileSearch(&tile, 40, SearchLumberMillTrees, 0)) ///< 40x40 tiles  to search
 		i->produced_cargo_waiting[0] = min(0xffff, i->produced_cargo_waiting[0] + 45); ///< Found a tree, add according value to waiting cargo
 }
 
@@ -1063,7 +1077,7 @@
 
 static bool CheckNewIndustry_Forest(TileIndex tile)
 {
-	if (_settings.game_creation.landscape == LT_ARCTIC) {
+	if (_settings_game.game_creation.landscape == LT_ARCTIC) {
 		if (GetTileZ(tile) < HighestSnowLine() + TILE_HEIGHT * 2U) {
 			_error_message = STR_4831_FOREST_CAN_ONLY_BE_PLANTED;
 			return false;
@@ -1075,7 +1089,7 @@
 static bool CheckNewIndustry_OilRefinery(TileIndex tile)
 {
 	if (_game_mode == GM_EDITOR) return true;
-	if (DistanceFromEdge(TILE_ADDXY(tile, 1, 1)) < _settings.game_creation.oil_refinery_limit) return true;
+	if (DistanceFromEdge(TILE_ADDXY(tile, 1, 1)) < _settings_game.game_creation.oil_refinery_limit) return true;
 
 	_error_message = STR_483B_CAN_ONLY_BE_POSITIONED;
 	return false;
@@ -1087,7 +1101,7 @@
 {
 	if (_game_mode == GM_EDITOR && _ignore_restrictions) return true;
 	if (TileHeight(tile) == 0 &&
-			DistanceFromEdge(TILE_ADDXY(tile, 1, 1)) < _settings.game_creation.oil_refinery_limit) return true;
+			DistanceFromEdge(TILE_ADDXY(tile, 1, 1)) < _settings_game.game_creation.oil_refinery_limit) return true;
 
 	_error_message = STR_483B_CAN_ONLY_BE_POSITIONED;
 	return false;
@@ -1095,7 +1109,7 @@
 
 static bool CheckNewIndustry_Farm(TileIndex tile)
 {
-	if (_settings.game_creation.landscape == LT_ARCTIC) {
+	if (_settings_game.game_creation.landscape == LT_ARCTIC) {
 		if (GetTileZ(tile) + TILE_HEIGHT * 2 >= HighestSnowLine()) {
 			_error_message = STR_0239_SITE_UNSUITABLE;
 			return false;
@@ -1171,7 +1185,7 @@
 
 	t = ClosestTownFromTile(tile, (uint)-1);
 
-	if (_settings.economy.multiple_industry_per_town) return t;
+	if (_settings_game.economy.multiple_industry_per_town) return t;
 
 	FOR_ALL_INDUSTRIES(i) {
 		if (i->type == (byte)type &&
@@ -1257,7 +1271,7 @@
 	/* It is almost impossible to have a fully flat land in TG, so what we
 	 *  do is that we check if we can make the land flat later on. See
 	 *  CheckIfCanLevelIndustryPlatform(). */
-	return !refused_slope || (_settings.game_creation.land_generator == LG_TERRAGENESIS && _generating_world && !custom_shape && !_ignore_restrictions);
+	return !refused_slope || (_settings_game.game_creation.land_generator == LG_TERRAGENESIS && _generating_world && !custom_shape && !_ignore_restrictions);
 }
 
 static bool CheckIfIndustryIsAllowed(TileIndex tile, int type, const Town *t)
@@ -1387,7 +1401,7 @@
 	const IndustrySpec *indspec = GetIndustrySpec(type);
 	const Industry *i;
 
-	if (_settings.economy.same_industry_close && indspec->IsRawIndustry())
+	if (_settings_game.economy.same_industry_close && indspec->IsRawIndustry())
 		/* Allow primary industries to be placed close to any other industry */
 		return true;
 
@@ -1401,8 +1415,8 @@
 				indspec->accepts_cargo[0] == i->accepts_cargo[0] && (
 				/* at least one of those options must be true */
 				_game_mode != GM_EDITOR || // editor must not be stopped
-				!_settings.economy.same_industry_close ||
-				!_settings.economy.multiple_industry_per_town)) {
+				!_settings_game.economy.same_industry_close ||
+				!_settings_game.economy.multiple_industry_per_town)) {
 			_error_message = STR_INDUSTRY_TOO_CLOSE;
 			return false;
 		}
@@ -1449,7 +1463,7 @@
 	i->production_rate[1] = indspec->production_rate[1];
 
 	/* don't use smooth economy for industries using production related callbacks */
-	if (_settings.economy.smooth_economy &&
+	if (_settings_game.economy.smooth_economy &&
 	    !(HasBit(indspec->callback_flags, CBM_IND_PRODUCTION_256_TICKS) || HasBit(indspec->callback_flags, CBM_IND_PRODUCTION_CARGO_ARRIVAL)) && // production callbacks
 	    !(HasBit(indspec->callback_flags, CBM_IND_MONTHLYPROD_CHANGE) || HasBit(indspec->callback_flags, CBM_IND_PRODUCTION_CHANGE))             // production change callbacks
 	) {
@@ -1577,7 +1591,7 @@
 		if (!_check_new_industry_procs[indspec->check_proc](tile)) return NULL;
 	}
 
-	if (!custom_shape_check && _settings.game_creation.land_generator == LG_TERRAGENESIS && _generating_world && !_ignore_restrictions && !CheckIfCanLevelIndustryPlatform(tile, 0, it, type)) return NULL;
+	if (!custom_shape_check && _settings_game.game_creation.land_generator == LG_TERRAGENESIS && _generating_world && !_ignore_restrictions && !CheckIfCanLevelIndustryPlatform(tile, 0, it, type)) return NULL;
 	if (!CheckIfFarEnoughFromIndustry(tile, type)) return NULL;
 
 	const Town *t = CheckMultipleIndustryInTown(tile, type);
@@ -1621,11 +1635,11 @@
 
 	/* If the patch for raw-material industries is not on, you cannot build raw-material industries.
 	 * Raw material industries are industries that do not accept cargo (at least for now) */
-	if (_game_mode != GM_EDITOR && _settings.construction.raw_industry_construction == 0 && indspec->IsRawIndustry()) {
+	if (_game_mode != GM_EDITOR && _settings_game.construction.raw_industry_construction == 0 && indspec->IsRawIndustry()) {
 		return CMD_ERROR;
 	}
 
-	if (_game_mode != GM_EDITOR && _settings.construction.raw_industry_construction == 2 && indspec->IsRawIndustry()) {
+	if (_game_mode != GM_EDITOR && _settings_game.construction.raw_industry_construction == 2 && indspec->IsRawIndustry()) {
 		if (flags & DC_EXEC) {
 			/* Prospecting has a chance to fail, however we cannot guarantee that something can
 			 * be built on the map, so the chance gets lower when the map is fuller, but there
@@ -1700,13 +1714,13 @@
 {
 	/* We need to bypass the amount given in parameter if it exceeds the maximum dimension of the
 	 * _numof_industry_table.  newgrf can specify a big amount */
-	int num = (amount > NB_NUMOFINDUSTRY) ? amount : _numof_industry_table[_settings.difficulty.number_industries][amount];
+	int num = (amount > NB_NUMOFINDUSTRY) ? amount : _numof_industry_table[_settings_game.difficulty.number_industries][amount];
 	const IndustrySpec *ind_spc = GetIndustrySpec(type);
 
 	/* These are always placed next to the coastline, so we scale by the perimeter instead. */
 	num = (ind_spc->check_proc == CHECK_REFINERY || ind_spc->check_proc == CHECK_OIL_RIG) ? ScaleByMapSize1D(num) : ScaleByMapSize(num);
 
-	if (_settings.difficulty.number_industries != 0) {
+	if (_settings_game.difficulty.number_industries != 0) {
 		PlayerID old_player = _current_player;
 		_current_player = OWNER_NONE;
 		assert(num > 0);
@@ -1735,7 +1749,7 @@
 	const IndustrySpec *ind_spc;
 
 	/* Find the total amount of industries */
-	if (_settings.difficulty.number_industries > 0) {
+	if (_settings_game.difficulty.number_industries > 0) {
 		for (it = 0; it < NUM_INDUSTRYTYPES; it++) {
 
 			ind_spc = GetIndustrySpec(it);
@@ -1744,12 +1758,12 @@
 				ResetIndustryCreationProbility(it);
 			}
 
-			chance = ind_spc->appear_creation[_settings.game_creation.landscape];
+			chance = ind_spc->appear_creation[_settings_game.game_creation.landscape];
 			if (ind_spc->enabled && chance > 0) {
 				/* once the chance of appearance is determind, it have to be scaled by
 				 * the difficulty level. The "chance" in question is more an index into
 				 * the _numof_industry_table,in fact */
-				int num = (chance > NB_NUMOFINDUSTRY) ? chance : _numof_industry_table[_settings.difficulty.number_industries][chance];
+				int num = (chance > NB_NUMOFINDUSTRY) ? chance : _numof_industry_table[_settings_game.difficulty.number_industries][chance];
 
 				/* These are always placed next to the coastline, so we scale by the perimeter instead. */
 				num = (ind_spc->check_proc == CHECK_REFINERY || ind_spc->check_proc == CHECK_OIL_RIG) ? ScaleByMapSize1D(num) : ScaleByMapSize(num);
@@ -1760,7 +1774,7 @@
 
 	SetGeneratingWorldProgress(GWP_INDUSTRY, i);
 
-	if (_settings.difficulty.number_industries > 0) {
+	if (_settings_game.difficulty.number_industries > 0) {
 		for (it = 0; it < NUM_INDUSTRYTYPES; it++) {
 			/* Once the number of industries has been determined, let's really create them.
 			 * The test for chance allows us to try create industries that are available only
@@ -1769,7 +1783,7 @@
 			 *          processed that scaling above? No, don't think so.  Will find a way. */
 			ind_spc = GetIndustrySpec(it);
 			if (ind_spc->enabled) {
-				chance = ind_spc->appear_creation[_settings.game_creation.landscape];
+				chance = ind_spc->appear_creation[_settings_game.game_creation.landscape];
 				if (chance > 0) PlaceInitialIndustry(it, chance);
 			}
 		}
@@ -1823,7 +1837,7 @@
 	/* Generate a list of all possible industries that can be built. */
 	for (j = 0; j < NUM_INDUSTRYTYPES; j++) {
 		ind_spc = GetIndustrySpec(j);
-		byte chance = ind_spc->appear_ingame[_settings.game_creation.landscape];
+		byte chance = ind_spc->appear_ingame[_settings_game.game_creation.landscape];
 
 		if (!ind_spc->enabled || chance == 0) continue;
 
@@ -1881,7 +1895,7 @@
 	const IndustrySpec *indspec = GetIndustrySpec(type);
 
 	/* oil wells (or the industries with that flag set) are always allowed to closedown */
-	if (indspec->behaviour & INDUSTRYBEH_DONT_INCR_PROD && _settings.game_creation.landscape == LT_TEMPERATE) return false;
+	if (indspec->behaviour & INDUSTRYBEH_DONT_INCR_PROD && _settings_game.game_creation.landscape == LT_TEMPERATE) return false;
 	return (indspec->behaviour & INDUSTRYBEH_CANCLOSE_LASTINSTANCE) == 0 && GetIndustryTypeCount(type) <= 1;
 }
 
@@ -2031,7 +2045,7 @@
 	bool standard = true;
 	bool suppress_message = false;
 	/* don't use smooth economy for industries using production related callbacks */
-	bool smooth_economy = _settings.economy.smooth_economy &&
+	bool smooth_economy = _settings_game.economy.smooth_economy &&
 	                      !(HasBit(indspec->callback_flags, CBM_IND_PRODUCTION_256_TICKS) || HasBit(indspec->callback_flags, CBM_IND_PRODUCTION_CARGO_ARRIVAL)) && // production callbacks
 	                      !(HasBit(indspec->callback_flags, CBM_IND_MONTHLYPROD_CHANGE) || HasBit(indspec->callback_flags, CBM_IND_PRODUCTION_CHANGE));            // production change callbacks
 	byte div = 0;
@@ -2072,7 +2086,7 @@
 
 	if (standard && (indspec->life_type & (INDUSTRYLIFE_ORGANIC | INDUSTRYLIFE_EXTRACTIVE)) != 0) {
 		/* decrease or increase */
-		bool only_decrease = (indspec->behaviour & INDUSTRYBEH_DONT_INCR_PROD) && _settings.game_creation.landscape == LT_TEMPERATE;
+		bool only_decrease = (indspec->behaviour & INDUSTRYBEH_DONT_INCR_PROD) && _settings_game.game_creation.landscape == LT_TEMPERATE;
 
 		if (smooth_economy) {
 			closeit = true;
@@ -2257,7 +2271,7 @@
 Money IndustrySpec::GetConstructionCost() const
 {
 	return (_price.build_industry *
-			(_settings.construction.raw_industry_construction == 1 && this->IsRawIndustry() ?
+			(_settings_game.construction.raw_industry_construction == 1 && this->IsRawIndustry() ?
 					this->raw_industry_cost_multiplier :
 					this->cost_multiplier
 			)) >> 8;
--- a/src/industry_gui.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/industry_gui.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -27,6 +27,7 @@
 #include "tilehighlight_func.h"
 #include "string_func.h"
 #include "sortlist_type.h"
+#include "widgets/dropdown_func.h"
 
 #include "table/strings.h"
 #include "table/sprites.h"
@@ -131,7 +132,7 @@
 				/* Rule is that editor mode loads all industries.
 				 * In game mode, all non raw industries are loaded too
 				 * and raw ones are loaded only when setting allows it */
-				if (_game_mode != GM_EDITOR && indsp->IsRawIndustry() && _settings.construction.raw_industry_construction == 0) {
+				if (_game_mode != GM_EDITOR && indsp->IsRawIndustry() && _settings_game.construction.raw_industry_construction == 0) {
 					/* Unselect if the industry is no longer in the list */
 					if (this->selected_type == ind) this->selected_index = -1;
 					continue;
@@ -195,10 +196,10 @@
 		 * In Editor, you just build, while ingame, or you fund or you prospect */
 		if (_game_mode == GM_EDITOR) {
 			/* We've chosen many random industries but no industries have been specified */
-			if (indsp == NULL) this->enabled[this->selected_index] = _settings.difficulty.number_industries != 0;
+			if (indsp == NULL) this->enabled[this->selected_index] = _settings_game.difficulty.number_industries != 0;
 			this->widget[DPIW_FUND_WIDGET].data = STR_BUILD_NEW_INDUSTRY;
 		} else {
-			this->widget[DPIW_FUND_WIDGET].data = (_settings.construction.raw_industry_construction == 2 && indsp->IsRawIndustry()) ? STR_PROSPECT_NEW_INDUSTRY : STR_FUND_NEW_INDUSTRY;
+			this->widget[DPIW_FUND_WIDGET].data = (_settings_game.construction.raw_industry_construction == 2 && indsp->IsRawIndustry()) ? STR_PROSPECT_NEW_INDUSTRY : STR_FUND_NEW_INDUSTRY;
 		}
 		this->SetWidgetDisabledState(DPIW_FUND_WIDGET, !this->enabled[this->selected_index]);
 
@@ -304,7 +305,7 @@
 
 					this->SetDirty();
 
-					if ((_game_mode != GM_EDITOR && _settings.construction.raw_industry_construction == 2 && indsp != NULL && indsp->IsRawIndustry()) ||
+					if ((_game_mode != GM_EDITOR && _settings_game.construction.raw_industry_construction == 2 && indsp != NULL && indsp->IsRawIndustry()) ||
 							this->selected_type == INVALID_INDUSTRYTYPE) {
 						/* Reset the button state if going to prospecting or "build many industries" */
 						this->RaiseButtons();
@@ -325,7 +326,7 @@
 						GenerateIndustries();
 						_generating_world = false;
 					}
-				} else if (_game_mode != GM_EDITOR && _settings.construction.raw_industry_construction == 2 && GetIndustrySpec(this->selected_type)->IsRawIndustry()) {
+				} else if (_game_mode != GM_EDITOR && _settings_game.construction.raw_industry_construction == 2 && GetIndustrySpec(this->selected_type)->IsRawIndustry()) {
 					DoCommandP(0, this->selected_type, InteractiveRandom(), NULL, CMD_BUILD_INDUSTRY | CMD_MSG(STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY));
 					this->HandleButtonClick(DPIW_FUND_WIDGET);
 				} else {
@@ -691,10 +692,8 @@
 	IDW_CLOSEBOX = 0,
 	IDW_CAPTION,
 	IDW_STICKY,
-	IDW_SORTBYNAME,
-	IDW_SORTBYTYPE,
-	IDW_SORTBYPROD,
-	IDW_SORTBYTRANSPORT,
+	IDW_DROPDOWN_ORDER,
+	IDW_DROPDOWN_CRITERIA,
 	IDW_SPACER,
 	IDW_INDUSTRY_LIST,
 	IDW_SCROLLBAR,
@@ -704,154 +703,149 @@
 /** Widget definition of the industy directory gui */
 static const Widget _industry_directory_widgets[] = {
 {   WWT_CLOSEBOX,   RESIZE_NONE,    13,     0,    10,     0,    13, STR_00C5,                STR_018B_CLOSE_WINDOW},             // IDW_CLOSEBOX
-{    WWT_CAPTION,  RESIZE_RIGHT,    13,    11,   495,     0,    13, STR_INDUSTRYDIR_CAPTION, STR_018C_WINDOW_TITLE_DRAG_THIS},   // IDW_CAPTION
-{  WWT_STICKYBOX,     RESIZE_LR,    13,   496,   507,     0,    13, 0x0,                     STR_STICKY_BUTTON},                 // IDW_STICKY
-{ WWT_PUSHTXTBTN,   RESIZE_NONE,    13,     0,   100,    14,    25, STR_SORT_BY_NAME,        STR_SORT_ORDER_TIP},                // IDW_SORTBYNAME
-{ WWT_PUSHTXTBTN,   RESIZE_NONE,    13,   101,   200,    14,    25, STR_SORT_BY_TYPE,        STR_SORT_ORDER_TIP},                // IDW_SORTBYTYPE
-{ WWT_PUSHTXTBTN,   RESIZE_NONE,    13,   201,   300,    14,    25, STR_SORT_BY_PRODUCTION,  STR_SORT_ORDER_TIP},                // IDW_SORTBYPROD
-{ WWT_PUSHTXTBTN,   RESIZE_NONE,    13,   301,   400,    14,    25, STR_SORT_BY_TRANSPORTED, STR_SORT_ORDER_TIP},                // IDW_SORTBYTRANSPORT
-{      WWT_PANEL,  RESIZE_RIGHT,    13,   401,   495,    14,    25, 0x0,                     STR_NULL},                          // IDW_SPACER
-{      WWT_PANEL,     RESIZE_RB,    13,     0,   495,    26,   189, 0x0,                     STR_200A_TOWN_NAMES_CLICK_ON_NAME}, // IDW_INDUSRTY_LIST
-{  WWT_SCROLLBAR,    RESIZE_LRB,    13,   496,   507,    14,   177, 0x0,                     STR_0190_SCROLL_BAR_SCROLLS_LIST},  // IDW_SCROLLBAR
-{  WWT_RESIZEBOX,   RESIZE_LRTB,    13,   496,   507,   178,   189, 0x0,                     STR_RESIZE_BUTTON},                 // IDW_RESIZE
+{    WWT_CAPTION,  RESIZE_RIGHT,    13,    11,   415,     0,    13, STR_INDUSTRYDIR_CAPTION, STR_018C_WINDOW_TITLE_DRAG_THIS},   // IDW_CAPTION
+{  WWT_STICKYBOX,     RESIZE_LR,    13,   416,   427,     0,    13, 0x0,                     STR_STICKY_BUTTON},                 // IDW_STICKY
+
+{    WWT_TEXTBTN,   RESIZE_NONE,    13,     0,    80,    14,    25, STR_SORT_BY,             STR_SORT_ORDER_TIP},                // IDW_DROPDOWN_ORDER
+{   WWT_DROPDOWN,   RESIZE_NONE,    13,    81,   243,    14,    25, 0x0,                     STR_SORT_CRITERIA_TIP},             // IDW_DROPDOWN_CRITERIA
+{      WWT_PANEL,  RESIZE_RIGHT,    13,   244,   415,    14,    25, 0x0,                     STR_NULL},                          // IDW_SPACER
+
+{      WWT_PANEL,     RESIZE_RB,    13,     0,   415,    26,   189, 0x0,                     STR_200A_TOWN_NAMES_CLICK_ON_NAME}, // IDW_INDUSRTY_LIST
+{  WWT_SCROLLBAR,    RESIZE_LRB,    13,   416,   427,    14,   177, 0x0,                     STR_0190_SCROLL_BAR_SCROLLS_LIST},  // IDW_SCROLLBAR
+{  WWT_RESIZEBOX,   RESIZE_LRTB,    13,   416,   427,   178,   189, 0x0,                     STR_RESIZE_BUTTON},                 // IDW_RESIZE
 {   WIDGETS_END},
 };
 
-static char _bufcache[96];
-static const Industry* _last_industry;
-static int _internal_sort_order;
-
-/** Returns percents of cargo transported if industry produces this cargo, else -1
- * @param i industry to check
- * @param id cargo slot
- * @return percents of cargo transported, or -1 if industry doesn't use this cargo slot
- */
-static inline int GetCargoTransportedPercentsIfValid(const Industry *i, uint id)
-{
-	assert(id < lengthof(i->produced_cargo));
-
-	if (i->produced_cargo[id] == CT_INVALID) return 101;
-	return i->last_month_pct_transported[id] * 100 >> 8;
-}
-
-/** Returns value representing industry's transported cargo
- * percentage for industry sorting
- * @param i industry to check
- * @return value used for sorting
- */
-static int GetCargoTransportedSortValue(const Industry *i)
-{
-	int p1 = GetCargoTransportedPercentsIfValid(i, 0);
-	int p2 = GetCargoTransportedPercentsIfValid(i, 1);
-
-	if (p1 > p2) Swap(p1, p2); // lower value has higher priority
-
-	return (p1 << 8) + p2;
-}
-
-static int CDECL GeneralIndustrySorter(const void *a, const void *b)
-{
-	const Industry* i = *(const Industry**)a;
-	const Industry* j = *(const Industry**)b;
-	int r;
-
-	switch (_internal_sort_order >> 1) {
-		default: NOT_REACHED();
-		case 0: /* Sort by Name (handled later) */
-			r = 0;
-			break;
-
-		case 1: /* Sort by Type */
-			r = i->type - j->type;
-			break;
-
-		case 2: /* Sort by Production */
-			if (i->produced_cargo[0] == CT_INVALID) {
-				r = (j->produced_cargo[0] == CT_INVALID ? 0 : -1);
-			} else {
-				if (j->produced_cargo[0] == CT_INVALID) {
-					r = 1;
-				} else {
-					r =
-						(i->last_month_production[0] + i->last_month_production[1]) -
-						(j->last_month_production[0] + j->last_month_production[1]);
-				}
-			}
-			break;
-
-		case 3: /* Sort by transported fraction */
-			r = GetCargoTransportedSortValue(i) - GetCargoTransportedSortValue(j);
-			break;
-	}
-
-	/* default to string sorting if they are otherwise equal */
-	if (r == 0) {
-		char buf1[96];
-
-		SetDParam(0, i->town->index);
-		GetString(buf1, STR_TOWN, lastof(buf1));
-
-		if (j != _last_industry) {
-			_last_industry = j;
-			SetDParam(0, j->town->index);
-			GetString(_bufcache, STR_TOWN, lastof(_bufcache));
-		}
-		r = strcmp(buf1, _bufcache);
-	}
-
-	if (_internal_sort_order & 1) r = -r;
-	return r;
-}
-
 typedef GUIList<const Industry*> GUIIndustryList;
 
-/**
- * Rebuild industries list if the VL_REBUILD flag is set
- *
- * @param sl pointer to industry list
- */
-static void BuildIndustriesList(GUIIndustryList *sl)
-{
-	if (!(sl->flags & VL_REBUILD)) return;
-
-	sl->Clear();
-
-	DEBUG(misc, 3, "Building industry list");
-
-	const Industry *i;
-	FOR_ALL_INDUSTRIES(i) {
-		*sl->Append() = i;
-	}
-
-	sl->Compact();
-
-	sl->flags &= ~VL_REBUILD;
-	sl->flags |= VL_RESORT;
-}
-
-
-/**
- * Sort industry list if the VL_RESORT flag is set
- *
- * @param sl pointer to industry list
- */
-static void SortIndustriesList(GUIIndustryList *sl)
-{
-	if (!(sl->flags & VL_RESORT)) return;
-
-	_internal_sort_order = (sl->sort_type << 1) | (sl->flags & VL_DESC);
-	_last_industry = NULL; // used for "cache" in namesorting
-	qsort((void*)sl->Begin(), sl->Length(), sizeof(sl->Begin()), &GeneralIndustrySorter);
-
-	sl->flags &= ~VL_RESORT;
-}
 
 /**
  * The list of industries.
  */
-struct IndustryDirectoryWindow : public Window, public GUIIndustryList {
-	static Listing industry_sort;
+class IndustryDirectoryWindow : public Window {
+protected:
+	/* Runtime saved values */
+	static Listing last_sorting;
+	static const Industry *last_industry;
 
+	/* Constants for sorting stations */
+	static const StringID sorter_names[];
+	static GUIIndustryList::SortFunction *const sorter_funcs[];
+
+	GUIIndustryList industries;
+
+	/** (Re)Build industries list */
+	void BuildIndustriesList()
+	{
+		if (!this->industries.NeedRebuild()) return;
+
+		this->industries.Clear();
+
+		DEBUG(misc, 3, "Building industry list");
+
+		const Industry *i;
+		FOR_ALL_INDUSTRIES(i) {
+			*this->industries.Append() = i;
+		}
+
+		this->industries.Compact();
+		this->industries.RebuildDone();
+	}
+
+	/**
+	 * Returns percents of cargo transported if industry produces this cargo, else -1
+	 *
+	 * @param i industry to check
+	 * @param id cargo slot
+	 * @return percents of cargo transported, or -1 if industry doesn't use this cargo slot
+	 */
+	static inline int GetCargoTransportedPercentsIfValid(const Industry *i, uint id)
+	{
+		assert(id < lengthof(i->produced_cargo));
+
+		if (i->produced_cargo[id] == CT_INVALID) return 101;
+		return i->last_month_pct_transported[id] * 100 >> 8;
+	}
+
+	/**
+	 * Returns value representing industry's transported cargo
+	 *  percentage for industry sorting
+	 *
+	 * @param i industry to check
+	 * @return value used for sorting
+	 */
+	static int GetCargoTransportedSortValue(const Industry *i)
+	{
+		int p1 = GetCargoTransportedPercentsIfValid(i, 0);
+		int p2 = GetCargoTransportedPercentsIfValid(i, 1);
+
+		if (p1 > p2) Swap(p1, p2); // lower value has higher priority
+
+		return (p1 << 8) + p2;
+	}
+
+	/** Sort industries by name */
+	static int CDECL IndustryNameSorter(const Industry* const *a, const Industry* const *b)
+	{
+		static char buf_cache[96];
+		static char buf[96];
+
+		SetDParam(0, (*a)->town->index);
+		GetString(buf, STR_TOWN, lastof(buf));
+
+		if (*b != last_industry) {
+			last_industry = *b;
+			SetDParam(0, (*b)->town->index);
+			GetString(buf_cache, STR_TOWN, lastof(buf_cache));
+		}
+
+		return strcmp(buf, buf_cache);
+	}
+
+	/** Sort industries by type and name */
+	static int CDECL IndustryTypeSorter(const Industry* const *a, const Industry* const *b)
+	{
+		int r = (*a)->type - (*b)->type;
+		return (r == 0) ? IndustryNameSorter(a, b) : r;
+	}
+
+	/** Sort industries by production and name */
+	static int CDECL IndustryProductionSorter(const Industry* const *a, const Industry* const *b)
+	{
+		int r = 0;
+
+		if ((*a)->produced_cargo[0] == CT_INVALID) {
+			if ((*b)->produced_cargo[0] != CT_INVALID) return -1;
+		} else {
+			if ((*b)->produced_cargo[0] == CT_INVALID) return 1;
+
+			r = ((*a)->last_month_production[0] + (*a)->last_month_production[1]) -
+			    ((*b)->last_month_production[0] + (*b)->last_month_production[1]);
+		}
+
+		return (r == 0) ? IndustryNameSorter(a, b) : r;
+	}
+
+	/** Sort industries by transported cargo and name */
+	static int CDECL IndustryTransportedCargoSorter(const Industry* const *a, const Industry* const *b)
+	{
+		int r = GetCargoTransportedSortValue(*a) - GetCargoTransportedSortValue(*b);
+		return (r == 0) ? IndustryNameSorter(a, b) : r;
+	}
+
+	/** Sort the industries list */
+	void SortIndustriesList()
+	{
+		if (!this->industries.Sort()) return;
+
+		/* Reset name sorter sort cache */
+		this->last_industry = NULL;
+
+		/* Set the modified widget dirty */
+		this->InvalidateWidget(IDW_INDUSTRY_LIST);
+	}
+
+public:
 	IndustryDirectoryWindow(const WindowDesc *desc, WindowNumber number) : Window(desc, number)
 	{
 		this->vscroll.cap = 16;
@@ -859,26 +853,35 @@
 		this->resize.step_height = 10;
 		this->FindWindowPlacementAndResize(desc);
 
-		this->flags = VL_REBUILD;
-		this->sort_type = industry_sort.criteria;
-		if (industry_sort.order) this->flags |= VL_DESC;
+		this->industries.SetListing(this->last_sorting);
+		this->industries.SetSortFuncs(this->sorter_funcs);
+		this->industries.ForceRebuild();
+		this->industries.NeedResort();
+		this->SortIndustriesList();
+
+		this->widget[IDW_DROPDOWN_CRITERIA].data = this->sorter_names[this->industries.SortType()];
+	}
+
+	~IndustryDirectoryWindow()
+	{
+		this->last_sorting = this->industries.GetListing();
 	}
 
 	virtual void OnPaint()
 	{
-		BuildIndustriesList(this);
-		SortIndustriesList(this);
+		BuildIndustriesList();
+		SortIndustriesList();
 
-		SetVScrollCount(this, this->Length());
+		SetVScrollCount(this, this->industries.Length());
 
 		this->DrawWidgets();
-		this->DrawSortButtonState(IDW_SORTBYNAME + this->sort_type, this->flags & VL_DESC ? SBS_DOWN : SBS_UP);
+		this->DrawSortButtonState(IDW_DROPDOWN_ORDER, this->industries.IsDescSortOrder() ? SBS_DOWN : SBS_UP);
 
-		int max = min(this->vscroll.pos + this->vscroll.cap, this->Length());
+		int max = min(this->vscroll.pos + this->vscroll.cap, this->industries.Length());
 		int y = 28; // start of the list-widget
 
 		for (int n = this->vscroll.pos; n < max; ++n) {
-			const Industry* i = *this->Get(n);
+			const Industry* i = this->industries[n];
 			const IndustrySpec *indsp = GetIndustrySpec(i->type);
 			byte p = 0;
 
@@ -911,39 +914,41 @@
 	virtual void OnClick(Point pt, int widget)
 	{
 		switch (widget) {
-			case IDW_SORTBYNAME:
-			case IDW_SORTBYTYPE:
-			case IDW_SORTBYPROD:
-			case IDW_SORTBYTRANSPORT:
-				if (this->sort_type == (widget - IDW_SORTBYNAME)) {
-					this->flags ^= VL_DESC;
-				} else {
-					this->sort_type = widget - IDW_SORTBYNAME;
-					this->flags &= ~VL_DESC;
-				}
-				industry_sort.criteria = this->sort_type;
-				industry_sort.order = HasBit(this->flags, 0);
-				this->flags |= VL_RESORT;
+			case IDW_DROPDOWN_ORDER:
+				this->industries.ToggleSortOrder();
 				this->SetDirty();
 				break;
 
+			case IDW_DROPDOWN_CRITERIA:
+				ShowDropDownMenu(this, this->sorter_names, this->industries.SortType(), IDW_DROPDOWN_CRITERIA, 0, 0);
+				break;
+
 			case IDW_INDUSTRY_LIST: {
 				int y = (pt.y - 28) / 10;
 				uint16 p;
 
 				if (!IsInsideMM(y, 0, this->vscroll.cap)) return;
 				p = y + this->vscroll.pos;
-				if (p < this->Length()) {
+				if (p < this->industries.Length()) {
 					if (_ctrl_pressed) {
-						ShowExtraViewPortWindow((*this->Get(p))->xy);
+						ShowExtraViewPortWindow(this->industries[p]->xy);
 					} else {
-						ScrollMainWindowToTile((*this->Get(p))->xy);
+						ScrollMainWindowToTile(this->industries[p]->xy);
 					}
 				}
 			} break;
 		}
 	}
 
+	virtual void OnDropdownSelect(int widget, int index)
+	{
+		if (this->industries.SortType() != index) {
+			this->industries.SetSortType(index);
+			this->widget[IDW_DROPDOWN_CRITERIA].data = this->sorter_names[this->industries.SortType()];
+			this->SetDirty();
+		}
+	}
+
 	virtual void OnResize(Point new_size, Point delta)
 	{
 		this->vscroll.cap += delta.y / 10;
@@ -951,16 +956,39 @@
 
 	virtual void OnInvalidateData(int data)
 	{
-		this->flags |= (data == 0 ? VL_REBUILD : VL_RESORT);
+		if (data == 0) {
+			this->industries.ForceRebuild();
+		} else {
+			this->industries.ForceResort();
+		}
 		this->InvalidateWidget(IDW_INDUSTRY_LIST);
 	}
 };
 
-Listing IndustryDirectoryWindow::industry_sort = {0, 0};
+Listing IndustryDirectoryWindow::last_sorting = {false, 0};
+const Industry *IndustryDirectoryWindow::last_industry = NULL;
+
+/* Availible station sorting functions */
+GUIIndustryList::SortFunction* const IndustryDirectoryWindow::sorter_funcs[] = {
+	&IndustryNameSorter,
+	&IndustryTypeSorter,
+	&IndustryProductionSorter,
+	&IndustryTransportedCargoSorter
+};
+
+/* Names of the sorting functions */
+const StringID IndustryDirectoryWindow::sorter_names[] = {
+	STR_SORT_BY_DROPDOWN_NAME,
+	STR_SORT_BY_TYPE,
+	STR_SORT_BY_PRODUCTION,
+	STR_SORT_BY_TRANSPORTED,
+	INVALID_STRING_ID
+};
+
 
 /** Window definition of the industy directory gui */
 static const WindowDesc _industry_directory_desc = {
-	WDP_AUTO, WDP_AUTO, 508, 190, 508, 190,
+	WDP_AUTO, WDP_AUTO, 428, 190, 428, 190,
 	WC_INDUSTRY_DIRECTORY, WC_NONE,
 	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE,
 	_industry_directory_widgets,
--- a/src/landscape.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/landscape.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -526,7 +526,7 @@
  */
 byte GetSnowLine(void)
 {
-	if (_snow_line == NULL) return _settings.game_creation.snow_line;
+	if (_snow_line == NULL) return _settings_game.game_creation.snow_line;
 
 	YearMonthDay ymd;
 	ConvertDateToYMD(_date, &ymd);
@@ -539,7 +539,7 @@
  */
 byte HighestSnowLine(void)
 {
-	return _snow_line == NULL ? _settings.game_creation.snow_line : _snow_line->highest_value;
+	return _snow_line == NULL ? _settings_game.game_creation.snow_line : _snow_line->highest_value;
 }
 
 /**
@@ -818,14 +818,14 @@
 	static const int gwp_desert_amount = 4 + 8;
 
 	if (mode == GW_HEIGHTMAP) {
-		SetGeneratingWorldProgress(GWP_LANDSCAPE, (_settings.game_creation.landscape == LT_TROPIC) ? 1 + gwp_desert_amount : 1);
+		SetGeneratingWorldProgress(GWP_LANDSCAPE, (_settings_game.game_creation.landscape == LT_TROPIC) ? 1 + gwp_desert_amount : 1);
 		LoadHeightmap(_file_to_saveload.name);
 		IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
-	} else if (_settings.game_creation.land_generator == LG_TERRAGENESIS) {
-		SetGeneratingWorldProgress(GWP_LANDSCAPE, (_settings.game_creation.landscape == LT_TROPIC) ? 3 + gwp_desert_amount : 3);
+	} else if (_settings_game.game_creation.land_generator == LG_TERRAGENESIS) {
+		SetGeneratingWorldProgress(GWP_LANDSCAPE, (_settings_game.game_creation.landscape == LT_TROPIC) ? 3 + gwp_desert_amount : 3);
 		GenerateTerrainPerlin();
 	} else {
-		switch (_settings.game_creation.landscape) {
+		switch (_settings_game.game_creation.landscape) {
 			case LT_ARCTIC: {
 				SetGeneratingWorldProgress(GWP_LANDSCAPE, 2);
 
@@ -872,9 +872,9 @@
 
 				uint32 r = Random();
 
-				uint i = ScaleByMapSize(GB(r, 0, 7) + (3 - _settings.difficulty.quantity_sea_lakes) * 256 + 100);
+				uint i = ScaleByMapSize(GB(r, 0, 7) + (3 - _settings_game.difficulty.quantity_sea_lakes) * 256 + 100);
 				for (; i != 0; --i) {
-					GenerateTerrain(_settings.difficulty.terrain_type, 0);
+					GenerateTerrain(_settings_game.difficulty.terrain_type, 0);
 				}
 				IncreaseGeneratingWorldProgress(GWP_LANDSCAPE);
 			} break;
@@ -883,7 +883,7 @@
 
 	ConvertGroundTilesIntoWaterTiles();
 
-	if (_settings.game_creation.landscape == LT_TROPIC) CreateDesertOrRainForest();
+	if (_settings_game.game_creation.landscape == LT_TROPIC) CreateDesertOrRainForest();
 }
 
 void OnTick_Town();
--- a/src/lang/afrikaans.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/afrikaans.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -361,9 +361,9 @@
 STR_SORT_BY                                                     :{BLACK}Sorteer by
 
 STR_SORT_BY_POPULATION                                          :{BLACK}Populasie
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Produksie
-STR_SORT_BY_TYPE                                                :{BLACK}Tipe
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Uitgervoer
+STR_SORT_BY_PRODUCTION                                          :Produksie
+STR_SORT_BY_TYPE                                                :Tipe
+STR_SORT_BY_TRANSPORTED                                         :Uitgervoer
 STR_SORT_BY_NAME                                                :{BLACK}Naam
 STR_SORT_BY_DROPDOWN_NAME                                       :Naam
 STR_SORT_BY_DATE                                                :{BLACK}Datum
--- a/src/lang/brazilian_portuguese.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/brazilian_portuguese.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -364,9 +364,9 @@
 STR_SORT_BY                                                     :{BLACK}Ordenar por
 
 STR_SORT_BY_POPULATION                                          :{BLACK}População
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Produção
-STR_SORT_BY_TYPE                                                :{BLACK}Tipo
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Transportado
+STR_SORT_BY_PRODUCTION                                          :Produção
+STR_SORT_BY_TYPE                                                :Tipo
+STR_SORT_BY_TRANSPORTED                                         :Transportado
 STR_SORT_BY_NAME                                                :{BLACK}Nome
 STR_SORT_BY_DROPDOWN_NAME                                       :Nome
 STR_SORT_BY_DATE                                                :{BLACK}Data
@@ -487,6 +487,9 @@
 STR_01A5_COST_TO_CLEAR                                          :{BLACK}Custo para limpar: {LTBLUE}{CURRENCY}
 STR_01A6_N_A                                                    :N/D
 STR_01A7_OWNER                                                  :{BLACK}Proprietário: {LTBLUE}{STRING}
+STR_ROAD_OWNER                                                  :{BLACK}Dono da estrada: {LTBLUE}{STRING}
+STR_TRAM_OWNER                                                  :{BLACK}Dono da linha de bonde: {LTBLUE}{STRING}
+STR_RAIL_OWNER                                                  :{BLACK}Dono da linha de trem: {LTBLUE}{STRING}
 STR_01A8_LOCAL_AUTHORITY                                        :{BLACK}Autoridade local: {LTBLUE}{STRING}
 STR_01A9_NONE                                                   :Nenhum
 STR_01AA_NAME                                                   :{BLACK}Nome
@@ -1055,6 +1058,7 @@
 STR_CONFIG_PATCHES_PLANE_SPEED                                  :{LTBLUE}Fator de velocidade para aeronaves: {ORANGE}1 / {STRING}
 STR_CONFIG_PATCHES_STOP_ON_TOWN_ROAD                            :{LTBLUE}Permitir estações drive-through em ruas locais: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_ADJACENT_STATIONS                            :{LTBLUE}Permitir construção de estações adjacentes: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_DYNAMIC_ENGINES                              :{LTBLUE}Ativar múltiplos conjuntos NewGRF de locomotivas: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_SMALL_AIRPORTS                               :{LTBLUE}Permitir sempre aeroportos pequenos: {ORANGE}{STRING}
 
@@ -1365,7 +1369,7 @@
 STR_NETWORK_GAME_NAME_TIP                                       :{BLACK}Nome do jogo
 STR_NETWORK_INFO_ICONS_TIP                                      :{BLACK}Idioma, versão do servidor, etc.
 STR_NETWORK_CLICK_GAME_TO_SELECT                                :{BLACK}Clique num jogo da lista para o selecionar
-STR_NETWORK_LAST_JOINED_SERVER                                  :{BLACK}O servidor que você entrou última vez:
+STR_NETWORK_LAST_JOINED_SERVER                                  :{BLACK}O servidor que você entrou da última vez:
 STR_NETWORK_CLICK_TO_SELECT_LAST                                :{BLACK}Clique para selecionar o servidor que você jogou da última vez
 
 STR_NETWORK_FIND_SERVER                                         :{BLACK}Localizar servidor
@@ -1714,6 +1718,7 @@
 STR_1816_TREE_LINED_ROAD                                        :Rodovia arborizada
 STR_1817_ROAD_VEHICLE_DEPOT                                     :Garagem
 STR_1818_ROAD_RAIL_LEVEL_CROSSING                               :Passagem de nível
+STR_TRAMWAY                                                     :Linha de bonde
 STR_CAN_T_REMOVE_BUS_STATION                                    :{WHITE}Impossível remover estação de ônibus
 STR_CAN_T_REMOVE_TRUCK_STATION                                  :{WHITE}Impossível remover parada de caminhões
 STR_CAN_T_REMOVE_PASSENGER_TRAM_STATION                         :{WHITE}Impossível remover estação de bonde...
@@ -2659,13 +2664,13 @@
 STR_8804                                                        :{SETX 10}{COMMA}: {STRING} {STRING}
 STR_8805                                                        :{RIGHTARROW}{SETX 10}{COMMA}: {STRING} {STRING}
 STR_ORDER_GO_TO                                                 :Vá para
-STR_ORDER_GO_NON_STOP_TO                                        :Vá não parando para
+STR_ORDER_GO_NON_STOP_TO                                        :Ir sem parar para
 STR_ORDER_GO_VIA                                                :Vá via
-STR_ORDER_GO_NON_STOP_VIA                                       :Vá não parando via
+STR_ORDER_GO_NON_STOP_VIA                                       :Ir sem parar via
 STR_ORDER_DROP_LOAD_IF_POSSIBLE                                 :Carregar se disponível
-STR_ORDER_DROP_FULL_LOAD_ALL                                    :Full load all cargo
+STR_ORDER_DROP_FULL_LOAD_ALL                                    :Carregar tudo
 STR_ORDER_DROP_FULL_LOAD_ANY                                    :Carregar completamente qualquer carga
-STR_ORDER_DROP_NO_LOADING                                       :Não carregando
+STR_ORDER_DROP_NO_LOADING                                       :Não carregar
 STR_ORDER_DROP_UNLOAD_IF_ACCEPTED                               :Descarregar se aceito
 STR_ORDER_DROP_UNLOAD                                           :Descarregar tudo
 STR_ORDER_DROP_TRANSFER                                         :Transferir
@@ -3183,6 +3188,8 @@
 STR_NEWGRF_UNPAUSE_WARNING_TITLE                                :{YELLOW}Arquivo(s) GRF faltantes
 STR_NEWGRF_UNPAUSE_WARNING                                      :{WHITE}Despausar pode travar OpenTTD. Não envie relatórios de erros sobre travas subseqüentes.{}Você realmente quer despausar?
 
+STR_LOADGAME_REMOVED_TRAMS                                      :{WHITE}Jogo foi salvo numa versão sem suporte a bondes. Todos os bondes foram removidos.
+
 STR_CURRENCY_WINDOW                                             :{WHITE}Moeda Modificada
 STR_CURRENCY_EXCHANGE_RATE                                      :{LTBLUE}Taxa de câmbio: {ORANGE}{CURRENCY} = £ {COMMA}
 STR_CURRENCY_SEPARATOR                                          :{LTBLUE}Separador:
@@ -3413,7 +3420,7 @@
 STR_TRANSPARENT_STRUCTURES_DESC                                 :{BLACK}Alternar transparência para estruturas como faróis e antenas, talvez no futuro para efeitos visuais
 STR_TRANSPARENT_CATENARY_DESC                                   :{BLACK}Alternar transparência para catenária. CTRL+click para travar.
 STR_TRANSPARENT_LOADING_DESC                                    :{BLACK}Altera transparência para os indicadores de carga
-STR_TRANSPARENT_INVISIBLE_DESC                                  :{BLACK}Definir objetos invisíveis ao invés de transparente
+STR_TRANSPARENT_INVISIBLE_DESC                                  :{BLACK}Definir objetivos como invisíveis ao invés de transparentes.
 
 STR_PERCENT_UP_SMALL                                            :{TINYFONT}{WHITE}{NUM}%{UPARROW}
 STR_PERCENT_UP                                                  :{WHITE}{NUM}%{UPARROW}
@@ -3547,3 +3554,9 @@
 STR_OSK_KEYBOARD_LAYOUT                                         :`1234567890-=\qwertyuiop[]asdfghjkl;'  zxcvbnm,./ .
 STR_OSK_KEYBOARD_LAYOUT_CAPS                                    :~!@#$%^&*()_+|QWERTYUIOP{{}}ASDFGHJKL:"  ZXCVBNM<>? .
 ########
+
+############ town controlled noise level
+STR_CONFIG_PATCHES_NOISE_LEVEL                                  :{LTBLUE}Permitir controle de ruído de aeronaves pelas cidades: {ORANGE}{STRING}
+STR_NOISE_IN_TOWN                                               :{BLACK}Limite de ruído na cidade: {ORANGE}{COMMA}{BLACK}  max: {ORANGE}{COMMA}
+STR_STATION_NOISE                                               :{BLACK}Ruído gerado: {GOLD}{COMMA}
+########
--- a/src/lang/bulgarian.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/bulgarian.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -365,9 +365,9 @@
 STR_SORT_BY                                                     :{BLACK}Сортирай по
 
 STR_SORT_BY_POPULATION                                          :{BLACK}Население
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Продукция
-STR_SORT_BY_TYPE                                                :{BLACK}Вид
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Транспортирано
+STR_SORT_BY_PRODUCTION                                          :Продукция
+STR_SORT_BY_TYPE                                                :Вид
+STR_SORT_BY_TRANSPORTED                                         :Транспортирано
 STR_SORT_BY_NAME                                                :{BLACK}Име
 STR_SORT_BY_DROPDOWN_NAME                                       :Име
 STR_SORT_BY_DATE                                                :{BLACK}Дата
--- a/src/lang/catalan.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/catalan.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -363,9 +363,9 @@
 STR_SORT_BY                                                     :{BLACK}Ordenar per
 
 STR_SORT_BY_POPULATION                                          :{BLACK}Població
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Producció
-STR_SORT_BY_TYPE                                                :{BLACK}Tipus
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Transportat
+STR_SORT_BY_PRODUCTION                                          :Producció
+STR_SORT_BY_TYPE                                                :Tipus
+STR_SORT_BY_TRANSPORTED                                         :Transportat
 STR_SORT_BY_NAME                                                :{BLACK}Nom
 STR_SORT_BY_DROPDOWN_NAME                                       :Nom
 STR_SORT_BY_DATE                                                :{BLACK}Data
@@ -486,6 +486,9 @@
 STR_01A5_COST_TO_CLEAR                                          :{BLACK}Cost de neteja: {LTBLUE}{CURRENCY}
 STR_01A6_N_A                                                    :N/D
 STR_01A7_OWNER                                                  :{BLACK}Propietari: {LTBLUE}{STRING}
+STR_ROAD_OWNER                                                  :{BLACK}Propietari de la carretera: {LTBLUE}{STRING}
+STR_TRAM_OWNER                                                  :{BLACK}Propietari del rail del tramvia: {LTBLUE}{STRING}
+STR_RAIL_OWNER                                                  :{BLACK}Propietari del rail: {LTBLUE}{STRING}
 STR_01A8_LOCAL_AUTHORITY                                        :{BLACK}Autoritat Local: {LTBLUE}{STRING}
 STR_01A9_NONE                                                   :Ningú
 STR_01AA_NAME                                                   :{BLACK}Nom
@@ -1054,6 +1057,7 @@
 STR_CONFIG_PATCHES_PLANE_SPEED                                  :{LTBLUE}Factor de velocitat dels avions: {ORANGE}1 / {STRING}
 STR_CONFIG_PATCHES_STOP_ON_TOWN_ROAD                            :{LTBLUE}Permet situar parades en carreteres que són propietat del poble: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_ADJACENT_STATIONS                            :{LTBLUE}Permet construir estacions annexes: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_DYNAMIC_ENGINES                              :{LTBLUE}Activa diversos paquets de motors NewGRF: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_SMALL_AIRPORTS                               :{LTBLUE}Permet sempre aeroports petits: {ORANGE}{STRING}
 
@@ -1713,6 +1717,7 @@
 STR_1816_TREE_LINED_ROAD                                        :Carretera de tres carrils
 STR_1817_ROAD_VEHICLE_DEPOT                                     :Cotxeres
 STR_1818_ROAD_RAIL_LEVEL_CROSSING                               :Pas a nivell
+STR_TRAMWAY                                                     :Rail de Tramvia
 STR_CAN_T_REMOVE_BUS_STATION                                    :{WHITE}No es pot treure l'estació d'autobusos...
 STR_CAN_T_REMOVE_TRUCK_STATION                                  :{WHITE}No es pot treure l'estació de camions...
 STR_CAN_T_REMOVE_PASSENGER_TRAM_STATION                         :{WHITE}No puc treure l'estació de tramvies de passatgers
@@ -3182,6 +3187,8 @@
 STR_NEWGRF_UNPAUSE_WARNING_TITLE                                :{YELLOW}Falten arxiu(s) GRF
 STR_NEWGRF_UNPAUSE_WARNING                                      :{WHITE}Treure la pausa pot provocar fallades d'OpenTTD. No informis d'errors a causa de fallades subseqüents.{}Estàs segur de voler treure la pausa?
 
+STR_LOADGAME_REMOVED_TRAMS                                      :{WHITE}El joc s'ha desat en una versió sense suport de tramvies. Tots els tramvies s'han eliminat.
+
 STR_CURRENCY_WINDOW                                             :{WHITE}Moneda personalitzada
 STR_CURRENCY_EXCHANGE_RATE                                      :{LTBLUE}Canvi de moneda: {ORANGE}{CURRENCY} = £ {COMMA}
 STR_CURRENCY_SEPARATOR                                          :{LTBLUE}Separador:
@@ -3546,3 +3553,9 @@
 STR_OSK_KEYBOARD_LAYOUT                                         :`1234567890-=\qwertyuiop[]asdfghjkl;'  zxcvbnm,./ .
 STR_OSK_KEYBOARD_LAYOUT_CAPS                                    :~!@#$%^&*()_+|QWERTYUIOP{{}}ASDFGHJKL:"  ZXCVBNM<>? .
 ########
+
+############ town controlled noise level
+STR_CONFIG_PATCHES_NOISE_LEVEL                                  :{LTBLUE}Permet a la ciutat controlar el nivell de soroll dels aeroports: {ORANGE}{STRING}
+STR_NOISE_IN_TOWN                                               :{BLACK}Límit de soroll a la ciutat: {ORANGE}{COMMA}{BLACK}  max: {ORANGE}{COMMA}
+STR_STATION_NOISE                                               :{BLACK}Soroll generat: {GOLD}{COMMA}
+########
--- a/src/lang/croatian.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/croatian.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -19,6 +19,7 @@
 STR_0009                                                        :{WHITE}{CARGO}
 STR_000C_ACCEPTS                                                :{BLACK}Prihvaća: {WHITE}
 STR_000D_ACCEPTS                                                :{BLACK}Prihvaća: {GOLD}
+STR_SUPPLIES                                                    :{BLACK}Zalihe: {GOLD}
 STR_000E                                                        :
 STR_000F_PASSENGERS                                             :Putnici
 STR_0010_COAL                                                   :Ugljen
@@ -363,9 +364,9 @@
 STR_SORT_BY                                                     :{BLACK}Sortiraj prema
 
 STR_SORT_BY_POPULATION                                          :{BLACK}Stanovnici
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Produkcija
-STR_SORT_BY_TYPE                                                :{BLACK}Vrsta
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Prevezeno
+STR_SORT_BY_PRODUCTION                                          :Produkcija
+STR_SORT_BY_TYPE                                                :Vrsta
+STR_SORT_BY_TRANSPORTED                                         :Prevezeno
 STR_SORT_BY_NAME                                                :{BLACK}Ime
 STR_SORT_BY_DROPDOWN_NAME                                       :Ime
 STR_SORT_BY_DATE                                                :{BLACK}Datum
@@ -378,6 +379,7 @@
 STR_SORT_BY_MAX_SPEED                                           :Maksimalna brzina
 STR_SORT_BY_MODEL                                               :Model
 STR_SORT_BY_VALUE                                               :Vrijednost
+STR_SORT_BY_LENGTH                                              :Dužina
 STR_SORT_BY_FACILITY                                            :Vrsta stanice
 STR_SORT_BY_WAITING                                             :Vrijednost tereta koji čeka
 STR_SORT_BY_RATING_MAX                                          :Ocjena tereta
@@ -1170,6 +1172,7 @@
 STR_CONFIG_PATCHES_TOWN_LAYOUT_BETTER_ROADS                     :bolje ceste
 STR_CONFIG_PATCHES_TOWN_LAYOUT_2X2_GRID                         :2x2 mreža
 STR_CONFIG_PATCHES_TOWN_LAYOUT_3X3_GRID                         :3x3 mreža
+STR_CONFIG_PATCHES_TOWN_LAYOUT_RANDOM                           :nasumično
 
 STR_CONFIG_PATCHES_TOOLBAR_POS                                  :{LTBLUE}Položaj glavne alatne trake: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_TOOLBAR_POS_LEFT                             :Lijevo
@@ -1202,6 +1205,16 @@
 STR_CONFIG_PATCHES_QUERY_CAPT                                   :{WHITE}Promijeni vrijednost postavke
 STR_CONFIG_PATCHES_SERVICE_INTERVAL_INCOMPATIBLE                :{WHITE}Neki ili svi od zadanih servisnih intervala ispod nisu kompatibilni s odabranim postavkama! Valjane vrijednosti su 5-90% ili 30-800 dana.
 
+STR_CONFIG_PATCHES_PATHFINDER_FOR_TRAINS_NTP                    :NTP {RED}(Nije preporučivo)
+STR_CONFIG_PATCHES_PATHFINDER_FOR_TRAINS_NPF                    :NPF
+STR_CONFIG_PATCHES_PATHFINDER_FOR_TRAINS_YAPF                   :YAPF {BLUE}(Preporučeno)
+STR_CONFIG_PATCHES_PATHFINDER_FOR_ROADVEH_OPF                   :Original {RED}(Nije preporučivo)
+STR_CONFIG_PATCHES_PATHFINDER_FOR_ROADVEH_NPF                   :NPF
+STR_CONFIG_PATCHES_PATHFINDER_FOR_ROADVEH_YAPF                  :YAPF {BLUE}(Preporučeno)
+STR_CONFIG_PATCHES_PATHFINDER_FOR_SHIPS_OPF                     :Original {BLUE}(Preporučeno)
+STR_CONFIG_PATCHES_PATHFINDER_FOR_SHIPS_NPF                     :NPF
+STR_CONFIG_PATCHES_PATHFINDER_FOR_SHIPS_YAPF                    :YAPF {RED}(Nije preporučivo)
+
 STR_TEMPERATE_LANDSCAPE                                         :Blagi krajolik
 STR_SUB_ARCTIC_LANDSCAPE                                        :Pod-arktički krajolik
 STR_SUB_TROPICAL_LANDSCAPE                                      :Sub-tropski krajolik
@@ -1336,6 +1349,7 @@
 
 STR_NETWORK_PLAYER_NAME                                         :{BLACK}Ime igrača:
 STR_NETWORK_ENTER_NAME_TIP                                      :{BLACK}Ovo je ime po kojem će te drugi igrači raspoznavati
+STR_NETWORK_PLAYER_NAME_OSKTITLE                                :{BLACK}Upiši svoje ime
 STR_NETWORK_CONNECTION                                          :{BLACK}Veza:
 STR_NETWORK_CONNECTION_TIP                                      :{BLACK}Izaberi između internetske igre ili igre preko lokalne mreže (LAN)
 
@@ -2622,6 +2636,8 @@
 STR_8802_DETAILS                                                :{WHITE}{VEHICLE} (Detalji)
 STR_8803_TRAIN_IN_THE_WAY                                       :{WHITE}Vlak na putu
 
+
+
 STR_TIMETABLE_TRAVEL_NOT_TIMETABLED                             :Putovanje (bez rasporeda)
 STR_TIMETABLE_TRAVEL_FOR                                        :Putovanje za {STRING}
 STR_TIMETABLE_STAY_FOR                                          :i boravak za {STRING}
@@ -3075,6 +3091,7 @@
 STR_NEWGRF_UNPAUSE_WARNING_TITLE                                :{YELLOW}Nedostaje GRF datoteka(e)
 STR_NEWGRF_UNPAUSE_WARNING                                      :{WHITE}Odpauziranje može uzrokovati rušenje OpenTTD-a. Nemojte slati prijave bugova za posljedična rušenja.{}Želite li stvarno odpauzirati?
 
+
 STR_CURRENCY_WINDOW                                             :{WHITE}Proizvoljna valuta
 STR_CURRENCY_EXCHANGE_RATE                                      :{LTBLUE}Devizni tečaj: {ORANGE}{CURRENCY} = £ {COMMA}
 STR_CURRENCY_SEPARATOR                                          :{LTBLUE}Razdjelnik:
@@ -3427,3 +3444,9 @@
 STR_DRAG_SIGNALS_DENSITY_DECREASE_TIP                           :{BLACK}Smanji gustoću signala prilikom izgradnje
 STR_DRAG_SIGNALS_DENSITY_INCREASE_TIP                           :{BLACK}Povećaj gustoću signala prilikom izgradnje
 ########
+
+############ on screen keyboard
+########
+
+############ town controlled noise level
+########
--- a/src/lang/czech.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/czech.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -2,7 +2,7 @@
 ##ownname Čeština
 ##isocode cs_CZ
 ##plural 6
-##case nom gen dat acc voc loc ins big
+##case nom gen dat acc voc loc ins big small
 ##gender f m n
 
 #
@@ -421,9 +421,9 @@
 STR_SORT_BY                                                     :{BLACK}Řadit podle
 
 STR_SORT_BY_POPULATION                                          :{BLACK}Populace
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Prudukce
-STR_SORT_BY_TYPE                                                :{BLACK}Typu
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Přepraveno
+STR_SORT_BY_PRODUCTION                                          :Prudukce
+STR_SORT_BY_TYPE                                                :Typu
+STR_SORT_BY_TRANSPORTED                                         :Přepraveno
 STR_SORT_BY_NAME                                                :{BLACK}Podle jména
 STR_SORT_BY_DROPDOWN_NAME                                       :jména
 STR_SORT_BY_DATE                                                :{BLACK}Podle data
@@ -544,6 +544,9 @@
 STR_01A5_COST_TO_CLEAR                                          :{BLACK}Cena za vyčištění: {LTBLUE}{CURRENCY}
 STR_01A6_N_A                                                    :N/A
 STR_01A7_OWNER                                                  :{BLACK}Vlastník: {LTBLUE}{STRING}
+STR_ROAD_OWNER                                                  :{BLACK}Majitel silnice: {LTBLUE}{STRING}
+STR_TRAM_OWNER                                                  :{BLACK}Majitel tratě: {LTBLUE}{STRING}
+STR_RAIL_OWNER                                                  :{BLACK}Majitel tratě: {LTBLUE}{STRING}
 STR_01A8_LOCAL_AUTHORITY                                        :{BLACK}Místní správa: {LTBLUE}{STRING}
 STR_01A9_NONE                                                   :Nic
 STR_01AA_NAME                                                   :{BLACK}Jméno
@@ -1112,6 +1115,7 @@
 STR_CONFIG_PATCHES_PLANE_SPEED                                  :{LTBLUE}Činitel rychlosti letadel: {ORANGE}1/{STRING}
 STR_CONFIG_PATCHES_STOP_ON_TOWN_ROAD                            :{LTBLUE}Povolit průjezdné zastávky na silnicích vlastněných obcemi: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_ADJACENT_STATIONS                            :{LTBLUE}Povolit stavění přilehlých stanic: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_DYNAMIC_ENGINES                              :{LTBLUE}Více grafických setů s vozidly vedle sebe: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_SMALL_AIRPORTS                               :{LTBLUE}Malá letiště se budou moci stále stavět: {ORANGE}{STRING}
 
@@ -1771,6 +1775,7 @@
 STR_1816_TREE_LINED_ROAD                                        :Silnice s alejí
 STR_1817_ROAD_VEHICLE_DEPOT                                     :Garáž
 STR_1818_ROAD_RAIL_LEVEL_CROSSING                               :Železniční přejezd
+STR_TRAMWAY                                                     :Tramvaj
 STR_CAN_T_REMOVE_BUS_STATION                                    :{WHITE}Nelze odstranit autobusovou zastávku...
 STR_CAN_T_REMOVE_TRUCK_STATION                                  :{WHITE}Nelze odstranit nakládací rampu...
 STR_CAN_T_REMOVE_PASSENGER_TRAM_STATION                         :{WHITE}Nelze zbourat tramvajovou stanici pro cestující...
@@ -2752,6 +2757,7 @@
 STR_ORDER_TOOLTIP_UNLOAD                                        :{BLACK}Ovlivnit vykládání u vybraného příkazu
 STR_GO_TO_STATION                                               :{STRING} {STATION} {STRING}
 
+STR_ORDER_GO_TO_DROPDOWN_TOOLTIP                                :{BLACK}Vložit složitější příkaz
 STR_ORDER_GO_TO_NEAREST_DEPOT                                   :Jet do nejbližšího depa
 STR_ORDER_GO_TO_NEAREST_HANGAR                                  :Jet do nejbližšího hangáru
 STR_ORDER_NEAREST_DEPOT                                         :nebližšího
@@ -2765,6 +2771,29 @@
 STR_GO_TO_NEAREST_DEPOT                                         :{STRING} {STRING} {STRING}
 STR_GO_TO_HANGAR                                                :{STRING} {STATION} hangár
 
+STR_ORDER_CONDITIONAL                                           :Podmíněné přeskočení příkazu
+STR_ORDER_CONDITIONAL_VARIABLE_TOOLTIP                          :{BLACK}Vlastnost vozidla, podle které přeskakovat
+STR_ORDER_CONDITIONAL_COMPARATOR_TOOLTIP                        :{BLACK}Jak porovnat vlastnost vozidla se zadanou hodnotou
+STR_ORDER_CONDITIONAL_VALUE_TOOLTIP                             :{BLACK}Hodnota, se kterou srovnat vlastnost vozidla
+STR_ORDER_CONDITIONAL_VALUE_CAPT                                :{WHITE}Zadej hodnotu pro srovnávání
+STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE                           :Procento naložení
+STR_ORDER_CONDITIONAL_RELIABILITY                               :Spolehlivost
+STR_ORDER_CONDITIONAL_MAX_SPEED                                 :Maximální rychlost
+STR_ORDER_CONDITIONAL_AGE                                       :Stáří vozidla (v letech)
+STR_ORDER_CONDITIONAL_REQUIRES_SERVICE                          :Vyžaduje údržbu
+STR_ORDER_CONDITIONAL_UNCONDITIONALLY                           :Vždy
+STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS                         :se rovná
+STR_ORDER_CONDITIONAL_COMPARATOR_NOT_EQUALS                     :se nerovná
+STR_ORDER_CONDITIONAL_COMPARATOR_LESS_THAN                      :je menší než
+STR_ORDER_CONDITIONAL_COMPARATOR_LESS_EQUALS                    :je menší nebo rovno
+STR_ORDER_CONDITIONAL_COMPARATOR_MORE_THAN                      :je více než
+STR_ORDER_CONDITIONAL_COMPARATOR_MORE_EQUALS                    :je více nebo rovno
+STR_ORDER_CONDITIONAL_COMPARATOR_IS_TRUE                        :je pravda
+STR_ORDER_CONDITIONAL_COMPARATOR_IS_FALSE                       :není pravda
+STR_CONDITIONAL_VALUE                                           :{SKIP}{BLACK}{COMMA}
+STR_CONDITIONAL_UNCONDITIONAL                                   :Skočit na příkaz {COMMA}
+STR_CONDITIONAL_NUM                                             :Skočit na příkaz {COMMA}, když {STRING.small} {STRING} {COMMA}
+STR_CONDITIONAL_TRUE_FALSE                                      :Skočit na příkaz {COMMA}, když {STRING.small} {STRING}
 
 STR_TIMETABLE_TRAVEL_NOT_TIMETABLED                             :Jet do (mimo jízdní řád)
 STR_TIMETABLE_TRAVEL_FOR                                        :Jet do {STRING}
@@ -3222,6 +3251,8 @@
 STR_NEWGRF_UNPAUSE_WARNING_TITLE                                :{YELLOW}Chybějící grafické soubory
 STR_NEWGRF_UNPAUSE_WARNING                                      :{WHITE}Spuštění hry může shodit OpenTTD. Nehlaš chybu kvůli pádům způsobeným touto akcí.{}Opravdu chceš rozjet hru?
 
+STR_LOADGAME_REMOVED_TRAMS                                      :{WHITE}Hra byla uložena ve verzi bez podpory tramvají. Všechny tramvaje se odstraní.
+
 STR_CURRENCY_WINDOW                                             :{WHITE}Vlastní měna
 STR_CURRENCY_EXCHANGE_RATE                                      :{LTBLUE}Kurz měny: {ORANGE}{CURRENCY} = £ {COMMA}
 STR_CURRENCY_SEPARATOR                                          :{LTBLUE}Oddělovač:
@@ -3586,3 +3617,9 @@
 STR_OSK_KEYBOARD_LAYOUT                                         :"+ěščřžýáíé=-\qwertyuiopú)asdfghjklů'  zxcvbnm,./ .
 STR_OSK_KEYBOARD_LAYOUT_CAPS                                    :~1234567890_+|QWERTYUIOP/(}}ASDFGHJKL:!  ZXCVBNM?:_ .
 ########
+
+############ town controlled noise level
+STR_CONFIG_PATCHES_NOISE_LEVEL                                  :{LTBLUE}Umožnit městům ovlivňovat hlukový limit pro letiště: {ORANGE}{STRING}
+STR_NOISE_IN_TOWN                                               :{BLACK}Hlukový limit ve městě: {ORANGE}{COMMA}{BLACK}  max.: {ORANGE}{COMMA}
+STR_STATION_NOISE                                               :{BLACK}Vytvářený hluk: {GOLD}{COMMA}
+########
--- a/src/lang/danish.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/danish.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -18,6 +18,7 @@
 STR_EN_ROUTE_FROM                                               :{YELLOW}({SHORTCARGO} undervejs fra {STATION})
 STR_000C_ACCEPTS                                                :{BLACK}Accepterer: {WHITE}
 STR_000D_ACCEPTS                                                :{BLACK}Accepterer: {GOLD}
+STR_SUPPLIES                                                    :{BLACK}Forsyninger: {GOLD}
 STR_000E                                                        :
 STR_000F_PASSENGERS                                             :Passagerer
 STR_0010_COAL                                                   :Kul
@@ -362,9 +363,9 @@
 STR_SORT_BY                                                     :{BLACK}Sortér på
 
 STR_SORT_BY_POPULATION                                          :{BLACK}Indbyggertal
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Produktion
-STR_SORT_BY_TYPE                                                :{BLACK}Type
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Transporteret
+STR_SORT_BY_PRODUCTION                                          :Produktion
+STR_SORT_BY_TYPE                                                :Type
+STR_SORT_BY_TRANSPORTED                                         :Transporteret
 STR_SORT_BY_NAME                                                :{BLACK}Navn
 STR_SORT_BY_DROPDOWN_NAME                                       :Navn
 STR_SORT_BY_DATE                                                :{BLACK}Dato
@@ -1363,6 +1364,8 @@
 STR_NETWORK_GAME_NAME_TIP                                       :{BLACK}Spillets navn
 STR_NETWORK_INFO_ICONS_TIP                                      :{BLACK}Sprog, server version, osv.
 STR_NETWORK_CLICK_GAME_TO_SELECT                                :{BLACK}Klik på et spil fra listen for at vælge det
+STR_NETWORK_LAST_JOINED_SERVER                                  :{BLACK}Den senest tilsluttede server:
+STR_NETWORK_CLICK_TO_SELECT_LAST                                :{BLACK}Klik for at vælge den server du spillede på sidst
 
 STR_NETWORK_FIND_SERVER                                         :{BLACK}Find server
 STR_NETWORK_FIND_SERVER_TIP                                     :{BLACK}Søg netværket for en server
@@ -1396,6 +1399,7 @@
 
 STR_NETWORK_NEW_GAME_NAME                                       :{BLACK}Spillets navn:
 STR_NETWORK_NEW_GAME_NAME_TIP                                   :{BLACK}Navnet vil blive vist til andre spillere i menuen, hvor man vælger netværksspil
+STR_NETWORK_NEW_GAME_NAME_OSKTITLE                              :{BLACK}Skriv et navn for netværksspillet
 STR_NETWORK_SET_PASSWORD                                        :{BLACK}Sæt kodeord
 STR_NETWORK_PASSWORD_TIP                                        :{BLACK}Beskyt dit spil med et kodeord hvis du ikke vil have fremmede med
 STR_NETWORK_SELECT_MAP                                          :{BLACK}Vælg et kort:
@@ -1452,7 +1456,10 @@
 STR_NETWORK_LANG_SWEDISH                                        :Svensk
 STR_NETWORK_LANG_TURKISH                                        :Tyrkisk
 STR_NETWORK_LANG_UKRAINIAN                                      :Ukrainsk
+STR_NETWORK_LANG_AFRIKAANS                                      :Afrikaans
 STR_NETWORK_LANG_CROATIAN                                       :Kroatisk
+STR_NETWORK_LANG_CATALAN                                        :Catalansk
+STR_NETWORK_LANG_ESTONIAN                                       :Estisk
 STR_NETWORK_LANG_GALICIAN                                       :Galicisk
 STR_NETWORK_LANG_GREEK                                          :Græsk
 STR_NETWORK_LANG_LATVIAN                                        :Lettisk
@@ -1554,6 +1561,7 @@
 STR_NETWORK_CHAT_TO_CLIENT                                      :[Privat] Til {STRING}: {GRAY}{STRING}
 STR_NETWORK_CHAT_ALL_CAPTION                                    :[Alle] :
 STR_NETWORK_CHAT_ALL                                            :[Alle] {STRING}: {GRAY}{STRING}
+STR_NETWORK_CHAT_OSKTITLE                                       :{BLACK}Skriv tekst i netværks-chat
 STR_NETWORK_NAME_CHANGE                                         :har skiftet navn til
 STR_NETWORK_SERVER_SHUTDOWN                                     :{WHITE} Serveren har lukket ned for dette spil
 STR_NETWORK_SERVER_REBOOT                                       :{WHITE} Serveren genstarter...{}Vent venligst...
@@ -1957,6 +1965,7 @@
 STR_400F_SELECT_SCENARIO_GREEN_PRE                              :{BLACK}Vælg scenarie (grøn), predefineret spil (blå), eller nyt tilfældigt spil
 STR_4010_GENERATE_RANDOM_NEW_GAME                               :Generer nyt tilfældigt spil
 STR_LOAD_HEIGHTMAP                                              :{WHITE}Hent højdekort
+STR_SAVE_OSKTITLE                                               :{BLACK}Skriv et navn til det gemte spil
 
 ##id 0x4800
 STR_4800_IN_THE_WAY                                             :{WHITE}{STRING} i vejen
@@ -2652,14 +2661,40 @@
 STR_ORDER_GO_NON_STOP_TO                                        :Gå uden stop til
 STR_ORDER_GO_VIA                                                :Gå via
 STR_ORDER_GO_NON_STOP_VIA                                       :Gå uden stop via
+STR_ORDER_DROP_LOAD_IF_POSSIBLE                                 :Åbn hvis tilgængelig
+STR_ORDER_DROP_FULL_LOAD_ALL                                    :Fuld last af alt gods
+STR_ORDER_DROP_FULL_LOAD_ANY                                    :Fuld last af hvilket som helst gods
+STR_ORDER_DROP_NO_LOADING                                       :Ingen lastning
+STR_ORDER_DROP_UNLOAD_IF_ACCEPTED                               :Los hvis gods accepteres
 STR_ORDER_DROP_UNLOAD                                           :Aflæs alt
 STR_ORDER_DROP_TRANSFER                                         :Overfør
+STR_ORDER_DROP_NO_UNLOADING                                     :Ingen losning
+STR_ORDER_FULL_LOAD                                             :(Fuld last)
+STR_ORDER_FULL_LOAD_ANY                                         :(Fuld last af hvilket som helst gods)
+STR_ORDER_NO_LOAD                                               :(Ingen lastning)
+STR_ORDER_UNLOAD                                                :(Los og medtag gods)
+STR_ORDER_UNLOAD_FULL_LOAD                                      :(Los og vent på fuld last)
+STR_ORDER_UNLOAD_FULL_LOAD_ANY                                  :(Los og vent på fuld last af hvilket som helst gods)
+STR_ORDER_UNLOAD_NO_LOAD                                        :(Los og efterlad tom)
+STR_ORDER_TRANSFER                                              :(Overfør og last gods)
+STR_ORDER_TRANSFER_FULL_LOAD                                    :(Overfør og vent på fuld last)
+STR_ORDER_TRANSFER_FULL_LOAD_ANY                                :(Overfør og vent på fuld last af hvilket som helst gods)
 STR_ORDER_TRANSFER_NO_LOAD                                      :(Overfør og efterlad tom)
+STR_ORDER_NO_UNLOAD                                             :(Los ikke og last gods)
+STR_ORDER_NO_UNLOAD_FULL_LOAD                                   :(Los ikke og vent på fuld last)
+STR_ORDER_NO_UNLOAD_FULL_LOAD_ANY                               :(Los ikke og vent på fuld last af hvilket som helst gods)
+STR_ORDER_TOOLTIP_NON_STOP                                      :{BLACK}Ændr standseregel for den valgte ordre
+STR_ORDER_TOOLTIP_FULL_LOAD                                     :{BLACK}Ændr lasteregel for den valgte ordre
+STR_ORDER_TOOLTIP_UNLOAD                                        :{BLACK}Ændr losseregel for den valgte ordre
 STR_GO_TO_STATION                                               :{STRING} {STATION} {STRING}
 
+STR_ORDER_GO_TO_DROPDOWN_TOOLTIP                                :{BLACK}Indsæt en avanceret ordre
 STR_ORDER_GO_TO_NEAREST_DEPOT                                   :Gå til nærmeste depot
+STR_ORDER_GO_TO_NEAREST_HANGAR                                  :Flyv til nærmeste hangar
 STR_ORDER_NEAREST_DEPOT                                         :det nærmeste
 STR_ORDER_NEAREST_HANGAR                                        :den nærmeste hangar
+STR_ORDER_SERVICE_AT                                            :Servicer i
+STR_ORDER_SERVICE_NON_STOP_AT                                   :Gå direkte til service i
 STR_ORDER_TRAIN_DEPOT                                           :Remise
 STR_ORDER_ROAD_DEPOT                                            :Værksted
 STR_ORDER_SHIP_DEPOT                                            :Skibsdok
@@ -2667,6 +2702,12 @@
 STR_GO_TO_NEAREST_DEPOT                                         :{STRING} {STRING} {STRING}
 STR_GO_TO_HANGAR                                                :{STRING} {STATION} hangar
 
+STR_ORDER_CONDITIONAL                                           :Betinget ordrespring
+STR_ORDER_CONDITIONAL_VARIABLE_TOOLTIP                          :{BLACK}Data som ordrespring baseres på
+STR_ORDER_CONDITIONAL_COMPARATOR_TOOLTIP                        :{BLACK}Hvordan data sammenlignes med den givne værdi
+STR_ORDER_CONDITIONAL_VALUE_TOOLTIP                             :{BLACK}Værdi data skal sammenlignes med
+STR_ORDER_CONDITIONAL_VALUE_CAPT                                :{WHITE}Skriv værdi der sammenlignes med
+STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE                           :Last-procentdel
 STR_ORDER_CONDITIONAL_RELIABILITY                               :Pålidelighed
 STR_ORDER_CONDITIONAL_MAX_SPEED                                 :Tophastighed
 STR_ORDER_CONDITIONAL_AGE                                       :Køretøjets alder (år)
@@ -2681,6 +2722,9 @@
 STR_ORDER_CONDITIONAL_COMPARATOR_IS_TRUE                        :er sand
 STR_ORDER_CONDITIONAL_COMPARATOR_IS_FALSE                       :er falsk
 STR_CONDITIONAL_VALUE                                           :{SKIP}{BLACK}{COMMA}
+STR_CONDITIONAL_UNCONDITIONAL                                   :Spring til ordre {COMMA}
+STR_CONDITIONAL_NUM                                             :Spring til ordre {COMMA} når {STRING} {STRING} {COMMA}
+STR_CONDITIONAL_TRUE_FALSE                                      :Spring til ordre {COMMA} når {STRING} {STRING}
 
 STR_TIMETABLE_TRAVEL_NOT_TIMETABLED                             :Rejs (ikke iflg. køreplan)
 STR_TIMETABLE_TRAVEL_FOR                                        :Rejs i {STRING}
@@ -2729,6 +2773,7 @@
 STR_TIMETABLE_VIEW                                              :{BLACK}Køreplan
 STR_TIMETABLE_VIEW_TOOLTIP                                      :{BLACK}Skift til køreplan-visning
 STR_ORDER_VIEW                                                  :{BLACK}Ordrer
+STR_ORDER_VIEW_TOOLTIP                                          :{BLACK}Skift til ordrevisning
 STR_8829_ORDERS                                                 :{WHITE}{VEHICLE} (Ordrer)
 STR_882A_END_OF_ORDERS                                          :{SETX 10}- - Slut på ordrer - -
 STR_SERVICE                                                     :{BLACK}Service
@@ -3137,6 +3182,7 @@
 STR_NEWGRF_UNPAUSE_WARNING_TITLE                                :{YELLOW}Manglende GRF-fil(er)
 STR_NEWGRF_UNPAUSE_WARNING                                      :{WHITE}OpenTTD kan gå ned, når spillet sættes i gang igen. Undlad at indsende fejlrapporter for efterfølgende nedbrud.{}Vil du virkelig sætte spillet i gang igen?
 
+
 STR_CURRENCY_WINDOW                                             :{WHITE}Brugerdefineret møntfod
 STR_CURRENCY_EXCHANGE_RATE                                      :{LTBLUE}Kurs: {ORANGE}{CURRENCY} = £ {COMMA}
 STR_CURRENCY_SEPARATOR                                          :{LTBLUE}Tilskuer:
@@ -3274,6 +3320,7 @@
 STR_WORLD_GENERATION_CAPTION                                    :{WHITE}Verdensgenerering
 STR_RANDOM_SEED                                                 :{BLACK}Tilfældig
 STR_RANDOM_SEED_HELP                                            :{BLACK}Klik for at angive tilfældighed
+STR_RANDOM_SEED_OSKTITLE                                        :{BLACK}Skriv startværdi til tilfældige tal
 STR_LAND_GENERATOR                                              :{BLACK}Terrængenerator:
 STR_TREE_PLACER                                                 :{BLACK}Træalgoritme:
 STR_HEIGHTMAP_ROTATION                                          :{BLACK}Højdekortets rotation:
@@ -3366,6 +3413,7 @@
 STR_TRANSPARENT_STRUCTURES_DESC                                 :{BLACK}Skift gennemsigtighed for strukturer som fyrtårne og antenner, og måske i fremtiden for øjeguf
 STR_TRANSPARENT_CATENARY_DESC                                   :{BLACK}Slå transparens til/fra for køreledninger. CTRL+klik for at låse.
 STR_TRANSPARENT_LOADING_DESC                                    :{BLACK}Slå gennemsigtighed til/fra for laste-indikatorer
+STR_TRANSPARENT_INVISIBLE_DESC                                  :{BLACK}Gør objekter usynlige i stedet for gennemsigtige
 
 STR_PERCENT_UP_SMALL                                            :{TINYFONT}{WHITE}{NUM}%{UPARROW}
 STR_PERCENT_UP                                                  :{WHITE}{NUM}%{UPARROW}
@@ -3499,3 +3547,6 @@
 STR_OSK_KEYBOARD_LAYOUT                                         :`1234567890-=\qwertyuiop[]asdfghjkl;'  zxcvbnm,./ .
 STR_OSK_KEYBOARD_LAYOUT_CAPS                                    :~!@#$%^&*()_+|QWERTYUIOP{{}}ASDFGHJKL:"  ZXCVBNM<>? .
 ########
+
+############ town controlled noise level
+########
--- a/src/lang/dutch.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/dutch.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -363,9 +363,9 @@
 STR_SORT_BY                                                     :{BLACK}Sorteer op
 
 STR_SORT_BY_POPULATION                                          :{BLACK}Inwoners
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Productie
-STR_SORT_BY_TYPE                                                :{BLACK}Soort
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Vervoerd
+STR_SORT_BY_PRODUCTION                                          :Productie
+STR_SORT_BY_TYPE                                                :Soort
+STR_SORT_BY_TRANSPORTED                                         :Vervoerd
 STR_SORT_BY_NAME                                                :{BLACK}Naam
 STR_SORT_BY_DROPDOWN_NAME                                       :Naam
 STR_SORT_BY_DATE                                                :{BLACK}Datum
@@ -486,6 +486,9 @@
 STR_01A5_COST_TO_CLEAR                                          :{BLACK}Sloopkosten: {LTBLUE}{CURRENCY}
 STR_01A6_N_A                                                    :(geen)
 STR_01A7_OWNER                                                  :{BLACK}Eigenaar: {LTBLUE}{STRING}
+STR_ROAD_OWNER                                                  :{BLACK}Weg eigenaar: {LTBLUE}{STRING}
+STR_TRAM_OWNER                                                  :{BLACK}Tramspoor eigenaar: {LTBLUE}{STRING}
+STR_RAIL_OWNER                                                  :{BLACK}Spoor eigenaar: {LTBLUE}{STRING}
 STR_01A8_LOCAL_AUTHORITY                                        :{BLACK}Gemeente: {LTBLUE}{STRING}
 STR_01A9_NONE                                                   :Geen
 STR_01AA_NAME                                                   :{BLACK}Naam
@@ -1054,6 +1057,7 @@
 STR_CONFIG_PATCHES_PLANE_SPEED                                  :{LTBLUE}Vliegtuig snelheidsverhouding: {ORANGE}1 / {STRING}
 STR_CONFIG_PATCHES_STOP_ON_TOWN_ROAD                            :{LTBLUE}Laat toe dat doorrij wegstops worden geplaatst op door stad beheerde wegen: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_ADJACENT_STATIONS                            :{LTBLUE}Bouwen van aangrenzende stations toestaan: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_DYNAMIC_ENGINES                              :{LTBLUE}Activeer meerdere NewGRF treinsets: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_SMALL_AIRPORTS                               :{LTBLUE}Altijd kleine vliegvelden toestaan: {ORANGE}{STRING}
 
@@ -1713,6 +1717,7 @@
 STR_1816_TREE_LINED_ROAD                                        :Weg met bomenrij
 STR_1817_ROAD_VEHICLE_DEPOT                                     :Wegvoertuigdepot
 STR_1818_ROAD_RAIL_LEVEL_CROSSING                               :Gelijke weg/spoorweg kruising
+STR_TRAMWAY                                                     :Tramspoor
 STR_CAN_T_REMOVE_BUS_STATION                                    :{WHITE}Kan busstation niet verwijderen...
 STR_CAN_T_REMOVE_TRUCK_STATION                                  :{WHITE}Kan vrachtwagenstation niet verwijderen...
 STR_CAN_T_REMOVE_PASSENGER_TRAM_STATION                         :{WHITE}Kan passagiers tram station niet verwijderen...
@@ -3182,6 +3187,8 @@
 STR_NEWGRF_UNPAUSE_WARNING_TITLE                                :{YELLOW}Ontbrekende GRF bestand(en)
 STR_NEWGRF_UNPAUSE_WARNING                                      :{WHITE}Pauze uit zetten kan OpenTTD laten vastlopen. Geef geen fout rapporten bij herhaaldelijk vastlopen.{}Weet je zeker dat je pauze wilt uit zetten?
 
+STR_LOADGAME_REMOVED_TRAMS                                      :{WHITE}Spel was opgeslagen in een versie zonder tram ondersteuning. Alle trams zijn verwijderd.
+
 STR_CURRENCY_WINDOW                                             :{WHITE}Aangepaste valuta
 STR_CURRENCY_EXCHANGE_RATE                                      :{LTBLUE}Wisselkoers: {ORANGE}{CURRENCY} = £ {COMMA}
 STR_CURRENCY_SEPARATOR                                          :{LTBLUE}Scheidingsteken:
@@ -3546,3 +3553,9 @@
 STR_OSK_KEYBOARD_LAYOUT                                         :`1234567890-=\qwertyuiop[]asdfghjkl;'  zxcvbnm,./ .
 STR_OSK_KEYBOARD_LAYOUT_CAPS                                    :~!@#$%^&*()_+|QWERTYUIOP{{}}ASDFGHJKL:"  ZXCVBNM<>? .
 ########
+
+############ town controlled noise level
+STR_CONFIG_PATCHES_NOISE_LEVEL                                  :{LTBLUE}Geluidsniveau controle door steden voor vliegvelden toestaan: {ORANGE}{STRING}
+STR_NOISE_IN_TOWN                                               :{BLACK}Geluidslimiet in steden: {ORANGE}{COMMA}{BLACK}  max: {ORANGE}{COMMA}
+STR_STATION_NOISE                                               :{BLACK}Geluid gegenereerd: {GOLD}{COMMA}
+########
--- a/src/lang/english.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/english.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -363,9 +363,9 @@
 STR_SORT_BY                                                     :{BLACK}Sort by
 
 STR_SORT_BY_POPULATION                                          :{BLACK}Population
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Production
-STR_SORT_BY_TYPE                                                :{BLACK}Type
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Transported
+STR_SORT_BY_PRODUCTION                                          :Production
+STR_SORT_BY_TYPE                                                :Type
+STR_SORT_BY_TRANSPORTED                                         :Transported
 STR_SORT_BY_NAME                                                :{BLACK}Name
 STR_SORT_BY_DROPDOWN_NAME                                       :Name
 STR_SORT_BY_DATE                                                :{BLACK}Date
--- a/src/lang/english_US.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/english_US.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -361,9 +361,9 @@
 STR_SORT_BY                                                     :{BLACK}Sort by
 
 STR_SORT_BY_POPULATION                                          :{BLACK}Population
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Production
-STR_SORT_BY_TYPE                                                :{BLACK}Type
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Transported
+STR_SORT_BY_PRODUCTION                                          :Production
+STR_SORT_BY_TYPE                                                :Type
+STR_SORT_BY_TRANSPORTED                                         :Transported
 STR_SORT_BY_NAME                                                :{BLACK}Name
 STR_SORT_BY_DROPDOWN_NAME                                       :Name
 STR_SORT_BY_DATE                                                :{BLACK}Date
--- a/src/lang/esperanto.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/esperanto.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -362,9 +362,9 @@
 STR_SORT_BY                                                     :{BLACK}Ordigu laŭ
 
 STR_SORT_BY_POPULATION                                          :{BLACK}Enloĝantaro
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Produktado
-STR_SORT_BY_TYPE                                                :{BLACK}Tipo
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Transportiĝis
+STR_SORT_BY_PRODUCTION                                          :Produktado
+STR_SORT_BY_TYPE                                                :Tipo
+STR_SORT_BY_TRANSPORTED                                         :Transportiĝis
 STR_SORT_BY_NAME                                                :{BLACK}Nomo
 STR_SORT_BY_DROPDOWN_NAME                                       :Nomo
 STR_SORT_BY_DATE                                                :{BLACK}Dato
--- a/src/lang/estonian.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/estonian.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -2,7 +2,7 @@
 ##ownname Eesti keel
 ##isocode et_ET
 ##plural 0
-##case g genitiiv
+##case g in
 
 #
 
@@ -51,138 +51,92 @@
 STR_001C_FRUIT.g                                                :Puuviljade
 STR_001D_DIAMONDS                                               :Teemantid
 STR_001D_DIAMONDS.g                                             :Teemantite
-STR_001D_DIAMONDS.genitiiv                                      :Teemantite
 STR_001E_FOOD                                                   :Toit
 STR_001E_FOOD.g                                                 :Toidu
-STR_001E_FOOD.genitiiv                                          :Toidu
 STR_001F_PAPER                                                  :Paber
 STR_001F_PAPER.g                                                :Paberi
-STR_001F_PAPER.genitiiv                                         :Paberi
 STR_0020_GOLD                                                   :Kuld
 STR_0020_GOLD.g                                                 :Kulla
-STR_0020_GOLD.genitiiv                                          :Kulla
 STR_0021_WATER                                                  :Vesi
 STR_0021_WATER.g                                                :Vee
-STR_0021_WATER.genitiiv                                         :Vee
 STR_0022_WHEAT                                                  :Nisu
 STR_0022_WHEAT.g                                                :Nisu
-STR_0022_WHEAT.genitiiv                                         :Nisu
 STR_0023_RUBBER                                                 :Kumm
 STR_0023_RUBBER.g                                               :Kummi
-STR_0023_RUBBER.genitiiv                                        :Kummi
 STR_0024_SUGAR                                                  :Suhkur
 STR_0024_SUGAR.g                                                :Suhkru
-STR_0024_SUGAR.genitiiv                                         :Suhkru
 STR_0025_TOYS                                                   :Mänguasjad
 STR_0025_TOYS.g                                                 :Mänguasjade
-STR_0025_TOYS.genitiiv                                          :Mänguasjade
 STR_0026_CANDY                                                  :Maiustused
 STR_0026_CANDY.g                                                :Maiustuste
-STR_0026_CANDY.genitiiv                                         :Maiustuste
 STR_0027_COLA                                                   :Koola
 STR_0027_COLA.g                                                 :Koola
-STR_0027_COLA.genitiiv                                          :Koola
 STR_0028_COTTON_CANDY                                           :Suhkruvatt
 STR_0028_COTTON_CANDY.g                                         :Suhkruvati
-STR_0028_COTTON_CANDY.genitiiv                                  :Suhkruvati
 STR_0029_BUBBLES                                                :Mullid
 STR_0029_BUBBLES.g                                              :Mullide
-STR_0029_BUBBLES.genitiiv                                       :Mullide
 STR_002A_TOFFEE                                                 :Iiris
 STR_002A_TOFFEE.g                                               :Iirise
-STR_002A_TOFFEE.genitiiv                                        :Iirise
 STR_002B_BATTERIES                                              :Patareid
 STR_002B_BATTERIES.g                                            :Patareide
-STR_002B_BATTERIES.genitiiv                                     :Patareide
 STR_002C_PLASTIC                                                :Plastmass
 STR_002C_PLASTIC.g                                              :Plastmassi
-STR_002C_PLASTIC.genitiiv                                       :Plastmassi
 STR_002D_FIZZY_DRINKS                                           :Kihisevad joogid
 STR_002D_FIZZY_DRINKS.g                                         :Kihisevate jookide
-STR_002D_FIZZY_DRINKS.genitiiv                                  :Kihisevate jookide
 STR_002E                                                        :
 STR_002F_PASSENGER                                              :Reisija
 STR_002F_PASSENGER.g                                            :Reisijate
-STR_002F_PASSENGER.genitiiv                                     :Reisijate
 STR_0030_COAL                                                   :Kivisüsi
 STR_0030_COAL.g                                                 :Kivisöe
-STR_0030_COAL.genitiiv                                          :Kivisöe
 STR_0031_MAIL                                                   :Post
 STR_0031_MAIL.g                                                 :Posti
 STR_0032_OIL                                                    :Nafta
 STR_0032_OIL.g                                                  :Nafta
-STR_0032_OIL.genitiiv                                           :Nafta
 STR_0033_LIVESTOCK                                              :Kariloom
 STR_0033_LIVESTOCK.g                                            :Kariloomade
-STR_0033_LIVESTOCK.genitiiv                                     :Kariloomade
 STR_0034_GOODS                                                  :Kaubad
 STR_0034_GOODS.g                                                :Kaupade
-STR_0034_GOODS.genitiiv                                         :Kaupade
 STR_0035_GRAIN                                                  :Teravili
 STR_0035_GRAIN.g                                                :Teravilja
-STR_0035_GRAIN.genitiiv                                         :Teravilja
 STR_0036_WOOD                                                   :Puit
 STR_0036_WOOD.g                                                 :Puidu
-STR_0036_WOOD.genitiiv                                          :Puidu
 STR_0037_IRON_ORE                                               :Rauamaak
 STR_0037_IRON_ORE.g                                             :Rauamaagi
-STR_0037_IRON_ORE.genitiiv                                      :Rauamaagi
 STR_0038_STEEL                                                  :Teras
 STR_0038_STEEL.g                                                :Terase
-STR_0038_STEEL.genitiiv                                         :Terase
 STR_0039_VALUABLES                                              :Väärisesemed
 STR_0039_VALUABLES.g                                            :Väärisesemete
-STR_0039_VALUABLES.genitiiv                                     :Väärisesemete
 STR_003A_COPPER_ORE                                             :Vasemaak
 STR_003A_COPPER_ORE.g                                           :Vasemaagi
-STR_003A_COPPER_ORE.genitiiv                                    :Vasemaagi
 STR_003B_MAIZE                                                  :Mais
 STR_003B_MAIZE.g                                                :Maisi
 STR_003C_FRUIT                                                  :Puuviljad
 STR_003C_FRUIT.g                                                :Puuviljade
-STR_003C_FRUIT.genitiiv                                         :Puuviljade
 STR_003D_DIAMOND                                                :Teemant
 STR_003D_DIAMOND.g                                              :Teemantite
-STR_003D_DIAMOND.genitiiv                                       :Teemantite
 STR_003E_FOOD                                                   :Toit
 STR_003E_FOOD.g                                                 :Toidu
-STR_003E_FOOD.genitiiv                                          :Toidu
 STR_003F_PAPER                                                  :Paber
 STR_003F_PAPER.g                                                :Paberi
-STR_003F_PAPER.genitiiv                                         :Paberi
 STR_0040_GOLD                                                   :Kuld
 STR_0040_GOLD.g                                                 :Kulla
-STR_0040_GOLD.genitiiv                                          :Kulla
 STR_0041_WATER                                                  :Vesi
 STR_0041_WATER.g                                                :Vee
-STR_0041_WATER.genitiiv                                         :Vee
 STR_0042_WHEAT                                                  :Nisu
 STR_0042_WHEAT.g                                                :Nisu
-STR_0042_WHEAT.genitiiv                                         :Nisu
 STR_0043_RUBBER                                                 :Kumm
 STR_0043_RUBBER.g                                               :kummi
-STR_0043_RUBBER.genitiiv                                        :Kummi
 STR_0044_SUGAR                                                  :Suhkur
 STR_0044_SUGAR.g                                                :Suhkru
-STR_0044_SUGAR.genitiiv                                         :Suhkru
 STR_0045_TOY                                                    :Mänguasjad
-STR_0045_TOY.genitiiv                                           :Mänguasjade
 STR_0046_CANDY                                                  :Maiustus
-STR_0046_CANDY.genitiiv                                         :Maiustuste
 STR_0047_COLA                                                   :Koola
-STR_0047_COLA.genitiiv                                          :Koola
 STR_0048_COTTON_CANDY                                           :Suhkruvatt
-STR_0048_COTTON_CANDY.genitiiv                                  :Suhkruvati
 STR_0049_BUBBLE                                                 :Mullid
-STR_0049_BUBBLE.genitiiv                                        :Mullide
 STR_004A_TOFFEE                                                 :Iiris
-STR_004A_TOFFEE.genitiiv                                        :Iirise
 STR_004B_BATTERY                                                :Patarei
-STR_004B_BATTERY.genitiiv                                       :Patareide
 STR_004C_PLASTIC                                                :Plastmass
-STR_004C_PLASTIC.genitiiv                                       :Plastmassi
 STR_004D_FIZZY_DRINK                                            :Kihisevad joogid
-STR_004D_FIZZY_DRINK.genitiiv                                   :Kihisevate jookide
 STR_QUANTITY_NOTHING                                            :
 STR_QUANTITY_PASSENGERS                                         :{COMMA} reisija{P "" t}
 STR_QUANTITY_COAL                                               :{WEIGHT} kivisütt
@@ -463,9 +417,9 @@
 STR_SORT_BY                                                     :{BLACK}Sorteeri:
 
 STR_SORT_BY_POPULATION                                          :{BLACK}Rahvaarv
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Toodang
-STR_SORT_BY_TYPE                                                :{BLACK}Tüüp
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Veetud
+STR_SORT_BY_PRODUCTION                                          :Toodang
+STR_SORT_BY_TYPE                                                :Tüüp
+STR_SORT_BY_TRANSPORTED                                         :Veetud
 STR_SORT_BY_NAME                                                :{BLACK}Nimi
 STR_SORT_BY_DROPDOWN_NAME                                       :Nimi
 STR_SORT_BY_DATE                                                :{BLACK}Daatum
@@ -478,6 +432,7 @@
 STR_SORT_BY_MAX_SPEED                                           :Tippkiirus
 STR_SORT_BY_MODEL                                               :Mudel
 STR_SORT_BY_VALUE                                               :Väärtus
+STR_SORT_BY_LENGTH                                              :Pikkus
 STR_SORT_BY_FACILITY                                            :Jaama tüüp
 STR_SORT_BY_WAITING                                             :Ootava kauba väärtus
 STR_SORT_BY_RATING_MAX                                          :Kauba hinnang
@@ -746,39 +701,72 @@
 STR_023E_BUILD_TOWN_IN_RANDOM_LOCATION                          :{BLACK}Ehita linn suvalisse kohta
 STR_023F_INDUSTRY_GENERATION                                    :{WHITE}Tööstuste loomine
 STR_0240_COAL_MINE                                              :{BLACK}Kivisöekaevandus
+STR_0240_COAL_MINE.in                                           :{BLACK}Kivisöekaevanduses
 STR_0241_POWER_STATION                                          :{BLACK}Elektrijaam
+STR_0241_POWER_STATION.in                                       :{BLACK}Elektrijaamas
 STR_0242_SAWMILL                                                :{BLACK}Saeveski
+STR_0242_SAWMILL.in                                             :{BLACK}Saeveskis
 STR_0243_FOREST                                                 :{BLACK}Mets
 STR_0244_OIL_REFINERY                                           :{BLACK}Naftarafineerimistehas
-STR_0245_OIL_RIG                                                :{BLACK}Naftaplatvorm
-STR_0246_FACTORY                                                :{BLACK}Vabrik
+STR_0244_OIL_REFINERY.in                                        :{BLACK}Naftarafineerimistehases
+STR_0245_OIL_RIG                                                :{BLACK}Naftapuurplatvorm
+STR_0245_OIL_RIG.in                                             :{BLACK}Naftapuurplatvormis
+STR_0246_FACTORY                                                :{BLACK}Tehas
+STR_0246_FACTORY.in                                             :{BLACK}Tehases
 STR_0247_STEEL_MILL                                             :{BLACK}Terasetööstus
-STR_0248_FARM                                                   :{BLACK}Talu
+STR_0247_STEEL_MILL.in                                          :{BLACK}Terasetööstuses
+STR_0248_FARM                                                   :{BLACK}Põllumajandusettevõte
+STR_0248_FARM.in                                                :{BLACK}Põllumajandusettevõttes
 STR_0249_IRON_ORE_MINE                                          :{BLACK}Rauamaagikaevandus
+STR_0249_IRON_ORE_MINE.in                                       :{BLACK}Rauamaagikaevanduses
 STR_024A_OIL_WELLS                                              :{BLACK}Naftapuuraugud
+STR_024A_OIL_WELLS.in                                           :{BLACK}Naftapuuraukudes
 STR_024B_BANK                                                   :{BLACK}Pank
+STR_024B_BANK.in                                                :{BLACK}Pangas
 STR_024C_PAPER_MILL                                             :{BLACK}Paberitehas
+STR_024C_PAPER_MILL.in                                          :{BLACK}Paberitehases
 STR_024D_FOOD_PROCESSING_PLANT                                  :{BLACK}Toidutöötlustehas
+STR_024D_FOOD_PROCESSING_PLANT.in                               :{BLACK}Toidutöötlustehases
 STR_024E_PRINTING_WORKS                                         :{BLACK}Trükikoda
+STR_024E_PRINTING_WORKS.in                                      :{BLACK}Trükikojas
 STR_024F_GOLD_MINE                                              :{BLACK}Kullakaevandus
+STR_024F_GOLD_MINE.in                                           :{BLACK}Kullakaevanduses
 STR_0250_LUMBER_MILL                                            :{BLACK}Saeveski
+STR_0250_LUMBER_MILL.in                                         :{BLACK}Saeveskis
 STR_0251_FRUIT_PLANTATION                                       :{BLACK}Puuviljaistandus
+STR_0251_FRUIT_PLANTATION.in                                    :{BLACK}Puuviljaistanduses
 STR_0252_RUBBER_PLANTATION                                      :{BLACK}Kummipuuistandus
+STR_0252_RUBBER_PLANTATION.in                                   :{BLACK}Kummipuuistanduses
 STR_0253_WATER_SUPPLY                                           :{BLACK}Veepumbad
+STR_0253_WATER_SUPPLY.in                                        :{BLACK}Veepumpades
 STR_0254_WATER_TOWER                                            :{BLACK}Veetorn
+STR_0254_WATER_TOWER.in                                         :{BLACK}Veetornis
 STR_0255_DIAMOND_MINE                                           :{BLACK}Teemantikaevandus
+STR_0255_DIAMOND_MINE.in                                        :{BLACK}Teemantikaevanduses
 STR_0256_COPPER_ORE_MINE                                        :{BLACK}Vasemaagikaevandus
+STR_0256_COPPER_ORE_MINE.in                                     :{BLACK}Vasemaagikaevanduses
 STR_0257_COTTON_CANDY_FOREST                                    :{BLACK}Suhkruvatimets
+STR_0257_COTTON_CANDY_FOREST.in                                 :{BLACK}Suhkruvatimetsas
 STR_0258_CANDY_FACTORY                                          :{BLACK}Maiustuste tehas
+STR_0258_CANDY_FACTORY.in                                       :{BLACK}Maiustuste tehases
 STR_0259_BATTERY_FARM                                           :{BLACK}Patareitalu
+STR_0259_BATTERY_FARM.in                                        :{BLACK}Patareitalus
 STR_025A_COLA_WELLS                                             :{BLACK}Koolapumbad
+STR_025A_COLA_WELLS.in                                          :{BLACK}Koolapumpades
 STR_025B_TOY_SHOP                                               :{BLACK}Mänguasjapood
+STR_025B_TOY_SHOP.in                                            :{BLACK}Mänguasjapoes
 STR_025C_TOY_FACTORY                                            :{BLACK}Mänguasjatehas
+STR_025C_TOY_FACTORY.in                                         :{BLACK}Mänguasjatehases
 STR_025D_PLASTIC_FOUNTAINS                                      :{BLACK}Plastmassiallikad
+STR_025D_PLASTIC_FOUNTAINS.in                                   :{BLACK}Plastmassiallikates
 STR_025E_FIZZY_DRINK_FACTORY                                    :{BLACK}Kihisevate jookide tehas
+STR_025E_FIZZY_DRINK_FACTORY.in                                 :{BLACK}Kihisevate jookide tehases
 STR_025F_BUBBLE_GENERATOR                                       :{BLACK}Mulligeneraator
+STR_025F_BUBBLE_GENERATOR.in                                    :{BLACK}Mulligeneraatoris
 STR_0260_TOFFEE_QUARRY                                          :{BLACK}Iirisekaevandus
+STR_0260_TOFFEE_QUARRY.in                                       :{BLACK}Iirisekaevanduses
 STR_0261_SUGAR_MINE                                             :{BLACK}Suhkrukaevandus
+STR_0261_SUGAR_MINE.in                                          :{BLACK}Suhkrukaevanduses
 STR_0262_CONSTRUCT_COAL_MINE                                    :{BLACK}Ehita kivisöekaevandus
 STR_0263_CONSTRUCT_POWER_STATION                                :{BLACK}Ehita elektrijaam
 STR_0264_CONSTRUCT_SAWMILL                                      :{BLACK}Ehita saeveski
@@ -952,7 +940,7 @@
 STR_0312_FUND_CONSTRUCTION_OF_NEW                               :{BLACK}Rahasta uute ehitiste konstrueerimist
 
 ############ range for menu starts
-STR_INDUSTRY_DIR                                                :Tööstuste nimistu
+STR_INDUSTRY_DIR                                                :Tööstuste kataloog
 STR_0313_FUND_NEW_INDUSTRY                                      :Uue tööstuse rahastamine
 ############ range ends here
 
@@ -1153,6 +1141,7 @@
 STR_CONFIG_PATCHES_PLANE_SPEED                                  :{LTBLUE}Lennuki kiiruse tegur: {ORANGE}1 / {STRING}
 STR_CONFIG_PATCHES_STOP_ON_TOWN_ROAD                            :{LTBLUE}Luba läbisõidupeatused linnateedel: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_ADJACENT_STATIONS                            :{LTBLUE}Luba jaamu lähestikku ehitada: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_DYNAMIC_ENGINES                              :{LTBLUE}Lubatakse mitu NewGRF sõidukikomplekti: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_SMALL_AIRPORTS                               :{LTBLUE}Luba väikesed lennuväljad kuni mängu lõpuni: {ORANGE}{STRING}
 
@@ -1463,6 +1452,8 @@
 STR_NETWORK_GAME_NAME_TIP                                       :{BLACK}Mängu nimi
 STR_NETWORK_INFO_ICONS_TIP                                      :{BLACK}Suhtluskeel, serveri versioon, jne.
 STR_NETWORK_CLICK_GAME_TO_SELECT                                :{BLACK}Mäng valimiseks vajuta nimekirjas olevale nimele
+STR_NETWORK_LAST_JOINED_SERVER                                  :{BLACK}Server, kus sa viimati mängisid:
+STR_NETWORK_CLICK_TO_SELECT_LAST                                :{BLACK}Klõpsa, et valida server, kus sa viimati mängisid
 
 STR_NETWORK_FIND_SERVER                                         :{BLACK}Serveri otsimine
 STR_NETWORK_FIND_SERVER_TIP                                     :{BLACK}Võrgust serveri otsimine
@@ -1917,6 +1908,7 @@
 STR_INDUSTRY                                                    :{INDUSTRY}
 STR_TOWN                                                        :{TOWN}
 STR_INDUSTRY_FORMAT                                             :{TOWN} {STRING}
+STR_INDUSTRY_FORMAT.in                                          :{TOWN} {STRING.in}
 STR_STATION                                                     :{STATION}
 
 ##id 0x2800
@@ -2129,7 +2121,7 @@
 STR_4832_ANNOUNCES_IMMINENT_CLOSURE                             :{BLACK}{BIGFONT}{STRING} juhtkond teatab sulgemisest!
 STR_4833_SUPPLY_PROBLEMS_CAUSE_TO                               :{BLACK}{BIGFONT}{STRING} teatab sulgemisest varustusprobleemide tõttu!
 STR_4834_LACK_OF_NEARBY_TREES_CAUSES                            :{BLACK}{BIGFONT}Lähiümbruse puude puudumine põhjustab {STRING} sulgemise!
-STR_4835_INCREASES_PRODUCTION                                   :{BLACK}{BIGFONT}{INDUSTRY} kasvab toodang!
+STR_4835_INCREASES_PRODUCTION                                   :{BLACK}{BIGFONT}{INDUSTRY} toodang kasvas!
 STR_4836_NEW_COAL_SEAM_FOUND_AT                                 :{BLACK}{BIGFONT}{INDUSTRY} lähedal avati uus kivisöe kiht!{}Toodang kahekordistub!
 STR_4837_NEW_OIL_RESERVES_FOUND                                 :{BLACK}{BIGFONT}{INDUSTRY} lähedal avastati uusi naftareserve!{}Toodang kahekordistub!
 STR_4838_IMPROVED_FARMING_METHODS                               :{BLACK}{BIGFONT}{INDUSTRY} võttis kasutusele uued põllutöövahendid! Toodang kahekordistub!
@@ -2752,6 +2744,8 @@
 STR_8801_CITIZENS_CELEBRATE_FIRST                               :{BLACK}{BIGFONT}Rahvas rõõmustab. . .{}{STATION} jaama saabus esimene rong!
 STR_8802_DETAILS                                                :{WHITE}{VEHICLE} (üksikasjad)
 STR_8803_TRAIN_IN_THE_WAY                                       :{WHITE}Rong on ees
+STR_8804                                                        :{SETX 10}{COMMA}: {STRING} {STRING}
+STR_8805                                                        :{RIGHTARROW}{SETX 10}{COMMA}: {STRING} {STRING}
 STR_ORDER_GO_TO                                                 :Mine
 STR_ORDER_GO_NON_STOP_TO                                        :Mine peatumata
 STR_ORDER_GO_VIA                                                :Mine läbi
@@ -3277,6 +3271,8 @@
 STR_NEWGRF_UNPAUSE_WARNING_TITLE                                :{YELLOW}Puuduolevad GRF failid
 STR_NEWGRF_UNPAUSE_WARNING                                      :{WHITE}Pausi lõpetamine võib põhjustada OpenTTD krahhi. Ära teavita järgnevatest krahhidest.{}Oled sa tõepoolest veendunud, et sa soovid pausi lõpetada?
 
+STR_LOADGAME_REMOVED_TRAMS                                      :{WHITE}Mäng salvestati trammide toetuseta versioonis. Kõik trammid eemaldati.
+
 STR_CURRENCY_WINDOW                                             :{WHITE}Isiklik valuuta
 STR_CURRENCY_EXCHANGE_RATE                                      :{LTBLUE}Vahetuskurss: {ORANGE}{CURRENCY} = £ {COMMA}
 STR_CURRENCY_SEPARATOR                                          :{LTBLUE}Vahemärk:
@@ -3641,3 +3637,6 @@
 STR_OSK_KEYBOARD_LAYOUT                                         :`1234567890-=\qwertyuiop[]asdfghjkl;'  zxcvbnm,./ .
 STR_OSK_KEYBOARD_LAYOUT_CAPS                                    :~!@#$%^&*()_+|QWERTYUIOP{{}}ASDFGHJKL:"  ZXCVBNM<>? .
 ########
+
+############ town controlled noise level
+########
--- a/src/lang/finnish.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/finnish.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -361,9 +361,9 @@
 STR_SORT_BY                                                     :{BLACK}Lajittele
 
 STR_SORT_BY_POPULATION                                          :{BLACK}Asukasluku
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Tuotto
-STR_SORT_BY_TYPE                                                :{BLACK}Tyyppi
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Kuljetettu
+STR_SORT_BY_PRODUCTION                                          :Tuotto
+STR_SORT_BY_TYPE                                                :Tyyppi
+STR_SORT_BY_TRANSPORTED                                         :Kuljetettu
 STR_SORT_BY_NAME                                                :{BLACK}Nimi
 STR_SORT_BY_DROPDOWN_NAME                                       :Nimi
 STR_SORT_BY_DATE                                                :{BLACK}Päiväys
@@ -376,6 +376,7 @@
 STR_SORT_BY_MAX_SPEED                                           :Huippunopeus
 STR_SORT_BY_MODEL                                               :Malli
 STR_SORT_BY_VALUE                                               :Arvo
+STR_SORT_BY_LENGTH                                              :Pituus
 STR_SORT_BY_FACILITY                                            :Asematyyppi
 STR_SORT_BY_WAITING                                             :Odottavan lastin arvo
 STR_SORT_BY_RATING_MAX                                          :Rahtauksen arvosana
@@ -852,6 +853,7 @@
 
 STR_0314_FUND_NEW_INDUSTRY                                      :{WHITE}Rakenna uutta teollisuutta
 STR_JUST_STRING                                                 :{STRING}
+STR_JUST_INT                                                    :{NUM}
 STR_0316_CAN_ONLY_BE_BUILT_IN_TOWNS                             :{WHITE}...voidaan rakentaa vain kaupunkeihin.
 STR_0317_CAN_ONLY_BE_BUILT_IN_RAINFOREST                        :{WHITE}...voidaan rakentaa vain sademetsäalueisiin.
 STR_0318_CAN_ONLY_BE_BUILT_IN_DESERT                            :{WHITE}...voidaan rakentaa vain aavikkoalueisiin.
@@ -1109,7 +1111,7 @@
 STR_CONFIG_PATCHES_LOADING_INDICATORS_ALL                       :Kaikki yhtiöt
 STR_CONFIG_PATCHES_TIMETABLE_ALLOW                              :{LTBLUE}Aikataulut ajoneuvoille: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_TIMETABLE_IN_TICKS                           :{LTBLUE}Näytä aikataulu tickseissä päivien sijaan: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE                            :{LTBLUE}Raidetyyppi oletuksena: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE                            :{LTBLUE}Oletusraidetyyppi: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE_RAIL                       :Tavallinen raide
 STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE_ELRAIL                     :Sähköraide
 STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE_MONORAIL                   :Yksiraiteinen
@@ -1159,6 +1161,7 @@
 STR_CONFIG_PATCHES_TOWN_LAYOUT_BETTER_ROADS                     :parempia teitä
 STR_CONFIG_PATCHES_TOWN_LAYOUT_2X2_GRID                         :2x2 ruudukko
 STR_CONFIG_PATCHES_TOWN_LAYOUT_3X3_GRID                         :3x3 ruudukko
+STR_CONFIG_PATCHES_TOWN_LAYOUT_RANDOM                           :satunnainen
 
 STR_CONFIG_PATCHES_TOOLBAR_POS                                  :{LTBLUE}Päätyökalupalkin sijainti: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_TOOLBAR_POS_LEFT                             :vasen
@@ -1190,6 +1193,7 @@
 STR_CONFIG_PATCHES_QUERY_CAPT                                   :{WHITE}Muuta asetusarvo
 STR_CONFIG_PATCHES_SERVICE_INTERVAL_INCOMPATIBLE                :{WHITE}Osa allaolevista oletushuoltoväleistä ei ole yhteensopivia valitun asetuksen kanssa! 5-90{NBSP}% ja 30-800 päivää ovat oikein.
 
+
 STR_TEMPERATE_LANDSCAPE                                         :lauhkea maasto
 STR_SUB_ARCTIC_LANDSCAPE                                        :pohjoinen maasto
 STR_SUB_TROPICAL_LANDSCAPE                                      :subtrooppinen maasto
@@ -1680,8 +1684,10 @@
 STR_TOWN_LABEL_TINY_BLACK                                       :{TINYFONT}{BLACK}{TOWN}
 STR_TOWN_LABEL_TINY_WHITE                                       :{TINYFONT}{WHITE}{TOWN}
 STR_2002                                                        :{TINYFONT}{BLACK}{SIGN}
+STR_2002_WHITE                                                  :{TINYFONT}{WHITE}{SIGN}
 STR_2004_BUILDING_MUST_BE_DEMOLISHED                            :{WHITE}Rakennus täytyy purkaa ensin.
 STR_2005                                                        :{WHITE}{TOWN}
+STR_CITY                                                        :{WHITE}{TOWN} (City)
 STR_2006_POPULATION                                             :{BLACK}Asukasluku: {ORANGE}{COMMA}{BLACK}  Taloja: {ORANGE}{COMMA}
 STR_2007_RENAME_TOWN                                            :Nimeä kaupunki
 STR_2008_CAN_T_RENAME_TOWN                                      :{WHITE}Kaupungin nimeä ei voi vaihtaa.
@@ -2599,6 +2605,8 @@
 STR_8802_DETAILS                                                :{WHITE}{VEHICLE} (yksityiskohdat)
 STR_8803_TRAIN_IN_THE_WAY                                       :{WHITE}Juna on tiellä.
 
+
+
 STR_TIMETABLE_TRAVEL_NOT_TIMETABLED                             :Kiertävä (ei aikataulua)
 STR_TIMETABLE_TRAVEL_FOR                                        :Kulje kohteeseen {STRING}
 STR_TIMETABLE_STAY_FOR                                          :ja odota {STRING}
@@ -2733,6 +2741,7 @@
 STR_NEW_VEHICLE_TYPE                                            :{BLACK}{BIGFONT}{ENGINE}
 STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE                         :{BLACK}Uusi {STRING} on nyt saatavilla! - {ENGINE}
 
+
 STR_CAN_T_TIMETABLE_VEHICLE                                     :{WHITE}Ei voi asettaa aikataulua.
 STR_TIMETABLE_ONLY_WAIT_AT_STATIONS                             :{WHITE}Vain asemalla voi odottaa.
 STR_TIMETABLE_NOT_STOPPING_HERE                                 :{WHITE}Tämä ajoneuvo ei pysähdy tällä asemalla.
@@ -3045,6 +3054,7 @@
 STR_NEWGRF_DISABLED_WARNING                                     :{WHITE}Puuttuvat GRF tiedostot ovat poistettu käytöstä
 STR_NEWGRF_NOT_FOUND_WARNING                                    :{WHITE}Puuttuvat GRF tiedostot tarvitaan pelin lataamiseksi.
 
+
 STR_CURRENCY_WINDOW                                             :{WHITE}Oma valuutta
 STR_CURRENCY_EXCHANGE_RATE                                      :{LTBLUE}Vaihtokurssi: {ORANGE}{CURRENCY} = £ {COMMA}
 STR_CURRENCY_SEPARATOR                                          :{LTBLUE}Välimerkki:
@@ -3168,6 +3178,9 @@
 STR_PURCHASE_INFO_ALL_BUT                                       :Kaikki paitsi {GOLD}
 STR_PURCHASE_INFO_MAX_TE                                        :{BLACK}Suurin vääntömomentti: {GOLD}{FORCE}
 
+########### For showing numbers in widgets
+
+
 ########### String for New Landscape Generator
 
 STR_GENERATE                                                    :{WHITE}Generoi
@@ -3328,3 +3341,15 @@
 STR_PROSPECT_NEW_INDUSTRY                                       :{BLACK}Koekaivaus
 STR_BUILD_NEW_INDUSTRY                                          :{BLACK}Rakenna
 STR_INDUSTRY_SELECTION_HINT                                     :{BLACK}Valitse tehdas listasta
+
+############ Face formatting
+########
+
+############ signal GUI
+########
+
+############ on screen keyboard
+########
+
+############ town controlled noise level
+########
--- a/src/lang/french.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/french.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -364,9 +364,9 @@
 STR_SORT_BY                                                     :{BLACK}Trier par
 
 STR_SORT_BY_POPULATION                                          :{BLACK}Population
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Production
-STR_SORT_BY_TYPE                                                :{BLACK}Type
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Transporté
+STR_SORT_BY_PRODUCTION                                          :Production
+STR_SORT_BY_TYPE                                                :Type
+STR_SORT_BY_TRANSPORTED                                         :Transporté
 STR_SORT_BY_NAME                                                :{BLACK}Nom
 STR_SORT_BY_DROPDOWN_NAME                                       :Nom
 STR_SORT_BY_DATE                                                :{BLACK}Date
@@ -487,6 +487,9 @@
 STR_01A5_COST_TO_CLEAR                                          :{BLACK}Coût du balayage: {LTBLUE}{CURRENCY}
 STR_01A6_N_A                                                    :N/D
 STR_01A7_OWNER                                                  :{BLACK}Propriétaire: {LTBLUE}{STRING}
+STR_ROAD_OWNER                                                  :{BLACK}Propriétaire de la route: {LTBLUE}{STRING}
+STR_TRAM_OWNER                                                  :{BLACK}Propriétaire du tramway: {LTBLUE}{STRING}
+STR_RAIL_OWNER                                                  :{BLACK}Propriétaire des rails: {LTBLUE}{STRING}
 STR_01A8_LOCAL_AUTHORITY                                        :{BLACK}Municipalité: {LTBLUE}{STRING}
 STR_01A9_NONE                                                   :Aucun
 STR_01AA_NAME                                                   :{BLACK}Nom
@@ -1055,6 +1058,7 @@
 STR_CONFIG_PATCHES_PLANE_SPEED                                  :{LTBLUE}Facteur de vitesse des aéroplanes: {ORANGE}1 / {STRING}
 STR_CONFIG_PATCHES_STOP_ON_TOWN_ROAD                            :{LTBLUE}Autoriser les arrêts de bus sur les routes des municipalités: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_ADJACENT_STATIONS                            :{LTBLUE}Autoriser la construction de stations adjacentes: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_DYNAMIC_ENGINES                              :{LTBLUE}Utiliser plusieurs NewGRF de véhicules: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_SMALL_AIRPORTS                               :{LTBLUE}Toujours permettre les petits aéroports: {ORANGE}{STRING}
 
@@ -1714,6 +1718,7 @@
 STR_1816_TREE_LINED_ROAD                                        :Route avec lignée d'arbustres
 STR_1817_ROAD_VEHICLE_DEPOT                                     :Dépôt de véhicules routiers
 STR_1818_ROAD_RAIL_LEVEL_CROSSING                               :Route/rail Croisement à niveau
+STR_TRAMWAY                                                     :Tramway
 STR_CAN_T_REMOVE_BUS_STATION                                    :{WHITE}Impossible de supprimer la station de bus...
 STR_CAN_T_REMOVE_TRUCK_STATION                                  :{WHITE}Impossible de supprimer la station de camions...
 STR_CAN_T_REMOVE_PASSENGER_TRAM_STATION                         :{WHITE}Impossible de retirer la station de tramway pour passagers...
@@ -3183,6 +3188,8 @@
 STR_NEWGRF_UNPAUSE_WARNING_TITLE                                :{YELLOW}Fichier(s) GRF manquant(s)
 STR_NEWGRF_UNPAUSE_WARNING                                      :{WHITE}Retirer la pause peut faire planter OpenTTD. Ne créez pas de rapport de bug pour ceux-ci.{}Voulez-vous vraiment retirer la pause?
 
+STR_LOADGAME_REMOVED_TRAMS                                      :{WHITE}Partie sauvegardée avec une version sans support des tramways. Tous les tramways ont été supprimés.
+
 STR_CURRENCY_WINDOW                                             :{WHITE}Devise personnalisée
 STR_CURRENCY_EXCHANGE_RATE                                      :{LTBLUE}Taux de change : {ORANGE}{CURRENCY} = £ {COMMA}
 STR_CURRENCY_SEPARATOR                                          :{LTBLUE}Séparateur :
@@ -3544,6 +3551,12 @@
 ########
 
 ############ on screen keyboard
-STR_OSK_KEYBOARD_LAYOUT                                         :²&é"'(-è_çà)=azertyuiop^$qsdfghjklmù*wxcvbn,;:!
-STR_OSK_KEYBOARD_LAYOUT_CAPS                                    :²1234567890°+AZERTYUIOP¨£QSDFGHJKLM%µWXCVBN?./§
+STR_OSK_KEYBOARD_LAYOUT                                         :²&é"'(-è_çà)= azertyuiop^$qsdfghjklmù*<wxcvbn,;:!
+STR_OSK_KEYBOARD_LAYOUT_CAPS                                    : 1234567890°+ AZERTYUIOP¨£QSDFGHJKLM%µ>WXCVBN?./§
 ########
+
+############ town controlled noise level
+STR_CONFIG_PATCHES_NOISE_LEVEL                                  :{LTBLUE}Permettre plus d'aéroport par ville, selon les nuisances: {ORANGE}{STRING}
+STR_NOISE_IN_TOWN                                               :{BLACK}Limite de nuisance pour la ville: {ORANGE}{COMMA}{BLACK}  max: {ORANGE}{COMMA}
+STR_STATION_NOISE                                               :{BLACK}Bruit généré: {GOLD}{COMMA}
+########
--- a/src/lang/galician.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/galician.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -360,9 +360,9 @@
 STR_SORT_BY                                                     :{BLACK}Ordear por
 
 STR_SORT_BY_POPULATION                                          :{BLACK}Poboación
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Producción
-STR_SORT_BY_TYPE                                                :{BLACK}Tipo
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Transportado
+STR_SORT_BY_PRODUCTION                                          :Producción
+STR_SORT_BY_TYPE                                                :Tipo
+STR_SORT_BY_TRANSPORTED                                         :Transportado
 STR_SORT_BY_NAME                                                :{BLACK}Nome
 STR_SORT_BY_DROPDOWN_NAME                                       :Nome
 STR_SORT_BY_DATE                                                :{BLACK}Data
--- a/src/lang/german.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/german.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -363,9 +363,9 @@
 STR_SORT_BY                                                     :{BLACK}Sortieren nach
 
 STR_SORT_BY_POPULATION                                          :{BLACK}Bevölkerung
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Produktion
-STR_SORT_BY_TYPE                                                :{BLACK}Typ
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Transportiert
+STR_SORT_BY_PRODUCTION                                          :Produktion
+STR_SORT_BY_TYPE                                                :Typ
+STR_SORT_BY_TRANSPORTED                                         :Transportiert
 STR_SORT_BY_NAME                                                :{BLACK}Name
 STR_SORT_BY_DROPDOWN_NAME                                       :Name
 STR_SORT_BY_DATE                                                :{BLACK}Datum
--- a/src/lang/hungarian.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/hungarian.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -427,9 +427,9 @@
 STR_SORT_BY                                                     :{BLACK}Rendezés
 
 STR_SORT_BY_POPULATION                                          :{BLACK}Lakosság
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Termelés
-STR_SORT_BY_TYPE                                                :{BLACK}Típus
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Elszállítás
+STR_SORT_BY_PRODUCTION                                          :Termelés
+STR_SORT_BY_TYPE                                                :Típus
+STR_SORT_BY_TRANSPORTED                                         :Elszállítás
 STR_SORT_BY_NAME                                                :{BLACK}Név
 STR_SORT_BY_DROPDOWN_NAME                                       :Név
 STR_SORT_BY_DATE                                                :{BLACK}Dátum
--- a/src/lang/icelandic.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/icelandic.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -1,7 +1,7 @@
 ##name Icelandic
 ##ownname Íslenska
 ##isocode is_IS
-##plural 9
+##plural 0
 ##gender karlkyn kvenkyn hvorugkyn
 
 #
@@ -19,6 +19,7 @@
 STR_EN_ROUTE_FROM                                               :{YELLOW}({SHORTCARGO} frá {STATION})
 STR_000C_ACCEPTS                                                :{BLACK}Tekur við: {WHITE}
 STR_000D_ACCEPTS                                                :{BLACK}Tekur við: {GOLD}
+STR_SUPPLIES                                                    :{BLACK}Birgðir: {GOLD}
 STR_000E                                                        :
 STR_000F_PASSENGERS                                             :Farþegar
 STR_0010_COAL                                                   :Kol
@@ -363,9 +364,9 @@
 STR_SORT_BY                                                     :{BLACK}Flokka eftir
 
 STR_SORT_BY_POPULATION                                          :{BLACK}Fólksfjöldi
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Framleiðsla
-STR_SORT_BY_TYPE                                                :{BLACK}Tegund
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Flutt
+STR_SORT_BY_PRODUCTION                                          :Framleiðsla
+STR_SORT_BY_TYPE                                                :Tegund
+STR_SORT_BY_TRANSPORTED                                         :Flutt
 STR_SORT_BY_NAME                                                :{BLACK}Nafn
 STR_SORT_BY_DROPDOWN_NAME                                       :Nafn
 STR_SORT_BY_DATE                                                :{BLACK}Dagsetning
@@ -378,6 +379,7 @@
 STR_SORT_BY_MAX_SPEED                                           :Hámarkshraði
 STR_SORT_BY_MODEL                                               :Týpa
 STR_SORT_BY_VALUE                                               :Virði
+STR_SORT_BY_LENGTH                                              :Lengd
 STR_SORT_BY_FACILITY                                            :Tegund stöðvar
 STR_SORT_BY_WAITING                                             :Verðgildi farms á stöð
 STR_SORT_BY_RATING_MAX                                          :Flutningur farms
@@ -485,6 +487,9 @@
 STR_01A5_COST_TO_CLEAR                                          :{BLACK}Kostnaður við hreinsun: {LTBLUE}{CURRENCY}
 STR_01A6_N_A                                                    :Enginn
 STR_01A7_OWNER                                                  :{BLACK}Eigandi: {LTBLUE}{STRING}
+STR_ROAD_OWNER                                                  :{BLACK}Eigandi vegs: {LTBLUE}{STRING}
+STR_TRAM_OWNER                                                  :{BLACK}Eigandi spors: {LTBLUE}{STRING}
+STR_RAIL_OWNER                                                  :{BLACK}Eigandi lestarteina: {LTBLUE}{STRING}
 STR_01A8_LOCAL_AUTHORITY                                        :{BLACK}Bæjaryfirvöld: {LTBLUE}{STRING}
 STR_01A9_NONE                                                   :Enginn
 STR_01AA_NAME                                                   :{BLACK}Nafn
@@ -1053,6 +1058,7 @@
 STR_CONFIG_PATCHES_PLANE_SPEED                                  :{LTBLUE}Hraðastuðull flugvéla: {ORANGE}1 / {STRING}
 STR_CONFIG_PATCHES_STOP_ON_TOWN_ROAD                            :{LTBLUE}Leyfa strætóstöðvar á gangstéttum bæja: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_ADJACENT_STATIONS                            :{LTBLUE}Heimila sambyggingu stöðva: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_DYNAMIC_ENGINES                              :{LTBLUE}Virkja mörg NewGRF vélasöfn: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_SMALL_AIRPORTS                               :{LTBLUE}Alltaf leyfa litla flugvelli: {ORANGE}{STRING}
 
@@ -1172,6 +1178,7 @@
 STR_CONFIG_PATCHES_TOWN_LAYOUT_BETTER_ROADS                     :betri vegi
 STR_CONFIG_PATCHES_TOWN_LAYOUT_2X2_GRID                         :2x2 net
 STR_CONFIG_PATCHES_TOWN_LAYOUT_3X3_GRID                         :3x3 net
+STR_CONFIG_PATCHES_TOWN_LAYOUT_RANDOM                           :slembið
 
 STR_CONFIG_PATCHES_TOOLBAR_POS                                  :{LTBLUE}Staðsetning tækjasláar: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_TOOLBAR_POS_LEFT                             :Vinstri
@@ -1362,6 +1369,8 @@
 STR_NETWORK_GAME_NAME_TIP                                       :{BLACK}Nafn leiksins
 STR_NETWORK_INFO_ICONS_TIP                                      :{BLACK}Tungumál, útgáfa þjóns o.s.frv.
 STR_NETWORK_CLICK_GAME_TO_SELECT                                :{BLACK}Ýttu á leik á listanum til að velja hann
+STR_NETWORK_LAST_JOINED_SERVER                                  :{BLACK}Þjónninn sem þú tengdist síðast:
+STR_NETWORK_CLICK_TO_SELECT_LAST                                :{BLACK}Smelltu til að velja þjóninn sem þú tengdist í síðast
 
 STR_NETWORK_FIND_SERVER                                         :{BLACK}Finna þjón
 STR_NETWORK_FIND_SERVER_TIP                                     :{BLACK}Leita að þjónum á neti
@@ -1709,6 +1718,7 @@
 STR_1816_TREE_LINED_ROAD                                        :Trjáskreyttur vegur
 STR_1817_ROAD_VEHICLE_DEPOT                                     :Bifreiðaskýli
 STR_1818_ROAD_RAIL_LEVEL_CROSSING                               :Vega/lestar gatnamót
+STR_TRAMWAY                                                     :Sporvagn
 STR_CAN_T_REMOVE_BUS_STATION                                    :{WHITE}Get ekki fjarlægt strætóstoppistöð...
 STR_CAN_T_REMOVE_TRUCK_STATION                                  :{WHITE}Get ekki flutt vörubílastöð...
 STR_CAN_T_REMOVE_PASSENGER_TRAM_STATION                         :{WHITE}Get ekki fjarlægt farþegasporvagnastöð...
@@ -2651,6 +2661,68 @@
 STR_8801_CITIZENS_CELEBRATE_FIRST                               :{BLACK}{BIGFONT}Bæjarbúar fagna . . .{}Fyrsta lest kemur við á {STATION}!
 STR_8802_DETAILS                                                :{WHITE}{VEHICLE} (Upplýsingar)
 STR_8803_TRAIN_IN_THE_WAY                                       :{WHITE}Lest fyrir
+STR_8804                                                        :{SETX 10}{COMMA}: {STRING} {STRING}
+STR_8805                                                        :{RIGHTARROW}{SETX 10}{COMMA}: {STRING} {STRING}
+STR_ORDER_GO_TO                                                 :Fara að
+STR_ORDER_GO_VIA                                                :Fara gegnum
+STR_ORDER_DROP_LOAD_IF_POSSIBLE                                 :Hlaða ef það er hægt
+STR_ORDER_DROP_FULL_LOAD_ALL                                    :Fullhlaða öllum farmi
+STR_ORDER_DROP_FULL_LOAD_ANY                                    :Fullhlaða hvaða farmi sem er
+STR_ORDER_DROP_NO_LOADING                                       :Ekki hlaða
+STR_ORDER_DROP_UNLOAD_IF_ACCEPTED                               :Afhlaða ef tekið er við farmi
+STR_ORDER_DROP_UNLOAD                                           :Afhlaða allt
+STR_ORDER_DROP_TRANSFER                                         :Flytja
+STR_ORDER_DROP_NO_UNLOADING                                     :Ekki afhlaða
+STR_ORDER_FULL_LOAD                                             :(Fullhlaða)
+STR_ORDER_FULL_LOAD_ANY                                         :(Fullhlaða hvaða farmi sem er)
+STR_ORDER_NO_LOAD                                               :(Ekki hlaða)
+STR_ORDER_UNLOAD                                                :(Afhlaða og taka farm)
+STR_ORDER_UNLOAD_FULL_LOAD                                      :(Afhlaða og bíða fullhleðslu)
+STR_ORDER_UNLOAD_FULL_LOAD_ANY                                  :(Afhlaða og bíða eftir hvaða fullhleðslu sem er)
+STR_ORDER_UNLOAD_NO_LOAD                                        :(Afhlaða og yfirgefa tóm)
+STR_ORDER_TRANSFER                                              :(Flytja og taka farm)
+STR_ORDER_TRANSFER_FULL_LOAD                                    :(Flytja og bíða fullfermis)
+STR_ORDER_TRANSFER_FULL_LOAD_ANY                                :(Flytja og bíða hvaða fullfermis sem er)
+STR_ORDER_TRANSFER_NO_LOAD                                      :(Flytja og yfirgefa tóm)
+STR_ORDER_NO_UNLOAD                                             :(Ekki afhlaða en taka farm)
+STR_ORDER_NO_UNLOAD_FULL_LOAD                                   :(Ekki afhlaða en býða fullfermis)
+STR_ORDER_NO_UNLOAD_FULL_LOAD_ANY                               :(Ekki afhlaða og bíða hvaða fullfermis sem er)
+STR_ORDER_TOOLTIP_NON_STOP                                      :{BLACK}Breyta stanshegðun valinna skipana
+STR_ORDER_TOOLTIP_FULL_LOAD                                     :{BLACK}Breyta fermishegðun valinna skipana
+STR_ORDER_TOOLTIP_UNLOAD                                        :{BLACK}Breyta hegðun affermingar valinna skipanna
+STR_GO_TO_STATION                                               :{STRING} {STATION} {STRING}
+
+STR_ORDER_GO_TO_DROPDOWN_TOOLTIP                                :{BLACK}Bæta við ítarlegri skipun
+STR_ORDER_GO_TO_NEAREST_DEPOT                                   :Fara í næsta skýli
+STR_ORDER_GO_TO_NEAREST_HANGAR                                  :Fara í næsta flugskýli
+STR_ORDER_NEAREST_DEPOT                                         :næsta
+STR_ORDER_NEAREST_HANGAR                                        :næsta flugskýli
+STR_ORDER_SERVICE_AT                                            :Skoða í
+STR_ORDER_TRAIN_DEPOT                                           :lestaskýli
+STR_ORDER_ROAD_DEPOT                                            :bifreiðaskýli
+STR_ORDER_SHIP_DEPOT                                            :skipaskýli
+STR_GO_TO_DEPOT                                                 :{STRING} {TOWN} {STRING}
+STR_GO_TO_NEAREST_DEPOT                                         :{STRING} {STRING} {STRING}
+STR_GO_TO_HANGAR                                                :{STRING} {STATION} flugskýli
+
+STR_ORDER_CONDITIONAL_VARIABLE_TOOLTIP                          :{BLACK}Gögn farartækis sem skilyrði byggja á
+STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE                           :Hleðsluhlutfall
+STR_ORDER_CONDITIONAL_RELIABILITY                               :Áreiðanleiki
+STR_ORDER_CONDITIONAL_MAX_SPEED                                 :Hámarkshraði
+STR_ORDER_CONDITIONAL_AGE                                       :Aldur farartækis (í árum)
+STR_ORDER_CONDITIONAL_UNCONDITIONALLY                           :Alltaf
+STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS                         :er jafnt og
+STR_ORDER_CONDITIONAL_COMPARATOR_NOT_EQUALS                     :er ekki jafnt og
+STR_ORDER_CONDITIONAL_COMPARATOR_LESS_THAN                      :er minna en
+STR_ORDER_CONDITIONAL_COMPARATOR_LESS_EQUALS                    :er minna en eða jafnt og
+STR_ORDER_CONDITIONAL_COMPARATOR_MORE_THAN                      :er stærra en
+STR_ORDER_CONDITIONAL_COMPARATOR_MORE_EQUALS                    :er stærra en eða jafnt og
+STR_ORDER_CONDITIONAL_COMPARATOR_IS_TRUE                        :er satt
+STR_ORDER_CONDITIONAL_COMPARATOR_IS_FALSE                       :er ósatt
+STR_CONDITIONAL_VALUE                                           :{SKIP}{BLACK}{COMMA}
+STR_CONDITIONAL_UNCONDITIONAL                                   :Hoppa í skipun {COMMA}
+STR_CONDITIONAL_NUM                                             :Hoppa í skipun {COMMA} þegar {STRING} {STRING} {COMMA}
+STR_CONDITIONAL_TRUE_FALSE                                      :Hoppa í skipun {COMMA} þegar {STRING} {STRING}
 
 STR_TIMETABLE_TRAVEL_NOT_TIMETABLED                             :Ferðalag (ekki sett í áætlun)
 STR_TIMETABLE_TRAVEL_FOR                                        :Ferðast í {STRING}
@@ -2708,6 +2780,7 @@
 STR_882D_VALUE                                                  :{LTBLUE}{ENGINE}{BLACK}   Virði: {LTBLUE}{CURRENCY}
 STR_882E                                                        :{WHITE}{VEHICLE}
 STR_882F_LOADING_UNLOADING                                      :{LTBLUE}Fermandi / Affermandi
+STR_LEAVING                                                     :{LTBLUE}Yfirgefur
 STR_TRAIN_MUST_BE_STOPPED                                       :{WHITE}Lest þarf að vera stöðvuð í skýli
 STR_8830_CAN_T_SEND_TRAIN_TO_DEPOT                              :{WHITE}Get ekki sent lest í skýli...
 STR_8831_NO_MORE_SPACE_FOR_ORDERS                               :{WHITE}Ekki pláss fyrir fleiri skipanir
@@ -3107,6 +3180,8 @@
 STR_NEWGRF_UNPAUSE_WARNING_TITLE                                :{YELLOW}Vantar GRF skrá(r)
 STR_NEWGRF_UNPAUSE_WARNING                                      :{WHITE}OpenTTD getur hrunið ef leikur er settur af stað. Ekki skrá villufærslur fyrir eftirfarandi hrun.{}Ertu viss um að þú viljir setja leikinn af stað?
 
+STR_LOADGAME_REMOVED_TRAMS                                      :{WHITE}Leikurinn var vistaður í útgáfu án sporvagna. Allir sporvagnar hafa verið fjarlægðir.
+
 STR_CURRENCY_WINDOW                                             :{WHITE}Sérvalinn gjaldeyrir
 STR_CURRENCY_EXCHANGE_RATE                                      :{LTBLUE}Gengi: {ORANGE}{CURRENCY} = £ {COMMA}
 STR_CURRENCY_SEPARATOR                                          :{LTBLUE}Aðskilnaðarmerki:
@@ -3337,6 +3412,7 @@
 STR_TRANSPARENT_STRUCTURES_DESC                                 :{BLACK}Virkja/afvirkja gegnsæji bygginga á borð við vita og möstur. CTRL+smella til að læsa.
 STR_TRANSPARENT_CATENARY_DESC                                   :{BLACK}Virkja/afvirkja gegnsæji raflína. CTRL+smella til að læsa.
 STR_TRANSPARENT_LOADING_DESC                                    :{BLACK}Virkja/afvirkja gegnsæji hleðslumæla. CTRL+smella til að læsa.
+STR_TRANSPARENT_INVISIBLE_DESC                                  :{BLACK}Gera hluti ósýnilega en ekki gagnsæja
 
 STR_PERCENT_UP_SMALL                                            :{TINYFONT}{WHITE}{NUM}%{UPARROW}
 STR_PERCENT_UP                                                  :{WHITE}{NUM}%{UPARROW}
@@ -3468,3 +3544,8 @@
 
 ############ on screen keyboard
 ########
+
+############ town controlled noise level
+STR_NOISE_IN_TOWN                                               :{BLACK}Hávaðamörk í bænum: {ORANGE}{COMMA}{BLACK}  mest: {ORANGE}{COMMA}
+STR_STATION_NOISE                                               :{BLACK}Hávaði við flugvöll: {GOLD}{COMMA}
+########
--- a/src/lang/italian.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/italian.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -365,9 +365,9 @@
 STR_SORT_BY                                                     :{BLACK}Ordina per
 
 STR_SORT_BY_POPULATION                                          :{BLACK}Popolazione
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Produzione
-STR_SORT_BY_TYPE                                                :{BLACK}Tipo
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Trasportato
+STR_SORT_BY_PRODUCTION                                          :Produzione
+STR_SORT_BY_TYPE                                                :Tipo
+STR_SORT_BY_TRANSPORTED                                         :Trasportato
 STR_SORT_BY_NAME                                                :{BLACK}Nome
 STR_SORT_BY_DROPDOWN_NAME                                       :Nome
 STR_SORT_BY_DATE                                                :{BLACK}Data
@@ -488,6 +488,9 @@
 STR_01A5_COST_TO_CLEAR                                          :{BLACK}Costo di demolizione: {LTBLUE}{CURRENCY}
 STR_01A6_N_A                                                    :N/A
 STR_01A7_OWNER                                                  :{BLACK}Proprietario: {LTBLUE}{STRING}
+STR_ROAD_OWNER                                                  :{BLACK}Proprietario strada: {LTBLUE}{STRING}
+STR_TRAM_OWNER                                                  :{BLACK}Proprietario tranvia: {LTBLUE}{STRING}
+STR_RAIL_OWNER                                                  :{BLACK}Proprietario ferrovia: {LTBLUE}{STRING}
 STR_01A8_LOCAL_AUTHORITY                                        :{BLACK}Autorità locale: {LTBLUE}{STRING}
 STR_01A9_NONE                                                   :Nessuno
 STR_01AA_NAME                                                   :{BLACK}Nome
@@ -1056,6 +1059,7 @@
 STR_CONFIG_PATCHES_PLANE_SPEED                                  :{LTBLUE}Fattore di velocità degli aeromobili: {ORANGE}1 / {STRING}
 STR_CONFIG_PATCHES_STOP_ON_TOWN_ROAD                            :{LTBLUE}Consenti fermate passanti sulle strade delle città: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_ADJACENT_STATIONS                            :{LTBLUE}Consenti la costruzione di stazioni adiacenti: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_DYNAMIC_ENGINES                              :{LTBLUE}Abilita pacchetti di locomotive NewGRF multipli: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_SMALL_AIRPORTS                               :{LTBLUE}Consenti sempre la costruzione di piccoli aeroporti: {ORANGE}{STRING}
 
@@ -1242,8 +1246,8 @@
 STR_HEADING_FOR_WAYPOINT                                        :{LTBLUE}Diretto a {WAYPOINT}
 STR_HEADING_FOR_WAYPOINT_VEL                                    :{LTBLUE}Diretto a {WAYPOINT}, {VELOCITY}
 
-STR_GO_TO_WAYPOINT                                              :Procedi attraverso {WAYPOINT}
-STR_GO_NON_STOP_TO_WAYPOINT                                     :Procedi no-stop attraverso {WAYPOINT}
+STR_GO_TO_WAYPOINT                                              :Passa per {WAYPOINT}
+STR_GO_NON_STOP_TO_WAYPOINT                                     :Passa no-stop per {WAYPOINT}
 
 STR_WAYPOINTNAME_CITY                                           :Waypoint di {TOWN}
 STR_WAYPOINTNAME_CITY_SERIAL                                    :Waypoint di {TOWN} #{COMMA}
@@ -1366,7 +1370,7 @@
 STR_NETWORK_GAME_NAME_TIP                                       :{BLACK}Nome della partita
 STR_NETWORK_INFO_ICONS_TIP                                      :{BLACK}Lingua, versione del server, etc.
 STR_NETWORK_CLICK_GAME_TO_SELECT                                :{BLACK}Fare clic su una partita in elenco per selezionarla
-STR_NETWORK_LAST_JOINED_SERVER                                  :{BLACK}L'ultimo server utilizzato.
+STR_NETWORK_LAST_JOINED_SERVER                                  :{BLACK}Ultimo server utilizzato:
 STR_NETWORK_CLICK_TO_SELECT_LAST                                :{BLACK}Fare clic per selezionare il server su cui si è giocato l'ultima volta
 
 STR_NETWORK_FIND_SERVER                                         :{BLACK}Trova server
@@ -1715,6 +1719,7 @@
 STR_1816_TREE_LINED_ROAD                                        :Strada alberata
 STR_1817_ROAD_VEHICLE_DEPOT                                     :Deposito automezzi
 STR_1818_ROAD_RAIL_LEVEL_CROSSING                               :Passaggio a livello
+STR_TRAMWAY                                                     :Tranvia
 STR_CAN_T_REMOVE_BUS_STATION                                    :{WHITE}Impossibile rimuovere la stazione degli autobus...
 STR_CAN_T_REMOVE_TRUCK_STATION                                  :{WHITE}Impossibile rimuovere l'area di carico per camion...
 STR_CAN_T_REMOVE_PASSENGER_TRAM_STATION                         :{WHITE}Impossibile rimuovere la stazione tram passeggeri...
@@ -2660,9 +2665,9 @@
 STR_8804                                                        :{SETX 10}{COMMA}: {STRING} {STRING}
 STR_8805                                                        :{RIGHTARROW}{SETX 10}{COMMA}: {STRING} {STRING}
 STR_ORDER_GO_TO                                                 :Vai a
-STR_ORDER_GO_NON_STOP_TO                                        :Vai non-stop a
-STR_ORDER_GO_VIA                                                :Procedi verso
-STR_ORDER_GO_NON_STOP_VIA                                       :Procedi non-stop verso
+STR_ORDER_GO_NON_STOP_TO                                        :Vai no-stop a
+STR_ORDER_GO_VIA                                                :Passa per
+STR_ORDER_GO_NON_STOP_VIA                                       :Passa no-stop per
 STR_ORDER_DROP_LOAD_IF_POSSIBLE                                 :Carica se possibile
 STR_ORDER_DROP_FULL_LOAD_ALL                                    :Attendi pieno carico
 STR_ORDER_DROP_FULL_LOAD_ANY                                    :Attendi qualsiasi carico
@@ -2691,8 +2696,8 @@
 STR_GO_TO_STATION                                               :{STRING} {STATION} {STRING}
 
 STR_ORDER_GO_TO_DROPDOWN_TOOLTIP                                :{BLACK}Inserisce un ordine avanzato
-STR_ORDER_GO_TO_NEAREST_DEPOT                                   :Vai al deposito più vicino
-STR_ORDER_GO_TO_NEAREST_HANGAR                                  :Vai all'hangar più vicino
+STR_ORDER_GO_TO_NEAREST_DEPOT                                   :Deposito più vicino
+STR_ORDER_GO_TO_NEAREST_HANGAR                                  :Hangar più vicino
 STR_ORDER_NEAREST_DEPOT                                         :più vicino
 STR_ORDER_NEAREST_HANGAR                                        :più vicino Hangar
 STR_ORDER_SERVICE_AT                                            :Manutenzione al
@@ -2700,11 +2705,11 @@
 STR_ORDER_TRAIN_DEPOT                                           :Deposito ferroviario
 STR_ORDER_ROAD_DEPOT                                            :Deposito automezzi
 STR_ORDER_SHIP_DEPOT                                            :Deposito navale
-STR_GO_TO_DEPOT                                                 :{0:STRING} {2:STRING} di {1:TOWN}
+STR_GO_TO_DEPOT                                                 :{0:STRING}l {2:STRING} di {1:TOWN}
 STR_GO_TO_NEAREST_DEPOT                                         :{STRING} {STRING} {STRING}
-STR_GO_TO_HANGAR                                                :{STRING}l'Hangar di {STATION}
+STR_GO_TO_HANGAR                                                :{STRING}ll'Hangar di {STATION}
 
-STR_ORDER_CONDITIONAL                                           :Salto condizionale a ordine
+STR_ORDER_CONDITIONAL                                           :Salto condizionale
 STR_ORDER_CONDITIONAL_VARIABLE_TOOLTIP                          :{BLACK}Dato del veicolo sul quale basare il salto
 STR_ORDER_CONDITIONAL_COMPARATOR_TOOLTIP                        :{BLACK}Modalità di confronto del dato del veicolo con il valore inserito
 STR_ORDER_CONDITIONAL_VALUE_TOOLTIP                             :{BLACK}Valore col quale confrontare il dato del veicolo
@@ -2716,7 +2721,7 @@
 STR_ORDER_CONDITIONAL_REQUIRES_SERVICE                          :Manutenzione richiesta
 STR_ORDER_CONDITIONAL_UNCONDITIONALLY                           :Sempre
 STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS                         :è uguale a
-STR_ORDER_CONDITIONAL_COMPARATOR_NOT_EQUALS                     :è diverso da
+STR_ORDER_CONDITIONAL_COMPARATOR_NOT_EQUALS                     :è diversa da
 STR_ORDER_CONDITIONAL_COMPARATOR_LESS_THAN                      :è minore di
 STR_ORDER_CONDITIONAL_COMPARATOR_LESS_EQUALS                    :è minore o uguale a
 STR_ORDER_CONDITIONAL_COMPARATOR_MORE_THAN                      :è maggiore di
@@ -3184,6 +3189,8 @@
 STR_NEWGRF_UNPAUSE_WARNING_TITLE                                :{YELLOW}File GRF mancanti
 STR_NEWGRF_UNPAUSE_WARNING                                      :{WHITE}Uscire dalla pausa può causare un crash: nel caso, si prega di non inviare segnalazioni bug al riguardo.{}Uscire dalla pausa?
 
+STR_LOADGAME_REMOVED_TRAMS                                      :{WHITE}La partita è stata salvata in una versione senza il supporto per i tram. Tutte le tranvie sono state rimosse.
+
 STR_CURRENCY_WINDOW                                             :{WHITE}Valuta personalizzata
 STR_CURRENCY_EXCHANGE_RATE                                      :{LTBLUE}Cambio: {ORANGE}{CURRENCY} = £ {COMMA}
 STR_CURRENCY_SEPARATOR                                          :{LTBLUE}Separatore:
@@ -3548,3 +3555,9 @@
 STR_OSK_KEYBOARD_LAYOUT                                         :\1234567890'ì qwertyuiopè+asdfghjklòàù<zxcvbnm,.- .
 STR_OSK_KEYBOARD_LAYOUT_CAPS                                    :|!"£$%&/()=?^ QWERTYUIOPé*ASDFGHJKLç°§>ZXCVBNM;:_ .
 ########
+
+############ town controlled noise level
+STR_CONFIG_PATCHES_NOISE_LEVEL                                  :{LTBLUE}Consenti controllo rumore aeroporti da parte delle città: {ORANGE}{STRING}
+STR_NOISE_IN_TOWN                                               :{BLACK}Limite di rumore in città: {ORANGE}{COMMA}{BLACK}  max: {ORANGE}{COMMA}
+STR_STATION_NOISE                                               :{BLACK}Rumore generato: {GOLD}{COMMA}
+########
--- a/src/lang/japanese.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/japanese.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -362,9 +362,9 @@
 STR_SORT_BY                                                     :{BLACK}並べ替え
 
 STR_SORT_BY_POPULATION                                          :{BLACK}人口
-STR_SORT_BY_PRODUCTION                                          :{BLACK}生産量
-STR_SORT_BY_TYPE                                                :{BLACK}種類
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}運送済み
+STR_SORT_BY_PRODUCTION                                          :生産量
+STR_SORT_BY_TYPE                                                :種類
+STR_SORT_BY_TRANSPORTED                                         :運送済み
 STR_SORT_BY_NAME                                                :{BLACK}名前
 STR_SORT_BY_DROPDOWN_NAME                                       :名前
 STR_SORT_BY_DATE                                                :{BLACK}日付
--- a/src/lang/korean.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/korean.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -19,6 +19,7 @@
 STR_EN_ROUTE_FROM                                               :{YELLOW}({1:STATION}에서 온 {0:SHORTCARGO})
 STR_000C_ACCEPTS                                                :{BLACK}받음: {WHITE}
 STR_000D_ACCEPTS                                                :{BLACK}받음: {GOLD}
+STR_SUPPLIES                                                    :{BLACK}공급: {GOLD}
 STR_000E                                                        :
 STR_000F_PASSENGERS                                             :승객
 STR_0010_COAL                                                   :석탄
@@ -200,7 +201,7 @@
 STR_00E7_INDUSTRIES                                             :산업시설
 STR_00E8_ROUTES                                                 :경로
 STR_00E9_VEGETATION                                             :초목
-STR_00EA_OWNERS                                                 :소유자
+STR_00EA_OWNERS                                                 :소유주
 STR_00EB_ROADS                                                  :{BLACK}{TINYFONT}도로
 STR_00EC_RAILROADS                                              :{BLACK}{TINYFONT}철도
 STR_00ED_STATIONS_AIRPORTS_DOCKS                                :{BLACK}{TINYFONT}역/공항/항구
@@ -261,7 +262,7 @@
 STR_0124_TREES                                                  :{BLACK}{TINYFONT}나무
 STR_0125_ROCKS                                                  :{BLACK}{TINYFONT}바위
 STR_0126_WATER                                                  :{BLACK}{TINYFONT}물
-STR_0127_NO_OWNER                                               :{BLACK}{TINYFONT}소유자 없음
+STR_0127_NO_OWNER                                               :{BLACK}{TINYFONT}소유주 없음
 STR_0128_TOWNS                                                  :{BLACK}{TINYFONT}마을
 STR_0129_INDUSTRIES                                             :{BLACK}{TINYFONT}산업 시설
 STR_012A_DESERT                                                 :{BLACK}{TINYFONT}사막
@@ -342,11 +343,11 @@
 
 ############ range for menu starts
 STR_0154_OPERATING_PROFIT_GRAPH                                 :경영 수익 그래프
-STR_0155_INCOME_GRAPH                                           :수입 그래프
+STR_0155_INCOME_GRAPH                                           :수익 그래프
 STR_0156_DELIVERED_CARGO_GRAPH                                  :수송 화물량 그래프
 STR_0157_PERFORMANCE_HISTORY_GRAPH                              :성취도 그래프
 STR_0158_COMPANY_VALUE_GRAPH                                    :회사가치 그래프
-STR_0159_CARGO_PAYMENT_RATES                                    :화물 지불량 그래프
+STR_0159_CARGO_PAYMENT_RATES                                    :화물 운송단가 그래프
 STR_015A_COMPANY_LEAGUE_TABLE                                   :회사 성취도 순위
 STR_PERFORMANCE_DETAIL_MENU                                     :상세 성취도
 ############ range for menu ends
@@ -363,9 +364,9 @@
 STR_SORT_BY                                                     :{BLACK}정렬
 
 STR_SORT_BY_POPULATION                                          :{BLACK}인구
-STR_SORT_BY_PRODUCTION                                          :{BLACK}생산
-STR_SORT_BY_TYPE                                                :{BLACK}종류
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}수송량
+STR_SORT_BY_PRODUCTION                                          :생산
+STR_SORT_BY_TYPE                                                :종류
+STR_SORT_BY_TRANSPORTED                                         :수송량
 STR_SORT_BY_NAME                                                :{BLACK}이름
 STR_SORT_BY_DROPDOWN_NAME                                       :이름
 STR_SORT_BY_DATE                                                :{BLACK}날짜
@@ -378,6 +379,7 @@
 STR_SORT_BY_MAX_SPEED                                           :최고 속력
 STR_SORT_BY_MODEL                                               :모델
 STR_SORT_BY_VALUE                                               :가격
+STR_SORT_BY_LENGTH                                              :길이
 STR_SORT_BY_FACILITY                                            :역 종류
 STR_SORT_BY_WAITING                                             :대기 화물량
 STR_SORT_BY_RATING_MAX                                          :화물 성취도
@@ -443,7 +445,7 @@
 STR_0182_BUILD_ROADS                                            :{BLACK}도로 건설
 STR_0183_BUILD_SHIP_DOCKS                                       :{BLACK}항만 건설
 STR_0184_BUILD_AIRPORTS                                         :{BLACK}공항 건설
-STR_0185_PLANT_TREES_PLACE_SIGNS                                :{BLACK}나무 심기, 팻말 달기 등
+STR_0185_PLANT_TREES_PLACE_SIGNS                                :{BLACK}나무 심기
 STR_0186_LAND_BLOCK_INFORMATION                                 :{BLACK}지역 정보
 STR_0187_OPTIONS                                                :{BLACK}옵션
 STR_0188                                                        :{BLACK}{SMALLUPARROW}
@@ -464,7 +466,7 @@
 STR_0193_SHOW_INDUSTRIES_ON_MAP                                 :{BLACK}맵에 산업시설 표시
 STR_0194_SHOW_TRANSPORT_ROUTES_ON                               :{BLACK}맵에 수송경로 표시
 STR_0195_SHOW_VEGETATION_ON_MAP                                 :{BLACK}맵에 초목 표시
-STR_0196_SHOW_LAND_OWNERS_ON_MAP                                :{BLACK}맵에 부지 소유자 표시
+STR_0196_SHOW_LAND_OWNERS_ON_MAP                                :{BLACK}맵에 부지 소유주 표시
 STR_0197_TOGGLE_TOWN_NAMES_ON_OFF                               :{BLACK}마을 이름 표시/숨기기
 STR_0198_PROFIT_THIS_YEAR_LAST_YEAR                             :{TINYFONT}{BLACK}올해 수입: {CURRENCY} (작년: {CURRENCY})
 
@@ -484,7 +486,10 @@
 STR_01A4_COST_TO_CLEAR_N_A                                      :{BLACK}초기화 가격: {LTBLUE}없음
 STR_01A5_COST_TO_CLEAR                                          :{BLACK}초기화 가격: {LTBLUE}{CURRENCY}
 STR_01A6_N_A                                                    :없음
-STR_01A7_OWNER                                                  :{BLACK}소유자: {LTBLUE}{STRING}
+STR_01A7_OWNER                                                  :{BLACK}소유주: {LTBLUE}{STRING}
+STR_ROAD_OWNER                                                  :{BLACK}도로 소유주: {LTBLUE}{STRING}
+STR_TRAM_OWNER                                                  :{BLACK}전찻길 소유주: {LTBLUE}{STRING}
+STR_RAIL_OWNER                                                  :{BLACK}철도 소유주: {LTBLUE}{STRING}
 STR_01A8_LOCAL_AUTHORITY                                        :{BLACK}지역 당국: {LTBLUE}{STRING}
 STR_01A9_NONE                                                   :없음
 STR_01AA_NAME                                                   :{BLACK}이름
@@ -801,15 +806,15 @@
 STR_02DC_DISPLAY_SUBSIDIES                                      :{BLACK}보조금 표시
 STR_02DD_SUBSIDIES                                              :보조금
 STR_02DE_MAP_OF_WORLD                                           :전체 지도 보기
-STR_EXTRA_VIEW_PORT                                             :추가 보임창
+STR_EXTRA_VIEW_PORT                                             :외부 화면
 STR_SIGN_LIST                                                   :팻말 목록
 STR_02DF_TOWN_DIRECTORY                                         :도시 목록
 STR_TOWN_POPULATION                                             :{BLACK}세계 인구: {COMMA}
-STR_EXTRA_VIEW_PORT_TITLE                                       :{WHITE}보임창 {COMMA}
-STR_EXTRA_VIEW_MOVE_VIEW_TO_MAIN                                :{BLACK}보임창으로 복사
-STR_EXTRA_VIEW_MOVE_VIEW_TO_MAIN_TT                             :{BLACK}이 지역의 풍경을 이 보임창으로 복사합니다
-STR_EXTRA_VIEW_MOVE_MAIN_TO_VIEW                                :{BLACK}보임창에서 붙여넣기
-STR_EXTRA_VIEW_MOVE_MAIN_TO_VIEW_TT                             :{BLACK}이 지역의 풍경을 이 보임창에 붙여넣습니다
+STR_EXTRA_VIEW_PORT_TITLE                                       :{WHITE}외부 화면 {COMMA}
+STR_EXTRA_VIEW_MOVE_VIEW_TO_MAIN                                :{BLACK}외부 화면에 저장
+STR_EXTRA_VIEW_MOVE_VIEW_TO_MAIN_TT                             :{BLACK}현재 장소를 외부 화면에 저장합니다.
+STR_EXTRA_VIEW_MOVE_MAIN_TO_VIEW                                :{BLACK}이 장소로 이동
+STR_EXTRA_VIEW_MOVE_MAIN_TO_VIEW_TT                             :{BLACK}외부 화면에 저장된 장소로 이동합니다.
 
 STR_02E0_CURRENCY_UNITS                                         :{BLACK}화폐 단위
 STR_02E1                                                        :{BLACK}{SKIP}{STRING}
@@ -1025,7 +1030,7 @@
 STR_CONFIG_PATCHES_EXTRADYNAMITE                                :{LTBLUE}도시 소유의 도로, 다리 등의 제거를 허용 : {ORANGE}{STRING}
 STR_CONFIG_PATCHES_MAMMOTHTRAINS                                :{LTBLUE}매우 긴 열차 허용 : {ORANGE}{STRING}
 STR_CONFIG_PATCHES_REALISTICACCEL                               :{LTBLUE}사실감있는 열차 가속 사용 : {ORANGE}{STRING}
-STR_CONFIG_PATCHES_FORBID_90_DEG                                :{LTBLUE}열차/선박의 90도 회전을 금지함: {ORANGE}{STRING} {LTBLUE} (requires NPF)
+STR_CONFIG_PATCHES_FORBID_90_DEG                                :{LTBLUE}열차/선박의 90도 회전을 금지함: {ORANGE}{STRING} {LTBLUE} (NPF 필요)
 STR_CONFIG_PATCHES_JOINSTATIONS                                 :{LTBLUE}바로 옆에 역이 있으면 그 역의 이름으로 건설 (새로운 이름X) : {ORANGE}{STRING}
 STR_CONFIG_PATCHES_IMPROVEDLOAD                                 :{LTBLUE}향상된 수송 알고리즘 사용 : {ORANGE}{STRING}
 STR_CONFIG_PATCHES_GRADUAL_LOADING                              :{LTBLUE}점차적으로 차량 싣기 : {ORANGE}{STRING}
@@ -1053,6 +1058,7 @@
 STR_CONFIG_PATCHES_PLANE_SPEED                                  :{LTBLUE}비행기 속도 인수: {ORANGE}1 / {STRING}
 STR_CONFIG_PATCHES_STOP_ON_TOWN_ROAD                            :{LTBLUE}마을이 소유중인 도로를 통과하는 버스 정류장 건설 허용: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_ADJACENT_STATIONS                            :{LTBLUE}정거장 근처에 건물 짓기 허용: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_DYNAMIC_ENGINES                              :{LTBLUE}여러 개의 NewGRF 엔진 세트를 허용: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_SMALL_AIRPORTS                               :{LTBLUE}소형 공항의 건설을 허용 : {ORANGE}{STRING}
 
@@ -1092,7 +1098,7 @@
 STR_CONFIG_PATCHES_SERVICEATHELIPAD                             :{LTBLUE}헬리콥터를 발착장에서 자동으로 점검 : {ORANGE}{STRING}
 STR_CONFIG_PATCHES_LINK_TERRAFORM_TOOLBAR                       :{LTBLUE}철도/도로/항만/공항 툴바에 지형 정보 링크 : {ORANGE}{STRING}
 STR_CONFIG_PATCHES_REVERSE_SCROLLING                            :{LTBLUE}스크롤 방향 뒤집기 : {ORANGE}{STRING}
-STR_CONFIG_PATCHES_SMOOTH_SCROLLING                             :{LTBLUE}부드러운 보임창 스크롤: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_SMOOTH_SCROLLING                             :{LTBLUE}부드러운 화면 스크롤: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_MEASURE_TOOLTIP                              :{LTBLUE}건설도구 사용시 거리측정 툴팁 표시 : {ORANGE}{STRING}
 STR_CONFIG_PATCHES_LIVERIES                                     :{LTBLUE}회사 조합원 표시 : {ORANGE}{STRING}
 STR_CONFIG_PATCHES_LIVERIES_NONE                                :없음
@@ -1121,9 +1127,9 @@
 STR_CONFIG_PATCHES_LOADING_INDICATORS_ALL                       :모든 회사
 STR_CONFIG_PATCHES_TIMETABLE_ALLOW                              :{LTBLUE}차량에 시간표 사용: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_TIMETABLE_IN_TICKS                           :{LTBLUE}시간표를 일(日)이 아닌 틱으로 표시: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE                            :{LTBLUE}기본값으로 사용할 철도의 종류 (새 게임/불러오기 후): {ORANGE}{STRING}
+STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE                            :{LTBLUE}자주 쓰는 철도 종류 설정: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE_RAIL                       :보통 철도
-STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE_ELRAIL                     :전개 철도
+STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE_ELRAIL                     :전기 철도
 STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE_MONORAIL                   :모노레일
 STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE_MAGLEV                     :자기부상
 STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE_FIRST                      :처음 사용 가능한 것
@@ -1172,6 +1178,7 @@
 STR_CONFIG_PATCHES_TOWN_LAYOUT_BETTER_ROADS                     :개선된 도로
 STR_CONFIG_PATCHES_TOWN_LAYOUT_2X2_GRID                         :2x2 칸
 STR_CONFIG_PATCHES_TOWN_LAYOUT_3X3_GRID                         :3x3 칸
+STR_CONFIG_PATCHES_TOWN_LAYOUT_RANDOM                           :무작위
 
 STR_CONFIG_PATCHES_TOOLBAR_POS                                  :{LTBLUE}주메뉴의 위치 : {ORANGE}{STRING}
 STR_CONFIG_PATCHES_TOOLBAR_POS_LEFT                             :왼쪽
@@ -1238,8 +1245,8 @@
 STR_HEADING_FOR_WAYPOINT                                        :{LTBLUE}{WAYPOINT}(으)로 향하는 중
 STR_HEADING_FOR_WAYPOINT_VEL                                    :{LTBLUE}{WAYPOINT}, {VELOCITY}(으)로 향하는 중
 
-STR_GO_TO_WAYPOINT                                              :{WAYPOINT}을/를 경유
-STR_GO_NON_STOP_TO_WAYPOINT                                     :{WAYPOINT}을/를 직통 경유
+STR_GO_TO_WAYPOINT                                              :[경유] {WAYPOINT}
+STR_GO_NON_STOP_TO_WAYPOINT                                     :[경유, 직통] {WAYPOINT}
 
 STR_WAYPOINTNAME_CITY                                           :웨이포인트 {TOWN}
 STR_WAYPOINTNAME_CITY_SERIAL                                    :웨이포인트 {TOWN} #{COMMA}
@@ -1271,7 +1278,7 @@
 
 STR_LANDSCAPING_TOOLBAR_TIP                                     :{BLACK}땅을 올리거나 내리기, 나무 심기 등의 지형 툴바를 엽니다.
 STR_LANDSCAPING_TOOLBAR                                         :{WHITE}지평편집
-STR_LEVEL_LAND_TOOLTIP                                          :{BLACK}위치좌표값
+STR_LEVEL_LAND_TOOLTIP                                          :{BLACK}땅을 평평하게 고릅니다.
 
 
 STR_TREES_RANDOM_TYPE                                           :{BLACK}무작위 나무
@@ -1362,6 +1369,8 @@
 STR_NETWORK_GAME_NAME_TIP                                       :{BLACK}게임 이름
 STR_NETWORK_INFO_ICONS_TIP                                      :{BLACK}언어, 서버 버전 등
 STR_NETWORK_CLICK_GAME_TO_SELECT                                :{BLACK}선택하려면 목록에서 게임을 클릭하세요
+STR_NETWORK_LAST_JOINED_SERVER                                  :{BLACK}최근에 접속한 서버:
+STR_NETWORK_CLICK_TO_SELECT_LAST                                :{BLACK}최근에 플레이한 서버를 선택하려면 클릭하세요
 
 STR_NETWORK_FIND_SERVER                                         :{BLACK}서버 검색
 STR_NETWORK_FIND_SERVER_TIP                                     :{BLACK}서버를 네트워크에서 검색합니다
@@ -1615,7 +1624,7 @@
 ##id 0x1000
 STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION                         :{WHITE}잘못된 방향으로 땅이 기울어졌습니다
 STR_1001_IMPOSSIBLE_TRACK_COMBINATION                           :{WHITE}불가능한 트랙 조합입니다
-STR_1002_EXCAVATION_WOULD_DAMAGE                                :{WHITE}터널에 영향을 주는 지형편집입니다
+STR_1002_EXCAVATION_WOULD_DAMAGE                                :{WHITE}터널 때문에 지형을 편집할 수 없습니다.
 STR_1003_ALREADY_AT_SEA_LEVEL                                   :{WHITE}이미 해수면에 도달했습니다
 STR_1004_TOO_HIGH                                               :{WHITE}너무 높습니다!
 STR_1005_NO_SUITABLE_RAILROAD_TRACK                             :{WHITE}알맞지 않은 철로입니다.
@@ -1709,6 +1718,7 @@
 STR_1816_TREE_LINED_ROAD                                        :가로수가 있는 도로
 STR_1817_ROAD_VEHICLE_DEPOT                                     :차고
 STR_1818_ROAD_RAIL_LEVEL_CROSSING                               :철도 건널목
+STR_TRAMWAY                                                     :전찻길
 STR_CAN_T_REMOVE_BUS_STATION                                    :{WHITE}버스정류장을 제거할 수 없습니다...
 STR_CAN_T_REMOVE_TRUCK_STATION                                  :{WHITE}트럭 터미널을 제거할 수 없습니다...
 STR_CAN_T_REMOVE_PASSENGER_TRAM_STATION                         :{WHITE}승객 전차 정거장을 제거할 수 없습니다...
@@ -1792,7 +1802,7 @@
 STR_2047_MEDIUM_ADVERTISING_CAMPAIGN                            :중규모 광고 캠페인
 STR_2048_LARGE_ADVERTISING_CAMPAIGN                             :대규모 광고 캠페인
 STR_2049_FUND_LOCAL_ROAD_RECONSTRUCTION                         :지역 도로 재공사에 투자
-STR_204A_BUILD_STATUE_OF_COMPANY                                :회사 소유자의 동상 건설
+STR_204A_BUILD_STATUE_OF_COMPANY                                :회사 소유주의 동상 건설
 STR_204B_FUND_NEW_BUILDINGS                                     :새로운 건물에 투자
 STR_204C_BUY_EXCLUSIVE_TRANSPORT                                :수송 권한 독점권 구입
 STR_TOWN_BRIBE_THE_LOCAL_AUTHORITY                              :지역 당국에 뇌물 먹이기
@@ -1819,7 +1829,7 @@
 STR_STATION                                                     :{STATION}
 
 ##id 0x2800
-STR_LANDSCAPING                                                 :지형편집
+STR_LANDSCAPING                                                 :지형 편집
 STR_2800_PLANT_TREES                                            :나무 심기
 STR_2801_PLACE_SIGN                                             :팻말 달기
 STR_2802_TREES                                                  :{WHITE}나무
@@ -2185,7 +2195,7 @@
 STR_6821_MEDIUM                                                 :보통
 STR_6822_HIGH                                                   :높음
 STR_6823_NONE                                                   :고장 안남
-STR_6824_REDUCED                                                :재생산
+STR_6824_REDUCED                                                :적음
 STR_6825_NORMAL                                                 :일반
 STR_6826_X1_5                                                   :1.5배 지급
 STR_6827_X2                                                     :2배 지급
@@ -2247,7 +2257,7 @@
 STR_7022_INCOME_GRAPH                                           :{WHITE}수익 그래프
 STR_CURRCOMPACT                                                 :{CURRCOMPACT}
 STR_7024                                                        :{COMMA}
-STR_7025_OPERATING_PROFIT_GRAPH                                 :{WHITE}수행 이익 그래프
+STR_7025_OPERATING_PROFIT_GRAPH                                 :{WHITE}경영 수익 그래프
 STR_7026_BANK_BALANCE                                           :{WHITE}소유금
 STR_7027_LOAN                                                   :{WHITE}대출
 STR_MAX_LOAN                                                    :{WHITE}최대 대출:  {BLACK}{CURRENCY}
@@ -2305,9 +2315,9 @@
 STR_705E_NEW_TRANSPORT_COMPANY_LAUNCHED                         :{BLACK}{BIGFONT}새로운 운송회사 등장!
 STR_705F_STARTS_CONSTRUCTION_NEAR                               :{BLACK}{BIGFONT}{COMPANY}이/가 {TOWN}에서 공사를 시작했습니다!
 STR_7060_CAN_T_BUY_COMPANY                                      :{WHITE}회사를 인수할 수 없습니다...
-STR_7061_CARGO_PAYMENT_RATES                                    :{WHITE}화물 운송비 지급량
+STR_7061_CARGO_PAYMENT_RATES                                    :{WHITE}화물 운송단가 비율
 STR_7062_DAYS_IN_TRANSIT                                        :{BLACK}{TINYFONT}통과시간
-STR_7063_PAYMENT_FOR_DELIVERING                                 :{BLACK}{TINYFONT}10단위(또는 1만리터)의 화물을 20칸의 거리로 운송할 때의 운송비 지급량입니다.
+STR_7063_PAYMENT_FOR_DELIVERING                                 :{BLACK}{TINYFONT}10 단위(1만 리터)의 화물을 20칸 거리만큼 운송할 때의 운송비 지급량
 STR_7064_TOGGLE_GRAPH_FOR_CARGO                                 :{BLACK}이 화물에 대한 그래프 켜기/끄기
 STR_7065                                                        :{BLACK}{TINYFONT}{STRING}
 STR_7066_ENGINEER                                               :엔지니어
@@ -2651,6 +2661,76 @@
 STR_8801_CITIZENS_CELEBRATE_FIRST                               :{BLACK}{BIGFONT}{STATION}에 처음으로 기차가 도착했습니다!{}사람들이 환호성을 지릅니다!
 STR_8802_DETAILS                                                :{WHITE}{VEHICLE} (상세정보)
 STR_8803_TRAIN_IN_THE_WAY                                       :{WHITE}중간에 기차가 있습니다
+STR_8804                                                        :{SETX 10}{COMMA}: {STRING} {STRING}
+STR_8805                                                        :{RIGHTARROW}{SETX 10}{COMMA}: {STRING} {STRING}
+STR_ORDER_GO_TO                                                 :[운행]
+STR_ORDER_GO_NON_STOP_TO                                        :급행
+STR_ORDER_GO_VIA                                                :경유
+STR_ORDER_GO_NON_STOP_VIA                                       :직통 경유
+STR_ORDER_DROP_LOAD_IF_POSSIBLE                                 :적재 옵션
+STR_ORDER_DROP_FULL_LOAD_ALL                                    :모든 화물을 가득 실음
+STR_ORDER_DROP_FULL_LOAD_ANY                                    :종류에 상관 없이 화물을 가득 실음
+STR_ORDER_DROP_NO_LOADING                                       :싣지 않기
+STR_ORDER_DROP_UNLOAD_IF_ACCEPTED                               :하차 옵션
+STR_ORDER_DROP_UNLOAD                                           :모든 화물 하차
+STR_ORDER_DROP_TRANSFER                                         :환승
+STR_ORDER_DROP_NO_UNLOADING                                     :화물 하차 않음
+STR_ORDER_FULL_LOAD                                             :(가득 실음)
+STR_ORDER_FULL_LOAD_ANY                                         :(종류에 상관 없이 모든 화물 적재)
+STR_ORDER_NO_LOAD                                               :(싣지 않기)
+STR_ORDER_UNLOAD                                                :(화물 하차 후 적재)
+STR_ORDER_UNLOAD_FULL_LOAD                                      :(화물 하차 후 모든 화물을 싣고 출발)
+STR_ORDER_UNLOAD_FULL_LOAD_ANY                                  :(화물 하차 후 종류에 상관없이 모든 화물 적재)
+STR_ORDER_UNLOAD_NO_LOAD                                        :(화물 하차 후 빈 차로 출발)
+STR_ORDER_TRANSFER                                              :(환승 후 화물 받음)
+STR_ORDER_TRANSFER_FULL_LOAD                                    :(환승 후 모든 화물 적재)
+STR_ORDER_TRANSFER_FULL_LOAD_ANY                                :(환승 후 종류에 상관없이 모든 화물 적재)
+STR_ORDER_TRANSFER_NO_LOAD                                      :(환승 후 빈 차로 출발)
+STR_ORDER_NO_UNLOAD                                             :(내리지 않고 화물을 받음)
+STR_ORDER_NO_UNLOAD_FULL_LOAD                                   :(내리지 않고 가득 찰 때까지 기다림)
+STR_ORDER_NO_UNLOAD_FULL_LOAD_ANY                               :(내리지 않고 특정 화물이 가득 찰 때까지 기다림)
+STR_ORDER_TOOLTIP_NON_STOP                                      :{BLACK}선택한 목적지에서의 정차 방식을 변경합니다
+STR_ORDER_TOOLTIP_FULL_LOAD                                     :{BLACK}선택한 목적지에서의 화물 적재 방식을 변경합니다
+STR_ORDER_TOOLTIP_UNLOAD                                        :{BLACK}선택한 목적지에서의 화물 하차 방식을 변경합니다
+STR_GO_TO_STATION                                               :{STRING} {STATION} {STRING}
+
+STR_ORDER_GO_TO_DROPDOWN_TOOLTIP                                :{BLACK}확장된 이동경로를 입력합니다
+STR_ORDER_GO_TO_NEAREST_DEPOT                                   :가까운 차량기지로
+STR_ORDER_GO_TO_NEAREST_HANGAR                                  :가까운 격납고로
+STR_ORDER_NEAREST_DEPOT                                         :가까운
+STR_ORDER_NEAREST_HANGAR                                        :가까운 격납고
+STR_ORDER_SERVICE_AT                                            :[점검]
+STR_ORDER_SERVICE_NON_STOP_AT                                   :[점검, 급행]
+STR_ORDER_TRAIN_DEPOT                                           :차량기지
+STR_ORDER_ROAD_DEPOT                                            :차고
+STR_ORDER_SHIP_DEPOT                                            :정박소
+STR_GO_TO_DEPOT                                                 :{STRING} {TOWN} {STRING}
+STR_GO_TO_NEAREST_DEPOT                                         :{STRING} {STRING} {STRING}
+STR_GO_TO_HANGAR                                                :{STRING} {STATION} 격납고
+
+STR_ORDER_CONDITIONAL                                           :조건부 경로 건너뛰기
+STR_ORDER_CONDITIONAL_VARIABLE_TOOLTIP                          :{BLACK}경로를 건너뛰기 위한 차량값
+STR_ORDER_CONDITIONAL_COMPARATOR_TOOLTIP                        :{BLACK}차량 데이터와 주어진 값을 비교하는 방법
+STR_ORDER_CONDITIONAL_VALUE_TOOLTIP                             :{BLACK}차량 데이터에 대해 비교하기 위한 값
+STR_ORDER_CONDITIONAL_VALUE_CAPT                                :{WHITE}비교할 값을 입력하세요
+STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE                           :적재율
+STR_ORDER_CONDITIONAL_RELIABILITY                               :신뢰도
+STR_ORDER_CONDITIONAL_MAX_SPEED                                 :최고 속력
+STR_ORDER_CONDITIONAL_AGE                                       :연식 (년)
+STR_ORDER_CONDITIONAL_REQUIRES_SERVICE                          :점검 필요성
+STR_ORDER_CONDITIONAL_UNCONDITIONALLY                           :항상
+STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS                         :=
+STR_ORDER_CONDITIONAL_COMPARATOR_NOT_EQUALS                     :≠
+STR_ORDER_CONDITIONAL_COMPARATOR_LESS_THAN                      :<
+STR_ORDER_CONDITIONAL_COMPARATOR_LESS_EQUALS                    :≤
+STR_ORDER_CONDITIONAL_COMPARATOR_MORE_THAN                      :>
+STR_ORDER_CONDITIONAL_COMPARATOR_MORE_EQUALS                    :≥
+STR_ORDER_CONDITIONAL_COMPARATOR_IS_TRUE                        :이 있을 때
+STR_ORDER_CONDITIONAL_COMPARATOR_IS_FALSE                       :이 없을 때
+STR_CONDITIONAL_VALUE                                           :{SKIP}{BLACK}{COMMA}
+STR_CONDITIONAL_UNCONDITIONAL                                   :{COMMA}(으)로 건너뛰기
+STR_CONDITIONAL_NUM                                             :[조건 경로] {COMMA}번째 경로로 건너뛰기 ({STRING} {STRING} {COMMA} 일때)
+STR_CONDITIONAL_TRUE_FALSE                                      :[조건 경로] {COMMA}번째 경로로 건너뛰기 ({STRING} {STRING})
 
 STR_TIMETABLE_TRAVEL_NOT_TIMETABLED                             :여행 (시간표 없음)
 STR_TIMETABLE_TRAVEL_FOR                                        :{STRING}로 여행
@@ -2708,6 +2788,7 @@
 STR_882D_VALUE                                                  :{LTBLUE}{ENGINE}{BLACK}   가격: {LTBLUE}{CURRENCY}
 STR_882E                                                        :{WHITE}{VEHICLE}
 STR_882F_LOADING_UNLOADING                                      :{LTBLUE}싣는중 / 내리는중
+STR_LEAVING                                                     :{LTBLUE}떠남
 STR_TRAIN_MUST_BE_STOPPED                                       :{WHITE}차량기지 안에서 정지해있어야 합니다!
 STR_8830_CAN_T_SEND_TRAIN_TO_DEPOT                              :{WHITE}기차를 기지로 보낼 수 없습니다...
 STR_8831_NO_MORE_SPACE_FOR_ORDERS                               :{WHITE}더이상 경로를 지정할 공간이 없습니다
@@ -3021,7 +3102,7 @@
 
 STR_BRIBE_FAILED                                                :{WHITE}당신의 뇌물 수수 행위가
 STR_BRIBE_FAILED_2                                              :{WHITE}지역 당국에 의해 발각되었습니다!
-STR_BUILD_DATE                                                  :{BLACK}생산: {LTBLUE}{DATE_LONG}
+STR_BUILD_DATE                                                  :{BLACK}건설날짜: {LTBLUE}{DATE_LONG}
 
 STR_PERFORMANCE_DETAIL                                          :{WHITE}상세 성취도
 STR_PERFORMANCE_DETAIL_KEY                                      :{BLACK}자세히
@@ -3105,7 +3186,9 @@
 STR_NEWGRF_DISABLED_WARNING                                     :{WHITE}사라진 GRF 파일은 사용불가능합니다
 STR_NEWGRF_NOT_FOUND_WARNING                                    :{WHITE}사라진 GRF 파일이 게임 로드에 사용될 수 있습니다
 STR_NEWGRF_UNPAUSE_WARNING_TITLE                                :{YELLOW}GRF 파일 손실
-STR_NEWGRF_UNPAUSE_WARNING                                      :{WHITE}일시정지는 OpenTTD를 망가뜨릴 수 있습니다. 차후에 나오는 버그를 위해 버그 리포트를 파일로 만들지 마십시오.{}일시정지하시겠습니까?
+STR_NEWGRF_UNPAUSE_WARNING                                      :{WHITE}일시정지를 해제하면 오류가 발생할 수도 있습니다. 차후에 나오는 오류를 위해 버그 리포트를 보관하지 마십시오.{}일시정지를 해제하시겠습니까?
+
+STR_LOADGAME_REMOVED_TRAMS                                      :{WHITE}전차를 지원하지 않는 버전으로 게임이 저장되었습니다. 모든 전차는 제거되었습니다.
 
 STR_CURRENCY_WINDOW                                             :{WHITE}사용자 화폐 단위
 STR_CURRENCY_EXCHANGE_RATE                                      :{LTBLUE}환율: {ORANGE}{CURRENCY} = {COMMA}파운드
@@ -3318,7 +3401,7 @@
 
 ############ Date formatting
 STR_DATE_TINY                                                   :{2:NUM}.{1:STRING}.{0:STRING}
-STR_DATE_SHORT                                                  :{1:NUM}년 {0:STRING}월
+STR_DATE_SHORT                                                  :{1:NUM}년 {0:STRING}
 STR_DATE_LONG                                                   :{2:NUM}년 {1:STRING}월 {0:STRING}일
 
 ########
@@ -3337,6 +3420,7 @@
 STR_TRANSPARENT_STRUCTURES_DESC                                 :{BLACK}등대와 안테나와 같은 구조물 투명 전환
 STR_TRANSPARENT_CATENARY_DESC                                   :{BLACK}케이블 보이기/숨기기. 고정하려면 CTRL+클릭하세요.
 STR_TRANSPARENT_LOADING_DESC                                    :{BLACK}적재 정도 투명 전환
+STR_TRANSPARENT_INVISIBLE_DESC                                  :{BLACK}투명이 아니라 아예 안보이게 할 항목을 선택하세요
 
 STR_PERCENT_UP_SMALL                                            :{TINYFONT}{WHITE}{NUM}%{UPARROW}
 STR_PERCENT_UP                                                  :{WHITE}{NUM}%{UPARROW}
@@ -3470,3 +3554,9 @@
 STR_OSK_KEYBOARD_LAYOUT                                         :`1234567890-=\qwertyuiop[]asdfghjkl;'  zxcvbnm,./ .
 STR_OSK_KEYBOARD_LAYOUT_CAPS                                    :~!@#$%^&*()_+|QWERTYUIOP{{}}ASDFGHJKL:"  ZXCVBNM<>? .
 ########
+
+############ town controlled noise level
+STR_CONFIG_PATCHES_NOISE_LEVEL                                  :{LTBLUE}도시가 공항에서 나오는 소음을 제한하도록 함: {ORANGE}{STRING}
+STR_NOISE_IN_TOWN                                               :{BLACK}도시 소음 제한: {ORANGE}{COMMA}{BLACK}  최고: {ORANGE}{COMMA}
+STR_STATION_NOISE                                               :{BLACK}소음 원인: {GOLD}{COMMA}
+########
--- a/src/lang/lithuanian.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/lithuanian.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -395,9 +395,9 @@
 STR_SORT_BY                                                     :{BLACK}Rikiuoti pagal
 
 STR_SORT_BY_POPULATION                                          :{BLACK}Populiacija
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Produkcija
-STR_SORT_BY_TYPE                                                :{BLACK}Tipa
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Pervezimus
+STR_SORT_BY_PRODUCTION                                          :Produkcija
+STR_SORT_BY_TYPE                                                :Tipa
+STR_SORT_BY_TRANSPORTED                                         :Pervezimus
 STR_SORT_BY_NAME                                                :{BLACK}Varda
 STR_SORT_BY_DROPDOWN_NAME                                       :Varda
 STR_SORT_BY_DATE                                                :{BLACK}Data
--- a/src/lang/norwegian_bokmal.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/norwegian_bokmal.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -362,9 +362,9 @@
 STR_SORT_BY                                                     :{BLACK}Sorter etter
 
 STR_SORT_BY_POPULATION                                          :{BLACK}Innbyggertall
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Produksjon
-STR_SORT_BY_TYPE                                                :{BLACK}Type
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Transportert
+STR_SORT_BY_PRODUCTION                                          :Produksjon
+STR_SORT_BY_TYPE                                                :Type
+STR_SORT_BY_TRANSPORTED                                         :Transportert
 STR_SORT_BY_NAME                                                :{BLACK}Navn
 STR_SORT_BY_DROPDOWN_NAME                                       :Navn
 STR_SORT_BY_DATE                                                :{BLACK}Dato
--- a/src/lang/norwegian_nynorsk.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/norwegian_nynorsk.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -362,9 +362,9 @@
 STR_SORT_BY                                                     :{BLACK}Sorter etter
 
 STR_SORT_BY_POPULATION                                          :{BLACK}Innbyggjartal
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Produksjon
-STR_SORT_BY_TYPE                                                :{BLACK}Type
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Transportert
+STR_SORT_BY_PRODUCTION                                          :Produksjon
+STR_SORT_BY_TYPE                                                :Type
+STR_SORT_BY_TRANSPORTED                                         :Transportert
 STR_SORT_BY_NAME                                                :{BLACK}Namn
 STR_SORT_BY_DROPDOWN_NAME                                       :Namn
 STR_SORT_BY_DATE                                                :{BLACK}Dato
--- a/src/lang/piglatin.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/piglatin.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -361,9 +361,9 @@
 STR_SORT_BY                                                     :{BLACK}Ortsay ybay
 
 STR_SORT_BY_POPULATION                                          :{BLACK}Opulationpay
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Oductionpray
-STR_SORT_BY_TYPE                                                :{BLACK}Ypetay
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Ansportedtray
+STR_SORT_BY_PRODUCTION                                          :Oductionpray
+STR_SORT_BY_TYPE                                                :Ypetay
+STR_SORT_BY_TRANSPORTED                                         :Ansportedtray
 STR_SORT_BY_NAME                                                :{BLACK}Amenay
 STR_SORT_BY_DROPDOWN_NAME                                       :Amenay
 STR_SORT_BY_DATE                                                :{BLACK}Ateday
--- a/src/lang/polish.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/polish.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -414,9 +414,9 @@
 STR_SORT_BY                                                     :{BLACK}Sortuj wg
 
 STR_SORT_BY_POPULATION                                          :{BLACK}Populacja
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Produkcja
-STR_SORT_BY_TYPE                                                :{BLACK}Typ
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Przetransportowano
+STR_SORT_BY_PRODUCTION                                          :Produkcja
+STR_SORT_BY_TYPE                                                :Typ
+STR_SORT_BY_TRANSPORTED                                         :Przetransportowano
 STR_SORT_BY_NAME                                                :{BLACK}Nazwa
 STR_SORT_BY_DROPDOWN_NAME                                       :Nazwa
 STR_SORT_BY_DATE                                                :{BLACK}Data
--- a/src/lang/portuguese.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/portuguese.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -362,9 +362,9 @@
 STR_SORT_BY                                                     :{BLACK}Ordenar por
 
 STR_SORT_BY_POPULATION                                          :{BLACK}População
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Produção
-STR_SORT_BY_TYPE                                                :{BLACK}Tipo
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Transportado
+STR_SORT_BY_PRODUCTION                                          :Produção
+STR_SORT_BY_TYPE                                                :Tipo
+STR_SORT_BY_TRANSPORTED                                         :Transportado
 STR_SORT_BY_NAME                                                :{BLACK}Nome
 STR_SORT_BY_DROPDOWN_NAME                                       :Nome
 STR_SORT_BY_DATE                                                :{BLACK}Data
@@ -2638,6 +2638,15 @@
 STR_8801_CITIZENS_CELEBRATE_FIRST                               :{BLACK}{BIGFONT}Cidadãos celebram . . .{}Primeiro comboio chega a {STATION}!
 STR_8802_DETAILS                                                :{WHITE}{VEHICLE} (Detalhes)
 STR_8803_TRAIN_IN_THE_WAY                                       :{WHITE}Comboio no caminho
+STR_GO_TO_STATION                                               :{STRING} {STATION} {STRING}
+
+STR_GO_TO_DEPOT                                                 :{STRING} {TOWN} {STRING}
+STR_GO_TO_NEAREST_DEPOT                                         :{STRING} {STRING} {STRING}
+
+STR_ORDER_CONDITIONAL_UNCONDITIONALLY                           :Sempre
+STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS                         :é igual a
+STR_ORDER_CONDITIONAL_COMPARATOR_NOT_EQUALS                     :é diferente de
+STR_CONDITIONAL_VALUE                                           :{SKIP}{BLACK}{COMMA}
 
 STR_TIMETABLE_TRAVEL_NOT_TIMETABLED                             :Viagem (sem programação)
 STR_TIMETABLE_TRAVEL_FOR                                        :Viajar durante {STRING}
@@ -3092,6 +3101,7 @@
 STR_NEWGRF_UNPAUSE_WARNING_TITLE                                :{YELLOW}Ficheiro(s) GRF em falta
 STR_NEWGRF_UNPAUSE_WARNING                                      :{WHITE}Sair da pausa pode causar problemas ao OpenTTD. Não envie informações sobre este tipo de problemas.{}Deseja realmente sair da pausa?
 
+
 STR_CURRENCY_WINDOW                                             :{WHITE}Moeda Modificada
 STR_CURRENCY_EXCHANGE_RATE                                      :{LTBLUE}Taxa de troca: {ORANGE}{CURRENCY} = £ {COMMA}
 STR_CURRENCY_SEPARATOR                                          :{LTBLUE}Separador:
@@ -3448,3 +3458,9 @@
 STR_DRAG_SIGNALS_DENSITY_DECREASE_TIP                           :{BLACK}Diminuir densidade de sinais
 STR_DRAG_SIGNALS_DENSITY_INCREASE_TIP                           :{BLACK}Aumentar densidade de sinais
 ########
+
+############ on screen keyboard
+########
+
+############ town controlled noise level
+########
--- a/src/lang/romanian.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/romanian.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -15,11 +15,12 @@
 STR_0007_FLAT_LAND_REQUIRED                                     :{WHITE}Necesită teren plat
 STR_0008_WAITING                                                :{BLACK}În aşteptare: {WHITE}{STRING}
 STR_0009                                                        :{WHITE}{CARGO}
+STR_EN_ROUTE_FROM                                               :{YELLOW}({SHORTCARGO} pe drum de la {STATION})
 STR_000C_ACCEPTS                                                :{BLACK}Acceptă: {WHITE}
 STR_000D_ACCEPTS                                                :{BLACK}Acceptă: {GOLD}
 STR_000E                                                        :
 STR_000F_PASSENGERS                                             :călători
-STR_0010_COAL                                                   :cărbuni
+STR_0010_COAL                                                   :cărbune
 STR_0011_MAIL                                                   :colete poştale
 STR_0012_OIL                                                    :petrol
 STR_0013_LIVESTOCK                                              :animale
@@ -51,7 +52,7 @@
 STR_002D_FIZZY_DRINKS                                           :sucuri
 STR_002E                                                        :
 STR_002F_PASSENGER                                              :călător
-STR_0030_COAL                                                   :cărbuni
+STR_0030_COAL                                                   :cărbune
 STR_0031_MAIL                                                   :colete poştale
 STR_0032_OIL                                                    :petrol
 STR_0033_LIVESTOCK                                              :animale
@@ -83,7 +84,7 @@
 STR_004D_FIZZY_DRINK                                            :suc
 STR_QUANTITY_NOTHING                                            :
 STR_QUANTITY_PASSENGERS                                         :{COMMA} cãlãtor{P "" i}
-STR_QUANTITY_COAL                                               :{WEIGHT} de cãrbune
+STR_QUANTITY_COAL                                               :{WEIGHT} de cărbune
 STR_QUANTITY_MAIL                                               :{COMMA} sac{P "" i} cu colete postale
 STR_QUANTITY_OIL                                                :{VOLUME} de petrol
 STR_QUANTITY_LIVESTOCK                                          :{COMMA} animal{P "" e}
@@ -125,7 +126,7 @@
 STR_ABBREV_IRON_ORE                                             :{TINYFONT}FE
 STR_ABBREV_STEEL                                                :{TINYFONT}OT
 STR_ABBREV_VALUABLES                                            :{TINYFONT}VL
-STR_ABBREV_COPPER_ORE                                           :{TINYFONT}CU
+STR_ABBREV_COPPER_ORE                                           :{TINYFONT}CP
 STR_ABBREV_MAIZE                                                :{TINYFONT}PR
 STR_ABBREV_FRUIT                                                :{TINYFONT}FR
 STR_ABBREV_DIAMONDS                                             :{TINYFONT}DM
@@ -134,7 +135,7 @@
 STR_ABBREV_GOLD                                                 :{TINYFONT}AU
 STR_ABBREV_WATER                                                :{TINYFONT}AP
 STR_ABBREV_WHEAT                                                :{TINYFONT}GR
-STR_ABBREV_RUBBER                                               :{TINYFONT}CU
+STR_ABBREV_RUBBER                                               :{TINYFONT}CC
 STR_ABBREV_SUGAR                                                :{TINYFONT}ZH
 STR_ABBREV_TOYS                                                 :{TINYFONT}JC
 STR_ABBREV_SWEETS                                               :{TINYFONT}BB
@@ -146,7 +147,7 @@
 STR_ABBREV_PLASTIC                                              :{TINYFONT}PL
 STR_ABBREV_FIZZY_DRINKS                                         :{TINYFONT}SC
 STR_ABBREV_NONE                                                 :{TINYFONT}NU
-STR_ABBREV_ALL                                                  :{TINYFONT}TOATE
+STR_ABBREV_ALL                                                  :{TINYFONT}TOT
 STR_00AE                                                        :{WHITE}{DATE_SHORT}
 STR_00AF                                                        :{WHITE}{DATE_LONG}
 STR_00B0_MAP                                                    :{WHITE}Harta - {STRING}
@@ -154,8 +155,8 @@
 STR_00B2_MESSAGE                                                :{YELLOW}Mesaj
 STR_00B3_MESSAGE_FROM                                           :{YELLOW}Mesaj de la {STRING}
 STR_POPUP_CAUTION_CAPTION                                       :{WHITE}Atentie!
-STR_00B4_CAN_T_DO_THIS                                          :{WHITE}Nu pot face asta....
-STR_00B5_CAN_T_CLEAR_THIS_AREA                                  :{WHITE}Nu pot curăţa terenul....
+STR_00B4_CAN_T_DO_THIS                                          :{WHITE}Nu se poate face asta....
+STR_00B5_CAN_T_CLEAR_THIS_AREA                                  :{WHITE}Nu se poate curăţa terenul....
 STR_00B6_ORIGINAL_COPYRIGHT                                     :{BLACK}Copyright original {COPYRIGHT} 1995 Chris Sawyer, toate drepturile rezervate
 STR_00B7_VERSION                                                :{BLACK}OpenTTD versiunea {REV}
 STR_00BA_COPYRIGHT_OPENTTD                                      :{BLACK}OpenTTD {COPYRIGHT}2002-2008 Echipa OpenTTD
@@ -200,9 +201,9 @@
 STR_00E9_VEGETATION                                             :Vegetatie
 STR_00EA_OWNERS                                                 :Proprietari
 STR_00EB_ROADS                                                  :{BLACK}{TINYFONT}Drumuri
-STR_00EC_RAILROADS                                              :{BLACK}{TINYFONT}Cãi ferate
-STR_00ED_STATIONS_AIRPORTS_DOCKS                                :{BLACK}{TINYFONT}Statii/Aeroporturi/Porturi
-STR_00EE_BUILDINGS_INDUSTRIES                                   :{BLACK}{TINYFONT}Clãdiri/Industrii
+STR_00EC_RAILROADS                                              :{BLACK}{TINYFONT}Căi ferate
+STR_00ED_STATIONS_AIRPORTS_DOCKS                                :{BLACK}{TINYFONT}Staţii/Aeroporturi/Porturi
+STR_00EE_BUILDINGS_INDUSTRIES                                   :{BLACK}{TINYFONT}Clădiri/Industrii
 STR_00EF_VEHICLES                                               :{BLACK}{TINYFONT}Vehicule
 STR_00F0_100M                                                   :{BLACK}{TINYFONT}100m
 STR_00F1_200M                                                   :{BLACK}{TINYFONT}200m
@@ -214,59 +215,59 @@
 STR_00F7_SHIPS                                                  :{BLACK}{TINYFONT}Nave
 STR_00F8_AIRCRAFT                                               :{BLACK}{TINYFONT}Aeronave
 STR_00F9_TRANSPORT_ROUTES                                       :{BLACK}{TINYFONT}Rute de transport
-STR_00FA_COAL_MINE                                              :{BLACK}{TINYFONT}Minã de cãrbune
-STR_00FB_POWER_STATION                                          :{BLACK}{TINYFONT}Termocentralã
-STR_00FC_FOREST                                                 :{BLACK}{TINYFONT}Pãdure
-STR_00FD_SAWMILL                                                :{BLACK}{TINYFONT}Exploatatie forestierã
-STR_00FE_OIL_REFINERY                                           :{BLACK}{TINYFONT}Rafinãrie
-STR_00FF_FARM                                                   :{BLACK}{TINYFONT}Fermã
-STR_0100_FACTORY                                                :{BLACK}{TINYFONT}Fabricã de conserve
+STR_00FA_COAL_MINE                                              :{BLACK}{TINYFONT}Mină de cărbune
+STR_00FB_POWER_STATION                                          :{BLACK}{TINYFONT}Termocentrală
+STR_00FC_FOREST                                                 :{BLACK}{TINYFONT}Pădure
+STR_00FD_SAWMILL                                                :{BLACK}{TINYFONT}Fabrică de cherestea
+STR_00FE_OIL_REFINERY                                           :{BLACK}{TINYFONT}Rafinărie
+STR_00FF_FARM                                                   :{BLACK}{TINYFONT}Fermă
+STR_0100_FACTORY                                                :{BLACK}{TINYFONT}Fabrică de conserve
 STR_0101_PRINTING_WORKS                                         :{BLACK}{TINYFONT}Tipografie
 STR_0102_OIL_WELLS                                              :{BLACK}{TINYFONT}Sonde de petrol
-STR_0103_IRON_ORE_MINE                                          :{BLACK}{TINYFONT}Minã de fier
-STR_0104_STEEL_MILL                                             :{BLACK}{TINYFONT}Otelãrie
-STR_0105_BANK                                                   :{BLACK}{TINYFONT}Bancã
-STR_0106_PAPER_MILL                                             :{BLACK}{TINYFONT}Fabricã de hârtie
-STR_0107_GOLD_MINE                                              :{BLACK}{TINYFONT}Minã de aur
+STR_0103_IRON_ORE_MINE                                          :{BLACK}{TINYFONT}Mină de fier
+STR_0104_STEEL_MILL                                             :{BLACK}{TINYFONT}Oţelărie
+STR_0105_BANK                                                   :{BLACK}{TINYFONT}Bancă
+STR_0106_PAPER_MILL                                             :{BLACK}{TINYFONT}Fabrică de hârtie
+STR_0107_GOLD_MINE                                              :{BLACK}{TINYFONT}Mină de aur
 STR_0108_FOOD_PROCESSING_PLANT                                  :{BLACK}{TINYFONT}Combinat alimentar
-STR_0109_DIAMOND_MINE                                           :{BLACK}{TINYFONT}Minã de diamante
-STR_010A_COPPER_ORE_MINE                                        :{BLACK}{TINYFONT}Minã de cupru
-STR_010B_FRUIT_PLANTATION                                       :{BLACK}{TINYFONT}Livadã
-STR_010C_RUBBER_PLANTATION                                      :{BLACK}{TINYFONT}Plantatie de cauciuc
-STR_010D_WATER_SUPPLY                                           :{BLACK}{TINYFONT}Rezervor de apã
-STR_010E_WATER_TOWER                                            :{BLACK}{TINYFONT}Turn de apã
-STR_010F_LUMBER_MILL                                            :{BLACK}{TINYFONT}Fabricã de cherestea
-STR_0110_COTTON_CANDY_FOREST                                    :{BLACK}{TINYFONT}Pãdure de vatã de zahãr
-STR_0111_CANDY_FACTORY                                          :{BLACK}{TINYFONT}Fabricã de bomboane
-STR_0112_BATTERY_FARM                                           :{BLACK}{TINYFONT}Fermã de baterii
+STR_0109_DIAMOND_MINE                                           :{BLACK}{TINYFONT}Mină de diamante
+STR_010A_COPPER_ORE_MINE                                        :{BLACK}{TINYFONT}Mină de cupru
+STR_010B_FRUIT_PLANTATION                                       :{BLACK}{TINYFONT}Livadă
+STR_010C_RUBBER_PLANTATION                                      :{BLACK}{TINYFONT}Plantaţie de cauciuc
+STR_010D_WATER_SUPPLY                                           :{BLACK}{TINYFONT}Rezervor de apă
+STR_010E_WATER_TOWER                                            :{BLACK}{TINYFONT}Turn de apă
+STR_010F_LUMBER_MILL                                            :{BLACK}{TINYFONT}Fabrică de cherestea
+STR_0110_COTTON_CANDY_FOREST                                    :{BLACK}{TINYFONT}Pădure de vată de zahăr
+STR_0111_CANDY_FACTORY                                          :{BLACK}{TINYFONT}Fabrică de bomboane
+STR_0112_BATTERY_FARM                                           :{BLACK}{TINYFONT}Fermă de baterii
 STR_0113_COLA_WELLS                                             :{BLACK}{TINYFONT}Fântâni de cola
-STR_0114_TOY_SHOP                                               :{BLACK}{TINYFONT}Magazin de jucãrii
-STR_0115_TOY_FACTORY                                            :{BLACK}{TINYFONT}Fabricã de jucãrii
+STR_0114_TOY_SHOP                                               :{BLACK}{TINYFONT}Magazin de jucării
+STR_0115_TOY_FACTORY                                            :{BLACK}{TINYFONT}Fabrică de jucării
 STR_0116_PLASTIC_FOUNTAINS                                      :{BLACK}{TINYFONT}Fântâni de plastic
-STR_0117_FIZZY_DRINK_FACTORY                                    :{BLACK}{TINYFONT}Fabricã de sucuri
-STR_0118_BUBBLE_GENERATOR                                       :{BLACK}{TINYFONT}Generator de balonase
-STR_0119_TOFFEE_QUARRY                                          :{BLACK}{TINYFONT}Carierã de caramel
-STR_011A_SUGAR_MINE                                             :{BLACK}{TINYFONT}Minã de zahãr
-STR_011B_RAILROAD_STATION                                       :{BLACK}{TINYFONT}Garã
-STR_011C_TRUCK_LOADING_BAY                                      :{BLACK}{TINYFONT}Loc încãrcare camioane
-STR_011D_BUS_STATION                                            :{BLACK}{TINYFONT}Statie de autobuz
+STR_0117_FIZZY_DRINK_FACTORY                                    :{BLACK}{TINYFONT}Fabrică de sucuri
+STR_0118_BUBBLE_GENERATOR                                       :{BLACK}{TINYFONT}Generator de balonaşe
+STR_0119_TOFFEE_QUARRY                                          :{BLACK}{TINYFONT}Carieră de caramel
+STR_011A_SUGAR_MINE                                             :{BLACK}{TINYFONT}Mină de zahăr
+STR_011B_RAILROAD_STATION                                       :{BLACK}{TINYFONT}Gară
+STR_011C_TRUCK_LOADING_BAY                                      :{BLACK}{TINYFONT}Loc încărcare camioane
+STR_011D_BUS_STATION                                            :{BLACK}{TINYFONT}Staţie de autobuz
 STR_011E_AIRPORT_HELIPORT                                       :{BLACK}{TINYFONT}Aeroport/Heliport
 STR_011F_DOCK                                                   :{BLACK}{TINYFONT}Port
 STR_0120_ROUGH_LAND                                             :{BLACK}{TINYFONT}Teren pietros
-STR_0121_GRASS_LAND                                             :{BLACK}{TINYFONT}Pajiste
+STR_0121_GRASS_LAND                                             :{BLACK}{TINYFONT}Pajişte
 STR_0122_BARE_LAND                                              :{BLACK}{TINYFONT}Teren viran
 STR_0123_FIELDS                                                 :{BLACK}{TINYFONT}Teren agricol
 STR_0124_TREES                                                  :{BLACK}{TINYFONT}Copaci
 STR_0125_ROCKS                                                  :{BLACK}{TINYFONT}Pietre
-STR_0126_WATER                                                  :{BLACK}{TINYFONT}Apã
-STR_0127_NO_OWNER                                               :{BLACK}{TINYFONT}Fãrã proprietar
-STR_0128_TOWNS                                                  :{BLACK}{TINYFONT}Orase
+STR_0126_WATER                                                  :{BLACK}{TINYFONT}Apă
+STR_0127_NO_OWNER                                               :{BLACK}{TINYFONT}Fără proprietar
+STR_0128_TOWNS                                                  :{BLACK}{TINYFONT}Oraşe
 STR_0129_INDUSTRIES                                             :{BLACK}{TINYFONT}Industrii
-STR_012A_DESERT                                                 :{BLACK}{TINYFONT}Desert
-STR_012B_SNOW                                                   :{BLACK}{TINYFONT}Zãpadã
+STR_012A_DESERT                                                 :{BLACK}{TINYFONT}Deşert
+STR_012B_SNOW                                                   :{BLACK}{TINYFONT}Zăpadă
 STR_012C_MESSAGE                                                :{WHITE}Mesaj
 STR_012D                                                        :{WHITE}{STRING}
-STR_012E_CANCEL                                                 :{BLACK}Anuleazã
+STR_012E_CANCEL                                                 :{BLACK}Anulează
 STR_012F_OK                                                     :{BLACK}OK
 STR_0130_RENAME                                                 :{BLACK}Redenumeste
 STR_0131_TOO_MANY_NAMES_DEFINED                                 :{WHITE}Prea multe nume definite
@@ -282,9 +283,9 @@
 STR_OSNAME_SUNOS                                                :SunOS
 
 STR_013B_OWNED_BY                                               :{WHITE}...apartine companiei {STRING}
-STR_013C_CARGO                                                  :{BLACK}Încãrcãturã
+STR_013C_CARGO                                                  :{BLACK}Încărcătură
 STR_013D_INFORMATION                                            :{BLACK}Informatii
-STR_013E_CAPACITIES                                             :{BLACK}Capacitãti
+STR_013E_CAPACITIES                                             :{BLACK}Capacităţi
 STR_TOTAL_CARGO                                                 :{BLACK}Încãrcãturi
 STR_013F_CAPACITY                                               :{BLACK}Capacitate: {LTBLUE}{CARGO}
 STR_CAPACITY_MULT                                               :{BLACK}Capacitate: {LTBLUE}{CARGO} (x{NUM})
@@ -292,7 +293,7 @@
 STR_TOTAL_CAPACITY                                              :{LTBLUE}- {CARGO} ({SHORTCARGO})
 STR_TOTAL_CAPACITY_MULT                                         :{LTBLUE}- {CARGO} ({SHORTCARGO}) (x{NUM})
 STR_0140_NEW_GAME                                               :{BLACK}Joc nou
-STR_0141_LOAD_GAME                                              :{BLACK}Încarcã joc
+STR_0141_LOAD_GAME                                              :{BLACK}Încarcă joc
 STR_SINGLE_PLAYER                                               :{BLACK}Un singur jucãtor
 STR_MULTIPLAYER                                                 :{BLACK}Multiplayer
 STR_SCENARIO_EDITOR                                             :{BLACK}Editor harta
@@ -322,8 +323,8 @@
 STR_UNITS_WEIGHT_SHORT_METRIC                                   :{COMMA}t
 STR_UNITS_WEIGHT_SHORT_SI                                       :{COMMA}kg
 
-STR_UNITS_WEIGHT_LONG_IMPERIAL                                  :{COMMA} tone imperiale{P "" s}
-STR_UNITS_WEIGHT_LONG_METRIC                                    :{COMMA} tone{P "" s}
+STR_UNITS_WEIGHT_LONG_IMPERIAL                                  :{COMMA} ton{P ă e}
+STR_UNITS_WEIGHT_LONG_METRIC                                    :{COMMA} ton{P ă e}
 STR_UNITS_WEIGHT_LONG_SI                                        :{COMMA} kg
 
 STR_UNITS_VOLUME_SHORT_IMPERIAL                                 :{COMMA}gal
@@ -341,29 +342,29 @@
 ############ range for menu starts
 STR_0154_OPERATING_PROFIT_GRAPH                                 :Profitul operational
 STR_0155_INCOME_GRAPH                                           :Venituri
-STR_0156_DELIVERED_CARGO_GRAPH                                  :Numãr încãrcãturi livrate
+STR_0156_DELIVERED_CARGO_GRAPH                                  :Număr încărcături livrate
 STR_0157_PERFORMANCE_HISTORY_GRAPH                              :Evolutia performantei
 STR_0158_COMPANY_VALUE_GRAPH                                    :Valoarea companiei
-STR_0159_CARGO_PAYMENT_RATES                                    :Valorile plãtilor pe încãrcãturi
+STR_0159_CARGO_PAYMENT_RATES                                    :Valorile plăţilor pe încărcături
 STR_015A_COMPANY_LEAGUE_TABLE                                   :Clasamentul companiilor
 STR_PERFORMANCE_DETAIL_MENU                                     :Rating de performantã detaliat
 ############ range for menu ends
 
 STR_015B_OPENTTD                                                :{WHITE}Despre OpenTTD
-STR_015C_SAVE_GAME                                              :Salveazã jocul (F3)
-STR_015D_LOAD_GAME                                              :Încarcã joc
+STR_015C_SAVE_GAME                                              :Salvează jocul (F3)
+STR_015D_LOAD_GAME                                              :Încarcă joc
 STR_015E_QUIT_GAME                                              :Iesire în meniul principal
 STR_015F_QUIT                                                   :Iesire din joc
-STR_ABANDON_GAME_QUERY                                          :{YELLOW}Esti sigur cã vrei sã renunti la acest joc?
+STR_ABANDON_GAME_QUERY                                          :{YELLOW}Eşti sigur că vrei să renunţi la acest joc?
 STR_0161_QUIT_GAME                                              :{WHITE}Iesire din joc
 STR_SORT_ORDER_TIP                                              :{BLACK}Alegeti ordinea de sortare ascendenta/descendenta
-STR_SORT_CRITERIA_TIP                                           :{BLACK}Alegeti criteriul de sortare
+STR_SORT_CRITERIA_TIP                                           :{BLACK}Alege criteriul de sortare
 STR_SORT_BY                                                     :{BLACK}Ordoneaza dupa
 
 STR_SORT_BY_POPULATION                                          :{BLACK}Populatia
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Productie
-STR_SORT_BY_TYPE                                                :{BLACK}Tip
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Transportat
+STR_SORT_BY_PRODUCTION                                          :Productie
+STR_SORT_BY_TYPE                                                :Tip
+STR_SORT_BY_TRANSPORTED                                         :Transportat
 STR_SORT_BY_NAME                                                :{BLACK}Nume
 STR_SORT_BY_DROPDOWN_NAME                                       :Nume
 STR_SORT_BY_DATE                                                :{BLACK}Datã
@@ -371,11 +372,12 @@
 STR_SORT_BY_PROFIT_LAST_YEAR                                    :Profit anul trecut
 STR_SORT_BY_PROFIT_THIS_YEAR                                    :Profit anul acesta
 STR_SORT_BY_AGE                                                 :Vechime
-STR_SORT_BY_RELIABILITY                                         :Eficienta
+STR_SORT_BY_RELIABILITY                                         :Eficienţă
 STR_SORT_BY_TOTAL_CAPACITY_PER_CARGOTYPE                        :Capacitatea totala in functie de incarcatura
 STR_SORT_BY_MAX_SPEED                                           :Viteza maxima
 STR_SORT_BY_MODEL                                               :Model
 STR_SORT_BY_VALUE                                               :Valoare
+STR_SORT_BY_LENGTH                                              :Lungime
 STR_SORT_BY_FACILITY                                            :Tipul de statie
 STR_SORT_BY_WAITING                                             :In asteptarea valorii  încãrcãturii
 STR_SORT_BY_RATING_MAX                                          :Evaluare încãrcãturã
@@ -386,8 +388,8 @@
 STR_ENGINE_SORT_RUNNING_COST                                    :Cost exploatare
 STR_ENGINE_SORT_POWER_VS_RUNNING_COST                           :Cost exploatare/putere
 STR_ENGINE_SORT_CARGO_CAPACITY                                  :Capacitate incarcatura
-STR_NO_WAITING_CARGO                                            :{BLACK}Nu este în asteptare nici un fel de încãrcãturã
-STR_SELECT_ALL_FACILITIES                                       :{BLACK}Alege toate facilitãtile
+STR_NO_WAITING_CARGO                                            :{BLACK}Nu este nici un fel de încărcătură în aşteptare
+STR_SELECT_ALL_FACILITIES                                       :{BLACK}Alege toate facilităţile
 STR_SELECT_ALL_TYPES                                            :{BLACK}Alege toate tipurile de încãrcãturi (inclusiv încãrcãturile care nu sunt în asteptare)
 STR_AVAILABLE_TRAINS                                            :{BLACK}Trenuri disponibile
 STR_AVAILABLE_ROAD_VEHICLES                                     :{BLACK}Vehicule disponibile
@@ -421,49 +423,49 @@
 STR_016E                                                        :{TINYFONT}{STRING}{} {STRING}
 STR_016F                                                        :{TINYFONT}{STRING}{} {STRING}{}{NUM}
 STR_0170                                                        :{TINYFONT}{STRING}-
-STR_0171_PAUSE_GAME                                             :{BLACK}Pauzã joc (F1)
+STR_0171_PAUSE_GAME                                             :{BLACK}Pauză joc (F1)
 STR_0172_SAVE_GAME_ABANDON_GAME                                 :{BLACK}Salvare/abandon/iesire joc
-STR_0173_DISPLAY_LIST_OF_COMPANY                                :{BLACK}Afiseazã lista cu statiile companiei
-STR_0174_DISPLAY_MAP                                            :{BLACK}Afiseazã harta (F4)
-STR_0175_DISPLAY_MAP_TOWN_DIRECTORY                             :{BLACK}Afiseazã harta, lista cu orase
-STR_0176_DISPLAY_TOWN_DIRECTORY                                 :{BLACK}Afiseazã lista cu orasele de pe hartã (F5)
-STR_0177_DISPLAY_COMPANY_FINANCES                               :{BLACK}Afiseazã informatiile financiare ale companiei
-STR_0178_DISPLAY_COMPANY_GENERAL                                :{BLACK}Afiseazã datele generale despre companie
-STR_0179_DISPLAY_GRAPHS                                         :{BLACK}Afiseazã graficele
-STR_017A_DISPLAY_COMPANY_LEAGUE                                 :{BLACK}Afiseazã clasamentul companiilor
-STR_017B_DISPLAY_LIST_OF_COMPANY                                :{BLACK}Afiseazã lista cu trenurile companiei
-STR_017C_DISPLAY_LIST_OF_COMPANY                                :{BLACK}Afiseazã lista cu autovehiculele companiei
-STR_017D_DISPLAY_LIST_OF_COMPANY                                :{BLACK}Afiseazã lista cu navele companiei
-STR_017E_DISPLAY_LIST_OF_COMPANY                                :{BLACK}Afiseazã lista cu aeronavele companiei
-STR_017F_ZOOM_THE_VIEW_IN                                       :{BLACK}Mãreste imaginea
-STR_0180_ZOOM_THE_VIEW_OUT                                      :{BLACK}Micsoreazã imaginea
-STR_0181_BUILD_RAILROAD_TRACK                                   :{BLACK}Construieste cãi ferate
+STR_0173_DISPLAY_LIST_OF_COMPANY                                :{BLACK}Afişează lista cu staţiile companiei
+STR_0174_DISPLAY_MAP                                            :{BLACK}Afişează harta (F4)
+STR_0175_DISPLAY_MAP_TOWN_DIRECTORY                             :{BLACK}Afişează harta, lista cu oraşe
+STR_0176_DISPLAY_TOWN_DIRECTORY                                 :{BLACK}Afişează lista cu oraşele de pe hartă (F5)
+STR_0177_DISPLAY_COMPANY_FINANCES                               :{BLACK}Afişează informaţii financiare ale companiei
+STR_0178_DISPLAY_COMPANY_GENERAL                                :{BLACK}Afişează date generale despre companie
+STR_0179_DISPLAY_GRAPHS                                         :{BLACK}Afişează grafice
+STR_017A_DISPLAY_COMPANY_LEAGUE                                 :{BLACK}Afişează clasamentul companiilor
+STR_017B_DISPLAY_LIST_OF_COMPANY                                :{BLACK}Afişează lista cu trenurile companiei
+STR_017C_DISPLAY_LIST_OF_COMPANY                                :{BLACK}Afişează lista cu autovehiculele companiei
+STR_017D_DISPLAY_LIST_OF_COMPANY                                :{BLACK}Afişează lista cu navele companiei
+STR_017E_DISPLAY_LIST_OF_COMPANY                                :{BLACK}Afişează lista cu aeronavele companiei
+STR_017F_ZOOM_THE_VIEW_IN                                       :{BLACK}Măreşte imaginea
+STR_0180_ZOOM_THE_VIEW_OUT                                      :{BLACK}Micşorează imaginea
+STR_0181_BUILD_RAILROAD_TRACK                                   :{BLACK}Construieşte căi ferate
 STR_0182_BUILD_ROADS                                            :{BLACK}Construieste drumuri
 STR_0183_BUILD_SHIP_DOCKS                                       :{BLACK}Construieste porturi
 STR_0184_BUILD_AIRPORTS                                         :{BLACK}Construieste aeroporturi
-STR_0185_PLANT_TREES_PLACE_SIGNS                                :{BLACK}Planteazã arbori, plaseazã semne, etc.
+STR_0185_PLANT_TREES_PLACE_SIGNS                                :{BLACK}Plantează arbori, plasează semne, etc.
 STR_0186_LAND_BLOCK_INFORMATION                                 :{BLACK}Informatii despre teren
 STR_0187_OPTIONS                                                :{BLACK}Optiuni
 STR_0188                                                        :{BLACK}{SMALLUPARROW}
 STR_0189                                                        :{BLACK}{SMALLDOWNARROW}
-STR_018A_CAN_T_CHANGE_SERVICING                                 :{WHITE}Nu pot schimba intervalul de întreţinere...
+STR_018A_CAN_T_CHANGE_SERVICING                                 :{WHITE}Nu se poate schimba intervalul de întreţinere...
 STR_018B_CLOSE_WINDOW                                           :{BLACK}Închide fereastra
 STR_018C_WINDOW_TITLE_DRAG_THIS                                 :{BLACK}Titlul ferestrei - trage de aici pentru a muta fereastra
 STR_STICKY_BUTTON                                               :{BLACK}Mark this window as undeletable for the 'Close All Windows' key
 STR_RESIZE_BUTTON                                               :{BLACK}Apasa si trage pentru redimensionarea ferestrei
 STR_SAVELOAD_HOME_BUTTON                                        :{BLACK}Click aici pentru a ajunge la directorul predefinit pentru salvari
-STR_018D_DEMOLISH_BUILDINGS_ETC                                 :{BLACK}Demoleazã clãdiri, strãzi, etc. pe un pãtrat de teren
+STR_018D_DEMOLISH_BUILDINGS_ETC                                 :{BLACK}Demolează clădiri, străzi, etc. pe un pătrăţel de teren
 STR_018E_LOWER_A_CORNER_OF_LAND                                 :{BLACK}Scade altitudinea unui vârf de teren
-STR_018F_RAISE_A_CORNER_OF_LAND                                 :{BLACK}Mãreste altitudinea unui vârf de teren
-STR_0190_SCROLL_BAR_SCROLLS_LIST                                :{BLACK}Bara de defilare - defileazã în listã sus/jos
+STR_018F_RAISE_A_CORNER_OF_LAND                                 :{BLACK}Măreşte altitudinea unui punct de teren
+STR_0190_SCROLL_BAR_SCROLLS_LIST                                :{BLACK}Bara de defilare - defilează în listă sus/jos
 STR_HSCROLL_BAR_SCROLLS_LIST                                    :{BLACK}Bara de defilare - stanga/dreapta
-STR_0191_SHOW_LAND_CONTOURS_ON_MAP                              :{BLACK}Aratã relieful pe hartã
-STR_0192_SHOW_VEHICLES_ON_MAP                                   :{BLACK}Aratã vehiculele pe hartã
-STR_0193_SHOW_INDUSTRIES_ON_MAP                                 :{BLACK}Aratã industriile pe hartã
-STR_0194_SHOW_TRANSPORT_ROUTES_ON                               :{BLACK}Aratã rutele de transport pe hartã
-STR_0195_SHOW_VEGETATION_ON_MAP                                 :{BLACK}Aratã vegetatia pe hartã
-STR_0196_SHOW_LAND_OWNERS_ON_MAP                                :{BLACK}Aratã proprietãtile pe hartã
-STR_0197_TOGGLE_TOWN_NAMES_ON_OFF                               :{BLACK}Activeazã/Dezactivează afişarea numelor oraşelor pe hartă
+STR_0191_SHOW_LAND_CONTOURS_ON_MAP                              :{BLACK}Arată relieful pe hartă
+STR_0192_SHOW_VEHICLES_ON_MAP                                   :{BLACK}Arată vehiculele pe hartă
+STR_0193_SHOW_INDUSTRIES_ON_MAP                                 :{BLACK}Arată industriile pe hartă
+STR_0194_SHOW_TRANSPORT_ROUTES_ON                               :{BLACK}Arată rutele de transport pe hartă
+STR_0195_SHOW_VEGETATION_ON_MAP                                 :{BLACK}Arată vegetaţia pe hartă
+STR_0196_SHOW_LAND_OWNERS_ON_MAP                                :{BLACK}Arată proprietarii de teren pe hartă
+STR_0197_TOGGLE_TOWN_NAMES_ON_OFF                               :{BLACK}Afişează/Ascunde numele oraşelor pe hartă
 STR_0198_PROFIT_THIS_YEAR_LAST_YEAR                             :{TINYFONT}{BLACK}Profit anul acesta: {CURRENCY} (anul trecut: {CURRENCY})
 
 ############ range for service numbers starts
@@ -479,11 +481,14 @@
 STR_01A1_IS_GETTING_VERY_OLD                                    :{WHITE}{STRING} {COMMA} este foarte vechi
 STR_01A2_IS_GETTING_VERY_OLD_AND                                :{WHITE}{STRING} {COMMA} este foarte vechi si trebuie înlocuit urgent
 STR_01A3_LAND_AREA_INFORMATION                                  :{WHITE}Informatii teren
-STR_01A4_COST_TO_CLEAR_N_A                                      :{BLACK}Costul demolãrii: {LTBLUE}nu este cazul
-STR_01A5_COST_TO_CLEAR                                          :{BLACK}Costul demolãrii: {LTBLUE}{CURRENCY}
+STR_01A4_COST_TO_CLEAR_N_A                                      :{BLACK}Costul demolării: {LTBLUE}nu este cazul
+STR_01A5_COST_TO_CLEAR                                          :{BLACK}Costul demolării: {LTBLUE}{CURRENCY}
 STR_01A6_N_A                                                    :nu este cazul
 STR_01A7_OWNER                                                  :{BLACK}Proprietar: {LTBLUE}{STRING}
-STR_01A8_LOCAL_AUTHORITY                                        :{BLACK}Autoritatea localã: {LTBLUE}{STRING}
+STR_ROAD_OWNER                                                  :{BLACK}Proprietar al drumului: {LTBLUE}{STRING}
+STR_TRAM_OWNER                                                  :{BLACK}Proprietar al şinei de tramvai: {LTBLUE}{STRING}
+STR_RAIL_OWNER                                                  :{BLACK}Proprietar al căii ferate: {LTBLUE}{STRING}
+STR_01A8_LOCAL_AUTHORITY                                        :{BLACK}Autoritatea locală: {LTBLUE}{STRING}
 STR_01A9_NONE                                                   :nici una
 STR_01AA_NAME                                                   :{BLACK}Nume
 STR_01AB                                                        :{BLACK}{TINYFONT}{VEHICLE}
@@ -524,13 +529,13 @@
 
 STR_01CB                                                        :{TINYFONT}{COMMA}
 
-STR_01CE_CARGO_ACCEPTED                                         :{BLACK}Încãrcãturi acceptate: {LTBLUE}
+STR_01CE_CARGO_ACCEPTED                                         :{BLACK}Încărcături acceptate: {LTBLUE}
 
 STR_01D1_8                                                      :({COMMA}/8 {STRING})
 STR_01D2_JAZZ_JUKEBOX                                           :{WHITE}Tonomatul cu jazz
-STR_01D3_SOUND_MUSIC                                            :Sunet/muzicã
-STR_01D4_SHOW_SOUND_MUSIC_WINDOW                                :{BLACK}Afiseazã fereastra pentru configurarea sunetului/muzicii
-STR_01D5_ALL                                                    :{TINYFONT}Toate
+STR_01D3_SOUND_MUSIC                                            :Sunet/muzică
+STR_01D4_SHOW_SOUND_MUSIC_WINDOW                                :{BLACK}Afişează fereastra pentru configurarea sunetului/muzicii
+STR_01D5_ALL                                                    :{TINYFONT}Tot
 STR_01D6_OLD_STYLE                                              :{TINYFONT}Oldies
 STR_01D7_NEW_STYLE                                              :{TINYFONT}Moderne
 STR_01D8_EZY_STREET                                             :{TINYFONT}Ezy Street
@@ -539,8 +544,8 @@
 STR_01DB_MUSIC_VOLUME                                           :{BLACK}{TINYFONT}Volumul muzicii
 STR_01DC_EFFECTS_VOLUME                                         :{BLACK}{TINYFONT}Volumul efectelor sonore
 STR_01DD_MIN_MAX                                                :{BLACK}{TINYFONT}MIN  '  '  '  '  '  '  MAX
-STR_01DE_SKIP_TO_PREVIOUS_TRACK                                 :{BLACK}Sãri la piesa precedentã din selectie
-STR_01DF_SKIP_TO_NEXT_TRACK_IN_SELECTION                        :{BLACK}Sãri la piesa urmãtoare din selectie
+STR_01DE_SKIP_TO_PREVIOUS_TRACK                                 :{BLACK}Sări la piesa precedentă din selecţie
+STR_01DF_SKIP_TO_NEXT_TRACK_IN_SELECTION                        :{BLACK}Sări la piesa următoare din selecţie
 STR_01E0_STOP_PLAYING_MUSIC                                     :{BLACK}Opreste muzica
 STR_01E1_START_PLAYING_MUSIC                                    :{BLACK}Porneste muzica
 STR_01E2_DRAG_SLIDERS_TO_SET_MUSIC                              :{BLACK}Foloseste aceste indicatoare pentru a regla volumul muzicii si al efectelor sonore
@@ -550,24 +555,24 @@
 STR_01E6                                                        :{DKGREEN}{TINYFONT}------
 STR_01E7                                                        :{DKGREEN}{TINYFONT}"{STRING}"
 STR_01E8_TRACK_XTITLE                                           :{BLACK}{TINYFONT}Piesa nr: {SETX 88}Titlul
-STR_01E9_SHUFFLE                                                :{TINYFONT}Amestecã
+STR_01E9_SHUFFLE                                                :{TINYFONT}Aleator
 STR_01EA_PROGRAM                                                :{TINYFONT}{BLACK}Program
 STR_01EB_MUSIC_PROGRAM_SELECTION                                :{WHITE}Programare piese muzicale
 STR_01EC_0                                                      :{TINYFONT}{LTBLUE}0{COMMA} "{STRING}"
 STR_01ED                                                        :{TINYFONT}{LTBLUE}{COMMA} "{STRING}"
 STR_01EE_TRACK_INDEX                                            :{TINYFONT}{BLACK}Lista melodiilor
 STR_01EF_PROGRAM                                                :{TINYFONT}{BLACK}Program - '{STRING}'
-STR_01F0_CLEAR                                                  :{TINYFONT}{BLACK}Sterge
-STR_01F1_SAVE                                                   :{TINYFONT}{BLACK}Salveazã
+STR_01F0_CLEAR                                                  :{TINYFONT}{BLACK}Şterge
+STR_01F1_SAVE                                                   :{TINYFONT}{BLACK}Salvează
 STR_01F2_CURRENT_PROGRAM_OF_MUSIC                               :{BLACK}Programul current al pieselor muzicale
-STR_01F3_SELECT_ALL_TRACKS_PROGRAM                              :{BLACK}Selecteazã programul 'toate melodiile'
-STR_01F4_SELECT_OLD_STYLE_MUSIC                                 :{BLACK}Selecteazã programul 'oldies'
-STR_01F5_SELECT_NEW_STYLE_MUSIC                                 :{BLACK}Selecteazã programul 'modern'
-STR_01F6_SELECT_CUSTOM_1_USER_DEFINED                           :{BLACK}Selecteazã programul personal 1
-STR_01F7_SELECT_CUSTOM_2_USER_DEFINED                           :{BLACK}Selecteazã programul personal 2
-STR_01F8_CLEAR_CURRENT_PROGRAM_CUSTOM1                          :{BLACK}Sterge programul curent (doar pentru cele personale)
+STR_01F3_SELECT_ALL_TRACKS_PROGRAM                              :{BLACK}Selectează programul 'toate melodiile'
+STR_01F4_SELECT_OLD_STYLE_MUSIC                                 :{BLACK}Selectează programul 'oldies'
+STR_01F5_SELECT_NEW_STYLE_MUSIC                                 :{BLACK}Selectează programul 'modern'
+STR_01F6_SELECT_CUSTOM_1_USER_DEFINED                           :{BLACK}Selectează programul personal 1
+STR_01F7_SELECT_CUSTOM_2_USER_DEFINED                           :{BLACK}Selectează programul personal 2
+STR_01F8_CLEAR_CURRENT_PROGRAM_CUSTOM1                          :{BLACK}Şterge programul curent (doar pentru cele personale)
 STR_01F9_SAVE_MUSIC_SETTINGS                                    :{BLACK}Salveaza setarile pentru muzica
-STR_01FA_CLICK_ON_MUSIC_TRACK_TO                                :{BLACK}Click pe o melodie pentru a o adãuga in programul personal curent
+STR_01FA_CLICK_ON_MUSIC_TRACK_TO                                :{BLACK}Clic pe o melodie pentru a o adăuga în programul personal curent
 STR_CLICK_ON_TRACK_TO_REMOVE                                    :{BLACK}Apasa pe pista audio pentru a o elimina din programul actual (doar Custom1 sau Custom2)
 STR_01FB_TOGGLE_PROGRAM_SHUFFLE                                 :{BLACK}Comutator pentru amestecarea melodiilor (da/nu)
 STR_01FC_SHOW_MUSIC_TRACK_SELECTION                             :{BLACK}Afiseaza fereastra pentru selectia melodiilor
@@ -575,7 +580,7 @@
 STR_01FE_DIFFICULTY                                             :{BLACK}Nivel dificultate ({STRING})
 STR_01FF                                                        :{TINYFONT}{BLACK}{DATE_LONG}
 STR_0200_LAST_MESSAGE_NEWS_REPORT                               :Ultimul mesaj/ultima stire
-STR_0201_MESSAGE_SETTINGS                                       :Setãri mesaje
+STR_0201_MESSAGE_SETTINGS                                       :Setări mesaje
 STR_MESSAGE_HISTORY_MENU                                        :Lista ultimelor mesaje
 STR_0203_SHOW_LAST_MESSAGE_NEWS                                 :{BLACK}Afiseaza ultimul mesaj (ultima stire) si optiunile pentru mesaje
 STR_0204_MESSAGE_OPTIONS                                        :{WHITE}Optiuni mesaje
@@ -585,23 +590,23 @@
 STR_0208_ACCIDENTS_DISASTERS                                    :{YELLOW}Accidente/dezastre
 STR_0209_COMPANY_INFORMATION                                    :{YELLOW}Informatii despre companie
 STR_NEWS_OPEN_CLOSE                                             :{YELLOW}Deschidere / inchidere industrii
-STR_020A_ECONOMY_CHANGES                                        :{YELLOW}Schimbãri economice
+STR_020A_ECONOMY_CHANGES                                        :{YELLOW}Schimbări economice
 STR_INDUSTRY_CHANGES_SERVED_BY_PLAYER                           :{YELLOW}Schimbări de producţie la industrii partenere cu jucătorul
 STR_INDUSTRY_CHANGES_SERVED_BY_OTHER                            :{YELLOW}Schimbări de producţie la industrii partenere cu concurenţa
-STR_OTHER_INDUSTRY_PRODUCTION_CHANGES                           :{YELLOW}Alte schimbari in productia industriala
+STR_OTHER_INDUSTRY_PRODUCTION_CHANGES                           :{YELLOW}Alte schimbări în producţia industrială
 STR_020B_ADVICE_INFORMATION_ON_PLAYER                           :{YELLOW}Sfaturi/informatii despre vehiculele tale
 STR_020C_NEW_VEHICLES                                           :{YELLOW}Vehicule noi
-STR_020D_CHANGES_OF_CARGO_ACCEPTANCE                            :{YELLOW}Schimbãri ale acceptãrii mãrfurilor
+STR_020D_CHANGES_OF_CARGO_ACCEPTANCE                            :{YELLOW}Schimbări ale acceptării mărfurilor
 STR_020E_SUBSIDIES                                              :{YELLOW}Subventii
 STR_020F_GENERAL_INFORMATION                                    :{YELLOW}Informatii generale
 STR_MESSAGES_ALL                                                :{YELLOW}Setare pentru tipurile de mesaje (da/nu/rezumat)
 STR_MESSAGE_SOUND                                               :{YELLOW}Sunet pentru mesajele-stiri
-STR_0210_TOO_FAR_FROM_PREVIOUS_DESTINATIO                       :{WHITE}...prea departe de destinatia precedentã
+STR_0210_TOO_FAR_FROM_PREVIOUS_DESTINATIO                       :{WHITE}...prea departe de destinaţia precedentă
 STR_0211_TOP_COMPANIES_WHO_REACHED                              :{BIGFONT}{BLACK}Primele companii care au atins {NUM}{}(Nivelul {STRING})
 STR_TOP_COMPANIES_NETWORK_GAME                                  :{BIGFONT}{BLACK}Clasamentul companiilor in {NUM}
 STR_0212                                                        :{BIGFONT}{COMMA}.
 STR_0213_BUSINESSMAN                                            :Om de afaceri
-STR_0214_ENTREPRENEUR                                           :Întreprinzãtor
+STR_0214_ENTREPRENEUR                                           :Întreprinzător
 STR_0215_INDUSTRIALIST                                          :Industrias
 STR_0216_CAPITALIST                                             :Capitalist
 STR_0217_MAGNATE                                                :Magnat
@@ -614,13 +619,13 @@
 STR_021F                                                        :{BLUE}{COMMA}
 STR_0221_OPENTTD                                                :{YELLOW}OpenTTD
 STR_0222_SCENARIO_EDITOR                                        :{YELLOW}Editor de scenarii
-STR_0223_LAND_GENERATION                                        :{WHITE}Generator suprafatã uscat
+STR_0223_LAND_GENERATION                                        :{WHITE}Generator suprafaţă uscat
 STR_0224                                                        :{BLACK}{UPARROW}
 STR_0225                                                        :{BLACK}{DOWNARROW}
-STR_0228_INCREASE_SIZE_OF_LAND_AREA                             :{BLACK}Mãreste aria de editare a terenului
-STR_0229_DECREASE_SIZE_OF_LAND_AREA                             :{BLACK}Micsoreazã aria de editare a terenului
-STR_022A_GENERATE_RANDOM_LAND                                   :{BLACK}Genereazã teren aleator
-STR_022B_RESET_LANDSCAPE                                        :{BLACK}Reseteazã peisajul
+STR_0228_INCREASE_SIZE_OF_LAND_AREA                             :{BLACK}Măreşte aria de editare a terenului
+STR_0229_DECREASE_SIZE_OF_LAND_AREA                             :{BLACK}Micşorează aria de editare a terenului
+STR_022A_GENERATE_RANDOM_LAND                                   :{BLACK}Generează teren aleator
+STR_022B_RESET_LANDSCAPE                                        :{BLACK}Resetează peisajul
 STR_022C_RESET_LANDSCAPE                                        :{WHITE}Resetare peisaj
 STR_RESET_LANDSCAPE_TOOLTIP                                     :{BLACK}Elimina de pe harta toate proprietatile detinute de jucatori
 STR_RESET_LANDSCAPE_CONFIRMATION_TEXT                           :{WHITE}Esti sigur ca vrei sa elimini toate proprietatile detinute de jucatori?
@@ -631,13 +636,13 @@
 STR_0233_TOWN_GENERATION                                        :{WHITE}Generare oras
 STR_0234_NEW_TOWN                                               :{BLACK}Oras nou
 STR_0235_CONSTRUCT_NEW_TOWN                                     :{BLACK}Construieste un oras nou
-STR_0236_CAN_T_BUILD_TOWN_HERE                                  :{WHITE}Nu pot construi un oras aici...
-STR_0237_TOO_CLOSE_TO_EDGE_OF_MAP                               :{WHITE}...prea aproape de marginea hãrtii
+STR_0236_CAN_T_BUILD_TOWN_HERE                                  :{WHITE}Nu se poate construi un oraş aici...
+STR_0237_TOO_CLOSE_TO_EDGE_OF_MAP                               :{WHITE}...prea aproape de marginea hărţii
 STR_0238_TOO_CLOSE_TO_ANOTHER_TOWN                              :{WHITE}...prea aproape de alt oras
 STR_0239_SITE_UNSUITABLE                                        :{WHITE}...locaţie nepotrivită
 STR_023A_TOO_MANY_TOWNS                                         :{WHITE}...prea multe oraşe
 STR_CANNOT_GENERATE_TOWN                                        :{WHITE}Nu pot construi nici un oras
-STR_NO_SPACE_FOR_TOWN                                           :{WHITE}...nu mai este loc pe hartã
+STR_NO_SPACE_FOR_TOWN                                           :{WHITE}...nu mai este loc pe hartă
 STR_023B_INCREASE_SIZE_OF_TOWN                                  :{BLACK}Măreşte dimensiunile oraşului
 STR_023C_EXPAND                                                 :{BLACK}Extinde
 STR_023D_RANDOM_TOWN                                            :{BLACK}Oraş aleator
@@ -645,7 +650,7 @@
 STR_023F_INDUSTRY_GENERATION                                    :{WHITE}Generare industrii
 STR_0240_COAL_MINE                                              :{BLACK}Mină de cărbune
 STR_0241_POWER_STATION                                          :{BLACK}Termocentrală
-STR_0242_SAWMILL                                                :{BLACK}Exploataţie forestieră
+STR_0242_SAWMILL                                                :{BLACK}Fabrică de cherestea
 STR_0243_FOREST                                                 :{BLACK}Pădure
 STR_0244_OIL_REFINERY                                           :{BLACK}Rafinărie
 STR_0245_OIL_RIG                                                :{BLACK}Platformă petrolieră
@@ -679,7 +684,7 @@
 STR_0261_SUGAR_MINE                                             :{BLACK}Mină de zahăr
 STR_0262_CONSTRUCT_COAL_MINE                                    :{BLACK}Construieşte mină de cupru
 STR_0263_CONSTRUCT_POWER_STATION                                :{BLACK}Construieşte termocentrală
-STR_0264_CONSTRUCT_SAWMILL                                      :{BLACK}Înfiinţează exploataţie forestieră
+STR_0264_CONSTRUCT_SAWMILL                                      :{BLACK}Înfiinţează fabrică de cherestea
 STR_0265_PLANT_FOREST                                           :{BLACK}Plantează pădure
 STR_0266_CONSTRUCT_OIL_REFINERY                                 :{BLACK}Construieşte rafinărie
 STR_0267_CONSTRUCT_OIL_RIG_CAN_ONLY                             :{BLACK}Construieşte platformă petrolieră (doar în apropierea marginilor hărţii)
@@ -712,7 +717,7 @@
 STR_0282_CONSTRUCT_BUBBLE_GENERATOR                             :{BLACK}Construieşte generator de balonaşe
 STR_0283_CONSTRUCT_TOFFEE_QUARRY                                :{BLACK}Construieşte carieră de caramel
 STR_0284_CONSTRUCT_SUGAR_MINE                                   :{BLACK}Construieşte mină de zahăr
-STR_0285_CAN_T_BUILD_HERE                                       :{WHITE}Nu pot construi {STRING} aici...
+STR_0285_CAN_T_BUILD_HERE                                       :{WHITE}Nu se poate construi {STRING} aici...
 STR_0286_MUST_BUILD_TOWN_FIRST                                  :{WHITE}...mai întâi trebuie creat un oraş
 STR_0287_ONLY_ONE_ALLOWED_PER_TOWN                              :{WHITE}...un singur obiectiv de acest tip este permis într-un oraş
 STR_0288_PLANT_TREES                                            :{BLACK}Plantează arbori
@@ -724,6 +729,7 @@
 STR_028E_PLACE_TRANSMITTER                                      :{BLACK}Plasează transmiţător
 STR_028F_DEFINE_DESERT_AREA                                     :{BLACK}Defineşte suprafaţa de deşert.{}Apasă şi menţine apăsat CTRL pentru a o şterge
 STR_CREATE_LAKE                                                 :{BLACK}Defineste zona apei.{}Creeaza un canal, mai putin cand CTRL este apasat la nivelul marii, cand va inunda, in loc, imprejurimile
+STR_CREATE_RIVER                                                :{BLACK}Amplasează râuri.
 STR_0290_DELETE                                                 :{BLACK}Şterge
 STR_0291_DELETE_THIS_TOWN_COMPLETELY                            :{BLACK}Şterge acest oraş
 STR_0292_SAVE_SCENARIO                                          :Salvează scenariul
@@ -798,15 +804,15 @@
 STR_02DC_DISPLAY_SUBSIDIES                                      :{BLACK}Afişează subvenţiile (F6)
 STR_02DD_SUBSIDIES                                              :Subvenţii (F6)
 STR_02DE_MAP_OF_WORLD                                           :Harta lumii (F4)
-STR_EXTRA_VIEW_PORT                                             :Extra ecran
+STR_EXTRA_VIEW_PORT                                             :Ecran suplimentar
 STR_SIGN_LIST                                                   :Lista de semne
 STR_02DF_TOWN_DIRECTORY                                         :Lista oraşelor
 STR_TOWN_POPULATION                                             :{BLACK}Populatia totala: {COMMA}
 STR_EXTRA_VIEW_PORT_TITLE                                       :{WHITE}Ecran{COMMA}
-STR_EXTRA_VIEW_MOVE_VIEW_TO_MAIN                                :{BLACK}Copiaza pe ecranul principal
-STR_EXTRA_VIEW_MOVE_VIEW_TO_MAIN_TT                             :{BLACK}Copiaza locatia ecranului principal in acest ecran
+STR_EXTRA_VIEW_MOVE_VIEW_TO_MAIN                                :{BLACK}Copiază în fereastră
+STR_EXTRA_VIEW_MOVE_VIEW_TO_MAIN_TT                             :{BLACK}Copiază locaţia ecranului principal în acest ecran
 STR_EXTRA_VIEW_MOVE_MAIN_TO_VIEW                                :{BLACK}Importa din ecran
-STR_EXTRA_VIEW_MOVE_MAIN_TO_VIEW_TT                             :{BLACK}Importa locatia acestui ecran in ecranul principal
+STR_EXTRA_VIEW_MOVE_MAIN_TO_VIEW_TT                             :{BLACK}Importă locaţia acestui ecran în ecranul principal
 
 STR_02E0_CURRENCY_UNITS                                         :{BLACK}Unitate monetară
 STR_02E1                                                        :{BLACK}{SKIP}{STRING}
@@ -929,7 +935,7 @@
 
 STR_OPTIONS_LANG                                                :{BLACK}Limba
 STR_OPTIONS_LANG_CBO                                            :{BLACK}{SKIP}{SKIP}{SKIP}{SKIP}{SKIP}{SKIP}{STRING}
-STR_OPTIONS_LANG_TIP                                            :{BLACK}Alege limba în care doresti afisatã interfata
+STR_OPTIONS_LANG_TIP                                            :{BLACK}Alege limba în care doreşti afişată interfaţa
 
 STR_OPTIONS_FULLSCREEN                                          :{BLACK}Ecran intreg
 STR_OPTIONS_FULLSCREEN_TIP                                      :{BLACK}Bifeaza aceasta casuta pentru a juca in modul
@@ -937,13 +943,13 @@
 
 STR_OPTIONS_RES                                                 :{BLACK}Rezolutia ecranului
 STR_OPTIONS_RES_CBO                                             :{BLACK}{SKIP}{SKIP}{SKIP}{SKIP}{SKIP}{SKIP}{SKIP}{STRING}
-STR_OPTIONS_RES_TIP                                             :{BLACK}Alege rezolutia doritã pentru joc
+STR_OPTIONS_RES_TIP                                             :{BLACK}Alege rezoluţia dorită pentru joc
 
 STR_OPTIONS_SCREENSHOT_FORMAT                                   :{BLACK}Formatul capturii de ecran
 STR_OPTIONS_SCREENSHOT_FORMAT_CBO                               :{BLACK}{SKIP}{SKIP}{SKIP}{SKIP}{SKIP}{SKIP}{SKIP}{SKIP}{STRING}
-STR_OPTIONS_SCREENSHOT_FORMAT_TIP                               :{BLACK}Alege tipul fisierului în care se salveazã captura de ecran (screenshot)
+STR_OPTIONS_SCREENSHOT_FORMAT_TIP                               :{BLACK}Alege tipul fişierului în care se salvează captura de ecran (screenshot)
 
-STR_AUTOSAVE_1_MONTH                                            :În fiecare lunã
+STR_AUTOSAVE_1_MONTH                                            :În fiecare lună
 STR_AUTOSAVE_FAILED                                             :{WHITE}Auto-salvarea a esuat
 
 STR_MONTH_JAN                                                   :ianuarie
@@ -961,73 +967,73 @@
 
 STR_HEADING_FOR_STATION                                         :{LTBLUE}Spre {STATION}
 STR_HEADING_FOR_STATION_VEL                                     :{LTBLUE}Spre {STATION}, {VELOCITY}
-STR_NO_ORDERS                                                   :{LTBLUE}Fãrã rutã
-STR_NO_ORDERS_VEL                                               :{LTBLUE}Fãrã rutã, {VELOCITY}
+STR_NO_ORDERS                                                   :{LTBLUE}Fără comenzi
+STR_NO_ORDERS_VEL                                               :{LTBLUE}Fără comenzi, {VELOCITY}
 
-STR_PASSENGERS                                                  :cãlãtori
+STR_PASSENGERS                                                  :călători
 STR_BAGS                                                        :saci
 STR_TONS                                                        :tone
 STR_LITERS                                                      :litri
-STR_ITEMS                                                       :bucãti
+STR_ITEMS                                                       :bucăţi
 STR_CRATES                                                      :pachete
 STR_RES_OTHER                                                   :altele
 STR_NOTHING                                                     :
 
 STR_SMALL_RIGHT_ARROW                                           :{TINYFONT}{RIGHTARROW}
 
-STR_CANT_SHARE_ORDER_LIST                                       :{WHITE}Nu pot construi lista de comenzi comune...
+STR_CANT_SHARE_ORDER_LIST                                       :{WHITE}Nu se poate trece la comenzi sincronizate...
 STR_CANT_COPY_ORDER_LIST                                        :{WHITE}Nu pot copia lista de comenzi...
-STR_END_OF_SHARED_ORDERS                                        :{SETX 10}- - Sfârsitul comenzilor comune - -
+STR_END_OF_SHARED_ORDERS                                        :{SETX 10}- - Sfârşitul comenzilor sincronizate - -
 
 STR_TRAIN_IS_LOST                                               :{WHITE}Trenul {COMMA} s-a rãtãcit.
 STR_TRAIN_IS_UNPROFITABLE                                       :{WHITE}Profitul trenului {COMMA} a fost anul trecut de {CURRENCY}
-STR_EURO_INTRODUCE                                              :{BLACK}{BIGFONT}Uniunea Monetarã Europeanã!{}{}Euro este introdus în tarã ca monedã unicã de folosintã în tranzactiile zilnice!
+STR_EURO_INTRODUCE                                              :{BLACK}{BIGFONT}Uniunea Monetară Europeană!{}{}Euro este introdus în ţară ca monedă unică de folosinţă în tranzacţiile zilnice!
 
 # Start of order review system.
 # DON'T ADD OR REMOVE LINES HERE
 STR_TRAIN_HAS_TOO_FEW_ORDERS                                    :{WHITE}Trenul {COMMA} are prea putine comenzi în listã
-STR_TRAIN_HAS_VOID_ORDER                                        :{WHITE}Trenul {COMMA} nu are comenzi
+STR_TRAIN_HAS_VOID_ORDER                                        :{WHITE}Trenul {COMMA} are o comandă nulă
 STR_TRAIN_HAS_DUPLICATE_ENTRY                                   :{WHITE}Trenul {COMMA} are comenzi repetate
 STR_TRAIN_HAS_INVALID_ENTRY                                     :{WHITE}Trenul {COMMA} are o statie inexistentã în comenzi
 STR_ROADVEHICLE_HAS_TOO_FEW_ORDERS                              :{WHITE}Autovehiculul {COMMA} are prea putine comenzi în listã
-STR_ROADVEHICLE_HAS_VOID_ORDER                                  :{WHITE}Autovehiculul {COMMA} nu are comenzi
+STR_ROADVEHICLE_HAS_VOID_ORDER                                  :{WHITE}Autovehiculul {COMMA} are o comandă nulă
 STR_ROADVEHICLE_HAS_DUPLICATE_ENTRY                             :{WHITE}Autovehiculul {COMMA} are comenzi duplicat
 STR_ROADVEHICLE_HAS_INVALID_ENTRY                               :{WHITE}Autovehiculul {COMMA} are o statie inexistentã în comenzi
 STR_SHIP_HAS_TOO_FEW_ORDERS                                     :{WHITE}Nava {COMMA} are prea putine comenzi în listã
-STR_SHIP_HAS_VOID_ORDER                                         :{WHITE}Nava {COMMA} nu are comenzi
+STR_SHIP_HAS_VOID_ORDER                                         :{WHITE}Nava {COMMA} are o comandă nulă
 STR_SHIP_HAS_DUPLICATE_ENTRY                                    :{WHITE}Nava {COMMA} are comenzi repetate
 STR_SHIP_HAS_INVALID_ENTRY                                      :{WHITE}Nava {COMMA} are o statie inexistentã în comenzi
-STR_AIRCRAFT_HAS_TOO_FEW_ORDERS                                 :{WHITE}Aeronava {COMMA} are prea putine comenzi în listã
-STR_AIRCRAFT_HAS_VOID_ORDER                                     :{WHITE}Aeronava {COMMA} nu are comenzi
+STR_AIRCRAFT_HAS_TOO_FEW_ORDERS                                 :{WHITE}Aeronava {COMMA} are prea puţine comenzi în listă
+STR_AIRCRAFT_HAS_VOID_ORDER                                     :{WHITE}Aeronava {COMMA} are o comandă nulă
 STR_AIRCRAFT_HAS_DUPLICATE_ENTRY                                :{WHITE}Aeronava {COMMA} are comenzi repetate
-STR_AIRCRAFT_HAS_INVALID_ENTRY                                  :{WHITE}Aeronava {COMMA} are o statie inexistentã în comenzi
+STR_AIRCRAFT_HAS_INVALID_ENTRY                                  :{WHITE}Aeronava {COMMA} are o staţie inexistentă în comenzi
 # end of order system
 
 STR_TRAIN_AUTORENEW_FAILED                                      :{WHITE}Înnoirea trenului {COMMA} a esuat (fonduri limitate)
 STR_ROADVEHICLE_AUTORENEW_FAILED                                :{WHITE}Înnoirea autovehiculului {COMMA} a esuat (fonduri limitate)
 STR_SHIP_AUTORENEW_FAILED                                       :{WHITE}Înnoirea navei {COMMA} a esuat (fonduri limitate)
-STR_AIRCRAFT_AUTORENEW_FAILED                                   :{WHITE}Înnoirea aeronavei {COMMA} a esuat (fonduri limitate)
+STR_AIRCRAFT_AUTORENEW_FAILED                                   :{WHITE}Înnoirea automată a aeronavei {COMMA} a eşuat (fonduri limitate)
 STR_TRAIN_TOO_LONG_AFTER_REPLACEMENT                            :{WHITE}Trenul {COMMA} este prea lung dupa inlocuire
 
 STR_CONFIG_PATCHES                                              :{BLACK}Configurare patch
-STR_CONFIG_PATCHES_TIP                                          :{BLACK}Configureazã patch-urile OpenTTD
+STR_CONFIG_PATCHES_TIP                                          :{BLACK}Configurează patch-urile OpenTTD
 STR_CONFIG_PATCHES_CAPTION                                      :{WHITE}Configurare patch
 
 STR_CONFIG_PATCHES_OFF                                          :inactiv
 STR_CONFIG_PATCHES_ON                                           :activ
-STR_CONFIG_PATCHES_VEHICLESPEED                                 :{LTBLUE}Afiseazã viteza vehiculelor in bara de jos: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_BUILDONSLOPES                                :{LTBLUE}Permite construirea pe coastã si in pantã: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_VEHICLESPEED                                 :{LTBLUE}Afişează viteza vehiculelor în bara de stare: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_BUILDONSLOPES                                :{LTBLUE}Permite construirea pe coastă şi în pantă: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_AUTOSLOPE                                    :{LTBLUE}Permite terra-formarea sub cladiri, sine, etc. (auto-pante): {ORANGE}{STRING}
 STR_CONFIG_PATCHES_CATCHMENT                                    :{LTBLUE}Permite arii de cuprindere mai realistice: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_EXTRADYNAMITE                                :{LTBLUE}Permite demolarea unui nr. mai mare constructii: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_MAMMOTHTRAINS                                :{LTBLUE}Permite constructia de trenuri foarte lungi: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_REALISTICACCEL                               :{LTBLUE}Permite acceleratie realisticã pentru trenuri: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_REALISTICACCEL                               :{LTBLUE}Permite acceleraţie realistică pentru trenuri: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_FORBID_90_DEG                                :{LTBLUE}Interzice trenurilor si navelor sa faca intoarceri de 90 de grade: {ORANGE}{STRING} {LTBLUE} (necesita NPF)
-STR_CONFIG_PATCHES_JOINSTATIONS                                 :{LTBLUE}Uneste gãrile alãturate: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_JOINSTATIONS                                 :{LTBLUE}Uneşte gările alăturate: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_IMPROVEDLOAD                                 :{LTBLUE}Foloseste algoritm incarcare imbunatatit: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_GRADUAL_LOADING                              :{LTBLUE}Incarca vehiculele gradual: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_INFLATION                                    :{LTBLUE}Inflatia: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_SELECTGOODS                                  :{LTBLUE}Livreazã marfa doar in statiile unde aceasta este ceruta: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_SELECTGOODS                                  :{LTBLUE}Livrează marfa doar în staţiile unde aceasta este cerută: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_LONGBRIDGES                                  :{LTBLUE}Permite constructia de poduri foarte lungi: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_GOTODEPOT                                    :{LTBLUE}Permite ordine de tipul "mergi la depou": {ORANGE}{STRING}
 STR_CONFIG_PATCHES_RAW_INDUSTRY_CONSTRUCTION_METHOD             :{LTBLUE}Metoda manuala de constructie industrii primare: {ORANGE}{STRING}
@@ -1035,20 +1041,22 @@
 STR_CONFIG_PATCHES_RAW_INDUSTRY_CONSTRUCTION_METHOD_NORMAL      :ca alte industrii
 STR_CONFIG_PATCHES_RAW_INDUSTRY_CONSTRUCTION_METHOD_PROSPECTING :de prospectie
 STR_CONFIG_PATCHES_MULTIPINDTOWN                                :{LTBLUE}Permite mai multe industrii similare in acelasi oras: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_SAMEINDCLOSE                                 :{LTBLUE}Industrii identice pot fi construite aproape una de cealaltã: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_LONGDATE                                     :{LTBLUE}Afiseazã intotdeauna data in format lung in bara de stare: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_SAMEINDCLOSE                                 :{LTBLUE}Industrii identice pot fi construite în apropiere una de cealaltă: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_LONGDATE                                     :{LTBLUE}Afişează întotdeauna data în format lung în bara de stare: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_SIGNALSIDE                                   :{LTBLUE}Afişează semafoarele pe partea de circulaţie: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_SHOWFINANCES                                 :{LTBLUE}Afiseazã finantele la sfârsitul fiecãrui an: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_NEW_NONSTOP                                  :{LTBLUE}Utilizeazã o metodã gen TTDPatch pentru 'non stop': {ORANGE}{STRING}
-STR_CONFIG_PATCHES_ROADVEH_QUEUE                                :{LTBLUE}Autovehiculele formeazã o coadã (cu efecte cuantice): {ORANGE}{STRING}
-STR_CONFIG_PATCHES_AUTOSCROLL                                   :{LTBLUE}Mutã imaginea când mouse-ul este la marginea ecranului: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_BRIBE                                        :{LTBLUE}Permite mituirea autoritãtilor locale: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_SHOWFINANCES                                 :{LTBLUE}Afişează finanţele la sfârşitul fiecărui an: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_NEW_NONSTOP                                  :{LTBLUE}Utilizează o metodă gen TTDPatch pentru 'non stop': {ORANGE}{STRING}
+STR_CONFIG_PATCHES_ROADVEH_QUEUE                                :{LTBLUE}Autovehiculele pot forma cozi (cu efecte cuantice): {ORANGE}{STRING}
+STR_CONFIG_PATCHES_AUTOSCROLL                                   :{LTBLUE}Mută imaginea când mouse-ul este la marginea ecranului: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_BRIBE                                        :{LTBLUE}Permite mituirea autorităţilor locale: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_ALLOW_EXCLUSIVE                              :{LTBLUE}Permite cumpararea de drepturi exclusive de transport: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_ALLOW_GIVE_MONEY                             :{LTBLUE}Permite transfer de bani catre alte companii: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_NONUNIFORM_STATIONS                          :{LTBLUE}Statii neuniforme: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_FREIGHT_TRAINS                               :{LTBLUE}Multiplicator greutate pt marfar pt simularea trenurilor grele: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_PLANE_SPEED                                  :{LTBLUE}Factor de viteză pentru avioane: {ORANGE}1 / {STRING}
 STR_CONFIG_PATCHES_STOP_ON_TOWN_ROAD                            :{LTBLUE}Permite semafoare in intersectiile drumurilor din proprietatea orasului: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_ADJACENT_STATIONS                            :{LTBLUE}Permite construirea de statii adiacente: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_DYNAMIC_ENGINES                              :{LTBLUE}Permite mai multe seturi NewGRF simultan: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_SMALL_AIRPORTS                               :{LTBLUE}Permite întotdeauna aeroporturi mici: {ORANGE}{STRING}
 
@@ -1058,10 +1066,10 @@
 STR_CONFIG_PATCHES_ORDER_REVIEW_EXDEPOT                         :da, dar exclude vehiculele oprite
 STR_CONFIG_PATCHES_ORDER_REVIEW_ON                              :pentru toate vehiculele
 STR_CONFIG_PATCHES_WARN_INCOME_LESS                             :{LTBLUE}Avertizare in cazul in care un tren are profit negativ: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_NEVER_EXPIRE_VEHICLES                        :{LTBLUE}Vehiculele nu expirã niciodatã: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_AUTORENEW_VEHICLE                            :{LTBLUE}Înnoire automatã pentru vehiculele învechite
-STR_CONFIG_PATCHES_AUTORENEW_MONTHS                             :{LTBLUE}Înnoire automatã cu {ORANGE}{STRING}{LTBLUE} luni pânã la/dupã atingerea vechimii max.
-STR_CONFIG_PATCHES_AUTORENEW_MONEY                              :{LTBLUE}Fonduri minime pentru înnoire automatã: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_NEVER_EXPIRE_VEHICLES                        :{LTBLUE}Vehiculele nu expiră niciodată: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_AUTORENEW_VEHICLE                            :{LTBLUE}Înnoire automată pentru vehiculele învechite
+STR_CONFIG_PATCHES_AUTORENEW_MONTHS                             :{LTBLUE}Înnoire automată cu {ORANGE}{STRING}{LTBLUE} luni înainte de/după atingerea vechimii max.
+STR_CONFIG_PATCHES_AUTORENEW_MONEY                              :{LTBLUE}Fonduri minime pentru înnoire automată: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_ERRMSG_DURATION                              :{LTBLUE}Durata mesajelor de eroare: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_POPULATION_IN_LABEL                          :{LTBLUE}Afiseaza populatia unui oras langa nume: {ORANGE}{STRING}
 
@@ -1069,7 +1077,7 @@
 STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL                      :Original
 STR_CONFIG_PATCHES_LAND_GENERATOR_TERRA_GENESIS                 :TerraGeneza
 STR_CONFIG_PATCHES_OIL_REF_EDGE_DISTANCE                        :{LTBLUE}Distanta maxima de la margine pt Rafinariile de petrol {ORANGE}{STRING}
-STR_CONFIG_PATCHES_SNOWLINE_HEIGHT                              :{LTBLUE}Altitudinea de înzãpezire: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_SNOWLINE_HEIGHT                              :{LTBLUE}Altitudinea de înzăpezire: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_ROUGHNESS_OF_TERRAIN                         :{LTBLUE}Duritatea terenului (Doar pt TerraGeneza) : {ORANGE}{STRING}
 STR_CONFIG_PATCHES_ROUGHNESS_OF_TERRAIN_VERY_SMOOTH             :Foarte fin
 STR_CONFIG_PATCHES_ROUGHNESS_OF_TERRAIN_SMOOTH                  :Fin
@@ -1084,12 +1092,12 @@
 STR_CONFIG_PATCHES_HEIGHTMAP_ROTATION_CLOCKWISE                 :In sensul acelor de ceasornic
 STR_CONFIG_PATCHES_SE_FLAT_WORLD_HEIGHT                         :{LTBLUE}Nivelul inaltimii atins de o harta plana: {ORANGE}{STRING}
 
-STR_CONFIG_PATCHES_STATION_SPREAD                               :{LTBLUE}Mãrimea maximã a statiilor: {ORANGE}{STRING} {RED}(valorile mari încetinesc jocul!)
+STR_CONFIG_PATCHES_STATION_SPREAD                               :{LTBLUE}Distanţarea maximă a staţiilor: {ORANGE}{STRING} {RED}Atenţie: Valorile mari încetinesc jocul!
 STR_CONFIG_PATCHES_SERVICEATHELIPAD                             :{LTBLUE}Service automat pentru elicoptere la helipaduri: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_LINK_TERRAFORM_TOOLBAR                       :{LTBLUE}Conecteaza bara de instrumente pentru peisaj cu cea de constructii feroviare/auto/aeriane: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_REVERSE_SCROLLING                            :{LTBLUE}Cand faci scroll cu mouse-ul muta ecranul in directia opusã: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_REVERSE_SCROLLING                            :{LTBLUE}Scroll cu mouse-ul dreapta mută ecranul în direcţia opusă: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_SMOOTH_SCROLLING                             :{LTBLUE}Derulare usoara ecran: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_MEASURE_TOOLTIP                              :{LTBLUE}Arata o bara de unelte de masuratori la folosirea uneltelor de constructie: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_MEASURE_TOOLTIP                              :{LTBLUE}Arată o indicaţie de distanţă la folosirea uneltelor de construcţie: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_LIVERIES                                     :{LTBLUE}Arata uniformele companiilor: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_LIVERIES_NONE                                :Niciunul
 STR_CONFIG_PATCHES_LIVERIES_OWN                                 :Propria companie
@@ -1127,15 +1135,15 @@
 STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE_MOST_USED                  :Cea mai folosita
 
 STR_CONFIG_PATCHES_ALWAYS_BUILD_INFRASTRUCTURE                  :{LTBLUE}Arata uneltele de constructie cand nu sunt disponibile vehiculele potrivite: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_MAX_TRAINS                                   :{LTBLUE}Nr. max. de trenuri per jucãtor: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_MAX_ROADVEH                                  :{LTBLUE}Nr. max. de autovehicule pentru un jucãtor: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_MAX_AIRCRAFT                                 :{LTBLUE}Nr. max. de aeronave pentru un jucãtor: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_MAX_SHIPS                                    :{LTBLUE}Nr. max. de nave per jucãtor: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_MAX_TRAINS                                   :{LTBLUE}Nr. max. de trenuri pentru un jucător: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_MAX_ROADVEH                                  :{LTBLUE}Nr. max. de autovehicule pentru un jucător: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_MAX_AIRCRAFT                                 :{LTBLUE}Nr. max. de aeronave pentru un jucător: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_MAX_SHIPS                                    :{LTBLUE}Nr. max. de nave pentru un jucător: {ORANGE}{STRING}
 
-STR_CONFIG_PATCHES_AI_BUILDS_TRAINS                             :{LTBLUE}Dezactiveazã trenurile pentru jucãtorii PC: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_AI_BUILDS_ROADVEH                            :{LTBLUE}Dezactiveazã autovehiculele pentru jucãtorii PC: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_AI_BUILDS_AIRCRAFT                           :{LTBLUE}Dezactiveazã aeronavele pentru jucãtorii PC: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_AI_BUILDS_SHIPS                              :{LTBLUE}Dezactiveazã navele pentru jucãtorii PC: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_AI_BUILDS_TRAINS                             :{LTBLUE}Dezactivează trenurile pentru jucătorii controlaţi de PC: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_AI_BUILDS_ROADVEH                            :{LTBLUE}Dezactivează autovehiculele pentru jucătorii controlaţi de PC: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_AI_BUILDS_AIRCRAFT                           :{LTBLUE}Dezactivează aeronavele pentru jucătorii controlaţi de PC: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_AI_BUILDS_SHIPS                              :{LTBLUE}Dezactivează navele pentru jucătorii controlaţi de PC: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_AINEW_ACTIVE                                 :{LTBLUE}Foloseste noul AI (versiune alfa): {ORANGE}{STRING}
 STR_CONFIG_PATCHES_AI_IN_MULTIPLAYER                            :{LTBLUE}Permite AI în multiplayer (experimental): {ORANGE}{STRING}
@@ -1149,7 +1157,7 @@
 STR_CONFIG_PATCHES_SERVINT_SHIPS                                :{LTBLUE}Intervalul de service presetat pentru nave: {ORANGE}{STRING} zile
 STR_CONFIG_PATCHES_SERVINT_SHIPS_DISABLED                       :{LTBLUE}Intervalul de service presetat pentru nave: {ORANGE}dezactivat
 STR_CONFIG_PATCHES_NOSERVICE                                    :{LTBLUE}Deactivare service cand defectiunile sunt anulate: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_WAGONSPEEDLIMITS                             :{LTBLUE}Activeazã limite de vitezã pt. vagoane: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_WAGONSPEEDLIMITS                             :{LTBLUE}Activează limite de viteză pentru vagoane: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_DISABLE_ELRAILS                              :{LTBLUE}Dezactiveaza sinele electrice: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_COLORED_NEWS_YEAR                            :{LTBLUE}Stirile în culori apar în anul: {ORANGE}{STRING}
@@ -1162,12 +1170,13 @@
 STR_CONFIG_PATCHES_ENABLE_SIGNAL_GUI                            :{LTBLUE}Activare GUI pentru semnale: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_TOWN_LAYOUT_INVALID                          :{WHITE}Apectul de oras "fara alte drumuri" nu este valid in editorul de scenarii
-STR_CONFIG_PATCHES_TOWN_LAYOUT                                  :{LTBLUE}Alege aspect drum-de-oras: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_TOWN_LAYOUT                                  :{LTBLUE}Alege amplasarea drumurilor în oraş: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_TOWN_LAYOUT_NO_ROADS                         :fara alte drumuri
 STR_CONFIG_PATCHES_TOWN_LAYOUT_DEFAULT                          :implicit
 STR_CONFIG_PATCHES_TOWN_LAYOUT_BETTER_ROADS                     :drumuri mai bune
 STR_CONFIG_PATCHES_TOWN_LAYOUT_2X2_GRID                         :grila 2x2
 STR_CONFIG_PATCHES_TOWN_LAYOUT_3X3_GRID                         :grila 3x3
+STR_CONFIG_PATCHES_TOWN_LAYOUT_RANDOM                           :aleator
 
 STR_CONFIG_PATCHES_TOOLBAR_POS                                  :{LTBLUE}Pozitia listei cu instrumente: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_TOOLBAR_POS_LEFT                             :stânga
@@ -1186,7 +1195,7 @@
 STR_CONFIG_PATCHES_CITY_SIZE_MULTIPLIER                         :{LTBLUE}Multiplicator initial dimensiune oras: {ORANGE}{STRING}
 STR_CONFIG_MODIFIED_ROAD_REBUILD                                :{LTBLUE}Elimina elementele de drum absurde pe durata constructiei drumului
 
-STR_CONFIG_PATCHES_GUI                                          :{BLACK}Interfatã
+STR_CONFIG_PATCHES_GUI                                          :{BLACK}Interfaţă
 STR_CONFIG_PATCHES_CONSTRUCTION                                 :{BLACK}Construcţie
 STR_CONFIG_PATCHES_VEHICLES                                     :{BLACK}Vehicule
 STR_CONFIG_PATCHES_STATIONS                                     :{BLACK}Statii
@@ -1197,25 +1206,38 @@
 STR_CONFIG_PATCHES_INT32                                        :{NUM}
 STR_CONFIG_PATCHES_CURRENCY                                     :{CURRENCY}
 
-STR_CONFIG_PATCHES_QUERY_CAPT                                   :{WHITE}Schimbã valoarea setãrii
+STR_CONFIG_PATCHES_QUERY_CAPT                                   :{WHITE}Schimbă valoarea setării
 STR_CONFIG_PATCHES_SERVICE_INTERVAL_INCOMPATIBLE                :{WHITE}Unele sau toate din intervalurile de service alese sunt incompatibile cu setarea aleasa! Valorile valide sunt cuprinse intre 5-90% si 30-800 zile
 
+STR_CONFIG_PATCHES_PATHFINDER_FOR_TRAINS                        :{LTBLUE}Algoritm de rutare pentru trenuri: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_PATHFINDER_FOR_TRAINS_NTP                    :NTP {RED}(Nerecomandat)
+STR_CONFIG_PATCHES_PATHFINDER_FOR_TRAINS_NPF                    :NPF
+STR_CONFIG_PATCHES_PATHFINDER_FOR_TRAINS_YAPF                   :YAPF {BLUE}(Recomandat)
+STR_CONFIG_PATCHES_PATHFINDER_FOR_ROADVEH                       :{LTBLUE}Algoritm de rutare pentru vehicule rutiere: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_PATHFINDER_FOR_ROADVEH_OPF                   :Original {RED}(Nerecomandat)
+STR_CONFIG_PATCHES_PATHFINDER_FOR_ROADVEH_NPF                   :NPF
+STR_CONFIG_PATCHES_PATHFINDER_FOR_ROADVEH_YAPF                  :YAPF {BLUE}(Recomandat)
+STR_CONFIG_PATCHES_PATHFINDER_FOR_SHIPS                         :{LTBLUE}Algoritm de rutare pentru nave: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_PATHFINDER_FOR_SHIPS_OPF                     :Original {BLUE}(Recomandat)
+STR_CONFIG_PATCHES_PATHFINDER_FOR_SHIPS_NPF                     :NPF
+STR_CONFIG_PATCHES_PATHFINDER_FOR_SHIPS_YAPF                    :YAPF {RED}(Nerecomandat)
+
 STR_TEMPERATE_LANDSCAPE                                         :peisajul temperat
 STR_SUB_ARCTIC_LANDSCAPE                                        :peisajul sub-arctic
 STR_SUB_TROPICAL_LANDSCAPE                                      :peisajul sub-tropical
 STR_TOYLAND_LANDSCAPE                                           :peisajul 'tara jucãriilor'
 
 STR_CHEATS                                                      :{WHITE}Cheat-uri
-STR_CHEATS_TIP                                                  :{BLACK}Checkbox-urile aratã un cheat folosit anterior
-STR_CHEATS_WARNING                                              :{BLACK}Atentie! Esti pe cale sã-ti trãdezi colegii de joc! Nu uita cã aceastã rusine va rãmâne înregistratã pentru totdeauna!
-STR_CHEAT_MONEY                                                 :{LTBLUE}Mãreste fondurile cu {CURRENCY}
-STR_CHEAT_CHANGE_PLAYER                                         :{LTBLUE}Joacã în locul jucãtorului: {ORANGE}{COMMA}
-STR_CHEAT_EXTRA_DYNAMITE                                        :{LTBLUE}Buldozer magic (demoleazã industrii si lucruri amovibile): {ORANGE}{STRING}
+STR_CHEATS_TIP                                                  :{BLACK}Bifa vă indică dacă aţi folosit anterior acest cheat
+STR_CHEATS_WARNING                                              :{BLACK}Atenţie! Eşti pe cale să-ţi trădezi colegii de joc! Nu uita că această ruşine va rămâne înregistrată pentru totdeauna!
+STR_CHEAT_MONEY                                                 :{LTBLUE}Măreşte fondurile cu {CURRENCY}
+STR_CHEAT_CHANGE_PLAYER                                         :{LTBLUE}Joacă în locul jucătorului: {ORANGE}{COMMA}
+STR_CHEAT_EXTRA_DYNAMITE                                        :{LTBLUE}Buldozer magic (demolează industrii şi lucruri amovibile): {ORANGE}{STRING}
 STR_CHEAT_CROSSINGTUNNELS                                       :{LTBLUE}Tunelele se pot intersecta: {ORANGE}{STRING}
-STR_CHEAT_BUILD_IN_PAUSE                                        :{LTBLUE}Construieste în modul pauzã: {ORANGE}{STRING}
-STR_CHEAT_NO_JETCRASH                                           :{LTBLUE}Avioanele cu reactie nu se vor prãbusi (frecvent) pe aeroporturile mici: {ORANGE} {STRING}
-STR_CHEAT_SWITCH_CLIMATE                                        :{LTBLUE}Schimbã peisajul: {ORANGE} {STRING}
-STR_CHEAT_CHANGE_DATE                                           :{LTBLUE}Schimbã data: {ORANGE} {DATE_SHORT}
+STR_CHEAT_BUILD_IN_PAUSE                                        :{LTBLUE}Construieşte în modul pauză: {ORANGE}{STRING}
+STR_CHEAT_NO_JETCRASH                                           :{LTBLUE}Avioanele cu reacţie nu se vor prăbuşi (frecvent) pe aeroporturile mici: {ORANGE} {STRING}
+STR_CHEAT_SWITCH_CLIMATE                                        :{LTBLUE}Schimbă peisajul: {ORANGE} {STRING}
+STR_CHEAT_CHANGE_DATE                                           :{LTBLUE}Schimbă data: {ORANGE} {DATE_SHORT}
 STR_CHEAT_SETUP_PROD                                            :{LTBLUE}Activeaza accesul la valorile de productie: {ORANGE}{STRING}
 
 STR_HEADING_FOR_WAYPOINT                                        :{LTBLUE}Merge spre {WAYPOINT}
@@ -1226,7 +1248,7 @@
 
 STR_WAYPOINTNAME_CITY                                           :Halta {TOWN}
 STR_WAYPOINTNAME_CITY_SERIAL                                    :Halta {TOWN} #{COMMA}
-STR_LANDINFO_WAYPOINT                                           :Haltã de miscare
+STR_LANDINFO_WAYPOINT                                           :Haltă de mişcare
 
 STR_WAYPOINT                                                    :{WHITE}Punct de tranzit
 STR_WAYPOINT_GRAPHICS_TIP                                       :{BLACK}Alege tipul de punct de tranzit
@@ -1234,18 +1256,18 @@
 STR_WAYPOINT_VIEWPORT                                           :{WHITE}{WAYPOINT}
 STR_WAYPOINT_VIEWPORT_TINY                                      :{TINYFONT}{WHITE}{WAYPOINT}
 STR_WAYPOINT_RAW                                                :{WAYPOINT}
-STR_EDIT_WAYPOINT_NAME                                          :{WHITE}Editeazã numele haltei
+STR_EDIT_WAYPOINT_NAME                                          :{WHITE}Editează numele haltei
 
 STR_CANT_CHANGE_WAYPOINT_NAME                                   :{WHITE}Nu pot schimba numele haltei...
-STR_CONVERT_RAIL_TO_WAYPOINT_TIP                                :{BLACK}Converteste linia în haltã de miscare (waypoint)
-STR_CANT_BUILD_TRAIN_WAYPOINT                                   :{WHITE}Nu pot plasa o haltã aici...
-STR_CANT_REMOVE_TRAIN_WAYPOINT                                  :{WHITE}Nu pot sterge halta de aici...
+STR_CONVERT_RAIL_TO_WAYPOINT_TIP                                :{BLACK}Converteşte linia în haltă de mişcare (waypoint)
+STR_CANT_BUILD_TRAIN_WAYPOINT                                   :{WHITE}Nu se poate plasa o haltă aici...
+STR_CANT_REMOVE_TRAIN_WAYPOINT                                  :{WHITE}Nu se poate desfiinţa halta de aici...
 
-STR_BUILD_AUTORAIL_TIP                                          :{BLACK}Construieste cale feratã în modul automat
+STR_BUILD_AUTORAIL_TIP                                          :{BLACK}Construieşte cale ferată în modul automat
 
-STR_NO_TOWN_IN_SCENARIO                                         :{WHITE}...în acest scenariu nu existã nici un oras
+STR_NO_TOWN_IN_SCENARIO                                         :{WHITE}...în acest scenariu nu există nici un oraş
 
-STR_GENERATE_RANDOM_LANDSCAPE                                   :{WHITE}Esti sigur cã vrei sã creezi un peisaj aleator?
+STR_GENERATE_RANDOM_LANDSCAPE                                   :{WHITE}Eşti sigur că vrei să creezi un peisaj aleator?
 STR_MANY_RANDOM_TOWNS                                           :{BLACK}Mai multe orase aleatoare
 STR_RANDOM_TOWNS_TIP                                            :{BLACK}Umple harta cu orase generate aleator
 STR_MANY_RANDOM_INDUSTRIES                                      :Multe industrii aleatoare
@@ -1254,7 +1276,7 @@
 
 STR_LANDSCAPING_TOOLBAR_TIP                                     :{BLACK}Afiseaza instrumentele pentru modelarea terenului, plantarea copacilor, etc.
 STR_LANDSCAPING_TOOLBAR                                         :{WHITE}Modificare peisaj
-STR_LEVEL_LAND_TOOLTIP                                          :{BLACK}Niveleazã terenul
+STR_LEVEL_LAND_TOOLTIP                                          :{BLACK}Nivelează terenul
 
 
 STR_TREES_RANDOM_TYPE                                           :{BLACK}Arbori din specii aleatoare
@@ -1264,9 +1286,9 @@
 STR_BUILD_CANALS_TIP                                            :{BLACK}Construieste canale.
 STR_LANDINFO_CANAL                                              :Canal
 
-STR_CANT_BUILD_LOCKS                                            :{WHITE}Nu pot construi o ecluzã aici...
-STR_BUILD_LOCKS_TIP                                             :{BLACK}Construieste ecluzã
-STR_LANDINFO_LOCK                                               :Ecluzã
+STR_CANT_BUILD_LOCKS                                            :{WHITE}Nu se poate construi o ecluză aici...
+STR_BUILD_LOCKS_TIP                                             :{BLACK}Construieşte ecluză
+STR_LANDINFO_LOCK                                               :Ecluză
 
 STR_BUOY_IS_IN_USE                                              :{WHITE}... baliza in uz!
 
@@ -1274,51 +1296,51 @@
 
 STR_CANT_REMOVE_PART_OF_STATION                                 :{WHITE}Nu pot demola o parte din statie...
 STR_CANT_CONVERT_RAIL                                           :{WHITE}Nu pot converti linia aici...
-STR_CONVERT_RAIL_TIP                                            :{BLACK}Converteste tipul de cale feratã
+STR_CONVERT_RAIL_TIP                                            :{BLACK}Converteşte tipul de cale ferată
 
 STR_DRAG_WHOLE_TRAIN_TO_SELL_TIP                                :{BLACK}Trage locomotiva aici pentru a vinde întregul tren
 
 STR_DRAG_DROP                                                   :{BLACK}Drag & Drop
 STR_STATION_DRAG_DROP                                           :{BLACK}Construieste o statie prin drag & drop
-STR_SELECT_STATION_CLASS_TIP                                    :{BLACK}Alege o clasã de statii pentru afisare
-STR_SELECT_STATION_TYPE_TIP                                     :{BLACK}Alege tipul de statie pentru constructie
-
-STR_FAST_FORWARD                                                :{BLACK}Mãreste viteza de trecere a timpului (TAB)
-STR_MESSAGE_HISTORY                                             :{WHITE}Cronologia mesajelor
-STR_MESSAGE_HISTORY_TIP                                         :{BLACK}O listã a celor mai recente mesaje
-STR_MESSAGES_DISABLE_ALL                                        :{BLACK}Dezactiveazã toate
-STR_MESSAGES_ENABLE_ALL                                         :{BLACK}Activeazã toate
+STR_SELECT_STATION_CLASS_TIP                                    :{BLACK}Alege o clasă de staţii pentru afişare
+STR_SELECT_STATION_TYPE_TIP                                     :{BLACK}Alege tipul de staţie pentru construcţie
 
-STR_CONSTRUCT_COAL_MINE_TIP                                     :{BLACK}Construieste minã de cãrbune
-STR_CONSTRUCT_FOREST_TIP                                        :{BLACK}Planteazã pãdure
-STR_CONSTRUCT_OIL_RIG_TIP                                       :{BLACK}Construieste platformã petrolierã
-STR_CONSTRUCT_FARM_TIP                                          :{BLACK}Înfiinteazã fermã
-STR_CONSTRUCT_COPPER_ORE_MINE_TIP                               :{BLACK}Construieste minã de cupru
-STR_CONSTRUCT_OIL_WELLS_TIP                                     :{BLACK}Foreazã dupã petrol
-STR_CONSTRUCT_GOLD_MINE_TIP                                     :{BLACK}Construieste minã de aur
-STR_CONSTRUCT_DIAMOND_MINE_TIP                                  :{BLACK}Construieste minã de diamante
-STR_CONSTRUCT_IRON_ORE_MINE_TIP                                 :{BLACK}Construieste minã de fier
-STR_CONSTRUCT_FRUIT_PLANTATION_TIP                              :{BLACK}Planteazã livadã
-STR_CONSTRUCT_RUBBER_PLANTATION_TIP                             :{BLACK}Înfiinteazã plantatie de cauciuc
-STR_CONSTRUCT_WATER_SUPPLY_TIP                                  :{BLACK}Construieste rezervor de apã
-STR_CONSTRUCT_COTTON_CANDY_TIP                                  :{BLACK}Planteazã pãdure de vatã de zahãr
-STR_CONSTRUCT_BATTERY_FARM_TIP                                  :{BLACK}Planteazã pãdure de baterii
-STR_CONSTRUCT_COLA_WELLS_TIP                                    :{BLACK}Foreazã dupã cola
+STR_FAST_FORWARD                                                :{BLACK}Măreşte viteza de trecere a timpului (TAB)
+STR_MESSAGE_HISTORY                                             :{WHITE}Cronologia mesajelor
+STR_MESSAGE_HISTORY_TIP                                         :{BLACK}O listă a celor mai recente mesaje
+STR_MESSAGES_DISABLE_ALL                                        :{BLACK}Dezactivează toate
+STR_MESSAGES_ENABLE_ALL                                         :{BLACK}Activează toate
+
+STR_CONSTRUCT_COAL_MINE_TIP                                     :{BLACK}Construieşte mină de cărbune
+STR_CONSTRUCT_FOREST_TIP                                        :{BLACK}Plantează pădure
+STR_CONSTRUCT_OIL_RIG_TIP                                       :{BLACK}Construieşte platformă petrolieră
+STR_CONSTRUCT_FARM_TIP                                          :{BLACK}Înfiinţează fermă
+STR_CONSTRUCT_COPPER_ORE_MINE_TIP                               :{BLACK}Construieşte mină de cupru
+STR_CONSTRUCT_OIL_WELLS_TIP                                     :{BLACK}Forează după petrol
+STR_CONSTRUCT_GOLD_MINE_TIP                                     :{BLACK}Construieşte mină de aur
+STR_CONSTRUCT_DIAMOND_MINE_TIP                                  :{BLACK}Construieşte mină de diamante
+STR_CONSTRUCT_IRON_ORE_MINE_TIP                                 :{BLACK}Construieşte mină de fier
+STR_CONSTRUCT_FRUIT_PLANTATION_TIP                              :{BLACK}Plantează livadă
+STR_CONSTRUCT_RUBBER_PLANTATION_TIP                             :{BLACK}Înfiinţează plantaţie de cauciuc
+STR_CONSTRUCT_WATER_SUPPLY_TIP                                  :{BLACK}Construieşte rezervor de apă
+STR_CONSTRUCT_COTTON_CANDY_TIP                                  :{BLACK}Plantează pădure de vată de zahăr
+STR_CONSTRUCT_BATTERY_FARM_TIP                                  :{BLACK}Înfiinţează fermă de baterii
+STR_CONSTRUCT_COLA_WELLS_TIP                                    :{BLACK}Forează după cola
 STR_CONSTRUCT_PLASTIC_FOUNTAINS_TIP                             :{BLACK}Construieste fântâni de plastic
 STR_CONSTRUCT_BUBBLE_GENERATOR_TIP                              :{BLACK}Construieste generator de balonase
-STR_CONSTRUCT_TOFFEE_QUARRY_TIP                                 :{BLACK}Construieste carierã de caramel
-STR_CONSTRUCT_SUGAR_MINE_TIP                                    :{BLACK}Construieste minã de zahãr
+STR_CONSTRUCT_TOFFEE_QUARRY_TIP                                 :{BLACK}Construieşte carieră de caramel
+STR_CONSTRUCT_SUGAR_MINE_TIP                                    :{BLACK}Construieşte mină de zahăr
 
 STR_INDUSTRYDIR_CAPTION                                         :{WHITE}Industrii
 STR_INDUSTRYDIR_ITEM                                            :{ORANGE}{INDUSTRY}{BLACK} ({CARGO}{STRING}){YELLOW} ({COMMA}% transportat)
 STR_INDUSTRYDIR_ITEM_TWO                                        :{ORANGE}{INDUSTRY}{BLACK} ({CARGO}{STRING}/{CARGO}{STRING}){YELLOW} ({COMMA}%/{COMMA}% transportat)
 STR_INDUSTRYDIR_ITEM_NOPROD                                     :{ORANGE}{INDUSTRY}
 
-STR_INDUSTRY_TOO_CLOSE                                          :{WHITE}...prea aproape de altã industrie
+STR_INDUSTRY_TOO_CLOSE                                          :{WHITE}...prea aproape de altă industrie
 
 STR_RAIL_REFIT_VEHICLE_TO_CARRY                                 :{BLACK}Schimba tipul încãrcãturii cãratã de acest tren
 STR_RAIL_REFIT_VEHICLE                                          :{BLACK}Modificã încãrcãturã
-STR_RAIL_SELECT_TYPE_OF_CARGO_FOR                               :{BLACK}Alege tipul de marfã transportat de tren
+STR_RAIL_SELECT_TYPE_OF_CARGO_FOR                               :{BLACK}Alege tipul de marfă transportat de tren
 STR_RAIL_REFIT_TO_CARRY_HIGHLIGHTED                             :{BLACK}Modificã trenul pentru a transporta marfa aleasã
 STR_RAIL_CAN_T_REFIT_VEHICLE                                    :{WHITE}Nu pot modifica trenul...
 STR_CONFIG_PATCHES_SERVINT_ISPERCENT                            :{LTBLUE}Intervaluri de service in procente: {ORANGE}{STRING}
@@ -1332,8 +1354,9 @@
 
 STR_NETWORK_MULTIPLAYER                                         :{WHITE}Multiplayer
 
-STR_NETWORK_PLAYER_NAME                                         :{BLACK}Numele jucãtorului:
+STR_NETWORK_PLAYER_NAME                                         :{BLACK}Numele jucătorului:
 STR_NETWORK_ENTER_NAME_TIP                                      :{BLACK}Acesta este numele prin care te vor identifica ceilalţi
+STR_NETWORK_PLAYER_NAME_OSKTITLE                                :{BLACK}Introduceţi-vă numele dvs.
 STR_NETWORK_CONNECTION                                          :{BLACK}Conexiune:
 STR_NETWORK_CONNECTION_TIP                                      :{BLACK}Alege între un joc pe internet şi unul în reţea (LAN)
 
@@ -1343,7 +1366,9 @@
 STR_NETWORK_GAME_NAME                                           :{BLACK}Nume
 STR_NETWORK_GAME_NAME_TIP                                       :{BLACK}Numele jocului
 STR_NETWORK_INFO_ICONS_TIP                                      :{BLACK}Limba, versiunea serverului, etc.
-STR_NETWORK_CLICK_GAME_TO_SELECT                                :{BLACK}Click pe un joc din listã pentru a-l selecta
+STR_NETWORK_CLICK_GAME_TO_SELECT                                :{BLACK}Clic pe un joc din listă pentru a-l selecta
+STR_NETWORK_LAST_JOINED_SERVER                                  :{BLACK}Server-ul la care v-aţi conectat data trecută:
+STR_NETWORK_CLICK_TO_SELECT_LAST                                :{BLACK}Clic pentru a alege serverul de data trecută
 
 STR_NETWORK_FIND_SERVER                                         :{BLACK}Caută server
 STR_NETWORK_FIND_SERVER_TIP                                     :{BLACK}Caută un server în reţea
@@ -1353,7 +1378,7 @@
 
 STR_NETWORK_GENERAL_ONLINE                                      :{BLACK}{COMMA}/{COMMA} - {COMMA}/{COMMA}
 STR_NETWORK_CLIENTS_CAPTION                                     :{BLACK}Clienţi
-STR_NETWORK_CLIENTS_CAPTION_TIP                                 :{BLACK}Clienti online / Nr. max. clienti
+STR_NETWORK_CLIENTS_CAPTION_TIP                                 :{BLACK}Clienţi online / Nr. max. clienţi{}Companii online / Nr. max. companii
 STR_NETWORK_GAME_INFO                                           :{SILVER}INFO JOC
 STR_ORANGE                                                      :{ORANGE}{STRING}
 STR_NETWORK_CLIENTS                                             :{SILVER}Clienţi:  {WHITE}{COMMA} / {COMMA} - {COMMA} / {COMMA}
@@ -1377,10 +1402,11 @@
 
 STR_NETWORK_NEW_GAME_NAME                                       :{BLACK}Nume joc:
 STR_NETWORK_NEW_GAME_NAME_TIP                                   :{BLACK}Numele jocului va fi afisat celorlalti în meniul de selectare al jocurilor multiplayer
+STR_NETWORK_NEW_GAME_NAME_OSKTITLE                              :{BLACK}Introduceţi un nume pentru joc
 STR_NETWORK_SET_PASSWORD                                        :{BLACK}Pune parola
 STR_NETWORK_PASSWORD_TIP                                        :{BLACK}Protejeazã-ti jocul cu o parolã dacã nu vrei sã intre jucãtori neautorizati
-STR_NETWORK_SELECT_MAP                                          :{BLACK}Alege o hartã:
-STR_NETWORK_SELECT_MAP_TIP                                      :{BLACK}Ce hartã doresti sa joci?
+STR_NETWORK_SELECT_MAP                                          :{BLACK}Alege o hartă:
+STR_NETWORK_SELECT_MAP_TIP                                      :{BLACK}Ce hartă doreşti să joci?
 STR_NETWORK_LAN_INTERNET_COMBO                                  :{BLACK}{SKIP}{STRING}
 STR_NETWORK_LAN                                                 :LAN
 STR_NETWORK_INTERNET                                            :Internet
@@ -1388,13 +1414,13 @@
 STR_NETWORK_INTERNET_ADVERTISE                                  :Internet (fă reclamă)
 STR_NETWORK_CLIENTS_SELECT                                      :{BLACK}{SKIP}{SKIP}{NUM} client{P "" i}
 STR_NETWORK_NUMBER_OF_CLIENTS                                   :{BLACK}Numar maxim de clienti
-STR_NETWORK_NUMBER_OF_CLIENTS_TIP                               :{BLACK}Alege un numar maxim de clienti. Nu trebuie ocupate toate locurile.
+STR_NETWORK_NUMBER_OF_CLIENTS_TIP                               :{BLACK}Alege un număr maxim de clienţi. Nu trebuie ocupate toate locurile.
 STR_NETWORK_COMPANIES_SELECT                                    :{BLACK}{SKIP}{SKIP}{SKIP}{NUM} compan{P ie ii}
 STR_NETWORK_NUMBER_OF_COMPANIES                                 :{BLACK}Maximum companii:
-STR_NETWORK_NUMBER_OF_COMPANIES_TIP                             :{BLACK}Limiteazã serverle la un anumit numãr companii
+STR_NETWORK_NUMBER_OF_COMPANIES_TIP                             :{BLACK}Limitează serverul la un anumit număr de companii
 STR_NETWORK_SPECTATORS_SELECT                                   :{BLACK}{SKIP}{SKIP}{SKIP}{SKIP}{NUM} spectator{P "" i}
 STR_NETWORK_NUMBER_OF_SPECTATORS                                :{BLACK}Maxim spectatori:
-STR_NETWORK_NUMBER_OF_SPECTATORS_TIP                            :{BLACK}Limiteazã serverul la un anumit numãr de spectatori
+STR_NETWORK_NUMBER_OF_SPECTATORS_TIP                            :{BLACK}Limitează serverul la un anumit număr de spectatori
 STR_NETWORK_LANGUAGE_SPOKEN                                     :{BLACK}Limba vorbită:
 STR_NETWORK_LANGUAGE_TIP                                        :{BLACK}Ceilalţi jucători vor şti în ce limbă se discută pe server.
 STR_NETWORK_LANGUAGE_COMBO                                      :{BLACK}{SKIP}{SKIP}{SKIP}{SKIP}{SKIP}{STRING}
@@ -1433,16 +1459,21 @@
 STR_NETWORK_LANG_SWEDISH                                        :Suedeza
 STR_NETWORK_LANG_TURKISH                                        :Turca
 STR_NETWORK_LANG_UKRAINIAN                                      :Ucrainiana
+STR_NETWORK_LANG_CROATIAN                                       :Croată
+STR_NETWORK_LANG_CATALAN                                        :Catalană
+STR_NETWORK_LANG_ESTONIAN                                       :Estonă
+STR_NETWORK_LANG_GREEK                                          :Greacă
+STR_NETWORK_LANG_LATVIAN                                        :Letonă
 ############ End of leave-in-this-order
 
 STR_NETWORK_GAME_LOBBY                                          :{WHITE}Chatul jocului multiplayer
 
 STR_NETWORK_PREPARE_TO_JOIN                                     :{BLACK}In pregatire pentru joc:   {ORANGE}{STRING}
 STR_NETWORK_COMPANY_LIST_TIP                                    :{BLACK}Lista companiilor din jocul curent. Poti colabora cu o companie sau sa infiintezi una
-STR_NETWORK_NEW_COMPANY                                         :{BLACK}Companie nouã
-STR_NETWORK_NEW_COMPANY_TIP                                     :{BLACK}Fondeazã o nouã companie
+STR_NETWORK_NEW_COMPANY                                         :{BLACK}Companie nouă
+STR_NETWORK_NEW_COMPANY_TIP                                     :{BLACK}Fondează o companie nouă
 STR_NETWORK_SPECTATE_GAME                                       :{BLACK}Modul spectator
-STR_NETWORK_SPECTATE_GAME_TIP                                   :{BLACK}Vizioneazã un joc din pozitia unui spectator
+STR_NETWORK_SPECTATE_GAME_TIP                                   :{BLACK}Vizionează jocul din poziţia de spectator
 STR_NETWORK_JOIN_COMPANY                                        :{BLACK}Alătură-te companiei
 STR_NETWORK_JOIN_COMPANY_TIP                                    :{BLACK}Ajută la conducerea acestei companii
 STR_NETWORK_REFRESH                                             :{BLACK}Actualizeaza serverul
@@ -1531,7 +1562,7 @@
 STR_NETWORK_CHAT_TO_CLIENT                                      :[Private] pentru {STRING}: {GRAY}{STRING}
 STR_NETWORK_CHAT_ALL_CAPTION                                    :[All] :
 STR_NETWORK_CHAT_ALL                                            :[All] {STRING}: {GRAY}{STRING}
-STR_NETWORK_NAME_CHANGE                                         :si-a schimbat numele in
+STR_NETWORK_NAME_CHANGE                                         :şi-a schimbat numele în
 STR_NETWORK_SERVER_SHUTDOWN                                     :{WHITE}Serverul a inchis conexiunea
 STR_NETWORK_SERVER_REBOOT                                       :{WHITE}Serverul este repornit...{}Va rugam asteptati...
 
@@ -1571,12 +1602,12 @@
 STR_0801_COST                                                   :{RED}Cheltuieli: {CURRENCY}
 STR_0802_INCOME                                                 :{TINYFONT}{GREEN}Venituri: {CURRENCY}
 STR_0803_INCOME                                                 :{GREEN}Venituri: {CURRENCY}
-STR_FEEDER_TINY                                                 :{TINYFONT}{YELLOW}Transferã: {CURRENCY}
-STR_FEEDER                                                      :{YELLOW}Transferã: {CURRENCY}
+STR_FEEDER_TINY                                                 :{TINYFONT}{YELLOW}Transferă: {CURRENCY}
+STR_FEEDER                                                      :{YELLOW}Transferă: {CURRENCY}
 STR_0805_ESTIMATED_COST                                         :{WHITE}Cost estimat: {CURRENCY}
 STR_0807_ESTIMATED_INCOME                                       :{WHITE}Venit estimat: {CURRENCY}
-STR_0808_CAN_T_RAISE_LAND_HERE                                  :{WHITE}Nu pot înălţa terenul...
-STR_0809_CAN_T_LOWER_LAND_HERE                                  :{WHITE}Nu pot coborî terenul...
+STR_0808_CAN_T_RAISE_LAND_HERE                                  :{WHITE}Nu se poate înălţa terenul...
+STR_0809_CAN_T_LOWER_LAND_HERE                                  :{WHITE}Nu se poate coborî terenul...
 STR_080A_ROCKS                                                  :Stânci
 STR_080B_ROUGH_LAND                                             :Teren pietros
 STR_080C_BARE_LAND                                              :Teren viran
@@ -1594,17 +1625,18 @@
 STR_1005_NO_SUITABLE_RAILROAD_TRACK                             :{WHITE}Cale ferată nepotrivită
 STR_1007_ALREADY_BUILT                                          :{WHITE}...deja construit
 STR_1008_MUST_REMOVE_RAILROAD_TRACK                             :{WHITE}Mai întâi trebuie înlăturată calea ferată
+STR_ERR_CROSSING_ON_ONEWAY_ROAD                                 :{WHITE}Drum cu sens unic sau blocat
 STR_100A_RAILROAD_CONSTRUCTION                                  :{WHITE}Construcţii feroviare
 STR_TITLE_ELRAIL_CONSTRUCTION                                   :{WHITE}Construcţie Cale Ferată Electrificată
 STR_100B_MONORAIL_CONSTRUCTION                                  :{WHITE}Construcţii monoşină
 STR_100C_MAGLEV_CONSTRUCTION                                    :{WHITE}Construcţii maglev
 STR_100D_SELECT_RAIL_BRIDGE                                     :{WHITE}Alege podul de cale ferată
-STR_100E_CAN_T_BUILD_TRAIN_DEPOT                                :{WHITE}Nu pot construi un depou feroviar aici...
-STR_100F_CAN_T_BUILD_RAILROAD_STATION                           :{WHITE}Nu pot construi o gară aici...
-STR_1010_CAN_T_BUILD_SIGNALS_HERE                               :{WHITE}Nu pot plasa semafoare aici...
-STR_1011_CAN_T_BUILD_RAILROAD_TRACK                             :{WHITE}Nu pot construi cale ferată aici...
-STR_1012_CAN_T_REMOVE_RAILROAD_TRACK                            :{WHITE}Nu pot înlătura calea ferată...
-STR_1013_CAN_T_REMOVE_SIGNALS_FROM                              :{WHITE}Nu pot înlătura semafoarele de aici...
+STR_100E_CAN_T_BUILD_TRAIN_DEPOT                                :{WHITE}Nu se poate construi depou feroviar aici...
+STR_100F_CAN_T_BUILD_RAILROAD_STATION                           :{WHITE}Nu se poate construi o gară aici...
+STR_1010_CAN_T_BUILD_SIGNALS_HERE                               :{WHITE}Nu se pot plasa semafoare aici...
+STR_1011_CAN_T_BUILD_RAILROAD_TRACK                             :{WHITE}Nu se poate construi cale ferată aici...
+STR_1012_CAN_T_REMOVE_RAILROAD_TRACK                            :{WHITE}Nu se poate înlătura calea ferată...
+STR_1013_CAN_T_REMOVE_SIGNALS_FROM                              :{WHITE}Nu se pot înlătura semafoarele de aici...
 STR_1014_TRAIN_DEPOT_ORIENTATION                                :{WHITE}Orientarea depoului feroviar
 STR_1015_RAILROAD_CONSTRUCTION                                  :Construcţii feroviare
 STR_TOOLB_ELRAIL_CONSTRUCTION                                   :Construcţie cale ferată electrificată
@@ -1643,16 +1675,16 @@
 STR_WHITE_TRAMWAY_CONSTRUCTION                                  :{WHITE}Construcţie Tramvai
 STR_1803_SELECT_ROAD_BRIDGE                                     :{WHITE}Alege pod rutier
 STR_ERR_ONEWAY_ROADS_CAN_T_HAVE_JUNCTION                        :{WHITE}... drumurile cu sens unic nu pot avea bifurcatii
-STR_1804_CAN_T_BUILD_ROAD_HERE                                  :{WHITE}Nu pot construi şosea aici...
+STR_1804_CAN_T_BUILD_ROAD_HERE                                  :{WHITE}Nu se poate construi şosea aici...
 STR_CAN_T_BUILD_TRAMWAY_HERE                                    :{WHITE}Nu pot construi şină de tramvai aici...
-STR_1805_CAN_T_REMOVE_ROAD_FROM                                 :{WHITE}Nu pot înlătura şoseaua...
+STR_1805_CAN_T_REMOVE_ROAD_FROM                                 :{WHITE}Nu se poate înlătura şoseaua...
 STR_CAN_T_REMOVE_TRAMWAY_FROM                                   :{WHITE}Nu pot înlătura şina de tramvai de aici...
 STR_1806_ROAD_DEPOT_ORIENTATION                                 :{WHITE}Orientarea autobazei
 STR_TRAM_DEPOT_ORIENTATION                                      :{WHITE}Orientarea Depoului de Tramvaie
-STR_1807_CAN_T_BUILD_ROAD_VEHICLE                               :{WHITE}Nu pot construi autobază aici...
+STR_1807_CAN_T_BUILD_ROAD_VEHICLE                               :{WHITE}Nu se poate construi autobază aici...
 STR_CAN_T_BUILD_TRAM_VEHICLE                                    :{WHITE}Nu pot construi depou de tramvaie aici...
-STR_1808_CAN_T_BUILD_BUS_STATION                                :{WHITE}Nu pot construi staţie de autobuz...
-STR_1809_CAN_T_BUILD_TRUCK_STATION                              :{WHITE}Nu pot construi platformă pentru camioane...
+STR_1808_CAN_T_BUILD_BUS_STATION                                :{WHITE}Nu se poate construi staţie de autobuz...
+STR_1809_CAN_T_BUILD_TRUCK_STATION                              :{WHITE}Nu se poate construi platformă pentru camioane...
 STR_CAN_T_BUILD_PASSENGER_TRAM_STATION                          :{WHITE}Nu pot construi staţie de tramvai aici...
 STR_CAN_T_BUILD_CARGO_TRAM_STATION                              :{WHITE}Nu pot construi staţie de tramvai aici...
 STR_180A_ROAD_CONSTRUCTION                                      :Construcţii rutiere
@@ -1673,7 +1705,7 @@
 STR_BUILD_TRAMWAY_TUNNEL                                        :{BLACK}Construieşte tunel pentru tramvaie
 STR_TOGGLE_ONE_WAY_ROAD                                         :{BLACK}Activare/Dezactivare sensuri unice
 STR_1811_TOGGLE_BUILD_REMOVE_FOR                                :{BLACK}Comutator pentru construcţie/înlăturare şosele
-STR_TOGGLE_BUILD_REMOVE_FOR_TRAMWAYS                            :{BLACK}Comuta constructie/stergere pentru constructia de linii de tramvaie
+STR_TOGGLE_BUILD_REMOVE_FOR_TRAMWAYS                            :{BLACK}Comută construcţie/eliminare pentru şine de tramvai
 STR_1813_SELECT_ROAD_VEHICLE_DEPOT                              :{BLACK}Alege orientarea autobazei
 STR_SELECT_TRAM_VEHICLE_DEPOT                                   :{BLACK}Alege orientarea depoului de tramvaie
 STR_1814_ROAD                                                   :Şosea
@@ -1681,6 +1713,7 @@
 STR_1816_TREE_LINED_ROAD                                        :Stradă cu copaci pe margine
 STR_1817_ROAD_VEHICLE_DEPOT                                     :Autobază
 STR_1818_ROAD_RAIL_LEVEL_CROSSING                               :Trecere la nivel cu calea ferată
+STR_TRAMWAY                                                     :Şină de tramvai
 STR_CAN_T_REMOVE_BUS_STATION                                    :{WHITE}Nu pot elimina statia de autobus...
 STR_CAN_T_REMOVE_TRUCK_STATION                                  :{WHITE}Nu pot elimina statia de camioane...
 STR_CAN_T_REMOVE_PASSENGER_TRAM_STATION                         :{WHITE}Nu pot înlătura staţia de tramvai...
@@ -1696,9 +1729,10 @@
 STR_2002_WHITE                                                  :{TINYFONT}{WHITE}{SIGN}
 STR_2004_BUILDING_MUST_BE_DEMOLISHED                            :{WHITE}Mai întâi trebuie demolată clădirea
 STR_2005                                                        :{WHITE}{TOWN}
+STR_CITY                                                        :{WHITE}{TOWN} (Oraş)
 STR_2006_POPULATION                                             :{BLACK}Populaţia: {ORANGE}{COMMA}{BLACK}  Locuinţe: {ORANGE}{COMMA}
 STR_2007_RENAME_TOWN                                            :Redenumire oraş
-STR_2008_CAN_T_RENAME_TOWN                                      :{WHITE}Nu pot redenumi oraşul...
+STR_2008_CAN_T_RENAME_TOWN                                      :{WHITE}Nu se poate redenumi oraşul...
 STR_2009_LOCAL_AUTHORITY_REFUSES                                :{WHITE}Autorităţile locale din {TOWN} refuză să permită această acţiune
 STR_200A_TOWN_NAMES_CLICK_ON_NAME                               :{BLACK}Numele oraşelor - clic pe un nume pentru a centra imaginea pe oraşul respectiv
 STR_200B_CENTER_THE_MAIN_VIEW_ON                                :{BLACK}Mută imaginea pe locaţia oraşului
@@ -1766,7 +1800,7 @@
 STR_204A_BUILD_STATUE_OF_COMPANY                                :Ridică un monument dedicat preşedintelui companiei
 STR_204B_FUND_NEW_BUILDINGS                                     :Finanţează construcţia de noi clădiri
 STR_204C_BUY_EXCLUSIVE_TRANSPORT                                :Cumpără drepturi exclusive de transport
-STR_TOWN_BRIBE_THE_LOCAL_AUTHORITY                              :Mituieste autoritatea localã
+STR_TOWN_BRIBE_THE_LOCAL_AUTHORITY                              :Mituieşte autoritatea locală
 STR_204D_INITIATE_A_SMALL_LOCAL                                 :{WHITE}{STRING}{}{YELLOW} Iniţiază o campanie publicitară mică pentru a atrage mai mulţi călători şi mai multe mărfuri spre compania ta.{}  Cost: {CURRENCY}
 STR_204E_INITIATE_A_MEDIUM_LOCAL                                :{WHITE}{STRING}{}{YELLOW} Iniţiază o campanie publicitară medie pentru a atrage mai mulţi călători şi mai multe mărfuri spre compania ta.{}  Cost: {CURRENCY}
 STR_204F_INITIATE_A_LARGE_LOCAL                                 :{WHITE}{STRING}{}{YELLOW} Iniţiază o mare campanie publicitară pentru a atrage mai mulţi călători şi mai multe mărfuri spre compania ta.{}  Cost: {CURRENCY}
@@ -1796,13 +1830,13 @@
 STR_2802_TREES                                                  :{WHITE}Arbori
 STR_2803_TREE_ALREADY_HERE                                      :{WHITE}...sunt deja plantaţi arbori
 STR_2804_SITE_UNSUITABLE                                        :{WHITE}...locaţie nepotrivită
-STR_2805_CAN_T_PLANT_TREE_HERE                                  :{WHITE}Nu pot planta arbori aici...
+STR_2805_CAN_T_PLANT_TREE_HERE                                  :{WHITE}Nu se pot planta arbori aici...
 STR_2806                                                        :{WHITE}{SIGN}
 STR_2808_TOO_MANY_SIGNS                                         :{WHITE}...prea multe semne
-STR_2809_CAN_T_PLACE_SIGN_HERE                                  :{WHITE}Nu pot plasa un semn aici...
+STR_2809_CAN_T_PLACE_SIGN_HERE                                  :{WHITE}Nu se poate plasa un semn aici...
 STR_280A_SIGN                                                   :Semn
 STR_280B_EDIT_SIGN_TEXT                                         :{WHITE}Editează textul semnului
-STR_280C_CAN_T_CHANGE_SIGN_NAME                                 :{WHITE}Nu pot schimba numele semnului...
+STR_280C_CAN_T_CHANGE_SIGN_NAME                                 :{WHITE}Nu se poate schimba numele semnului...
 STR_280D_SELECT_TREE_TYPE_TO_PLANT                              :{BLACK}Alege specia de arbori de plantat
 STR_280E_TREES                                                  :Arbori
 STR_280F_RAINFOREST                                             :Pădure tropicală
@@ -1827,7 +1861,7 @@
 STR_300E_MUST_DEMOLISH_AIRPORT_FIRST                            :{WHITE}Mai întâi trebuie demolat aeroportul
 
 STR_3030_RENAME_STATION_LOADING                                 :Redenumeşte staţia
-STR_3031_CAN_T_RENAME_STATION                                   :{WHITE}Nu pot redenumi staţia...
+STR_3031_CAN_T_RENAME_STATION                                   :{WHITE}Nu se poate redenumi staţia...
 STR_3032_RATINGS                                                :{BLACK}Evaluări
 STR_3033_ACCEPTS                                                :{BLACK}Acceptă
 STR_3034_LOCAL_RATING_OF_TRANSPORT                              :{BLACK}Evaluarea serviciilor de transport local:
@@ -1868,7 +1902,7 @@
 STR_3051_SELECT_BUS_STATION_ORIENTATION                         :{BLACK}Alege orientarea staţiei de autobuz
 STR_3052_SELECT_TRUCK_LOADING_BAY                               :{BLACK}Alege orientarea platformei pentru camioane
 STR_SELECT_PASSENGER_TRAM_STATION_ORIENTATION                   :{BLACK}Alege orientarea staţiei de tramvai
-STR_SELECT_CARGO_TRAM_STATION_ORIENTATION                       :{BLACK}Alege orientarea staţiei de tramvai
+STR_SELECT_CARGO_TRAM_STATION_ORIENTATION                       :{BLACK}Alege orientarea platformei de tramvai
 STR_3053_CENTER_MAIN_VIEW_ON_STATION                            :{BLACK}Centrează imaginea pe locaţia staţiei
 STR_3054_SHOW_STATION_RATINGS                                   :{BLACK}Afişează evaluările staţiei
 STR_3055_CHANGE_NAME_OF_STATION                                 :{BLACK}Schimbă numele staţiei
@@ -1900,12 +1934,12 @@
 ##id 0x3800
 STR_3800_SHIP_DEPOT_ORIENTATION                                 :{WHITE}Orientarea şantierului naval
 STR_3801_MUST_BE_BUILT_ON_WATER                                 :{WHITE}...trebuie construit pe apă
-STR_3802_CAN_T_BUILD_SHIP_DEPOT                                 :{WHITE}Nu pot construi un şantier naval aici...
+STR_3802_CAN_T_BUILD_SHIP_DEPOT                                 :{WHITE}Nu se poate construi şantier naval aici...
 STR_3803_SELECT_SHIP_DEPOT_ORIENTATION                          :{BLACK}Alege orientarea şantierului naval
 STR_3804_WATER                                                  :Apă
 STR_3805_COAST_OR_RIVERBANK                                     :Mal/Coastă
 STR_3806_SHIP_DEPOT                                             :Şantier naval
-STR_3807_CAN_T_BUILD_ON_WATER                                   :{WHITE}...Nu pot construi pe apă
+STR_3807_CAN_T_BUILD_ON_WATER                                   :{WHITE}...Nu se poate construi pe apă
 STR_MUST_DEMOLISH_CANAL_FIRST                                   :{WHITE}Trebuie sa demolezi canalul inainte
 
 ##id 0x4000
@@ -1915,7 +1949,7 @@
 STR_4003_DELETE                                                 :{BLACK}Şterge
 STR_4004                                                        :{COMPANY}, {DATE_LONG}
 STR_4005_BYTES_FREE                                             :{BLACK}{COMMA} megabyte{P "" s} liberi
-STR_4006_UNABLE_TO_READ_DRIVE                                   :{BLACK}Nu pot citi acest disc
+STR_4006_UNABLE_TO_READ_DRIVE                                   :{BLACK}Discul nu a putut fi citit
 STR_4007_GAME_SAVE_FAILED                                       :{WHITE}Salvarea jocului eşuată{}{STRING}
 STR_4008_UNABLE_TO_DELETE_FILE                                  :{WHITE}Ştergerea jocului eşuată
 STR_4009_GAME_LOAD_FAILED                                       :{WHITE}Încărcarea jocului eşuată{}{STRING}
@@ -1932,13 +1966,14 @@
 STR_400F_SELECT_SCENARIO_GREEN_PRE                              :{BLACK}Alege un scenariu (verde), un joc predefinit (albastru) sau o hartă aleatoare
 STR_4010_GENERATE_RANDOM_NEW_GAME                               :Generează o hartă aleatoare
 STR_LOAD_HEIGHTMAP                                              :{WHITE}Încarcă harta înălţimilor
+STR_SAVE_OSKTITLE                                               :{BLACK}Introduceţi un nume pentru salvare
 
 ##id 0x4800
 STR_4800_IN_THE_WAY                                             :{WHITE}{STRING} în cale
 STR_4801                                                        :{WHITE}{INDUSTRY}
 STR_4802_COAL_MINE                                              :Mină de cărbune
 STR_4803_POWER_STATION                                          :Termocentrală
-STR_4804_SAWMILL                                                :Exploataţie forestieră
+STR_4804_SAWMILL                                                :Fabrică de cherestea
 STR_4805_FOREST                                                 :Pădure
 STR_4806_OIL_REFINERY                                           :Rafinărie
 STR_4807_OIL_RIG                                                :Platformă petrolieră
@@ -2029,8 +2064,8 @@
 STR_5013_CONCRETE                                               :Beton
 STR_5014_TUBULAR_STEEL                                          :Tubular (oţel)
 STR_BRIDGE_TUBULAR_SILICON                                      :Tubular (silicon)
-STR_5015_CAN_T_BUILD_BRIDGE_HERE                                :{WHITE}Nu pot construi pod aici...
-STR_5016_CAN_T_BUILD_TUNNEL_HERE                                :{WHITE}Nu pot construi tunel aici...
+STR_5015_CAN_T_BUILD_BRIDGE_HERE                                :{WHITE}Nu se poate construi pod aici...
+STR_5016_CAN_T_BUILD_TUNNEL_HERE                                :{WHITE}Nu se poate construi tunel aici...
 STR_5017_RAILROAD_TUNNEL                                        :Tunel feroviar
 STR_5018_ROAD_TUNNEL                                            :Tunel rutier
 STR_501B_STEEL_SUSPENSION_RAIL_BRIDGE                           :Pod feroviar suspendat din oţel
@@ -2108,7 +2143,7 @@
 
 ##id 0x6800
 STR_6800_DIFFICULTY_LEVEL                                       :{WHITE}Nivel de dificultate
-STR_OPTIONS_SAVE_CHANGES                                        :{BLACK}Salveazã
+STR_OPTIONS_SAVE_CHANGES                                        :{BLACK}Salvează
 
 ############ range for difficulty levels starts
 STR_6801_EASY                                                   :{BLACK}Uşor
@@ -2192,8 +2227,8 @@
 STR_7009_PRESIDENT_NAME                                         :{BLACK}Numele preşedintelui
 STR_700A_COMPANY_NAME                                           :Noul nume al companiei
 STR_700B_PRESIDENT_S_NAME                                       :Noul nume al preşedintelui
-STR_700C_CAN_T_CHANGE_COMPANY_NAME                              :{WHITE}Nu pot schimba numele companiei...
-STR_700D_CAN_T_CHANGE_PRESIDENT                                 :{WHITE}Nu pot schimba numele preşedintelui...
+STR_700C_CAN_T_CHANGE_COMPANY_NAME                              :{WHITE}Nu se poate schimba numele companiei...
+STR_700D_CAN_T_CHANGE_PRESIDENT                                 :{WHITE}Nu se poate schimba numele preşedintelui...
 STR_700E_FINANCES                                               :{WHITE}Situaţia financiară a companiei {COMPANY} {BLACK}{COMPANYNUM}
 STR_700F_EXPENDITURE_INCOME                                     :{WHITE}Cheltuieli/Venituri
 STR_7010                                                        :{WHITE}{NUM}
@@ -2229,7 +2264,7 @@
 STR_702D_LOAN_ALREADY_REPAYED                                   :{WHITE}...nu ai nici un credit de plătit
 STR_702E_REQUIRED                                               :{WHITE}...ai nevoie de {CURRENCY}
 STR_702F_CAN_T_REPAY_LOAN                                       :{WHITE}Nu poţi plăti creditul...
-STR_INSUFFICIENT_FUNDS                                          :{WHITE}Nu poti dona din banii împrumutati de bancã...
+STR_INSUFFICIENT_FUNDS                                          :{WHITE}Nu poţi dona din banii împrumutaţi de la bancă...
 STR_7030_SELECT_NEW_FACE_FOR_PRESIDENT                          :{BLACK}Alege o nouă poză a preşedintelui
 STR_7031_CHANGE_THE_COMPANY_VEHICLE                             :{BLACK}Schimbă culoarea care îţi reprezintă compania
 STR_7032_CHANGE_THE_PRESIDENT_S                                 :{BLACK}Schimbă numele preşedintelui
@@ -2242,7 +2277,7 @@
 STR_7039_VEHICLES                                               :{GOLD}Vehicule:
 STR_TRAINS                                                      :{WHITE}{COMMA} tren{P "" uri}
 STR_ROAD_VEHICLES                                               :{WHITE}{COMMA} autovehicul{P "" e}
-STR_AIRCRAFT                                                    :{WHITE}{COMMA} aeronav{P ã e}
+STR_AIRCRAFT                                                    :{WHITE}{COMMA} aeronav{P ă e}
 STR_SHIPS                                                       :{WHITE}{COMMA} nav{P ã e}
 STR_7042_NONE                                                   :{WHITE}Nici unul
 STR_7043_FACE_SELECTION                                         :{WHITE}Alegerea pozei
@@ -2274,7 +2309,7 @@
 STR_705D_HAS_BEEN_CLOSED_DOWN_BY                                :{BLACK}{BIGFONT}Compania {COMPANY} a fost închisă şi toate activele au fost valorificate de creditori!
 STR_705E_NEW_TRANSPORT_COMPANY_LAUNCHED                         :{BLACK}{BIGFONT}A apărut o nouă companie!
 STR_705F_STARTS_CONSTRUCTION_NEAR                               :{BLACK}{BIGFONT}{COMPANY} şi-a stabilit sediul lângă {TOWN}!
-STR_7060_CAN_T_BUY_COMPANY                                      :{WHITE}Nu pot cumpăra compania...
+STR_7060_CAN_T_BUY_COMPANY                                      :{WHITE}Nu se poate cumpăra compania...
 STR_7061_CARGO_PAYMENT_RATES                                    :{WHITE}Preţurile transportului de călători şi mărfuri
 STR_7062_DAYS_IN_TRANSIT                                        :{BLACK}{TINYFONT}Zile în tranzit
 STR_7063_PAYMENT_FOR_DELIVERING                                 :{BLACK}{TINYFONT}Plata pentru livrarea a 10 unităţi (sau 10.000 de litri) de marfă pe o distanţă de 20 de pătrăţele
@@ -2292,7 +2327,7 @@
 STR_706F_BUILD_HQ                                               :{BLACK}Construieşte sediu
 STR_7070_BUILD_COMPANY_HEADQUARTERS                             :{BLACK}Construieşte sau arată sediul companiei
 STR_RELOCATE_COMPANY_HEADQUARTERS                               :{BLACK}Muta sediul companiei (costa 1% din valoarea companiei)
-STR_7071_CAN_T_BUILD_COMPANY_HEADQUARTERS                       :{WHITE}Nu pot construi sediul...
+STR_7071_CAN_T_BUILD_COMPANY_HEADQUARTERS                       :{WHITE}Nu se poate construi sediul...
 STR_7072_VIEW_HQ                                                :{BLACK}Vezi sediul
 STR_RELOCATE_HQ                                                 :{BLACK}Muta sediu
 STR_COMPANY_PASSWORD                                            :{BLACK}Parola
@@ -2311,8 +2346,8 @@
 STR_7078_SELL_25_SHARE_IN_COMPANY                               :{BLACK}Vinde 25% din acţiunile companiei
 STR_7079_BUY_25_SHARE_IN_THIS_COMPANY                           :{BLACK}Cumpără 25% din acţiunile acestei companii
 STR_707A_SELL_25_SHARE_IN_THIS_COMPANY                          :{BLACK}Vinde 25% din acţiunile acestei companii
-STR_707B_CAN_T_BUY_25_SHARE_IN_THIS                             :{WHITE}Nu pot cumpăra 25% din acţiunile acestei companii...
-STR_707C_CAN_T_SELL_25_SHARE_IN                                 :{WHITE}Nu pot vinde 25% din acţiunile acestei companii...
+STR_707B_CAN_T_BUY_25_SHARE_IN_THIS                             :{WHITE}Nu se pot cumpăra 25% din acţiunile acestei companii...
+STR_707C_CAN_T_SELL_25_SHARE_IN                                 :{WHITE}Nu se pot vinde 25% din acţiunile acestei companii...
 STR_707D_OWNED_BY                                               :{WHITE}({COMMA}% deţinute de {COMPANY})
 STR_707F_HAS_BEEN_TAKEN_OVER_BY                                 :{BLACK}{BIGFONT}{COMPANY} a fost preluată de {COMPANY}!
 STR_PROTECTED                                                   :{WHITE}Această companie încă nu vinde acţiuni...
@@ -2328,6 +2363,8 @@
 STR_LIVERY_PASSENGER_WAGON_STEAM                                :Vagon de călători (Aburi)
 STR_LIVERY_PASSENGER_WAGON_DIESEL                               :Vagon de călători (Diesel)
 STR_LIVERY_PASSENGER_WAGON_ELECTRIC                             :Vagon de călători (Electric)
+STR_LIVERY_PASSENGER_WAGON_MONORAIL                             :Vagon pentru Pasageri (Monoşină)
+STR_LIVERY_PASSENGER_WAGON_MAGLEV                               :Vagon pentru Pasageri (Pernă Magnetică)
 STR_LIVERY_FREIGHT_WAGON                                        :Vagon de marfa
 STR_LIVERY_BUS                                                  :Autobus
 STR_LIVERY_TRUCK                                                :Camion
@@ -2344,8 +2381,8 @@
 STR_LIVERY_ROADVEH_TIP                                          :{BLACK}Arata schemele de culori pentru autovehiculele rutiere
 STR_LIVERY_SHIP_TIP                                             :{BLACK}Arata schemele de culori pentru vase
 STR_LIVERY_AIRCRAFT_TIP                                         :{BLACK}Arata schemele de culori pentru avioane
-STR_LIVERY_PRIMARY_TIP                                          :{BLACK}Alege culoarea primara pentru schema selectata
-STR_LIVERY_SECONDARY_TIP                                        :{BLACK}Alege culoarea secundara pentru schema selectata
+STR_LIVERY_PRIMARY_TIP                                          :{BLACK}Alege culoarea primară pentru schema selectată
+STR_LIVERY_SECONDARY_TIP                                        :{BLACK}Alege culoarea secundară pentru schema selectată
 STR_LIVERY_PANEL_TIP                                            :{BLACK}Alege o schema de culori pentru modificare sau mai multe scheme, folosind CTRL+click. Apasa pe casuta pentru a comuta schema
 
 ##id 0x8000
@@ -2619,11 +2656,72 @@
 STR_8801_CITIZENS_CELEBRATE_FIRST                               :{BLACK}{BIGFONT}Cetăţenii sărbătoresc {}sosirea primului tren la {STATION}!
 STR_8802_DETAILS                                                :{WHITE}{VEHICLE} (Detalii)
 STR_8803_TRAIN_IN_THE_WAY                                       :{WHITE}Tren în drum
+STR_8804                                                        :{SETX 10}{COMMA}: {STRING} {STRING}
+STR_8805                                                        :{RIGHTARROW}{SETX 10}{COMMA}: {STRING} {STRING}
+STR_ORDER_GO_TO                                                 :Du-te la
+STR_ORDER_GO_NON_STOP_TO                                        :Du-te fără oprire la
+STR_ORDER_GO_VIA                                                :Du-te prin
+STR_ORDER_GO_NON_STOP_VIA                                       :Du-te fără oprire prin
+STR_ORDER_DROP_FULL_LOAD_ALL                                    :Încarcă toate produsele
+STR_ORDER_DROP_FULL_LOAD_ANY                                    :Încarcă orice produs
+STR_ORDER_DROP_NO_LOADING                                       :Nu încărca
+STR_ORDER_DROP_UNLOAD_IF_ACCEPTED                               :Descarcă dacă este cerere
+STR_ORDER_DROP_UNLOAD                                           :Descarcă tot
+STR_ORDER_DROP_TRANSFER                                         :Transferă
+STR_ORDER_DROP_NO_UNLOADING                                     :Nu descărca
+STR_ORDER_FULL_LOAD                                             :(Încărcare maximă)
+STR_ORDER_FULL_LOAD_ANY                                         :(Încărcare orice produs)
+STR_ORDER_NO_LOAD                                               :(Fără încărcare)
+STR_ORDER_UNLOAD_FULL_LOAD                                      :(Descarcă şi aşteaptă încărcare maximă)
+STR_ORDER_UNLOAD_FULL_LOAD_ANY                                  :(Descarcă şi aşteaptă orice încărcătură)
+STR_ORDER_UNLOAD_NO_LOAD                                        :(Descarcă şi pleacă)
+STR_ORDER_TRANSFER                                              :(Transferă - preia încărcătura)
+STR_ORDER_TRANSFER_FULL_LOAD                                    :(Transferă şi aşteaptă încărcare maximă)
+STR_ORDER_TRANSFER_FULL_LOAD_ANY                                :(Transferă şi aşteaptă orice încărcătură)
+STR_ORDER_TRANSFER_NO_LOAD                                      :(Transferă - pleacă descărcat)
+STR_ORDER_NO_UNLOAD                                             :(Nu descărca şi preia încărcătura)
+STR_ORDER_NO_UNLOAD_FULL_LOAD                                   :(Nu descărca şi aşteaptă încărcare maximă)
+STR_ORDER_NO_UNLOAD_FULL_LOAD_ANY                               :(Nu descărca şi aşteaptă orice încărcătură)
+STR_ORDER_TOOLTIP_NON_STOP                                      :{BLACK}Schimbă comportamentul de oprire pentru ordinul selectat
+STR_ORDER_TOOLTIP_FULL_LOAD                                     :{BLACK}Schimbă comportamentul de încărcare pentru ordinul selectat
+STR_ORDER_TOOLTIP_UNLOAD                                        :{BLACK}Schimbă comportamentul de descărcare pentru ordinul selectat
+STR_GO_TO_STATION                                               :{STRING} {STATION} {STRING}
+
+STR_ORDER_GO_TO_DROPDOWN_TOOLTIP                                :{BLACK}Adaugă o comandă avansată
+STR_ORDER_GO_TO_NEAREST_DEPOT                                   :Du-te la cel mai apropiat depou
+STR_ORDER_GO_TO_NEAREST_HANGAR                                  :Du-te la cel mai apropiat hangar
+STR_ORDER_NEAREST_DEPOT                                         :cel mai apropiat
+STR_ORDER_NEAREST_HANGAR                                        :cel mai apropiat Hangar
+STR_ORDER_SERVICE_AT                                            :Service la
+STR_ORDER_TRAIN_DEPOT                                           :Depou de Trenuri
+STR_ORDER_ROAD_DEPOT                                            :Autobază
+STR_ORDER_SHIP_DEPOT                                            :Şantier Naval
+STR_GO_TO_DEPOT                                                 :{STRING} {TOWN} {STRING}
+STR_GO_TO_NEAREST_DEPOT                                         :{STRING} {STRING} {STRING}
+STR_GO_TO_HANGAR                                                :{STRING} {STATION} Hangar
+
+STR_ORDER_CONDITIONAL_VALUE_TOOLTIP                             :{BLACK}Valoarea cu care se compară
+STR_ORDER_CONDITIONAL_VALUE_CAPT                                :{WHITE}Introduceţi valoarea de comparat
+STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE                           :Procentaj încărcare
+STR_ORDER_CONDITIONAL_RELIABILITY                               :Eficienţă
+STR_ORDER_CONDITIONAL_MAX_SPEED                                 :Viteză maximă
+STR_ORDER_CONDITIONAL_AGE                                       :Vechime vehicol (ani)
+STR_ORDER_CONDITIONAL_REQUIRES_SERVICE                          :Necesită service
+STR_ORDER_CONDITIONAL_UNCONDITIONALLY                           :Întotdeauna
+STR_ORDER_CONDITIONAL_COMPARATOR_EQUALS                         :este egal cu
+STR_ORDER_CONDITIONAL_COMPARATOR_NOT_EQUALS                     :nu este egal cu
+STR_ORDER_CONDITIONAL_COMPARATOR_LESS_THAN                      :este mai mic decât
+STR_ORDER_CONDITIONAL_COMPARATOR_LESS_EQUALS                    :mai mic sau egal cu
+STR_ORDER_CONDITIONAL_COMPARATOR_MORE_THAN                      :este mai mare decât
+STR_ORDER_CONDITIONAL_COMPARATOR_MORE_EQUALS                    :mai mare sau egal cu
+STR_ORDER_CONDITIONAL_COMPARATOR_IS_TRUE                        :este adevărat
+STR_ORDER_CONDITIONAL_COMPARATOR_IS_FALSE                       :este fals
+STR_CONDITIONAL_VALUE                                           :{SKIP}{BLACK}{COMMA}
 
 STR_TIMETABLE_TRAVEL_NOT_TIMETABLED                             :Calatorie (fara orar)
 STR_TIMETABLE_TRAVEL_FOR                                        :Calatorii pentru {STRING}
 STR_TIMETABLE_STAY_FOR                                          :si opriri pentru {STRING}
-STR_TIMETABLE_DAYS                                              :{COMMA} zi{P "" s}
+STR_TIMETABLE_DAYS                                              :{COMMA} zi{P "" le}
 STR_TIMETABLE_TICKS                                             :{COMMA} programare{P "" s}
 
 STR_HEADING_FOR_TRAIN_DEPOT                                     :{ORANGE}Merge la Depoul {TOWN}
@@ -2648,17 +2746,17 @@
 STR_NEW_ELRAIL_VEHICLES                                         :{WHITE}Noi Vehicule Electrice pe Sine
 STR_881D_NEW_MONORAIL_VEHICLES                                  :{WHITE}Noi vehicule monoşină
 STR_881E_NEW_MAGLEV_VEHICLES                                    :{WHITE}Noi vehicule maglev
-STR_ALL_AVAIL_RAIL_VEHICLES                                     :{WHITE}Vehicule pe sine
+STR_ALL_AVAIL_RAIL_VEHICLES                                     :{WHITE}Vehicule pe şine
 
 STR_881F_BUILD_VEHICLE                                          :{BLACK}Cumpără vehicul
-STR_CLONE_ROAD_VEHICLE                                          :{BLACK}Cloneazã vehiculul
-STR_CLONE_ROAD_VEHICLE_INFO                                     :{BLACK}Acest buton va crea o copie a autovehiculului. Control+click pentru comenzi comune
-STR_CLONE_ROAD_VEHICLE_DEPOT_INFO                               :{BLACK}Acest buton va crea o copie a autovehiculului. Apasã acest buton, apoi fã click pe un autovehicul de pe hartã. Control+click pentru a-i da ordine comune
-STR_CLONE_TRAIN                                                 :{BLACK}Cloneazã trenul
-STR_CLONE_TRAIN_INFO                                            :{BLACK}Acest buton va crea o copie a întregului tren. Control+click pentru comenzi comune
-STR_CLONE_TRAIN_DEPOT_INFO                                      :{BLACK}Acest buton va crea o copie a întregului tren. Apasã acest buton, apoi fã click pe un tren de pe hartã. Control+click pentru a-i da ordine comune
+STR_CLONE_ROAD_VEHICLE                                          :{BLACK}Clonare vehicul
+STR_CLONE_ROAD_VEHICLE_INFO                                     :{BLACK}Acest buton va crea o copie a autovehiculului. Control+clic pentru comenzi sincronizate
+STR_CLONE_ROAD_VEHICLE_DEPOT_INFO                               :{BLACK}Acest buton va crea o copie a autovehiculului. Apasă acest buton, apoi fă clic pe un autovehicul din joc. Control+clic pentru a crea comenzi sincronizate
+STR_CLONE_TRAIN                                                 :{BLACK}Clonare tren
+STR_CLONE_TRAIN_INFO                                            :{BLACK}Acest buton va crea o copie a întregului tren. Control+clic pentru comenzi sincronizate
+STR_CLONE_TRAIN_DEPOT_INFO                                      :{BLACK}Acest buton va crea o copie a întregului tren. Apasă acest buton, apoi fă clic pe un tren din joc. Control+clic pentru a crea comenzi sincronizate
 STR_8820_RENAME                                                 :{BLACK}Redenumeşte
-STR_8823_SKIP                                                   :{BLACK}Sãri peste
+STR_8823_SKIP                                                   :{BLACK}Treci la următoarea
 STR_8824_DELETE                                                 :{BLACK}Şterge
 STR_8826_GO_TO                                                  :{BLACK}Mergi la
 STR_REFIT                                                       :{BLACK}Rearanjeaza
@@ -2666,30 +2764,31 @@
 STR_REFIT_ORDER                                                 :(Rearanjeaza in {STRING})
 STR_TIMETABLE_VIEW                                              :{BLACK}Orar
 STR_TIMETABLE_VIEW_TOOLTIP                                      :{BLACK}Comuta in modul de vizualizare orar
+STR_ORDER_VIEW                                                  :{BLACK}Comenzi
 STR_8829_ORDERS                                                 :{WHITE}{VEHICLE} (Comenzi)
 STR_882A_END_OF_ORDERS                                          :{SETX 10}- - Sfârşitul comenzilor - -
 STR_SERVICE                                                     :{BLACK}Service
-STR_882B_CAN_T_BUILD_RAILROAD_VEHICLE                           :{WHITE}Nu pot construi vehiculul...
+STR_882B_CAN_T_BUILD_RAILROAD_VEHICLE                           :{WHITE}Nu se poate construi vehiculul...
 STR_882C_BUILT_VALUE                                            :{LTBLUE}{ENGINE}{BLACK}   Cumpărat: {LTBLUE}{NUM}{BLACK} Valoare: {LTBLUE}{CURRENCY}
 STR_882D_VALUE                                                  :{LTBLUE}{ENGINE}{BLACK}   Valoare: {LTBLUE}{CURRENCY}
 STR_882E                                                        :{WHITE}{VEHICLE}
 STR_882F_LOADING_UNLOADING                                      :{LTBLUE}Încărcare / Descărcare
 STR_TRAIN_MUST_BE_STOPPED                                       :{WHITE}Trenul trebuie oprit intr-un depou
-STR_8830_CAN_T_SEND_TRAIN_TO_DEPOT                              :{WHITE}Nu pot trimite trenul la depou...
+STR_8830_CAN_T_SEND_TRAIN_TO_DEPOT                              :{WHITE}Nu se poate trimite trenul la depou...
 STR_8831_NO_MORE_SPACE_FOR_ORDERS                               :{WHITE}Nu mai este loc pentru comenzi
 STR_8832_TOO_MANY_ORDERS                                        :{WHITE}Prea multe comenzi
-STR_8833_CAN_T_INSERT_NEW_ORDER                                 :{WHITE}Nu pot adăuga o comandă nouă...
-STR_8834_CAN_T_DELETE_THIS_ORDER                                :{WHITE}Nu pot şterge această comandă...
-STR_8835_CAN_T_MODIFY_THIS_ORDER                                :{WHITE}Nu pot modifica această comandă...
+STR_8833_CAN_T_INSERT_NEW_ORDER                                 :{WHITE}Nu se poate adăuga o comandă nouă...
+STR_8834_CAN_T_DELETE_THIS_ORDER                                :{WHITE}Nu se poate şterge această comandă...
+STR_8835_CAN_T_MODIFY_THIS_ORDER                                :{WHITE}Nu se poate modifica această comandă...
 STR_CAN_T_MOVE_THIS_ORDER                                       :{WHITE}Nu pot muta acest ordin...
 STR_CAN_T_SKIP_ORDER                                            :{WHITE}Nu pot renunta la comanda actuala...
 STR_CAN_T_SKIP_TO_ORDER                                         :{WHITE}Nu pot sări la ordinul selectat...
-STR_8837_CAN_T_MOVE_VEHICLE                                     :{WHITE}Nu pot muta vehiculul...
+STR_8837_CAN_T_MOVE_VEHICLE                                     :{WHITE}Nu se poate muta vehiculul...
 STR_REAR_ENGINE_FOLLOW_FRONT_ERROR                              :{WHITE}Al doilea vagon+motor va avea mereu aceeasi destinatie ca si primul
 STR_8838_N_A                                                    :N/A{SKIP}
-STR_8839_CAN_T_SELL_RAILROAD_VEHICLE                            :{WHITE}Nu pot vinde vehiculul...
-STR_883A_UNABLE_TO_FIND_ROUTE_TO                                :{WHITE}Nu pot găsi un drum spre un depou local
-STR_883B_CAN_T_STOP_START_TRAIN                                 :{WHITE}Nu pot opri-porni trenul...
+STR_8839_CAN_T_SELL_RAILROAD_VEHICLE                            :{WHITE}Nu se poate vinde vehiculul...
+STR_883A_UNABLE_TO_FIND_ROUTE_TO                                :{WHITE}Nu se poate găsi un drum spre un depou apropiat
+STR_883B_CAN_T_STOP_START_TRAIN                                 :{WHITE}Nu se poate opri/porni trenul...
 STR_883C_SERVICING_INTERVAL_DAYS                                :{BLACK}Intervalul pentru întreţinere: {LTBLUE}{COMMA}zile{BLACK}   Ultima întreţinere: {LTBLUE}{DATE_LONG}
 STR_SERVICING_INTERVAL_PERCENT                                  :{BLACK}Intervalul de service: {LTBLUE}{COMMA}%{BLACK}   Ultimul service: {LTBLUE}{DATE_LONG}
 STR_883D_TRAINS_CLICK_ON_TRAIN_FOR                              :{BLACK}Trenuri - apasă aici pentru informaţii despre trenuri
@@ -2697,29 +2796,29 @@
 STR_883F_TRAINS_CLICK_ON_TRAIN_FOR                              :{BLACK}Trenuri - clic pe tren pentru informaţii, mută vehiculele pentru adăugare-scoatere din tren
 STR_8840_BUILD_NEW_TRAIN_VEHICLE                                :{BLACK}Construieşte un nou vehicul feroviar
 STR_8841_DRAG_TRAIN_VEHICLE_TO_HERE                             :{BLACK}Mută un vehicul aici pentru a-l vinde
-STR_8842_CENTER_MAIN_VIEW_ON_TRAIN                              :{BLACK}Centreazã imaginea pe locatia depoului
+STR_8842_CENTER_MAIN_VIEW_ON_TRAIN                              :{BLACK}Centrează imaginea pe locaţia depoului
 STR_8843_TRAIN_VEHICLE_SELECTION                                :{BLACK}Lista de selectie a componentelor trenului - clic pe vehicule pt. informatii
-STR_8844_BUILD_THE_HIGHLIGHTED_TRAIN                            :{BLACK}Cumpãrã vehiculul selectat
+STR_8844_BUILD_THE_HIGHLIGHTED_TRAIN                            :{BLACK}Cumpără vehiculul selectat
 STR_8845_RENAME_TRAIN_VEHICLE_TYPE                              :{BLACK}Redenumeste modelul vehiculului
-STR_8846_CURRENT_TRAIN_ACTION_CLICK                             :{BLACK}Comanda curentã a trenului - apasã aici pentru a porni/opri trenul
-STR_8847_SHOW_TRAIN_S_ORDERS                                    :{BLACK}Afiseazã comenzile trenului
-STR_8848_CENTER_MAIN_VIEW_ON_TRAIN                              :{BLACK}Centreazã imaginea pe locatia curentã a trenului
+STR_8846_CURRENT_TRAIN_ACTION_CLICK                             :{BLACK}Comanda curentă a trenului - clic aici pentru a opri/porni trenul
+STR_8847_SHOW_TRAIN_S_ORDERS                                    :{BLACK}Afişează comenzile trenului
+STR_8848_CENTER_MAIN_VIEW_ON_TRAIN                              :{BLACK}Centrează imaginea pe locaţia curentă a trenului
 STR_8849_SEND_TRAIN_TO_DEPOT                                    :{BLACK}Trimite trenul într-un depou
-STR_884A_FORCE_TRAIN_TO_PROCEED                                 :{BLACK}Forteazã trenul sã ignore semnalulizarea de oprire
-STR_884B_REVERSE_DIRECTION_OF_TRAIN                             :{BLACK}Schimbã sensul de circulatie al trenului
-STR_884C_SHOW_TRAIN_DETAILS                                     :{BLACK}Afiseazã detaliile trenului
-STR_884D_INCREASE_SERVICING_INTERVAL                            :{BLACK}Mãreste intervalul de service
-STR_884E_DECREASE_SERVICING_INTERVAL                            :{BLACK}Micsoreazã intervalul de service
-STR_884F_SHOW_DETAILS_OF_CARGO_CARRIED                          :{BLACK}Afiseazã detalii despre încãrcãtura transportatã
-STR_8850_SHOW_DETAILS_OF_TRAIN_VEHICLES                         :{BLACK}Afiseazã detalii despre componentele trenului
-STR_8851_SHOW_CAPACITIES_OF_EACH                                :{BLACK}Afiseazã capacitãtile componentelor trenului
+STR_884A_FORCE_TRAIN_TO_PROCEED                                 :{BLACK}Forţează trenul să ignore semnalizarea de oprire
+STR_884B_REVERSE_DIRECTION_OF_TRAIN                             :{BLACK}Schimbă sensul de circulaţie al trenului
+STR_884C_SHOW_TRAIN_DETAILS                                     :{BLACK}Afişează detaliile trenului
+STR_884D_INCREASE_SERVICING_INTERVAL                            :{BLACK}Măreşte intervalul de service
+STR_884E_DECREASE_SERVICING_INTERVAL                            :{BLACK}Micşorează intervalul de service
+STR_884F_SHOW_DETAILS_OF_CARGO_CARRIED                          :{BLACK}Afişează detalii despre încărcătura transportată
+STR_8850_SHOW_DETAILS_OF_TRAIN_VEHICLES                         :{BLACK}Afişează detalii despre componentele trenului
+STR_8851_SHOW_CAPACITIES_OF_EACH                                :{BLACK}Afişează capacităţile fiecărei componente
 STR_SHOW_TOTAL_CARGO                                            :{BLACK}Afiseazã capacitãtile totale ale trenului, diferentiate pe tip de încãrcãturã
-STR_8852_ORDERS_LIST_CLICK_ON_ORDER                             :{BLACK}Lista de comenzi - clic pe comandã pentru a o selecta
+STR_8852_ORDERS_LIST_CLICK_ON_ORDER                             :{BLACK}Lista de comenzi - clic pe o comandă pentru a o selecta. Ctrl+clic poziţionează ecranul pe staţie
 STR_8853_SKIP_THE_CURRENT_ORDER                                 :{BLACK}Renunta la comanta acruala si preia-o pe urmatoarea. CTRL + click face salt la comanda selectata
-STR_8854_DELETE_THE_HIGHLIGHTED                                 :{BLACK}Sterge comanda selectatã
-STR_8856_INSERT_A_NEW_ORDER_BEFORE                              :{BLACK}Introdu o comandã înaintea celei selectate sau adaugã o comandã la sfârsitul listei
+STR_8854_DELETE_THE_HIGHLIGHTED                                 :{BLACK}Şterge comanda selectată
+STR_8856_INSERT_A_NEW_ORDER_BEFORE                              :{BLACK}Adaugă o comandă înaintea celei selectate, sau la sfârşitul listei
 STR_TIMETABLE_TOOLTIP                                           :{BLACK}Orar - click on an order to highlight it.
-STR_TIMETABLE_WAIT_TIME_TOOLTIP                                 :{BLACK}Modifica durata de timp alocata pentru comanda selectata
+STR_TIMETABLE_WAIT_TIME_TOOLTIP                                 :{BLACK}Modifică durata de timp alocată pentru comanda selectată
 STR_TIMETABLE_CLEAR_TIME_TOOLTIP                                :{BLACK}Elimina durata de timp pentru comanda selectata
 STR_TIMETABLE_RESET_LATENESS_TOOLTIP                            :{BLACK}Reinitializeaza contorul de intarziere, astfel ca vehiculul sa ajunga la timp
 STR_SERVICE_HINT                                                :{BLACK}Sari peste aceastã comandã dacã nu este necesar un service
@@ -2729,18 +2828,18 @@
 STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED                         :{BLACK}Greutate: {LTBLUE}{WEIGHT_S}  {BLACK}Putere: {LTBLUE}{POWER}{BLACK} Vitezã max.: {LTBLUE}{VELOCITY}
 STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED_MAX_TE                  :{BLACK}Greutate: {LTBLUE}{WEIGHT_S} {BLACK}Putere: {LTBLUE}{POWER}{BLACK} Viteza max.: {LTBLUE}{VELOCITY} {BLACK}E.T. max.: {LTBLUE}{FORCE}
 STR_885F_PROFIT_THIS_YEAR_LAST_YEAR                             :{BLACK}Profit anul acesta: {LTBLUE}{CURRENCY}  (anul trecut: {CURRENCY})
-STR_8860_RELIABILITY_BREAKDOWNS                                 :{BLACK}Eficientã: {LTBLUE}{COMMA}%  {BLACK}Defectiuni de la ultimul service: {LTBLUE}{COMMA}
+STR_8860_RELIABILITY_BREAKDOWNS                                 :{BLACK}Eficienţă: {LTBLUE}{COMMA}%  {BLACK}Defecţiuni de la ultimul service: {LTBLUE}{COMMA}
 STR_8861_STOPPED                                                :{RED}Oprit
-STR_8862_CAN_T_MAKE_TRAIN_PASS_SIGNAL                           :{WHITE}Nu pot permite trenului sã treacã în caz de pericol...
+STR_8862_CAN_T_MAKE_TRAIN_PASS_SIGNAL                           :{WHITE}Nu se poate permite trenului să treacă în caz de pericol...
 STR_8863_CRASHED                                                :{RED}Accident!
 
 STR_8865_NAME_TRAIN                                             :{WHITE}Numele trenului
-STR_8866_CAN_T_NAME_TRAIN                                       :{WHITE}Nu pot redenumi trenul...
+STR_8866_CAN_T_NAME_TRAIN                                       :{WHITE}Nu se poate denumi trenul...
 STR_8867_NAME_TRAIN                                             :{BLACK}Numele trenului
 STR_8868_TRAIN_CRASH_DIE_IN_FIREBALL                            :{BLACK}{BIGFONT}Accident feroviar!{}{COMMA} victime în urma unei coliziuni
-STR_8869_CAN_T_REVERSE_DIRECTION                                :{WHITE}Nu pot schimba sensul de mers al trenului...
+STR_8869_CAN_T_REVERSE_DIRECTION                                :{WHITE}Nu se poate schimba sensul de mers al trenului...
 STR_886A_RENAME_TRAIN_VEHICLE_TYPE                              :{WHITE}Redenumeste modelul vehiculului feroviar
-STR_886B_CAN_T_RENAME_TRAIN_VEHICLE                             :{WHITE}Nu pot redenumi modelul acestui vehicul...
+STR_886B_CAN_T_RENAME_TRAIN_VEHICLE                             :{WHITE}Nu se poate redenumi modelul de vehicul...
 STR_CLEAR_TIME                                                  :{BLACK}Curata timp
 STR_RESET_LATENESS                                              :{BLACK}Reinitializeaza contorul de intarziere
 
@@ -2750,19 +2849,19 @@
 STR_TRAIN_NO_POWER                                              :{RED}Fara curent
 STR_TRAIN_START_NO_CATENARY                                     :Aceasta sina nu este electrificata, deci trenul nu poate porni
 
-STR_NEW_VEHICLE_NOW_AVAILABLE                                   :{BLACK}{BIGFONT}Un nou {STRING} este acum disponibil!
+STR_NEW_VEHICLE_NOW_AVAILABLE                                   :{BLACK}{BIGFONT}Un nou tip de {STRING} este acum disponibil!
 STR_NEW_VEHICLE_TYPE                                            :{BLACK}{BIGFONT}{ENGINE}
-STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE                         :{BLACK}Un nou {STRING} este acum disponibil!  -  {ENGINE}
+STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE                         :{BLACK}Un nou tip de {STRING} este acum disponibil!  -  {ENGINE}
 
 STR_CAN_T_SELL_DESTROYED_VEHICLE                                :{WHITE}Vehiculul distrus nu poate fi vandut...
 STR_CAN_T_REFIT_DESTROYED_VEHICLE                               :{WHITE}Nu putem repara vehiculele distruse...
 
 STR_CAN_T_TIMETABLE_VEHICLE                                     :{WHITE}Nu pot programa vehiculul...
 STR_TIMETABLE_ONLY_WAIT_AT_STATIONS                             :{WHITE}Vehiculele pot astepta numai in statii.
-STR_TIMETABLE_NOT_STOPPING_HERE                                 :{WHITE}Acest vehicul nu opreste in aceasta statie.
+STR_TIMETABLE_NOT_STOPPING_HERE                                 :{WHITE}Acest vehicul nu are oprire în această staţie.
 STR_TIMETABLE_CHANGE_TIME                                       :{BLACK}Modifica timpul
 STR_TIMETABLE_STATUS_ON_TIME                                    :Acest vehicul se incadreaza in timp
-STR_TIMETABLE_STATUS_LATE                                       :Momentan, acest vehicul este in intarziere {STRING}
+STR_TIMETABLE_STATUS_LATE                                       :Vehiculul are întârziere de {STRING}
 STR_TIMETABLE_STATUS_EARLY                                      :Momentan, acest vehicul si-a devansat programul {STRING}
 STR_TIMETABLE_TOTAL_TIME                                        :Acest orar va lua {STRING} pentru finalizare
 STR_TIMETABLE_TOTAL_TIME_INCOMPLETE                             :Acest orar va lua cel putin {STRING} pentru finalizare (nu in intregime programat)
@@ -2776,220 +2875,220 @@
 STR_9003_ROAD_VEHICLE_DEPOT                                     :{WHITE}Autobaza {TOWN}
 STR_9004_NEW_VEHICLES                                           :{BLACK}Autovehicule noi
 STR_9006_NEW_ROAD_VEHICLES                                      :{WHITE}Autovehicule noi
-STR_9007_BUILD_VEHICLE                                          :{BLACK}Cumpãrã vehicul
-STR_9009_CAN_T_BUILD_ROAD_VEHICLE                               :{WHITE}Nu pot cumpãra autovehicul...
+STR_9007_BUILD_VEHICLE                                          :{BLACK}Cumpără vehicul
+STR_9009_CAN_T_BUILD_ROAD_VEHICLE                               :{WHITE}Nu pot cumpăra autovehicul...
 STR_900C_DETAILS                                                :{WHITE}{VEHICLE} (Detalii)
 STR_900D_AGE_RUNNING_COST_YR                                    :{BLACK}Vârsta: {LTBLUE}{STRING}{BLACK}   Cost de rulare: {LTBLUE}{CURRENCY}/an
-STR_900E_MAX_SPEED                                              :{BLACK}Vitezã max.: {LTBLUE}{VELOCITY}
+STR_900E_MAX_SPEED                                              :{BLACK}Viteză max.: {LTBLUE}{VELOCITY}
 STR_900F_PROFIT_THIS_YEAR_LAST_YEAR                             :{BLACK}Profit anul acesta: {LTBLUE}{CURRENCY}  (anul trecut: {CURRENCY})
-STR_9010_RELIABILITY_BREAKDOWNS                                 :{BLACK}Eficientã: {LTBLUE}{COMMA}%  {BLACK}Defectiuni de la ultimul service: {LTBLUE}{COMMA}
-STR_9011_BUILT_VALUE                                            :{LTBLUE}{ENGINE}{BLACK}   Cumpãrat: {LTBLUE}{NUM}{BLACK} Valoare: {LTBLUE}{CURRENCY}
+STR_9010_RELIABILITY_BREAKDOWNS                                 :{BLACK}Eficienţă: {LTBLUE}{COMMA}%  {BLACK}Defecţiuni de la ultimul service: {LTBLUE}{COMMA}
+STR_9011_BUILT_VALUE                                            :{LTBLUE}{ENGINE}{BLACK}   Cumpărat: {LTBLUE}{NUM}{BLACK} Valoare: {LTBLUE}{CURRENCY}
 STR_9012_CAPACITY                                               :{BLACK}Capacitate: {LTBLUE}{CARGO}
-STR_9013_MUST_BE_STOPPED_INSIDE                                 :{WHITE}...trebuie oprit intr-o autobazã
-STR_9014_CAN_T_SELL_ROAD_VEHICLE                                :{WHITE}Nu pot vinde autovehiculul...
-STR_9015_CAN_T_STOP_START_ROAD_VEHICLE                          :{WHITE}Nu pot opri/porni autovehiculul...
-STR_9016_ROAD_VEHICLE_IS_WAITING                                :{WHITE}Autovehiculul {COMMA} e parcat la autobazã
+STR_9013_MUST_BE_STOPPED_INSIDE                                 :{WHITE}...trebuie oprit într-o autobază
+STR_9014_CAN_T_SELL_ROAD_VEHICLE                                :{WHITE}Nu se poate vinde autovehiculul...
+STR_9015_CAN_T_STOP_START_ROAD_VEHICLE                          :{WHITE}Nu se poate opri/porni autovehiculul...
+STR_9016_ROAD_VEHICLE_IS_WAITING                                :{WHITE}Autovehiculul {COMMA} staţionează la autobază
 STR_HEADING_FOR_ROAD_DEPOT                                      :{ORANGE}Merge la Autobaza {TOWN}
 STR_HEADING_FOR_ROAD_DEPOT_VEL                                  :{ORANGE}Merge la Autobaza {TOWN}, {VELOCITY}
 STR_HEADING_FOR_ROAD_DEPOT_SERVICE                              :{LTBLUE}Service la Autobaza {TOWN}
 STR_HEADING_FOR_ROAD_DEPOT_SERVICE_VEL                          :{LTBLUE}Service la Autobaza {TOWN}, {VELOCITY}
-STR_9018_CAN_T_SEND_VEHICLE_TO_DEPOT                            :{WHITE}Nu pot trimite autovehiculul la autobazã...
-STR_9019_UNABLE_TO_FIND_LOCAL_DEPOT                             :{WHITE}Nu pot gãsi un drum spre o autobazã localã
+STR_9018_CAN_T_SEND_VEHICLE_TO_DEPOT                            :{WHITE}Nu pot trimite autovehiculul la autobază...
+STR_9019_UNABLE_TO_FIND_LOCAL_DEPOT                             :{WHITE}Nu pot găsi o autobază apropiată
 STR_901A_ROAD_VEHICLES_CLICK_ON                                 :{BLACK}Autovehicule - clic pe vehicul pentru informatii
 STR_901B_BUILD_NEW_ROAD_VEHICLES                                :{BLACK}Cumpãrã un nou autovehicul (ai nevoie de o autobazã)
-STR_901C_CURRENT_VEHICLE_ACTION                                 :{BLACK}Comanda curentã a autovehiculului - clic aici pentru a opri/porni autovehiculul
-STR_901D_SHOW_VEHICLE_S_ORDERS                                  :{BLACK}Afiseazã comenzile autovehiculului
-STR_901E_CENTER_MAIN_VIEW_ON_VEHICLE                            :{BLACK}Centreazã imaginea pe locatia curentã a autovehiculului
-STR_901F_SEND_VEHICLE_TO_DEPOT                                  :{BLACK}Trimite autovehiculul la o autobazã
-STR_9020_FORCE_VEHICLE_TO_TURN_AROUND                           :{BLACK}Forteazã vehiculul sã întoarcã
-STR_9021_SHOW_ROAD_VEHICLE_DETAILS                              :{BLACK}Afiseazã detaliile autovehiculului
+STR_901C_CURRENT_VEHICLE_ACTION                                 :{BLACK}Comanda curentă a autovehiculului - clic aici pentru a opri/porni autovehiculul
+STR_901D_SHOW_VEHICLE_S_ORDERS                                  :{BLACK}Afişează comenzile autovehiculului
+STR_901E_CENTER_MAIN_VIEW_ON_VEHICLE                            :{BLACK}Centrează imaginea pe locaţia curentă a autovehiculului
+STR_901F_SEND_VEHICLE_TO_DEPOT                                  :{BLACK}Trimite autovehiculul la autobază. Ctrl+clic pentru service
+STR_9020_FORCE_VEHICLE_TO_TURN_AROUND                           :{BLACK}Forţează vehiculul să întoarcă
+STR_9021_SHOW_ROAD_VEHICLE_DETAILS                              :{BLACK}Afişează detaliile autovehiculului
 STR_9022_VEHICLES_CLICK_ON_VEHICLE                              :{BLACK}Autovehicule - clic pe vehicul pentru informatii
-STR_9023_BUILD_NEW_ROAD_VEHICLE                                 :{BLACK}Cumpãrã un autovehicul
-STR_9024_DRAG_ROAD_VEHICLE_TO_HERE                              :{BLACK}Mutã un autovehicul aici pentru a-l vinde
-STR_9025_CENTER_MAIN_VIEW_ON_ROAD                               :{BLACK}Centreazã imaginea pe locatia acestei autobaze
-STR_9026_ROAD_VEHICLE_SELECTION                                 :{BLACK}Lista selectie vehicule rutiere - apasa pe vehicul pentru informatii
-STR_9027_BUILD_THE_HIGHLIGHTED_ROAD                             :{BLACK}Cumpãrã autovehiculul selectat
-STR_902A_COST_SPEED_RUNNING_COST                                :{BLACK}Pret: {CURRENCY}{}Vitezã: {VELOCITY}{}Cost de rulare: {CURRENCY}/an{}Capacitate: {CARGO}
+STR_9023_BUILD_NEW_ROAD_VEHICLE                                 :{BLACK}Cumpără un autovehicul nou
+STR_9024_DRAG_ROAD_VEHICLE_TO_HERE                              :{BLACK}Mută un autovehicul aici pentru a-l vinde
+STR_9025_CENTER_MAIN_VIEW_ON_ROAD                               :{BLACK}Centrează imaginea pe locaţia acestei autobaze
+STR_9026_ROAD_VEHICLE_SELECTION                                 :{BLACK}Listă selecţie vehicule rutiere - apasă pe vehicul pentru informaţii
+STR_9027_BUILD_THE_HIGHLIGHTED_ROAD                             :{BLACK}Cumpără autovehiculul selectat
+STR_902A_COST_SPEED_RUNNING_COST                                :{BLACK}Preţ: {CURRENCY}{}Viteză: {VELOCITY}{}Cost de rulare: {CURRENCY}/an{}Capacitate: {CARGO}
 STR_ARTICULATED_RV_CAPACITY                                     :{BLACK}Capacitate: {LTBLUE}
 STR_BARE_CARGO                                                  :{CARGO}
 
 STR_902C_NAME_ROAD_VEHICLE                                      :{WHITE}Numele autovehiculului
-STR_902D_CAN_T_NAME_ROAD_VEHICLE                                :{WHITE}Nu pot redenumi autovehiculul...
+STR_902D_CAN_T_NAME_ROAD_VEHICLE                                :{WHITE}Nu se poate denumi autovehiculul...
 STR_902E_NAME_ROAD_VEHICLE                                      :{BLACK}Numele autovehiculului
-STR_902F_CITIZENS_CELEBRATE_FIRST                               :{BLACK}{BIGFONT}Cetãtenii sãrbãtoresc{}sosirea primului autobuz la {STATION}!
-STR_9030_CITIZENS_CELEBRATE_FIRST                               :{BLACK}{BIGFONT}Cetãtenii sãrbãtoresc{}sosirea primului camion la {STATION}!
+STR_902F_CITIZENS_CELEBRATE_FIRST                               :{BLACK}{BIGFONT}Cetăţenii sărbătoresc{}Sosirea primului autobuz la {STATION}!
+STR_9030_CITIZENS_CELEBRATE_FIRST                               :{BLACK}{BIGFONT}Cetăţenii sărbătoresc{}Sosirea primului camion la {STATION}!
 STR_CITIZENS_CELEBRATE_FIRST_PASSENGER_TRAM                     :{BLACK}{BIGFONT}Cetăţenii sărbătoresc . . .{}sosirea primului primul tramvai pentru călători la {STATION}!
 STR_CITIZENS_CELEBRATE_FIRST_CARGO_TRAM                         :{BLACK}{BIGFONT}Cetăţenii sărbătoresc . . .{}sosirea primului primul tramvai pentru marfă la {STATION}!
-STR_9031_ROAD_VEHICLE_CRASH_DRIVER                              :{BLACK}{BIGFONT}Accident rutier!{}Soferul decedat in urma coliziunii cu un tren
-STR_9032_ROAD_VEHICLE_CRASH_DIE                                 :{BLACK}{BIGFONT}Accident rutier!{}{COMMA} victime in urma coliziunii cu un tren
-STR_9033_CAN_T_MAKE_VEHICLE_TURN                                :{WHITE}Nu pot schimba întoarce autvehiculul...
-STR_ONLY_TURN_SINGLE_UNIT                                       :{WHITE}Nu pot întoarce vehiculele alcãtuite din mai multe unitãti
-STR_9034_RENAME                                                 :{BLACK}Redenumeste
-STR_9035_RENAME_ROAD_VEHICLE_TYPE                               :{BLACK}Redenumeste modelul de autovehicul
-STR_9036_RENAME_ROAD_VEHICLE_TYPE                               :{WHITE}Redenumeste modelul autovehiculului
-STR_9037_CAN_T_RENAME_ROAD_VEHICLE                              :{WHITE}Nu pot redenumi modelul acestui autovehicul...
+STR_9031_ROAD_VEHICLE_CRASH_DRIVER                              :{BLACK}{BIGFONT}Accident rutier!{}Şoferul decedat în urma coliziunii cu un tren
+STR_9032_ROAD_VEHICLE_CRASH_DIE                                 :{BLACK}{BIGFONT}Accident rutier!{}{COMMA} victime în urma coliziunii cu un tren
+STR_9033_CAN_T_MAKE_VEHICLE_TURN                                :{WHITE}Nu pot întoarce autovehiculul...
+STR_ONLY_TURN_SINGLE_UNIT                                       :{WHITE}Nu se pot întoarce vehiculele alcătuite din mai multe unităţi
+STR_9034_RENAME                                                 :{BLACK}Redenumeşte
+STR_9035_RENAME_ROAD_VEHICLE_TYPE                               :{BLACK}Redenumeşte modelul de autovehicul
+STR_9036_RENAME_ROAD_VEHICLE_TYPE                               :{WHITE}Redenumeşte modelul de autovehicul
+STR_9037_CAN_T_RENAME_ROAD_VEHICLE                              :{WHITE}Nu pot redenumi modelul de autovehicul...
 
 STR_REFIT_ROAD_VEHICLE_TO_CARRY                                 :{BLACK}Adapteaza autovehiculul pentru o incarcatura diferita
 STR_REFIT_ROAD_VEHICLE                                          :{BLACK}Adaptare autovehicul
 STR_REFIT_ROAD_VEHICLE_TO_CARRY_HIGHLIGHTED                     :{BLACK}Adapteaza autovehiculul pentru transportul incarcaturii evidentiate
 STR_REFIT_ROAD_VEHICLE_CAN_T                                    :{WHITE}Nu pot adapta autovehiculul...
-STR_ROAD_SELECT_TYPE_OF_CARGO_FOR                               :{BLACK}Alege tipul de marfa pentru transport cu autovehiculul
+STR_ROAD_SELECT_TYPE_OF_CARGO_FOR                               :{BLACK}Alege tipul de marfă pe care o transportă autovehiculul
 
 ##id 0x9800
-STR_9800_DOCK_CONSTRUCTION                                      :Construcţii navale
+STR_9800_DOCK_CONSTRUCTION                                      :Construcţie port
 STR_9801_DOCK_CONSTRUCTION                                      :{WHITE}Construcţie port
 STR_9802_CAN_T_BUILD_DOCK_HERE                                  :{WHITE}Nu pot construi port aici...
-STR_9803_SHIP_DEPOT                                             :{WHITE}Santierul Naval {TOWN}
+STR_9803_SHIP_DEPOT                                             :{WHITE}Şantierul Naval {TOWN}
 STR_9804_NEW_SHIPS                                              :{BLACK}Nave noi
-STR_9805_SHIPS                                                  :{WHITE}{COMPANY} - {COMMA}Nave
+STR_9805_SHIPS                                                  :{WHITE}{COMPANY} - {COMMA} Nav{P ă e}
 STR_9808_NEW_SHIPS                                              :{WHITE}Nave noi
-STR_9809_BUILD_SHIP                                             :{BLACK}Construieste navã
-STR_CLONE_SHIP                                                  :{BLACK}Cloneaz? nava
-STR_CLONE_SHIP_INFO                                             :{BLACK}Acest buton va crea o copie a navei. Control+click pentru comenzi comune
-STR_CLONE_SHIP_DEPOT_INFO                                       :{BLACK}Acest buton va crea o copie a navei. Apasã acest buton, apoi fã click pe o nav? de pe hartã. Control+click pentru a-i da ordine comune
-STR_980B_SHIP_MUST_BE_STOPPED_IN                                :{WHITE}Nava trebuie sã fie stationatã într-un santier
+STR_9809_BUILD_SHIP                                             :{BLACK}Construieşte navă
+STR_CLONE_SHIP                                                  :{BLACK}Clonare navă
+STR_CLONE_SHIP_INFO                                             :{BLACK}Acest buton va crea o copie a navei. Control+clic pentru comenzi sincronizate
+STR_CLONE_SHIP_DEPOT_INFO                                       :{BLACK}Acest buton va crea o copie a navei. Apasă acest buton, apoi fă clic pe o navă din joc. Control+clic pentru a crea comenzi sincronizate
+STR_980B_SHIP_MUST_BE_STOPPED_IN                                :{WHITE}Nava trebuie să fie staţionată într-un şantier
 STR_980C_CAN_T_SELL_SHIP                                        :{WHITE}Nu pot vinde nava...
 STR_980D_CAN_T_BUILD_SHIP                                       :{WHITE}Nu pot construi nava...
-STR_980E_SHIP_IN_THE_WAY                                        :{WHITE}Navã în cale
+STR_980E_SHIP_IN_THE_WAY                                        :{WHITE}Navă în cale
 STR_980F                                                        :{WHITE}{VEHICLE}
 STR_9811_DETAILS                                                :{WHITE}{VEHICLE} (Detalii)
-STR_9812_AGE_RUNNING_COST_YR                                    :{BLACK}Vârsta: {LTBLUE}{STRING}{BLACK}   Cost de rulare: {LTBLUE}{CURRENCY}/an
+STR_9812_AGE_RUNNING_COST_YR                                    :{BLACK}Vechime: {LTBLUE}{STRING}{BLACK}   Cost de rulare: {LTBLUE}{CURRENCY}/an
 STR_9813_MAX_SPEED                                              :{BLACK}Viteza max.: {LTBLUE}{VELOCITY}
 STR_9814_PROFIT_THIS_YEAR_LAST_YEAR                             :{BLACK}Profit anul acesta: {LTBLUE}{CURRENCY}  (anul trecut: {CURRENCY})
-STR_9815_RELIABILITY_BREAKDOWNS                                 :{BLACK}Eficientã: {LTBLUE}{COMMA}%  {BLACK}Defectiuni de la ultimul service: {LTBLUE}{COMMA}
+STR_9815_RELIABILITY_BREAKDOWNS                                 :{BLACK}Eficienţă: {LTBLUE}{COMMA}%  {BLACK}Defecţiuni de la ultimul service: {LTBLUE}{COMMA}
 STR_9816_BUILT_VALUE                                            :{LTBLUE}{ENGINE}{BLACK}   Construit: {LTBLUE}{NUM}{BLACK} Valoare: {LTBLUE}{CURRENCY}
 STR_9817_CAPACITY                                               :{BLACK}Capacitate: {LTBLUE}{CARGO}
 STR_9818_CAN_T_STOP_START_SHIP                                  :{WHITE}Nu pot opri/porni nava...
-STR_9819_CAN_T_SEND_SHIP_TO_DEPOT                               :{WHITE}Nu pot trimite nava în santier...
-STR_981A_UNABLE_TO_FIND_LOCAL_DEPOT                             :{WHITE}Nu pot gãsi un santier apropiat
+STR_9819_CAN_T_SEND_SHIP_TO_DEPOT                               :{WHITE}Nu pot trimite nava în şantier...
+STR_981A_UNABLE_TO_FIND_LOCAL_DEPOT                             :{WHITE}Nu pot găsi un şantier apropiat
 STR_HEADING_FOR_SHIP_DEPOT                                      :{ORANGE}Merge la Santierul {TOWN}
 STR_HEADING_FOR_SHIP_DEPOT_VEL                                  :{ORANGE}Merge la Santierul {TOWN}, {VELOCITY}
 STR_HEADING_FOR_SHIP_DEPOT_SERVICE                              :{LTBLUE}Service la Santierul Naval {TOWN}
 STR_HEADING_FOR_SHIP_DEPOT_SERVICE_VEL                          :{LTBLUE}Service la Santierul Naval {TOWN}, {VELOCITY}
-STR_981C_SHIP_IS_WAITING_IN_DEPOT                               :{WHITE}Nava {COMMA} este stationatã în santier
-STR_981D_BUILD_SHIP_DOCK                                        :{BLACK}Construieste port
-STR_981E_BUILD_SHIP_DEPOT_FOR_BUILDING                          :{BLACK}Constructie santier naval (pentru construirea si repararea navelor)
-STR_981F_SHIPS_CLICK_ON_SHIP_FOR                                :{BLACK}Nave - clic pe o navã pentru informatii
-STR_9820_BUILD_NEW_SHIP                                         :{BLACK}Construieste o nouã navã
+STR_981C_SHIP_IS_WAITING_IN_DEPOT                               :{WHITE}Nava {COMMA} este staţionată în şantier
+STR_981D_BUILD_SHIP_DOCK                                        :{BLACK}Construieşte port
+STR_981E_BUILD_SHIP_DEPOT_FOR_BUILDING                          :{BLACK}Construcţie şantier naval (pentru construirea şi repararea navelor)
+STR_981F_SHIPS_CLICK_ON_SHIP_FOR                                :{BLACK}Nave - clic pe o navă pentru informaţii
+STR_9820_BUILD_NEW_SHIP                                         :{BLACK}Construieşte o navă nouă
 STR_9821_DRAG_SHIP_TO_HERE_TO_SELL                              :{BLACK}Trage nava aici pentru a o vinde
-STR_9822_CENTER_MAIN_VIEW_ON_SHIP                               :{BLACK}Centreazã imaginea pe locatia santierului
-STR_9823_SHIPS_CLICK_ON_SHIP_FOR                                :{BLACK}Nave - click pe navã pentru informatii
-STR_9824_BUILD_NEW_SHIPS_REQUIRES                               :{BLACK}Construieste nave noi (necesitã cel putin un santier naval)
-STR_9825_SHIP_SELECTION_LIST_CLICK                              :{BLACK}Lista de selectie a navelor - click pe o navã pentru informatii
-STR_9826_BUILD_THE_HIGHLIGHTED_SHIP                             :{BLACK}Construieste nava selectatã
-STR_9827_CURRENT_SHIP_ACTION_CLICK                              :{BLACK}Comanda curentã a navei - clic aici pentru a porni/opri nava
-STR_9828_SHOW_SHIP_S_ORDERS                                     :{BLACK}Afiseazã comenzile navei
-STR_9829_CENTER_MAIN_VIEW_ON_SHIP                               :{BLACK}Centreazã imaginea pe locatia curentã a navei
-STR_982A_SEND_SHIP_TO_DEPOT                                     :{BLACK}Trimite nava într-un santier
-STR_982B_SHOW_SHIP_DETAILS                                      :{BLACK}Afiseazã detaliile navei
-STR_982E_COST_MAX_SPEED_CAPACITY                                :{BLACK}Cost: {CURRENCY} Viteza max.: {VELOCITY}{}Capacitate: {CARGO}{}Cost de rulare: {CURRENCY}/an
-STR_982F_NAME_SHIP                                              :{BLACK}Alege un nume pentru aceastã navã
+STR_9822_CENTER_MAIN_VIEW_ON_SHIP                               :{BLACK}Centrează imaginea pe locaţia şantierului
+STR_9823_SHIPS_CLICK_ON_SHIP_FOR                                :{BLACK}Nave - click pe navă pentru informaţii
+STR_9824_BUILD_NEW_SHIPS_REQUIRES                               :{BLACK}Construieşte nave noi (necesită cel puţin un şantier naval)
+STR_9825_SHIP_SELECTION_LIST_CLICK                              :{BLACK}Listă de selecţie a navelor - click pe o navă pentru informaţii
+STR_9826_BUILD_THE_HIGHLIGHTED_SHIP                             :{BLACK}Construieşte nava selectată
+STR_9827_CURRENT_SHIP_ACTION_CLICK                              :{BLACK}Comanda curentă a navei - clic aici pentru a opri/porni nava
+STR_9828_SHOW_SHIP_S_ORDERS                                     :{BLACK}Afişează comenzile navei
+STR_9829_CENTER_MAIN_VIEW_ON_SHIP                               :{BLACK}Centrează imaginea pe locaţia curentă a navei
+STR_982A_SEND_SHIP_TO_DEPOT                                     :{BLACK}Trimite nava în şantier. Ctrl+clic pentru întreţinere
+STR_982B_SHOW_SHIP_DETAILS                                      :{BLACK}Afişează detaliile navei
+STR_982E_COST_MAX_SPEED_CAPACITY                                :{BLACK}Preţ: {CURRENCY} Viteza max.: {VELOCITY}{}Capacitate: {CARGO}{}Cost de rulare: {CURRENCY}/an
+STR_982F_NAME_SHIP                                              :{BLACK}Denumeşte această navă
 
-STR_9831_NAME_SHIP                                              :{WHITE}Alege un nume pentru aceastã navã
-STR_9832_CAN_T_NAME_SHIP                                        :{WHITE}Nu pot redenumi nava...
-STR_9833_CITIZENS_CELEBRATE_FIRST                               :{BLACK}{BIGFONT}Cetãtenii sãrbãtoresc{}Sosirea primei nave la {STATION}!
-STR_9834_POSITION_BUOY_WHICH_CAN                                :{BLACK}Plaseazã o balizã ce poate fi utilizatã pentru directionare
-STR_9835_CAN_T_POSITION_BUOY_HERE                               :{WHITE}Nu pot plasa o balizã aici...
-STR_9836_RENAME                                                 :{BLACK}Redenumeste
-STR_9837_RENAME_SHIP_TYPE                                       :{BLACK}Redenumeste modelul navei
-STR_9838_RENAME_SHIP_TYPE                                       :{WHITE}Redenumeste modelul navei
-STR_9839_CAN_T_RENAME_SHIP_TYPE                                 :{WHITE}Nu pot schimba numele modelului acestei nave...
-STR_983A_REFIT_CARGO_SHIP_TO_CARRY                              :{BLACK}Schimbã tipul de marfã transportat
-STR_983B_REFIT                                                  :{WHITE}{VEHICLE} (Schimb marfã)
-STR_983C_REFIT_SHIP                                             :{BLACK}Schimbã marfa transportatã
-STR_983D_SELECT_TYPE_OF_CARGO_FOR                               :{BLACK}Alege tipul de încãrcãturã ce va fi transportat de navã
-STR_983E_REFIT_SHIP_TO_CARRY_HIGHLIGHTED                        :{BLACK}Schimbã tipul de încãrcãturã al acestei nave
-STR_983F_SELECT_CARGO_TYPE_TO_CARRY                             :{GOLD}Alege tipul încãrcãturii:
-STR_9840_NEW_CAPACITY_COST_OF_REFIT                             :{BLACK}Noua capacitate: {GOLD}{CARGO}{}{BLACK}Costul transformãrii: {GOLD}{CURRENCY}
-STR_9841_CAN_T_REFIT_SHIP                                       :{WHITE}Nu pot schimba tipul navei...
-STR_9842_REFITTABLE                                             :(suportã alte mãrfuri)
+STR_9831_NAME_SHIP                                              :{WHITE}Denumeşte această navă
+STR_9832_CAN_T_NAME_SHIP                                        :{WHITE}Nu pot denumi nava...
+STR_9833_CITIZENS_CELEBRATE_FIRST                               :{BLACK}{BIGFONT}Cetăţenii sărbătoresc{}Sosirea primei nave la {STATION}!
+STR_9834_POSITION_BUOY_WHICH_CAN                                :{BLACK}Amplasează o baliză ce poate fi utilizată pentru direcţionare
+STR_9835_CAN_T_POSITION_BUOY_HERE                               :{WHITE}Nu se poate amplasa baliză aici...
+STR_9836_RENAME                                                 :{BLACK}Redenumeşte
+STR_9837_RENAME_SHIP_TYPE                                       :{BLACK}Redenumeşte modelul de navă
+STR_9838_RENAME_SHIP_TYPE                                       :{WHITE}Redenumeşte modelul de navă
+STR_9839_CAN_T_RENAME_SHIP_TYPE                                 :{WHITE}Nu se poate redenumi modelul de navă...
+STR_983A_REFIT_CARGO_SHIP_TO_CARRY                              :{BLACK}Schimbă tipul de marfă transportat de navă
+STR_983B_REFIT                                                  :{WHITE}{VEHICLE} (Schimbă marfa)
+STR_983C_REFIT_SHIP                                             :{BLACK}Schimbă marfa transportată de navă
+STR_983D_SELECT_TYPE_OF_CARGO_FOR                               :{BLACK}Alege tipul de încărcătură ce va fi transportat de navă
+STR_983E_REFIT_SHIP_TO_CARRY_HIGHLIGHTED                        :{BLACK}Schimbă tipul de încărcătură al navei cu cel selectat
+STR_983F_SELECT_CARGO_TYPE_TO_CARRY                             :{GOLD}Alege tipul încărcăturii:
+STR_9840_NEW_CAPACITY_COST_OF_REFIT                             :{BLACK}Noua capacitate: {GOLD}{CARGO}{}{BLACK}Costul transformării: {GOLD}{CURRENCY}
+STR_9841_CAN_T_REFIT_SHIP                                       :{WHITE}Nu se poate schimba tipul navei...
+STR_9842_REFITTABLE                                             :(suportă alte mărfuri)
 
 ##id 0xA000
-STR_A000_AIRPORTS                                               :{WHITE}Airoporturi
-STR_A001_CAN_T_BUILD_AIRPORT_HERE                               :{WHITE}Nu pot construi un aeroport aici...
+STR_A000_AIRPORTS                                               :{WHITE}Aeroporturi
+STR_A001_CAN_T_BUILD_AIRPORT_HERE                               :{WHITE}Nu se poate construi un aeroport aici...
 STR_A002_AIRCRAFT_HANGAR                                        :{WHITE}{STATION} Hangar
-STR_A003_NEW_AIRCRAFT                                           :{BLACK}Aeronavã nouã
-STR_CLONE_AIRCRAFT                                              :{BLACK}Clonare aeronavã
-STR_CLONE_AIRCRAFT_INFO                                         :{BLACK}Acest buton va crea o copie a aeronavei. Control+click pentru comenzi comune
-STR_CLONE_AIRCRAFT_INFO_HANGAR_WINDOW                           :{BLACK}Acest buton va crea o copie a aeronavei. Apasã acest buton, apoi fã click pe o aeronav? de pe hartã. Control+click pentru a-i da ordine comune
-STR_A005_NEW_AIRCRAFT                                           :{WHITE}Aeronavã nouã
-STR_A006_BUILD_AIRCRAFT                                         :{BLACK}Cumpãrã aeronavã
-STR_A008_CAN_T_BUILD_AIRCRAFT                                   :{WHITE}Nu pot cumpãra aeronava...
+STR_A003_NEW_AIRCRAFT                                           :{BLACK}Aeronavă nouă
+STR_CLONE_AIRCRAFT                                              :{BLACK}Clonare aeronavă
+STR_CLONE_AIRCRAFT_INFO                                         :{BLACK}Acest buton va crea o copie a aeronavei. Control+clic pentru comenzi sincronizate
+STR_CLONE_AIRCRAFT_INFO_HANGAR_WINDOW                           :{BLACK}Acest buton va crea o copie a aeronavei. Apasă acest buton, apoi fă clic pe o aeronavă din joc. Control+clic pentru a crea comenzi sincronizate
+STR_A005_NEW_AIRCRAFT                                           :{WHITE}Aeronavă nouă
+STR_A006_BUILD_AIRCRAFT                                         :{BLACK}Cumpără aeronavă
+STR_A008_CAN_T_BUILD_AIRCRAFT                                   :{WHITE}Nu se poate cumpăra aeronava...
 STR_A009_AIRCRAFT                                               :{WHITE}{COMPANY} - {COMMA} Aeronave
 STR_A00A                                                        :{WHITE}{VEHICLE}
 STR_A00B_ORDERS                                                 :{WHITE}{VEHICLE} (Comenzi)
 STR_A00C_DETAILS                                                :{WHITE}{VEHICLE} (Detalii)
-STR_A00D_AGE_RUNNING_COST_YR                                    :{BLACK}Vârstã: {LTBLUE}{STRING}{BLACK}   Cost de rulare: {LTBLUE}{CURRENCY}/an
-STR_A00E_MAX_SPEED                                              :{BLACK}Vitezã max.: {LTBLUE}{VELOCITY}
+STR_A00D_AGE_RUNNING_COST_YR                                    :{BLACK}Vârstă: {LTBLUE}{STRING}{BLACK}   Cost de rulare: {LTBLUE}{CURRENCY}/an
+STR_A00E_MAX_SPEED                                              :{BLACK}Viteză max.: {LTBLUE}{VELOCITY}
 STR_A00F_PROFIT_THIS_YEAR_LAST_YEAR                             :{BLACK}Profit anul acesta: {LTBLUE}{CURRENCY}  (anul trecut: {CURRENCY})
-STR_A010_RELIABILITY_BREAKDOWNS                                 :{BLACK}Eficientã: {LTBLUE}{COMMA}%  {BLACK}Defectiuni de la ultimul service: {LTBLUE}{COMMA}
-STR_A011_BUILT_VALUE                                            :{LTBLUE}{ENGINE}{BLACK}   Cumpãrat în: {LTBLUE}{NUM}{BLACK} Valoare: {LTBLUE}{CURRENCY}
-STR_A012_CAN_T_SEND_AIRCRAFT_TO                                 :{WHITE}Nu pot trimite nava într+un hangar...
+STR_A010_RELIABILITY_BREAKDOWNS                                 :{BLACK}Eficienţă: {LTBLUE}{COMMA}%  {BLACK}Defecţiuni de la ultimul service: {LTBLUE}{COMMA}
+STR_A011_BUILT_VALUE                                            :{LTBLUE}{ENGINE}{BLACK}   Cumpărat în: {LTBLUE}{NUM}{BLACK} Valoare: {LTBLUE}{CURRENCY}
+STR_A012_CAN_T_SEND_AIRCRAFT_TO                                 :{WHITE}Nu se poate trimite aeronava la hangar...
 STR_HEADING_FOR_HANGAR                                          :{ORANGE}Merge la Hangarul {STATION}
 STR_HEADING_FOR_HANGAR_VEL                                      :{ORANGE}Merge la Hangarul {STATION}, {VELOCITY}
 STR_HEADING_FOR_HANGAR_SERVICE                                  :{LTBLUE}Service la Hangarul {STATION}
 STR_HEADING_FOR_HANGAR_SERVICE_VEL                              :{LTBLUE}Service la Hangarul {STATION}, {VELOCITY}
-STR_A014_AIRCRAFT_IS_WAITING_IN                                 :{WHITE}Aeronava {COMMA} se aflã în hangar
-STR_A015_AIRCRAFT_IN_THE_WAY                                    :{WHITE}Aeronavã în cale
-STR_A016_CAN_T_STOP_START_AIRCRAFT                              :{WHITE}Nu pot opri/porni aeronava...
-STR_A017_AIRCRAFT_IS_IN_FLIGHT                                  :{WHITE}Aeronavã se aflã în zbor
+STR_A014_AIRCRAFT_IS_WAITING_IN                                 :{WHITE}Aeronava {COMMA} staţionează în hangar
+STR_A015_AIRCRAFT_IN_THE_WAY                                    :{WHITE}Aeronavă în cale
+STR_A016_CAN_T_STOP_START_AIRCRAFT                              :{WHITE}Nu se poate opri/porni aeronava...
+STR_A017_AIRCRAFT_IS_IN_FLIGHT                                  :{WHITE}Aeronava se află în zbor
 STR_A019_CAPACITY                                               :{BLACK}Capacitate: {LTBLUE}{CARGO}, {CARGO}
 STR_A01A_CAPACITY                                               :{BLACK}Capacitate: {LTBLUE}{CARGO}
-STR_A01B_AIRCRAFT_MUST_BE_STOPPED                               :{WHITE}Aeronava trebuie sã se afle într-un hangar
-STR_A01C_CAN_T_SELL_AIRCRAFT                                    :{WHITE}Nu pot vinde aeronava...
-STR_A01D_AIRPORT_CONSTRUCTION                                   :Construcţie aeroport
-STR_A01E_BUILD_AIRPORT                                          :{BLACK}Constr. aeroport
-STR_A01F_AIRCRAFT_CLICK_ON_AIRCRAFT                             :{BLACK}Aeronavã - clic pe aeronavã pentru informatii
-STR_A020_BUILD_NEW_AIRCRAFT_REQUIRES                            :{BLACK}Cumpãrã o nouã aeronavã (necesitã un aeroport)
-STR_A021_AIRCRAFT_CLICK_ON_AIRCRAFT                             :{BLACK}Aeronavã - clic pe aeronavã pentru informatii
-STR_A022_BUILD_NEW_AIRCRAFT                                     :{BLACK}Cumpãrã o aeronavã
+STR_A01B_AIRCRAFT_MUST_BE_STOPPED                               :{WHITE}Aeronava trebuie să staţioneze într-un hangar
+STR_A01C_CAN_T_SELL_AIRCRAFT                                    :{WHITE}Nu se poate vinde aeronava...
+STR_A01D_AIRPORT_CONSTRUCTION                                   :Construire aeroport
+STR_A01E_BUILD_AIRPORT                                          :{BLACK}Construieşte aeroport
+STR_A01F_AIRCRAFT_CLICK_ON_AIRCRAFT                             :{BLACK}Aeronavă - clic pe aeronavă pentru informaţii
+STR_A020_BUILD_NEW_AIRCRAFT_REQUIRES                            :{BLACK}Cumpără o nouă aeronavă (necesită un aeroport cu hangar)
+STR_A021_AIRCRAFT_CLICK_ON_AIRCRAFT                             :{BLACK}Aeronavă - clic pe aeronavă pentru informaţii
+STR_A022_BUILD_NEW_AIRCRAFT                                     :{BLACK}Cumpără o aeronavă
 STR_A023_DRAG_AIRCRAFT_TO_HERE_TO                               :{BLACK}Trage aeronava aici pentru a o vinde
-STR_A024_CENTER_MAIN_VIEW_ON_HANGAR                             :{BLACK}Centreazã imaginea pe locatia hangarului
-STR_A025_AIRCRAFT_SELECTION_LIST                                :{BLACK}Lista de selectie a aeronavelor - clic pe o aeronavã pentru informatii
-STR_A026_BUILD_THE_HIGHLIGHTED_AIRCRAFT                         :{BLACK}Cumpãrã aeronava selectatã
-STR_A027_CURRENT_AIRCRAFT_ACTION                                :{BLACK}Comanda curentã a aeronavei - click aici pentru a porni/opri aeronava
-STR_A028_SHOW_AIRCRAFT_S_ORDERS                                 :{BLACK}Afiseazã comenzile aeronavei
-STR_A029_CENTER_MAIN_VIEW_ON_AIRCRAFT                           :{BLACK}Centreazã imaginea pe locatia curentã a aeronavei
-STR_A02A_SEND_AIRCRAFT_TO_HANGAR                                :{BLACK}Trimite aeronava într-un hangar
-STR_A02B_SHOW_AIRCRAFT_DETAILS                                  :{BLACK}Afiseazã detaliile aeronavei
-STR_A02E_COST_MAX_SPEED_CAPACITY                                :{BLACK}Pret: {CURRENCY} Viteza max.: {VELOCITY}{}Capacitate: {COMMA} cãlãtori, {COMMA} saci de postã{}Cost de rulare: {CURRENCY}/an
+STR_A024_CENTER_MAIN_VIEW_ON_HANGAR                             :{BLACK}Centrează imaginea pe locaţia hangarului
+STR_A025_AIRCRAFT_SELECTION_LIST                                :{BLACK}Lista de selecţie a aeronavelor - clic pe o aeronavă pentru informaţii
+STR_A026_BUILD_THE_HIGHLIGHTED_AIRCRAFT                         :{BLACK}Cumpără aeronava selectată
+STR_A027_CURRENT_AIRCRAFT_ACTION                                :{BLACK}Comanda curentă a aeronavei - clic aici pentru a opri/porni aeronava
+STR_A028_SHOW_AIRCRAFT_S_ORDERS                                 :{BLACK}Afişează comenzile aeronavei
+STR_A029_CENTER_MAIN_VIEW_ON_AIRCRAFT                           :{BLACK}Centrează imaginea pe locaţia curentă a aeronavei
+STR_A02A_SEND_AIRCRAFT_TO_HANGAR                                :{BLACK}Trimite aeronava la hangar. Ctrl+clic pentru întreţinere
+STR_A02B_SHOW_AIRCRAFT_DETAILS                                  :{BLACK}Afişează detaliile aeronavei
+STR_A02E_COST_MAX_SPEED_CAPACITY                                :{BLACK}Preţ: {CURRENCY} Viteza max.: {VELOCITY}{}Capacitate: {COMMA} călători, {COMMA} saci de poştă{}Cost de rulare: {CURRENCY}/an
 
-STR_A030_NAME_AIRCRAFT                                          :{WHITE}Redenumeste aeronava
-STR_A031_CAN_T_NAME_AIRCRAFT                                    :{WHITE}Nu pot redenumi aeronava...
-STR_A032_NAME_AIRCRAFT                                          :{BLACK}Redenumeste aeronava
-STR_A033_CITIZENS_CELEBRATE_FIRST                               :{BLACK}{BIGFONT}Cetãtenii sãrbãtoresc {}sosirea primei aeronave la {STATION}!
-STR_A034_PLANE_CRASH_DIE_IN_FIREBALL                            :{BLACK}{BIGFONT}Accident aviatic!{}{COMMA} victime în urma prãbusirii de la {STATION}
+STR_A030_NAME_AIRCRAFT                                          :{WHITE}Denumeşte aeronava
+STR_A031_CAN_T_NAME_AIRCRAFT                                    :{WHITE}Nu pot denumi aeronava...
+STR_A032_NAME_AIRCRAFT                                          :{BLACK}Denumeşte aeronava
+STR_A033_CITIZENS_CELEBRATE_FIRST                               :{BLACK}{BIGFONT}Cetăţenii sărbătoresc {}Sosirea primei aeronave la {STATION}!
+STR_A034_PLANE_CRASH_DIE_IN_FIREBALL                            :{BLACK}{BIGFONT}Accident aviatic!{}{COMMA} victime în urma prăbuşirii de la {STATION}
 STR_PLANE_CRASH_OUT_OF_FUEL                                     :{BLACK}{BIGFONT}Accident aerian!{}Aeronava in pana de combustibil, {COMMA} victime in urma dezastrulu!
 STR_A036                                                        :{TINYFONT}{BLACK}{STATION}
 STR_A037_RENAME                                                 :{BLACK}Redenumire
-STR_A038_RENAME_AIRCRAFT_TYPE                                   :{BLACK}Redenumeste modelul aeronavei
-STR_A039_RENAME_AIRCRAFT_TYPE                                   :{WHITE}Redenumeste modelul aeronavei
-STR_A03A_CAN_T_RENAME_AIRCRAFT_TYPE                             :{WHITE}Nu pot schimba numele aceste aeronave...
-STR_A03B_REFIT_AIRCRAFT_TO_CARRY                                :{BLACK}Schimbã tipul de încãrcãturã transportat
-STR_A03C_REFIT                                                  :{WHITE}{VEHICLE} (Schimbã încãrcãtura)
-STR_A03D_REFIT_AIRCRAFT                                         :{BLACK}Schimbã tipul de încãrcãturã transportat
-STR_A03E_SELECT_TYPE_OF_CARGO_FOR                               :{BLACK}Alege marfa care doresti sã fie transportatã
-STR_A03F_REFIT_AIRCRAFT_TO_CARRY                                :{BLACK}Schimbã tipul de încãrcãturã al acestei aeronave
-STR_A040_SELECT_CARGO_TYPE_TO_CARRY                             :{GOLD}Alege marfa de transportat:
-STR_A041_NEW_CAPACITY_COST_OF_REFIT                             :{BLACK}Noua capacitate: {GOLD}{STRING}{}{BLACK}Costul transformãrii: {GOLD}{CURRENCY}
-STR_A042_CAN_T_REFIT_AIRCRAFT                                   :{WHITE}Nu pot schimba tipul de încãrcãturã...
+STR_A038_RENAME_AIRCRAFT_TYPE                                   :{BLACK}Redenumeşte modelul de aeronavă
+STR_A039_RENAME_AIRCRAFT_TYPE                                   :{WHITE}Redenumeşte modelul de aeronavă
+STR_A03A_CAN_T_RENAME_AIRCRAFT_TYPE                             :{WHITE}Nu se poate redenumi modelul de aeronavă...
+STR_A03B_REFIT_AIRCRAFT_TO_CARRY                                :{BLACK}Schimbă tipul de marfă transportat de aeronavă
+STR_A03C_REFIT                                                  :{WHITE}{VEHICLE} (Schimbă marfa)
+STR_A03D_REFIT_AIRCRAFT                                         :{BLACK}Schimbă marfa transportată de aeronavă
+STR_A03E_SELECT_TYPE_OF_CARGO_FOR                               :{BLACK}Alege tipul de încărcătură ce va fi transportat de aeronavă
+STR_A03F_REFIT_AIRCRAFT_TO_CARRY                                :{BLACK}Schimbă tipul de încărcătură al aeronavei cu cel selectat
+STR_A040_SELECT_CARGO_TYPE_TO_CARRY                             :{GOLD}Alege tipul încărcăturii:
+STR_A041_NEW_CAPACITY_COST_OF_REFIT                             :{BLACK}Noua capacitate: {GOLD}{STRING}{}{BLACK}Costul transformării: {GOLD}{CURRENCY}
+STR_A042_CAN_T_REFIT_AIRCRAFT                                   :{WHITE}Nu se poate schimba tipul aeronavei...
 
 STR_TIMETABLE_TITLE                                             :{WHITE}{VEHICLE} (Orar)
 
 ##id 0xB000
 STR_B000_ZEPPELIN_DISASTER_AT                                   :{BLACK}{BIGFONT}Accident de zepelin la{STATION}!
 STR_B001_ROAD_VEHICLE_DESTROYED                                 :{BLACK}{BIGFONT}Autovehicul distrus în urma coliziunii cu un OZN!
-STR_B002_OIL_REFINERY_EXPLOSION                                 :{BLACK}{BIGFONT}Explozie la o rafinãrie de lângã {TOWN}!
-STR_B003_FACTORY_DESTROYED_IN_SUSPICIOUS                        :{BLACK}{BIGFONT}Fabricã de conserve distrusã în conditii misterioase lângã {TOWN}!
-STR_B004_UFO_LANDS_NEAR                                         :{BLACK}{BIGFONT}Un OZN a aterizat lângã {TOWN}!
-STR_B005_COAL_MINE_SUBSIDENCE_LEAVES                            :{BLACK}{BIGFONT}Prãbusirea unei mine de cupru lângã {TOWN} provoacã daune majore!
+STR_B002_OIL_REFINERY_EXPLOSION                                 :{BLACK}{BIGFONT}Explozie la o rafinărie de lângă {TOWN}!
+STR_B003_FACTORY_DESTROYED_IN_SUSPICIOUS                        :{BLACK}{BIGFONT}Fabrică de conserve distrusă în condiţii misterioase lângă {TOWN}!
+STR_B004_UFO_LANDS_NEAR                                         :{BLACK}{BIGFONT}Un OZN a aterizat lângă {TOWN}!
+STR_B005_COAL_MINE_SUBSIDENCE_LEAVES                            :{BLACK}{BIGFONT}Prăbuşirea unei mine de cărbune lângă {TOWN} provoacă daune majore!
 STR_B006_FLOOD_VEHICLE_DESTROYED                                :{BLACK}{BIGFONT}Inundatii!{}Se estimeaza cel putin {COMMA}  victime!
 
 STR_BRIBE_FAILED                                                :{WHITE}Încercarea ta de mituire
-STR_BRIBE_FAILED_2                                              :{WHITE}a fost descoperitã de un procuror local
+STR_BRIBE_FAILED_2                                              :{WHITE}a fost descoperită de un procuror local
 STR_BUILD_DATE                                                  :{BLACK}Data constructiei: {LTBLUE}{DATE_LONG}
 
-STR_PERFORMANCE_DETAIL                                          :{WHITE}Ratingul de performantã detaliat
+STR_PERFORMANCE_DETAIL                                          :{WHITE}Rating de performanţă detaliat
 STR_PERFORMANCE_DETAIL_KEY                                      :{BLACK}Detalii
 STR_PERFORMANCE_DETAIL_AMOUNT_CURRENCY                          :{BLACK}({CURRCOMPACT}/{CURRCOMPACT})
 STR_PERFORMANCE_DETAIL_AMOUNT_INT                               :{BLACK}({COMMA}/{COMMA})
@@ -3002,7 +3101,7 @@
 STR_PERFORMANCE_DETAIL_MIN_INCOME                               :{BLACK}Venit minim:
 STR_PERFORMANCE_DETAIL_MAX_INCOME                               :{BLACK}Venit maxim:
 STR_PERFORMANCE_DETAIL_DELIVERED                                :{BLACK}Livrãri:
-STR_PERFORMANCE_DETAIL_CARGO                                    :{BLACK}Mãrfuri:
+STR_PERFORMANCE_DETAIL_CARGO                                    :{BLACK}Mărfuri:
 STR_PERFORMANCE_DETAIL_MONEY                                    :{BLACK}Cont curent:
 STR_PERFORMANCE_DETAIL_LOAN                                     :{BLACK}Credite:
 STR_PERFORMANCE_DETAIL_TOTAL                                    :{BLACK}Total:
@@ -3020,7 +3119,7 @@
 
 STR_NEWGRF_SETTINGS_BUTTON                                      :{BLACK}Setari NewGRF
 STR_NEWGRF_SETTINGS_CAPTION                                     :{WHITE}Setari Newgrf
-STR_NEWGRF_APPLY_CHANGES                                        :{BLACK}Aplica schimbarile
+STR_NEWGRF_APPLY_CHANGES                                        :{BLACK}Aplică schimbările
 STR_NEWGRF_SET_PARAMETERS                                       :{BLACK}Seteaza parametri
 STR_NEWGRF_TIP                                                  :{BLACK}Lista tuturor setarilor Newgrf pe care le-ai instalat. Click pentru a schimba setarile.
 STR_NEWGRF_NO_FILES_INSTALLED                                   :{BLACK}Nu exista fisiere newgrf instalate! Citeste manualul pentru instructiunile de instalare a fisierelor grafice noi.
@@ -3073,6 +3172,8 @@
 STR_NEWGRF_UNPAUSE_WARNING_TITLE                                :{YELLOW}Fisier(e) GRF lipsa
 STR_NEWGRF_UNPAUSE_WARNING                                      :{WHITE}Reluarea jocului poate bloca OpenTTD. Nu raportati raporturi cu probleme pentru blocari succesive.{}Sigur doresti sa reiei jocul?
 
+STR_LOADGAME_REMOVED_TRAMS                                      :{WHITE}Jocul a fost salvat într-o versiune fără suport pentru tramvaie. Toate tramvaiele au fost eliminate.
+
 STR_CURRENCY_WINDOW                                             :{WHITE}Monedă proprie
 STR_CURRENCY_EXCHANGE_RATE                                      :{LTBLUE}Curs de schimb: {ORANGE}{CURRENCY} = £ {COMMA}
 STR_CURRENCY_SEPARATOR                                          :{LTBLUE}Separator:
@@ -3099,7 +3200,7 @@
 STR_SCHEDULED_AIRCRAFT_TIP                                      :{BLACK}Afiseaza toate aeronavele care opresc in aceasta statie
 STR_SCHEDULED_SHIPS_TIP                                         :{BLACK}Afiseaza toate navele care opresc in aceasta statie
 
-STR_VEH_WITH_SHARED_ORDERS_LIST                                 :{WHITE}Comenzi comune ale {COMMA} Vehicul{P "" s}
+STR_VEH_WITH_SHARED_ORDERS_LIST                                 :{WHITE}Comenzi sincronizate pentru {COMMA} vehicul{P "" e}
 STR_VEH_WITH_SHARED_ORDERS_LIST_TIP                             :{BLACK}Arata toate vehiculele care se incadreaza in acest program
 
 ### depot strings
@@ -3131,11 +3232,11 @@
 STR_REPLACE_VEHICLES_STOP                                       :{BLACK}Oprire inlocuire vehicule
 STR_NOT_REPLACING                                               :{BLACK}Neinlocuire
 STR_NOT_REPLACING_VEHICLE_SELECTED                              :{BLACK}Nici un vehicul selectat
-STR_REPLACE_HELP_LEFT_ARRAY                                     :{BLACK}Alege tipul de motor pentru inlocuire
-STR_REPLACE_HELP_RIGHT_ARRAY                                    :{BLACK}Alege noul tip de motor pe care doresti sa-l folosesti in locul motorului selectat in stanga
+STR_REPLACE_HELP_LEFT_ARRAY                                     :{BLACK}Alege tipul de motor pentru înlocuire
+STR_REPLACE_HELP_RIGHT_ARRAY                                    :{BLACK}Alege noul tip de motor pe care doreşti să-l foloseşti în locul motorului selectat în stânga
 STR_REPLACE_HELP_STOP_BUTTON                                    :{BLACK}Apasa aici pentru oprirea inlocuirii motorului selectat in stanga
 STR_REPLACE_HELP_START_BUTTON                                   :{BLACK}Apasa aici pentru a incepe inlocuirea motorului selectat in stanga cu cel selectat in dreapta
-STR_REPLACE_HELP_RAILTYPE                                       :{BLACK}Alege un tip de cale ferata pentru care sa inlocuiesti motoarele
+STR_REPLACE_HELP_RAILTYPE                                       :{BLACK}Alege un tip de cale ferată pentru care să înlocuieşti motoarele
 STR_REPLACE_HELP_REPLACE_INFO_TAB                               :{BLACK}Arata care va fi  inlocuitorul motorului selectat in stanga
 STR_REPLACE_HELP                                                :{BLACK}Aceasta functie iti permite sa selectezi un model de vehicul si sa-l inlocuiesti cu altul. Schimbarea se va efectua automat la intrarea vehiculului intr-un depou.
 STR_REPLACE_REMOVE_WAGON                                        :{BLACK}Retragere vagoane: {ORANGE}{SKIP}{STRING}
@@ -3145,7 +3246,7 @@
 STR_RAIL_VEHICLE_NOT_AVAILABLE                                  :{WHITE}Vehiculul nu este disponibil
 STR_ROAD_VEHICLE_NOT_AVAILABLE                                  :{WHITE}Vehiculul nu este disponibil
 STR_SHIP_NOT_AVAILABLE                                          :{WHITE}Vasul nu este disponibil
-STR_AIRCRAFT_NOT_AVAILABLE                                      :{WHITE}Aeronava nu este disponibila
+STR_AIRCRAFT_NOT_AVAILABLE                                      :{WHITE}Aeronava nu este disponibilă
 
 STR_ENGINES                                                     :Motoare
 STR_WAGONS                                                      :Vagoane
@@ -3185,7 +3286,7 @@
 STR_PURCHASE_INFO_RUNNINGCOST                                   :{BLACK}Cost de rulare: {GOLD}{CURRENCY}/an
 STR_PURCHASE_INFO_CAPACITY                                      :{BLACK}Capacitate: {GOLD}{CARGO} {STRING}
 STR_PURCHASE_INFO_DESIGNED_LIFE                                 :{BLACK}An aparitie: {GOLD}{NUM}{BLACK} Durata de viata: {GOLD}{COMMA} years
-STR_PURCHASE_INFO_RELIABILITY                                   :{BLACK}Eficienta max.: {GOLD}{COMMA}%
+STR_PURCHASE_INFO_RELIABILITY                                   :{BLACK}Eficienţă max.: {GOLD}{COMMA}%
 STR_PURCHASE_INFO_COST                                          :{BLACK}Cost: {GOLD}{CURRENCY}
 STR_PURCHASE_INFO_WEIGHT_CWEIGHT                                :{BLACK}Greutate: {GOLD}{WEIGHT_S}  ({WEIGHT_S})
 STR_PURCHASE_INFO_COST_SPEED                                    :{BLACK}Cost: {GOLD}{CURRENCY}{BLACK} Viteza: {GOLD}{VELOCITY}
@@ -3196,6 +3297,12 @@
 STR_PURCHASE_INFO_ALL_BUT                                       :Toate, cu exceptia {GOLD}
 STR_PURCHASE_INFO_MAX_TE                                        :{BLACK}Efort tractor max.: {GOLD}{FORCE}
 
+########### For showing numbers in widgets
+
+STR_NUM_1                                                       :{BLACK}{SKIP}{NUM}
+STR_NUM_2                                                       :{BLACK}{SKIP}{SKIP}{NUM}
+STR_NUM_3                                                       :{BLACK}{SKIP}{SKIP}{SKIP}{NUM}
+
 ########### String for New Landscape Generator
 
 STR_GENERATE                                                    :{WHITE}Genereaza
@@ -3204,6 +3311,7 @@
 STR_WORLD_GENERATION_CAPTION                                    :{WHITE}Generare lume
 STR_RANDOM_SEED                                                 :{BLACK}Parametru aleator:
 STR_RANDOM_SEED_HELP                                            :{BLACK}Click pt introducerea unui parametru aleator
+STR_RANDOM_SEED_OSKTITLE                                        :{BLACK}Introduceţi o valoare de pornire pentru numerele aleatoare
 STR_LAND_GENERATOR                                              :{BLACK}Generator de teren:
 STR_TREE_PLACER                                                 :{BLACK}Algoritm arbore:
 STR_HEIGHTMAP_ROTATION                                          :{BLACK}Rotatie harta inaltimi:
@@ -3334,7 +3442,7 @@
 
 STR_GROUPS_CLICK_ON_GROUP_FOR_TIP                               :{BLACK}Grupuri - Da click pe un grup pentru lista completa a vehiculelor acestuia
 STR_GROUP_CREATE_TIP                                            :{BLACK}Da click pentru a creea un grup
-STR_GROUP_DELETE_TIP                                            :{BLACK}Sterge grupul selectat
+STR_GROUP_DELETE_TIP                                            :{BLACK}Şterge grupul selectat
 STR_GROUP_RENAME_TIP                                            :{BLACK}Redenumeste grupul selectat
 STR_GROUP_REPLACE_PROTECTION_TIP                                :{BLACK}Click aici pentru a proteja acest grup de la inlocuirile automate globale
 
@@ -3356,7 +3464,7 @@
 STR_FUND_NEW_INDUSTRY                                           :{BLACK}Finanteaza
 STR_PROSPECT_NEW_INDUSTRY                                       :{BLACK}Prospecteaza
 STR_BUILD_NEW_INDUSTRY                                          :{BLACK}Construieste
-STR_INDUSTRY_SELECTION_HINT                                     :{BLACK}Alege industria potrivita din acesta lista
+STR_INDUSTRY_SELECTION_HINT                                     :{BLACK}Alege industria potrivită din acestă listă
 
 ############ Face formatting
 STR_FACE_ADVANCED                                               :{BLACK}Avansat
@@ -3375,9 +3483,9 @@
 STR_FACE_SAVE_TIP                                               :{BLACK}Salveaza fata preferata
 STR_FACE_SAVE_DONE                                              :{WHITE}Aceasta fata va fi salvata ca fata preferata în fisierul de configurare al OpenTTD.
 STR_FACE_EUROPEAN                                               :{BLACK}European
-STR_FACE_SELECT_EUROPEAN                                        :{BLACK}Alege fete europene
+STR_FACE_SELECT_EUROPEAN                                        :{BLACK}Alege feţe europene
 STR_FACE_AFRICAN                                                :{BLACK}African
-STR_FACE_SELECT_AFRICAN                                         :{BLACK}Alege fete africane
+STR_FACE_SELECT_AFRICAN                                         :{BLACK}Alege feţe africane
 STR_FACE_YES                                                    :Da
 STR_FACE_NO                                                     :Nu
 STR_FACE_MOUSTACHE_EARRING_TIP                                  :{BLACK}Permite mustata sau cercei
@@ -3422,3 +3530,10 @@
 STR_DRAG_SIGNALS_DENSITY_DECREASE_TIP                           :{BLACK}Scade densitatea semnalului de tractare
 STR_DRAG_SIGNALS_DENSITY_INCREASE_TIP                           :{BLACK}Mareste densitatea semnalului de tractare
 ########
+
+############ on screen keyboard
+########
+
+############ town controlled noise level
+STR_STATION_NOISE                                               :{BLACK}Zgomot generat: {GOLD}{COMMA}
+########
--- a/src/lang/russian.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/russian.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -365,9 +365,9 @@
 STR_SORT_BY                                                     :{BLACK}Сортировка
 
 STR_SORT_BY_POPULATION                                          :{BLACK}Население
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Продукция
-STR_SORT_BY_TYPE                                                :{BLACK}Тип
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Вывоз
+STR_SORT_BY_PRODUCTION                                          :Продукция
+STR_SORT_BY_TYPE                                                :Тип
+STR_SORT_BY_TRANSPORTED                                         :Вывоз
 STR_SORT_BY_NAME                                                :{BLACK}Имя
 STR_SORT_BY_DROPDOWN_NAME                                       :Название
 STR_SORT_BY_DATE                                                :{BLACK}Дата
@@ -380,6 +380,7 @@
 STR_SORT_BY_MAX_SPEED                                           :Максимальная скорость
 STR_SORT_BY_MODEL                                               :Модель
 STR_SORT_BY_VALUE                                               :Стоимость
+STR_SORT_BY_LENGTH                                              :Длина
 STR_SORT_BY_FACILITY                                            :Тип станции
 STR_SORT_BY_WAITING                                             :Кол-во товара на станции
 STR_SORT_BY_RATING_MAX                                          :Рейтинг грузов
@@ -487,6 +488,9 @@
 STR_01A5_COST_TO_CLEAR                                          :{BLACK}Чтобы очистить, надо: {LTBLUE}{CURRENCY}
 STR_01A6_N_A                                                    :нет данных
 STR_01A7_OWNER                                                  :{BLACK}Владелец: {LTBLUE}{STRING}
+STR_ROAD_OWNER                                                  :{BLACK}Владелец дороги: {LTBLUE}{STRING}
+STR_TRAM_OWNER                                                  :{BLACK}Владелец трамвая: {LTBLUE}{STRING}
+STR_RAIL_OWNER                                                  :{BLACK}Владелец ЖД пути: {LTBLUE}{STRING}
 STR_01A8_LOCAL_AUTHORITY                                        :{BLACK}Администрация: {LTBLUE}{STRING}
 STR_01A9_NONE                                                   :Нет
 STR_01AA_NAME                                                   :{BLACK}Имя
@@ -1055,6 +1059,7 @@
 STR_CONFIG_PATCHES_PLANE_SPEED                                  :{LTBLUE}Коэффициент скорости авиатранспорта: {ORANGE}1 / {STRING}
 STR_CONFIG_PATCHES_STOP_ON_TOWN_ROAD                            :{LTBLUE}Позволять строить остановки на городских дорогах: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_ADJACENT_STATIONS                            :{LTBLUE}Разрешить строительство смежных станций: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_DYNAMIC_ENGINES                              :{LTBLUE}Включить поддержку нескольких NewGRF сетов: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_SMALL_AIRPORTS                               :{LTBLUE}Малые аэропорты всегда доступны: {ORANGE}{STRING}
 
@@ -1457,7 +1462,7 @@
 STR_NETWORK_LANG_SWEDISH                                        :Шведский
 STR_NETWORK_LANG_TURKISH                                        :Турецкий
 STR_NETWORK_LANG_UKRAINIAN                                      :Украинский
-STR_NETWORK_LANG_AFRIKAANS                                      :Африканский
+STR_NETWORK_LANG_AFRIKAANS                                      :Африкаанс
 STR_NETWORK_LANG_CROATIAN                                       :Хорватский
 STR_NETWORK_LANG_CATALAN                                        :Каталанский
 STR_NETWORK_LANG_ESTONIAN                                       :Эстонский
@@ -1714,6 +1719,7 @@
 STR_1816_TREE_LINED_ROAD                                        :Шоссе
 STR_1817_ROAD_VEHICLE_DEPOT                                     :Гараж
 STR_1818_ROAD_RAIL_LEVEL_CROSSING                               :Железнодорожный переезд
+STR_TRAMWAY                                                     :Трамвай
 STR_CAN_T_REMOVE_BUS_STATION                                    :{WHITE}Невозможно удалить автобусную остановку...
 STR_CAN_T_REMOVE_TRUCK_STATION                                  :{WHITE}Невозможно удалить грузовой терминал...
 STR_CAN_T_REMOVE_PASSENGER_TRAM_STATION                         :{WHITE}Не могу удалить пассажирскую трамвайную станцию...
@@ -2667,6 +2673,8 @@
 STR_8801_CITIZENS_CELEBRATE_FIRST                               :{BLACK}{BIGFONT}Жители празднуют!{}Первый поезд прибыл на станцию {STATION}!
 STR_8802_DETAILS                                                :{WHITE}{VEHICLE} (Детали)
 STR_8803_TRAIN_IN_THE_WAY                                       :{WHITE}Поезд мешает
+STR_8804                                                        :{SETX 10}{COMMA}: {STRING} {STRING}
+STR_8805                                                        :{RIGHTARROW}{SETX 10}{COMMA}: {STRING} {STRING}
 STR_ORDER_GO_TO                                                 :Идти на
 STR_ORDER_GO_NON_STOP_TO                                        :Идти без остановки на
 STR_ORDER_GO_VIA                                                :Идти через
@@ -3192,6 +3200,8 @@
 STR_NEWGRF_UNPAUSE_WARNING_TITLE                                :{YELLOW}Пропущенные GRF файлы
 STR_NEWGRF_UNPAUSE_WARNING                                      :{WHITE}Снятие с паузы может привести к ошибке OpenTTD.{}Вы хотите запустить игру?
 
+STR_LOADGAME_REMOVED_TRAMS                                      :{WHITE}Игра была сохранена в игре без поддержки трамваев. Все трамваи были отключены.
+
 STR_CURRENCY_WINDOW                                             :{WHITE}Своя валюта
 STR_CURRENCY_EXCHANGE_RATE                                      :{LTBLUE}Обменный курс: {ORANGE}{CURRENCY} = £{COMMA}
 STR_CURRENCY_SEPARATOR                                          :{LTBLUE}Разделитель:
@@ -3556,3 +3566,9 @@
 STR_OSK_KEYBOARD_LAYOUT                                         :`1234567890-=\qwertyuiop[]asdfghjkl;'  zxcvbnm,./ .
 STR_OSK_KEYBOARD_LAYOUT_CAPS                                    :~!@#$%^&*()_+|QWERTYUIOP{{}}ASDFGHJKL:"  ZXCVBNM<>? .
 ########
+
+############ town controlled noise level
+STR_CONFIG_PATCHES_NOISE_LEVEL                                  :{LTBLUE}Разрешить городам контролировать уровень шума для аэропортов: {ORANGE}{STRING}
+STR_NOISE_IN_TOWN                                               :{BLACK}Уровень шума в городе: {ORANGE}{COMMA}{BLACK}  макс: {ORANGE}{COMMA}
+STR_STATION_NOISE                                               :{BLACK}Производимый шум: {GOLD}{COMMA}
+########
--- a/src/lang/simplified_chinese.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/simplified_chinese.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -361,9 +361,9 @@
 STR_SORT_BY                                                     :{BLACK}排序
 
 STR_SORT_BY_POPULATION                                          :{BLACK}人口
-STR_SORT_BY_PRODUCTION                                          :{BLACK}产出
-STR_SORT_BY_TYPE                                                :{BLACK}类型
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}已运输
+STR_SORT_BY_PRODUCTION                                          :产出
+STR_SORT_BY_TYPE                                                :类型
+STR_SORT_BY_TRANSPORTED                                         :已运输
 STR_SORT_BY_NAME                                                :{BLACK}姓名
 STR_SORT_BY_DROPDOWN_NAME                                       :姓名
 STR_SORT_BY_DATE                                                :{BLACK}日期
--- a/src/lang/slovak.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/slovak.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -427,9 +427,9 @@
 STR_SORT_BY                                                     :{BLACK}Usporiadat
 
 STR_SORT_BY_POPULATION                                          :{BLACK}Populacia
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Produkcia
-STR_SORT_BY_TYPE                                                :{BLACK}Typ
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Prepravene
+STR_SORT_BY_PRODUCTION                                          :Produkcia
+STR_SORT_BY_TYPE                                                :Typ
+STR_SORT_BY_TRANSPORTED                                         :Prepravene
 STR_SORT_BY_NAME                                                :{BLACK}Nazov
 STR_SORT_BY_DROPDOWN_NAME                                       :Nazov
 STR_SORT_BY_DATE                                                :{BLACK}Datum
--- a/src/lang/slovenian.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/slovenian.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -405,9 +405,9 @@
 STR_SORT_BY                                                     :{BLACK}Sortiraj po
 
 STR_SORT_BY_POPULATION                                          :{BLACK}Prebivalstvo
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Proizvodnja
-STR_SORT_BY_TYPE                                                :{BLACK}Tip
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Prepeljano
+STR_SORT_BY_PRODUCTION                                          :Proizvodnja
+STR_SORT_BY_TYPE                                                :Tip
+STR_SORT_BY_TRANSPORTED                                         :Prepeljano
 STR_SORT_BY_NAME                                                :{BLACK}Ime
 STR_SORT_BY_DROPDOWN_NAME                                       :Ime
 STR_SORT_BY_DATE                                                :{BLACK}Datum
--- a/src/lang/spanish.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/spanish.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -364,9 +364,9 @@
 STR_SORT_BY                                                     :{BLACK}Ordenar por
 
 STR_SORT_BY_POPULATION                                          :{BLACK}Población
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Producción
-STR_SORT_BY_TYPE                                                :{BLACK}Tipo
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Transportado
+STR_SORT_BY_PRODUCTION                                          :Producción
+STR_SORT_BY_TYPE                                                :Tipo
+STR_SORT_BY_TRANSPORTED                                         :Transportado
 STR_SORT_BY_NAME                                                :{BLACK}Nombre
 STR_SORT_BY_DROPDOWN_NAME                                       :Nombre
 STR_SORT_BY_DATE                                                :{BLACK}Fecha
@@ -379,6 +379,7 @@
 STR_SORT_BY_MAX_SPEED                                           :Velocidad máxima
 STR_SORT_BY_MODEL                                               :Modelo
 STR_SORT_BY_VALUE                                               :Valor
+STR_SORT_BY_LENGTH                                              :Longitud
 STR_SORT_BY_FACILITY                                            :Tipo de estación
 STR_SORT_BY_WAITING                                             :Esperando valor de la carga
 STR_SORT_BY_RATING_MAX                                          :Clasificación de la carga
@@ -486,6 +487,9 @@
 STR_01A5_COST_TO_CLEAR                                          :{BLACK}Coste de desbroce: {LTBLUE}{CURRENCY}
 STR_01A6_N_A                                                    :N/D
 STR_01A7_OWNER                                                  :{BLACK}Propietario: {LTBLUE}{STRING}
+STR_ROAD_OWNER                                                  :{BLACK}Propietario de la carretera: {LTBLUE}{STRING}
+STR_TRAM_OWNER                                                  :{BLACK}Propietario del tranvía: {LTBLUE}{STRING}
+STR_RAIL_OWNER                                                  :{BLACK}Propietario de la vía del tren: {LTBLUE}{STRING}
 STR_01A8_LOCAL_AUTHORITY                                        :{BLACK}Autoridad local: {LTBLUE}{STRING}
 STR_01A9_NONE                                                   :Ninguna
 STR_01AA_NAME                                                   :{BLACK}Nombre
@@ -1054,6 +1058,7 @@
 STR_CONFIG_PATCHES_PLANE_SPEED                                  :{LTBLUE}Factor velocidad avión: {ORANGE}1 / {STRING}
 STR_CONFIG_PATCHES_STOP_ON_TOWN_ROAD                            :{LTBLUE}Permite conducir en paradas sobre carreteras de ciudades: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_ADJACENT_STATIONS                            :{LTBLUE}Permitir construcción en estaciones contiguas : {ORANGE}{STRING}
+STR_CONFIG_PATCHES_DYNAMIC_ENGINES                              :{LTBLUE}Activar motor  de multiples NewGRF: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_SMALL_AIRPORTS                               :{LTBLUE}Permitir siempre aeropuertos pequeños: {ORANGE}{STRING}
 
@@ -1364,6 +1369,8 @@
 STR_NETWORK_GAME_NAME_TIP                                       :{BLACK}Nombre del juego
 STR_NETWORK_INFO_ICONS_TIP                                      :{BLACK}Idioma, versión del servidor, etc.
 STR_NETWORK_CLICK_GAME_TO_SELECT                                :{BLACK}Pulse en un juego de la lista para seleccionarlo
+STR_NETWORK_LAST_JOINED_SERVER                                  :{BLACK}El servidor al que has estado conectado la última vez:
+STR_NETWORK_CLICK_TO_SELECT_LAST                                :{BLACK}Pulsa para seleccionar el servidor al que has jugado la última vez
 
 STR_NETWORK_FIND_SERVER                                         :{BLACK}Buscar servidor
 STR_NETWORK_FIND_SERVER_TIP                                     :{BLACK}Buscar en la red servidores
@@ -1711,6 +1718,7 @@
 STR_1816_TREE_LINED_ROAD                                        :Carretera arbolada
 STR_1817_ROAD_VEHICLE_DEPOT                                     :Depósito de carretera
 STR_1818_ROAD_RAIL_LEVEL_CROSSING                               :Paso a nivel
+STR_TRAMWAY                                                     :Tranvía
 STR_CAN_T_REMOVE_BUS_STATION                                    :{WHITE}No se puede quitar la estación de bus...
 STR_CAN_T_REMOVE_TRUCK_STATION                                  :{WHITE}No se puede quitar la estación de camiones...
 STR_CAN_T_REMOVE_PASSENGER_TRAM_STATION                         :{WHITE}No se puede quitar estación de tranvía de pasajeros...
@@ -3180,6 +3188,8 @@
 STR_NEWGRF_UNPAUSE_WARNING_TITLE                                :{YELLOW}Fichero(s) GRF que faltan
 STR_NEWGRF_UNPAUSE_WARNING                                      :{WHITE}Quitar la pausa puede hacer que se cierre OpenTTD. No notifique este error.{}¿Desea realmente quitar la pausa?
 
+STR_LOADGAME_REMOVED_TRAMS                                      :{WHITE}El juego ha sido grabado en una versión sin soporte de tranvía. Todos los tranvías serán eliminados.
+
 STR_CURRENCY_WINDOW                                             :{WHITE}Moneda personalizada
 STR_CURRENCY_EXCHANGE_RATE                                      :{LTBLUE}Tasa de cambio: {ORANGE}{CURRENCY} = £ {COMMA}
 STR_CURRENCY_SEPARATOR                                          :{LTBLUE}Separador:
@@ -3544,3 +3554,9 @@
 STR_OSK_KEYBOARD_LAYOUT                                         :`1234567890-=\qwertyuiop[]asdfghjkl;'  zxcvbnm,./ .
 STR_OSK_KEYBOARD_LAYOUT_CAPS                                    :~!@#$%^&*()_+|QWERTYUIOP{{}}ASDFGHJKL:"  ZXCVBNM<>? .
 ########
+
+############ town controlled noise level
+STR_CONFIG_PATCHES_NOISE_LEVEL                                  :{LTBLUE}Permitir a la ciudad controlar el nivel de ruidos de los aeropuertos: {ORANGE}{STRING}
+STR_NOISE_IN_TOWN                                               :{BLACK}Nivel de ruido en ciudad: {ORANGE}{COMMA}{BLACK}  max: {ORANGE}{COMMA}
+STR_STATION_NOISE                                               :{BLACK}Ruido generado: {GOLD}{COMMA}
+########
--- a/src/lang/swedish.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/swedish.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -363,9 +363,9 @@
 STR_SORT_BY                                                     :{BLACK}Sortera efter
 
 STR_SORT_BY_POPULATION                                          :{BLACK}Befolkning
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Produktion
-STR_SORT_BY_TYPE                                                :{BLACK}Typ
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Transporterat
+STR_SORT_BY_PRODUCTION                                          :Produktion
+STR_SORT_BY_TYPE                                                :Typ
+STR_SORT_BY_TRANSPORTED                                         :Transporterat
 STR_SORT_BY_NAME                                                :{BLACK}Namn
 STR_SORT_BY_DROPDOWN_NAME                                       :Namn
 STR_SORT_BY_DATE                                                :{BLACK}Datum
@@ -378,6 +378,7 @@
 STR_SORT_BY_MAX_SPEED                                           :Maximal hastighet
 STR_SORT_BY_MODEL                                               :Modell
 STR_SORT_BY_VALUE                                               :Värde
+STR_SORT_BY_LENGTH                                              :Längd
 STR_SORT_BY_FACILITY                                            :Stationstyp
 STR_SORT_BY_WAITING                                             :Väntande last-värde
 STR_SORT_BY_RATING_MAX                                          :Lasts-värdering
@@ -485,6 +486,9 @@
 STR_01A5_COST_TO_CLEAR                                          :{BLACK}Kostnad att röja: {LTBLUE}{CURRENCY}
 STR_01A6_N_A                                                    :Otillgänglig
 STR_01A7_OWNER                                                  :{BLACK}Ägare: {LTBLUE}{STRING}
+STR_ROAD_OWNER                                                  :{BLACK}Vägens ägare: {LTBLUE}{STRING}
+STR_TRAM_OWNER                                                  :{BLACK}Spårvägens ägare: {LTBLUE}{STRING}
+STR_RAIL_OWNER                                                  :{BLACK}Järnvägens ägare: {LTBLUE}{STRING}
 STR_01A8_LOCAL_AUTHORITY                                        :{BLACK}Lokala myndigheter: {LTBLUE}{STRING}
 STR_01A9_NONE                                                   :Ingen
 STR_01AA_NAME                                                   :{BLACK}Namn
@@ -1053,6 +1057,7 @@
 STR_CONFIG_PATCHES_PLANE_SPEED                                  :{LTBLUE}Hastighetsfaktor för flygplan: {ORANGE}1 / {STRING}
 STR_CONFIG_PATCHES_STOP_ON_TOWN_ROAD                            :{LTBLUE}Tillåt genomfarts-stop på stadsägda vägar: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_ADJACENT_STATIONS                            :{LTBLUE}Tillåt byggande av närliggande stationer: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_DYNAMIC_ENGINES                              :{LTBLUE}Tillåt flera NewGRF-set: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_SMALL_AIRPORTS                               :{LTBLUE}Tillåt alltid små flygplatser: {ORANGE}{STRING}
 
@@ -1363,6 +1368,8 @@
 STR_NETWORK_GAME_NAME_TIP                                       :{BLACK}Namn på nätverksspelet
 STR_NETWORK_INFO_ICONS_TIP                                      :{BLACK}Språk, serverversion, mm
 STR_NETWORK_CLICK_GAME_TO_SELECT                                :{BLACK}Klicka på ett spel från listan för att välja det
+STR_NETWORK_LAST_JOINED_SERVER                                  :{BLACK}Servern du senast anslöt till:
+STR_NETWORK_CLICK_TO_SELECT_LAST                                :{BLACK}Välj servern du senast spelade på
 
 STR_NETWORK_FIND_SERVER                                         :{BLACK}Leta server
 STR_NETWORK_FIND_SERVER_TIP                                     :{BLACK}Leta på nätverket efter en server
@@ -1710,6 +1717,7 @@
 STR_1816_TREE_LINED_ROAD                                        :Väg med träd
 STR_1817_ROAD_VEHICLE_DEPOT                                     :Bussgarage
 STR_1818_ROAD_RAIL_LEVEL_CROSSING                               :Väg-/Järnvägskorsning
+STR_TRAMWAY                                                     :Spårväg
 STR_CAN_T_REMOVE_BUS_STATION                                    :{WHITE}Kan inte ta bort busstation...
 STR_CAN_T_REMOVE_TRUCK_STATION                                  :{WHITE}Kan inte ta bort lastbilsstation...
 STR_CAN_T_REMOVE_PASSENGER_TRAM_STATION                         :{WHITE}Kan inte ta bort passagerar-spårvagnsstation...
@@ -2779,6 +2787,7 @@
 STR_882D_VALUE                                                  :{LTBLUE}{ENGINE}{BLACK}   Värde: {LTBLUE}{CURRENCY}
 STR_882E                                                        :{WHITE}{VEHICLE}
 STR_882F_LOADING_UNLOADING                                      :{LTBLUE}Lastar / lastar av
+STR_LEAVING                                                     :{LTBLUE}Lämnar
 STR_TRAIN_MUST_BE_STOPPED                                       :{WHITE}Tåget måste stoppas inne i depån
 STR_8830_CAN_T_SEND_TRAIN_TO_DEPOT                              :{WHITE}Kan inte skicka tåg till depå...
 STR_8831_NO_MORE_SPACE_FOR_ORDERS                               :{WHITE}Ingen mer plats för order
@@ -3178,6 +3187,8 @@
 STR_NEWGRF_UNPAUSE_WARNING_TITLE                                :{YELLOW}Saknad(e) GRF-fil(er)
 STR_NEWGRF_UNPAUSE_WARNING                                      :{WHITE}Avpausning kan krascha OpenTTD. Skicka ej igen bugg-rapport för möjlig krasch.{}Är du säker att du vill avpausa?
 
+STR_LOADGAME_REMOVED_TRAMS                                      :{WHITE}Spelet sparades i en version som ej stöder spårvagn. Alla spårvagnar har tagits bort
+
 STR_CURRENCY_WINDOW                                             :{WHITE}Egen valuta
 STR_CURRENCY_EXCHANGE_RATE                                      :{LTBLUE}Växlingskurs: {ORANGE}{CURRENCY} = £ {COMMA}
 STR_CURRENCY_SEPARATOR                                          :{LTBLUE}Avskiljare:
@@ -3542,3 +3553,9 @@
 STR_OSK_KEYBOARD_LAYOUT                                         :`1234567890-=\qwertyuiop[]asdfghjkl;'  zxcvbnm,./ .
 STR_OSK_KEYBOARD_LAYOUT_CAPS                                    :~!@#$%^&*()_+|QWERTYUIOP{{}}ASDFGHJKL:"  ZXCVBNM<>? .
 ########
+
+############ town controlled noise level
+STR_CONFIG_PATCHES_NOISE_LEVEL                                  :{LTBLUE}Tillåt stadskontrollerade bullernivåer för flygplatser: {ORANGE}{STRING}
+STR_NOISE_IN_TOWN                                               :{BLACK}Bullernivågräns i stad: {ORANGE}{COMMA}{BLACK}  max: {ORANGE}{COMMA}
+STR_STATION_NOISE                                               :{BLACK}Genererat buller: {GOLD}{COMMA}
+########
--- a/src/lang/traditional_chinese.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/traditional_chinese.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -361,9 +361,9 @@
 STR_SORT_BY                                                     :{BLACK}排序依照
 
 STR_SORT_BY_POPULATION                                          :{BLACK}人口
-STR_SORT_BY_PRODUCTION                                          :{BLACK}產量
-STR_SORT_BY_TYPE                                                :{BLACK}種類
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}輸出量
+STR_SORT_BY_PRODUCTION                                          :產量
+STR_SORT_BY_TYPE                                                :種類
+STR_SORT_BY_TRANSPORTED                                         :輸出量
 STR_SORT_BY_NAME                                                :{BLACK}名稱
 STR_SORT_BY_DROPDOWN_NAME                                       :名稱
 STR_SORT_BY_DATE                                                :{BLACK}日期
--- a/src/lang/turkish.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/turkish.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -361,9 +361,9 @@
 STR_SORT_BY                                                     :{BLACK}Sırala
 
 STR_SORT_BY_POPULATION                                          :{BLACK}Nüfus
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Üretim
-STR_SORT_BY_TYPE                                                :{BLACK}Tür
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Taşınan
+STR_SORT_BY_PRODUCTION                                          :Üretim
+STR_SORT_BY_TYPE                                                :Tür
+STR_SORT_BY_TRANSPORTED                                         :Taşınan
 STR_SORT_BY_NAME                                                :{BLACK}İsim
 STR_SORT_BY_DROPDOWN_NAME                                       :İsim
 STR_SORT_BY_DATE                                                :{BLACK}Tarih
@@ -1380,7 +1380,7 @@
 STR_NETWORK_SERVER_ADDRESS                                      :{SILVER}Sunucu adresi:  {WHITE}{STRING} : {NUM}
 STR_NETWORK_START_DATE                                          :{SILVER}Başlama tarihi:  {WHITE}{DATE_SHORT}
 STR_NETWORK_CURRENT_DATE                                        :{SILVER}Şimdiki tarih:  {WHITE}{DATE_SHORT}
-STR_NETWORK_PASSWORD                                            :{SILVER}Şifre korumalı!
+STR_NETWORK_PASSWORD                                            :{SILVER}Parola korumalı!
 STR_NETWORK_SERVER_OFFLINE                                      :{SILVER}SUNUCU KAPALI
 STR_NETWORK_SERVER_FULL                                         :{SILVER}SUNUCU DOLU
 STR_NETWORK_VERSION_MISMATCH                                    :{SILVER}SÜRÜM UYUŞMAZLIĞI
@@ -2649,6 +2649,44 @@
 STR_8801_CITIZENS_CELEBRATE_FIRST                               :{BLACK}{BIGFONT}Kutlama Yapıldı . . .{} {STATION} istasyonuna ilk kez tren geldi!
 STR_8802_DETAILS                                                :{WHITE}{VEHICLE} (Detaylar)
 STR_8803_TRAIN_IN_THE_WAY                                       :{WHITE}Yolda tren var
+STR_ORDER_GO_VIA                                                :Üzerinden git
+STR_ORDER_GO_NON_STOP_VIA                                       :Durmadan üzerinden git
+STR_ORDER_DROP_LOAD_IF_POSSIBLE                                 :Mümkünse yükle
+STR_ORDER_DROP_FULL_LOAD_ALL                                    :Tüm kargoyu yükle
+STR_ORDER_DROP_FULL_LOAD_ANY                                    :Her kargoyu yükle
+STR_ORDER_DROP_NO_LOADING                                       :Yükleme yapma
+STR_ORDER_DROP_UNLOAD_IF_ACCEPTED                               :Kabul edilirse yükle
+STR_ORDER_DROP_UNLOAD                                           :Tümünü boşalt
+STR_ORDER_DROP_TRANSFER                                         :Aktar
+STR_ORDER_DROP_NO_UNLOADING                                     :Boşaltma yapma
+STR_ORDER_FULL_LOAD                                             :(Tam yükle)
+STR_ORDER_FULL_LOAD_ANY                                         :(Her kargoyu tam yükle)
+STR_ORDER_NO_LOAD                                               :(Yükleme yapma)
+STR_ORDER_UNLOAD                                                :(Kargoyu boşalt ve al)
+STR_ORDER_UNLOAD_FULL_LOAD                                      :(Boşalt ve tam yüklemeyi bekle)
+STR_ORDER_UNLOAD_NO_LOAD                                        :(Boşalt ve boş kal)
+STR_ORDER_TRANSFER                                              :(Aktar ve kargoyu al)
+STR_GO_TO_STATION                                               :{STRING} {STATION} {STRING}
+
+STR_ORDER_GO_TO_DROPDOWN_TOOLTIP                                :{BLACK}Gelişmiş talimat ekle
+STR_ORDER_GO_TO_NEAREST_DEPOT                                   :En yakın gara git
+STR_ORDER_GO_TO_NEAREST_HANGAR                                  :En yakın hangara git
+STR_ORDER_NEAREST_DEPOT                                         :en yakın
+STR_ORDER_NEAREST_HANGAR                                        :en yakın Hangar
+STR_ORDER_TRAIN_DEPOT                                           :Tren Garı
+STR_ORDER_ROAD_DEPOT                                            :Araba Garajı
+STR_ORDER_SHIP_DEPOT                                            :Tershane
+STR_GO_TO_DEPOT                                                 :{STRING} {TOWN} {STRING}
+STR_GO_TO_NEAREST_DEPOT                                         :{STRING} {STRING} {STRING}
+STR_GO_TO_HANGAR                                                :{STRING} {STATION} Hangar
+
+STR_ORDER_CONDITIONAL_LOAD_PERCENTAGE                           :Yükleme yüzdesi
+STR_ORDER_CONDITIONAL_RELIABILITY                               :Güvenilirlik
+STR_ORDER_CONDITIONAL_MAX_SPEED                                 :Azami hız
+STR_ORDER_CONDITIONAL_AGE                                       :Araç yaşı (yıl)
+STR_ORDER_CONDITIONAL_REQUIRES_SERVICE                          :Bakım gerektirir
+STR_ORDER_CONDITIONAL_UNCONDITIONALLY                           :Her zaman
+STR_CONDITIONAL_VALUE                                           :{SKIP}{BLACK}{COMMA}
 
 STR_TIMETABLE_TRAVEL_NOT_TIMETABLED                             :Gezi (zamanlı değil)
 STR_TIMETABLE_TRAVEL_FOR                                        :{STRING} için gezi
@@ -2696,6 +2734,7 @@
 STR_REFIT_ORDER                                                 :(Moifiye ile > {STRING})
 STR_TIMETABLE_VIEW                                              :{BLACK}Zaman çizelgesi
 STR_TIMETABLE_VIEW_TOOLTIP                                      :{BLACK}Zaman tablosu görünümüne geç
+STR_ORDER_VIEW                                                  :{BLACK}Talimatlar
 STR_8829_ORDERS                                                 :{WHITE}{VEHICLE} (Talimatlar)
 STR_882A_END_OF_ORDERS                                          :{SETX 10}- - Talimatların Sonu - -
 STR_SERVICE                                                     :{BLACK}Bakım
@@ -3102,6 +3141,7 @@
 STR_NEWGRF_NOT_FOUND_WARNING                                    :{WHITE}Oyunu yüklemek için gerekli olan GRF dosyaları eksik
 STR_NEWGRF_UNPAUSE_WARNING_TITLE                                :{YELLOW}Eksik GRF dosyası
 
+
 STR_CURRENCY_WINDOW                                             :{WHITE}Özel Para Birimi
 STR_CURRENCY_EXCHANGE_RATE                                      :{LTBLUE}Çarpan: {ORANGE}{CURRENCY} = £ {COMMA}
 STR_CURRENCY_SEPARATOR                                          :{LTBLUE}Ayraç:
@@ -3385,10 +3425,12 @@
 #### Improved sign GUI
 STR_NEXT_SIGN_TOOLTIP                                           :{BLACK}Sonraki tabelaya git
 STR_PREVIOUS_SIGN_TOOLTIP                                       :{BLACK}Önceki tabelaya git
+STR_SIGN_OSKTITLE                                               :{BLACK}Tabela için bir isim girin
 
 ########
 
 STR_FUND_NEW_INDUSTRY                                           :{BLACK}Parayla Yap
+STR_PROSPECT_NEW_INDUSTRY                                       :{BLACK}Tetkik arama
 STR_BUILD_NEW_INDUSTRY                                          :{BLACK}İnşa et
 STR_INDUSTRY_SELECTION_HINT                                     :{BLACK}Bu listeden uygun fabrikayı seçin
 
@@ -3450,3 +3492,6 @@
 
 ############ on screen keyboard
 ########
+
+############ town controlled noise level
+########
--- a/src/lang/ukrainian.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/ukrainian.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -488,9 +488,9 @@
 STR_SORT_BY                                                     :{BLACK}Сортувати
 
 STR_SORT_BY_POPULATION                                          :{BLACK}за населенням
-STR_SORT_BY_PRODUCTION                                          :{BLACK}за продуктивністю
-STR_SORT_BY_TYPE                                                :{BLACK}за типом
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}за перевезенням
+STR_SORT_BY_PRODUCTION                                          :за продуктивністю
+STR_SORT_BY_TYPE                                                :за типом
+STR_SORT_BY_TRANSPORTED                                         :за перевезенням
 STR_SORT_BY_NAME                                                :{BLACK}за назвою
 STR_SORT_BY_DROPDOWN_NAME                                       :Назва
 STR_SORT_BY_DATE                                                :{BLACK}за датою
@@ -503,6 +503,7 @@
 STR_SORT_BY_MAX_SPEED                                           :за швидкістю
 STR_SORT_BY_MODEL                                               :Модель
 STR_SORT_BY_VALUE                                               :за ціною
+STR_SORT_BY_LENGTH                                              :Довжина
 STR_SORT_BY_FACILITY                                            :Вид станцій
 STR_SORT_BY_WAITING                                             :за ціною вантажу
 STR_SORT_BY_RATING_MAX                                          :Рейтинг вантажів
@@ -610,6 +611,9 @@
 STR_01A5_COST_TO_CLEAR                                          :{BLACK}Вартість очистки: {LTBLUE}{CURRENCY}
 STR_01A6_N_A                                                    :немає
 STR_01A7_OWNER                                                  :{BLACK}Власник: {LTBLUE}{STRING}
+STR_ROAD_OWNER                                                  :{BLACK}Власник дороги: {LTBLUE}{STRING}
+STR_TRAM_OWNER                                                  :{BLACK}Власник трамвайної дороги: {LTBLUE}{STRING}
+STR_RAIL_OWNER                                                  :{BLACK}Власник залізниці: {LTBLUE}{STRING}
 STR_01A8_LOCAL_AUTHORITY                                        :{BLACK}Місцева влада: {LTBLUE}{STRING}
 STR_01A9_NONE                                                   :немає
 STR_01AA_NAME                                                   :{BLACK}Назва
@@ -1178,6 +1182,7 @@
 STR_CONFIG_PATCHES_PLANE_SPEED                                  :{LTBLUE}Фактор швидкості літаків: {ORANGE}1 / {STRING}
 STR_CONFIG_PATCHES_STOP_ON_TOWN_ROAD                            :{LTBLUE}Дозволити безпересадкові зупинки на муніципальних дорогах: {ORANGE}{STRING}
 STR_CONFIG_PATCHES_ADJACENT_STATIONS                            :{LTBLUE}Дозволити будувати суміжні станції: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_DYNAMIC_ENGINES                              :{LTBLUE}Дозволити декілька NewGRF наборів транспорту: {ORANGE}{STRING}
 
 STR_CONFIG_PATCHES_SMALL_AIRPORTS                               :{LTBLUE}Будувати малі аеропорти можна завжди: {ORANGE}{STRING}
 
@@ -1837,6 +1842,7 @@
 STR_1816_TREE_LINED_ROAD                                        :Дорога з насадженнями
 STR_1817_ROAD_VEHICLE_DEPOT                                     :Автомобільне депо
 STR_1818_ROAD_RAIL_LEVEL_CROSSING                               :Залізничний переїзд
+STR_TRAMWAY                                                     :Трамвайна дорога
 STR_CAN_T_REMOVE_BUS_STATION                                    :{WHITE}Не можна знести автобусну станцію...
 STR_CAN_T_REMOVE_TRUCK_STATION                                  :{WHITE}Не можна знести вантажну станцію...
 STR_CAN_T_REMOVE_PASSENGER_TRAM_STATION                         :{WHITE}Не можна знести пасажирську трамвайну станцію...
@@ -3343,6 +3349,8 @@
 STR_NEWGRF_UNPAUSE_WARNING_TITLE                                :{YELLOW}Відсутній GRF файл(и)
 STR_NEWGRF_UNPAUSE_WARNING                                      :{WHITE}Зняття з паузи може привести до аварійної відмови OpenTTD. Не рапортуйте про наступні відмови.{}Ви дійсно хочете зняти з паузи?
 
+STR_LOADGAME_REMOVED_TRAMS                                      :{WHITE}Гра була записана у версії без підтримки трамваїв. Усі трамваї були видалені.
+
 STR_CURRENCY_WINDOW                                             :{WHITE}Вибір грошової одиниці
 STR_CURRENCY_EXCHANGE_RATE                                      :{LTBLUE}Валютний курс: {ORANGE}{CURRENCY} = Ј {COMMA}
 STR_CURRENCY_SEPARATOR                                          :{LTBLUE}Роздільник:
@@ -3707,3 +3715,9 @@
 STR_OSK_KEYBOARD_LAYOUT                                         :`1234567890-=\йцукенгшщзхїфівапролджє  ячсмитьбю. .
 STR_OSK_KEYBOARD_LAYOUT_CAPS                                    :~!@#$%^&*()_+|ЙЦУКЕНГШЩЗХЇФІВАПРОЛДЖЄ  ЯЧСМИТЬБЮ, .
 ########
+
+############ town controlled noise level
+STR_CONFIG_PATCHES_NOISE_LEVEL                                  :{LTBLUE}Дозволити залежний від міста рівень шуму для аеропортів: {ORANGE}{STRING}
+STR_NOISE_IN_TOWN                                               :{BLACK}Ліміт шуму в місті: {ORANGE}{COMMA}{BLACK}  макс: {ORANGE}{COMMA}
+STR_STATION_NOISE                                               :{BLACK}Генерований шум: {GOLD}{COMMA}
+########
--- a/src/lang/unfinished/greek.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/unfinished/greek.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -360,9 +360,9 @@
 STR_SORT_BY                                                     :{BLACK}Ταξινόμηση κατά
 
 STR_SORT_BY_POPULATION                                          :{BLACK}Πληθυσμός
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Παραγωγή
-STR_SORT_BY_TYPE                                                :{BLACK}Τύπος
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Μεταφέρθηκαν
+STR_SORT_BY_PRODUCTION                                          :Παραγωγή
+STR_SORT_BY_TYPE                                                :Τύπος
+STR_SORT_BY_TRANSPORTED                                         :Μεταφέρθηκαν
 STR_SORT_BY_NAME                                                :{BLACK}Όνομα
 STR_SORT_BY_DROPDOWN_NAME                                       :Όνομα
 STR_SORT_BY_DATE                                                :{BLACK}Μέρα
--- a/src/lang/unfinished/latvian.txt	Tue May 27 00:50:55 2008 +0000
+++ b/src/lang/unfinished/latvian.txt	Tue Jun 17 10:32:49 2008 +0000
@@ -359,9 +359,9 @@
 STR_SORT_BY                                                     :{BLACK}Saka'rtot pe'c
 
 STR_SORT_BY_POPULATION                                          :{BLACK}Iedzi'vota'ju skaita
-STR_SORT_BY_PRODUCTION                                          :{BLACK}Produkcijas
-STR_SORT_BY_TYPE                                                :{BLACK}Tipa
-STR_SORT_BY_TRANSPORTED                                         :{BLACK}Transporte'ta'
+STR_SORT_BY_PRODUCTION                                          :Produkcijas
+STR_SORT_BY_TYPE                                                :Tipa
+STR_SORT_BY_TRANSPORTED                                         :Transporte'ta'
 STR_SORT_BY_NAME                                                :{BLACK}Va'rda
 STR_SORT_BY_DROPDOWN_NAME                                       :Va'rds
 STR_SORT_BY_DATE                                                :{BLACK}Datums
--- a/src/main_gui.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/main_gui.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -34,9 +34,7 @@
 #include "tilehighlight_func.h"
 
 #include "network/network.h"
-#include "network/network_data.h"
-#include "network/network_client.h"
-#include "network/network_server.h"
+#include "network/network_func.h"
 #include "network/network_gui.h"
 
 #include "table/sprites.h"
@@ -48,16 +46,16 @@
 void CcGiveMoney(bool success, TileIndex tile, uint32 p1, uint32 p2)
 {
 #ifdef ENABLE_NETWORK
-	if (!success || !_settings.economy.give_money) return;
+	if (!success || !_settings_game.economy.give_money) return;
 
 	char msg[20];
 	/* Inform the player of this action */
 	snprintf(msg, sizeof(msg), "%d", p1);
 
 	if (!_network_server) {
-		SEND_COMMAND(PACKET_CLIENT_CHAT)(NETWORK_ACTION_GIVE_MONEY, DESTTYPE_TEAM, p2, msg);
+		NetworkClientSendChat(NETWORK_ACTION_GIVE_MONEY, DESTTYPE_TEAM, p2, msg);
 	} else {
-		NetworkServer_HandleChat(NETWORK_ACTION_GIVE_MONEY, DESTTYPE_TEAM, p2, msg, NETWORK_SERVER_INDEX);
+		NetworkServerSendChat(NETWORK_ACTION_GIVE_MONEY, DESTTYPE_TEAM, p2, msg, NETWORK_SERVER_INDEX);
 	}
 #endif /* ENABLE_NETWORK */
 }
@@ -344,7 +342,7 @@
 					if (cio == NULL) break;
 
 					/* Only players actually playing can speak to team. Eg spectators cannot */
-					if (_settings.gui.prefer_teamchat && IsValidPlayer(cio->client_playas)) {
+					if (_settings_client.gui.prefer_teamchat && IsValidPlayer(cio->client_playas)) {
 						const NetworkClientInfo *ci;
 						FOR_ALL_ACTIVE_CLIENT_INFOS(ci) {
 							if (ci->client_playas == cio->client_playas && ci != cio) {
--- a/src/map.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/map.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -258,7 +258,7 @@
  * Although it really is a square search...
  * Every tile will be tested by means of the callback function proc,
  * which will determine if yes or no the given tile meets criteria of search.
- * @param tile to start the search from
+ * @param tile to start the search from. Upon completion, it will return the tile matching the search
  * @param size: number of tiles per side of the desired search area
  * @param proc: callback testing function pointer.
  * @param data to be passed to the callback function. Depends on the implementation
@@ -266,7 +266,7 @@
  * @pre proc != NULL
  * @pre size > 0
  */
-bool CircularTileSearch(TileIndex tile, uint size, TestTileOnSearchProc proc, uint32 data)
+bool CircularTileSearch(TileIndex *tile, uint size, TestTileOnSearchProc proc, uint32 data)
 {
 	uint n, x, y;
 	DiagDirection dir;
@@ -274,14 +274,17 @@
 	assert(proc != NULL);
 	assert(size > 0);
 
-	x = TileX(tile);
-	y = TileY(tile);
+	x = TileX(*tile);
+	y = TileY(*tile);
 
 	if (size % 2 == 1) {
 		/* If the length of the side is uneven, the center has to be checked
 		 * separately, as the pattern of uneven sides requires to go around the center */
 		n = 2;
-		if (proc(TileXY(x, y), data)) return true;
+		if (proc(TileXY(x, y), data)) {
+			*tile = TileXY(x, y);
+			return true;
+		}
 
 		/* If tile test is not successful, get one tile down and left,
 		 * ready for a test in first circle around center tile */
@@ -302,6 +305,7 @@
 			for (j = n; j != 0; j--) {
 				if (x <= MapMaxX() && y <= MapMaxY() && ///< Is the tile within the map?
 						proc(TileXY(x, y), data)) {     ///< Is the callback successful?
+					*tile = TileXY(x, y);
 					return true;                        ///< then stop the search
 				}
 
@@ -314,5 +318,7 @@
 		x += _tileoffs_by_dir[DIR_W].x;
 		y += _tileoffs_by_dir[DIR_W].y;
 	}
+
+	*tile = INVALID_TILE;
 	return false;
 }
--- a/src/map_func.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/map_func.h	Tue Jun 17 10:32:49 2008 +0000
@@ -391,7 +391,7 @@
 /**
  * Searches for some cirumstances of a tile around a given tile with a helper function.
  */
-bool CircularTileSearch(TileIndex tile, uint size, TestTileOnSearchProc proc, uint32 data);
+bool CircularTileSearch(TileIndex *tile, uint size, TestTileOnSearchProc proc, uint32 data);
 
 /**
  * Get a random tile out of a given seed.
--- a/src/minilzo.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/minilzo.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -1183,7 +1183,7 @@
 			break;
 	}
 
-	*out_len = op - out;
+	*out_len = (lzo_uint)(op - out);
 	return pd(in_end,ii);
 }
 
@@ -1233,7 +1233,7 @@
 	*op++ = 0;
 	*op++ = 0;
 
-	*out_len = op - out;
+	*out_len = (lzo_uint)(op - out);
 	return LZO_E_OK;
 }
 
@@ -1555,7 +1555,7 @@
 
 eof_found:
 	assert(t == 1);
-	*out_len = op - out;
+	*out_len = (lzo_uint)(op - out);
 	return (ip == ip_end ? LZO_E_OK :
 		   (ip < ip_end  ? LZO_E_INPUT_NOT_CONSUMED : LZO_E_INPUT_OVERRUN));
 
--- a/src/misc.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/misc.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -25,6 +25,7 @@
 #include "texteff.hpp"
 #include "gfx_func.h"
 #include "core/alloc_type.hpp"
+#include "gamelog.h"
 #include "animated_tile_func.h"
 #include "tilehighlight_func.h"
 #include "core/bitmath_func.hpp"
@@ -55,7 +56,7 @@
 void InitializeNPF();
 void InitializeOldNames();
 
-void InitializeGame(int mode, uint size_x, uint size_y)
+void InitializeGame(uint size_x, uint size_y, bool reset_date)
 {
 	AllocateMap(size_x, size_y);
 
@@ -67,10 +68,10 @@
 	_realtime_tick = 0;
 	_date_fract = 0;
 	_cur_tileloop_tile = 0;
-	_settings = _settings_newgame;
+	_settings_game = _settings_newgame;
 
-	if ((mode & IG_DATE_RESET) == IG_DATE_RESET) {
-		SetDate(ConvertYMDToDate(_settings.game_creation.starting_year, 0, 1));
+	if (reset_date) {
+		SetDate(ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1));
 		InitializeOldNames();
 	}
 
@@ -110,6 +111,13 @@
 	InitializeLandscapeVariables(false);
 
 	ResetObjectToPlace();
+
+	GamelogReset();
+	GamelogStartAction(GLAT_START);
+	GamelogRevision();
+	GamelogMode();
+	GamelogGRFAddList(_grfconfig);
+	GamelogStopAction();
 }
 
 
--- a/src/misc/smallvec.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/misc/smallvec.h	Tue Jun 17 10:32:49 2008 +0000
@@ -5,6 +5,9 @@
 #ifndef SMALLVEC_H
 #define SMALLVEC_H
 
+#include "../core/alloc_func.hpp"
+#include "../core/math_func.hpp"
+
 template <typename T, uint S>
 struct SmallVector {
 	T *data;
--- a/src/misc_cmd.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/misc_cmd.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -145,7 +145,7 @@
 	switch (p2) {
 		default: return CMD_ERROR; // Invalid method
 		case 0: // Take some extra loan
-			loan = (IsHumanPlayer(_current_player) || _settings.ai.ainew_active) ? LOAN_INTERVAL : LOAN_INTERVAL_OLD_AI;
+			loan = (IsHumanPlayer(_current_player) || _settings_game.ai.ainew_active) ? LOAN_INTERVAL : LOAN_INTERVAL_OLD_AI;
 			break;
 		case 1: // Take a loan as big as possible
 			loan = _economy.max_loan - p->current_loan;
@@ -181,7 +181,7 @@
 	switch (p2) {
 		default: return CMD_ERROR; // Invalid method
 		case 0: // Pay back one step
-			loan = min(p->current_loan, (Money)(IsHumanPlayer(_current_player) || _settings.ai.ainew_active) ? LOAN_INTERVAL : LOAN_INTERVAL_OLD_AI);
+			loan = min(p->current_loan, (Money)(IsHumanPlayer(_current_player) || _settings_game.ai.ainew_active) ? LOAN_INTERVAL : LOAN_INTERVAL_OLD_AI);
 			break;
 		case 1: // Pay back as much as possible
 			loan = max(min(p->current_loan, p->player_money), (Money)LOAN_INTERVAL);
@@ -359,7 +359,7 @@
  */
 CommandCost CmdGiveMoney(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
 {
-	if (!_settings.economy.give_money) return CMD_ERROR;
+	if (!_settings_game.economy.give_money) return CMD_ERROR;
 
 	const Player *p = GetPlayer(_current_player);
 	CommandCost amount(EXPENSES_OTHER, min((Money)p1, (Money)20000000LL));
--- a/src/misc_gui.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/misc_gui.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -50,7 +50,6 @@
 #include "table/strings.h"
 
 /* Variables to display file lists */
-FiosItem *_fios_list;
 SaveLoadDialogMode _saveload_mode;
 
 
@@ -102,7 +101,7 @@
 
 	LandInfoWindow(TileIndex tile) : Window(&_land_info_desc) {
 		Player *p = GetPlayer(IsValidPlayer(_local_player) ? _local_player : PLAYER_FIRST);
-		Town *t = ClosestTownFromTile(tile, _settings.economy.dist_local_authority);
+		Town *t = ClosestTownFromTile(tile, _settings_game.economy.dist_local_authority);
 
 		Money old_money = p->player_money;
 		p->player_money = INT64_MAX;
@@ -396,7 +395,7 @@
 			Window(pt.x, pt.y, width, height, WC_ERRMSG, widget),
 			show_player_face(show_player_face)
 	{
-		this->duration = _settings.gui.errmsg_duration;
+		this->duration = _settings_client.gui.errmsg_duration;
 		CopyOutDParam(this->decode_params, 0, lengthof(this->decode_params));
 		this->message_1 = msg1;
 		this->message_2 = msg2;
@@ -465,7 +464,7 @@
 {
 	DeleteWindowById(WC_ERRMSG, 0);
 
-	if (!_settings.gui.errmsg_duration) return;
+	if (!_settings_client.gui.errmsg_duration) return;
 
 	if (msg_2 == STR_NULL) msg_2 = STR_EMPTY;
 
@@ -620,7 +619,7 @@
 	DeleteWindowById(WC_TOOLTIPS, 0);
 
 	/* We only show measurement tooltips with patch setting on */
-	if (str == STR_NULL || (paramcount != 0 && !_settings.gui.measure_tooltip)) return;
+	if (str == STR_NULL || (paramcount != 0 && !_settings_client.gui.measure_tooltip)) return;
 
 	for (uint i = 0; i != paramcount; i++) SetDParam(i, params[i]);
 	char buffer[512];
@@ -717,30 +716,6 @@
 	}
 }
 
-void SetVScrollCount(Window *w, int num)
-{
-	w->vscroll.count = num;
-	num -= w->vscroll.cap;
-	if (num < 0) num = 0;
-	if (num < w->vscroll.pos) w->vscroll.pos = num;
-}
-
-void SetVScroll2Count(Window *w, int num)
-{
-	w->vscroll2.count = num;
-	num -= w->vscroll2.cap;
-	if (num < 0) num = 0;
-	if (num < w->vscroll2.pos) w->vscroll2.pos = num;
-}
-
-void SetHScrollCount(Window *w, int num)
-{
-	w->hscroll.count = num;
-	num -= w->hscroll.cap;
-	if (num < 0) num = 0;
-	if (num < w->hscroll.pos) w->hscroll.pos = num;
-}
-
 /* Delete a character at the caret position in a text buf.
  * If backspace is set, delete the character before the caret,
  * else delete the character after it. */
@@ -751,7 +726,7 @@
 
 	if (backspace) s = Utf8PrevChar(s);
 
-	size_t len = Utf8Decode(&c, s);
+	uint16 len = (uint16)Utf8Decode(&c, s);
 	uint width = GetCharacterWidth(FS_NORMAL, c);
 
 	tb->width  -= width;
@@ -807,7 +782,7 @@
 bool InsertTextBufferChar(Textbuf *tb, WChar key)
 {
 	const byte charwidth = GetCharacterWidth(FS_NORMAL, key);
-	size_t len = Utf8CharLen(key);
+	uint16 len = (uint16)Utf8CharLen(key);
 	if (tb->length < (tb->maxlength - len) && (tb->maxwidth == 0 || tb->width + charwidth <= tb->maxwidth)) {
 		memmove(tb->buf + tb->caretpos + len, tb->buf + tb->caretpos, tb->length - tb->caretpos + 1);
 		Utf8Encode(tb->buf + tb->caretpos, key);
@@ -847,7 +822,7 @@
 			if (tb->caretpos < tb->length) {
 				WChar c;
 
-				tb->caretpos   += Utf8Decode(&c, tb->buf + tb->caretpos);
+				tb->caretpos   += (uint16)Utf8Decode(&c, tb->buf + tb->caretpos);
 				tb->caretxoffs += GetCharacterWidth(FS_NORMAL, c);
 
 				return true;
@@ -1083,6 +1058,11 @@
 	{
 		EventState state;
 		switch (this->HandleEditBoxKey(QUERY_STR_WIDGET_TEXT, key, keycode, state)) {
+			default: NOT_REACHED();
+			case 0: {
+				Window *osk = FindWindowById(WC_OSK, 0);
+				if (osk != NULL && osk->parent == this) osk->OnInvalidateData();
+			} break;
 			case 1: this->OnOk(); // Enter pressed, confirms change
 			/* FALL THROUGH */
 			case 2: delete this; break; // ESC pressed, closes window, abandons changes
@@ -1093,8 +1073,9 @@
 	~QueryStringWindow()
 	{
 		if (!this->handled && this->parent != NULL) {
-			this->handled = true;
-			this->parent->OnQueryTextFinished(NULL);
+			Window *parent = this->parent;
+			this->parent = NULL; // so parent doesn't try to delete us again
+			parent->OnQueryTextFinished(NULL);
 		}
 		ClrBit(_no_scroll, SCROLL_EDIT);
 	}
@@ -1207,6 +1188,8 @@
 				 * DeleteNonVitalWindows() to be called - we shouldn't be in a window then */
 				QueryCallbackProc *proc = this->proc;
 				Window *parent = this->parent;
+				/* Prevent the destructor calling the callback function */
+				this->proc = NULL;
 				delete this;
 				if (proc != NULL) {
 					proc(parent, true);
@@ -1316,11 +1299,11 @@
 		case SLD_NEW_GAME:
 		case SLD_LOAD_SCENARIO:
 		case SLD_SAVE_SCENARIO:
-			_fios_list = FiosGetScenarioList(_saveload_mode); break;
+			FiosGetScenarioList(_saveload_mode); break;
 		case SLD_LOAD_HEIGHTMAP:
-			_fios_list = FiosGetHeightmapList(_saveload_mode); break;
+			FiosGetHeightmapList(_saveload_mode); break;
 
-		default: _fios_list = FiosGetSavegameList(_saveload_mode); break;
+		default: FiosGetSavegameList(_saveload_mode); break;
 	}
 }
 
@@ -1349,8 +1332,8 @@
 	 * Drives (A:\ (windows only) are always under the files (FIOS_TYPE_DRIVE)
 	 * Only sort savegames/scenarios, not directories
 	 */
-	for (int i = 0; i < _fios_num; i++) {
-		switch (_fios_list[i].type) {
+	for (const FiosItem *item = _fios_items.Begin(); item != _fios_items.End(); item++) {
+		switch (item->type) {
 			case FIOS_TYPE_DIR:    sort_start++; break;
 			case FIOS_TYPE_PARENT: sort_start++; break;
 			case FIOS_TYPE_DRIVE:  sort_end++;   break;
@@ -1358,9 +1341,9 @@
 		}
 	}
 
-	uint s_amount = _fios_num - sort_start - sort_end;
+	uint s_amount = _fios_items.Length() - sort_start - sort_end;
 	if (s_amount > 0) {
-		qsort(_fios_list + sort_start, s_amount, sizeof(FiosItem), compare_FiosItems);
+		qsort(_fios_items.Get(sort_start), s_amount, sizeof(FiosItem), compare_FiosItems);
 	}
 }
 
@@ -1459,10 +1442,9 @@
 
 	virtual void OnPaint()
 	{
-		int pos;
 		int y;
 
-		SetVScrollCount(this, _fios_num);
+		SetVScrollCount(this, _fios_items.Length());
 		this->DrawWidgets();
 		DrawFiosTexts(this->width);
 
@@ -1475,8 +1457,8 @@
 		this->DrawSortButtonState(_savegame_sort_order & SORT_BY_NAME ? 2 : 3, _savegame_sort_order & SORT_DESCENDING ? SBS_DOWN : SBS_UP);
 
 		y = this->widget[7].top + 1;
-		for (pos = this->vscroll.pos; pos < _fios_num; pos++) {
-			const FiosItem *item = _fios_list + pos;
+		for (uint pos = this->vscroll.pos; pos < _fios_items.Length(); pos++) {
+			const FiosItem *item = _fios_items.Get(pos);
 
 			DoDrawStringTruncated(item->title, 4, y, _fios_colors[item->type], this->width - 18);
 			y += 10;
@@ -1513,14 +1495,12 @@
 
 			case 7: { // Click the listbox
 				int y = (pt.y - this->widget[widget].top - 1) / 10;
-				char *name;
-				const FiosItem *file;
 
 				if (y < 0 || (y += this->vscroll.pos) >= this->vscroll.count) return;
 
-				file = _fios_list + y;
+				const FiosItem *file = _fios_items.Get(y);
 
-				name = FiosBrowseTo(file);
+				char *name = FiosBrowseTo(file);
 				if (name != NULL) {
 					if (_saveload_mode == SLD_LOAD_GAME || _saveload_mode == SLD_LOAD_SCENARIO) {
 						_switch_mode = (_game_mode == GM_EDITOR) ? SM_LOAD_SCENARIO : SM_LOAD;
--- a/src/mixer.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/mixer.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -104,7 +104,7 @@
 	return NULL;
 }
 
-void MxSetChannelRawSrc(MixerChannel *mc, int8 *mem, uint size, uint rate, uint flags)
+void MxSetChannelRawSrc(MixerChannel *mc, int8 *mem, size_t size, uint rate, uint flags)
 {
 	mc->memory = mem;
 	mc->flags = flags;
@@ -114,12 +114,12 @@
 	mc->frac_speed = (rate << 16) / _play_rate;
 
 	/* adjust the magnitude to prevent overflow */
-	while (size & 0xFFFF0000) {
+	while (size & ~0xFFFF) {
 		size >>= 1;
 		rate = (rate >> 1) + 1;
 	}
 
-	mc->samples_left = size * _play_rate / rate;
+	mc->samples_left = (uint)size * _play_rate / rate;
 }
 
 void MxSetChannelVolume(MixerChannel *mc, uint left, uint right)
--- a/src/mixer.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/mixer.h	Tue Jun 17 10:32:49 2008 +0000
@@ -18,7 +18,7 @@
 void MxMixSamples(void *buffer, uint samples);
 
 MixerChannel *MxAllocateChannel();
-void MxSetChannelRawSrc(MixerChannel *mc, int8 *mem, uint size, uint rate, uint flags);
+void MxSetChannelRawSrc(MixerChannel *mc, int8 *mem, size_t size, uint rate, uint flags);
 void MxSetChannelVolume(MixerChannel *mc, uint left, uint right);
 void MxActivateChannel(MixerChannel*);
 
--- a/src/network/core/config.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/network/core/config.h	Tue Jun 17 10:32:49 2008 +0000
@@ -1,14 +1,12 @@
 /* $Id$ */
 
 /**
- * @file config.h Configuration options of the network stuff
+ * @file config.h Configuration options of the network stuff. It is used even when compiling without network support.
  */
 
 #ifndef NETWORK_CORE_CONFIG_H
 #define NETWORK_CORE_CONFIG_H
 
-#ifdef ENABLE_NETWORK
-
 /** DNS hostname of the masterserver */
 #define NETWORK_MASTER_SERVER_HOST "master.openttd.org"
 /** Message sent to the masterserver to 'identify' this client as OpenTTD */
@@ -54,6 +52,4 @@
 	NETWORK_NUM_LANDSCAPES        =    4,
 };
 
-#endif /* ENABLE_NETWORK */
-
 #endif /* NETWORK_CORE_CONFIG_H */
--- a/src/network/core/core.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/network/core/core.h	Tue Jun 17 10:32:49 2008 +0000
@@ -62,7 +62,7 @@
 	 * Whether this socket is currently bound to a socket.
 	 * @return true when the socket is bound, false otherwise
 	 */
-	bool IsConnected() { return this->sock != INVALID_SOCKET; }
+	bool IsConnected() const { return this->sock != INVALID_SOCKET; }
 
 	/**
 	 * Whether the current client connected to the socket has quit.
@@ -70,7 +70,7 @@
 	 * data), the socket in not closed; only the packet is dropped.
 	 * @return true when the current client has quit, false otherwise
 	 */
-	bool HasClientQuit() { return this->has_quit; }
+	bool HasClientQuit() const { return this->has_quit; }
 
 	void Send_GRFIdentifier(Packet *p, const GRFIdentifier *grf);
 	void Recv_GRFIdentifier(Packet *p, GRFIdentifier *grf);
--- a/src/network/core/game.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/network/core/game.h	Tue Jun 17 10:32:49 2008 +0000
@@ -19,7 +19,13 @@
  * some fields will be empty on the client (like game_password) by default
  * and only filled with data a player enters.
  */
-struct NetworkGameInfo {
+struct NetworkServerGameInfo {
+	byte clients_on;                                ///< Current count of clients on server
+	Date start_date;                                ///< When the game started
+	char map_name[NETWORK_NAME_LENGTH];             ///< Map which is played ["random" for a randomized map]
+};
+
+struct NetworkGameInfo : NetworkServerGameInfo {
 	byte game_info_version;                         ///< Version of the game info
 	char server_name[NETWORK_NAME_LENGTH];          ///< Server name
 	char hostname[NETWORK_HOSTNAME_LENGTH];         ///< Hostname of the server (if any)
@@ -28,21 +34,16 @@
 	bool compatible;                                ///< Can we connect to this server or not? (based on server_revision _and_ grf_match
 	byte server_lang;                               ///< Language of the server (we should make a nice table for this)
 	bool use_password;                              ///< Is this server passworded?
-	char server_password[NETWORK_PASSWORD_LENGTH];  ///< On the server: the game password, on the client: != "" if server has password
 	byte clients_max;                               ///< Max clients allowed on server
-	byte clients_on;                                ///< Current count of clients on server
-	byte companies_max;                             ///< Max companies allowed on server
 	byte companies_on;                              ///< How many started companies do we have
-	byte spectators_max;                            ///< Max spectators allowed on server
+	byte companies_max;                             ///< Max companies allowed on server
 	byte spectators_on;                             ///< How many spectators do we have?
+	byte spectators_max;                            ///< Max spectators allowed on server
 	Date game_date;                                 ///< Current date
-	Date start_date;                                ///< When the game started
-	char map_name[NETWORK_NAME_LENGTH];             ///< Map which is played ["random" for a randomized map]
 	uint16 map_width;                               ///< Map width
 	uint16 map_height;                              ///< Map height
 	byte map_set;                                   ///< Graphical set
 	bool dedicated;                                 ///< Is this a dedicated server?
-	char rcon_password[NETWORK_PASSWORD_LENGTH];    ///< RCon password for the server. "" if rcon is disabled
 	GRFConfig *grfconfig;                           ///< List of NewGRF files used
 };
 
--- a/src/network/core/tcp.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/network/core/tcp.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -11,7 +11,7 @@
 #include "../../openttd.h"
 #include "../../variables.h"
 
-#include "../network_data.h"
+#include "../network_internal.h"
 #include "packet.h"
 #include "tcp.h"
 
--- a/src/network/network.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/network/network.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -3,7 +3,7 @@
 /** @file network.cpp Base functions for networking support. */
 
 #include "../stdafx.h"
-#include "network_data.h"
+#include "../player_type.h"
 
 #ifdef ENABLE_NETWORK
 
@@ -15,6 +15,7 @@
 #include "../variables.h"
 #include "../date_func.h"
 #include "../newgrf_config.h"
+#include "network_internal.h"
 #include "network_client.h"
 #include "network_server.h"
 #include "network_udp.h"
@@ -38,7 +39,6 @@
 #ifdef DEBUG_DUMP_COMMANDS
 	#include "../core/alloc_func.hpp"
 #endif /* DEBUG_DUMP_COMMANDS */
-
 #include "table/strings.h"
 
 bool _network_reload_cfg;
@@ -46,6 +46,29 @@
 bool _network_available;  ///< is network mode available?
 bool _network_dedicated;  ///< are we a dedicated server?
 bool _network_advertise;  ///< is the server advertising to the master server?
+bool _is_network_server;  ///< Does this client wants to be a network-server?
+NetworkServerGameInfo _network_game_info;
+NetworkPlayerInfo _network_player_info[MAX_PLAYERS];
+NetworkClientInfo _network_client_info[MAX_CLIENT_INFO];
+uint16 _network_own_client_index;
+uint16 _redirect_console_to_client;
+bool _network_need_advertise;
+uint32 _network_last_advertise_frame;
+uint8 _network_reconnect;
+char *_network_host_list[10];
+char *_network_ban_list[25];
+uint32 _frame_counter_server; // The frame_counter of the server, if in network-mode
+uint32 _frame_counter_max; // To where we may go with our clients
+uint32 _last_sync_frame; // Used in the server to store the last time a sync packet was sent to clients.
+uint32 _broadcast_list[MAX_INTERFACES + 1];
+uint32 _network_server_bind_ip;
+uint32 _sync_seed_1, _sync_seed_2;
+uint32 _sync_frame;
+bool _network_first_time;
+uint32 _network_last_host_ip;
+bool _network_udp_server;
+uint16 _network_udp_broadcast;
+uint8 _network_advertise_retries;
 
 /* Check whether NETWORK_NUM_LANDSCAPES is still in sync with NUM_LANDSCAPE */
 assert_compile((int)NETWORK_NUM_LANDSCAPES == (int)NUM_LANDSCAPE);
@@ -216,8 +239,8 @@
 	// This client has missed his ACK packet after 1 DAY_TICKS..
 	//  so we increase his lag for every frame that passes!
 	// The packet can be out by a max of _net_frame_freq
-	if (cs->last_frame_server + DAY_TICKS + _network_frame_freq < _frame_counter)
-		lag += _frame_counter - (cs->last_frame_server + DAY_TICKS + _network_frame_freq);
+	if (cs->last_frame_server + DAY_TICKS + _settings_client.network.frame_freq < _frame_counter)
+		lag += _frame_counter - (cs->last_frame_server + DAY_TICKS + _settings_client.network.frame_freq);
 
 	return lag;
 }
@@ -332,18 +355,18 @@
 {
 	if (!_network_dedicated) return;
 
-	if (NetworkCountPlayers() < _network_min_players) {
+	if (NetworkCountPlayers() < _settings_client.network.min_players) {
 		if (_min_players_paused) return;
 
 		_min_players_paused = true;
 		DoCommandP(0, 1, 0, NULL, CMD_PAUSE);
-		NetworkServer_HandleChat(NETWORK_ACTION_SERVER_MESSAGE, DESTTYPE_BROADCAST, 0, "Game paused (not enough players)", NETWORK_SERVER_INDEX);
+		NetworkServerSendChat(NETWORK_ACTION_SERVER_MESSAGE, DESTTYPE_BROADCAST, 0, "Game paused (not enough players)", NETWORK_SERVER_INDEX);
 	} else {
 		if (!_min_players_paused) return;
 
 		_min_players_paused = false;
 		DoCommandP(0, 0, 0, NULL, CMD_PAUSE);
-		NetworkServer_HandleChat(NETWORK_ACTION_SERVER_MESSAGE, DESTTYPE_BROADCAST, 0, "Game unpaused (enough players)", NETWORK_SERVER_INDEX);
+		NetworkServerSendChat(NETWORK_ACTION_SERVER_MESSAGE, DESTTYPE_BROADCAST, 0, "Game unpaused (enough players)", NETWORK_SERVER_INDEX);
 	}
 }
 
@@ -601,7 +624,7 @@
 	if (_network_server) {
 		// Can we handle a new client?
 		if (_network_clients_connected >= MAX_CLIENTS) return NULL;
-		if (_network_game_info.clients_on >= _network_game_info.clients_max) return NULL;
+		if (_network_game_info.clients_on >= _settings_client.network.max_clients) return NULL;
 
 		// Register the login
 		client_no = _network_clients_connected++;
@@ -662,9 +685,9 @@
 	}
 
 	/* When the client was PRE_ACTIVE, the server was in pause mode, so unpause */
-	if (cs->status == STATUS_PRE_ACTIVE && _network_pause_on_join) {
+	if (cs->status == STATUS_PRE_ACTIVE && _settings_client.network.pause_on_join) {
 		DoCommandP(0, 0, 0, NULL, CMD_PAUSE);
-		NetworkServer_HandleChat(NETWORK_ACTION_SERVER_MESSAGE, DESTTYPE_BROADCAST, 0, "Game unpaused", NETWORK_SERVER_INDEX);
+		NetworkServerSendChat(NETWORK_ACTION_SERVER_MESSAGE, DESTTYPE_BROADCAST, 0, "Game unpaused", NETWORK_SERVER_INDEX);
 	}
 
 	cs->Destroy();
@@ -802,7 +825,7 @@
 	SOCKET ls;
 	struct sockaddr_in sin;
 
-	DEBUG(net, 1, "Listening on %s:%d", _network_server_bind_ip_host, _network_server_port);
+	DEBUG(net, 1, "Listening on %s:%d", _settings_client.network.server_bind_ip, _settings_client.network.server_port);
 
 	ls = socket(AF_INET, SOCK_STREAM, 0);
 	if (ls == INVALID_SOCKET) {
@@ -823,7 +846,7 @@
 
 	sin.sin_family = AF_INET;
 	sin.sin_addr.s_addr = _network_server_bind_ip;
-	sin.sin_port = htons(_network_server_port);
+	sin.sin_port = htons(_settings_client.network.server_port);
 
 	if (bind(ls, (struct sockaddr*)&sin, sizeof(sin)) != 0) {
 		ServerStartError("bind() failed");
@@ -854,12 +877,22 @@
 	}
 
 	if (_network_server) {
-		// We are a server, also close the listensocket
+		/* We are a server, also close the listensocket */
 		closesocket(_listensocket);
 		_listensocket = INVALID_SOCKET;
 		DEBUG(net, 1, "Closed listener");
-		NetworkUDPCloseAll();
 	}
+	NetworkUDPCloseAll();
+
+	/* Free all queued commands */
+	while (_local_command_queue != NULL) {
+		CommandPacket *p = _local_command_queue;
+		_local_command_queue = _local_command_queue->next;
+		free(p);
+	}
+
+	_networking = false;
+	_network_server = false;
 }
 
 // Inits the network (cleans sockets and stuff)
@@ -923,7 +956,7 @@
 
 		ttd_strlcpy(host, b, lengthof(host));
 
-		ttd_strlcpy(_network_default_ip, b, lengthof(_network_default_ip));
+		ttd_strlcpy(_settings_client.network.connect_to_ip, b, lengthof(_settings_client.network.connect_to_ip));
 		rport = NETWORK_DEFAULT_PORT;
 
 		ParseConnectionString(&player, &port, host);
@@ -961,11 +994,10 @@
 
 	if (port == 0) return false;
 
-	ttd_strlcpy(_network_last_host, host, sizeof(_network_last_host));
-	_network_last_port = port;
+	ttd_strlcpy(_settings_client.network.last_host, host, sizeof(_settings_client.network.last_host));
+	_settings_client.network.last_port = port;
 
 	NetworkDisconnect();
-	NetworkUDPCloseAll();
 	NetworkInitialize();
 
 	// Try to connect
@@ -987,34 +1019,13 @@
 {
 	NetworkClientInfo *ci;
 
-	ttd_strlcpy(_network_game_info.server_name, _network_server_name, sizeof(_network_game_info.server_name));
-	ttd_strlcpy(_network_game_info.server_password, _network_server_password, sizeof(_network_server_password));
-	ttd_strlcpy(_network_game_info.rcon_password, _network_rcon_password, sizeof(_network_rcon_password));
-	if (_network_game_info.server_name[0] == '\0')
-		snprintf(_network_game_info.server_name, sizeof(_network_game_info.server_name), "Unnamed Server");
-
-	ttd_strlcpy(_network_game_info.server_revision, _openttd_revision, sizeof(_network_game_info.server_revision));
-
-	// The server is a client too ;)
-	if (_network_dedicated) {
-		_network_game_info.clients_on = 0;
-		_network_game_info.companies_on = 0;
-		_network_game_info.dedicated = true;
-	} else {
-		_network_game_info.clients_on = 1;
-		_network_game_info.companies_on = 1;
-		_network_game_info.dedicated = false;
+	if (StrEmpty(_settings_client.network.server_name)) {
+		snprintf(_settings_client.network.server_name, sizeof(_settings_client.network.server_name), "Unnamed Server");
 	}
 
-	_network_game_info.spectators_on = 0;
-
-	_network_game_info.game_date = _date;
-	_network_game_info.start_date = ConvertYMDToDate(_settings.game_creation.starting_year, 0, 1);
-	_network_game_info.map_width = MapSizeX();
-	_network_game_info.map_height = MapSizeY();
-	_network_game_info.map_set = _settings.game_creation.landscape;
-
-	_network_game_info.use_password = (_network_server_password[0] != '\0');
+	/* The server is a client too */
+	_network_game_info.clients_on = _network_dedicated ? 0 : 1;
+	_network_game_info.start_date = ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1);
 
 	// We use _network_client_info[MAX_CLIENT_INFO - 1] to store the server-data in it
 	//  The index is NETWORK_SERVER_INDEX ( = 1)
@@ -1024,8 +1035,8 @@
 	ci->client_index = NETWORK_SERVER_INDEX;
 	ci->client_playas = _network_dedicated ? PLAYER_SPECTATOR : _local_player;
 
-	ttd_strlcpy(ci->client_name, _network_player_name, sizeof(ci->client_name));
-	ttd_strlcpy(ci->unique_id, _network_unique_id, sizeof(ci->unique_id));
+	ttd_strlcpy(ci->client_name, _settings_client.network.player_name, sizeof(ci->client_name));
+	ttd_strlcpy(ci->unique_id, _settings_client.network.network_id, sizeof(ci->unique_id));
 }
 
 bool NetworkServerStart()
@@ -1041,7 +1052,7 @@
 
 	// Try to start UDP-server
 	_network_udp_server = true;
-	_network_udp_server = _udp_server_socket->Listen(_network_server_bind_ip, _network_server_port, false);
+	_network_udp_server = _udp_server_socket->Listen(_network_server_bind_ip, _settings_client.network.server_port, false);
 
 	_network_server = true;
 	_networking = true;
@@ -1086,16 +1097,6 @@
 	}
 
 	NetworkClose();
-
-	// Free all queued commands
-	while (_local_command_queue != NULL) {
-		CommandPacket *p = _local_command_queue;
-		_local_command_queue = _local_command_queue->next;
-		free(p);
-	}
-
-	_networking = false;
-	_network_server = false;
 }
 
 // We want to disconnect from the host/clients
@@ -1114,16 +1115,6 @@
 	DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
 
 	NetworkClose();
-
-	// Free all queued commands
-	while (_local_command_queue != NULL) {
-		CommandPacket *p = _local_command_queue;
-		_local_command_queue = _local_command_queue->next;
-		free(p);
-	}
-
-	_networking = false;
-	_network_server = false;
 }
 
 // Receives something from the network
@@ -1332,7 +1323,7 @@
 		_frame_counter++;
 		// Update max-frame-counter
 		if (_frame_counter > _frame_counter_max) {
-			_frame_counter_max = _frame_counter + _network_frame_freq;
+			_frame_counter_max = _frame_counter + _settings_client.network.frame_freq;
 			send_frame = true;
 		}
 
@@ -1382,7 +1373,7 @@
 		sprintf(hex_output + di * 2, "%02x", digest[di]);
 
 	/* _network_unique_id is our id */
-	snprintf(_network_unique_id, sizeof(_network_unique_id), "%s", hex_output);
+	snprintf(_settings_client.network.network_id, sizeof(_settings_client.network.network_id), "%s", hex_output);
 }
 
 void NetworkStartDebugLog(const char *hostname, uint16 port)
@@ -1429,26 +1420,14 @@
 	_network_advertise_retries = 0;
 
 	/* Load the ip from the openttd.cfg */
-	_network_server_bind_ip = inet_addr(_network_server_bind_ip_host);
+	_network_server_bind_ip = inet_addr(_settings_client.network.server_bind_ip);
 	/* And put the data back in it in case it was an invalid ip */
-	snprintf(_network_server_bind_ip_host, sizeof(_network_server_bind_ip_host), "%s", inet_ntoa(*(struct in_addr *)&_network_server_bind_ip));
+	snprintf(_settings_client.network.server_bind_ip, sizeof(_settings_client.network.server_bind_ip), "%s", inet_ntoa(*(struct in_addr *)&_network_server_bind_ip));
 
 	/* Generate an unique id when there is none yet */
-	if (_network_unique_id[0] == '\0') NetworkGenerateUniqueId();
+	if (StrEmpty(_settings_client.network.network_id)) NetworkGenerateUniqueId();
 
-	{
-		byte cl_max = _network_game_info.clients_max;
-		byte cp_max = _network_game_info.companies_max;
-		byte sp_max = _network_game_info.spectators_max;
-		byte s_lang = _network_game_info.server_lang;
-
-		memset(&_network_game_info, 0, sizeof(_network_game_info));
-		_network_game_info.clients_max = cl_max;
-		_network_game_info.companies_max = cp_max;
-		_network_game_info.spectators_max = sp_max;
-		_network_game_info.server_lang = s_lang;
-	}
-
+	memset(&_network_game_info, 0, sizeof(_network_game_info));
 
 	NetworkInitialize();
 	DEBUG(net, 3, "[core] network online, multiplayer available");
--- a/src/network/network.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/network/network.h	Tue Jun 17 10:32:49 2008 +0000
@@ -17,7 +17,7 @@
 extern bool _network_available;  ///< is network mode available?
 extern bool _network_dedicated;  ///< are we a dedicated server?
 extern bool _network_advertise;  ///< is the server advertising to the master server?
-extern bool _network_reload_cfg; ///< will we reload the entire config for the next game?
+extern bool _is_network_server;  ///< Does this client wants to be a network-server?
 
 #else /* ENABLE_NETWORK */
 /* Network function stubs when networking is disabled */
@@ -30,6 +30,7 @@
 #define _network_available 0
 #define _network_dedicated 0
 #define _network_advertise 0
+#define _is_network_server 0
 
 #endif /* ENABLE_NETWORK */
 
--- a/src/network/network_client.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/network/network_client.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -7,7 +7,7 @@
 #include "../stdafx.h"
 #include "../debug.h"
 #include "../openttd.h"
-#include "network_data.h"
+#include "network_internal.h"
 #include "core/tcp.h"
 #include "network_client.h"
 #include "network_gamelist.h"
@@ -83,8 +83,8 @@
 {
 	if (StrEmpty(_network_player_info[_local_player].password)) return;
 
-	_password_game_seed = _settings.game_creation.generation_seed;
-	ttd_strlcpy(_password_server_unique_id, _network_unique_id, sizeof(_password_server_unique_id));
+	_password_game_seed = _settings_game.game_creation.generation_seed;
+	ttd_strlcpy(_password_server_unique_id, _settings_client.network.network_id, sizeof(_password_server_unique_id));
 
 	const char *new_pw = GenerateCompanyPasswordHash(_network_player_info[_local_player].password);
 	ttd_strlcpy(_network_player_info[_local_player].password, new_pw, sizeof(_network_player_info[_local_player].password));
@@ -131,10 +131,10 @@
 
 	p = NetworkSend_Init(PACKET_CLIENT_JOIN);
 	p->Send_string(_openttd_revision);
-	p->Send_string(_network_player_name); // Player name
+	p->Send_string(_settings_client.network.player_name); // Player name
 	p->Send_uint8 (_network_playas);      // PlayAs
 	p->Send_uint8 (NETLANG_ANY);          // Language
-	p->Send_string(_network_unique_id);
+	p->Send_string(_settings_client.network.network_id);
 	MY_CLIENT->Send_Packet(p);
 }
 
@@ -938,4 +938,39 @@
 	return res;
 }
 
+void NetworkClientSendRcon(const char *password, const char *command)
+{
+	SEND_COMMAND(PACKET_CLIENT_RCON)(password, command);
+}
+
+void NetworkUpdatePlayerName()
+{
+	NetworkClientInfo *ci = NetworkFindClientInfoFromIndex(_network_own_client_index);
+
+	if (ci == NULL) return;
+
+	/* Don't change the name if it is the same as the old name */
+	if (strcmp(ci->client_name, _settings_client.network.player_name) != 0) {
+		if (!_network_server) {
+			SEND_COMMAND(PACKET_CLIENT_SET_NAME)(_settings_client.network.player_name);
+		} else {
+			if (NetworkFindName(_settings_client.network.player_name)) {
+				NetworkTextMessage(NETWORK_ACTION_NAME_CHANGE, CC_DEFAULT, false, ci->client_name, "%s", _settings_client.network.player_name);
+				ttd_strlcpy(ci->client_name, _settings_client.network.player_name, sizeof(ci->client_name));
+				NetworkUpdateClientInfo(NETWORK_SERVER_INDEX);
+			}
+		}
+	}
+}
+
+void NetworkClientSendChat(NetworkAction action, DestType type, int dest, const char *msg)
+{
+	SEND_COMMAND(PACKET_CLIENT_CHAT)(action, type, dest, msg);
+}
+
+void NetworkClientSetPassword()
+{
+	SEND_COMMAND(PACKET_CLIENT_SET_PASSWORD)(_network_player_info[_local_player].password);
+}
+
 #endif /* ENABLE_NETWORK */
--- a/src/network/network_data.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/network/network_data.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -6,7 +6,7 @@
 
 #include "../stdafx.h"
 #include "../debug.h"
-#include "network_data.h"
+#include "network_internal.h"
 #include "network_client.h"
 #include "../command_func.h"
 #include "../callback_table.h"
--- a/src/network/network_data.h	Tue May 27 00:50:55 2008 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,121 +0,0 @@
-/* $Id$ */
-
-/** @file network_data.h Internal functions. */
-
-#ifndef NETWORK_DATA_H
-#define NETWORK_DATA_H
-
-#include "../openttd.h"
-#include "../console_type.h"
-#include "network.h"
-#include "network_internal.h"
-
-// Is the network enabled?
-#ifdef ENABLE_NETWORK
-
-#include "core/os_abstraction.h"
-#include "core/core.h"
-#include "core/config.h"
-#include "core/packet.h"
-#include "core/tcp.h"
-
-#define MAX_TEXT_MSG_LEN 1024 /* long long long long sentences :-) */
-
-// The client-info-server-index is always 1
-#define NETWORK_SERVER_INDEX 1
-#define NETWORK_EMPTY_INDEX 0
-
-enum MapPacket {
-	MAP_PACKET_START,
-	MAP_PACKET_NORMAL,
-	MAP_PACKET_END,
-};
-
-enum NetworkErrorCode {
-	NETWORK_ERROR_GENERAL, // Try to use thisone like never
-
-	// Signals from clients
-	NETWORK_ERROR_DESYNC,
-	NETWORK_ERROR_SAVEGAME_FAILED,
-	NETWORK_ERROR_CONNECTION_LOST,
-	NETWORK_ERROR_ILLEGAL_PACKET,
-	NETWORK_ERROR_NEWGRF_MISMATCH,
-
-	// Signals from servers
-	NETWORK_ERROR_NOT_AUTHORIZED,
-	NETWORK_ERROR_NOT_EXPECTED,
-	NETWORK_ERROR_WRONG_REVISION,
-	NETWORK_ERROR_NAME_IN_USE,
-	NETWORK_ERROR_WRONG_PASSWORD,
-	NETWORK_ERROR_PLAYER_MISMATCH, // Happens in CLIENT_COMMAND
-	NETWORK_ERROR_KICKED,
-	NETWORK_ERROR_CHEATER,
-	NETWORK_ERROR_FULL,
-};
-
-// Actions that can be used for NetworkTextMessage
-enum NetworkAction {
-	NETWORK_ACTION_JOIN,
-	NETWORK_ACTION_LEAVE,
-	NETWORK_ACTION_SERVER_MESSAGE,
-	NETWORK_ACTION_CHAT,
-	NETWORK_ACTION_CHAT_COMPANY,
-	NETWORK_ACTION_CHAT_CLIENT,
-	NETWORK_ACTION_GIVE_MONEY,
-	NETWORK_ACTION_NAME_CHANGE,
-};
-
-enum NetworkPasswordType {
-	NETWORK_GAME_PASSWORD,
-	NETWORK_COMPANY_PASSWORD,
-};
-
-enum DestType {
-	DESTTYPE_BROADCAST, ///< Send message/notice to all players (All)
-	DESTTYPE_TEAM,    ///< Send message/notice to everyone playing the same company (Team)
-	DESTTYPE_CLIENT,    ///< Send message/notice to only a certain player (Private)
-};
-
-// following externs are instantiated at network.cpp
-extern CommandPacket *_local_command_queue;
-
-// Here we keep track of the clients
-//  (and the client uses [0] for his own communication)
-extern NetworkTCPSocketHandler _clients[MAX_CLIENTS];
-
-#define DEREF_CLIENT(i) (&_clients[i])
-// This returns the NetworkClientInfo from a NetworkClientState
-#define DEREF_CLIENT_INFO(cs) (&_network_client_info[cs - _clients])
-
-// Macros to make life a bit more easier
-#define DEF_CLIENT_RECEIVE_COMMAND(type) NetworkRecvStatus NetworkPacketReceive_ ## type ## _command(Packet *p)
-#define DEF_CLIENT_SEND_COMMAND(type) void NetworkPacketSend_ ## type ## _command()
-#define DEF_CLIENT_SEND_COMMAND_PARAM(type) void NetworkPacketSend_ ## type ## _command
-#define DEF_SERVER_RECEIVE_COMMAND(type) void NetworkPacketReceive_ ## type ## _command(NetworkTCPSocketHandler *cs, Packet *p)
-#define DEF_SERVER_SEND_COMMAND(type) void NetworkPacketSend_ ## type ## _command(NetworkTCPSocketHandler *cs)
-#define DEF_SERVER_SEND_COMMAND_PARAM(type) void NetworkPacketSend_ ## type ## _command
-
-#define SEND_COMMAND(type) NetworkPacketSend_ ## type ## _command
-#define RECEIVE_COMMAND(type) NetworkPacketReceive_ ## type ## _command
-
-#define FOR_ALL_CLIENTS(cs) for (cs = _clients; cs != endof(_clients) && cs->IsConnected(); cs++)
-#define FOR_ALL_ACTIVE_CLIENT_INFOS(ci) for (ci = _network_client_info; ci != endof(_network_client_info); ci++) if (ci->client_index != NETWORK_EMPTY_INDEX)
-
-void NetworkExecuteCommand(CommandPacket *cp);
-void NetworkAddCommandQueue(NetworkTCPSocketHandler *cs, CommandPacket *cp);
-
-// from network.c
-void NetworkCloseClient(NetworkTCPSocketHandler *cs);
-void CDECL NetworkTextMessage(NetworkAction action, ConsoleColour color, bool self_send, const char *name, const char *str, ...);
-void NetworkGetClientName(char *clientname, size_t size, const NetworkTCPSocketHandler *cs);
-uint NetworkCalculateLag(const NetworkTCPSocketHandler *cs);
-byte NetworkGetCurrentLanguageIndex();
-NetworkClientInfo *NetworkFindClientInfoFromIndex(uint16 client_index);
-NetworkClientInfo *NetworkFindClientInfoFromIP(const char *ip);
-NetworkTCPSocketHandler *NetworkFindClientStateFromIndex(uint16 client_index);
-unsigned long NetworkResolveHost(const char *hostname);
-char* GetNetworkErrorMsg(char* buf, NetworkErrorCode err, const char* last);
-
-#endif /* ENABLE_NETWORK */
-
-#endif /* NETWORK_DATA_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/network/network_func.h	Tue Jun 17 10:32:49 2008 +0000
@@ -0,0 +1,63 @@
+/* $Id$ */
+
+/** @file network_internal.h Variables and function used internally. */
+
+#ifndef NETWORK_FUNC_H
+#define NETWORK_FUNC_H
+
+#ifdef ENABLE_NETWORK
+
+#include "network_type.h"
+#include "../console_type.h"
+
+extern NetworkServerGameInfo _network_game_info;
+extern NetworkPlayerInfo _network_player_info[MAX_PLAYERS];
+extern NetworkClientInfo _network_client_info[MAX_CLIENT_INFO];
+
+extern uint16 _network_own_client_index;
+extern uint16 _redirect_console_to_client;
+extern bool _network_need_advertise;
+extern uint32 _network_last_advertise_frame;
+extern uint8 _network_reconnect;
+extern char *_network_host_list[10];
+extern char *_network_ban_list[25];
+
+byte NetworkSpectatorCount();
+void CheckMinPlayers();
+void NetworkUpdatePlayerName();
+bool NetworkCompanyHasPlayers(PlayerID company);
+bool NetworkChangeCompanyPassword(byte argc, char *argv[]);
+void NetworkReboot();
+void NetworkDisconnect();
+void NetworkGameLoop();
+void NetworkUDPGameLoop();
+void NetworkUDPCloseAll();
+void ParseConnectionString(const char **player, const char **port, char *connection_string);
+void NetworkStartDebugLog(const char *hostname, uint16 port);
+void NetworkPopulateCompanyInfo();
+
+void NetworkUpdateClientInfo(uint16 client_index);
+bool NetworkClientConnectGame(const char *host, uint16 port);
+void NetworkClientSendRcon(const char *password, const char *command);
+void NetworkClientSendChat(NetworkAction action, DestType type, int dest, const char *msg);
+void NetworkClientSetPassword();
+
+/*** Commands ran by the server ***/
+void NetworkServerMonthlyLoop();
+void NetworkServerYearlyLoop();
+void NetworkServerChangeOwner(PlayerID current_player, PlayerID new_player);
+void NetworkServerShowStatusToConsole();
+bool NetworkServerStart();
+
+NetworkClientInfo *NetworkFindClientInfoFromIndex(uint16 client_index);
+NetworkClientInfo *NetworkFindClientInfoFromIP(const char *ip);
+const char* GetPlayerIP(const NetworkClientInfo *ci);
+
+void NetworkServerSendRcon(uint16 client_index, ConsoleColour colour_code, const char *string);
+void NetworkServerSendError(uint16 client_index, NetworkErrorCode error);
+void NetworkServerSendChat(NetworkAction action, DestType type, int dest, const char *msg, uint16 from_index);
+
+#define FOR_ALL_ACTIVE_CLIENT_INFOS(ci) for (ci = _network_client_info; ci != endof(_network_client_info); ci++) if (ci->client_index != NETWORK_EMPTY_INDEX)
+
+#endif /* ENABLE_NETWORK */
+#endif /* NETWORK_FUNC_H */
--- a/src/network/network_gamelist.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/network/network_gamelist.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -11,6 +11,7 @@
 #include "../debug.h"
 #include "../newgrf_config.h"
 #include "../core/alloc_func.hpp"
+#include "network_internal.h"
 #include "core/game.h"
 #include "network_udp.h"
 #include "network_gamelist.h"
--- a/src/network/network_gamelist.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/network/network_gamelist.h	Tue Jun 17 10:32:49 2008 +0000
@@ -5,6 +5,8 @@
 #ifndef NETWORK_GAMELIST_H
 #define NETWORK_GAMELIST_H
 
+#include "network_type.h"
+
 /** Structure with information shown in the game list (GUI) */
 struct NetworkGameList {
 	NetworkGameInfo info;  ///< The game information of this server
--- a/src/network/network_gui.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/network/network_gui.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -9,7 +9,7 @@
 #include "network.h"
 #include "../date_func.h"
 #include "../fios.h"
-#include "network_data.h"
+#include "network_internal.h"
 #include "network_client.h"
 #include "network_gui.h"
 #include "network_gamelist.h"
@@ -38,9 +38,6 @@
 #define BGC 5
 #define BTC 15
 
-/* Global to remember sorting after window has been closed */
-static Listing _ng_sorting;
-
 static bool _chat_tab_completion_active;
 
 static void ShowNetworkStartServerWindow();
@@ -87,57 +84,6 @@
 	InvalidateWindowData(WC_NETWORK_WINDOW, 0, unselect);
 }
 
-static bool _internal_sort_order; // Used for Qsort order-flipping
-typedef int CDECL NGameNameSortFunction(const void*, const void*);
-
-/** Qsort function to sort by name. */
-static int CDECL NGameNameSorter(const void *a, const void *b)
-{
-	const NetworkGameList *cmp1 = *(const NetworkGameList**)a;
-	const NetworkGameList *cmp2 = *(const NetworkGameList**)b;
-	int r = strcasecmp(cmp1->info.server_name, cmp2->info.server_name);
-
-	return _internal_sort_order ? -r : r;
-}
-
-/** Qsort function to sort by the amount of clients online on a
- * server. If the two servers have the same amount, the one with the
- * higher maximum is preferred. */
-static int CDECL NGameClientSorter(const void *a, const void *b)
-{
-	const NetworkGameList *cmp1 = *(const NetworkGameList**)a;
-	const NetworkGameList *cmp2 = *(const NetworkGameList**)b;
-	/* Reverse as per default we are interested in most-clients first */
-	int r = cmp1->info.clients_on - cmp2->info.clients_on;
-
-	if (r == 0) r = cmp1->info.clients_max - cmp2->info.clients_max;
-	if (r == 0) r = strcasecmp(cmp1->info.server_name, cmp2->info.server_name);
-
-	return _internal_sort_order ? -r : r;
-}
-
-/** Qsort function to sort by joinability. If both servers are the
- * same, prefer the non-passworded server first. */
-static int CDECL NGameAllowedSorter(const void *a, const void *b)
-{
-	const NetworkGameList *cmp1 = *(const NetworkGameList**)a;
-	const NetworkGameList *cmp2 = *(const NetworkGameList**)b;
-
-	/* The servers we do not know anything about (the ones that did not reply) should be at the bottom) */
-	int r = StrEmpty(cmp1->info.server_revision) - StrEmpty(cmp2->info.server_revision);
-
-	/* Reverse default as we are interested in version-compatible clients first */
-	if (r == 0) r = cmp2->info.version_compatible - cmp1->info.version_compatible;
-	/* The version-compatible ones are then sorted with NewGRF compatible first, incompatible last */
-	if (r == 0) r = cmp2->info.compatible - cmp1->info.compatible;
-	/* Passworded servers should be below unpassworded servers */
-	if (r == 0) r = cmp1->info.use_password - cmp2->info.use_password;
-	/* Finally sort on the name of the server */
-	if (r == 0) r = strcasecmp(cmp1->info.server_name, cmp2->info.server_name);
-
-	return _internal_sort_order ? -r : r;
-}
-
 /** Enum for NetworkGameWindow, referring to _network_game_window_widgets */
 enum NetworkGameWindowWidgets {
 	NGWW_CLOSE,         ///< Close 'X' button
@@ -171,42 +117,25 @@
 
 typedef GUIList<NetworkGameList*> GUIGameServerList;
 
-struct NetworkGameWindow : public QueryStringBaseWindow {
+class NetworkGameWindow : public QueryStringBaseWindow {
+protected:
+	/* Runtime saved values */
+	static Listing last_sorting;
+
+	/* Constants for sorting servers */
+	static GUIGameServerList::SortFunction *const sorter_funcs[];
+
 	byte field;                  ///< selected text-field
 	NetworkGameList *server;     ///< selected server
 	GUIGameServerList servers;   ///< list with game servers.
 
-	NetworkGameWindow(const WindowDesc *desc) : QueryStringBaseWindow(desc)
-	{
-		ttd_strlcpy(this->edit_str_buf, _network_player_name, lengthof(this->edit_str_buf));
-		this->afilter = CS_ALPHANUMERAL;
-		InitializeTextBuffer(&this->text, this->edit_str_buf, lengthof(this->edit_str_buf), 120);
-
-		UpdateNetworkGameWindow(true);
-
-		this->vscroll.cap = 11;
-		this->resize.step_height = NET_PRC__SIZE_OF_ROW;
-
-		this->field = NGWW_PLAYER;
-		this->server = NULL;
-
-		this->servers.flags = VL_REBUILD | (_ng_sorting.order ? VL_DESC : VL_NONE);
-		this->servers.sort_type = _ng_sorting.criteria;
-
-		this->FindWindowPlacementAndResize(desc);
-	}
-
-	~NetworkGameWindow()
-	{
-	}
-
 	/**
 	 * (Re)build the network game list as its amount has changed because
 	 * an item has been added or deleted for example
 	 */
 	void BuildNetworkGameList()
 	{
-		if (!(this->servers.flags & VL_REBUILD)) return;
+		if (!this->servers.NeedRebuild()) return;
 
 		/* Create temporary array of games to use for listing */
 		this->servers.Clear();
@@ -216,40 +145,63 @@
 		}
 
 		this->servers.Compact();
-
-		/* Force resort */
-		this->servers.flags &= ~VL_REBUILD;
-		this->servers.flags |= VL_RESORT;
+		this->servers.RebuildDone();
 	}
 
+	/** Sort servers by name. */
+	static int CDECL NGameNameSorter(NetworkGameList* const *a, NetworkGameList* const *b)
+	{
+		return strcasecmp((*a)->info.server_name, (*b)->info.server_name);
+	}
+
+	/** Sort servers by the amount of clients online on a
+	 * server. If the two servers have the same amount, the one with the
+	 * higher maximum is preferred. */
+	static int CDECL NGameClientSorter(NetworkGameList* const *a, NetworkGameList* const *b)
+	{
+		/* Reverse as per default we are interested in most-clients first */
+		int r = (*a)->info.clients_on - (*b)->info.clients_on;
+
+		if (r == 0) r = (*a)->info.clients_max - (*b)->info.clients_max;
+		if (r == 0) r = NGameNameSorter(a, b);
+
+		return r;
+	}
+
+	/** Sort servers by joinability. If both servers are the
+	 * same, prefer the non-passworded server first. */
+	static int CDECL NGameAllowedSorter(NetworkGameList* const *a, NetworkGameList* const *b)
+	{
+		/* The servers we do not know anything about (the ones that did not reply) should be at the bottom) */
+		int r = StrEmpty((*a)->info.server_revision) - StrEmpty((*b)->info.server_revision);
+
+		/* Reverse default as we are interested in version-compatible clients first */
+		if (r == 0) r = (*b)->info.version_compatible - (*a)->info.version_compatible;
+		/* The version-compatible ones are then sorted with NewGRF compatible first, incompatible last */
+		if (r == 0) r = (*b)->info.compatible - (*a)->info.compatible;
+		/* Passworded servers should be below unpassworded servers */
+		if (r == 0) r = (*a)->info.use_password - (*b)->info.use_password;
+		/* Finally sort on the name of the server */
+		if (r == 0) r = NGameNameSorter(a, b);
+
+		return r;
+	}
+
+	/** Sort the server list */
 	void SortNetworkGameList()
 	{
-		static NGameNameSortFunction * const ngame_sorter[] = {
-			&NGameNameSorter,
-			&NGameClientSorter,
-			&NGameAllowedSorter
-		};
-
-		NetworkGameList *item;
-		uint i;
-
-		if (!(this->servers.flags & VL_RESORT)) return;
-		if (this->servers.Length() == 0) return;
-
-		_internal_sort_order = !!(this->servers.flags & VL_DESC);
-		qsort(this->servers.Begin(), this->servers.Length(), sizeof(this->servers.Begin()), ngame_sorter[this->servers.sort_type]);
+		if (!this->servers.Sort()) return;
 
 		/* After sorting ngl->sort_list contains the sorted items. Put these back
 		 * into the original list. Basically nothing has changed, we are only
 		 * shuffling the ->next pointers */
 		_network_game_list = this->servers[0];
-		for (item = _network_game_list, i = 1; i != this->servers.Length(); i++) {
+		NetworkGameList *item = _network_game_list;
+		for (uint i = 1; i != this->servers.Length(); i++) {
 			item->next = this->servers[i];
 			item = item->next;
 		}
 		item->next = NULL;
-
-		this->servers.flags &= ~VL_RESORT;
 	}
 
 	/**
@@ -285,16 +237,44 @@
 		}
 	}
 
+public:
+	NetworkGameWindow(const WindowDesc *desc) : QueryStringBaseWindow(desc)
+	{
+		ttd_strlcpy(this->edit_str_buf, _settings_client.network.player_name, lengthof(this->edit_str_buf));
+		this->afilter = CS_ALPHANUMERAL;
+		InitializeTextBuffer(&this->text, this->edit_str_buf, lengthof(this->edit_str_buf), 120);
+
+		UpdateNetworkGameWindow(true);
+
+		this->vscroll.cap = 11;
+		this->resize.step_height = NET_PRC__SIZE_OF_ROW;
+
+		this->field = NGWW_PLAYER;
+		this->server = NULL;
+
+		this->servers.SetListing(this->last_sorting);
+		this->servers.SetSortFuncs(this->sorter_funcs);
+		this->servers.ForceRebuild();
+		this->SortNetworkGameList();
+
+		this->FindWindowPlacementAndResize(desc);
+	}
+
+	~NetworkGameWindow()
+	{
+		this->last_sorting = this->servers.GetListing();
+	}
+
 	virtual void OnPaint()
 	{
 		const NetworkGameList *sel = this->server;
-		const SortButtonState arrow = (this->servers.flags & VL_DESC) ? SBS_DOWN : SBS_UP;
+		const SortButtonState arrow = this->servers.IsDescSortOrder() ? SBS_DOWN : SBS_UP;
 
-		if (this->servers.flags & VL_REBUILD) {
+		if (this->servers.NeedRebuild()) {
 			this->BuildNetworkGameList();
 			SetVScrollCount(this, this->servers.Length());
 		}
-		if (this->servers.flags & VL_RESORT) this->SortNetworkGameList();
+		this->SortNetworkGameList();
 
 		/* 'Refresh' button invisible if no server selected */
 		this->SetWidgetDisabledState(NGWW_REFRESH, sel == NULL);
@@ -310,7 +290,7 @@
 				sel->info.grfconfig == NULL);
 
 		SetDParam(0, 0x00);
-		SetDParam(1, _lan_internet_types_dropdown[_network_lan_internet]);
+		SetDParam(1, _lan_internet_types_dropdown[_settings_client.network.lan_internet]);
 		this->DrawWidgets();
 
 		/* Edit box to set player name */
@@ -319,31 +299,23 @@
 		DrawString(this->widget[NGWW_PLAYER].left - 100, 23, STR_NETWORK_PLAYER_NAME, TC_GOLD);
 
 		/* Sort based on widgets: name, clients, compatibility */
-		switch (this->servers.sort_type) {
+		switch (this->servers.SortType()) {
 			case NGWW_NAME    - NGWW_NAME: this->DrawSortButtonState(NGWW_NAME,    arrow); break;
 			case NGWW_CLIENTS - NGWW_NAME: this->DrawSortButtonState(NGWW_CLIENTS, arrow); break;
 			case NGWW_INFO    - NGWW_NAME: this->DrawSortButtonState(NGWW_INFO,    arrow); break;
 		}
 
 		uint16 y = NET_PRC__OFFSET_TOP_WIDGET + 3;
-		int32 n = 0;
-		int32 pos = this->vscroll.pos;
-		const NetworkGameList *cur_item = _network_game_list;
 
-		while (pos > 0 && cur_item != NULL) {
-			pos--;
-			cur_item = cur_item->next;
+		const int max = min(this->vscroll.pos + this->vscroll.cap, (int)this->servers.Length());
+
+		for (int i = this->vscroll.pos; i < max; ++i) {
+			const NetworkGameList *ngl = this->servers[i];
+			this->DrawServerLine(ngl, y, ngl == sel);
+			y += NET_PRC__SIZE_OF_ROW;
 		}
 
-		while (cur_item != NULL) {
-			this->DrawServerLine(cur_item, y, cur_item == sel);
-
-			cur_item = cur_item->next;
-			y += NET_PRC__SIZE_OF_ROW;
-			if (++n == this->vscroll.cap) break; // max number of games in the window
-		}
-
-		const NetworkGameList *last_joined = NetworkGameListAddItem(inet_addr(_network_last_host), _network_last_port);
+		const NetworkGameList *last_joined = NetworkGameListAddItem(inet_addr(_settings_client.network.last_host), _settings_client.network.last_port);
 		/* Draw the last joined server, if any */
 		if (last_joined != NULL) this->DrawServerLine(last_joined, y = this->widget[NGWW_LASTJOINED].top + 3, last_joined == sel);
 
@@ -411,7 +383,7 @@
 			if (!sel->info.compatible) {
 				DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, y, sel->info.version_compatible ? STR_NETWORK_GRF_MISMATCH : STR_NETWORK_VERSION_MISMATCH, TC_FROMSTRING); // server mismatch
 			} else if (sel->info.clients_on == sel->info.clients_max) {
-				/* Show: server full, when clients_on == clients_max */
+				/* Show: server full, when clients_on == max_clients */
 				DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, y, STR_NETWORK_SERVER_FULL, TC_FROMSTRING); // server full
 			} else if (sel->info.use_password) {
 				DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, y, STR_NETWORK_PASSWORD, TC_FROMSTRING); // password warning
@@ -434,37 +406,33 @@
 				break;
 
 			case NGWW_CONN_BTN: // 'Connection' droplist
-				ShowDropDownMenu(this, _lan_internet_types_dropdown, _network_lan_internet, NGWW_CONN_BTN, 0, 0); // do it for widget NSSW_CONN_BTN
+				ShowDropDownMenu(this, _lan_internet_types_dropdown, _settings_client.network.lan_internet, NGWW_CONN_BTN, 0, 0); // do it for widget NSSW_CONN_BTN
 				break;
 
 			case NGWW_NAME: // Sort by name
 			case NGWW_CLIENTS: // Sort by connected clients
 			case NGWW_INFO: // Connectivity (green dot)
-				if (this->servers.sort_type == widget - NGWW_NAME) this->servers.flags ^= VL_DESC;
-				this->servers.flags |= VL_RESORT;
-				this->servers.sort_type = widget - NGWW_NAME;
-
-				_ng_sorting.order = !!(this->servers.flags & VL_DESC);
-				_ng_sorting.criteria = this->servers.sort_type;
+				if (this->servers.SortType() == widget - NGWW_NAME) {
+					this->servers.ToggleSortOrder();
+				} else {
+					this->servers.SetSortType(widget - NGWW_NAME);
+					this->servers.ForceResort();
+				}
 				this->SetDirty();
 				break;
 
 			case NGWW_MATRIX: { // Matrix to show networkgames
-				NetworkGameList *cur_item;
 				uint32 id_v = (pt.y - NET_PRC__OFFSET_TOP_WIDGET) / NET_PRC__SIZE_OF_ROW;
 
 				if (id_v >= this->vscroll.cap) return; // click out of bounds
 				id_v += this->vscroll.pos;
 
-				cur_item = _network_game_list;
-				for (; id_v > 0 && cur_item != NULL; id_v--) cur_item = cur_item->next;
-
-				this->server = cur_item;
+				this->server = (id_v < this->servers.Length()) ? this->servers[id_v] : NULL;
 				this->SetDirty();
 			} break;
 
 			case NGWW_LASTJOINED: {
-				NetworkGameList *last_joined = NetworkGameListAddItem(inet_addr(_network_last_host), _network_last_port);
+				NetworkGameList *last_joined = NetworkGameListAddItem(inet_addr(_settings_client.network.last_host), _settings_client.network.last_port);
 				if (last_joined != NULL) {
 					this->server = last_joined;
 					this->SetDirty();
@@ -472,7 +440,7 @@
 			} break;
 
 			case NGWW_FIND: // Find server automatically
-				switch (_network_lan_internet) {
+				switch (_settings_client.network.lan_internet) {
 					case 0: NetworkUDPSearchGame(); break;
 					case 1: NetworkUDPQueryMasterServer(); break;
 				}
@@ -480,7 +448,7 @@
 
 			case NGWW_ADD: // Add a server
 				ShowQueryString(
-					BindCString(_network_default_ip),
+					BindCString(_settings_client.network.connect_to_ip),
 					STR_NETWORK_ENTER_IP,
 					31 | 0x1000,  // maximum number of characters OR
 					250, // characters up to this width pixels, whichever is satisfied first
@@ -493,8 +461,8 @@
 
 			case NGWW_JOIN: // Join Game
 				if (this->server != NULL) {
-					snprintf(_network_last_host, sizeof(_network_last_host), "%s", inet_ntoa(*(struct in_addr *)&this->server->ip));
-					_network_last_port = this->server->port;
+					snprintf(_settings_client.network.last_host, sizeof(_settings_client.network.last_host), "%s", inet_ntoa(*(struct in_addr *)&this->server->ip));
+					_settings_client.network.last_port = this->server->port;
 					ShowNetworkLobbyWindow(this->server);
 				}
 				break;
@@ -513,7 +481,7 @@
 	{
 		switch (widget) {
 			case NGWW_CONN_BTN:
-				_network_lan_internet = index;
+				_settings_client.network.lan_internet = index;
 				break;
 
 			default:
@@ -531,7 +499,7 @@
 	virtual void OnInvalidateData(int data)
 	{
 		if (data != 0) this->server = NULL;
-		this->servers.flags |= VL_REBUILD;
+		this->servers.ForceRebuild();
 		this->SetDirty();
 	}
 
@@ -549,13 +517,13 @@
 			return state;
 		}
 
-		if (this->HandleEditBoxKey(NGWW_PLAYER, keycode, key, state) == 1) return state; // enter pressed
+		if (this->HandleEditBoxKey(NGWW_PLAYER, key, keycode, state) == 1) return state; // enter pressed
 
 		/* The name is only allowed when it starts with a letter! */
-		if (StrEmpty(this->edit_str_buf) && this->edit_str_buf[0] != ' ') {
-			ttd_strlcpy(_network_player_name, this->edit_str_buf, lengthof(_network_player_name));
+		if (!StrEmpty(this->edit_str_buf) && this->edit_str_buf[0] != ' ') {
+			ttd_strlcpy(_settings_client.network.player_name, this->edit_str_buf, lengthof(_settings_client.network.player_name));
 		} else {
-			ttd_strlcpy(_network_player_name, "Player", lengthof(_network_player_name));
+			ttd_strlcpy(_settings_client.network.player_name, "Player", lengthof(_settings_client.network.player_name));
 		}
 		return state;
 	}
@@ -589,6 +557,14 @@
 	}
 };
 
+Listing NetworkGameWindow::last_sorting = {false, 2};
+GUIGameServerList::SortFunction *const NetworkGameWindow::sorter_funcs[] = {
+	&NGameNameSorter,
+	&NGameClientSorter,
+	&NGameAllowedSorter
+};
+
+
 static const Widget _network_game_window_widgets[] = {
 /* TOP */
 {   WWT_CLOSEBOX,   RESIZE_NONE,   BGC,     0,    10,     0,    13, STR_00C5,                         STR_018B_CLOSE_WINDOW},            // NGWW_CLOSE
@@ -650,9 +626,6 @@
 		for (srv = &_network_host_list[0]; srv != endof(_network_host_list) && *srv != NULL; srv++) {
 			NetworkAddServer(*srv);
 		}
-
-		_ng_sorting.criteria = 2; // sort default by collectivity (green-dots on top)
-		_ng_sorting.order = 0;    // sort ascending by default
 	}
 
 	new NetworkGameWindow(&_network_game_window_desc);
@@ -692,47 +665,45 @@
 
 	NetworkStartServerWindow(const WindowDesc *desc) : QueryStringBaseWindow(desc)
 	{
-		ttd_strlcpy(this->edit_str_buf, _network_server_name, lengthof(this->edit_str_buf));
+		ttd_strlcpy(this->edit_str_buf, _settings_client.network.server_name, lengthof(this->edit_str_buf));
 
 		_saveload_mode = SLD_NEW_GAME;
 		BuildFileList();
 		this->vscroll.cap = 12;
-		this->vscroll.count = _fios_num + 1;
+		this->vscroll.count = _fios_items.Length();
 
 		this->afilter = CS_ALPHANUMERAL;
 		InitializeTextBuffer(&this->text, this->edit_str_buf, lengthof(this->edit_str_buf), 160);
 
 		this->field = NSSW_GAMENAME;
-		_network_game_info.use_password = !StrEmpty(_network_server_password);
 
 		this->FindWindowPlacementAndResize(desc);
 	}
 
 	virtual void OnPaint()
 	{
-		int y = NSSWND_START, pos;
+		int y = NSSWND_START;
 		const FiosItem *item;
 
 		/* draw basic widgets */
 		SetDParam(1, _connection_types_dropdown[_network_advertise]);
-		SetDParam(2, _network_game_info.clients_max);
-		SetDParam(3, _network_game_info.companies_max);
-		SetDParam(4, _network_game_info.spectators_max);
-		SetDParam(5, STR_NETWORK_LANG_ANY + _network_game_info.server_lang);
+		SetDParam(2, _settings_client.network.max_clients);
+		SetDParam(3, _settings_client.network.max_companies);
+		SetDParam(4, _settings_client.network.max_spectators);
+		SetDParam(5, STR_NETWORK_LANG_ANY + _settings_client.network.server_lang);
 		this->DrawWidgets();
 
 		/* editbox to set game name */
 		this->DrawEditBox(NSSW_GAMENAME);
 
 		/* if password is set, draw red '*' next to 'Set password' button */
-		if (_network_game_info.use_password) DoDrawString("*", 408, 23, TC_RED);
+		if (!StrEmpty(_settings_client.network.server_password)) DoDrawString("*", 408, 23, TC_RED);
 
 		/* draw list of maps */
 		GfxFillRect(11, 63, 258, 215, 0xD7);  // black background of maps list
 
-		pos = this->vscroll.pos;
-		while (pos < _fios_num + 1) {
-			item = _fios_list + pos - 1;
+		for (uint pos = this->vscroll.pos; pos < _fios_items.Length() + 1; pos++) {
+			item = _fios_items.Get(pos - 1);
 			if (item == this->map || (pos == 0 && this->map == NULL))
 				GfxFillRect(11, y - 1, 258, y + 10, 155); // show highlighted item with a different colour
 
@@ -741,7 +712,6 @@
 			} else {
 				DoDrawString(item->title, 14, y, _fios_colors[item->type] );
 			}
-			pos++;
 			y += NSSWND_ROWSIZE;
 
 			if (y >= this->vscroll.cap * NSSWND_ROWSIZE + NSSWND_START) break;
@@ -764,7 +734,7 @@
 
 			case NSSW_SETPWD: // Set password button
 				this->widget_id = NSSW_SETPWD;
-				ShowQueryString(BindCString(_network_server_password), STR_NETWORK_SET_PASSWORD, 20, 250, this, CS_ALPHANUMERAL);
+				ShowQueryString(BindCString(_settings_client.network.server_password), STR_NETWORK_SET_PASSWORD, 20, 250, this, CS_ALPHANUMERAL);
 				break;
 
 			case NSSW_SELMAP: { // Select map
@@ -773,7 +743,7 @@
 				y += this->vscroll.pos;
 				if (y >= this->vscroll.count) return;
 
-				this->map = (y == 0) ? NULL : _fios_list + y - 1;
+				this->map = (y == 0) ? NULL : _fios_items.Get(y - 1);
 				this->SetDirty();
 			} break;
 
@@ -791,13 +761,13 @@
 					switch (widget) {
 						default: NOT_REACHED();
 						case NSSW_CLIENTS_BTND: case NSSW_CLIENTS_BTNU:
-							_network_game_info.clients_max    = Clamp(_network_game_info.clients_max    + widget - NSSW_CLIENTS_TXT,    2, MAX_CLIENTS);
+							_settings_client.network.max_clients    = Clamp(_settings_client.network.max_clients    + widget - NSSW_CLIENTS_TXT,    2, MAX_CLIENTS);
 							break;
 						case NSSW_COMPANIES_BTND: case NSSW_COMPANIES_BTNU:
-							_network_game_info.companies_max  = Clamp(_network_game_info.companies_max  + widget - NSSW_COMPANIES_TXT,  1, MAX_PLAYERS);
+							_settings_client.network.max_companies  = Clamp(_settings_client.network.max_companies  + widget - NSSW_COMPANIES_TXT,  1, MAX_PLAYERS);
 							break;
 						case NSSW_SPECTATORS_BTND: case NSSW_SPECTATORS_BTNU:
-							_network_game_info.spectators_max = Clamp(_network_game_info.spectators_max + widget - NSSW_SPECTATORS_TXT, 0, MAX_CLIENTS);
+							_settings_client.network.max_spectators = Clamp(_settings_client.network.max_spectators + widget - NSSW_SPECTATORS_TXT, 0, MAX_CLIENTS);
 							break;
 					}
 				}
@@ -806,26 +776,26 @@
 
 			case NSSW_CLIENTS_TXT:    // Click on number of players
 				this->widget_id = NSSW_CLIENTS_TXT;
-				SetDParam(0, _network_game_info.clients_max);
+				SetDParam(0, _settings_client.network.max_clients);
 				ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_NETWORK_NUMBER_OF_CLIENTS,    3, 50, this, CS_NUMERAL);
 				break;
 
 			case NSSW_COMPANIES_TXT:  // Click on number of companies
 				this->widget_id = NSSW_COMPANIES_TXT;
-				SetDParam(0, _network_game_info.companies_max);
+				SetDParam(0, _settings_client.network.max_companies);
 				ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_NETWORK_NUMBER_OF_COMPANIES,  3, 50, this, CS_NUMERAL);
 				break;
 
 			case NSSW_SPECTATORS_TXT: // Click on number of spectators
 				this->widget_id = NSSW_SPECTATORS_TXT;
-				SetDParam(0, _network_game_info.spectators_max);
+				SetDParam(0, _settings_client.network.max_spectators);
 				ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_NETWORK_NUMBER_OF_SPECTATORS, 3, 50, this, CS_NUMERAL);
 				break;
 
 			case NSSW_LANGUAGE_BTN: { // Language
 				uint sel = 0;
 				for (uint i = 0; i < lengthof(_language_dropdown) - 1; i++) {
-					if (_language_dropdown[i] == STR_NETWORK_LANG_ANY + _network_game_info.server_lang) {
+					if (_language_dropdown[i] == STR_NETWORK_LANG_ANY + _settings_client.network.server_lang) {
 						sel = i;
 						break;
 					}
@@ -869,7 +839,7 @@
 				_network_advertise = (index != 0);
 				break;
 			case NSSW_LANGUAGE_BTN:
-				_network_game_info.server_lang = _language_dropdown[index] - STR_NETWORK_LANG_ANY;
+				_settings_client.network.server_lang = _language_dropdown[index] - STR_NETWORK_LANG_ANY;
 				break;
 			default:
 				NOT_REACHED();
@@ -889,7 +859,7 @@
 		if (this->field == NSSW_GAMENAME) {
 			if (this->HandleEditBoxKey(NSSW_GAMENAME, key, keycode, state) == 1) return state; // enter pressed
 
-			ttd_strlcpy(_network_server_name, this->text.buf, sizeof(_network_server_name));
+			ttd_strlcpy(_settings_client.network.server_name, this->text.buf, sizeof(_settings_client.network.server_name));
 		}
 
 		return state;
@@ -900,16 +870,15 @@
 		if (str == NULL) return;
 
 		if (this->widget_id == NSSW_SETPWD) {
-			ttd_strlcpy(_network_server_password, str, lengthof(_network_server_password));
-			_network_game_info.use_password = !StrEmpty(_network_server_password);
+			ttd_strlcpy(_settings_client.network.server_password, str, lengthof(_settings_client.network.server_password));
 		} else {
 			int32 value = atoi(str);
 			this->InvalidateWidget(this->widget_id);
 			switch (this->widget_id) {
 				default: NOT_REACHED();
-				case NSSW_CLIENTS_TXT:    _network_game_info.clients_max    = Clamp(value, 2, MAX_CLIENTS); break;
-				case NSSW_COMPANIES_TXT:  _network_game_info.companies_max  = Clamp(value, 1, MAX_PLAYERS); break;
-				case NSSW_SPECTATORS_TXT: _network_game_info.spectators_max = Clamp(value, 0, MAX_CLIENTS); break;
+				case NSSW_CLIENTS_TXT:    _settings_client.network.max_clients    = Clamp(value, 2, MAX_CLIENTS); break;
+				case NSSW_COMPANIES_TXT:  _settings_client.network.max_companies  = Clamp(value, 1, MAX_PLAYERS); break;
+				case NSSW_SPECTATORS_TXT: _settings_client.network.max_spectators = Clamp(value, 0, MAX_CLIENTS); break;
 			}
 		}
 
@@ -1131,22 +1100,22 @@
 			case NLWW_JOIN:     // Join company
 				/* Button can be clicked only when it is enabled */
 				_network_playas = this->company;
-				NetworkClientConnectGame(_network_last_host, _network_last_port);
+				NetworkClientConnectGame(_settings_client.network.last_host, _settings_client.network.last_port);
 				break;
 
 			case NLWW_NEW:      // New company
 				_network_playas = PLAYER_NEW_COMPANY;
-				NetworkClientConnectGame(_network_last_host, _network_last_port);
+				NetworkClientConnectGame(_settings_client.network.last_host, _settings_client.network.last_port);
 				break;
 
 			case NLWW_SPECTATE: // Spectate game
 				_network_playas = PLAYER_SPECTATOR;
-				NetworkClientConnectGame(_network_last_host, _network_last_port);
+				NetworkClientConnectGame(_settings_client.network.last_host, _settings_client.network.last_port);
 				break;
 
 			case NLWW_REFRESH:  // Refresh
-				NetworkTCPQueryServer(_network_last_host, _network_last_port); // company info
-				NetworkUDPQueryServer(_network_last_host, _network_last_port); // general data
+				NetworkTCPQueryServer(_settings_client.network.last_host, _settings_client.network.last_port); // company info
+				NetworkUDPQueryServer(_settings_client.network.last_host, _settings_client.network.last_port); // general data
 				break;
 		}
 	}
@@ -1189,8 +1158,8 @@
 {
 	DeleteWindowById(WC_NETWORK_WINDOW, 0);
 
-	NetworkTCPQueryServer(_network_last_host, _network_last_port); // company info
-	NetworkUDPQueryServer(_network_last_host, _network_last_port); // general data
+	NetworkTCPQueryServer(_settings_client.network.last_host, _settings_client.network.last_port); // company info
+	NetworkUDPQueryServer(_settings_client.network.last_host, _settings_client.network.last_port); // general data
 
 	new NetworkLobbyWindow(&_network_lobby_window_desc, ngl);
 }
@@ -1334,7 +1303,7 @@
 
 		if (_network_own_client_index != ci->client_index) {
 			/* We are no spectator and the player we want to give money to is no spectator and money gifts are allowed */
-			if (IsValidPlayer(_network_playas) && IsValidPlayer(ci->client_playas) && _settings.economy.give_money) {
+			if (IsValidPlayer(_network_playas) && IsValidPlayer(ci->client_playas) && _settings_game.economy.give_money) {
 				GetString(this->action[i], STR_NETWORK_CLIENTLIST_GIVE_MONEY, lastof(this->action[i]));
 				this->proc[i++] = &ClientList_GiveMoney;
 			}
@@ -1586,6 +1555,12 @@
 	ShowQueryString(STR_EMPTY, caption, 20, 180, FindWindowById(WC_NETWORK_STATUS_WINDOW, 0), CS_ALPHANUMERAL);
 }
 
+// Vars needed for the join-GUI
+NetworkJoinStatus _network_join_status;
+uint8 _network_join_waiting;
+uint16 _network_join_kbytes;
+uint16 _network_join_kbytes_total;
+
 struct NetworkJoinStatusWindow : Window {
 	NetworkJoinStatusWindow(const WindowDesc *desc) : Window(desc)
 	{
@@ -1667,7 +1642,7 @@
 	if (!_network_server) {
 		SEND_COMMAND(PACKET_CLIENT_CHAT)((NetworkAction)(NETWORK_ACTION_CHAT + type), type, dest, buf);
 	} else {
-		NetworkServer_HandleChat((NetworkAction)(NETWORK_ACTION_CHAT + type), type, dest, buf, NETWORK_SERVER_INDEX);
+		NetworkServerSendChat((NetworkAction)(NETWORK_ACTION_CHAT + type), type, dest, buf, NETWORK_SERVER_INDEX);
 	}
 }
 
@@ -1921,7 +1896,7 @@
 	{
 		this->parent = parent;
 		this->afilter = CS_ALPHANUMERAL;
-		InitializeTextBuffer(&this->text, this->edit_str_buf, min(lengthof(_network_default_company_pass), lengthof(this->edit_str_buf)), 0);
+		InitializeTextBuffer(&this->text, this->edit_str_buf, min(lengthof(_settings_client.network.default_company_pass), lengthof(this->edit_str_buf)), 0);
 
 		this->FindWindowPlacementAndResize(desc);
 	}
@@ -1929,7 +1904,7 @@
 	void OnOk()
 	{
 		if (this->IsWidgetLowered(NCPWW_SAVE_AS_DEFAULT_PASSWORD)) {
-			snprintf(_network_default_company_pass, lengthof(_network_default_company_pass), "%s", this->edit_str_buf);
+			snprintf(_settings_client.network.default_company_pass, lengthof(_settings_client.network.default_company_pass), "%s", this->edit_str_buf);
 		}
 
 		/* empty password is a '*' because of console argument */
--- a/src/network/network_gui.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/network/network_gui.h	Tue Jun 17 10:32:49 2008 +0000
@@ -5,11 +5,10 @@
 #ifndef NETWORK_GUI_H
 #define NETWORK_GUI_H
 
-#include "../window_type.h"
-
 #ifdef ENABLE_NETWORK
 
-#include "network_data.h"
+#include "../window_type.h"
+#include "network_type.h"
 
 void ShowNetworkNeedPassword(NetworkPasswordType npt);
 void ShowNetworkGiveMoneyWindow(PlayerID player); // PlayerID
--- a/src/network/network_internal.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/network/network_internal.h	Tue Jun 17 10:32:49 2008 +0000
@@ -7,10 +7,13 @@
 
 #ifdef ENABLE_NETWORK
 
-#include "../player_type.h"
-#include "../economy_type.h"
+#include "network.h"
+#include "network_func.h"
+#include "core/os_abstraction.h"
+#include "core/core.h"
 #include "core/config.h"
-#include "core/game.h"
+#include "core/packet.h"
+#include "core/tcp.h"
 
 /**
  * If this line is enable, every frame will have a sync test
@@ -29,50 +32,14 @@
  */
 //#define NETWORK_SEND_DOUBLE_SEED
 
-
-enum {
-	/**
-	 * How many clients can we have? Like.. MAX_PLAYERS - 1 is the amount of
-	 *  players that can really play.. so.. a max of 4 spectators.. gives us..
-	 *  MAX_PLAYERS + 3
-	 */
-	MAX_CLIENTS = MAX_PLAYERS + 3,
+#define MAX_TEXT_MSG_LEN 1024 /* long long long long sentences :-) */
 
-	/** Do not change this next line. It should _ALWAYS_ be MAX_CLIENTS + 1 */
-	MAX_CLIENT_INFO = MAX_CLIENTS + 1,
-
-	/** Maximum number of internet interfaces supported. */
-	MAX_INTERFACES = 9,
-
-	/** How many vehicle/station types we put over the network */
-	NETWORK_VEHICLE_TYPES = 5,
-	NETWORK_STATION_TYPES = 5,
+enum MapPacket {
+	MAP_PACKET_START,
+	MAP_PACKET_NORMAL,
+	MAP_PACKET_END,
 };
 
-struct NetworkPlayerInfo {
-	char company_name[NETWORK_NAME_LENGTH];         ///< Company name
-	char password[NETWORK_PASSWORD_LENGTH];         ///< The password for the player
-	Year inaugurated_year;                          ///< What year the company started in
-	Money company_value;                            ///< The company value
-	Money money;                                    ///< The amount of money the company has
-	Money income;                                   ///< How much did the company earned last year
-	uint16 performance;                             ///< What was his performance last month?
-	bool use_password;                              ///< Is there a password
-	uint16 num_vehicle[NETWORK_VEHICLE_TYPES];      ///< How many vehicles are there of this type?
-	uint16 num_station[NETWORK_STATION_TYPES];      ///< How many stations are there of this type?
-	char players[NETWORK_PLAYERS_LENGTH];           ///< The players that control this company (Name1, name2, ..)
-	uint16 months_empty;                            ///< How many months the company is empty
-};
-
-struct NetworkClientInfo {
-	uint16 client_index;                            ///< Index of the client (same as ClientState->index)
-	char client_name[NETWORK_CLIENT_NAME_LENGTH];   ///< Name of the client
-	byte client_lang;                               ///< The language of the client
-	PlayerID client_playas;                         ///< As which player is this client playing (PlayerID)
-	uint32 client_ip;                               ///< IP-address of the client (so he can be banned)
-	Date join_date;                                 ///< Gamedate the player has joined
-	char unique_id[NETWORK_UNIQUE_ID_LENGTH];       ///< Every play sends an unique id so we can indentify him
-};
 
 enum NetworkJoinStatus {
 	NETWORK_JOIN_STATUS_CONNECTING,
@@ -126,100 +93,80 @@
 	NETLANG_COUNT
 };
 
-VARDEF NetworkGameInfo _network_game_info;
-VARDEF NetworkPlayerInfo _network_player_info[MAX_PLAYERS];
-VARDEF NetworkClientInfo _network_client_info[MAX_CLIENT_INFO];
-
-VARDEF char _network_player_name[NETWORK_CLIENT_NAME_LENGTH];
-VARDEF char _network_default_ip[NETWORK_HOSTNAME_LENGTH];
+extern NetworkPlayerInfo _network_player_info[MAX_PLAYERS];
 
-VARDEF uint16 _network_own_client_index;
-VARDEF char _network_unique_id[NETWORK_UNIQUE_ID_LENGTH]; // Our own unique ID
+extern uint32 _frame_counter_server; // The frame_counter of the server, if in network-mode
+extern uint32 _frame_counter_max; // To where we may go with our clients
 
-VARDEF uint32 _frame_counter_server; // The frame_counter of the server, if in network-mode
-VARDEF uint32 _frame_counter_max; // To where we may go with our clients
-
-VARDEF uint32 _last_sync_frame; // Used in the server to store the last time a sync packet was sent to clients.
+extern uint32 _last_sync_frame; // Used in the server to store the last time a sync packet was sent to clients.
 
 // networking settings
-VARDEF uint32 _broadcast_list[MAX_INTERFACES + 1];
-
-VARDEF uint16 _network_server_port;
-/* We use bind_ip and bind_ip_host, where bind_ip_host is the readable form of
-    bind_ip_host, and bind_ip the numeric value, because we want a nice number
-    in the openttd.cfg, but we wants to use the uint32 internally.. */
-VARDEF uint32 _network_server_bind_ip;
-VARDEF char _network_server_bind_ip_host[NETWORK_HOSTNAME_LENGTH];
-VARDEF bool _is_network_server; // Does this client wants to be a network-server?
-VARDEF char _network_server_name[NETWORK_NAME_LENGTH];
-VARDEF char _network_server_password[NETWORK_PASSWORD_LENGTH];
-VARDEF char _network_rcon_password[NETWORK_PASSWORD_LENGTH];
-VARDEF char _network_default_company_pass[NETWORK_PASSWORD_LENGTH];
-
-VARDEF uint16 _network_max_join_time;             ///< Time a client can max take to join
-VARDEF bool _network_pause_on_join;               ///< Pause the game when a client tries to join (more chance of succeeding join)
-
-VARDEF uint16 _redirect_console_to_client;
-
-VARDEF uint16 _network_sync_freq;
-VARDEF uint8 _network_frame_freq;
+extern uint32 _broadcast_list[MAX_INTERFACES + 1];
 
-VARDEF uint32 _sync_seed_1, _sync_seed_2;
-VARDEF uint32 _sync_frame;
-VARDEF bool _network_first_time;
-// Vars needed for the join-GUI
-VARDEF NetworkJoinStatus _network_join_status;
-VARDEF uint8 _network_join_waiting;
-VARDEF uint16 _network_join_kbytes;
-VARDEF uint16 _network_join_kbytes_total;
-
-VARDEF char _network_last_host[NETWORK_HOSTNAME_LENGTH];
-VARDEF short _network_last_port;
-VARDEF uint32 _network_last_host_ip;
-VARDEF uint8 _network_reconnect;
+extern uint32 _network_server_bind_ip;
 
-VARDEF bool _network_udp_server;
-VARDEF uint16 _network_udp_broadcast;
-
-VARDEF byte _network_lan_internet;
+extern uint32 _sync_seed_1, _sync_seed_2;
+extern uint32 _sync_frame;
+extern bool _network_first_time;
+// Vars needed for the join-GUI
+extern NetworkJoinStatus _network_join_status;
+extern uint8 _network_join_waiting;
+extern uint16 _network_join_kbytes;
+extern uint16 _network_join_kbytes_total;
 
-VARDEF bool _network_need_advertise;
-VARDEF uint32 _network_last_advertise_frame;
-VARDEF uint8 _network_advertise_retries;
+extern uint32 _network_last_host_ip;
+extern uint8 _network_reconnect;
 
-VARDEF bool _network_autoclean_companies;
-VARDEF uint8 _network_autoclean_unprotected; // Remove a company after X months
-VARDEF uint8 _network_autoclean_protected;   // Unprotect a company after X months
+extern bool _network_udp_server;
+extern uint16 _network_udp_broadcast;
 
-VARDEF Year _network_restart_game_year;      // If this year is reached, the server automaticly restarts
-VARDEF uint8 _network_min_players;           // Minimum number of players for game to unpause
+extern uint8 _network_advertise_retries;
+
+// following externs are instantiated at network.cpp
+extern CommandPacket *_local_command_queue;
+
+// Here we keep track of the clients
+//  (and the client uses [0] for his own communication)
+extern NetworkTCPSocketHandler _clients[MAX_CLIENTS];
 
 void NetworkTCPQueryServer(const char* host, unsigned short port);
 
-byte NetworkSpectatorCount();
-
-VARDEF char *_network_host_list[10];
-VARDEF char *_network_ban_list[25];
-
-void ParseConnectionString(const char **player, const char **port, char *connection_string);
-void NetworkUpdateClientInfo(uint16 client_index);
 void NetworkAddServer(const char *b);
 void NetworkRebuildHostList();
-bool NetworkChangeCompanyPassword(byte argc, char *argv[]);
-void NetworkPopulateCompanyInfo();
 void UpdateNetworkGameWindow(bool unselect);
-void CheckMinPlayers();
-void NetworkStartDebugLog(const char *hostname, uint16 port);
-
-void NetworkUDPCloseAll();
-void NetworkGameLoop();
-void NetworkUDPGameLoop();
-bool NetworkServerStart();
-bool NetworkClientConnectGame(const char *host, uint16 port);
-void NetworkReboot();
-void NetworkDisconnect();
 
 bool IsNetworkCompatibleVersion(const char *version);
 
+void NetworkExecuteCommand(CommandPacket *cp);
+void NetworkAddCommandQueue(NetworkTCPSocketHandler *cs, CommandPacket *cp);
+
+// from network.c
+void NetworkCloseClient(NetworkTCPSocketHandler *cs);
+void CDECL NetworkTextMessage(NetworkAction action, ConsoleColour color, bool self_send, const char *name, const char *str, ...);
+void NetworkGetClientName(char *clientname, size_t size, const NetworkTCPSocketHandler *cs);
+uint NetworkCalculateLag(const NetworkTCPSocketHandler *cs);
+byte NetworkGetCurrentLanguageIndex();
+NetworkTCPSocketHandler *NetworkFindClientStateFromIndex(uint16 client_index);
+unsigned long NetworkResolveHost(const char *hostname);
+char* GetNetworkErrorMsg(char* buf, NetworkErrorCode err, const char* last);
+bool NetworkFindName(char new_name[NETWORK_CLIENT_NAME_LENGTH]);
+
+#define DEREF_CLIENT(i) (&_clients[i])
+// This returns the NetworkClientInfo from a NetworkClientState
+#define DEREF_CLIENT_INFO(cs) (&_network_client_info[cs - _clients])
+
+// Macros to make life a bit more easier
+#define DEF_CLIENT_RECEIVE_COMMAND(type) NetworkRecvStatus NetworkPacketReceive_ ## type ## _command(Packet *p)
+#define DEF_CLIENT_SEND_COMMAND(type) void NetworkPacketSend_ ## type ## _command()
+#define DEF_CLIENT_SEND_COMMAND_PARAM(type) void NetworkPacketSend_ ## type ## _command
+#define DEF_SERVER_RECEIVE_COMMAND(type) void NetworkPacketReceive_ ## type ## _command(NetworkTCPSocketHandler *cs, Packet *p)
+#define DEF_SERVER_SEND_COMMAND(type) void NetworkPacketSend_ ## type ## _command(NetworkTCPSocketHandler *cs)
+#define DEF_SERVER_SEND_COMMAND_PARAM(type) void NetworkPacketSend_ ## type ## _command
+
+#define SEND_COMMAND(type) NetworkPacketSend_ ## type ## _command
+#define RECEIVE_COMMAND(type) NetworkPacketReceive_ ## type ## _command
+
+#define FOR_ALL_CLIENTS(cs) for (cs = _clients; cs != endof(_clients) && cs->IsConnected(); cs++)
+
 #endif /* ENABLE_NETWORK */
 #endif /* NETWORK_INTERNAL_H */
--- a/src/network/network_server.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/network/network_server.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -8,7 +8,7 @@
 #include "../openttd.h" // XXX StringID
 #include "../debug.h"
 #include "../strings_func.h"
-#include "network_data.h"
+#include "network_internal.h"
 #include "core/tcp.h"
 #include "../vehicle_base.h"
 #include "../vehicle_func.h"
@@ -229,8 +229,8 @@
 
 	Packet *p = NetworkSend_Init(PACKET_SERVER_NEED_PASSWORD);
 	p->Send_uint8(type);
-	p->Send_uint32(_settings.game_creation.generation_seed);
-	p->Send_string(_network_unique_id);
+	p->Send_uint32(_settings_game.game_creation.generation_seed);
+	p->Send_string(_settings_client.network.network_id);
 	cs->Send_Packet(p);
 }
 
@@ -254,8 +254,8 @@
 
 	p = NetworkSend_Init(PACKET_SERVER_WELCOME);
 	p->Send_uint16(cs->index);
-	p->Send_uint32(_settings.game_creation.generation_seed);
-	p->Send_string(_network_unique_id);
+	p->Send_uint32(_settings_game.game_creation.generation_seed);
+	p->Send_string(_settings_client.network.network_id);
 	cs->Send_Packet(p);
 
 		// Transmit info about all the active clients
@@ -323,12 +323,12 @@
 		Packet *p;
 
 		// Make a dump of the current game
-		if (SaveOrLoad(filename, SL_SAVE, AUTOSAVE_DIR) != SL_OK) error("network savedump failed");
+		if (SaveOrLoad(filename, SL_SAVE, AUTOSAVE_DIR) != SL_OK) usererror("network savedump failed");
 
 		file_pointer = FioFOpenFile(filename, "rb", AUTOSAVE_DIR);
 		fseek(file_pointer, 0, SEEK_END);
 
-		if (ftell(file_pointer) == 0) error("network savedump failed - zero sized savegame?");
+		if (ftell(file_pointer) == 0) usererror("network savedump failed - zero sized savegame?");
 
 		// Now send the _frame_counter and how many packets are coming
 		p = NetworkSend_Init(PACKET_SERVER_MAP);
@@ -355,7 +355,7 @@
 			p->Send_uint8(MAP_PACKET_NORMAL);
 			res = (int)fread(p->buffer + p->size, 1, SEND_MTU - p->size, file_pointer);
 
-			if (ferror(file_pointer)) error("Error reading temporary network savegame!");
+			if (ferror(file_pointer)) usererror("Error reading temporary network savegame!");
 
 			p->size += res;
 			cs->Send_Packet(p);
@@ -611,10 +611,16 @@
 
 DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_NEWGRFS_CHECKED)
 {
+	if (cs->status != STATUS_INACTIVE) {
+		/* Illegal call, return error and ignore the packet */
+		SEND_COMMAND(PACKET_SERVER_ERROR)(cs, NETWORK_ERROR_NOT_EXPECTED);
+		return;
+	}
+
 	NetworkClientInfo *ci = DEREF_CLIENT_INFO(cs);
 
 	/* We now want a password from the client else we do not allow him in! */
-	if (_network_game_info.use_password) {
+	if (!StrEmpty(_settings_client.network.server_password)) {
 		SEND_COMMAND(PACKET_SERVER_NEED_PASSWORD)(cs, NETWORK_GAME_PASSWORD);
 	} else {
 		if (IsValidPlayer(ci->client_playas) && _network_player_info[ci->client_playas].password[0] != '\0') {
@@ -627,6 +633,12 @@
 
 DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_JOIN)
 {
+	if (cs->status != STATUS_INACTIVE) {
+		/* Illegal call, return error and ignore the packet */
+		SEND_COMMAND(PACKET_SERVER_ERROR)(cs, NETWORK_ERROR_NOT_EXPECTED);
+		return;
+	}
+
 	char name[NETWORK_CLIENT_NAME_LENGTH];
 	char unique_id[NETWORK_UNIQUE_ID_LENGTH];
 	NetworkClientInfo *ci;
@@ -655,13 +667,13 @@
 	// join another company does not affect these values
 	switch (playas) {
 		case PLAYER_NEW_COMPANY: /* New company */
-			if (ActivePlayerCount() >= _network_game_info.companies_max) {
+			if (ActivePlayerCount() >= _settings_client.network.max_companies) {
 				SEND_COMMAND(PACKET_SERVER_ERROR)(cs, NETWORK_ERROR_FULL);
 				return;
 			}
 			break;
 		case PLAYER_SPECTATOR: /* Spectator */
-			if (NetworkSpectatorCount() >= _network_game_info.spectators_max) {
+			if (NetworkSpectatorCount() >= _settings_client.network.max_spectators) {
 				SEND_COMMAND(PACKET_SERVER_ERROR)(cs, NETWORK_ERROR_FULL);
 				return;
 			}
@@ -711,7 +723,7 @@
 
 	if (cs->status == STATUS_AUTHORIZING && type == NETWORK_GAME_PASSWORD) {
 		// Check game-password
-		if (strcmp(password, _network_game_info.server_password) != 0) {
+		if (strcmp(password, _settings_client.network.server_password) != 0) {
 			// Password is invalid
 			SEND_COMMAND(PACKET_SERVER_ERROR)(cs, NETWORK_ERROR_WRONG_PASSWORD);
 			return;
@@ -800,11 +812,11 @@
 			}
 		}
 
-		if (_network_pause_on_join) {
+		if (_settings_client.network.pause_on_join) {
 			/* Now pause the game till the client is in sync */
 			DoCommandP(0, 1, 0, NULL, CMD_PAUSE);
 
-			NetworkServer_HandleChat(NETWORK_ACTION_SERVER_MESSAGE, DESTTYPE_BROADCAST, 0, "Game paused (incoming client)", NETWORK_SERVER_INDEX);
+			NetworkServerSendChat(NETWORK_ACTION_SERVER_MESSAGE, DESTTYPE_BROADCAST, 0, "Game paused (incoming client)", NETWORK_SERVER_INDEX);
 		}
 	} else {
 		// Wrong status for this packet, give a warning to client, and close connection
@@ -1011,6 +1023,12 @@
 
 DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_ACK)
 {
+	if (cs->status < STATUS_AUTH) {
+		/* Illegal call, return error and ignore the packet */
+		SEND_COMMAND(PACKET_SERVER_ERROR)(cs, NETWORK_ERROR_NOT_AUTHORIZED);
+		return;
+	}
+
 	uint32 frame = p->Recv_uint32();
 
 	/* The client is trying to catch up with the server */
@@ -1021,9 +1039,9 @@
 		/* Now he is! Unpause the game */
 		cs->status = STATUS_ACTIVE;
 
-		if (_network_pause_on_join) {
+		if (_settings_client.network.pause_on_join) {
 			DoCommandP(0, 0, 0, NULL, CMD_PAUSE);
-			NetworkServer_HandleChat(NETWORK_ACTION_SERVER_MESSAGE, DESTTYPE_BROADCAST, 0, "Game unpaused (client connected)", NETWORK_SERVER_INDEX);
+			NetworkServerSendChat(NETWORK_ACTION_SERVER_MESSAGE, DESTTYPE_BROADCAST, 0, "Game unpaused (client connected)", NETWORK_SERVER_INDEX);
 		}
 
 		CheckMinPlayers();
@@ -1040,7 +1058,7 @@
 
 
 
-void NetworkServer_HandleChat(NetworkAction action, DestType desttype, int dest, const char *msg, uint16 from_index)
+void NetworkServerSendChat(NetworkAction action, DestType desttype, int dest, const char *msg, uint16 from_index)
 {
 	NetworkTCPSocketHandler *cs;
 	const NetworkClientInfo *ci, *ci_own, *ci_to;
@@ -1139,6 +1157,12 @@
 
 DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_CHAT)
 {
+	if (cs->status < STATUS_AUTH) {
+		/* Illegal call, return error and ignore the packet */
+		SEND_COMMAND(PACKET_SERVER_ERROR)(cs, NETWORK_ERROR_NOT_AUTHORIZED);
+		return;
+	}
+
 	NetworkAction action = (NetworkAction)p->Recv_uint8();
 	DestType desttype = (DestType)p->Recv_uint8();
 	int dest = p->Recv_uint16();
@@ -1146,11 +1170,17 @@
 
 	p->Recv_string(msg, MAX_TEXT_MSG_LEN);
 
-	NetworkServer_HandleChat(action, desttype, dest, msg, cs->index);
+	NetworkServerSendChat(action, desttype, dest, msg, cs->index);
 }
 
 DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_SET_PASSWORD)
 {
+	if (cs->status != STATUS_ACTIVE) {
+		/* Illegal call, return error and ignore the packet */
+		SEND_COMMAND(PACKET_SERVER_ERROR)(cs, NETWORK_ERROR_NOT_EXPECTED);
+		return;
+	}
+
 	char password[NETWORK_PASSWORD_LENGTH];
 	const NetworkClientInfo *ci;
 
@@ -1164,6 +1194,12 @@
 
 DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_SET_NAME)
 {
+	if (cs->status != STATUS_ACTIVE) {
+		/* Illegal call, return error and ignore the packet */
+		SEND_COMMAND(PACKET_SERVER_ERROR)(cs, NETWORK_ERROR_NOT_EXPECTED);
+		return;
+	}
+
 	char client_name[NETWORK_CLIENT_NAME_LENGTH];
 	NetworkClientInfo *ci;
 
@@ -1187,12 +1223,12 @@
 	char pass[NETWORK_PASSWORD_LENGTH];
 	char command[NETWORK_RCONCOMMAND_LENGTH];
 
-	if (_network_game_info.rcon_password[0] == '\0') return;
+	if (StrEmpty(_settings_client.network.rcon_password)) return;
 
 	p->Recv_string(pass, sizeof(pass));
 	p->Recv_string(command, sizeof(command));
 
-	if (strcmp(pass, _network_game_info.rcon_password) != 0) {
+	if (strcmp(pass, _settings_client.network.rcon_password) != 0) {
 		DEBUG(net, 0, "[rcon] wrong password from client-id %d", cs->index);
 		return;
 	}
@@ -1365,7 +1401,7 @@
 /* Check if we want to restart the map */
 static void NetworkCheckRestartMap()
 {
-	if (_network_restart_game_year != 0 && _cur_year >= _network_restart_game_year) {
+	if (_settings_client.network.restart_game_year != 0 && _cur_year >= _settings_client.network.restart_game_year) {
 		DEBUG(net, 0, "Auto-restarting map. Year %d reached", _cur_year);
 
 		StartNewGameWithoutGUI(GENERATE_NEW_SEED);
@@ -1384,7 +1420,7 @@
 	const Player *p;
 	bool clients_in_company[MAX_PLAYERS];
 
-	if (!_network_autoclean_companies) return;
+	if (!_settings_client.network.autoclean_companies) return;
 
 	memset(clients_in_company, 0, sizeof(clients_in_company));
 
@@ -1409,13 +1445,13 @@
 			_network_player_info[p->index].months_empty++;
 
 			/* Is the company empty for autoclean_unprotected-months, and is there no protection? */
-			if (_network_player_info[p->index].months_empty > _network_autoclean_unprotected && _network_player_info[p->index].password[0] == '\0') {
+			if (_network_player_info[p->index].months_empty > _settings_client.network.autoclean_unprotected && _network_player_info[p->index].password[0] == '\0') {
 				/* Shut the company down */
 				DoCommandP(0, 2, p->index, NULL, CMD_PLAYER_CTRL);
 				IConsolePrintF(CC_DEFAULT, "Auto-cleaned company #%d", p->index + 1);
 			}
 			/* Is the compnay empty for autoclean_protected-months, and there is a protection? */
-			if (_network_player_info[p->index].months_empty > _network_autoclean_protected && _network_player_info[p->index].password[0] != '\0') {
+			if (_network_player_info[p->index].months_empty > _settings_client.network.autoclean_protected && _network_player_info[p->index].password[0] != '\0') {
 				/* Unprotect the company */
 				_network_player_info[p->index].password[0] = '\0';
 				IConsolePrintF(CC_DEFAULT, "Auto-removed protection from company #%d", p->index+1);
@@ -1510,7 +1546,7 @@
 #endif
 
 #ifndef ENABLE_NETWORK_SYNC_EVERY_FRAME
-	if (_frame_counter >= _last_sync_frame + _network_sync_freq) {
+	if (_frame_counter >= _last_sync_frame + _settings_client.network.sync_freq) {
 		_last_sync_frame = _frame_counter;
 		send_sync = true;
 	}
@@ -1542,8 +1578,8 @@
 			}
 		} else if (cs->status == STATUS_PRE_ACTIVE) {
 			int lag = NetworkCalculateLag(cs);
-			if (lag > _network_max_join_time) {
-				IConsolePrintF(CC_ERROR,"Client #%d is dropped because it took longer than %d ticks for him to join", cs->index, _network_max_join_time);
+			if (lag > _settings_client.network.max_join_time) {
+				IConsolePrintF(CC_ERROR,"Client #%d is dropped because it took longer than %d ticks for him to join", cs->index, _settings_client.network.max_join_time);
 				NetworkCloseClient(cs);
 			}
 		} else if (cs->status == STATUS_INACTIVE) {
@@ -1582,4 +1618,82 @@
 	NetworkAutoCleanCompanies();
 }
 
+void NetworkServerChangeOwner(PlayerID current_player, PlayerID new_player)
+{
+	/* The server has to handle all administrative issues, for example
+	 * updating and notifying all clients of what has happened */
+	NetworkTCPSocketHandler *cs;
+	NetworkClientInfo *ci = NetworkFindClientInfoFromIndex(NETWORK_SERVER_INDEX);
+
+	/* The server has just changed from player */
+	if (current_player == ci->client_playas) {
+		ci->client_playas = new_player;
+		NetworkUpdateClientInfo(NETWORK_SERVER_INDEX);
+	}
+
+	/* Find all clients that were in control of this company, and mark them as new_player */
+	FOR_ALL_CLIENTS(cs) {
+		ci = DEREF_CLIENT_INFO(cs);
+		if (current_player == ci->client_playas) {
+			ci->client_playas = new_player;
+			NetworkUpdateClientInfo(ci->client_index);
+		}
+	}
+}
+
+const char* GetPlayerIP(const NetworkClientInfo* ci)
+{
+	struct in_addr addr;
+
+	addr.s_addr = ci->client_ip;
+	return inet_ntoa(addr);
+}
+
+void NetworkServerShowStatusToConsole()
+{
+	static const char* const stat_str[] = {
+		"inactive",
+		"authorizing",
+		"authorized",
+		"waiting",
+		"loading map",
+		"map done",
+		"ready",
+		"active"
+	};
+
+	NetworkTCPSocketHandler *cs;
+	FOR_ALL_CLIENTS(cs) {
+		int lag = NetworkCalculateLag(cs);
+		const NetworkClientInfo *ci = DEREF_CLIENT_INFO(cs);
+		const char* status;
+
+		status = (cs->status < (ptrdiff_t)lengthof(stat_str) ? stat_str[cs->status] : "unknown");
+		IConsolePrintF(CC_INFO, "Client #%1d  name: '%s'  status: '%s'  frame-lag: %3d  company: %1d  IP: %s  unique-id: '%s'",
+			cs->index, ci->client_name, status, lag,
+			ci->client_playas + (IsValidPlayer(ci->client_playas) ? 1 : 0),
+			GetPlayerIP(ci), ci->unique_id);
+	}
+}
+
+void NetworkServerSendRcon(uint16 client_index, ConsoleColour colour_code, const char *string)
+{
+	SEND_COMMAND(PACKET_SERVER_RCON)(NetworkFindClientStateFromIndex(client_index), colour_code, string);
+}
+
+void NetworkServerSendError(uint16 client_index, NetworkErrorCode error)
+{
+	SEND_COMMAND(PACKET_SERVER_ERROR)(NetworkFindClientStateFromIndex(client_index), error);
+}
+
+bool NetworkCompanyHasPlayers(PlayerID company)
+{
+	const NetworkTCPSocketHandler *cs;
+	const NetworkClientInfo *ci;
+	FOR_ALL_CLIENTS(cs) {
+		ci = DEREF_CLIENT_INFO(cs);
+		if (ci->client_playas == company) return true;
+	}
+	return false;
+}
 #endif /* ENABLE_NETWORK */
--- a/src/network/network_server.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/network/network_server.h	Tue Jun 17 10:32:49 2008 +0000
@@ -14,21 +14,8 @@
 DEF_SERVER_SEND_COMMAND(PACKET_SERVER_NEWGAME);
 DEF_SERVER_SEND_COMMAND_PARAM(PACKET_SERVER_RCON)(NetworkTCPSocketHandler *cs, uint16 color, const char *command);
 
-bool NetworkFindName(char new_name[NETWORK_CLIENT_NAME_LENGTH]);
-void NetworkServer_HandleChat(NetworkAction action, DestType type, int dest, const char *msg, uint16 from_index);
-
 bool NetworkServer_ReadPackets(NetworkTCPSocketHandler *cs);
 void NetworkServer_Tick(bool send_frame);
-void NetworkServerMonthlyLoop();
-void NetworkServerYearlyLoop();
-
-static inline const char* GetPlayerIP(const NetworkClientInfo* ci)
-{
-	struct in_addr addr;
-
-	addr.s_addr = ci->client_ip;
-	return inet_ntoa(addr);
-}
 
 #else /* ENABLE_NETWORK */
 /* Network function stubs when networking is disabled */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/network/network_type.h	Tue Jun 17 10:32:49 2008 +0000
@@ -0,0 +1,108 @@
+/* $Id$ */
+
+/** @file network_internal.h Variables and function used internally. */
+
+#ifndef NETWORK_TYPE_H
+#define NETWORK_TYPE_H
+
+#ifdef ENABLE_NETWORK
+
+#include "../player_type.h"
+#include "../economy_type.h"
+#include "core/config.h"
+#include "core/game.h"
+
+enum {
+	/**
+	 * How many clients can we have? Like.. MAX_PLAYERS - 1 is the amount of
+	 *  players that can really play.. so.. a max of 4 spectators.. gives us..
+	 *  MAX_PLAYERS + 3
+	 */
+	MAX_CLIENTS = MAX_PLAYERS + 3,
+
+	/** Do not change this next line. It should _ALWAYS_ be MAX_CLIENTS + 1 */
+	MAX_CLIENT_INFO = MAX_CLIENTS + 1,
+
+	/** Maximum number of internet interfaces supported. */
+	MAX_INTERFACES = 9,
+
+	/** How many vehicle/station types we put over the network */
+	NETWORK_VEHICLE_TYPES = 5,
+	NETWORK_STATION_TYPES = 5,
+
+	NETWORK_SERVER_INDEX = 1,
+	NETWORK_EMPTY_INDEX  = 0,
+};
+
+struct NetworkPlayerInfo {
+	char company_name[NETWORK_NAME_LENGTH];         ///< Company name
+	char password[NETWORK_PASSWORD_LENGTH];         ///< The password for the player
+	Year inaugurated_year;                          ///< What year the company started in
+	Money company_value;                            ///< The company value
+	Money money;                                    ///< The amount of money the company has
+	Money income;                                   ///< How much did the company earned last year
+	uint16 performance;                             ///< What was his performance last month?
+	bool use_password;                              ///< Is there a password
+	uint16 num_vehicle[NETWORK_VEHICLE_TYPES];      ///< How many vehicles are there of this type?
+	uint16 num_station[NETWORK_STATION_TYPES];      ///< How many stations are there of this type?
+	char players[NETWORK_PLAYERS_LENGTH];           ///< The players that control this company (Name1, name2, ..)
+	uint16 months_empty;                            ///< How many months the company is empty
+};
+
+struct NetworkClientInfo {
+	uint16 client_index;                            ///< Index of the client (same as ClientState->index)
+	char client_name[NETWORK_CLIENT_NAME_LENGTH];   ///< Name of the client
+	byte client_lang;                               ///< The language of the client
+	PlayerID client_playas;                         ///< As which player is this client playing (PlayerID)
+	uint32 client_ip;                               ///< IP-address of the client (so he can be banned)
+	Date join_date;                                 ///< Gamedate the player has joined
+	char unique_id[NETWORK_UNIQUE_ID_LENGTH];       ///< Every play sends an unique id so we can indentify him
+};
+
+enum NetworkPasswordType {
+	NETWORK_GAME_PASSWORD,
+	NETWORK_COMPANY_PASSWORD,
+};
+
+enum DestType {
+	DESTTYPE_BROADCAST, ///< Send message/notice to all players (All)
+	DESTTYPE_TEAM,      ///< Send message/notice to everyone playing the same company (Team)
+	DESTTYPE_CLIENT,    ///< Send message/notice to only a certain player (Private)
+};
+
+/** Actions that can be used for NetworkTextMessage */
+enum NetworkAction {
+	NETWORK_ACTION_JOIN,
+	NETWORK_ACTION_LEAVE,
+	NETWORK_ACTION_SERVER_MESSAGE,
+	NETWORK_ACTION_CHAT,
+	NETWORK_ACTION_CHAT_COMPANY,
+	NETWORK_ACTION_CHAT_CLIENT,
+	NETWORK_ACTION_GIVE_MONEY,
+	NETWORK_ACTION_NAME_CHANGE,
+};
+
+enum NetworkErrorCode {
+	NETWORK_ERROR_GENERAL, // Try to use this one like never
+
+	/* Signals from clients */
+	NETWORK_ERROR_DESYNC,
+	NETWORK_ERROR_SAVEGAME_FAILED,
+	NETWORK_ERROR_CONNECTION_LOST,
+	NETWORK_ERROR_ILLEGAL_PACKET,
+	NETWORK_ERROR_NEWGRF_MISMATCH,
+
+	/* Signals from servers */
+	NETWORK_ERROR_NOT_AUTHORIZED,
+	NETWORK_ERROR_NOT_EXPECTED,
+	NETWORK_ERROR_WRONG_REVISION,
+	NETWORK_ERROR_NAME_IN_USE,
+	NETWORK_ERROR_WRONG_PASSWORD,
+	NETWORK_ERROR_PLAYER_MISMATCH, // Happens in CLIENT_COMMAND
+	NETWORK_ERROR_KICKED,
+	NETWORK_ERROR_CHEATER,
+	NETWORK_ERROR_FULL,
+};
+
+#endif /* ENABLE_NETWORK */
+#endif /* NETWORK_TYPE_H */
--- a/src/network/network_udp.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/network/network_udp.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -11,11 +11,11 @@
 
 #include "../stdafx.h"
 #include "../debug.h"
-#include "network_data.h"
 #include "../date_func.h"
 #include "../map_func.h"
 #include "network_gamelist.h"
 #include "network_udp.h"
+#include "network_internal.h"
 #include "../variables.h"
 #include "../newgrf_config.h"
 #include "../core/endian_func.hpp"
@@ -23,6 +23,7 @@
 #include "../player_base.h"
 #include "../player_func.h"
 #include "../settings_type.h"
+#include "../rev.h"
 
 #include "core/udp.h"
 
@@ -68,21 +69,36 @@
 DEF_UDP_RECEIVE_COMMAND(Server, PACKET_UDP_CLIENT_FIND_SERVER)
 {
 	// Just a fail-safe.. should never happen
-	if (!_network_udp_server)
+	if (!_network_udp_server) {
 		return;
+	}
+
+	NetworkGameInfo ngi;
+
+	/* Update some game_info */
+	ngi.clients_on     = _network_game_info.clients_on;
+	ngi.start_date     = _network_game_info.start_date;
+
+	ngi.server_lang    = _settings_client.network.server_lang;
+	ngi.use_password   = !StrEmpty(_settings_client.network.server_password);
+	ngi.clients_max    = _settings_client.network.max_clients;
+	ngi.companies_on   = ActivePlayerCount();
+	ngi.companies_max  = _settings_client.network.max_companies;
+	ngi.spectators_on  = NetworkSpectatorCount();
+	ngi.spectators_max = _settings_client.network.max_spectators;
+	ngi.game_date      = _date;
+	ngi.map_width      = MapSizeX();
+	ngi.map_height     = MapSizeY();
+	ngi.map_set        = _settings_game.game_creation.landscape;
+	ngi.dedicated      = _network_dedicated;
+	ngi.grfconfig      = _grfconfig;
+
+	ttd_strlcpy(ngi.map_name, _network_game_info.map_name, lengthof(ngi.map_name));
+	ttd_strlcpy(ngi.server_name, _settings_client.network.server_name, lengthof(ngi.server_name));
+	ttd_strlcpy(ngi.server_revision, _openttd_revision, lengthof(ngi.server_revision));
 
 	Packet packet(PACKET_UDP_SERVER_RESPONSE);
-
-	// Update some game_info
-	_network_game_info.game_date     = _date;
-	_network_game_info.map_width     = MapSizeX();
-	_network_game_info.map_height    = MapSizeY();
-	_network_game_info.map_set       = _settings.game_creation.landscape;
-	_network_game_info.companies_on  = ActivePlayerCount();
-	_network_game_info.spectators_on = NetworkSpectatorCount();
-	_network_game_info.grfconfig     = _grfconfig;
-
-	this->Send_NetworkGameInfo(&packet, &_network_game_info);
+	this->Send_NetworkGameInfo(&packet, &ngi);
 
 	// Let the client know that we are here
 	this->SendPacket(&packet, client_addr);
@@ -428,7 +444,7 @@
 		struct sockaddr_in out_addr;
 
 		out_addr.sin_family = AF_INET;
-		out_addr.sin_port = htons(_network_server_port);
+		out_addr.sin_port = htons(_settings_client.network.server_port);
 		out_addr.sin_addr.s_addr = _broadcast_list[i];
 
 		DEBUG(net, 4, "[udp] broadcasting to %s", inet_ntoa(out_addr.sin_addr));
@@ -535,7 +551,7 @@
 	Packet p(PACKET_UDP_SERVER_UNREGISTER);
 	/* Packet is: Version, server_port */
 	p.Send_uint8 (NETWORK_MASTER_SERVER_VERSION);
-	p.Send_uint16(_network_server_port);
+	p.Send_uint16(_settings_client.network.server_port);
 	_udp_master_socket->SendPacket(&p, &out_addr);
 }
 
@@ -584,7 +600,7 @@
 	/* Packet is: WELCOME_MESSAGE, Version, server_port */
 	p.Send_string(NETWORK_MASTER_SERVER_WELCOME_MESSAGE);
 	p.Send_uint8 (NETWORK_MASTER_SERVER_VERSION);
-	p.Send_uint16(_network_server_port);
+	p.Send_uint16(_settings_client.network.server_port);
 	_udp_master_socket->SendPacket(&p, &out_addr);
 }
 
--- a/src/newgrf.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/newgrf.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -328,7 +328,7 @@
 	/* Hack for add-on GRFs that need to modify another GRF's engines. This lets
 	 * them use the same engine slots. */
 	const GRFFile *grf_match = NULL;
-	if (_settings.vehicle.dynamic_engines) {
+	if (_settings_game.vehicle.dynamic_engines) {
 		uint32 override = _grf_id_overrides[file->grfid];
 		if (override != 0) {
 			grf_match = GetFileByGRFID(override);
@@ -343,7 +343,7 @@
 	/* Check if this vehicle is already defined... */
 	Engine *e = NULL;
 	FOR_ALL_ENGINES(e) {
-		if (_settings.vehicle.dynamic_engines && e->grffile != NULL && e->grffile != file && e->grffile != grf_match) continue;
+		if (_settings_game.vehicle.dynamic_engines && e->grffile != NULL && e->grffile != file && e->grffile != grf_match) continue;
 		if (e->type != type) continue;
 		if (e->internal_id != internal_id) continue;
 
@@ -379,14 +379,14 @@
 	extern uint32 GetNewGRFOverride(uint32 grfid);
 
 	const GRFFile *grf_match = NULL;
-	if (_settings.vehicle.dynamic_engines) {
+	if (_settings_game.vehicle.dynamic_engines) {
 		uint32 override = _grf_id_overrides[file->grfid];
 		if (override != 0) grf_match = GetFileByGRFID(override);
 	}
 
 	const Engine *e = NULL;
 	FOR_ALL_ENGINES(e) {
-		if (_settings.vehicle.dynamic_engines && e->grffile != file && (grf_match == NULL || e->grffile != grf_match)) continue;
+		if (_settings_game.vehicle.dynamic_engines && e->grffile != file && (grf_match == NULL || e->grffile != grf_match)) continue;
 		if (e->type != type) continue;
 		if (e->internal_id != internal_id) continue;
 
@@ -419,18 +419,6 @@
 
 typedef bool (*VCI_Handler)(uint engine, int numinfo, int prop, byte **buf, int len);
 
-static void dewagonize(int condition, Engine *e)
-{
-	if (condition != 0) {
-		e->info.unk2 &= ~0x80;
-		if (e->u.rail.railveh_type == RAILVEH_WAGON)
-			e->u.rail.railveh_type = RAILVEH_SINGLEHEAD;
-	} else {
-		e->info.unk2 |= 0x80;
-		e->u.rail.railveh_type = RAILVEH_WAGON;
-	}
-}
-
 static bool RailVehicleChangeInfo(uint engine, int numinfo, int prop, byte **bufp, int len)
 {
 	byte *buf = *bufp;
@@ -470,7 +458,15 @@
 
 			case 0x0B: // Power
 				rvi->power = grf_load_word(&buf);
-				dewagonize(rvi->power, e);
+
+				/* Set engine / wagon state based on power */
+				if (rvi->power != 0) {
+					if (rvi->railveh_type == RAILVEH_WAGON) {
+						rvi->railveh_type = RAILVEH_SINGLEHEAD;
+					}
+				} else {
+					rvi->railveh_type = RAILVEH_WAGON;
+				}
 				break;
 
 			case 0x0D: // Running cost factor
@@ -1414,7 +1410,7 @@
 				 * date before 1930, as this breaks the build date stuff.
 				 * @see FinaliseHouseArray() for more details.
 				 */
-				if (housespec->min_date < 1930) housespec->min_date = 1930;
+				if (housespec->min_year < 1930) housespec->min_year = 1930;
 
 				_loaded_newgrf_features.has_newhouses = true;
 			} break;
@@ -1425,8 +1421,8 @@
 
 			case 0x0A: { // Availability years
 				uint16 years = grf_load_word(&buf);
-				housespec->min_date = GB(years, 0, 8) > 150 ? MAX_YEAR : ORIGINAL_BASE_YEAR + GB(years, 0, 8);
-				housespec->max_date = GB(years, 8, 8) > 150 ? MAX_YEAR : ORIGINAL_BASE_YEAR + GB(years, 8, 8);
+				housespec->min_year = GB(years, 0, 8) > 150 ? MAX_YEAR : ORIGINAL_BASE_YEAR + GB(years, 0, 8);
+				housespec->max_year = GB(years, 8, 8) > 150 ? MAX_YEAR : ORIGINAL_BASE_YEAR + GB(years, 8, 8);
 			} break;
 
 			case 0x0B: // Population
@@ -1447,8 +1443,8 @@
 
 				/* If value of goods is negative, it means in fact food or, if in toyland, fizzy_drink acceptance.
 				 * Else, we have "standard" 3rd cargo type, goods or candy, for toyland once more */
-				CargoID cid = (goods >= 0) ? ((_settings.game_creation.landscape == LT_TOYLAND) ? CT_CANDY : CT_GOODS) :
-						((_settings.game_creation.landscape == LT_TOYLAND) ? CT_FIZZY_DRINKS : CT_FOOD);
+				CargoID cid = (goods >= 0) ? ((_settings_game.game_creation.landscape == LT_TOYLAND) ? CT_CANDY : CT_GOODS) :
+						((_settings_game.game_creation.landscape == LT_TOYLAND) ? CT_FIZZY_DRINKS : CT_FOOD);
 
 				/* Make sure the cargo type is valid in this climate. */
 				if (!GetCargo(cid)->IsValid()) goods = 0;
@@ -2177,11 +2173,11 @@
 				break;
 
 			case 0x17: // Probability in random game
-				indsp->appear_creation[_settings.game_creation.landscape] = grf_load_byte(&buf);
+				indsp->appear_creation[_settings_game.game_creation.landscape] = grf_load_byte(&buf);
 				break;
 
 			case 0x18: // Probability during gameplay
-				indsp->appear_ingame[_settings.game_creation.landscape] = grf_load_byte(&buf);
+				indsp->appear_ingame[_settings_game.game_creation.landscape] = grf_load_byte(&buf);
 				break;
 
 			case 0x19: // Map color
@@ -2653,7 +2649,7 @@
 							break;
 
 						case 0x02: // Decay speed
-							SB(ei->unk2, 0, 7, grf_load_byte(&buf) & 0x7F);
+							ei->decay_speed = grf_load_byte(&buf);
 							break;
 
 						case 0x03: // Vehicle life
@@ -3260,17 +3256,28 @@
 }
 
 
-static void VehicleMapSpriteGroup(byte *buf, byte feature, uint8 idcount, uint8 cidcount, bool wagover)
+static bool IsValidGroupID(uint16 groupid, const char *function)
+{
+	if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) {
+		grfmsg(1, "%s: Spriteset 0x%04X out of range (maximum 0x%02X) or empty, skipping.", function, groupid, _cur_grffile->spritegroups_count - 1);
+		return false;
+	}
+
+	return true;
+}
+
+static void VehicleMapSpriteGroup(byte *buf, byte feature, uint8 idcount)
 {
 	static EngineID *last_engines;
 	static uint last_engines_count;
-
-	if (!wagover) {
-		if (last_engines_count != idcount) {
-			last_engines = ReallocT(last_engines, idcount);
-			last_engines_count = idcount;
-		}
-	} else {
+	bool wagover = false;
+
+	/* Test for 'wagon override' flag */
+	if (HasBit(idcount, 7)) {
+		wagover = true;
+		/* Strip off the flag */
+		idcount = GB(idcount, 0, 7);
+
 		if (last_engines_count == 0) {
 			grfmsg(0, "VehicleMapSpriteGroup: WagonOverride: No engine to do override with");
 			return;
@@ -3278,79 +3285,76 @@
 
 		grfmsg(6, "VehicleMapSpriteGroup: WagonOverride: %u engines, %u wagons",
 				last_engines_count, idcount);
-	}
-
+	} else {
+		if (last_engines_count != idcount) {
+			last_engines = ReallocT(last_engines, idcount);
+			last_engines_count = idcount;
+		}
+	}
+
+	EngineID *engines = (EngineID*)alloca(idcount * sizeof(*engines));
 	for (uint i = 0; i < idcount; i++) {
-		uint8 engine_id = buf[3 + i];
-		EngineID engine = GetNewEngine(_cur_grffile, (VehicleType)feature, engine_id)->index;
-		byte *bp = &buf[4 + idcount];
-
-		grfmsg(7, "VehicleMapSpriteGroup: [%d] Engine %d...", i, engine);
-
-		for (uint c = 0; c < cidcount; c++) {
-			uint8 ctype = grf_load_byte(&bp);
-			uint16 groupid = grf_load_word(&bp);
-
-			grfmsg(8, "VehicleMapSpriteGroup: * [%d] Cargo type 0x%X, group id 0x%02X", c, ctype, groupid);
-
-			if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) {
-				grfmsg(1, "VehicleMapSpriteGroup: Spriteset 0x%04X out of range 0x%X or empty, skipping", groupid, _cur_grffile->spritegroups_count);
-				continue;
-			}
-
-			ctype = TranslateCargo(feature, ctype);
-			if (ctype == CT_INVALID) continue;
+		engines[i] = GetNewEngine(_cur_grffile, (VehicleType)feature, grf_load_byte(&buf))->index;
+		if (!wagover) last_engines[i] = engines[i];
+	}
+
+	uint8 cidcount = grf_load_byte(&buf);
+	for (uint c = 0; c < cidcount; c++) {
+		uint8 ctype = grf_load_byte(&buf);
+		uint16 groupid = grf_load_word(&buf);
+		if (!IsValidGroupID(groupid, "VehicleMapSpriteGroup")) continue;
+
+		grfmsg(8, "VehicleMapSpriteGroup: * [%d] Cargo type 0x%X, group id 0x%02X", c, ctype, groupid);
+
+		ctype = TranslateCargo(feature, ctype);
+		if (ctype == CT_INVALID) continue;
+
+		for (uint i = 0; i < idcount; i++) {
+			EngineID engine = engines[i];
+
+			grfmsg(7, "VehicleMapSpriteGroup: [%d] Engine %d...", i, engine);
 
 			if (wagover) {
 				SetWagonOverrideSprites(engine, ctype, _cur_grffile->spritegroups[groupid], last_engines, last_engines_count);
 			} else {
 				SetCustomEngineSprites(engine, ctype, _cur_grffile->spritegroups[groupid]);
-				last_engines[i] = engine;
 			}
 		}
 	}
 
-	{
-		byte *bp = &buf[4 + idcount + cidcount * 3];
-		uint16 groupid = grf_load_word(&bp);
-
-		grfmsg(8, "-- Default group id 0x%04X", groupid);
-
-		for (uint i = 0; i < idcount; i++) {
-			EngineID engine = GetNewEngine(_cur_grffile, (VehicleType)feature, buf[3 + i])->index;
-
-			/* Don't tell me you don't love duplicated code! */
-			if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) {
-				grfmsg(1, "VehicleMapSpriteGroup: Spriteset 0x%04X out of range 0x%X or empty, skipping",
-				       groupid, _cur_grffile->spritegroups_count);
-				continue;
-			}
-
-			if (wagover) {
-				SetWagonOverrideSprites(engine, CT_DEFAULT, _cur_grffile->spritegroups[groupid], last_engines, last_engines_count);
-			} else {
-				SetCustomEngineSprites(engine, CT_DEFAULT, _cur_grffile->spritegroups[groupid]);
-				SetEngineGRF(engine, _cur_grffile);
-				last_engines[i] = engine;
-			}
+	uint16 groupid = grf_load_word(&buf);
+	if (!IsValidGroupID(groupid, "VehicleMapSpriteGroup")) return;
+
+	grfmsg(8, "-- Default group id 0x%04X", groupid);
+
+	for (uint i = 0; i < idcount; i++) {
+		EngineID engine = engines[i];
+
+		if (wagover) {
+			SetWagonOverrideSprites(engine, CT_DEFAULT, _cur_grffile->spritegroups[groupid], last_engines, last_engines_count);
+		} else {
+			SetCustomEngineSprites(engine, CT_DEFAULT, _cur_grffile->spritegroups[groupid]);
+			SetEngineGRF(engine, _cur_grffile);
 		}
 	}
 }
 
 
-static void CanalMapSpriteGroup(byte *buf, uint8 idcount, uint8 cidcount)
+static void CanalMapSpriteGroup(byte *buf, uint8 idcount)
 {
-	byte *bp = &buf[4 + idcount + cidcount * 3];
-	uint16 groupid = grf_load_word(&bp);
-
-	if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) {
-		grfmsg(1, "CanalMapSpriteGroup: Spriteset 0x%04X out of range 0x%X or empty, skipping.",
-		       groupid, _cur_grffile->spritegroups_count);
-		return;
-	}
+	CanalFeature *cfs = (CanalFeature*)alloca(idcount * sizeof(*cfs));
+	for (uint i = 0; i < idcount; i++) {
+		cfs[i] = (CanalFeature)grf_load_byte(&buf);
+	}
+
+	uint8 cidcount = grf_load_byte(&buf);
+	buf += cidcount * 3;
+
+	uint16 groupid = grf_load_word(&buf);
+	if (!IsValidGroupID(groupid, "CanalMapSpriteGroup")) return;
 
 	for (uint i = 0; i < idcount; i++) {
-		CanalFeature cf = (CanalFeature)buf[3 + i];
+		CanalFeature cf = cfs[i];
 
 		if (cf >= CF_END) {
 			grfmsg(1, "CanalMapSpriteGroup: Canal subset %d out of range, skipping", cf);
@@ -3362,77 +3366,69 @@
 }
 
 
-static void StationMapSpriteGroup(byte *buf, uint8 idcount, uint8 cidcount)
+static void StationMapSpriteGroup(byte *buf, uint8 idcount)
 {
+	uint8 *stations = (uint8*)alloca(idcount * sizeof(*stations));
 	for (uint i = 0; i < idcount; i++) {
-		uint8 stid = buf[3 + i];
-		StationSpec *statspec = _cur_grffile->stations[stid];
-
-		if (statspec == NULL) {
-			grfmsg(1, "StationMapSpriteGroup: Station with ID 0x%02X does not exist, skipping", stid);
-			return;
-		}
-
-		byte *bp = &buf[4 + idcount];
-
-		for (uint c = 0; c < cidcount; c++) {
-			uint8 ctype = grf_load_byte(&bp);
-			uint16 groupid = grf_load_word(&bp);
-
-			if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) {
-				grfmsg(1, "StationMapSpriteGroup: Spriteset 0x%04X out of range 0x%X or empty, skipping",
-				       groupid, _cur_grffile->spritegroups_count);
-				continue;
+		stations[i] = grf_load_byte(&buf);
+	}
+
+	uint8 cidcount = grf_load_byte(&buf);
+	for (uint c = 0; c < cidcount; c++) {
+		uint8 ctype = grf_load_byte(&buf);
+		uint16 groupid = grf_load_word(&buf);
+		if (!IsValidGroupID(groupid, "StationMapSpriteGroup")) continue;
+
+		ctype = TranslateCargo(GSF_STATION, ctype);
+		if (ctype == CT_INVALID) continue;
+
+		for (uint i = 0; i < idcount; i++) {
+			StationSpec *statspec = _cur_grffile->stations[stations[i]];
+
+			if (statspec == NULL) {
+				grfmsg(1, "StationMapSpriteGroup: Station with ID 0x%02X does not exist, skipping", stations[i]);
+				return;
 			}
 
-			ctype = TranslateCargo(GSF_STATION, ctype);
-			if (ctype == CT_INVALID) continue;
-
 			statspec->spritegroup[ctype] = _cur_grffile->spritegroups[groupid];
 		}
 	}
 
-	{
-		byte *bp = &buf[4 + idcount + cidcount * 3];
-		uint16 groupid = grf_load_word(&bp);
-
-		if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) {
-			grfmsg(1, "StationMapSpriteGroup: Spriteset 0x%04X out of range 0x%X or empty, skipping",
-			       groupid, _cur_grffile->spritegroups_count);
-			return;
+	uint16 groupid = grf_load_word(&buf);
+	if (!IsValidGroupID(groupid, "StationMapSpriteGroup")) return;
+
+	for (uint i = 0; i < idcount; i++) {
+		StationSpec *statspec = _cur_grffile->stations[stations[i]];
+
+		if (statspec == NULL) {
+			grfmsg(1, "StationMapSpriteGroup: Station with ID 0x%02X does not exist, skipping", stations[i]);
+			continue;
 		}
 
-		for (uint i = 0; i < idcount; i++) {
-			uint8 stid = buf[3 + i];
-			StationSpec *statspec = _cur_grffile->stations[stid];
-			if (statspec == NULL) {
-				grfmsg(1, "StationMapSpriteGroup: Station with ID 0x%02X does not exist, skipping", stid);
-				continue;
-			}
-
-			statspec->spritegroup[CT_DEFAULT] = _cur_grffile->spritegroups[groupid];
-			statspec->grffile = _cur_grffile;
-			statspec->localidx = stid;
-			SetCustomStationSpec(statspec);
-		}
+		statspec->spritegroup[CT_DEFAULT] = _cur_grffile->spritegroups[groupid];
+		statspec->grffile = _cur_grffile;
+		statspec->localidx = stations[i];
+		SetCustomStationSpec(statspec);
 	}
 }
 
 
-static void TownHouseMapSpriteGroup(byte *buf, uint8 idcount, uint8 cidcount)
+static void TownHouseMapSpriteGroup(byte *buf, uint8 idcount)
 {
-	byte *bp = &buf[4 + idcount + cidcount * 3];
-	uint16 groupid = grf_load_word(&bp);
-
-	if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) {
-		grfmsg(1, "TownHouseMapSpriteGroup: Spriteset 0x%04X out of range 0x%X or empty, skipping.",
-		       groupid, _cur_grffile->spritegroups_count);
-		return;
-	}
+	uint8 *houses = (uint8*)alloca(idcount * sizeof(*houses));
+	for (uint i = 0; i < idcount; i++) {
+		houses[i] = grf_load_byte(&buf);
+	}
+
+	/* Skip the cargo type section, we only care about the default group */
+	uint8 cidcount = grf_load_byte(&buf);
+	buf += cidcount * 3;
+
+	uint16 groupid = grf_load_word(&buf);
+	if (!IsValidGroupID(groupid, "TownHouseMapSpriteGroup")) return;
 
 	for (uint i = 0; i < idcount; i++) {
-		uint8 hid = buf[3 + i];
-		HouseSpec *hs = _cur_grffile->housespec[hid];
+		HouseSpec *hs = _cur_grffile->housespec[houses[i]];
 
 		if (hs == NULL) {
 			grfmsg(1, "TownHouseMapSpriteGroup: Too many houses defined, skipping");
@@ -3443,20 +3439,22 @@
 	}
 }
 
-static void IndustryMapSpriteGroup(byte *buf, uint8 idcount, uint8 cidcount)
+static void IndustryMapSpriteGroup(byte *buf, uint8 idcount)
 {
-	byte *bp = &buf[4 + idcount + cidcount * 3];
-	uint16 groupid = grf_load_word(&bp);
-
-	if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) {
-		grfmsg(1, "IndustryMapSpriteGroup: Spriteset 0x%04X out of range 0x%X or empty, skipping.",
-		       groupid, _cur_grffile->spritegroups_count);
-		return;
-	}
+	uint8 *industries = (uint8*)alloca(idcount * sizeof(*industries));
+	for (uint i = 0; i < idcount; i++) {
+		industries[i] = grf_load_byte(&buf);
+	}
+
+	/* Skip the cargo type section, we only care about the default group */
+	uint8 cidcount = grf_load_byte(&buf);
+	buf += cidcount * 3;
+
+	uint16 groupid = grf_load_word(&buf);
+	if (!IsValidGroupID(groupid, "IndustryMapSpriteGroup")) return;
 
 	for (uint i = 0; i < idcount; i++) {
-		uint8 id = buf[3 + i];
-		IndustrySpec *indsp = _cur_grffile->industryspec[id];
+		IndustrySpec *indsp = _cur_grffile->industryspec[industries[i]];
 
 		if (indsp == NULL) {
 			grfmsg(1, "IndustryMapSpriteGroup: Too many industries defined, skipping");
@@ -3467,20 +3465,22 @@
 	}
 }
 
-static void IndustrytileMapSpriteGroup(byte *buf, uint8 idcount, uint8 cidcount)
+static void IndustrytileMapSpriteGroup(byte *buf, uint8 idcount)
 {
-	byte *bp = &buf[4 + idcount + cidcount * 3];
-	uint16 groupid = grf_load_word(&bp);
-
-	if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) {
-		grfmsg(1, "IndustrytileMapSpriteGroup: Spriteset 0x%04X out of range 0x%X or empty, skipping.",
-		       groupid, _cur_grffile->spritegroups_count);
-		return;
-	}
+	uint8 *indtiles = (uint8*)alloca(idcount * sizeof(*indtiles));
+	for (uint i = 0; i < idcount; i++) {
+		indtiles[i] = grf_load_byte(&buf);
+	}
+
+	/* Skip the cargo type section, we only care about the default group */
+	uint8 cidcount = grf_load_byte(&buf);
+	buf += cidcount * 3;
+
+	uint16 groupid = grf_load_word(&buf);
+	if (!IsValidGroupID(groupid, "IndustrytileMapSpriteGroup")) return;
 
 	for (uint i = 0; i < idcount; i++) {
-		uint8 id = buf[3 + i];
-		IndustryTileSpec *indtsp = _cur_grffile->indtspec[id];
+		IndustryTileSpec *indtsp = _cur_grffile->indtspec[indtiles[i]];
 
 		if (indtsp == NULL) {
 			grfmsg(1, "IndustrytileMapSpriteGroup: Too many industry tiles defined, skipping");
@@ -3491,22 +3491,25 @@
 	}
 }
 
-static void CargoMapSpriteGroup(byte *buf, uint8 idcount, uint8 cidcount)
+static void CargoMapSpriteGroup(byte *buf, uint8 idcount)
 {
-	byte *bp = &buf[4 + idcount + cidcount * 3];
-	uint16 groupid = grf_load_word(&bp);
-
-	if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) {
-		grfmsg(1, "CargoMapSpriteGroup: Spriteset 0x%04X out of range 0x%X or empty, skipping.",
-		       groupid, _cur_grffile->spritegroups_count);
-		return;
-	}
+	CargoID *cargos = (CargoID*)alloca(idcount * sizeof(*cargos));
+	for (uint i = 0; i < idcount; i++) {
+		cargos[i] = grf_load_byte(&buf);
+	}
+
+	/* Skip the cargo type section, we only care about the default group */
+	uint8 cidcount = grf_load_byte(&buf);
+	buf += cidcount * 3;
+
+	uint16 groupid = grf_load_word(&buf);
+	if (!IsValidGroupID(groupid, "CargoMapSpriteGroup")) return;
 
 	for (uint i = 0; i < idcount; i++) {
-		CargoID cid = buf[3 + i];
+		CargoID cid = cargos[i];
 
 		if (cid >= NUM_CARGO) {
-			grfmsg(1, "CargoMapSpriteGroup: Cargo ID %d out of range, skipping");
+			grfmsg(1, "CargoMapSpriteGroup: Cargo ID %d out of range, skipping", cid);
 			continue;
 		}
 
@@ -3516,49 +3519,49 @@
 	}
 }
 
-static void FSMportsMapSpriteGroup(byte *buf, uint8 idcount, uint8 cidcount)
+static void FSMportsMapSpriteGroup(byte *buf, uint8 idcount)
 {
+	uint8 *stations = (uint8*)alloca(idcount * sizeof(*stations));
 	for (uint i = 0; i < idcount; i++) {
-		uint8 stid = buf[3 + i];
-		FSMportsSpec *fsmportsspec = _cur_grffile->fsmports[stid];
-		byte *bp = &buf[4 + idcount];
-
-		for (uint c = 0; c < cidcount; c++) {
-			uint8 ctype = grf_load_byte(&bp);
-			uint16 groupid = grf_load_word(&bp);
-
-			if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) {
-				grfmsg(1, "StationMapSpriteGroup: Spriteset 0x%04X out of range 0x%X or empty, skipping",
-				       groupid, _cur_grffile->spritegroups_count);
-				continue;
+		stations[i] = grf_load_byte(&buf);
+	}
+
+	uint8 cidcount = grf_load_byte(&buf);
+	for (uint c = 0; c < cidcount; c++) {
+		uint8 ctype = grf_load_byte(&buf);
+		uint16 groupid = grf_load_word(&buf);
+		if (!IsValidGroupID(groupid, "StationMapSpriteGroup")) continue;
+
+		ctype = TranslateCargo(GSF_STATION, ctype);
+		if (ctype == CT_INVALID) continue;
+
+		for (uint i = 0; i < idcount; i++) {
+			FSMportsSpec *fsmportsspec = _cur_grffile->fsmports[stations[i]];
+
+			if (fsmportsspec == NULL) {
+				grfmsg(1, "StationMapSpriteGroup: Station with ID 0x%02X does not exist, skipping", stations[i]);
+				return;
 			}
 
-			ctype = TranslateCargo(GSF_STATION, ctype);
-			if (ctype == CT_INVALID) continue;
-
 			fsmportsspec->spritegroup[ctype] = _cur_grffile->spritegroups[groupid];
 		}
 	}
 
-	{
-		byte *bp = &buf[4 + idcount + cidcount * 3];
-		uint16 groupid = grf_load_word(&bp);
-
-		if (groupid >= _cur_grffile->spritegroups_count || _cur_grffile->spritegroups[groupid] == NULL) {
-			grfmsg(1, "StationMapSpriteGroup: Spriteset 0x%04X out of range 0x%X or empty, skipping",
-			       groupid, _cur_grffile->spritegroups_count);
-			return;
+	uint16 groupid = grf_load_word(&buf);
+	if (!IsValidGroupID(groupid, "StationMapSpriteGroup")) return;
+
+	for (uint i = 0; i < idcount; i++) {
+		FSMportsSpec *fsmportsspec = _cur_grffile->fsmports[stations[i]];
+
+		if (fsmportsspec == NULL) {
+			grfmsg(1, "StationMapSpriteGroup: Station with ID 0x%02X does not exist, skipping", stations[i]);
+			continue;
 		}
 
-		for (uint i = 0; i < idcount; i++) {
-			uint8 stid = buf[3 + i];
-			FSMportsSpec *fsmportsspec = _cur_grffile->fsmports[stid];
-
-			fsmportsspec->spritegroup[CT_DEFAULT] = _cur_grffile->spritegroups[groupid];
-			fsmportsspec->grffile = _cur_grffile;
-			fsmportsspec->localidx = stid;
-			SetCustomFSMportsSpec(fsmportsspec);
-		}
+		fsmportsspec->spritegroup[CT_DEFAULT] = _cur_grffile->spritegroups[groupid];
+		fsmportsspec->grffile = _cur_grffile;
+		fsmportsspec->localidx = stations[i];
+		SetCustomFSMportsSpec(fsmportsspec);
 	}
 }
 
@@ -3588,16 +3591,15 @@
 
 	if (!check_length(len, 6, "FeatureMapSpriteGroup")) return;
 
-	uint8 feature = buf[1];
-	uint8 idcount = buf[2] & 0x7F;
-	bool wagover = (buf[2] & 0x80) == 0x80;
-
-	if (!check_length(len, 3 + idcount, "FeatureMapSpriteGroup")) return;
+	buf++;
+	uint8 feature = grf_load_byte(&buf);
+	uint8 idcount = grf_load_byte(&buf);
 
 	/* If idcount is zero, this is a feature callback */
 	if (idcount == 0) {
-		byte *bp = &buf[4];
-		uint16 groupid = grf_load_word(&bp);
+		/* Skip number of cargo ids? */
+		grf_load_byte(&buf);
+		uint16 groupid = grf_load_word(&buf);
 
 		grfmsg(6, "FeatureMapSpriteGroup: Adding generic feature callback for feature %d", feature);
 
@@ -3605,46 +3607,42 @@
 		return;
 	}
 
-	uint8 cidcount = buf[3 + idcount];
-	if (!check_length(len, 4 + idcount + cidcount * 3, "FeatureMapSpriteGroup")) return;
-
-	grfmsg(6, "FeatureMapSpriteGroup: Feature %d, %d ids, %d cids, wagon override %d",
-			feature, idcount, cidcount, wagover);
+	grfmsg(6, "FeatureMapSpriteGroup: Feature %d, %d ids", feature, idcount);
 
 	switch (feature) {
 		case GSF_TRAIN:
 		case GSF_ROAD:
 		case GSF_SHIP:
 		case GSF_AIRCRAFT:
-			VehicleMapSpriteGroup(buf, feature, idcount, cidcount, wagover);
+			VehicleMapSpriteGroup(buf, feature, idcount);
 			return;
 
 		case GSF_CANAL:
-			CanalMapSpriteGroup(buf, idcount, cidcount);
+			CanalMapSpriteGroup(buf, idcount);
 			return;
 
 		case GSF_STATION:
-			StationMapSpriteGroup(buf, idcount, cidcount);
+			StationMapSpriteGroup(buf, idcount);
 			return;
 
 		case GSF_TOWNHOUSE:
-			TownHouseMapSpriteGroup(buf, idcount, cidcount);
+			TownHouseMapSpriteGroup(buf, idcount);
 			return;
 
 		case GSF_INDUSTRIES:
-			IndustryMapSpriteGroup(buf, idcount, cidcount);
+			IndustryMapSpriteGroup(buf, idcount);
 			return;
 
 		case GSF_INDUSTRYTILES:
-			IndustrytileMapSpriteGroup(buf, idcount, cidcount);
+			IndustrytileMapSpriteGroup(buf, idcount);
 			return;
 
 		case GSF_CARGOS:
-			CargoMapSpriteGroup(buf, idcount, cidcount);
+			CargoMapSpriteGroup(buf, idcount);
 			return;
 
 		case GSF_FSMPORTS:
-			FSMportsMapSpriteGroup(buf, idcount, cidcount);
+			FSMportsMapSpriteGroup(buf, idcount);
 			return;
 
 		default:
@@ -3704,7 +3702,7 @@
 			case GSF_ROAD:
 			case GSF_SHIP:
 			case GSF_AIRCRAFT:
-				if (id < GetEnginePoolSize()) {
+				if (!generic) {
 					Engine *e = GetNewEngine(_cur_grffile, (VehicleType)feature, id);
 					StringID string = AddGRFString(_cur_grffile->grfid, e->index, lang, new_scheme, name, e->info.string_id);
 					e->info.string_id = string;
@@ -3893,16 +3891,16 @@
 		/* Special not-TTDP-compatible case used in openttd(d/w).grf
 		 * Missing shore sprites and initialisation of SPR_SHORE_BASE */
 		grfmsg(2, "GraphicsNew: Loading 10 missing shore sprites from openttd(d/w).grf.");
-		LoadNextSprite(       SPR_SHORE_BASE          +  0, _file_index, _nfo_line++); // SLOPE_STEEP_S
-		LoadNextSprite(       SPR_SHORE_BASE          +  5, _file_index, _nfo_line++); // SLOPE_STEEP_W
-		LoadNextSprite(       SPR_SHORE_BASE          +  7, _file_index, _nfo_line++); // SLOPE_WSE
-		LoadNextSprite(       SPR_SHORE_BASE          + 10, _file_index, _nfo_line++); // SLOPE_STEEP_N
-		LoadNextSprite(       SPR_SHORE_BASE          + 11, _file_index, _nfo_line++); // SLOPE_NWS
-		LoadNextSprite(       SPR_SHORE_BASE          + 13, _file_index, _nfo_line++); // SLOPE_ENW
-		LoadNextSprite(       SPR_SHORE_BASE          + 14, _file_index, _nfo_line++); // SLOPE_SEN
-		LoadNextSprite(       SPR_SHORE_BASE          + 15, _file_index, _nfo_line++); // SLOPE_STEEP_E
-		LoadNextSprite(       SPR_SHORE_BASE          + 16, _file_index, _nfo_line++); // SLOPE_EW
-		LoadNextSprite(       SPR_SHORE_BASE          + 17, _file_index, _nfo_line++); // SLOPE_NS
+		LoadNextSprite(SPR_SHORE_BASE +  0, _file_index, _nfo_line++); // SLOPE_STEEP_S
+		LoadNextSprite(SPR_SHORE_BASE +  5, _file_index, _nfo_line++); // SLOPE_STEEP_W
+		LoadNextSprite(SPR_SHORE_BASE +  7, _file_index, _nfo_line++); // SLOPE_WSE
+		LoadNextSprite(SPR_SHORE_BASE + 10, _file_index, _nfo_line++); // SLOPE_STEEP_N
+		LoadNextSprite(SPR_SHORE_BASE + 11, _file_index, _nfo_line++); // SLOPE_NWS
+		LoadNextSprite(SPR_SHORE_BASE + 13, _file_index, _nfo_line++); // SLOPE_ENW
+		LoadNextSprite(SPR_SHORE_BASE + 14, _file_index, _nfo_line++); // SLOPE_SEN
+		LoadNextSprite(SPR_SHORE_BASE + 15, _file_index, _nfo_line++); // SLOPE_STEEP_E
+		LoadNextSprite(SPR_SHORE_BASE + 16, _file_index, _nfo_line++); // SLOPE_EW
+		LoadNextSprite(SPR_SHORE_BASE + 17, _file_index, _nfo_line++); // SLOPE_NS
 		if (_loaded_newgrf_features.shore == SHORE_REPLACE_NONE) _loaded_newgrf_features.shore = SHORE_REPLACE_ONLY_NEW;
 		return;
 	}
@@ -3988,11 +3986,11 @@
 			return true;
 
 		case 0x03: // current climate, 0=temp, 1=arctic, 2=trop, 3=toyland
-			*value = _settings.game_creation.landscape;
+			*value = _settings_game.game_creation.landscape;
 			return true;
 
 		case 0x06: // road traffic side, bit 4 clear=left, set=right
-			*value = _settings.vehicle.road_side << 4;
+			*value = _settings_game.vehicle.road_side << 4;
 			return true;
 
 		case 0x09: // date fraction
@@ -4023,7 +4021,7 @@
 		case 0x0F: // Rail track type cost factors
 			*value = 0;
 			SB(*value, 0, 8, _railtype_cost_multiplier[0]); // normal rail
-			if (_settings.vehicle.disable_elrails) {
+			if (_settings_game.vehicle.disable_elrails) {
 				/* skip elrail multiplier - disabled */
 				SB(*value, 8, 8, _railtype_cost_multiplier[2]); // monorail
 			} else {
@@ -4066,7 +4064,7 @@
 		/* case 0x1F: // locale dependent settings not implemented */
 
 		case 0x20: // snow line height
-			*value = _settings.game_creation.landscape == LT_ARCTIC ? GetSnowLine() : 0xFF;
+			*value = _settings_game.game_creation.landscape == LT_ARCTIC ? GetSnowLine() : 0xFF;
 			return true;
 
 		case 0x21: // OpenTTD version
@@ -4074,7 +4072,15 @@
 			return true;
 
 		case 0x22: // difficulty level
-			*value = _settings.difficulty.diff_level;
+			*value = _settings_game.difficulty.diff_level;
+			return true;
+
+		case 0x23: // long format date
+			*value = _date;
+			return true;
+
+		case 0x24: // long format year
+			*value = _cur_year;
 			return true;
 
 		default: return false;
@@ -4138,7 +4144,7 @@
 	 *                 to place where parameter is to be stored. */
 
 	/* Preload the next sprite */
-	uint32 pos = FioGetPos();
+	size_t pos = FioGetPos();
 	uint16 num = FioReadWord();
 	uint8 type = FioReadByte();
 
@@ -4619,10 +4625,10 @@
 {
 	switch (param) {
 		/* start year - 1920 */
-		case 0x0B: return max(_settings.game_creation.starting_year, ORIGINAL_BASE_YEAR) - ORIGINAL_BASE_YEAR;
+		case 0x0B: return max(_settings_game.game_creation.starting_year, ORIGINAL_BASE_YEAR) - ORIGINAL_BASE_YEAR;
 
 		/* freight trains weight factor */
-		case 0x0E: return _settings.vehicle.freight_trains;
+		case 0x0E: return _settings_game.vehicle.freight_trains;
 
 		/* empty wagon speed increase */
 		case 0x0F: return 0;
@@ -4631,7 +4637,7 @@
 		 * the following is good for 1x, 2x and 4x (most common?) and...
 		 * well not really for 3x. */
 		case 0x10:
-			switch (_settings.vehicle.plane_speed) {
+			switch (_settings_game.vehicle.plane_speed) {
 				default:
 				case 4: return 1;
 				case 3: return 2;
@@ -4813,7 +4819,7 @@
 						case 0x01: // Road Vehicles
 						case 0x02: // Ships
 						case 0x03: // Aircraft
-							if (!_settings.vehicle.dynamic_engines) {
+							if (!_settings_game.vehicle.dynamic_engines) {
 								src1 = PerformGRM(&_grm_engines[_engine_offsets[feature]], _engine_counts[feature], count, op, target, "vehicles");
 								if (_skip_sprites == -1) return;
 							} else {
@@ -4975,7 +4981,7 @@
 
 		case 0x8F: // Rail track type cost factors
 			_railtype_cost_multiplier[0] = GB(res, 0, 8);
-			if (_settings.vehicle.disable_elrails) {
+			if (_settings_game.vehicle.disable_elrails) {
 				_railtype_cost_multiplier[1] = GB(res, 0, 8);
 				_railtype_cost_multiplier[2] = GB(res, 8, 8);
 			} else {
@@ -5510,23 +5516,23 @@
 
 static void InitializeGRFSpecial()
 {
-	_ttdpatch_flags[0] =  ((_settings.station.always_small_airport ? 1 : 0) << 0x0C)  // keepsmallairport
+	_ttdpatch_flags[0] =  ((_settings_game.station.always_small_airport ? 1 : 0) << 0x0C)  // keepsmallairport
 	                   |                                                 (1 << 0x0D)  // newairports
 	                   |                                                 (1 << 0x0E)  // largestations
-	                   |      ((_settings.construction.longbridges ? 1 : 0) << 0x0F)  // longbridges
+	                   |      ((_settings_game.construction.longbridges ? 1 : 0) << 0x0F)  // longbridges
 	                   |                                                 (0 << 0x10)  // loadtime
 	                   |                                                 (1 << 0x12)  // presignals
 	                   |                                                 (1 << 0x13)  // extpresignals
-	                   | ((_settings.vehicle.never_expire_vehicles ? 1 : 0) << 0x16)  // enginespersist
+	                   | ((_settings_game.vehicle.never_expire_vehicles ? 1 : 0) << 0x16)  // enginespersist
 	                   |                                                 (1 << 0x1B)  // multihead
 	                   |                                                 (1 << 0x1D)  // lowmemory
 	                   |                                                 (1 << 0x1E); // generalfixes
 
-	_ttdpatch_flags[1] =   ((_settings.economy.station_noise_level ? 1 : 0) << 0x07)  // moreairports - based on units of noise
-	                   |        ((_settings.vehicle.mammoth_trains ? 1 : 0) << 0x08)  // mammothtrains
+	_ttdpatch_flags[1] =   ((_settings_game.economy.station_noise_level ? 1 : 0) << 0x07)  // moreairports - based on units of noise
+	                   |        ((_settings_game.vehicle.mammoth_trains ? 1 : 0) << 0x08)  // mammothtrains
 	                   |                                                 (1 << 0x09)  // trainrefit
 	                   |                                                 (0 << 0x0B)  // subsidiaries
-	                   |         ((_settings.order.gradual_loading ? 1 : 0) << 0x0C)  // gradualloading
+	                   |         ((_settings_game.order.gradual_loading ? 1 : 0) << 0x0C)  // gradualloading
 	                   |                                                 (1 << 0x12)  // unifiedmaglevmode - set bit 0 mode. Not revelant to OTTD
 	                   |                                                 (1 << 0x13)  // unifiedmaglevmode - set bit 1 mode
 	                   |                                                 (1 << 0x14)  // bridgespeedlimits
@@ -5535,14 +5541,14 @@
 	                   |                                                 (1 << 0x18)  // newrvs
 	                   |                                                 (1 << 0x19)  // newships
 	                   |                                                 (1 << 0x1A)  // newplanes
-	                   |      ((_settings.construction.signal_side ? 1 : 0) << 0x1B)  // signalsontrafficside
-	                   |       ((_settings.vehicle.disable_elrails ? 0 : 1) << 0x1C); // electrifiedrailway
+	                   |      ((_settings_game.construction.signal_side ? 1 : 0) << 0x1B)  // signalsontrafficside
+	                   |       ((_settings_game.vehicle.disable_elrails ? 0 : 1) << 0x1C); // electrifiedrailway
 
 	_ttdpatch_flags[2] =                                                 (1 << 0x01)  // loadallgraphics - obsolote
 	                   |                                                 (1 << 0x03)  // semaphores
 	                   |                                                 (0 << 0x0B)  // enhancedgui
 	                   |                                                 (0 << 0x0C)  // newagerating
-	                   |  ((_settings.construction.build_on_slopes ? 1 : 0) << 0x0D)  // buildonslopes
+	                   |  ((_settings_game.construction.build_on_slopes ? 1 : 0) << 0x0D)  // buildonslopes
 	                   |                                                 (1 << 0x0E)  // fullloadany
 	                   |                                                 (1 << 0x0F)  // planespeed
 	                   |                                                 (0 << 0x10)  // moreindustriesperclimate - obsolete
@@ -5550,15 +5556,15 @@
 	                   |                                                 (1 << 0x12)  // newstations
 	                   |                                                 (1 << 0x13)  // tracktypecostdiff
 	                   |                                                 (1 << 0x14)  // manualconvert
-	                   |  ((_settings.construction.build_on_slopes ? 1 : 0) << 0x15)  // buildoncoasts
+	                   |  ((_settings_game.construction.build_on_slopes ? 1 : 0) << 0x15)  // buildoncoasts
 	                   |                                                 (1 << 0x16)  // canals
 	                   |                                                 (1 << 0x17)  // newstartyear
-	                   |    ((_settings.vehicle.freight_trains > 1 ? 1 : 0) << 0x18)  // freighttrains
+	                   |    ((_settings_game.vehicle.freight_trains > 1 ? 1 : 0) << 0x18)  // freighttrains
 	                   |                                                 (1 << 0x19)  // newhouses
 	                   |                                                 (1 << 0x1A)  // newbridges
 	                   |                                                 (1 << 0x1B)  // newtownnames
 	                   |                                                 (1 << 0x1C)  // moreanimation
-	                   |    ((_settings.vehicle.wagon_speed_limits ? 1 : 0) << 0x1D)  // wagonspeedlimits
+	                   |    ((_settings_game.vehicle.wagon_speed_limits ? 1 : 0) << 0x1D)  // wagonspeedlimits
 	                   |                                                 (1 << 0x1E)  // newshistory
 	                   |                                                 (0 << 0x1F); // custombridgeheads
 
@@ -5570,13 +5576,13 @@
 	                   |                                                 (1 << 0x05)  // resolutionwidth
 	                   |                                                 (1 << 0x06)  // resolutionheight
 	                   |                                                 (1 << 0x07)  // newindustries
-	                   |           ((_settings.order.improved_load ? 1 : 0) << 0x08)  // fifoloading
+	                   |           ((_settings_game.order.improved_load ? 1 : 0) << 0x08)  // fifoloading
 	                   |                                                 (0 << 0x09)  // townroadbranchprob
 	                   |                                                 (0 << 0x0A)  // tempsnowline
 	                   |                                                 (1 << 0x0B)  // newcargo
 	                   |                                                 (1 << 0x0C)  // enhancemultiplayer
 	                   |                                                 (1 << 0x0D)  // onewayroads
-	                   |   ((_settings.station.nonuniform_stations ? 1 : 0) << 0x0E)  // irregularstations
+	                   |   ((_settings_game.station.nonuniform_stations ? 1 : 0) << 0x0E)  // irregularstations
 	                   |                                                 (1 << 0x0F)  // statistics
 	                   |                                                 (1 << 0x10)  // newsounds
 	                   |                                                 (1 << 0x11)  // autoreplace
@@ -5586,7 +5592,7 @@
 	                   |                                                 (0 << 0x15)  // enhancetunnels
 	                   |                                                 (1 << 0x16)  // shortrvs
 	                   |                                                 (1 << 0x17)  // articulatedrvs
-	                   |       ((_settings.vehicle.dynamic_engines ? 1 : 0) << 0x18)  // dynamic engines
+	                   |       ((_settings_game.vehicle.dynamic_engines ? 1 : 0) << 0x18)  // dynamic engines
 	                   |                                                 (1 << 0x1E); // variablerunningcosts
 }
 
@@ -5786,7 +5792,7 @@
 	ResetNewGRFErrors();
 
 	/* Set up the default cargo types */
-	SetupCargoForClimate(_settings.game_creation.landscape);
+	SetupCargoForClimate(_settings_game.game_creation.landscape);
 
 	/* Reset misc GRF features and train list display variables */
 	_misc_grf_features = 0;
@@ -6016,7 +6022,7 @@
 	 * On the other hand, why 1930? Just 'fix' the houses with the lowest
 	 * minimum introduction date to 0.
 	 */
-	Year min_date = MAX_YEAR;
+	Year min_year = MAX_YEAR;
 
 	for (GRFFile *file = _first_grffile; file != NULL; file = file->next) {
 		if (file->housespec == NULL) continue;
@@ -6025,16 +6031,16 @@
 			HouseSpec *hs = file->housespec[i];
 			if (hs != NULL) {
 				_house_mngr.SetEntitySpec(hs);
-				if (hs->min_date < min_date) min_date = hs->min_date;
+				if (hs->min_year < min_year) min_year = hs->min_year;
 			}
 		}
 	}
 
-	if (min_date != 0) {
+	if (min_year != 0) {
 		for (int i = 0; i < HOUSE_MAX; i++) {
 			HouseSpec *hs = GetHouseSpecs(i);
 
-			if (hs->enabled && hs->min_date == min_date) hs->min_date = 0;
+			if (hs->enabled && hs->min_year == min_year) hs->min_year = 0;
 		}
 	}
 }
@@ -6211,7 +6217,7 @@
 	 * processed once at initialization.  */
 	if (stage != GLS_FILESCAN && stage != GLS_SAFETYSCAN && stage != GLS_LABELSCAN) {
 		_cur_grffile = GetFileByFilename(filename);
-		if (_cur_grffile == NULL) error("File '%s' lost in cache.\n", filename);
+		if (_cur_grffile == NULL) usererror("File '%s' lost in cache.\n", filename);
 		if (stage == GLS_RESERVE && config->status != GCS_INITIALISED) return;
 		if (stage == GLS_ACTIVATION && !HasBit(config->flags, GCF_RESERVED)) return;
 		_cur_grffile->is_ottdfile = config->IsOpenTTDBaseGRF();
@@ -6421,7 +6427,7 @@
 			if (stage > GLS_INIT && HasBit(c->flags, GCF_INIT_ONLY)) continue;
 
 			/* @todo usererror() */
-			if (!FioCheckFileExists(c->filename)) error("NewGRF file is missing '%s'", c->filename);
+			if (!FioCheckFileExists(c->filename)) usererror("NewGRF file is missing '%s'", c->filename);
 
 			if (stage == GLS_LABELSCAN) InitNewGRFFile(c, _cur_spriteid);
 			LoadNewGRFFile(c, slot++, stage);
--- a/src/newgrf.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/newgrf.h	Tue Jun 17 10:32:49 2008 +0000
@@ -54,7 +54,7 @@
 struct GRFLabel {
 	byte label;
 	uint32 nfo_line;
-	uint32 pos;
+	size_t pos;
 	struct GRFLabel *next;
 };
 
--- a/src/newgrf_commons.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/newgrf_commons.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -278,7 +278,7 @@
  *         Terrain type: 0 normal, 1 desert, 2 rainforest, 4 on or above snowline */
 uint32 GetTerrainType(TileIndex tile)
 {
-	switch (_settings.game_creation.landscape) {
+	switch (_settings_game.game_creation.landscape) {
 		case LT_TROPIC: return GetTropicZone(tile);
 		case LT_ARCTIC: return GetTileZ(tile) > GetSnowLine() ? 4 : 0;
 		default:        return 0;
--- a/src/newgrf_config.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/newgrf_config.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -8,11 +8,12 @@
 #include "variables.h"
 #include "saveload.h"
 #include "md5.h"
-#include "network/network_data.h"
 #include "newgrf.h"
 #include "newgrf_config.h"
 #include "core/alloc_func.hpp"
 #include "string_func.h"
+#include "gamelog.h"
+#include "network/network_type.h"
 
 #include "fileio.h"
 #include "fios.h"
@@ -257,6 +258,7 @@
 
 				/* Non-found has precedence over compatibility load */
 				if (res != GLC_NOT_FOUND) res = GLC_COMPATIBLE;
+				GamelogGRFCompatible(f);
 				goto compatible_grf;
 			}
 
@@ -264,6 +266,8 @@
 			md5sumToString(buf, lastof(buf), c->md5sum);
 			DEBUG(grf, 0, "NewGRF %08X (%s) not found; checksum %s", BSWAP32(c->grfid), c->filename, buf);
 
+			GamelogGRFRemove(c->grfid);
+
 			c->status = GCS_NOT_FOUND;
 			res = GLC_NOT_FOUND;
 		} else {
--- a/src/newgrf_engine.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/newgrf_engine.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -466,6 +466,7 @@
 			case 0x43: return _current_player | (LiveryHelper(object->u.vehicle.self_type, NULL) << 24); // Owner information
 			case 0x46: return 0;               // Motion counter
 			case 0x48: return GetEngine(object->u.vehicle.self_type)->flags; // Vehicle Type Info
+			case 0x49: return _cur_year; // 'Long' format build year
 			case 0xC4: return Clamp(_cur_year, ORIGINAL_BASE_YEAR, ORIGINAL_MAX_YEAR) - ORIGINAL_BASE_YEAR; // Build year
 			case 0xDA: return INVALID_VEHICLE; // Next vehicle
 			case 0x7F: return GetGRFParameter(object->u.vehicle.self_type, parameter); // Read GRF parameter
@@ -600,6 +601,7 @@
 		}
 
 		case 0x48: return GetEngine(v->engine_type)->flags; // Vehicle Type Info
+		case 0x49: return v->build_year;
 
 		/* Variables which use the parameter */
 		case 0x60: // Count consist's engine ID occurance
@@ -862,7 +864,7 @@
 	NewVehicleResolver(&object, engine, v);
 
 	group = Resolve(GetVehicleSpriteGroup(engine, v), &object);
-	if (group == NULL || group->type != SGT_RESULT) return 0;
+	if (group == NULL || group->type != SGT_RESULT || group->g.result.num_sprites == 0) return 0;
 
 	return group->g.result.sprite + (direction % group->g.result.num_sprites);
 }
@@ -870,26 +872,22 @@
 
 SpriteID GetRotorOverrideSprite(EngineID engine, const Vehicle *v, bool info_view)
 {
-	#if !defined(NDEBUG) || defined(WITH_ASSERT)
 	const Engine *e = GetEngine(engine);
-	#endif /* !defined(NDEBUG) || defined(WITH_ASSERT) */
-
-	const SpriteGroup *group;
-	ResolverObject object;
-
-	assert(e->type == VEH_AIRCRAFT);
 
 	/* Only valid for helicopters */
+	assert(e->type == VEH_AIRCRAFT);
 	assert(!(e->u.air.subtype & AIR_CTOL));
 
+	ResolverObject object;
+
 	NewVehicleResolver(&object, engine, v);
 
 	object.info_view = info_view;
 
-	group = GetWagonOverrideSpriteSet(engine, CT_DEFAULT, engine);
+	const SpriteGroup *group = GetWagonOverrideSpriteSet(engine, CT_DEFAULT, engine);
 	group = Resolve(group, &object);
 
-	if (group == NULL || group->type != SGT_RESULT) return 0;
+	if (group == NULL || group->type != SGT_RESULT || group->g.result.num_sprites == 0) return 0;
 
 	if (v == NULL) return group->g.result.sprite;
 
@@ -1107,7 +1105,7 @@
 		/* Populate map with current list positions */
 		Engine *e;
 		FOR_ALL_ENGINES_OF_TYPE(e, VEH_TRAIN) {
-			if (!_settings.vehicle.dynamic_engines || e->grffile == source_e->grffile) {
+			if (!_settings_game.vehicle.dynamic_engines || e->grffile == source_e->grffile) {
 				if (e->internal_id == target) target_e = e;
 				lptr_map[e->list_position] = e;
 			}
--- a/src/newgrf_gui.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/newgrf_gui.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -15,6 +15,7 @@
 #include "core/alloc_func.hpp"
 #include "string_func.h"
 #include "gfx_func.h"
+#include "gamelog.h"
 
 #include "table/strings.h"
 #include "table/sprites.h"
@@ -564,8 +565,11 @@
 		GRFConfig *c;
 		int i = 0;
 
+		GamelogStartAction(GLAT_GRF);
+		GamelogGRFUpdate(_grfconfig, nw->list); // log GRF changes
 		CopyGRFConfigList(nw->orig_list, nw->list, false);
 		ReloadNewGRFData();
+		GamelogStopAction();
 
 		/* Show new, updated list */
 		for (c = nw->list; c != NULL && c != nw->sel; c = c->next, i++) {}
--- a/src/newgrf_town.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/newgrf_town.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -21,7 +21,7 @@
 	switch (variable) {
 		/* Larger towns */
 		case 0x40:
-			if (_settings.economy.larger_towns == 0) return 2;
+			if (_settings_game.economy.larger_towns == 0) return 2;
 			if (t->larger_town) return 1;
 			return 0;
 
--- a/src/news_gui.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/news_gui.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -24,52 +24,24 @@
 #include "table/sprites.h"
 #include "table/strings.h"
 
-/** @file news_gui.cpp
- *
- * 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 (\a _oldest_news) is being overwritten
- * by the newest (\a _latest_news).
- *
- * \verbatim
- * oldest                   current   lastest
- *  |                          |         |
- * [O------------F-------------C---------L           ]
- *               |
- *            forced
- * \endverbatim
- *
- * Of course by using an array we can have situations like
- *
- * \verbatim
- * [----L          O-----F---------C-----------------]
- * This is where we have wrapped around the array and have
- * (MAX_NEWS - O) + L news items
- * \endverbatim
- */
-
 #define NB_WIDG_PER_SETTING 4
 
-typedef byte NewsID;
-#define INVALID_NEWS 255
-
 NewsItem _statusbar_news_item;
 bool _news_ticker_sound;
-static NewsItem *_news_items = NULL;        ///< The news FIFO queue
-static uint _max_news_items = 0;            ///< size of news FIFO queue
-static NewsID _current_news = INVALID_NEWS; ///< points to news item that should be shown next
-static NewsID _oldest_news = 0;             ///< points to first item in fifo queue
-static NewsID _latest_news = INVALID_NEWS;  ///< points to last item in fifo queue
+
+static uint MIN_NEWS_AMOUNT = 30;           ///< prefered minimum amount of news messages
+static uint _total_news = 0;                ///< current number of news items
+static NewsItem *_oldest_news = NULL;       ///< head of news items queue
+static NewsItem *_latest_news = NULL;       ///< tail of news items queue
 
 /** Forced news item.
  * Users can force an item by accessing the history or "last message".
- * If the message being shown was forced by the user, its index is stored in
- * _forced_news. Otherwise, \a _forced_news variable is INVALID_NEWS. */
-static NewsID _forced_news = INVALID_NEWS;
+ * If the message being shown was forced by the user, a pointer is stored
+ * in _forced_news. Otherwise, \a _forced_news variable is NULL. */
+static NewsItem *_forced_news = NULL;       ///< item the user has asked for
 
-static uint _total_news = 0; ///< Number of news items in FIFO queue @see _news_items
-static void MoveToNextItem();
+/** Current news item (last item shown regularly). */
+static NewsItem *_current_news = NULL;
 
 
 typedef void DrawNewsCallbackProc(struct Window *w, const NewsItem *ni);
@@ -156,45 +128,55 @@
 	{ NT_ARRIVAL_OTHER,   NM_THIN,     NF_VIEWPORT|NF_VEHICLE, NULL                    }, ///< NS_ARRIVAL_OTHER
 	{ NT_ACCIDENT,        NM_THIN,     NF_VIEWPORT|NF_TILE,    NULL                    }, ///< NS_ACCIDENT_TILE
 	{ NT_ACCIDENT,        NM_THIN,     NF_VIEWPORT|NF_VEHICLE, NULL                    }, ///< NS_ACCIDENT_VEHICLE
-	{ NT_COMPANY_INFO,    NM_CALLBACK, NF_NONE,                DrawNewsBankrupcy       }, ///< NS_COMPANY_TROUBLE
-	{ NT_COMPANY_INFO,    NM_CALLBACK, NF_NONE,                DrawNewsBankrupcy       }, ///< NS_COMPANY_MERGER
-	{ NT_COMPANY_INFO,    NM_CALLBACK, NF_NONE,                DrawNewsBankrupcy       }, ///< NS_COMPANY_BANKRUPT
-	{ NT_COMPANY_INFO,    NM_CALLBACK, NF_TILE,                DrawNewsBankrupcy       }, ///< NS_COMPANY_NEW
+	{ NT_COMPANY_INFO,    NM_NORMAL,   NF_NONE,                DrawNewsBankrupcy       }, ///< NS_COMPANY_TROUBLE
+	{ NT_COMPANY_INFO,    NM_NORMAL,   NF_NONE,                DrawNewsBankrupcy       }, ///< NS_COMPANY_MERGER
+	{ NT_COMPANY_INFO,    NM_NORMAL,   NF_NONE,                DrawNewsBankrupcy       }, ///< NS_COMPANY_BANKRUPT
+	{ NT_COMPANY_INFO,    NM_NORMAL,   NF_TILE,                DrawNewsBankrupcy       }, ///< NS_COMPANY_NEW
 	{ NT_OPENCLOSE,       NM_THIN,     NF_VIEWPORT|NF_TILE,    NULL                    }, ///< NS_OPENCLOSE
 	{ NT_ECONOMY,         NM_NORMAL,   NF_NONE,                NULL                    }, ///< NS_ECONOMY
 	{ NT_INDUSTRY_PLAYER, NM_THIN,     NF_VIEWPORT|NF_TILE,    NULL                    }, ///< NS_INDUSTRY_PLAYER
 	{ NT_INDUSTRY_OTHER,  NM_THIN,     NF_VIEWPORT|NF_TILE,    NULL                    }, ///< NS_INDUSTRY_OTHER
 	{ NT_INDUSTRY_NOBODY, NM_THIN,     NF_VIEWPORT|NF_TILE,    NULL                    }, ///< NS_INDUSTRY_NOBODY
 	{ NT_ADVICE,          NM_SMALL,    NF_VIEWPORT|NF_VEHICLE, NULL                    }, ///< NS_ADVICE
-	{ NT_NEW_VEHICLES,    NM_CALLBACK, NF_NONE,                DrawNewsNewVehicleAvail }, ///< NS_NEW_VEHICLES
+	{ NT_NEW_VEHICLES,    NM_NORMAL,   NF_NONE,                DrawNewsNewVehicleAvail }, ///< NS_NEW_VEHICLES
 	{ NT_ACCEPTANCE,      NM_SMALL,    NF_VIEWPORT|NF_TILE,    NULL                    }, ///< NS_ACCEPTANCE
 	{ NT_SUBSIDIES,       NM_NORMAL,   NF_TILE|NF_TILE2,       NULL                    }, ///< NS_SUBSIDIES
 	{ NT_GENERAL,         NM_NORMAL,   NF_TILE,                NULL                    }, ///< NS_GENERAL
 };
 
-/** Initialize the news-items data structures */
-void InitNewsItemStructs()
-{
-	free(_news_items);
-	_max_news_items = max(ScaleByMapSize(30), 30U);
-	_news_items = CallocT<NewsItem>(_max_news_items);
-	_current_news = INVALID_NEWS;
-	_oldest_news = 0;
-	_latest_news = INVALID_NEWS;
-	_forced_news = INVALID_NEWS;
-	_total_news = 0;
-}
+/**
+ * Per-NewsType data
+ */
+NewsTypeData _news_type_data[NT_END] = {
+	/* name,              age, sound,           display */
+	{ "arrival_player",    60, SND_1D_APPLAUSE, ND_FULL },  ///< NT_ARRIVAL_PLAYER
+	{ "arrival_other",     60, SND_1D_APPLAUSE, ND_FULL },  ///< NT_ARRIVAL_OTHER
+	{ "accident",          90, SND_BEGIN,       ND_FULL },  ///< NT_ACCIDENT
+	{ "company_info",      60, SND_BEGIN,       ND_FULL },  ///< NT_COMPANY_INFO
+	{ "openclose",         90, SND_BEGIN,       ND_FULL },  ///< NT_OPENCLOSE
+	{ "economy",           30, SND_BEGIN,       ND_FULL },  ///< NT_ECONOMY
+	{ "production_player", 30, SND_BEGIN,       ND_FULL },  ///< NT_INDUSTRY_PLAYER
+	{ "production_other",  30, SND_BEGIN,       ND_FULL },  ///< NT_INDUSTRY_OTHER
+	{ "production_nobody", 30, SND_BEGIN,       ND_FULL },  ///< NT_INDUSTRY_NOBODY
+	{ "advice",           150, SND_BEGIN,       ND_FULL },  ///< NT_ADVICE
+	{ "new_vehicles",      30, SND_1E_OOOOH,    ND_FULL },  ///< NT_NEW_VEHICLES
+	{ "acceptance",        90, SND_BEGIN,       ND_FULL },  ///< NT_ACCEPTANCE
+	{ "subsidies",        180, SND_BEGIN,       ND_FULL },  ///< NT_SUBSIDIES
+	{ "general",           60, SND_BEGIN,       ND_FULL },  ///< NT_GENERAL
+};
 
 struct NewsWindow : Window {
 	uint16 chat_height;
 	NewsItem *ni;
+	static uint duration;
 
 	NewsWindow(const WindowDesc *desc, NewsItem *ni) : Window(desc), ni(ni)
 	{
+		NewsWindow::duration = 555;
 		const Window *w = FindWindowById(WC_SEND_NETWORK_MSG, 0);
 		this->chat_height = (w != NULL) ? w->height : 0;
 
-		this->ni = &_news_items[_forced_news == INVALID_NEWS ? _current_news : _forced_news];
+		this->ni = _forced_news == NULL ? _current_news : _forced_news;
 		this->flags4 |= WF_DISABLE_VP_SCROLL;
 
 		this->FindWindowPlacementAndResize(desc);
@@ -226,6 +208,11 @@
 			case NM_THIN: {
 				this->DrawNewsBorder();
 
+				if (_news_subtype_data[this->ni->subtype].callback != NULL) {
+					(_news_subtype_data[this->ni->subtype].callback)(this, ni);
+					break;
+				}
+
 				DrawString(2, 1, STR_00C6, TC_FROMSTRING);
 
 				SetDParam(0, this->ni->date);
@@ -255,11 +242,6 @@
 				break;
 			}
 
-			case NM_CALLBACK:
-				this->DrawNewsBorder();
-				(_news_subtype_data[this->ni->subtype].callback)(this, ni);
-				break;
-
 			default:
 				this->DrawWidgets();
 				if (!(this->ni->flags & NF_VIEWPORT)) {
@@ -278,9 +260,9 @@
 	{
 		switch (widget) {
 			case 1:
-				this->ni->duration = 0;
+				NewsWindow::duration = 0;
 				delete this;
-				_forced_news = INVALID_NEWS;
+				_forced_news = NULL;
 				break;
 
 			case 0:
@@ -334,104 +316,7 @@
 	}
 };
 
-/**
- * Return the correct index in the pseudo-fifo
- * queue and deals with overflows when increasing the index
- */
-static inline NewsID IncreaseIndex(NewsID i)
-{
-	assert(i != INVALID_NEWS);
-	return (i + 1) % _max_news_items;
-}
-
-/**
- * Return the correct index in the pseudo-fifo
- * queue and deals with overflows when decreasing the index
- */
-static inline NewsID DecreaseIndex(NewsID i)
-{
-	assert(i != INVALID_NEWS);
-	return (i + _max_news_items - 1) % _max_news_items;
-}
-
-/**
- * Add a new newsitem to be shown.
- * @param string String to display
- * @param subtype news category, any of the NewsSubtype enums (NS_)
- * @param data_a news-specific value based on news type
- * @param data_b news-specific value based on news type
- *
- * @see NewsSubype
- */
-void AddNewsItem(StringID string, NewsSubtype subtype, uint data_a, uint data_b)
-{
-	if (_game_mode == GM_MENU) return;
-
-	/* check the rare case that the oldest (to be overwritten) news item is open */
-	if (_total_news == _max_news_items && (_oldest_news == _current_news || _oldest_news == _forced_news)) {
-		MoveToNextItem();
-	}
-
-	if (_total_news < _max_news_items) _total_news++;
-
-	/* Increase _latest_news. If we have no news yet, use _oldest news as an
-	 * index. We cannot use 0 as _oldest_news can jump around due to
-	 * DeleteVehicleNews */
-	NewsID l_news = _latest_news;
-	_latest_news = (_latest_news == INVALID_NEWS) ? _oldest_news : IncreaseIndex(_latest_news);
-
-	/* If the fifo-buffer is full, overwrite the oldest entry */
-	if (l_news != INVALID_NEWS && _latest_news == _oldest_news) {
-		assert(_total_news == _max_news_items);
-		_oldest_news = IncreaseIndex(_oldest_news);
-	}
-
-	/*DEBUG(misc, 0, "+cur %3d, old %2d, lat %3d, for %3d, tot %2d",
-	  _current_news, _oldest_news, _latest_news, _forced_news, _total_news);*/
-
-	/* Add news to _latest_news */
-	NewsItem *ni = &_news_items[_latest_news];
-	memset(ni, 0, sizeof(*ni));
-
-	ni->string_id = string;
-	ni->subtype = subtype;
-	ni->flags = _news_subtype_data[subtype].flags;
-
-	/* show this news message in color? */
-	if (_cur_year >= _settings.gui.colored_news_year) ni->flags |= NF_INCOLOR;
-
-	ni->data_a = data_a;
-	ni->data_b = data_b;
-	ni->date = _date;
-	CopyOutDParam(ni->params, 0, lengthof(ni->params));
-
-	Window *w = FindWindowById(WC_MESSAGE_HISTORY, 0);
-	if (w == NULL) return;
-	w->SetDirty();
-	w->vscroll.count = _total_news;
-}
-
-
-/**
- * Per-NewsType data
- */
-NewsTypeData _news_type_data[NT_END] = {
-	/* name,              age, sound,           display */
-	{ "arrival_player",    60, SND_1D_APPLAUSE, ND_FULL },  ///< NT_ARRIVAL_PLAYER
-	{ "arrival_other",     60, SND_1D_APPLAUSE, ND_FULL },  ///< NT_ARRIVAL_OTHER
-	{ "accident",          90, SND_BEGIN,       ND_FULL },  ///< NT_ACCIDENT
-	{ "company_info",      60, SND_BEGIN,       ND_FULL },  ///< NT_COMPANY_INFO
-	{ "openclose",         90, SND_BEGIN,       ND_FULL },  ///< NT_OPENCLOSE
-	{ "economy",           30, SND_BEGIN,       ND_FULL },  ///< NT_ECONOMY
-	{ "production_player", 30, SND_BEGIN,       ND_FULL },  ///< NT_INDUSTRY_PLAYER
-	{ "production_other",  30, SND_BEGIN,       ND_FULL },  ///< NT_INDUSTRY_OTHER
-	{ "production_nobody", 30, SND_BEGIN,       ND_FULL },  ///< NT_INDUSTRY_NOBODY
-	{ "advice",           150, SND_BEGIN,       ND_FULL },  ///< NT_ADVICE
-	{ "new_vehicles",      30, SND_1E_OOOOH,    ND_FULL },  ///< NT_NEW_VEHICLES
-	{ "acceptance",        90, SND_BEGIN,       ND_FULL },  ///< NT_ACCEPTANCE
-	{ "subsidies",        180, SND_BEGIN,       ND_FULL },  ///< NT_SUBSIDIES
-	{ "general",           60, SND_BEGIN,       ND_FULL },  ///< NT_GENERAL
-};
+/* static */ uint NewsWindow::duration; ///< Remaining time for showing current news message
 
 
 static const Widget _news_type13_widgets[] = {
@@ -479,9 +364,6 @@
 /** Open up an own newspaper window for the news item */
 static void ShowNewspaper(NewsItem *ni)
 {
-	ni->flags &= ~NF_FORCE_BIG;
-	ni->duration = 555;
-
 	SoundFx sound = _news_type_data[_news_subtype_data[ni->subtype].type].sound;
 	if (sound != 0) SndPlayFx(sound);
 
@@ -489,7 +371,6 @@
 	Window *w;
 	switch (_news_subtype_data[ni->subtype].display_mode) {
 		case NM_NORMAL:
-		case NM_CALLBACK:
 			_news_type13_desc.top = top;
 			w = new NewsWindow(&_news_type13_desc, ni);
 			if (ni->flags & NF_VIEWPORT) {
@@ -516,9 +397,6 @@
 			}
 			break;
 	}
-
-	/*DEBUG(misc, 0, " cur %3d, old %2d, lat %3d, for %3d, tot %2d",
-	  _current_news, _oldest_news, _latest_news, _forced_news, _total_news);*/
 }
 
 /** Show news item in the ticker */
@@ -530,6 +408,21 @@
 	InvalidateWindowData(WC_STATUS_BAR, 0, SBI_SHOW_TICKER);
 }
 
+/** Initialize the news-items data structures */
+void InitNewsItemStructs()
+{
+	for (NewsItem *ni = _oldest_news; ni != NULL; ) {
+		NewsItem *next = ni->next;
+		delete ni;
+		ni = next;
+	}
+
+	_total_news = 0;
+	_oldest_news = NULL;
+	_latest_news = NULL;
+	_forced_news = NULL;
+	_current_news = NULL;
+}
 
 /**
  * Are we ready to show another news item?
@@ -537,32 +430,30 @@
  */
 static bool ReadyForNextItem()
 {
-	NewsID item = (_forced_news == INVALID_NEWS) ? _current_news : _forced_news;
-
-	if (item >= _max_news_items) return true;
-	NewsItem *ni = &_news_items[item];
+	NewsItem *ni = _forced_news == NULL ? _current_news : _forced_news;
+	if (ni == NULL) return true;
 
 	/* Ticker message
 	 * Check if the status bar message is still being displayed? */
 	if (IsNewsTickerShown()) return false;
 
 	/* Newspaper message, decrement duration counter */
-	if (ni->duration != 0) ni->duration--;
+	if (NewsWindow::duration != 0) NewsWindow::duration--;
 
 	/* neither newsticker nor newspaper are running */
-	return (ni->duration == 0 || FindWindowById(WC_NEWS_WINDOW, 0) == NULL);
+	return (NewsWindow::duration == 0 || FindWindowById(WC_NEWS_WINDOW, 0) == NULL);
 }
 
 /** Move to the next news item */
 static void MoveToNextItem()
 {
 	DeleteWindowById(WC_NEWS_WINDOW, 0);
-	_forced_news = INVALID_NEWS;
+	_forced_news = NULL;
 
 	/* if we're not at the last item, then move on */
 	if (_current_news != _latest_news) {
-		_current_news = (_current_news == INVALID_NEWS) ? _oldest_news : IncreaseIndex(_current_news);
-		NewsItem *ni = &_news_items[_current_news];
+		_current_news = (_current_news == NULL) ? _oldest_news : _current_news->next;
+		NewsItem *ni = _current_news;
 		const NewsType type = _news_subtype_data[ni->subtype].type;
 
 		/* check the date, don't show too old items */
@@ -574,12 +465,9 @@
 				InvalidateWindowData(WC_STATUS_BAR, 0, SBI_SHOW_REMINDER);
 				break;
 
-			case ND_SUMMARY: // Summary - show ticker, but if forced big, cascade to full
-				if (!(ni->flags & NF_FORCE_BIG)) {
-					ShowTicker(ni);
-					break;
-				}
-				/* Fallthrough */
+			case ND_SUMMARY: // Summary - show ticker
+				ShowTicker(ni);
+				break;
 
 			case ND_FULL: // Full - show newspaper
 				ShowNewspaper(ni);
@@ -588,29 +476,140 @@
 	}
 }
 
+/**
+ * Add a new newsitem to be shown.
+ * @param string String to display
+ * @param subtype news category, any of the NewsSubtype enums (NS_)
+ * @param data_a news-specific value based on news type
+ * @param data_b news-specific value based on news type
+ *
+ * @see NewsSubype
+ */
+void AddNewsItem(StringID string, NewsSubtype subtype, uint data_a, uint data_b)
+{
+	if (_game_mode == GM_MENU) return;
+
+	/* Create new news item node */
+	NewsItem *ni = new NewsItem;
+
+	ni->string_id = string;
+	ni->subtype = subtype;
+	ni->flags = _news_subtype_data[subtype].flags;
+
+	/* show this news message in color? */
+	if (_cur_year >= _settings_client.gui.colored_news_year) ni->flags |= NF_INCOLOR;
+
+	ni->data_a = data_a;
+	ni->data_b = data_b;
+	ni->date = _date;
+	CopyOutDParam(ni->params, 0, lengthof(ni->params));
+
+	if (_total_news++ == 0) {
+		assert(_oldest_news == NULL);
+		_oldest_news = ni;
+		ni->prev = NULL;
+	} else {
+		assert(_latest_news->next == NULL);
+		_latest_news->next = ni;
+		ni->prev = _latest_news;
+	}
+
+	ni->next = NULL;
+	_latest_news = ni;
+
+	InvalidateWindow(WC_MESSAGE_HISTORY, 0);
+}
+
+/** Delete a news item from the queue */
+static void DeleteNewsItem(NewsItem *ni)
+{
+	if (_forced_news == ni) {
+		/* about to remove the currently forced item; skip to next */
+		MoveToNextItem();
+	}
+
+	if ((_current_news == ni) && (FindWindowById(WC_MESSAGE_HISTORY, 0) != NULL)) {
+		/* about to remove the currently displayed item; also skip */
+		MoveToNextItem();
+	}
+
+	/* delete item */
+
+	if (ni->prev != NULL) {
+		ni->prev->next = ni->next;
+	} else {
+		assert(_oldest_news == ni);
+		_oldest_news = ni->next;
+	}
+
+	if (ni->next != NULL) {
+		ni->next->prev = ni->prev;
+	} else {
+		assert(_latest_news == ni);
+		_latest_news = ni->prev;
+	}
+
+	if (_current_news == ni) _current_news = ni->prev;
+	_total_news--;
+	delete ni;
+
+	InvalidateWindow(WC_MESSAGE_HISTORY, 0);
+}
+
+void DeleteVehicleNews(VehicleID vid, StringID news)
+{
+	NewsItem *ni = _oldest_news;
+
+	while (ni != NULL) {
+		if (ni->flags & NF_VEHICLE &&
+				ni->data_a == vid &&
+				(news == INVALID_STRING_ID || ni->string_id == news)) {
+			/* grab a pointer to the next item before ni is freed */
+			NewsItem *p = ni->next;
+			DeleteNewsItem(ni);
+			ni = p;
+		} else {
+			ni = ni->next;
+		}
+	}
+}
+
+void RemoveOldNewsItems()
+{
+	NewsItem *next;
+	for (NewsItem *cur = _oldest_news; _total_news > MIN_NEWS_AMOUNT && cur != NULL; cur = next) {
+		next = cur->next;
+		if (_date - _news_type_data[_news_subtype_data[cur->subtype].type].age * _settings_client.gui.news_message_timeout > cur->date) DeleteNewsItem(cur);
+	}
+}
+
 void NewsLoop()
 {
 	/* no news item yet */
 	if (_total_news == 0) return;
 
+	static byte _last_clean_month = 0;
+
+	if (_last_clean_month != _cur_month) {
+		RemoveOldNewsItems();
+		_last_clean_month = _cur_month;
+	}
+
 	if (ReadyForNextItem()) MoveToNextItem();
 }
 
 /** Do a forced show of a specific message */
-static void ShowNewsMessage(NewsID i)
+static void ShowNewsMessage(NewsItem *ni)
 {
-	if (_total_news == 0) return;
+	assert(_total_news != 0);
 
 	/* Delete the news window */
 	DeleteWindowById(WC_NEWS_WINDOW, 0);
 
 	/* setup forced news item */
-	_forced_news = i;
+	_forced_news = ni;
 
-	if (_forced_news != INVALID_NEWS) {
-		NewsItem *ni = &_news_items[_forced_news];
-		ni->duration = 555;
-		ni->flags |= NF_FORCE_BIG;
+	if (_forced_news != NULL) {
 		DeleteWindowById(WC_NEWS_WINDOW, 0);
 		ShowNewspaper(ni);
 	}
@@ -619,37 +618,23 @@
 /** Show previous news item */
 void ShowLastNewsMessage()
 {
-	if (_forced_news == INVALID_NEWS) {
+	if (_total_news == 0) {
+		return;
+	} else if (_forced_news == NULL) {
 		/* Not forced any news yet, show the current one, unless a news window is
 		 * open (which can only be the current one), then show the previous item */
 		const Window *w = FindWindowById(WC_NEWS_WINDOW, 0);
-		ShowNewsMessage((w == NULL || (_current_news == _oldest_news)) ? _current_news : DecreaseIndex(_current_news));
+		ShowNewsMessage((w == NULL || (_current_news == _oldest_news)) ? _current_news : _current_news->prev);
 	} else if (_forced_news == _oldest_news) {
 		/* We have reached the oldest news, start anew with the latest */
 		ShowNewsMessage(_latest_news);
 	} else {
 		/* 'Scrolling' through news history show each one in turn */
-		ShowNewsMessage(DecreaseIndex(_forced_news));
+		ShowNewsMessage(_forced_news->prev);
 	}
 }
 
 
-/* return news by number, with 0 being the most
- * recent news. Returns INVALID_NEWS if end of queue reached. */
-static NewsID getNews(NewsID i)
-{
-	if (i >= _total_news) return INVALID_NEWS;
-
-	if (_latest_news < i) {
-		i = _latest_news + _max_news_items - i;
-	} else {
-		i = _latest_news - i;
-	}
-
-	i %= _max_news_items;
-	return i;
-}
-
 /**
  * Draw an unformatted news message truncated to a maximum length. If
  * length exceeds maximum length it will be postfixed by '...'
@@ -715,27 +700,37 @@
 		this->DrawWidgets();
 
 		if (_total_news == 0) return;
-		NewsID show = min(_total_news, this->vscroll.cap);
 
-		for (NewsID p = this->vscroll.pos; p < this->vscroll.pos + show; p++) {
-			/* get news in correct order */
-			const NewsItem *ni = &_news_items[getNews(p)];
+		NewsItem *ni = _latest_news;
+		for (int n = this->vscroll.pos; n > 0; n--) {
+			ni = ni->prev;
+			if (ni == NULL) return;
+		}
 
+		for (int n = this->vscroll.cap; n > 0; n--) {
 			SetDParam(0, ni->date);
 			DrawString(4, y, STR_SHORT_DATE, TC_WHITE);
 
 			DrawNewsString(82, y, TC_WHITE, ni, this->width - 95);
 			y += 12;
+
+			ni = ni->prev;
+			if (ni == NULL) return;
 		}
 	}
 
 	virtual void OnClick(Point pt, int widget)
 	{
 		if (widget == 3) {
-			int y = (pt.y - 19) / 12;
-			NewsID p = getNews(y + this->vscroll.pos);
+			NewsItem *ni = _latest_news;
+			if (ni == NULL) return;
 
-			if (p != INVALID_NEWS) ShowNewsMessage(p);
+			for (int n = (pt.y - 19) / 12 + this->vscroll.pos; n > 0; n--) {
+				ni = ni->prev;
+				if (ni == NULL) return;
+			}
+
+			ShowNewsMessage(ni);
 		}
 	}
 
@@ -976,66 +971,3 @@
 	DeleteWindowById(WC_GAME_OPTIONS, 0);
 	new MessageOptionsWindow(&_message_options_desc);
 }
-
-
-void DeleteVehicleNews(VehicleID vid, StringID news)
-{
-	for (NewsID n = _oldest_news; _latest_news != INVALID_NEWS; n = IncreaseIndex(n)) {
-		const NewsItem *ni = &_news_items[n];
-
-		if (ni->flags & NF_VEHICLE &&
-				ni->data_a == vid &&
-				(news == INVALID_STRING_ID || ni->string_id == news)) {
-			/* If we delete a forced news and it is just before the current news
-			 * then we need to advance to the next news (if any) */
-			if (_forced_news == n) MoveToNextItem();
-			if (_forced_news == INVALID_NEWS && _current_news == n) MoveToNextItem();
-			_total_news--;
-
-			/* If this is the last news item, invalidate _latest_news */
-			if (_total_news == 0) {
-				assert(_latest_news == _oldest_news);
-				_latest_news = INVALID_NEWS;
-				_current_news = INVALID_NEWS;
-			}
-
-			/* Since we only imitate a FIFO removing an arbitrary element does need
-			 * some magic. Remove the item by shifting head towards the tail. eg
-			 *    oldest    remove  last
-			 *        |        |     |
-			 * [------O--------n-----L--]
-			 * will become (change dramatized to make clear)
-			 * [---------O-----------L--]
-			 * We also need an update of the current, forced and visible (open window)
-			 * news's as this shifting could change the items they were pointing to */
-			if (_total_news != 0) {
-				NewsWindow *w = dynamic_cast<NewsWindow*>(FindWindowById(WC_NEWS_WINDOW, 0));
-				NewsID visible_news = (w != NULL) ? (NewsID)(w->ni - _news_items) : INVALID_NEWS;
-
-				for (NewsID i = n;; i = DecreaseIndex(i)) {
-					_news_items[i] = _news_items[DecreaseIndex(i)];
-
-					if (i != _latest_news) {
-						if (i == _current_news) _current_news = IncreaseIndex(_current_news);
-						if (i == _forced_news) _forced_news = IncreaseIndex(_forced_news);
-						if (i == visible_news) w->ni = &_news_items[IncreaseIndex(visible_news)];
-					}
-
-					if (i == _oldest_news) break;
-				}
-				_oldest_news = IncreaseIndex(_oldest_news);
-			}
-
-			/*DEBUG(misc, 0, "-cur %3d, old %2d, lat %3d, for %3d, tot %2d",
-			  _current_news, _oldest_news, _latest_news, _forced_news, _total_news);*/
-
-			Window *w = FindWindowById(WC_MESSAGE_HISTORY, 0);
-			if (w != NULL) {
-				w->SetDirty();
-				w->vscroll.count = _total_news;
-			}
-		}
-
-		if (n == _latest_news) break;
-	}
-}
--- a/src/news_type.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/news_type.h	Tue Jun 17 10:32:49 2008 +0000
@@ -62,7 +62,6 @@
 	NM_SMALL    = 0, ///< Show only a small popup informing us about vehicle age for example
 	NM_NORMAL   = 1, ///< Show a simple news message (height 170 pixels)
 	NM_THIN     = 2, ///< Show a simple news message (height 130 pixels)
-	NM_CALLBACK = 3, ///< Do some special processing before displaying news message. Which callback to call is in NewsCallback
 };
 
 /**
@@ -74,7 +73,6 @@
 	NF_VIEWPORT  = (1 << 1), ///< Does the news message have a viewport? (ingame picture of happening)
 	NF_TILE      = (1 << 2), ///< When clicked on the news message scroll to a given tile? Tile is in data_a
 	NF_VEHICLE   = (1 << 3), ///< When clicked on the message scroll to the vehicle? VehicleID is in data_a
-	NF_FORCE_BIG = (1 << 4), ///< Force the appearance of a news message if it has already been shown (internal)
 	NF_INCOLOR   = (1 << 5), ///< Show the newsmessage in colour, otherwise it defaults to black & white
 	NF_TILE2     = (1 << 6), ///< There is a second tile to scroll to; tile is in data_b
 };
@@ -101,8 +99,9 @@
 };
 
 struct NewsItem {
+	NewsItem *prev;        ///< Previous news item
+	NewsItem *next;        ///< Next news item
 	StringID string_id;    ///< Message text
-	uint16 duration;       ///< Remaining time for showing this news message
 	Date date;             ///< Date of the news
 	NewsSubtype subtype;   ///< News subtype @see NewsSubtype
 	NewsFlag flags;        ///< NewsFlags bits @see NewsFlag
--- a/src/npf.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/npf.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -213,7 +213,7 @@
 
 	if (z2 - z1 > 1) {
 		/* Slope up */
-		return _settings.pf.npf.npf_rail_slope_penalty;
+		return _settings_game.pf.npf.npf_rail_slope_penalty;
 	}
 	return 0;
 	/* Should we give a bonus for slope down? Probably not, we
@@ -260,10 +260,10 @@
 	cost = _trackdir_length[trackdir]; // Should be different for diagonal tracks
 
 	if (IsBuoyTile(current->tile) && IsDiagonalTrackdir(trackdir))
-		cost += _settings.pf.npf.npf_buoy_penalty; // A small penalty for going over buoys
+		cost += _settings_game.pf.npf.npf_buoy_penalty; // A small penalty for going over buoys
 
 	if (current->direction != NextTrackdir((Trackdir)parent->path.node.direction))
-		cost += _settings.pf.npf.npf_water_curve_penalty;
+		cost += _settings_game.pf.npf.npf_water_curve_penalty;
 
 	/* @todo More penalties? */
 
@@ -285,13 +285,13 @@
 		case MP_ROAD:
 			cost = NPF_TILE_LENGTH;
 			/* Increase the cost for level crossings */
-			if (IsLevelCrossing(tile)) cost += _settings.pf.npf.npf_crossing_penalty;
+			if (IsLevelCrossing(tile)) cost += _settings_game.pf.npf.npf_crossing_penalty;
 			break;
 
 		case MP_STATION:
 			cost = NPF_TILE_LENGTH;
 			/* Increase the cost for drive-through road stops */
-			if (IsDriveThroughStopTile(tile)) cost += _settings.pf.npf.npf_road_drive_through_penalty;
+			if (IsDriveThroughStopTile(tile)) cost += _settings_game.pf.npf.npf_road_drive_through_penalty;
 			break;
 
 		default:
@@ -306,7 +306,7 @@
 	/* Check for turns. Road vehicles only really drive diagonal, turns are
 	 * represented by non-diagonal tracks */
 	if (!IsDiagonalTrackdir((Trackdir)current->direction))
-		cost += _settings.pf.npf.npf_road_curve_penalty;
+		cost += _settings_game.pf.npf.npf_road_curve_penalty;
 
 	NPFMarkTile(tile);
 	DEBUG(npf, 4, "Calculating G for: (%d, %d). Result: %d", TileX(current->tile), TileY(current->tile), cost);
@@ -344,7 +344,7 @@
 			 * give any station tile a penalty, because every possible route will get
 			 * this penalty exactly once, on its end tile (if it's a station) and it
 			 * will therefore not make a difference. */
-			cost = NPF_TILE_LENGTH + _settings.pf.npf.npf_rail_station_penalty;
+			cost = NPF_TILE_LENGTH + _settings_game.pf.npf.npf_rail_station_penalty;
 			break;
 
 		default:
@@ -366,9 +366,9 @@
 				SignalType sigtype = GetSignalType(tile, TrackdirToTrack(trackdir));
 				if (sigtype == SIGTYPE_EXIT || sigtype == SIGTYPE_COMBO) {
 					/* Penalise exit and combo signals differently (heavier) */
-					cost += _settings.pf.npf.npf_rail_firstred_exit_penalty;
+					cost += _settings_game.pf.npf.npf_rail_firstred_exit_penalty;
 				} else {
-					cost += _settings.pf.npf.npf_rail_firstred_penalty;
+					cost += _settings_game.pf.npf.npf_rail_firstred_penalty;
 				}
 			}
 			/* Record the state of this signal */
@@ -386,14 +386,14 @@
 	 * of course... */
 	new_node.path.node = *current;
 	if (as->EndNodeCheck(as, &new_node) == AYSTAR_FOUND_END_NODE && NPFGetFlag(current, NPF_FLAG_LAST_SIGNAL_RED))
-		cost += _settings.pf.npf.npf_rail_lastred_penalty;
+		cost += _settings_game.pf.npf.npf_rail_lastred_penalty;
 
 	/* Check for slope */
 	cost += NPFSlopeCost(current);
 
 	/* Check for turns */
 	if (current->direction != NextTrackdir((Trackdir)parent->path.node.direction))
-		cost += _settings.pf.npf.npf_rail_curve_penalty;
+		cost += _settings_game.pf.npf.npf_rail_curve_penalty;
 	/*TODO, with realistic acceleration, also the amount of straight track between
 	 *      curves should be taken into account, as this affects the speed limit. */
 
@@ -402,7 +402,7 @@
 		/* Penalise any depot tile that is not the last tile in the path. This
 		 * _should_ penalise every occurence of reversing in a depot (and only
 		 * that) */
-		cost += _settings.pf.npf.npf_rail_depot_reverse_penalty;
+		cost += _settings_game.pf.npf.npf_rail_depot_reverse_penalty;
 	}
 
 	/* Check for occupied track */
@@ -634,7 +634,7 @@
 	trackdirbits &= TrackdirReachesTrackdirs(src_trackdir);
 
 	/* Filter out trackdirs that would make 90 deg turns for trains */
-	if (_settings.pf.forbid_90_deg && (type == TRANSPORT_RAIL || type == TRANSPORT_WATER)) trackdirbits &= ~TrackdirCrossesTrackdirs(src_trackdir);
+	if (_settings_game.pf.forbid_90_deg && (type == TRANSPORT_RAIL || type == TRANSPORT_WATER)) trackdirbits &= ~TrackdirCrossesTrackdirs(src_trackdir);
 
 	DEBUG(npf, 6, "After filtering: (%d, %d), possible trackdirs: 0x%X", TileX(dst_tile), TileY(dst_tile), trackdirbits);
 
@@ -970,7 +970,7 @@
 	//_npf_aystar.max_search_nodes = 0;
 	/* We will limit the number of nodes for now, until we have a better
 	 * solution to really fix performance */
-	_npf_aystar.max_search_nodes = _settings.pf.npf.npf_max_search_nodes;
+	_npf_aystar.max_search_nodes = _settings_game.pf.npf.npf_max_search_nodes;
 }
 
 void NPFFillWithOrderData(NPFFindStationOrTileData* fstd, Vehicle* v)
--- a/src/oldloader.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/oldloader.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -319,8 +319,8 @@
 	/* Convert town-names if needed */
 	FOR_ALL_TOWNS(town) {
 		if (IsInsideMM(town->townnametype, 0x20C1, 0x20C3)) {
-			town->townnametype = SPECSTR_TOWNNAME_ENGLISH + _settings.game_creation.town_name;
-			town->townnameparts = GetOldTownName(town->townnameparts, _settings.game_creation.town_name);
+			town->townnametype = SPECSTR_TOWNNAME_ENGLISH + _settings_game.game_creation.town_name;
+			town->townnameparts = GetOldTownName(town->townnameparts, _settings_game.game_creation.town_name);
 		}
 	}
 }
@@ -1392,8 +1392,8 @@
 
 static inline bool LoadOldGameDifficulty(LoadgameState *ls, int num)
 {
-	bool ret = LoadChunk(ls, &_settings.difficulty, game_difficulty_chunk);
-	_settings.difficulty.max_loan *= 1000;
+	bool ret = LoadChunk(ls, &_settings_game.difficulty, game_difficulty_chunk);
+	_settings_game.difficulty.max_loan *= 1000;
 	return ret;
 }
 
@@ -1572,8 +1572,8 @@
 
 	OCL_VAR ( OC_FILE_U8 | OC_VAR_U16,    1, &_station_tick_ctr ),
 
-	OCL_VAR (  OC_UINT8,    1, &_settings.gui.currency ),
-	OCL_VAR (  OC_UINT8,    1, &_settings.gui.units ),
+	OCL_VAR (  OC_UINT8,    1, &_settings_game.locale.currency ),
+	OCL_VAR (  OC_UINT8,    1, &_settings_game.locale.units ),
 	OCL_VAR ( OC_FILE_U8 | OC_VAR_U32,    1, &_cur_player_tick_index ),
 
 	OCL_NULL( 2 ),               ///< Date stuff, calculated automatically
@@ -1583,19 +1583,19 @@
 	OCL_VAR (  OC_UINT8,    1, &_economy.infl_amount_pr ),
 	OCL_VAR (  OC_UINT8,    1, &_economy.interest_rate ),
 	OCL_NULL( 1 ), // available airports
-	OCL_VAR (  OC_UINT8,    1, &_settings.vehicle.road_side ),
-	OCL_VAR (  OC_UINT8,    1, &_settings.game_creation.town_name ),
+	OCL_VAR (  OC_UINT8,    1, &_settings_game.vehicle.road_side ),
+	OCL_VAR (  OC_UINT8,    1, &_settings_game.game_creation.town_name ),
 
 	OCL_CHUNK( 1, LoadOldGameDifficulty ),
 
 	OCL_ASSERT( 0x77130 ),
 
-	OCL_VAR (  OC_UINT8,    1, &_settings.difficulty.diff_level ),
-	OCL_VAR (  OC_UINT8,    1, &_settings.game_creation.landscape ),
+	OCL_VAR (  OC_UINT8,    1, &_settings_game.difficulty.diff_level ),
+	OCL_VAR (  OC_UINT8,    1, &_settings_game.game_creation.landscape ),
 	OCL_VAR (  OC_UINT8,    1, &_trees_tick_ctr ),
 
 	OCL_NULL( 1 ),               ///< Custom vehicle types yes/no, no longer used
-	OCL_VAR (  OC_UINT8,    1, &_settings.game_creation.snow_line ),
+	OCL_VAR (  OC_UINT8,    1, &_settings_game.game_creation.snow_line ),
 
 	OCL_NULL( 32 ),              ///< new_industry_randtable, no longer used (because of new design)
 	OCL_NULL( 36 ),              ///< cargo-stuff, calculated in InitializeLandscapeVariables
@@ -1630,7 +1630,7 @@
 	DEBUG(oldloader, 3, "Done, converting game data...");
 
 	/* Fix some general stuff */
-	_settings.game_creation.landscape = _settings.game_creation.landscape & 0xF;
+	_settings_game.game_creation.landscape = _settings_game.game_creation.landscape & 0xF;
 
 	/* Remap some pointers */
 	_cur_town_ctr      = REMAP_TOWN_IDX(_old_cur_town_ctr);
@@ -1692,7 +1692,7 @@
 	FixOldVehicles();
 
 	/* We have a new difficulty setting */
-	_settings.difficulty.town_council_tolerance = Clamp(_settings.difficulty.diff_level, 0, 2);
+	_settings_game.difficulty.town_council_tolerance = Clamp(_settings_game.difficulty.diff_level, 0, 2);
 
 	DEBUG(oldloader, 3, "Finished converting game data");
 	DEBUG(oldloader, 1, "TTD(Patch) savegame successfully converted");
--- a/src/openttd.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/openttd.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -6,7 +6,6 @@
 
 #define VARDEF
 #include "variables.h"
-#include "network/network_internal.h"
 #undef VARDEF
 
 #include "openttd.h"
@@ -23,10 +22,7 @@
 #include "gui.h"
 #include "mixer.h"
 #include "sound_func.h"
-#include "viewport_func.h"
 #include "window_func.h"
-#include "window_gui.h"
-#include "zoom_func.h"
 
 #include "debug.h"
 #include "saveload.h"
@@ -44,6 +40,7 @@
 #include "console_func.h"
 #include "screenshot.h"
 #include "network/network.h"
+#include "network/network_func.h"
 #include "signs_base.h"
 #include "signs_func.h"
 #include "waypoint.h"
@@ -58,6 +55,7 @@
 #include "strings_func.h"
 #include "date_func.h"
 #include "vehicle_func.h"
+#include "gamelog.h"
 #include "cheat_func.h"
 #include "animated_tile_func.h"
 #include "functions.h"
@@ -102,11 +100,31 @@
 
 extern void SetDifficultyLevel(int mode, DifficultySettings *gm_opt);
 extern Player* DoStartupNewPlayer(bool is_ai);
-extern void ShowOSErrorBox(const char *buf);
+extern void ShowOSErrorBox(const char *buf, bool system);
 extern void InitializeRailGUI();
 
 /**
- * Error handling for fatal errors.
+ * Error handling for fatal user errors.
+ * @param s the string to print.
+ * @note Does NEVER return.
+ */
+void CDECL usererror(const char *s, ...)
+{
+	va_list va;
+	char buf[512];
+
+	va_start(va, s);
+	vsnprintf(buf, lengthof(buf), s, va);
+	va_end(va);
+
+	ShowOSErrorBox(buf, false);
+	if (_video_driver != NULL) _video_driver->Stop();
+
+	exit(1);
+}
+
+/**
+ * Error handling for fatal non-user errors.
  * @param s the string to print.
  * @note Does NEVER return.
  */
@@ -119,7 +137,7 @@
 	vsnprintf(buf, lengthof(buf), s, va);
 	va_end(va);
 
-	ShowOSErrorBox(buf);
+	ShowOSErrorBox(buf, true);
 	if (_video_driver != NULL) _video_driver->Stop();
 
 	assert(0);
@@ -283,7 +301,6 @@
 static void InitializeDynamicVariables()
 {
 	/* Dynamic stuff needs to be initialized somewhere... */
-	_town_sort     = NULL;
 	_industry_mngr.ResetMapping();
 	_industile_mngr.ResetMapping();
 }
@@ -306,6 +323,7 @@
 	UnInitWindowSystem();
 
 	/* Uninitialize variables that are allocated dynamically */
+	GamelogReset();
 	_Town_pool.CleanPool();
 	_Industry_pool.CleanPool();
 	_Station_pool.CleanPool();
@@ -316,8 +334,6 @@
 	_CargoPacket_pool.CleanPool();
 	_Engine_pool.CleanPool();
 
-	free((void*)_town_sort);
-
 	free(_config_file);
 
 	/* Close all and any open filehandles */
@@ -342,8 +358,6 @@
 
 	_pause_game = 0;
 	SetLocalPlayer(PLAYER_FIRST);
-	/* Make sure you can't scroll in the menu */
-	_scrolling_viewport = 0;
 	_cursor.fix_at = false;
 	MarkWholeScreenDirty();
 
@@ -353,7 +367,6 @@
 	if (_music_driver->IsSongPlaying()) ResetMusic();
 }
 
-byte _no_scroll;
 byte _savegame_sort_order;
 #if defined(UNIX) && !defined(__MORPHOS__)
 extern void DedicatedFork();
@@ -492,8 +505,8 @@
 	if (_cur_resolution[1] == 0) _cur_resolution[1] = 1;
 
 #if defined(ENABLE_NETWORK)
-	if (dedicated_host) snprintf(_network_server_bind_ip_host, NETWORK_HOSTNAME_LENGTH, "%s", dedicated_host);
-	if (dedicated_port) _network_server_port = dedicated_port;
+	if (dedicated_host) snprintf(_settings_client.network.server_bind_ip, sizeof(_settings_client.network.server_bind_ip), "%s", dedicated_host);
+	if (dedicated_port) _settings_client.network.server_port = dedicated_port;
 	if (_dedicated_forks && !dedicated) _dedicated_forks = false;
 #endif /* ENABLE_NETWORK */
 
@@ -526,30 +539,30 @@
 	DEBUG(misc, 1, "Loading blitter...");
 	if (BlitterFactoryBase::SelectBlitter(_ini_blitter) == NULL)
 		StrEmpty(_ini_blitter) ?
-			error("Failed to autoprobe blitter") :
-			error("Failed to select requested blitter '%s'; does it exist?", _ini_blitter);
+			usererror("Failed to autoprobe blitter") :
+			usererror("Failed to select requested blitter '%s'; does it exist?", _ini_blitter);
 
 	DEBUG(driver, 1, "Loading drivers...");
 
 	_sound_driver = (SoundDriver*)SoundDriverFactoryBase::SelectDriver(_ini_sounddriver, Driver::DT_SOUND);
 	if (_sound_driver == NULL) {
 		StrEmpty(_ini_sounddriver) ?
-			error("Failed to autoprobe sound driver") :
-			error("Failed to select requested sound driver '%s'", _ini_sounddriver);
+			usererror("Failed to autoprobe sound driver") :
+			usererror("Failed to select requested sound driver '%s'", _ini_sounddriver);
 	}
 
 	_music_driver = (MusicDriver*)MusicDriverFactoryBase::SelectDriver(_ini_musicdriver, Driver::DT_MUSIC);
 	if (_music_driver == NULL) {
 		StrEmpty(_ini_musicdriver) ?
-			error("Failed to autoprobe music driver") :
-			error("Failed to select requested music driver '%s'", _ini_musicdriver);
+			usererror("Failed to autoprobe music driver") :
+			usererror("Failed to select requested music driver '%s'", _ini_musicdriver);
 	}
 
 	_video_driver = (VideoDriver*)VideoDriverFactoryBase::SelectDriver(_ini_videodriver, Driver::DT_VIDEO);
 	if (_video_driver == NULL) {
 		StrEmpty(_ini_videodriver) ?
-			error("Failed to autoprobe video driver") :
-			error("Failed to select requested video driver '%s'", _ini_videodriver);
+			usererror("Failed to autoprobe video driver") :
+			usererror("Failed to select requested video driver '%s'", _ini_videodriver);
 	}
 
 	_savegame_sort_order = SORT_BY_DATE | SORT_DESCENDING;
@@ -584,7 +597,7 @@
 	if (_settings_newgame.difficulty.diff_level == 9) SetDifficultyLevel(0, &_settings_newgame.difficulty);
 
 	/* Make sure _settings is filled with _settings_newgame if we switch to a game directly */
-	if (_switch_mode != SM_NONE) _settings = _settings_newgame;
+	if (_switch_mode != SM_NONE) _settings_game = _settings_newgame;
 
 	/* initialize the ingame console */
 	IConsoleInit();
@@ -644,7 +657,7 @@
 {
 	if (_game_mode == GM_MENU) { // do not ask to quit on the main screen
 		_exit_game = true;
-	} else if (_settings.gui.autosave_on_exit) {
+	} else if (_settings_client.gui.autosave_on_exit) {
 		DoExitSave();
 		_exit_game = true;
 	} else {
@@ -676,16 +689,16 @@
 
 	SetLocalPlayer(PLAYER_FIRST);
 	_current_player = _local_player;
-	DoCommandP(0, (_settings.gui.autorenew << 15 ) | (_settings.gui.autorenew_months << 16) | 4, _settings.gui.autorenew_money, NULL, CMD_SET_AUTOREPLACE);
+	DoCommandP(0, (_settings_client.gui.autorenew << 15 ) | (_settings_client.gui.autorenew_months << 16) | 4, _settings_client.gui.autorenew_money, NULL, CMD_SET_AUTOREPLACE);
 
-	SettingsDisableElrail(_settings.vehicle.disable_elrails);
+	SettingsDisableElrail(_settings_game.vehicle.disable_elrails);
 	InitializeRailGUI();
 
 #ifdef ENABLE_NETWORK
 	/* We are the server, we start a new player (not dedicated),
 	 * so set the default password *if* needed. */
-	if (_network_server && !StrEmpty(_network_default_company_pass)) {
-		char *password = _network_default_company_pass;
+	if (_network_server && !StrEmpty(_settings_client.network.default_company_pass)) {
+		char *password = _settings_client.network.default_company_pass;
 		NetworkChangeCompanyPassword(1, &password);
 	}
 #endif /* ENABLE_NETWORK */
@@ -703,7 +716,7 @@
 	_industry_mngr.ResetMapping();
 
 	GenerateWorldSetCallback(&MakeNewGameDone);
-	GenerateWorld(from_heightmap ? GW_HEIGHTMAP : GW_NEWGAME, 1 << _settings.game_creation.map_x, 1 << _settings.game_creation.map_y);
+	GenerateWorld(from_heightmap ? GW_HEIGHTMAP : GW_NEWGAME, 1 << _settings_game.game_creation.map_x, 1 << _settings_game.game_creation.map_y);
 }
 
 static void MakeNewEditorWorldDone()
@@ -720,7 +733,7 @@
 	ResetGRFConfig(true);
 
 	GenerateWorldSetCallback(&MakeNewEditorWorldDone);
-	GenerateWorld(GW_EMPTY, 1 << _settings.game_creation.map_x, 1 << _settings.game_creation.map_y);
+	GenerateWorld(GW_EMPTY, 1 << _settings_game.game_creation.map_x, 1 << _settings_game.game_creation.map_y);
 }
 
 void StartupPlayers();
@@ -759,7 +772,7 @@
 		ShowErrorMessage(INVALID_STRING_ID, STR_012D, 0, 0);
 	}
 
-	_settings.difficulty = _settings_newgame.difficulty;
+	_settings_game.difficulty = _settings_newgame.difficulty;
 
 	/* Inititalize data */
 	StartupEconomy();
@@ -769,7 +782,7 @@
 
 	SetLocalPlayer(PLAYER_FIRST);
 	_current_player = _local_player;
-	DoCommandP(0, (_settings.gui.autorenew << 15 ) | (_settings.gui.autorenew_months << 16) | 4, _settings.gui.autorenew_money, NULL, CMD_SET_AUTOREPLACE);
+	DoCommandP(0, (_settings_client.gui.autorenew << 15 ) | (_settings_client.gui.autorenew_months << 16) | 4, _settings_client.gui.autorenew_money, NULL, CMD_SET_AUTOREPLACE);
 
 	MarkWholeScreenDirty();
 }
@@ -814,10 +827,8 @@
 		if (_networking) {
 			if (_network_server && (new_mode == SM_LOAD || new_mode == SM_NEWGAME)) {
 				NetworkReboot();
-				NetworkUDPCloseAll();
 			} else {
 				NetworkDisconnect();
-				NetworkUDPCloseAll();
 			}
 		}
 
@@ -826,9 +837,9 @@
 			/* But not if we are going to the menu */
 			if (new_mode != SM_MENU) {
 				/* check if we should reload the config */
-				if (_network_reload_cfg) {
+				if (_settings_client.network.reload_cfg) {
 					LoadFromConfig();
-					_settings = _settings_newgame;
+					_settings_game = _settings_newgame;
 					ResetGRFConfig(false);
 				}
 				NetworkServerStart();
@@ -901,7 +912,7 @@
 		case SM_LOAD_HEIGHTMAP: /* Load heightmap from scenario editor */
 			SetLocalPlayer(OWNER_NONE);
 
-			GenerateWorld(GW_HEIGHTMAP, 1 << _settings.game_creation.map_x, 1 << _settings.game_creation.map_y);
+			GenerateWorld(GW_HEIGHTMAP, 1 << _settings_game.game_creation.map_x, 1 << _settings_game.game_creation.map_y);
 			MarkWholeScreenDirty();
 			break;
 
@@ -934,7 +945,7 @@
 
 		case SM_GENRANDLAND: /* Generate random land within scenario editor */
 			SetLocalPlayer(OWNER_NONE);
-			GenerateWorld(GW_RANDOM, 1 << _settings.game_creation.map_x, 1 << _settings.game_creation.map_y);
+			GenerateWorld(GW_RANDOM, 1 << _settings_game.game_creation.map_x, 1 << _settings_game.game_creation.map_y);
 			/* XXX: set date */
 			MarkWholeScreenDirty();
 			break;
@@ -1050,16 +1061,16 @@
 	if (_networking) return;
 #endif /* PSP */
 
-	if (_settings.gui.keep_all_autosave && _local_player != PLAYER_SPECTATOR) {
+	if (_settings_client.gui.keep_all_autosave && _local_player != PLAYER_SPECTATOR) {
 		SetDParam(0, _local_player);
 		SetDParam(1, _date);
 		GetString(buf, STR_4004, lastof(buf));
 		ttd_strlcat(buf, ".sav", lengthof(buf));
 	} else {
-		/* generate a savegame name and number according to _settings.gui.max_num_autosaves */
+		/* generate a savegame name and number according to _settings_client.gui.max_num_autosaves */
 		snprintf(buf, sizeof(buf), "autosave%d.sav", _autosave_ctr);
 
-		if (++_autosave_ctr >= _settings.gui.max_num_autosaves) _autosave_ctr = 0;
+		if (++_autosave_ctr >= _settings_client.gui.max_num_autosaves) _autosave_ctr = 0;
 	}
 
 	DEBUG(sl, 2, "Autosaving to '%s'", buf);
@@ -1068,53 +1079,6 @@
 	}
 }
 
-static void ScrollMainViewport(int x, int y)
-{
-	if (_game_mode != GM_MENU) {
-		Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
-		assert(w);
-
-		w->viewport->dest_scrollpos_x += ScaleByZoom(x, w->viewport->zoom);
-		w->viewport->dest_scrollpos_y += ScaleByZoom(y, w->viewport->zoom);
-	}
-}
-
-/**
- * Describes all the different arrow key combinations the game allows
- * when it is in scrolling mode.
- * The real arrow keys are bitwise numbered as
- * 1 = left
- * 2 = up
- * 4 = right
- * 8 = down
- */
-static const int8 scrollamt[16][2] = {
-	{ 0,  0}, ///<  no key specified
-	{-2,  0}, ///<  1 : left
-	{ 0, -2}, ///<  2 : up
-	{-2, -1}, ///<  3 : left  + up
-	{ 2,  0}, ///<  4 : right
-	{ 0,  0}, ///<  5 : left  + right = nothing
-	{ 2, -1}, ///<  6 : right + up
-	{ 0, -2}, ///<  7 : right + left  + up = up
-	{ 0  ,2}, ///<  8 : down
-	{-2  ,1}, ///<  9 : down  + left
-	{ 0,  0}, ///< 10 : down  + up    = nothing
-	{-2,  0}, ///< 11 : left  + up    +  down = left
-	{ 2,  1}, ///< 12 : down  + right
-	{ 0,  2}, ///< 13 : left  + right +  down = down
-	{ 2,  0}, ///< 14 : right + up    +  down = right
-	{ 0,  0}, ///< 15 : left  + up    +  right + down  = nothing
-};
-
-static void HandleKeyScrolling()
-{
-	if (_dirkeys && !_no_scroll) {
-		int factor = _shift_pressed ? 50 : 10;
-		ScrollMainViewport(scrollamt[_dirkeys][0] * factor, scrollamt[_dirkeys][1] * factor);
-	}
-}
-
 void GameLoop()
 {
 	ProcessAsyncSaveFinish();
@@ -1126,9 +1090,6 @@
 		RedrawAutosave();
 	}
 
-	/* handle scrolling of the main window */
-	HandleKeyScrolling();
-
 	/* make a screenshot? */
 	if (IsScreenshotRequested()) ShowScreenshotResult(MakeScreenshot());
 
@@ -1141,12 +1102,6 @@
 	IncreaseSpriteLRU();
 	InteractiveRandom();
 
-	if (_scroller_click_timeout > 3) {
-		_scroller_click_timeout -= 3;
-	} else {
-		_scroller_click_timeout = 0;
-	}
-
 	_caret_timer += 3;
 	_palette_animation_counter += 8;
 	CursorTick();
@@ -1162,7 +1117,7 @@
 		if (_network_reconnect > 0 && --_network_reconnect == 0) {
 			/* This means that we want to reconnect to the last host
 			 * We do this here, because it means that the network is really closed */
-			NetworkClientConnectGame(_network_last_host, _network_last_port);
+			NetworkClientConnectGame(_settings_client.network.last_host, _settings_client.network.last_port);
 		}
 		/* Singleplayer */
 		StateGameLoop();
@@ -1180,17 +1135,6 @@
 	MusicLoop();
 }
 
-void BeforeSaveGame()
-{
-	const Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
-
-	if (w != NULL) {
-		_saved_scrollpos_x = w->viewport->scrollpos_x;
-		_saved_scrollpos_y = w->viewport->scrollpos_y;
-		_saved_scrollpos_zoom = w->viewport->zoom;
-	}
-}
-
 static void ConvertTownOwner()
 {
 	for (TileIndex tile = 0; tile != MapSize(); tile++) {
@@ -1249,7 +1193,7 @@
 /* since savegame version 4.2 the currencies are arranged differently */
 static void UpdateCurrencies()
 {
-	_settings.gui.currency = convert_currency[_settings.gui.currency];
+	_settings_game.locale.currency = convert_currency[_settings_game.locale.currency];
 }
 
 /* Up to revision 1413 the invisible tiles at the southern border have not been
@@ -1324,20 +1268,8 @@
 	ResetWindowSystem();
 	SetupColorsAndInitialWindow();
 
-	Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
-
-	w->viewport->scrollpos_x = _saved_scrollpos_x;
-	w->viewport->scrollpos_y = _saved_scrollpos_y;
-	w->viewport->dest_scrollpos_x = _saved_scrollpos_x;
-	w->viewport->dest_scrollpos_y = _saved_scrollpos_y;
-
-	ViewPort *vp = w->viewport;
-	vp->zoom = min(_saved_scrollpos_zoom, ZOOM_LVL_MAX);
-	vp->virtual_width = ScaleByZoom(vp->width, vp->zoom);
-	vp->virtual_height = ScaleByZoom(vp->height, vp->zoom);
-
-	DoZoomInOutWindow(ZOOM_NONE, w); // update button status
-	MarkWholeScreenDirty();
+	extern void ResetViewportAfterLoadGame();
+	ResetViewportAfterLoadGame();
 
 	/* Update coordinates of the signs. */
 	UpdateAllStationVirtCoord();
@@ -1370,6 +1302,13 @@
 	TileIndex map_size = MapSize();
 	Player *p;
 
+	if (CheckSavegameVersion(98)) GamelogOldver();
+
+	GamelogTestRevision();
+	GamelogTestMode();
+
+	if (CheckSavegameVersion(98)) GamelogGRFAddList(_grfconfig);
+
 	/* in version 2.1 of the savegame, town owner was unified. */
 	if (CheckSavegameVersionOldStyle(2, 1)) ConvertTownOwner();
 
@@ -1412,7 +1351,7 @@
 		Town *t;
 		FOR_ALL_TOWNS(t) {
 			t->name = CopyFromOldName(t->townnametype);
-			if (t->name != NULL) t->townnametype = SPECSTR_TOWNNAME_START + _settings.game_creation.town_name;
+			if (t->name != NULL) t->townnametype = SPECSTR_TOWNNAME_START + _settings_game.game_creation.town_name;
 		}
 
 		Waypoint *wp;
@@ -1426,7 +1365,7 @@
 	ResetOldNames();
 
 	/* convert road side to my format. */
-	if (_settings.vehicle.road_side) _settings.vehicle.road_side = 1;
+	if (_settings_game.vehicle.road_side) _settings_game.vehicle.road_side = 1;
 
 	/* Check if all NewGRFs are present, we are very strict in MP mode */
 	GRFListCompatibility gcf_res = IsGoodGRFConfigList();
@@ -1446,7 +1385,7 @@
 	SetDate(_date);
 
 	/* Force dynamic engines off when loading older savegames */
-	if (CheckSavegameVersion(95)) _settings.vehicle.dynamic_engines = 0;
+	if (CheckSavegameVersion(95)) _settings_game.vehicle.dynamic_engines = 0;
 
 	/* Load the sprites */
 	GfxLoadSprites();
@@ -1679,9 +1618,9 @@
 		 */
 		if (!_network_dedicated && IsValidPlayer(PLAYER_FIRST)) {
 			p = GetPlayer(PLAYER_FIRST);
-			p->engine_renew        = _settings.gui.autorenew;
-			p->engine_renew_months = _settings.gui.autorenew_months;
-			p->engine_renew_money  = _settings.gui.autorenew_money;
+			p->engine_renew        = _settings_client.gui.autorenew;
+			p->engine_renew_months = _settings_client.gui.autorenew_months;
+			p->engine_renew_money  = _settings_client.gui.autorenew_money;
 		}
 	}
 
@@ -2064,9 +2003,9 @@
 
 	/* from version 38 we have optional elrails, since we cannot know the
 	 * preference of a user, let elrails enabled; it can be disabled manually */
-	if (CheckSavegameVersion(38)) _settings.vehicle.disable_elrails = false;
+	if (CheckSavegameVersion(38)) _settings_game.vehicle.disable_elrails = false;
 	/* do the same as when elrails were enabled/disabled manually just now */
-	SettingsDisableElrail(_settings.vehicle.disable_elrails);
+	SettingsDisableElrail(_settings_game.vehicle.disable_elrails);
 	InitializeRailGUI();
 
 	/* From version 53, the map array was changed for house tiles to allow
@@ -2231,7 +2170,7 @@
 		Town *t;
 
 		FOR_ALL_TOWNS(t) {
-			if (_settings.economy.larger_towns != 0 && (t->index % _settings.economy.larger_towns) == 0) {
+			if (_settings_game.economy.larger_towns != 0 && (t->index % _settings_game.economy.larger_towns) == 0) {
 				t->larger_town = true;
 			}
 		}
@@ -2268,12 +2207,12 @@
 	if (CheckSavegameVersion(58)) {
 		/* patch difficulty number_industries other then zero get bumped to +1
 		 * since a new option (very low at position1) has been added */
-		if (_settings.difficulty.number_industries > 0) {
-			_settings.difficulty.number_industries++;
+		if (_settings_game.difficulty.number_industries > 0) {
+			_settings_game.difficulty.number_industries++;
 		}
 
 		/* Same goes for number of towns, although no test is needed, just an increment */
-		_settings.difficulty.number_towns++;
+		_settings_game.difficulty.number_towns++;
 	}
 
 	if (CheckSavegameVersion(64)) {
@@ -2506,22 +2445,22 @@
 		}
 
 		/* Convert old PF settings to new */
-		if (_settings.pf.yapf.rail_use_yapf || CheckSavegameVersion(28)) {
-			_settings.pf.pathfinder_for_trains = VPF_YAPF;
+		if (_settings_game.pf.yapf.rail_use_yapf || CheckSavegameVersion(28)) {
+			_settings_game.pf.pathfinder_for_trains = VPF_YAPF;
 		} else {
-			_settings.pf.pathfinder_for_trains = (_settings.pf.new_pathfinding_all ? VPF_NPF : VPF_NTP);
+			_settings_game.pf.pathfinder_for_trains = (_settings_game.pf.new_pathfinding_all ? VPF_NPF : VPF_NTP);
 		}
 
-		if (_settings.pf.yapf.road_use_yapf || CheckSavegameVersion(28)) {
-			_settings.pf.pathfinder_for_roadvehs = VPF_YAPF;
+		if (_settings_game.pf.yapf.road_use_yapf || CheckSavegameVersion(28)) {
+			_settings_game.pf.pathfinder_for_roadvehs = VPF_YAPF;
 		} else {
-			_settings.pf.pathfinder_for_roadvehs = (_settings.pf.new_pathfinding_all ? VPF_NPF : VPF_OPF);
+			_settings_game.pf.pathfinder_for_roadvehs = (_settings_game.pf.new_pathfinding_all ? VPF_NPF : VPF_OPF);
 		}
 
-		if (_settings.pf.yapf.ship_use_yapf) {
-			_settings.pf.pathfinder_for_ships = VPF_YAPF;
+		if (_settings_game.pf.yapf.ship_use_yapf) {
+			_settings_game.pf.pathfinder_for_ships = VPF_YAPF;
 		} else {
-			_settings.pf.pathfinder_for_ships = (_settings.pf.new_pathfinding_all ? VPF_NPF : VPF_OPF);
+			_settings_game.pf.pathfinder_for_ships = (_settings_game.pf.new_pathfinding_all ? VPF_NPF : VPF_OPF);
 		}
 	}
 
@@ -2559,6 +2498,8 @@
 		}
 	}
 
+	if (_debug_gamelog_level > 0) GamelogPrintDebug();
+
 	return InitializeWindowsAndCaches();
 }
 
--- a/src/openttd.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/openttd.h	Tue Jun 17 10:32:49 2008 +0000
@@ -5,10 +5,6 @@
 #ifndef OPENTTD_H
 #define OPENTTD_H
 
-#ifndef VARDEF
-#define VARDEF extern
-#endif
-
 enum GameModes {
 	GM_MENU,
 	GM_NORMAL,
@@ -29,21 +25,6 @@
 	SM_LOAD_HEIGHTMAP  = 12,
 };
 
-
-/* Modes for GenerateWorld */
-enum GenerateWorldModes {
-	GW_NEWGAME   = 0,    /* Generate a map for a new game */
-	GW_EMPTY     = 1,    /* Generate an empty map (sea-level) */
-	GW_RANDOM    = 2,    /* Generate a random map for SE */
-	GW_HEIGHTMAP = 3,    /* Generate a newgame from a heightmap */
-};
-
-/* Modes for InitializeGame, those are _bits_! */
-enum InitializeGameModes {
-	IG_NONE       = 0,  /* Don't do anything special */
-	IG_DATE_RESET = 1,  /* Reset the date when initializing a game */
-};
-
 /* Display Options */
 enum {
 	DO_SHOW_TOWN_NAMES    = 0,
@@ -54,26 +35,6 @@
 	DO_WAYPOINTS          = 6,
 };
 
-enum {
-	SORT_ASCENDING  = 0,
-	SORT_DESCENDING = 1,
-	SORT_BY_DATE    = 0,
-	SORT_BY_NAME    = 2
-};
-
-extern byte _savegame_sort_order;
-
-/* In certain windows you navigate with the arrow keys. Do not scroll the
- * gameview when here. Bitencoded variable that only allows scrolling if all
- * elements are zero */
-enum {
-	SCROLL_CON  = 0,
-	SCROLL_EDIT = 1,
-	SCROLL_SAVE = 2,
-	SCROLL_CHAT = 4,
-};
-extern byte _no_scroll;
-
 extern byte _game_mode;
 extern bool _exit_game;
 extern int8 _pause_game;
--- a/src/order_cmd.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/order_cmd.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -156,7 +156,7 @@
 	this->flags = 0;
 
 	/* First handle non-stop */
-	if (_settings.gui.sg_new_nonstop) {
+	if (_settings_client.gui.sg_new_nonstop) {
 		/* OFB_NON_STOP */
 		this->SetNonStopType((old_flags & 8) ? ONSF_NO_STOP_AT_ANY_STATION : ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
 	} else {
@@ -176,7 +176,7 @@
 		} else if ((old_flags & 4) == 0) { // !OFB_FULL_LOAD
 			this->SetLoadType(OLF_LOAD_IF_POSSIBLE);
 		} else {
-			this->SetLoadType(_settings.gui.sg_full_load_any ? OLF_FULL_LOAD_ANY : OLFB_FULL_LOAD);
+			this->SetLoadType(_settings_client.gui.sg_full_load_any ? OLF_FULL_LOAD_ANY : OLFB_FULL_LOAD);
 		}
 
 		/* Finally fix the unload flags */
@@ -455,7 +455,7 @@
 
 	if (!HasOrderPoolFree(1)) return_cmd_error(STR_8831_NO_MORE_SPACE_FOR_ORDERS);
 
-	if (v->type == VEH_SHIP && IsHumanPlayer(v->owner) && _settings.pf.pathfinder_for_ships != VPF_NPF) {
+	if (v->type == VEH_SHIP && IsHumanPlayer(v->owner) && _settings_game.pf.pathfinder_for_ships != VPF_NPF) {
 		/* Make sure the new destination is not too far away from the previous */
 		const Order *prev = NULL;
 		uint n = 0;
@@ -1277,7 +1277,7 @@
 			}
 
 			/* Copy timetable if enabled */
-			if (_settings.order.timetabling && !DoCommandP(0, v->index | (i << 16) | (1 << 25),
+			if (_settings_game.order.timetabling && !DoCommandP(0, v->index | (i << 16) | (1 << 25),
 					bak->order[i].wait_time << 16 | bak->order[i].travel_time, NULL,
 					CMD_CHANGE_TIMETABLE | CMD_NO_TEST_IF_IN_NETWORK)) {
 				break;
@@ -1390,13 +1390,13 @@
 void CheckOrders(const Vehicle* v)
 {
 	/* Does the user wants us to check things? */
-	if (_settings.gui.order_review_system == 0) return;
+	if (_settings_client.gui.order_review_system == 0) return;
 
 	/* Do nothing for crashed vehicles */
 	if (v->vehstatus & VS_CRASHED) return;
 
 	/* Do nothing for stopped vehicles if setting is '1' */
-	if (_settings.gui.order_review_system == 1 && v->vehstatus & VS_STOPPED)
+	if (_settings_client.gui.order_review_system == 1 && v->vehstatus & VS_STOPPED)
 		return;
 
 	/* do nothing we we're not the first vehicle in a share-chain */
@@ -1575,7 +1575,7 @@
 
 Date GetServiceIntervalClamped(uint index)
 {
-	return (_settings.vehicle.servint_ispercent) ? Clamp(index, MIN_SERVINT_PERCENT, MAX_SERVINT_PERCENT) : Clamp(index, MIN_SERVINT_DAYS, MAX_SERVINT_DAYS);
+	return (_settings_game.vehicle.servint_ispercent) ? Clamp(index, MIN_SERVINT_PERCENT, MAX_SERVINT_PERCENT) : Clamp(index, MIN_SERVINT_DAYS, MAX_SERVINT_DAYS);
 }
 
 /**
@@ -1613,6 +1613,95 @@
 }
 
 /**
+ * Process a conditional order and determine the next order.
+ * @param order the order the vehicle currently has
+ * @param v the vehicle to update
+ * @return index of next order to jump to, or INVALID_VEH_ORDER_ID to use the next order
+ */
+static VehicleOrderID ProcessConditionalOrder(const Order *order, const Vehicle *v)
+{
+	if (order->GetType() != OT_CONDITIONAL) return INVALID_VEH_ORDER_ID;
+
+	bool skip_order = false;
+	OrderConditionComparator occ = order->GetConditionComparator();
+	uint16 value = order->GetConditionValue();
+
+	switch (order->GetConditionVariable()) {
+		case OCV_LOAD_PERCENTAGE:  skip_order = OrderConditionCompare(occ, CalcPercentVehicleFilled(v, NULL), value); break;
+		case OCV_RELIABILITY:      skip_order = OrderConditionCompare(occ, v->reliability * 100 >> 16,        value); break;
+		case OCV_MAX_SPEED:        skip_order = OrderConditionCompare(occ, v->GetDisplayMaxSpeed(),           value); break;
+		case OCV_AGE:              skip_order = OrderConditionCompare(occ, v->age / 366,                      value); break;
+		case OCV_REQUIRES_SERVICE: skip_order = OrderConditionCompare(occ, v->NeedsServicing(),               value); break;
+		case OCV_UNCONDITIONALLY:  skip_order = true; break;
+		default: NOT_REACHED();
+	}
+
+	return skip_order ? order->GetConditionSkipToOrder() : (VehicleOrderID)INVALID_VEH_ORDER_ID;
+}
+
+/**
+ * Update the vehicle's destination tile from an order.
+ * @param order the order the vehicle currently has
+ * @param v the vehicle to update
+ */
+static bool UpdateOrderDest(Vehicle *v, const Order *order)
+{
+	switch (order->GetType()) {
+		case OT_GOTO_STATION:
+			v->dest_tile = v->GetOrderStationLocation(order->GetDestination());
+			break;
+
+		case OT_GOTO_DEPOT:
+			if (v->current_order.GetDepotActionType() & ODATFB_NEAREST_DEPOT) {
+				/* We need to search for the nearest depot (hangar). */
+				TileIndex location;
+				DestinationID destination;
+				bool reverse;
+
+				if (v->FindClosestDepot(&location, &destination, &reverse)) {
+					v->dest_tile = location;
+					v->current_order.MakeGoToDepot(destination, ODTFB_PART_OF_ORDERS);
+
+					/* If there is no depot in front, reverse automatically (trains only) */
+					if (v->type == VEH_TRAIN && reverse) DoCommand(v->tile, v->index, 0, DC_EXEC, CMD_REVERSE_TRAIN_DIRECTION);
+
+					if (v->type == VEH_AIRCRAFT && v->u.air.state == FLYING && v->u.air.targetairport != destination) {
+						/* The aircraft is now heading for a different hangar than the next in the orders */
+						extern void AircraftNextAirportPos_and_Order(Vehicle *v);
+						AircraftNextAirportPos_and_Order(v);
+					}
+				} else {
+					UpdateVehicleTimetable(v, true);
+					v->cur_order_index++;
+				}
+			} else if (v->type != VEH_AIRCRAFT) {
+				v->dest_tile = GetDepot(order->GetDestination())->xy;
+			}
+			break;
+
+		case OT_GOTO_WAYPOINT:
+			v->dest_tile = GetWaypoint(order->GetDestination())->xy;
+			break;
+
+		case OT_CONDITIONAL: {
+			VehicleOrderID next_order = ProcessConditionalOrder(order, v);
+			UpdateVehicleTimetable(v, true);
+			if (next_order != INVALID_VEH_ORDER_ID) {
+				v->cur_order_index = next_order;
+			} else {
+				v->cur_order_index++;
+			}
+			return false;
+		}
+
+		default:
+			v->dest_tile = 0;
+			return false;
+	}
+	return true;
+}
+
+/**
  * Handle the orders of a vehicle and determine the next place
  * to go to if needed.
  * @param v the vehicle to do this for.
@@ -1710,71 +1799,7 @@
 			break;
 	}
 
-	switch (order->GetType()) {
-		case OT_GOTO_STATION:
-			v->dest_tile = v->GetOrderStationLocation(order->GetDestination());
-			break;
-
-		case OT_GOTO_DEPOT:
-			if (v->current_order.GetDepotActionType() & ODATFB_NEAREST_DEPOT) {
-				/* We need to search for the nearest depot (hangar). */
-				TileIndex location;
-				DestinationID destination;
-				bool reverse;
-
-				if (v->FindClosestDepot(&location, &destination, &reverse)) {
-					v->dest_tile = location;
-					v->current_order.MakeGoToDepot(destination, ODTFB_PART_OF_ORDERS);
-
-					/* If there is no depot in front, reverse automatically (trains only) */
-					if (v->type == VEH_TRAIN && reverse) DoCommand(v->tile, v->index, 0, DC_EXEC, CMD_REVERSE_TRAIN_DIRECTION);
-
-					if (v->type == VEH_AIRCRAFT && v->u.air.state == FLYING && v->u.air.targetairport != destination) {
-						/* The aircraft is now heading for a different hangar than the next in the orders */
-						extern void AircraftNextAirportPos_and_Order(Vehicle *v);
-						AircraftNextAirportPos_and_Order(v);
-					}
-				} else {
-					UpdateVehicleTimetable(v, true);
-					v->cur_order_index++;
-				}
-			} else if (v->type != VEH_AIRCRAFT) {
-				v->dest_tile = GetDepot(order->GetDestination())->xy;
-			}
-			break;
-
-		case OT_GOTO_WAYPOINT:
-			v->dest_tile = GetWaypoint(order->GetDestination())->xy;
-			break;
-
-		case OT_CONDITIONAL: {
-			bool skip_order = false;
-			OrderConditionComparator occ = order->GetConditionComparator();
-			uint16 value = order->GetConditionValue();
-
-			switch (order->GetConditionVariable()) {
-				case OCV_LOAD_PERCENTAGE:  skip_order = OrderConditionCompare(occ, CalcPercentVehicleFilled(v, NULL), value); break;
-				case OCV_RELIABILITY:      skip_order = OrderConditionCompare(occ, v->reliability * 100 >> 16,        value); break;
-				case OCV_MAX_SPEED:        skip_order = OrderConditionCompare(occ, v->GetDisplayMaxSpeed(),           value); break;
-				case OCV_AGE:              skip_order = OrderConditionCompare(occ, v->age / 366,                      value); break;
-				case OCV_REQUIRES_SERVICE: skip_order = OrderConditionCompare(occ, v->NeedsServicing(),               value); break;
-				case OCV_UNCONDITIONALLY:  skip_order = true; break;
-				default: NOT_REACHED();
-			}
-			UpdateVehicleTimetable(v, true);
-			if (skip_order) {
-				v->cur_order_index = order->GetConditionSkipToOrder();
-			} else {
-				v->cur_order_index++;
-			}
-		} return false;
-
-		default:
-			v->dest_tile = 0;
-			return false;
-	}
-
-	return may_reverse;
+	return UpdateOrderDest(v, order) && may_reverse;
 }
 
 /**
@@ -1836,7 +1861,7 @@
 	if (CheckSavegameVersionOldStyle(5, 2)) {
 		/* Version older than 5.2 did not have a ->next pointer. Convert them
 		    (in the old days, the orderlist was 5000 items big) */
-		uint len = SlGetFieldLength();
+		size_t len = SlGetFieldLength();
 		uint i;
 
 		if (CheckSavegameVersion(5)) {
--- a/src/order_gui.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/order_gui.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -265,13 +265,13 @@
 	order.index = 0;
 
 	/* check depot first */
-	if (_settings.order.gotodepot) {
+	if (_settings_game.order.gotodepot) {
 		switch (GetTileType(tile)) {
 			case MP_RAILWAY:
 				if (v->type == VEH_TRAIN && IsTileOwner(tile, _local_player)) {
 					if (IsRailDepot(tile)) {
 						order.MakeGoToDepot(GetDepotByTile(tile)->index, ODTFB_PART_OF_ORDERS);
-						if (_settings.gui.new_nonstop) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
+						if (_settings_client.gui.new_nonstop) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
 						return order;
 					}
 				}
@@ -280,7 +280,7 @@
 			case MP_ROAD:
 				if (IsRoadDepot(tile) && v->type == VEH_ROAD && IsTileOwner(tile, _local_player)) {
 					order.MakeGoToDepot(GetDepotByTile(tile)->index, ODTFB_PART_OF_ORDERS);
-					if (_settings.gui.new_nonstop) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
+					if (_settings_client.gui.new_nonstop) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
 					return order;
 				}
 				break;
@@ -313,7 +313,7 @@
 			IsTileOwner(tile, _local_player) &&
 			IsRailWaypoint(tile)) {
 		order.MakeGoToWaypoint(GetWaypointByTile(tile)->index);
-		if (_settings.gui.new_nonstop) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
+		if (_settings_client.gui.new_nonstop) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
 		return order;
 	}
 
@@ -330,7 +330,7 @@
 			(facil = FACIL_TRUCK_STOP, 1);
 			if (st->facilities & facil) {
 				order.MakeGoToStation(st_index);
-				if (_settings.gui.new_nonstop && (v->type == VEH_TRAIN || v->type == VEH_ROAD)) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
+				if (_settings_client.gui.new_nonstop && (v->type == VEH_TRAIN || v->type == VEH_ROAD)) order.SetNonStopType(ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS);
 				return order;
 			}
 		}
@@ -566,6 +566,7 @@
 	{
 		/* Don't skip when there's nothing to skip */
 		if (_ctrl_pressed && w->vehicle->cur_order_index == w->OrderGetSel()) return;
+		if (w->vehicle->num_orders == 0) return;
 
 		DoCommandP(w->vehicle->tile, w->vehicle->index, _ctrl_pressed ? w->OrderGetSel() : ((w->vehicle->cur_order_index + 1) % w->vehicle->num_orders),
 				NULL, CMD_SKIP_TO_ORDER | CMD_MSG(_ctrl_pressed ? STR_CAN_T_SKIP_TO_ORDER : STR_CAN_T_SKIP_ORDER));
@@ -611,7 +612,7 @@
 		this->resize.step_height = 10;
 		this->selected_order = -1;
 		this->vehicle = v;
-		if (_settings.order.timetabling) {
+		if (_settings_game.order.timetabling) {
 			this->widget[ORDER_WIDGET_CAPTION].right -= 61;
 		} else {
 			this->HideWidget(ORDER_WIDGET_TIMETABLE_VIEW);
--- a/src/os2.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/os2.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -67,7 +67,7 @@
 #endif
 
 		if (disk == disk2) {
-			FiosItem *fios = FiosAlloc();
+			FiosItem *fios = _fios_items.Append();
 			fios->type = FIOS_TYPE_DRIVE;
 			fios->mtime = 0;
 #ifndef __INNOTEK_LIBC__
@@ -145,7 +145,7 @@
 	WinTerminate(hab);
 }
 
-void ShowOSErrorBox(const char *buf)
+void ShowOSErrorBox(const char *buf, bool system)
 {
 	HAB hab;
 	HMQ hmq;
--- a/src/osk_gui.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/osk_gui.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -203,6 +203,11 @@
 		/* make the caret of the parent window also blink */
 		this->parent->InvalidateWidget(this->text_btn);
 	}
+
+	virtual void OnInvalidateData(int)
+	{
+		this->InvalidateWidget(OSK_WIDGET_TEXT);
+	}
 };
 
 static const Widget _osk_widgets[] = {
--- a/src/ottdres.rc.in	Tue May 27 00:50:55 2008 +0000
+++ b/src/ottdres.rc.in	Tue Jun 17 10:32:49 2008 +0000
@@ -65,8 +65,8 @@
 //
 
 VS_VERSION_INFO VERSIONINFO
- FILEVERSION 0,6,0,@@REVISION@@
- PRODUCTVERSION 0,6,0,@@REVISION@@
+ FILEVERSION 0,7,0,@@REVISION@@
+ PRODUCTVERSION 0,7,0,@@REVISION@@
  FILEFLAGSMASK 0x3fL
 #ifdef _DEBUG
  FILEFLAGS 0x1L
--- a/src/pathfind.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/pathfind.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -778,7 +778,7 @@
 	tpf->enum_proc = enum_proc;
 	tpf->tracktype = TRANSPORT_RAIL;
 	tpf->railtypes = railtypes;
-	tpf->maxlength = min(_settings.pf.opf.pf_maxlength * 3, 10000);
+	tpf->maxlength = min(_settings_game.pf.opf.pf_maxlength * 3, 10000);
 	tpf->nstack = 0;
 	tpf->new_link = tpf->links;
 	tpf->num_links_left = lengthof(tpf->links);
--- a/src/player_gui.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/player_gui.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -13,14 +13,12 @@
 #include "player_base.h"
 #include "command_func.h"
 #include "network/network.h"
+#include "network/network_gui.h"
 #include "variables.h"
 #include "roadveh.h"
 #include "train.h"
 #include "aircraft.h"
 #include "newgrf.h"
-#include "network/network_data.h"
-#include "network/network_client.h"
-#include "network/network_gui.h"
 #include "player_face.h"
 #include "strings_func.h"
 #include "functions.h"
@@ -1191,7 +1189,7 @@
 		this->SetWidgetHiddenState(PCW_WIDGET_COMPANY_PASSWORD, !local || !_networking);
 
 		if (!local) {
-			if (_settings.economy.allow_shares) { // Shares are allowed
+			if (_settings_game.economy.allow_shares) { // Shares are allowed
 				/* If all shares are owned by someone (none by nobody), disable buy button */
 				this->SetWidgetDisabledState(PCW_WIDGET_BUY_SHARE, GetAmountOwnedBy(p, PLAYER_SPECTATOR) == 0 ||
 						/* Only 25% left to buy. If the player is human, disable buying it up.. TODO issues! */
@@ -1304,10 +1302,10 @@
 		}
 	}
 
-	virtual void OnTick()
+	virtual void OnHundredthTick()
 	{
 		/* redraw the window every now and then */
-		if ((++this->vscroll.pos & 0x1F) == 0) this->SetDirty();
+		this->SetDirty();
 	}
 
 	virtual void OnPlaceObject(Point pt, TileIndex tile)
@@ -1477,7 +1475,7 @@
 		} else {
 			/* in single player _local player is always valid */
 			const Player *p = GetPlayer(_local_player);
-			this->window_number = _settings.difficulty.diff_level;
+			this->window_number = _settings_game.difficulty.diff_level;
 			this->rank = SaveHighScoreValue(p);
 		}
 
@@ -1545,7 +1543,7 @@
 
 		this->SetupHighScoreEndWindow(&x, &y);
 
-		SetDParam(0, _settings.gui.ending_year);
+		SetDParam(0, _settings_client.gui.ending_year);
 		SetDParam(1, this->window_number + STR_6801_EASY);
 		DrawStringMultiCenter(x + (640 / 2), y + 62, !_networking ? STR_0211_TOP_COMPANIES_WHO_REACHED : STR_TOP_COMPANIES_NETWORK_GAME, 500);
 
--- a/src/players.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/players.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -13,7 +13,7 @@
 #include "saveload.h"
 #include "command_func.h"
 #include "network/network.h"
-#include "network/network_internal.h"
+#include "network/network_func.h"
 #include "variables.h"
 #include "cheat_func.h"
 #include "ai/ai.h"
@@ -65,9 +65,9 @@
 	/* Do not update the patches if we are in the intro GUI */
 	if (IsValidPlayer(new_player) && _game_mode != GM_MENU) {
 		const Player *p = GetPlayer(new_player);
-		_settings.gui.autorenew        = p->engine_renew;
-		_settings.gui.autorenew_months = p->engine_renew_months;
-		_settings.gui.autorenew_money  = p->engine_renew_money;
+		_settings_client.gui.autorenew        = p->engine_renew;
+		_settings_client.gui.autorenew_months = p->engine_renew_months;
+		_settings_client.gui.autorenew_money  = p->engine_renew_money;
 		InvalidateWindow(WC_GAME_OPTIONS, 0);
 	}
 }
@@ -541,9 +541,9 @@
 	/* Engine renewal settings */
 	p->engine_renew_list = NULL;
 	p->renew_keep_length = false;
-	p->engine_renew = _settings_newgame.gui.autorenew;
-	p->engine_renew_months = _settings_newgame.gui.autorenew_months;
-	p->engine_renew_money = _settings_newgame.gui.autorenew_money;
+	p->engine_renew = _settings_client.gui.autorenew;
+	p->engine_renew_months = _settings_client.gui.autorenew_months;
+	p->engine_renew_money = _settings_client.gui.autorenew_money;
 
 	GeneratePresidentName(p);
 
@@ -563,7 +563,7 @@
 void StartupPlayers()
 {
 	/* The AI starts like in the setting with +2 month max */
-	_next_competitor_start = _settings.difficulty.competitor_start_time * 90 * DAY_TICKS + RandomRange(60 * DAY_TICKS) + 1;
+	_next_competitor_start = _settings_game.difficulty.competitor_start_time * 90 * DAY_TICKS + RandomRange(60 * DAY_TICKS) + 1;
 }
 
 static void MaybeStartNewPlayer()
@@ -578,10 +578,10 @@
 	}
 
 	/* when there's a lot of computers in game, the probability that a new one starts is lower */
-	if (n < (uint)_settings.difficulty.max_no_competitors &&
+	if (n < (uint)_settings_game.difficulty.max_no_competitors &&
 			n < (_network_server ?
-				InteractiveRandomRange(_settings.difficulty.max_no_competitors + 2) :
-				RandomRange(_settings.difficulty.max_no_competitors + 2)
+				InteractiveRandomRange(_settings_game.difficulty.max_no_competitors + 2) :
+				RandomRange(_settings_game.difficulty.max_no_competitors + 2)
 			)) {
 		/* Send a command to all clients to start up a new AI.
 		 * Works fine for Multiplayer and Singleplayer */
@@ -589,7 +589,7 @@
 	}
 
 	/* The next AI starts like the difficulty setting said, with +2 month max */
-	_next_competitor_start = _settings.difficulty.competitor_start_time * 90 * DAY_TICKS + 1;
+	_next_competitor_start = _settings_game.difficulty.competitor_start_time * 90 * DAY_TICKS + 1;
 	_next_competitor_start += _network_server ? InteractiveRandomRange(60 * DAY_TICKS) : RandomRange(60 * DAY_TICKS);
 }
 
@@ -630,7 +630,7 @@
 		}
 	}
 
-	if (_settings.gui.show_finances && _local_player != PLAYER_SPECTATOR) {
+	if (_settings_client.gui.show_finances && _local_player != PLAYER_SPECTATOR) {
 		ShowPlayerFinances(_local_player);
 		p = GetPlayer(_local_player);
 		if (p->num_valid_stat_ent > 5 && p->old_economy[0].performance_history < p->old_economy[4].performance_history) {
@@ -695,7 +695,7 @@
 			if (flags & DC_EXEC) {
 				p->engine_renew = HasBit(p2, 0);
 				if (IsLocalPlayer()) {
-					_settings.gui.autorenew = p->engine_renew;
+					_settings_client.gui.autorenew = p->engine_renew;
 					InvalidateWindow(WC_GAME_OPTIONS, 0);
 				}
 			}
@@ -708,7 +708,7 @@
 			if (flags & DC_EXEC) {
 				p->engine_renew_months = (int16)p2;
 				if (IsLocalPlayer()) {
-					_settings.gui.autorenew_months = p->engine_renew_months;
+					_settings_client.gui.autorenew_months = p->engine_renew_months;
 					InvalidateWindow(WC_GAME_OPTIONS, 0);
 				}
 			}
@@ -721,7 +721,7 @@
 			if (flags & DC_EXEC) {
 				p->engine_renew_money = p2;
 				if (IsLocalPlayer()) {
-					_settings.gui.autorenew_money = p->engine_renew_money;
+					_settings_client.gui.autorenew_money = p->engine_renew_money;
 					InvalidateWindow(WC_GAME_OPTIONS, 0);
 				}
 			}
@@ -771,9 +771,9 @@
 				p->engine_renew_money = p2;
 
 				if (IsLocalPlayer()) {
-					_settings.gui.autorenew = p->engine_renew;
-					_settings.gui.autorenew_months = p->engine_renew_months;
-					_settings.gui.autorenew_money = p->engine_renew_money;
+					_settings_client.gui.autorenew = p->engine_renew;
+					_settings_client.gui.autorenew_months = p->engine_renew_months;
+					_settings_client.gui.autorenew_money = p->engine_renew_money;
 					InvalidateWindow(WC_GAME_OPTIONS, 0);
 				}
 			}
@@ -865,8 +865,8 @@
 			assert(_local_player == PLAYER_SPECTATOR);
 			SetLocalPlayer(p->index);
 #ifdef ENABLE_NETWORK
-			if (!StrEmpty(_network_default_company_pass)) {
-				char *password = _network_default_company_pass;
+			if (!StrEmpty(_settings_client.network.default_company_pass)) {
+				char *password = _settings_client.network.default_company_pass;
 				NetworkChangeCompanyPassword(1, &password);
 			}
 #endif /* ENABLE_NETWORK */
@@ -876,8 +876,8 @@
 		/* Now that we have a new player, broadcast its autorenew settings to
 		 * all clients so everything is in sync */
 		DoCommand(0,
-			(_settings.gui.autorenew << 15 ) | (_settings.gui.autorenew_months << 16) | 4,
-			_settings.gui.autorenew_money,
+			(_settings_client.gui.autorenew << 15 ) | (_settings_client.gui.autorenew_months << 16) | 4,
+			_settings_client.gui.autorenew_money,
 			DC_EXEC,
 			CMD_SET_AUTOREPLACE
 		);
@@ -994,7 +994,7 @@
 /** Save the highscore for the player */
 int8 SaveHighScoreValue(const Player *p)
 {
-	HighScore *hs = _highscore_table[_settings.difficulty.diff_level];
+	HighScore *hs = _highscore_table[_settings_game.difficulty.diff_level];
 	uint i;
 	uint16 score = p->old_economy[0].performance_history;
 
@@ -1122,7 +1122,7 @@
 	}
 
 	/* Initialize end of game variable (when to show highscore chart) */
-	_settings.gui.ending_year = 2051;
+	_settings_client.gui.ending_year = 2051;
 }
 
 /* Save/load of players */
--- a/src/rail.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/rail.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -207,7 +207,7 @@
 	FOR_ALL_ENGINES_OF_TYPE(e, VEH_TRAIN) {
 		const EngineInfo *ei = &e->info;
 
-		if (HasBit(ei->climates, _settings.game_creation.landscape) &&
+		if (HasBit(ei->climates, _settings_game.game_creation.landscape) &&
 				(HasBit(e->player_avail, p) || _date >= e->intro_date + 365)) {
 			const RailVehicleInfo *rvi = &e->u.rail;
 
--- a/src/rail_cmd.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/rail_cmd.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -292,7 +292,7 @@
 
 	/* check track/slope combination */
 	if ((f_new == FOUNDATION_INVALID) ||
-	    ((f_new != FOUNDATION_NONE) && (!_settings.construction.build_on_slopes || _is_old_ai_player))
+	    ((f_new != FOUNDATION_NONE) && (!_settings_game.construction.build_on_slopes || _is_old_ai_player))
 	   ) return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
 
 	Foundation f_old = GetRailFoundation(tileh, existing);
@@ -756,7 +756,7 @@
 
 	if (tileh != SLOPE_FLAT && (
 				_is_old_ai_player ||
-				!_settings.construction.build_on_slopes ||
+				!_settings_game.construction.build_on_slopes ||
 				IsSteepSlope(tileh) ||
 				!CanBuildDepotByTileh(dir, tileh)
 			)) {
@@ -1224,7 +1224,7 @@
 			RailType type = GetRailType(tile);
 
 			/* Converting to the same type or converting 'hidden' elrail -> rail */
-			if (type == totype || (_settings.vehicle.disable_elrails && totype == RAILTYPE_RAIL && type == RAILTYPE_ELECTRIC)) continue;
+			if (type == totype || (_settings_game.vehicle.disable_elrails && totype == RAILTYPE_RAIL && type == RAILTYPE_ELECTRIC)) continue;
 
 			/* Trying to convert other's rail */
 			if (!CheckTileOwnership(tile)) continue;
@@ -1420,7 +1420,7 @@
 
 static void DrawSingleSignal(TileIndex tile, Track track, byte condition, uint image, uint pos)
 {
-	bool side = (_settings.vehicle.road_side != 0) && _settings.construction.signal_side;
+	bool side = (_settings_game.vehicle.road_side != 0) && _settings_game.construction.signal_side;
 	static const Point SignalPositions[2][12] = {
 		{      /* Signals on the left side */
 		/*  LEFT      LEFT      RIGHT     RIGHT     UPPER     UPPER */
@@ -1789,7 +1789,7 @@
 
 			/* adjust ground tile for desert
 			 * don't adjust for snow, because snow in depots looks weird */
-			if (IsSnowRailGround(ti->tile) && _settings.game_creation.landscape == LT_TROPIC) {
+			if (IsSnowRailGround(ti->tile) && _settings_game.game_creation.landscape == LT_TROPIC) {
 				if (image != SPR_FLAT_GRASS_TILE) {
 					image += rti->snow_offset; // tile with tracks
 				} else {
@@ -1953,7 +1953,7 @@
 		return;
 	}
 
-	switch (_settings.game_creation.landscape) {
+	switch (_settings_game.game_creation.landscape) {
 		case LT_ARCTIC: {
 			uint z;
 			Slope slope = GetTileSlope(tile, &z);
@@ -2329,7 +2329,7 @@
  */
 static CommandCost TestAutoslopeOnRailTile(TileIndex tile, uint flags, uint z_old, Slope tileh_old, uint z_new, Slope tileh_new, TrackBits rail_bits)
 {
-	if (!_settings.construction.build_on_slopes || !AutoslopeEnabled()) return CMD_ERROR;
+	if (!_settings_game.construction.build_on_slopes || !AutoslopeEnabled()) return CMD_ERROR;
 
 	/* Is the slope-rail_bits combination valid in general? I.e. is it save to call GetRailFoundation() ? */
 	if (CmdFailed(CheckRailSlope(tileh_new, rail_bits, TRACK_BIT_NONE, tile))) return CMD_ERROR;
@@ -2405,7 +2405,7 @@
 		/* allow terraforming */
 		return CommandCost(EXPENSES_CONSTRUCTION, was_water ? _price.clear_water : (Money)0);
 	} else {
-		if (_settings.construction.build_on_slopes && AutoslopeEnabled()) {
+		if (_settings_game.construction.build_on_slopes && AutoslopeEnabled()) {
 			switch (GetRailTileType(tile)) {
 				case RAIL_TILE_WAYPOINT: {
 					CommandCost cost = TestAutoslopeOnRailTile(tile, flags, z_old, tileh_old, z_new, tileh_new, GetRailWaypointBits(tile));
--- a/src/rail_gui.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/rail_gui.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -182,7 +182,7 @@
 		VpSetPlaceSizingLimit(-1);
 	} else if (_railstation.dragdrop) {
 		VpStartPlaceSizing(tile, VPM_X_AND_Y_LIMITED, DDSP_BUILD_STATION);
-		VpSetPlaceSizingLimit(_settings.station.station_spread);
+		VpSetPlaceSizingLimit(_settings_game.station.station_spread);
 	} else {
 		DoCommandP(tile,
 				_railstation.orientation | (_railstation.numtracks << 8) | (_railstation.platlength << 16) | (_ctrl_pressed << 24),
@@ -227,7 +227,7 @@
 			SB(p1, 7, 1, _convert_signal_button);
 		} else {
 			SB(p1, 3, 1, _ctrl_pressed);
-			SB(p1, 4, 1, (_cur_year < _settings.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC));
+			SB(p1, 4, 1, (_cur_year < _settings_client.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC));
 			SB(p1, 5, 2, SIGTYPE_NORMAL);
 			SB(p1, 7, 1, 0);
 		}
@@ -429,7 +429,7 @@
  */
 static void BuildRailClick_AutoSignals(Window *w)
 {
-	if (_settings.gui.enable_signal_gui != _ctrl_pressed) {
+	if (_settings_client.gui.enable_signal_gui != _ctrl_pressed) {
 		if (HandlePlacePushButton(w, RTW_BUILD_SIGNALS, ANIMCURSOR_BUILDSIGNALS, VHM_RECT, PlaceRail_AutoSignals)) ShowSignalBuilder(w);
 	} else {
 		HandlePlacePushButton(w, RTW_BUILD_SIGNALS, ANIMCURSOR_BUILDSIGNALS, VHM_RECT, PlaceRail_AutoSignals);
@@ -484,7 +484,7 @@
 				if (_railstation.orientation == 0) Swap(x, y);
 				SetTileSelectSize(x, y);
 			} else {
-				VpSetPlaceSizingLimit(_settings.station.station_spread);
+				VpSetPlaceSizingLimit(_settings_game.station.station_spread);
 			}
 		}
 	}
@@ -547,15 +547,15 @@
 		SB(p2,  3, 1, 0);
 		SB(p2,  4, 1, _cur_signal_variant);
 		SB(p2,  6, 1, _ctrl_pressed);
-		SB(p2, 24, 8, _settings.gui.drag_signals_density);
+		SB(p2, 24, 8, _settings_client.gui.drag_signals_density);
 	} else {
 		SB(p2,  3, 1, 0);
-		SB(p2,  4, 1, (_cur_year < _settings.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC));
+		SB(p2,  4, 1, (_cur_year < _settings_client.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC));
 		SB(p2,  6, 1, _ctrl_pressed);
-		SB(p2, 24, 8, _settings.gui.drag_signals_density);
+		SB(p2, 24, 8, _settings_client.gui.drag_signals_density);
 	}
 
-	/* _settings.gui.drag_signals_density is given as a parameter such that each user
+	/* _settings_client.gui.drag_signals_density is given as a parameter such that each user
 	 * in a network game can specify his/her own signal density */
 	DoCommandP(
 		TileVirtXY(thd->selstart.x, thd->selstart.y),
@@ -617,12 +617,12 @@
 		this->DisableWidget(RTW_REMOVE);
 
 		this->FindWindowPlacementAndResize(desc);
-		if (_settings.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
+		if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
 	}
 
 	~BuildRailToolbarWindow()
 	{
-		if (_settings.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0);
+		if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0);
 	}
 
 	void UpdateRemoveWidgetStatus(int clicked_widget)
@@ -1011,13 +1011,13 @@
 				SetTileSelectSize(x, y);
 		}
 
-		int rad = (_settings.station.modified_catchment) ? CA_TRAIN : CA_UNMODIFIED;
+		int rad = (_settings_game.station.modified_catchment) ? CA_TRAIN : CA_UNMODIFIED;
 
 		if (_station_show_coverage)
 			SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
 
 		for (uint bits = 0; bits < 7; bits++) {
-			bool disable = bits >= _settings.station.station_spread;
+			bool disable = bits >= _settings_game.station.station_spread;
 			if (statspec == NULL) {
 				this->SetWidgetDisabledState(bits + BRSW_PLATFORM_NUM_1, disable);
 				this->SetWidgetDisabledState(bits + BRSW_PLATFORM_LEN_1, disable);
@@ -1393,8 +1393,8 @@
 
 		this->SetWidgetLoweredState(BSW_CONVERT, _convert_signal_button);
 
-		this->SetWidgetDisabledState(BSW_DRAG_SIGNALS_DENSITY_DECREASE, _settings.gui.drag_signals_density == 1);
-		this->SetWidgetDisabledState(BSW_DRAG_SIGNALS_DENSITY_INCREASE, _settings.gui.drag_signals_density == 20);
+		this->SetWidgetDisabledState(BSW_DRAG_SIGNALS_DENSITY_DECREASE, _settings_client.gui.drag_signals_density == 1);
+		this->SetWidgetDisabledState(BSW_DRAG_SIGNALS_DENSITY_INCREASE, _settings_client.gui.drag_signals_density == 20);
 
 		this->DrawWidgets();
 
@@ -1409,7 +1409,7 @@
 		this->DrawSignalSprite(BSW_ELECTRIC_COMBO,  SPR_IMG_SIGNAL_ELECTRIC_COMBO,  -2,  6);
 
 		/* Draw dragging signal density value in the BSW_DRAG_SIGNALS_DENSITY widget */
-		SetDParam(0, _settings.gui.drag_signals_density);
+		SetDParam(0, _settings_client.gui.drag_signals_density);
 		DrawStringCentered(this->widget[BSW_DRAG_SIGNALS_DENSITY].left + (this->widget[BSW_DRAG_SIGNALS_DENSITY].right -
 				this->widget[BSW_DRAG_SIGNALS_DENSITY].left) / 2 + 1,
 				this->widget[BSW_DRAG_SIGNALS_DENSITY].top + 2, STR_JUST_INT, TC_ORANGE);
@@ -1437,15 +1437,15 @@
 				break;
 
 			case BSW_DRAG_SIGNALS_DENSITY_DECREASE:
-				if (_settings.gui.drag_signals_density > 1) {
-					_settings.gui.drag_signals_density--;
+				if (_settings_client.gui.drag_signals_density > 1) {
+					_settings_client.gui.drag_signals_density--;
 					SetWindowDirty(FindWindowById(WC_GAME_OPTIONS, 0));
 				}
 				break;
 
 			case BSW_DRAG_SIGNALS_DENSITY_INCREASE:
-				if (_settings.gui.drag_signals_density < 20) {
-					_settings.gui.drag_signals_density++;
+				if (_settings_client.gui.drag_signals_density < 20) {
+					_settings_client.gui.drag_signals_density++;
 					SetWindowDirty(FindWindowById(WC_GAME_OPTIONS, 0));
 				}
 				break;
@@ -1652,7 +1652,7 @@
 {      WWT_PANEL,   RESIZE_NONE,     7,   207,   272,    17,    76, 0x0,          STR_WAYPOINT_GRAPHICS_TIP},        // BRWW_WAYPOINT_4
 {      WWT_PANEL,   RESIZE_NONE,     7,   275,   340,    17,    76, 0x0,          STR_WAYPOINT_GRAPHICS_TIP},        // BRWW_WAYPOINT_5
 
-{ WWT_HSCROLLBAR,   RESIZE_NONE,    7,     1,   343,     80,    91, 0x0,          STR_0190_SCROLL_BAR_SCROLLS_LIST}, // BRWW_SCROLL
+{ WWT_HSCROLLBAR,   RESIZE_NONE,    7,     1,   343,     80,    91, 0x0,          STR_HSCROLL_BAR_SCROLLS_LIST},     // BRWW_SCROLL
 {    WIDGETS_END},
 };
 
@@ -1704,7 +1704,7 @@
 	if (_local_player == PLAYER_SPECTATOR || !IsValidPlayer(_local_player)) return;
 
 	extern RailType _last_built_railtype;
-	RailType rt = (RailType)_settings.gui.default_rail_type;
+	RailType rt = (RailType)_settings_client.gui.default_rail_type;
 	if (rt >= RAILTYPE_END) {
 		if (rt == RAILTYPE_END + 2) {
 			/* Find the most used rail type */
@@ -1756,7 +1756,7 @@
  */
 int32 ResetSignalVariant(int32 = 0)
 {
-	SignalVariant new_variant = (_cur_year < _settings.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC);
+	SignalVariant new_variant = (_cur_year < _settings_client.gui.semaphore_build_before ? SIG_SEMAPHORE : SIG_ELECTRIC);
 
 	if (new_variant != _cur_signal_variant) {
 		Window *w = FindWindowById(WC_BUILD_SIGNAL, 0);
--- a/src/rev.cpp.in	Tue May 27 00:50:55 2008 +0000
+++ b/src/rev.cpp.in	Tue Jun 17 10:32:49 2008 +0000
@@ -23,6 +23,16 @@
 const char _openttd_revision[] = "@@VERSION@@";
 
 /**
+ * Let us know if current build was modified. This detection
+ * works even in the case when revision string is overriden by
+ * --revision argument.
+ * Value 0 means no modification, 1 is for unknown state
+ * (compiling from sources without any version control software)
+ * and 2 is for modified revision.
+ */
+const byte _openttd_revision_modified = @@MODIFIED@@;
+
+/**
  * The NewGRF revision of OTTD:
  * bits  meaning.
  * 28-31 major version
--- a/src/rev.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/rev.h	Tue Jun 17 10:32:49 2008 +0000
@@ -6,6 +6,7 @@
 #define REV_H
 
 extern const char _openttd_revision[];
+extern const byte _openttd_revision_modified;
 extern const uint32 _openttd_newgrf_version;
 
 #endif /* REV_H */
--- a/src/road.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/road.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -103,7 +103,7 @@
 	FOR_ALL_ENGINES_OF_TYPE(e, VEH_ROAD) {
 		const EngineInfo *ei = &e->info;
 
-		if (HasBit(ei->climates, _settings.game_creation.landscape) &&
+		if (HasBit(ei->climates, _settings_game.game_creation.landscape) &&
 				(HasBit(e->player_avail, p) || _date >= e->intro_date + 365)) {
 			SetBit(rt, HasBit(ei->misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD);
 		}
--- a/src/road_cmd.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/road_cmd.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -69,9 +69,9 @@
 
 	if (flags & DC_EXEC) {
 		if (_game_mode == GM_MENU) {
-			_settings.vehicle.road_side = p1;
+			_settings_newgame.vehicle.road_side = p1;
 		} else {
-			_settings.vehicle.road_side = p1;
+			_settings_game.vehicle.road_side = p1;
 		}
 		InvalidateWindow(WC_GAME_OPTIONS, 0);
 	}
@@ -182,7 +182,7 @@
 	 * then allow it */
 	if (KillFirstBit(n) != ROAD_NONE && (n & remove) != ROAD_NONE) {
 		/* you can remove all kind of roads with extra dynamite */
-		if (!_settings.construction.extra_dynamite) {
+		if (!_settings_game.construction.extra_dynamite) {
 			SetDParam(0, t->index);
 			_error_message = STR_2009_LOCAL_AUTHORITY_REFUSES;
 			return false;
@@ -279,7 +279,7 @@
 			 * @li if build on slopes is disabled */
 			if (IsSteepSlope(tileh) || (IsStraightRoad(other) &&
 					(other & _invalid_tileh_slopes_road[0][tileh & SLOPE_ELEVATED]) != ROAD_NONE) ||
-					(tileh != SLOPE_FLAT && !_settings.construction.build_on_slopes)) {
+					(tileh != SLOPE_FLAT && !_settings_game.construction.build_on_slopes)) {
 				pieces |= MirrorRoadBits(pieces);
 			}
 
@@ -419,7 +419,7 @@
 	RoadBits type_bits = existing | *pieces;
 
 	/* Roads on slopes */
-	if (_settings.construction.build_on_slopes && (_invalid_tileh_slopes_road[0][tileh] & (other | type_bits)) == ROAD_NONE) {
+	if (_settings_game.construction.build_on_slopes && (_invalid_tileh_slopes_road[0][tileh] & (other | type_bits)) == ROAD_NONE) {
 
 		/* If we add leveling we've got to pay for it */
 		if ((other | existing) == ROAD_NONE) return CommandCost(EXPENSES_CONSTRUCTION, _price.terraform);
@@ -439,7 +439,7 @@
 		if (IsSlopeWithOneCornerRaised(tileh)) {
 
 			/* Prevent build on slopes if it isn't allowed */
-			if (_settings.construction.build_on_slopes) {
+			if (_settings_game.construction.build_on_slopes) {
 
 				/* If we add foundation we've got to pay for it */
 				if ((other | existing) == ROAD_NONE) return CommandCost(EXPENSES_CONSTRUCTION, _price.terraform);
@@ -594,7 +594,7 @@
 		CommandCost ret = CheckRoadSlope(tileh, &pieces, existing, other_bits);
 		/* Return an error if we need to build a foundation (ret != 0) but the
 		 * current patch-setting is turned off (or stupid AI@work) */
-		if (CmdFailed(ret) || (ret.GetCost() != 0 && !_settings.construction.build_on_slopes)) {
+		if (CmdFailed(ret) || (ret.GetCost() != 0 && !_settings_game.construction.build_on_slopes)) {
 			return_cmd_error(STR_1000_LAND_SLOPED_IN_WRONG_DIRECTION);
 		}
 		cost.AddCost(ret);
@@ -849,7 +849,7 @@
 
 	Slope tileh = GetTileSlope(tile, NULL);
 	if (tileh != SLOPE_FLAT && (
-				!_settings.construction.build_on_slopes ||
+				!_settings_game.construction.build_on_slopes ||
 				IsSteepSlope(tileh) ||
 				!CanBuildDepotByTileh(dir, tileh)
 			)) {
@@ -1000,7 +1000,7 @@
 static bool AlwaysDrawUnpavedRoads(TileIndex tile, Roadside roadside)
 {
 	return (IsOnSnow(tile) &&
-			!(_settings.game_creation.landscape == LT_TROPIC && HasGrfMiscBit(GMB_DESERT_PAVED_ROADS) &&
+			!(_settings_game.game_creation.landscape == LT_TROPIC && HasGrfMiscBit(GMB_DESERT_PAVED_ROADS) &&
 				roadside != ROADSIDE_BARREN && roadside != ROADSIDE_GRASS && roadside != ROADSIDE_GRASS_ROAD_WORKS));
 }
 
@@ -1291,7 +1291,7 @@
 
 static void TileLoop_Road(TileIndex tile)
 {
-	switch (_settings.game_creation.landscape) {
+	switch (_settings_game.game_creation.landscape) {
 		case LT_ARCTIC:
 			if (IsOnSnow(tile) != (GetTileZ(tile) > GetSnowLine())) {
 				ToggleSnow(tile);
@@ -1337,7 +1337,7 @@
 
 		{
 			/* Adjust road ground type depending on 'grp' (grp is the distance to the center) */
-			const Roadside* new_rs = (_settings.game_creation.landscape == LT_TOYLAND) ? _town_road_types_2[grp] : _town_road_types[grp];
+			const Roadside* new_rs = (_settings_game.game_creation.landscape == LT_TOYLAND) ? _town_road_types_2[grp] : _town_road_types[grp];
 			Roadside cur_rs = GetRoadside(tile);
 
 			/* We have our desired type, do nothing */
@@ -1359,7 +1359,7 @@
 	} else if (IncreaseRoadWorksCounter(tile)) {
 		TerminateRoadWorks(tile);
 
-		if (_settings.economy.mod_road_rebuild) {
+		if (_settings_game.economy.mod_road_rebuild) {
 			/* Generate a nicer town surface */
 			const RoadBits old_rb = GetAnyRoadBits(tile, ROADTYPE_ROAD);
 			const RoadBits new_rb = CleanUpRoadBits(tile, old_rb);
@@ -1570,7 +1570,7 @@
 
 static CommandCost TerraformTile_Road(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
 {
-	if (_settings.construction.build_on_slopes && AutoslopeEnabled()) {
+	if (_settings_game.construction.build_on_slopes && AutoslopeEnabled()) {
 		switch (GetRoadTileType(tile)) {
 			case ROAD_TILE_CROSSING:
 				if (!IsSteepSlope(tileh_new) && (GetTileMaxZ(tile) == z_new + GetSlopeMaxZ(tileh_new)) && HasBit(VALID_LEVEL_CROSSING_SLOPES, tileh_new)) return CommandCost(EXPENSES_CONSTRUCTION, _price.terraform);
--- a/src/road_gui.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/road_gui.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -409,12 +409,12 @@
 			WIDGET_LIST_END);
 
 		this->FindWindowPlacementAndResize(desc);
-		if (_settings.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
+		if (_settings_client.gui.link_terraform_toolbar) ShowTerraformToolbar(this);
 	}
 
 	~BuildRoadToolbarWindow()
 	{
-		if (_settings.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0);
+		if (_settings_client.gui.link_terraform_toolbar) DeleteWindowById(WC_SCEN_LAND_GEN, 0);
 	}
 
 	/**
@@ -838,11 +838,17 @@
 	{
 		this->DrawWidgets();
 
+		if (_station_show_coverage) {
+			int rad = _settings_game.station.modified_catchment ? CA_TRUCK /* = CA_BUS */ : CA_UNMODIFIED;
+			SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
+		} else {
+			SetTileSelectSize(1, 1);
+		}
 			_thd.FSMportLayout = NULL;  // ensure irregular airport support disabled
 			_thd.FSMportMask = NULL;
 
 			if (_station_show_coverage) {
-				int rad = _settings.station.modified_catchment ? CA_TRUCK /* = CA_BUS */ : CA_UNMODIFIED;
+				int rad = _settings_game.station.modified_catchment ? CA_TRUCK /* = CA_BUS */ : CA_UNMODIFIED;
 				SetTileSelectBigSize(-rad, -rad, 2 * rad, 2 * rad);
 			} else {
 				SetTileSelectSize(1, 1);
--- a/src/roadveh_cmd.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/roadveh_cmd.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -205,7 +205,7 @@
 
 	/* find the first free roadveh id */
 	unit_num = HasBit(p2, 0) ? 0 : GetFreeUnitNumber(VEH_ROAD);
-	if (unit_num > _settings.vehicle.max_roadveh)
+	if (unit_num > _settings_game.vehicle.max_roadveh)
 		return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
 
 	if (flags & DC_EXEC) {
@@ -257,7 +257,7 @@
 
 		v->name = NULL;
 
-		v->service_interval = _settings.vehicle.servint_roadveh;
+		v->service_interval = _settings_game.vehicle.servint_roadveh;
 
 		v->date_of_last_service = _date;
 		v->build_year = _cur_year;
@@ -419,7 +419,7 @@
 
 static const Depot* FindClosestRoadDepot(const Vehicle* v)
 {
-	switch (_settings.pf.pathfinder_for_roadvehs) {
+	switch (_settings_game.pf.pathfinder_for_roadvehs) {
 		case VPF_YAPF: /* YAPF */
 			return YapfFindNearestRoadDepot(v);
 
@@ -702,7 +702,7 @@
 		InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
 
 		if (!PlayVehicleSound(v, VSE_BREAKDOWN)) {
-			SndPlayVehicleFx((_settings.game_creation.landscape != LT_TOYLAND) ?
+			SndPlayVehicleFx((_settings_game.game_creation.landscape != LT_TOYLAND) ?
 				SND_0F_VEHICLE_BREAKDOWN : SND_35_COMEDY_BREAKDOWN, v);
 		}
 
@@ -863,7 +863,7 @@
 	/* updates statusbar only if speed have changed to save CPU time */
 	if (spd != v->cur_speed) {
 		v->cur_speed = spd;
-		if (_settings.gui.vehicle_speed) {
+		if (_settings_client.gui.vehicle_speed) {
 			InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 		}
 	}
@@ -1085,7 +1085,7 @@
 				trackdirs = TRACKDIR_BIT_NONE;
 			} else {
 				/* Proper station type, check if there is free loading bay */
-				if (!_settings.pf.roadveh_queue && IsStandardRoadStopTile(tile) &&
+				if (!_settings_game.pf.roadveh_queue && IsStandardRoadStopTile(tile) &&
 						!GetRoadStopByTile(tile, rstype)->HasFreeBay()) {
 					/* Station is full and RV queuing is off */
 					trackdirs = TRACKDIR_BIT_NONE;
@@ -1124,7 +1124,7 @@
 		return_track(FindFirstBit2x64(trackdirs));
 	}
 
-	switch (_settings.pf.pathfinder_for_roadvehs) {
+	switch (_settings_game.pf.pathfinder_for_roadvehs) {
 		case VPF_YAPF: { /* YAPF */
 			Trackdir trackdir = YapfChooseRoadTrack(v, tile, enterdir);
 			if (trackdir != INVALID_TRACKDIR) return_track(trackdir);
@@ -1211,7 +1211,7 @@
 
 static uint RoadFindPathToStop(const Vehicle *v, TileIndex tile)
 {
-	if (_settings.pf.pathfinder_for_roadvehs == VPF_YAPF) {
+	if (_settings_game.pf.pathfinder_for_roadvehs == VPF_YAPF) {
 		/* use YAPF */
 		return YapfRoadVehDistanceToTile(v, tile);
 	}
@@ -1273,7 +1273,7 @@
 	v->direction = DiagDirToDir(dir);
 
 	Trackdir tdir = _roadveh_depot_exit_trackdir[dir];
-	const RoadDriveEntry *rdp = _road_drive_data[v->u.road.roadtype][(_settings.vehicle.road_side << RVS_DRIVE_SIDE) + tdir];
+	const RoadDriveEntry *rdp = _road_drive_data[v->u.road.roadtype][(_settings_game.vehicle.road_side << RVS_DRIVE_SIDE) + tdir];
 
 	int x = TileX(v->tile) * TILE_SIZE + (rdp[RVC_DEPOT_START_FRAME].x & 0xF);
 	int y = TileY(v->tile) * TILE_SIZE + (rdp[RVC_DEPOT_START_FRAME].y & 0xF);
@@ -1451,7 +1451,7 @@
 	 * In this case v->u.road.state is masked to give the road stop entry direction. */
 	rd = _road_drive_data[v->u.road.roadtype][(
 		(HasBit(v->u.road.state, RVS_IN_DT_ROAD_STOP) ? v->u.road.state & RVSB_ROAD_STOP_TRACKDIR_MASK : v->u.road.state) +
-		(_settings.vehicle.road_side << RVS_DRIVE_SIDE)) ^ v->u.road.overtaking][v->u.road.frame + 1];
+		(_settings_game.vehicle.road_side << RVS_DRIVE_SIDE)) ^ v->u.road.overtaking][v->u.road.frame + 1];
 
 	if (rd.x & RDE_NEXT_TILE) {
 		TileIndex tile = v->tile + TileOffsByDiagDir((DiagDirection)(rd.x & 3));
@@ -1468,7 +1468,7 @@
 		}
 
 		if (dir == INVALID_TRACKDIR) {
-			if (!IsRoadVehFront(v)) error("!Disconnecting road vehicle.");
+			if (!IsRoadVehFront(v)) error("Disconnecting road vehicle.");
 			v->cur_speed = 0;
 			return false;
 		}
@@ -1529,7 +1529,7 @@
 		}
 
 		/* Get position data for first frame on the new tile */
-		rdp = _road_drive_data[v->u.road.roadtype][(dir + (_settings.vehicle.road_side << RVS_DRIVE_SIDE)) ^ v->u.road.overtaking];
+		rdp = _road_drive_data[v->u.road.roadtype][(dir + (_settings_game.vehicle.road_side << RVS_DRIVE_SIDE)) ^ v->u.road.overtaking];
 
 		x = TileX(tile) * TILE_SIZE + rdp[start_frame].x;
 		y = TileY(tile) * TILE_SIZE + rdp[start_frame].y;
@@ -1632,7 +1632,7 @@
 			return false;
 		}
 
-		rdp = _road_drive_data[v->u.road.roadtype][(_settings.vehicle.road_side << RVS_DRIVE_SIDE) + dir];
+		rdp = _road_drive_data[v->u.road.roadtype][(_settings_game.vehicle.road_side << RVS_DRIVE_SIDE) + dir];
 
 		x = TileX(v->tile) * TILE_SIZE + rdp[turn_around_start_frame].x;
 		y = TileY(v->tile) * TILE_SIZE + rdp[turn_around_start_frame].y;
@@ -1711,7 +1711,7 @@
 	 * (the station test and stop type test ensure that other vehicles, using the road stop as
 	 * a through route, do not stop) */
 	if (IsRoadVehFront(v) && ((IsInsideMM(v->u.road.state, RVSB_IN_ROAD_STOP, RVSB_IN_ROAD_STOP_END) &&
-			_road_veh_data_1[v->u.road.state - RVSB_IN_ROAD_STOP + (_settings.vehicle.road_side << RVS_DRIVE_SIDE)] == v->u.road.frame) ||
+			_road_veh_data_1[v->u.road.state - RVSB_IN_ROAD_STOP + (_settings_game.vehicle.road_side << RVS_DRIVE_SIDE)] == v->u.road.frame) ||
 			(IsInsideMM(v->u.road.state, RVSB_IN_DT_ROAD_STOP, RVSB_IN_DT_ROAD_STOP_END) &&
 			v->current_order.ShouldStopAtStation(v, GetStationIndex(v->tile)) &&
 			GetRoadStopType(v->tile) == (IsCargoInClass(v->cargo_type, CC_PASSENGERS) ? ROADSTOP_BUS : ROADSTOP_TRUCK) &&
@@ -1887,7 +1887,7 @@
 static void CheckIfRoadVehNeedsService(Vehicle *v)
 {
 	/* If we already got a slot at a stop, use that FIRST, and go to a depot later */
-	if (v->u.road.slot != NULL || _settings.vehicle.servint_roadveh == 0 || !v->NeedsAutomaticServicing()) return;
+	if (v->u.road.slot != NULL || _settings_game.vehicle.servint_roadveh == 0 || !v->NeedsAutomaticServicing()) return;
 	if (v->IsInDepot()) {
 		VehicleServiceInDepot(v);
 		return;
--- a/src/saveload.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/saveload.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -32,6 +32,7 @@
 #include "autoreplace_base.h"
 #include "statusbar_gui.h"
 #include <list>
+#include "gamelog.h"
 
 #include "table/strings.h"
 
@@ -43,8 +44,8 @@
 uint16 _sl_version;       ///< the major savegame version identifier
 byte   _sl_minor_version; ///< the minor savegame version, DO NOT USE!
 
-typedef void WriterProc(uint len);
-typedef uint ReaderProc();
+typedef void WriterProc(size_t len);
+typedef size_t ReaderProc();
 
 /** The saveload struct, containing reader-writer functions, bufffer, version, etc. */
 static struct {
@@ -53,10 +54,10 @@
 	byte block_mode;                     ///< ???
 	bool error;                          ///< did an error occur or not
 
-	int obj_len;                         ///< the length of the current object we are busy with
+	size_t obj_len;                      ///< the length of the current object we are busy with
 	int array_index, last_array_index;   ///< in the case of an array, the current and last positions
 
-	uint32 offs_base;                    ///< the offset in number of bytes since we started writing data (eg uncompressed savegame size)
+	size_t offs_base;                    ///< the offset in number of bytes since we started writing data (eg uncompressed savegame size)
 
 	WriterProc *write_bytes;             ///< savegame writer function
 	ReaderProc *read_bytes;              ///< savegame loader function
@@ -123,7 +124,7 @@
  */
 static void SlReadFill()
 {
-	uint len = _sl.read_bytes();
+	size_t len = _sl.read_bytes();
 	if (len == 0) SlError(STR_GAME_SAVELOAD_ERROR_BROKEN_SAVEGAME, "Unexpected end of chunk");
 
 	_sl.bufp = _sl.buf;
@@ -131,7 +132,7 @@
 	_sl.offs_base += len;
 }
 
-static inline uint32 SlGetOffs() {return _sl.offs_base - (_sl.bufe - _sl.bufp);}
+static inline size_t SlGetOffs() {return _sl.offs_base - (_sl.bufe - _sl.bufp);}
 
 /** Return the size in bytes of a certain type of normal/atomic variable
  * as it appears in memory. See VarTypes
@@ -283,27 +284,27 @@
  * @param i Index being written
  */
 
-static void SlWriteSimpleGamma(uint i)
+static void SlWriteSimpleGamma(size_t i)
 {
 	if (i >= (1 << 7)) {
 		if (i >= (1 << 14)) {
 			if (i >= (1 << 21)) {
 				assert(i < (1 << 28));
-				SlWriteByte((byte)0xE0 | (i >> 24));
+				SlWriteByte((byte)(0xE0 | (i >> 24)));
 				SlWriteByte((byte)(i >> 16));
 			} else {
-				SlWriteByte((byte)0xC0 | (i >> 16));
+				SlWriteByte((byte)(0xC0 | (i >> 16)));
 			}
 			SlWriteByte((byte)(i >> 8));
 		} else {
 			SlWriteByte((byte)(0x80 | (i >> 8)));
 		}
 	}
-	SlWriteByte(i);
+	SlWriteByte((byte)i);
 }
 
 /** Return how many bytes used to encode a gamma value */
-static inline uint SlGetGammaLength(uint i)
+static inline uint SlGetGammaLength(size_t i)
 {
 	return 1 + (i >= (1 << 7)) + (i >= (1 << 14)) + (i >= (1 << 21));
 }
@@ -312,8 +313,8 @@
 static inline void SlWriteSparseIndex(uint index) {SlWriteSimpleGamma(index);}
 
 static inline uint SlReadArrayLength() {return SlReadSimpleGamma();}
-static inline void SlWriteArrayLength(uint length) {SlWriteSimpleGamma(length);}
-static inline uint SlGetArrayLength(uint length) {return SlGetGammaLength(length);}
+static inline void SlWriteArrayLength(size_t length) {SlWriteSimpleGamma(length);}
+static inline uint SlGetArrayLength(size_t length) {return SlGetGammaLength(length);}
 
 void SlSetArrayIndex(uint index)
 {
@@ -321,7 +322,7 @@
 	_sl.array_index = index;
 }
 
-static uint32 _next_offs;
+static size_t _next_offs;
 
 /**
  * Iterate through the elements of an array and read the whole thing
@@ -375,7 +376,7 @@
 			 * The lower 24 bits are normal
 			 * The uppermost 4 bits are bits 24:27 */
 			assert(length < (1 << 28));
-			SlWriteUint32((length & 0xFFFFFF) | ((length >> 24) << 28));
+			SlWriteUint32((uint32)((length & 0xFFFFFF) | ((length >> 24) << 28)));
 			break;
 		case CH_ARRAY:
 			assert(_sl.last_array_index <= _sl.array_index);
@@ -390,7 +391,7 @@
 		default: NOT_REACHED();
 		} break;
 	case NL_CALCLENGTH:
-		_sl.obj_len += length;
+		_sl.obj_len += (int)length;
 		break;
 	}
 }
@@ -422,7 +423,7 @@
 }
 
 /* Get the length of the current object */
-uint SlGetFieldLength() {return _sl.obj_len;}
+size_t SlGetFieldLength() {return _sl.obj_len;}
 
 /** Return a signed-long version of the value of a setting
  * @param ptr pointer to the variable
@@ -628,7 +629,7 @@
  * @param length The length of the array counted in elements
  * @param conv VarType type of the variable that is used in calculating the size
  */
-static inline size_t SlCalcArrayLen(uint length, VarType conv)
+static inline size_t SlCalcArrayLen(size_t length, VarType conv)
 {
 	return SlCalcConvFileLen(conv) * length;
 }
@@ -639,7 +640,7 @@
  * @param length The length of the array in elements
  * @param conv VarType type of the atomic array (int, byte, uint64, etc.)
  */
-void SlArray(void *array, uint length, VarType conv)
+void SlArray(void *array, size_t length, VarType conv)
 {
 	/* Automatically calculate the length? */
 	if (_sl.need_length != NL_NONE) {
@@ -651,10 +652,18 @@
 	/* NOTICE - handle some buggy stuff, in really old versions everything was saved
 	 * as a byte-type. So detect this, and adjust array size accordingly */
 	if (!_sl.save && _sl_version == 0) {
+		/* all arrays except difficulty settings */
 		if (conv == SLE_INT16 || conv == SLE_UINT16 || conv == SLE_STRINGID ||
 				conv == SLE_INT32 || conv == SLE_UINT32) {
-			length *= SlCalcConvFileLen(conv);
-			conv = SLE_INT8;
+			SlCopyBytes(array, length * SlCalcConvFileLen(conv));
+			return;
+		}
+		/* used for conversion of Money 32bit->64bit */
+		if (conv == (SLE_FILE_I32 | SLE_VAR_I64)) {
+			for (uint i = 0; i < length; i++) {
+				((int64*)array)[i] = (int32)BSWAP32(SlReadUint32());
+			}
+			return;
 		}
 	}
 
@@ -710,7 +719,7 @@
 	std::list<void *> *l = (std::list<void *> *) list;
 
 	if (_sl.save) {
-		SlWriteUint32(l->size());
+		SlWriteUint32((uint32)l->size());
 
 		std::list<void *>::iterator iter;
 		for (iter = l->begin(); iter != l->end(); ++iter) {
@@ -757,7 +766,7 @@
  * @param sld The SaveLoad description of the object so we know how to manipulate it
  * @return size of given objetc
  */
-static size_t SlCalcObjLength(const void *object, const SaveLoad *sld)
+size_t SlCalcObjLength(const void *object, const SaveLoad *sld)
 {
 	size_t length = 0;
 
@@ -884,7 +893,7 @@
  */
 void SlAutolength(AutolengthProc *proc, void *arg)
 {
-	uint32 offs;
+	size_t offs;
 
 	assert(_sl.save);
 
@@ -912,8 +921,8 @@
 static void SlLoadChunk(const ChunkHandler *ch)
 {
 	byte m = SlReadByte();
-	uint32 len;
-	uint32 endoffs;
+	size_t len;
+	size_t endoffs;
 
 	_sl.block_mode = m;
 	_sl.obj_len = 0;
@@ -1052,7 +1061,7 @@
 
 #include "minilzo.h"
 
-static uint ReadLZO()
+static size_t ReadLZO()
 {
 	byte out[LZO_SIZE + LZO_SIZE / 64 + 16 + 3 + 8];
 	uint32 tmp[2];
@@ -1085,13 +1094,13 @@
 
 /* p contains the pointer to the buffer, len contains the pointer to the length.
  * len bytes will be written, p and l will be updated to reflect the next buffer. */
-static void WriteLZO(uint size)
+static void WriteLZO(size_t size)
 {
 	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);
+	lzo1x_1_compress(_sl.buf, (lzo_uint)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)));
 	if (fwrite(out, outlen + sizeof(uint32)*2, 1, _sl.fh) != 1) SlError(STR_GAME_SAVELOAD_ERROR_FILE_NOT_WRITEABLE);
@@ -1112,12 +1121,12 @@
 /*********************************************
  ******** START OF NOCOMP CODE (uncompressed)*
  *********************************************/
-static uint ReadNoComp()
+static size_t ReadNoComp()
 {
 	return fread(_sl.buf, 1, LZO_SIZE, _sl.fh);
 }
 
-static void WriteNoComp(uint size)
+static void WriteNoComp(size_t size)
 {
 	if (fwrite(_sl.buf, 1, size, _sl.fh) != size) SlError(STR_GAME_SAVELOAD_ERROR_FILE_NOT_WRITEABLE);
 }
@@ -1170,9 +1179,9 @@
 	_Savegame_pool.CleanPool();
 }
 
-static void WriteMem(uint size)
+static void WriteMem(size_t size)
 {
-	_ts.count += size;
+	_ts.count += (uint)size;
 	/* Allocate new block and new buffer-pointer */
 	_Savegame_pool.AddBlockIfNeeded(_ts.count);
 	_sl.buf = GetSavegame(_ts.count);
@@ -1197,7 +1206,7 @@
 	return true;
 }
 
-static uint ReadZlib()
+static size_t ReadZlib()
 {
 	int r;
 
@@ -1237,13 +1246,13 @@
 	return true;
 }
 
-static void WriteZlibLoop(z_streamp z, byte *p, uint len, int mode)
+static void WriteZlibLoop(z_streamp z, byte *p, size_t len, int mode)
 {
 	byte buf[1024]; // output buffer
 	int r;
 	uint n;
 	z->next_in = p;
-	z->avail_in = len;
+	z->avail_in = (uInt)len;
 	do {
 		z->next_out = buf;
 		z->avail_out = sizeof(buf);
@@ -1258,7 +1267,7 @@
 	} while (z->avail_in || !z->avail_out);
 }
 
-static void WriteZlib(uint len)
+static void WriteZlib(size_t len)
 {
 	WriteZlibLoop(&_z, _sl.buf, len, 0);
 }
@@ -1278,6 +1287,7 @@
  *******************************************/
 
 /* these define the chunks */
+extern const ChunkHandler _gamelog_chunk_handlers[];
 extern const ChunkHandler _misc_chunk_handlers[];
 extern const ChunkHandler _name_chunk_handlers[];
 extern const ChunkHandler _cheat_chunk_handlers[] ;
@@ -1299,6 +1309,7 @@
 extern const ChunkHandler _cargopacket_chunk_handlers[];
 
 static const ChunkHandler * const _chunk_handlers[] = {
+	_gamelog_chunk_handlers,
 	_misc_chunk_handlers,
 	_name_chunk_handlers,
 	_cheat_chunk_handlers,
@@ -1471,9 +1482,9 @@
 }
 
 /* actual loader/saver function */
-void InitializeGame(int mode, uint size_x, uint size_y);
+void InitializeGame(uint size_x, uint size_y, bool reset_date);
 extern bool AfterLoadGame();
-extern void BeforeSaveGame();
+extern void SaveViewportBeforeSaveGame();
 extern bool LoadOldSaveGame(const char *file);
 
 /** Small helper function to close the to be loaded savegame an signal error */
@@ -1596,10 +1607,9 @@
 	}
 }
 
-static void * CDECL SaveFileToDiskThread(void *arg)
+static void SaveFileToDiskThread(void *arg)
 {
 	SaveFileToDisk(true);
-	return NULL;
 }
 
 void WaitTillSaved()
@@ -1634,11 +1644,17 @@
 
 	/* Load a TTDLX or TTDPatch game */
 	if (mode == SL_OLD_LOAD) {
-		InitializeGame(IG_DATE_RESET, 256, 256); // set a mapsize of 256x256 for TTDPatch games or it might get confused
+		InitializeGame(256, 256, true); // set a mapsize of 256x256 for TTDPatch games or it might get confused
+		GamelogReset();
 		if (!LoadOldSaveGame(filename)) return SL_REINIT;
 		_sl_version = 0;
 		_sl_minor_version = 0;
-		if (!AfterLoadGame()) return SL_REINIT;
+		GamelogStartAction(GLAT_LOAD);
+		if (!AfterLoadGame()) {
+			GamelogStopAction();
+			return SL_REINIT;
+		}
+		GamelogStopAction();
 		return SL_OK;
 	}
 
@@ -1673,7 +1689,7 @@
 
 			_sl_version = SAVEGAME_VERSION;
 
-			BeforeSaveGame();
+			SaveViewportBeforeSaveGame();
 			SlSaveChunks();
 			SlWriteFill(); // flush the save buffer
 
@@ -1747,17 +1763,26 @@
 			/* Old maps were hardcoded to 256x256 and thus did not contain
 			 * any mapsize information. Pre-initialize to 256x256 to not to
 			 * confuse old games */
-			InitializeGame(IG_DATE_RESET, 256, 256);
+			InitializeGame(256, 256, true);
+
+			GamelogReset();
 
 			SlLoadChunks();
 			fmt->uninit_read();
 			fclose(_sl.fh);
 
+			GamelogStartAction(GLAT_LOAD);
+
 			_savegame_type = SGT_OTTD;
 
 			/* After loading fix up savegame for any internal changes that
 			 * might've occured since then. If it fails, load back the old game */
-			if (!AfterLoadGame()) return SL_REINIT;
+			if (!AfterLoadGame()) {
+				GamelogStopAction();
+				return SL_REINIT;
+			}
+
+			GamelogStopAction();
 		}
 
 		return SL_OK;
@@ -1776,7 +1801,7 @@
 	}
 }
 
-/** Do a save when exiting the game (patch option) _settings.gui.autosave_on_exit */
+/** Do a save when exiting the game (patch option) _settings_client.gui.autosave_on_exit */
 void DoExitSave()
 {
 	SaveOrLoad("exit.sav", SL_SAVE, AUTOSAVE_DIR);
--- a/src/saveload.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/saveload.h	Tue Jun 17 10:32:49 2008 +0000
@@ -13,7 +13,7 @@
 
 #define SIZE_MAX ((size_t)-1)
 
-static const uint NEWGRF_AIRPORTS_SAVEGAME = 98;
+static const uint NEWGRF_AIRPORTS_SAVEGAME = 99;
 
 enum SaveOrLoadResult {
 	SL_OK     = 0, ///< completed successfully
@@ -306,7 +306,7 @@
  * to add this to the address of the object */
 static inline void *GetVariableAddress(const void *object, const SaveLoad *sld)
 {
-	return (byte*)object + (ptrdiff_t)sld->address;
+	return (byte*)(sld->global ? NULL : object) + (ptrdiff_t)sld->address;
 }
 
 int64 ReadValue(const void *ptr, VarType conv);
@@ -316,15 +316,16 @@
 int SlIterateArray();
 
 void SlAutolength(AutolengthProc *proc, void *arg);
-uint SlGetFieldLength();
+size_t SlGetFieldLength();
 void SlSetLength(size_t length);
 size_t SlCalcObjMemberLength(const void *object, const SaveLoad *sld);
+size_t SlCalcObjLength(const void *object, const SaveLoad *sld);
 
 byte SlReadByte();
 void SlWriteByte(byte b);
 
 void SlGlobList(const SaveLoadGlobVarList *sldg);
-void SlArray(void *array, uint length, VarType conv);
+void SlArray(void *array, size_t length, VarType conv);
 void SlObject(void *object, const SaveLoad *sld);
 bool SlObjectMember(void *object, const SaveLoad *sld);
 
--- a/src/settings.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/settings.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -25,7 +25,7 @@
 #include "screenshot.h"
 #include "variables.h"
 #include "network/network.h"
-#include "network/network_internal.h"
+#include "network/network_func.h"
 #include "settings_internal.h"
 #include "command_func.h"
 #include "console_func.h"
@@ -60,12 +60,14 @@
 #include "sound/sound_driver.hpp"
 #include "music/music_driver.hpp"
 #include "blitter/factory.hpp"
+#include "gamelog.h"
 #include "station_func.h"
 
 #include "table/strings.h"
 
-Settings _settings;
-Settings _settings_newgame;
+ClientSettings _settings_client;
+GameSettings _settings_game;
+GameSettings _settings_newgame;
 
 struct IniFile;
 struct IniItem;
@@ -765,7 +767,7 @@
 		}
 
 		p = (item == NULL) ? sdb->def : string_to_val(sdb, item->value);
-		ptr = GetVariableAddress(sld->global ? NULL : object, sld);
+		ptr = GetVariableAddress(object, sld);
 
 		switch (sdb->cmd) {
 		case SDT_BOOLX: /* All four are various types of (integer) numbers */
@@ -1120,6 +1122,32 @@
 #define SDT_CONDNULL(length, from, to)\
 	{{"", NULL, {0}, {0}, 0, 0, 0, NULL, STR_NULL, NULL, NULL}, SLE_CONDNULL(length, from, to)}
 
+
+#define SDTC_CONDVAR(var, type, from, to, flags, guiflags, def, min, max, interval, str, proc)\
+	SDTG_GENERAL(#var, SDT_NUMX, SL_VAR, type, flags, guiflags, _settings_client.var, 1, def, min, max, interval, NULL, str, proc, from, to)
+#define SDTC_VAR(var, type, flags, guiflags, def, min, max, interval, str, proc)\
+	SDTC_CONDVAR(var, type, 0, SL_MAX_VERSION, flags, guiflags, def, min, max, interval, str, proc)
+
+#define SDTC_CONDBOOL(var, from, to, flags, guiflags, def, str, proc)\
+	SDTG_GENERAL(#var, SDT_BOOLX, SL_VAR, SLE_BOOL, flags, guiflags, _settings_client.var, 1, def, 0, 1, 0, NULL, str, proc, from, to)
+#define SDTC_BOOL(var, flags, guiflags, def, str, proc)\
+	SDTC_CONDBOOL(var, 0, SL_MAX_VERSION, flags, guiflags, def, str, proc)
+
+#define SDTC_CONDLIST(var, type, length, flags, guiflags, def, str, proc, from, to)\
+	SDTG_GENERAL(#var, SDT_INTLIST, SL_ARR, type, flags, guiflags, _settings_client.var, length, def, 0, 0, 0, NULL, str, proc, from, to)
+#define SDTC_LIST(var, type, flags, guiflags, def, str, proc)\
+	SDTG_GENERAL(#var, SDT_INTLIST, SL_ARR, type, flags, guiflags, _settings_client.var, lengthof(_settings_client.var), def, 0, 0, 0, NULL, str, proc, 0, SL_MAX_VERSION)
+
+#define SDTC_CONDSTR(var, type, length, flags, guiflags, def, str, proc, from, to)\
+	SDTG_GENERAL(#var, SDT_STRING, SL_STR, type, flags, guiflags, _settings_client.var, length, def, 0, 0, 0, NULL, str, proc, from, to)
+#define SDTC_STR(var, type, flags, guiflags, def, str, proc)\
+	SDTG_GENERAL(#var, SDT_STRING, SL_STR, type, flags, guiflags, _settings_client.var, lengthof(_settings_client.var), def, 0, 0, 0, NULL, str, proc, 0, SL_MAX_VERSION)
+
+#define SDTC_CONDOMANY(var, type, from, to, flags, guiflags, def, max, full, str, proc)\
+	SDTG_GENERAL(#var, SDT_ONEOFMANY, SL_VAR, type, flags, guiflags, _settings_client.var, 1, def, 0, max, 0, full, str, proc, from, to)
+#define SDTC_OMANY(var, type, flags, guiflags, def, max, full, str, proc)\
+	SDTC_CONDOMANY(var, type, 0, SL_MAX_VERSION, flags, guiflags, def, max, full, str, proc)
+
 #define SDT_END() {{NULL, NULL, {0}, {0}, 0, 0, 0, NULL, STR_NULL, NULL, NULL}, SLE_END()}
 
 /* Shortcuts for macros below. Logically if we don't save the value
@@ -1154,7 +1182,7 @@
 {
 	if (p1 == 1) {
 		ShowErrorMessage(INVALID_STRING_ID, TEMP_AI_MULTIPLAYER, 0, 0);
-		_settings.ai.ainew_active = true;
+		_settings_game.ai.ainew_active = true;
 	}
 	return 0;
 }
@@ -1220,7 +1248,7 @@
 static int32 CheckInterval(int32 p1)
 {
 	bool warning;
-	const VehicleSettings *ptc = (_game_mode == GM_MENU) ? &_settings_newgame.vehicle : &_settings.vehicle;
+	const VehicleSettings *ptc = (_game_mode == GM_MENU) ? &_settings_newgame.vehicle : &_settings_game.vehicle;
 
 	if (p1) {
 		warning = ( (IsInsideMM(ptc->servint_trains,   5, 90 + 1) || ptc->servint_trains   == 0) &&
@@ -1242,19 +1270,19 @@
 
 static int32 EngineRenewUpdate(int32 p1)
 {
-	DoCommandP(0, 0, _settings.gui.autorenew, NULL, CMD_SET_AUTOREPLACE);
+	DoCommandP(0, 0, _settings_client.gui.autorenew, NULL, CMD_SET_AUTOREPLACE);
 	return 0;
 }
 
 static int32 EngineRenewMonthsUpdate(int32 p1)
 {
-	DoCommandP(0, 1, _settings.gui.autorenew_months, NULL, CMD_SET_AUTOREPLACE);
+	DoCommandP(0, 1, _settings_client.gui.autorenew_months, NULL, CMD_SET_AUTOREPLACE);
 	return 0;
 }
 
 static int32 EngineRenewMoneyUpdate(int32 p1)
 {
-	DoCommandP(0, 2, _settings.gui.autorenew_money, NULL, CMD_SET_AUTOREPLACE);
+	DoCommandP(0, 2, _settings_client.gui.autorenew_money, NULL, CMD_SET_AUTOREPLACE);
 	return 0;
 }
 
@@ -1328,7 +1356,7 @@
 
 static int32 DifficultyReset(int32 level)
 {
-	SetDifficultyLevel(level, (_game_mode == GM_MENU) ? &_settings_newgame.difficulty : &_settings.difficulty);
+	SetDifficultyLevel(level, (_game_mode == GM_MENU) ? &_settings_newgame.difficulty : &_settings_game.difficulty);
 	return 0;
 }
 
@@ -1337,7 +1365,7 @@
 	if (_game_mode == GM_MENU) {
 		_settings_newgame.difficulty.diff_level = 3;
 	} else {
-		_settings.difficulty.diff_level = 3;
+		_settings_game.difficulty.diff_level = 3;
 	}
 
 	/* If we are a network-client, update the difficult setting (if it is open).
@@ -1354,7 +1382,7 @@
 {
 	if (_game_mode == GM_NORMAL) {
 		UpdateAirportsNoise();
-		if (_settings.economy.station_noise_level) {
+		if (_settings_game.economy.station_noise_level) {
 			InvalidateWindowClassesData(WC_TOWN_VIEW, 0);
 		}
 	}
@@ -1372,14 +1400,14 @@
  */
 static int32 CheckTownLayout(int32 p1)
 {
-	if (_settings.economy.town_layout == TL_NO_ROADS && _game_mode == GM_EDITOR) {
+	if (_settings_game.economy.town_layout == TL_NO_ROADS && _game_mode == GM_EDITOR) {
 		ShowErrorMessage(INVALID_STRING_ID, STR_CONFIG_PATCHES_TOWN_LAYOUT_INVALID, 0, 0);
-		_settings.economy.town_layout = TL_ORIGINAL;
+		_settings_game.economy.town_layout = TL_ORIGINAL;
 	}
 	return 0;
 }
 
-/** Conversion callback for _gameopt_settings.landscape
+/** Conversion callback for _gameopt_settings_game.landscape
  * It converts (or try) between old values and the new ones,
  * without loosing initial setting  of the user
  * @param value that was read from config file
@@ -1399,13 +1427,48 @@
  * So basically, 200, 400, 800 are the lowest allowed values */
 static int32 CheckNoiseToleranceLevel(const char *value)
 {
-	Settings *s = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings;
+	GameSettings *s = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game;
 	for (uint16 i = 0; i < lengthof(s->economy.town_noise_population); i++) {
 		s->economy.town_noise_population[i] = max(uint16(200 * (i + 1)), s->economy.town_noise_population[i]);
 	}
 	return 0;
 }
 
+#ifdef ENABLE_NETWORK
+
+static int32 UpdateMinPlayers(int32 p1)
+{
+	CheckMinPlayers();
+	return 0;
+}
+
+static int32 UpdatePlayerName(int32 p1)
+{
+	NetworkUpdatePlayerName();
+	return 0;
+}
+
+static int32 UpdateServerPassword(int32 p1)
+{
+	if (strcmp(_settings_client.network.server_password, "*") == 0) {
+		_settings_client.network.server_password[0] = '\0';
+	}
+
+	return 0;
+}
+
+static int32 UpdateRconPassword(int32 p1)
+{
+	if (strcmp(_settings_client.network.rcon_password, "*") == 0) {
+		_settings_client.network.rcon_password[0] = '\0';
+	}
+
+	return 0;
+}
+
+#endif /* ENABLE_NETWORK */
+
+
 /* End - Callback Functions */
 
 #ifndef EXTERNAL_PLAYER
@@ -1472,39 +1535,6 @@
 	  SDTG_END()
 };
 
-#ifdef ENABLE_NETWORK
-static const SettingDescGlobVarList _network_settings[] = {
-	  SDTG_VAR("sync_freq",           SLE_UINT16,C|S,0, _network_sync_freq,            100, 0,   100,   0, STR_NULL, NULL),
-	  SDTG_VAR("frame_freq",           SLE_UINT8,C|S,0, _network_frame_freq,             0, 0,   100,   0, STR_NULL, NULL),
-	  SDTG_VAR("max_join_time",       SLE_UINT16, S, 0, _network_max_join_time,        500, 0, 32000,   0, STR_NULL, NULL),
-	 SDTG_BOOL("pause_on_join",                   S, 0, _network_pause_on_join,        true,               STR_NULL, NULL),
-	  SDTG_STR("server_bind_ip",        SLE_STRB, S, 0, _network_server_bind_ip_host,  "0.0.0.0",          STR_NULL, NULL),
-	  SDTG_VAR("server_port",         SLE_UINT16, S, 0, _network_server_port,          NETWORK_DEFAULT_PORT, 0, 65535, 0, STR_NULL, NULL),
-	 SDTG_BOOL("server_advertise",                S, 0, _network_advertise,            false,              STR_NULL, NULL),
-	  SDTG_VAR("lan_internet",         SLE_UINT8, S, 0, _network_lan_internet,           0, 0,     1,   0, STR_NULL, NULL),
-	  SDTG_STR("player_name",           SLE_STRB, S, 0, _network_player_name,          NULL,               STR_NULL, NULL),
-	  SDTG_STR("server_password",       SLE_STRB, S, 0, _network_server_password,      NULL,               STR_NULL, NULL),
-	  SDTG_STR("rcon_password",         SLE_STRB, S, 0, _network_rcon_password,        NULL,               STR_NULL, NULL),
-	  SDTG_STR("default_company_pass",  SLE_STRB, S, 0, _network_default_company_pass, NULL,               STR_NULL, NULL),
-	  SDTG_STR("server_name",           SLE_STRB, S, 0, _network_server_name,          NULL,               STR_NULL, NULL),
-	  SDTG_STR("connect_to_ip",         SLE_STRB, S, 0, _network_default_ip,           NULL,               STR_NULL, NULL),
-	  SDTG_STR("network_id",            SLE_STRB, S, 0, _network_unique_id,            NULL,               STR_NULL, NULL),
-	 SDTG_BOOL("autoclean_companies",             S, 0, _network_autoclean_companies,  false,              STR_NULL, NULL),
-	  SDTG_VAR("autoclean_unprotected",SLE_UINT8, S, 0, _network_autoclean_unprotected,12, 0,     60,   0, STR_NULL, NULL),
-	  SDTG_VAR("autoclean_protected",  SLE_UINT8, S, 0, _network_autoclean_protected,  36, 0,    180,   0, STR_NULL, NULL),
-	  SDTG_VAR("max_companies",        SLE_UINT8, S, 0, _network_game_info.companies_max,   8, 1, MAX_PLAYERS, 0, STR_NULL, NULL),
-	  SDTG_VAR("max_clients",          SLE_UINT8, S, 0, _network_game_info.clients_max,    10, 2, MAX_CLIENTS, 0, STR_NULL, NULL),
-	  SDTG_VAR("max_spectators",       SLE_UINT8, S, 0, _network_game_info.spectators_max, 10, 0, MAX_CLIENTS, 0, STR_NULL, NULL),
-	  SDTG_VAR("restart_game_year",    SLE_INT32, S,D0, _network_restart_game_year,    0, MIN_YEAR, MAX_YEAR, 1, STR_NULL, NULL),
-	  SDTG_VAR("min_players",          SLE_UINT8, S, 0, _network_min_players,               0, 0, 10,   0, STR_NULL, NULL),
-	SDTG_OMANY("server_lang",          SLE_UINT8, S, 0, _network_game_info.server_lang,     0, 35, "ANY|ENGLISH|GERMAN|FRENCH|BRAZILIAN|BULGARIAN|CHINESE|CZECH|DANISH|DUTCH|ESPERANTO|FINNISH|HUNGARIAN|ICELANDIC|ITALIAN|JAPANESE|KOREAN|LITHUANIAN|NORWEGIAN|POLISH|PORTUGUESE|ROMANIAN|RUSSIAN|SLOVAK|SLOVENIAN|SPANISH|SWEDISH|TURKISH|UKRAINIAN|AFRIKAANS|CROATIAN|CATALAN|ESTONIAN|GALICIAN|GREEK|LATVIAN", STR_NULL, NULL),
-	 SDTG_BOOL("reload_cfg",                      S, 0, _network_reload_cfg,           false,              STR_NULL, NULL),
-	  SDTG_STR("last_host",             SLE_STRB, S, 0, _network_last_host,            "0.0.0.0",          STR_NULL, NULL),
-	  SDTG_VAR("last_port",           SLE_UINT16, S, 0, _network_last_port,            0, 0, UINT16_MAX, 0, STR_NULL ,NULL),
-	  SDTG_END()
-};
-#endif /* ENABLE_NETWORK */
-
 static const uint GAME_DIFFICULTY_NUM = 18;
 uint16 _old_diff_custom[GAME_DIFFICULTY_NUM];
 
@@ -1521,16 +1551,16 @@
 	 SDTG_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, SLE_FILE_I16 | SLE_VAR_U16,    C, 0, _old_diff_custom, 17, 0, 0, 0, 0, NULL, STR_NULL, NULL, 0,  3),
 	 SDTG_GENERAL("diff_custom", SDT_INTLIST, SL_ARR, SLE_UINT16,                    C, 0, _old_diff_custom, 18, 0, 0, 0, 0, NULL, STR_NULL, NULL, 4, 96),
 
-	      SDT_VAR(Settings, difficulty.diff_level,    SLE_UINT8,                     0, 0, 0, 0,  3, 0, STR_NULL, NULL),
-	    SDT_OMANY(Settings, gui.currency,             SLE_UINT8,                     N, 0, 0, CUSTOM_CURRENCY_ID, "GBP|USD|EUR|YEN|ATS|BEF|CHF|CZK|DEM|DKK|ESP|FIM|FRF|GRD|HUF|ISK|ITL|NLG|NOK|PLN|ROL|RUR|SIT|SEK|YTL|SKK|BRR|custom", STR_NULL, NULL, NULL),
-	    SDT_OMANY(Settings, gui.units,                SLE_UINT8,                     N, 0, 1, 2, "imperial|metric|si", STR_NULL, NULL, NULL),
+	      SDT_VAR(GameSettings, difficulty.diff_level,    SLE_UINT8,                     0, 0, 0, 0,  3, 0, STR_NULL, NULL),
+	    SDT_OMANY(GameSettings, locale.currency,          SLE_UINT8,                     N, 0, 0, CUSTOM_CURRENCY_ID, "GBP|USD|EUR|YEN|ATS|BEF|CHF|CZK|DEM|DKK|ESP|FIM|FRF|GRD|HUF|ISK|ITL|NLG|NOK|PLN|ROL|RUR|SIT|SEK|YTL|SKK|BRR|custom", STR_NULL, NULL, NULL),
+	    SDT_OMANY(GameSettings, locale.units,             SLE_UINT8,                     N, 0, 1, 2, "imperial|metric|si", STR_NULL, NULL, NULL),
 	/* There are only 21 predefined town_name values (0-20), but you can have more with newgrf action F so allow these bigger values (21-255). Invalid values will fallback to english on use and (undefined string) in GUI. */
-	    SDT_OMANY(Settings, game_creation.town_name,  SLE_UINT8,                     0, 0, 0, 255, "english|french|german|american|latin|silly|swedish|dutch|finnish|polish|slovakish|norwegian|hungarian|austrian|romanian|czech|swiss|danish|turkish|italian|catalan", STR_NULL, NULL, NULL),
-	    SDT_OMANY(Settings, game_creation.landscape,  SLE_UINT8,                     0, 0, 0, 3, "temperate|arctic|tropic|toyland", STR_NULL, NULL, ConvertLandscape),
-	      SDT_VAR(Settings, game_creation.snow_line,  SLE_UINT8,                     0, 0, 7 * TILE_HEIGHT, 2 * TILE_HEIGHT, 13 * TILE_HEIGHT, 0, STR_NULL, NULL),
-	SDT_CONDOMANY(Settings, gui.autosave,             SLE_UINT8,  0, 22,             N, 0, 0, 0, "", STR_NULL, NULL, NULL),
-	SDT_CONDOMANY(Settings, gui.autosave,             SLE_UINT8, 23, SL_MAX_VERSION, S, 0, 1, 4, "off|monthly|quarterly|half year|yearly", STR_NULL, NULL, NULL),
-	    SDT_OMANY(Settings, vehicle.road_side,        SLE_UINT8,                     0, 0, 1, 1, "left|right", STR_NULL, NULL, NULL),
+	    SDT_OMANY(GameSettings, game_creation.town_name,  SLE_UINT8,                     0, 0, 0, 255, "english|french|german|american|latin|silly|swedish|dutch|finnish|polish|slovakish|norwegian|hungarian|austrian|romanian|czech|swiss|danish|turkish|italian|catalan", STR_NULL, NULL, NULL),
+	    SDT_OMANY(GameSettings, game_creation.landscape,  SLE_UINT8,                     0, 0, 0, 3, "temperate|arctic|tropic|toyland", STR_NULL, NULL, ConvertLandscape),
+	      SDT_VAR(GameSettings, game_creation.snow_line,  SLE_UINT8,                     0, 0, 7 * TILE_HEIGHT, 2 * TILE_HEIGHT, 13 * TILE_HEIGHT, 0, STR_NULL, NULL),
+	 SDT_CONDNULL(                                                1,  0, 22),
+ SDTC_CONDOMANY(              gui.autosave,             SLE_UINT8, 23, SL_MAX_VERSION, S, 0, 1, 4, "off|monthly|quarterly|half year|yearly", STR_NULL, NULL),
+	    SDT_OMANY(GameSettings, vehicle.road_side,        SLE_UINT8,                     0, 0, 1, 1, "left|right", STR_NULL, NULL, NULL),
 	    SDT_END()
 };
 
@@ -1547,216 +1577,247 @@
 	/***************************************************************************/
 	/* Saved patch variables. */
 	/* Do not ADD or REMOVE something in this "difficulty.XXX" table or before it. It breaks savegame compatability. */
-	 SDT_CONDVAR(Settings, difficulty.max_no_competitors,        SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     2,     0,      7,  1, STR_NULL,                                  DifficultyChange),
-	 SDT_CONDVAR(Settings, difficulty.competitor_start_time,     SLE_UINT8, 97, SL_MAX_VERSION, 0,NG,     2,     0,      3,  1, STR_6830_IMMEDIATE,                        DifficultyChange),
-	 SDT_CONDVAR(Settings, difficulty.number_towns,              SLE_UINT8, 97, SL_MAX_VERSION, 0,NG,     2,     0,      3,  1, STR_NUM_VERY_LOW,                          DifficultyChange),
-	 SDT_CONDVAR(Settings, difficulty.number_industries,         SLE_UINT8, 97, SL_MAX_VERSION, 0,NG,     4,     0,      4,  1, STR_NONE,                                  DifficultyChange),
-	 SDT_CONDVAR(Settings, difficulty.max_loan,                 SLE_UINT32, 97, SL_MAX_VERSION, 0,NG|CR,300000,100000,500000,50000,STR_NULL,                               DifficultyChange),
-	 SDT_CONDVAR(Settings, difficulty.initial_interest,          SLE_UINT8, 97, SL_MAX_VERSION, 0,NG,     2,     2,      4,  1, STR_NULL,                                  DifficultyChange),
-	 SDT_CONDVAR(Settings, difficulty.vehicle_costs,             SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     0,     0,      2,  1, STR_6820_LOW,                              DifficultyChange),
-	 SDT_CONDVAR(Settings, difficulty.competitor_speed,          SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     2,     0,      4,  1, STR_681B_VERY_SLOW,                        DifficultyChange),
-	 SDT_CONDVAR(Settings, difficulty.competitor_intelligence,   SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     0,     0,      2,  1, STR_6820_LOW,                              DifficultyChange),
-	 SDT_CONDVAR(Settings, difficulty.vehicle_breakdowns,        SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     1,     0,      2,  1, STR_6823_NONE,                             DifficultyChange),
-	 SDT_CONDVAR(Settings, difficulty.subsidy_multiplier,        SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     2,     0,      3,  1, STR_6826_X1_5,                             DifficultyChange),
-	 SDT_CONDVAR(Settings, difficulty.construction_cost,         SLE_UINT8, 97, SL_MAX_VERSION, 0,NG,     0,     0,      2,  1, STR_6820_LOW,                              DifficultyChange),
-	 SDT_CONDVAR(Settings, difficulty.terrain_type,              SLE_UINT8, 97, SL_MAX_VERSION, 0,NG,     1,     0,      3,  1, STR_682A_VERY_FLAT,                        DifficultyChange),
-	 SDT_CONDVAR(Settings, difficulty.quantity_sea_lakes,        SLE_UINT8, 97, SL_MAX_VERSION, 0,NG,     0,     0,      3,  1, STR_VERY_LOW,                              DifficultyChange),
-	 SDT_CONDVAR(Settings, difficulty.economy,                   SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     0,     0,      1,  1, STR_682E_STEADY,                           DifficultyChange),
-	 SDT_CONDVAR(Settings, difficulty.line_reverse_mode,         SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     0,     0,      1,  1, STR_6834_AT_END_OF_LINE_AND_AT_STATIONS,   DifficultyChange),
-	 SDT_CONDVAR(Settings, difficulty.disasters,                 SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     0,     0,      1,  1, STR_6836_OFF,                              DifficultyChange),
-	 SDT_CONDVAR(Settings, difficulty.town_council_tolerance,    SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     0,     0,      2,  1, STR_PERMISSIVE,                            DifficultyNoiseChange),
-	 SDT_CONDVAR(Settings, difficulty.diff_level,                SLE_UINT8, 97, SL_MAX_VERSION, 0,NG,     0,     0,      3,  0, STR_NULL,                                  DifficultyReset),
+	 SDT_CONDVAR(GameSettings, difficulty.max_no_competitors,        SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     2,     0,      7,  1, STR_NULL,                                  DifficultyChange),
+	 SDT_CONDVAR(GameSettings, difficulty.competitor_start_time,     SLE_UINT8, 97, SL_MAX_VERSION, 0,NG,     2,     0,      3,  1, STR_6830_IMMEDIATE,                        DifficultyChange),
+	 SDT_CONDVAR(GameSettings, difficulty.number_towns,              SLE_UINT8, 97, SL_MAX_VERSION, 0,NG,     2,     0,      3,  1, STR_NUM_VERY_LOW,                          DifficultyChange),
+	 SDT_CONDVAR(GameSettings, difficulty.number_industries,         SLE_UINT8, 97, SL_MAX_VERSION, 0,NG,     4,     0,      4,  1, STR_NONE,                                  DifficultyChange),
+	 SDT_CONDVAR(GameSettings, difficulty.max_loan,                 SLE_UINT32, 97, SL_MAX_VERSION, 0,NG|CR,300000,100000,500000,50000,STR_NULL,                               DifficultyChange),
+	 SDT_CONDVAR(GameSettings, difficulty.initial_interest,          SLE_UINT8, 97, SL_MAX_VERSION, 0,NG,     2,     2,      4,  1, STR_NULL,                                  DifficultyChange),
+	 SDT_CONDVAR(GameSettings, difficulty.vehicle_costs,             SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     0,     0,      2,  1, STR_6820_LOW,                              DifficultyChange),
+	 SDT_CONDVAR(GameSettings, difficulty.competitor_speed,          SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     2,     0,      4,  1, STR_681B_VERY_SLOW,                        DifficultyChange),
+	 SDT_CONDVAR(GameSettings, difficulty.competitor_intelligence,   SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     0,     0,      2,  1, STR_6820_LOW,                              DifficultyChange),
+	 SDT_CONDVAR(GameSettings, difficulty.vehicle_breakdowns,        SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     1,     0,      2,  1, STR_6823_NONE,                             DifficultyChange),
+	 SDT_CONDVAR(GameSettings, difficulty.subsidy_multiplier,        SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     2,     0,      3,  1, STR_6826_X1_5,                             DifficultyChange),
+	 SDT_CONDVAR(GameSettings, difficulty.construction_cost,         SLE_UINT8, 97, SL_MAX_VERSION, 0,NG,     0,     0,      2,  1, STR_6820_LOW,                              DifficultyChange),
+	 SDT_CONDVAR(GameSettings, difficulty.terrain_type,              SLE_UINT8, 97, SL_MAX_VERSION, 0,NG,     1,     0,      3,  1, STR_682A_VERY_FLAT,                        DifficultyChange),
+	 SDT_CONDVAR(GameSettings, difficulty.quantity_sea_lakes,        SLE_UINT8, 97, SL_MAX_VERSION, 0,NG,     0,     0,      3,  1, STR_VERY_LOW,                              DifficultyChange),
+	 SDT_CONDVAR(GameSettings, difficulty.economy,                   SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     0,     0,      1,  1, STR_682E_STEADY,                           DifficultyChange),
+	 SDT_CONDVAR(GameSettings, difficulty.line_reverse_mode,         SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     0,     0,      1,  1, STR_6834_AT_END_OF_LINE_AND_AT_STATIONS,   DifficultyChange),
+	 SDT_CONDVAR(GameSettings, difficulty.disasters,                 SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     0,     0,      1,  1, STR_6836_OFF,                              DifficultyChange),
+	 SDT_CONDVAR(GameSettings, difficulty.town_council_tolerance,    SLE_UINT8, 97, SL_MAX_VERSION, 0, 0,     0,     0,      2,  1, STR_PERMISSIVE,                            DifficultyNoiseChange),
+	 SDT_CONDVAR(GameSettings, difficulty.diff_level,                SLE_UINT8, 97, SL_MAX_VERSION, 0,NG,     0,     0,      3,  0, STR_NULL,                                  DifficultyReset),
 
 	/* There are only 21 predefined town_name values (0-20), but you can have more with newgrf action F so allow these bigger values (21-255). Invalid values will fallback to english on use and (undefined string) in GUI. */
- SDT_CONDOMANY(Settings, game_creation.town_name,              SLE_UINT8, 97, SL_MAX_VERSION, 0,NN, 0, 255, "english|french|german|american|latin|silly|swedish|dutch|finnish|polish|slovakish|norwegian|hungarian|austrian|romanian|czech|swiss|danish|turkish|italian|catalan", STR_NULL, NULL, NULL),
- SDT_CONDOMANY(Settings, game_creation.landscape,              SLE_UINT8, 97, SL_MAX_VERSION, 0,NN, 0,   3, "temperate|arctic|tropic|toyland", STR_NULL, NULL, ConvertLandscape),
-	 SDT_CONDVAR(Settings, game_creation.snow_line,              SLE_UINT8, 97, SL_MAX_VERSION, 0,NN, 7 * TILE_HEIGHT, 2 * TILE_HEIGHT, 13 * TILE_HEIGHT, 0, STR_NULL, NULL),
- SDT_CONDOMANY(Settings, vehicle.road_side,                    SLE_UINT8, 97, SL_MAX_VERSION, 0,NN, 1,   1, "left|right", STR_NULL, NULL, NULL),
-
-	    SDT_BOOL(Settings, construction.build_on_slopes,                                        0,NN,  true,                    STR_CONFIG_PATCHES_BUILDONSLOPES,          NULL),
-	SDT_CONDBOOL(Settings, construction.autoslope,                          75, SL_MAX_VERSION, 0, 0,  true,                    STR_CONFIG_PATCHES_AUTOSLOPE,              NULL),
-	    SDT_BOOL(Settings, construction.extra_dynamite,                                         0, 0, false,                    STR_CONFIG_PATCHES_EXTRADYNAMITE,          NULL),
-	    SDT_BOOL(Settings, construction.longbridges,                                            0,NN,  true,                    STR_CONFIG_PATCHES_LONGBRIDGES,            NULL),
-	    SDT_BOOL(Settings, construction.signal_side,                                            N,NN,  true,                    STR_CONFIG_PATCHES_SIGNALSIDE,             RedrawScreen),
-	    SDT_BOOL(Settings, station.always_small_airport,                                        0,NN, false,                    STR_CONFIG_PATCHES_SMALL_AIRPORTS,         NULL),
-	 SDT_CONDVAR(Settings, economy.town_layout,                  SLE_UINT8, 59, SL_MAX_VERSION, 0,MS,TL_ORIGINAL,TL_NO_ROADS,NUM_TLS-1,1, STR_CONFIG_PATCHES_TOWN_LAYOUT,  CheckTownLayout),
-
-	    SDT_BOOL(Settings, vehicle.realistic_acceleration,                                      0, 0, false,                    STR_CONFIG_PATCHES_REALISTICACCEL,         RealisticAccelerationChanged),
-	    SDT_BOOL(Settings, pf.forbid_90_deg,                                                    0, 0, false,                    STR_CONFIG_PATCHES_FORBID_90_DEG,          NULL),
-	    SDT_BOOL(Settings, vehicle.mammoth_trains,                                              0,NN,  true,                    STR_CONFIG_PATCHES_MAMMOTHTRAINS,          NULL),
-	    SDT_BOOL(Settings, order.gotodepot,                                                     0, 0,  true,                    STR_CONFIG_PATCHES_GOTODEPOT,              NULL),
-	    SDT_BOOL(Settings, pf.roadveh_queue,                                                    0, 0,  true,                    STR_CONFIG_PATCHES_ROADVEH_QUEUE,          NULL),
-
-	SDT_CONDBOOL(Settings, pf.new_pathfinding_all,                           0,             86, 0, 0, false,                    STR_NULL,                                  NULL),
-	SDT_CONDBOOL(Settings, pf.yapf.ship_use_yapf,                           28,             86, 0, 0, false,                    STR_NULL,                                  NULL),
-	SDT_CONDBOOL(Settings, pf.yapf.road_use_yapf,                           28,             86, 0, 0,  true,                    STR_NULL,                                  NULL),
-	SDT_CONDBOOL(Settings, pf.yapf.rail_use_yapf,                           28,             86, 0, 0,  true,                    STR_NULL,                                  NULL),
-
-	 SDT_CONDVAR(Settings, pf.pathfinder_for_trains,             SLE_UINT8, 87, SL_MAX_VERSION, 0, MS,    2,     0,       2, 1, STR_CONFIG_PATCHES_PATHFINDER_FOR_TRAINS,  NULL),
-	 SDT_CONDVAR(Settings, pf.pathfinder_for_roadvehs,           SLE_UINT8, 87, SL_MAX_VERSION, 0, MS,    2,     0,       2, 1, STR_CONFIG_PATCHES_PATHFINDER_FOR_ROADVEH, NULL),
-	 SDT_CONDVAR(Settings, pf.pathfinder_for_ships,              SLE_UINT8, 87, SL_MAX_VERSION, 0, MS,    0,     0,       2, 1, STR_CONFIG_PATCHES_PATHFINDER_FOR_SHIPS,   NULL),
-
-	    SDT_BOOL(Settings, vehicle.never_expire_vehicles,                                       0,NN, false,                    STR_CONFIG_PATCHES_NEVER_EXPIRE_VEHICLES,  NULL),
-	     SDT_VAR(Settings, vehicle.max_trains,                  SLE_UINT16,                     0, 0,   500,     0,    5000, 0, STR_CONFIG_PATCHES_MAX_TRAINS,             RedrawScreen),
-	     SDT_VAR(Settings, vehicle.max_roadveh,                 SLE_UINT16,                     0, 0,   500,     0,    5000, 0, STR_CONFIG_PATCHES_MAX_ROADVEH,            RedrawScreen),
-	     SDT_VAR(Settings, vehicle.max_aircraft,                SLE_UINT16,                     0, 0,   200,     0,    5000, 0, STR_CONFIG_PATCHES_MAX_AIRCRAFT,           RedrawScreen),
-	     SDT_VAR(Settings, vehicle.max_ships,                   SLE_UINT16,                     0, 0,   300,     0,    5000, 0, STR_CONFIG_PATCHES_MAX_SHIPS,              RedrawScreen),
-	    SDT_BOOL(Settings, vehicle.servint_ispercent,                                           0, 0, false,                    STR_CONFIG_PATCHES_SERVINT_ISPERCENT,      CheckInterval),
-	     SDT_VAR(Settings, vehicle.servint_trains,              SLE_UINT16,                     0,D0,   150,     5,     800, 0, STR_CONFIG_PATCHES_SERVINT_TRAINS,         InValidateDetailsWindow),
-	     SDT_VAR(Settings, vehicle.servint_roadveh,             SLE_UINT16,                     0,D0,   150,     5,     800, 0, STR_CONFIG_PATCHES_SERVINT_ROADVEH,        InValidateDetailsWindow),
-	     SDT_VAR(Settings, vehicle.servint_ships,               SLE_UINT16,                     0,D0,   360,     5,     800, 0, STR_CONFIG_PATCHES_SERVINT_SHIPS,          InValidateDetailsWindow),
-	     SDT_VAR(Settings, vehicle.servint_aircraft,            SLE_UINT16,                     0,D0,   100,     5,     800, 0, STR_CONFIG_PATCHES_SERVINT_AIRCRAFT,       InValidateDetailsWindow),
-	    SDT_BOOL(Settings, order.no_servicing_if_no_breakdowns,                                 0, 0, false,                    STR_CONFIG_PATCHES_NOSERVICE,              NULL),
-	    SDT_BOOL(Settings, vehicle.wagon_speed_limits,                                          0,NN,  true,                    STR_CONFIG_PATCHES_WAGONSPEEDLIMITS,       UpdateConsists),
-	SDT_CONDBOOL(Settings, vehicle.disable_elrails,                         38, SL_MAX_VERSION, 0,NN, false,                    STR_CONFIG_PATCHES_DISABLE_ELRAILS,        SettingsDisableElrail),
-	 SDT_CONDVAR(Settings, vehicle.freight_trains,               SLE_UINT8, 39, SL_MAX_VERSION, 0,NN,     1,     1,     255, 1, STR_CONFIG_PATCHES_FREIGHT_TRAINS,         NULL),
-	SDT_CONDBOOL(Settings, order.timetabling,                               67, SL_MAX_VERSION, 0, 0,  true,                    STR_CONFIG_PATCHES_TIMETABLE_ALLOW,        NULL),
-	 SDT_CONDVAR(Settings, vehicle.plane_speed,                  SLE_UINT8, 90, SL_MAX_VERSION, 0, 0,     4,     1,       4, 0, STR_CONFIG_PATCHES_PLANE_SPEED,            NULL),
-	SDT_CONDBOOL(Settings, vehicle.dynamic_engines,                         95, SL_MAX_VERSION, 0,NN, false,                    STR_CONFIG_PATCHES_DYNAMIC_ENGINES,        NULL),
+ SDT_CONDOMANY(GameSettings, game_creation.town_name,              SLE_UINT8, 97, SL_MAX_VERSION, 0,NN, 0, 255, "english|french|german|american|latin|silly|swedish|dutch|finnish|polish|slovakish|norwegian|hungarian|austrian|romanian|czech|swiss|danish|turkish|italian|catalan", STR_NULL, NULL, NULL),
+ SDT_CONDOMANY(GameSettings, game_creation.landscape,              SLE_UINT8, 97, SL_MAX_VERSION, 0,NN, 0,   3, "temperate|arctic|tropic|toyland", STR_NULL, NULL, ConvertLandscape),
+	 SDT_CONDVAR(GameSettings, game_creation.snow_line,              SLE_UINT8, 97, SL_MAX_VERSION, 0,NN, 7 * TILE_HEIGHT, 2 * TILE_HEIGHT, 13 * TILE_HEIGHT, 0, STR_NULL, NULL),
+ SDT_CONDOMANY(GameSettings, vehicle.road_side,                    SLE_UINT8, 97, SL_MAX_VERSION, 0,NN, 1,   1, "left|right", STR_NULL, NULL, NULL),
 
-	    SDT_BOOL(Settings, station.join_stations,                                               0, 0,  true,                    STR_CONFIG_PATCHES_JOINSTATIONS,           NULL),
-	SDT_CONDBOOL(Settings, gui.sg_full_load_any,                             0,             92, 0, 0 , true,                    STR_NULL,                                  NULL),
-	    SDT_BOOL(Settings, order.improved_load,                                                 0,NN,  true,                    STR_CONFIG_PATCHES_IMPROVEDLOAD,           NULL),
-	    SDT_BOOL(Settings, order.selectgoods,                                                   0, 0,  true,                    STR_CONFIG_PATCHES_SELECTGOODS,            NULL),
-	SDT_CONDBOOL(Settings, gui.sg_new_nonstop,                               0,             92, 0, 0, false,                    STR_NULL,                                  NULL),
-	    SDT_BOOL(Settings, station.nonuniform_stations,                                         0,NN,  true,                    STR_CONFIG_PATCHES_NONUNIFORM_STATIONS,    NULL),
-	     SDT_VAR(Settings, station.station_spread,               SLE_UINT8,                     0, 0,    12,     4,      64, 0, STR_CONFIG_PATCHES_STATION_SPREAD,         InvalidateStationBuildWindow),
-	    SDT_BOOL(Settings, order.serviceathelipad,                                              0, 0,  true,                    STR_CONFIG_PATCHES_SERVICEATHELIPAD,       NULL),
-	    SDT_BOOL(Settings, station.modified_catchment,                                          0, 0,  true,                    STR_CONFIG_PATCHES_CATCHMENT,              NULL),
-	SDT_CONDBOOL(Settings, order.gradual_loading,                           40, SL_MAX_VERSION, 0, 0,  true,                    STR_CONFIG_PATCHES_GRADUAL_LOADING,        NULL),
-	SDT_CONDBOOL(Settings, construction.road_stop_on_town_road,             47, SL_MAX_VERSION, 0, 0,  true,                    STR_CONFIG_PATCHES_STOP_ON_TOWN_ROAD,      NULL),
-	SDT_CONDBOOL(Settings, station.adjacent_stations,                       62, SL_MAX_VERSION, 0, 0,  true,                    STR_CONFIG_PATCHES_ADJACENT_STATIONS,      NULL),
-	SDT_CONDBOOL(Settings, economy.station_noise_level,                     96, SL_MAX_VERSION, 0, 0, false,                    STR_CONFIG_PATCHES_NOISE_LEVEL,            InvalidateTownViewWindow),
+	    SDT_BOOL(GameSettings, construction.build_on_slopes,                                        0,NN,  true,                    STR_CONFIG_PATCHES_BUILDONSLOPES,          NULL),
+	SDT_CONDBOOL(GameSettings, construction.autoslope,                          75, SL_MAX_VERSION, 0, 0,  true,                    STR_CONFIG_PATCHES_AUTOSLOPE,              NULL),
+	    SDT_BOOL(GameSettings, construction.extra_dynamite,                                         0, 0, false,                    STR_CONFIG_PATCHES_EXTRADYNAMITE,          NULL),
+	    SDT_BOOL(GameSettings, construction.longbridges,                                            0,NN,  true,                    STR_CONFIG_PATCHES_LONGBRIDGES,            NULL),
+	    SDT_BOOL(GameSettings, construction.signal_side,                                            N,NN,  true,                    STR_CONFIG_PATCHES_SIGNALSIDE,             RedrawScreen),
+	    SDT_BOOL(GameSettings, station.always_small_airport,                                        0,NN, false,                    STR_CONFIG_PATCHES_SMALL_AIRPORTS,         NULL),
+	 SDT_CONDVAR(GameSettings, economy.town_layout,                  SLE_UINT8, 59, SL_MAX_VERSION, 0,MS,TL_ORIGINAL,TL_NO_ROADS,NUM_TLS-1,1, STR_CONFIG_PATCHES_TOWN_LAYOUT,  CheckTownLayout),
 
-	    SDT_BOOL(Settings, economy.inflation,                                                   0, 0,  true,                    STR_CONFIG_PATCHES_INFLATION,              NULL),
-	     SDT_VAR(Settings, construction.raw_industry_construction, SLE_UINT8,                   0,MS,     0,     0,       2, 0, STR_CONFIG_PATCHES_RAW_INDUSTRY_CONSTRUCTION_METHOD, InvalidateBuildIndustryWindow),
-	    SDT_BOOL(Settings, economy.multiple_industry_per_town,                                  0, 0, false,                    STR_CONFIG_PATCHES_MULTIPINDTOWN,          NULL),
-	    SDT_BOOL(Settings, economy.same_industry_close,                                         0, 0, false,                    STR_CONFIG_PATCHES_SAMEINDCLOSE,           NULL),
-	    SDT_BOOL(Settings, economy.bribe,                                                       0, 0,  true,                    STR_CONFIG_PATCHES_BRIBE,                  NULL),
-	SDT_CONDBOOL(Settings, economy.exclusive_rights,                        79, SL_MAX_VERSION, 0, 0,  true,                    STR_CONFIG_PATCHES_ALLOW_EXCLUSIVE,        NULL),
-	SDT_CONDBOOL(Settings, economy.give_money,                              79, SL_MAX_VERSION, 0, 0,  true,                    STR_CONFIG_PATCHES_ALLOW_GIVE_MONEY,       NULL),
-	     SDT_VAR(Settings, game_creation.snow_line_height,       SLE_UINT8,                     0, 0,     7,     2,      13, 0, STR_CONFIG_PATCHES_SNOWLINE_HEIGHT,        NULL),
-	     SDT_VAR(Settings, gui.colored_news_year,                SLE_INT32,                     0,NC,  2000,MIN_YEAR,MAX_YEAR,1,STR_CONFIG_PATCHES_COLORED_NEWS_YEAR,      NULL),
-	     SDT_VAR(Settings, game_creation.starting_year,          SLE_INT32,                     0,NC,  1950,MIN_YEAR,MAX_YEAR,1,STR_CONFIG_PATCHES_STARTING_YEAR,          NULL),
-	     SDT_VAR(Settings, gui.ending_year,                      SLE_INT32,                    0,NC|NO,2051,MIN_YEAR,MAX_YEAR,1,STR_CONFIG_PATCHES_ENDING_YEAR,            NULL),
-	    SDT_BOOL(Settings, economy.smooth_economy,                                              0, 0,  true,                    STR_CONFIG_PATCHES_SMOOTH_ECONOMY,         NULL),
-	    SDT_BOOL(Settings, economy.allow_shares,                                                0, 0, false,                    STR_CONFIG_PATCHES_ALLOW_SHARES,           NULL),
-	 SDT_CONDVAR(Settings, economy.town_growth_rate,             SLE_UINT8, 54, SL_MAX_VERSION, 0, MS,    2,     0,       4, 0, STR_CONFIG_PATCHES_TOWN_GROWTH,            NULL),
-	 SDT_CONDVAR(Settings, economy.larger_towns,                 SLE_UINT8, 54, SL_MAX_VERSION, 0, D0,    4,     0,     255, 1, STR_CONFIG_PATCHES_LARGER_TOWNS,           NULL),
-	 SDT_CONDVAR(Settings, economy.initial_city_size,            SLE_UINT8, 56, SL_MAX_VERSION, 0, 0,     2,     1,      10, 1, STR_CONFIG_PATCHES_CITY_SIZE_MULTIPLIER,   NULL),
-	SDT_CONDBOOL(Settings, economy.mod_road_rebuild,                        77, SL_MAX_VERSION, 0, 0, false,                    STR_CONFIG_MODIFIED_ROAD_REBUILD,          NULL),
+	    SDT_BOOL(GameSettings, vehicle.realistic_acceleration,                                      0, 0, false,                    STR_CONFIG_PATCHES_REALISTICACCEL,         RealisticAccelerationChanged),
+	    SDT_BOOL(GameSettings, pf.forbid_90_deg,                                                    0, 0, false,                    STR_CONFIG_PATCHES_FORBID_90_DEG,          NULL),
+	    SDT_BOOL(GameSettings, vehicle.mammoth_trains,                                              0,NN,  true,                    STR_CONFIG_PATCHES_MAMMOTHTRAINS,          NULL),
+	    SDT_BOOL(GameSettings, order.gotodepot,                                                     0, 0,  true,                    STR_CONFIG_PATCHES_GOTODEPOT,              NULL),
+	    SDT_BOOL(GameSettings, pf.roadveh_queue,                                                    0, 0,  true,                    STR_CONFIG_PATCHES_ROADVEH_QUEUE,          NULL),
 
-	    SDT_BOOL(Settings, ai.ainew_active,                                                     0, 0, false,                    STR_CONFIG_PATCHES_AINEW_ACTIVE,           AiNew_PatchActive_Warning),
-	    SDT_BOOL(Settings, ai.ai_in_multiplayer,                                                0, 0, false,                    STR_CONFIG_PATCHES_AI_IN_MULTIPLAYER,      Ai_In_Multiplayer_Warning),
-	    SDT_BOOL(Settings, ai.ai_disable_veh_train,                                             0, 0, false,                    STR_CONFIG_PATCHES_AI_BUILDS_TRAINS,       NULL),
-	    SDT_BOOL(Settings, ai.ai_disable_veh_roadveh,                                           0, 0, false,                    STR_CONFIG_PATCHES_AI_BUILDS_ROADVEH,      NULL),
-	    SDT_BOOL(Settings, ai.ai_disable_veh_aircraft,                                          0, 0, false,                    STR_CONFIG_PATCHES_AI_BUILDS_AIRCRAFT,     NULL),
-	    SDT_BOOL(Settings, ai.ai_disable_veh_ship,                                              0, 0, false,                    STR_CONFIG_PATCHES_AI_BUILDS_SHIPS,        NULL),
-
-	     SDT_VAR(Settings, vehicle.extend_vehicle_life,          SLE_UINT8,                     0, 0,     0,     0,     100, 0, STR_NULL,                                  NULL),
-	     SDT_VAR(Settings, economy.dist_local_authority,         SLE_UINT8,                     0, 0,    20,     5,      60, 0, STR_NULL,                                  NULL),
-	     SDT_VAR(Settings, pf.wait_oneway_signal,                SLE_UINT8,                     0, 0,    15,     2,     100, 0, STR_NULL,                                  NULL),
-	     SDT_VAR(Settings, pf.wait_twoway_signal,                SLE_UINT8,                     0, 0,    41,     2,     100, 0, STR_NULL,                                  NULL),
-	SDT_CONDLISTO(Settings, economy.town_noise_population, 3,   SLE_UINT16, 96, SL_MAX_VERSION, 0,D0, "800,2000,4000",          STR_NULL,                                  NULL, CheckNoiseToleranceLevel),
+	SDT_CONDBOOL(GameSettings, pf.new_pathfinding_all,                           0,             86, 0, 0, false,                    STR_NULL,                                  NULL),
+	SDT_CONDBOOL(GameSettings, pf.yapf.ship_use_yapf,                           28,             86, 0, 0, false,                    STR_NULL,                                  NULL),
+	SDT_CONDBOOL(GameSettings, pf.yapf.road_use_yapf,                           28,             86, 0, 0,  true,                    STR_NULL,                                  NULL),
+	SDT_CONDBOOL(GameSettings, pf.yapf.rail_use_yapf,                           28,             86, 0, 0,  true,                    STR_NULL,                                  NULL),
 
-	     SDT_VAR(Settings, pf.opf.pf_maxlength,                          SLE_UINT16,                     0, 0,  4096,                    64,   65535, 0, STR_NULL,         NULL),
-	     SDT_VAR(Settings, pf.opf.pf_maxdepth,                            SLE_UINT8,                     0, 0,    48,                     4,     255, 0, STR_NULL,         NULL),
+	 SDT_CONDVAR(GameSettings, pf.pathfinder_for_trains,             SLE_UINT8, 87, SL_MAX_VERSION, 0, MS,    2,     0,       2, 1, STR_CONFIG_PATCHES_PATHFINDER_FOR_TRAINS,  NULL),
+	 SDT_CONDVAR(GameSettings, pf.pathfinder_for_roadvehs,           SLE_UINT8, 87, SL_MAX_VERSION, 0, MS,    2,     0,       2, 1, STR_CONFIG_PATCHES_PATHFINDER_FOR_ROADVEH, NULL),
+	 SDT_CONDVAR(GameSettings, pf.pathfinder_for_ships,              SLE_UINT8, 87, SL_MAX_VERSION, 0, MS,    0,     0,       2, 1, STR_CONFIG_PATCHES_PATHFINDER_FOR_SHIPS,   NULL),
 
-	     SDT_VAR(Settings, pf.npf.npf_max_search_nodes,                    SLE_UINT,                     0, 0, 10000,                   500,  100000, 0, STR_NULL,         NULL),
-	     SDT_VAR(Settings, pf.npf.npf_rail_firstred_penalty,               SLE_UINT,                     0, 0, ( 10 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
-	     SDT_VAR(Settings, pf.npf.npf_rail_firstred_exit_penalty,          SLE_UINT,                     0, 0, (100 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
-	     SDT_VAR(Settings, pf.npf.npf_rail_lastred_penalty,                SLE_UINT,                     0, 0, ( 10 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
-	     SDT_VAR(Settings, pf.npf.npf_rail_station_penalty,                SLE_UINT,                     0, 0, (  1 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
-	     SDT_VAR(Settings, pf.npf.npf_rail_slope_penalty,                  SLE_UINT,                     0, 0, (  1 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
-	     SDT_VAR(Settings, pf.npf.npf_rail_curve_penalty,                  SLE_UINT,                     0, 0, 1,                         0,  100000, 0, STR_NULL,         NULL),
-	     SDT_VAR(Settings, pf.npf.npf_rail_depot_reverse_penalty,          SLE_UINT,                     0, 0, ( 50 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
-	     SDT_VAR(Settings, pf.npf.npf_buoy_penalty,                        SLE_UINT,                     0, 0, (  2 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
-	     SDT_VAR(Settings, pf.npf.npf_water_curve_penalty,                 SLE_UINT,                     0, 0, (NPF_TILE_LENGTH / 4),     0,  100000, 0, STR_NULL,         NULL),
-	     SDT_VAR(Settings, pf.npf.npf_road_curve_penalty,                  SLE_UINT,                     0, 0, 1,                         0,  100000, 0, STR_NULL,         NULL),
-	     SDT_VAR(Settings, pf.npf.npf_crossing_penalty,                    SLE_UINT,                     0, 0, (  3 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
-	 SDT_CONDVAR(Settings, pf.npf.npf_road_drive_through_penalty,          SLE_UINT, 47, SL_MAX_VERSION, 0, 0, (  8 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
+	    SDT_BOOL(GameSettings, vehicle.never_expire_vehicles,                                       0,NN, false,                    STR_CONFIG_PATCHES_NEVER_EXPIRE_VEHICLES,  NULL),
+	     SDT_VAR(GameSettings, vehicle.max_trains,                  SLE_UINT16,                     0, 0,   500,     0,    5000, 0, STR_CONFIG_PATCHES_MAX_TRAINS,             RedrawScreen),
+	     SDT_VAR(GameSettings, vehicle.max_roadveh,                 SLE_UINT16,                     0, 0,   500,     0,    5000, 0, STR_CONFIG_PATCHES_MAX_ROADVEH,            RedrawScreen),
+	     SDT_VAR(GameSettings, vehicle.max_aircraft,                SLE_UINT16,                     0, 0,   200,     0,    5000, 0, STR_CONFIG_PATCHES_MAX_AIRCRAFT,           RedrawScreen),
+	     SDT_VAR(GameSettings, vehicle.max_ships,                   SLE_UINT16,                     0, 0,   300,     0,    5000, 0, STR_CONFIG_PATCHES_MAX_SHIPS,              RedrawScreen),
+	    SDT_BOOL(GameSettings, vehicle.servint_ispercent,                                           0, 0, false,                    STR_CONFIG_PATCHES_SERVINT_ISPERCENT,      CheckInterval),
+	     SDT_VAR(GameSettings, vehicle.servint_trains,              SLE_UINT16,                     0,D0,   150,     5,     800, 0, STR_CONFIG_PATCHES_SERVINT_TRAINS,         InValidateDetailsWindow),
+	     SDT_VAR(GameSettings, vehicle.servint_roadveh,             SLE_UINT16,                     0,D0,   150,     5,     800, 0, STR_CONFIG_PATCHES_SERVINT_ROADVEH,        InValidateDetailsWindow),
+	     SDT_VAR(GameSettings, vehicle.servint_ships,               SLE_UINT16,                     0,D0,   360,     5,     800, 0, STR_CONFIG_PATCHES_SERVINT_SHIPS,          InValidateDetailsWindow),
+	     SDT_VAR(GameSettings, vehicle.servint_aircraft,            SLE_UINT16,                     0,D0,   100,     5,     800, 0, STR_CONFIG_PATCHES_SERVINT_AIRCRAFT,       InValidateDetailsWindow),
+	    SDT_BOOL(GameSettings, order.no_servicing_if_no_breakdowns,                                 0, 0, false,                    STR_CONFIG_PATCHES_NOSERVICE,              NULL),
+	    SDT_BOOL(GameSettings, vehicle.wagon_speed_limits,                                          0,NN,  true,                    STR_CONFIG_PATCHES_WAGONSPEEDLIMITS,       UpdateConsists),
+	SDT_CONDBOOL(GameSettings, vehicle.disable_elrails,                         38, SL_MAX_VERSION, 0,NN, false,                    STR_CONFIG_PATCHES_DISABLE_ELRAILS,        SettingsDisableElrail),
+	 SDT_CONDVAR(GameSettings, vehicle.freight_trains,               SLE_UINT8, 39, SL_MAX_VERSION, 0,NN,     1,     1,     255, 1, STR_CONFIG_PATCHES_FREIGHT_TRAINS,         NULL),
+	SDT_CONDBOOL(GameSettings, order.timetabling,                               67, SL_MAX_VERSION, 0, 0,  true,                    STR_CONFIG_PATCHES_TIMETABLE_ALLOW,        NULL),
+	 SDT_CONDVAR(GameSettings, vehicle.plane_speed,                  SLE_UINT8, 90, SL_MAX_VERSION, 0, 0,     4,     1,       4, 0, STR_CONFIG_PATCHES_PLANE_SPEED,            NULL),
+	SDT_CONDBOOL(GameSettings, vehicle.dynamic_engines,                         95, SL_MAX_VERSION, 0,NN, false,                    STR_CONFIG_PATCHES_DYNAMIC_ENGINES,        NULL),
+
+	    SDT_BOOL(GameSettings, station.join_stations,                                               0, 0,  true,                    STR_CONFIG_PATCHES_JOINSTATIONS,           NULL),
+ SDTC_CONDBOOL(              gui.sg_full_load_any,                             0,             92, 0, 0 , true,                    STR_NULL,                                  NULL),
+	    SDT_BOOL(GameSettings, order.improved_load,                                                 0,NN,  true,                    STR_CONFIG_PATCHES_IMPROVEDLOAD,           NULL),
+	    SDT_BOOL(GameSettings, order.selectgoods,                                                   0, 0,  true,                    STR_CONFIG_PATCHES_SELECTGOODS,            NULL),
+ SDTC_CONDBOOL(              gui.sg_new_nonstop,                               0,             92, 0, 0, false,                    STR_NULL,                                  NULL),
+	    SDT_BOOL(GameSettings, station.nonuniform_stations,                                         0,NN,  true,                    STR_CONFIG_PATCHES_NONUNIFORM_STATIONS,    NULL),
+	     SDT_VAR(GameSettings, station.station_spread,               SLE_UINT8,                     0, 0,    12,     4,      64, 0, STR_CONFIG_PATCHES_STATION_SPREAD,         InvalidateStationBuildWindow),
+	    SDT_BOOL(GameSettings, order.serviceathelipad,                                              0, 0,  true,                    STR_CONFIG_PATCHES_SERVICEATHELIPAD,       NULL),
+	    SDT_BOOL(GameSettings, station.modified_catchment,                                          0, 0,  true,                    STR_CONFIG_PATCHES_CATCHMENT,              NULL),
+	SDT_CONDBOOL(GameSettings, order.gradual_loading,                           40, SL_MAX_VERSION, 0, 0,  true,                    STR_CONFIG_PATCHES_GRADUAL_LOADING,        NULL),
+	SDT_CONDBOOL(GameSettings, construction.road_stop_on_town_road,             47, SL_MAX_VERSION, 0, 0,  true,                    STR_CONFIG_PATCHES_STOP_ON_TOWN_ROAD,      NULL),
+	SDT_CONDBOOL(GameSettings, station.adjacent_stations,                       62, SL_MAX_VERSION, 0, 0,  true,                    STR_CONFIG_PATCHES_ADJACENT_STATIONS,      NULL),
+	SDT_CONDBOOL(GameSettings, economy.station_noise_level,                     96, SL_MAX_VERSION, 0, 0, false,                    STR_CONFIG_PATCHES_NOISE_LEVEL,            InvalidateTownViewWindow),
+
+	    SDT_BOOL(GameSettings, economy.inflation,                                                   0, 0,  true,                    STR_CONFIG_PATCHES_INFLATION,              NULL),
+	     SDT_VAR(GameSettings, construction.raw_industry_construction, SLE_UINT8,                   0,MS,     0,     0,       2, 0, STR_CONFIG_PATCHES_RAW_INDUSTRY_CONSTRUCTION_METHOD, InvalidateBuildIndustryWindow),
+	    SDT_BOOL(GameSettings, economy.multiple_industry_per_town,                                  0, 0, false,                    STR_CONFIG_PATCHES_MULTIPINDTOWN,          NULL),
+	    SDT_BOOL(GameSettings, economy.same_industry_close,                                         0, 0, false,                    STR_CONFIG_PATCHES_SAMEINDCLOSE,           NULL),
+	    SDT_BOOL(GameSettings, economy.bribe,                                                       0, 0,  true,                    STR_CONFIG_PATCHES_BRIBE,                  NULL),
+	SDT_CONDBOOL(GameSettings, economy.exclusive_rights,                        79, SL_MAX_VERSION, 0, 0,  true,                    STR_CONFIG_PATCHES_ALLOW_EXCLUSIVE,        NULL),
+	SDT_CONDBOOL(GameSettings, economy.give_money,                              79, SL_MAX_VERSION, 0, 0,  true,                    STR_CONFIG_PATCHES_ALLOW_GIVE_MONEY,       NULL),
+	     SDT_VAR(GameSettings, game_creation.snow_line_height,       SLE_UINT8,                     0, 0,     7,     2,      13, 0, STR_CONFIG_PATCHES_SNOWLINE_HEIGHT,        NULL),
+	    SDTC_VAR(              gui.colored_news_year,                SLE_INT32,                     0,NC,  2000,MIN_YEAR,MAX_YEAR,1,STR_CONFIG_PATCHES_COLORED_NEWS_YEAR,      NULL),
+	     SDT_VAR(GameSettings, game_creation.starting_year,          SLE_INT32,                     0,NC,  1950,MIN_YEAR,MAX_YEAR,1,STR_CONFIG_PATCHES_STARTING_YEAR,          NULL),
+	    SDTC_VAR(              gui.ending_year,                      SLE_INT32,                    0,NC|NO,2051,MIN_YEAR,MAX_YEAR,1,STR_CONFIG_PATCHES_ENDING_YEAR,            NULL),
+	    SDT_BOOL(GameSettings, economy.smooth_economy,                                              0, 0,  true,                    STR_CONFIG_PATCHES_SMOOTH_ECONOMY,         NULL),
+	    SDT_BOOL(GameSettings, economy.allow_shares,                                                0, 0, false,                    STR_CONFIG_PATCHES_ALLOW_SHARES,           NULL),
+	 SDT_CONDVAR(GameSettings, economy.town_growth_rate,             SLE_UINT8, 54, SL_MAX_VERSION, 0, MS,    2,     0,       4, 0, STR_CONFIG_PATCHES_TOWN_GROWTH,            NULL),
+	 SDT_CONDVAR(GameSettings, economy.larger_towns,                 SLE_UINT8, 54, SL_MAX_VERSION, 0, D0,    4,     0,     255, 1, STR_CONFIG_PATCHES_LARGER_TOWNS,           NULL),
+	 SDT_CONDVAR(GameSettings, economy.initial_city_size,            SLE_UINT8, 56, SL_MAX_VERSION, 0, 0,     2,     1,      10, 1, STR_CONFIG_PATCHES_CITY_SIZE_MULTIPLIER,   NULL),
+	SDT_CONDBOOL(GameSettings, economy.mod_road_rebuild,                        77, SL_MAX_VERSION, 0, 0, false,                    STR_CONFIG_MODIFIED_ROAD_REBUILD,          NULL),
+
+	    SDT_BOOL(GameSettings, ai.ainew_active,                                                     0, 0, false,                    STR_CONFIG_PATCHES_AINEW_ACTIVE,           AiNew_PatchActive_Warning),
+	    SDT_BOOL(GameSettings, ai.ai_in_multiplayer,                                                0, 0, false,                    STR_CONFIG_PATCHES_AI_IN_MULTIPLAYER,      Ai_In_Multiplayer_Warning),
+	    SDT_BOOL(GameSettings, ai.ai_disable_veh_train,                                             0, 0, false,                    STR_CONFIG_PATCHES_AI_BUILDS_TRAINS,       NULL),
+	    SDT_BOOL(GameSettings, ai.ai_disable_veh_roadveh,                                           0, 0, false,                    STR_CONFIG_PATCHES_AI_BUILDS_ROADVEH,      NULL),
+	    SDT_BOOL(GameSettings, ai.ai_disable_veh_aircraft,                                          0, 0, false,                    STR_CONFIG_PATCHES_AI_BUILDS_AIRCRAFT,     NULL),
+	    SDT_BOOL(GameSettings, ai.ai_disable_veh_ship,                                              0, 0, false,                    STR_CONFIG_PATCHES_AI_BUILDS_SHIPS,        NULL),
+
+	     SDT_VAR(GameSettings, vehicle.extend_vehicle_life,          SLE_UINT8,                     0, 0,     0,     0,     100, 0, STR_NULL,                                  NULL),
+	     SDT_VAR(GameSettings, economy.dist_local_authority,         SLE_UINT8,                     0, 0,    20,     5,      60, 0, STR_NULL,                                  NULL),
+	     SDT_VAR(GameSettings, pf.wait_oneway_signal,                SLE_UINT8,                     0, 0,    15,     2,     100, 0, STR_NULL,                                  NULL),
+	     SDT_VAR(GameSettings, pf.wait_twoway_signal,                SLE_UINT8,                     0, 0,    41,     2,     100, 0, STR_NULL,                                  NULL),
+	SDT_CONDLISTO(GameSettings, economy.town_noise_population, 3,   SLE_UINT16, 96, SL_MAX_VERSION, 0,D0, "800,2000,4000",          STR_NULL,                                  NULL, CheckNoiseToleranceLevel),
+
+	     SDT_VAR(GameSettings, pf.opf.pf_maxlength,                          SLE_UINT16,                     0, 0,  4096,                    64,   65535, 0, STR_NULL,         NULL),
+	     SDT_VAR(GameSettings, pf.opf.pf_maxdepth,                            SLE_UINT8,                     0, 0,    48,                     4,     255, 0, STR_NULL,         NULL),
+
+	     SDT_VAR(GameSettings, pf.npf.npf_max_search_nodes,                    SLE_UINT,                     0, 0, 10000,                   500,  100000, 0, STR_NULL,         NULL),
+	     SDT_VAR(GameSettings, pf.npf.npf_rail_firstred_penalty,               SLE_UINT,                     0, 0, ( 10 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
+	     SDT_VAR(GameSettings, pf.npf.npf_rail_firstred_exit_penalty,          SLE_UINT,                     0, 0, (100 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
+	     SDT_VAR(GameSettings, pf.npf.npf_rail_lastred_penalty,                SLE_UINT,                     0, 0, ( 10 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
+	     SDT_VAR(GameSettings, pf.npf.npf_rail_station_penalty,                SLE_UINT,                     0, 0, (  1 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
+	     SDT_VAR(GameSettings, pf.npf.npf_rail_slope_penalty,                  SLE_UINT,                     0, 0, (  1 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
+	     SDT_VAR(GameSettings, pf.npf.npf_rail_curve_penalty,                  SLE_UINT,                     0, 0, 1,                         0,  100000, 0, STR_NULL,         NULL),
+	     SDT_VAR(GameSettings, pf.npf.npf_rail_depot_reverse_penalty,          SLE_UINT,                     0, 0, ( 50 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
+	     SDT_VAR(GameSettings, pf.npf.npf_buoy_penalty,                        SLE_UINT,                     0, 0, (  2 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
+	     SDT_VAR(GameSettings, pf.npf.npf_water_curve_penalty,                 SLE_UINT,                     0, 0, (NPF_TILE_LENGTH / 4),     0,  100000, 0, STR_NULL,         NULL),
+	     SDT_VAR(GameSettings, pf.npf.npf_road_curve_penalty,                  SLE_UINT,                     0, 0, 1,                         0,  100000, 0, STR_NULL,         NULL),
+	     SDT_VAR(GameSettings, pf.npf.npf_crossing_penalty,                    SLE_UINT,                     0, 0, (  3 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
+	 SDT_CONDVAR(GameSettings, pf.npf.npf_road_drive_through_penalty,          SLE_UINT, 47, SL_MAX_VERSION, 0, 0, (  8 * NPF_TILE_LENGTH),   0,  100000, 0, STR_NULL,         NULL),
 
 
-	SDT_CONDBOOL(Settings, pf.yapf.disable_node_optimization,                        28, SL_MAX_VERSION, 0, 0, false,                                    STR_NULL,         NULL),
-	 SDT_CONDVAR(Settings, pf.yapf.max_search_nodes,                       SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 10000,                   500, 1000000, 0, STR_NULL,         NULL),
-	SDT_CONDBOOL(Settings, pf.yapf.rail_firstred_twoway_eol,                         28, SL_MAX_VERSION, 0, 0,  true,                                    STR_NULL,         NULL),
-	 SDT_CONDVAR(Settings, pf.yapf.rail_firstred_penalty,                  SLE_UINT, 28, SL_MAX_VERSION, 0, 0,    10 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
-	 SDT_CONDVAR(Settings, pf.yapf.rail_firstred_exit_penalty,             SLE_UINT, 28, SL_MAX_VERSION, 0, 0,   100 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
-	 SDT_CONDVAR(Settings, pf.yapf.rail_lastred_penalty,                   SLE_UINT, 28, SL_MAX_VERSION, 0, 0,    10 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
-	 SDT_CONDVAR(Settings, pf.yapf.rail_lastred_exit_penalty,              SLE_UINT, 28, SL_MAX_VERSION, 0, 0,   100 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
-	 SDT_CONDVAR(Settings, pf.yapf.rail_station_penalty,                   SLE_UINT, 28, SL_MAX_VERSION, 0, 0,    30 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
-	 SDT_CONDVAR(Settings, pf.yapf.rail_slope_penalty,                     SLE_UINT, 28, SL_MAX_VERSION, 0, 0,     2 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
-	 SDT_CONDVAR(Settings, pf.yapf.rail_curve45_penalty,                   SLE_UINT, 28, SL_MAX_VERSION, 0, 0,     1 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
-	 SDT_CONDVAR(Settings, pf.yapf.rail_curve90_penalty,                   SLE_UINT, 28, SL_MAX_VERSION, 0, 0,     6 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
-	 SDT_CONDVAR(Settings, pf.yapf.rail_depot_reverse_penalty,             SLE_UINT, 28, SL_MAX_VERSION, 0, 0,    50 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
-	 SDT_CONDVAR(Settings, pf.yapf.rail_crossing_penalty,                  SLE_UINT, 28, SL_MAX_VERSION, 0, 0,     3 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
-	 SDT_CONDVAR(Settings, pf.yapf.rail_look_ahead_max_signals,            SLE_UINT, 28, SL_MAX_VERSION, 0, 0,    10,                     1,     100, 0, STR_NULL,         NULL),
-	 SDT_CONDVAR(Settings, pf.yapf.rail_look_ahead_signal_p0,               SLE_INT, 28, SL_MAX_VERSION, 0, 0,   500,              -1000000, 1000000, 0, STR_NULL,         NULL),
-	 SDT_CONDVAR(Settings, pf.yapf.rail_look_ahead_signal_p1,               SLE_INT, 28, SL_MAX_VERSION, 0, 0,  -100,              -1000000, 1000000, 0, STR_NULL,         NULL),
-	 SDT_CONDVAR(Settings, pf.yapf.rail_look_ahead_signal_p2,               SLE_INT, 28, SL_MAX_VERSION, 0, 0,     5,              -1000000, 1000000, 0, STR_NULL,         NULL),
-	 SDT_CONDVAR(Settings, pf.yapf.rail_longer_platform_penalty,           SLE_UINT, 33, SL_MAX_VERSION, 0, 0,     8 * YAPF_TILE_LENGTH,  0,   20000, 0, STR_NULL,         NULL),
-	 SDT_CONDVAR(Settings, pf.yapf.rail_longer_platform_per_tile_penalty,  SLE_UINT, 33, SL_MAX_VERSION, 0, 0,     0 * YAPF_TILE_LENGTH,  0,   20000, 0, STR_NULL,         NULL),
-	 SDT_CONDVAR(Settings, pf.yapf.rail_shorter_platform_penalty,          SLE_UINT, 33, SL_MAX_VERSION, 0, 0,    40 * YAPF_TILE_LENGTH,  0,   20000, 0, STR_NULL,         NULL),
-	 SDT_CONDVAR(Settings, pf.yapf.rail_shorter_platform_per_tile_penalty, SLE_UINT, 33, SL_MAX_VERSION, 0, 0,     0 * YAPF_TILE_LENGTH,  0,   20000, 0, STR_NULL,         NULL),
-	 SDT_CONDVAR(Settings, pf.yapf.road_slope_penalty,                     SLE_UINT, 33, SL_MAX_VERSION, 0, 0,     2 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
-	 SDT_CONDVAR(Settings, pf.yapf.road_curve_penalty,                     SLE_UINT, 33, SL_MAX_VERSION, 0, 0,     1 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
-	 SDT_CONDVAR(Settings, pf.yapf.road_crossing_penalty,                  SLE_UINT, 33, SL_MAX_VERSION, 0, 0,     3 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
-	 SDT_CONDVAR(Settings, pf.yapf.road_stop_penalty,                      SLE_UINT, 47, SL_MAX_VERSION, 0, 0,     8 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
+	SDT_CONDBOOL(GameSettings, pf.yapf.disable_node_optimization,                        28, SL_MAX_VERSION, 0, 0, false,                                    STR_NULL,         NULL),
+	 SDT_CONDVAR(GameSettings, pf.yapf.max_search_nodes,                       SLE_UINT, 28, SL_MAX_VERSION, 0, 0, 10000,                   500, 1000000, 0, STR_NULL,         NULL),
+	SDT_CONDBOOL(GameSettings, pf.yapf.rail_firstred_twoway_eol,                         28, SL_MAX_VERSION, 0, 0,  true,                                    STR_NULL,         NULL),
+	 SDT_CONDVAR(GameSettings, pf.yapf.rail_firstred_penalty,                  SLE_UINT, 28, SL_MAX_VERSION, 0, 0,    10 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
+	 SDT_CONDVAR(GameSettings, pf.yapf.rail_firstred_exit_penalty,             SLE_UINT, 28, SL_MAX_VERSION, 0, 0,   100 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
+	 SDT_CONDVAR(GameSettings, pf.yapf.rail_lastred_penalty,                   SLE_UINT, 28, SL_MAX_VERSION, 0, 0,    10 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
+	 SDT_CONDVAR(GameSettings, pf.yapf.rail_lastred_exit_penalty,              SLE_UINT, 28, SL_MAX_VERSION, 0, 0,   100 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
+	 SDT_CONDVAR(GameSettings, pf.yapf.rail_station_penalty,                   SLE_UINT, 28, SL_MAX_VERSION, 0, 0,    30 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
+	 SDT_CONDVAR(GameSettings, pf.yapf.rail_slope_penalty,                     SLE_UINT, 28, SL_MAX_VERSION, 0, 0,     2 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
+	 SDT_CONDVAR(GameSettings, pf.yapf.rail_curve45_penalty,                   SLE_UINT, 28, SL_MAX_VERSION, 0, 0,     1 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
+	 SDT_CONDVAR(GameSettings, pf.yapf.rail_curve90_penalty,                   SLE_UINT, 28, SL_MAX_VERSION, 0, 0,     6 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
+	 SDT_CONDVAR(GameSettings, pf.yapf.rail_depot_reverse_penalty,             SLE_UINT, 28, SL_MAX_VERSION, 0, 0,    50 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
+	 SDT_CONDVAR(GameSettings, pf.yapf.rail_crossing_penalty,                  SLE_UINT, 28, SL_MAX_VERSION, 0, 0,     3 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
+	 SDT_CONDVAR(GameSettings, pf.yapf.rail_look_ahead_max_signals,            SLE_UINT, 28, SL_MAX_VERSION, 0, 0,    10,                     1,     100, 0, STR_NULL,         NULL),
+	 SDT_CONDVAR(GameSettings, pf.yapf.rail_look_ahead_signal_p0,               SLE_INT, 28, SL_MAX_VERSION, 0, 0,   500,              -1000000, 1000000, 0, STR_NULL,         NULL),
+	 SDT_CONDVAR(GameSettings, pf.yapf.rail_look_ahead_signal_p1,               SLE_INT, 28, SL_MAX_VERSION, 0, 0,  -100,              -1000000, 1000000, 0, STR_NULL,         NULL),
+	 SDT_CONDVAR(GameSettings, pf.yapf.rail_look_ahead_signal_p2,               SLE_INT, 28, SL_MAX_VERSION, 0, 0,     5,              -1000000, 1000000, 0, STR_NULL,         NULL),
+	 SDT_CONDVAR(GameSettings, pf.yapf.rail_longer_platform_penalty,           SLE_UINT, 33, SL_MAX_VERSION, 0, 0,     8 * YAPF_TILE_LENGTH,  0,   20000, 0, STR_NULL,         NULL),
+	 SDT_CONDVAR(GameSettings, pf.yapf.rail_longer_platform_per_tile_penalty,  SLE_UINT, 33, SL_MAX_VERSION, 0, 0,     0 * YAPF_TILE_LENGTH,  0,   20000, 0, STR_NULL,         NULL),
+	 SDT_CONDVAR(GameSettings, pf.yapf.rail_shorter_platform_penalty,          SLE_UINT, 33, SL_MAX_VERSION, 0, 0,    40 * YAPF_TILE_LENGTH,  0,   20000, 0, STR_NULL,         NULL),
+	 SDT_CONDVAR(GameSettings, pf.yapf.rail_shorter_platform_per_tile_penalty, SLE_UINT, 33, SL_MAX_VERSION, 0, 0,     0 * YAPF_TILE_LENGTH,  0,   20000, 0, STR_NULL,         NULL),
+	 SDT_CONDVAR(GameSettings, pf.yapf.road_slope_penalty,                     SLE_UINT, 33, SL_MAX_VERSION, 0, 0,     2 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
+	 SDT_CONDVAR(GameSettings, pf.yapf.road_curve_penalty,                     SLE_UINT, 33, SL_MAX_VERSION, 0, 0,     1 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
+	 SDT_CONDVAR(GameSettings, pf.yapf.road_crossing_penalty,                  SLE_UINT, 33, SL_MAX_VERSION, 0, 0,     3 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
+	 SDT_CONDVAR(GameSettings, pf.yapf.road_stop_penalty,                      SLE_UINT, 47, SL_MAX_VERSION, 0, 0,     8 * YAPF_TILE_LENGTH,  0, 1000000, 0, STR_NULL,         NULL),
 
-	 SDT_CONDVAR(Settings, game_creation.land_generator,                  SLE_UINT8, 30, SL_MAX_VERSION, 0,MS,     1,                     0,       1, 0, STR_CONFIG_PATCHES_LAND_GENERATOR,        NULL),
-	 SDT_CONDVAR(Settings, game_creation.oil_refinery_limit,              SLE_UINT8, 30, SL_MAX_VERSION, 0, 0,    32,                    12,      48, 0, STR_CONFIG_PATCHES_OIL_REF_EDGE_DISTANCE, NULL),
-	 SDT_CONDVAR(Settings, game_creation.tgen_smoothness,                 SLE_UINT8, 30, SL_MAX_VERSION, 0,MS,     1,                     0,       3, 0, STR_CONFIG_PATCHES_ROUGHNESS_OF_TERRAIN,  NULL),
-	 SDT_CONDVAR(Settings, game_creation.generation_seed,                SLE_UINT32, 30, SL_MAX_VERSION, 0, 0,      GENERATE_NEW_SEED, 0, UINT32_MAX, 0, STR_NULL,                                 NULL),
-	 SDT_CONDVAR(Settings, game_creation.tree_placer,                     SLE_UINT8, 30, SL_MAX_VERSION, 0,MS,     2,                     0,       2, 0, STR_CONFIG_PATCHES_TREE_PLACER,           NULL),
-	     SDT_VAR(Settings, game_creation.heightmap_rotation,              SLE_UINT8,                     S,MS,     0,                     0,       1, 0, STR_CONFIG_PATCHES_HEIGHTMAP_ROTATION,    NULL),
-	     SDT_VAR(Settings, game_creation.se_flat_world_height,            SLE_UINT8,                     S, 0,     0,                     0,      15, 0, STR_CONFIG_PATCHES_SE_FLAT_WORLD_HEIGHT,  NULL),
+	 SDT_CONDVAR(GameSettings, game_creation.land_generator,                  SLE_UINT8, 30, SL_MAX_VERSION, 0,MS,     1,                     0,       1, 0, STR_CONFIG_PATCHES_LAND_GENERATOR,        NULL),
+	 SDT_CONDVAR(GameSettings, game_creation.oil_refinery_limit,              SLE_UINT8, 30, SL_MAX_VERSION, 0, 0,    32,                    12,      48, 0, STR_CONFIG_PATCHES_OIL_REF_EDGE_DISTANCE, NULL),
+	 SDT_CONDVAR(GameSettings, game_creation.tgen_smoothness,                 SLE_UINT8, 30, SL_MAX_VERSION, 0,MS,     1,                     0,       3, 0, STR_CONFIG_PATCHES_ROUGHNESS_OF_TERRAIN,  NULL),
+	 SDT_CONDVAR(GameSettings, game_creation.generation_seed,                SLE_UINT32, 30, SL_MAX_VERSION, 0, 0,      GENERATE_NEW_SEED, 0, UINT32_MAX, 0, STR_NULL,                                 NULL),
+	 SDT_CONDVAR(GameSettings, game_creation.tree_placer,                     SLE_UINT8, 30, SL_MAX_VERSION, 0,MS,     2,                     0,       2, 0, STR_CONFIG_PATCHES_TREE_PLACER,           NULL),
+	     SDT_VAR(GameSettings, game_creation.heightmap_rotation,              SLE_UINT8,                     S,MS,     0,                     0,       1, 0, STR_CONFIG_PATCHES_HEIGHTMAP_ROTATION,    NULL),
+	     SDT_VAR(GameSettings, game_creation.se_flat_world_height,            SLE_UINT8,                     S, 0,     0,                     0,      15, 0, STR_CONFIG_PATCHES_SE_FLAT_WORLD_HEIGHT,  NULL),
 
- SDT_CONDOMANY(Settings, gui.currency,                                  SLE_UINT8, 97, SL_MAX_VERSION, N, 0, 0, CUSTOM_CURRENCY_ID, "GBP|USD|EUR|YEN|ATS|BEF|CHF|CZK|DEM|DKK|ESP|FIM|FRF|GRD|HUF|ISK|ITL|NLG|NOK|PLN|ROL|RUR|SIT|SEK|YTL|SKK|BRR|custom", STR_NULL, NULL, NULL),
- SDT_CONDOMANY(Settings, gui.units,                                     SLE_UINT8, 97, SL_MAX_VERSION, N, 0, 1, 2, "imperial|metric|si", STR_NULL, NULL, NULL),
+	     SDT_VAR(GameSettings, game_creation.map_x,                           SLE_UINT8,                     S, 0,     8,                     6,      11, 0, STR_CONFIG_PATCHES_MAP_X,                 NULL),
+	     SDT_VAR(GameSettings, game_creation.map_y,                           SLE_UINT8,                     S, 0,     8,                     6,      11, 0, STR_CONFIG_PATCHES_MAP_Y,                 NULL),
+
+ SDT_CONDOMANY(GameSettings, locale.currency,                               SLE_UINT8, 97, SL_MAX_VERSION, N, 0, 0, CUSTOM_CURRENCY_ID, "GBP|USD|EUR|YEN|ATS|BEF|CHF|CZK|DEM|DKK|ESP|FIM|FRF|GRD|HUF|ISK|ITL|NLG|NOK|PLN|ROL|RUR|SIT|SEK|YTL|SKK|BRR|custom", STR_NULL, NULL, NULL),
+ SDT_CONDOMANY(GameSettings, locale.units,                                  SLE_UINT8, 97, SL_MAX_VERSION, N, 0, 1, 2, "imperial|metric|si", STR_NULL, NULL, NULL),
 
 	/***************************************************************************/
 	/* Unsaved patch variables. */
- SDT_OMANY(Settings, gui.autosave,               SLE_UINT8, S, 0, 1, 4, "off|monthly|quarterly|half year|yearly", STR_NULL, NULL,               NULL),
-	SDT_BOOL(Settings, gui.vehicle_speed,                     S, 0,  true,                        STR_CONFIG_PATCHES_VEHICLESPEED,                NULL),
-	SDT_BOOL(Settings, gui.status_long_date,                  S, 0,  true,                        STR_CONFIG_PATCHES_LONGDATE,                    NULL),
-	SDT_BOOL(Settings, gui.show_finances,                     S, 0,  true,                        STR_CONFIG_PATCHES_SHOWFINANCES,                NULL),
-	SDT_BOOL(Settings, gui.autoscroll,                        S, 0, false,                        STR_CONFIG_PATCHES_AUTOSCROLL,                  NULL),
-	SDT_BOOL(Settings, gui.reverse_scroll,                    S, 0, false,                        STR_CONFIG_PATCHES_REVERSE_SCROLLING,           NULL),
-	SDT_BOOL(Settings, gui.smooth_scroll,                     S, 0, false,                        STR_CONFIG_PATCHES_SMOOTH_SCROLLING,            NULL),
-	SDT_BOOL(Settings, gui.measure_tooltip,                   S, 0, false,                        STR_CONFIG_PATCHES_MEASURE_TOOLTIP,             NULL),
-	 SDT_VAR(Settings, gui.errmsg_duration,        SLE_UINT8, S, 0,     5,        0,       20, 0, STR_CONFIG_PATCHES_ERRMSG_DURATION,             NULL),
-	 SDT_VAR(Settings, gui.toolbar_pos,            SLE_UINT8, S,MS,     0,        0,        2, 0, STR_CONFIG_PATCHES_TOOLBAR_POS,                 v_PositionMainToolbar),
-	 SDT_VAR(Settings, gui.window_snap_radius,     SLE_UINT8, S,D0,    10,        1,       32, 0, STR_CONFIG_PATCHES_SNAP_RADIUS,                 NULL),
-	SDT_BOOL(Settings, gui.population_in_label,               S, 0,  true,                        STR_CONFIG_PATCHES_POPULATION_IN_LABEL,         PopulationInLabelActive),
-	SDT_BOOL(Settings, gui.link_terraform_toolbar,            S, 0, false,                        STR_CONFIG_PATCHES_LINK_TERRAFORM_TOOLBAR,      NULL),
-	 SDT_VAR(Settings, gui.liveries,               SLE_UINT8, S,MS,     2,        0,        2, 0, STR_CONFIG_PATCHES_LIVERIES,                    RedrawScreen),
-	SDT_BOOL(Settings, gui.prefer_teamchat,                   S, 0, false,                        STR_CONFIG_PATCHES_PREFER_TEAMCHAT,             NULL),
-	 SDT_VAR(Settings, gui.scrollwheel_scrolling,  SLE_UINT8, S,MS,     0,        0,        2, 0, STR_CONFIG_PATCHES_SCROLLWHEEL_SCROLLING,       NULL),
-	 SDT_VAR(Settings, gui.scrollwheel_multiplier, SLE_UINT8, S, 0,     5,        1,       15, 1, STR_CONFIG_PATCHES_SCROLLWHEEL_MULTIPLIER,      NULL),
-	SDT_BOOL(Settings, gui.pause_on_newgame,                  S, 0, false,                        STR_CONFIG_PATCHES_PAUSE_ON_NEW_GAME,           NULL),
-	 SDT_VAR(Settings, gui.advanced_vehicle_list,  SLE_UINT8, S,MS,     1,        0,        2, 0, STR_CONFIG_PATCHES_ADVANCED_VEHICLE_LISTS,      NULL),
-	SDT_BOOL(Settings, gui.timetable_in_ticks,                S, 0, false,                        STR_CONFIG_PATCHES_TIMETABLE_IN_TICKS,          NULL),
-	 SDT_VAR(Settings, gui.loading_indicators,     SLE_UINT8, S,MS,     1,        0,        2, 0, STR_CONFIG_PATCHES_LOADING_INDICATORS,          RedrawScreen),
-	 SDT_VAR(Settings, gui.default_rail_type,      SLE_UINT8, S,MS,     4,        0,        6, 0, STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE,           NULL),
-	SDT_BOOL(Settings, gui.enable_signal_gui,                 S, 0, false,                        STR_CONFIG_PATCHES_ENABLE_SIGNAL_GUI,           CloseSignalGUI),
-	 SDT_VAR(Settings, gui.drag_signals_density,   SLE_UINT8, S, 0,     4,        1,       20, 0, STR_CONFIG_PATCHES_DRAG_SIGNALS_DENSITY,        DragSignalsDensityChanged),
-	 SDT_VAR(Settings, gui.semaphore_build_before, SLE_INT32, S, NC, 1975, MIN_YEAR, MAX_YEAR, 1, STR_CONFIG_PATCHES_SEMAPHORE_BUILD_BEFORE_DATE, ResetSignalVariant),
-	SDT_BOOL(Settings, gui.train_income_warn,                 S, 0,  true,                        STR_CONFIG_PATCHES_WARN_INCOME_LESS,            NULL),
-	 SDT_VAR(Settings, gui.order_review_system,    SLE_UINT8, S,MS,     2,        0,        2, 0, STR_CONFIG_PATCHES_ORDER_REVIEW,                NULL),
-	SDT_BOOL(Settings, gui.lost_train_warn,                   S, 0,  true,                        STR_CONFIG_PATCHES_WARN_LOST_TRAIN,             NULL),
-	SDT_BOOL(Settings, gui.autorenew,                         S, 0, false,                        STR_CONFIG_PATCHES_AUTORENEW_VEHICLE,           EngineRenewUpdate),
-	 SDT_VAR(Settings, gui.autorenew_months,       SLE_INT16, S, 0,     6,      -12,       12, 0, STR_CONFIG_PATCHES_AUTORENEW_MONTHS,            EngineRenewMonthsUpdate),
-	 SDT_VAR(Settings, gui.autorenew_money,         SLE_UINT, S,CR,100000,        0,  2000000, 0, STR_CONFIG_PATCHES_AUTORENEW_MONEY,             EngineRenewMoneyUpdate),
-	SDT_BOOL(Settings, gui.always_build_infrastructure,       S, 0, false,                        STR_CONFIG_PATCHES_ALWAYS_BUILD_INFRASTRUCTURE, RedrawScreen),
-	SDT_BOOL(Settings, gui.new_nonstop,                       S, 0, false,                        STR_CONFIG_PATCHES_NEW_NONSTOP,                 NULL),
-	SDT_BOOL(Settings, gui.keep_all_autosave,                 S, 0, false,                        STR_NULL,                                       NULL),
-	SDT_BOOL(Settings, gui.autosave_on_exit,                  S, 0, false,                        STR_NULL,                                       NULL),
-	 SDT_VAR(Settings, gui.max_num_autosaves,      SLE_UINT8, S, 0,    16,        0,      255, 0, STR_NULL,                                       NULL),
-	SDT_BOOL(Settings, gui.bridge_pillars,                    S, 0,  true,                        STR_NULL,                                       NULL),
-	SDT_BOOL(Settings, gui.auto_euro,                         S, 0,  true,                        STR_NULL,                                       NULL),
+	SDTC_OMANY(gui.autosave,                  SLE_UINT8, S,  0, 1, 4, "off|monthly|quarterly|half year|yearly", STR_NULL,                     NULL),
+	 SDTC_BOOL(gui.vehicle_speed,                        S,  0,  true,                        STR_CONFIG_PATCHES_VEHICLESPEED,                NULL),
+	 SDTC_BOOL(gui.status_long_date,                     S,  0,  true,                        STR_CONFIG_PATCHES_LONGDATE,                    NULL),
+	 SDTC_BOOL(gui.show_finances,                        S,  0,  true,                        STR_CONFIG_PATCHES_SHOWFINANCES,                NULL),
+	 SDTC_BOOL(gui.autoscroll,                           S,  0, false,                        STR_CONFIG_PATCHES_AUTOSCROLL,                  NULL),
+	 SDTC_BOOL(gui.reverse_scroll,                       S,  0, false,                        STR_CONFIG_PATCHES_REVERSE_SCROLLING,           NULL),
+	 SDTC_BOOL(gui.smooth_scroll,                        S,  0, false,                        STR_CONFIG_PATCHES_SMOOTH_SCROLLING,            NULL),
+	 SDTC_BOOL(gui.measure_tooltip,                      S,  0, false,                        STR_CONFIG_PATCHES_MEASURE_TOOLTIP,             NULL),
+	  SDTC_VAR(gui.errmsg_duration,           SLE_UINT8, S,  0,     5,        0,       20, 0, STR_CONFIG_PATCHES_ERRMSG_DURATION,             NULL),
+	  SDTC_VAR(gui.toolbar_pos,               SLE_UINT8, S, MS,     0,        0,        2, 0, STR_CONFIG_PATCHES_TOOLBAR_POS,                 v_PositionMainToolbar),
+	  SDTC_VAR(gui.window_snap_radius,        SLE_UINT8, S, D0,    10,        1,       32, 0, STR_CONFIG_PATCHES_SNAP_RADIUS,                 NULL),
+	 SDTC_BOOL(gui.population_in_label,                  S,  0,  true,                        STR_CONFIG_PATCHES_POPULATION_IN_LABEL,         PopulationInLabelActive),
+	 SDTC_BOOL(gui.link_terraform_toolbar,               S,  0, false,                        STR_CONFIG_PATCHES_LINK_TERRAFORM_TOOLBAR,      NULL),
+	  SDTC_VAR(gui.liveries,                  SLE_UINT8, S, MS,     2,        0,        2, 0, STR_CONFIG_PATCHES_LIVERIES,                    RedrawScreen),
+	 SDTC_BOOL(gui.prefer_teamchat,                      S,  0, false,                        STR_CONFIG_PATCHES_PREFER_TEAMCHAT,             NULL),
+	  SDTC_VAR(gui.scrollwheel_scrolling,     SLE_UINT8, S, MS,     0,        0,        2, 0, STR_CONFIG_PATCHES_SCROLLWHEEL_SCROLLING,       NULL),
+	  SDTC_VAR(gui.scrollwheel_multiplier,    SLE_UINT8, S,  0,     5,        1,       15, 1, STR_CONFIG_PATCHES_SCROLLWHEEL_MULTIPLIER,      NULL),
+	 SDTC_BOOL(gui.pause_on_newgame,                     S,  0, false,                        STR_CONFIG_PATCHES_PAUSE_ON_NEW_GAME,           NULL),
+	  SDTC_VAR(gui.advanced_vehicle_list,     SLE_UINT8, S, MS,     1,        0,        2, 0, STR_CONFIG_PATCHES_ADVANCED_VEHICLE_LISTS,      NULL),
+	 SDTC_BOOL(gui.timetable_in_ticks,                   S,  0, false,                        STR_CONFIG_PATCHES_TIMETABLE_IN_TICKS,          NULL),
+	  SDTC_VAR(gui.loading_indicators,        SLE_UINT8, S, MS,     1,        0,        2, 0, STR_CONFIG_PATCHES_LOADING_INDICATORS,          RedrawScreen),
+	  SDTC_VAR(gui.default_rail_type,         SLE_UINT8, S, MS,     4,        0,        6, 0, STR_CONFIG_PATCHES_DEFAULT_RAIL_TYPE,           NULL),
+	 SDTC_BOOL(gui.enable_signal_gui,                    S,  0, false,                        STR_CONFIG_PATCHES_ENABLE_SIGNAL_GUI,           CloseSignalGUI),
+	  SDTC_VAR(gui.drag_signals_density,      SLE_UINT8, S,  0,     4,        1,       20, 0, STR_CONFIG_PATCHES_DRAG_SIGNALS_DENSITY,        DragSignalsDensityChanged),
+	  SDTC_VAR(gui.semaphore_build_before,    SLE_INT32, S, NC,  1975, MIN_YEAR, MAX_YEAR, 1, STR_CONFIG_PATCHES_SEMAPHORE_BUILD_BEFORE_DATE, ResetSignalVariant),
+	 SDTC_BOOL(gui.train_income_warn,                    S,  0,  true,                        STR_CONFIG_PATCHES_WARN_INCOME_LESS,            NULL),
+	  SDTC_VAR(gui.order_review_system,       SLE_UINT8, S, MS,     2,        0,        2, 0, STR_CONFIG_PATCHES_ORDER_REVIEW,                NULL),
+	 SDTC_BOOL(gui.lost_train_warn,                      S,  0,  true,                        STR_CONFIG_PATCHES_WARN_LOST_TRAIN,             NULL),
+	 SDTC_BOOL(gui.autorenew,                            S,  0, false,                        STR_CONFIG_PATCHES_AUTORENEW_VEHICLE,           EngineRenewUpdate),
+	  SDTC_VAR(gui.autorenew_months,          SLE_INT16, S,  0,     6,      -12,       12, 0, STR_CONFIG_PATCHES_AUTORENEW_MONTHS,            EngineRenewMonthsUpdate),
+	  SDTC_VAR(gui.autorenew_money,            SLE_UINT, S, CR,100000,        0,  2000000, 0, STR_CONFIG_PATCHES_AUTORENEW_MONEY,             EngineRenewMoneyUpdate),
+	 SDTC_BOOL(gui.always_build_infrastructure,          S,  0, false,                        STR_CONFIG_PATCHES_ALWAYS_BUILD_INFRASTRUCTURE, RedrawScreen),
+	 SDTC_BOOL(gui.new_nonstop,                          S,  0, false,                        STR_CONFIG_PATCHES_NEW_NONSTOP,                 NULL),
+	 SDTC_BOOL(gui.keep_all_autosave,                    S,  0, false,                        STR_NULL,                                       NULL),
+	 SDTC_BOOL(gui.autosave_on_exit,                     S,  0, false,                        STR_NULL,                                       NULL),
+	  SDTC_VAR(gui.max_num_autosaves,         SLE_UINT8, S,  0,    16,        0,      255, 0, STR_NULL,                                       NULL),
+	 SDTC_BOOL(gui.bridge_pillars,                       S,  0,  true,                        STR_NULL,                                       NULL),
+	 SDTC_BOOL(gui.auto_euro,                            S,  0,  true,                        STR_NULL,                                       NULL),
+	  SDTC_VAR(gui.news_message_timeout,      SLE_UINT8, S,  0,     2,        1,      255, 0, STR_NULL,                                       NULL),
 
-	 SDT_VAR(Settings, game_creation.map_x,        SLE_UINT8, S, 0,     8,        6,       11, 0, STR_CONFIG_PATCHES_MAP_X,                       NULL),
-	 SDT_VAR(Settings, game_creation.map_y,        SLE_UINT8, S, 0,     8,        6,       11, 0, STR_CONFIG_PATCHES_MAP_Y,                       NULL),
+#ifdef ENABLE_NETWORK
+	  SDTC_VAR(network.sync_freq,            SLE_UINT16,C|S,NO,   100,        0,      100, 0, STR_NULL,                                       NULL),
+	  SDTC_VAR(network.frame_freq,            SLE_UINT8,C|S,NO,     0,        0,      100, 0, STR_NULL,                                       NULL),
+	  SDTC_VAR(network.max_join_time,        SLE_UINT16, S, NO,   500,        0,    32000, 0, STR_NULL,                                       NULL),
+	 SDTC_BOOL(network.pause_on_join,                    S, NO,  true,                        STR_NULL,                                       NULL),
+	  SDTC_STR(network.server_bind_ip,         SLE_STRB, S, NO, "0.0.0.0",                    STR_NULL,                                       NULL),
+	  SDTC_VAR(network.server_port,          SLE_UINT16, S, NO,NETWORK_DEFAULT_PORT,0,65535,0,STR_NULL,                                       NULL),
+	 SDTC_BOOL(network.server_advertise,                 S, NO, false,                        STR_NULL,                                       NULL),
+	  SDTC_VAR(network.lan_internet,          SLE_UINT8, S, NO,     0,        0,        1, 0, STR_NULL,                                       NULL),
+	  SDTC_STR(network.player_name,            SLE_STRB, S,  0,  NULL,                        STR_NULL,                                       UpdatePlayerName),
+	  SDTC_STR(network.server_password,        SLE_STRB, S, NO,  NULL,                        STR_NULL,                                       UpdateServerPassword),
+	  SDTC_STR(network.rcon_password,          SLE_STRB, S, NO,  NULL,                        STR_NULL,                                       UpdateRconPassword),
+	  SDTC_STR(network.default_company_pass,   SLE_STRB, S,  0,  NULL,                        STR_NULL,                                       NULL),
+	  SDTC_STR(network.server_name,            SLE_STRB, S, NO,  NULL,                        STR_NULL,                                       NULL),
+	  SDTC_STR(network.connect_to_ip,          SLE_STRB, S,  0,  NULL,                        STR_NULL,                                       NULL),
+	  SDTC_STR(network.network_id,             SLE_STRB, S, NO,  NULL,                        STR_NULL,                                       NULL),
+	 SDTC_BOOL(network.autoclean_companies,              S, NO, false,                        STR_NULL,                                       NULL),
+	  SDTC_VAR(network.autoclean_unprotected, SLE_UINT8, S, NO,    12,     0,          60, 0, STR_NULL,                                       NULL),
+	  SDTC_VAR(network.autoclean_protected,   SLE_UINT8, S, NO,    36,     0,         180, 0, STR_NULL,                                       NULL),
+	  SDTC_VAR(network.max_companies,         SLE_UINT8, S, NO,     8,     1, MAX_PLAYERS, 0, STR_NULL,                                       NULL),
+	  SDTC_VAR(network.max_clients,           SLE_UINT8, S, NO,    10,     2, MAX_CLIENTS, 0, STR_NULL,                                       NULL),
+	  SDTC_VAR(network.max_spectators,        SLE_UINT8, S, NO,    10,     0, MAX_CLIENTS, 0, STR_NULL,                                       NULL),
+	  SDTC_VAR(network.restart_game_year,     SLE_INT32, S,D0|NO|NC,0, MIN_YEAR, MAX_YEAR, 1, STR_NULL,                                       NULL),
+	  SDTC_VAR(network.min_players,           SLE_UINT8, S, NO,     0,     0,        10,   0, STR_NULL,                                       UpdateMinPlayers),
+	SDTC_OMANY(network.server_lang,           SLE_UINT8, S, NO,     0,    35, "ANY|ENGLISH|GERMAN|FRENCH|BRAZILIAN|BULGARIAN|CHINESE|CZECH|DANISH|DUTCH|ESPERANTO|FINNISH|HUNGARIAN|ICELANDIC|ITALIAN|JAPANESE|KOREAN|LITHUANIAN|NORWEGIAN|POLISH|PORTUGUESE|ROMANIAN|RUSSIAN|SLOVAK|SLOVENIAN|SPANISH|SWEDISH|TURKISH|UKRAINIAN|AFRIKAANS|CROATIAN|CATALAN|ESTONIAN|GALICIAN|GREEK|LATVIAN", STR_NULL, NULL),
+	 SDTC_BOOL(network.reload_cfg,                       S, NO, false,                        STR_NULL,                                       NULL),
+	  SDTC_STR(network.last_host,              SLE_STRB, S,  0, "0.0.0.0",                    STR_NULL,                                       NULL),
+	  SDTC_VAR(network.last_port,            SLE_UINT16, S,  0,     0,     0,  UINT16_MAX, 0, STR_NULL,                                       NULL),
+#endif /* ENABLE_NETWORK */
 
 	/*
 	 * Since the network code (CmdChangePatchSetting and friends) use the index in this array to decide
@@ -1767,7 +1828,7 @@
 
 #ifdef __APPLE__
 	/* We might need to emulate a right mouse button on mac */
-	     SDT_VAR(Settings, gui.right_mouse_btn_emulation, SLE_UINT8, S, MS, 0, 0, 2, 0, STR_CONFIG_PATCHES_RIGHT_MOUSE_BTN_EMU, NULL),
+	 SDTC_VAR(gui.right_mouse_btn_emulation, SLE_UINT8, S, MS, 0, 0, 2, 0, STR_CONFIG_PATCHES_RIGHT_MOUSE_BTN_EMU, NULL),
 #endif
 
 	SDT_END()
@@ -1793,26 +1854,37 @@
 #undef NO
 #undef CR
 
+/**
+ * Prepare for reading and old diff_custom by zero-ing the memory.
+ */
 static void PrepareOldDiffCustom()
 {
 	memset(_old_diff_custom, 0, sizeof(_old_diff_custom));
 }
 
-static void HandleOldDiffCustom()
+/**
+ * Reading of the old diff_custom array and transforming it to the new format.
+ * @param savegame is it read from the config or savegame. In the latter case
+ *                 we are sure there is an array; in the former case we have
+ *                 to check that.
+ */
+static void HandleOldDiffCustom(bool savegame)
 {
-	uint options_to_load = GAME_DIFFICULTY_NUM - (CheckSavegameVersion(4) ? 1 : 0);
+	uint options_to_load = GAME_DIFFICULTY_NUM - ((savegame && CheckSavegameVersion(4)) ? 1 : 0);
 
-	/* If we did read to old_diff_custom, then at least one value must be non 0. */
-	bool old_diff_custom_used = false;
-	for (uint i = 0; i < options_to_load && !old_diff_custom_used; i++) {
-		old_diff_custom_used = (_old_diff_custom[i] != 0);
+	if (!savegame) {
+		/* If we did read to old_diff_custom, then at least one value must be non 0. */
+		bool old_diff_custom_used = false;
+		for (uint i = 0; i < options_to_load && !old_diff_custom_used; i++) {
+			old_diff_custom_used = (_old_diff_custom[i] != 0);
+		}
+
+		if (!old_diff_custom_used) return;
 	}
 
-	if (!old_diff_custom_used) return;
-
 	for (uint i = 0; i < options_to_load; i++) {
 		const SettingDesc *sd = &_patch_settings[i];
-		void *var = GetVariableAddress((_game_mode == GM_MENU) ? &_settings_newgame : &_settings, &sd->save);
+		void *var = GetVariableAddress(savegame ? &_settings_game : &_settings_newgame, &sd->save);
 		Write_ValidateSetting(var, sd, (int32)((i == 4 ? 1000 : 1) * _old_diff_custom[i]));
 	}
 }
@@ -1983,15 +2055,10 @@
 	proc(ini, (const SettingDesc*)_win32_settings,   "win32", NULL);
 #endif /* WIN32 */
 
-	PrepareOldDiffCustom();
-	proc(ini, _gameopt_settings, "gameopt",  &_settings_newgame);
-	HandleOldDiffCustom();
-
 	proc(ini, _patch_settings,   "patches",  &_settings_newgame);
 	proc(ini, _currency_settings,"currency", &_custom_currency);
 
 #ifdef ENABLE_NETWORK
-	proc(ini, (const SettingDesc*)_network_settings, "network", NULL);
 	proc_list(ini, "servers", _network_host_list, lengthof(_network_host_list), NULL);
 	proc_list(ini, "bans",    _network_ban_list,  lengthof(_network_ban_list), NULL);
 #endif /* ENABLE_NETWORK */
@@ -2002,6 +2069,11 @@
 {
 	IniFile *ini = ini_load(_config_file);
 	ResetCurrencies(false); // Initialize the array of curencies, without preserving the custom one
+
+	PrepareOldDiffCustom();
+	ini_load_settings(ini, _gameopt_settings, "gameopt",  &_settings_newgame);
+	HandleOldDiffCustom(false);
+
 	HandleSettingDescs(ini, ini_load_settings, ini_load_setting_list);
 	_grfconfig_newgame = GRFLoadConfig(ini, "newgrf", false);
 	_grfconfig_static  = GRFLoadConfig(ini, "newgrf-static", true);
@@ -2050,15 +2122,27 @@
 	if (sd == NULL) return CMD_ERROR;
 	if (!SlIsObjectCurrentlyValid(sd->save.version_from, sd->save.version_to)) return CMD_ERROR;
 
-	if ((sd->desc.flags & SGF_NETWORK_ONLY) && !_networking) return CMD_ERROR;
+	if ((sd->desc.flags & SGF_NETWORK_ONLY) && !_networking && _game_mode != GM_MENU) return CMD_ERROR;
 	if ((sd->desc.flags & SGF_NO_NETWORK) && _networking) return CMD_ERROR;
 	if ((sd->desc.flags & SGF_NEWGAME_ONLY) && _game_mode != GM_MENU) return CMD_ERROR;
 
 	if (flags & DC_EXEC) {
-		Settings *s = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings;
+		GameSettings *s = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game;
 		void *var = GetVariableAddress(s, &sd->save);
-		Write_ValidateSetting(var, sd, (int32)p2);
-		if (sd->desc.proc != NULL) sd->desc.proc((int32)ReadValue(var, sd->save.conv));
+
+		int32 oldval = (int32)ReadValue(var, sd->save.conv);
+		int32 newval = (int32)p2;
+
+		Write_ValidateSetting(var, sd, newval);
+		newval = (int32)ReadValue(var, sd->save.conv);
+
+		if (sd->desc.proc != NULL) sd->desc.proc(newval);
+
+		if ((sd->desc.flags & SGF_NO_NETWORK) && oldval != newval) {
+			GamelogStartAction(GLAT_PATCH);
+			GamelogPatch(sd->desc.name, oldval, newval);
+			GamelogStopAction();
+		}
 
 		InvalidateWindow(WC_GAME_OPTIONS, 0);
 	}
@@ -2073,7 +2157,7 @@
  * This only affects patch-members that are not needed to be the same on all
  * clients in a network game.
  * @param value new value of the patch */
-bool SetPatchValue(uint index, const Settings *object, int32 value)
+bool SetPatchValue(uint index, int32 value)
 {
 	const SettingDesc *sd = &_patch_settings[index];
 	/* If an item is player-based, we do not send it over the network
@@ -2081,7 +2165,7 @@
 	 * of patches because changing a player-based setting in a game also
 	 * changes its defaults. At least that is the convention we have chosen */
 	if (sd->save.conv & SLF_NETWORK_NO) {
-		void *var = GetVariableAddress(object, &sd->save);
+		void *var = GetVariableAddress((_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game, &sd->save);
 		Write_ValidateSetting(var, sd, value);
 
 		if (_game_mode != GM_MENU) {
@@ -2100,6 +2184,24 @@
 	return false;
 }
 
+/**
+ * Set a patch value with a string.
+ * @param index the patch settings index.
+ * @param value the value to write
+ * @note CANNOT BE SAVED IN THE SAVEGAME.
+ */
+bool SetPatchValue(uint index, const char *value)
+{
+	const SettingDesc *sd = &_patch_settings[index];
+	assert(sd->save.conv & SLF_NETWORK_NO);
+
+	char *var = (char*)GetVariableAddress(NULL, &sd->save);
+	ttd_strlcpy(var, value, sd->save.length);
+	if (sd->desc.proc != NULL) sd->desc.proc(0);
+
+	return true;
+}
+
 const SettingDesc *GetPatchFromName(const char *name, uint *i)
 {
 	const SettingDesc *sd;
@@ -2125,23 +2227,41 @@
 
 /* Those 2 functions need to be here, else we have to make some stuff non-static
  * and besides, it is also better to keep stuff like this at the same place */
-bool IConsoleSetPatchSetting(const char *name, int32 value)
+void IConsoleSetPatchSetting(const char *name, const char *value)
 {
-	bool success;
 	uint index;
 	const SettingDesc *sd = GetPatchFromName(name, &index);
-	void *ptr;
 
 	if (sd == NULL) {
 		IConsolePrintF(CC_WARNING, "'%s' is an unknown patch setting.", name);
-		return true;
+		return;
 	}
 
-	Settings *s = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings;
-	ptr = GetVariableAddress(s, &sd->save);
+	bool success;
+	if (sd->desc.cmd == SDT_STRING) {
+		success = SetPatchValue(index, value);
+	} else {
+		uint32 val;
+		extern bool GetArgumentInteger(uint32 *value, const char *arg);
+		success = GetArgumentInteger(&val, value);
+		if (success) success = SetPatchValue(index, val);
+	}
 
-	success = SetPatchValue(index, s, value);
-	return success;
+	if (!success) {
+		if (_network_server) {
+			IConsoleError("This command/variable is not available during network games.");
+		} else {
+			IConsoleError("This command/variable is only available to a network server.");
+		}
+	}
+}
+
+void IConsoleSetPatchSetting(const char *name, int value)
+{
+	uint index;
+	const SettingDesc *sd = GetPatchFromName(name, &index);
+	assert(sd != NULL);
+	SetPatchValue(index, value);
 }
 
 void IConsoleGetPatchSetting(const char *name)
@@ -2156,16 +2276,20 @@
 		return;
 	}
 
-	ptr = GetVariableAddress((_game_mode == GM_MENU) ? &_settings_newgame : &_settings, &sd->save);
+	ptr = GetVariableAddress((_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game, &sd->save);
 
-	if (sd->desc.cmd == SDT_BOOLX) {
-		snprintf(value, sizeof(value), (*(bool*)ptr == 1) ? "on" : "off");
+	if (sd->desc.cmd == SDT_STRING) {
+		IConsolePrintF(CC_WARNING, "Current value for '%s' is: '%s'", name, (const char *)ptr);
 	} else {
-		snprintf(value, sizeof(value), "%d", (int32)ReadValue(ptr, sd->save.conv));
+		if (sd->desc.cmd == SDT_BOOLX) {
+			snprintf(value, sizeof(value), (*(bool*)ptr == 1) ? "on" : "off");
+		} else {
+			snprintf(value, sizeof(value), "%d", (int32)ReadValue(ptr, sd->save.conv));
+		}
+
+		IConsolePrintF(CC_WARNING, "Current value for '%s' is: '%s' (min: %s%d, max: %d)",
+			name, value, (sd->desc.flags & SGF_0ISDISABLED) ? "(0) " : "", sd->desc.min, sd->desc.max);
 	}
-
-	IConsolePrintF(CC_WARNING, "Current value for '%s' is: '%s' (min: %s%d, max: %d)",
-		name, value, (sd->desc.flags & SGF_0ISDISABLED) ? "(0) " : "", sd->desc.min, sd->desc.max);
 }
 
 void IConsoleListPatches()
@@ -2174,10 +2298,12 @@
 
 	for (const SettingDesc *sd = _patch_settings; sd->save.cmd != SL_END; sd++) {
 		char value[80];
-		const void *ptr = GetVariableAddress((_game_mode == GM_MENU) ? &_settings_newgame : &_settings, &sd->save);
+		const void *ptr = GetVariableAddress((_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game, &sd->save);
 
 		if (sd->desc.cmd == SDT_BOOLX) {
 			snprintf(value, lengthof(value), (*(bool*)ptr == 1) ? "on" : "off");
+		} else if (sd->desc.cmd == SDT_STRING) {
+			snprintf(value, sizeof(value), "%s", (const char *)ptr);
 		} else {
 			snprintf(value, lengthof(value), "%d", (uint32)ReadValue(ptr, sd->save.conv));
 		}
@@ -2195,7 +2321,7 @@
 {
 	for (; osd->save.cmd != SL_END; osd++) {
 		const SaveLoad *sld = &osd->save;
-		void *ptr = GetVariableAddress(sld->global ? NULL : object, sld);
+		void *ptr = GetVariableAddress(object, sld);
 
 		if (!SlObjectMember(ptr, sld)) continue;
 	}
@@ -2246,8 +2372,8 @@
 	 * a networking environment. This ensures for example that the local
 	 * autosave-frequency stays when joining a network-server */
 	PrepareOldDiffCustom();
-	LoadSettings(_gameopt_settings, &_settings);
-	HandleOldDiffCustom();
+	LoadSettings(_gameopt_settings, &_settings_game);
+	HandleOldDiffCustom(true);
 }
 
 static void Load_PATS()
@@ -2255,12 +2381,12 @@
 	/* Copy over default setting since some might not get loaded in
 	 * a networking environment. This ensures for example that the local
 	 * signal_side stays when joining a network-server */
-	LoadSettings(_patch_settings, &_settings);
+	LoadSettings(_patch_settings, &_settings_game);
 }
 
 static void Save_PATS()
 {
-	SaveSettings(_patch_settings, &_settings);
+	SaveSettings(_patch_settings, &_settings_game);
 }
 
 void CheckConfig()
--- a/src/settings_func.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/settings_func.h	Tue Jun 17 10:32:49 2008 +0000
@@ -5,7 +5,8 @@
 #ifndef SETTINGS_FUNC_H
 #define SETTINGS_FUNC_H
 
-bool IConsoleSetPatchSetting(const char *name, int32 value);
+void IConsoleSetPatchSetting(const char *name, const char *value);
+void IConsoleSetPatchSetting(const char *name, int32 value);
 void IConsoleGetPatchSetting(const char *name);
 void IConsoleListPatches();
 
--- a/src/settings_gui.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/settings_gui.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -142,11 +142,11 @@
 static void ShowCustCurrency();
 
 struct GameOptionsWindow : Window {
-	Settings *opt;
+	GameSettings *opt;
 
 	GameOptionsWindow(const WindowDesc *desc) : Window(desc)
 	{
-		this->opt = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings;
+		this->opt = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game;
 		this->FindWindowPlacementAndResize(desc);
 	}
 
@@ -162,11 +162,11 @@
 		this->SetWidgetDisabledState(GAMEOPT_VEHICLENAME_SAVE, !(_vehicle_design_names & 1));
 		if (!this->IsWidgetDisabled(GAMEOPT_VEHICLENAME_SAVE)) str = STR_02BF_CUSTOM;
 		SetDParam(0, str);
-		SetDParam(1, _currency_specs[this->opt->gui.currency].name);
-		SetDParam(2, STR_UNITS_IMPERIAL + this->opt->gui.units);
+		SetDParam(1, _currency_specs[this->opt->locale.currency].name);
+		SetDParam(2, STR_UNITS_IMPERIAL + this->opt->locale.units);
 		SetDParam(3, STR_02E9_DRIVE_ON_LEFT + this->opt->vehicle.road_side);
 		SetDParam(4, TownName(this->opt->game_creation.town_name));
-		SetDParam(5, _autosave_dropdown[this->opt->gui.autosave]);
+		SetDParam(5, _autosave_dropdown[_settings_client.gui.autosave]);
 		SetDParam(6, SPECSTR_LANGUAGE_START + _dynlang.curr);
 		int i = GetCurRes();
 		SetDParam(7, i == _num_resolutions ? STR_RES_OTHER : SPECSTR_RESOLUTION_START + i);
@@ -181,11 +181,11 @@
 	{
 		switch (widget) {
 			case GAMEOPT_CURRENCY_BTN: // Setup currencies dropdown
-				ShowDropDownMenu(this, BuildCurrencyDropdown(), this->opt->gui.currency, GAMEOPT_CURRENCY_BTN, _game_mode == GM_MENU ? 0 : ~GetMaskOfAllowedCurrencies(), 0);
+				ShowDropDownMenu(this, BuildCurrencyDropdown(), this->opt->locale.currency, GAMEOPT_CURRENCY_BTN, _game_mode == GM_MENU ? 0 : ~GetMaskOfAllowedCurrencies(), 0);
 				break;
 
 			case GAMEOPT_DISTANCE_BTN: // Setup distance unit dropdown
-				ShowDropDownMenu(this, _units_dropdown, this->opt->gui.units, GAMEOPT_DISTANCE_BTN, 0, 0);
+				ShowDropDownMenu(this, _units_dropdown, this->opt->locale.units, GAMEOPT_DISTANCE_BTN, 0, 0);
 				break;
 
 			case GAMEOPT_ROADSIDE_BTN: { // Setup road-side dropdown
@@ -206,7 +206,7 @@
 				break;
 
 			case GAMEOPT_AUTOSAVE_BTN: // Setup autosave dropdown
-				ShowDropDownMenu(this, _autosave_dropdown, this->opt->gui.autosave, GAMEOPT_AUTOSAVE_BTN, 0, 0);
+				ShowDropDownMenu(this, _autosave_dropdown, _settings_client.gui.autosave, GAMEOPT_AUTOSAVE_BTN, 0, 0);
 				break;
 
 			case GAMEOPT_VEHICLENAME_BTN: // Setup customized vehicle-names dropdown
@@ -265,12 +265,12 @@
 
 			case GAMEOPT_CURRENCY_BTN: /* Currency */
 				if (index == CUSTOM_CURRENCY_ID) ShowCustCurrency();
-				this->opt->gui.currency = index;
+				this->opt->locale.currency = index;
 				MarkWholeScreenDirty();
 				break;
 
 			case GAMEOPT_DISTANCE_BTN: // Measuring units
-				this->opt->gui.units = index;
+				this->opt->locale.units = index;
 				MarkWholeScreenDirty();
 				break;
 
@@ -289,7 +289,7 @@
 				break;
 
 			case GAMEOPT_AUTOSAVE_BTN: // Autosave options
-				_settings.gui.autosave = _settings_newgame.gui.autosave = index;
+				_settings_client.gui.autosave = index;
 				this->SetDirty();
 				break;
 
@@ -398,7 +398,7 @@
 	uint8 timeout;
 
 	/* Temporary holding place of values in the difficulty window until 'Save' is clicked */
-	Settings opt_mod_temp;
+	GameSettings opt_mod_temp;
 
 	enum {
 		GAMEDIFF_WND_TOP_OFFSET = 45,
@@ -427,7 +427,7 @@
 	{
 		/* Copy current settings (ingame or in intro) to temporary holding place
 		 * change that when setting stuff, copy back on clicking 'OK' */
-		this->opt_mod_temp = (_game_mode == GM_MENU) ? _settings_newgame : _settings;
+		this->opt_mod_temp = (_game_mode == GM_MENU) ? _settings_newgame : _settings_game;
 		this->clicked_increase = false;
 		this->clicked_button = NO_SETTINGS_BUTTON;
 		this->timeout = 0;
@@ -537,7 +537,7 @@
 				break;
 
 			case GDW_ACCEPT: { // Save button - save changes
-				Settings *opt_ptr = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings;
+				GameSettings *opt_ptr = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game;
 
 				uint i;
 				const SettingDesc *sd = GetPatchFromName("difficulty.max_no_competitors", &i);
@@ -738,7 +738,7 @@
 };
 
 struct PatchesSelectionWindow : Window {
-	static Settings *patches_ptr;
+	static GameSettings *patches_ptr;
 	static int patches_max;
 
 	int page;
@@ -749,7 +749,7 @@
 	{
 		static bool first_time = true;
 
-		patches_ptr = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings;
+		patches_ptr = (_game_mode == GM_MENU) ? &_settings_newgame : &_settings_game;
 
 		/* Build up the dynamic settings-array only once per OpenTTD session */
 		if (first_time) {
@@ -912,7 +912,7 @@
 					}
 
 					if (value != oldvalue) {
-						SetPatchValue(page->entries[btn].index, patches_ptr, value);
+						SetPatchValue(page->entries[btn].index, value);
 						this->SetDirty();
 					}
 				} else {
@@ -955,13 +955,13 @@
 			/* Save the correct currency-translated value */
 			if (sd->desc.flags & SGF_CURRENCY) value /= _currency->rate;
 
-			SetPatchValue(pe->index, patches_ptr, value);
+			SetPatchValue(pe->index, value);
 			this->SetDirty();
 		}
 	}
 };
 
-Settings *PatchesSelectionWindow::patches_ptr = NULL;
+GameSettings *PatchesSelectionWindow::patches_ptr = NULL;
 int PatchesSelectionWindow::patches_max = 0;
 
 static const Widget _patches_selection_widgets[] = {
--- a/src/settings_internal.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/settings_internal.h	Tue Jun 17 10:32:49 2008 +0000
@@ -84,6 +84,7 @@
 };
 
 const SettingDesc *GetPatchFromName(const char *name, uint *i);
-bool SetPatchValue(uint index, const Settings *object, int32 value);
+bool SetPatchValue(uint index, int32 value);
+bool SetPatchValue(uint index, const char *value);
 
 #endif /* SETTINGS_H */
--- a/src/settings_type.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/settings_type.h	Tue Jun 17 10:32:49 2008 +0000
@@ -8,6 +8,7 @@
 #include "date_type.h"
 #include "town_type.h"
 #include "transport_type.h"
+#include "network/core/config.h"
 
 /** Settings related to the difficulty of the game */
 struct DifficultySettings {
@@ -77,10 +78,49 @@
 	bool   autorenew;                        ///< should autorenew be enabled for new companies?
 	int16  autorenew_months;                 ///< how many months from EOL of vehicles should autorenew trigger for new companies?
 	int32  autorenew_money;                  ///< how much money before autorenewing for new companies?
+	byte   news_message_timeout;             ///< how much longer than the news message "age" should we keep the message in the history
+};
+
+/** Settings related to currency/unit systems. */
+struct LocaleSettings {
 	byte   currency;                         ///< currency we currently use
 	byte   units;                            ///< unit system we show everything
 };
 
+/** All settings related to the network. */
+struct NetworkSettings {
+#ifdef ENABLE_NETWORK
+	uint16 sync_freq;                                     ///< how often do we check whether we are still in-sync
+	uint8  frame_freq;                                    ///< how often do we send commands to the clients
+	uint16 max_join_time;                                 ///< maximum amount of time, in game ticks, a client may take to join
+	bool   pause_on_join;                                 ///< pause the game when people join
+	char   server_bind_ip[NETWORK_HOSTNAME_LENGTH];       ///< IP address the server binds to
+	uint16 server_port;                                   ///< port the server listens on
+	char   server_name[NETWORK_NAME_LENGTH];              ///< name of the server
+	char   server_password[NETWORK_PASSWORD_LENGTH];      ///< passowrd for joining this server
+	char   rcon_password[NETWORK_PASSWORD_LENGTH];        ///< passowrd for rconsole (server side)
+	bool   server_advertise;                              ///< advertise the server to the masterserver
+	uint8  lan_internet;                                  ///< search on the LAN or internet for servers
+	char   player_name[NETWORK_NAME_LENGTH];              ///< name of the player
+	char   default_company_pass[NETWORK_PASSWORD_LENGTH]; ///< default password for new companies in encrypted form
+	char   connect_to_ip[NETWORK_HOSTNAME_LENGTH];        ///< default for the "Add server" query
+	char   network_id[NETWORK_UNIQUE_ID_LENGTH];          ///< semi-unique ID of the client
+	bool   autoclean_companies;                           ///< automatically remove companies that are not in use
+	uint8  autoclean_unprotected;                         ///< remove passwordless companies after this many months
+	uint8  autoclean_protected;                           ///< remove the password from passworded companies after this many months
+	uint8  max_companies;                                 ///< maximum amount of companies
+	uint8  max_clients;                                   ///< maximum amount of clients
+	uint8  max_spectators;                                ///< maximum amount of spectators
+	Year   restart_game_year;                             ///< year the server restarts
+	uint8  min_players;                                   ///< minimum amount of players to unpause the game
+	uint8  server_lang;                                   ///< language of the server
+	bool   reload_cfg;                                    ///< reload the config file before restarting
+	char   last_host[NETWORK_HOSTNAME_LENGTH];            ///< IP address of the last joined server
+	uint16 last_port;                                     ///< port of the last joined server
+#else /* ENABLE_NETWORK */
+#endif
+};
+
 /** Settings related to the creation of games. */
 struct GameCreationSettings {
 	uint32 generation_seed;                  ///< noise seed for world generation
@@ -264,10 +304,9 @@
 	byte   station_spread;                   ///< amount a station may spread
 };
 
-/** All settings together. */
-struct Settings {
+/** All settings together for the game. */
+struct GameSettings {
 	DifficultySettings   difficulty;         ///< settings related to the difficulty
-	GUISettings          gui;                ///< settings related to the GUI
 	GameCreationSettings game_creation;      ///< settings used during the creation of a game (map)
 	ConstructionSettings construction;       ///< construction of things in-game
 	AISettings           ai;                 ///< what may the AI do?
@@ -276,12 +315,22 @@
 	VehicleSettings      vehicle;            ///< options for vehicles
 	EconomySettings      economy;            ///< settings to change the economy
 	StationSettings      station;            ///< settings related to station management
+	LocaleSettings       locale;             ///< settings related to used currency/unit system in the current game
 };
 
-/** The current settings. */
-extern Settings _settings;
+/** All settings that are only important for the local client. */
+struct ClientSettings {
+	GUISettings          gui;                ///< settings related to the GUI
+	NetworkSettings      network;            ///< settings related to the network
+};
 
-/** The settings values that are used for new games and/or modified in config file */
-extern Settings _settings_newgame;
+/** The current settings for this game. */
+extern ClientSettings _settings_client;
+
+/** The current settings for this game. */
+extern GameSettings _settings_game;
+
+/** The settings values that are used for new games and/or modified in config file. */
+extern GameSettings _settings_newgame;
 
 #endif /* SETTINGS_TYPE_H */
--- a/src/ship_cmd.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/ship_cmd.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -106,7 +106,7 @@
 
 static const Depot* FindClosestShipDepot(const Vehicle* v)
 {
-	if (_settings.pf.pathfinder_for_ships == VPF_NPF) { /* NPF is used */
+	if (_settings_game.pf.pathfinder_for_ships == VPF_NPF) { /* NPF is used */
 		Trackdir trackdir = GetVehicleTrackdir(v);
 		NPFFoundTargetData ftd = NPFRouteToDepotTrialError(v->tile, trackdir, false, TRANSPORT_WATER, 0, v->owner, INVALID_RAILTYPES);
 
@@ -137,7 +137,7 @@
 
 static void CheckIfShipNeedsService(Vehicle *v)
 {
-	if (_settings.vehicle.servint_ships == 0 || !v->NeedsAutomaticServicing()) return;
+	if (_settings_game.vehicle.servint_ships == 0 || !v->NeedsAutomaticServicing()) return;
 	if (v->IsInDepot()) {
 		VehicleServiceInDepot(v);
 		return;
@@ -196,7 +196,7 @@
 		InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
 
 		if (!PlayVehicleSound(v, VSE_BREAKDOWN)) {
-			SndPlayVehicleFx((_settings.game_creation.landscape != LT_TOYLAND) ?
+			SndPlayVehicleFx((_settings_game.game_creation.landscape != LT_TOYLAND) ?
 				SND_10_TRAIN_BREAKDOWN : SND_3A_COMEDY_BREAKDOWN_2, v);
 		}
 
@@ -320,7 +320,7 @@
 	/*updates statusbar only if speed have changed to save CPU time */
 	if (spd != v->cur_speed) {
 		v->cur_speed = spd;
-		if (_settings.gui.vehicle_speed)
+		if (_settings_client.gui.vehicle_speed)
 			InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 	}
 
@@ -459,7 +459,7 @@
 {
 	assert(IsValidDiagDirection(enterdir));
 
-	switch (_settings.pf.pathfinder_for_ships) {
+	switch (_settings_game.pf.pathfinder_for_ships) {
 		case VPF_YAPF: { /* YAPF */
 			Trackdir trackdir = YapfChooseShipTrack(v, tile, enterdir, tracks);
 			if (trackdir != INVALID_TRACKDIR) return TrackdirToTrack(trackdir);
@@ -756,7 +756,7 @@
 
 	unit_num = HasBit(p2, 0) ? 0 : GetFreeUnitNumber(VEH_SHIP);
 
-	if (!Vehicle::AllocateList(NULL, 1) || unit_num > _settings.vehicle.max_ships)
+	if (!Vehicle::AllocateList(NULL, 1) || unit_num > _settings_game.vehicle.max_ships)
 		return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
 
 	if (flags & DC_EXEC) {
@@ -800,7 +800,7 @@
 		v->name = NULL;
 		v->u.ship.state = TRACK_BIT_DEPOT;
 
-		v->service_interval = _settings.vehicle.servint_ships;
+		v->service_interval = _settings_game.vehicle.servint_ships;
 		v->date_of_last_service = _date;
 		v->build_year = _cur_year;
 		v->cur_image = 0x0E5E;
--- a/src/signs.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/signs.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -24,7 +24,6 @@
 #include "table/strings.h"
 
 SignID _new_sign_id;
-uint _total_signs;
 bool _sign_sort_dirty;
 
 /* Initialize the sign-pool */
@@ -115,7 +114,6 @@
 		InvalidateWindow(WC_SIGN_LIST, 0);
 		_sign_sort_dirty = true;
 		_new_sign_id = si->index;
-		_total_signs++;
 	}
 
 	return CommandCost();
@@ -162,7 +160,6 @@
 
 			InvalidateWindow(WC_SIGN_LIST, 0);
 			_sign_sort_dirty = true;
-			_total_signs--;
 		}
 	}
 
@@ -202,7 +199,6 @@
  */
 void InitializeSigns()
 {
-	_total_signs = 0;
 	_Sign_pool.CleanPool();
 	_Sign_pool.AddBlockToPool();
 }
@@ -241,13 +237,10 @@
  */
 static void Load_SIGN()
 {
-	_total_signs = 0;
 	int index;
 	while ((index = SlIterateArray()) != -1) {
 		Sign *si = new (index) Sign();
 		SlObject(si, _sign_desc);
-
-		_total_signs++;
 	}
 
 	_sign_sort_dirty = true;
--- a/src/signs_base.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/signs_base.h	Tue Jun 17 10:32:49 2008 +0000
@@ -40,12 +40,6 @@
 	return GetSignPoolSize() - 1;
 }
 
-static inline uint GetNumSigns()
-{
-	extern uint _total_signs;
-	return _total_signs;
-}
-
 static inline bool IsValidSignID(uint index)
 {
 	return index < GetSignPoolSize() && GetSign(index)->IsValid();
--- a/src/smallmap_gui.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/smallmap_gui.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -459,7 +459,7 @@
 
 		case MP_TREES:
 			if (GetTreeGround(tile) == TREE_GROUND_SNOW_DESERT) {
-				bits = (_settings.game_creation.landscape == LT_ARCTIC) ? MKCOLOR(0x98575798) : MKCOLOR(0xC25757C2);
+				bits = (_settings_game.game_creation.landscape == LT_ARCTIC) ? MKCOLOR(0x98575798) : MKCOLOR(0xC25757C2);
 			} else {
 				bits = MKCOLOR(0x54575754);
 			}
@@ -574,6 +574,7 @@
 	int32 scroll_x;
 	int32 scroll_y;
 	int32 subscroll;
+	uint8 refresh;
 
 public:
 	/**
@@ -1019,7 +1020,7 @@
 	virtual void OnTick()
 	{
 		/* update the window every now and then */
-		if ((++this->vscroll.pos & 0x1F) == 0) this->SetDirty();
+		if ((++this->refresh & 0x1F) == 0) this->SetDirty();
 	}
 
 	virtual void OnScroll(Point delta)
--- a/src/sortlist_type.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/sortlist_type.h	Tue Jun 17 10:32:49 2008 +0000
@@ -5,6 +5,8 @@
 #ifndef SORTLIST_TYPE_H
 #define SORTLIST_TYPE_H
 
+#include "core/enum_type.hpp"
+#include "core/bitmath_func.hpp"
 #include "misc/smallvec.h"
 #include "date_type.h"
 
@@ -188,26 +190,28 @@
 	 *  sorted data.
 	 *
 	 * @param compare The function to compare two list items
+	 * @return true if the list sequence has been altered
 	 * */
-	FORCEINLINE void Sort(SortFunction *compare)
+	FORCEINLINE bool Sort(SortFunction *compare)
 	{
 		/* Do not sort if the resort bit is not set */
-		if (!HASBITS(this->flags, VL_RESORT)) return;
+		if (!HASBITS(this->flags, VL_RESORT)) return false;
 
 		CLRBITS(this->flags, VL_RESORT);
 
 		this->ResetResortTimer();
 
 		/* Do not sort when the list is not sortable */
-		if (!this->IsSortable()) return;
+		if (!this->IsSortable()) return false;
 
 		const bool desc = HASBITS(this->flags, VL_DESC);
 
 		if (HASBITS(this->flags, VL_FIRST_SORT)) {
+			CLRBITS(this->flags, VL_FIRST_SORT);
 			qsort(this->data, this->items, sizeof(T), (int (CDECL *)(const void *, const void *))compare);
 
 			if (desc) this->Reverse();
-			return;
+			return true;
 		}
 
 		T *a = this->data;
@@ -238,6 +242,7 @@
 				}
 			}
 		}
+		return true;
 	}
 
 	/**
@@ -253,11 +258,13 @@
 	/**
 	 * Overload of Sort()
 	 * Overloaded to reduce external code
+	 *
+	 * @return true if the list sequence has been altered
 	 */
-	void Sort()
+	bool Sort()
 	{
 		assert(this->func_list != NULL);
-		this->Sort(this->func_list[this->sort_type]);
+		return this->Sort(this->func_list[this->sort_type]);
 	}
 
 	/**
--- a/src/sound.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/sound.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -29,7 +29,7 @@
 	uint i;
 
 	FioOpenFile(SOUND_SLOT, filename);
-	uint pos = FioGetPos();
+	size_t pos = FioGetPos();
 	uint count = FioReadDword() / 8;
 
 	/* Simple check for the correct number of original sounds. */
--- a/src/sound/win32_s.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/sound/win32_s.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -24,7 +24,7 @@
 	hdr->lpData = MallocT<char>(_bufsize * 4);
 	if (hdr->lpData == NULL ||
 			waveOutPrepareHeader(_waveout, hdr, sizeof(WAVEHDR)) != MMSYSERR_NOERROR)
-		error("waveOutPrepareHeader failed");
+		usererror("waveOutPrepareHeader failed");
 }
 
 static void FillHeaders()
@@ -35,7 +35,7 @@
 		if (!(hdr->dwFlags & WHDR_INQUEUE)) {
 			MxMixSamples(hdr->lpData, hdr->dwBufferLength / 4);
 			if (waveOutWrite(_waveout, hdr, sizeof(WAVEHDR)) != MMSYSERR_NOERROR)
-				error("waveOutWrite failed");
+				usererror("waveOutWrite failed");
 		}
 	}
 }
--- a/src/sound_type.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/sound_type.h	Tue Jun 17 10:32:49 2008 +0000
@@ -20,8 +20,8 @@
 
 struct FileEntry {
 	uint8 file_slot;
-	uint32 file_offset;
-	uint32 file_size;
+	size_t file_offset;
+	size_t file_size;
 	uint16 rate;
 	uint8 bits_per_sample;
 	uint8 channels;
--- a/src/spritecache.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/spritecache.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -25,7 +25,7 @@
 struct SpriteCache {
 	void *ptr;
 	uint32 id;
-	uint32 file_pos;
+	size_t file_pos;
 	uint16 file_slot;
 	int16 lru;
 };
@@ -123,7 +123,7 @@
 static void* ReadSprite(SpriteCache *sc, SpriteID id, bool real_sprite)
 {
 	uint8 file_slot = sc->file_slot;
-	uint32 file_pos = sc->file_pos;
+	size_t file_pos = sc->file_pos;
 
 	DEBUG(sprite, 9, "Load sprite %d", id);
 
@@ -169,7 +169,7 @@
 			static byte warning_level = 0;
 			DEBUG(sprite, warning_level, "Tried to load non sprite #%d as a real sprite. Probable cause: NewGRF interference", id);
 			warning_level = 6;
-			if (id == SPR_IMG_QUERY) error("Uhm, would you be so kind not to load a NewGRF that makes the 'query' sprite a non- sprite?");
+			if (id == SPR_IMG_QUERY) usererror("Uhm, would you be so kind not to load a NewGRF that makes the 'query' sprite a non- sprite?");
 			return (void*)GetSprite(SPR_IMG_QUERY);
 		}
 
@@ -241,12 +241,12 @@
 bool LoadNextSprite(int load_index, byte file_slot, uint file_sprite_id)
 {
 	SpriteCache *sc;
-	uint32 file_pos = FioGetPos();
+	size_t file_pos = FioGetPos();
 
 	if (!ReadSpriteHeaderSkipData()) return false;
 
 	if (load_index >= MAX_SPRITES) {
-		error("Tried to load too many sprites (#%d; max %d)", load_index, MAX_SPRITES);
+		usererror("Tried to load too many sprites (#%d; max %d)", load_index, MAX_SPRITES);
 	}
 
 	sc = AllocateSpriteCache(load_index);
@@ -279,9 +279,9 @@
 	return (MemBlock*)((byte*)block + (block->size & ~S_FREE_MASK));
 }
 
-static uint32 GetSpriteCacheUsage()
+static size_t GetSpriteCacheUsage()
 {
-	uint32 tot_size = 0;
+	size_t tot_size = 0;
 	MemBlock* s;
 
 	for (s = _spritecache_ptr; s->size != 0; s = NextBlock(s)) {
--- a/src/spriteloader/grf.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/spriteloader/grf.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -9,7 +9,7 @@
 #include "../core/alloc_func.hpp"
 #include "grf.hpp"
 
-bool SpriteLoaderGrf::LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, uint32 file_pos)
+bool SpriteLoaderGrf::LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, size_t file_pos)
 {
 	/* Open the right file and go to the correct position */
 	FioSeekToFile(file_slot, file_pos);
--- a/src/spriteloader/grf.hpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/spriteloader/grf.hpp	Tue Jun 17 10:32:49 2008 +0000
@@ -12,7 +12,7 @@
 	/**
 	 * Load a sprite from the disk and return a sprite struct which is the same for all loaders.
 	 */
-	bool LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, uint32 file_pos);
+	bool LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, size_t file_pos);
 };
 
 #endif /* SPRITELOADER_GRF_HPP */
--- a/src/spriteloader/png.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/spriteloader/png.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -170,11 +170,11 @@
 	return true;
 }
 
-bool SpriteLoaderPNG::LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, uint32 file_pos)
+bool SpriteLoaderPNG::LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, size_t file_pos)
 {
 	const char *filename = FioGetFilename(file_slot);
-	if (!LoadPNG(sprite, filename, file_pos, false)) return false;
-	if (!LoadPNG(sprite, filename, file_pos, true)) return false;
+	if (!LoadPNG(sprite, filename, (uint32)file_pos, false)) return false;
+	if (!LoadPNG(sprite, filename, (uint32)file_pos, true)) return false;
 	return true;
 }
 
--- a/src/spriteloader/png.hpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/spriteloader/png.hpp	Tue Jun 17 10:32:49 2008 +0000
@@ -12,7 +12,7 @@
 	/**
 	 * Load a sprite from the disk and return a sprite struct which is the same for all loaders.
 	 */
-	bool LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, uint32 file_pos);
+	bool LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, size_t file_pos);
 };
 
 #endif /* SPRITELOADER_PNG_HPP */
--- a/src/spriteloader/spriteloader.hpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/spriteloader/spriteloader.hpp	Tue Jun 17 10:32:49 2008 +0000
@@ -26,7 +26,7 @@
 	/**
 	 * Load a sprite from the disk and return a sprite struct which is the same for all loaders.
 	 */
-	virtual bool LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, uint32 file_pos) = 0;
+	virtual bool LoadSprite(SpriteLoader::Sprite *sprite, uint8 file_slot, size_t file_pos) = 0;
 
 	virtual ~SpriteLoader() { }
 };
--- a/src/station.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/station.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -285,7 +285,7 @@
 		/* check new rect dimensions against preset max */
 		int w = new_rect.right - new_rect.left + 1;
 		int h = new_rect.bottom - new_rect.top + 1;
-		if (mode != ADD_FORCE && (w > _settings.station.station_spread || h > _settings.station.station_spread)) {
+		if (mode != ADD_FORCE && (w > _settings_game.station.station_spread || h > _settings_game.station.station_spread)) {
 			assert(mode != ADD_TRY);
 			_error_message = STR_306C_STATION_TOO_SPREAD_OUT;
 			return false;
--- a/src/station_cmd.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/station_cmd.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -358,7 +358,7 @@
 				CountMapSquareAround(tile, CMSATree) >= 8 ||
 				CountMapSquareAround(tile, CMSAForest) >= 2)
 			) {
-		return _settings.game_creation.landscape == LT_TROPIC ? STR_SV_STNAME_FOREST : STR_SV_STNAME_WOODS;
+		return _settings_game.game_creation.landscape == LT_TROPIC ? STR_SV_STNAME_FOREST : STR_SV_STNAME_WOODS;
 	}
 
 	/* check elevation compared to town */
@@ -625,7 +625,7 @@
 			TileXY(rect.left, rect.bottom),
 			rect.right - rect.left   + 1,
 			rect.top   - rect.bottom + 1,
-			_settings.station.modified_catchment ? FindCatchmentRadius(st) : (uint)CA_UNMODIFIED
+			_settings_game.station.modified_catchment ? FindCatchmentRadius(st) : (uint)CA_UNMODIFIED
 		);
 	} else {
 		memset(accepts, 0, sizeof(accepts));
@@ -762,7 +762,7 @@
 		 *     b) the build_on_slopes switch is disabled
 		 */
 		if (IsSteepSlope(tileh) ||
-				((_is_old_ai_player || !_settings.construction.build_on_slopes) && tileh != SLOPE_FLAT)) {
+				((_is_old_ai_player || !_settings_game.construction.build_on_slopes) && tileh != SLOPE_FLAT)) {
 			return_cmd_error(STR_0007_FLAT_LAND_REQUIRED);
 		}
 
@@ -839,7 +839,7 @@
 	uint w = fin[1];
 	uint h = fin[2];
 
-	if (_settings.station.nonuniform_stations) {
+	if (_settings_game.station.nonuniform_stations) {
 		/* determine new size of train station region.. */
 		int x = min(TileX(st->train_tile), TileX(tile));
 		int y = min(TileY(st->train_tile), TileY(tile));
@@ -883,7 +883,7 @@
 		}
 	}
 	/* make sure the final size is not too big. */
-	if (curw > _settings.station.station_spread || curh > _settings.station.station_spread) {
+	if (curw > _settings_game.station.station_spread || curh > _settings_game.station.station_spread) {
 		_error_message = STR_306C_STATION_TOO_SPREAD_OUT;
 		return false;
 	}
@@ -972,7 +972,7 @@
 		w_org = numtracks;
 	}
 
-	if (h_org > _settings.station.station_spread || w_org > _settings.station.station_spread) return CMD_ERROR;
+	if (h_org > _settings_game.station.station_spread || w_org > _settings_game.station.station_spread) return CMD_ERROR;
 
 	/* these values are those that will be stored in train_tile and station_platforms */
 	uint finalvalues[3];
@@ -985,14 +985,14 @@
 	/* If DC_EXEC is in flag, do not want to pass it to CheckFlatLandBelow, because of a nice bug
 	 * for detail info, see:
 	 * https://sourceforge.net/tracker/index.php?func=detail&aid=1029064&group_id=103924&atid=636365 */
-	CommandCost ret = CheckFlatLandBelow(tile_org, w_org, h_org, flags & ~DC_EXEC, 5 << axis, _settings.station.nonuniform_stations ? &est : NULL);
+	CommandCost ret = CheckFlatLandBelow(tile_org, w_org, h_org, flags & ~DC_EXEC, 5 << axis, _settings_game.station.nonuniform_stations ? &est : NULL);
 	if (CmdFailed(ret)) return ret;
 	CommandCost cost(EXPENSES_CONSTRUCTION, ret.GetCost() + (numtracks * _price.train_station_track + _price.train_station_length) * plat_len);
 
 	Station *st = NULL;
 	bool check_surrounding = true;
 
-	if (_settings.station.adjacent_stations) {
+	if (_settings_game.station.adjacent_stations) {
 		if (est != INVALID_STATION) {
 			if (HasBit(p1, 24)) {
 				/* You can't build an adjacent station over the top of one that
@@ -1027,7 +1027,7 @@
 
 		if (st->train_tile != 0) {
 			/* check if we want to expanding an already existing station? */
-			if (_is_old_ai_player || !_settings.station.join_stations)
+			if (_is_old_ai_player || !_settings_game.station.join_stations)
 				return_cmd_error(STR_3005_TOO_CLOSE_TO_ANOTHER_RAILROAD);
 			if (!CanExpandRailroadStation(st, finalvalues, axis))
 				return CMD_ERROR;
@@ -1082,7 +1082,7 @@
 		/* Now really clear the land below the station
 		 * It should never return CMD_ERROR.. but you never know ;)
 		 * (a bit strange function name for it, but it really does clear the land, when DC_EXEC is in flags) */
-		ret = CheckFlatLandBelow(tile_org, w_org, h_org, flags, 5 << axis, _settings.station.nonuniform_stations ? &est : NULL);
+		ret = CheckFlatLandBelow(tile_org, w_org, h_org, flags, 5 << axis, _settings_game.station.nonuniform_stations ? &est : NULL);
 		if (CmdFailed(ret)) return ret;
 
 		st->train_tile = finalvalues[0];
@@ -1251,7 +1251,7 @@
 		/* Do not allow removing from stations if non-uniform stations are not enabled
 		 * The check must be here to give correct error message
 		 */
-		if (!_settings.station.nonuniform_stations) return_cmd_error(STR_NONUNIFORM_STATIONS_DISALLOWED);
+		if (!_settings_game.station.nonuniform_stations) return_cmd_error(STR_NONUNIFORM_STATIONS_DISALLOWED);
 
 		/* If we reached here, the tile is valid so increase the quantity of tiles we will remove */
 		quantity++;
@@ -1296,7 +1296,7 @@
 static CommandCost RemoveRailroadStation(Station *st, TileIndex tile, uint32 flags)
 {
 	/* if there is flooding and non-uniform stations are enabled, remove platforms tile by tile */
-	if (_current_player == OWNER_WATER && _settings.station.nonuniform_stations) {
+	if (_current_player == OWNER_WATER && _settings_game.station.nonuniform_stations) {
 		return DoCommand(tile, 0, 0, DC_EXEC, CMD_REMOVE_FROM_RAILROAD_STATION);
 	}
 
@@ -1415,7 +1415,7 @@
 			Owner road_owner = GetRoadOwner(tile, ROADTYPE_ROAD);
 			if (road_owner == OWNER_TOWN) {
 				town_owned_road = true;
-				if (!_settings.construction.road_stop_on_town_road) return_cmd_error(STR_DRIVE_THROUGH_ERROR_ON_TOWN_ROAD);
+				if (!_settings_game.construction.road_stop_on_town_road) return_cmd_error(STR_DRIVE_THROUGH_ERROR_ON_TOWN_ROAD);
 			} else {
 				if (road_owner != OWNER_NONE && !CheckOwnership(road_owner)) return CMD_ERROR;
 			}
@@ -1438,7 +1438,7 @@
 
 	Station *st = NULL;
 
-	if (!_settings.station.adjacent_stations || !HasBit(p2, 5)) {
+	if (!_settings_game.station.adjacent_stations || !HasBit(p2, 5)) {
 		st = GetStationAround(tile, 1, 1, INVALID_STATION);
 		if (st == CHECK_STATIONS_ERR) return CMD_ERROR;
 	}
@@ -1676,18 +1676,15 @@
 	 * adding the town_council_tolerance 4 times, as a way to graduate, depending of the tolerance.
 	 * Basically, it says that the less tolerant a town is, the bigger the distance before
 	 * an actual decrease can be granted */
-	uint8 town_tolerance_distance = 8 + (_settings.difficulty.town_council_tolerance * 4);
-
-	/* The airport is in the "inner" distance where there is no noise reduction */
-	if (distance < town_tolerance_distance) return afc->noise_level;
+	uint8 town_tolerance_distance = 8 + (_settings_game.difficulty.town_council_tolerance * 4);
 
 	/* now, we want to have the distance segmented using the distance judged bareable by town
 	 * This will give us the coefficient of reduction the distance provides. */
-	uint noise_reduction = min(afc->noise_level, distance / town_tolerance_distance);
-
-	/* If the noise reduction equals the airport noise itself, don't give it for free. Use it all minus 1.
+	uint noise_reduction = distance / town_tolerance_distance;
+
+	/* If the noise reduction equals the airport noise itself, don't give it for free.
 	 * Otherwise, simply reduce the airport's level. */
-	return max(1U, noise_reduction == afc->noise_level ? afc->noise_level - 1 : afc->noise_level - noise_reduction);
+	return noise_reduction >= afc->noise_level ? 1 : afc->noise_level - noise_reduction;
 }
 
 /** Place an Airport.
@@ -1731,7 +1728,7 @@
 	/* Check if local auth would allow a new airport */
 	bool authority_refused;
 
-	if (_settings.economy.station_noise_level) {
+	if (_settings_game.economy.station_noise_level) {
 		/* do not allow to build a new airport if this raise the town noise over the maximum allowed by town */
 		authority_refused = (t->noise_reached + newnoise_level) > t->MaxTownNoise();
 	} else {
@@ -1752,7 +1749,7 @@
 	byte w = fsmportsspec->size_x[layout_set];
 	byte h = fsmportsspec->size_y[layout_set];
 
-	if (w > _settings.station.station_spread || h > _settings.station.station_spread) {
+	if (w > _settings_game.station.station_spread || h > _settings_game.station.station_spread) {
 		_error_message = STR_306C_STATION_TOO_SPREAD_OUT;
 		return CMD_ERROR;
 	}
@@ -1762,7 +1759,7 @@
 		return CMD_ERROR;
 	}
 
-	if (!_settings.station.adjacent_stations || !HasBit(p1, 24)) {
+	if (!_settings_game.station.adjacent_stations || !HasBit(p1, 24)) {
 		st = GetStationAround(tile, w, h, INVALID_STATION);
 		if (st == CHECK_STATIONS_ERR) return CMD_ERROR;
 	} else {
@@ -1872,7 +1869,7 @@
 		BEGIN_TILE_LOOP(tile_cur, w, h, tile) {
 			partial_snow_desert = 0x00;
 			byte layout = *layout_ptr++;
-			if ((GetTropicZone(tile_cur) == TROPICZONE_DESERT) || ((GetTileZ(tile_cur) >= GetSnowLine() && _settings.game_creation.landscape == LT_ARCTIC)))
+			if ((GetTropicZone(tile_cur) == TROPICZONE_DESERT) || ((GetTileZ(tile_cur) >= GetSnowLine() && _settings_game.game_creation.landscape == LT_ARCTIC)))
 				partial_snow_desert = 1;
 			MakeAirport(tile_cur, st->owner, st->index, layout);
 			if (layout != 255)
@@ -1888,7 +1885,7 @@
 		InvalidateWindowData(WC_STATION_LIST, st->owner, 0);
 		InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_PLANES);
 
-		if (_settings.economy.station_noise_level) {
+		if (_settings_game.economy.station_noise_level) {
 			InvalidateWindow(WC_TOWN_VIEW, st->town->index);
 		}
 	}
@@ -1963,7 +1960,7 @@
 
 		InvalidateWindowWidget(WC_STATION_VIEW, st->index, SVW_PLANES);
 
-		if (_settings.economy.station_noise_level) {
+		if (_settings_game.economy.station_noise_level) {
 			InvalidateWindow(WC_TOWN_VIEW, st->town->index);
 		}
 
@@ -2126,7 +2123,7 @@
 	/* middle */
 	Station *st = NULL;
 
-	if (!_settings.station.adjacent_stations || !HasBit(p1, 0)) {
+	if (!_settings_game.station.adjacent_stations || !HasBit(p1, 0)) {
 		st = GetStationAround(
 				tile + ToTileIndexDiff(_dock_tileoffs_chkaround[direction]),
 				_dock_w_chk[direction], _dock_h_chk[direction], INVALID_STATION);
@@ -2894,7 +2891,7 @@
 	int w_prod; // width and height of the "producer" of the cargo
 	int h_prod;
 	int max_rad;
-	if (_settings.station.modified_catchment) {
+	if (_settings_game.station.modified_catchment) {
 		w_prod = w;
 		h_prod = h;
 		w += 2 * MAX_CATCHMENT;
@@ -2917,7 +2914,7 @@
 		if (st->IsBuoy()) continue; // bouys don't accept cargo
 
 
-		if (_settings.station.modified_catchment) {
+		if (_settings_game.station.modified_catchment) {
 			/* min and max coordinates of the producer relative */
 			const int x_min_prod = max_rad + 1;
 			const int x_max_prod = max_rad + w_prod;
@@ -2971,7 +2968,7 @@
 
 		if (st->goods[type].rating == 0) continue; // Lowest possible rating, better not to give cargo anymore
 
-		if (_settings.order.selectgoods && st->goods[type].last_speed == 0) continue; // Selectively servicing stations, and not this one
+		if (_settings_game.order.selectgoods && st->goods[type].last_speed == 0) continue; // Selectively servicing stations, and not this one
 
 		if (IsCargoInClass(type, CC_PASSENGERS)) {
 			if (st->facilities == FACIL_TRUCK_STOP) continue; // passengers are never served by just a truck stop
@@ -3208,7 +3205,7 @@
 
 static CommandCost TerraformTile_Station(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
 {
-	if (_settings.construction.build_on_slopes && AutoslopeEnabled()) {
+	if (_settings_game.construction.build_on_slopes && AutoslopeEnabled()) {
 		/* TODO: If you implement newgrf callback 149 'land slope check', you have to decide what to do with it here.
 		 *       TTDP does not call it.
 		 */
--- a/src/station_gui.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/station_gui.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -30,13 +30,6 @@
 #include "table/strings.h"
 #include "table/sprites.h"
 
-typedef int CDECL StationSortListingTypeFunction(const void*, const void*);
-
-static StationSortListingTypeFunction StationNameSorter;
-static StationSortListingTypeFunction StationTypeSorter;
-static StationSortListingTypeFunction StationWaitingSorter;
-static StationSortListingTypeFunction StationRatingMaxSorter;
-
 bool _station_show_coverage;
 
 /**
@@ -86,166 +79,134 @@
 	if (rating != 0) GfxFillRect(x + 1, y, x + rating, y, 0xD0);
 }
 
-const StringID _station_sort_listing[] = {
-	STR_SORT_BY_DROPDOWN_NAME,
-	STR_SORT_BY_FACILITY,
-	STR_SORT_BY_WAITING,
-	STR_SORT_BY_RATING_MAX,
-	INVALID_STRING_ID
-};
-
-static char _bufcache[64];
-static const Station *_last_station;
-static int _internal_sort_order;
-
-static int CDECL StationNameSorter(const void *a, const void *b)
-{
-	const Station *st1 = *(const Station**)a;
-	const Station *st2 = *(const Station**)b;
-	char buf1[64];
-
-	SetDParam(0, st1->index);
-	GetString(buf1, STR_STATION, lastof(buf1));
-
-	if (st2 != _last_station) {
-		_last_station = st2;
-		SetDParam(0, st2->index);
-		GetString(_bufcache, STR_STATION, lastof(_bufcache));
-	}
-
-	int r = strcmp(buf1, _bufcache); // sort by name
-	return (_internal_sort_order & 1) ? -r : r;
-}
-
-static int CDECL StationTypeSorter(const void *a, const void *b)
-{
-	const Station *st1 = *(const Station**)a;
-	const Station *st2 = *(const Station**)b;
-	return (_internal_sort_order & 1) ? st2->facilities - st1->facilities : st1->facilities - st2->facilities;
-}
-
-static const uint32 _cargo_filter_max = UINT32_MAX;
-static uint32 _cargo_filter = _cargo_filter_max;
-
-static int CDECL StationWaitingSorter(const void *a, const void *b)
-{
-	const Station *st1 = *(const Station**)a;
-	const Station *st2 = *(const Station**)b;
-	Money sum1 = 0, sum2 = 0;
-
-	for (CargoID j = 0; j < NUM_CARGO; j++) {
-		if (!HasBit(_cargo_filter, j)) continue;
-		if (!st1->goods[j].cargo.Empty()) sum1 += GetTransportedGoodsIncome(st1->goods[j].cargo.Count(), 20, 50, j);
-		if (!st2->goods[j].cargo.Empty()) sum2 += GetTransportedGoodsIncome(st2->goods[j].cargo.Count(), 20, 50, j);
-	}
-
-	return (_internal_sort_order & 1) ? ClampToI32(sum2 - sum1) : ClampToI32(sum1 - sum2);
-}
-
-/**
- * qsort-compatible version of sorting two stations by maximum rating
- * @param a   First object to be sorted, must be of type (const Station *)
- * @param b   Second object to be sorted, must be of type (const Station *)
- * @return    The sort order
- * @retval >0 a should come before b in the list
- * @retval <0 b should come before a in the list
- */
-static int CDECL StationRatingMaxSorter(const void *a, const void *b)
-{
-	const Station *st1 = *(const Station**)a;
-	const Station *st2 = *(const Station**)b;
-	byte maxr1 = 0;
-	byte maxr2 = 0;
-
-	for (CargoID j = 0; j < NUM_CARGO; j++) {
-		if (HasBit(st1->goods[j].acceptance_pickup, GoodsEntry::PICKUP)) maxr1 = max(maxr1, st1->goods[j].rating);
-		if (HasBit(st2->goods[j].acceptance_pickup, GoodsEntry::PICKUP)) maxr2 = max(maxr2, st2->goods[j].rating);
-	}
-
-	return (_internal_sort_order & 1) ? maxr2 - maxr1 : maxr1 - maxr2;
-}
-
 typedef GUIList<const Station*> GUIStationList;
 
 /**
- * Rebuild station list if the VL_REBUILD flag is set
- *
- * @param sl pointer to plstations_d (station list and flags)
- * @param owner player whose stations are to be in list
- * @param facilities types of stations of interest
- * @param cargo_filter bitmap of cargo types to include
- * @param include_empty whether we should include stations without waiting cargo
- */
-static void BuildStationsList(GUIStationList *sl, PlayerID owner, byte facilities, uint32 cargo_filter, bool include_empty)
-{
-	if (!(sl->flags & VL_REBUILD)) return;
-
-	sl->Clear();
-
-	DEBUG(misc, 3, "Building station list for player %d", owner);
-
-	const Station *st;
-	FOR_ALL_STATIONS(st) {
-		if (st->owner == owner || (st->owner == OWNER_NONE && !st->IsBuoy() && HasStationInUse(st->index, owner))) {
-			if (facilities & st->facilities) { //only stations with selected facilities
-				int num_waiting_cargo = 0;
-				for (CargoID j = 0; j < NUM_CARGO; j++) {
-					if (!st->goods[j].cargo.Empty()) {
-						num_waiting_cargo++; //count number of waiting cargo
-						if (HasBit(cargo_filter, j)) {
-							*sl->Append() = st;
-							break;
-						}
-					}
-				}
-				/* stations without waiting cargo */
-				if (num_waiting_cargo == 0 && include_empty) {
-					*sl->Append() = st;
-				}
-			}
-		}
-	}
-
-	sl->Compact();
-
-	sl->flags &= ~VL_REBUILD;
-	sl->flags |= VL_RESORT;
-}
-
-
-/**
- * Sort station list if the VL_RESORT flag is set
- *
- * @param sl pointer to plstations_d (station list and flags)
- */
-static void SortStationsList(GUIStationList *sl)
-{
-	static StationSortListingTypeFunction *const _station_sorter[] = {
-		&StationNameSorter,
-		&StationTypeSorter,
-		&StationWaitingSorter,
-		&StationRatingMaxSorter
-	};
-
-	if (!(sl->flags & VL_RESORT)) return;
-
-	_internal_sort_order = sl->flags & VL_DESC;
-	_last_station = NULL; // used for "cache" in namesorting
-	qsort((void*)sl->Begin(), sl->Length(), sizeof(sl->Begin()), _station_sorter[sl->sort_type]);
-
-	sl->resort_timer = DAY_TICKS * PERIODIC_RESORT_DAYS;
-	sl->flags &= ~VL_RESORT;
-}
-
-/**
  * The list of stations per player.
  */
-struct PlayerStationsWindow : public Window, public GUIStationList
+class PlayerStationsWindow : public Window
 {
-	static Listing station_sort;
-	static byte facilities;
-	static bool include_empty;
+protected:
+	/* Runtime saved values */
+	static Listing last_sorting;
+	static byte facilities;               // types of stations of interest
+	static bool include_empty;            // whether we should include stations without waiting cargo
+	static const uint32 cargo_filter_max;
+	static uint32 cargo_filter;           // bitmap of cargo types to include
+	static const Station *last_station;
 
+	/* Constants for sorting stations */
+	static const StringID sorter_names[];
+	static GUIStationList::SortFunction *const sorter_funcs[];
+
+	GUIStationList stations;
+
+
+	/**
+	 * (Re)Build station list
+	 *
+	 * @param owner player whose stations are to be in list
+	 */
+	void BuildStationsList(const PlayerID owner)
+	{
+		if (!this->stations.NeedRebuild()) return;
+
+		DEBUG(misc, 3, "Building station list for player %d", owner);
+
+		this->stations.Clear();
+
+		const Station *st;
+		FOR_ALL_STATIONS(st) {
+			if (st->owner == owner || (st->owner == OWNER_NONE && !st->IsBuoy() && HasStationInUse(st->index, owner))) {
+				if (this->facilities & st->facilities) { // only stations with selected facilities
+					int num_waiting_cargo = 0;
+					for (CargoID j = 0; j < NUM_CARGO; j++) {
+						if (!st->goods[j].cargo.Empty()) {
+							num_waiting_cargo++; // count number of waiting cargo
+							if (HasBit(this->cargo_filter, j)) {
+								*this->stations.Append() = st;
+								break;
+							}
+						}
+					}
+					/* stations without waiting cargo */
+					if (num_waiting_cargo == 0 && this->include_empty) {
+						*this->stations.Append() = st;
+					}
+				}
+			}
+		}
+
+		this->stations.Compact();
+		this->stations.RebuildDone();
+	}
+
+	/** Sort stations by their name */
+	static int CDECL StationNameSorter(const Station* const *a, const Station* const *b)
+	{
+		static char buf_cache[64];
+		char buf[64];
+
+		SetDParam(0, (*a)->index);
+		GetString(buf, STR_STATION, lastof(buf));
+
+		if (*b != last_station) {
+			last_station = *b;
+			SetDParam(0, (*b)->index);
+			GetString(buf_cache, STR_STATION, lastof(buf_cache));
+		}
+
+		return strcmp(buf, buf_cache);
+	}
+
+	/** Sort stations by their type */
+	static int CDECL StationTypeSorter(const Station* const *a, const Station* const *b)
+	{
+		return (*a)->facilities - (*b)->facilities;
+	}
+
+	/** Sort stations by their waiting cargo */
+	static int CDECL StationWaitingSorter(const Station* const *a, const Station* const *b)
+	{
+		Money sum1 = 0;
+		Money sum2 = 0;
+
+		for (CargoID j = 0; j < NUM_CARGO; j++) {
+			if (!HasBit(cargo_filter, j)) continue;
+			if (!(*a)->goods[j].cargo.Empty()) sum1 += GetTransportedGoodsIncome((*a)->goods[j].cargo.Count(), 20, 50, j);
+			if (!(*b)->goods[j].cargo.Empty()) sum2 += GetTransportedGoodsIncome((*b)->goods[j].cargo.Count(), 20, 50, j);
+		}
+
+		return ClampToI32(sum1 - sum2);
+	}
+
+	/** Sort stations by their rating */
+	static int CDECL StationRatingMaxSorter(const Station* const *a, const Station* const *b)
+	{
+		byte maxr1 = 0;
+		byte maxr2 = 0;
+
+		for (CargoID j = 0; j < NUM_CARGO; j++) {
+			if (HasBit((*a)->goods[j].acceptance_pickup, GoodsEntry::PICKUP)) maxr1 = max(maxr1, (*a)->goods[j].rating);
+			if (HasBit((*b)->goods[j].acceptance_pickup, GoodsEntry::PICKUP)) maxr2 = max(maxr2, (*b)->goods[j].rating);
+		}
+
+		return maxr1 - maxr2;
+	}
+
+	/** Sort the stations list */
+	void SortStationsList()
+	{
+		if (!this->stations.Sort()) return;
+
+		/* Reset name sorter sort cache */
+		this->last_station = NULL;
+
+		/* Set the modified widget dirty */
+		this->InvalidateWidget(SLW_LIST);
+	}
+
+public:
 	PlayerStationsWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number)
 	{
 		this->caption_color = (byte)this->window_number;
@@ -278,7 +239,7 @@
 			wi->data     = 0;
 			wi->tooltips = STR_USE_CTRL_TO_SELECT_MORE;
 
-			if (HasBit(_cargo_filter, c)) this->LowerWidget(SLW_CARGOSTART + i);
+			if (HasBit(this->cargo_filter, c)) this->LowerWidget(SLW_CARGOSTART + i);
 			i++;
 		}
 
@@ -294,45 +255,48 @@
 			this->resize.width = this->width;
 		}
 
-		if (_cargo_filter == _cargo_filter_max) _cargo_filter = _cargo_mask;
+		if (this->cargo_filter == this->cargo_filter_max) this->cargo_filter = _cargo_mask;
 
 		for (uint i = 0; i < 5; i++) {
-			if (HasBit(facilities, i)) this->LowerWidget(i + SLW_TRAIN);
+			if (HasBit(this->facilities, i)) this->LowerWidget(i + SLW_TRAIN);
 		}
-		this->SetWidgetLoweredState(SLW_FACILALL, facilities == (FACIL_TRAIN | FACIL_TRUCK_STOP | FACIL_BUS_STOP | FACIL_AIRPORT | FACIL_DOCK));
-		this->SetWidgetLoweredState(SLW_CARGOALL, _cargo_filter == _cargo_mask && include_empty);
-		this->SetWidgetLoweredState(SLW_NOCARGOWAITING, include_empty);
+		this->SetWidgetLoweredState(SLW_FACILALL, this->facilities == (FACIL_TRAIN | FACIL_TRUCK_STOP | FACIL_BUS_STOP | FACIL_AIRPORT | FACIL_DOCK));
+		this->SetWidgetLoweredState(SLW_CARGOALL, this->cargo_filter == _cargo_mask && this->include_empty);
+		this->SetWidgetLoweredState(SLW_NOCARGOWAITING, this->include_empty);
 
-		this->flags = VL_REBUILD;
-		this->sort_type = station_sort.criteria;
-		if (station_sort.order) this->flags |= VL_DESC;
+		this->stations.SetListing(this->last_sorting);
+		this->stations.SetSortFuncs(this->sorter_funcs);
+		this->stations.ForceRebuild();
+		this->stations.NeedResort();
+		this->SortStationsList();
 
-		/* set up resort timer */
-		this->resort_timer = DAY_TICKS * PERIODIC_RESORT_DAYS;
+		this->widget[SLW_SORTDROPBTN].data = this->sorter_names[this->stations.SortType()];
 
 		this->FindWindowPlacementAndResize(desc);
 	}
 
+	~PlayerStationsWindow()
+	{
+		this->last_sorting = this->stations.GetListing();
+	}
+
 	virtual void OnPaint()
 	{
-		PlayerID owner = (PlayerID)this->window_number;
+		const PlayerID owner = (PlayerID)this->window_number;
 
-		BuildStationsList(this, owner, facilities, _cargo_filter, include_empty);
-		SortStationsList(this);
+		this->BuildStationsList(owner);
+		this->SortStationsList();
 
-		SetVScrollCount(this, this->Length());
+		SetVScrollCount(this, this->stations.Length());
 
 		/* draw widgets, with player's name in the caption */
 		SetDParam(0, owner);
 		SetDParam(1, this->vscroll.count);
 
-		/* Set text of sort by dropdown */
-		this->widget[SLW_SORTDROPBTN].data = _station_sort_listing[this->sort_type];
-
 		this->DrawWidgets();
 
 		/* draw arrow pointing up/down for ascending/descending sorting */
-		this->DrawSortButtonState(SLW_SORTBY, this->flags & VL_DESC ? SBS_DOWN : SBS_UP);
+		this->DrawSortButtonState(SLW_SORTBY, this->stations.IsDescSortOrder() ? SBS_DOWN : SBS_UP);
 
 		int cg_ofst;
 		int x = 89;
@@ -344,7 +308,7 @@
 			const CargoSpec *cs = GetCargo(c);
 			if (!cs->IsValid()) continue;
 
-			cg_ofst = HasBit(_cargo_filter, c) ? 2 : 1;
+			cg_ofst = HasBit(this->cargo_filter, c) ? 2 : 1;
 			GfxFillRect(x + cg_ofst, y + cg_ofst, x + cg_ofst + 10 , y + cg_ofst + 7, cs->rating_colour);
 			DrawStringCentered(x + 6 + cg_ofst, y + cg_ofst, cs->abbrev, TC_BLACK);
 			x += 14;
@@ -366,11 +330,11 @@
 			return;
 		}
 
-		int max = min(this->vscroll.pos + this->vscroll.cap, this->Length());
+		int max = min(this->vscroll.pos + this->vscroll.cap, this->stations.Length());
 		y = 40; // start of the list-widget
 
 		for (int i = this->vscroll.pos; i < max; ++i) { // do until max number of stations of owner
-			const Station *st = *this->Get(i);
+			const Station *st = this->stations[i];
 			int x;
 
 			assert(st->xy != 0);
@@ -404,9 +368,9 @@
 
 				id_v += this->vscroll.pos;
 
-				if (id_v >= this->Length()) return; // click out of list bound
+				if (id_v >= this->stations.Length()) return; // click out of list bound
 
-				const Station *st = *this->Get(id_v);
+				const Station *st = this->stations[id_v];
 				/* do not check HasStationInUse - it is slow and may be invalid */
 				assert(st->owner == (PlayerID)this->window_number || (st->owner == OWNER_NONE && !st->IsBuoy()));
 
@@ -424,18 +388,18 @@
 			case SLW_AIRPLANE:
 			case SLW_SHIP:
 				if (_ctrl_pressed) {
-					ToggleBit(facilities, widget - SLW_TRAIN);
+					ToggleBit(this->facilities, widget - SLW_TRAIN);
 					this->ToggleWidgetLoweredState(widget);
 				} else {
 					uint i;
-					FOR_EACH_SET_BIT(i, facilities) {
+					FOR_EACH_SET_BIT(i, this->facilities) {
 						this->RaiseWidget(i + SLW_TRAIN);
 					}
-					SetBit(facilities, widget - SLW_TRAIN);
+					SetBit(this->facilities, widget - SLW_TRAIN);
 					this->LowerWidget(widget);
 				}
-				this->SetWidgetLoweredState(SLW_FACILALL, facilities == (FACIL_TRAIN | FACIL_TRUCK_STOP | FACIL_BUS_STOP | FACIL_AIRPORT | FACIL_DOCK));
-				this->flags |= VL_REBUILD;
+				this->SetWidgetLoweredState(SLW_FACILALL, this->facilities == (FACIL_TRAIN | FACIL_TRUCK_STOP | FACIL_BUS_STOP | FACIL_AIRPORT | FACIL_DOCK));
+				this->stations.ForceRebuild();
 				this->SetDirty();
 				break;
 
@@ -445,8 +409,8 @@
 				}
 				this->LowerWidget(SLW_FACILALL);
 
-				facilities = FACIL_TRAIN | FACIL_TRUCK_STOP | FACIL_BUS_STOP | FACIL_AIRPORT | FACIL_DOCK;
-				this->flags |= VL_REBUILD;
+				this->facilities = FACIL_TRAIN | FACIL_TRUCK_STOP | FACIL_BUS_STOP | FACIL_AIRPORT | FACIL_DOCK;
+				this->stations.ForceRebuild();
 				this->SetDirty();
 				break;
 
@@ -460,42 +424,40 @@
 				this->LowerWidget(SLW_NOCARGOWAITING);
 				this->LowerWidget(SLW_CARGOALL);
 
-				_cargo_filter = _cargo_mask;
-				include_empty = true;
-				this->flags |= VL_REBUILD;
+				this->cargo_filter = _cargo_mask;
+				this->include_empty = true;
+				this->stations.ForceRebuild();
 				this->SetDirty();
 				break;
 			}
 
 			case SLW_SORTBY: // flip sorting method asc/desc
-				this->flags ^= VL_DESC; //DESC-flag
-				station_sort.order = HasBit(this->flags, 0);
-				this->flags |= VL_RESORT;
+				this->stations.ToggleSortOrder();
 				this->flags4 |= 5 << WF_TIMEOUT_SHL;
 				this->LowerWidget(SLW_SORTBY);
 				this->SetDirty();
 				break;
 
 			case SLW_SORTDROPBTN: // select sorting criteria dropdown menu
-				ShowDropDownMenu(this, _station_sort_listing, this->sort_type, SLW_SORTDROPBTN, 0, 0);
+				ShowDropDownMenu(this, this->sorter_names, this->stations.SortType(), SLW_SORTDROPBTN, 0, 0);
 				break;
 
 			case SLW_NOCARGOWAITING:
 				if (_ctrl_pressed) {
-					include_empty = !include_empty;
+					this->include_empty = !this->include_empty;
 					this->ToggleWidgetLoweredState(SLW_NOCARGOWAITING);
 				} else {
 					for (uint i = SLW_CARGOSTART; i < this->widget_count; i++) {
 						this->RaiseWidget(i);
 					}
 
-					_cargo_filter = 0;
-					include_empty = true;
+					this->cargo_filter = 0;
+					this->include_empty = true;
 
 					this->LowerWidget(SLW_NOCARGOWAITING);
 				}
-				this->flags |= VL_REBUILD;
-				this->SetWidgetLoweredState(SLW_CARGOALL, _cargo_filter == _cargo_mask && include_empty);
+				this->SetWidgetLoweredState(SLW_CARGOALL, this->cargo_filter == _cargo_mask && this->include_empty);
+				this->stations.ForceRebuild();
 				this->SetDirty();
 				break;
 
@@ -511,7 +473,7 @@
 					}
 
 					if (_ctrl_pressed) {
-						ToggleBit(_cargo_filter, c);
+						ToggleBit(this->cargo_filter, c);
 						this->ToggleWidgetLoweredState(widget);
 					} else {
 						for (uint i = SLW_CARGOSTART; i < this->widget_count; i++) {
@@ -519,14 +481,14 @@
 						}
 						this->RaiseWidget(SLW_NOCARGOWAITING);
 
-						_cargo_filter = 0;
-						include_empty = false;
+						this->cargo_filter = 0;
+						this->include_empty = false;
 
-						SetBit(_cargo_filter, c);
+						SetBit(this->cargo_filter, c);
 						this->LowerWidget(widget);
 					}
-					this->flags |= VL_REBUILD;
-					this->SetWidgetLoweredState(SLW_CARGOALL, _cargo_filter == _cargo_mask && include_empty);
+					this->SetWidgetLoweredState(SLW_CARGOALL, this->cargo_filter == _cargo_mask && this->include_empty);
+					this->stations.ForceRebuild();
 					this->SetDirty();
 				}
 				break;
@@ -535,22 +497,21 @@
 
 	virtual void OnDropdownSelect(int widget, int index)
 	{
-		if (this->sort_type != index) {
-			/* value has changed -> resort */
-			this->sort_type = index;
-			station_sort.criteria = this->sort_type;
-			this->flags |= VL_RESORT;
+		if (this->stations.SortType() != index) {
+			this->stations.SetSortType(index);
+
+			/* Display the current sort variant */
+			this->widget[SLW_SORTDROPBTN].data = this->sorter_names[this->stations.SortType()];
+
+			this->SetDirty();
 		}
-		this->SetDirty();
 	}
 
 	virtual void OnTick()
 	{
 		if (_pause_game != 0) return;
-		if (--this->resort_timer == 0) {
+		if (this->stations.NeedResort()) {
 			DEBUG(misc, 3, "Periodic rebuild station list player %d", this->window_number);
-			this->resort_timer = DAY_TICKS * PERIODIC_RESORT_DAYS;
-			this->flags |= VL_REBUILD;
 			this->SetDirty();
 		}
 	}
@@ -568,13 +529,37 @@
 
 	virtual void OnInvalidateData(int data)
 	{
-		this->flags |= (data == 0 ? VL_REBUILD : VL_RESORT);
+		if (data == 0) {
+			this->stations.ForceRebuild();
+		} else {
+			this->stations.ForceResort();
+		}
 	}
 };
 
-Listing PlayerStationsWindow::station_sort = {0, 0};
+Listing PlayerStationsWindow::last_sorting = {false, 0};
 byte PlayerStationsWindow::facilities = FACIL_TRAIN | FACIL_TRUCK_STOP | FACIL_BUS_STOP | FACIL_AIRPORT | FACIL_DOCK;
 bool PlayerStationsWindow::include_empty = true;
+const uint32 PlayerStationsWindow::cargo_filter_max = UINT32_MAX;
+uint32 PlayerStationsWindow::cargo_filter = UINT32_MAX;
+const Station *PlayerStationsWindow::last_station = NULL;
+
+/* Availible station sorting functions */
+GUIStationList::SortFunction *const PlayerStationsWindow::sorter_funcs[] = {
+	&StationNameSorter,
+	&StationTypeSorter,
+	&StationWaitingSorter,
+	&StationRatingMaxSorter
+};
+
+/* Names of the sorting functions */
+const StringID PlayerStationsWindow::sorter_names[] = {
+	STR_SORT_BY_DROPDOWN_NAME,
+	STR_SORT_BY_FACILITY,
+	STR_SORT_BY_WAITING,
+	STR_SORT_BY_RATING_MAX,
+	INVALID_STRING_ID
+};
 
 
 static const Widget _player_stations_widgets[] = {
@@ -736,7 +721,7 @@
 				cargolist.push_back(CargoData(i, INVALID_STATION, st->goods[i].cargo.Count()));
 
 				/* Set the row for this cargo entry for the expand/hide button */
-				this->cargo_rows[i] = cargolist.size();
+				this->cargo_rows[i] = (uint16)cargolist.size();
 
 				/* Add an entry for each distinct cargo source. */
 				const CargoList::List *packets = st->goods[i].cargo.Packets();
@@ -766,7 +751,7 @@
 				}
 			}
 		}
-		SetVScrollCount(this, cargolist.size() + 1); // update scrollbar
+		SetVScrollCount(this, (int)cargolist.size() + 1); // update scrollbar
 
 		/* disable some buttons */
 		this->SetWidgetDisabledState(SVW_RENAME,   st->owner != _local_player);
--- a/src/station_type.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/station_type.h	Tue Jun 17 10:32:49 2008 +0000
@@ -57,7 +57,7 @@
 	CA_TRAIN           =  4,
 	CA_DOCK            =  5,
 
-	CA_UNMODIFIED      =  4, ///< Used when _settings.station.modified_catchment is false
+	CA_UNMODIFIED      =  4, ///< Used when _settings_game.station.modified_catchment is false
 
 	MAX_CATCHMENT      = 10, ///< Airports have a catchment up to this number.
 };
--- a/src/statusbar_gui.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/statusbar_gui.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -82,7 +82,7 @@
 
 		this->DrawWidgets();
 		SetDParam(0, _date);
-		DrawStringCentered(70, 1, (_pause_game || _settings.gui.status_long_date) ? STR_00AF : STR_00AE, TC_FROMSTRING);
+		DrawStringCentered(70, 1, (_pause_game || _settings_client.gui.status_long_date) ? STR_00AF : STR_00AE, TC_FROMSTRING);
 
 		if (p != NULL) {
 			/* Draw player money */
--- a/src/stdafx.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/stdafx.h	Tue Jun 17 10:32:49 2008 +0000
@@ -201,6 +201,11 @@
 		typedef _W64 unsigned int UINT_PTR, *PUINT_PTR;
 	#endif /* WIN32 && !_WIN64 && !WIN64 */
 
+	#if defined(_WIN64) || defined(WIN64)
+		#define fseek _fseeki64
+	#endif /* _WIN64 || WIN64 */
+
+
 	#define GCC_PACK
 
 	/* This is needed to zlib uses the stdcall calling convention on visual studio */
@@ -312,6 +317,7 @@
 	#define CloseConnection OTTD_CloseConnection
 #endif /* __APPLE__ */
 
+void NORETURN CDECL usererror(const char *str, ...);
 void NORETURN CDECL error(const char *str, ...);
 #define NOT_REACHED() error("NOT_REACHED triggered at line %i of %s", __LINE__, __FILE__)
 
--- a/src/string_func.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/string_func.h	Tue Jun 17 10:32:49 2008 +0000
@@ -81,7 +81,7 @@
  * @param c Unicode character.
  * @return Length of UTF-8 encoding for character.
  */
-static inline size_t Utf8CharLen(WChar c)
+static inline int8 Utf8CharLen(WChar c)
 {
 	if (c < 0x80)       return 1;
 	if (c < 0x800)      return 2;
@@ -100,7 +100,7 @@
  * @param c char to query length of
  * @return requested size
  */
-static inline size_t Utf8EncodedCharLen(char c)
+static inline int8 Utf8EncodedCharLen(char c)
 {
 	if (GB(c, 3, 5) == 0x1E) return 4;
 	if (GB(c, 4, 4) == 0x0E) return 3;
--- a/src/strings.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/strings.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -178,7 +178,7 @@
 
 	if (index >= _langtab_num[tab]) {
 		error(
-			"!String 0x%X is invalid. "
+			"String 0x%X is invalid. "
 			"Probably because an old version of the .lng file.\n", string
 		);
 	}
@@ -546,7 +546,7 @@
  */
 uint ConvertSpeedToDisplaySpeed(uint speed)
 {
- return (speed * units[_settings.gui.units].s_m) >> units[_settings.gui.units].s_s;
+ return (speed * units[_settings_game.locale.units].s_m) >> units[_settings_game.locale.units].s_s;
 }
 
 /**
@@ -556,7 +556,7 @@
  */
 uint ConvertDisplaySpeedToSpeed(uint speed)
 {
-	return ((speed << units[_settings.gui.units].s_s) + units[_settings.gui.units].s_m / 2) / units[_settings.gui.units].s_m;
+	return ((speed << units[_settings_game.locale.units].s_s) + units[_settings_game.locale.units].s_m / 2) / units[_settings_game.locale.units].s_m;
 }
 
 static char* FormatString(char* buff, const char* str, const int64* argv, uint casei, const char* last)
@@ -602,9 +602,9 @@
 
 			case SCC_VELOCITY: {// {VELOCITY}
 				int64 args[1];
-				assert(_settings.gui.units < lengthof(units));
+				assert(_settings_game.locale.units < lengthof(units));
 				args[0] = ConvertSpeedToDisplaySpeed(GetInt32(&argv));
-				buff = FormatString(buff, GetStringPtr(units[_settings.gui.units].velocity), args, modifier >> 24, last);
+				buff = FormatString(buff, GetStringPtr(units[_settings_game.locale.units].velocity), args, modifier >> 24, last);
 				modifier = 0;
 				break;
 			}
@@ -625,18 +625,18 @@
 				switch (cargo_str) {
 					case STR_TONS: {
 						int64 args[1];
-						assert(_settings.gui.units < lengthof(units));
-						args[0] = GetInt32(&argv) * units[_settings.gui.units].w_m >> units[_settings.gui.units].w_s;
-						buff = FormatString(buff, GetStringPtr(units[_settings.gui.units].l_weight), args, modifier >> 24, last);
+						assert(_settings_game.locale.units < lengthof(units));
+						args[0] = GetInt32(&argv) * units[_settings_game.locale.units].w_m >> units[_settings_game.locale.units].w_s;
+						buff = FormatString(buff, GetStringPtr(units[_settings_game.locale.units].l_weight), args, modifier >> 24, last);
 						modifier = 0;
 						break;
 					}
 
 					case STR_LITERS: {
 						int64 args[1];
-						assert(_settings.gui.units < lengthof(units));
-						args[0] = GetInt32(&argv) * units[_settings.gui.units].v_m >> units[_settings.gui.units].v_s;
-						buff = FormatString(buff, GetStringPtr(units[_settings.gui.units].l_volume), args, modifier >> 24, last);
+						assert(_settings_game.locale.units < lengthof(units));
+						args[0] = GetInt32(&argv) * units[_settings_game.locale.units].v_m >> units[_settings_game.locale.units].v_s;
+						buff = FormatString(buff, GetStringPtr(units[_settings_game.locale.units].l_volume), args, modifier >> 24, last);
 						modifier = 0;
 						break;
 					}
@@ -718,9 +718,9 @@
 
 			case SCC_VOLUME: { // {VOLUME}
 				int64 args[1];
-				assert(_settings.gui.units < lengthof(units));
-				args[0] = GetInt32(&argv) * units[_settings.gui.units].v_m >> units[_settings.gui.units].v_s;
-				buff = FormatString(buff, GetStringPtr(units[_settings.gui.units].l_volume), args, modifier >> 24, last);
+				assert(_settings_game.locale.units < lengthof(units));
+				args[0] = GetInt32(&argv) * units[_settings_game.locale.units].v_m >> units[_settings_game.locale.units].v_s;
+				buff = FormatString(buff, GetStringPtr(units[_settings_game.locale.units].l_volume), args, modifier >> 24, last);
 				modifier = 0;
 				break;
 			}
@@ -763,45 +763,45 @@
 
 			case SCC_POWER: { // {POWER}
 				int64 args[1];
-				assert(_settings.gui.units < lengthof(units));
-				args[0] = GetInt32(&argv) * units[_settings.gui.units].p_m >> units[_settings.gui.units].p_s;
-				buff = FormatString(buff, GetStringPtr(units[_settings.gui.units].power), args, modifier >> 24, last);
+				assert(_settings_game.locale.units < lengthof(units));
+				args[0] = GetInt32(&argv) * units[_settings_game.locale.units].p_m >> units[_settings_game.locale.units].p_s;
+				buff = FormatString(buff, GetStringPtr(units[_settings_game.locale.units].power), args, modifier >> 24, last);
 				modifier = 0;
 				break;
 			}
 
 			case SCC_VOLUME_SHORT: { // {VOLUME_S}
 				int64 args[1];
-				assert(_settings.gui.units < lengthof(units));
-				args[0] = GetInt32(&argv) * units[_settings.gui.units].v_m >> units[_settings.gui.units].v_s;
-				buff = FormatString(buff, GetStringPtr(units[_settings.gui.units].s_volume), args, modifier >> 24, last);
+				assert(_settings_game.locale.units < lengthof(units));
+				args[0] = GetInt32(&argv) * units[_settings_game.locale.units].v_m >> units[_settings_game.locale.units].v_s;
+				buff = FormatString(buff, GetStringPtr(units[_settings_game.locale.units].s_volume), args, modifier >> 24, last);
 				modifier = 0;
 				break;
 			}
 
 			case SCC_WEIGHT: { // {WEIGHT}
 				int64 args[1];
-				assert(_settings.gui.units < lengthof(units));
-				args[0] = GetInt32(&argv) * units[_settings.gui.units].w_m >> units[_settings.gui.units].w_s;
-				buff = FormatString(buff, GetStringPtr(units[_settings.gui.units].l_weight), args, modifier >> 24, last);
+				assert(_settings_game.locale.units < lengthof(units));
+				args[0] = GetInt32(&argv) * units[_settings_game.locale.units].w_m >> units[_settings_game.locale.units].w_s;
+				buff = FormatString(buff, GetStringPtr(units[_settings_game.locale.units].l_weight), args, modifier >> 24, last);
 				modifier = 0;
 				break;
 			}
 
 			case SCC_WEIGHT_SHORT: { // {WEIGHT_S}
 				int64 args[1];
-				assert(_settings.gui.units < lengthof(units));
-				args[0] = GetInt32(&argv) * units[_settings.gui.units].w_m >> units[_settings.gui.units].w_s;
-				buff = FormatString(buff, GetStringPtr(units[_settings.gui.units].s_weight), args, modifier >> 24, last);
+				assert(_settings_game.locale.units < lengthof(units));
+				args[0] = GetInt32(&argv) * units[_settings_game.locale.units].w_m >> units[_settings_game.locale.units].w_s;
+				buff = FormatString(buff, GetStringPtr(units[_settings_game.locale.units].s_weight), args, modifier >> 24, last);
 				modifier = 0;
 				break;
 			}
 
 			case SCC_FORCE: { // {FORCE}
 				int64 args[1];
-				assert(_settings.gui.units < lengthof(units));
-				args[0] = GetInt32(&argv) * units[_settings.gui.units].f_m >> units[_settings.gui.units].f_s;
-				buff = FormatString(buff, GetStringPtr(units[_settings.gui.units].force), args, modifier >> 24, last);
+				assert(_settings_game.locale.units < lengthof(units));
+				args[0] = GetInt32(&argv) * units[_settings_game.locale.units].f_m >> units[_settings_game.locale.units].f_s;
+				buff = FormatString(buff, GetStringPtr(units[_settings_game.locale.units].force), args, modifier >> 24, last);
 				modifier = 0;
 				break;
 			}
@@ -1137,7 +1137,7 @@
 	const char* const* base;
 	uint num;
 
-	if (_settings.game_creation.landscape == LT_TOYLAND) {
+	if (_settings_game.game_creation.landscape == LT_TOYLAND) {
 		base = _silly_surname_list;
 		num  = lengthof(_silly_surname_list);
 	} else {
@@ -1167,7 +1167,7 @@
 		buff = strecpy(buff, initial, last);
 	}
 
-	if (_settings.game_creation.landscape == LT_TOYLAND) {
+	if (_settings_game.game_creation.landscape == LT_TOYLAND) {
 		base = _silly_surname_list;
 		num  = lengthof(_silly_surname_list);
 	} else {
@@ -1427,7 +1427,7 @@
 		FioAppendDirectory(path, lengthof(path), sp, LANG_DIR);
 		language_count += GetLanguageList(files, language_count, lengthof(files), path);
 	}
-	if (language_count == 0) error("No available language packs (invalid versions?)");
+	if (language_count == 0) usererror("No available language packs (invalid versions?)");
 
 	/* Acquire the locale of the current system */
 	const char *lang = GetCurrentLocale("LC_MESSAGES");
@@ -1463,7 +1463,7 @@
 		dl->num++;
 	}
 
-	if (dl->num == 0) error("Invalid version of language packs");
+	if (dl->num == 0) usererror("Invalid version of language packs");
 
 	/* We haven't found the language in the config nor the one in the locale.
 	 * Now we set it to one of the fallback languages */
@@ -1471,7 +1471,7 @@
 		chosen_language = (language_fallback != -1) ? language_fallback : en_GB_fallback;
 	}
 
-	if (!ReadLanguagePack(chosen_language)) error("Can't read language pack '%s'", dl->ent[chosen_language].file);
+	if (!ReadLanguagePack(chosen_language)) usererror("Can't read language pack '%s'", dl->ent[chosen_language].file);
 }
 
 /**
--- a/src/subsidy_gui.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/subsidy_gui.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -37,23 +37,29 @@
 		for (const Subsidy *s = _subsidies; s != endof(_subsidies); s++) {
 			if (s->cargo_type != CT_INVALID && s->age < 12) {
 				y -= 10;
-				if (y < 0) this->HandleClick(s);
+				if (y < 0) {
+					this->HandleClick(s);
+					return;
+				}
 				num++;
 			}
 		}
 
 		if (num == 0) {
-			y -= 10;
+			y -= 10; // "None"
 			if (y < 0) return;
 		}
 
-		y -= 11;
+		y -= 11; // "Services already subsidised:"
 		if (y < 0) return;
 
 		for (const Subsidy *s = _subsidies; s != endof(_subsidies); s++) {
 			if (s->cargo_type != CT_INVALID && s->age >= 12) {
 				y -= 10;
-				if (y < 0) this->HandleClick(s);
+				if (y < 0) {
+					this->HandleClick(s);
+					return;
+				}
 			}
 		}
 	}
--- a/src/table/engines.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/table/engines.h	Tue Jun 17 10:32:49 2008 +0000
@@ -18,7 +18,7 @@
 /** Writes the properties of a train or road vehicle into the EngineInfo struct.
  * @see EngineInfo
  * @param a Introduction date
- * @param b unk2, flag for carriage(bit 7) and decay speed(bits0..6)
+ * @param b decay speed
  * @param c life length
  * @param d base life
  * @param e Bitmask of the climates
@@ -29,18 +29,18 @@
 
 /** Writes the properties of a train carriage into the EngineInfo struct.
  * @param a Introduction date
- * @param b unk2, flag for carriage(bit 7) and decay speed(bits0..6)
+ * @param b decay speed
  * @param c life length
  * @param d base life
  * @param e Bitmask of the climates
  * @see MK
  * @note the 5 between d and e is the load amount
  */
-#define MW(a, b, c, d, e) { DAYS_TILL_ORIGINAL_BASE_YEAR + a, c, d, b | 0x80, 5, e, 0, 8, 0, 0, 0, STR_EMPTY }
+#define MW(a, b, c, d, e) { DAYS_TILL_ORIGINAL_BASE_YEAR + a, c, d, b, 5, e, 0, 8, 0, 0, 0, STR_EMPTY }
 
 /** Writes the properties of a ship into the EngineInfo struct.
  * @param a Introduction date
- * @param b unk2, flag for carriage(bit 7) and decay speed(bits0..6)
+ * @param b decay speed
  * @param c life length
  * @param d base life
  * @param e Bitmask of the climates
@@ -51,7 +51,7 @@
 
 /** Writes the properties of an aeroplane into the EngineInfo struct.
  * @param a Introduction date
- * @param b unk2, flag for carriage(bit 7) and decay speed(bits0..6)
+ * @param b decay speed
  * @param c life length
  * @param d base life
  * @param e Bitmask of the climates
--- a/src/table/files.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/table/files.h	Tue Jun 17 10:32:49 2008 +0000
@@ -33,7 +33,7 @@
 		{ "TRGT.GRF",      {0xfc, 0xde, 0x1d, 0x7e, 0x8a, 0x74, 0x19, 0x7d, 0x72, 0xa6, 0x26, 0x95, 0x88, 0x4b, 0x90, 0x9e} }
 	},
 	{ "SAMPLE.CAT",    {0x42, 0x2e, 0xa3, 0xdd, 0x07, 0x4d, 0x28, 0x59, 0xbb, 0x51, 0x63, 0x9a, 0x6e, 0x0e, 0x85, 0xda} },
-	{ "OPENTTDD.GRF",  {0xbd, 0x4a, 0xe3, 0x63, 0x5c, 0xf4, 0x58, 0x12, 0x27, 0x32, 0xaa, 0x9b, 0x61, 0xfb, 0x61, 0xe6} }
+	{ "OPENTTDD.GRF",  {0xfa, 0x57, 0xbe, 0xb3, 0xb7, 0xe1, 0x9b, 0xa2, 0x38, 0x8f, 0x1a, 0xb7, 0xce, 0x2a, 0x93, 0x59} }
 };
 
 static FileList files_win = {
@@ -46,5 +46,5 @@
 		{ "TRGTR.GRF",     {0xde, 0x53, 0x65, 0x05, 0x17, 0xfe, 0x66, 0x1c, 0xea, 0xa3, 0x13, 0x8c, 0x6e, 0xdb, 0x0e, 0xb8} }
 	},
 	{ "SAMPLE.CAT",    {0x92, 0x12, 0xe8, 0x1e, 0x72, 0xba, 0xdd, 0x4b, 0xbe, 0x1e, 0xae, 0xae, 0x66, 0x45, 0x8e, 0x10} },
-	{ "OPENTTDW.GRF",  {0x06, 0xd0, 0x4e, 0x75, 0x65, 0x4d, 0x7c, 0x65, 0xa5, 0xb5, 0x44, 0xfb, 0x82, 0xe3, 0xcb, 0x6d} }
+	{ "OPENTTDW.GRF",  {0x3e, 0xe0, 0x24, 0xcd, 0x32, 0xa0, 0xd1, 0xd3, 0x21, 0xbc, 0x31, 0x7f, 0x22, 0x13, 0x6e, 0x81} }
 };
--- a/src/table/sprites.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/table/sprites.h	Tue Jun 17 10:32:49 2008 +0000
@@ -49,7 +49,7 @@
 
 	/* Extra graphic spritenumbers */
 	SPR_OPENTTD_BASE     = 4896,
-	OPENTTD_SPRITE_COUNT = 144,
+	OPENTTD_SPRITE_COUNT = 145,
 
 	/* Halftile-selection sprites */
 	SPR_HALFTILE_SELECTION_FLAT = SPR_OPENTTD_BASE,
@@ -122,6 +122,8 @@
 	SPR_GROUP_REPLACE_OFF_SHIP     = SPR_OPENTTD_BASE + 132,
 	SPR_GROUP_REPLACE_OFF_AIRCRAFT = SPR_OPENTTD_BASE + 133,
 
+	SPR_SWITCH_TOOLBAR = SPR_OPENTTD_BASE + 144,
+
 	SPR_SIGNALS_BASE  = SPR_OPENTTD_BASE + OPENTTD_SPRITE_COUNT,
 	PRESIGNAL_SPRITE_COUNT                   =  48,
 	PRESIGNAL_AND_SEMAPHORE_SPRITE_COUNT     = 112,
--- a/src/table/town_land.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/table/town_land.h	Tue Jun 17 10:32:49 2008 +0000
@@ -1809,8 +1809,8 @@
 	/**
 	 *                                                              remove_rating_decrease
 	 *                                                               |    mail_generation
-	 *     min_date                                                  |    |    1st CargoID acceptance
-	 *     |         max_date                                        |    |    |    2nd CargoID acceptance
+	 *     min_year                                                  |    |    1st CargoID acceptance
+	 *     |         max_year                                        |    |    |    2nd CargoID acceptance
 	 *     |         |    population                                 |    |    |    |    3th CargoID acceptance
 	 *     |         |    |    removal_cost                          |    |    |    |    |
 	 *     |         |    |    |    building_name                    |    |    |    |    |
--- a/src/terraform_gui.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/terraform_gui.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -550,7 +550,7 @@
 
 static void EditorTerraformClick_DesertLightHouse(Window *w)
 {
-	HandlePlacePushButton(w, ETTW_PLACE_DESERT_LIGHTHOUSE, SPR_CURSOR_LIGHTHOUSE, VHM_RECT, (_settings.game_creation.landscape == LT_TROPIC) ? PlaceProc_DesertArea : PlaceProc_LightHouse);
+	HandlePlacePushButton(w, ETTW_PLACE_DESERT_LIGHTHOUSE, SPR_CURSOR_LIGHTHOUSE, VHM_RECT, (_settings_game.game_creation.landscape == LT_TROPIC) ? PlaceProc_DesertArea : PlaceProc_LightHouse);
 }
 
 static void EditorTerraformClick_Transmitter(Window *w)
@@ -615,7 +615,7 @@
 struct ScenarioEditorLandscapeGenerationWindow : Window {
 	ScenarioEditorLandscapeGenerationWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number)
 	{
-		this->widget[ETTW_PLACE_DESERT_LIGHTHOUSE].tooltips = (_settings.game_creation.landscape == LT_TROPIC) ? STR_028F_DEFINE_DESERT_AREA : STR_028D_PLACE_LIGHTHOUSE;
+		this->widget[ETTW_PLACE_DESERT_LIGHTHOUSE].tooltips = (_settings_game.game_creation.landscape == LT_TROPIC) ? STR_028F_DEFINE_DESERT_AREA : STR_028D_PLACE_LIGHTHOUSE;
 		this->FindWindowPlacementAndResize(desc);
 	}
 
--- a/src/texteff.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/texteff.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -392,7 +392,7 @@
 						dpi->top  <= te->bottom &&
 						dpi->left + dpi->width  > te->x &&
 						dpi->top  + dpi->height > te->y) {
-					if (te->mode == TE_RISING || (_settings.gui.loading_indicators && !IsTransparencySet(TO_LOADING))) {
+					if (te->mode == TE_RISING || (_settings_client.gui.loading_indicators && !IsTransparencySet(TO_LOADING))) {
 						AddStringToDraw(te->x, te->y, te->string_id, te->params_1, te->params_2);
 					}
 				}
@@ -407,7 +407,7 @@
 						dpi->top  <= te->bottom * 2 - te->y &&
 						dpi->left + dpi->width  > te->x &&
 						dpi->top  + dpi->height > te->y) {
-					if (te->mode == TE_RISING || (_settings.gui.loading_indicators && !IsTransparencySet(TO_LOADING))) {
+					if (te->mode == TE_RISING || (_settings_client.gui.loading_indicators && !IsTransparencySet(TO_LOADING))) {
 						AddStringToDraw(te->x, te->y, (StringID)(te->string_id - 1), te->params_1, te->params_2);
 					}
 				}
--- a/src/tgp.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/tgp.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -211,10 +211,10 @@
 	{1500, 1000, 1200, 1000,  500,   32,    20,    0,    0,    0,    0,    0},
 };
 
-/** Desired water percentage (100% == 1024) - indexed by _settings.difficulty.quantity_sea_lakes */
+/** Desired water percentage (100% == 1024) - indexed by _settings_game.difficulty.quantity_sea_lakes */
 static const amplitude_t _water_percent[4] = {20, 80, 250, 400};
 
-/** Desired maximum height - indexed by _settings.difficulty.terrain_type */
+/** Desired maximum height - indexed by _settings_game.difficulty.terrain_type */
 static const int8 _max_height[4] = {
 	6,       ///< Very flat
 	9,       ///< Flat
@@ -342,7 +342,7 @@
 	do {
 		log_frequency = iteration_round - log_frequency_min;
 		if (log_frequency >= 0) {
-			amplitude = _amplitudes_by_smoothness_and_frequency[_settings.game_creation.tgen_smoothness][log_frequency];
+			amplitude = _amplitudes_by_smoothness_and_frequency[_settings_game.game_creation.tgen_smoothness][log_frequency];
 		} else {
 			amplitude = 0;
 		}
@@ -402,7 +402,7 @@
 		/* Transform height into 0..1 space */
 		fheight = (double)(*h - h_min) / (double)(h_max - h_min);
 		/* Apply sine transform depending on landscape type */
-		switch(_settings.game_creation.landscape) {
+		switch(_settings_game.game_creation.landscape) {
 			case LT_TOYLAND:
 			case LT_TEMPERATE:
 				/* Move and scale 0..1 into -1..+1 */
@@ -531,7 +531,7 @@
  */
 static void HeightMapCoastLines()
 {
-	int smallest_size = min(_settings.game_creation.map_x, _settings.game_creation.map_y);
+	int smallest_size = min(_settings_game.game_creation.map_x, _settings_game.game_creation.map_y);
 	const int margin = 4;
 	uint y, x;
 	double max_x;
@@ -661,9 +661,9 @@
  *  - height histogram redistribution by sine wave transform */
 static void HeightMapNormalize()
 {
-	const amplitude_t water_percent = _water_percent[_settings.difficulty.quantity_sea_lakes];
-	const height_t h_max_new = I2H(_max_height[_settings.difficulty.terrain_type]);
-	const height_t roughness = 7 + 3 * _settings.game_creation.tgen_smoothness;
+	const amplitude_t water_percent = _water_percent[_settings_game.difficulty.quantity_sea_lakes];
+	const height_t h_max_new = I2H(_max_height[_settings_game.difficulty.terrain_type]);
+	const height_t roughness = 7 + 3 * _settings_game.game_creation.tgen_smoothness;
 
 	HeightMapAdjustWaterLevel(water_percent, h_max_new);
 
@@ -692,7 +692,7 @@
  */
 static double int_noise(const long x, const long y, const int prime)
 {
-	long n = x + y * prime + _settings.game_creation.generation_seed;
+	long n = x + y * prime + _settings_game.game_creation.generation_seed;
 
 	n = (n << 13) ^ n;
 
--- a/src/thread.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/thread.h	Tue Jun 17 10:32:49 2008 +0000
@@ -5,7 +5,7 @@
 #ifndef THREAD_H
 #define THREAD_H
 
-typedef void * (CDECL *OTTDThreadFunc)(void *);
+typedef void (*OTTDThreadFunc)(void *);
 
 /**
  * A Thread Object which works on all our supported OSes.
@@ -37,7 +37,7 @@
 	/**
 	 * Join this thread.
 	 */
-	virtual void *Join() = 0;
+	virtual void Join() = 0;
 
 	/**
 	 * Check if this thread is the current active thread.
@@ -64,7 +64,7 @@
 	 * Convert the current thread to a new ThreadObject.
 	 * @return A new ThreadObject with the current thread attached to it.
 	 */
-	static ThreadObject* AttachCurrent();
+	static ThreadObject *AttachCurrent();
 
 	/**
 	 * Find the Id of the current running thread.
--- a/src/thread_morphos.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/thread_morphos.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -34,7 +34,6 @@
 	struct Message msg;  ///< standard exec.library message (MUST be the first thing in the message struct!)
 	OTTDThreadFunc func; ///< function the thread will execute
 	void *arg;           ///< functions arguments for the thread function
-	void *ret;           ///< return value of the thread function
 };
 
 
@@ -79,7 +78,6 @@
 		/* Things we'll pass down to the child by utilizing NP_StartupMsg */
 		m_msg.func = proc;
 		m_msg.arg  = param;
-		m_msg.ret  = NULL;
 
 		m_replyport = CreateMsgPort();
 
@@ -161,10 +159,9 @@
 		return true;
 	}
 
-	/* virtual */ void *Join()
+	/* virtual */ void Join()
 	{
 		struct OTTDThreadStartupMessage *reply;
-		void *ret;
 
 		/* You cannot join yourself */
 		assert(!IsCurrent());
@@ -173,13 +170,9 @@
 		KPutStr("[OpenTTD] Wait for child to quit...\n");
 		WaitPort(m_replyport);
 
-		reply = (struct OTTDThreadStartupMessage *)GetMsg(m_replyport);
-		ret   = reply->ret;
-
+		GetMsg(m_replyport);
 		DeleteMsgPort(m_replyport);
 		m_thr = 0;
-
-		return ret;
 	}
 
 	/* virtual */ bool IsCurrent()
@@ -209,7 +202,7 @@
 
 		if (NewGetTaskAttrs(NULL, &msg, sizeof(struct OTTDThreadStartupMessage *), TASKINFOTYPE_STARTUPMSG, TAG_DONE) && msg != NULL) {
 			try {
-				msg->ret = msg->func(msg->arg);
+				msg->func(msg->arg);
 			} catch(...) {
 				KPutStr("[Child] Returned to main()\n");
 			}
@@ -256,7 +249,7 @@
 
 	/* virtual */ void Set()
 	{
-		// Check if semaphore count is really important there.
+		/* Check if semaphore count is really important there. */
 		ReleaseSemaphore(&m_sem);
 	}
 
--- a/src/thread_pthread.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/thread_pthread.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -95,18 +95,15 @@
 		throw 0;
 	}
 
-	/* virtual */ void *Join()
+	/* virtual */ void Join()
 	{
 		/* You cannot join yourself */
 		assert(!IsCurrent());
 
-		void *ret;
-		pthread_join(m_thr, &ret);
+		pthread_join(m_thr, NULL);
 		m_thr = 0;
 
 		delete this;
-
-		return ret;
 	}
 
 	/* virtual */ bool IsCurrent()
@@ -126,14 +123,15 @@
 	 */
 	static void *stThreadProc(void *thr)
 	{
-		return ((ThreadObject_pthread *)thr)->ThreadProc();
+		((ThreadObject_pthread *)thr)->ThreadProc();
+		pthread_exit(NULL);
 	}
 
 	/**
 	 * A new thread is created, and this function is called. Call the custom
 	 *  function of the creator of the thread.
 	 */
-	void *ThreadProc()
+	void ThreadProc()
 	{
 		/* The new thread stops here so the calling thread can complete pthread_create() call */
 		sem_wait(&m_sem_start);
@@ -152,8 +150,6 @@
 		sem_post(&m_sem_stop);
 
 		if (exit) delete this;
-
-		pthread_exit(NULL);
 	}
 };
 
--- a/src/thread_win32.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/thread_win32.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -20,7 +20,6 @@
 	OTTDThreadFunc m_proc;
 	void     *m_param;
 	bool     m_attached;
-	void     *ret;
 
 public:
 	/**
@@ -91,14 +90,12 @@
 		throw 0;
 	}
 
-	/* virtual */ void *Join()
+	/* virtual */ void Join()
 	{
 		/* You cannot join yourself */
 		assert(!IsCurrent());
 
 		WaitForSingleObject(m_h_thr, INFINITE);
-
-		return this->ret;
 	}
 
 	/* virtual */ bool IsCurrent()
@@ -119,21 +116,20 @@
 	 */
 	static uint CALLBACK stThreadProc(void *thr)
 	{
-		return ((ThreadObject_Win32 *)thr)->ThreadProc();
+		((ThreadObject_Win32 *)thr)->ThreadProc();
+		return 0;
 	}
 
 	/**
 	 * A new thread is created, and this function is called. Call the custom
 	 *  function of the creator of the thread.
 	 */
-	uint ThreadProc()
+	void ThreadProc()
 	{
 		try {
-			this->ret = m_proc(m_param);
+			m_proc(m_param);
 		} catch (...) {
 		}
-
-		return 0;
 	}
 };
 
--- a/src/timetable_cmd.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/timetable_cmd.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -54,7 +54,7 @@
  */
 CommandCost CmdChangeTimetable(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
 {
-	if (!_settings.order.timetabling) return CMD_ERROR;
+	if (!_settings_game.order.timetabling) return CMD_ERROR;
 
 	VehicleID veh = GB(p1, 0, 16);
 	if (!IsValidVehicleID(veh)) return CMD_ERROR;
@@ -90,7 +90,7 @@
  */
 CommandCost CmdSetVehicleOnTime(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
 {
-	if (!_settings.order.timetabling) return CMD_ERROR;
+	if (!_settings_game.order.timetabling) return CMD_ERROR;
 
 	VehicleID veh = GB(p1, 0, 16);
 	if (!IsValidVehicleID(veh)) return CMD_ERROR;
@@ -116,7 +116,7 @@
  */
 CommandCost CmdAutofillTimetable(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
 {
-	if (!_settings.order.timetabling) return CMD_ERROR;
+	if (!_settings_game.order.timetabling) return CMD_ERROR;
 
 	VehicleID veh = GB(p1, 0, 16);
 	if (!IsValidVehicleID(veh)) return CMD_ERROR;
@@ -157,7 +157,7 @@
 
 	v->current_order_time = 0;
 
-	if (!_settings.order.timetabling) return;
+	if (!_settings_game.order.timetabling) return;
 
 	/* Make sure the timetable only starts when the vehicle reaches the first
 	 * order, not when travelling from the depot to the first station. */
--- a/src/timetable_gui.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/timetable_gui.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -38,7 +38,7 @@
 
 void SetTimetableParams(int param1, int param2, uint32 time)
 {
-	if (_settings.gui.timetable_in_ticks) {
+	if (_settings_client.gui.timetable_in_ticks) {
 		SetDParam(param1, STR_TIMETABLE_TICKS);
 		SetDParam(param2, time);
 	} else {
@@ -172,7 +172,7 @@
 		}
 		y += 10;
 
-		if (v->lateness_counter == 0 || (!_settings.gui.timetable_in_ticks && v->lateness_counter / DAY_TICKS == 0)) {
+		if (v->lateness_counter == 0 || (!_settings_client.gui.timetable_in_ticks && v->lateness_counter / DAY_TICKS == 0)) {
 			DrawString(2, y, STR_TIMETABLE_STATUS_ON_TIME, TC_BLACK);
 		} else {
 			SetTimetableParams(0, 1, abs(v->lateness_counter));
@@ -222,7 +222,7 @@
 
 				if (order != NULL) {
 					uint time = (selected % 2 == 1) ? order->travel_time : order->wait_time;
-					if (!_settings.gui.timetable_in_ticks) time /= DAY_TICKS;
+					if (!_settings_client.gui.timetable_in_ticks) time /= DAY_TICKS;
 
 					if (time != 0) {
 						SetDParam(0, time);
@@ -259,7 +259,7 @@
 		uint32 p1 = PackTimetableArgs(v, this->sel_index);
 
 		uint64 time = StrEmpty(str) ? 0 : strtoul(str, NULL, 10);
-		if (!_settings.gui.timetable_in_ticks) time *= DAY_TICKS;
+		if (!_settings_client.gui.timetable_in_ticks) time *= DAY_TICKS;
 
 		uint32 p2 = minu(time, MAX_UVALUE(uint16));
 
--- a/src/toolbar_gui.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/toolbar_gui.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -47,10 +47,19 @@
 
 static void PopupMainToolbMenu(Window *parent, uint16 parent_button, StringID base_string, byte item_count, byte disabled_mask = 0, int sel_index = 0, int checked_items = 0);
 static void PopupMainPlayerToolbMenu(Window *parent, int main_button, int gray);
+static void SplitToolbar(Window *w);
 
 RailType _last_built_railtype;
 RoadType _last_built_roadtype;
 
+enum ToolbarMode {
+	TB_NORMAL,
+	TB_UPPER,
+	TB_LOWER
+};
+
+static ToolbarMode _toolbar_mode;
+
 static void SelectSignTool()
 {
 	if (_cursor.sprite == SPR_CURSOR_SIGN) {
@@ -282,7 +291,7 @@
 
 static void ToolbarGraphsClick(Window *w)
 {
-	PopupMainToolbMenu(w, 10, STR_0154_OPERATING_PROFIT_GRAPH, 6);
+	PopupMainToolbMenu(w, 10, STR_0154_OPERATING_PROFIT_GRAPH, (_toolbar_mode == TB_NORMAL) ? 6 : 8);
 }
 
 static void MenuClickGraphs(int index)
@@ -294,6 +303,9 @@
 		case 3: ShowPerformanceHistoryGraph(); break;
 		case 4: ShowCompanyValueGraph();       break;
 		case 5: ShowCargoPaymentRates();       break;
+		/* functions for combined graphs/league button */
+		case 6: ShowCompanyLeagueTable();      break;
+		case 7: ShowPerformanceRatingDetail(); break;
 	}
 }
 
@@ -533,6 +545,22 @@
 	}
 }
 
+/* --- Switch toolbar button --- */
+
+static void ToolbarSwitchClick(Window *w)
+{
+	if (_toolbar_mode != TB_LOWER) {
+		_toolbar_mode = TB_LOWER;
+	} else {
+		_toolbar_mode = TB_UPPER;
+	}
+
+	SplitToolbar(w);
+	w->HandleButtonClick(27);
+	SetWindowDirty(w);
+	SndPlayFx(SND_15_BEEP);
+}
+
 /* --- Scenario editor specific handlers. */
 
 static void ToolbarScenDateBackward(Window *w)
@@ -631,6 +659,90 @@
 {
 }
 
+/* --- Resizing the toolbar */
+
+static void ResizeToolbar(Window *w)
+{
+	/* There are 27 buttons plus some spacings if the space allows it */
+	uint button_width;
+	uint spacing;
+	if (w->width >= 27 * 22) {
+		button_width = 22;
+		spacing = w->width - (27 * button_width);
+	} else {
+		button_width = w->width / 27;
+		spacing = 0;
+	}
+	uint extra_spacing_at[] = { 4, 8, 13, 17, 19, 24, 0 };
+
+	for (uint i = 0, x = 0, j = 0; i < 27; i++) {
+		if (extra_spacing_at[j] == i) {
+			j++;
+			uint add = spacing / (lengthof(extra_spacing_at) - j);
+			spacing -= add;
+			x += add;
+		}
+
+		w->widget[i].type = WWT_IMGBTN;
+		w->widget[i].left = x;
+		x += (spacing != 0) ? button_width : (w->width - x) / (27 - i);
+		w->widget[i].right = x - 1;
+	}
+
+	w->widget[27].type = WWT_EMPTY;
+	_toolbar_mode = TB_NORMAL;
+}
+
+/* --- Split the toolbar */
+
+static void SplitToolbar(Window *w)
+{
+	static const byte arrange14[] = {
+		0,  1, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 27,
+		2,  3,  4,  5,  6,  7,  8,  9, 10, 12, 24, 25, 26, 27,
+	};
+	static const byte arrange15[] = {
+		0,  1,  4, 13, 14, 15, 16, 19, 20, 21, 22, 23, 17, 18, 27,
+		0,  2,  4,  3,  5,  6,  7,  8,  9, 10, 12, 24, 25, 26, 27,
+	};
+	static const byte arrange16[] = {
+		0,  1,  2,  4, 13, 14, 15, 16, 19, 20, 21, 22, 23, 17, 18, 27,
+		0,  1,  3,  5,  6,  7,  8,  9, 10, 12, 24, 25, 26, 17, 18, 27,
+	};
+	static const byte arrange17[] = {
+		0,  1,  2,  4,  6, 13, 14, 15, 16, 19, 20, 21, 22, 23, 17, 18, 27,
+		0,  1,  3,  4,  6,  5,  7,  8,  9, 10, 12, 24, 25, 26, 17, 18, 27,
+	};
+	static const byte arrange18[] = {
+		0,  1,  2,  4,  5,  6,  7,  8,  9, 12, 19, 20, 21, 22, 23, 17, 18, 27,
+		0,  1,  3,  4,  5,  6,  7, 10, 13, 14, 15, 16, 24, 25, 26, 17, 18, 27,
+	};
+	static const byte arrange19[] = {
+		0,  1,  2,  4,  5,  6, 13, 14, 15, 16, 19, 20, 21, 22, 23, 24, 17, 18, 27,
+		0,  1,  3,  4,  7,  8,  9, 10, 12, 25, 19, 20, 21, 22, 23, 26, 17, 18, 27,
+	};
+
+	static const byte *arrangements[] = { arrange14, arrange15, arrange16, arrange17, arrange18, arrange19 };
+
+	static const uint icon_size = 22;
+	uint max_icons = max(14U, (w->width + icon_size / 2) / icon_size);
+
+	assert(max_icons >= 14 && max_icons <= 19);
+
+	/* first hide all icons */
+	for (uint i = 0; i < 27; i++) {
+		w->widget[i].type = WWT_EMPTY;
+	}
+
+	/* now activate them all on their proper positions */
+	for (uint i = 0, x = 0, n = max_icons - 14; i < max_icons; i++) {
+		uint icon = arrangements[n][i + ((_toolbar_mode == TB_LOWER) ? max_icons : 0)];
+		w->widget[icon].type = WWT_IMGBTN;
+		w->widget[icon].left = x;
+		x += (w->width - x) / (max_icons - i);
+		w->widget[icon].right = x - 1;
+	}
+}
 
 /* --- Toolbar handling for the 'normal' case */
 
@@ -664,6 +776,7 @@
 	ToolbarMusicClick,
 	ToolbarNewspaperClick,
 	ToolbarHelpClick,
+	ToolbarSwitchClick,
 };
 
 struct MainToolbarWindow : Window {
@@ -774,29 +887,10 @@
 
 	virtual void OnResize(Point new_size, Point delta)
 	{
-		/* There are 27 buttons plus some spacings if the space allows it */
-		uint button_width;
-		uint spacing;
-		if (this->width >= 27 * 22) {
-			button_width = 22;
-			spacing = this->width - (27 * button_width);
+		if (this->width <= 19 * 22) {
+			SplitToolbar(this);
 		} else {
-			button_width = this->width / 27;
-			spacing = 0;
-		}
-		uint extra_spacing_at[] = { 4, 8, 13, 17, 19, 24, 0 };
-
-		for (uint i = 0, x = 0, j = 0; i < 27; i++) {
-			if (extra_spacing_at[j] == i) {
-				j++;
-				uint add = spacing / (lengthof(extra_spacing_at) - j);
-				spacing -= add;
-				x += add;
-			}
-
-			this->widget[i].left = x;
-			x += (spacing != 0) ? button_width : (this->width - x) / (27 - i);
-			this->widget[i].right = x - 1;
+			ResizeToolbar(this);
 		}
 	}
 
@@ -850,6 +944,7 @@
 {     WWT_IMGBTN,   RESIZE_NONE,    14,     0,     0,     0,    21, SPR_IMG_MUSIC,           STR_01D4_SHOW_SOUND_MUSIC_WINDOW},
 {     WWT_IMGBTN,   RESIZE_NONE,    14,     0,     0,     0,    21, SPR_IMG_MESSAGES,        STR_0203_SHOW_LAST_MESSAGE_NEWS},
 {     WWT_IMGBTN,   RESIZE_NONE,    14,     0,     0,     0,    21, SPR_IMG_QUERY,           STR_0186_LAND_BLOCK_INFORMATION},
+{     WWT_IMGBTN,   RESIZE_NONE,    14,     0,     0,     0,    21, SPR_SWITCH_TOOLBAR,      STR_EMPTY}, // switch toolbar button. only active when toolbar has been split
 {   WIDGETS_END},
 };
 
--- a/src/town.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/town.h	Tue Jun 17 10:32:49 2008 +0000
@@ -16,6 +16,7 @@
 #include "settings_type.h"
 #include "strings_type.h"
 #include "viewport_type.h"
+#include "economy_type.h"
 
 enum {
 	HOUSE_NO_CLASS   = 0,
@@ -197,7 +198,7 @@
 	inline uint16 MaxTownNoise() const {
 		if (this->population == 0) return 0; // no population? no noise
 
-		return ((this->population / _settings.economy.town_noise_population[_settings.difficulty.town_council_tolerance]) + 3);
+		return ((this->population / _settings_game.economy.town_noise_population[_settings_game.difficulty.town_council_tolerance]) + 3);
 	}
 };
 
@@ -207,13 +208,13 @@
  */
 inline TownLayout Town::GetActiveLayout() const
 {
-	return (_settings.economy.town_layout == TL_RANDOM) ? this->layout : _settings.economy.town_layout;
+	return (_settings_game.economy.town_layout == TL_RANDOM) ? this->layout : _settings_game.economy.town_layout;
 }
 
 struct HouseSpec {
 	/* Standard properties */
-	Year min_date;                     ///< introduction year of the house
-	Year max_date;                     ///< last year it can be built
+	Year min_year;                     ///< introduction year of the house
+	Year max_year;                     ///< last year it can be built
 	byte population;                   ///< population (Zero on other tiles in multi tile house.)
 	byte removal_cost;                 ///< cost multiplier for removing it
 	StringID building_name;            ///< building name
@@ -242,6 +243,13 @@
 	/* grf file related properties*/
 	uint8 local_id;                    ///< id defined by the grf file for this house
 	const struct GRFFile *grffile;     ///< grf file that introduced this house
+
+	/**
+	 * Get the cost for removing this house
+	 * @return the cost (inflation corrected etc)
+	 */
+	Money GetRemovalCost() const;
+
 };
 
 extern HouseSpec _house_specs[HOUSE_MAX];
@@ -345,10 +353,6 @@
 #define FOR_ALL_TOWNS_FROM(t, start) for (t = GetTown(start); t != NULL; t = (t->index + 1U < GetTownPoolSize()) ? GetTown(t->index + 1U) : NULL) if (t->IsValid())
 #define FOR_ALL_TOWNS(t) FOR_ALL_TOWNS_FROM(t, 0)
 
-extern bool _town_sort_dirty;
-extern byte _town_sort_order;
-extern const Town **_town_sort;
-
 extern Town *_cleared_town;
 extern int _cleared_town_rating;
 
--- a/src/town_cmd.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/town_cmd.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -55,10 +55,6 @@
 uint _total_towns;
 HouseSpec _house_specs[HOUSE_MAX];
 
-bool _town_sort_dirty;
-byte _town_sort_order;
-const Town **_town_sort;
-
 Town *_cleared_town;
 int _cleared_town_rating;
 
@@ -82,7 +78,7 @@
 	/* Delete town authority window
 	 * and remove from list of sorted towns */
 	DeleteWindowById(WC_TOWN_VIEW, this->index);
-	_town_sort_dirty = true;
+	InvalidateWindowData(WC_TOWN_DIRECTORY, 0, 0);
 	_total_towns--;
 
 	/* Delete all industries belonging to the town */
@@ -131,6 +127,11 @@
 	}
 }
 
+Money HouseSpec::GetRemovalCost() const
+{
+	return (_price.remove_house * this->removal_cost) >> 8;
+}
+
 // Local
 static int _grow_town_result;
 
@@ -324,7 +325,7 @@
 	SetDParam(0, t->index);
 	SetDParam(1, t->population);
 	UpdateViewportSignPos(&t->sign, pt.x, pt.y - 24,
-		_settings.gui.population_in_label ? STR_TOWN_LABEL_POP : STR_TOWN_LABEL);
+		_settings_client.gui.population_in_label ? STR_TOWN_LABEL_POP : STR_TOWN_LABEL);
 	MarkTownSignDirty(t);
 }
 
@@ -348,7 +349,7 @@
 	InvalidateWindow(WC_TOWN_VIEW, t->index);
 	UpdateTownVirtCoord(t);
 
-	if (_town_sort_order & 2) _town_sort_dirty = true;
+	InvalidateWindowData(WC_TOWN_DIRECTORY, 0, 1);
 }
 
 /**
@@ -521,7 +522,7 @@
 	const HouseSpec *hs = GetHouseSpecs(GetHouseType(tile));
 
 	CommandCost cost(EXPENSES_CONSTRUCTION);
-	cost.AddCost(_price.remove_house * hs->removal_cost >> 8);
+	cost.AddCost(hs->GetRemovalCost());
 
 	int rating = hs->remove_rating_decrease;
 	_cleared_town_rating += rating;
@@ -596,7 +597,7 @@
 		if (callback != CALLBACK_FAILED) {
 			if (accepts[0] != CT_INVALID) ac[accepts[0]] = GB(callback, 0, 4);
 			if (accepts[1] != CT_INVALID) ac[accepts[1]] = GB(callback, 4, 4);
-			if (_settings.game_creation.landscape != LT_TEMPERATE && HasBit(callback, 12)) {
+			if (_settings_game.game_creation.landscape != LT_TEMPERATE && HasBit(callback, 12)) {
 				/* The 'S' bit indicates food instead of goods */
 				ac[CT_FOOD] = GB(callback, 8, 4);
 			} else {
@@ -1255,7 +1256,7 @@
 	/* Let the town be a ghost town
 	 * The player wanted it in such a way. Thus there he has it. ;)
 	 * Never reached in editor mode. */
-	if (_settings.economy.town_layout == TL_NO_ROADS && _generating_world) {
+	if (_settings_game.economy.town_layout == TL_NO_ROADS && _generating_world) {
 		return false;
 	}
 
@@ -1367,9 +1368,9 @@
 	 * the other towns may take considerable amount of time (10000 is
 	 * too much). */
 	int tries = 1000;
-	bool grf = (_settings.game_creation.town_name >= _nb_orig_names);
-	uint32 grfid = grf ? GetGRFTownNameId(_settings.game_creation.town_name - _nb_orig_names) : 0;
-	uint16 townnametype = grf ? GetGRFTownNameType(_settings.game_creation.town_name - _nb_orig_names) : SPECSTR_TOWNNAME_START + _settings.game_creation.town_name;
+	bool grf = (_settings_game.game_creation.town_name >= _nb_orig_names);
+	uint32 grfid = grf ? GetGRFTownNameId(_settings_game.game_creation.town_name - _nb_orig_names) : 0;
+	uint16 townnametype = grf ? GetGRFTownNameType(_settings_game.game_creation.town_name - _nb_orig_names) : SPECSTR_TOWNNAME_START + _settings_game.game_creation.town_name;
 
 	assert(townnameparts != NULL);
 
@@ -1453,19 +1454,19 @@
 	t->exclusive_counter = 0;
 	t->statues = 0;
 
-	if (_settings.game_creation.town_name < _nb_orig_names) {
+	if (_settings_game.game_creation.town_name < _nb_orig_names) {
 		/* Original town name */
 		t->townnamegrfid = 0;
-		t->townnametype = SPECSTR_TOWNNAME_START + _settings.game_creation.town_name;
+		t->townnametype = SPECSTR_TOWNNAME_START + _settings_game.game_creation.town_name;
 	} else {
 		/* Newgrf town name */
-		t->townnamegrfid = GetGRFTownNameId(_settings.game_creation.town_name  - _nb_orig_names);
-		t->townnametype  = GetGRFTownNameType(_settings.game_creation.town_name - _nb_orig_names);
+		t->townnamegrfid = GetGRFTownNameId(_settings_game.game_creation.town_name  - _nb_orig_names);
+		t->townnametype  = GetGRFTownNameType(_settings_game.game_creation.town_name - _nb_orig_names);
 	}
 	t->townnameparts = townnameparts;
 
 	UpdateTownVirtCoord(t);
-	_town_sort_dirty = true;
+	InvalidateWindowData(WC_TOWN_DIRECTORY, 0, 0);
 
 	t->InitializeLayout();
 
@@ -1485,7 +1486,7 @@
 			break;
 
 		case TSM_CITY:
-			x *= _settings.economy.initial_city_size;
+			x *= _settings_game.economy.initial_city_size;
 			t->larger_town = true;
 			break;
 	}
@@ -1585,8 +1586,8 @@
 bool GenerateTowns()
 {
 	uint num = 0;
-	uint n = ScaleByMapSize(_num_initial_towns[_settings.difficulty.number_towns] + (Random() & 7));
-	uint num_cities = _settings.economy.larger_towns == 0 ? 0 : n / _settings.economy.larger_towns;
+	uint n = ScaleByMapSize(_num_initial_towns[_settings_game.difficulty.number_towns] + (Random() & 7));
+	uint num_cities = _settings_game.economy.larger_towns == 0 ? 0 : n / _settings_game.economy.larger_towns;
 
 	SetGeneratingWorldProgress(GWP_TOWN, n);
 
@@ -1594,7 +1595,7 @@
 		IncreaseGeneratingWorldProgress(GWP_TOWN);
 		/* try 20 times to create a random-sized town for the first loop. */
 		TownSizeMode mode = num_cities > 0 ? TSM_CITY : TSM_RANDOM;
-		if (CreateRandomTown(20, mode, _settings.economy.initial_city_size) != NULL) num++;
+		if (CreateRandomTown(20, mode, _settings_game.economy.initial_city_size) != NULL) num++;
 		if (num_cities > 0) num_cities--;
 	} while (--n);
 
@@ -1602,7 +1603,7 @@
 	if (num == 0 && CreateRandomTown(10000, TSM_RANDOM, 0) == NULL) {
 		if (GetNumTowns() == 0) {
 			/* XXX - can we handle that more gracefully? */
-			if (_game_mode != GM_EDITOR) error("Could not generate any town");
+			if (_game_mode != GM_EDITOR) usererror("Could not generate any town");
 
 			return false;
 		}
@@ -1643,11 +1644,7 @@
  */
 static inline void ClearMakeHouseTile(TileIndex tile, TownID tid, byte counter, byte stage, HouseID type, byte random_bits)
 {
-	#if !defined(NDEBUG) || defined(WITH_ASSERT)
-		CommandCost cc =
-	#endif /* !defined(NDEBUG) || defined(WITH_ASSERT) */
-
-	DoCommand(tile, 0, 0, DC_EXEC | DC_AUTO | DC_NO_WATER, CMD_LANDSCAPE_CLEAR);
+	CommandCost cc = DoCommand(tile, 0, 0, DC_EXEC | DC_AUTO | DC_NO_WATER, CMD_LANDSCAPE_CLEAR);
 
 	assert(CmdSucceeded(cc));
 
@@ -1879,8 +1876,8 @@
 	HouseZonesBits rad = GetTownRadiusGroup(t, tile);
 
 	/* Above snow? */
-	int land = _settings.game_creation.landscape;
-	if (land == LT_ARCTIC && z >= _settings.game_creation.snow_line) land = -1;
+	int land = _settings_game.game_creation.landscape;
+	if (land == LT_ARCTIC && z >= _settings_game.game_creation.snow_line) land = -1;
 
 	uint bitmask = (1 << rad) + (1 << (land + 12));
 
@@ -1939,7 +1936,7 @@
 			}
 		}
 
-		if (_cur_year < hs->min_date || _cur_year > hs->max_date) continue;
+		if (_cur_year < hs->min_year || _cur_year > hs->max_year) continue;
 
 		/* Special houses that there can be only one of. */
 		uint oneof = 0;
@@ -2099,7 +2096,7 @@
 		t->name = strdup(_cmd_text);
 
 		UpdateTownVirtCoord(t);
-		_town_sort_dirty = true;
+		InvalidateWindowData(WC_TOWN_DIRECTORY, 0, 1);
 		UpdateAllStationVirtCoord();
 		UpdateAllWaypointSigns();
 		MarkWholeScreenDirty();
@@ -2201,7 +2198,7 @@
 {
 	TileIndex tile = t->xy;
 
-	if (CircularTileSearch(tile, 9, SearchTileForStatue, t->index)) {
+	if (CircularTileSearch(&tile, 9, SearchTileForStatue, t->index)) {
 		SetBit(t->statues, _current_player); // Once found and built, "inform" the Town
 	}
 }
@@ -2219,7 +2216,7 @@
 static void TownActionBuyRights(Town *t)
 {
 	/* Check if it's allowed to by the rights */
-	if (!_settings.economy.exclusive_rights) return;
+	if (!_settings_game.economy.exclusive_rights) return;
 
 	t->exclusive_counter = 12;
 	t->exclusivity = _current_player;
@@ -2251,6 +2248,7 @@
 		 */
 		if (t->ratings[_current_player] > RATING_BRIBE_DOWN_TO) {
 			t->ratings[_current_player] = RATING_BRIBE_DOWN_TO;
+			InvalidateWindow(WC_TOWN_AUTHORITY, t->index);
 		}
 	} else {
 		ChangeTownRating(t, RATING_BRIBE_UP_STEP, RATING_BRIBE_MAXIMUM);
@@ -2332,8 +2330,10 @@
 		t->ratings[i] = Clamp(t->ratings[i], RATING_MINIMUM, RATING_MAXIMUM);
 	}
 
+	InvalidateWindow(WC_TOWN_AUTHORITY, t->index);
+
 	ClrBit(t->flags12, TOWN_IS_FUNDED);
-	if (_settings.economy.town_growth_rate == 0 && t->fund_buildings_months == 0) return;
+	if (_settings_game.economy.town_growth_rate == 0 && t->fund_buildings_months == 0) return;
 
 	/** Towns are processed every TOWN_GROWTH_FREQUENCY ticks, and this is the
 	 * number of times towns are processed before a new building is built. */
@@ -2352,17 +2352,17 @@
 		if (n == 0 && !Chance16(1, 12)) return;
 	}
 
-	if (_settings.game_creation.landscape == LT_ARCTIC) {
+	if (_settings_game.game_creation.landscape == LT_ARCTIC) {
 		if (TilePixelHeight(t->xy) >= GetSnowLine() && t->act_food == 0 && t->population > 90)
 			return;
-	} else if (_settings.game_creation.landscape == LT_TROPIC) {
+	} else if (_settings_game.game_creation.landscape == LT_TROPIC) {
 		if (GetTropicZone(t->xy) == TROPICZONE_DESERT && (t->act_food == 0 || t->act_water == 0) && t->population > 60)
 			return;
 	}
 
 	/* Use the normal growth rate values if new buildings have been funded in
 	 * this town and the growth rate is set to none. */
-	uint growth_multiplier = _settings.economy.town_growth_rate != 0 ? _settings.economy.town_growth_rate - 1 : 1;
+	uint growth_multiplier = _settings_game.economy.town_growth_rate != 0 ? _settings_game.economy.town_growth_rate - 1 : 1;
 
 	m >>= growth_multiplier;
 	if (t->larger_town) m /= 2;
@@ -2405,7 +2405,7 @@
 {
 	if (!IsValidPlayer(_current_player)) return true;
 
-	Town *t = ClosestTownFromTile(tile, _settings.economy.dist_local_authority);
+	Town *t = ClosestTownFromTile(tile, _settings_game.economy.dist_local_authority);
 	if (t == NULL) return true;
 
 	if (t->ratings[_current_player] > RATING_VERYPOOR) return true;
@@ -2503,6 +2503,7 @@
 		_town_test_ratings[t] = rating;
 	} else {
 		t->ratings[_current_player] = rating;
+		InvalidateWindow(WC_TOWN_AUTHORITY, t->index);
 	}
 }
 
@@ -2524,7 +2525,7 @@
 	 * owned by a town no removal if rating is lower than ... depends now on
 	 * difficulty setting. Minimum town rating selected by difficulty level
 	 */
-	int modemod = _default_rating_settings[_settings.difficulty.town_council_tolerance][type];
+	int modemod = _default_rating_settings[_settings_game.difficulty.town_council_tolerance][type];
 
 	if (GetRating(t) < 16 + modemod && !(flags & DC_NO_TOWN_RATING)) {
 		SetDParam(0, t->index);
@@ -2565,7 +2566,6 @@
 	_cur_town_ctr = 0;
 	_cur_town_iter = 0;
 	_total_towns = 0;
-	_town_sort_dirty = true;
 }
 
 static CommandCost TerraformTile_Town(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
@@ -2736,8 +2736,6 @@
 
 void AfterLoadTown()
 {
-	_town_sort_dirty = true;
-
 	Town *t;
 	FOR_ALL_TOWNS(t) t->InitializeLayout();
 }
--- a/src/town_gui.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/town_gui.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -24,10 +24,13 @@
 #include "settings_type.h"
 #include "tilehighlight_func.h"
 #include "string_func.h"
+#include "sortlist_type.h"
 
 #include "table/sprites.h"
 #include "table/strings.h"
 
+typedef GUIList<const Town*> GUITownList;
+
 extern bool GenerateTowns();
 static int _scengen_town_size = 1; // depress medium-sized towns per default
 
@@ -76,7 +79,7 @@
 	TownActions buttons = TACT_NONE;
 
 	/* Spectators and unwanted have no options */
-	if (pid != PLAYER_SPECTATOR && !(_settings.economy.bribe && t->unwanted[pid])) {
+	if (pid != PLAYER_SPECTATOR && !(_settings_game.economy.bribe && t->unwanted[pid])) {
 
 		/* Things worth more than this are not shown */
 		Money avail = GetPlayer(pid)->player_money + _price.station_value * 200;
@@ -88,11 +91,11 @@
 			const TownActions cur = (TownActions)(1 << i);
 
 			/* Is the player not able to bribe ? */
-			if (cur == TACT_BRIBE && (!_settings.economy.bribe || t->ratings[pid] >= RATING_BRIBE_MAXIMUM))
+			if (cur == TACT_BRIBE && (!_settings_game.economy.bribe || t->ratings[pid] >= RATING_BRIBE_MAXIMUM))
 				continue;
 
 			/* Is the player not able to buy exclusive rights ? */
-			if (cur == TACT_BUY_RIGHTS && !_settings.economy.exclusive_rights)
+			if (cur == TACT_BUY_RIGHTS && !_settings_game.economy.exclusive_rights)
 				continue;
 
 			/* Is the player not able to build a statue ? */
@@ -313,7 +316,7 @@
 		}
 
 		/* Space required for showing noise level information */
-		if (_settings.economy.station_noise_level) {
+		if (_settings_game.economy.station_noise_level) {
 			ResizeWindowForWidget(this, TVW_INFOPANEL, 0, 10);
 		}
 
@@ -343,7 +346,7 @@
 		this->DrawViewport();
 
 		/* only show the town noise, if the noise option is activated. */
-		if (_settings.economy.station_noise_level) {
+		if (_settings_game.economy.station_noise_level) {
 			SetDParam(0, this->town->noise_reached);
 			SetDParam(1, this->town->MaxTownNoise());
 			DrawString(2, 137, STR_NOISE_IN_TOWN, 0);
@@ -385,7 +388,7 @@
 		/* Called when setting station noise have changed, in order to resize the window */
 		this->SetDirty(); // refresh display for current size. This will allow to avoid glitches when downgrading
 
-		if (_settings.economy.station_noise_level) { // adjust depending
+		if (_settings_game.economy.station_noise_level) { // adjust depending
 			if (this->height == 150) { // window is smaller, needs to be bigger
 				ResizeWindowForWidget(this, TVW_INFOPANEL, 0, 10);
 			}
@@ -448,64 +451,6 @@
 };
 
 
-/* used to get a sorted list of the towns */
-static uint _num_town_sort;
-
-static char _bufcache[64];
-static const Town* _last_town;
-
-static int CDECL TownNameSorter(const void *a, const void *b)
-{
-	const Town* ta = *(const Town**)a;
-	const Town* tb = *(const Town**)b;
-	char buf1[64];
-	int r;
-
-	SetDParam(0, ta->index);
-	GetString(buf1, STR_TOWN, lastof(buf1));
-
-	/* If 'b' is the same town as in the last round, use the cached value
-	 *  We do this to speed stuff up ('b' is called with the same value a lot of
-	 *  times after eachother) */
-	if (tb != _last_town) {
-		_last_town = tb;
-		SetDParam(0, tb->index);
-		GetString(_bufcache, STR_TOWN, lastof(_bufcache));
-	}
-
-	r = strcmp(buf1, _bufcache);
-	if (_town_sort_order & 1) r = -r;
-	return r;
-}
-
-static int CDECL TownPopSorter(const void *a, const void *b)
-{
-	const Town* ta = *(const Town**)a;
-	const Town* tb = *(const Town**)b;
-	int r = ta->population - tb->population;
-	if (_town_sort_order & 1) r = -r;
-	return r;
-}
-
-static void MakeSortedTownList()
-{
-	const Town* t;
-	uint n = 0;
-
-	/* Create array for sorting */
-	_town_sort = ReallocT(_town_sort, GetMaxTownIndex() + 1);
-
-	FOR_ALL_TOWNS(t) _town_sort[n++] = t;
-
-	_num_town_sort = n;
-
-	_last_town = NULL; // used for "cache"
-	qsort((void*)_town_sort, n, sizeof(_town_sort[0]), _town_sort_order & 2 ? TownPopSorter : TownNameSorter);
-
-	DEBUG(misc, 3, "Resorting towns list");
-}
-
-
 struct TownDirectoryWindow : public Window {
 private:
 	enum TownDirectoryWidget {
@@ -514,6 +459,65 @@
 		TDW_CENTERTOWN,
 	};
 
+	/* Runtime saved values */
+	static Listing last_sorting;
+	static const Town *last_town;
+
+	/* Constants for sorting towns */
+	static GUITownList::SortFunction * const sorter_funcs[];
+
+	GUITownList towns;
+
+	void BuildTownList()
+	{
+		if (!this->towns.NeedRebuild()) return;
+
+		this->towns.Clear();
+
+		const Town *t;
+		FOR_ALL_TOWNS(t) {
+			*this->towns.Append() = t;
+		}
+
+		this->towns.Compact();
+		this->towns.RebuildDone();
+	}
+
+	void SortTownList()
+	{
+		last_town = NULL;
+		this->towns.Sort();
+	}
+
+	/** Sort by town name */
+	static int CDECL TownNameSorter(const Town * const *a, const Town * const *b)
+	{
+		static char buf_cache[64];
+		const Town *ta = *a;
+		const Town *tb = *b;
+		char buf[64];
+
+		SetDParam(0, ta->index);
+		GetString(buf, STR_TOWN, lastof(buf));
+
+		/* If 'b' is the same town as in the last round, use the cached value
+		 * We do this to speed stuff up ('b' is called with the same value a lot of
+		 * times after eachother) */
+		if (tb != last_town) {
+			last_town = tb;
+			SetDParam(0, tb->index);
+			GetString(buf_cache, STR_TOWN, lastof(buf_cache));
+		}
+
+		return strcmp(buf, buf_cache);
+	}
+
+	/** Sort by population */
+	static int CDECL TownPopulationSorter(const Town * const *a, const Town * const *b)
+	{
+		return (*a)->population - (*b)->population;
+	}
+
 public:
 	TownDirectoryWindow(const WindowDesc *desc) : Window(desc, 0)
 	{
@@ -521,28 +525,35 @@
 		this->resize.step_height = 10;
 		this->resize.height = this->height - 10 * 6; // minimum of 10 items in the list, each item 10 high
 
+		this->towns.SetListing(this->last_sorting);
+		this->towns.SetSortFuncs(this->sorter_funcs);
+		this->towns.ForceRebuild();
+
 		this->FindWindowPlacementAndResize(desc);
 	}
 
+	~TownDirectoryWindow()
+	{
+		this->last_sorting = this->towns.GetListing();
+	}
+
 	virtual void OnPaint()
 	{
-		if (_town_sort_dirty) {
-			_town_sort_dirty = false;
-			MakeSortedTownList();
-		}
+		this->BuildTownList();
+		this->SortTownList();
 
-		SetVScrollCount(this, _num_town_sort);
+		SetVScrollCount(this, this->towns.Length());
 
 		this->DrawWidgets();
-		this->DrawSortButtonState((_town_sort_order <= 1) ? TDW_SORTNAME : TDW_SORTPOPULATION, _town_sort_order & 1 ? SBS_DOWN : SBS_UP);
+		this->DrawSortButtonState(this->towns.sort_type == 0 ? TDW_SORTNAME : TDW_SORTPOPULATION, this->towns.IsDescSortOrder() ? SBS_DOWN : SBS_UP);
 
 		{
 			int n = 0;
 			uint16 i = this->vscroll.pos;
 			int y = 28;
 
-			while (i < _num_town_sort) {
-				const Town* t = _town_sort[i];
+			while (i < this->towns.Length()) {
+				const Town *t = this->towns[i];
 
 				assert(t->xy);
 
@@ -564,29 +575,33 @@
 	{
 		switch (widget) {
 			case TDW_SORTNAME: /* Sort by Name ascending/descending */
-				_town_sort_order = (_town_sort_order == 0) ? 1 : 0;
-				_town_sort_dirty = true;
+				if (this->towns.SortType() == 0) {
+					this->towns.ToggleSortOrder();
+				} else {
+					this->towns.SetSortType(0);
+				}
 				this->SetDirty();
 				break;
 
 			case TDW_SORTPOPULATION: /* Sort by Population ascending/descending */
-				_town_sort_order = (_town_sort_order == 2) ? 3 : 2;
-				_town_sort_dirty = true;
+				if (this->towns.SortType() == 1) {
+					this->towns.ToggleSortOrder();
+				} else {
+					this->towns.SetSortType(1);
+				}
 				this->SetDirty();
 				break;
 
 			case TDW_CENTERTOWN: { /* Click on Town Matrix */
-				const Town* t;
-
 				uint16 id_v = (pt.y - 28) / 10;
 
 				if (id_v >= this->vscroll.cap) return; // click out of bounds
 
 				id_v += this->vscroll.pos;
 
-				if (id_v >= _num_town_sort) return; // click out of town bounds
+				if (id_v >= this->towns.Length()) return; // click out of town bounds
 
-				t = _town_sort[id_v];
+				const Town *t = this->towns[id_v];
 				assert(t->xy);
 				if (_ctrl_pressed) {
 					ShowExtraViewPortWindow(t->xy);
@@ -607,6 +622,24 @@
 	{
 		this->vscroll.cap += delta.y / 10;
 	}
+
+	virtual void OnInvalidateData(int data)
+	{
+		if (data == 0) {
+			this->towns.ForceRebuild();
+		} else {
+			this->towns.ForceResort();
+		}
+	}
+};
+
+Listing TownDirectoryWindow::last_sorting = {false, 0};
+const Town *TownDirectoryWindow::last_town = NULL;
+
+/* Available town directory sorting functions */
+GUITownList::SortFunction * const TownDirectoryWindow::sorter_funcs[] = {
+	&TownNameSorter,
+	&TownPopulationSorter,
 };
 
 static const WindowDesc _town_directory_desc = {
--- a/src/train_cmd.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/train_cmd.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -92,7 +92,7 @@
 byte FreightWagonMult(CargoID cargo)
 {
 	if (!GetCargo(cargo)->is_freight) return 1;
-	return _settings.vehicle.freight_trains;
+	return _settings_game.vehicle.freight_trains;
 }
 
 
@@ -278,7 +278,7 @@
 			}
 
 			/* max speed is the minimum of the speed limits of all vehicles in the consist */
-			if ((rvi_u->railveh_type != RAILVEH_WAGON || _settings.vehicle.wagon_speed_limits) && !UsesWagonOverride(u)) {
+			if ((rvi_u->railveh_type != RAILVEH_WAGON || _settings_game.vehicle.wagon_speed_limits) && !UsesWagonOverride(u)) {
 				uint16 speed = GetVehicleProperty(u, 0x09, rvi_u->max_speed);
 				if (speed != 0) max_speed = min(speed, max_speed);
 			}
@@ -726,7 +726,7 @@
 		Vehicle *v = vl[0];
 
 		UnitID unit_num = HasBit(p2, 0) ? 0 : GetFreeUnitNumber(VEH_TRAIN);
-		if (unit_num > _settings.vehicle.max_trains)
+		if (unit_num > _settings_game.vehicle.max_trains)
 			return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
 
 		if (flags & DC_EXEC) {
@@ -765,7 +765,7 @@
 			v->u.rail.railtype = rvi->railtype;
 			_new_vehicle_id = v->index;
 
-			v->service_interval = _settings.vehicle.servint_trains;
+			v->service_interval = _settings_game.vehicle.servint_trains;
 			v->date_of_last_service = _date;
 			v->build_year = _cur_year;
 			v->cur_image = 0xAC2;
@@ -1001,7 +1001,7 @@
 	if (HasBit(p2, 0) && src_head == dst_head) return CommandCost();
 
 	{
-		int max_len = _settings.vehicle.mammoth_trains ? 100 : 10;
+		int max_len = _settings_game.vehicle.mammoth_trains ? 100 : 10;
 
 		/* check if all vehicles in the source train are stopped inside a depot. */
 		int src_len = CheckTrainStoppedInDepot(src_head);
@@ -1044,7 +1044,7 @@
 	/* moving a loco to a new line?, then we need to assign a unitnumber. */
 	if (dst == NULL && !IsFrontEngine(src) && IsTrainEngine(src)) {
 		UnitID unit_num = GetFreeUnitNumber(VEH_TRAIN);
-		if (unit_num > _settings.vehicle.max_trains)
+		if (unit_num > _settings_game.vehicle.max_trains)
 			return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
 
 		if (flags & DC_EXEC) src->unitnumber = unit_num;
@@ -1544,7 +1544,7 @@
 	int old = v->u.rail.last_speed;
 	if (spd != old) {
 		v->u.rail.last_speed = spd;
-		if (_settings.gui.vehicle_speed || (old == 0) != (spd == 0)) {
+		if (_settings_client.gui.vehicle_speed || (old == 0) != (spd == 0)) {
 			InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, VVW_WIDGET_START_STOP_VEH);
 		}
 	}
@@ -1883,7 +1883,7 @@
 		if (v->vehstatus & VS_CRASHED || v->breakdown_ctr != 0) return CMD_ERROR;
 
 		if (flags & DC_EXEC) {
-			if (_settings.vehicle.realistic_acceleration && v->cur_speed != 0) {
+			if (_settings_game.vehicle.realistic_acceleration && v->cur_speed != 0) {
 				ToggleBit(v->u.rail.flags, VRF_REVERSING);
 			} else {
 				v->cur_speed = 0;
@@ -2058,7 +2058,7 @@
 		return tfdd;
 	}
 
-	switch (_settings.pf.pathfinder_for_trains) {
+	switch (_settings_game.pf.pathfinder_for_trains) {
 		case VPF_YAPF: { /* YAPF */
 			bool found = YapfFindNearestRailDepotTwoWay(v, max_distance, NPF_INFINITE_PENALTY, &tfdd.tile, &tfdd.reverse);
 			tfdd.best_length = found ? max_distance / 2 : UINT_MAX; // some fake distance or NOT_FOUND
@@ -2369,7 +2369,7 @@
 	/* quick return in case only one possible track is available */
 	if (KillFirstBit(tracks) == TRACK_BIT_NONE) return FindFirstTrack(tracks);
 
-	switch (_settings.pf.pathfinder_for_trains) {
+	switch (_settings_game.pf.pathfinder_for_trains) {
 		case VPF_YAPF: { /* YAPF */
 			Trackdir trackdir = YapfChooseRailTrack(v, tile, enterdir, tracks, &path_not_found);
 			if (trackdir != INVALID_TRACKDIR) {
@@ -2446,7 +2446,7 @@
 			/* it is first time the problem occurred, set the "path not found" flag */
 			SetBit(v->u.rail.flags, VRF_NO_PATH_TO_DESTINATION);
 			/* and notify user about the event */
-			if (_settings.gui.lost_train_warn && v->owner == _local_player) {
+			if (_settings_client.gui.lost_train_warn && v->owner == _local_player) {
 				SetDParam(0, v->unitnumber);
 				AddNewsItem(
 					STR_TRAIN_IS_LOST,
@@ -2474,7 +2474,7 @@
 
 static bool CheckReverseTrain(Vehicle *v)
 {
-	if (_settings.difficulty.line_reverse_mode != 0 ||
+	if (_settings_game.difficulty.line_reverse_mode != 0 ||
 			v->u.rail.track == TRACK_BIT_DEPOT || v->u.rail.track == TRACK_BIT_WORMHOLE ||
 			!(v->direction & 1)) {
 		return false;
@@ -2487,7 +2487,7 @@
 
 	assert(v->u.rail.track);
 
-	switch (_settings.pf.pathfinder_for_trains) {
+	switch (_settings_game.pf.pathfinder_for_trains) {
 		case VPF_YAPF: /* YAPF */
 			reverse_best = YapfCheckReverseTrain(v);
 			break;
@@ -2607,13 +2607,13 @@
 	uint accel;
 
 	if (v->vehstatus & VS_STOPPED || HasBit(v->u.rail.flags, VRF_REVERSING)) {
-		if (_settings.vehicle.realistic_acceleration) {
+		if (_settings_game.vehicle.realistic_acceleration) {
 			accel = GetTrainAcceleration(v, AM_BRAKE) * 2;
 		} else {
 			accel = v->acceleration * -2;
 		}
 	} else {
-		if (_settings.vehicle.realistic_acceleration) {
+		if (_settings_game.vehicle.realistic_acceleration) {
 			accel = GetTrainAcceleration(v, AM_ACCEL);
 		} else {
 			accel = v->acceleration;
@@ -2754,7 +2754,7 @@
 /** Modify the speed of the vehicle due to a turn */
 static inline void AffectSpeedByDirChange(Vehicle *v, Direction new_dir)
 {
-	if (_settings.vehicle.realistic_acceleration) return;
+	if (_settings_game.vehicle.realistic_acceleration) return;
 
 	DirDiff diff = DirDifference(v->direction, new_dir);
 	if (diff == DIRDIFF_SAME) return;
@@ -2766,7 +2766,7 @@
 /** Modify the speed of the vehicle due to a change in altitude */
 static inline void AffectSpeedByZChange(Vehicle *v, byte old_z)
 {
-	if (old_z == v->z_pos || _settings.vehicle.realistic_acceleration) return;
+	if (old_z == v->z_pos || _settings_game.vehicle.realistic_acceleration) return;
 
 	const RailtypeSlowdownParams *rsp = &_railtype_slowdown[v->u.rail.railtype];
 
@@ -2971,7 +2971,7 @@
 				TrackBits red_signals = TrackdirBitsToTrackBits(TrackStatusToRedSignals(ts) & reachable_trackdirs);
 
 				TrackBits bits = TrackdirBitsToTrackBits(trackdirbits);
-				if (_settings.pf.pathfinder_for_trains != VPF_NTP && _settings.pf.forbid_90_deg && prev == NULL) {
+				if (_settings_game.pf.pathfinder_for_trains != VPF_NTP && _settings_game.pf.forbid_90_deg && prev == NULL) {
 					/* We allow wagons to make 90 deg turns, because forbid_90_deg
 					 * can be switched on halfway a turn */
 					bits &= ~TrackCrossesTracks(FindFirstTrack(v->u.rail.track));
@@ -2999,12 +2999,12 @@
 							v->cur_speed = 0;
 							v->subspeed = 0;
 							v->progress = 255 - 100;
-							if (++v->load_unload_time_rem < _settings.pf.wait_oneway_signal * 20) return;
+							if (++v->load_unload_time_rem < _settings_game.pf.wait_oneway_signal * 20) return;
 						} else if (HasSignalOnTrackdir(gp.new_tile, i)) {
 							v->cur_speed = 0;
 							v->subspeed = 0;
 							v->progress = 255 - 10;
-							if (++v->load_unload_time_rem < _settings.pf.wait_twoway_signal * 73) {
+							if (++v->load_unload_time_rem < _settings_game.pf.wait_twoway_signal * 73) {
 								TileIndex o_tile = gp.new_tile + TileOffsByDiagDir(enterdir);
 								Direction rdir = ReverseDir(dir);
 
@@ -3113,7 +3113,7 @@
 
 invalid_rail:
 	/* We've reached end of line?? */
-	if (prev != NULL) error("!Disconnecting train");
+	if (prev != NULL) error("Disconnecting train");
 
 reverse_train_direction:
 	v->load_unload_time_rem = 0;
@@ -3246,7 +3246,7 @@
 		InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
 
 		if (!PlayVehicleSound(v, VSE_BREAKDOWN)) {
-			SndPlayVehicleFx((_settings.game_creation.landscape != LT_TOYLAND) ?
+			SndPlayVehicleFx((_settings_game.game_creation.landscape != LT_TOYLAND) ?
 				SND_10_TRAIN_BREAKDOWN : SND_3A_COMEDY_BREAKDOWN_2, v);
 		}
 
@@ -3406,7 +3406,7 @@
 
 	/* mask unreachable track bits if we are forbidden to do 90deg turns */
 	TrackBits bits = TrackdirBitsToTrackBits(trackdirbits);
-	if (_settings.pf.pathfinder_for_trains != VPF_NTP && _settings.pf.forbid_90_deg) {
+	if (_settings_game.pf.pathfinder_for_trains != VPF_NTP && _settings_game.pf.forbid_90_deg) {
 		bits &= ~TrackCrossesTracks(FindFirstTrack(v->u.rail.track));
 	}
 
@@ -3539,7 +3539,7 @@
 {
 	static const uint MAX_ACCEPTABLE_DEPOT_DIST = 16;
 
-	if (_settings.vehicle.servint_trains == 0 || !v->NeedsAutomaticServicing()) return;
+	if (_settings_game.vehicle.servint_trains == 0 || !v->NeedsAutomaticServicing()) return;
 	if (v->IsInDepot()) {
 		VehicleServiceInDepot(v);
 		return;
@@ -3614,7 +3614,7 @@
 	FOR_ALL_VEHICLES(v) {
 		if (v->type == VEH_TRAIN && IsFrontEngine(v)) {
 			/* show warning if train is not generating enough income last 2 years (corresponds to a red icon in the vehicle list) */
-			if (_settings.gui.train_income_warn && v->owner == _local_player && v->age >= 730 && v->GetDisplayProfitThisYear() < 0) {
+			if (_settings_client.gui.train_income_warn && v->owner == _local_player && v->age >= 730 && v->GetDisplayProfitThisYear() < 0) {
 				SetDParam(1, v->GetDisplayProfitThisYear());
 				SetDParam(0, v->unitnumber);
 				AddNewsItem(
--- a/src/train_gui.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/train_gui.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -124,7 +124,7 @@
 			SetDParam(0, v->cargo_type);
 			SetDParam(1, v->cargo.Count());
 			SetDParam(2, v->cargo.Source());
-			SetDParam(3, _settings.vehicle.freight_trains);
+			SetDParam(3, _settings_game.vehicle.freight_trains);
 			str = FreightWagonMult(v->cargo_type) > 1 ? STR_FROM_MULT : STR_8813_FROM;
 		}
 		DrawString(x, y, str, TC_FROMSTRING);
@@ -150,7 +150,7 @@
 	if (v->cargo_cap != 0) {
 		SetDParam(0, v->cargo_type);
 		SetDParam(1, v->cargo_cap);
-		SetDParam(2, _settings.vehicle.freight_trains);
+		SetDParam(2, _settings_game.vehicle.freight_trains);
 		DrawString(x, y, FreightWagonMult(v->cargo_type) > 1 ? STR_CAPACITY_MULT : STR_013F_CAPACITY, TC_FROMSTRING);
 	}
 }
@@ -249,7 +249,7 @@
 				SetDParam(1, act_cargo[i]); // {CARGO} #2
 				SetDParam(2, i);            // {SHORTCARGO} #1
 				SetDParam(3, max_cargo[i]); // {SHORTCARGO} #2
-				SetDParam(4, _settings.vehicle.freight_trains);
+				SetDParam(4, _settings_game.vehicle.freight_trains);
 				DrawString(x, y + 2, FreightWagonMult(i) > 1 ? STR_TOTAL_CAPACITY_MULT : STR_TOTAL_CAPACITY, TC_FROMSTRING);
 			}
 		}
--- a/src/tree_cmd.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/tree_cmd.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -112,7 +112,7 @@
  */
 static TreeType GetRandomTreeType(TileIndex tile, uint seed)
 {
-	switch (_settings.game_creation.landscape) {
+	switch (_settings_game.game_creation.landscape) {
 		case LT_TEMPERATE:
 			return (TreeType)(seed * TREE_COUNT_TEMPERATE / 256 + TREE_TEMPERATE);
 
@@ -249,7 +249,7 @@
 
 		if (CanPlantTreesOnTile(tile, true)) {
 			PlaceTree(tile, r);
-			if (_settings.game_creation.tree_placer != TP_IMPROVED) continue;
+			if (_settings_game.game_creation.tree_placer != TP_IMPROVED) continue;
 
 			/* Place a number of trees based on the tile height.
 			 *  This gives a cool effect of multiple trees close together.
@@ -259,7 +259,7 @@
 			j = GetTileZ(tile) / TILE_HEIGHT * 2;
 			while (j--) {
 				/* Above snowline more trees! */
-				if (_settings.game_creation.landscape == LT_ARCTIC && ht > GetSnowLine()) {
+				if (_settings_game.game_creation.landscape == LT_ARCTIC && ht > GetSnowLine()) {
 					PlaceTreeAtSameHeight(tile, ht);
 					PlaceTreeAtSameHeight(tile, ht);
 				};
@@ -270,7 +270,7 @@
 	} while (--i);
 
 	/* place extra trees at rainforest area */
-	if (_settings.game_creation.landscape == LT_TROPIC) {
+	if (_settings_game.game_creation.landscape == LT_TROPIC) {
 		i = ScaleByMapSize(15000);
 
 		do {
@@ -296,18 +296,18 @@
 {
 	uint i, total;
 
-	if (_settings.game_creation.tree_placer == TP_NONE) return;
+	if (_settings_game.game_creation.tree_placer == TP_NONE) return;
 
-	if (_settings.game_creation.landscape != LT_TOYLAND) PlaceMoreTrees();
+	if (_settings_game.game_creation.landscape != LT_TOYLAND) PlaceMoreTrees();
 
-	switch (_settings.game_creation.tree_placer) {
-		case TP_ORIGINAL: i = _settings.game_creation.landscape == LT_ARCTIC ? 15 : 6; break;
-		case TP_IMPROVED: i = _settings.game_creation.landscape == LT_ARCTIC ?  4 : 2; break;
+	switch (_settings_game.game_creation.tree_placer) {
+		case TP_ORIGINAL: i = _settings_game.game_creation.landscape == LT_ARCTIC ? 15 : 6; break;
+		case TP_IMPROVED: i = _settings_game.game_creation.landscape == LT_ARCTIC ?  4 : 2; break;
 		default: NOT_REACHED(); return;
 	}
 
 	total = ScaleByMapSize(1000);
-	if (_settings.game_creation.landscape == LT_TROPIC) total += ScaleByMapSize(15000);
+	if (_settings_game.game_creation.landscape == LT_TROPIC) total += ScaleByMapSize(15000);
 	total *= i;
 	SetGeneratingWorldProgress(GWP_TREE, total);
 
@@ -332,7 +332,7 @@
 
 	if (p2 >= MapSize()) return CMD_ERROR;
 	/* Check the tree type. It can be random or some valid value within the current climate */
-	if (p1 != (uint)-1 && p1 - _tree_base_by_landscape[_settings.game_creation.landscape] >= _tree_count_by_landscape[_settings.game_creation.landscape]) return CMD_ERROR;
+	if (p1 != (uint)-1 && p1 - _tree_base_by_landscape[_settings_game.game_creation.landscape] >= _tree_count_by_landscape[_settings_game.game_creation.landscape]) return CMD_ERROR;
 
 	// make sure sx,sy are smaller than ex,ey
 	ex = TileX(tile);
@@ -390,7 +390,7 @@
 					}
 
 					if (_game_mode != GM_EDITOR && IsValidPlayer(_current_player)) {
-						Town *t = ClosestTownFromTile(tile, _settings.economy.dist_local_authority);
+						Town *t = ClosestTownFromTile(tile, _settings_game.economy.dist_local_authority);
 						if (t != NULL) ChangeTownRating(t, RATING_TREE_UP_STEP, RATING_TREE_MAXIMUM);
 					}
 
@@ -533,7 +533,7 @@
 	uint num;
 
 	if (IsValidPlayer(_current_player)) {
-		Town *t = ClosestTownFromTile(tile, _settings.economy.dist_local_authority);
+		Town *t = ClosestTownFromTile(tile, _settings_game.economy.dist_local_authority);
 		if (t != NULL) ChangeTownRating(t, RATING_TREE_DOWN_STEP, RATING_TREE_MINIMUM);
 	}
 
@@ -626,7 +626,7 @@
 	if (GetTreeGround(tile) == TREE_GROUND_SHORE) {
 		TileLoop_Water(tile);
 	} else {
-		switch (_settings.game_creation.landscape) {
+		switch (_settings_game.game_creation.landscape) {
 			case LT_TROPIC: TileLoopTreesDesert(tile); break;
 			case LT_ARCTIC: TileLoopTreesAlps(tile);   break;
 		}
@@ -652,7 +652,7 @@
 
 	switch (GetTreeGrowth(tile)) {
 		case 3: /* regular sized tree */
-			if (_settings.game_creation.landscape == LT_TROPIC &&
+			if (_settings_game.game_creation.landscape == LT_TROPIC &&
 					GetTreeType(tile) != TREE_CACTUS &&
 					GetTropicZone(tile) == TROPICZONE_DESERT) {
 				AddTreeGrowth(tile, 1);
@@ -704,7 +704,7 @@
 					case TREE_GROUND_GRASS: MakeClear(tile, CLEAR_GRASS, GetTreeDensity(tile)); break;
 					case TREE_GROUND_ROUGH: MakeClear(tile, CLEAR_ROUGH, 3); break;
 					default: // snow or desert
-						MakeClear(tile, _settings.game_creation.landscape == LT_TROPIC ? CLEAR_DESERT : CLEAR_SNOW, GetTreeDensity(tile));
+						MakeClear(tile, _settings_game.game_creation.landscape == LT_TROPIC ? CLEAR_DESERT : CLEAR_SNOW, GetTreeDensity(tile));
 						break;
 				}
 			}
@@ -725,7 +725,7 @@
 	TreeType tree;
 
 	/* place a tree at a random rainforest spot */
-	if (_settings.game_creation.landscape == LT_TROPIC &&
+	if (_settings_game.game_creation.landscape == LT_TROPIC &&
 			(r = Random(), tile = RandomTileSeed(r), GetTropicZone(tile) == TROPICZONE_RAINFOREST) &&
 			CanPlantTreesOnTile(tile, false) &&
 			(tree = GetRandomTreeType(tile, GB(r, 24, 8))) != TREE_INVALID) {
--- a/src/tree_gui.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/tree_gui.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -74,8 +74,8 @@
 
 		this->DrawWidgets();
 
-		int i = this->base = _tree_base_by_landscape[_settings.game_creation.landscape];
-		int count = this->count = _tree_count_by_landscape[_settings.game_creation.landscape];
+		int i = this->base = _tree_base_by_landscape[_settings_game.game_creation.landscape];
+		int count = this->count = _tree_count_by_landscape[_settings_game.game_creation.landscape];
 
 		int x = 18;
 		int y = 54;
--- a/src/tunnelbridge_cmd.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/tunnelbridge_cmd.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -169,7 +169,7 @@
 	if (b->avail_year > _cur_year) return false;
 
 	max = b->max_length;
-	if (max >= 16 && _settings.construction.longbridges) max = 100;
+	if (max >= 16 && _settings_game.construction.longbridges) max = 100;
 
 	return b->min_length <= bridge_len && bridge_len <= max;
 }
@@ -311,7 +311,7 @@
 	} else {
 		/* Build a new bridge. */
 
-		bool allow_on_slopes = (!_is_old_ai_player && _settings.construction.build_on_slopes);
+		bool allow_on_slopes = (!_is_old_ai_player && _settings_game.construction.build_on_slopes);
 
 		/* Try and clear the start landscape */
 		ret = DoCommand(tile_start, 0, 0, flags, CMD_LANDSCAPE_CLEAR);
@@ -576,7 +576,7 @@
 	/* Obviously if the bridge/tunnel belongs to us, or no-one, we can remove it */
 	if (CheckTileOwnership(tile) || IsTileOwner(tile, OWNER_NONE)) return true;
 	/* Otherwise we can only remove town-owned stuff with extra patch-settings, or cheat */
-	if (IsTileOwner(tile, OWNER_TOWN) && (_settings.construction.extra_dynamite || _cheats.magic_bulldozer.value)) return true;
+	if (IsTileOwner(tile, OWNER_TOWN) && (_settings_game.construction.extra_dynamite || _cheats.magic_bulldozer.value)) return true;
 	return false;
 }
 
@@ -1123,7 +1123,7 @@
 
 			DrawGroundSpriteAt(image, pal, x, y, z);
 		}
-	} else if (_settings.gui.bridge_pillars) {
+	} else if (_settings_client.gui.bridge_pillars) {
 		/* draw pillars below for high bridges */
 		DrawBridgePillars(psid, ti, axis, type, x, y, z);
 	}
@@ -1200,7 +1200,7 @@
 static void TileLoop_TunnelBridge(TileIndex tile)
 {
 	bool snow_or_desert = HasTunnelBridgeSnowOrDesert(tile);
-	switch (_settings.game_creation.landscape) {
+	switch (_settings_game.game_creation.landscape) {
 		case LT_ARCTIC:
 			if (snow_or_desert != (GetTileZ(tile) > GetSnowLine())) {
 				SetTunnelBridgeSnowOrDesert(tile, !snow_or_desert);
@@ -1388,7 +1388,7 @@
 
 static CommandCost TerraformTile_TunnelBridge(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
 {
-	if (_settings.construction.build_on_slopes && AutoslopeEnabled() && IsBridge(tile)) {
+	if (_settings_game.construction.build_on_slopes && AutoslopeEnabled() && IsBridge(tile)) {
 		DiagDirection direction = GetTunnelBridgeDirection(tile);
 		Axis axis = DiagDirToAxis(direction);
 		CommandCost res;
--- a/src/unix.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/unix.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -214,7 +214,7 @@
 	fprintf(stderr, "%s\n", str);
 }
 
-void ShowOSErrorBox(const char *buf)
+void ShowOSErrorBox(const char *buf, bool system)
 {
 #if defined(__APPLE__)
 	/* this creates an NSAlertPanel with the contents of 'buf'
--- a/src/unmovable_cmd.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/unmovable_cmd.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -375,11 +375,11 @@
 
 void GenerateUnmovables()
 {
-	if (_settings.game_creation.landscape == LT_TOYLAND) return;
+	if (_settings_game.game_creation.landscape == LT_TOYLAND) return;
 
 	/* add radio tower */
 	int radiotowser_to_build = ScaleByMapSize(15); // maximum number of radio towers on the map
-	int lighthouses_to_build = _settings.game_creation.landscape == LT_TROPIC ? 0 : ScaleByMapSize1D((Random() & 3) + 7);
+	int lighthouses_to_build = _settings_game.game_creation.landscape == LT_TROPIC ? 0 : ScaleByMapSize1D((Random() & 3) + 7);
 	SetGeneratingWorldProgress(GWP_UNMOVABLE, radiotowser_to_build + lighthouses_to_build);
 
 	for (uint i = ScaleByMapSize(1000); i != 0; i--) {
@@ -395,7 +395,7 @@
 		}
 	}
 
-	if (_settings.game_creation.landscape == LT_TROPIC) return;
+	if (_settings_game.game_creation.landscape == LT_TROPIC) return;
 
 	/* add lighthouses */
 	uint maxx = MapMaxX();
--- a/src/variables.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/variables.h	Tue Jun 17 10:32:49 2008 +0000
@@ -5,6 +5,10 @@
 #ifndef VARIABLES_H
 #define VARIABLES_H
 
+#ifndef VARDEF
+#define VARDEF extern
+#endif
+
 /* Amount of game ticks */
 VARDEF uint16 _tick_counter;
 
--- a/src/vehicle.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/vehicle.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -25,7 +25,6 @@
 #include "industry_map.h"
 #include "station_map.h"
 #include "water_map.h"
-#include "network/network.h"
 #include "yapf/yapf.h"
 #include "newgrf_callbacks.h"
 #include "newgrf_engine.h"
@@ -51,6 +50,7 @@
 #include "animated_tile_func.h"
 #include "effectvehicle_base.h"
 #include "core/alloc_func.hpp"
+#include "vehiclelist.h"
 
 #include "table/sprites.h"
 #include "table/strings.h"
@@ -127,20 +127,20 @@
 {
 	if (this->vehstatus & (VS_STOPPED | VS_CRASHED)) return false;
 
-	if (_settings.order.no_servicing_if_no_breakdowns && _settings.difficulty.vehicle_breakdowns == 0) {
+	if (_settings_game.order.no_servicing_if_no_breakdowns && _settings_game.difficulty.vehicle_breakdowns == 0) {
 		/* Vehicles set for autoreplacing needs to go to a depot even if breakdowns are turned off.
 		 * Note: If servicing is enabled, we postpone replacement till next service. */
 		return EngineHasReplacementForPlayer(GetPlayer(this->owner), this->engine_type, this->group_id);
 	}
 
-	return _settings.vehicle.servint_ispercent ?
+	return _settings_game.vehicle.servint_ispercent ?
 		(this->reliability < GetEngine(this->engine_type)->reliability * (100 - this->service_interval) / 100) :
 		(this->date_of_last_service + this->service_interval < _date);
 }
 
 bool Vehicle::NeedsAutomaticServicing() const
 {
-	if (_settings.order.gotodepot && VehicleHasDepotOrders(this)) return false;
+	if (_settings_game.order.gotodepot && VehicleHasDepotOrders(this)) return false;
 	if (this->current_order.IsType(OT_LOADING))            return false;
 	if (this->current_order.IsType(OT_GOTO_DEPOT) && this->current_order.GetDepotOrderType() != ODTFB_SERVICE) return false;
 	return NeedsServicing();
@@ -913,7 +913,7 @@
 	if ((rel_old >> 8) != (rel >> 8)) InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
 
 	if (v->breakdown_ctr != 0 || v->vehstatus & VS_STOPPED ||
-			_settings.difficulty.vehicle_breakdowns < 1 ||
+			_settings_game.difficulty.vehicle_breakdowns < 1 ||
 			v->cur_speed < 5 || _game_mode == GM_MENU) {
 		return;
 	}
@@ -930,7 +930,7 @@
 	if (v->type == VEH_SHIP) rel += 0x6666;
 
 	/* reduced breakdowns? */
-	if (_settings.difficulty.vehicle_breakdowns == 1) rel += 0x6666;
+	if (_settings_game.difficulty.vehicle_breakdowns == 1) rel += 0x6666;
 
 	/* check if to break down */
 	if (_breakdown_chance[(uint)min(rel, 0xffff) >> 10] <= v->breakdown_chance) {
@@ -1292,137 +1292,6 @@
 }
 
 /**
- * Generate a list of vehicles inside a depot.
- * @param type    Type of vehicle
- * @param tile    The tile the depot is located on
- * @param engines Pointer to list to add vehicles to
- * @param wagons  Pointer to list to add wagons to (can be NULL)
- */
-void BuildDepotVehicleList(VehicleType type, TileIndex tile, VehicleList *engines, VehicleList *wagons)
-{
-	engines->Clear();
-	if (wagons != NULL && wagons != engines) wagons->Clear();
-
-	const Vehicle *v;
-	FOR_ALL_VEHICLES(v) {
-		/* General tests for all vehicle types */
-		if (v->type != type) continue;
-		if (v->tile != tile) continue;
-
-		switch (type) {
-			case VEH_TRAIN:
-				if (v->u.rail.track != TRACK_BIT_DEPOT) continue;
-				if (wagons != NULL && IsFreeWagon(v)) {
-					*wagons->Append() = v;
-					continue;
-				}
-				break;
-
-			default:
-				if (!v->IsInDepot()) continue;
-				break;
-		}
-
-		if (!v->IsPrimaryVehicle()) continue;
-
-		*engines->Append() = v;
-	}
-
-	/* Ensure the lists are not wasting too much space. If the lists are fresh
-	 * (i.e. built within a command) then this will actually do nothing. */
-	engines->Compact();
-	if (wagons != NULL && wagons != engines) wagons->Compact();
-}
-
-/**
- * Generate a list of vehicles based on window type.
- * @param list        Pointer to list to add vehicles to
- * @param type        Type of vehicle
- * @param owner       Player to generate list for
- * @param index       This parameter has different meanings depending on window_type
- *    <ul>
- *      <li>VLW_STATION_LIST:  index of station to generate a list for</li>
- *      <li>VLW_SHARED_ORDERS: index of order to generate a list for<li>
- *      <li>VLW_STANDARD: not used<li>
- *      <li>VLW_DEPOT_LIST: TileIndex of the depot/hangar to make the list for</li>
- *      <li>VLW_GROUP_LIST: index of group to generate a list for</li>
- *    </ul>
- * @param window_type The type of window the list is for, using the VLW_ flags in vehicle_gui.h
- */
-void GenerateVehicleSortList(VehicleList *list, VehicleType type, PlayerID owner, uint32 index, uint16 window_type)
-{
-	list->Clear();
-
-	const Vehicle *v;
-
-	switch (window_type) {
-		case VLW_STATION_LIST:
-			FOR_ALL_VEHICLES(v) {
-				if (v->type == type && v->IsPrimaryVehicle()) {
-					const Order *order;
-
-					FOR_VEHICLE_ORDERS(v, order) {
-						if (order->IsType(OT_GOTO_STATION) && order->GetDestination() == index) {
-							*list->Append() = v;
-							break;
-						}
-					}
-				}
-			}
-			break;
-
-		case VLW_SHARED_ORDERS:
-			FOR_ALL_VEHICLES(v) {
-				/* Find a vehicle with the order in question */
-				if (v->orders != NULL && v->orders->index == index) {
-					/* Add all vehicles from this vehicle's shared order list */
-					for (v = GetFirstVehicleFromSharedList(v); v != NULL; v = v->next_shared) {
-						*list->Append() = v;
-					}
-					break;
-				}
-			}
-			break;
-
-		case VLW_STANDARD:
-			FOR_ALL_VEHICLES(v) {
-				if (v->type == type && v->owner == owner && v->IsPrimaryVehicle()) {
-					*list->Append() = v;
-				}
-			}
-			break;
-
-		case VLW_DEPOT_LIST:
-			FOR_ALL_VEHICLES(v) {
-				if (v->type == type && v->IsPrimaryVehicle()) {
-					const Order *order;
-
-					FOR_VEHICLE_ORDERS(v, order) {
-						if (order->IsType(OT_GOTO_DEPOT) && order->GetDestination() == index) {
-							*list->Append() = v;
-							break;
-						}
-					}
-				}
-			}
-			break;
-
-		case VLW_GROUP_LIST:
-			FOR_ALL_VEHICLES(v) {
-				if (v->type == type && v->IsPrimaryVehicle() &&
-						v->owner == owner && v->group_id == index) {
-					*list->Append() = v;
-				}
-			}
-			break;
-
-		default: NOT_REACHED(); break;
-	}
-
-	list->Compact();
-}
-
-/**
  * Send all vehicles of type to depots
  * @param type type of vehicle
  * @param flags the flags used for DoCommand()
@@ -1826,10 +1695,10 @@
 	static UnitID gmax = 0;
 
 	switch (type) {
-		case VEH_TRAIN:    max = _settings.vehicle.max_trains; break;
-		case VEH_ROAD:     max = _settings.vehicle.max_roadveh; break;
-		case VEH_SHIP:     max = _settings.vehicle.max_ships; break;
-		case VEH_AIRCRAFT: max = _settings.vehicle.max_aircraft; break;
+		case VEH_TRAIN:    max = _settings_game.vehicle.max_trains; break;
+		case VEH_ROAD:     max = _settings_game.vehicle.max_roadveh; break;
+		case VEH_SHIP:     max = _settings_game.vehicle.max_ships; break;
+		case VEH_AIRCRAFT: max = _settings_game.vehicle.max_aircraft; break;
 		default: NOT_REACHED();
 	}
 
@@ -1879,14 +1748,14 @@
 	assert(IsPlayerBuildableVehicleType(type));
 
 	if (!IsValidPlayer(_current_player)) return false;
-	if (_settings.gui.always_build_infrastructure) return true;
+	if (_settings_client.gui.always_build_infrastructure) return true;
 
 	UnitID max;
 	switch (type) {
-		case VEH_TRAIN:    max = _settings.vehicle.max_trains; break;
-		case VEH_ROAD:     max = _settings.vehicle.max_roadveh; break;
-		case VEH_SHIP:     max = _settings.vehicle.max_ships; break;
-		case VEH_AIRCRAFT: max = _settings.vehicle.max_aircraft; break;
+		case VEH_TRAIN:    max = _settings_game.vehicle.max_trains; break;
+		case VEH_ROAD:     max = _settings_game.vehicle.max_roadveh; break;
+		case VEH_SHIP:     max = _settings_game.vehicle.max_ships; break;
+		case VEH_AIRCRAFT: max = _settings_game.vehicle.max_aircraft; break;
 		default: NOT_REACHED();
 	}
 
@@ -1918,7 +1787,7 @@
 
 	/* The default livery is always available for use, but its in_use flag determines
 	 * whether any _other_ liveries are in use. */
-	if (p->livery[LS_DEFAULT].in_use && (_settings.gui.liveries == 2 || (_settings.gui.liveries == 1 && player == _local_player))) {
+	if (p->livery[LS_DEFAULT].in_use && (_settings_client.gui.liveries == 2 || (_settings_client.gui.liveries == 1 && player == _local_player))) {
 		/* Determine the livery scheme to use */
 		switch (GetEngine(engine_type)->type) {
 			default: NOT_REACHED();
@@ -2487,7 +2356,7 @@
 
 			/* Not the first call for this tick, or still loading */
 			if (mode || !HasBit(this->vehicle_flags, VF_LOADING_FINISHED) ||
-					(_settings.order.timetabling && this->current_order_time < wait_time)) return;
+					(_settings_game.order.timetabling && this->current_order_time < wait_time)) return;
 
 			this->PlayLeaveStationSound();
 
--- a/src/vehicle_func.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/vehicle_func.h	Tue Jun 17 10:32:49 2008 +0000
@@ -68,8 +68,6 @@
 void TrainPowerChanged(Vehicle *v);
 Money GetTrainRunningCost(const Vehicle *v);
 
-void GenerateVehicleSortList(VehicleList *list, VehicleType type, PlayerID owner, uint32 index, uint16 window_type);
-void BuildDepotVehicleList(VehicleType type, TileIndex tile, VehicleList *engine_list, VehicleList *wagon_list);
 CommandCost SendAllVehiclesToDepot(VehicleType type, uint32 flags, bool service, PlayerID owner, uint16 vlw_flag, uint32 id);
 void VehicleEnterDepot(Vehicle *v);
 
--- a/src/vehicle_gui.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/vehicle_gui.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -36,6 +36,7 @@
 #include "widgets/dropdown_func.h"
 #include "order_func.h"
 #include "timetable.h"
+#include "vehiclelist.h"
 
 #include "table/sprites.h"
 #include "table/strings.h"
@@ -110,7 +111,7 @@
 	_last_vehicle[0] = _last_vehicle[1] = NULL;
 
 	_internal_sort_order = (vl->vehicles.flags & VL_DESC) != 0;
-	qsort((void*)vl->vehicles.Begin(), vl->vehicles.Length(), sizeof(vl->vehicles.Begin()),
+	qsort((void*)vl->vehicles.Begin(), vl->vehicles.Length(), sizeof(*vl->vehicles.Begin()),
 		_vehicle_sorter[vl->vehicles.sort_type]);
 
 	vl->vehicles.resort_timer = DAY_TICKS * PERIODIC_RESORT_DAYS;
@@ -121,7 +122,7 @@
 {
 	_internal_sort_order = 0;
 	if (list->Length() < 2) return;
-	qsort((void*)list->Begin(), list->Length(), sizeof(list->Begin()), _vehicle_sorter[0]);
+	qsort((void*)list->Begin(), list->Length(), sizeof(*list->Begin()), _vehicle_sorter[0]);
 }
 
 /** draw the vehicle profit button in the vehicle list window. */
@@ -1217,12 +1218,12 @@
 
 void ShowVehicleListWindow(PlayerID player, VehicleType vehicle_type)
 {
-	/* If _settings.gui.advanced_vehicle_list > 1, display the Advanced list
-	 * if _settings.gui.advanced_vehicle_list == 1, display Advanced list only for local player
+	/* If _settings_client.gui.advanced_vehicle_list > 1, display the Advanced list
+	 * if _settings_client.gui.advanced_vehicle_list == 1, display Advanced list only for local player
 	 * if _ctrl_pressed, do the opposite action (Advanced list x Normal list)
 	 */
 
-	if ((_settings.gui.advanced_vehicle_list > (uint)(player != _local_player)) != _ctrl_pressed) {
+	if ((_settings_client.gui.advanced_vehicle_list > (uint)(player != _local_player)) != _ctrl_pressed) {
 		ShowPlayerGroup(player, vehicle_type);
 	} else {
 		ShowVehicleListWindowLocal(player, VLW_STANDARD, vehicle_type, 0);
@@ -1408,10 +1409,10 @@
 	{
 		switch (vehicle_type) {
 			default: NOT_REACHED();
-			case VEH_TRAIN:    return _settings.vehicle.servint_trains   != 0; break;
-			case VEH_ROAD:     return _settings.vehicle.servint_roadveh  != 0; break;
-			case VEH_SHIP:     return _settings.vehicle.servint_ships    != 0; break;
-			case VEH_AIRCRAFT: return _settings.vehicle.servint_aircraft != 0; break;
+			case VEH_TRAIN:    return _settings_game.vehicle.servint_trains   != 0; break;
+			case VEH_ROAD:     return _settings_game.vehicle.servint_roadveh  != 0; break;
+			case VEH_SHIP:     return _settings_game.vehicle.servint_ships    != 0; break;
+			case VEH_AIRCRAFT: return _settings_game.vehicle.servint_aircraft != 0; break;
 		}
 		return false; // kill a compiler warning
 	}
@@ -1483,7 +1484,7 @@
 				SetDParam(1, v->u.rail.cached_power);
 				SetDParam(0, v->u.rail.cached_weight);
 				SetDParam(3, v->u.rail.cached_max_te / 1000);
-				DrawString(2, 25, (_settings.vehicle.realistic_acceleration && v->u.rail.railtype != RAILTYPE_MAGLEV) ?
+				DrawString(2, 25, (_settings_game.vehicle.realistic_acceleration && v->u.rail.railtype != RAILTYPE_MAGLEV) ?
 					STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED_MAX_TE :
 					STR_VEHICLE_INFO_WEIGHT_POWER_MAX_SPEED, TC_FROMSTRING);
 				break;
@@ -1511,7 +1512,7 @@
 		/* Draw service interval text */
 		SetDParam(0, v->service_interval);
 		SetDParam(1, v->date_of_last_service);
-		DrawString(13, this->height - (v->type != VEH_TRAIN ? 11 : 23), _settings.vehicle.servint_ispercent ? STR_SERVICING_INTERVAL_PERCENT : STR_883C_SERVICING_INTERVAL_DAYS, TC_FROMSTRING);
+		DrawString(13, this->height - (v->type != VEH_TRAIN ? 11 : 23), _settings_game.vehicle.servint_ispercent ? STR_SERVICING_INTERVAL_PERCENT : STR_883C_SERVICING_INTERVAL_DAYS, TC_FROMSTRING);
 
 		switch (v->type) {
 			case VEH_TRAIN:
@@ -1950,7 +1951,7 @@
 					}
 				} else {
 					SetDParam(0, v->GetDisplaySpeed());
-					str = STR_TRAIN_STOPPING + _settings.gui.vehicle_speed;
+					str = STR_TRAIN_STOPPING + _settings_client.gui.vehicle_speed;
 				}
 			} else { // no train
 				str = STR_8861_STOPPED;
@@ -1960,7 +1961,7 @@
 				case OT_GOTO_STATION: {
 					SetDParam(0, v->current_order.GetDestination());
 					SetDParam(1, v->GetDisplaySpeed());
-					str = STR_HEADING_FOR_STATION + _settings.gui.vehicle_speed;
+					str = STR_HEADING_FOR_STATION + _settings_client.gui.vehicle_speed;
 				} break;
 
 				case OT_GOTO_DEPOT: {
@@ -1974,9 +1975,9 @@
 						SetDParam(1, v->GetDisplaySpeed());
 					}
 					if ((v->current_order.GetDepotActionType() & ODATFB_HALT) && !(v->current_order.GetDepotOrderType() & ODTFB_PART_OF_ORDERS)) {
-						str = _heading_for_depot_strings[v->type] + _settings.gui.vehicle_speed;
+						str = _heading_for_depot_strings[v->type] + _settings_client.gui.vehicle_speed;
 					} else {
-						str = _heading_for_depot_service_strings[v->type] + _settings.gui.vehicle_speed;
+						str = _heading_for_depot_service_strings[v->type] + _settings_client.gui.vehicle_speed;
 					}
 				} break;
 
@@ -1987,7 +1988,7 @@
 				case OT_GOTO_WAYPOINT: {
 					assert(v->type == VEH_TRAIN);
 					SetDParam(0, v->current_order.GetDestination());
-					str = STR_HEADING_FOR_WAYPOINT + _settings.gui.vehicle_speed;
+					str = STR_HEADING_FOR_WAYPOINT + _settings_client.gui.vehicle_speed;
 					SetDParam(1, v->GetDisplaySpeed());
 					break;
 				}
@@ -2001,7 +2002,7 @@
 
 				default:
 					if (v->num_orders == 0) {
-						str = STR_NO_ORDERS + _settings.gui.vehicle_speed;
+						str = STR_NO_ORDERS + _settings_client.gui.vehicle_speed;
 						SetDParam(0, v->GetDisplaySpeed());
 					} else {
 						str = STR_EMPTY;
--- a/src/vehicle_type.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/vehicle_type.h	Tue Jun 17 10:32:49 2008 +0000
@@ -6,7 +6,6 @@
 #define VEHICLE_TYPE_H
 
 #include "core/enum_type.hpp"
-#include "misc/smallvec.h"
 
 typedef uint16 VehicleID;
 
@@ -57,6 +56,4 @@
 	DEPOT_COMMAND_MASK  = 0xF,
 };
 
-typedef SmallVector<const Vehicle*, 32> VehicleList;
-
 #endif /* VEHICLE_TYPE_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/vehiclelist.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -0,0 +1,144 @@
+/* $Id$ */
+
+/** @file vehicle.cpp Base implementations of all vehicles. */
+
+#include "stdafx.h"
+#include "openttd.h"
+#include "vehicle_type.h"
+#include "vehicle_func.h"
+#include "vehicle_base.h"
+#include "vehicle_gui.h"
+#include "core/alloc_func.hpp"
+#include "train.h"
+#include "vehiclelist.h"
+
+/**
+ * Generate a list of vehicles inside a depot.
+ * @param type    Type of vehicle
+ * @param tile    The tile the depot is located on
+ * @param engines Pointer to list to add vehicles to
+ * @param wagons  Pointer to list to add wagons to (can be NULL)
+ */
+void BuildDepotVehicleList(VehicleType type, TileIndex tile, VehicleList *engines, VehicleList *wagons)
+{
+	engines->Clear();
+	if (wagons != NULL && wagons != engines) wagons->Clear();
+
+	const Vehicle *v;
+	FOR_ALL_VEHICLES(v) {
+		/* General tests for all vehicle types */
+		if (v->type != type) continue;
+		if (v->tile != tile) continue;
+
+		switch (type) {
+			case VEH_TRAIN:
+				if (v->u.rail.track != TRACK_BIT_DEPOT) continue;
+				if (wagons != NULL && IsFreeWagon(v)) {
+					*wagons->Append() = v;
+					continue;
+				}
+				break;
+
+			default:
+				if (!v->IsInDepot()) continue;
+				break;
+		}
+
+		if (!v->IsPrimaryVehicle()) continue;
+
+		*engines->Append() = v;
+	}
+
+	/* Ensure the lists are not wasting too much space. If the lists are fresh
+	 * (i.e. built within a command) then this will actually do nothing. */
+	engines->Compact();
+	if (wagons != NULL && wagons != engines) wagons->Compact();
+}
+
+/**
+ * Generate a list of vehicles based on window type.
+ * @param list        Pointer to list to add vehicles to
+ * @param type        Type of vehicle
+ * @param owner       Player to generate list for
+ * @param index       This parameter has different meanings depending on window_type
+ *    <ul>
+ *      <li>VLW_STATION_LIST:  index of station to generate a list for</li>
+ *      <li>VLW_SHARED_ORDERS: index of order to generate a list for<li>
+ *      <li>VLW_STANDARD: not used<li>
+ *      <li>VLW_DEPOT_LIST: TileIndex of the depot/hangar to make the list for</li>
+ *      <li>VLW_GROUP_LIST: index of group to generate a list for</li>
+ *    </ul>
+ * @param window_type The type of window the list is for, using the VLW_ flags in vehicle_gui.h
+ */
+void GenerateVehicleSortList(VehicleList *list, VehicleType type, PlayerID owner, uint32 index, uint16 window_type)
+{
+	list->Clear();
+
+	const Vehicle *v;
+
+	switch (window_type) {
+		case VLW_STATION_LIST:
+			FOR_ALL_VEHICLES(v) {
+				if (v->type == type && v->IsPrimaryVehicle()) {
+					const Order *order;
+
+					FOR_VEHICLE_ORDERS(v, order) {
+						if (order->IsType(OT_GOTO_STATION) && order->GetDestination() == index) {
+							*list->Append() = v;
+							break;
+						}
+					}
+				}
+			}
+			break;
+
+		case VLW_SHARED_ORDERS:
+			FOR_ALL_VEHICLES(v) {
+				/* Find a vehicle with the order in question */
+				if (v->orders != NULL && v->orders->index == index) {
+					/* Add all vehicles from this vehicle's shared order list */
+					for (v = GetFirstVehicleFromSharedList(v); v != NULL; v = v->next_shared) {
+						*list->Append() = v;
+					}
+					break;
+				}
+			}
+			break;
+
+		case VLW_STANDARD:
+			FOR_ALL_VEHICLES(v) {
+				if (v->type == type && v->owner == owner && v->IsPrimaryVehicle()) {
+					*list->Append() = v;
+				}
+			}
+			break;
+
+		case VLW_DEPOT_LIST:
+			FOR_ALL_VEHICLES(v) {
+				if (v->type == type && v->IsPrimaryVehicle()) {
+					const Order *order;
+
+					FOR_VEHICLE_ORDERS(v, order) {
+						if (order->IsType(OT_GOTO_DEPOT) && order->GetDestination() == index) {
+							*list->Append() = v;
+							break;
+						}
+					}
+				}
+			}
+			break;
+
+		case VLW_GROUP_LIST:
+			FOR_ALL_VEHICLES(v) {
+				if (v->type == type && v->IsPrimaryVehicle() &&
+						v->owner == owner && v->group_id == index) {
+					*list->Append() = v;
+				}
+			}
+			break;
+
+		default: NOT_REACHED(); break;
+	}
+
+	list->Compact();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/vehiclelist.h	Tue Jun 17 10:32:49 2008 +0000
@@ -0,0 +1,15 @@
+/* $Id$ */
+
+/** @file vehiclelist.h Functions and type for generating vehicle lists. */
+
+#ifndef VEHICLELIST_H
+#define VEHICLELIST_H
+
+#include "misc/smallvec.h"
+
+typedef SmallVector<const Vehicle *, 32> VehicleList;
+
+void GenerateVehicleSortList(VehicleList *list, VehicleType type, PlayerID owner, uint32 index, uint16 window_type);
+void BuildDepotVehicleList(VehicleType type, TileIndex tile, VehicleList *engine_list, VehicleList *wagon_list);
+
+#endif /* VEHICLELIST_H */
--- a/src/video/cocoa/event.mm	Tue May 27 00:50:55 2008 +0000
+++ b/src/video/cocoa/event.mm	Tue Jun 17 10:32:49 2008 +0000
@@ -288,9 +288,9 @@
 	}
 
 	if (_current_mods & NSShiftKeyMask)     key |= WKC_SHIFT;
-	if (_current_mods & NSControlKeyMask)   key |= (_settings.gui.right_mouse_btn_emulation != RMBE_CONTROL ? WKC_CTRL : WKC_META);
+	if (_current_mods & NSControlKeyMask)   key |= (_settings_client.gui.right_mouse_btn_emulation != RMBE_CONTROL ? WKC_CTRL : WKC_META);
 	if (_current_mods & NSAlternateKeyMask) key |= WKC_ALT;
-	if (_current_mods & NSCommandKeyMask)   key |= (_settings.gui.right_mouse_btn_emulation != RMBE_CONTROL ? WKC_META : WKC_CTRL);
+	if (_current_mods & NSCommandKeyMask)   key |= (_settings_client.gui.right_mouse_btn_emulation != RMBE_CONTROL ? WKC_META : WKC_CTRL);
 
 	return key << 16;
 }
@@ -459,8 +459,8 @@
 		case NSLeftMouseDown:
 		{
 			uint32 keymask = 0;
-			if (_settings.gui.right_mouse_btn_emulation == RMBE_COMMAND) keymask |= NSCommandKeyMask;
-			if (_settings.gui.right_mouse_btn_emulation == RMBE_CONTROL) keymask |= NSControlKeyMask;
+			if (_settings_client.gui.right_mouse_btn_emulation == RMBE_COMMAND) keymask |= NSCommandKeyMask;
+			if (_settings_client.gui.right_mouse_btn_emulation == RMBE_CONTROL) keymask |= NSControlKeyMask;
 
 			pt = _cocoa_subdriver->GetMouseLocation(event);
 
@@ -602,8 +602,8 @@
 			} /* else: deltaY was 0.0 and we don't want to do anything */
 
 			/* Set the scroll count for scrollwheel scrolling */
-			_cursor.h_wheel -= (int)([ event deltaX ]* 5 * _settings.gui.scrollwheel_multiplier);
-			_cursor.v_wheel -= (int)([ event deltaY ]* 5 * _settings.gui.scrollwheel_multiplier);
+			_cursor.h_wheel -= (int)([ event deltaX ]* 5 * _settings_client.gui.scrollwheel_multiplier);
+			_cursor.v_wheel -= (int)([ event deltaY ]* 5 * _settings_client.gui.scrollwheel_multiplier);
 			break;
 
 		default:
@@ -671,7 +671,7 @@
 
 			bool old_ctrl_pressed = _ctrl_pressed;
 
-			_ctrl_pressed = !!(_current_mods & ( _settings.gui.right_mouse_btn_emulation != RMBE_CONTROL ? NSControlKeyMask : NSCommandKeyMask));
+			_ctrl_pressed = !!(_current_mods & ( _settings_client.gui.right_mouse_btn_emulation != RMBE_CONTROL ? NSControlKeyMask : NSCommandKeyMask));
 			_shift_pressed = !!(_current_mods & NSShiftKeyMask);
 
 			if (old_ctrl_pressed != _ctrl_pressed) HandleCtrlChanged();
--- a/src/video/dedicated_v.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/video/dedicated_v.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -107,10 +107,10 @@
 	/* Create event to signal when console input is ready */
 	_hInputReady = CreateEvent(NULL, false, false, NULL);
 	_hWaitForInputHandling = CreateEvent(NULL, false, false, NULL);
-	if (_hInputReady == NULL || _hWaitForInputHandling == NULL) error("Cannot create console event!");
+	if (_hInputReady == NULL || _hWaitForInputHandling == NULL) usererror("Cannot create console event!");
 
 	_hThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)CheckForConsoleInput, NULL, 0, &dwThreadId);
-	if (_hThread == NULL) error("Cannot create console thread!");
+	if (_hThread == NULL) usererror("Cannot create console thread!");
 
 	DEBUG(driver, 2, "Windows console thread started");
 }
--- a/src/video/sdl_v.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/video/sdl_v.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -118,7 +118,7 @@
 	modes = SDL_CALL SDL_ListModes(NULL, SDL_SWSURFACE + (_fullscreen ? SDL_FULLSCREEN : 0));
 
 	if (modes == NULL)
-		error("sdl: no modes available");
+		usererror("sdl: no modes available");
 
 	_all_modes = (modes == (void*)-1);
 
@@ -198,7 +198,7 @@
 
 	DEBUG(driver, 1, "SDL: using mode %dx%dx%d", w, h, bpp);
 
-	if (bpp == 0) error("Can't use a blitter that blits 0 bpp for normal visuals");
+	if (bpp == 0) usererror("Can't use a blitter that blits 0 bpp for normal visuals");
 
 	/* Give the application an icon */
 	icon = SDL_CALL SDL_LoadBMP(ICON_DIR PATHSEP "openttd.32.bmp");
--- a/src/video/win32_v.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/video/win32_v.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -59,7 +59,7 @@
 
 	}
 	_wnd.gdi_palette = CreatePalette(pal);
-	if (_wnd.gdi_palette == NULL) error("CreatePalette failed!\n");
+	if (_wnd.gdi_palette == NULL) usererror("CreatePalette failed!\n");
 }
 
 static void UpdatePalette(HDC dc, uint start, uint count)
@@ -292,7 +292,7 @@
 			_sntprintf(Windowtitle, sizeof(Windowtitle), _T("OpenTTD %s"), MB_TO_WIDE(_openttd_revision));
 
 			_wnd.main_wnd = CreateWindow(_T("OTTD"), Windowtitle, style, x, y, w, h, 0, 0, GetModuleHandle(NULL), 0);
-			if (_wnd.main_wnd == NULL) error("CreateWindow failed");
+			if (_wnd.main_wnd == NULL) usererror("CreateWindow failed");
 			ShowWindow(_wnd.main_wnd, showstyle);
 		}
 	}
@@ -671,7 +671,7 @@
 		};
 
 		registered = true;
-		if (!RegisterClass(&wnd)) error("RegisterClass failed");
+		if (!RegisterClass(&wnd)) usererror("RegisterClass failed");
 	}
 }
 
@@ -684,7 +684,7 @@
 	w = max(w, 64);
 	h = max(h, 64);
 
-	if (bpp == 0) error("Can't use a blitter that blits 0 bpp for normal visuals");
+	if (bpp == 0) usererror("Can't use a blitter that blits 0 bpp for normal visuals");
 
 	if (w == _screen.width && h == _screen.height)
 		return false;
@@ -707,7 +707,7 @@
 
 	dc = GetDC(0);
 	_wnd.dib_sect = CreateDIBSection(dc, bi, DIB_RGB_COLORS, (VOID**)&_wnd.buffer_bits, NULL, 0);
-	if (_wnd.dib_sect == NULL) error("CreateDIBSection failed");
+	if (_wnd.dib_sect == NULL) usererror("CreateDIBSection failed");
 	ReleaseDC(0, dc);
 
 	return true;
--- a/src/viewport.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/viewport.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -1045,7 +1045,7 @@
 						right  > t->sign.left &&
 						left   < t->sign.left + t->sign.width_1) {
 					AddStringToDraw(t->sign.left + 1, t->sign.top + 1,
-						_settings.gui.population_in_label ? STR_TOWN_LABEL_POP : STR_TOWN_LABEL,
+						_settings_client.gui.population_in_label ? STR_TOWN_LABEL_POP : STR_TOWN_LABEL,
 						t->index, t->population);
 				}
 			}
@@ -1061,7 +1061,7 @@
 						right  > t->sign.left &&
 						left   < t->sign.left + t->sign.width_1 * 2) {
 					AddStringToDraw(t->sign.left + 1, t->sign.top + 1,
-						_settings.gui.population_in_label ? STR_TOWN_LABEL_POP : STR_TOWN_LABEL,
+						_settings_client.gui.population_in_label ? STR_TOWN_LABEL_POP : STR_TOWN_LABEL,
 						t->index, t->population);
 				}
 			}
@@ -1616,7 +1616,7 @@
 		int delta_y = w->viewport->dest_scrollpos_y - w->viewport->scrollpos_y;
 
 		if (delta_x != 0 || delta_y != 0) {
-			if (_settings.gui.smooth_scroll) {
+			if (_settings_client.gui.smooth_scroll) {
 				int max_scroll = ScaleByMapSize1D(512);
 				/* Not at our desired positon yet... */
 				w->viewport->scrollpos_x += Clamp(delta_x / 4, -max_scroll, max_scroll);
@@ -2535,7 +2535,7 @@
 		}
 	}
 
-	if (_settings.gui.measure_tooltip) {
+	if (_settings_client.gui.measure_tooltip) {
 		TileIndex t0 = TileVirtXY(thd->selstart.x, thd->selstart.y);
 		TileIndex t1 = TileVirtXY(x, y);
 		uint distance = DistanceManhattan(t0, t1) + 1;
@@ -2615,7 +2615,7 @@
 			style = HT_DIR_X;
 
 calc_heightdiff_single_direction:;
-			if (_settings.gui.measure_tooltip) {
+			if (_settings_client.gui.measure_tooltip) {
 				TileIndex t0 = TileVirtXY(sx, sy);
 				TileIndex t1 = TileVirtXY(x, y);
 				uint distance = DistanceManhattan(t0, t1) + 1;
@@ -2643,7 +2643,7 @@
 			y = sy + Clamp(y - sy, -limit, limit);
 			} /* Fallthrough */
 		case VPM_X_AND_Y: { /* drag an X by Y area */
-			if (_settings.gui.measure_tooltip) {
+			if (_settings_client.gui.measure_tooltip) {
 				static const StringID measure_strings_area[] = {
 					STR_NULL, STR_NULL, STR_MEASURE_AREA, STR_MEASURE_AREA_HEIGHTDIFF
 				};
@@ -2783,3 +2783,33 @@
 	_thd.FSMportMask = NULL;
 	SetObjectToPlace(SPR_CURSOR_MOUSE, PAL_NONE, VHM_NONE, WC_MAIN_WINDOW, 0);
 }
+
+
+void SaveViewportBeforeSaveGame()
+{
+	const Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
+
+	if (w != NULL) {
+		_saved_scrollpos_x = w->viewport->scrollpos_x;
+		_saved_scrollpos_y = w->viewport->scrollpos_y;
+		_saved_scrollpos_zoom = w->viewport->zoom;
+	}
+}
+
+void ResetViewportAfterLoadGame()
+{
+	Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
+
+	w->viewport->scrollpos_x = _saved_scrollpos_x;
+	w->viewport->scrollpos_y = _saved_scrollpos_y;
+	w->viewport->dest_scrollpos_x = _saved_scrollpos_x;
+	w->viewport->dest_scrollpos_y = _saved_scrollpos_y;
+
+	ViewPort *vp = w->viewport;
+	vp->zoom = min(_saved_scrollpos_zoom, ZOOM_LVL_MAX);
+	vp->virtual_width = ScaleByZoom(vp->width, vp->zoom);
+	vp->virtual_height = ScaleByZoom(vp->height, vp->zoom);
+
+	DoZoomInOutWindow(ZOOM_NONE, w); // update button status
+	MarkWholeScreenDirty();
+}
--- a/src/water_cmd.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/water_cmd.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -774,7 +774,7 @@
 	}
 
 	/* if non-uniform stations are disabled, flood some train in this train station (if there is any) */
-	if (!_settings.station.nonuniform_stations && IsTileType(tile, MP_STATION) && GetStationType(tile) == STATION_RAIL) {
+	if (!_settings_game.station.nonuniform_stations && IsTileType(tile, MP_STATION) && GetStationType(tile) == STATION_RAIL) {
 		const Station *st = GetStationByTile(tile);
 
 		BEGIN_TILE_LOOP(t, st->trainst_w, st->trainst_h, st->train_tile)
--- a/src/waypoint.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/waypoint.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -210,7 +210,7 @@
 
 	tileh = GetTileSlope(tile, NULL);
 	if (tileh != SLOPE_FLAT &&
-			(!_settings.construction.build_on_slopes || IsSteepSlope(tileh) || !(tileh & (0x3 << axis)) || !(tileh & ~(0x3 << axis)))) {
+			(!_settings_game.construction.build_on_slopes || IsSteepSlope(tileh) || !(tileh & (0x3 << axis)) || !(tileh & ~(0x3 << axis)))) {
 		return_cmd_error(STR_0007_FLAT_LAND_REQUIRED);
 	}
 
--- a/src/widgets/dropdown.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/widgets/dropdown.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -274,7 +274,7 @@
 		} else {
 			/* ... and lastly if it won't, enable the scroll bar and fit the
 			 * list in below the widget */
-			int avg_height = list_height / list->size();
+			int avg_height = list_height / (int)list->size();
 			int rows = (screen_bottom - 4 - top) / avg_height;
 			height = rows * avg_height;
 			scroll = true;
@@ -306,8 +306,8 @@
 		dw->widget[0].right -= 12;
 
 		/* Capacity is the average number of items visible */
-		dw->vscroll.cap   = height * list->size() / list_height;
-		dw->vscroll.count = list->size();
+		dw->vscroll.cap   = height * (uint16)list->size() / list_height;
+		dw->vscroll.count = (uint16)list->size();
 	}
 
 	dw->desc_flags = WDF_DEF_WIDGET;
--- a/src/win32.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/win32.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -25,6 +25,7 @@
 #include "core/random_func.hpp"
 #include "core/bitmath_func.hpp"
 #include "string_func.h"
+#include "gamelog.h"
 #include <ctype.h>
 #include <tchar.h>
 #include <errno.h>
@@ -91,14 +92,14 @@
 }
 #endif
 
-void ShowOSErrorBox(const char *buf)
+void ShowOSErrorBox(const char *buf, bool system)
 {
 	MyShowCursor(true);
 	MessageBox(GetActiveWindow(), MB_TO_WIDE(buf), _T("Error!"), MB_ICONSTOP);
 
 /* if exception tracker is enabled, we crash here to let the exception handler handle it. */
 #if defined(WIN32_EXCEPTION_TRACKER) && !defined(_DEBUG)
-	if (*buf == '!') {
+	if (system) {
 		_exception_string = buf;
 		*(byte*)0 = 0;
 	}
@@ -454,6 +455,15 @@
 
 extern bool CloseConsoleLogIfActive();
 
+static HANDLE _file_crash_log;
+
+static void GamelogPrintCrashLogProc(const char *s)
+{
+	DWORD num_written;
+	WriteFile(_file_crash_log, s, strlen(s), &num_written, NULL);
+	WriteFile(_file_crash_log, "\r\n", strlen("\r\n"), &num_written, NULL);
+}
+
 static LONG WINAPI ExceptionHandler(EXCEPTION_POINTERS *ep)
 {
 	char *output;
@@ -588,17 +598,15 @@
 		os.dwOSVersionInfoSize = sizeof(os);
 		GetVersionEx(&os);
 		output += sprintf(output, "\r\nSystem information:\r\n"
-			" Windows version %d.%d %d %s\r\n",
+			" Windows version %d.%d %d %s\r\n\r\n",
 			os.dwMajorVersion, os.dwMinorVersion, os.dwBuildNumber, os.szCSDVersion);
 	}
 
-	{
-		HANDLE file = CreateFile(_T("crash.log"), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
+	_file_crash_log = CreateFile(_T("crash.log"), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
+
+	if (_file_crash_log != INVALID_HANDLE_VALUE) {
 		DWORD num_written;
-		if (file != INVALID_HANDLE_VALUE) {
-			WriteFile(file, _crash_msg, output - _crash_msg, &num_written, NULL);
-			CloseHandle(file);
-		}
+		WriteFile(_file_crash_log, _crash_msg, output - _crash_msg, &num_written, NULL);
 	}
 
 #if !defined(_DEBUG)
@@ -636,6 +644,11 @@
 	}
 #endif
 
+	if (_file_crash_log != INVALID_HANDLE_VALUE) {
+		GamelogPrint(&GamelogPrintCrashLogProc);
+		CloseHandle(_file_crash_log);
+	}
+
 	/* Close any possible log files */
 	CloseConsoleLogIfActive();
 
@@ -780,7 +793,7 @@
 {
 #if defined(WINCE)
 	/* WinCE only knows one drive: / */
-	FiosItem *fios = FiosAlloc();
+	FiosItem *fios = _fios_items.Append();
 	fios->type = FIOS_TYPE_DRIVE;
 	fios->mtime = 0;
 	snprintf(fios->name, lengthof(fios->name), PATHSEP "");
@@ -791,7 +804,7 @@
 
 	GetLogicalDriveStrings(sizeof(drives), drives);
 	for (s = drives; *s != '\0';) {
-		FiosItem *fios = FiosAlloc();
+		FiosItem *fios = _fios_items.Append();
 		fios->type = FIOS_TYPE_DRIVE;
 		fios->mtime = 0;
 		snprintf(fios->name, lengthof(fios->name),  "%c:", s[0] & 0xFF);
@@ -948,7 +961,7 @@
 
 #if !defined(WINCE)
 	/* Check if a win9x user started the win32 version */
-	if (HasBit(GetVersion(), 31)) error("This version of OpenTTD doesn't run on windows 95/98/ME.\nPlease download the win9x binary and try again.");
+	if (HasBit(GetVersion(), 31)) usererror("This version of OpenTTD doesn't run on windows 95/98/ME.\nPlease download the win9x binary and try again.");
 #endif
 
 	/* For UNICODE we need to convert the commandline to char* _AND_
@@ -1090,7 +1103,7 @@
 	const char *ptr;
 
 	WChar c;
-	size_t width, length;
+	uint16 width, length;
 
 	if (IsClipboardFormatAvailable(CF_UNICODETEXT)) {
 		OpenClipboard(NULL);
@@ -1122,7 +1135,7 @@
 	for (ptr = utf8_buf; (c = Utf8Consume(&ptr)) != '\0';) {
 		if (!IsPrintable(c)) break;
 
-		size_t len = Utf8CharLen(c);
+		byte len = Utf8CharLen(c);
 		if (tb->length + length >= tb->maxlength - len) break;
 
 		byte charwidth = GetCharacterWidth(FS_NORMAL, c);
--- a/src/window.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/window.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -37,6 +37,7 @@
 Window *_z_windows[MAX_NUMBER_OF_WINDOWS];
 Window **_last_z_window; ///< always points to the next free space in the z-array
 
+byte _no_scroll;
 Point _cursorpos_drag_start;
 
 int _scrollbar_start_pos;
@@ -720,9 +721,14 @@
 }
 
 /**
- * Find a nice spot for this window and resize it towards the default size.
+ * Resize window towards the default size.
+ * Prior to construction, a position for the new window (for its default size)
+ * has been found with LocalGetWindowPlacement(). Initially, the window is
+ * constructed with minimal size. Resizing the window to its default size is
+ * done here.
  * @param def_width default width in pixels of the window
  * @param def_height default height in pixels of the window
+ * @see Window::Window(), Window::Initialize()
  */
 void Window::FindWindowPlacementAndResize(int def_width, int def_height)
 {
@@ -801,7 +807,17 @@
 	this->Initialize(x, y, width, height, cls, widget, 0);
 }
 
-
+/**
+ * Decide whether a given rectangle is a good place to open a completely visible new window.
+ * The new window should be within screen borders, and not overlap with another already
+ * existing window (except for the main window in the background).
+ * @param left    Left edge of the rectangle
+ * @param top     Top edge of the rectangle
+ * @param width   Width of the rectangle
+ * @param height  Height of the rectangle
+ * @param pos     If rectangle is good, use this parameter to return the top-left corner of the new window
+ * @return Boolean indication that the rectangle is a good place for the new window
+ */
 static bool IsGoodAutoPlace1(int left, int top, int width, int height, Point &pos)
 {
 	Window* const *wz;
@@ -829,11 +845,26 @@
 	return true;
 }
 
+/**
+ * Decide whether a given rectangle is a good place to open a mostly visible new window.
+ * The new window should be mostly within screen borders, and not overlap with another already
+ * existing window (except for the main window in the background).
+ * @param left    Left edge of the rectangle
+ * @param top     Top edge of the rectangle
+ * @param width   Width of the rectangle
+ * @param height  Height of the rectangle
+ * @param pos     If rectangle is good, use this parameter to return the top-left corner of the new window
+ * @return Boolean indication that the rectangle is a good place for the new window
+ */
 static bool IsGoodAutoPlace2(int left, int top, int width, int height, Point &pos)
 {
 	Window* const *wz;
 
+	/* Left part of the rectangle may be at most 1/4 off-screen,
+	 * right part of the rectangle may be at most 1/2 off-screen
+	 */
 	if (left < -(width>>2) || left > _screen.width - (width>>1)) return false;
+	/* Bottom part of the rectangle may be at most 1/4 off-screen */
 	if (top < 22 || top > _screen.height - (height>>2)) return false;
 
 	/* Make sure it is not obscured by any window. */
@@ -854,13 +885,24 @@
 	return true;
 }
 
+/**
+ * Find a good place for opening a new window of a given width and height.
+ * @param width  Width of the new window
+ * @param height Height of the new window
+ * @return Top-left coordinate of the new window
+ */
 static Point GetAutoPlacePosition(int width, int height)
 {
 	Window* const *wz;
 	Point pt;
 
+	/* First attempt, try top-left of the screen */
 	if (IsGoodAutoPlace1(0, 24, width, height, pt)) return pt;
 
+	/* Second attempt, try around all existing windows with a distance of 2 pixels.
+	 * The new window must be entirely on-screen, and not overlap with an existing window.
+	 * Eight starting points are tried, two at each corner.
+	 */
 	FOR_ALL_WINDOWS(wz) {
 		const Window *w = *wz;
 		if (w->window_class == WC_MAIN_WINDOW) continue;
@@ -875,6 +917,10 @@
 		if (IsGoodAutoPlace1(w->left + w->width - width, w->top - height - 2,    width, height, pt)) return pt;
 	}
 
+	/* Third attempt, try around all existing windows with a distance of 2 pixels.
+	 * The new window may be partly off-screen, and must not overlap with an existing window.
+	 * Only four starting points are tried.
+	 */
 	FOR_ALL_WINDOWS(wz) {
 		const Window *w = *wz;
 		if (w->window_class == WC_MAIN_WINDOW) continue;
@@ -885,6 +931,9 @@
 		if (IsGoodAutoPlace2(w->left, w->top - height - 2,    width, height, pt)) return pt;
 	}
 
+	/* Fourth and final attempt, put window at diagonal starting from (0, 24), try multiples
+	 * of (+5, +5)
+	 */
 	{
 		int left = 0, top = 24;
 
@@ -1021,6 +1070,7 @@
 	_last_z_window = _z_windows;
 	_mouseover_last_w = NULL;
 	_no_scroll = 0;
+	_scrolling_viewport = 0;
 }
 
 /**
@@ -1217,11 +1267,11 @@
 			int nx = x;
 			int ny = y;
 
-			if (_settings.gui.window_snap_radius != 0) {
+			if (_settings_client.gui.window_snap_radius != 0) {
 				Window* const *vz;
 
-				int hsnap = _settings.gui.window_snap_radius;
-				int vsnap = _settings.gui.window_snap_radius;
+				int hsnap = _settings_client.gui.window_snap_radius;
+				int vsnap = _settings_client.gui.window_snap_radius;
 				int delta;
 
 				FOR_ALL_WINDOWS(vz) {
@@ -1467,7 +1517,7 @@
 
 static bool HandleViewportScroll()
 {
-	bool scrollwheel_scrolling = _settings.gui.scrollwheel_scrolling == 1 && (_cursor.v_wheel != 0 || _cursor.h_wheel != 0);
+	bool scrollwheel_scrolling = _settings_client.gui.scrollwheel_scrolling == 1 && (_cursor.v_wheel != 0 || _cursor.h_wheel != 0);
 
 	if (!_scrolling_viewport) return true;
 
@@ -1487,7 +1537,7 @@
 	}
 
 	Point delta;
-	if (_settings.gui.reverse_scroll) {
+	if (_settings_client.gui.reverse_scroll) {
 		delta.x = -_cursor.delta.x;
 		delta.y = -_cursor.delta.y;
 	} else {
@@ -1667,7 +1717,7 @@
 		return;
 	}
 
-	if (_settings.gui.autoscroll && _game_mode != GM_MENU && !IsGeneratingWorld()) {
+	if (_settings_client.gui.autoscroll && _game_mode != GM_MENU && !IsGeneratingWorld()) {
 		int x = _cursor.pos.x;
 		int y = _cursor.pos.y;
 		Window *w = FindWindowFromPt(x, y);
@@ -1707,11 +1757,60 @@
 extern void UpdateTileSelection();
 extern bool VpHandlePlaceSizingDrag();
 
+static void ScrollMainViewport(int x, int y)
+{
+	if (_game_mode != GM_MENU) {
+		Window *w = FindWindowById(WC_MAIN_WINDOW, 0);
+		assert(w);
+
+		w->viewport->dest_scrollpos_x += ScaleByZoom(x, w->viewport->zoom);
+		w->viewport->dest_scrollpos_y += ScaleByZoom(y, w->viewport->zoom);
+	}
+}
+
+/**
+ * Describes all the different arrow key combinations the game allows
+ * when it is in scrolling mode.
+ * The real arrow keys are bitwise numbered as
+ * 1 = left
+ * 2 = up
+ * 4 = right
+ * 8 = down
+ */
+static const int8 scrollamt[16][2] = {
+	{ 0,  0}, ///<  no key specified
+	{-2,  0}, ///<  1 : left
+	{ 0, -2}, ///<  2 : up
+	{-2, -1}, ///<  3 : left  + up
+	{ 2,  0}, ///<  4 : right
+	{ 0,  0}, ///<  5 : left  + right = nothing
+	{ 2, -1}, ///<  6 : right + up
+	{ 0, -2}, ///<  7 : right + left  + up = up
+	{ 0  ,2}, ///<  8 : down
+	{-2  ,1}, ///<  9 : down  + left
+	{ 0,  0}, ///< 10 : down  + up    = nothing
+	{-2,  0}, ///< 11 : left  + up    +  down = left
+	{ 2,  1}, ///< 12 : down  + right
+	{ 0,  2}, ///< 13 : left  + right +  down = down
+	{ 2,  0}, ///< 14 : right + up    +  down = right
+	{ 0,  0}, ///< 15 : left  + up    +  right + down  = nothing
+};
+
+static void HandleKeyScrolling()
+{
+	if (_dirkeys && !_no_scroll) {
+		int factor = _shift_pressed ? 50 : 10;
+		ScrollMainViewport(scrollamt[_dirkeys][0] * factor, scrollamt[_dirkeys][1] * factor);
+	}
+}
+
 void MouseLoop(MouseClick click, int mousewheel)
 {
 	DecreaseWindowCounters();
 	HandlePlacePresize();
 	UpdateTileSelection();
+	HandleKeyScrolling();
+
 	if (!VpHandlePlaceSizingDrag())  return;
 	if (!HandleDragDrop())           return;
 	if (!HandleWindowDragging())     return;
@@ -1719,7 +1818,7 @@
 	if (!HandleViewportScroll())     return;
 	if (!HandleMouseOver())          return;
 
-	bool scrollwheel_scrolling = _settings.gui.scrollwheel_scrolling == 1 && (_cursor.v_wheel != 0 || _cursor.h_wheel != 0);
+	bool scrollwheel_scrolling = _settings_client.gui.scrollwheel_scrolling == 1 && (_cursor.v_wheel != 0 || _cursor.h_wheel != 0);
 	if (click == MC_NONE && mousewheel == 0 && !scrollwheel_scrolling) return;
 
 	int x = _cursor.pos.x;
@@ -1734,7 +1833,7 @@
 	if (vp != NULL && (_game_mode == GM_MENU || IsGeneratingWorld())) return;
 
 	if (mousewheel != 0) {
-		if (_settings.gui.scrollwheel_scrolling == 0) {
+		if (_settings_client.gui.scrollwheel_scrolling == 0) {
 			/* Send mousewheel event to window */
 			w->OnMouseWheel(mousewheel);
 		}
@@ -1979,6 +2078,12 @@
  */
 void CallWindowTickEvent()
 {
+	if (_scroller_click_timeout > 3) {
+		_scroller_click_timeout -= 3;
+	} else {
+		_scroller_click_timeout = 0;
+	}
+
 	for (Window * const *wz = _last_z_window; wz != _z_windows;) {
 		(*--wz)->OnTick();
 	}
@@ -2059,7 +2164,7 @@
 		w = FindWindowById(WC_MAIN_TOOLBAR, 0);
 	}
 
-	switch (_settings.gui.toolbar_pos) {
+	switch (_settings_client.gui.toolbar_pos) {
 		case 1:  w->left = (_screen.width - w->width) / 2; break;
 		case 2:  w->left = _screen.width - w->width; break;
 		default: w->left = 0;
@@ -2068,6 +2173,30 @@
 	return w->left;
 }
 
+void SetVScrollCount(Window *w, int num)
+{
+	w->vscroll.count = num;
+	num -= w->vscroll.cap;
+	if (num < 0) num = 0;
+	if (num < w->vscroll.pos) w->vscroll.pos = num;
+}
+
+void SetVScroll2Count(Window *w, int num)
+{
+	w->vscroll2.count = num;
+	num -= w->vscroll2.cap;
+	if (num < 0) num = 0;
+	if (num < w->vscroll2.pos) w->vscroll2.pos = num;
+}
+
+void SetHScrollCount(Window *w, int num)
+{
+	w->hscroll.count = num;
+	num -= w->hscroll.cap;
+	if (num < 0) num = 0;
+	if (num < w->hscroll.pos) w->hscroll.pos = num;
+}
+
 /**
  * Relocate all windows to fit the new size of the game application screen
  * @param neww New width of the game application screen
--- a/src/window_gui.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/window_gui.h	Tue Jun 17 10:32:49 2008 +0000
@@ -536,6 +536,21 @@
 extern Window **_last_z_window;
 #define FOR_ALL_WINDOWS(wz) for (wz = _z_windows; wz != _last_z_window; wz++)
 
+/**
+ * In certain windows you navigate with the arrow keys. Do not scroll the
+ * gameview when here. Bitencoded variable that only allows scrolling if all
+ * elements are zero
+ */
+enum {
+	SCROLL_CON  = 0,
+	SCROLL_EDIT = 1,
+	SCROLL_SAVE = 2,
+	SCROLL_CHAT = 4,
+};
+
+/** Disable scrolling of the main viewport when an input-window is active. */
+extern byte _no_scroll;
+
 extern Point _cursorpos_drag_start;
 
 extern int _scrollbar_start_pos;
@@ -562,6 +577,10 @@
 
 void ResizeWindowForWidget(Window *w, int widget, int delta_x, int delta_y);
 
+void SetVScrollCount(Window *w, int num);
+void SetVScroll2Count(Window *w, int num);
+void SetHScrollCount(Window *w, int num);
+
 
 /**
  * Sets the enabled/disabled status of a widget.
--- a/src/yapf/follow_track.hpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/yapf/follow_track.hpp	Tue Jun 17 10:32:49 2008 +0000
@@ -22,7 +22,7 @@
 		EC_NO_WAY,
 	};
 
-	const Vehicle*      m_veh;           ///< moving vehicle
+	const Vehicle      *m_veh;           ///< moving vehicle
 	TileIndex           m_old_tile;      ///< the origin (vehicle moved from) before move
 	Trackdir            m_old_td;        ///< the trackdir (the vehicle was on) before move
 	TileIndex           m_new_tile;      ///< the new tile (the vehicle has entered)
@@ -33,14 +33,14 @@
 	bool                m_is_station;    ///< last turn passed station
 	int                 m_tiles_skipped; ///< number of skipped tunnel or station tiles
 	ErrorCode           m_err;
-	CPerformanceTimer* m_pPerf;
+	CPerformanceTimer  *m_pPerf;
 
-	FORCEINLINE CFollowTrackT(const Vehicle* v = NULL, CPerformanceTimer* pPerf = NULL)
+	FORCEINLINE CFollowTrackT(const Vehicle *v = NULL, CPerformanceTimer* pPerf = NULL)
 	{
 		Init(v, pPerf);
 	}
 
-	FORCEINLINE void Init(const Vehicle* v, CPerformanceTimer* pPerf)
+	FORCEINLINE void Init(const Vehicle *v, CPerformanceTimer* pPerf)
 	{
 		assert(!IsRailTT() || (v != NULL && v->type == VEH_TRAIN));
 		m_veh = v;
--- a/src/yapf/yapf.h	Tue May 27 00:50:55 2008 +0000
+++ b/src/yapf/yapf.h	Tue Jun 17 10:32:49 2008 +0000
@@ -16,7 +16,7 @@
  * @param tracks   available tracks on the new tile (to choose from)
  * @return         the best trackdir for next turn or INVALID_TRACKDIR if the path could not be found
  */
-Trackdir YapfChooseShipTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks);
+Trackdir YapfChooseShipTrack(const Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks);
 
 /** Finds the best path for given road vehicle.
  * @param v        the RV that needs to find a path
@@ -24,7 +24,7 @@
  * @param enterdir diagonal direction which the RV will enter this new tile from
  * @return         the best trackdir for next turn or INVALID_TRACKDIR if the path could not be found
  */
-Trackdir YapfChooseRoadTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir);
+Trackdir YapfChooseRoadTrack(const Vehicle *v, TileIndex tile, DiagDirection enterdir);
 
 /** Finds the best path for given train.
  * @param v        the train that needs to find a path
@@ -34,7 +34,7 @@
  * @param path_not_found [out] true is returned if no path can be found (returned Trackdir is only a 'guess')
  * @return         the best trackdir for next turn or INVALID_TRACKDIR if the path could not be found
  */
-Trackdir YapfChooseRailTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool *path_not_found);
+Trackdir YapfChooseRailTrack(const Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool *path_not_found);
 
 /** Used by RV multistop feature to find the nearest road stop that has a free slot.
  * @param v      RV (its current tile will be the origin)
@@ -58,17 +58,17 @@
  * @param reversed     receives true if train needs to reversed first
  * @return       the true if depot was found.
  */
-bool YapfFindNearestRailDepotTwoWay(Vehicle *v, int max_distance, int reverse_penalty, TileIndex* depot_tile, bool* reversed);
+bool YapfFindNearestRailDepotTwoWay(const Vehicle *v, int max_distance, int reverse_penalty, TileIndex *depot_tile, bool *reversed);
 
 /** Returns true if it is better to reverse the train before leaving station */
-bool YapfCheckReverseTrain(Vehicle* v);
+bool YapfCheckReverseTrain(const Vehicle* v);
 
 /** Use this function to notify YAPF that track layout (or signal configuration) has change */
 void YapfNotifyTrackLayoutChange(TileIndex tile, Track track);
 
 /** performance measurement helpers */
 void* NpfBeginInterval();
-int NpfEndInterval(void* perf);
+int NpfEndInterval(void *perf);
 
 
 extern int _aystar_stats_open_size;
--- a/src/yapf/yapf_base.hpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/yapf/yapf_base.hpp	Tue Jun 17 10:32:49 2008 +0000
@@ -51,11 +51,11 @@
 
 	NodeList             m_nodes;              ///< node list multi-container
 protected:
-	Node*                m_pBestDestNode;      ///< pointer to the destination node found at last round
-	Node*                m_pBestIntermediateNode; ///< here should be node closest to the destination if path not found
-	const YAPFSettings  *m_settings;           ///< current settings (_settings.yapf)
+	Node                *m_pBestDestNode;      ///< pointer to the destination node found at last round
+	Node                *m_pBestIntermediateNode; ///< here should be node closest to the destination if path not found
+	const YAPFSettings  *m_settings;           ///< current settings (_settings_game.yapf)
 	int                  m_max_search_nodes;   ///< maximum number of nodes we are allowed to visit before we give up
-	const Vehicle*       m_veh;                ///< vehicle that we are trying to drive
+	const Vehicle       *m_veh;                ///< vehicle that we are trying to drive
 
 	int                  m_stats_cost_calcs;   ///< stats - how many node's costs were calculated
 	int                  m_stats_cache_hits;   ///< stats - how many node's costs were reused from cache
@@ -74,7 +74,7 @@
 	FORCEINLINE CYapfBaseT()
 		: m_pBestDestNode(NULL)
 		, m_pBestIntermediateNode(NULL)
-		, m_settings(&_settings.pf.yapf)
+		, m_settings(&_settings_game.pf.yapf)
 		, m_max_search_nodes(PfGetSettings().max_search_nodes)
 		, m_veh(NULL)
 		, m_stats_cost_calcs(0)
@@ -281,7 +281,7 @@
 		m_nodes.InsertOpenNode(n);
 	}
 
-	const Vehicle* GetVehicle() const {return m_veh;}
+	const Vehicle * GetVehicle() const {return m_veh;}
 
 	void DumpBase(DumpTarget &dmp) const
 	{
--- a/src/yapf/yapf_costrail.hpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/yapf/yapf_costrail.hpp	Tue Jun 17 10:32:49 2008 +0000
@@ -191,7 +191,7 @@
 	FORCEINLINE int PlatformLengthPenalty(int platform_length)
 	{
 		int cost = 0;
-		const Vehicle* v = Yapf().GetVehicle();
+		const Vehicle *v = Yapf().GetVehicle();
 		assert(v != NULL);
 		assert(v->type == VEH_TRAIN);
 		assert(v->u.rail.cached_total_length != 0);
@@ -261,7 +261,7 @@
 		int segment_entry_cost = 0;
 		int segment_cost = 0;
 
-		const Vehicle* v = Yapf().GetVehicle();
+		const Vehicle *v = Yapf().GetVehicle();
 
 		// start at n.m_key.m_tile / n.m_key.m_td and walk to the end of segment
 		TILE cur(n.m_key.m_tile, n.m_key.m_td);
--- a/src/yapf/yapf_destrail.hpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/yapf/yapf_destrail.hpp	Tue Jun 17 10:32:49 2008 +0000
@@ -11,7 +11,7 @@
 	RailTypes m_compatible_railtypes;
 
 public:
-	void SetDestination(Vehicle* v)
+	void SetDestination(const Vehicle* v)
 	{
 		m_compatible_railtypes = v->u.rail.compatible_railtypes;
 	}
@@ -84,7 +84,7 @@
 	}
 
 public:
-	void SetDestination(Vehicle* v)
+	void SetDestination(const Vehicle* v)
 	{
 		switch (v->current_order.GetType()) {
 			case OT_GOTO_STATION:
--- a/src/yapf/yapf_rail.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/yapf/yapf_rail.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -45,7 +45,7 @@
 	/// return debug report character to identify the transportation type
 	FORCEINLINE char TransportTypeChar() const {return 't';}
 
-	static bool stFindNearestDepotTwoWay(Vehicle *v, TileIndex t1, Trackdir td1, TileIndex t2, Trackdir td2, int max_distance, int reverse_penalty, TileIndex* depot_tile, bool* reversed)
+	static bool stFindNearestDepotTwoWay(const Vehicle *v, TileIndex t1, Trackdir td1, TileIndex t2, Trackdir td2, int max_distance, int reverse_penalty, TileIndex* depot_tile, bool* reversed)
 	{
 		Tpf pf1;
 		bool result1 = pf1.FindNearestDepotTwoWay(v, t1, td1, t2, td2, max_distance, reverse_penalty, depot_tile, reversed);
@@ -64,7 +64,7 @@
 		return result1;
 	}
 
-	FORCEINLINE bool FindNearestDepotTwoWay(Vehicle *v, TileIndex t1, Trackdir td1, TileIndex t2, Trackdir td2, int max_distance, int reverse_penalty, TileIndex* depot_tile, bool* reversed)
+	FORCEINLINE bool FindNearestDepotTwoWay(const Vehicle *v, TileIndex t1, Trackdir td1, TileIndex t2, Trackdir td2, int max_distance, int reverse_penalty, TileIndex* depot_tile, bool* reversed)
 	{
 		// set origin and destination nodes
 		Yapf().SetOrigin(t1, td1, t2, td2, reverse_penalty, true);
@@ -121,7 +121,7 @@
 	/// return debug report character to identify the transportation type
 	FORCEINLINE char TransportTypeChar() const {return 't';}
 
-	static Trackdir stChooseRailTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool *path_not_found)
+	static Trackdir stChooseRailTrack(const Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool *path_not_found)
 	{
 		// create pathfinder instance
 		Tpf pf1;
@@ -148,7 +148,7 @@
 		return result1;
 	}
 
-	FORCEINLINE Trackdir ChooseRailTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool *path_not_found)
+	FORCEINLINE Trackdir ChooseRailTrack(const Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool *path_not_found)
 	{
 		// set origin and destination nodes
 		Yapf().SetOrigin(v->tile, GetVehicleTrackdir(v), INVALID_TILE, INVALID_TRACKDIR, 1, true);
@@ -181,7 +181,7 @@
 		return next_trackdir;
 	}
 
-	static bool stCheckReverseTrain(Vehicle* v, TileIndex t1, Trackdir td1, TileIndex t2, Trackdir td2, int reverse_penalty)
+	static bool stCheckReverseTrain(const Vehicle *v, TileIndex t1, Trackdir td1, TileIndex t2, Trackdir td2, int reverse_penalty)
 	{
 		Tpf pf1;
 		bool result1 = pf1.CheckReverseTrain(v, t1, td1, t2, td2, reverse_penalty);
@@ -198,7 +198,7 @@
 		return result1;
 	}
 
-	FORCEINLINE bool CheckReverseTrain(Vehicle* v, TileIndex t1, Trackdir td1, TileIndex t2, Trackdir td2, int reverse_penalty)
+	FORCEINLINE bool CheckReverseTrain(const Vehicle *v, TileIndex t1, Trackdir td1, TileIndex t2, Trackdir td2, int reverse_penalty)
 	{
 		// create pathfinder instance
 		// set origin and destination nodes
@@ -247,14 +247,14 @@
 struct CYapfAnyDepotRail2 : CYapfT<CYapfRail_TypesT<CYapfAnyDepotRail2, CFollowTrackRailNo90, CRailNodeListTrackDir, CYapfDestinationAnyDepotRailT     , CYapfFollowAnyDepotRailT> > {};
 
 
-Trackdir YapfChooseRailTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool *path_not_found)
+Trackdir YapfChooseRailTrack(const Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks, bool *path_not_found)
 {
 	// default is YAPF type 2
-	typedef Trackdir (*PfnChooseRailTrack)(Vehicle*, TileIndex, DiagDirection, TrackBits, bool*);
+	typedef Trackdir (*PfnChooseRailTrack)(const Vehicle*, TileIndex, DiagDirection, TrackBits, bool*);
 	PfnChooseRailTrack pfnChooseRailTrack = &CYapfRail1::stChooseRailTrack;
 
 	// check if non-default YAPF type needed
-	if (_settings.pf.forbid_90_deg) {
+	if (_settings_game.pf.forbid_90_deg) {
 		pfnChooseRailTrack = &CYapfRail2::stChooseRailTrack; // Trackdir, forbid 90-deg
 	}
 
@@ -263,10 +263,10 @@
 	return td_ret;
 }
 
-bool YapfCheckReverseTrain(Vehicle* v)
+bool YapfCheckReverseTrain(const Vehicle* v)
 {
 	/* last wagon */
-	Vehicle* last_veh = GetLastVehicleInChain(v);
+	const Vehicle *last_veh = GetLastVehicleInChain(v);
 
 	// get trackdirs of both ends
 	Trackdir td = GetVehicleTrackdir(v);
@@ -307,11 +307,11 @@
 		reverse_penalty += DistanceManhattan(cur_tile, tile_rev) * YAPF_TILE_LENGTH;
 	}
 
-	typedef bool (*PfnCheckReverseTrain)(Vehicle*, TileIndex, Trackdir, TileIndex, Trackdir, int);
+	typedef bool (*PfnCheckReverseTrain)(const Vehicle*, TileIndex, Trackdir, TileIndex, Trackdir, int);
 	PfnCheckReverseTrain pfnCheckReverseTrain = CYapfRail1::stCheckReverseTrain;
 
 	// check if non-default YAPF type needed
-	if (_settings.pf.forbid_90_deg) {
+	if (_settings_game.pf.forbid_90_deg) {
 		pfnCheckReverseTrain = &CYapfRail2::stCheckReverseTrain; // Trackdir, forbid 90-deg
 	}
 
@@ -323,12 +323,12 @@
 	return reverse;
 }
 
-bool YapfFindNearestRailDepotTwoWay(Vehicle *v, int max_distance, int reverse_penalty, TileIndex* depot_tile, bool* reversed)
+bool YapfFindNearestRailDepotTwoWay(const Vehicle *v, int max_distance, int reverse_penalty, TileIndex *depot_tile, bool *reversed)
 {
 	*depot_tile = INVALID_TILE;
 	*reversed = false;
 
-	Vehicle* last_veh = GetLastVehicleInChain(v);
+	const Vehicle *last_veh = GetLastVehicleInChain(v);
 
 	TileIndex tile = v->tile;
 	TileIndex last_tile = last_veh->tile;
@@ -337,11 +337,11 @@
 	Trackdir td = GetVehicleTrackdir(v);
 	Trackdir td_rev = ReverseTrackdir(GetVehicleTrackdir(last_veh));
 
-	typedef bool (*PfnFindNearestDepotTwoWay)(Vehicle*, TileIndex, Trackdir, TileIndex, Trackdir, int, int, TileIndex*, bool*);
+	typedef bool (*PfnFindNearestDepotTwoWay)(const Vehicle*, TileIndex, Trackdir, TileIndex, Trackdir, int, int, TileIndex*, bool*);
 	PfnFindNearestDepotTwoWay pfnFindNearestDepotTwoWay = &CYapfAnyDepotRail1::stFindNearestDepotTwoWay;
 
 	// check if non-default YAPF type needed
-	if (_settings.pf.forbid_90_deg) {
+	if (_settings_game.pf.forbid_90_deg) {
 		pfnFindNearestDepotTwoWay = &CYapfAnyDepotRail2::stFindNearestDepotTwoWay; // Trackdir, forbid 90-deg
 	}
 
--- a/src/yapf/yapf_road.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/yapf/yapf_road.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -83,7 +83,7 @@
 			// base tile cost depending on distance between edges
 			segment_cost += Yapf().OneTileCost(tile, trackdir);
 
-			const Vehicle* v = Yapf().GetVehicle();
+			const Vehicle *v = Yapf().GetVehicle();
 			// we have reached the vehicle's destination - segment should end here to avoid target skipping
 			if (v->current_order.IsType(OT_GOTO_STATION) && tile == v->dest_tile) break;
 
@@ -253,13 +253,13 @@
 	/// return debug report character to identify the transportation type
 	FORCEINLINE char TransportTypeChar() const {return 'r';}
 
-	static Trackdir stChooseRoadTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir)
+	static Trackdir stChooseRoadTrack(const Vehicle *v, TileIndex tile, DiagDirection enterdir)
 	{
 		Tpf pf;
 		return pf.ChooseRoadTrack(v, tile, enterdir);
 	}
 
-	FORCEINLINE Trackdir ChooseRoadTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir)
+	FORCEINLINE Trackdir ChooseRoadTrack(const Vehicle *v, TileIndex tile, DiagDirection enterdir)
 	{
 		// handle special case - when next tile is destination tile
 		if (tile == v->dest_tile) {
@@ -400,28 +400,29 @@
 struct CYapfRoadAnyDepot2 : CYapfT<CYapfRoad_TypesT<CYapfRoadAnyDepot2, CRoadNodeListExitDir , CYapfDestinationAnyDepotRoadT> > {};
 
 
-Trackdir YapfChooseRoadTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir)
+Trackdir YapfChooseRoadTrack(const Vehicle *v, TileIndex tile, DiagDirection enterdir)
 {
 	// default is YAPF type 2
-	typedef Trackdir (*PfnChooseRoadTrack)(Vehicle*, TileIndex, DiagDirection);
+	typedef Trackdir (*PfnChooseRoadTrack)(const Vehicle*, TileIndex, DiagDirection);
 	PfnChooseRoadTrack pfnChooseRoadTrack = &CYapfRoad2::stChooseRoadTrack; // default: ExitDir, allow 90-deg
 
 	// check if non-default YAPF type should be used
-	if (_settings.pf.yapf.disable_node_optimization)
+	if (_settings_game.pf.yapf.disable_node_optimization) {
 		pfnChooseRoadTrack = &CYapfRoad1::stChooseRoadTrack; // Trackdir, allow 90-deg
+	}
 
 	Trackdir td_ret = pfnChooseRoadTrack(v, tile, enterdir);
 	return td_ret;
 }
 
-uint YapfRoadVehDistanceToTile(const Vehicle* v, TileIndex tile)
+uint YapfRoadVehDistanceToTile(const Vehicle *v, TileIndex tile)
 {
 	// default is YAPF type 2
 	typedef uint (*PfnDistanceToTile)(const Vehicle*, TileIndex);
 	PfnDistanceToTile pfnDistanceToTile = &CYapfRoad2::stDistanceToTile; // default: ExitDir, allow 90-deg
 
 	// check if non-default YAPF type should be used
-	if (_settings.pf.yapf.disable_node_optimization)
+	if (_settings_game.pf.yapf.disable_node_optimization)
 		pfnDistanceToTile = &CYapfRoad1::stDistanceToTile; // Trackdir, allow 90-deg
 
 	// measure distance in YAPF units
@@ -450,7 +451,7 @@
 	PfnFindNearestDepot pfnFindNearestDepot = &CYapfRoadAnyDepot2::stFindNearestDepot;
 
 	// check if non-default YAPF type should be used
-	if (_settings.pf.yapf.disable_node_optimization)
+	if (_settings_game.pf.yapf.disable_node_optimization)
 		pfnFindNearestDepot = &CYapfRoadAnyDepot1::stFindNearestDepot; // Trackdir, allow 90-deg
 
 	Depot* ret = pfnFindNearestDepot(v, tile, trackdir);
--- a/src/yapf/yapf_ship.cpp	Tue May 27 00:50:55 2008 +0000
+++ b/src/yapf/yapf_ship.cpp	Tue Jun 17 10:32:49 2008 +0000
@@ -34,7 +34,7 @@
 	/// return debug report character to identify the transportation type
 	FORCEINLINE char TransportTypeChar() const {return 'w';}
 
-	static Trackdir ChooseShipTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks)
+	static Trackdir ChooseShipTrack(const Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks)
 	{
 		// handle special case - when next tile is destination tile
 		if (tile == v->dest_tile) {
@@ -147,24 +147,25 @@
 struct CYapfShip3 : CYapfT<CYapfShip_TypesT<CYapfShip3, CFollowTrackWaterNo90, CShipNodeListTrackDir> > {};
 
 /** Ship controller helper - path finder invoker */
-Trackdir YapfChooseShipTrack(Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks)
+Trackdir YapfChooseShipTrack(const Vehicle *v, TileIndex tile, DiagDirection enterdir, TrackBits tracks)
 {
 	// default is YAPF type 2
-	typedef Trackdir (*PfnChooseShipTrack)(Vehicle*, TileIndex, DiagDirection, TrackBits);
+	typedef Trackdir (*PfnChooseShipTrack)(const Vehicle*, TileIndex, DiagDirection, TrackBits);
 	PfnChooseShipTrack pfnChooseShipTrack = CYapfShip2::ChooseShipTrack; // default: ExitDir, allow 90-deg
 
 	// check if non-default YAPF type needed
-	if (_settings.pf.forbid_90_deg)
+	if (_settings_game.pf.forbid_90_deg) {
 		pfnChooseShipTrack = &CYapfShip3::ChooseShipTrack; // Trackdir, forbid 90-deg
-	else if (_settings.pf.yapf.disable_node_optimization)
+	} else if (_settings_game.pf.yapf.disable_node_optimization) {
 		pfnChooseShipTrack = &CYapfShip1::ChooseShipTrack; // Trackdir, allow 90-deg
+	}
 
 	Trackdir td_ret = pfnChooseShipTrack(v, tile, enterdir, tracks);
 	return td_ret;
 }
 
 /** performance measurement helper */
-void* NpfBeginInterval()
+void * NpfBeginInterval()
 {
 	CPerformanceTimer& perf = *new CPerformanceTimer;
 	perf.Start();
@@ -172,7 +173,7 @@
 }
 
 /** performance measurement helper */
-int NpfEndInterval(void* vperf)
+int NpfEndInterval(void *vperf)
 {
 	CPerformanceTimer& perf = *(CPerformanceTimer*)vperf;
 	perf.Stop();