diff --git a/.gitignore b/.gitignore
index cb1e9d1599..4bf58b05c1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,6 +7,7 @@ bin/ai/*
bin/baseset/*
!bin/baseset/openttd.grf
!bin/baseset/opntitle.dat
+!bin/baseset/orig_extra.grf
!bin/baseset/orig_*.obg
!bin/baseset/orig_*.obs
!bin/baseset/no_sound.obs
@@ -22,6 +23,9 @@ bundles/*
docs/aidocs/*
docs/gamedocs/*
docs/source/*
+.kdev4
+.kdev4/*
+*.kdev4
media/openttd.desktop
media/openttd.desktop.install
objs/*
@@ -33,6 +37,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/.hgignore b/.hgignore
index debab32b0e..17b2557f80 100644
--- a/.hgignore
+++ b/.hgignore
@@ -13,6 +13,9 @@ config.pwd
docs/aidocs/*
docs/gamedocs/*
docs/source/*
+.kdev4
+.kdev4/*
+*.kdev4
Makefile
Makefile.am
Makefile.bundle
diff --git a/Makefile.grf.in b/Makefile.grf.in
index 1cc2642320..1625b9e4c0 100644
--- a/Makefile.grf.in
+++ b/Makefile.grf.in
@@ -44,22 +44,18 @@ PNG_FILES := $(GRF_DIR)/*.png $(GRF_DIR)/rivers/*.png
# Build the GRF.
ifdef GRFCODEC
-all: $(BIN_DIR)/openttd.grf $(BIN_DIR)/orig_dos.obg $(BIN_DIR)/orig_dos_de.obg $(BIN_DIR)/orig_win.obg $(BIN_DIR)/orig_dos.obs $(BIN_DIR)/orig_win.obs $(BIN_DIR)/no_sound.obs $(BIN_DIR)/orig_win.obm $(BIN_DIR)/no_music.obm
+all: $(BIN_DIR)/openttd.grf $(BIN_DIR)/orig_extra.grf $(BIN_DIR)/orig_dos.obg $(BIN_DIR)/orig_dos_de.obg $(BIN_DIR)/orig_win.obg $(BIN_DIR)/orig_dos.obs $(BIN_DIR)/orig_win.obs $(BIN_DIR)/no_sound.obs $(BIN_DIR)/orig_win.obm $(BIN_DIR)/no_music.obm
else
all:
endif
-# Make sure the sprites directory exists.
-$(OBJS_DIR)/sprites:
- $(Q)-mkdir "$@"
-
$(OBJS_DIR)/langfiles.tmp: $(LANG_DIR)/*.txt
$(E) '$(STAGE) Collecting baseset translations'
$(Q) cat $^ > $@
-$(BIN_DIR)/%.obg: $(BASESET_DIR)/%.obg $(BIN_DIR)/openttd.grf $(OBJS_DIR)/langfiles.tmp $(BASESET_DIR)/translations.awk
+$(BIN_DIR)/%.obg: $(BASESET_DIR)/%.obg $(BIN_DIR)/orig_extra.grf $(OBJS_DIR)/langfiles.tmp $(BASESET_DIR)/translations.awk
$(E) '$(STAGE) Updating $(notdir $@)'
- $(Q) sed 's/^OPENTTD.GRF = *[0-9a-f]*$$/OPENTTD.GRF = '`$(MD5SUM) $(BIN_DIR)/openttd.grf | sed 's@ .*@@'`'/' $< > $@.tmp
+ $(Q) sed 's/^ORIG_EXTRA.GRF = *[0-9a-f]*$$/ORIG_EXTRA.GRF = '`$(MD5SUM) $(BIN_DIR)/orig_extra.grf | sed 's@ .*@@'`'/' $< > $@.tmp
$(Q) awk -v langfiles='$(OBJS_DIR)/langfiles.tmp' -f $(BASESET_DIR)/translations.awk $@.tmp >$@
$(Q) rm $@.tmp
@@ -72,8 +68,9 @@ $(BIN_DIR)/%.obm: $(BASESET_DIR)/%.obm $(OBJS_DIR)/langfiles.tmp $(BASESET_DIR)/
$(Q) awk -v langfiles='$(OBJS_DIR)/langfiles.tmp' -f $(BASESET_DIR)/translations.awk $< >$@
# Compile extra grf
-$(BIN_DIR)/openttd.grf: $(PNG_FILES) $(NFO_FILES) $(OBJS_DIR)/sprites $(GRF_DIR)/assemble_nfo.awk
+$(BIN_DIR)/openttd.grf: $(PNG_FILES) $(NFO_FILES) $(GRF_DIR)/assemble_nfo.awk
$(E) '$(STAGE) Assembling openttd.nfo'
+ $(Q)-mkdir -p $(OBJS_DIR)/sprites
$(Q)-cp $(PNG_FILES) $(OBJS_DIR)/sprites 2> /dev/null
$(Q) awk -f $(GRF_DIR)/assemble_nfo.awk $(GRF_DIR)/openttd.nfo > $(OBJS_DIR)/sprites/openttd.nfo
$(Q) $(NFORENUM) -s $(OBJS_DIR)/sprites/openttd.nfo
@@ -81,6 +78,17 @@ $(BIN_DIR)/openttd.grf: $(PNG_FILES) $(NFO_FILES) $(OBJS_DIR)/sprites $(GRF_DIR)
$(Q) $(GRFCODEC) -n -s -e -p1 $(OBJS_DIR)/openttd.grf
$(Q)cp $(OBJS_DIR)/openttd.grf $(BIN_DIR)/openttd.grf
+# The copy operation of PNG_FILES is duplicated from the target 'openttd.grf', thus those targets may not run in parallel.
+$(BIN_DIR)/orig_extra.grf: $(PNG_FILES) $(NFO_FILES) $(GRF_DIR)/assemble_nfo.awk | $(BIN_DIR)/openttd.grf
+ $(E) '$(STAGE) Assembling orig_extra.nfo'
+ $(Q)-mkdir -p $(OBJS_DIR)/sprites
+ $(Q)-cp $(PNG_FILES) $(OBJS_DIR)/sprites 2> /dev/null
+ $(Q) awk -f $(GRF_DIR)/assemble_nfo.awk $(GRF_DIR)/orig_extra.nfo > $(OBJS_DIR)/sprites/orig_extra.nfo
+ $(Q) $(NFORENUM) -s $(OBJS_DIR)/sprites/orig_extra.nfo
+ $(E) '$(STAGE) Compiling orig_extra.grf'
+ $(Q) $(GRFCODEC) -n -s -e -p1 $(OBJS_DIR)/orig_extra.grf
+ $(Q)cp $(OBJS_DIR)/orig_extra.grf $(BIN_DIR)/orig_extra.grf
+
# Clean up temporary files.
clean:
$(Q)rm -f *.bak *.grf
diff --git a/Makefile.in b/Makefile.in
index 0d50fc1b1e..d33d8a0d2a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -152,7 +152,7 @@ mrproper:
distclean: mrproper
maintainer-clean: distclean
- $(Q)rm -f $(BIN_DIR)/baseset/openttd.grf $(BIN_DIR)/baseset/*.obg $(BIN_DIR)/baseset/*.obs $(BIN_DIR)/baseset/*.obm
+ $(Q)rm -f $(BIN_DIR)/baseset/openttd.grf $(BIN_DIR)/baseset/orig_extra.grf $(BIN_DIR)/baseset/*.obg $(BIN_DIR)/baseset/*.obs $(BIN_DIR)/baseset/*.obm
depend:
@for dir in $(SRC_DIRS); do \
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/openttd.grf b/bin/baseset/openttd.grf
index efe35ffd38..168d00fbd8 100644
Binary files a/bin/baseset/openttd.grf and b/bin/baseset/openttd.grf differ
diff --git a/bin/baseset/orig_dos.obg b/bin/baseset/orig_dos.obg
index 3eb8c0ff97..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.
@@ -63,21 +64,21 @@ description.zh_CN = 运输大亨DOS豪华版原版图形包.
description.zh_TW = 原版 Transport Tycoon Deluxe DOS 版的圖形。
[files]
-base = TRG1.GRF
-logos = TRGI.GRF
-arctic = TRGC.GRF
-tropical = TRGH.GRF
-toyland = TRGT.GRF
-extra = OPENTTD.GRF
+base = TRG1.GRF
+logos = TRGI.GRF
+arctic = TRGC.GRF
+tropical = TRGH.GRF
+toyland = TRGT.GRF
+extra = ORIG_EXTRA.GRF
[md5s]
-TRG1.GRF = 9311676280e5b14077a8ee41c1b42192
-TRGI.GRF = da6a6c9dcc451eec88d79211437b76a8
-TRGC.GRF = ed446637e034104c5559b32c18afe78d
-TRGH.GRF = ee6616fb0e6ef6b24892c58c93d86fc9
-TRGT.GRF = e30e8a398ae86c03dc534a8ac7dfb3b6
-OPENTTD.GRF = 505d96061556d3bb5cec6234096ec5bc
+TRG1.GRF = 9311676280e5b14077a8ee41c1b42192
+TRGI.GRF = da6a6c9dcc451eec88d79211437b76a8
+TRGC.GRF = ed446637e034104c5559b32c18afe78d
+TRGH.GRF = ee6616fb0e6ef6b24892c58c93d86fc9
+TRGT.GRF = e30e8a398ae86c03dc534a8ac7dfb3b6
+ORIG_EXTRA.GRF = 73b921a42814c47a84945b7e9add5d9f
[origin]
-default = You can find it on your Transport Tycoon Deluxe CD-ROM.
-OPENTTD.GRF = This file was part of your OpenTTD installation.
+default = You can find it on your Transport Tycoon Deluxe CD-ROM.
+ORIG_EXTRA.GRF = This file was part of your OpenTTD installation.
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_dos_de.obg b/bin/baseset/orig_dos_de.obg
index b081e4bc2f..676840f788 100644
--- a/bin/baseset/orig_dos_de.obg
+++ b/bin/baseset/orig_dos_de.obg
@@ -62,21 +62,21 @@ description.zh_CN = 运输大亨DOS豪华德语版原版图形包.
description.zh_TW = 原版 Transport Tycoon Deluxe DOS 版 (德國版) 的圖形。
[files]
-base = TRG1.GRF
-logos = TRGI.GRF
-arctic = TRGC.GRF
-tropical = TRGH.GRF
-toyland = TRGT.GRF
-extra = OPENTTD.GRF
+base = TRG1.GRF
+logos = TRGI.GRF
+arctic = TRGC.GRF
+tropical = TRGH.GRF
+toyland = TRGT.GRF
+extra = ORIG_EXTRA.GRF
[md5s]
-TRG1.GRF = 9311676280e5b14077a8ee41c1b42192
-TRGI.GRF = da6a6c9dcc451eec88d79211437b76a8
-TRGC.GRF = ed446637e034104c5559b32c18afe78d
-TRGH.GRF = ee6616fb0e6ef6b24892c58c93d86fc9
-TRGT.GRF = fcde1d7e8a74197d72a62695884b909e
-OPENTTD.GRF = 505d96061556d3bb5cec6234096ec5bc
+TRG1.GRF = 9311676280e5b14077a8ee41c1b42192
+TRGI.GRF = da6a6c9dcc451eec88d79211437b76a8
+TRGC.GRF = ed446637e034104c5559b32c18afe78d
+TRGH.GRF = ee6616fb0e6ef6b24892c58c93d86fc9
+TRGT.GRF = fcde1d7e8a74197d72a62695884b909e
+ORIG_EXTRA.GRF = 73b921a42814c47a84945b7e9add5d9f
[origin]
-default = You can find it on your Transport Tycoon Deluxe CD-ROM.
-OPENTTD.GRF = This file was part of your OpenTTD installation.
+default = You can find it on your Transport Tycoon Deluxe CD-ROM.
+ORIG_EXTRA.GRF = This file was part of your OpenTTD installation.
diff --git a/bin/baseset/orig_extra.grf b/bin/baseset/orig_extra.grf
new file mode 100644
index 0000000000..168c415a5d
Binary files /dev/null and b/bin/baseset/orig_extra.grf differ
diff --git a/bin/baseset/orig_win.obg b/bin/baseset/orig_win.obg
index 65a97c4770..049a3dca9b 100644
--- a/bin/baseset/orig_win.obg
+++ b/bin/baseset/orig_win.obg
@@ -63,21 +63,21 @@ description.zh_CN = 运输大亨Windows豪华版原版图形包.
description.zh_TW = 原版 Transport Tycoon Deluxe Windows 版的圖形。
[files]
-base = TRG1R.GRF
-logos = TRGIR.GRF
-arctic = TRGCR.GRF
-tropical = TRGHR.GRF
-toyland = TRGTR.GRF
-extra = OPENTTD.GRF
+base = TRG1R.GRF
+logos = TRGIR.GRF
+arctic = TRGCR.GRF
+tropical = TRGHR.GRF
+toyland = TRGTR.GRF
+extra = ORIG_EXTRA.GRF
[md5s]
-TRG1R.GRF = b04ce593d8c5016e07473a743d7d3358
-TRGIR.GRF = 0c2484ff6be49fc63a83be6ab5c38f32
-TRGCR.GRF = 3668f410c761a050b5e7095a2b14879b
-TRGHR.GRF = 06bf2b7a31766f048baac2ebe43457b1
-TRGTR.GRF = de53650517fe661ceaa3138c6edb0eb8
-OPENTTD.GRF = 505d96061556d3bb5cec6234096ec5bc
+TRG1R.GRF = b04ce593d8c5016e07473a743d7d3358
+TRGIR.GRF = 0c2484ff6be49fc63a83be6ab5c38f32
+TRGCR.GRF = 3668f410c761a050b5e7095a2b14879b
+TRGHR.GRF = 06bf2b7a31766f048baac2ebe43457b1
+TRGTR.GRF = de53650517fe661ceaa3138c6edb0eb8
+ORIG_EXTRA.GRF = 73b921a42814c47a84945b7e9add5d9f
[origin]
-default = You can find it on your Transport Tycoon Deluxe CD-ROM.
-OPENTTD.GRF = This file was part of your OpenTTD installation.
+default = You can find it on your Transport Tycoon Deluxe CD-ROM.
+ORIG_EXTRA.GRF = This file was part of your OpenTTD installation.
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 026f093f7e..c93bcf2276 100644
--- a/config.lib
+++ b/config.lib
@@ -178,7 +178,7 @@ set_default() {
with_libbfd
with_bfd_extra_debug
with_self_gdb_debug
- CC CXX CFLAGS CXXFLAGS LDFLAGS CFLAGS_BUILD CXXFLAGS_BUILD LDFLAGS_BUILD"
+ CC CXX CFLAGS CXXFLAGS LDFLAGS CFLAGS_BUILD CXXFLAGS_BUILD LDFLAGS_BUILD PKG_CONFIG_PATH PKG_CONFIG_LIBDIR"
}
detect_params() {
@@ -491,6 +491,8 @@ detect_params() {
CFLAGS_BUILD=* | --CFLAGS_BUILD=* | --CFLAGS-BUILD=*) CFLAGS_BUILD="$optarg";;
CXXFLAGS_BUILD=* | --CXXFLAGS_BUILD=* | --CXXFLAGS-BUILD=*) CXXFLAGS_BUILD="$optarg";;
LDFLAGS_BUILD=* | --LDFLAGS_BUILD=* | --LDFLAGS-BUILD=*) LDFLAGS_BUILD="$optarg";;
+ PKG_CONFIG_PATH=* | --PKG_CONFIG_PATH=* | --PKG-CONFIG-PATH=*) PKG_CONFIG_PATH="$optarg";;
+ PKG_CONFIG_LIBDIR=* | --PKG_CONFIG_LIBDIR=* | --PKG-CONFIG-LIBDIR=*) PKG_CONFIG_LIBDIR="$optarg";;
--ignore-extra-parameters) ignore_extra_parameters="1";;
@@ -541,6 +543,20 @@ save_params() {
echo "" >> $config_log
}
+# Export a variable so tools like pkg-config can see it when invoked.
+# If the variable contains an empty string then unset it.
+# $1 - name of the variable to export or unset
+export_or_unset() {
+ eval local value=\$$1
+ if [ -n "$value" ]; then
+ export $1;
+ log 2 "using $1=$value";
+ else
+ unset $1;
+ log 2 "not using $1";
+ fi
+}
+
check_params() {
# Some params want to be in full uppercase, else they might not work as
# expected.. fix that here
@@ -549,6 +565,16 @@ check_params() {
os=`echo $os | tr '[a-z]' '[A-Z]'`
cpu_type=`echo $cpu_type | tr '[a-z]' '[A-Z]'`
+ # Export some variables to be used by pkg-config
+ #
+ # PKG_CONFIG_LIBDIR variable musn't be set if we are not willing to
+ # override the default pkg-config search path, it musn't be an empty
+ # string. If the variable is empty (e.g. when an empty string comes
+ # from config.cache) then unset it. This way the "don't override" state
+ # will be properly preserved when (re)configuring.
+ export_or_unset PKG_CONFIG_PATH
+ export_or_unset PKG_CONFIG_LIBDIR
+
# Check if all params have valid values
# Endian only allows AUTO, LE and, BE
@@ -1431,11 +1457,14 @@ make_compiler_cflags() {
flags="$flags -fno-tree-vrp"
fi
- if [ $cc_version -ge 407 ]; then
+ if [ $cc_version -eq 407 ]; then
# Disable -Wnarrowing which gives many warnings, such as:
# warning: narrowing conversion of '...' from 'unsigned int' to 'int' inside { } [-Wnarrowing]
# They are valid according to the C++ standard, but useless.
cxxflags="$cxxflags -Wno-narrowing"
+ fi
+
+ if [ $cc_version -ge 407 ]; then
# Disable bogus 'attempt to free a non-heap object' warning
flags="$flags -Wno-free-nonheap-object"
else
@@ -1881,23 +1910,6 @@ EOL
CFLAGS="$OSX_SYSROOT $CFLAGS"
LDFLAGS="$OSX_LD_SYSROOT $LDFLAGS"
fi
-
- if [ "$enable_universal" = "0" ] && [ $cc_version -gt 400 ]; then
- # Only set the min version when not doing an universal build.
- # Universal builds set the version elsewhere.
- if [ "$cpu_type" = "64" ]; then
- CFLAGS="$CFLAGS -mmacosx-version-min=10.5"
- else
- gcc_cpu=`$cc_host -dumpmachine`
- if [ "`echo $gcc_cpu | cut -c 1-3`" = "ppc" -o "`echo $gcc_cpu | cut -c 1-7`" = "powerpc" ]; then
- # PowerPC build can run on 10.3
- CFLAGS="$CFLAGS -mmacosx-version-min=10.3"
- else
- # Intel is only available starting from 10.4
- CFLAGS="$CFLAGS -mmacosx-version-min=10.4"
- fi
- fi
- fi
fi
if [ "$os" = "BEOS" ] || [ "$os" = "HAIKU" ]; then
@@ -3382,24 +3394,40 @@ detect_nforenum() {
log 1 "checking nforenum... found"
}
-detect_cputype() {
- if [ -n "$cpu_type" ] && [ "$cpu_type" != "DETECT" ]; then
- log 1 "forcing cpu-type... $cpu_type bits"
- return;
- fi
- echo "#define _SQ64 1" > tmp.64bit.cpp
- echo "#include \"src/stdafx.h\"" >> tmp.64bit.cpp
- echo "assert_compile(sizeof(size_t) == 8);" >> tmp.64bit.cpp
- echo "int main() { return 0; }" >> tmp.64bit.cpp
- execute="$cxx_host $CFLAGS tmp.64bit.cpp -o tmp.64bit -DTESTING 2>&1"
+_detect_cputype_width() {
+ echo "#define _SQ64 1" > $1.cpp
+ echo "#include \"src/stdafx.h\"" >> $1.cpp
+ echo "assert_compile(sizeof(size_t) == $2);" >> $1.cpp
+ echo "int main() { return 0; }" >> $1.cpp
+ execute="$cxx_host $CFLAGS -std=c++11 $1.cpp -o $1 -DTESTING 2>&1"
cpu_type="`eval $execute 2>/dev/null`"
ret=$?
log 2 "executing $execute"
log 2 " returned $cpu_type"
log 2 " exit code $ret"
- if [ "$ret" = "0" ]; then cpu_type="64"; else cpu_type="32"; fi
+ rm -f $1 $1.cpp
+ return $ret
+}
+
+detect_cputype() {
+ if [ -n "$cpu_type" ] && [ "$cpu_type" != "DETECT" ]; then
+ log 1 "forcing cpu-type... $cpu_type bits"
+ return;
+ fi
+ _detect_cputype_width tmp.32bit 4
+ result32=$?
+ _detect_cputype_width tmp.64bit 8
+ result64=$?
+
+ if [ "$result32" = 0 ] && [ "$result64" != 0 ]; then
+ cpu_type="32"
+ elif [ "$result32" != 0 ] && [ "$result64" = 0 ]; then
+ cpu_type="64"
+ else
+ log 1 "configure: unable to determine cpu-type (pointer width)"
+ exit 1
+ fi
log 1 "detecting cpu-type... $cpu_type bits"
- rm -f tmp.64bit tmp.64bit.cpp
}
detect_sse_capable_architecture() {
@@ -3854,6 +3882,8 @@ showhelp() {
echo " CFLAGS_BUILD C compiler flags for build time tool generation"
echo " CXXFLAGS_BUILD C++ compiler flags for build time tool generation"
echo " LDFLAGS_BUILD linker flags for build time tool generation"
+ echo " PKG_CONFIG_PATH additional library search paths (see \"man pkg-config\")"
+ echo " PKG_CONFIG_LIBDIR replace the default library search path (see \"man pkg-config\")"
echo ""
echo "Use these variables to override the choices made by 'configure' or to help"
echo "it to find libraries and programs with nonstandard names/locations."
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/media/baseset/orig_dos.obg b/media/baseset/orig_dos.obg
index b4cde64007..f9db843af1 100644
--- a/media/baseset/orig_dos.obg
+++ b/media/baseset/orig_dos.obg
@@ -11,21 +11,21 @@ palette = DOS
!! description STR_BASEGRAPHICS_DOS_DESCRIPTION
[files]
-base = TRG1.GRF
-logos = TRGI.GRF
-arctic = TRGC.GRF
-tropical = TRGH.GRF
-toyland = TRGT.GRF
-extra = OPENTTD.GRF
+base = TRG1.GRF
+logos = TRGI.GRF
+arctic = TRGC.GRF
+tropical = TRGH.GRF
+toyland = TRGT.GRF
+extra = ORIG_EXTRA.GRF
[md5s]
-TRG1.GRF = 9311676280e5b14077a8ee41c1b42192
-TRGI.GRF = da6a6c9dcc451eec88d79211437b76a8
-TRGC.GRF = ed446637e034104c5559b32c18afe78d
-TRGH.GRF = ee6616fb0e6ef6b24892c58c93d86fc9
-TRGT.GRF = e30e8a398ae86c03dc534a8ac7dfb3b6
-OPENTTD.GRF =
+TRG1.GRF = 9311676280e5b14077a8ee41c1b42192
+TRGI.GRF = da6a6c9dcc451eec88d79211437b76a8
+TRGC.GRF = ed446637e034104c5559b32c18afe78d
+TRGH.GRF = ee6616fb0e6ef6b24892c58c93d86fc9
+TRGT.GRF = e30e8a398ae86c03dc534a8ac7dfb3b6
+ORIG_EXTRA.GRF =
[origin]
-default = You can find it on your Transport Tycoon Deluxe CD-ROM.
-OPENTTD.GRF = This file was part of your OpenTTD installation.
+default = You can find it on your Transport Tycoon Deluxe CD-ROM.
+ORIG_EXTRA.GRF = This file was part of your OpenTTD installation.
diff --git a/media/baseset/orig_dos_de.obg b/media/baseset/orig_dos_de.obg
index 8cfcc27074..4e12582727 100644
--- a/media/baseset/orig_dos_de.obg
+++ b/media/baseset/orig_dos_de.obg
@@ -11,21 +11,21 @@ palette = DOS
!! description STR_BASEGRAPHICS_DOS_DE_DESCRIPTION
[files]
-base = TRG1.GRF
-logos = TRGI.GRF
-arctic = TRGC.GRF
-tropical = TRGH.GRF
-toyland = TRGT.GRF
-extra = OPENTTD.GRF
+base = TRG1.GRF
+logos = TRGI.GRF
+arctic = TRGC.GRF
+tropical = TRGH.GRF
+toyland = TRGT.GRF
+extra = ORIG_EXTRA.GRF
[md5s]
-TRG1.GRF = 9311676280e5b14077a8ee41c1b42192
-TRGI.GRF = da6a6c9dcc451eec88d79211437b76a8
-TRGC.GRF = ed446637e034104c5559b32c18afe78d
-TRGH.GRF = ee6616fb0e6ef6b24892c58c93d86fc9
-TRGT.GRF = fcde1d7e8a74197d72a62695884b909e
-OPENTTD.GRF =
+TRG1.GRF = 9311676280e5b14077a8ee41c1b42192
+TRGI.GRF = da6a6c9dcc451eec88d79211437b76a8
+TRGC.GRF = ed446637e034104c5559b32c18afe78d
+TRGH.GRF = ee6616fb0e6ef6b24892c58c93d86fc9
+TRGT.GRF = fcde1d7e8a74197d72a62695884b909e
+ORIG_EXTRA.GRF =
[origin]
-default = You can find it on your Transport Tycoon Deluxe CD-ROM.
-OPENTTD.GRF = This file was part of your OpenTTD installation.
+default = You can find it on your Transport Tycoon Deluxe CD-ROM.
+ORIG_EXTRA.GRF = This file was part of your OpenTTD installation.
diff --git a/media/baseset/orig_win.obg b/media/baseset/orig_win.obg
index 82a5c2a616..393b5d3013 100644
--- a/media/baseset/orig_win.obg
+++ b/media/baseset/orig_win.obg
@@ -11,21 +11,21 @@ palette = Windows
!! description STR_BASEGRAPHICS_WIN_DESCRIPTION
[files]
-base = TRG1R.GRF
-logos = TRGIR.GRF
-arctic = TRGCR.GRF
-tropical = TRGHR.GRF
-toyland = TRGTR.GRF
-extra = OPENTTD.GRF
+base = TRG1R.GRF
+logos = TRGIR.GRF
+arctic = TRGCR.GRF
+tropical = TRGHR.GRF
+toyland = TRGTR.GRF
+extra = ORIG_EXTRA.GRF
[md5s]
-TRG1R.GRF = b04ce593d8c5016e07473a743d7d3358
-TRGIR.GRF = 0c2484ff6be49fc63a83be6ab5c38f32
-TRGCR.GRF = 3668f410c761a050b5e7095a2b14879b
-TRGHR.GRF = 06bf2b7a31766f048baac2ebe43457b1
-TRGTR.GRF = de53650517fe661ceaa3138c6edb0eb8
-OPENTTD.GRF =
+TRG1R.GRF = b04ce593d8c5016e07473a743d7d3358
+TRGIR.GRF = 0c2484ff6be49fc63a83be6ab5c38f32
+TRGCR.GRF = 3668f410c761a050b5e7095a2b14879b
+TRGHR.GRF = 06bf2b7a31766f048baac2ebe43457b1
+TRGTR.GRF = de53650517fe661ceaa3138c6edb0eb8
+ORIG_EXTRA.GRF =
[origin]
-default = You can find it on your Transport Tycoon Deluxe CD-ROM.
-OPENTTD.GRF = This file was part of your OpenTTD installation.
+default = You can find it on your Transport Tycoon Deluxe CD-ROM.
+ORIG_EXTRA.GRF = This file was part of your OpenTTD installation.
diff --git a/media/extra_grf/canals.nfo b/media/extra_grf/canals.nfo
index c0d0275f35..e464762ee6 100644
--- a/media/extra_grf/canals.nfo
+++ b/media/extra_grf/canals.nfo
@@ -6,7 +6,7 @@
// 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 .
//
- -1 * 0 0C "Canal graphics by George / PaulC"
+ -1 * 0 0C "Canal graphics by George"
-1 * 3 05 08 41
// Canal slopes
-1 sprites/canal_locks.png 8bpp 66 8 64 23 -31 0 normal
@@ -77,95 +77,3 @@
-1 sprites/canals.png 8bpp 446 10 24 16 -11 -6 normal
// Canal icon
-1 sprites/canal_locks.png 8bpp 50 232 20 20 0 0 normal
-
-// Differentiation for the climates starts here
-
-// Canal edges (arctic snowy)
- -1 * 4 01 05 01 \b12
- -1 sprites/canals.png 8bpp 30 40 45 22 -11 -1 normal
- -1 sprites/canals.png 8bpp 94 40 41 21 -8 10 normal
- -1 sprites/canals.png 8bpp 142 40 42 21 -31 10 normal
- -1 sprites/canals.png 8bpp 190 40 43 22 -31 -1 normal
- -1 sprites/canals.png 8bpp 238 40 22 22 11 4 normal
- -1 sprites/canals.png 8bpp 270 40 24 16 -11 15 normal
- -1 sprites/canals.png 8bpp 302 40 23 23 -31 4 normal
- -1 sprites/canals.png 8bpp 334 40 24 18 -11 -1 normal
- -1 sprites/canals.png 8bpp 366 40 12 11 21 10 normal
- -1 sprites/canals.png 8bpp 398 40 19 10 -8 21 normal
- -1 sprites/canals.png 8bpp 430 40 11 10 -31 10 normal
- -1 sprites/canals.png 8bpp 446 40 24 16 -11 -6 normal
- -1 * 7 02 05 10 01 00 00 00
-
-// Canal edges (arctic normal)
- -1 * 4 01 05 01 \b12
- -1 sprites/canals.png 8bpp 30 70 45 22 -11 -1 normal
- -1 sprites/canals.png 8bpp 94 70 41 21 -8 10 normal
- -1 sprites/canals.png 8bpp 142 70 42 21 -31 10 normal
- -1 sprites/canals.png 8bpp 190 70 43 22 -31 -1 normal
- -1 sprites/canals.png 8bpp 238 70 22 22 11 4 normal
- -1 sprites/canals.png 8bpp 270 70 24 16 -11 15 normal
- -1 sprites/canals.png 8bpp 302 70 23 23 -31 4 normal
- -1 sprites/canals.png 8bpp 334 70 24 18 -11 -1 normal
- -1 sprites/canals.png 8bpp 366 70 12 11 21 10 normal
- -1 sprites/canals.png 8bpp 398 70 19 10 -8 21 normal
- -1 sprites/canals.png 8bpp 430 70 11 10 -31 10 normal
- -1 sprites/canals.png 8bpp 446 70 24 16 -11 -6 normal
- -1 * 7 02 05 11 01 00 00 00
-// Choose the right arctic canal edges
- -1 * 14 02 05 12 81 81 00 FF 01 10 00 04 04 11 00
- -1 * 6 07 83 01 \7! 01 01
- -1 * 7 03 05 01 02 00 12 00
-
-// Canal edges (tropic desert)
- -1 * 4 01 05 01 \b12
- -1 sprites/canals.png 8bpp 30 100 45 22 -11 -1 normal
- -1 sprites/canals.png 8bpp 94 100 41 21 -8 10 normal
- -1 sprites/canals.png 8bpp 142 100 42 21 -31 10 normal
- -1 sprites/canals.png 8bpp 190 100 43 22 -31 -1 normal
- -1 sprites/canals.png 8bpp 238 100 22 22 11 4 normal
- -1 sprites/canals.png 8bpp 270 100 24 16 -11 15 normal
- -1 sprites/canals.png 8bpp 302 100 23 23 -31 4 normal
- -1 sprites/canals.png 8bpp 334 100 24 18 -11 -1 normal
- -1 sprites/canals.png 8bpp 366 100 12 11 21 10 normal
- -1 sprites/canals.png 8bpp 398 100 19 10 -8 21 normal
- -1 sprites/canals.png 8bpp 430 100 11 10 -31 10 normal
- -1 sprites/canals.png 8bpp 446 100 24 16 -11 -6 normal
- -1 * 7 02 05 13 01 00 00 00
-
-// Canal edges (tropic rainforest)
- -1 * 4 01 05 01 \b12
- -1 sprites/canals.png 8bpp 30 130 45 22 -11 -1 normal
- -1 sprites/canals.png 8bpp 94 130 41 21 -8 10 normal
- -1 sprites/canals.png 8bpp 142 130 42 21 -31 10 normal
- -1 sprites/canals.png 8bpp 190 130 43 22 -31 -1 normal
- -1 sprites/canals.png 8bpp 238 130 22 22 11 4 normal
- -1 sprites/canals.png 8bpp 270 130 24 16 -11 15 normal
- -1 sprites/canals.png 8bpp 302 130 23 23 -31 4 normal
- -1 sprites/canals.png 8bpp 334 130 24 18 -11 -1 normal
- -1 sprites/canals.png 8bpp 366 130 12 11 21 10 normal
- -1 sprites/canals.png 8bpp 398 130 19 10 -8 21 normal
- -1 sprites/canals.png 8bpp 430 130 11 10 -31 10 normal
- -1 sprites/canals.png 8bpp 446 130 24 16 -11 -6 normal
- -1 * 7 02 05 14 01 00 00 00
-// Choose the right tropic canal edges
- -1 * 14 02 05 15 81 81 00 FF 01 13 00 01 01 14 00
- -1 * 6 07 83 01 \7! 02 01
- -1 * 7 03 05 01 02 00 15 00
-
-// Canal edges (toyland)
- -1 * 4 01 05 01 \b12
- -1 sprites/canals.png 8bpp 30 160 45 22 -11 -1 normal
- -1 sprites/canals.png 8bpp 94 160 41 21 -8 10 normal
- -1 sprites/canals.png 8bpp 142 160 42 21 -31 10 normal
- -1 sprites/canals.png 8bpp 190 160 43 22 -31 -1 normal
- -1 sprites/canals.png 8bpp 238 160 22 22 11 4 normal
- -1 sprites/canals.png 8bpp 270 160 24 16 -11 15 normal
- -1 sprites/canals.png 8bpp 302 160 23 23 -31 4 normal
- -1 sprites/canals.png 8bpp 334 160 24 18 -11 -1 normal
- -1 sprites/canals.png 8bpp 366 160 12 11 21 10 normal
- -1 sprites/canals.png 8bpp 398 160 19 10 -8 21 normal
- -1 sprites/canals.png 8bpp 430 160 11 10 -31 10 normal
- -1 sprites/canals.png 8bpp 446 160 24 16 -11 -6 normal
- -1 * 7 02 05 16 01 00 00 00
- -1 * 6 07 83 01 \7! 03 01
- -1 * 7 03 05 01 02 00 16 00
diff --git a/media/extra_grf/canals_extra.nfo b/media/extra_grf/canals_extra.nfo
new file mode 100644
index 0000000000..3103886233
--- /dev/null
+++ b/media/extra_grf/canals_extra.nfo
@@ -0,0 +1,101 @@
+//
+// $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 .
+//
+ -1 * 0 0C "Extra canal graphics by PaulC"
+
+// Differentiation for the climates starts here
+
+// Canal edges (arctic snowy)
+ -1 * 4 01 05 01 \b12
+ -1 sprites/canals.png 8bpp 30 40 45 22 -11 -1 normal
+ -1 sprites/canals.png 8bpp 94 40 41 21 -8 10 normal
+ -1 sprites/canals.png 8bpp 142 40 42 21 -31 10 normal
+ -1 sprites/canals.png 8bpp 190 40 43 22 -31 -1 normal
+ -1 sprites/canals.png 8bpp 238 40 22 22 11 4 normal
+ -1 sprites/canals.png 8bpp 270 40 24 16 -11 15 normal
+ -1 sprites/canals.png 8bpp 302 40 23 23 -31 4 normal
+ -1 sprites/canals.png 8bpp 334 40 24 18 -11 -1 normal
+ -1 sprites/canals.png 8bpp 366 40 12 11 21 10 normal
+ -1 sprites/canals.png 8bpp 398 40 19 10 -8 21 normal
+ -1 sprites/canals.png 8bpp 430 40 11 10 -31 10 normal
+ -1 sprites/canals.png 8bpp 446 40 24 16 -11 -6 normal
+ -1 * 7 02 05 10 01 00 00 00
+
+// Canal edges (arctic normal)
+ -1 * 4 01 05 01 \b12
+ -1 sprites/canals.png 8bpp 30 70 45 22 -11 -1 normal
+ -1 sprites/canals.png 8bpp 94 70 41 21 -8 10 normal
+ -1 sprites/canals.png 8bpp 142 70 42 21 -31 10 normal
+ -1 sprites/canals.png 8bpp 190 70 43 22 -31 -1 normal
+ -1 sprites/canals.png 8bpp 238 70 22 22 11 4 normal
+ -1 sprites/canals.png 8bpp 270 70 24 16 -11 15 normal
+ -1 sprites/canals.png 8bpp 302 70 23 23 -31 4 normal
+ -1 sprites/canals.png 8bpp 334 70 24 18 -11 -1 normal
+ -1 sprites/canals.png 8bpp 366 70 12 11 21 10 normal
+ -1 sprites/canals.png 8bpp 398 70 19 10 -8 21 normal
+ -1 sprites/canals.png 8bpp 430 70 11 10 -31 10 normal
+ -1 sprites/canals.png 8bpp 446 70 24 16 -11 -6 normal
+ -1 * 7 02 05 11 01 00 00 00
+// Choose the right arctic canal edges
+ -1 * 14 02 05 12 81 81 00 FF 01 10 00 04 04 11 00
+ -1 * 6 07 83 01 \7! 01 01
+ -1 * 7 03 05 01 02 00 12 00
+
+// Canal edges (tropic desert)
+ -1 * 4 01 05 01 \b12
+ -1 sprites/canals.png 8bpp 30 100 45 22 -11 -1 normal
+ -1 sprites/canals.png 8bpp 94 100 41 21 -8 10 normal
+ -1 sprites/canals.png 8bpp 142 100 42 21 -31 10 normal
+ -1 sprites/canals.png 8bpp 190 100 43 22 -31 -1 normal
+ -1 sprites/canals.png 8bpp 238 100 22 22 11 4 normal
+ -1 sprites/canals.png 8bpp 270 100 24 16 -11 15 normal
+ -1 sprites/canals.png 8bpp 302 100 23 23 -31 4 normal
+ -1 sprites/canals.png 8bpp 334 100 24 18 -11 -1 normal
+ -1 sprites/canals.png 8bpp 366 100 12 11 21 10 normal
+ -1 sprites/canals.png 8bpp 398 100 19 10 -8 21 normal
+ -1 sprites/canals.png 8bpp 430 100 11 10 -31 10 normal
+ -1 sprites/canals.png 8bpp 446 100 24 16 -11 -6 normal
+ -1 * 7 02 05 13 01 00 00 00
+
+// Canal edges (tropic rainforest)
+ -1 * 4 01 05 01 \b12
+ -1 sprites/canals.png 8bpp 30 130 45 22 -11 -1 normal
+ -1 sprites/canals.png 8bpp 94 130 41 21 -8 10 normal
+ -1 sprites/canals.png 8bpp 142 130 42 21 -31 10 normal
+ -1 sprites/canals.png 8bpp 190 130 43 22 -31 -1 normal
+ -1 sprites/canals.png 8bpp 238 130 22 22 11 4 normal
+ -1 sprites/canals.png 8bpp 270 130 24 16 -11 15 normal
+ -1 sprites/canals.png 8bpp 302 130 23 23 -31 4 normal
+ -1 sprites/canals.png 8bpp 334 130 24 18 -11 -1 normal
+ -1 sprites/canals.png 8bpp 366 130 12 11 21 10 normal
+ -1 sprites/canals.png 8bpp 398 130 19 10 -8 21 normal
+ -1 sprites/canals.png 8bpp 430 130 11 10 -31 10 normal
+ -1 sprites/canals.png 8bpp 446 130 24 16 -11 -6 normal
+ -1 * 7 02 05 14 01 00 00 00
+// Choose the right tropic canal edges
+ -1 * 14 02 05 15 81 81 00 FF 01 13 00 01 01 14 00
+ -1 * 6 07 83 01 \7! 02 01
+ -1 * 7 03 05 01 02 00 15 00
+
+// Canal edges (toyland)
+ -1 * 4 01 05 01 \b12
+ -1 sprites/canals.png 8bpp 30 160 45 22 -11 -1 normal
+ -1 sprites/canals.png 8bpp 94 160 41 21 -8 10 normal
+ -1 sprites/canals.png 8bpp 142 160 42 21 -31 10 normal
+ -1 sprites/canals.png 8bpp 190 160 43 22 -31 -1 normal
+ -1 sprites/canals.png 8bpp 238 160 22 22 11 4 normal
+ -1 sprites/canals.png 8bpp 270 160 24 16 -11 15 normal
+ -1 sprites/canals.png 8bpp 302 160 23 23 -31 4 normal
+ -1 sprites/canals.png 8bpp 334 160 24 18 -11 -1 normal
+ -1 sprites/canals.png 8bpp 366 160 12 11 21 10 normal
+ -1 sprites/canals.png 8bpp 398 160 19 10 -8 21 normal
+ -1 sprites/canals.png 8bpp 430 160 11 10 -31 10 normal
+ -1 sprites/canals.png 8bpp 446 160 24 16 -11 -6 normal
+ -1 * 7 02 05 16 01 00 00 00
+ -1 * 6 07 83 01 \7! 03 01
+ -1 * 7 03 05 01 02 00 16 00
diff --git a/media/extra_grf/openttd.nfo b/media/extra_grf/openttd.nfo
index 66149a37e5..7ece5c7149 100644
--- a/media/extra_grf/openttd.nfo
+++ b/media/extra_grf/openttd.nfo
@@ -60,10 +60,11 @@
00
// GRF ID, must start with FF so it gets ignored
- -1 * 0 08 08 FF "OTT"
+//@@WARNING DISABLE 101
+ -1 * 0 08 08 FF FF FF FE
// Name of the GRF
- "OpenTTD's base graphics " 00
+ "OpenTTD's default and fallback extra graphics" 00
// Description of the GRF.
"License: GNU General Public License version 2" 0D
@@ -86,7 +87,6 @@
#include "canals.nfo"
#include "oneway.nfo"
#include "tramtracks.nfo"
-#include "shore.nfo"
#include "sloped_tracks.nfo"
#include "airports.nfo"
#include "roadstops.nfo"
@@ -97,11 +97,5 @@
#include "airport_preview.nfo"
#include "chars.nfo"
#include "mono.nfo"
-#include "fix_graphics.nfo"
-#include "rivers/rapids.nfo"
-#include "rivers/temperate.nfo"
-#include "rivers/arctic.nfo"
-#include "rivers/tropic.nfo"
-#include "rivers/toyland.nfo"
#include "tunnel_portals.nfo"
#include "palette.nfo"
diff --git a/media/extra_grf/orig_extra.nfo b/media/extra_grf/orig_extra.nfo
new file mode 100644
index 0000000000..03a8ff6741
--- /dev/null
+++ b/media/extra_grf/orig_extra.nfo
@@ -0,0 +1,85 @@
+// Automatically generated by GRFCODEC. Do not modify!
+// (Info version 32)
+// Format: spritenum imagefile depth xpos ypos xsize ysize xrel yrel zoom flags
+//
+// $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 .
+//
+// Sources for extra graphics to complement the original graphics.
+// Checks whether the correct version of OpenTTD is used before
+// allowing it to be used.
+//
+
+//
+// Number of sprites, it is wrong, but GRFcodec automagically gets it right.
+//
+ 0 * 4 00 00 00 00
+
+
+//
+// Check whether we are running OTTD or not.
+//
+ -1 * 0 07 9D 04 \7= 01 00 00 00 01
+ -1 * 0 0B 03 7F FF 80 " is not for TTDPatch. Use ttdpatch(w).grf." 00
+
+
+//
+// Check for OTTD's version number
+//
+
+// First step... Variable A1 might not exist. If that's the case it always
+// skips. As we do not want to skip out of the whole testing, we skip over
+// the real version check.
+ -1 * 0 07 A1 04 \7= FF FF FF FF 02
+
+// Real version check.
+ -1 * 0 07 A1 04 \7> \w20304 01 01 03
+
+// If the version check is supported, the string is translateable via OpenTTD
+// itself. Use it!.
+
+ -1 * 0 0B 03 7F 06 "1.1 (or trunk r20304)" 00
+
+// Some OTTD versions before r11130 did support Action B, so use the English
+// phrase there
+ -1 * 0 0B 03 7F FF "Requires OpenTTD version 1.1 (or trunk r20304) or better." 00
+
+// Final fallback. No Action B support, just skip to the end of the file.
+ -1 * 0 07 A1 04 \7= FF FF FF FF 00
+
+// We are a DOS paletted NewGRF, so tell OpenTTD that. Then it can actually
+// do the right thing. Yay for that feature as that means no duplicate NewGRF!
+ -1 * 0 14
+ "C" "INFO"
+ "B" "PALS" \w1 "D"
+ 00
+ 00
+
+// GRF ID, must start with FF so it gets ignored
+//@@WARNING DISABLE 101
+ -1 * 0 08 08 FF "OTT"
+
+// Name of the GRF
+ "Original baseset extra graphics" 00
+
+// Description of the GRF.
+ "License: GNU General Public License version 2" 0D
+ "Andrew Parkhouse: rivers" 0D
+ "Addi and PaulC: original graphics fixes" 0D
+ "OpenTTD developers: other graphics" 00
+
+//
+// The real data of the GRF is acquired from several subfiles.
+//
+#include "shore.nfo"
+#include "fix_graphics.nfo"
+#include "canals_extra.nfo"
+#include "rivers/rapids.nfo"
+#include "rivers/temperate.nfo"
+#include "rivers/arctic.nfo"
+#include "rivers/tropic.nfo"
+#include "rivers/toyland.nfo"
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 9eb869f2d3..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"
@@ -408,6 +408,7 @@ Section "Uninstall"
; Baseset files
Delete "$INSTDIR\baseset\opntitle.dat"
Delete "$INSTDIR\baseset\openttd.grf"
+ Delete "$INSTDIR\baseset\orig_extra.grf"
Delete "$INSTDIR\baseset\orig_win.obg"
Delete "$INSTDIR\baseset\orig_dos.obg"
Delete "$INSTDIR\baseset\orig_dos_de.obg"
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/gen-kdev4.sh b/projects/gen-kdev4.sh
new file mode 100755
index 0000000000..4ea5dbc2a8
--- /dev/null
+++ b/projects/gen-kdev4.sh
@@ -0,0 +1,203 @@
+#!/bin/sh
+
+# $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 .
+
+# echo without interpretation of backslash escapes and without
+# adding newline at the end - just the string as it is
+rawprint()
+{
+ printf '%s' "$@"
+}
+
+encode_dword()
+{
+ printf '\x%02x' \
+ `expr $1 / 16777216 % 256` \
+ `expr $1 / 65536 % 256` \
+ `expr $1 / 256 % 256` \
+ `expr $1 % 256`
+}
+
+encode_string()
+{
+ # turn string into UTF-16 and hexdump it
+ hex_utf16=`rawprint "$1" | iconv -t UTF-16BE | od -t x1 -A n | tr -d -c '[:xdigit:]'`;
+
+ encode_dword `rawprint "$hex_utf16" | wc -m | xargs -I {} expr {} / 2` # length = num hex digits / 2
+ rawprint "$hex_utf16" | sed 's/../\\x&/g' # put '\x' prefix before every pair of digits
+}
+
+encode_single_define()
+{
+ encode_string `rawprint "$1" | grep -o '^[^=]*'` # everything before '='
+ rawprint '\x00\x00\x00\n\x00'
+ encode_string `rawprint "$1" | sed 's/^[^=]*=\?//'` # everything after '='
+}
+
+# $1 - newline-separated list of defines
+encode_defines()
+{
+ # add some fixed defines and discard empty lines from the tail
+ defines=`printf 'va_list\nva_args\n%s' "$1"`
+
+ # count lines (no newline at the end so add one)
+ encode_dword `printf '%s\n' "$defines" | wc -l`
+
+ while [ -n "$defines" ]; do
+ encode_single_define `rawprint "$defines" | head -n 1`
+ defines=`rawprint "$defines" | tail -n +2`
+ done
+}
+
+encode_includes()
+{
+ encode_dword 3 # number of custom includes
+ encode_string "$1/src/stdafx.h"
+ encode_string "$1/objs/lang"
+ encode_string "$1/objs/setting"
+}
+
+# escape with a backslash (\) characters special to the sed replace string: \ &
+# also escape our custom filed separator that we will be using in sed: @
+escape_sed_special()
+{
+ sed -e 's/[\&@]/\\&/g'
+}
+
+
+
+PROJECT_DIR=`pwd`
+DIR_NAME=`pwd | xargs -0 basename`
+
+USAGE_TEXT='Usage:
+
+ projects/gen-kdev4 [PROJECT_NAME|-h|--help]
+
+PROJECT_NAME is the name of the project that will be displayed in KDevelop.
+Before executing, cd into OpenTTD folder and run ./configure script.
+
+-h, --help
+ print help and exit'
+
+case "$# $1" in
+ '1 -h' | '1 --help') printf 'Generate OpenTTD project files for KDevelop 4+\n\n%s\n' "$USAGE_TEXT"; exit 0;;
+ 1*) PROJECT_NAME="$1";;
+ 0*) PROJECT_NAME="$DIR_NAME";;
+ *) printf 'Wrong arguments given. %s\n' "$USAGE_TEXT" >&2; exit 1;;
+esac
+
+CFLAGS=`grep '^using CFLAGS\.\.\.' config.log 2>/dev/null`
+if [ -z "$CFLAGS" ]; then
+ echo "OpenTTD config.log not found" >&2
+ echo "cd into OpenTTD first and run 'configure'" >&2
+ exit 1
+fi
+DEFINES=`eval "printf '%s\n' $CFLAGS" | grep '^\-D' | cut -c3-`
+
+PROJECT_NAME_SED=s@!!PROJECT_NAME!!@`rawprint "$PROJECT_NAME" | escape_sed_special`@g
+PROJECT_DIR_SED=s@!!PROJECT_DIR!!@`rawprint "$PROJECT_DIR" | escape_sed_special`@g
+CUSTOM_DEFINES_SED=s@!!CUSTOM_DEFINES!!@`encode_defines "$DEFINES" | escape_sed_special`@g
+CUSTOM_INCLUDES_SED=s@!!CUSTOM_INCLUDES!!@`encode_includes "$PROJECT_DIR" | escape_sed_special`@g
+
+mkdir -p .kdev4
+
+sed -e "$PROJECT_NAME_SED" \
+ >"$PROJECT_DIR/$DIR_NAME.kdev4" \
+ << "EOF"
+[Project]
+Manager=KDevCustomMakeManager
+Name=!!PROJECT_NAME!!
+EOF
+
+sed -e "$PROJECT_DIR_SED" -e "$CUSTOM_DEFINES_SED" -e "$CUSTOM_INCLUDES_SED" \
+ >"$PROJECT_DIR/.kdev4/$DIR_NAME.kdev4" \
+ << "EOF"
+[CustomDefinesAndIncludes][ProjectPath0]
+Defines=!!CUSTOM_DEFINES!!
+Includes=!!CUSTOM_INCLUDES!!
+Path=.
+
+[Defines And Includes][Compiler]
+Name=GCC
+Path=gcc
+Type=GCC
+
+[Filters]
+size=10
+
+[Filters][0]
+inclusive=0
+pattern=.*
+targets=3
+
+[Filters][1]
+inclusive=0
+pattern=.svn
+targets=2
+
+[Filters][2]
+inclusive=0
+pattern=.hg
+targets=2
+
+[Filters][3]
+inclusive=0
+pattern=.git
+targets=2
+
+[Filters][4]
+inclusive=0
+pattern=*.rej
+targets=1
+
+[Filters][5]
+inclusive=0
+pattern=*.orig
+targets=1
+
+[Filters][6]
+inclusive=0
+pattern=*~
+targets=1
+
+[Filters][7]
+inclusive=0
+pattern=.*.kate-swp
+targets=1
+
+[Filters][8]
+inclusive=0
+pattern=.*.swp
+targets=1
+
+[Filters][9]
+inclusive=0
+pattern=/objs
+targets=2
+
+[Launch]
+Launch Configurations=Launch Configuration 0
+
+[Launch][Launch Configuration 0]
+Configured Launch Modes=execute
+Configured Launchers=nativeAppLauncher
+Name=Launch OpenTTD\s
+Type=Native Application
+
+[Launch][Launch Configuration 0][Data]
+Arguments=-d 1
+Dependencies=@Variant(\x00\x00\x00\t\x00\x00\x00\x00\x00)
+Dependency Action=Nothing
+EnvironmentGroup=
+Executable=file://!!PROJECT_DIR!!/bin/openttd
+External Terminal=konsole --noclose --workdir %workdir -e %exe
+Project Target=
+Use External Terminal=false
+Working Directory=file://!!PROJECT_DIR!!/bin
+isExecutable=true
+EOF
diff --git a/projects/openttd_vs100.vcxproj b/projects/openttd_vs100.vcxproj
index a7abe4d1ab..642f3a43d3 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
+
@@ -667,6 +679,8 @@
+
+
diff --git a/projects/openttd_vs100.vcxproj.filters b/projects/openttd_vs100.vcxproj.filters
index d996963c06..54cd94e730 100644
--- a/projects/openttd_vs100.vcxproj.filters
+++ b/projects/openttd_vs100.vcxproj.filters
@@ -1230,6 +1230,12 @@
Core Source Code
+
+ Core Source Code
+
+
+ Core Source Code
+
Core Source Code
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 67acda0402..675c8546f4 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
+
@@ -684,6 +696,8 @@
+
+
diff --git a/projects/openttd_vs140.vcxproj.filters b/projects/openttd_vs140.vcxproj.filters
index d996963c06..54cd94e730 100644
--- a/projects/openttd_vs140.vcxproj.filters
+++ b/projects/openttd_vs140.vcxproj.filters
@@ -1230,6 +1230,12 @@
Core Source Code
+
+ Core Source Code
+
+
+ Core Source Code
+
Core Source Code
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/projects/openttd_vs80.vcproj b/projects/openttd_vs80.vcproj
index fcd9c0e3a3..afb125acf2 100644
--- a/projects/openttd_vs80.vcproj
+++ b/projects/openttd_vs80.vcproj
@@ -1946,6 +1946,14 @@
RelativePath=".\..\src\core\bitmath_func.hpp"
>
+
+
+
+
diff --git a/projects/openttd_vs90.vcproj b/projects/openttd_vs90.vcproj
index cd5eea9d4e..f35a14ece5 100644
--- a/projects/openttd_vs90.vcproj
+++ b/projects/openttd_vs90.vcproj
@@ -1943,6 +1943,14 @@
RelativePath=".\..\src\core\bitmath_func.hpp"
>
+
+
+
+
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 635cb35a36..1136c894f5 100644
--- a/source.list
+++ b/source.list
@@ -424,6 +424,8 @@ core/alloc_type.hpp
core/backup_type.hpp
core/bitmath_func.cpp
core/bitmath_func.hpp
+core/container_func.hpp
+core/dyn_arena_alloc.hpp
core/endian_func.hpp
core/endian_type.hpp
core/enum_type.hpp
diff --git a/src/3rdparty/squirrel/squirrel/sqvm.cpp b/src/3rdparty/squirrel/squirrel/sqvm.cpp
index 973002b49d..c66c4aca59 100644
--- a/src/3rdparty/squirrel/squirrel/sqvm.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqvm.cpp
@@ -215,7 +215,7 @@ bool SQVM::ObjCmp(const SQObjectPtr &o1,const SQObjectPtr &o2,SQInteger &result)
_RET_SUCCEED(_integer(res))
}
}
- //continues through (no break needed)
+ FALLTHROUGH;
default:
_RET_SUCCEED( _userpointer(o1) < _userpointer(o2)?-1:1 );
}
@@ -287,6 +287,7 @@ void SQVM::ToString(const SQObjectPtr &o,SQObjectPtr &res)
//else keeps going to the default
}
}
+ FALLTHROUGH;
default:
seprintf(buf, lastof(buf),"(%s : 0x%p)",GetTypeName(o),(void*)_rawval(o));
}
@@ -539,7 +540,7 @@ bool SQVM::FOREACH_OP(SQObjectPtr &o1,SQObjectPtr &o2,SQObjectPtr
_generator(o1)->Resume(this, arg_2+1);
_FINISH(0);
}
- /* FALL THROUGH */
+ FALLTHROUGH;
default:
Raise_Error("cannot iterate %s", GetTypeName(o1));
}
@@ -769,7 +770,7 @@ exception_restore:
ct_stackbase = _stackbase;
goto common_call;
}
- /* FALL THROUGH */
+ FALLTHROUGH;
case _OP_CALL: {
ct_tailcall = false;
ct_target = arg0;
@@ -1101,7 +1102,7 @@ exception_trap:
_lasterror = currerror;
return false;
}
- assert(0);
+ NOT_REACHED();
}
bool SQVM::CreateClassInstance(SQClass *theclass, SQObjectPtr &inst, SQObjectPtr &constructor)
@@ -1330,7 +1331,7 @@ bool SQVM::Set(const SQObjectPtr &self,const SQObjectPtr &key,const SQObjectPtr
return true;
}
}
- //keeps going
+ FALLTHROUGH;
case OT_USERDATA:
if(_delegable(self)->_delegate) {
SQObjectPtr t;
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/ai/ai_scanner.cpp b/src/ai/ai_scanner.cpp
index 4eb2071479..5f16de3f91 100644
--- a/src/ai/ai_scanner.cpp
+++ b/src/ai/ai_scanner.cpp
@@ -114,7 +114,7 @@ AIInfo *AIScannerInfo::FindInfo(const char *nameParam, int versionParam, bool fo
*e = '\0';
e++;
versionParam = atoi(e);
- /* FALL THROUGH, like we were calling this function with a version. */
+ /* Continue, like we were calling this function with a version. */
}
if (force_exact_match) {
diff --git a/src/aircraft.h b/src/aircraft.h
index 0805ae8ec6..f0ca1c4abb 100644
--- a/src/aircraft.h
+++ b/src/aircraft.h
@@ -93,7 +93,7 @@ struct Aircraft FINAL : public SpecializedVehicle {
void UpdateDeltaXY(Direction direction);
ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_AIRCRAFT_INC : EXPENSES_AIRCRAFT_RUN; }
bool IsPrimaryVehicle() const { return this->IsNormalAircraft(); }
- SpriteID GetImage(Direction direction, EngineImageType image_type) const;
+ void GetImage(Direction direction, EngineImageType image_type, VehicleSpriteSeq *result) const;
int GetDisplaySpeed() const { return this->cur_speed; }
int GetDisplayMaxSpeed() const { return this->vcache.cached_max_speed; }
int GetSpeedOldUnits() const { return this->vcache.cached_max_speed * 10 / 128; }
@@ -141,7 +141,7 @@ struct Aircraft FINAL : public SpecializedVehicle {
*/
#define FOR_ALL_AIRCRAFT(var) FOR_ALL_VEHICLES_OF_TYPE(Aircraft, var)
-SpriteID GetRotorImage(const Aircraft *v, EngineImageType image_type);
+void GetRotorImage(const Aircraft *v, EngineImageType image_type, VehicleSpriteSeq *result);
Station *GetTargetAirportIfValid(const Aircraft *v);
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index edb10af327..c9cddbf97d 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -152,64 +152,69 @@ static StationID FindNearestHangar(const Aircraft *v)
return index;
}
-SpriteID Aircraft::GetImage(Direction direction, EngineImageType image_type) const
+void Aircraft::GetImage(Direction direction, EngineImageType image_type, VehicleSpriteSeq *result) const
{
uint8 spritenum = this->spritenum;
if (is_custom_sprite(spritenum)) {
- SpriteID sprite = GetCustomVehicleSprite(this, direction, image_type);
- if (sprite != 0) return sprite;
+ GetCustomVehicleSprite(this, direction, image_type, result);
+ if (result->IsValid()) return;
spritenum = this->GetEngine()->original_image_index;
}
assert(IsValidImageIndex(spritenum));
- return direction + _aircraft_sprite[spritenum];
+ result->Set(direction + _aircraft_sprite[spritenum]);
}
-SpriteID GetRotorImage(const Aircraft *v, EngineImageType image_type)
+void GetRotorImage(const Aircraft *v, EngineImageType image_type, VehicleSpriteSeq *result)
{
assert(v->subtype == AIR_HELICOPTER);
const Aircraft *w = v->Next()->Next();
if (is_custom_sprite(v->spritenum)) {
- SpriteID sprite = GetCustomRotorSprite(v, false, image_type);
- if (sprite != 0) return sprite;
+ GetCustomRotorSprite(v, false, image_type, result);
+ if (result->IsValid()) return;
}
/* Return standard rotor sprites if there are no custom sprites for this helicopter */
- return SPR_ROTOR_STOPPED + w->state;
+ result->Set(SPR_ROTOR_STOPPED + w->state);
}
-static SpriteID GetAircraftIcon(EngineID engine, EngineImageType image_type)
+static void GetAircraftIcon(EngineID engine, EngineImageType image_type, VehicleSpriteSeq *result)
{
const Engine *e = Engine::Get(engine);
uint8 spritenum = e->u.air.image_index;
if (is_custom_sprite(spritenum)) {
- SpriteID sprite = GetCustomVehicleIcon(engine, DIR_W, image_type);
- if (sprite != 0) return sprite;
+ GetCustomVehicleIcon(engine, DIR_W, image_type, result);
+ if (result->IsValid()) return;
spritenum = e->original_image_index;
}
assert(IsValidImageIndex(spritenum));
- return DIR_W + _aircraft_sprite[spritenum];
+ result->Set(DIR_W + _aircraft_sprite[spritenum]);
}
void DrawAircraftEngine(int left, int right, int preferred_x, int y, EngineID engine, PaletteID pal, EngineImageType image_type)
{
- SpriteID sprite = GetAircraftIcon(engine, image_type);
- const Sprite *real_sprite = GetSprite(sprite, ST_NORMAL);
+ VehicleSpriteSeq seq;
+ GetAircraftIcon(engine, image_type, &seq);
+
+ Rect rect;
+ seq.GetBounds(&rect);
preferred_x = Clamp(preferred_x,
- left - UnScaleGUI(real_sprite->x_offs),
- right - UnScaleGUI(real_sprite->width) - UnScaleGUI(real_sprite->x_offs));
- DrawSprite(sprite, pal, preferred_x, y);
+ left - UnScaleGUI(rect.left),
+ right - UnScaleGUI(rect.right));
+
+ seq.Draw(preferred_x, y, pal, pal == PALETTE_CRASH);
if (!(AircraftVehInfo(engine)->subtype & AIR_CTOL)) {
- SpriteID rotor_sprite = GetCustomRotorIcon(engine, image_type);
- if (rotor_sprite == 0) rotor_sprite = SPR_ROTOR_STOPPED;
- DrawSprite(rotor_sprite, PAL_NONE, preferred_x, y - ScaleGUITrad(5));
+ VehicleSpriteSeq rotor_seq;
+ GetCustomRotorIcon(engine, image_type, &rotor_seq);
+ if (!rotor_seq.IsValid()) rotor_seq.Set(SPR_ROTOR_STOPPED);
+ rotor_seq.Draw(preferred_x, y - ScaleGUITrad(5), PAL_NONE, false);
}
}
@@ -224,12 +229,16 @@ void DrawAircraftEngine(int left, int right, int preferred_x, int y, EngineID en
*/
void GetAircraftSpriteSize(EngineID engine, uint &width, uint &height, int &xoffs, int &yoffs, EngineImageType image_type)
{
- const Sprite *spr = GetSprite(GetAircraftIcon(engine, image_type), ST_NORMAL);
+ VehicleSpriteSeq seq;
+ GetAircraftIcon(engine, image_type, &seq);
- width = UnScaleGUI(spr->width);
- height = UnScaleGUI(spr->height);
- xoffs = UnScaleGUI(spr->x_offs);
- yoffs = UnScaleGUI(spr->y_offs);
+ Rect rect;
+ seq.GetBounds(&rect);
+
+ width = UnScaleGUI(rect.right - rect.left + 1);
+ height = UnScaleGUI(rect.bottom - rect.top + 1);
+ xoffs = UnScaleGUI(rect.left);
+ yoffs = UnScaleGUI(rect.top);
}
/**
@@ -317,7 +326,8 @@ CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, const Engine *
v->date_of_last_service = _date;
v->build_year = u->build_year = _cur_year;
- v->cur_image = u->cur_image = SPR_IMG_QUERY;
+ v->sprite_seq.Set(SPR_IMG_QUERY);
+ u->sprite_seq.Set(SPR_IMG_QUERY);
v->random_bits = VehicleRandomBits();
u->random_bits = VehicleRandomBits();
@@ -349,7 +359,7 @@ CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, const Engine *
w->vehstatus = VS_HIDDEN | VS_UNCLICKABLE;
w->spritenum = 0xFF;
w->subtype = AIR_ROTOR;
- w->cur_image = SPR_ROTOR_STOPPED;
+ w->sprite_seq.Set(SPR_ROTOR_STOPPED);
w->random_bits = VehicleRandomBits();
/* Use rotor's air.state to store the rotor animation frame */
w->state = HRS_ROTOR_STOPPED;
@@ -468,21 +478,21 @@ static void HelicopterTickHandler(Aircraft *v)
int tick = ++u->tick_counter;
int spd = u->cur_speed >> 4;
- SpriteID img;
+ VehicleSpriteSeq seq;
if (spd == 0) {
u->state = HRS_ROTOR_STOPPED;
- img = GetRotorImage(v, EIT_ON_MAP);
- if (u->cur_image == img) return;
+ GetRotorImage(v, EIT_ON_MAP, &seq);
+ if (u->sprite_seq == seq) return;
} else if (tick >= spd) {
u->tick_counter = 0;
u->state++;
if (u->state > HRS_ROTOR_MOVING_3) u->state = HRS_ROTOR_MOVING_1;
- img = GetRotorImage(v, EIT_ON_MAP);
+ GetRotorImage(v, EIT_ON_MAP, &seq);
} else {
return;
}
- u->cur_image = img;
+ u->sprite_seq = seq;
u->UpdatePositionAndViewport();
}
@@ -502,7 +512,9 @@ void SetAircraftPosition(Aircraft *v, int x, int y, int z)
v->UpdatePosition();
v->UpdateViewport(true, false);
- if (v->subtype == AIR_HELICOPTER) v->Next()->Next()->cur_image = GetRotorImage(v, EIT_ON_MAP);
+ if (v->subtype == AIR_HELICOPTER) {
+ GetRotorImage(v, EIT_ON_MAP, &v->Next()->Next()->sprite_seq);
+ }
Aircraft *u = v->Next();
@@ -513,7 +525,7 @@ void SetAircraftPosition(Aircraft *v, int x, int y, int z)
safe_y = Clamp(u->y_pos, 0, MapMaxY() * TILE_SIZE);
u->z_pos = GetSlopePixelZ(safe_x, safe_y);
- u->cur_image = v->cur_image;
+ u->sprite_seq.CopyWithoutPalette(v->sprite_seq); // the shadow is never coloured
u->UpdatePositionAndViewport();
@@ -1237,7 +1249,9 @@ void Aircraft::MarkDirty()
{
this->colourmap = PAL_NONE;
this->UpdateViewport(true, false);
- if (this->subtype == AIR_HELICOPTER) this->Next()->Next()->cur_image = GetRotorImage(this, EIT_ON_MAP);
+ if (this->subtype == AIR_HELICOPTER) {
+ GetRotorImage(this, EIT_ON_MAP, &this->Next()->Next()->sprite_seq);
+ }
}
diff --git a/src/aircraft_gui.cpp b/src/aircraft_gui.cpp
index c3379d3951..6693b1f8ad 100644
--- a/src/aircraft_gui.cpp
+++ b/src/aircraft_gui.cpp
@@ -83,11 +83,14 @@ void DrawAircraftImage(const Vehicle *v, int left, int right, int y, VehicleID s
{
bool rtl = _current_text_dir == TD_RTL;
- SpriteID sprite = v->GetImage(rtl ? DIR_E : DIR_W, image_type);
- const Sprite *real_sprite = GetSprite(sprite, ST_NORMAL);
+ VehicleSpriteSeq seq;
+ v->GetImage(rtl ? DIR_E : DIR_W, image_type, &seq);
- int width = UnScaleGUI(real_sprite->width);
- int x_offs = UnScaleGUI(real_sprite->x_offs);
+ Rect rect;
+ seq.GetBounds(&rect);
+
+ int width = UnScaleGUI(rect.right - rect.left + 1);
+ int x_offs = UnScaleGUI(rect.left);
int x = rtl ? right - width - x_offs : left - x_offs;
bool helicopter = v->subtype == AIR_HELICOPTER;
@@ -95,17 +98,18 @@ void DrawAircraftImage(const Vehicle *v, int left, int right, int y, VehicleID s
int heli_offs = 0;
PaletteID pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v);
- DrawSprite(sprite, pal, x, y + y_offs);
+ seq.Draw(x, y + y_offs, pal, (v->vehstatus & VS_CRASHED) != 0);
if (helicopter) {
const Aircraft *a = Aircraft::From(v);
- SpriteID rotor_sprite = GetCustomRotorSprite(a, true, image_type);
- if (rotor_sprite == 0) rotor_sprite = SPR_ROTOR_STOPPED;
+ VehicleSpriteSeq rotor_seq;
+ GetCustomRotorSprite(a, true, image_type, &rotor_seq);
+ if (!rotor_seq.IsValid()) rotor_seq.Set(SPR_ROTOR_STOPPED);
heli_offs = ScaleGUITrad(5);
- DrawSprite(rotor_sprite, PAL_NONE, x, y + y_offs - heli_offs);
+ rotor_seq.Draw(x, y + y_offs - heli_offs, PAL_NONE, false);
}
if (v->index == selection) {
x += x_offs;
- y += UnScaleGUI(real_sprite->y_offs) + y_offs - heli_offs;
- DrawFrameRect(x - 1, y - 1, x + width + 1, y + UnScaleGUI(real_sprite->height) + heli_offs + 1, COLOUR_WHITE, FR_BORDERONLY);
+ y += UnScaleGUI(rect.top) + y_offs - heli_offs;
+ DrawFrameRect(x - 1, y - 1, x + width + 1, y + UnScaleGUI(rect.bottom - rect.top + 1) + heli_offs + 1, COLOUR_WHITE, FR_BORDERONLY);
}
}
diff --git a/src/articulated_vehicles.cpp b/src/articulated_vehicles.cpp
index 8c372e7eae..04c9f95a97 100644
--- a/src/articulated_vehicles.cpp
+++ b/src/articulated_vehicles.cpp
@@ -441,7 +441,7 @@ void AddArticulatedParts(Vehicle *first)
v->max_age = 0;
v->engine_type = engine_type;
v->value = 0;
- v->cur_image = SPR_IMG_QUERY;
+ v->sprite_seq.Set(SPR_IMG_QUERY);
v->random_bits = VehicleRandomBits();
if (flip_image) v->spritenum++;
diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp
index 691042a1d5..1074d1dd78 100644
--- a/src/autoreplace_gui.cpp
+++ b/src/autoreplace_gui.cpp
@@ -87,7 +87,7 @@ class ReplaceVehicleWindow : public Window {
byte sort_criteria; ///< Criteria of sorting vehicles.
bool descending_sort_order; ///< Order of sorting vehicles.
bool show_hidden_engines; ///< Whether to show the hidden engines.
- RailType sel_railtype; ///< Type of rail tracks selected.
+ RailType sel_railtype; ///< Type of rail tracks selected. #INVALID_RAILTYPE to show all.
Scrollbar *vscroll[2];
/**
@@ -104,7 +104,7 @@ class ReplaceVehicleWindow : public Window {
/* Ensure that the wagon/engine selection fits the engine. */
if ((rvi->railveh_type == RAILVEH_WAGON) == show_engines) return false;
- if (draw_left && show_engines) {
+ if (draw_left && this->sel_railtype != INVALID_RAILTYPE) {
/* Ensure that the railtype is specific to the selected one */
if (rvi->railtype != this->sel_railtype) return false;
}
@@ -211,24 +211,7 @@ class ReplaceVehicleWindow : public Window {
public:
ReplaceVehicleWindow(WindowDesc *desc, VehicleType vehicletype, GroupID id_g) : Window(desc)
{
- if (vehicletype == VEH_TRAIN) {
- /* For rail vehicles find the most used vehicle type, which is usually
- * better than 'just' the first/previous vehicle type. */
- uint type_count[RAILTYPE_END];
- memset(type_count, 0, sizeof(type_count));
-
- const Engine *e;
- FOR_ALL_ENGINES_OF_TYPE(e, VEH_TRAIN) {
- if (e->u.rail.railveh_type == RAILVEH_WAGON) continue;
- type_count[e->u.rail.railtype] += GetGroupNumEngines(_local_company, id_g, e->index);
- }
-
- this->sel_railtype = RAILTYPE_BEGIN;
- for (RailType rt = RAILTYPE_BEGIN; rt < RAILTYPE_END; rt++) {
- if (type_count[this->sel_railtype] < type_count[rt]) this->sel_railtype = rt;
- }
- }
-
+ this->sel_railtype = INVALID_RAILTYPE;
this->replace_engines = true; // start with locomotives (all other vehicles will not read this bool)
this->engines[0].ForceRebuild();
this->engines[1].ForceRebuild();
@@ -288,12 +271,9 @@ public:
break;
}
- case WID_RV_TRAIN_ENGINEWAGON_TOGGLE: {
- StringID str = this->GetWidget(widget)->widget_data;
- SetDParam(0, STR_REPLACE_ENGINES);
- Dimension d = GetStringBoundingBox(str);
- SetDParam(0, STR_REPLACE_WAGONS);
- d = maxdim(d, GetStringBoundingBox(str));
+ case WID_RV_TRAIN_ENGINEWAGON_DROPDOWN: {
+ Dimension d = GetStringBoundingBox(STR_REPLACE_ENGINES);
+ d = maxdim(d, GetStringBoundingBox(STR_REPLACE_WAGONS));
d.width += padding.width;
d.height += padding.height;
*size = maxdim(*size, d);
@@ -367,7 +347,7 @@ public:
break;
}
- case WID_RV_TRAIN_ENGINEWAGON_TOGGLE:
+ case WID_RV_TRAIN_ENGINEWAGON_DROPDOWN:
SetDParam(0, this->replace_engines ? STR_REPLACE_ENGINES : STR_REPLACE_WAGONS);
break;
}
@@ -432,12 +412,8 @@ public:
this->SetWidgetDisabledState(WID_RV_STOP_REPLACE, this->sel_engine[0] == INVALID_ENGINE || !EngineHasReplacementForCompany(c, this->sel_engine[0], this->sel_group));
if (this->window_number == VEH_TRAIN) {
- /* sets the colour of that art thing */
- this->GetWidget(WID_RV_TRAIN_FLUFF_LEFT)->colour = _company_colours[_local_company];
- this->GetWidget(WID_RV_TRAIN_FLUFF_RIGHT)->colour = _company_colours[_local_company];
-
/* Show the selected railtype in the pulldown menu */
- this->GetWidget(WID_RV_TRAIN_RAILTYPE_DROPDOWN)->widget_data = GetRailTypeInfo(sel_railtype)->strings.replace_text;
+ this->GetWidget(WID_RV_TRAIN_RAILTYPE_DROPDOWN)->widget_data = sel_railtype == INVALID_RAILTYPE ? STR_REPLACE_ALL_RAILTYPE : GetRailTypeInfo(sel_railtype)->strings.replace_text;
}
this->DrawWidgets();
@@ -483,15 +459,16 @@ public:
DisplayVehicleSortDropDown(this, static_cast(this->window_number), this->sort_criteria, WID_RV_SORT_DROPDOWN);
break;
- case WID_RV_TRAIN_ENGINEWAGON_TOGGLE:
- this->replace_engines = !(this->replace_engines);
- this->engines[0].ForceRebuild();
- this->reset_sel_engine = true;
- this->SetDirty();
+ case WID_RV_TRAIN_ENGINEWAGON_DROPDOWN: {
+ DropDownList *list = new DropDownList();
+ *list->Append() = new DropDownListStringItem(STR_REPLACE_ENGINES, 1, false);
+ *list->Append() = new DropDownListStringItem(STR_REPLACE_WAGONS, 0, false);
+ ShowDropDownList(this, list, this->replace_engines ? 1 : 0, WID_RV_TRAIN_ENGINEWAGON_DROPDOWN);
break;
+ }
case WID_RV_TRAIN_RAILTYPE_DROPDOWN: // Railtype selection dropdown menu
- ShowDropDownList(this, GetRailTypeDropDownList(true), sel_railtype, WID_RV_TRAIN_RAILTYPE_DROPDOWN);
+ ShowDropDownList(this, GetRailTypeDropDownList(true, true), sel_railtype, WID_RV_TRAIN_RAILTYPE_DROPDOWN);
break;
case WID_RV_TRAIN_WAGONREMOVE_TOGGLE: // toggle renew_keep_length
@@ -566,6 +543,14 @@ public:
break;
}
+ case WID_RV_TRAIN_ENGINEWAGON_DROPDOWN: {
+ this->replace_engines = index != 0;
+ this->engines[0].ForceRebuild();
+ this->reset_sel_engine = true;
+ this->SetDirty();
+ break;
+ }
+
case WID_RV_START_REPLACE:
this->ReplaceClick_StartReplace(index != 0);
break;
@@ -611,7 +596,13 @@ static const NWidgetPart _nested_replace_rail_vehicle_widgets[] = {
EndContainer(),
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
- NWidget(WWT_PANEL, COLOUR_GREY), SetResize(1, 0), EndContainer(),
+ NWidget(NWID_VERTICAL),
+ NWidget(NWID_HORIZONTAL),
+ NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_RV_TRAIN_RAILTYPE_DROPDOWN), SetMinimalSize(136, 12), SetDataTip(0x0, STR_REPLACE_HELP_RAILTYPE), SetFill(1, 0), SetResize(1, 0),
+ NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_RV_TRAIN_ENGINEWAGON_DROPDOWN), SetDataTip(STR_BLACK_STRING, STR_REPLACE_ENGINE_WAGON_SELECT_HELP),
+ EndContainer(),
+ NWidget(WWT_PANEL, COLOUR_GREY), SetResize(1, 0), EndContainer(),
+ EndContainer(),
NWidget(NWID_VERTICAL),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_RV_SORT_ASCENDING_DESCENDING), SetDataTip(STR_BUTTON_SORT_BY, STR_TOOLTIP_SORT_ORDER), SetFill(1, 1),
@@ -631,20 +622,16 @@ static const NWidgetPart _nested_replace_rail_vehicle_widgets[] = {
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_LEFT_DETAILS), SetMinimalSize(240, 122), SetResize(1, 0), EndContainer(),
- NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_RIGHT_DETAILS), SetMinimalSize(240, 122), SetResize(1, 0), EndContainer(),
+ NWidget(NWID_VERTICAL),
+ NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_RIGHT_DETAILS), SetMinimalSize(240, 122), SetResize(1, 0), EndContainer(),
+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_RV_TRAIN_WAGONREMOVE_TOGGLE), SetMinimalSize(138, 12), SetDataTip(STR_REPLACE_REMOVE_WAGON, STR_REPLACE_REMOVE_WAGON_HELP), SetFill(1, 0), SetResize(1, 0),
+ EndContainer(),
EndContainer(),
NWidget(NWID_HORIZONTAL),
NWidget(NWID_PUSHBUTTON_DROPDOWN, COLOUR_GREY, WID_RV_START_REPLACE), SetMinimalSize(139, 12), SetDataTip(STR_REPLACE_VEHICLES_START, STR_REPLACE_HELP_START_BUTTON),
NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_INFO_TAB), SetMinimalSize(167, 12), SetDataTip(0x0, STR_REPLACE_HELP_REPLACE_INFO_TAB), SetResize(1, 0),
EndContainer(),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_RV_STOP_REPLACE), SetMinimalSize(150, 12), SetDataTip(STR_REPLACE_VEHICLES_STOP, STR_REPLACE_HELP_STOP_BUTTON),
- EndContainer(),
- NWidget(NWID_HORIZONTAL),
- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_RV_TRAIN_ENGINEWAGON_TOGGLE), SetMinimalSize(139, 12), SetDataTip(STR_REPLACE_ENGINE_WAGON_SELECT, STR_REPLACE_ENGINE_WAGON_SELECT_HELP),
- NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_TRAIN_FLUFF_LEFT), SetMinimalSize(15, 12), EndContainer(),
- NWidget(WWT_DROPDOWN, COLOUR_GREY, WID_RV_TRAIN_RAILTYPE_DROPDOWN), SetMinimalSize(136, 12), SetDataTip(0x0, STR_REPLACE_HELP_RAILTYPE), SetResize(1, 0),
- NWidget(WWT_PANEL, COLOUR_GREY, WID_RV_TRAIN_FLUFF_RIGHT), SetMinimalSize(16, 12), EndContainer(),
- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_RV_TRAIN_WAGONREMOVE_TOGGLE), SetMinimalSize(138, 12), SetDataTip(STR_REPLACE_REMOVE_WAGON, STR_REPLACE_REMOVE_WAGON_HELP),
NWidget(WWT_RESIZEBOX, COLOUR_GREY),
EndContainer(),
};
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/blitter/8bpp_simple.cpp b/src/blitter/8bpp_simple.cpp
index ed5dd3f7ae..2131a04682 100644
--- a/src/blitter/8bpp_simple.cpp
+++ b/src/blitter/8bpp_simple.cpp
@@ -48,7 +48,7 @@ void Blitter_8bppSimple::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Zoom
break;
case BM_BLACK_REMAP:
- colour = 0;
+ if (*src != 0) *dst = 0;
break;
default:
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/clear_cmd.cpp b/src/clear_cmd.cpp
index 2e9589aee2..f9eb88df54 100644
--- a/src/clear_cmd.cpp
+++ b/src/clear_cmd.cpp
@@ -56,7 +56,7 @@ void DrawHillyLandTile(const TileInfo *ti)
if (ti->tileh != SLOPE_FLAT) {
DrawGroundSprite(SPR_FLAT_ROUGH_LAND + SlopeToSpriteOffset(ti->tileh), PAL_NONE);
} else {
- DrawGroundSprite(_landscape_clear_sprites_rough[GB(ti->x ^ ti->y, 4, 3)], PAL_NONE);
+ DrawGroundSprite(_landscape_clear_sprites_rough[GB(TileHash(ti->x, ti->y), 0, 3)], PAL_NONE);
}
}
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/company_cmd.cpp b/src/company_cmd.cpp
index 577ea884d8..ee2ed13355 100644
--- a/src/company_cmd.cpp
+++ b/src/company_cmd.cpp
@@ -162,7 +162,7 @@ static bool IsValidCompanyManagerFace(CompanyManagerFace cmf)
for (CompanyManagerFaceVariable cmfv = CMFV_CHEEKS; cmfv < CMFV_END; cmfv++) {
switch (cmfv) {
case CMFV_MOUSTACHE: if (!has_moustache) continue; break;
- case CMFV_LIPS: // FALL THROUGH
+ case CMFV_LIPS:
case CMFV_NOSE: if (has_moustache) continue; break;
case CMFV_TIE_EARRING: if (!has_tie_earring) continue; break;
case CMFV_GLASSES: if (!has_glasses) continue; break;
diff --git a/src/company_gui.cpp b/src/company_gui.cpp
index 0be6679583..31d4fdd1f0 100644
--- a/src/company_gui.cpp
+++ b/src/company_gui.cpp
@@ -318,7 +318,8 @@ struct CompanyFinancesWindow : Window {
case WID_CF_EXPS_PRICE2:
case WID_CF_EXPS_PRICE3:
size->height = _expenses_list_types[type].GetHeight();
- /* FALL THROUGH */
+ FALLTHROUGH;
+
case WID_CF_BALANCE_VALUE:
case WID_CF_LOAN_VALUE:
case WID_CF_TOTAL_VALUE:
@@ -636,7 +637,8 @@ public:
size->width = 0;
break;
}
- /* FALL THROUGH */
+ FALLTHROUGH;
+
case WID_SCL_PRI_COL_DROPDOWN: {
int padding = this->square.width + NWidgetScrollbar::GetVerticalDimension().width + 10;
for (const StringID *id = _colour_dropdown; id != endof(_colour_dropdown); id++) {
@@ -892,7 +894,7 @@ void DrawCompanyManagerFace(CompanyManagerFace cmf, int colour, int x, int y)
for (CompanyManagerFaceVariable cmfv = CMFV_CHEEKS; cmfv < CMFV_END; cmfv++) {
switch (cmfv) {
case CMFV_MOUSTACHE: if (!has_moustache) continue; break;
- case CMFV_LIPS: // FALL THROUGH
+ case CMFV_LIPS:
case CMFV_NOSE: if (has_moustache) continue; break;
case CMFV_TIE_EARRING: if (!has_tie_earring) continue; break;
case CMFV_GLASSES: if (!has_glasses) continue; break;
@@ -1365,7 +1367,7 @@ public:
/* OK button */
case WID_SCMF_ACCEPT:
DoCommandP(0, 0, this->face, CMD_SET_COMPANY_MANAGER_FACE);
- /* FALL THROUGH */
+ FALLTHROUGH;
/* Cancel button */
case WID_SCMF_CANCEL:
@@ -2381,7 +2383,7 @@ struct CompanyWindow : Window
virtual void OnPlaceObject(Point pt, TileIndex tile)
{
- if (DoCommandP(tile, OBJECT_HQ, 0, CMD_BUILD_OBJECT | CMD_MSG(STR_ERROR_CAN_T_BUILD_COMPANY_HEADQUARTERS))) {
+ if (DoCommandP(tile, OBJECT_HQ, 0, CMD_BUILD_OBJECT | CMD_MSG(STR_ERROR_CAN_T_BUILD_COMPANY_HEADQUARTERS)) && !_shift_pressed) {
ResetObjectToPlace();
this->RaiseButtons();
}
diff --git a/src/console.cpp b/src/console.cpp
index 24a528d8a4..736f6a1575 100644
--- a/src/console.cpp
+++ b/src/console.cpp
@@ -435,7 +435,10 @@ void IConsoleCmdExec(const char *cmdstr)
* enclosed in "" are taken as one token. We can only go as far as the amount
* of characters in our stream or the max amount of tokens we can handle */
for (cmdptr = cmdstr, t_index = 0, tstream_i = 0; *cmdptr != '\0'; cmdptr++) {
- if (t_index >= lengthof(tokens) || tstream_i >= lengthof(tokenstream)) break;
+ if (tstream_i >= lengthof(tokenstream)) {
+ IConsoleError("command line too long");
+ return;
+ }
switch (*cmdptr) {
case ' ': // Token separator
@@ -453,6 +456,10 @@ void IConsoleCmdExec(const char *cmdstr)
case '"': // Tokens enclosed in "" are one token
longtoken = !longtoken;
if (!foundtoken) {
+ if (t_index >= lengthof(tokens)) {
+ IConsoleError("command line too long");
+ return;
+ }
tokens[t_index++] = &tokenstream[tstream_i];
foundtoken = true;
}
@@ -462,11 +469,15 @@ void IConsoleCmdExec(const char *cmdstr)
tokenstream[tstream_i++] = *++cmdptr;
break;
}
- /* FALL THROUGH */
+ FALLTHROUGH;
default: // Normal character
tokenstream[tstream_i++] = *cmdptr;
if (!foundtoken) {
+ if (t_index >= lengthof(tokens)) {
+ IConsoleError("command line too long");
+ return;
+ }
tokens[t_index++] = &tokenstream[tstream_i - 1];
foundtoken = true;
}
@@ -474,7 +485,7 @@ void IConsoleCmdExec(const char *cmdstr)
}
}
- for (uint i = 0; tokens[i] != NULL; i++) {
+ for (uint i = 0; i < lengthof(tokens) && tokens[i] != NULL; i++) {
DEBUG(console, 8, "Token %d is: '%s'", i, tokens[i]);
}
diff --git a/src/core/container_func.hpp b/src/core/container_func.hpp
new file mode 100644
index 0000000000..276c1f7f54
--- /dev/null
+++ b/src/core/container_func.hpp
@@ -0,0 +1,42 @@
+/* $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. */
+
+#ifndef CONTAINER_FUNC_HPP
+#define CONTAINER_FUNC_HPP
+
+#include
+
+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;
+ });
+}
+
+#endif /* CONTAINER_FUNC_HPP */
diff --git a/src/core/dyn_arena_alloc.hpp b/src/core/dyn_arena_alloc.hpp
new file mode 100644
index 0000000000..2a074d6aa1
--- /dev/null
+++ b/src/core/dyn_arena_alloc.hpp
@@ -0,0 +1,102 @@
+/* $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 dyn_arena_alloc.hpp Dynamic chunk-size arena allocator. */
+
+#ifndef DYN_ARENA_ALLOC_HPP
+#define DYN_ARENA_ALLOC_HPP
+
+#include
+
+/**
+ * Custom arena allocator for uniform-size allocations of a variable size.
+ * The allocation and chunk sizes may only be changed when the arena is empty.
+ */
+class DynUniformArenaAllocator {
+ std::vector used_blocks;
+
+ void *current_block = nullptr;
+ void *last_freed = nullptr;
+ size_t next_position = 0;
+
+ size_t item_size = 0;
+ size_t items_per_chunk = 0;
+
+ void NewBlock()
+ {
+ current_block = malloc(item_size * items_per_chunk);
+ assert(current_block != nullptr);
+ next_position = 0;
+ used_blocks.push_back(current_block);
+ }
+
+ public:
+ DynUniformArenaAllocator() = default;
+ DynUniformArenaAllocator(const DynUniformArenaAllocator &other) = delete;
+ DynUniformArenaAllocator& operator=(const DynUniformArenaAllocator &other) = delete;
+
+ ~DynUniformArenaAllocator()
+ {
+ EmptyArena();
+ }
+
+ void EmptyArena()
+ {
+ current_block = nullptr;
+ last_freed = nullptr;
+ next_position = 0;
+ for (void *block : used_blocks) {
+ free(block);
+ }
+ used_blocks.clear();
+ }
+
+ void ResetArena()
+ {
+ EmptyArena();
+ item_size = 0;
+ items_per_chunk = 0;
+ }
+
+ void *Allocate() {
+ assert(item_size != 0);
+ if (last_freed) {
+ void *ptr = last_freed;
+ last_freed = *reinterpret_cast(ptr);
+ return ptr;
+ } else {
+ if (current_block == nullptr || next_position == items_per_chunk) {
+ NewBlock();
+ }
+ void *out = reinterpret_cast(current_block) + (item_size * next_position);
+ next_position++;
+ return out;
+ }
+ }
+
+ void Free(void *ptr) {
+ if (!ptr) return;
+ assert(current_block != nullptr);
+
+ *reinterpret_cast(ptr) = last_freed;
+ last_freed = ptr;
+ }
+
+ void SetParameters(size_t item_size, size_t items_per_chunk)
+ {
+ if (item_size < sizeof(void *)) item_size = sizeof(void *);
+ if (this->item_size == item_size && this->items_per_chunk == items_per_chunk) return;
+
+ assert(current_block == nullptr);
+ this->item_size = item_size;
+ this->items_per_chunk = items_per_chunk;
+ }
+};
+
+#endif /* DYN_ARENA_ALLOC_HPP */
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