diff --git a/.gitignore b/.gitignore
index 2b298a14a9..5aa8cb7849 100644
--- a/.gitignore
+++ b/.gitignore
@@ -34,6 +34,8 @@ projects/*.sdf
projects/*.opensdf
projects/*.vcproj.*.user
projects/*.vcxproj.user
+projects/*.VC.db
+projects/*.VC.opendb
src/rev.cpp
src/os/windows/ottdres.rc
diff --git a/bin/ai/compat_1.7.nut b/bin/ai/compat_1.7.nut
index fe985b90d0..1290443c4d 100644
--- a/bin/ai/compat_1.7.nut
+++ b/bin/ai/compat_1.7.nut
@@ -6,3 +6,5 @@
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see .
*/
+
+GSLog.Info("1.7 API compatibility in effect.");
diff --git a/bin/ai/compat_1.8.nut b/bin/ai/compat_1.8.nut
new file mode 100644
index 0000000000..fe985b90d0
--- /dev/null
+++ b/bin/ai/compat_1.8.nut
@@ -0,0 +1,8 @@
+/* $Id$ */
+
+/*
+ * This file is part of OpenTTD.
+ * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
+ * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see .
+ */
diff --git a/bin/ai/regression/regression_info.nut b/bin/ai/regression/regression_info.nut
index 87676e1625..f908ae28ac 100644
--- a/bin/ai/regression/regression_info.nut
+++ b/bin/ai/regression/regression_info.nut
@@ -6,7 +6,7 @@ class Regression extends AIInfo {
function GetShortName() { return "REGR"; }
function GetDescription() { return "This runs regression-tests on some commands. On the same map the result should always be the same."; }
function GetVersion() { return 1; }
- function GetAPIVersion() { return "1.7"; }
+ function GetAPIVersion() { return "1.8"; }
function GetDate() { return "2007-03-18"; }
function CreateInstance() { return "Regression"; }
}
diff --git a/bin/baseset/no_music.obm b/bin/baseset/no_music.obm
index 40c3f76060..7a70e3b55d 100644
--- a/bin/baseset/no_music.obm
+++ b/bin/baseset/no_music.obm
@@ -23,6 +23,7 @@ description.en_US = A music pack without actual music.
description.es_ES = Un conjunto de música vacío.
description.es_MX = Paquete de música vacío
description.et_EE = Muusikakogu ilma muusikata.
+description.eu_ES = Musika gabeko musika paketea.
description.fi_FI = Musiikkipaketti, jossa ei ole musiikkia.
description.fr_FR = Un pack de musiques sans musiques.
description.ga_IE = Pacáiste ceoil gan aon cheol iarbhír ann.
@@ -40,6 +41,7 @@ description.la_VA = Sarcina musicae sine ulla musica.
description.lb_LU = E Musikpack ouni aktuell Musik.
description.lt_LT = Muzikos pakas be muzikos.
description.lv_LV = Mūzikas kopa bez mūzikas
+description.ms_MY = Pek muzik tanpa muzik sebenar.
description.nb_NO = En musikkpakke uten noe musikk.
description.nl_NL = Een muziekset zonder muziek.
description.nn_NO = Ei musikkpakke utan noko musikk.
diff --git a/bin/baseset/orig_dos.obg b/bin/baseset/orig_dos.obg
index ad3b35c49f..7222400af0 100644
--- a/bin/baseset/orig_dos.obg
+++ b/bin/baseset/orig_dos.obg
@@ -24,6 +24,7 @@ description.en_US = Original Transport Tycoon Deluxe DOS edition graphics.
description.es_ES = Gráficos originales de Transport Tycoon Deluxe versión DOS.
description.es_MX = Gráficos originales de Transport Tycoon Deluxe para DOS.
description.et_EE = Algse Transport Tycoon Deluxe DOSi versiooni graafika.
+description.eu_ES = Transport Tycoon Deluxe originaleko DOS edizioko grafikoak.
description.fi_FI = Alkuperäiset Transport Tycoon Deluxen DOS-version grafiikat.
description.fr_FR = Graphiques originaux de Transport Tycoon Deluxe (version DOS).
description.ga_IE = Grafaicí bunaidhTransport Tycoon Deluxe, eagrán DOS.
diff --git a/bin/baseset/orig_dos.obs b/bin/baseset/orig_dos.obs
index 71fa44baf6..ce2d6d22e6 100644
--- a/bin/baseset/orig_dos.obs
+++ b/bin/baseset/orig_dos.obs
@@ -23,6 +23,7 @@ description.en_US = Original Transport Tycoon Deluxe DOS edition sounds.
description.es_ES = Sonidos originales de Transport Tycoon Deluxe versión DOS.
description.es_MX = Sonidos originales de Transport Tycoon Deluxe para DOS.
description.et_EE = Algse Transport Tycoon Deluxe DOSi versiooni helid.
+description.eu_ES = Transport Tycoon Deluxe originaleko DOS edizioko soinuak.
description.fi_FI = Alkuperäiset Transport Tycoon Deluxen DOS-version äänet.
description.fr_FR = Sons originaux de Transport Tycoon Deluxe (version DOS).
description.ga_IE = Fuaimeanna bunaidh Transport Tycoon Deluxe, eagrán DOS.
diff --git a/bin/baseset/orig_win.obm b/bin/baseset/orig_win.obm
index 0682031547..8e2053e043 100644
--- a/bin/baseset/orig_win.obm
+++ b/bin/baseset/orig_win.obm
@@ -40,6 +40,7 @@ description.la_VA = Musica ex editione originale Transport Tycoon Deluxe Windows
description.lb_LU = Original Transport Tycoon Deluxe Windows Editioun Musik.
description.lt_LT = Originali Transport Tycoon Deluxe Windows leidimo muzika.
description.lv_LV = Oriģinālā Transport Tycoon Deluxe Windows izdevuma mūzika.
+description.ms_MY = Muzik asal Transport Tycoon Deluxe edisi Windows.
description.nb_NO = Original musikk fra Transport Tycoon Deluxe for Windows.
description.nl_NL = Originele muziek van de Transport Tycoon Deluxe Windows-versie.
description.nn_NO = Original musikk frå Transport Tycoon Deluxe for Windows.
diff --git a/bin/baseset/orig_win.obs b/bin/baseset/orig_win.obs
index fa2178fd40..c3e5fb7693 100644
--- a/bin/baseset/orig_win.obs
+++ b/bin/baseset/orig_win.obs
@@ -23,6 +23,7 @@ description.en_US = Original Transport Tycoon Deluxe Windows edition sounds.
description.es_ES = Sonidos originales de Transport Tycoon Deluxe versión Windows.
description.es_MX = Sonidos originales de Transport Tycoon Deluxe para Windows.
description.et_EE = Algse Transport Tycoon Deluxe Windowsi versiooni helid.
+description.eu_ES = Transport Tycoon Deluxe originaleko Windows edizioko grafikoak.
description.fi_FI = Alkuperäiset Transport Tycoon Deluxen Windows-version äänet.
description.fr_FR = Sons originaux de Transport Tycoon Deluxe (version Windows).
description.ga_IE = Fuaimeanna bunaidh Transport Tycoon Deluxe, eagrán Windows.
diff --git a/bin/game/compat_1.7.nut b/bin/game/compat_1.7.nut
index fe985b90d0..1290443c4d 100644
--- a/bin/game/compat_1.7.nut
+++ b/bin/game/compat_1.7.nut
@@ -6,3 +6,5 @@
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see .
*/
+
+GSLog.Info("1.7 API compatibility in effect.");
diff --git a/bin/game/compat_1.8.nut b/bin/game/compat_1.8.nut
new file mode 100644
index 0000000000..fe985b90d0
--- /dev/null
+++ b/bin/game/compat_1.8.nut
@@ -0,0 +1,8 @@
+/* $Id$ */
+
+/*
+ * This file is part of OpenTTD.
+ * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
+ * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see .
+ */
diff --git a/changelog.txt b/changelog.txt
index c110109386..89b3babf84 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,3 +1,68 @@
+1.6.1 (2016-07-01)
+------------------------------------------------------------------------
+- Fix: Compilation and optimisation issues with GCC6 (r27606, r27605, r27595)
+- Fix: Compilation with --disable-network [FS#6481] (r27602)
+- Fix: [NewGRF] shift-and-add-divide/modulo varadjusts use signed division/modulo (r27600)
+- Fix: Company 0 could accept engine previews before they were offered (r27598)
+
+
+1.6.1-RC1 (2016-06-01)
+------------------------------------------------------------------------
+- Feature: Mexican Spanish (r27564, r27553, r27552)
+- Change: Performance improvement for dedicated servers by skipping drawing calls earlier in the process [FS#6402] (r27579)
+- Fix: Automatic servicing of road vehicles compared path finder costs with tile distances, thus vehicles went to depots which were factor 100 too far away [FS#6410] (r27586)
+- Fix: Enforce a non-zero load amount for all vehicles, so that vehicles can process their cargo reservations [FS#6437] (r27585, r27584)
+- Fix: Do not decrease the column width of depot windows when vehicles with high unitnumbers leave [FS#6415] (r27583)
+- Fix: Button size computation in script configuration window [FS#6461] (r27581)
+- Fix: [NewGRF] Set date of last service on construction also for wagons and articulated parts [FS#6395] (r27580)
+- Fix: Vehicles could not be hidden from the purchase list when they were in exclusive preview [FS#6454] (r27578)
+- Fix: Dock and roadstop picker, client list and town authority window did not auto-resize according to their content when they were positioned at the bottom of the screen [FS#6386] (r27577)
+- Fix: Various incorrect but uncritical size computations in the content client [FS#6449] (r27576, r27570)
+- Fix: Memory leak when disabling palette animation [FS#6404] (r27575)
+- Fix: [NewGRF] The house id as returned by house variable 66 was incorrect when querying neighboured tiles [FS#6432] (r27574)
+- Fix: [Build] Compilation failure with gcc 6.1 due to headers included after safeguards.h [FS#6467] (r27573)
+- Fix: Convenience savegame bump to distinguish 1.6 savegames from 1.5 savegames [FS#6442] (r27572)
+- Fix: [Build] Force sorting to be locale independent, so files are always ordered the same and by that token better diff-able (r27562, r27558)
+- Fix: Typos in comments and string (r27561, r27560)
+- Fix: [Build] bashism that caused different CFLAGS with bash vs dash (r27557)
+- Fix: Use a more appropiate sound effect for convert-rail (r27547)
+- Fix: Remove SetFill from vehicle GUI buttons, so that the viewport is resized instead of them in case of long window titles (r27546)
+- Fix: [Script] Generation of API wrappers (r27545, r27544, r27543)
+- Fix: [Windows] ICU got disabled for Windows builds, breaking RTL support [FS#6427] (r27542)
+- Fix: [NewGRF] Station spritelayouts did not accept the var10 flag for the palette [FS#6435] (r27534)
+
+
+1.6.0 (2016-04-01)
+------------------------------------------------------------------------
+(None)
+
+
+1.6.0-RC1 (2016-03-01)
+------------------------------------------------------------------------
+- Feature: [NewGRF] Allow custom sound IDs in RV property 0x12, ship property 0x10 and aircraft property 0x12 (r27507)
+- Feature: When viewing online content of a particular type, hide content of other types unless they have been (auto)selected for download (r27469, r27468, r27444)
+- Feature: [NewGRF] Move sprite 8 positions in sprite aligner with ctrl+click [FS#6241] (r27451)
+- Feature: Lower the sell-vehicle and sell-chain buttons in the train depot GUI while dragging a vehicle over it [FS#6391] (r27450, r27446)
+- Feature: Make the object placement GUI an independent window (r27438, r27397, r27346)
+- Feature: [Build] Project files and compilation with MSVC2015 (r27385, r27382, r27381, r27380, r27379)
+- Feature: [NewGRF] Allow railtype NewGRF to define separate sprites for the fences on either track side [FS#6315] (r27354, r27343)
+- Feature: [NewGRF] Increase the maximum amount of industry types to 128 per NewGRF and 240 in total (r27279)
+- Feature: Make Ctrl+Remove-Roadstop also remove the road, just like for rail stations [FS#6252] (r27251)
+- Change: [NewGRF] Allow static NewGRF to enable the second rocky tile set (r27497)
+- Change: Round loading percentage in loading indicators and conditional orders towards 50%, so that 0% and 100% mean completely empty or full (r27426)
+- Change: [Build] Rework the configure system to make more use of pkg-config (r27377:r27366, r27361, r27360)
+- Change: Enable YAPF cache debugging with desync debug level 2 (r27332)
+- Change: [strgen] Default plural subparameter position for CARGO_xxx string control codes is subparameter 1 (r27295)
+- Change: [NewGRF] Translate industry variable A6 (r27267)
+- Change: Do not consider cargo that is already being loaded as waiting cargo wrt. the station rating [FS#6165] (r27256)
+- Change: Tune down terrain generation to reduce amount of long slopes (r27230)
+- Change: Generate more detailed curves at the coast (r27229)
+- Change: Slightly more water in the non-custom sea levels (r27228)
+- Change: Be more lenient about road stop removal when at least one stop could be removed [FS#6262] (r27225)
+- Fix: [Win32] Stdin/out/err need to be re-assigned differently if the runtime lib of MSVC2015 is used (r27481)
+- Fix: [Haiku] On Haiku use the appropriate system variable to obtain the include dir [FS#6401] (r27472)
+
+
1.5.3 (2015-12-01)
------------------------------------------------------------------------
(None)
diff --git a/config.lib b/config.lib
index 29741c46c7..8d88eb4145 100644
--- a/config.lib
+++ b/config.lib
@@ -1527,8 +1527,11 @@ make_cflags_and_ldflags() {
cc_build_is_gcc=`basename "$cc_build" | grep "gcc" 2>/dev/null`
if [ -n "$cc_build_is_gcc" ]; then
- # Just add -O1 to the tools needed for building.
+ # Add -O1 and fortify source to the tools needed for building, on gcc
CFLAGS_BUILD="$CFLAGS_BUILD -D_FORTIFY_SOURCE=2 -O1"
+ elif [ -n "`basename "$cc_build" | grep "clang" 2>/dev/null`" ]; then
+ # Add -O1 to the tools needed for building, on clang
+ CFLAGS_BUILD="$CFLAGS_BUILD -O1"
fi
fi
diff --git a/known-bugs.txt b/known-bugs.txt
index 34aca33002..f5ae731018 100644
--- a/known-bugs.txt
+++ b/known-bugs.txt
@@ -1,6 +1,6 @@
OpenTTD's known bugs
-Last updated: 2015-02-24
-Release version: 1.5.0-beta2
+Last updated: 2016-07-01
+Release version: 1.6.1
------------------------------------------------------------------------
diff --git a/os/debian/changelog b/os/debian/changelog
index 4dd5b1155f..c8cf30794b 100644
--- a/os/debian/changelog
+++ b/os/debian/changelog
@@ -1,3 +1,27 @@
+openttd (1.6.1-0) unstable; urgency=low
+
+ * New upstream release 1.6.1
+
+ -- OpenTTD Fri, 01 Jul 2016 00:00:00 +0200
+
+openttd (1.6.1~RC1-0) unstable; urgency=low
+
+ * New upstream release 1.6.1-RC1
+
+ -- OpenTTD Wed, 01 Jun 2016 21:00:00 +0200
+
+openttd (1.6.0-0) unstable; urgency=low
+
+ * New upstream release 1.6.0
+
+ -- OpenTTD Fri, 01 Apr 2016 21:00:00 +0200
+
+openttd (1.6.0~RC1-0) unstable; urgency=low
+
+ * New upstream release 1.6.0-RC1
+
+ -- OpenTTD Tue, 01 Mar 2016 21:00:00 +0100
+
openttd (1.5.3-0) unstable; urgency=low
* New upstream release 1.5.3
diff --git a/os/debian/copyright b/os/debian/copyright
index be573b4825..ab62f66a42 100644
--- a/os/debian/copyright
+++ b/os/debian/copyright
@@ -5,7 +5,7 @@ Source: http://www.openttd.org
Files: *
-Copyright: © 2004-2012 Ludvig Strigeous and others.
+Copyright: © 2004-2017 Ludvig Strigeous and others.
License: GPL-2.0
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2.0 as
diff --git a/os/os2/installer/make_installer.cmd b/os/os2/installer/make_installer.cmd
index de01554a07..5e30e4c354 100644
--- a/os/os2/installer/make_installer.cmd
+++ b/os/os2/installer/make_installer.cmd
@@ -1,6 +1,6 @@
@echo off
-set OPENTTD_VERSION=1.7.0
+set OPENTTD_VERSION=1.8.0
set OPENSFX_VERSION=0.8.0
set NOSOUND_VERSION=0.8.0
set OPENGFX_VERSION=1.2.0
diff --git a/os/rpm/openttd.spec b/os/rpm/openttd.spec
index 711693bcf7..9685624462 100644
--- a/os/rpm/openttd.spec
+++ b/os/rpm/openttd.spec
@@ -2,7 +2,7 @@
# spec file for package openttd
#
# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany.
-# Copyright (c) 2007-2012 The OpenTTD developers
+# Copyright (c) 2007-2017 The OpenTTD developers
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,9 +17,9 @@
#
Name: openttd
-Version: 1.7.beta1
+Version: 1.8.beta1
Release: 0
-%define srcver 1.7.0-beta1
+%define srcver 1.8.0-beta1
Summary: An open source reimplementation of Chris Sawyer's Transport Tycoon Deluxe
License: GPL-2.0
Group: Amusements/Games/Strategy/Other
diff --git a/os/windows/installer/install.nsi b/os/windows/installer/install.nsi
index c7b8c82af4..76a87b37dd 100644
--- a/os/windows/installer/install.nsi
+++ b/os/windows/installer/install.nsi
@@ -1,6 +1,6 @@
# Version numbers to update
!define APPV_MAJOR 1
-!define APPV_MINOR 7
+!define APPV_MINOR 8
!define APPV_MAINT 0
!define APPV_BUILD 0
!define APPV_EXTRA "-beta1"
diff --git a/projects/dpi_aware.manifest b/projects/dpi_aware.manifest
new file mode 100644
index 0000000000..6f04161596
--- /dev/null
+++ b/projects/dpi_aware.manifest
@@ -0,0 +1,7 @@
+
+
+
+ True/PM
+
+
+
diff --git a/projects/openttd_vs100.vcxproj b/projects/openttd_vs100.vcxproj
index dfed0d0d8e..49f99b487e 100644
--- a/projects/openttd_vs100.vcxproj
+++ b/projects/openttd_vs100.vcxproj
@@ -145,6 +145,9 @@
MachineX86
true
+
+ dpi_aware.manifest
+
@@ -188,6 +191,9 @@
MachineX86
+
+ dpi_aware.manifest
+
@@ -244,6 +250,9 @@
MachineX64
true
+
+ dpi_aware.manifest
+
@@ -289,6 +298,9 @@
1048576
MachineX64
+
+ dpi_aware.manifest
+
diff --git a/projects/openttd_vs100.vcxproj.in b/projects/openttd_vs100.vcxproj.in
index c6b16455a9..c8e71c4234 100644
--- a/projects/openttd_vs100.vcxproj.in
+++ b/projects/openttd_vs100.vcxproj.in
@@ -145,6 +145,9 @@
MachineX86
true
+
+ dpi_aware.manifest
+
@@ -188,6 +191,9 @@
MachineX86
+
+ dpi_aware.manifest
+
@@ -244,6 +250,9 @@
MachineX64
true
+
+ dpi_aware.manifest
+
@@ -289,6 +298,9 @@
1048576
MachineX64
+
+ dpi_aware.manifest
+
!!FILES!!
diff --git a/projects/openttd_vs140.vcxproj b/projects/openttd_vs140.vcxproj
index ae7f7ada7d..696bc311bb 100644
--- a/projects/openttd_vs140.vcxproj
+++ b/projects/openttd_vs140.vcxproj
@@ -151,6 +151,9 @@
true
5.01
+
+ PerMonitorHighDPIAware
+
@@ -198,6 +201,9 @@
MachineX86
5.01
+
+ PerMonitorHighDPIAware
+
@@ -257,6 +263,9 @@
true
5.02
+
+ PerMonitorHighDPIAware
+
@@ -306,6 +315,9 @@
MachineX64
5.02
+
+ PerMonitorHighDPIAware
+
diff --git a/projects/openttd_vs140.vcxproj.in b/projects/openttd_vs140.vcxproj.in
index 76b16b5109..9d873283fa 100644
--- a/projects/openttd_vs140.vcxproj.in
+++ b/projects/openttd_vs140.vcxproj.in
@@ -151,6 +151,9 @@
true
5.01
+
+ PerMonitorHighDPIAware
+
@@ -198,6 +201,9 @@
MachineX86
5.01
+
+ PerMonitorHighDPIAware
+
@@ -257,6 +263,9 @@
true
5.02
+
+ PerMonitorHighDPIAware
+
@@ -306,6 +315,9 @@
MachineX64
5.02
+
+ PerMonitorHighDPIAware
+
!!FILES!!
diff --git a/readme.txt b/readme.txt
index 817f397b51..e378bd5d22 100644
--- a/readme.txt
+++ b/readme.txt
@@ -1,5 +1,5 @@
-Last updated: 2015-02-24
-Release version: 1.5.0-beta2
+Last updated: 2016-07-01
+Release version: 1.6.1
------------------------------------------------------------------------
diff --git a/source.list b/source.list
index de4dfa8c1a..60dd888aef 100644
--- a/source.list
+++ b/source.list
@@ -424,6 +424,7 @@ core/alloc_type.hpp
core/backup_type.hpp
core/bitmath_func.cpp
core/bitmath_func.hpp
+core/container_func.hpp
core/endian_func.hpp
core/endian_type.hpp
core/enum_type.hpp
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp
index a0720e2ea5..101a97d0a9 100644
--- a/src/ai/ai_gui.cpp
+++ b/src/ai/ai_gui.cpp
@@ -306,7 +306,6 @@ struct AISettingsWindow : public Window {
timeout(0)
{
this->ai_config = GetConfig(slot);
- this->RebuildVisibleSettings();
this->CreateNestedTree();
this->vscroll = this->GetScrollbar(WID_AIS_SCROLLBAR);
@@ -314,7 +313,7 @@ struct AISettingsWindow : public Window {
this->SetWidgetDisabledState(WID_AIS_RESET, _game_mode != GM_MENU && Company::IsValidID(this->slot));
- this->vscroll->SetCount((int)this->visible_settings.size());
+ this->RebuildVisibleSettings();
}
virtual void SetStringParameters(int widget) const
@@ -342,6 +341,8 @@ struct AISettingsWindow : public Window {
visible_settings.push_back(&(*it));
}
}
+
+ this->vscroll->SetCount((int)this->visible_settings.size());
}
virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
@@ -531,21 +532,23 @@ struct AISettingsWindow : public Window {
virtual void OnQueryTextFinished(char *str)
{
if (StrEmpty(str)) return;
- ScriptConfigItemList::const_iterator it = this->ai_config->GetConfigList()->begin();
+ VisibleSettingsList::const_iterator it = this->visible_settings.begin();
for (int i = 0; i < this->clicked_row; i++) it++;
- if (_game_mode == GM_NORMAL && ((this->slot == OWNER_DEITY) || Company::IsValidID(this->slot)) && (it->flags & SCRIPTCONFIG_INGAME) == 0) return;
+ const ScriptConfigItem config_item = **it;
+ if (_game_mode == GM_NORMAL && ((this->slot == OWNER_DEITY) || Company::IsValidID(this->slot)) && (config_item.flags & SCRIPTCONFIG_INGAME) == 0) return;
int32 value = atoi(str);
- this->ai_config->SetSetting((*it).name, value);
+ this->ai_config->SetSetting(config_item.name, value);
this->SetDirty();
}
virtual void OnDropdownSelect(int widget, int index)
{
assert(this->clicked_dropdown);
- ScriptConfigItemList::const_iterator it = this->ai_config->GetConfigList()->begin();
+ VisibleSettingsList::const_iterator it = this->visible_settings.begin();
for (int i = 0; i < this->clicked_row; i++) it++;
- if (_game_mode == GM_NORMAL && ((this->slot == OWNER_DEITY) || Company::IsValidID(this->slot)) && (it->flags & SCRIPTCONFIG_INGAME) == 0) return;
- this->ai_config->SetSetting((*it).name, index);
+ const ScriptConfigItem config_item = **it;
+ if (_game_mode == GM_NORMAL && ((this->slot == OWNER_DEITY) || Company::IsValidID(this->slot)) && (config_item.flags & SCRIPTCONFIG_INGAME) == 0) return;
+ this->ai_config->SetSetting(config_item.name, index);
this->SetDirty();
}
diff --git a/src/ai/ai_info.cpp b/src/ai/ai_info.cpp
index e862b62466..2afd5d4199 100644
--- a/src/ai/ai_info.cpp
+++ b/src/ai/ai_info.cpp
@@ -28,7 +28,8 @@ static bool CheckAPIVersion(const char *api_version)
{
return strcmp(api_version, "0.7") == 0 || strcmp(api_version, "1.0") == 0 || strcmp(api_version, "1.1") == 0 ||
strcmp(api_version, "1.2") == 0 || strcmp(api_version, "1.3") == 0 || strcmp(api_version, "1.4") == 0 ||
- strcmp(api_version, "1.5") == 0 || strcmp(api_version, "1.6") == 0 || strcmp(api_version, "1.7") == 0;
+ strcmp(api_version, "1.5") == 0 || strcmp(api_version, "1.6") == 0 || strcmp(api_version, "1.7") == 0 ||
+ strcmp(api_version, "1.8") == 0;
}
#if defined(WIN32)
diff --git a/src/blitter/32bpp_anim.cpp b/src/blitter/32bpp_anim.cpp
index deedaf34b5..532ad23cc7 100644
--- a/src/blitter/32bpp_anim.cpp
+++ b/src/blitter/32bpp_anim.cpp
@@ -39,13 +39,14 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
}
Colour *dst = (Colour *)bp->dst + bp->top * bp->pitch + bp->left;
- uint16 *anim = this->anim_buf + ((uint32 *)bp->dst - (uint32 *)_screen.dst_ptr) + bp->top * this->anim_buf_width + bp->left;
+ assert(_screen.pitch == this->anim_buf_pitch); // precondition for translating 'bp->dst' into an 'anim_buf' offset below.
+ uint16 *anim = this->anim_buf + ((uint32 *)bp->dst - (uint32 *)_screen.dst_ptr) + bp->top * this->anim_buf_pitch + bp->left;
const byte *remap = bp->remap; // store so we don't have to access it via bp everytime
for (int y = 0; y < bp->height; y++) {
Colour *dst_ln = dst + bp->pitch;
- uint16 *anim_ln = anim + this->anim_buf_width;
+ uint16 *anim_ln = anim + this->anim_buf_pitch;
const Colour *src_px_ln = (const Colour *)((const byte *)src_px + *(const uint32 *)src_px);
src_px++;
@@ -279,9 +280,8 @@ void Blitter_32bppAnim::DrawColourMappingRect(void *dst, int width, int height,
}
Colour *udst = (Colour *)dst;
- uint16 *anim;
-
- anim = this->anim_buf + ((uint32 *)dst - (uint32 *)_screen.dst_ptr);
+ assert(_screen.pitch == this->anim_buf_pitch); // precondition for translating 'dst' into an 'anim_buf' offset below.
+ uint16 *anim = this->anim_buf + ((uint32 *)dst - (uint32 *)_screen.dst_ptr);
if (pal == PALETTE_TO_TRANSPARENT) {
do {
@@ -292,7 +292,7 @@ void Blitter_32bppAnim::DrawColourMappingRect(void *dst, int width, int height,
anim++;
}
udst = udst - width + _screen.pitch;
- anim = anim - width + this->anim_buf_width;
+ anim = anim - width + this->anim_buf_pitch;
} while (--height);
return;
}
@@ -305,7 +305,7 @@ void Blitter_32bppAnim::DrawColourMappingRect(void *dst, int width, int height,
anim++;
}
udst = udst - width + _screen.pitch;
- anim = anim - width + this->anim_buf_width;
+ anim = anim - width + this->anim_buf_pitch;
} while (--height);
return;
}
@@ -319,7 +319,8 @@ void Blitter_32bppAnim::SetPixel(void *video, int x, int y, uint8 colour)
/* Set the colour in the anim-buffer too, if we are rendering to the screen */
if (_screen_disable_anim) return;
- this->anim_buf[((uint32 *)video - (uint32 *)_screen.dst_ptr) + x + y * this->anim_buf_width] = colour | (DEFAULT_BRIGHTNESS << 8);
+ assert(_screen.pitch == this->anim_buf_pitch); // precondition for translating 'video' into an 'anim_buf' offset below.
+ this->anim_buf[((uint32 *)video - (uint32 *)_screen.dst_ptr) + x + y * this->anim_buf_pitch] = colour | (DEFAULT_BRIGHTNESS << 8);
}
void Blitter_32bppAnim::DrawRect(void *video, int width, int height, uint8 colour)
@@ -331,9 +332,8 @@ void Blitter_32bppAnim::DrawRect(void *video, int width, int height, uint8 colou
}
Colour colour32 = LookupColourInPalette(colour);
- uint16 *anim_line;
-
- anim_line = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + this->anim_buf;
+ assert(_screen.pitch == this->anim_buf_pitch); // precondition for translating 'video' into an 'anim_buf' offset below.
+ uint16 *anim_line = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + this->anim_buf;
do {
Colour *dst = (Colour *)video;
@@ -347,7 +347,7 @@ void Blitter_32bppAnim::DrawRect(void *video, int width, int height, uint8 colou
anim++;
}
video = (uint32 *)video + _screen.pitch;
- anim_line += this->anim_buf_width;
+ anim_line += this->anim_buf_pitch;
} while (--height);
}
@@ -357,6 +357,7 @@ void Blitter_32bppAnim::CopyFromBuffer(void *video, const void *src, int width,
assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch);
Colour *dst = (Colour *)video;
const uint32 *usrc = (const uint32 *)src;
+ assert(_screen.pitch == this->anim_buf_pitch); // precondition for translating 'video' into an 'anim_buf' offset below.
uint16 *anim_line = ((uint32 *)video - (uint32 *)_screen.dst_ptr) + this->anim_buf;
for (; height > 0; height--) {
@@ -370,7 +371,7 @@ void Blitter_32bppAnim::CopyFromBuffer(void *video, const void *src, int width,
/* Copy back the anim-buffer */
memcpy(anim_line, usrc, width * sizeof(uint16));
usrc = (const uint32 *)((const uint16 *)usrc + width);
- anim_line += this->anim_buf_width;
+ anim_line += this->anim_buf_pitch;
/* Okay, it is *very* likely that the image we stored is using
* the wrong palette animated colours. There are two things we
@@ -397,11 +398,11 @@ void Blitter_32bppAnim::CopyToBuffer(const void *video, void *dst, int width, in
assert(video >= _screen.dst_ptr && video <= (uint32 *)_screen.dst_ptr + _screen.width + _screen.height * _screen.pitch);
uint32 *udst = (uint32 *)dst;
const uint32 *src = (const uint32 *)video;
- const uint16 *anim_line;
if (this->anim_buf == NULL) return;
- anim_line = ((const uint32 *)video - (uint32 *)_screen.dst_ptr) + this->anim_buf;
+ assert(_screen.pitch == this->anim_buf_pitch); // precondition for translating 'video' into an 'anim_buf' offset below.
+ const uint16 *anim_line = ((const uint32 *)video - (uint32 *)_screen.dst_ptr) + this->anim_buf;
for (; height > 0; height--) {
memcpy(udst, src, width * sizeof(uint32));
@@ -410,7 +411,7 @@ void Blitter_32bppAnim::CopyToBuffer(const void *video, void *dst, int width, in
/* Copy the anim-buffer */
memcpy(udst, anim_line, width * sizeof(uint16));
udst = (uint32 *)((uint16 *)udst + width);
- anim_line += this->anim_buf_width;
+ anim_line += this->anim_buf_pitch;
}
}
@@ -422,8 +423,8 @@ void Blitter_32bppAnim::ScrollBuffer(void *video, int &left, int &top, int &widt
/* We need to scroll the anim-buffer too */
if (scroll_y > 0) {
- dst = this->anim_buf + left + (top + height - 1) * this->anim_buf_width;
- src = dst - scroll_y * this->anim_buf_width;
+ dst = this->anim_buf + left + (top + height - 1) * this->anim_buf_pitch;
+ src = dst - scroll_y * this->anim_buf_pitch;
/* Adjust left & width */
if (scroll_x >= 0) {
@@ -436,13 +437,13 @@ void Blitter_32bppAnim::ScrollBuffer(void *video, int &left, int &top, int &widt
uint th = height - scroll_y;
for (; th > 0; th--) {
memcpy(dst, src, tw * sizeof(uint16));
- src -= this->anim_buf_width;
- dst -= this->anim_buf_width;
+ src -= this->anim_buf_pitch;
+ dst -= this->anim_buf_pitch;
}
} else {
/* Calculate pointers */
- dst = this->anim_buf + left + top * this->anim_buf_width;
- src = dst - scroll_y * this->anim_buf_width;
+ dst = this->anim_buf + left + top * this->anim_buf_pitch;
+ src = dst - scroll_y * this->anim_buf_pitch;
/* Adjust left & width */
if (scroll_x >= 0) {
@@ -457,8 +458,8 @@ void Blitter_32bppAnim::ScrollBuffer(void *video, int &left, int &top, int &widt
uint th = height + scroll_y;
for (; th > 0; th--) {
memmove(dst, src, tw * sizeof(uint16));
- src += this->anim_buf_width;
- dst += this->anim_buf_width;
+ src += this->anim_buf_pitch;
+ dst += this->anim_buf_pitch;
}
}
@@ -495,6 +496,7 @@ void Blitter_32bppAnim::PaletteAnimate(const Palette &palette)
anim++;
}
dst += _screen.pitch - this->anim_buf_width;
+ anim += this->anim_buf_pitch - this->anim_buf_width;
}
/* Make sure the backend redraws the whole screen */
@@ -508,11 +510,13 @@ Blitter::PaletteAnimation Blitter_32bppAnim::UsePaletteAnimation()
void Blitter_32bppAnim::PostResize()
{
- if (_screen.width != this->anim_buf_width || _screen.height != this->anim_buf_height) {
+ if (_screen.width != this->anim_buf_width || _screen.height != this->anim_buf_height ||
+ _screen.pitch != this->anim_buf_pitch) {
/* The size of the screen changed; we can assume we can wipe all data from our buffer */
free(this->anim_buf);
- this->anim_buf = CallocT(_screen.width * _screen.height);
this->anim_buf_width = _screen.width;
this->anim_buf_height = _screen.height;
+ this->anim_buf_pitch = _screen.pitch;
+ this->anim_buf = CallocT(this->anim_buf_height * this->anim_buf_pitch);
}
}
diff --git a/src/blitter/32bpp_anim.hpp b/src/blitter/32bpp_anim.hpp
index a0a022e49f..1b35c17663 100644
--- a/src/blitter/32bpp_anim.hpp
+++ b/src/blitter/32bpp_anim.hpp
@@ -20,14 +20,18 @@ protected:
uint16 *anim_buf; ///< In this buffer we keep track of the 8bpp indexes so we can do palette animation
int anim_buf_width; ///< The width of the animation buffer.
int anim_buf_height; ///< The height of the animation buffer.
+ int anim_buf_pitch; ///< The pitch of the animation buffer.
Palette palette; ///< The current palette.
public:
Blitter_32bppAnim() :
anim_buf(NULL),
anim_buf_width(0),
- anim_buf_height(0)
- {}
+ anim_buf_height(0),
+ anim_buf_pitch(0)
+ {
+ this->palette = _cur_palette;
+ }
~Blitter_32bppAnim();
diff --git a/src/blitter/32bpp_anim_sse4.cpp b/src/blitter/32bpp_anim_sse4.cpp
index 7d4b66fca6..987cb0c6ac 100644
--- a/src/blitter/32bpp_anim_sse4.cpp
+++ b/src/blitter/32bpp_anim_sse4.cpp
@@ -35,7 +35,8 @@ inline void Blitter_32bppSSE4_Anim::Draw(const Blitter::BlitterParams *bp, ZoomL
{
const byte * const remap = bp->remap;
Colour *dst_line = (Colour *) bp->dst + bp->top * bp->pitch + bp->left;
- uint16 *anim_line = this->anim_buf + ((uint32 *)bp->dst - (uint32 *)_screen.dst_ptr) + bp->top * this->anim_buf_width + bp->left;
+ assert(_screen.pitch == this->anim_buf_pitch); // precondition for translating 'bp->dst' into an 'anim_buf' offset below.
+ uint16 *anim_line = this->anim_buf + ((uint32 *)bp->dst - (uint32 *)_screen.dst_ptr) + bp->top * this->anim_buf_pitch + bp->left;
int effective_width = bp->width;
/* Find where to start reading in the source sprite. */
@@ -353,7 +354,7 @@ next_line:
if (mode != BM_TRANSPARENT) src_mv_line += si->sprite_width;
src_rgba_line = (const Colour*) ((const byte*) src_rgba_line + si->sprite_line_size);
dst_line += bp->pitch;
- anim_line += this->anim_buf_width;
+ anim_line += this->anim_buf_pitch;
}
}
IGNORE_UNINITIALIZED_WARNING_STOP
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index bd4bf3b59b..655a18d7f8 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -719,7 +719,15 @@ static int DrawShipPurchaseInfo(int left, int right, int y, EngineID engine_numb
return y;
}
-/* Draw aircraft specific details */
+/**
+ * Draw aircraft specific details in the buy window.
+ * @param left Left edge of the window to draw in.
+ * @param right Right edge of the window to draw in.
+ * @param y Top of the area to draw in.
+ * @param engine_number Engine to display.
+ * @param refittable If set, the aircraft can be refitted.
+ * @return Bottom of the used area.
+ */
static int DrawAircraftPurchaseInfo(int left, int right, int y, EngineID engine_number, bool refittable)
{
const Engine *e = Engine::Get(engine_number);
@@ -755,6 +763,12 @@ static int DrawAircraftPurchaseInfo(int left, int right, int y, EngineID engine_
DrawString(left, right, y, STR_PURCHASE_INFO_RUNNINGCOST);
y += FONT_HEIGHT_NORMAL;
+ /* Aircraft type */
+ SetDParam(0, e->GetAircraftTypeText());
+ DrawString(left, right, y, STR_PURCHASE_INFO_AIRCRAFT_TYPE);
+ y += FONT_HEIGHT_NORMAL;
+
+ /* Aircraft range, if available. */
uint16 range = e->GetRange();
if (range != 0) {
SetDParam(0, range);
diff --git a/src/company_base.h b/src/company_base.h
index 0017761216..4d76e6251a 100644
--- a/src/company_base.h
+++ b/src/company_base.h
@@ -52,10 +52,10 @@ extern CompanyPool _company_pool;
/** Statically loadable part of Company pool item */
struct CompanyProperties {
uint32 name_2; ///< Parameter of #name_1.
- uint16 name_1; ///< Name of the company if the user did not change it.
+ StringID name_1; ///< Name of the company if the user did not change it.
char *name; ///< Name of the company if the user changed it.
- uint16 president_name_1; ///< Name of the president if the user did not change it.
+ StringID president_name_1; ///< Name of the president if the user did not change it.
uint32 president_name_2; ///< Parameter of #president_name_1
char *president_name; ///< Name of the president if the user changed it.
diff --git a/src/core/container_func.hpp b/src/core/container_func.hpp
new file mode 100644
index 0000000000..1b8e8ad847
--- /dev/null
+++ b/src/core/container_func.hpp
@@ -0,0 +1,35 @@
+/* $Id$ */
+
+/*
+ * This file is part of OpenTTD.
+ * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
+ * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see .
+ */
+
+/** @file container_func.hpp Functions related to use of containers. */
+
+template unsigned int container_unordered_remove_if (C &container, UP predicate) {
+ unsigned int removecount = 0;
+ for (auto it = container.begin(); it != container.end();) {
+ if (predicate(*it)) {
+ removecount++;
+ if (std::next(it) != container.end()) {
+ *it = std::move(container.back());
+ container.pop_back();
+ } else {
+ container.pop_back();
+ break;
+ }
+ } else {
+ ++it;
+ }
+ }
+ return removecount;
+}
+
+template unsigned int container_unordered_remove(C &container, const V &value) {
+ return container_unordered_remove_if (container, [&](const typename C::value_type &v) {
+ return v == value;
+ });
+}
diff --git a/src/core/multimap.hpp b/src/core/multimap.hpp
index e906677141..da6a33ef45 100644
--- a/src/core/multimap.hpp
+++ b/src/core/multimap.hpp
@@ -15,7 +15,7 @@
#include