diff --git a/.gitignore b/.gitignore
index e30aabe37c..3e74133dfe 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,6 +13,9 @@ bin/baseset/*
!bin/baseset/no_sound.obs
!bin/baseset/no_music.obm
!bin/baseset/orig_*.obm
+!bin/game
+bin/game/*
+!bin/game/compat*.nut
!bin/scripts
bin/scripts/*
!bin/scripts/*.example
diff --git a/Makefile.src.in b/Makefile.src.in
index 78413af7c5..29d551c22b 100644
--- a/Makefile.src.in
+++ b/Makefile.src.in
@@ -94,6 +94,7 @@ VERSION := $(shell echo "$(VERSIONS)" | cut -f 1 -d' ')
ISODATE := $(shell echo "$(VERSIONS)" | cut -f 2 -d' ')
GITHASH := $(shell echo "$(VERSIONS)" | cut -f 4 -d' ')
ISTAG := $(shell echo "$(VERSIONS)" | cut -f 5 -d' ')
+ISSTABLETAG := $(shell echo "$(VERSIONS)" | cut -f 6 -d' ')
# Make sure we have something in VERSION and ISODATE
ifeq ($(VERSION),)
@@ -281,10 +282,10 @@ endif
# Revision files
$(SRC_DIR)/rev.cpp: $(CONFIG_CACHE_VERSION) $(SRC_DIR)/rev.cpp.in
- $(Q)cat $(SRC_DIR)/rev.cpp.in | sed "s@\!\!ISODATE\!\!@$(ISODATE)@g;s@!!VERSION!!@$(VERSION)@g;s@!!MODIFIED!!@$(MODIFIED)@g;s@!!DATE!!@`date +%d.%m.%y`@g;s@!!GITHASH!!@$(GITHASH)@g;s@!!ISTAG!!@$(ISTAG)@g;s@\!\!CONFIGURE_INVOCATION\!\!@$(CONFIGURE_INVOCATION)@g;" > $(SRC_DIR)/rev.cpp
+ $(Q)cat $(SRC_DIR)/rev.cpp.in | sed "s@\!\!ISODATE\!\!@$(ISODATE)@g;s@!!VERSION!!@$(VERSION)@g;s@!!MODIFIED!!@$(MODIFIED)@g;s@!!DATE!!@`date +%d.%m.%y`@g;s@!!GITHASH!!@$(GITHASH)@g;s@!!ISTAG!!@$(ISTAG)@g;s@!!ISSTABLETAG!!@$(ISSTABLETAG)@g;s@\!\!CONFIGURE_INVOCATION\!\!@$(CONFIGURE_INVOCATION)@g;" > $(SRC_DIR)/rev.cpp
$(SRC_DIR)/os/windows/ottdres.rc: $(CONFIG_CACHE_VERSION) $(SRC_DIR)/os/windows/ottdres.rc.in
- $(Q)cat $(SRC_DIR)/os/windows/ottdres.rc.in | sed "s@\!\!ISODATE\!\!@$(ISODATE)@g;s@!!VERSION!!@$(VERSION)@g;s@!!DATE!!@`date +%d.%m.%y`@g;s@!!GITHASH!!@$(GITHASH)@g;s@!!ISTAG!!@$(ISTAG)@g" > $(SRC_DIR)/os/windows/ottdres.rc
+ $(Q)cat $(SRC_DIR)/os/windows/ottdres.rc.in | sed "s@\!\!ISODATE\!\!@$(ISODATE)@g;s@!!VERSION!!@$(VERSION)@g;s@!!DATE!!@`date +%d.%m.%y`@g;s@!!GITHASH!!@$(GITHASH)@g;s@!!ISTAG!!@$(ISTAG)@g;s@!!ISSTABLETAG!!@$(ISSTABLETAG)@g" > $(SRC_DIR)/os/windows/ottdres.rc
FORCE:
diff --git a/README.md b/README.md
index b62cd2ba7b..544a2ea465 100644
--- a/README.md
+++ b/README.md
@@ -596,22 +596,22 @@ your operating system:
Different types of data or extensions go into different subdirectories of the
chosen main OpenTTD directory:
-| data type | directory | additional info |
-| --- | --- | --- |
-| Config File | (no subdirectory) | |
-| Screenshots | screenshot | |
-| Base Graphics | baseset | (or a subdirectory thereof) |
-| Sound Sets | baseset | (or a subdirectory thereof) |
-| NewGRFs | newgrf | (or a subdirectory thereof) |
-| 32bpp Sets | newgrf | (or a subdirectory thereof) |
-| Music Sets | baseset | (or a subdirectory thereof) |
-| AIs | ai | (or a subdirectory thereof) |
-| AI Libraries | ai/library | (or a subdirectory thereof) |
-| Game Scripts (GS) | game | (or a subdirectory thereof) |
-| GS Libraries | game/library | (or a subdirectory thereof) |
-| Savegames | save | |
-| Automatic Savegames | save/autosave | |
-| Scenarios | scenario | |
+| data type | directory | additional info |
+| ------------------- | ----------------- | --------------------------- |
+| Config File | (no subdirectory) | |
+| Screenshots | screenshot | |
+| Base Graphics | baseset | (or a subdirectory thereof) |
+| Sound Sets | baseset | (or a subdirectory thereof) |
+| NewGRFs | newgrf | (or a subdirectory thereof) |
+| 32bpp Sets | newgrf | (or a subdirectory thereof) |
+| Music Sets | baseset | (or a subdirectory thereof) |
+| AIs | ai | (or a subdirectory thereof) |
+| AI Libraries | ai/library | (or a subdirectory thereof) |
+| Game Scripts (GS) | game | (or a subdirectory thereof) |
+| GS Libraries | game/library | (or a subdirectory thereof) |
+| Savegames | save | |
+| Automatic Savegames | save/autosave | |
+| Scenarios | scenario | |
The (automatically created) directory content_download is for OpenTTD's internal
use and no files should be added to it or its subdirectories manually.
@@ -762,6 +762,12 @@ The following is an explanation of the different statistics:
- *World ticks* - Time spent on other world/landscape processing. This
includes towns growing, building animations, updates of farmland and trees,
and station rating updates.
+- *GS/AI total*, *Game script*, and *AI players* - Time spent running logic
+ for game scripts and AI players. The total may show as less than the current
+ sum of the individual scripts, this is because AI players at lower
+ difficulty settings do not run every game tick, and hence contribute less
+ to the average across all ticks. Keep in mind that the "Current" figure is
+ also an average, just only over short term.
- *Link graph delay* - Time overruns of the cargo distribution link graph
update thread. Usually the link graph is updated in a background thread,
but these updates need to synchronise with the main game loop occasionally,
diff --git a/azure-pipelines-ci.yml b/azure-pipelines-ci.yml
index d624f8ce73..789f8f6a32 100644
--- a/azure-pipelines-ci.yml
+++ b/azure-pipelines-ci.yml
@@ -1,7 +1,9 @@
trigger:
- master
+- release/*
pr:
- master
+- release/*
jobs:
- job: windows
@@ -55,6 +57,9 @@ jobs:
pool:
vmImage: 'macOS-10.13'
+ variables:
+ MACOSX_DEPLOYMENT_TARGET: 10.9
+
steps:
- template: azure-pipelines/templates/ci-git-rebase.yml
- template: azure-pipelines/templates/osx-dependencies.yml
diff --git a/azure-pipelines/templates/osx-dependencies.yml b/azure-pipelines/templates/osx-dependencies.yml
index c4b723c58b..0393a56621 100644
--- a/azure-pipelines/templates/osx-dependencies.yml
+++ b/azure-pipelines/templates/osx-dependencies.yml
@@ -1,11 +1,12 @@
steps:
- script: |
set -ex
- HOMEBREW_NO_AUTO_UPDATE=1 brew install pkg-config lzo xz libpng
+ HOMEBREW_NO_AUTO_UPDATE=1 brew install pkg-config lzo xz libpng freetype
# Remove the dynamic libraries of these libraries, to ensure we use
# the static versions. That is important, as it is unlikely any
# end-user has these brew libraries installed.
rm /usr/local/Cellar/lzo/*/lib/*.dylib
rm /usr/local/Cellar/xz/*/lib/*.dylib
rm /usr/local/Cellar/libpng/*/lib/*.dylib
+ rm /usr/local/Cellar/freetype/*/lib/*.dylib
displayName: 'Install dependencies'
diff --git a/azure-pipelines/templates/release.yml b/azure-pipelines/templates/release.yml
index 86f2be40ed..7628d3c91e 100644
--- a/azure-pipelines/templates/release.yml
+++ b/azure-pipelines/templates/release.yml
@@ -135,6 +135,9 @@ jobs:
vmImage: 'macOS-10.13'
dependsOn: source
+ variables:
+ MACOSX_DEPLOYMENT_TARGET: 10.9
+
steps:
- template: release-fetch-source.yml
- template: osx-dependencies.yml
diff --git a/bin/ai/compat_0.7.nut b/bin/ai/compat_0.7.nut
index 98c03c6731..86ab06bba5 100644
--- a/bin/ai/compat_0.7.nut
+++ b/bin/ai/compat_0.7.nut
@@ -374,3 +374,10 @@ AIBridge.GetName <- function(bridge_id)
{
return AIBridge._GetName(bridge_id, AIVehicle.VT_RAIL);
}
+
+/* 1.9 adds parent_group_id to CreateGroup function */
+AIGroup._CreateGroup <- AIGroup.CreateGroup;
+AIGroup.CreateGroup <- function(vehicle_type)
+{
+ return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
+}
diff --git a/bin/ai/compat_1.0.nut b/bin/ai/compat_1.0.nut
index 627c949cc3..6aa0e1a973 100644
--- a/bin/ai/compat_1.0.nut
+++ b/bin/ai/compat_1.0.nut
@@ -126,3 +126,10 @@ AIBridge.GetName <- function(bridge_id)
{
return AIBridge._GetName(bridge_id, AIVehicle.VT_RAIL);
}
+
+/* 1.9 adds parent_group_id to CreateGroup function */
+AIGroup._CreateGroup <- AIGroup.CreateGroup;
+AIGroup.CreateGroup <- function(vehicle_type)
+{
+ return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
+}
diff --git a/bin/ai/compat_1.1.nut b/bin/ai/compat_1.1.nut
index a47f3d5b16..3d7b7553ee 100644
--- a/bin/ai/compat_1.1.nut
+++ b/bin/ai/compat_1.1.nut
@@ -63,3 +63,10 @@ AIBridge.GetName <- function(bridge_id)
{
return AIBridge._GetName(bridge_id, AIVehicle.VT_RAIL);
}
+
+/* 1.9 adds parent_group_id to CreateGroup function */
+AIGroup._CreateGroup <- AIGroup.CreateGroup;
+AIGroup.CreateGroup <- function(vehicle_type)
+{
+ return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
+}
diff --git a/bin/ai/compat_1.10.nut b/bin/ai/compat_1.10.nut
new file mode 100644
index 0000000000..fe985b90d0
--- /dev/null
+++ b/bin/ai/compat_1.10.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/compat_1.2.nut b/bin/ai/compat_1.2.nut
index 95ccabda24..594ba98352 100644
--- a/bin/ai/compat_1.2.nut
+++ b/bin/ai/compat_1.2.nut
@@ -15,3 +15,10 @@ AIBridge.GetName <- function(bridge_id)
{
return AIBridge._GetName(bridge_id, AIVehicle.VT_RAIL);
}
+
+/* 1.9 adds parent_group_id to CreateGroup function */
+AIGroup._CreateGroup <- AIGroup.CreateGroup;
+AIGroup.CreateGroup <- function(vehicle_type)
+{
+ return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
+}
diff --git a/bin/ai/compat_1.3.nut b/bin/ai/compat_1.3.nut
index fc8e06bf5e..fb0f41d308 100644
--- a/bin/ai/compat_1.3.nut
+++ b/bin/ai/compat_1.3.nut
@@ -15,3 +15,10 @@ AIBridge.GetName <- function(bridge_id)
{
return AIBridge._GetName(bridge_id, AIVehicle.VT_RAIL);
}
+
+/* 1.9 adds parent_group_id to CreateGroup function */
+AIGroup._CreateGroup <- AIGroup.CreateGroup;
+AIGroup.CreateGroup <- function(vehicle_type)
+{
+ return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
+}
diff --git a/bin/ai/compat_1.4.nut b/bin/ai/compat_1.4.nut
index 169ead959d..4bbb971604 100644
--- a/bin/ai/compat_1.4.nut
+++ b/bin/ai/compat_1.4.nut
@@ -15,3 +15,10 @@ AIBridge.GetName <- function(bridge_id)
{
return AIBridge._GetName(bridge_id, AIVehicle.VT_RAIL);
}
+
+/* 1.9 adds parent_group_id to CreateGroup function */
+AIGroup._CreateGroup <- AIGroup.CreateGroup;
+AIGroup.CreateGroup <- function(vehicle_type)
+{
+ return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
+}
diff --git a/bin/ai/compat_1.5.nut b/bin/ai/compat_1.5.nut
index 681a708bee..b006f1733e 100644
--- a/bin/ai/compat_1.5.nut
+++ b/bin/ai/compat_1.5.nut
@@ -15,3 +15,10 @@ AIBridge.GetName <- function(bridge_id)
{
return AIBridge._GetName(bridge_id, AIVehicle.VT_RAIL);
}
+
+/* 1.9 adds parent_group_id to CreateGroup function */
+AIGroup._CreateGroup <- AIGroup.CreateGroup;
+AIGroup.CreateGroup <- function(vehicle_type)
+{
+ return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
+}
diff --git a/bin/ai/compat_1.6.nut b/bin/ai/compat_1.6.nut
index 5242821d1d..e57a3cb980 100644
--- a/bin/ai/compat_1.6.nut
+++ b/bin/ai/compat_1.6.nut
@@ -15,3 +15,10 @@ AIBridge.GetName <- function(bridge_id)
{
return AIBridge._GetName(bridge_id, AIVehicle.VT_RAIL);
}
+
+/* 1.9 adds parent_group_id to CreateGroup function */
+AIGroup._CreateGroup <- AIGroup.CreateGroup;
+AIGroup.CreateGroup <- function(vehicle_type)
+{
+ return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
+}
diff --git a/bin/ai/compat_1.7.nut b/bin/ai/compat_1.7.nut
index 93884e6637..ae403d104b 100644
--- a/bin/ai/compat_1.7.nut
+++ b/bin/ai/compat_1.7.nut
@@ -15,3 +15,10 @@ AIBridge.GetName <- function(bridge_id)
{
return AIBridge._GetName(bridge_id, AIVehicle.VT_RAIL);
}
+
+/* 1.9 adds parent_group_id to CreateGroup function */
+AIGroup._CreateGroup <- AIGroup.CreateGroup;
+AIGroup.CreateGroup <- function(vehicle_type)
+{
+ return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
+}
diff --git a/bin/ai/compat_1.8.nut b/bin/ai/compat_1.8.nut
index f3fa1bc0a6..ecf4accdde 100644
--- a/bin/ai/compat_1.8.nut
+++ b/bin/ai/compat_1.8.nut
@@ -15,3 +15,10 @@ AIBridge.GetName <- function(bridge_id)
{
return AIBridge._GetName(bridge_id, AIVehicle.VT_RAIL);
}
+
+/* 1.9 adds parent_group_id to CreateGroup function */
+AIGroup._CreateGroup <- AIGroup.CreateGroup;
+AIGroup.CreateGroup <- function(vehicle_type)
+{
+ return AIGroup._CreateGroup(vehicle_type, AIGroup.GROUP_INVALID);
+}
diff --git a/bin/ai/compat_1.9.nut b/bin/ai/compat_1.9.nut
index fe985b90d0..6dae3ebc0b 100644
--- a/bin/ai/compat_1.9.nut
+++ b/bin/ai/compat_1.9.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 .
*/
+
+AILog.Info("1.9 API compatibility in effect.");
diff --git a/bin/ai/regression/regression_info.nut b/bin/ai/regression/regression_info.nut
index 341d13a085..d5c3f7dd29 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.9"; }
+ function GetAPIVersion() { return "1.10"; }
function GetDate() { return "2007-03-18"; }
function CreateInstance() { return "Regression"; }
}
diff --git a/bin/ai/regression/tst_regression/main.nut b/bin/ai/regression/tst_regression/main.nut
index 8b92b6f881..7315f33f82 100644
--- a/bin/ai/regression/tst_regression/main.nut
+++ b/bin/ai/regression/tst_regression/main.nut
@@ -574,7 +574,7 @@ function Regression::Group()
local vehicle = AIVehicle.BuildVehicle(10000, 116);
print(" AIVehicle.BuildVehicle(): " + vehicle);
print(" GetNumEngines(): " + AIGroup.GetNumEngines(AIGroup.GROUP_ALL, 116));
- local group = AIGroup.CreateGroup(AIVehicle.VT_ROAD);
+ local group = AIGroup.CreateGroup(AIVehicle.VT_ROAD, AIGroup.GROUP_INVALID);
print(" CreateGroup(): " + group);
print(" MoveVehicle(): " + AIGroup.MoveVehicle(group, vehicle));
print(" GetNumEngines(): " + AIGroup.GetNumEngines(group, 116));
diff --git a/bin/game/compat_1.10.nut b/bin/game/compat_1.10.nut
new file mode 100644
index 0000000000..fe985b90d0
--- /dev/null
+++ b/bin/game/compat_1.10.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/game/compat_1.9.nut b/bin/game/compat_1.9.nut
index fe985b90d0..c2acf9e909 100644
--- a/bin/game/compat_1.9.nut
+++ b/bin/game/compat_1.9.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.9 API compatibility in effect.");
diff --git a/changelog.txt b/changelog.txt
index 7a8651d6e5..1d9f8947ea 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,3 +1,29 @@
+1.9.0-beta3 (2019-02-24)
+------------------------------------------------------------------------
+- Feature: Option to adjust font size separately from GUI size (#7003)
+- Feature: Increase maximum number of orders from 64000 to ~16.7m (#7220)
+- Add: Show performance of AI and GS in framerate window
+- Add: News menu entry and shortcut for deleting all messages (#7240)
+- Change: [OSX] Improved scrolling behaviour when using touchpads
+- Change: Add scrollbar to cargo legend in cargo payment rates window
+- Change: Owner of vehicle with exclusive transport rights may now load cargo from neutral stations (#7256)
+- Change: Improved UI behaviour when dragging sound volume sliders with the mouse (#7227)
+- Change: Use selected vehicle group as parent when creating a new group (#7224)
+- Change: Use SlErrorCorrupt() on pool index error when loading a savegame, instead of terminating (#7219)
+- Change: Skip reliability decay if servicing is disabled
+- Fix: Remove desert around lakes upon generation
+- Fix: Re-sorting file list did not update filtered rows
+- Fix #7159: Waiting time at red one-way signals was too short
+- Fix #7189: Fluidsynth volume gain too high
+- Fix #7004: Cargo flow legend was not properly refreshed after zooming (#7265)
+- Fix: Possibility to modify wrong AI/GS settings when switching AI/GS scripts around (#7090, #7091)
+- Fix: Use more descriptive "spectator" strings for story book and goal dropdown menus
+- Fix #6599: Disable build and rename button in build vehicle window when no vehicle is selected
+- Fix: Do not mangle tagged revision strings for network revision strings
+- Fix #7151: AI start date deviation was still applied when not set to a random AI (#7223)
+- Fix #7197: Invalidate depot buttons when necessary (#7212)
+- Doc: [AI] UnshareOrders empties the orders list of the vehicle
+
1.9.0-beta2 (2019-02-09)
------------------------------------------------------------------------
- Fix: Non-Windows builds did not get correct git hash
diff --git a/config.lib b/config.lib
index f44b9d77ea..b4aecfb9b0 100644
--- a/config.lib
+++ b/config.lib
@@ -844,7 +844,7 @@ check_params() {
pre_detect_with_zlib=$with_zlib
detect_zlib
- if [ "$with_zlib" = "0" ] || [ -z "$zlib-config" ]; then
+ if [ "$with_zlib" = "0" ] || [ -z "$zlib_config" ]; then
log 1 "WARNING: zlib was not detected or disabled"
log 1 "WARNING: OpenTTD doesn't require zlib, but it does mean that many features"
log 1 "WARNING: (like loading most old savegames/scenarios, loading heightmaps,"
@@ -1989,12 +1989,10 @@ EOL
CFLAGS="$CFLAGS -DWITH_SDL"
# SDL must not add _GNU_SOURCE as it breaks many platforms
CFLAGS="$CFLAGS `$sdl_config --cflags | sed 's@-D_GNU_SOURCE[^ ]*@@'`"
- if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ]; then
- if [ "$enable_static" != "0" ]; then
- LIBS="$LIBS `$sdl_config --static-libs`"
- else
- LIBS="$LIBS `$sdl_config --libs`"
- fi
+ if [ "$enable_static" != "0" ]; then
+ LIBS="$LIBS `$sdl_config --static --libs`"
+ else
+ LIBS="$LIBS `$sdl_config --libs`"
fi
fi
diff --git a/docs/landscape.html b/docs/landscape.html
index 319036acde..c8ac686c07 100644
--- a/docs/landscape.html
+++ b/docs/landscape.html
@@ -767,6 +767,7 @@
|
+ - m1 bits 6..5: water class (sea or land)
- m1 bits 4..0: owner (normally 10)
- m2 bits 8..6: ground
diff --git a/docs/landscape_grid.html b/docs/landscape_grid.html
index 252caec07d..cd5fb3c9e2 100644
--- a/docs/landscape_grid.html
+++ b/docs/landscape_grid.html
@@ -196,7 +196,7 @@ the array so you can quickly see what is used and what is not.
trees |
XXXX XXXX |
XXXX XXXX |
- OOO~ ~~~~ |
+ OXX~ ~~~~ |
OOOO OOOX XXXX XXXX |
~~XX XXXX |
OOOO OOOO |
diff --git a/findversion.sh b/findversion.sh
index df481f9bd7..0a92f1360c 100755
--- a/findversion.sh
+++ b/findversion.sh
@@ -83,9 +83,15 @@ if [ -d "$ROOT_DIR/.git" ]; then
if [ -n "$TAG" ]; then
VERSION="${TAG}"
ISTAG="1"
+ if [ -n "`echo \"${TAG}\" | grep \"^[0-9.]*$\"`" ]; then
+ ISSTABLETAG="1"
+ else
+ ISSTABLETAG="0"
+ fi
else
VERSION="${ISODATE}-${BRANCH}${hashprefix}${SHORTHASH}"
ISTAG="0"
+ ISSTABLETAG="0"
fi
elif [ -f "$ROOT_DIR/.ottdrev-vc" ]; then
VERSION_DATA="`cat "$ROOT_DIR/.ottdrev-vc" | sed -n -e '1 p;'`"
@@ -95,6 +101,7 @@ elif [ -f "$ROOT_DIR/.ottdrev-vc" ]; then
MODIFIED="`echo "$VERSION_DATA" | cut -f 3 -d' '`"
HASH="`echo "$VERSION_DATA" | cut -f 4 -d' '`"
ISTAG="`echo "$VERSION_DATA" | cut -f 5 -d' '`"
+ ISSTABLETAG="`echo "$VERSION_DATA" | cut -f 6 -d' '`"
if [ "$MODIFIED" = "2" ]; then
VERSION="`echo "$VERSION" | sed -e 's/M$//'`"
fi
@@ -121,10 +128,11 @@ else
TAG=""
VERSION=""
ISTAG="0"
+ ISSTABLETAG="0"
fi
if [ "$MODIFIED" -eq "2" ]; then
VERSION="${VERSION}M"
fi
-echo "$VERSION $ISODATE $MODIFIED $HASH $ISTAG"
+echo "$VERSION $ISODATE $MODIFIED $HASH $ISTAG $ISSTABLETAG"
diff --git a/known-bugs.txt b/known-bugs.txt
index bcb9c354a9..c02897e501 100644
--- a/known-bugs.txt
+++ b/known-bugs.txt
@@ -1,6 +1,6 @@
OpenTTD's known bugs
-Last updated: 2019-02-09
-Release version: 1.9.0-beta2
+Last updated: 2019-02-24
+Release version: 1.9.0-beta3
------------------------------------------------------------------------
diff --git a/os/debian/changelog b/os/debian/changelog
index e429487ec0..858c15371b 100644
--- a/os/debian/changelog
+++ b/os/debian/changelog
@@ -1,3 +1,9 @@
+openttd (1.9.0~beta3-0) unstable; urgency=low
+
+ * New upstream release 1.9.0-beta3
+
+ -- OpenTTD Sun, 24 Feb 2019 23:00:00 +0000
+
openttd (1.9.0~beta2-0) unstable; urgency=low
* New upstream release 1.9.0-beta2
diff --git a/os/os2/installer/make_installer.cmd b/os/os2/installer/make_installer.cmd
index a15198b5f1..3addeca1ae 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.9.0
+set OPENTTD_VERSION=1.10.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 d16230f312..09d19621fe 100644
--- a/os/rpm/openttd.spec
+++ b/os/rpm/openttd.spec
@@ -17,9 +17,9 @@
#
Name: openttd
-Version: 1.9.beta2
+Version: 1.10.beta1
Release: 0
-%define srcver 1.9.0-beta2
+%define srcver 1.10.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 d0c933ca21..a0ca6ee6be 100644
--- a/os/windows/installer/install.nsi
+++ b/os/windows/installer/install.nsi
@@ -1,9 +1,9 @@
# Version numbers to update
!define APPV_MAJOR 1
-!define APPV_MINOR 9
+!define APPV_MINOR 10
!define APPV_MAINT 0
-!define APPV_BUILD 1
-!define APPV_EXTRA "-beta2"
+!define APPV_BUILD 0
+!define APPV_EXTRA "-beta1"
!define APPNAME "OpenTTD" ; Define application name
!define APPVERSION "${APPV_MAJOR}.${APPV_MINOR}.${APPV_MAINT}${APPV_EXTRA}" ; Define application version
@@ -24,6 +24,7 @@
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "top.bmp"
+ManifestDPIAware true
BrandingText "OpenTTD Installer"
SetCompressor LZMA
diff --git a/projects/determineversion.vbs b/projects/determineversion.vbs
index e1589dcbf0..a00778f2d1 100755
--- a/projects/determineversion.vbs
+++ b/projects/determineversion.vbs
@@ -21,7 +21,7 @@ Sub FindReplaceInFile(filename, to_find, replacement)
file.Close
End Sub
-Sub UpdateFile(modified, isodate, version, cur_date, githash, istag, filename)
+Sub UpdateFile(modified, isodate, version, cur_date, githash, istag, isstabletag, filename)
FSO.CopyFile filename & ".in", filename
FindReplaceInFile filename, "!!MODIFIED!!", modified
FindReplaceInFile filename, "!!ISODATE!!", isodate
@@ -29,11 +29,12 @@ Sub UpdateFile(modified, isodate, version, cur_date, githash, istag, filename)
FindReplaceInFile filename, "!!DATE!!", cur_date
FindReplaceInFile filename, "!!GITHASH!!", githash
FindReplaceInFile filename, "!!ISTAG!!", istag
+ FindReplaceInFile filename, "!!ISSTABLETAG!!", isstabletag
FindReplaceInFile filename, "!!CONFIGURE_INVOCATION!!", ""
End Sub
Sub UpdateFiles(version)
- Dim modified, isodate, cur_date, githash, istag
+ Dim modified, isodate, cur_date, githash, istag, isstabletag
cur_date = DatePart("D", Date) & "." & DatePart("M", Date) & "." & DatePart("YYYY", Date)
If InStr(version, Chr(9)) Then
@@ -42,20 +43,23 @@ Sub UpdateFiles(version)
modified = Mid(isodate, InStr(isodate, Chr(9)) + 1)
githash = Mid(modified, InStr(modified, Chr(9)) + 1)
istag = Mid(githash, InStr(githash, Chr(9)) + 1)
+ isstabletag = Mid(istag, InStr(istag, Chr(9)) + 1)
' Remove tails from fields
version = Mid(version, 1, InStr(version, Chr(9)) - 1)
isodate = Mid(isodate, 1, InStr(isodate, Chr(9)) - 1)
modified = Mid(modified, 1, InStr(modified, Chr(9)) - 1)
githash = Mid(githash, 1, InStr(githash, Chr(9)) - 1)
+ istag = Mid(istag, 1, InStr(istag, Chr(9)) - 1)
Else
isodate = 0
modified = 1
githash = ""
istag = 0
+ isstabletag = 0
End If
- UpdateFile modified, isodate, version, cur_date, githash, istag, "../src/rev.cpp"
- UpdateFile modified, isodate, version, cur_date, githash, istag, "../src/os/windows/ottdres.rc"
+ UpdateFile modified, isodate, version, cur_date, githash, istag, isstabletag, "../src/rev.cpp"
+ UpdateFile modified, isodate, version, cur_date, githash, istag, isstabletag, "../src/os/windows/ottdres.rc"
End Sub
Function DetermineVersion()
@@ -144,7 +148,7 @@ Function DetermineVersion()
DetermineVersion = "norev000"
modified = 1
Else
- Dim version, hashprefix, istag
+ Dim version, hashprefix, istag, isstabletag
If modified = 0 Then
hashprefix = "-g"
ElseIf modified = 2 Then
@@ -156,12 +160,21 @@ Function DetermineVersion()
If tag <> "" Then
version = tag
istag = 1
+
+ Set stable_regexp = New RegExp
+ stable_regexp.Pattern = "^[0-9.]*$"
+ If stable_regexp.Test(tag) Then
+ isstabletag = 1
+ Else
+ isstabletag = 0
+ End If
Else
version = isodate & "-" & branch & hashprefix & shorthash
istag = 0
+ isstabletag = 0
End If
- DetermineVersion = version & Chr(9) & isodate & Chr(9) & modified & Chr(9) & hash & Chr(9) & istag
+ DetermineVersion = version & Chr(9) & isodate & Chr(9) & modified & Chr(9) & hash & Chr(9) & istag & Chr(9) & isstabletag
End If
End Function
diff --git a/projects/openttd_vs140.vcxproj b/projects/openttd_vs140.vcxproj
index 0d1b4bf0b5..b595f2152a 100644
--- a/projects/openttd_vs140.vcxproj
+++ b/projects/openttd_vs140.vcxproj
@@ -422,7 +422,6 @@
-
@@ -648,7 +647,6 @@
-
diff --git a/projects/openttd_vs140.vcxproj.filters b/projects/openttd_vs140.vcxproj.filters
index fa3313c427..ebb4cd334c 100644
--- a/projects/openttd_vs140.vcxproj.filters
+++ b/projects/openttd_vs140.vcxproj.filters
@@ -357,9 +357,6 @@
Source Files
-
- Source Files
-
Source Files
@@ -1035,9 +1032,6 @@
Header Files
-
- Header Files
-
Header Files
diff --git a/projects/openttd_vs141.vcxproj b/projects/openttd_vs141.vcxproj
index 549e801008..13692a6252 100644
--- a/projects/openttd_vs141.vcxproj
+++ b/projects/openttd_vs141.vcxproj
@@ -422,7 +422,6 @@
-
@@ -648,7 +647,6 @@
-
diff --git a/projects/openttd_vs141.vcxproj.filters b/projects/openttd_vs141.vcxproj.filters
index fa3313c427..ebb4cd334c 100644
--- a/projects/openttd_vs141.vcxproj.filters
+++ b/projects/openttd_vs141.vcxproj.filters
@@ -357,9 +357,6 @@
Source Files
-
- Source Files
-
Source Files
@@ -1035,9 +1032,6 @@
Header Files
-
- Header Files
-
Header Files
diff --git a/projects/openttd_vs142.vcxproj b/projects/openttd_vs142.vcxproj
index 28f8c96fd1..d72574c139 100644
--- a/projects/openttd_vs142.vcxproj
+++ b/projects/openttd_vs142.vcxproj
@@ -422,7 +422,6 @@
-
@@ -648,7 +647,6 @@
-
diff --git a/projects/openttd_vs142.vcxproj.filters b/projects/openttd_vs142.vcxproj.filters
index fa3313c427..ebb4cd334c 100644
--- a/projects/openttd_vs142.vcxproj.filters
+++ b/projects/openttd_vs142.vcxproj.filters
@@ -357,9 +357,6 @@
Source Files
-
- Source Files
-
Source Files
@@ -1035,9 +1032,6 @@
Header Files
-
- Header Files
-
Header Files
diff --git a/source.list b/source.list
index 747d9c5727..67fc58c744 100644
--- a/source.list
+++ b/source.list
@@ -84,9 +84,6 @@ rev.cpp
road.cpp
roadstop.cpp
screenshot.cpp
-#if SDL
- sdl.cpp
-#end
settings.cpp
signal.cpp
programmable_signals.cpp
@@ -338,7 +335,6 @@ roadveh.h
safeguards.h
scope.h
screenshot.h
-sdl.h
sound/sdl_s.h
video/sdl_v.h
schdispatch.h
diff --git a/src/ai/ai_core.cpp b/src/ai/ai_core.cpp
index d4ff233116..51522edaff 100644
--- a/src/ai/ai_core.cpp
+++ b/src/ai/ai_core.cpp
@@ -16,6 +16,7 @@
#include "../company_func.h"
#include "../network/network.h"
#include "../window_func.h"
+#include "../framerate_type.h"
#include "ai_scanner.hpp"
#include "ai_instance.hpp"
#include "ai_config.hpp"
@@ -79,8 +80,11 @@
const Company *c;
FOR_ALL_COMPANIES(c) {
if (c->is_ai) {
+ PerformanceMeasurer framerate((PerformanceElement)(PFE_AI0 + c->index));
cur_company.Change(c->index);
c->ai_instance->GameLoop();
+ } else {
+ PerformanceMeasurer::SetInactive((PerformanceElement)(PFE_AI0 + c->index));
}
}
cur_company.Restore();
@@ -101,6 +105,7 @@
/* static */ void AI::Stop(CompanyID company)
{
if (_networking && !_network_server) return;
+ PerformanceMeasurer::SetInactive((PerformanceElement)(PFE_AI0 + company));
Backup cur_company(_current_company, company, FILE_LINE);
Company *c = Company::Get(company);
diff --git a/src/ai/ai_info.cpp b/src/ai/ai_info.cpp
index 43a4345460..62ddb2344f 100644
--- a/src/ai/ai_info.cpp
+++ b/src/ai/ai_info.cpp
@@ -29,7 +29,7 @@ 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.8") == 0 || strcmp(api_version, "1.9") == 0;
+ strcmp(api_version, "1.8") == 0 || strcmp(api_version, "1.9") == 0 || strcmp(api_version, "1.10") == 0;
}
#if defined(_WIN32)
diff --git a/src/aircraft_cmd.cpp b/src/aircraft_cmd.cpp
index 49ab304fb2..1539454e12 100644
--- a/src/aircraft_cmd.cpp
+++ b/src/aircraft_cmd.cpp
@@ -1370,19 +1370,17 @@ static void CrashAirplane(Aircraft *v)
*/
static void MaybeCrashAirplane(Aircraft *v)
{
- if (_settings_game.vehicle.plane_crashes == 0) return;
Station *st = Station::Get(v->targetairport);
- /* FIXME -- MaybeCrashAirplane -> increase crashing chances of very modern airplanes on smaller than AT_METROPOLITAN airports */
- uint32 prob = (0x4000 << _settings_game.vehicle.plane_crashes);
-
+ uint32 prob;
if ((st->airport.GetFTA()->flags & AirportFTAClass::SHORT_STRIP) &&
(AircraftVehInfo(v->engine_type)->subtype & AIR_FAST) &&
!_cheats.no_jetcrash.value) {
- prob /= 20;
+ prob = 3276;
} else {
- prob /= 1500;
+ if (_settings_game.vehicle.plane_crashes == 0) return;
+ prob = (0x4000 << _settings_game.vehicle.plane_crashes) / 1500;
}
if (_settings_game.vehicle.improved_breakdowns && v->breakdown_ctr == 1 && v->breakdown_type == BREAKDOWN_AIRCRAFT_EM_LANDING) {
/* Airplanes that are attempting an emergency landing have a 2% chance to crash */
@@ -2174,7 +2172,19 @@ void UpdateAirplanesOnNewStation(const Station *st)
FOR_ALL_AIRCRAFT(v) {
if (!v->IsNormalAircraft() || v->targetairport != st->index) continue;
assert(v->state == FLYING);
+
+ Order *o = &v->current_order;
+ /* The aircraft is heading to a hangar, but the new station doesn't have one,
+ * or the aircraft can't land on the new station. Cancel current order. */
+ if (o->IsType(OT_GOTO_DEPOT) && !(o->GetDepotOrderType() & ODTFB_PART_OF_ORDERS) && o->GetDestination() == st->index &&
+ (!st->airport.HasHangar() || !CanVehicleUseStation(v, st))) {
+ o->MakeDummy();
+ SetWindowWidgetDirty(WC_VEHICLE_VIEW, v->index, WID_VV_START_STOP);
+ }
v->pos = v->previous_pos = AircraftGetEntryPoint(v, ap, rotation);
UpdateAircraftCache(v);
}
+
+ /* Heliports don't have a hangar. Invalidate all go to hangar orders from all aircraft. */
+ if (!st->airport.HasHangar()) RemoveOrderFromAllVehicles(OT_GOTO_DEPOT, st->index, true);
}
diff --git a/src/cargomonitor.cpp b/src/cargomonitor.cpp
index 70d6a9c697..f43efa6989 100644
--- a/src/cargomonitor.cpp
+++ b/src/cargomonitor.cpp
@@ -116,8 +116,9 @@ int32 GetPickupAmount(CargoMonitorID monitor, bool keep_monitoring)
* @param src_type type of \a src.
* @param src index of source.
* @param st station where the cargo is delivered to.
+ * @param dest industry index where the cargo is delivered to.
*/
-void AddCargoDelivery(CargoID cargo_type, CompanyID company, uint32 amount, SourceType src_type, SourceID src, const Station *st)
+void AddCargoDelivery(CargoID cargo_type, CompanyID company, uint32 amount, SourceType src_type, SourceID src, const Station *st, IndustryID dest)
{
if (amount == 0) return;
@@ -150,6 +151,7 @@ void AddCargoDelivery(CargoID cargo_type, CompanyID company, uint32 amount, Sour
/* Industry delivery. */
for (const Industry * const *ip = st->industries_near.Begin(); ip != st->industries_near.End(); ip++) {
+ if ((*ip)->index != dest) continue;
CargoMonitorID num = EncodeCargoIndustryMonitor(company, cargo_type, (*ip)->index);
CargoMonitorMap::iterator iter = _cargo_deliveries.find(num);
if (iter != _cargo_deliveries.end()) iter->second += amount;
diff --git a/src/cargomonitor.h b/src/cargomonitor.h
index aa7cfb3b5f..1e47fc0784 100644
--- a/src/cargomonitor.h
+++ b/src/cargomonitor.h
@@ -148,6 +148,6 @@ void ClearCargoPickupMonitoring(CompanyID company = INVALID_OWNER);
void ClearCargoDeliveryMonitoring(CompanyID company = INVALID_OWNER);
int32 GetDeliveryAmount(CargoMonitorID monitor, bool keep_monitoring);
int32 GetPickupAmount(CargoMonitorID monitor, bool keep_monitoring);
-void AddCargoDelivery(CargoID cargo_type, CompanyID company, uint32 amount, SourceType src_type, SourceID src, const Station *st);
+void AddCargoDelivery(CargoID cargo_type, CompanyID company, uint32 amount, SourceType src_type, SourceID src, const Station *st, IndustryID dest = INVALID_INDUSTRY);
#endif /* CARGOMONITOR_H */
diff --git a/src/company_gui.cpp b/src/company_gui.cpp
index 608632379d..c801fe650a 100644
--- a/src/company_gui.cpp
+++ b/src/company_gui.cpp
@@ -711,7 +711,7 @@ public:
this->BuildGroupList(company);
this->SetRows();
} else {
- this->SetSelectedGroup(group);
+ this->SetSelectedGroup(company, group);
}
this->FinishInitNested(company);
@@ -719,7 +719,7 @@ public:
this->InvalidateData(1);
}
- void SetSelectedGroup(GroupID group)
+ void SetSelectedGroup(CompanyID company, GroupID group)
{
this->RaiseWidget(this->livery_class + WID_SCL_CLASS_GENERAL);
const Group *g = Group::Get(group);
@@ -734,7 +734,7 @@ public:
this->LowerWidget(this->livery_class + WID_SCL_CLASS_GENERAL);
this->groups.ForceRebuild();
- this->BuildGroupList((CompanyID)this->window_number);
+ this->BuildGroupList(company);
this->SetRows();
/* Position scrollbar to selected group */
@@ -1029,9 +1029,15 @@ public:
if (data != -1) {
/* data contains a VehicleType, rebuild list if it displayed */
if (this->livery_class == data + LC_GROUP_RAIL) {
- if (!Group::IsValidID(this->sel)) this->sel = INVALID_GROUP;
this->groups.ForceRebuild();
this->BuildGroupList((CompanyID)this->window_number);
+ this->SetRows();
+
+ if (!Group::IsValidID(this->sel)) {
+ this->sel = INVALID_GROUP;
+ if (this->groups.Length() > 0) this->sel = this->groups[0]->index;
+ }
+
this->SetDirty();
}
return;
@@ -1103,7 +1109,7 @@ void ShowCompanyLiveryWindow(CompanyID company, GroupID group)
if (w == NULL) {
new SelectCompanyLiveryWindow(&_select_company_livery_desc, company, group);
} else if (group != INVALID_GROUP) {
- w->SetSelectedGroup(group);
+ w->SetSelectedGroup(company, group);
}
}
diff --git a/src/crashlog.cpp b/src/crashlog.cpp
index e6c2d7032e..1d3be5b083 100644
--- a/src/crashlog.cpp
+++ b/src/crashlog.cpp
@@ -66,7 +66,6 @@
#include
#endif
#ifdef WITH_SDL
-# include "sdl.h"
# include
#endif /* WITH_SDL */
#ifdef WITH_ZLIB
@@ -292,14 +291,8 @@ char *CrashLog::LogLibraries(char *buffer, const char *last) const
#endif /* WITH_PNG */
#ifdef WITH_SDL
-#ifdef DYNAMICALLY_LOADED_SDL
- if (SDL_CALL SDL_Linked_Version != NULL) {
-#else
- {
-#endif
- const SDL_version *v = SDL_CALL SDL_Linked_Version();
- buffer += seprintf(buffer, last, " SDL: %d.%d.%d\n", v->major, v->minor, v->patch);
- }
+ const SDL_version *v = SDL_Linked_Version();
+ buffer += seprintf(buffer, last, " SDL: %d.%d.%d\n", v->major, v->minor, v->patch);
#endif /* WITH_SDL */
#ifdef WITH_ZLIB
diff --git a/src/economy.cpp b/src/economy.cpp
index a6d39f1229..e9d646cb91 100644
--- a/src/economy.cpp
+++ b/src/economy.cpp
@@ -1062,9 +1062,10 @@ static SmallIndustryList _cargo_delivery_destinations;
* @param cargo_type Type of cargo delivered
* @param num_pieces Amount of cargo delivered
* @param source The source of the cargo
+ * @param company The company delivering the cargo
* @return actually accepted pieces of cargo
*/
-static uint DeliverGoodsToIndustry(const Station *st, CargoID cargo_type, uint num_pieces, IndustryID source)
+static uint DeliverGoodsToIndustry(const Station *st, CargoID cargo_type, uint num_pieces, IndustryID source, CompanyID company)
{
/* Find the nearest industrytile to the station sign inside the catchment area, whose industry accepts the cargo.
* This fails in three cases:
@@ -1097,6 +1098,9 @@ static uint DeliverGoodsToIndustry(const Station *st, CargoID cargo_type, uint n
ind->last_cargo_accepted_at[cargo_index] = _date;
num_pieces -= amount;
accepted += amount;
+
+ /* Update the cargo monitor. */
+ AddCargoDelivery(cargo_type, company, amount, ST_INDUSTRY, source, st, ind->index);
}
return accepted;
@@ -1122,30 +1126,30 @@ static Money DeliverGoods(int num_pieces, CargoID cargo_type, StationID dest, Ti
Station *st = Station::Get(dest);
/* Give the goods to the industry. */
- uint accepted = DeliverGoodsToIndustry(st, cargo_type, num_pieces, src_type == ST_INDUSTRY ? src : INVALID_INDUSTRY);
+ uint accepted_ind = DeliverGoodsToIndustry(st, cargo_type, num_pieces, src_type == ST_INDUSTRY ? src : INVALID_INDUSTRY, company->index);
/* If this cargo type is always accepted, accept all */
- if (HasBit(st->always_accepted, cargo_type)) accepted = num_pieces;
+ uint accepted_total = HasBit(st->always_accepted, cargo_type) ? num_pieces : accepted_ind;
/* Update station statistics */
- if (accepted > 0) {
+ if (accepted_total > 0) {
SetBit(st->goods[cargo_type].status, GoodsEntry::GES_EVER_ACCEPTED);
SetBit(st->goods[cargo_type].status, GoodsEntry::GES_CURRENT_MONTH);
SetBit(st->goods[cargo_type].status, GoodsEntry::GES_ACCEPTED_BIGTICK);
}
/* Update company statistics */
- company->cur_economy.delivered_cargo[cargo_type] += accepted;
+ company->cur_economy.delivered_cargo[cargo_type] += accepted_total;
/* Increase town's counter for town effects */
const CargoSpec *cs = CargoSpec::Get(cargo_type);
- st->town->received[cs->town_effect].new_act += accepted;
+ st->town->received[cs->town_effect].new_act += accepted_total;
/* Determine profit */
- Money profit = GetTransportedGoodsIncome(accepted, DistanceManhattan(source_tile, st->xy), days_in_transit, cargo_type);
+ Money profit = GetTransportedGoodsIncome(accepted_total, DistanceManhattan(source_tile, st->xy), days_in_transit, cargo_type);
/* Update the cargo monitor. */
- AddCargoDelivery(cargo_type, company->index, accepted, src_type, src, st);
+ AddCargoDelivery(cargo_type, company->index, accepted_total - accepted_ind, src_type, src, st);
/* Modify profit if a subsidy is in effect */
if (CheckSubsidised(cargo_type, company->index, src_type, src, st)) {
diff --git a/src/engine.cpp b/src/engine.cpp
index b54d3f8b4b..7467e86f97 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -662,7 +662,14 @@ void StartupOneEngine(Engine *e, Date aging_date)
/* Don't randomise the start-date in the first two years after gamestart to ensure availability
* of engines in early starting games.
* Note: TTDP uses fixed 1922 */
+ SavedRandomSeeds saved_seeds;
+ SaveRandomSeeds(&saved_seeds);
+ SetRandomSeed(_settings_game.game_creation.generation_seed ^
+ ei->base_intro ^
+ e->type ^
+ e->GetGRFID());
uint32 r = Random();
+
e->intro_date = ei->base_intro <= ConvertYMDToDate(_settings_game.game_creation.starting_year + 2, 0, 1) ? ei->base_intro : (Date)GB(r, 0, 9) + ei->base_intro;
if (e->intro_date <= _date) {
e->age = (aging_date - e->intro_date) >> 5;
@@ -682,6 +689,7 @@ void StartupOneEngine(Engine *e, Date aging_date)
e->reliability_spd_dec = ei->decay_speed << 2;
+ RestoreRandomSeeds(saved_seeds);
CalcEngineReliability(e);
/* prevent certain engines from ever appearing. */
diff --git a/src/fios_gui.cpp b/src/fios_gui.cpp
index 5ec87be1eb..8098465852 100644
--- a/src/fios_gui.cpp
+++ b/src/fios_gui.cpp
@@ -590,6 +590,7 @@ public:
if (_savegame_sort_dirty) {
_savegame_sort_dirty = false;
SortSaveGameList(this->fios_items);
+ this->OnInvalidateData(SLIWD_FILTER_CHANGES);
}
this->DrawWidgets();
diff --git a/src/fontcache.cpp b/src/fontcache.cpp
index 7c1ab0704b..54c83d8185 100644
--- a/src/fontcache.cpp
+++ b/src/fontcache.cpp
@@ -174,12 +174,12 @@ uint SpriteFontCache::GetGlyphWidth(GlyphID key)
{
SpriteID sprite = this->GetUnicodeGlyph(key);
if (sprite == 0) sprite = this->GetUnicodeGlyph('?');
- return SpriteExists(sprite) ? GetSprite(sprite, ST_FONT)->width + ScaleGUITrad(this->fs != FS_NORMAL ? 1 : 0) : 0;
+ return SpriteExists(sprite) ? GetSprite(sprite, ST_FONT)->width + ScaleFontTrad(this->fs != FS_NORMAL ? 1 : 0) : 0;
}
int SpriteFontCache::GetHeight() const
{
- return ScaleGUITrad(this->height);
+ return ScaleFontTrad(this->height);
}
bool SpriteFontCache::GetDrawGlyphShadow()
@@ -286,16 +286,18 @@ void FreeTypeFontCache::SetFontSize(FontSize fs, FT_Face face, int pixels)
{
if (pixels == 0) {
/* Try to determine a good height based on the minimal height recommended by the font. */
- int scaled_height = ScaleGUITrad(_default_font_height[this->fs]);
+ int scaled_height = ScaleFontTrad(_default_font_height[this->fs]);
pixels = scaled_height;
TT_Header *head = (TT_Header *)FT_Get_Sfnt_Table(this->face, ft_sfnt_head);
if (head != NULL) {
/* Font height is minimum height plus the difference between the default
* height for this font size and the small size. */
- int diff = scaled_height - ScaleGUITrad(_default_font_height[FS_SMALL]);
+ int diff = scaled_height - ScaleFontTrad(_default_font_height[FS_SMALL]);
pixels = Clamp(min(head->Lowest_Rec_PPEM, 20) + diff, scaled_height, MAX_FONT_SIZE);
}
+ } else {
+ pixels = ScaleFontTrad(pixels);
}
this->used_size = pixels;
@@ -425,6 +427,9 @@ FreeTypeFontCache::~FreeTypeFontCache()
*/
void FreeTypeFontCache::ClearFontCache()
{
+ /* Font scaling might have changed, determine font size anew if it was automatically selected. */
+ if (this->face != NULL) this->SetFontSize(this->fs, this->face, this->req_size);
+
if (this->glyph_to_sprite == NULL) return;
for (int i = 0; i < 256; i++) {
@@ -442,9 +447,6 @@ void FreeTypeFontCache::ClearFontCache()
this->glyph_to_sprite = NULL;
Layouter::ResetFontCache(this->fs);
-
- /* GUI scaling might have changed, determine font size anew if it was automatically selected. */
- if (this->face != NULL && this->req_size == 0) this->SetFontSize(this->fs, this->face, this->req_size);
}
FreeTypeFontCache::GlyphEntry *FreeTypeFontCache::GetGlyphPtr(GlyphID key)
diff --git a/src/framerate_gui.cpp b/src/framerate_gui.cpp
index 908cf81c0b..060b19a4a1 100644
--- a/src/framerate_gui.cpp
+++ b/src/framerate_gui.cpp
@@ -13,13 +13,18 @@
#include
#include "gfx_func.h"
#include "window_gui.h"
+#include "window_func.h"
#include "table/sprites.h"
+#include "string_func.h"
#include "strings_func.h"
#include "console_func.h"
#include "console_type.h"
#include "guitimer_func.h"
+#include "company_base.h"
+#include "ai/ai_info.hpp"
#include "widgets/framerate_widget.h"
+#include "safeguards.h"
/**
@@ -183,6 +188,23 @@ namespace {
PerformanceData(1), // PFE_ACC_DRAWWORLD
PerformanceData(60.0), // PFE_VIDEO
PerformanceData(1000.0 * 8192 / 44100), // PFE_SOUND
+ PerformanceData(1), // PFE_ALLSCRIPTS
+ PerformanceData(1), // PFE_GAMESCRIPT
+ PerformanceData(1), // PFE_AI0 ...
+ PerformanceData(1),
+ PerformanceData(1),
+ PerformanceData(1),
+ PerformanceData(1),
+ PerformanceData(1),
+ PerformanceData(1),
+ PerformanceData(1),
+ PerformanceData(1),
+ PerformanceData(1),
+ PerformanceData(1),
+ PerformanceData(1),
+ PerformanceData(1),
+ PerformanceData(1),
+ PerformanceData(1), // PFE_AI14
};
}
@@ -215,6 +237,15 @@ PerformanceMeasurer::PerformanceMeasurer(PerformanceElement elem)
/** Finish a cycle of a measured element and store the measurement taken. */
PerformanceMeasurer::~PerformanceMeasurer()
{
+ if (this->elem == PFE_ALLSCRIPTS) {
+ /* Hack to not record scripts total when no scripts are active */
+ bool any_active = _pf_data[PFE_GAMESCRIPT].num_valid > 0;
+ for (uint e = PFE_AI0; e < PFE_MAX; e++) any_active |= _pf_data[e].num_valid > 0;
+ if (!any_active) {
+ PerformanceMeasurer::SetInactive(PFE_ALLSCRIPTS);
+ return;
+ }
+ }
_pf_data[this->elem].Add(this->start_time, GetPerformanceTimer());
}
@@ -224,11 +255,19 @@ void PerformanceMeasurer::SetExpectedRate(double rate)
_pf_data[this->elem].expected_rate = rate;
}
+/** Mark a performance element as not currently in use. */
+/* static */ void PerformanceMeasurer::SetInactive(PerformanceElement elem)
+{
+ _pf_data[elem].num_valid = 0;
+ _pf_data[elem].next_index = 0;
+ _pf_data[elem].prev_index = 0;
+}
+
/**
* Indicate that a cycle of "pause" where no processing occurs.
* @param elem The element not currently being processed
*/
-void PerformanceMeasurer::Paused(PerformanceElement elem)
+/* static */ void PerformanceMeasurer::Paused(PerformanceElement elem)
{
_pf_data[elem].AddPause(GetPerformanceTimer());
}
@@ -266,6 +305,44 @@ void PerformanceAccumulator::Reset(PerformanceElement elem)
void ShowFrametimeGraphWindow(PerformanceElement elem);
+static const PerformanceElement DISPLAY_ORDER_PFE[PFE_MAX] = {
+ PFE_GAMELOOP,
+ PFE_GL_ECONOMY,
+ PFE_GL_TRAINS,
+ PFE_GL_ROADVEHS,
+ PFE_GL_SHIPS,
+ PFE_GL_AIRCRAFT,
+ PFE_GL_LANDSCAPE,
+ PFE_ALLSCRIPTS,
+ PFE_GAMESCRIPT,
+ PFE_AI0,
+ PFE_AI1,
+ PFE_AI2,
+ PFE_AI3,
+ PFE_AI4,
+ PFE_AI5,
+ PFE_AI6,
+ PFE_AI7,
+ PFE_AI8,
+ PFE_AI9,
+ PFE_AI10,
+ PFE_AI11,
+ PFE_AI12,
+ PFE_AI13,
+ PFE_AI14,
+ PFE_GL_LINKGRAPH,
+ PFE_DRAWING,
+ PFE_DRAWWORLD,
+ PFE_VIDEO,
+ PFE_SOUND,
+};
+
+static const char * GetAIName(int ai_index)
+{
+ if (!Company::IsValidAiID(ai_index)) return "";
+ return Company::Get(ai_index)->ai_info->GetName();
+}
+
/** @hideinitializer */
static const NWidgetPart _framerate_window_widgets[] = {
NWidget(NWID_HORIZONTAL),
@@ -281,14 +358,20 @@ static const NWidgetPart _framerate_window_widgets[] = {
NWidget(WWT_TEXT, COLOUR_GREY, WID_FRW_RATE_FACTOR), SetDataTip(STR_FRAMERATE_SPEED_FACTOR, STR_FRAMERATE_SPEED_FACTOR_TOOLTIP),
EndContainer(),
EndContainer(),
- NWidget(WWT_PANEL, COLOUR_GREY),
- NWidget(NWID_VERTICAL), SetPadding(6), SetPIP(0, 3, 0),
- NWidget(NWID_HORIZONTAL), SetPIP(0, 6, 0),
- NWidget(WWT_EMPTY, COLOUR_GREY, WID_FRW_TIMES_NAMES),
- NWidget(WWT_EMPTY, COLOUR_GREY, WID_FRW_TIMES_CURRENT),
- NWidget(WWT_EMPTY, COLOUR_GREY, WID_FRW_TIMES_AVERAGE),
+ NWidget(NWID_HORIZONTAL),
+ NWidget(WWT_PANEL, COLOUR_GREY),
+ NWidget(NWID_VERTICAL), SetPadding(6), SetPIP(0, 3, 0),
+ NWidget(NWID_HORIZONTAL), SetPIP(0, 6, 0),
+ NWidget(WWT_EMPTY, COLOUR_GREY, WID_FRW_TIMES_NAMES), SetScrollbar(WID_FRW_SCROLLBAR),
+ NWidget(WWT_EMPTY, COLOUR_GREY, WID_FRW_TIMES_CURRENT), SetScrollbar(WID_FRW_SCROLLBAR),
+ NWidget(WWT_EMPTY, COLOUR_GREY, WID_FRW_TIMES_AVERAGE), SetScrollbar(WID_FRW_SCROLLBAR),
+ EndContainer(),
+ NWidget(WWT_TEXT, COLOUR_GREY, WID_FRW_INFO_DATA_POINTS), SetDataTip(STR_FRAMERATE_DATA_POINTS, 0x0),
EndContainer(),
- NWidget(WWT_TEXT, COLOUR_GREY, WID_FRW_INFO_DATA_POINTS), SetDataTip(STR_FRAMERATE_DATA_POINTS, 0x0),
+ EndContainer(),
+ NWidget(NWID_VERTICAL),
+ NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_FRW_SCROLLBAR),
+ NWidget(WWT_RESIZEBOX, COLOUR_GREY),
EndContainer(),
EndContainer(),
};
@@ -296,6 +379,8 @@ static const NWidgetPart _framerate_window_widgets[] = {
struct FramerateWindow : Window {
bool small;
GUITimer next_update;
+ int num_active;
+ int num_displayed;
struct CachedDecimal {
StringID strid;
@@ -332,14 +417,19 @@ struct FramerateWindow : Window {
CachedDecimal times_shortterm[PFE_MAX]; ///< cached short term average times
CachedDecimal times_longterm[PFE_MAX]; ///< cached long term average times
- static const int VSPACING = 3; ///< space between column heading and values
+ static const int VSPACING = 3; ///< space between column heading and values
+ static const int MIN_ELEMENTS = 5; ///< smallest number of elements to display
FramerateWindow(WindowDesc *desc, WindowNumber number) : Window(desc)
{
this->InitNested(number);
this->small = this->IsShaded();
this->UpdateData();
+ this->num_displayed = this->num_active;
this->next_update.SetInterval(100);
+
+ /* Window is always initialised to MIN_ELEMENTS height, resize to contain num_displayed */
+ ResizeWindow(this, 0, (max(MIN_ELEMENTS, this->num_displayed) - MIN_ELEMENTS) * FONT_HEIGHT_NORMAL);
}
virtual void OnRealtimeTick(uint delta_ms)
@@ -369,9 +459,19 @@ struct FramerateWindow : Window {
this->rate_drawing.SetRate(_pf_data[PFE_DRAWING].GetRate(), _pf_data[PFE_DRAWING].expected_rate);
+ int new_active = 0;
for (PerformanceElement e = PFE_FIRST; e < PFE_MAX; e++) {
this->times_shortterm[e].SetTime(_pf_data[e].GetAverageDurationMilliseconds(8), MILLISECONDS_PER_TICK);
this->times_longterm[e].SetTime(_pf_data[e].GetAverageDurationMilliseconds(NUM_FRAMERATE_POINTS), MILLISECONDS_PER_TICK);
+ if (_pf_data[e].num_valid > 0) new_active++;
+ }
+
+ if (new_active != this->num_active) {
+ this->num_active = new_active;
+ Scrollbar *sb = this->GetScrollbar(WID_FRW_SCROLLBAR);
+ sb->SetCount(this->num_active);
+ sb->SetCapacity(min(this->num_displayed, this->num_active));
+ this->ReInit();
}
}
@@ -425,11 +525,20 @@ struct FramerateWindow : Window {
break;
case WID_FRW_TIMES_NAMES: {
- int linecount = PFE_MAX - PFE_FIRST;
size->width = 0;
- size->height = FONT_HEIGHT_NORMAL * (linecount + 1) + VSPACING;
- for (int line = 0; line < linecount; line++) {
- Dimension line_size = GetStringBoundingBox(STR_FRAMERATE_GAMELOOP + line);
+ size->height = FONT_HEIGHT_NORMAL + VSPACING + MIN_ELEMENTS * FONT_HEIGHT_NORMAL;
+ resize->width = 0;
+ resize->height = FONT_HEIGHT_NORMAL;
+ for (PerformanceElement e : DISPLAY_ORDER_PFE) {
+ if (_pf_data[e].num_valid == 0) continue;
+ Dimension line_size;
+ if (e < PFE_AI0) {
+ line_size = GetStringBoundingBox(STR_FRAMERATE_GAMELOOP + e);
+ } else {
+ SetDParam(0, e - PFE_AI0 + 1);
+ SetDParamStr(1, GetAIName(e - PFE_AI0));
+ line_size = GetStringBoundingBox(STR_FRAMERATE_AI);
+ }
size->width = max(size->width, line_size.width);
}
break;
@@ -437,13 +546,14 @@ struct FramerateWindow : Window {
case WID_FRW_TIMES_CURRENT:
case WID_FRW_TIMES_AVERAGE: {
- int linecount = PFE_MAX - PFE_FIRST;
*size = GetStringBoundingBox(STR_FRAMERATE_CURRENT + (widget - WID_FRW_TIMES_CURRENT));
SetDParam(0, 999999);
SetDParam(1, 2);
Dimension item_size = GetStringBoundingBox(STR_FRAMERATE_MS_GOOD);
size->width = max(size->width, item_size.width);
- size->height += FONT_HEIGHT_NORMAL * linecount + VSPACING;
+ size->height += FONT_HEIGHT_NORMAL * MIN_ELEMENTS + VSPACING;
+ resize->width = 0;
+ resize->height = FONT_HEIGHT_NORMAL;
break;
}
}
@@ -452,14 +562,23 @@ struct FramerateWindow : Window {
/** Render a column of formatted average durations */
void DrawElementTimesColumn(const Rect &r, StringID heading_str, const CachedDecimal *values) const
{
+ const Scrollbar *sb = this->GetScrollbar(WID_FRW_SCROLLBAR);
+ uint16 skip = sb->GetPosition();
+ int drawable = this->num_displayed;
int y = r.top;
DrawString(r.left, r.right, y, heading_str, TC_FROMSTRING, SA_CENTER, true);
y += FONT_HEIGHT_NORMAL + VSPACING;
-
- for (PerformanceElement e = PFE_FIRST; e < PFE_MAX; e++) {
- values[e].InsertDParams(0);
- DrawString(r.left, r.right, y, values[e].strid, TC_FROMSTRING, SA_RIGHT);
- y += FONT_HEIGHT_NORMAL;
+ for (PerformanceElement e : DISPLAY_ORDER_PFE) {
+ if (_pf_data[e].num_valid == 0) continue;
+ if (skip > 0) {
+ skip--;
+ } else {
+ values[e].InsertDParams(0);
+ DrawString(r.left, r.right, y, values[e].strid, TC_FROMSTRING, SA_RIGHT);
+ y += FONT_HEIGHT_NORMAL;
+ drawable--;
+ if (drawable == 0) break;
+ }
}
}
@@ -468,11 +587,26 @@ struct FramerateWindow : Window {
switch (widget) {
case WID_FRW_TIMES_NAMES: {
/* Render a column of titles for performance element names */
- int linecount = PFE_MAX - PFE_FIRST;
+ const Scrollbar *sb = this->GetScrollbar(WID_FRW_SCROLLBAR);
+ uint16 skip = sb->GetPosition();
+ int drawable = this->num_displayed;
int y = r.top + FONT_HEIGHT_NORMAL + VSPACING; // first line contains headings in the value columns
- for (int i = 0; i < linecount; i++) {
- DrawString(r.left, r.right, y, STR_FRAMERATE_GAMELOOP + i, TC_FROMSTRING, SA_LEFT);
- y += FONT_HEIGHT_NORMAL;
+ for (PerformanceElement e : DISPLAY_ORDER_PFE) {
+ if (_pf_data[e].num_valid == 0) continue;
+ if (skip > 0) {
+ skip--;
+ } else {
+ if (e < PFE_AI0) {
+ DrawString(r.left, r.right, y, STR_FRAMERATE_GAMELOOP + e, TC_FROMSTRING, SA_LEFT);
+ } else {
+ SetDParam(0, e - PFE_AI0 + 1);
+ SetDParamStr(1, GetAIName(e - PFE_AI0));
+ DrawString(r.left, r.right, y, STR_FRAMERATE_AI, TC_FROMSTRING, SA_LEFT);
+ }
+ y += FONT_HEIGHT_NORMAL;
+ drawable--;
+ if (drawable == 0) break;
+ }
}
break;
}
@@ -494,19 +628,34 @@ struct FramerateWindow : Window {
case WID_FRW_TIMES_CURRENT:
case WID_FRW_TIMES_AVERAGE: {
/* Open time graph windows when clicking detail measurement lines */
- int line = this->GetRowFromWidget(pt.y, widget, VSPACING, FONT_HEIGHT_NORMAL);
- if (line > 0) {
- line -= 1;
- ShowFrametimeGraphWindow((PerformanceElement)line);
+ const Scrollbar *sb = this->GetScrollbar(WID_FRW_SCROLLBAR);
+ int line = sb->GetScrolledRowFromWidget(pt.y - FONT_HEIGHT_NORMAL - VSPACING, this, widget, VSPACING, FONT_HEIGHT_NORMAL);
+ if (line != INT_MAX) {
+ line++;
+ /* Find the visible line that was clicked */
+ for (PerformanceElement e : DISPLAY_ORDER_PFE) {
+ if (_pf_data[e].num_valid > 0) line--;
+ if (line == 0) {
+ ShowFrametimeGraphWindow(e);
+ break;
+ }
+ }
}
break;
}
}
}
+
+ virtual void OnResize()
+ {
+ auto *wid = this->GetWidget(WID_FRW_TIMES_NAMES);
+ this->num_displayed = (wid->current_y - wid->min_y - VSPACING) / FONT_HEIGHT_NORMAL - 1; // subtract 1 for headings
+ this->GetScrollbar(WID_FRW_SCROLLBAR)->SetCapacity(this->num_displayed);
+ }
};
static WindowDesc _framerate_display_desc(
- WDP_AUTO, "framerate_display", 60, 40,
+ WDP_AUTO, "framerate_display", 0, 0,
WC_FRAMERATE_DISPLAY, WC_NONE,
0,
_framerate_window_widgets, lengthof(_framerate_window_widgets)
@@ -549,7 +698,13 @@ struct FrametimeGraphWindow : Window {
{
switch (widget) {
case WID_FGW_CAPTION:
- SetDParam(0, STR_FRAMETIME_CAPTION_GAMELOOP + this->element);
+ if (this->element < PFE_AI0) {
+ SetDParam(0, STR_FRAMETIME_CAPTION_GAMELOOP + this->element);
+ } else {
+ SetDParam(0, STR_FRAMETIME_CAPTION_AI);
+ SetDParam(1, this->element - PFE_AI0 + 1);
+ SetDParamStr(2, GetAIName(this->element - PFE_AI0));
+ }
break;
}
}
@@ -829,7 +984,10 @@ void ConPrintFramerate()
" Viewport drawing",
"Video output",
"Sound mixing",
+ "AI/GS scripts total",
+ "Game script",
};
+ char ai_name_buf[128];
static const PerformanceElement rate_elements[] = { PFE_GAMELOOP, PFE_DRAWING, PFE_VIDEO };
@@ -848,8 +1006,15 @@ void ConPrintFramerate()
for (PerformanceElement e = PFE_FIRST; e < PFE_MAX; e++) {
auto &pf = _pf_data[e];
if (pf.num_valid == 0) continue;
+ const char *name;
+ if (e < PFE_AI0) {
+ name = MEASUREMENT_NAMES[e];
+ } else {
+ seprintf(ai_name_buf, lastof(ai_name_buf), "AI %d %s", e - PFE_AI0 + 1, GetAIName(e - PFE_AI0)),
+ name = ai_name_buf;
+ }
IConsolePrintF(TC_LIGHT_BLUE, "%s times: %.2fms %.2fms %.2fms",
- MEASUREMENT_NAMES[e],
+ name,
pf.GetAverageDurationMilliseconds(count1),
pf.GetAverageDurationMilliseconds(count2),
pf.GetAverageDurationMilliseconds(count3));
diff --git a/src/framerate_type.h b/src/framerate_type.h
index 8df9a279a1..3c54e03078 100644
--- a/src/framerate_type.h
+++ b/src/framerate_type.h
@@ -60,6 +60,23 @@ enum PerformanceElement {
PFE_DRAWWORLD, ///< Time spent drawing world viewports in GUI
PFE_VIDEO, ///< Speed of painting drawn video buffer.
PFE_SOUND, ///< Speed of mixing audio samples
+ PFE_ALLSCRIPTS, ///< Sum of all GS/AI scripts
+ PFE_GAMESCRIPT, ///< Game script execution
+ PFE_AI0, ///< AI execution for player slot 1
+ PFE_AI1, ///< AI execution for player slot 2
+ PFE_AI2, ///< AI execution for player slot 3
+ PFE_AI3, ///< AI execution for player slot 4
+ PFE_AI4, ///< AI execution for player slot 5
+ PFE_AI5, ///< AI execution for player slot 6
+ PFE_AI6, ///< AI execution for player slot 7
+ PFE_AI7, ///< AI execution for player slot 8
+ PFE_AI8, ///< AI execution for player slot 9
+ PFE_AI9, ///< AI execution for player slot 10
+ PFE_AI10, ///< AI execution for player slot 11
+ PFE_AI11, ///< AI execution for player slot 12
+ PFE_AI12, ///< AI execution for player slot 13
+ PFE_AI13, ///< AI execution for player slot 14
+ PFE_AI14, ///< AI execution for player slot 15
PFE_MAX, ///< End of enum, must be last.
};
DECLARE_POSTFIX_INCREMENT(PerformanceElement)
@@ -81,6 +98,7 @@ public:
PerformanceMeasurer(PerformanceElement elem);
~PerformanceMeasurer();
void SetExpectedRate(double rate);
+ static void SetInactive(PerformanceElement elem);
static void Paused(PerformanceElement elem);
};
diff --git a/src/game/game_core.cpp b/src/game/game_core.cpp
index 2f95e26224..10b079bee3 100644
--- a/src/game/game_core.cpp
+++ b/src/game/game_core.cpp
@@ -15,6 +15,7 @@
#include "../company_func.h"
#include "../network/network.h"
#include "../window_func.h"
+#include "../framerate_type.h"
#include "game.hpp"
#include "game_scanner.hpp"
#include "game_config.hpp"
@@ -31,8 +32,16 @@
/* static */ void Game::GameLoop()
{
- if (_networking && !_network_server) return;
- if (Game::instance == NULL) return;
+ if (_networking && !_network_server) {
+ PerformanceMeasurer::SetInactive(PFE_GAMESCRIPT);
+ return;
+ }
+ if (Game::instance == NULL) {
+ PerformanceMeasurer::SetInactive(PFE_GAMESCRIPT);
+ return;
+ }
+
+ PerformanceMeasurer framerate(PFE_GAMESCRIPT);
Game::frame_counter++;
diff --git a/src/game/game_info.cpp b/src/game/game_info.cpp
index f8c04608b7..0aa3161740 100644
--- a/src/game/game_info.cpp
+++ b/src/game/game_info.cpp
@@ -26,7 +26,7 @@ static bool CheckAPIVersion(const char *api_version)
{
return 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.8") == 0 || strcmp(api_version, "1.9") == 0;
+ strcmp(api_version, "1.8") == 0 || strcmp(api_version, "1.9") == 0 || strcmp(api_version, "1.10") == 0;
}
#if defined(_WIN32)
diff --git a/src/gfx.cpp b/src/gfx.cpp
index 586bc14ab1..b0c055624a 100644
--- a/src/gfx.cpp
+++ b/src/gfx.cpp
@@ -58,6 +58,7 @@ static void GfxMainBlitter(const Sprite *sprite, int x, int y, BlitterMode mode,
static ReusableBuffer _cursor_backup;
ZoomLevelByte _gui_zoom; ///< GUI Zoom level
+ZoomLevelByte _font_zoom; ///< Font Zoom level
/**
* The rect for repaint.
@@ -1130,13 +1131,14 @@ TextColour GetContrastColour(uint8 background, uint8 threshold)
*/
void LoadStringWidthTable(bool monospace)
{
+ ClearFontCache();
+
for (FontSize fs = monospace ? FS_MONO : FS_BEGIN; fs < (monospace ? FS_END : FS_MONO); fs++) {
for (uint i = 0; i != 224; i++) {
_stringwidth_table[fs][i] = GetGlyphWidth(fs, i + 32);
}
}
- ClearFontCache();
ReInitAllWindows();
}
diff --git a/src/gfx_layout.h b/src/gfx_layout.h
index f6fc3b5c71..94cbac073a 100644
--- a/src/gfx_layout.h
+++ b/src/gfx_layout.h
@@ -19,6 +19,7 @@
#include |