(svn r12478) [0.6] -Backport from trunk (12477, 12453, 12448, 12443, 12439, 12417): 0.6
authorrubidium
Fri, 28 Mar 2008 19:01:57 +0000
branch0.6
changeset 9353 1127b484af20
parent 9352 d7b2f0bbd0ec
child 9354 ffe77c8db697
(svn r12478) [0.6] -Backport from trunk (12477, 12453, 12448, 12443, 12439, 12417):
- Fix: Timetable times for aircraft were always doubled [FS#1883] (r12477)
- Fix: Remove broken endian-dependent code and unnecessary rgb to bgr swapping [FS#1880] (r12453)
- Change: Unify RPM spec files (r12448)
- Add: OpenTTD's version to the config file to 'ease' getting the correct version on bugreports (r12443)
- Fix: Do not 'disable' the drawing of autorail overlays when the tile is 'error'-marked (red pulsating selection) [FS#1871] (r12439)
- Fix: Plural rule for Icelandic was wrong (r12417)
changelog.txt
os/mandrake/README.urpmi
os/mandrake/openttd.spec
os/rpm/openttd.spec
os/suse/openttd.spec
src/aircraft_cmd.cpp
src/lang/icelandic.txt
src/settings.cpp
src/spriteloader/png.cpp
src/strgen/strgen.cpp
src/strings.cpp
src/viewport.cpp
--- a/changelog.txt	Fri Mar 28 11:51:58 2008 +0000
+++ b/changelog.txt	Fri Mar 28 19:01:57 2008 +0000
@@ -1,7 +1,16 @@
+0.6.0???? (2008-03-??)
+------------------------------------------------------------------------
+- Fix: Timetable times for aircraft were always doubled [FS#1883] (r12477)
+- Fix: Remove broken endian-dependent code and unnecessary rgb to bgr swapping [FS#1880] (r12453)
+- Fix: Do not 'disable' the drawing of autorail overlays when the tile is 'error'-marked (red pulsating selection) [FS#1871] (r12439)
+- Fix: Plural rule for Icelandic was wrong (r12417)
+
+
 0.6.0-RC1 (2008-03-26)
 ------------------------------------------------------------------------
 - Feature: Show whether a town is a "city" in the town description title bar (r12391)
 - Feature: Increase house animation frame number from 32 to 128 (r12347)
+- Fix: Loading of TTD savegames (r12399, r12401)
 - Fix: Vehicle lists related to stations not closed when the station is deleted [FS#1872] (r12393)
 - Fix: Trams failing to turn on bridge heads/tunnel entrances [FS#1851] (r123890)
 - Fix: Train could break apart when reversed while partially in a depot [FS#1841] (r12386, r12384)
@@ -25,7 +34,7 @@
 - Fix: Do not try to flood water tile [FS#1836] (r12350)
 - Fix: NTP skipped junction just after bridge end (r12348)
 - Fix: Remove duplicated and inconsistent code wrt. autoreplace with rules in both vehicles' group and ALL_GROUP [FS#1748, FS#1825] (r12346)
-- Fix: Don't try to restore backupped timetable when timetabling is disabled [FS#1828]  (r12345)
+- Fix: Don't try to restore backupped timetable when timetabling is disabled [FS#1828] (r12345)
 - Fix: Slow helicopters never got the 'chance' to finish the landing routine (r12343)
 - Fix: GRM buffer for cargos was incorrect size [FS#1827] (r12341)
 - Fix: Recalculate cached train data after clearing reversing flag when entering depot (r12339)
@@ -48,7 +57,7 @@
 - Fix: Include prop 25 data for all train parts, not just those that carry cargo (r12314)
 - Fix: YAPF and NTP did not apply penalty for uphill tracks on steep slopes (r12313)
 - Fix: Restore timetable from backupped orders and add group ID to the backup [FS#1549] (r12296)
-- Fix: Do not draw trees nor lamps between tram tracks  (r12290) [FS#1807]
+- Fix: Do not draw trees nor lamps between tram tracks (r12290) [FS#1807]
 - Fix: [Win32] Do not create save dir on install (r12269)
 - Fix: Autoreplace did not update vehicle index for timetable window [FS#1805] (r12261)
 - Fix: GetProductionAroundTiles() may fail if only the second production slot exists (r12258)
@@ -59,7 +68,7 @@
 - Fix: When loading a savegame fails, do not start creating a new game, just go straight back to the intro screen (r12202)
 - Fix: Force AI to build rail or road instead of bridges if possible, so it doesn't build bridges everywhere (r12200)
 - Fix: "Transparent buildings" now only toggles buildings, so show tick when buildings are transparent [FS#1789] (r12198)
-- Fix: Show correct last year profit when the train had negative income  [FS#1788] (r12197)
+- Fix: Show correct last year profit when the train had negative income [FS#1788] (r12197)
 - Fix: There can be oil rigs at map borders, do not set water class for them [FS#1787] (r12195)
 - Fix: Do not start overtaking if the RV reaches wrong-way one-way-road in the next tiles (r12191)
 - Fix: Assert when trying to play tile sound at NW border of map (placing buyos, leveling land) [FS#1784] (r12186)
--- a/os/mandrake/README.urpmi	Fri Mar 28 11:51:58 2008 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-You require the data files of the original Transport Tycoon Deluxe
-for Windows to play the game. You have to manually copy the following
-files to %{_gamesdatadir}/openttd/data/
-sample.cat
-trg1r.grf
-trgcr.grf
-trghr.grf
-trgir.grf
-trgtr.grf
--- a/os/mandrake/openttd.spec	Fri Mar 28 11:51:58 2008 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,146 +0,0 @@
-#------------------------------------------------------------------------------
-#   openttd.spec
-#       This SPEC file controls the building of custom OpenTTD RPM
-#       packages.
-#------------------------------------------------------------------------------
-
-%define name openttd
-%define version 0.5.0
-%define release 1mdk
-
-#------------------------------------------------------------------------------
-#   Prologue information
-#------------------------------------------------------------------------------
-Name: %{name}
-Version: %{version}
-Release: %{release}
-Summary: An open source clone of the Microprose game "Transport Tycoon Deluxe"
-Group: Games/Strategy
-License: GPL
-
-URL: http://www.openttd.org
-
-Source: %{name}-%{version}.tar.gz
-Packager: Dominik Scherer <dominik@openttd.com>
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
-BuildRequires: libSDL1.2-devel >= 1.2.7
-BuildRequires: libpng3-devel >= 1.2.5
-BuildRequires: zlib1-devel >= 1.2.1
-
-#------------------------------------------------------------------------------
-#   Description
-#------------------------------------------------------------------------------
-%description
-An enhanced open source clone of the Microprose game "Transport Tycoon Deluxe".
-You require the data files of the original Transport Tycoon Deluxe
-for Windows to play the game. You have to MANUALLY copy them to the
-game data directory!
-
-#------------------------------------------------------------------------------
-#   install scripts
-#------------------------------------------------------------------------------
-%prep
-rm -rf $RPM_BUILD_ROOT
-%setup
-
-%build
-make BINARY_DIR=%{_gamesbindir} PREFIX=%{_gamesdatadir} DATA_DIR=openttd INSTALL_DIR=%{_gamesdatadir}/openttd/ USE_HOMEDIR=1 PERSONAL_DIR=.openttd INSTALL=1 RELEASE=%{version}
-
-%install
-mkdir -p $RPM_BUILD_ROOT%{_gamesbindir}
-mkdir -p $RPM_BUILD_ROOT%{_gamesdatadir}/openttd/lang
-mkdir -p $RPM_BUILD_ROOT%{_gamesdatadir}/openttd/data
-mkdir -p $RPM_BUILD_ROOT%{_gamesdatadir}/openttd/scenario
-
-cp ./openttd $RPM_BUILD_ROOT%{_gamesbindir}/
-cp -r ./lang/*.lng $RPM_BUILD_ROOT%{_gamesdatadir}/openttd/lang/
-cp -r ./data/*.grf $RPM_BUILD_ROOT%{_gamesdatadir}/openttd/data/
-cp -r ./scenario/*.scn $RPM_BUILD_ROOT%{_gamesdatadir}/openttd/scenario/
-cp -r ./data/opntitle.dat $RPM_BUILD_ROOT%{_gamesdatadir}/openttd/data/
-
-# icon
-install -m644 media/openttd.32.png -D $RPM_BUILD_ROOT%{_miconsdir}/%{name}.png
-install -m644 media/openttd.64.png -D $RPM_BUILD_ROOT%{_iconsdir}/%{name}.png
-install -m644 media/openttd.128.png -D $RPM_BUILD_ROOT%{_liconsdir}/%{name}.png
-
-# menu entry
-mkdir -p $RPM_BUILD_ROOT/%{_menudir}
-cat << EOF > $RPM_BUILD_ROOT/%{_menudir}/%{name}
-?package(%{name}):command="%{_gamesbindir}/openttd" icon="%{name}.png" \
-  needs="X11" section="Amusement/Strategy" title="OpenTTD" \
-  longtitle="%{Summary}"
-EOF
-
-%clean
-rm -rf $RPM_BUILD_ROOT
-
-%post
-%{update_menus}
-
-%postun
-%{clean_menus}
-
-#------------------------------------------------------------------------------
-#   Files listing.
-#------------------------------------------------------------------------------
-%files
-%defattr(-,root,root,0755)
-%{_gamesbindir}/openttd
-
-%{_gamesdatadir}/openttd/lang/american.lng
-%{_gamesdatadir}/openttd/lang/catalan.lng
-%{_gamesdatadir}/openttd/lang/czech.lng
-%{_gamesdatadir}/openttd/lang/danish.lng
-%{_gamesdatadir}/openttd/lang/dutch.lng
-%{_gamesdatadir}/openttd/lang/english.lng
-%{_gamesdatadir}/openttd/lang/finnish.lng
-%{_gamesdatadir}/openttd/lang/french.lng
-%{_gamesdatadir}/openttd/lang/galician.lng
-%{_gamesdatadir}/openttd/lang/german.lng
-%{_gamesdatadir}/openttd/lang/hungarian.lng
-%{_gamesdatadir}/openttd/lang/icelandic.lng
-%{_gamesdatadir}/openttd/lang/italian.lng
-%{_gamesdatadir}/openttd/lang/norwegian.lng
-%{_gamesdatadir}/openttd/lang/origveh.lng
-%{_gamesdatadir}/openttd/lang/polish.lng
-%{_gamesdatadir}/openttd/lang/portuguese.lng
-%{_gamesdatadir}/openttd/lang/romanian.lng
-%{_gamesdatadir}/openttd/lang/slovak.lng
-%{_gamesdatadir}/openttd/lang/spanish.lng
-%{_gamesdatadir}/openttd/lang/swedish.lng
-
-%{_gamesdatadir}/openttd/data/autorail.grf
-%{_gamesdatadir}/openttd/data/canalsw.grf
-%{_gamesdatadir}/openttd/data/openttd.grf
-%{_gamesdatadir}/openttd/data/opntitle.dat
-%{_gamesdatadir}/openttd/data/signalsw.grf
-%{_gamesdatadir}/openttd/data/trkfoundw.grf
-
-"%{_gamesdatadir}/openttd/scenario/Linkgame Islands 2004.scn"
-"%{_gamesdatadir}/openttd/scenario/Mountain Pass.scn"
-"%{_gamesdatadir}/openttd/scenario/Volcano City.scn"
-
-%{_menudir}/%{name}
-%{_iconsdir}/*.png
-%{_miconsdir}/*.png
-%{_liconsdir}/*.png
-
-%doc changelog.txt readme.txt COPYING os/linux/README.urpmi
-
-#------------------------------------------------------------------------------
-#   Change Log
-#------------------------------------------------------------------------------
-%changelog
-* Sun Jan 23 2005 Dominik Scherer <dominik@openttd.com> 0.3.6-1mdk
-- Upgraded to 0.3.6
-- Structured and commented the spec file a bit (inspired by ScummVM)
-
-* Fri Dec 24 2004 Dominik Scherer <dominik@openttd.com> 0.3.5-1mdk
-- Upgraded to 0.3.5
-- Added a warning message about the additional required files (only displayed when installing via urpmi)
-
-* Wed Sep 15 2004 Dominik Scherer <> 0.3.4-1mdk
-- Upgraded to 0.3.4
-
-* Wed Jul 31 2004 Dominik Scherer <> 0.3.3-1mdk
-- Initial release
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/os/rpm/openttd.spec	Fri Mar 28 19:01:57 2008 +0000
@@ -0,0 +1,75 @@
+#
+# spec file for package openttd (trunk)
+#
+# Copyright (c) 2007 The OpenTTD team.
+# This file and all modifications and additions to the pristine
+# package are under the same license as the package itself
+#
+Name:          openttd
+Version:       svn
+Release:       head
+Group:         Applications/Games
+Source:        %{name}-%{version}-%{release}.tar.gz
+License:       GPL
+URL:           http://www.openttd.org
+Packager:      Denis Burlaka <burlaka@yandex.ru>
+Summary:       OpenTTD is an Open Source clone of Chris Sawyer's Transport Tycoon Deluxe
+Requires:      SDL zlib libpng freetype2 fontconfig
+BuildRequires: gcc SDL-devel zlib-devel libpng-devel fontconfig-devel
+%if %{_vendor}=="suse"
+BuildRequires: freetype2-devel
+%endif
+%if %{_vendor}=="fedora"
+BuildRequires: freetype-devel
+%endif
+%if %{_vendor}=="mandriva"
+BuildRequires: libfreetype6-devel
+%endif
+BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-buildroot
+Prefix:        /usr
+
+%description
+OpenTTD is a clone of the Microprose game "Transport Tycoon Deluxe", a popular game originally written by Chris Sawyer. It attempts to mimic the original game as closely as possible while extending it with new features.
+
+OpenTTD is licensed under the GNU General Public License version 2.0. For more information, see the file 'COPYING' included with every release and source download of the game.
+
+%prep
+%setup
+
+%build
+./configure --prefix-dir=%{prefix} --binary-dir=bin --install-dir="$RPM_BUILD_ROOT"
+make
+
+%install
+make ROOT="$RPM_BUILD_ROOT" install
+
+mkdir -p $RPM_BUILD_ROOT/%{_datadir}/applications
+cat << EOF > $RPM_BUILD_ROOT/%{_datadir}/applications/%{name}.desktop
+[Desktop Entry]
+Categories=Games;
+Encoding=UTF-8
+Exec=/usr/bin/openttd
+Name=OpenTTD
+Icon=openttd.32
+Terminal=false
+Type=Application
+EOF
+
+%clean
+rm -Rf "$RPM_BUILD_ROOT"
+
+%files
+%dir %{_datadir}/games/%{name}
+%dir %{_datadir}/games/%{name}/lang
+%dir %{_datadir}/games/%{name}/data
+%dir %{_datadir}/games/%{name}/gm
+%dir %{_datadir}/games/%{name}/docs
+%dir %{_datadir}/pixmaps
+%defattr(644, root, games, 755)
+%attr(755, root, games) %{_bindir}/%{name}
+%{_datadir}/games/%{name}/lang/*
+%{_datadir}/games/%{name}/data/*
+%{_datadir}/games/%{name}/docs/*
+%{_datadir}/pixmaps/*
+%{_datadir}/applications/%{name}.desktop
+
Binary file os/suse/openttd.spec has changed
--- a/src/aircraft_cmd.cpp	Fri Mar 28 11:51:58 2008 +0000
+++ b/src/aircraft_cmd.cpp	Fri Mar 28 19:01:57 2008 +0000
@@ -2135,7 +2135,6 @@
 static void AircraftEventHandler(Vehicle *v, int loop)
 {
 	v->tick_counter++;
-	v->current_order_time++;
 
 	if (v->vehstatus & VS_CRASHED) {
 		HandleCrashedAircraft(v);
@@ -2172,6 +2171,8 @@
 
 	AgeAircraftCargo(this);
 
+	this->current_order_time++;
+
 	for (uint i = 0; i != 2; i++) {
 		AircraftEventHandler(this, i);
 		if (this->type != VEH_AIRCRAFT) // In case it was deleted
--- a/src/lang/icelandic.txt	Fri Mar 28 11:51:58 2008 +0000
+++ b/src/lang/icelandic.txt	Fri Mar 28 19:01:57 2008 +0000
@@ -1,7 +1,7 @@
 ##name Icelandic
 ##ownname Íslenska
 ##isocode is_IS
-##plural 0
+##plural 9
 ##gender karlkyn kvenkyn hvorugkyn
 
 #
--- a/src/settings.cpp	Fri Mar 28 11:51:58 2008 +0000
+++ b/src/settings.cpp	Fri Mar 28 19:01:57 2008 +0000
@@ -1750,6 +1750,36 @@
 	}
 }
 
+/**
+ * Save the version of OpenTTD to the ini file.
+ * @param ini the ini to write to
+ */
+static void SaveVersionInConfig(IniFile *ini)
+{
+	extern const char _openttd_revision[];
+	extern uint32 _openttd_newgrf_version;
+
+	IniGroup *group = ini_getgroup(ini, "version", -1);
+
+	if (group == NULL) return;
+	group->item = NULL;
+	IniItem **item = &group->item;
+
+	char version[9];
+	snprintf(version, lengthof(version), "%08X", _openttd_newgrf_version);
+
+	const char *versions[][2] = {
+		{ "version_string", _openttd_revision },
+		{ "version_number", version }
+	};
+
+	for (uint i = 0; i < lengthof(versions); i++) {
+		*item = ini_item_alloc(group, versions[i][0], strlen(versions[i][0]));
+		(*item)->value = (char*)pool_strdup(&ini->pool, versions[i][1], strlen(versions[i][1]));
+		item = &(*item)->next;
+	}
+}
+
 /* Save a GRF configuration to the given group name */
 static void GRFSaveConfig(IniFile *ini, const char *grpname, const GRFConfig *list)
 {
@@ -1814,6 +1844,7 @@
 	GRFSaveConfig(ini, "newgrf", _grfconfig_newgame);
 	GRFSaveConfig(ini, "newgrf-static", _grfconfig_static);
 	NewsDisplaySaveConfig(ini, "news_display", _news_display_opt);
+	SaveVersionInConfig(ini);
 	ini_save(_config_file, ini);
 	ini_free(ini);
 }
--- a/src/spriteloader/png.cpp	Fri Mar 28 11:51:58 2008 +0000
+++ b/src/spriteloader/png.cpp	Fri Mar 28 19:01:57 2008 +0000
@@ -9,7 +9,6 @@
 #include "../fileio.h"
 #include "../debug.h"
 #include "../core/alloc_func.hpp"
-#include "../core/endian_func.hpp"
 #include "png.hpp"
 #include <png.h>
 
@@ -126,18 +125,8 @@
 			color_type = PNG_COLOR_TYPE_RGB;
 		}
 
-#ifdef TTD_LITTLE_ENDIAN
-		png_set_bgr(png_ptr);
-#else
-		if (color_type == PNG_COLOR_TYPE_RGB_ALPHA) png_set_swap_alpha(png_ptr);
-#endif
-
 		if (color_type == PNG_COLOR_TYPE_RGB) {
-#ifdef TTD_LITTLE_ENDIAN
 			png_set_filler(png_ptr, 0xff, PNG_FILLER_AFTER);
-#else
-			png_set_filler(png_ptr, 0xff, PNG_FILLER_BEFORE);
-#endif
 		}
 
 		pixelsize = sizeof(uint32);
@@ -159,16 +148,16 @@
 		for (uint x = 0; x < info_ptr->width; x++) {
 			if (mask) {
 				if (row_pointer[x * sizeof(uint8)] != 0) {
+					dst[x].r = 0;
+					dst[x].g = 0;
 					dst[x].b = 0;
-					dst[x].g = 0;
-					dst[x].r = 0;
 					/* Alpha channel is used from the original image (to allow transparency in remap colors) */
 					dst[x].m = row_pointer[x * sizeof(uint8)];
 				}
 			} else {
-				dst[x].b = row_pointer[x * sizeof(uint32) + 0];
+				dst[x].r = row_pointer[x * sizeof(uint32) + 0];
 				dst[x].g = row_pointer[x * sizeof(uint32) + 1];
-				dst[x].r = row_pointer[x * sizeof(uint32) + 2];
+				dst[x].b = row_pointer[x * sizeof(uint32) + 2];
 				dst[x].a = row_pointer[x * sizeof(uint32) + 3];
 				dst[x].m = 0;
 			}
--- a/src/strgen/strgen.cpp	Fri Mar 28 11:51:58 2008 +0000
+++ b/src/strgen/strgen.cpp	Fri Mar 28 19:01:57 2008 +0000
@@ -103,7 +103,7 @@
 static int _numcases;
 
 // for each plural value, this is the number of plural forms.
-static const byte _plural_form_counts[] = { 2, 1, 2, 3, 3, 3, 3, 3, 4 };
+static const byte _plural_form_counts[] = { 2, 1, 2, 3, 3, 3, 3, 3, 4, 2 };
 
 static const char *_cur_ident;
 
--- a/src/strings.cpp	Fri Mar 28 11:51:58 2008 +0000
+++ b/src/strings.cpp	Fri Mar 28 19:01:57 2008 +0000
@@ -462,6 +462,12 @@
 	 *   Slovenian */
 	case 8:
 		return n % 100 == 1 ? 0 : n % 100 == 2 ? 1 : n % 100 == 3 || n % 100 == 4 ? 2 : 3;
+
+	/* Two forms; singular used for everything ending in 1 but not in 11.
+	 * Used in:
+	 *   Icelandic */
+	case 9:
+		return n % 10 == 1 && n % 100 != 11 ? 0 : 1;
 	}
 }
 
--- a/src/viewport.cpp	Fri Mar 28 11:51:58 2008 +0000
+++ b/src/viewport.cpp	Fri Mar 28 19:01:57 2008 +0000
@@ -941,10 +941,8 @@
 static void DrawTileSelection(const TileInfo *ti)
 {
 	/* Draw a red error square? */
-	if (_thd.redsq != 0 && _thd.redsq == ti->tile) {
-		DrawTileSelectionRect(ti, PALETTE_TILE_RED_PULSATING);
-		return;
-	}
+	bool is_redsq = _thd.redsq != 0 && _thd.redsq == ti->tile;
+	if (is_redsq) DrawTileSelectionRect(ti, PALETTE_TILE_RED_PULSATING);
 
 	/* no selection active? */
 	if (_thd.drawstyle == 0) return;
@@ -953,7 +951,7 @@
 	if (IsInsideBS(ti->x, _thd.pos.x, _thd.size.x) &&
 			IsInsideBS(ti->y, _thd.pos.y, _thd.size.y)) {
 		if (_thd.drawstyle & HT_RECT) {
-			DrawTileSelectionRect(ti, _thd.make_square_red ? PALETTE_SEL_TILE_RED : PAL_NONE);
+			if (!is_redsq) DrawTileSelectionRect(ti, _thd.make_square_red ? PALETTE_SEL_TILE_RED : PAL_NONE);
 		} else if (_thd.drawstyle & HT_POINT) {
 			/* Figure out the Z coordinate for the single dot. */
 			byte z = 0;
@@ -994,7 +992,7 @@
 	}
 
 	/* Check if it's inside the outer area? */
-	if (_thd.outersize.x &&
+	if (!is_redsq && _thd.outersize.x &&
 			_thd.size.x < _thd.size.x + _thd.outersize.x &&
 			IsInsideBS(ti->x, _thd.pos.x + _thd.offs.x, _thd.size.x + _thd.outersize.x) &&
 			IsInsideBS(ti->y, _thd.pos.y + _thd.offs.y, _thd.size.y + _thd.outersize.y)) {