diff --git a/Makefile.grf.in b/Makefile.grf.in
index 9206bc8547..61609d0a32 100644
--- a/Makefile.grf.in
+++ b/Makefile.grf.in
@@ -1,4 +1,4 @@
-# $Id: Makefile.grf.in 25205 2013-04-24 20:30:02Z frosch $
+# $Id: Makefile.grf.in 26715 2014-08-03 14:06:04Z frosch $
# 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.
@@ -75,10 +75,10 @@ $(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
+$(BIN_DIR)/openttd.grf: $(PNG_FILES) $(NFO_FILES) $(OBJS_DIR)/sprites $(GRF_DIR)/assemble_nfo.awk
$(E) '$(STAGE) Assembling openttd.nfo'
$(Q)-cp $(PNG_FILES) $(OBJS_DIR)/sprites 2> /dev/null
- $(Q) $(CC_BUILD) -nostdinc -I$(GRF_DIR) -C -E - < "$(GRF_DIR)/openttd.nfo" | sed -e '/^#/d' -e '/^$$/d' > $(OBJS_DIR)/sprites/openttd.nfo
+ $(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
$(E) '$(STAGE) Compiling openttd.grf'
$(Q) $(GRFCODEC) -n -s -e -p1 $(OBJS_DIR)/openttd.grf
diff --git a/Makefile.src.in b/Makefile.src.in
index 62b9d2da40..3c3002d8f0 100644
--- a/Makefile.src.in
+++ b/Makefile.src.in
@@ -292,8 +292,8 @@ $(ENDIAN_CHECK): $(SRC_DIR)/endian_check.cpp
# Revision files
-# $(SRC_DIR)/rev.cpp: $(CONFIG_CACHE_VERSION) $(SRC_DIR)/rev.cpp.in
-# $(Q)cat $(SRC_DIR)/rev.cpp.in | sed "s@\!\!REVISION\!\!@$(REV_NR)@g;s@!!VERSION!!@$(REV)@g;s@!!MODIFIED!!@$(MODIFIED)@g;s@!!DATE!!@`date +%d.%m.%y`@g" > $(SRC_DIR)/rev.cpp
+$(SRC_DIR)/rev.cpp: $(CONFIG_CACHE_VERSION) $(SRC_DIR)/rev.cpp.in
+ $(Q)cat $(SRC_DIR)/rev.cpp.in | sed "s@\!\!REVISION\!\!@$(REV_NR)@g;s@!!VERSION!!@$(REV)@g;s@!!MODIFIED!!@$(MODIFIED)@g;s@!!DATE!!@`date +%d.%m.%y`@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@\!\!REVISION\!\!@$(REV_NR)@g;s@!!VERSION!!@$(REV)@g;s@!!DATE!!@`date +%d.%m.%y`@g" > $(SRC_DIR)/os/windows/ottdres.rc
diff --git a/bin/baseset/no_sound.obs b/bin/baseset/no_sound.obs
index b72f609b68..6c4af154ab 100644
--- a/bin/baseset/no_sound.obs
+++ b/bin/baseset/no_sound.obs
@@ -1,4 +1,4 @@
-; $Id: no_sound.obs 26414 2014-03-18 19:51:54Z frosch $
+; $Id: no_sound.obs 26532 2014-04-27 20:01:21Z rubidium $
;
; This represents more or less nothingness
;
@@ -22,6 +22,7 @@ description.en_AU = A sound pack without any sounds.
description.en_US = A sound pack without any sounds.
description.es_ES = Un conjunto de sonidos vacío.
description.et_EE = Helikogu ilma helideta.
+description.eu_ES = Soinurik gabeko soinu pakete bat
description.fi_FI = Äänipaketti, jossa ei ole ääniä.
description.fr_FR = Un pack de sons sans sons.
description.gd_GB = Pacaid fhuaimean anns nach eil fuaim sam bith.
diff --git a/build-number.txt b/build-number.txt
index 3e86d579de..561dee4ba1 100644
--- a/build-number.txt
+++ b/build-number.txt
@@ -1,4 +1,4 @@
#Created by the Bamboo Continuous Integration Server
-#Tue Apr 01 20:37:12 CEST 2014
-build.number=46
-build.timestamp="2014-04-01 20\:37\:12"
+#Tue Oct 21 20:36:41 CEST 2014
+build.number=57
+build.timestamp="2014-10-21 20\:36\:41"
diff --git a/changelog.txt b/changelog.txt
index 1da7d4d1b2..979e6f58a2 100644
--- a/changelog.txt
+++ b/changelog.txt
@@ -1,3 +1,120 @@
+1.4.4 (2014-10-21)
+------------------------------------------------------------------------
+(None)
+
+
+1.4.4-RC1 (2014-10-08)
+------------------------------------------------------------------------
+- Fix: Image widgets stored 32bit SpriteID in uint16 (r26971)
+- Fix: Owner of road depot road types were not properly changed upon bankruptcy [FS#6126] (r26955)
+- Fix: Compilation on HAIKU (r26922)
+- Fix: Crash when enabling 'Full animation' if multiplayer chat text is on screen [FS#6096] (r26919)
+- Fix: Height computation of game script text in town GUI did not consider margins [FS#6119] (r26859)
+- Fix: [Squirrel] Debian lintian issues (r26853)
+- Fix: Compilation of strgen on various platforms like Solaris (r26850)
+- Fix: Better display of refit information for articulated vehicles [FS#6113] (r26849, r26848)
+- Fix: Do not assign a next hop when returning cargo [FS#6110] (r26847)
+- Fix: The ok-button in the OSK for the signs list should just close the OSK [FS#6116] (r26827)
+
+
+1.4.3 (2014-09-23)
+------------------------------------------------------------------------
+(None)
+
+
+1.4.3-RC2 (2014-09-14)
+------------------------------------------------------------------------
+- Fix: Crashes on joining a server with pending order backups [FS#6112] (r26819)
+- Fix: Crashes on start due to dereferencing the -1 index of the file names array of music files (r26809)
+
+
+1.4.3-RC1 (2014-09-07)
+------------------------------------------------------------------------
+- Fix: TC_NO_SHADE did not work for 32bpp text rendering (r26792)
+- Fix: Loading a game with order backups leaked Orders and left unreachable items in the pool (r26787)
+- Fix: Buffer overrun in SQCompiler::Error (r26764)
+- Fix: Desync due to not always properly restoring game state from the savegame (r26753)
+- Fix: [Script] Crashes and infinite loops when using lists in item-descending order [FS#6085] (r26744)
+- Fix: Incorrect CFLAGS when enabling gprof profiling (r26737, r26735)
+- Fix: Do not reset the last selected airport or layout, unless it is really necessary [FS#6083] (r26732)
+- Fix: Use the normal search path to look for xdg-open at Unix [FS#6077] (r26724)
+- Fix: Properly check for cargo acceptance of houses [FS#5997] (r26723)
+
+
+1.4.2 (2014-08-16)
+------------------------------------------------------------------------
+(None)
+
+
+1.4.2-RC2 (2014-08-03)
+------------------------------------------------------------------------
+- Change: Use awk instead of trying to convince cpp to preprocess nfo files (r26708)
+- Fix: CMD_CLEAR_ORDER_BACKUP should not be suppressed by pause modes (r26716)
+- Fix: [NewGRF] Parameters to SCC_NEWGRF_PUSH_WORD and SCC_NEWGRF_UNPRINT were not skipped during drawing (r26713)
+- Fix: [OSX] Compilation fails with some lzo2 versions, if __LP64__ is defined to 0 instead of checking whether it is defined [FS#6069] (r26709)
+- Fix: Wrong breakdown sound was played for ships [FS#6015] (r26706)
+- Fix: Integer overflows in acceleration code causing either too low acceleration or too high acceleration [FS#6067] (r26702)
+- Fix: Discard incorrectly saved order backups when clients join [FS#6066] (r26700)
+- Fix: Do not crash when trying to show an error about vehicle in a NewGRF and the NewGRF was not loaded at all (r26699)
+- Fix: Slovak uses space as group separator in numbers [FS#6064] (r26695)
+- Fix: Tighten parameter bound checks on GSCargoMonitor functions, and return -1 on out-of-bound parameters (r26685)
+
+
+1.4.2-RC1 (2014-07-03)
+------------------------------------------------------------------------
+- Fix: CargoPacket::SourceStation() returns a StationID (r26660)
+- Fix: Days in dates are not represented by ordinal numbers in all languages [FS#6047] (r26657)
+- Fix: Production cheat cannot be allowed to be active in multiplayer for desync reasons, even when activated in singleplayer previously [FS#6044] (r26656)
+- Fix: Make sure an 'abs' is used that supports int64 when using 'abs' on those variables (r26651)
+- Fix: Support save/load chunk lengths of up to (1 << 32) - 1 [FS#6041] (r26650)
+- Fix: Incorrect usage of string commands in the base language [FS#6037] (r26642, r26640, r26639, r26632)
+- Fix: Segmentation fault when encountering a .obg/.obs/.obm with empty string/zero length MD5 checksums [FS#6038] (r26637)
+- Fix: The 'Load' button was not properly enabled/disabled for old savegames without NewGRF information (r26634)
+- Fix: If the video driver fails to supply a list of resolutions, display an error message [FS#6012] (r26629)
+
+
+1.4.1 (2014-06-02)
+------------------------------------------------------------------------
+- Fix: First send packages about new company, then clients joining it to admin port [FS#6025] (r26616)
+
+
+1.4.1-RC2 (2014-05-18)
+------------------------------------------------------------------------
+- Fix: Save/load issues on big endian machines (r26593, r26590, r26589)
+- Fix: Consider multiheaded trains in station refits [FS#5995] (r26586)
+- Fix: Game script could be changed in game by double clicking [FS#5974] (r26583)
+- Fix: Transfer stations also should have a cargo rating [FS#5989] (r26581, r26580)
+- Fix: [Network] AIs would not reset certain network state information upon creation of their company [FS#6003] (r26578, r26576)
+- Fix: [Network] Client of non-dedicated server was not correctly put into the first company for all state variables [FS#6001] (r26577)
+
+
+1.4.1-RC1 (2014-05-04)
+------------------------------------------------------------------------
+- Change: Remove demand calculation based on tiles (r26484)
+- Change: Use pkg-config for libpng as well (r26435, r26433, r26432)
+- Change: Use better distance metric for link graph [FS#5941] (r26411)
+- Fix: [Windows] Crash when the operating system performs the "paint" callback during window creation [FS#5994] (r26539, r26538)
+- Fix: OpenBSD compilation [FS#5992] (r26523)
+- Fix: prevent from ever reading huge (or negative) amounts of data in strgen (r26521)
+- Fix: Severity rating of dedicated server messages during world generation (r26518)
+- Fix: Buffer overruns in handling of symbolic links inside tars (r26514)
+- Fix: Incorrect usage of strecpy (r26505, r26485)
+- Fix: Reading console input on dedicated server relied on unspecified behaviour (r26496)
+- Fix: Allow single-vehicle consists to station-refit in a meaningful way (r26483)
+- Fix: Prevent comparing to NULL when strndup could not allocate memory (r26476)
+- Fix: Potentially undefined shifts in NewGRF code (r26475)
+- Fix: Make sure there is no uninitialised sprite data (r26473)
+- Fix: Draw text shadow for ellipses (r26467)
+- Fix: Add special handling for PALETTE_CRASH to work for non-8bpp-mapped sprites (r26463)
+- Fix: Avoid division by 0 when scaling flow values [FS#5970] (r26448)
+- Fix: Draw links to match _settings_game.vehicle.road_side [FS#5961] (r26445)
+- Fix: Load button for heightmap list was missing [FS#5953] (r26428)
+- Fix: Do not crash when supplying an invalid filename without extension to cmd parameter -q (r26423)
+- Fix: Some road constructions used the rail sound effect [FS#5946] (r26422)
+- Fix: Goal GUI failed to shade [FS#5948] (r26420)
+- Fix: Shares button state was not appropriately updated when switching setting or company [FS#5947] (r26416)
+
+
1.4.0 (2014-04-01)
------------------------------------------------------------------------
(None)
diff --git a/config.lib b/config.lib
index 13507f3c42..3ffd0c5ccb 100644
--- a/config.lib
+++ b/config.lib
@@ -1,4 +1,4 @@
-# $Id: config.lib 26440 2014-04-01 18:33:16Z frosch $
+# $Id: config.lib 27029 2014-10-21 18:33:24Z frosch $
# 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.
@@ -1441,6 +1441,7 @@ make_cflags_and_ldflags() {
make_compiler_cflags "$cc_host" "CFLAGS" "CXXFLAGS" "LDFLAGS" "FEATURES"
CFLAGS="$CFLAGS -D$os"
+ CFLAGS_BUILD="$CFLAGS_BUILD -D$os"
if [ "$enable_debug" = "0" ]; then
# No debug, add default stuff
@@ -1450,7 +1451,11 @@ make_cflags_and_ldflags() {
LDFLAGS="$LDFLAGS -noixemul"
fi
- CFLAGS="-O2 -fomit-frame-pointer $CFLAGS"
+ if [ "$enable_profiling" = "0" ]; then
+ # -fomit-frame-pointer and -pg do not go well together (gcc errors they are incompatible)
+ CFLAGS="-fomit-frame-pointer $CFLAGS"
+ fi
+ CFLAGS="-O2 $CFLAGS"
else
OBJS_SUBDIR="debug"
@@ -1494,7 +1499,7 @@ make_cflags_and_ldflags() {
fi
if [ "$enable_profiling" != "0" ]; then
- CFLAGS="$CFLAGS -p"
+ CFLAGS="$CFLAGS -pg"
LDFLAGS="$LDFLAGS -pg"
fi
@@ -1700,17 +1705,18 @@ make_cflags_and_ldflags() {
if [ -n "$png_config" ]; then
CFLAGS="$CFLAGS -DWITH_PNG"
- CFLAGS="$CFLAGS `$png_config --cppflags --I_opts | tr '\n\r' ' '`"
+ CFLAGS="$CFLAGS `$png_config --cflags | tr '\n\r' ' '`"
- # The extra flags are unneeded for latest libpng-config, but some versions are so broken...
if [ "$enable_static" != "0" ]; then
if [ "$os" = "OSX" ]; then
- LIBS="$LIBS `$png_config --prefix`/lib/libpng.a"
+ # fontconfig_config goes via pkg-config on all systems, which doesn't know --prefix
+ # Also, despite the reason we link to the .a file ourself (because we can't use -static), we do need to ask pkg-config about possible other deps
+ LIBS="$LIBS `$png_config --variable=prefix`/lib/libpng.a `$png_config --libs --static | sed s@-lpng[0-9]*@@`"
else
- LIBS="$LIBS `$png_config --static --ldflags | tr '\n\r' ' '`"
+ LIBS="$LIBS `$png_config --libs --static | tr '\n\r' ' '`"
fi
else
- LIBS="$LIBS `$png_config --ldflags | tr '\n\r' ' '`"
+ LIBS="$LIBS `$png_config --libs | tr '\n\r' ' '`"
fi
fi
@@ -2715,80 +2721,64 @@ detect_libtimidity() {
detect_library "$with_libtimidity" "libtimidity" "libtimidity.a" "" "timidity.h"
}
-detect_lzma() {
- # 0 means no, 1 is auto-detect, 2 is force
- if [ "$with_lzma" = "0" ]; then
- log 1 "checking liblzma... disabled"
+detect_pkg_config() {
+ # $1 - config-param ($with_lzma value)
+ # $2 - package name ('liblzma')
+ # $3 - config name ('lzma_config', sets $lzma_config)
+ # $4 - minimum module version ('2.3')
- lzma_config=""
+ # 0 means no, 1 is auto-detect, 2 is force
+ if [ "$1" = "0" ]; then
+ log 1 "checking $2... disabled"
+
+ eval "$3=\"\""
return 0
fi
- if [ "$with_lzma" = "1" ] || [ "$with_lzma" = "" ] || [ "$with_lzma" = "2" ]; then
- lzma_config="pkg-config liblzma"
+ log 2 "detecting $2"
+
+ if [ "$1" = "1" ] || [ "$1" = "" ] || [ "$1" = "2" ]; then
+ pkg_config_call="pkg-config $2"
else
- lzma_config="$with_lzma"
+ pkg_config_call="$1"
fi
- version=`$lzma_config --modversion 2>/dev/null`
+ version=`$pkg_config_call --modversion 2>/dev/null`
ret=$?
- log 2 "executing $lzma_config --modversion"
+ check_version "$4" "$version"
+ version_ok=$?
+ log 2 "executing $pkg_config_call --modversion"
log 2 " returned $version"
log 2 " exit code $ret"
- if [ -z "$version" ] || [ "$ret" != "0" ]; then
- log 1 "checking liblzma... not found"
+ if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$version_ok" != "1" ]; then
+ if [ -n "$version" ] && [ "$version_ok" != "1" ]; then
+ log 1 "checking $2... needs at least version $4, $2 NOT enabled"
+ else
+ log 1 "checking $2... not found"
+ fi
# It was forced, so it should be found.
- if [ "$with_lzma" != "1" ]; then
- log 1 "configure: error: pkg-config liblzma couldn't be found"
- log 1 "configure: error: you supplied '$with_lzma', but it seems invalid"
+ if [ "$1" != "1" ]; then
+ log 1 "configure: error: pkg-config $2 couldn't be found"
+ log 1 "configure: error: you supplied '$1', but it seems invalid"
exit 1
fi
- lzma_config=""
+ eval "$3=\"\""
return 0
fi
- log 1 "checking liblzma... found"
+ eval "$3=\"$pkg_config_call\""
+ log 1 "checking $2... found"
+}
+
+detect_lzma() {
+ detect_pkg_config "$with_lzma" "liblzma" "lzma_config" "5.0"
}
detect_xdg_basedir() {
- # 0 means no, 1 is auto-detect, 2 is force
- if [ "$with_xdg_basedir" = "0" ]; then
- log 1 "checking libxdg_basedir... disabled"
-
- xdg_basedir_config=""
- return 0
- fi
-
- if [ "$with_xdg_basedir" = "1" ] || [ "$with_xdg_basedir" = "" ] || [ "$with_xdg_basedir" = "2" ]; then
- xdg_basedir_config="pkg-config libxdg-basedir"
- else
- xdg_basedir_config="$with_xdg_basedir"
- fi
-
- version=`$xdg_basedir_config --modversion 2>/dev/null`
- ret=$?
- log 2 "executing $xdg_basedir_config --modversion"
- log 2 " returned $version"
- log 2 " exit code $ret"
-
- if [ -z "$version" ] || [ "$ret" != "0" ]; then
- log 1 "checking libxdg_basedir... not found"
-
- # It was forced, so it should be found.
- if [ "$with_xdg_basedir" != "1" ]; then
- log 1 "configure: error: pkg-config libxdg_basedir couldn't be found"
- log 1 "configure: error: you supplied '$with_xdg_basedir', but it seems invalid"
- exit 1
- fi
-
- xdg_basedir_config=""
- return 0
- fi
-
- log 1 "checking libxdg_basedir... found"
+ detect_pkg_config "$with_xdg_basedir" "libxdg-basedir" "xdg_basedir_config" "1.2"
}
detect_png() {
@@ -2815,33 +2805,7 @@ detect_png() {
return 0
fi
- if [ "$with_png" = "1" ] || [ "$with_png" = "" ] || [ "$with_png" = "2" ]; then
- png_config="libpng-config"
- else
- png_config="$with_png"
- fi
-
- version=`$png_config --version 2>/dev/null`
- ret=$?
- log 2 "executing $png_config --version"
- log 2 " returned $version"
- log 2 " exit code $ret"
-
- if [ -z "$version" ] || [ "$ret" != "0" ]; then
- log 1 "checking libpng... not found"
-
- # It was forced, so it should be found.
- if [ "$with_png" != "1" ]; then
- log 1 "configure: error: libpng-config couldn't be found"
- log 1 "configure: error: you supplied '$with_png', but it seems invalid"
- exit 1
- fi
-
- png_config=""
- return 0
- fi
-
- log 1 "checking libpng... found"
+ detect_pkg_config "$with_png" "libpng" "png_config" "1.2"
}
detect_freetype() {
@@ -2936,39 +2900,7 @@ detect_fontconfig() {
return 0
fi
- if [ "$with_fontconfig" = "1" ] || [ "$with_fontconfig" = "" ] || [ "$with_fontconfig" = "2" ]; then
- fontconfig_config="pkg-config fontconfig"
- else
- fontconfig_config="$with_fontconfig"
- fi
-
- version=`$fontconfig_config --modversion 2>/dev/null`
- ret=$?
- check_version '2.3' "$version"
- version_ok=$?
- log 2 "executing $fontconfig_config --modversion"
- log 2 " returned $version"
- log 2 " exit code $ret"
-
- if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$version_ok" != "1" ]; then
- if [ -n "$version" ] && [ "$version_ok" != "1" ]; then
- log 1 "checking libfontconfig... needs at least version 2.3.0, fontconfig NOT enabled"
- else
- log 1 "checking libfontconfig... not found"
- fi
-
- # It was forced, so it should be found.
- if [ "$with_fontconfig" != "1" ]; then
- log 1 "configure: error: fontconfig-config couldn't be found"
- log 1 "configure: error: you supplied '$with_fontconfig', but it seems invalid"
- exit 1
- fi
-
- fontconfig_config=""
- return 0
- fi
-
- log 1 "checking libfontconfig... found"
+ detect_pkg_config "$with_fontconfig" "fontconfig" "fontconfig_config" "2.3"
}
detect_icu() {
diff --git a/docs/landscape.html b/docs/landscape.html
index abf01c9d8b..2aa30460ec 100644
--- a/docs/landscape.html
+++ b/docs/landscape.html
@@ -539,6 +539,7 @@
+
m3 bits 7..4: owner of road type 1 (tram); OWNER_NONE (10) is stored as OWNER_TOWN (0F)
m5 bits 7 clear: road or level-crossing
- m6 bits 5..3:
@@ -573,7 +574,6 @@
- - m3 bits 7..4: owner of road type 1 (tram); OWNER_NONE (10) is stored as OWNER_TOWN (0F)
- m5 bit 6 clear: road
- m1 bits 4..0: owner of the road type 0 (normal road)
@@ -663,6 +663,7 @@
+ - m7 bits 4..0: owner of the road type 0 (normal road)
m6 bits 7..6 : Possibility of a bridge above, in the direction specified
diff --git a/docs/landscape_grid.html b/docs/landscape_grid.html
index e2f3c1f977..cd5d3203d7 100644
--- a/docs/landscape_grid.html
+++ b/docs/landscape_grid.html
@@ -147,11 +147,11 @@ the array so you can quickly see what is used and what is not.
-inherit- |
-inherit- |
-inherit- |
- OOOO OOOO |
+ XXXX OOOO |
OOOO OOOO |
XXOO OOXX |
XXOO OOXX |
- XXXO OOOO |
+ XXXO XXXX |
| 3 |
diff --git a/known-bugs.txt b/known-bugs.txt
index 0a884cb738..642cb301ac 100644
--- a/known-bugs.txt
+++ b/known-bugs.txt
@@ -1,6 +1,6 @@
OpenTTD's known bugs
-Last updated: 2014-04-01
-Release version: 1.4.0
+Last updated: 2014-10-21
+Release version: 1.4.4
------------------------------------------------------------------------
@@ -33,12 +33,13 @@ No suitable AI can be found
If you have no AIs and an AI is started the so-called 'dummy' AI will
be loaded. This AI does nothing but writing a message on the AI debug
window and showing a red warning. There are basically two solutions
- for this problem: you must change the settings so no AI is started,
- this is done in the difficulty settings window. The other solution is
- acquiring (downloading) some AI. The easiest way to do this is via
- the "Check Online Content" button in the main (intro) menu or via
- "AI Settings" -> "Select AI" -> "Check Online Content" which is also
- accessed via the main menu.
+ for this problem: Either you set the number of AI players to 0 so that
+ no AI is started. You find that setting at the top of the window in the
+ "AI / Game Scripts Settings" window.
+ The other solution is acquiring (downloading) some AI. The easiest way
+ to do this is via the "Check Online Content" button in the main (intro)
+ menu or directly in the "AI / Game Scripts Settings" dialogue via the
+ "Check Online Content" button.
After a while of playing, colours get corrupted
In Windows 7 the background slideshow corrupts the colour mapping of
diff --git a/media/extra_grf/assemble_nfo.awk b/media/extra_grf/assemble_nfo.awk
new file mode 100644
index 0000000000..462cea75a6
--- /dev/null
+++ b/media/extra_grf/assemble_nfo.awk
@@ -0,0 +1,32 @@
+# $Id: assemble_nfo.awk 26715 2014-08-03 14:06:04Z frosch $
+
+# 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 .
+
+BEGIN {
+ # Very basic variant function; barely any error checking.
+ # Just use the first argument as the file to start from when assembling everything
+ path = ARGV[1];
+ gsub("[^/\\\\]*$", "", path);
+ assemble(ARGV[1]);
+}
+
+# Recursive function for assembling by means of resolving the #includes.
+function assemble(filename) {
+ while ((getline < filename) > 0) {
+ if (NF == 2 && $1 == "#include" ) {
+ # Remove the quotes.
+ gsub("[\"'<>]", "", $2);
+ assemble(path $2);
+ } else {
+ print $0;
+ }
+ }
+
+ if (close(filename) < 0) {
+ print "Could not open " filename > "/dev/stderr";
+ exit -1;
+ }
+}
diff --git a/os/debian/changelog b/os/debian/changelog
index 1ff0deed6c..95e4f8099e 100644
--- a/os/debian/changelog
+++ b/os/debian/changelog
@@ -1,3 +1,69 @@
+openttd (1.4.4-0) unstable; urgency=low
+
+ * New upstream release 1.4.4
+
+ -- OpenTTD Tue, 21 Oct 2014 21:00:00 +0200
+
+openttd (1.4.4~RC1-0) unstable; urgency=low
+
+ * New upstream release 1.4.4-RC1
+
+ -- OpenTTD Wed, 08 Oct 2014 19:00:00 +0200
+
+openttd (1.4.3-0) unstable; urgency=low
+
+ * New upstream release 1.4.3
+
+ -- OpenTTD Tue, 23 Sep 2014 21:00:00 +0200
+
+openttd (1.4.3~RC2-0) unstable; urgency=low
+
+ * New upstream release 1.4.3-RC2
+
+ -- OpenTTD Sun, 14 Sep 2014 19:00:00 +0200
+
+openttd (1.4.3~RC1-0) unstable; urgency=low
+
+ * New upstream release 1.4.3-RC1
+
+ -- OpenTTD Sun, 07 Sep 2014 19:00:00 +0200
+
+openttd (1.4.2-0) unstable; urgency=low
+
+ * New upstream release 1.4.2
+
+ -- OpenTTD Sat, 16 Aug 2014 21:00:00 +0200
+
+openttd (1.4.2~RC2-0) unstable; urgency=low
+
+ * New upstream release 1.4.2-RC2
+
+ -- OpenTTD Sun, 03 Aug 2014 18:00:00 +0200
+
+openttd (1.4.2~RC1-0) unstable; urgency=low
+
+ * New upstream release 1.4.2-RC1
+
+ -- OpenTTD Thu, 03 Jul 2014 21:00:00 +0200
+
+openttd (1.4.1-0) unstable; urgency=low
+
+ * New upstream release 1.4.1
+
+ -- OpenTTD Mon, 02 Jun 2014 21:00:00 +0200
+
+openttd (1.4.1~RC2-0) unstable; urgency=low
+
+ * New upstream release 1.4.1-RC2
+
+ -- OpenTTD Sun, 18 May 2014 21:00:00 +0200
+
+openttd (1.4.1~RC1-0) unstable; urgency=low
+
+ * New upstream release 1.4.1-RC1
+
+ -- OpenTTD Sun, 04 May 2014 21:00:00 +0200
+
openttd (1.4.0-0) unstable; urgency=low
* New upstream release 1.4.0
diff --git a/os/windows/installer/install.nsi b/os/windows/installer/install.nsi
index 30fbc653ec..aefe17ed02 100644
--- a/os/windows/installer/install.nsi
+++ b/os/windows/installer/install.nsi
@@ -1,8 +1,8 @@
# Version numbers to update
!define APPV_MAJOR 1
!define APPV_MINOR 4
-!define APPV_MAINT 0
-!define APPV_BUILD 6
+!define APPV_MAINT 4
+!define APPV_BUILD 1
!define APPV_EXTRA ""
!define APPNAME "OpenTTD" ; Define application name
diff --git a/projects/openttd_vs100.vcxproj b/projects/openttd_vs100.vcxproj
index bd2400e96e..317bc46dba 100644
--- a/projects/openttd_vs100.vcxproj
+++ b/projects/openttd_vs100.vcxproj
@@ -403,7 +403,6 @@
-
@@ -645,7 +644,6 @@
-
@@ -657,7 +655,6 @@
-
@@ -694,9 +691,7 @@
-
-
@@ -745,17 +740,14 @@
-
-
-
@@ -834,7 +826,6 @@
-
@@ -959,13 +950,7 @@
-
-
-
-
-
-
diff --git a/projects/openttd_vs100.vcxproj.filters b/projects/openttd_vs100.vcxproj.filters
index 185cb6325c..9de799d1ec 100644
--- a/projects/openttd_vs100.vcxproj.filters
+++ b/projects/openttd_vs100.vcxproj.filters
@@ -438,9 +438,6 @@
Header Files
-
- Header Files
-
Header Files
@@ -1164,9 +1161,6 @@
Header Files
-
- Header Files
-
Header Files
@@ -1200,9 +1194,6 @@
Header Files
-
- Header Files
-
Header Files
@@ -1311,15 +1302,9 @@
GUI Source Code
-
- GUI Source Code
-
GUI Source Code
-
- GUI Source Code
-
GUI Source Code
@@ -1464,18 +1449,12 @@
GUI Source Code
-
- GUI Source Code
-
GUI Source Code
GUI Source Code
-
- GUI Source Code
-
Widgets
@@ -1494,9 +1473,6 @@
Widgets
-
- Widgets
-
Widgets
@@ -1731,9 +1707,6 @@
Command handlers
-
- Command handlers
-
Save/Load handlers
@@ -2106,27 +2079,9 @@
Squirrel headers
-
- Squirrel headers
-
-
- Squirrel headers
-
-
- Squirrel headers
-
Squirrel headers
-
- Squirrel headers
-
-
- Squirrel headers
-
-
- Squirrel headers
-
Squirrel headers
diff --git a/projects/openttd_vs80.vcproj b/projects/openttd_vs80.vcproj
index a9a484417d..f32c0be585 100644
--- a/projects/openttd_vs80.vcproj
+++ b/projects/openttd_vs80.vcproj
@@ -886,10 +886,6 @@
RelativePath=".\..\src\bridge.h"
>
-
-
@@ -1854,10 +1850,6 @@
RelativePath=".\..\src\viewport_type.h"
>
-
-
@@ -1902,10 +1894,6 @@
RelativePath=".\..\src\window_type.h"
>
-
-
@@ -2058,18 +2046,10 @@
RelativePath=".\..\src\build_vehicle_gui.cpp"
>
-
-
-
-
@@ -2262,10 +2242,6 @@
RelativePath=".\..\src\vehicle_gui.cpp"
>
-
-
@@ -2274,10 +2250,6 @@
RelativePath=".\..\src\waypoint_gui.cpp"
>
-
-
-
-
@@ -2626,10 +2594,6 @@
RelativePath=".\..\src\waypoint_cmd.cpp"
>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/projects/openttd_vs90.vcproj b/projects/openttd_vs90.vcproj
index 2fc471448c..97c02c515f 100644
--- a/projects/openttd_vs90.vcproj
+++ b/projects/openttd_vs90.vcproj
@@ -1,7 +1,7 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -447,6 +445,10 @@
RelativePath=".\..\src\autoreplace.cpp"
>
+
+
@@ -507,6 +509,10 @@
RelativePath=".\..\src\dedicated.cpp"
>
+
+
@@ -539,6 +545,10 @@
RelativePath=".\..\src\fios.cpp"
>
+
+
@@ -547,10 +557,6 @@
RelativePath=".\..\src\fontdetection.cpp"
>
-
-
@@ -564,11 +570,11 @@
>
-
-
-
-
@@ -623,18 +621,14 @@
RelativePath=".\..\src\linkgraph\linkgraphschedule.cpp"
>
-
-
-
-
+
+
@@ -699,6 +693,10 @@
RelativePath=".\..\src\rail.cpp"
>
+
+
@@ -747,6 +745,10 @@
RelativePath=".\..\src\station.cpp"
>
+
+
@@ -763,10 +765,6 @@
RelativePath=".\..\src\strings.cpp"
>
-
-
@@ -863,6 +861,10 @@
RelativePath=".\..\src\autoslope.h"
>
+
+
@@ -999,6 +1001,10 @@
RelativePath=".\..\src\video\dedicated_v.h"
>
+
+
@@ -1087,6 +1093,10 @@
RelativePath=".\..\src\fios.h"
>
+
+
@@ -1095,10 +1105,6 @@
RelativePath=".\..\src\fontdetection.h"
>
-
-
@@ -1195,6 +1201,10 @@
RelativePath=".\..\src\ini_type.h"
>
+
+
@@ -1207,18 +1217,6 @@
RelativePath=".\..\src\language.h"
>
-
-
-
-
-
-
@@ -1247,14 +1245,6 @@
RelativePath=".\..\src\linkgraph\linkgraphschedule.h"
>
-
-
-
-
@@ -1267,6 +1257,10 @@
RelativePath=".\..\src\map_type.h"
>
+
+
@@ -1515,6 +1509,10 @@
RelativePath=".\..\src\rail_type.h"
>
+
+
@@ -2260,11 +2258,11 @@
>
-
-
-
-
-
-
-
-
-
-
-
-
@@ -3512,11 +3486,11 @@
>
-
-
-
-
@@ -3907,6 +3873,14 @@
RelativePath=".\..\src\blitter\32bpp_sse4.hpp"
>
+
+
+
+
diff --git a/readme.txt b/readme.txt
index 8a6ae58ac6..74de256310 100644
--- a/readme.txt
+++ b/readme.txt
@@ -1,5 +1,5 @@
-Last updated: 2014-04-01
-Release version: 1.4.0
+Last updated: 2014-10-21
+Release version: 1.4.4
------------------------------------------------------------------------
@@ -674,46 +674,47 @@ http://homer.rice.edu/~sandmann/cwsdpmi/csdpmi5s.zip
X.X) Credits
---- -------
The OpenTTD team (in alphabetical order):
- Albert Hofkamp (Alberth) - GUI expert
- Jean-François Claeys (Belugas) - GUI, newindustries and more
- Matthijs Kooijman (blathijs) - Pathfinder-guru, pool rework
- Ulf Hermann (fonsinchen) - Cargo Distribution
- Christoph Elsenhans (frosch) - General coding
- Loïc Guilloux (glx) - Windows Expert
- Michael Lutz (michi_cc) - Path based signals
- Owen Rudge (orudge) - Forum host, OS/2 port
- Peter Nelson (peter1138) - Spiritual descendant from newGRF gods
- Ingo von Borstel (planetmaker) - Support
- Remko Bijker (Rubidium) - Lead coder and way more
- Zdeněk Sojka (SmatZ) - Bug finder and fixer
- José Soler (Terkhen) - General coding
- Thijs Marinussen (Yexo) - AI Framework
- Leif Linse (Zuu) - AI/Game Script
+ Albert Hofkamp (Alberth) - GUI expert (since 0.7)
+ Matthijs Kooijman (blathijs) - Pathfinder-guru, Debian port (since 0.3)
+ Ulf Hermann (fonsinchen) - Cargo Distribution (since 1.3)
+ Christoph Elsenhans (frosch) - General coding (since 0.6)
+ Loïc Guilloux (glx) - Windows Expert (since 0.4.5)
+ Michael Lutz (michi_cc) - Path based signals (since 0.7)
+ Owen Rudge (orudge) - Forum host, OS/2 port (since 0.1)
+ Peter Nelson (peter1138) - Spiritual descendant from newGRF gods (since 0.4.5)
+ Ingo von Borstel (planetmaker) - General coding, Support (since 1.1)
+ Remko Bijker (Rubidium) - Lead coder and way more (since 0.4.5)
+ José Soler (Terkhen) - General coding (since 1.0)
+ Leif Linse (Zuu) - AI/Game Script (since 1.2)
Inactive Developers:
- Bjarni Corfitzen (Bjarni) - MacOSX port, coder and vehicles
- Victor Fischer (Celestar) - Programming everywhere you need him to
- Tamás Faragó (Darkvater) - Ex-Lead coder
- Jaroslav Mazanec (KUDr) - YAPG (Yet Another Pathfinder God) ;)
- Jonathan Coome (Maedhros) - High priest of the NewGRF Temple
- Attila Bán (MiHaMiX) - WebTranslator 1 and 2
- Christoph Mallon (Tron) - Programmer, code correctness police
+ Jean-François Claeys (Belugas) - GUI, newindustries and more (0.4.5 - 1.0)
+ Bjarni Corfitzen (Bjarni) - MacOSX port, coder and vehicles (0.3 - 0.7)
+ Victor Fischer (Celestar) - Programming everywhere you need him to (0.3 - 0.6)
+ Jaroslav Mazanec (KUDr) - YAPG (Yet Another Pathfinder God) ;) (0.4.5 - 0.6)
+ Jonathan Coome (Maedhros) - High priest of the NewGRF Temple (0.5 - 0.6)
+ Attila Bán (MiHaMiX) - WebTranslator 1 and 2 (0.3 - 0.5)
+ Zdeněk Sojka (SmatZ) - Bug finder and fixer (0.6 - 1.3)
+ Christoph Mallon (Tron) - Programmer, code correctness police (0.3 - 0.5)
+ Patric Stout (TrueBrain) - NoProgrammer (0.3 - 1.2), sys op (active)
+ Thijs Marinussen (Yexo) - AI Framework, General (0.6 - 1.3)
Retired Developers:
- Ludvig Strigeus (ludde) - OpenTTD author, main coder (0.1 - 0.3.3)
- Serge Paquet (vurlix) - Assistant project manager, coder (0.1 - 0.3.3)
- Dominik Scherer (dominik81) - Lead programmer, GUI expert (0.3.0 - 0.3.6)
- Benedikt Brüggemeier (skidd13) - Bug fixer and code reworker
- Patric Stout (TrueBrain) - NoProgrammer (0.3 - 1.2), sys op (active)
+ Tamás Faragó (Darkvater) - Ex-Lead coder (0.3 - 0.5)
+ Dominik Scherer (dominik81) - Lead programmer, GUI expert (0.3 - 0.3)
+ Emil Djupfeld (egladil) - MacOSX port (0.4 - 0.6)
+ Simon Sasburg (HackyKid) - Bug fixer (0.4 - 0.4.5)
+ Ludvig Strigeus (ludde) - Original author of OpenTTD, main coder (0.1 - 0.3)
+ Cian Duffy (MYOB) - BeOS port / manual writing (0.1 - 0.3)
+ Petr Baudiš (pasky) - Many patches, newgrf support, etc. (0.3 - 0.3)
+ Benedikt Brüggemeier (skidd13) - Bug fixer and code reworker (0.6 - 0.7)
+ Serge Paquet (vurlix) - 2nd contributor after ludde (0.1 - 0.3)
Thanks to:
Josef Drexler - For his great work on TTDPatch.
Marcin Grzegorczyk - For his TTDPatch work and documentation of Transport Tycoon Deluxe internals and track foundations
- Petr Baudiš (pasky) - Many patches, newgrf support, etc.
- Simon Sasburg (HackyKid) - For the many bugfixes he has blessed us with
Stefan Meißner (sign_de) - For his work on the console
Mike Ragsdale - OpenTTD installer
- Cian Duffy (MYOB) - BeOS port / manual writing
Christian Rosentreter (tokai) - MorphOS / AmigaOS port
Richard Kempton (RichK67) - Additional airports, initial TGP implementation
Alberto Demichelis - Squirrel scripting language
diff --git a/source.list b/source.list
index f2bc976fdb..143785589b 100644
--- a/source.list
+++ b/source.list
@@ -729,13 +729,7 @@ script/squirrel_std.hpp
3rdparty/squirrel/squirrel/sqpcheader.h
3rdparty/squirrel/squirrel/sqstate.h
3rdparty/squirrel/include/sqstdaux.h
-3rdparty/squirrel/include/sqstdblob.h
-3rdparty/squirrel/sqstdlib/sqstdblobimpl.h
-3rdparty/squirrel/include/sqstdio.h
3rdparty/squirrel/include/sqstdmath.h
-3rdparty/squirrel/sqstdlib/sqstdstream.h
-3rdparty/squirrel/include/sqstdstring.h
-3rdparty/squirrel/include/sqstdsystem.h
3rdparty/squirrel/squirrel/sqstring.h
3rdparty/squirrel/squirrel/sqtable.h
3rdparty/squirrel/include/squirrel.h
diff --git a/src/3rdparty/squirrel/squirrel/sqcompiler.cpp b/src/3rdparty/squirrel/squirrel/sqcompiler.cpp
index b9eace1c63..35fcc9e499 100644
--- a/src/3rdparty/squirrel/squirrel/sqcompiler.cpp
+++ b/src/3rdparty/squirrel/squirrel/sqcompiler.cpp
@@ -66,7 +66,7 @@ public:
static SQChar temp[256];
va_list vl;
va_start(vl, s);
- scvsprintf(temp, s, vl);
+ scvsnprintf(temp, sizeof(temp), s, vl);
va_end(vl);
throw temp;
}
diff --git a/src/ai/ai_gui.cpp b/src/ai/ai_gui.cpp
index 69ca059f04..21447a28a9 100644
--- a/src/ai/ai_gui.cpp
+++ b/src/ai/ai_gui.cpp
@@ -1,4 +1,4 @@
-/* $Id: ai_gui.cpp 26086 2013-11-24 14:46:26Z rubidium $ */
+/* $Id: ai_gui.cpp 26596 2014-05-18 11:26:09Z frosch $ */
/*
* This file is part of OpenTTD.
@@ -853,7 +853,7 @@ struct AIConfigWindow : public Window {
case WID_AIC_GAMELIST: {
this->selected_slot = OWNER_DEITY;
this->InvalidateData();
- if (click_count > 1 && this->selected_slot != INVALID_COMPANY) ShowAIListWindow((CompanyID)this->selected_slot);
+ if (click_count > 1 && this->selected_slot != INVALID_COMPANY && _game_mode != GM_NORMAL) ShowAIListWindow((CompanyID)this->selected_slot);
break;
}
@@ -952,7 +952,7 @@ static bool SetScriptButtonColour(NWidgetCore &button, bool dead, bool paused)
{
/* Dead scripts are indicated with red background and
* paused scripts are indicated with yellow background. */
- Colours colour = dead ? COLOUR_WHITE :
+ Colours colour = dead ? COLOUR_RED :
(paused ? COLOUR_YELLOW : COLOUR_GREY);
if (button.colour != colour) {
button.colour = colour;
@@ -1195,10 +1195,10 @@ struct AIDebugWindow : public Window {
TextColour colour;
switch (log->type[pos]) {
case ScriptLog::LOG_SQ_INFO: colour = TC_BLACK; break;
- case ScriptLog::LOG_SQ_ERROR: colour = TC_WHITE; break;
+ case ScriptLog::LOG_SQ_ERROR: colour = TC_RED; break;
case ScriptLog::LOG_INFO: colour = TC_BLACK; break;
case ScriptLog::LOG_WARNING: colour = TC_YELLOW; break;
- case ScriptLog::LOG_ERROR: colour = TC_WHITE; break;
+ case ScriptLog::LOG_ERROR: colour = TC_RED; break;
default: colour = TC_BLACK; break;
}
diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp
index 1b048775a3..9011d1aa11 100644
--- a/src/airport_gui.cpp
+++ b/src/airport_gui.cpp
@@ -1,4 +1,4 @@
-/* $Id: airport_gui.cpp 26165 2013-12-18 18:23:30Z frosch $ */
+/* $Id: airport_gui.cpp 26789 2014-09-07 15:07:22Z frosch $ */
/*
* This file is part of OpenTTD.
@@ -44,7 +44,7 @@ void CcBuildAirport(const CommandCost &result, TileIndex tile, uint32 p1, uint32
{
if (result.Failed()) return;
- if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT, tile);
+ if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT_OTHER, tile);
if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
}
@@ -226,8 +226,27 @@ public:
this->SetWidgetLoweredState(WID_AP_BTN_DOHILIGHT, _settings_client.gui.station_show_coverage);
this->OnInvalidateData();
- this->vscroll->SetCount(AirportClass::Get(_selected_airport_class)->GetSpecCount());
- this->SelectFirstAvailableAirport(true);
+ /* Ensure airport class is valid (changing NewGRFs). */
+ _selected_airport_class = Clamp(_selected_airport_class, APC_BEGIN, (AirportClassID)(AirportClass::GetClassCount() - 1));
+ const AirportClass *ac = AirportClass::Get(_selected_airport_class);
+ this->vscroll->SetCount(ac->GetSpecCount());
+
+ /* Ensure the airport index is valid for this class (changing NewGRFs). */
+ _selected_airport_index = Clamp(_selected_airport_index, -1, ac->GetSpecCount() - 1);
+
+ /* Only when no valid airport was selected, we want to select the first airport. */
+ bool selectFirstAirport = true;
+ if (_selected_airport_index != -1) {
+ const AirportSpec *as = ac->GetSpec(_selected_airport_index);
+ if (as->IsAvailable()) {
+ /* Ensure the airport layout is valid. */
+ _selected_airport_layout = Clamp(_selected_airport_layout, 0, as->num_table - 1);
+ selectFirstAirport = false;
+ this->UpdateSelectSize();
+ }
+ }
+
+ if (selectFirstAirport) this->SelectFirstAvailableAirport(true);
}
virtual ~BuildAirportWindow()
diff --git a/src/articulated_vehicles.cpp b/src/articulated_vehicles.cpp
index 95b27d5d10..25c7747d65 100644
--- a/src/articulated_vehicles.cpp
+++ b/src/articulated_vehicles.cpp
@@ -1,4 +1,4 @@
-/* $Id: articulated_vehicles.cpp 25259 2013-05-19 14:22:04Z rubidium $ */
+/* $Id: articulated_vehicles.cpp 26972 2014-10-06 20:10:07Z frosch $ */
/*
* This file is part of OpenTTD.
@@ -160,6 +160,41 @@ CargoArray GetCapacityOfArticulatedParts(EngineID engine)
return capacity;
}
+/**
+ * Get the default cargoes and refits of an articulated vehicle.
+ * The refits are linked to a cargo rather than an articulated part to prevent a long list of parts.
+ * @param engine Model to investigate.
+ * @param[out] cargoes Total amount of units that can be transported, summed by cargo.
+ * @param[out] refits Whether a (possibly partial) refit for each cargo is possible.
+ */
+void GetArticulatedVehicleCargoesAndRefits(EngineID engine, CargoArray *cargoes, uint32 *refits)
+{
+ cargoes->Clear();
+ *refits = 0;
+
+ const Engine *e = Engine::Get(engine);
+
+ CargoID cargo_type;
+ uint16 cargo_capacity = GetVehicleDefaultCapacity(engine, &cargo_type);
+ if (cargo_type < NUM_CARGO && cargo_capacity > 0) {
+ (*cargoes)[cargo_type] += cargo_capacity;
+ if (IsEngineRefittable(engine)) SetBit(*refits, cargo_type);
+ }
+
+ if (!e->IsGroundVehicle() || !HasBit(e->info.callback_mask, CBM_VEHICLE_ARTIC_ENGINE)) return;
+
+ for (uint i = 1; i < MAX_ARTICULATED_PARTS; i++) {
+ EngineID artic_engine = GetNextArticulatedPart(i, engine);
+ if (artic_engine == INVALID_ENGINE) break;
+
+ cargo_capacity = GetVehicleDefaultCapacity(artic_engine, &cargo_type);
+ if (cargo_type < NUM_CARGO && cargo_capacity > 0) {
+ (*cargoes)[cargo_type] += cargo_capacity;
+ if (IsEngineRefittable(artic_engine)) SetBit(*refits, cargo_type);
+ }
+ }
+}
+
/**
* Checks whether any of the articulated parts is refittable
* @param engine the first part
diff --git a/src/autoreplace_gui.cpp b/src/autoreplace_gui.cpp
index 0b725052cb..1fef9ff5c3 100644
--- a/src/autoreplace_gui.cpp
+++ b/src/autoreplace_gui.cpp
@@ -1,4 +1,4 @@
-/* $Id: autoreplace_gui.cpp 25919 2013-10-28 10:28:24Z frosch $ */
+/* $Id: autoreplace_gui.cpp 26653 2014-06-17 19:14:59Z frosch $ */
/*
* This file is part of OpenTTD.
@@ -276,10 +276,8 @@ public:
}
case WID_RV_INFO_TAB: {
- SetDParam(0, STR_REPLACE_NOT_REPLACING);
- Dimension d = GetStringBoundingBox(STR_BLACK_STRING);
- SetDParam(0, STR_REPLACE_NOT_REPLACING_VEHICLE_SELECTED);
- d = maxdim(d, GetStringBoundingBox(STR_BLACK_STRING));
+ Dimension d = GetStringBoundingBox(STR_REPLACE_NOT_REPLACING);
+ d = maxdim(d, GetStringBoundingBox(STR_REPLACE_NOT_REPLACING_VEHICLE_SELECTED));
d.width += WD_FRAMETEXT_LEFT + WD_FRAMETEXT_RIGHT;
d.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
*size = maxdim(*size, d);
@@ -351,20 +349,21 @@ public:
switch (widget) {
case WID_RV_INFO_TAB: {
const Company *c = Company::Get(_local_company);
+ StringID str;
if (this->sel_engine[0] != INVALID_ENGINE) {
if (!EngineHasReplacementForCompany(c, this->sel_engine[0], this->sel_group)) {
- SetDParam(0, STR_REPLACE_NOT_REPLACING);
+ str = STR_REPLACE_NOT_REPLACING;
} else {
bool when_old = false;
EngineID e = EngineReplacementForCompany(c, this->sel_engine[0], this->sel_group, &when_old);
- SetDParam(0, when_old ? STR_REPLACE_REPLACING_WHEN_OLD : STR_ENGINE_NAME);
- SetDParam(1, e);
+ str = when_old ? STR_REPLACE_REPLACING_WHEN_OLD : STR_ENGINE_NAME;
+ SetDParam(0, e);
}
} else {
- SetDParam(0, STR_REPLACE_NOT_REPLACING_VEHICLE_SELECTED);
+ str = STR_REPLACE_NOT_REPLACING_VEHICLE_SELECTED;
}
- DrawString(r.left + WD_FRAMETEXT_LEFT, r.right - WD_FRAMETEXT_RIGHT, r.top + WD_FRAMERECT_TOP, STR_BLACK_STRING, TC_FROMSTRING, SA_HOR_CENTER);
+ DrawString(r.left + WD_FRAMETEXT_LEFT, r.right - WD_FRAMETEXT_RIGHT, r.top + WD_FRAMERECT_TOP, str, TC_BLACK, SA_HOR_CENTER);
break;
}
diff --git a/src/base_media_func.h b/src/base_media_func.h
index 352460d971..068f22e68d 100644
--- a/src/base_media_func.h
+++ b/src/base_media_func.h
@@ -1,4 +1,4 @@
-/* $Id: base_media_func.h 26073 2013-11-23 18:13:46Z rubidium $ */
+/* $Id: base_media_func.h 26652 2014-06-17 19:08:07Z frosch $ */
/*
* This file is part of OpenTTD.
@@ -100,7 +100,7 @@ bool BaseSet::FillSetDetails(IniFile *ini, const
/* Then find the MD5 checksum */
item = md5s->GetItem(filename, false);
- if (item == NULL) {
+ if (item == NULL || item->value == NULL) {
DEBUG(grf, 0, "No MD5 checksum specified for: %s (in %s)", filename, full_filename);
return false;
}
diff --git a/src/blitter/32bpp_anim.cpp b/src/blitter/32bpp_anim.cpp
index e087fb94a7..87de1fd521 100644
--- a/src/blitter/32bpp_anim.cpp
+++ b/src/blitter/32bpp_anim.cpp
@@ -1,4 +1,4 @@
-/* $Id: 32bpp_anim.cpp 24111 2012-04-10 20:16:51Z rubidium $ */
+/* $Id: 32bpp_anim.cpp 26544 2014-04-29 18:41:19Z frosch $ */
/*
* This file is part of OpenTTD.
@@ -133,6 +133,46 @@ inline void Blitter_32bppAnim::Draw(const Blitter::BlitterParams *bp, ZoomLevel
}
break;
+ case BM_CRASH_REMAP:
+ if (src_px->a == 255) {
+ do {
+ uint m = *src_n;
+ if (m == 0) {
+ uint8 g = MakeDark(src_px->r, src_px->g, src_px->b);
+ *dst = ComposeColourRGBA(g, g, g, src_px->a, *dst);
+ *anim = 0;
+ } else {
+ uint r = remap[GB(m, 0, 8)];
+ *anim = r | (m & 0xFF00);
+ if (r != 0) *dst = this->AdjustBrightness(this->LookupColourInPalette(r), GB(m, 8, 8));
+ }
+ anim++;
+ dst++;
+ src_px++;
+ src_n++;
+ } while (--n != 0);
+ } else {
+ do {
+ uint m = *src_n;
+ if (m == 0) {
+ if (src_px->a != 0) {
+ uint8 g = MakeDark(src_px->r, src_px->g, src_px->b);
+ *dst = ComposeColourRGBA(g, g, g, src_px->a, *dst);
+ *anim = 0;
+ }
+ } else {
+ uint r = remap[GB(m, 0, 8)];
+ *anim = 0;
+ if (r != 0) *dst = ComposeColourPANoCheck(this->AdjustBrightness(this->LookupColourInPalette(r), GB(m, 8, 8)), src_px->a, *dst);
+ }
+ anim++;
+ dst++;
+ src_px++;
+ src_n++;
+ } while (--n != 0);
+ }
+ break;
+
case BM_TRANSPARENT:
/* TODO -- We make an assumption here that the remap in fact is transparency, not some colour.
* This is never a problem with the code we produce, but newgrfs can make it fail... or at least:
@@ -208,6 +248,7 @@ void Blitter_32bppAnim::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomL
case BM_NORMAL: Draw (bp, zoom); return;
case BM_COLOUR_REMAP: Draw(bp, zoom); return;
case BM_TRANSPARENT: Draw (bp, zoom); return;
+ case BM_CRASH_REMAP: Draw (bp, zoom); return;
}
}
@@ -439,7 +480,7 @@ void Blitter_32bppAnim::PaletteAnimate(const Palette &palette)
}
/* Make sure the backend redraws the whole screen */
- _video_driver->MakeDirty(0, 0, _screen.width, _screen.height);
+ VideoDriver::GetInstance()->MakeDirty(0, 0, _screen.width, _screen.height);
}
Blitter::PaletteAnimation Blitter_32bppAnim::UsePaletteAnimation()
diff --git a/src/blitter/32bpp_anim_sse4.cpp b/src/blitter/32bpp_anim_sse4.cpp
index 16632718fa..7f648cdca3 100644
--- a/src/blitter/32bpp_anim_sse4.cpp
+++ b/src/blitter/32bpp_anim_sse4.cpp
@@ -1,4 +1,4 @@
-/* $Id: 32bpp_anim_sse4.cpp 26260 2014-01-13 18:20:23Z rubidium $ */
+/* $Id: 32bpp_anim_sse4.cpp 26541 2014-04-29 18:18:52Z frosch $ */
/*
* This file is part of OpenTTD.
@@ -313,6 +313,25 @@ bmcr_alpha_blend_single:
if (src[0].a) anim[0] = 0;
}
break;
+
+ case BM_CRASH_REMAP:
+ for (uint x = (uint) bp->width; x > 0; x--) {
+ if (src_mv->m == 0) {
+ if (src->a != 0) {
+ uint8 g = MakeDark(src->r, src->g, src->b);
+ *dst = ComposeColourRGBA(g, g, g, src->a, *dst);
+ *anim = 0;
+ }
+ } else {
+ uint r = remap[src_mv->m];
+ if (r != 0) *dst = ComposeColourPANoCheck(this->AdjustBrightness(this->LookupColourInPalette(r), src_mv->v), src->a, *dst);
+ }
+ src_mv++;
+ dst++;
+ src++;
+ anim++;
+ }
+ break;
}
next_line:
@@ -373,6 +392,7 @@ bm_normal:
}
break;
case BM_TRANSPARENT: Draw(bp, zoom); return;
+ case BM_CRASH_REMAP: Draw(bp, zoom); return;
}
}
diff --git a/src/blitter/32bpp_base.hpp b/src/blitter/32bpp_base.hpp
index 33e637e070..044aa02c8b 100644
--- a/src/blitter/32bpp_base.hpp
+++ b/src/blitter/32bpp_base.hpp
@@ -1,4 +1,4 @@
-/* $Id: 32bpp_base.hpp 24610 2012-10-17 20:21:43Z frosch $ */
+/* $Id: 32bpp_base.hpp 26541 2014-04-29 18:18:52Z frosch $ */
/*
* This file is part of OpenTTD.
@@ -112,6 +112,19 @@ public:
return Colour(r * nom / denom, g * nom / denom, b * nom / denom);
}
+ /**
+ * Make a colour dark grey, for specialized 32bpp remapping.
+ * @param r red component
+ * @param g green component
+ * @param b blue component
+ * @return the brightness value of the new colour, now dark grey.
+ */
+ static inline uint8 MakeDark(uint8 r, uint8 g, uint8 b)
+ {
+ /* Magic-numbers are ~66% of those used in MakeGrey() */
+ return ((r * 13063) + (g * 25647) + (b * 4981)) / 65536;
+ }
+
/**
* Make a colour grey - based.
* @param colour the colour to make grey.
diff --git a/src/blitter/32bpp_optimized.cpp b/src/blitter/32bpp_optimized.cpp
index c054c7f820..a3765dd350 100644
--- a/src/blitter/32bpp_optimized.cpp
+++ b/src/blitter/32bpp_optimized.cpp
@@ -1,4 +1,4 @@
-/* $Id: 32bpp_optimized.cpp 25820 2013-10-06 19:38:36Z frosch $ */
+/* $Id: 32bpp_optimized.cpp 26541 2014-04-29 18:18:52Z frosch $ */
/*
* This file is part of OpenTTD.
@@ -141,6 +141,40 @@ inline void Blitter_32bppOptimized::Draw(const Blitter::BlitterParams *bp, ZoomL
}
break;
+ case BM_CRASH_REMAP:
+ if (src_px->a == 255) {
+ do {
+ uint m = *src_n;
+ if (m == 0) {
+ uint8 g = MakeDark(src_px->r, src_px->g, src_px->b);
+ *dst = ComposeColourRGBA(g, g, g, src_px->a, *dst);
+ } else {
+ uint r = remap[GB(m, 0, 8)];
+ if (r != 0) *dst = this->AdjustBrightness(this->LookupColourInPalette(r), GB(m, 8, 8));
+ }
+ dst++;
+ src_px++;
+ src_n++;
+ } while (--n != 0);
+ } else {
+ do {
+ uint m = *src_n;
+ if (m == 0) {
+ if (src_px->a != 0) {
+ uint8 g = MakeDark(src_px->r, src_px->g, src_px->b);
+ *dst = ComposeColourRGBA(g, g, g, src_px->a, *dst);
+ }
+ } else {
+ uint r = remap[GB(m, 0, 8)];
+ if (r != 0) *dst = ComposeColourPANoCheck(this->AdjustBrightness(this->LookupColourInPalette(r), GB(m, 8, 8)), src_px->a, *dst);
+ }
+ dst++;
+ src_px++;
+ src_n++;
+ } while (--n != 0);
+ }
+ break;
+
case BM_TRANSPARENT:
/* TODO -- We make an assumption here that the remap in fact is transparency, not some colour.
* This is never a problem with the code we produce, but newgrfs can make it fail... or at least:
@@ -204,6 +238,7 @@ void Blitter_32bppOptimized::Draw(Blitter::BlitterParams *bp, BlitterMode mode,
case BM_NORMAL: Draw (bp, zoom); return;
case BM_COLOUR_REMAP: Draw(bp, zoom); return;
case BM_TRANSPARENT: Draw (bp, zoom); return;
+ case BM_CRASH_REMAP: Draw (bp, zoom); return;
}
}
diff --git a/src/blitter/32bpp_simple.cpp b/src/blitter/32bpp_simple.cpp
index 5b8267b645..8cf98b5642 100644
--- a/src/blitter/32bpp_simple.cpp
+++ b/src/blitter/32bpp_simple.cpp
@@ -1,4 +1,4 @@
-/* $Id: 32bpp_simple.cpp 26103 2013-11-25 13:06:33Z rubidium $ */
+/* $Id: 32bpp_simple.cpp 26541 2014-04-29 18:18:52Z frosch $ */
/*
* This file is part of OpenTTD.
@@ -45,6 +45,17 @@ void Blitter_32bppSimple::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Zoo
}
break;
+ case BM_CRASH_REMAP:
+ if (src->m == 0) {
+ if (src->a != 0) {
+ uint8 g = MakeDark(src->r, src->g, src->b);
+ *dst = ComposeColourRGBA(g, g, g, src->a, *dst);
+ }
+ } else {
+ if (bp->remap[src->m] != 0) *dst = ComposeColourPA(this->AdjustBrightness(this->LookupColourInPalette(bp->remap[src->m]), src->v), src->a, *dst);
+ }
+ break;
+
case BM_TRANSPARENT:
/* TODO -- We make an assumption here that the remap in fact is transparency, not some colour.
* This is never a problem with the code we produce, but newgrfs can make it fail... or at least:
diff --git a/src/blitter/32bpp_sse2.cpp b/src/blitter/32bpp_sse2.cpp
index fbb69f0499..fa62a6a297 100644
--- a/src/blitter/32bpp_sse2.cpp
+++ b/src/blitter/32bpp_sse2.cpp
@@ -1,4 +1,4 @@
-/* $Id: 32bpp_sse2.cpp 26259 2014-01-13 18:17:17Z rubidium $ */
+/* $Id: 32bpp_sse2.cpp 26541 2014-04-29 18:18:52Z frosch $ */
/*
* This file is part of OpenTTD.
@@ -36,6 +36,7 @@ Sprite *Blitter_32bppSSE_Base::Encode(const SpriteLoader::Sprite *sprite, Alloca
/* Calculate sizes and allocate. */
SpriteData sd;
+ memset(&sd, 0, sizeof(sd));
uint all_sprites_size = 0;
for (ZoomLevel z = zoom_min; z <= zoom_max; z++) {
const SpriteLoader::Sprite *src_sprite = &sprite[z];
diff --git a/src/blitter/32bpp_sse_func.hpp b/src/blitter/32bpp_sse_func.hpp
index 155292e899..a4e7c97e0e 100644
--- a/src/blitter/32bpp_sse_func.hpp
+++ b/src/blitter/32bpp_sse_func.hpp
@@ -1,4 +1,4 @@
-/* $Id: 32bpp_sse_func.hpp 26334 2014-02-11 21:17:43Z frosch $ */
+/* $Id: 32bpp_sse_func.hpp 26541 2014-04-29 18:18:52Z frosch $ */
/*
* This file is part of OpenTTD.
@@ -238,13 +238,13 @@ inline void Blitter_32bppSSE4::Draw(const Blitter::BlitterParams *bp, ZoomLevel
for (int y = bp->height; y != 0; y--) {
Colour *dst = dst_line;
const Colour *src = src_rgba_line + META_LENGTH;
- if (mode == BM_COLOUR_REMAP) src_mv = src_mv_line;
+ if (mode == BM_COLOUR_REMAP || mode == BM_CRASH_REMAP) src_mv = src_mv_line;
if (read_mode == RM_WITH_MARGIN) {
assert(bt_last == BT_NONE); // or you must ensure block type is preserved
src += src_rgba_line[0].data;
dst += src_rgba_line[0].data;
- if (mode == BM_COLOUR_REMAP) src_mv += src_rgba_line[0].data;
+ if (mode == BM_COLOUR_REMAP || mode == BM_CRASH_REMAP) src_mv += src_rgba_line[0].data;
const int width_diff = si->sprite_width - bp->width;
effective_width = bp->width - (int) src_rgba_line[0].data;
const int delta_diff = (int) src_rgba_line[1].data - width_diff;
@@ -377,10 +377,27 @@ bmcr_alpha_blend_single:
dst->data = _mm_cvtsi128_si32(DarkenTwoPixels(srcABCD, dstABCD, DARKEN_PARAM_1, DARKEN_PARAM_2));
}
break;
+
+ case BM_CRASH_REMAP:
+ for (uint x = (uint) bp->width; x > 0; x--) {
+ if (src_mv->m == 0) {
+ if (src->a != 0) {
+ uint8 g = MakeDark(src->r, src->g, src->b);
+ *dst = ComposeColourRGBA(g, g, g, src->a, *dst);
+ }
+ } else {
+ uint r = remap[src_mv->m];
+ if (r != 0) *dst = ComposeColourPANoCheck(this->AdjustBrightness(this->LookupColourInPalette(r), src_mv->v), src->a, *dst);
+ }
+ src_mv++;
+ dst++;
+ src++;
+ }
+ break;
}
next_line:
- if (mode == BM_COLOUR_REMAP) src_mv_line += si->sprite_width;
+ if (mode == BM_COLOUR_REMAP || mode == BM_CRASH_REMAP) src_mv_line += si->sprite_width;
src_rgba_line = (const Colour*) ((const byte*) src_rgba_line + si->sprite_line_size);
dst_line += bp->pitch;
}
@@ -429,6 +446,7 @@ bm_normal:
Draw(bp, zoom); return;
}
case BM_TRANSPARENT: Draw(bp, zoom); return;
+ case BM_CRASH_REMAP: Draw(bp, zoom); return;
}
}
#endif /* FULL_ANIMATION */
diff --git a/src/blitter/8bpp_optimized.cpp b/src/blitter/8bpp_optimized.cpp
index 50d5e929a7..864ff37583 100644
--- a/src/blitter/8bpp_optimized.cpp
+++ b/src/blitter/8bpp_optimized.cpp
@@ -1,4 +1,4 @@
-/* $Id: 8bpp_optimized.cpp 25820 2013-10-06 19:38:36Z frosch $ */
+/* $Id: 8bpp_optimized.cpp 26541 2014-04-29 18:18:52Z frosch $ */
/*
* This file is part of OpenTTD.
@@ -83,7 +83,8 @@ void Blitter_8bppOptimized::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Z
width -= pixels;
switch (mode) {
- case BM_COLOUR_REMAP: {
+ case BM_COLOUR_REMAP:
+ case BM_CRASH_REMAP: {
const uint8 *remap = bp->remap;
do {
uint m = remap[*src];
diff --git a/src/blitter/8bpp_simple.cpp b/src/blitter/8bpp_simple.cpp
index 100f5ed1c9..a42ccc1894 100644
--- a/src/blitter/8bpp_simple.cpp
+++ b/src/blitter/8bpp_simple.cpp
@@ -1,4 +1,4 @@
-/* $Id: 8bpp_simple.cpp 26103 2013-11-25 13:06:33Z rubidium $ */
+/* $Id: 8bpp_simple.cpp 26541 2014-04-29 18:18:52Z frosch $ */
/*
* This file is part of OpenTTD.
@@ -37,6 +37,7 @@ void Blitter_8bppSimple::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Zoom
switch (mode) {
case BM_COLOUR_REMAP:
+ case BM_CRASH_REMAP:
colour = bp->remap[*src];
break;
diff --git a/src/blitter/base.hpp b/src/blitter/base.hpp
index 37a09794d8..b380948fcc 100644
--- a/src/blitter/base.hpp
+++ b/src/blitter/base.hpp
@@ -1,4 +1,4 @@
-/* $Id: base.hpp 25911 2013-10-23 19:41:20Z fonsinchen $ */
+/* $Id: base.hpp 26541 2014-04-29 18:18:52Z frosch $ */
/*
* This file is part of OpenTTD.
@@ -20,6 +20,7 @@ enum BlitterMode {
BM_NORMAL, ///< Perform the simple blitting.
BM_COLOUR_REMAP, ///< Perform a colour remapping.
BM_TRANSPARENT, ///< Perform transparency colour remapping.
+ BM_CRASH_REMAP, ///< Perform a crash remapping.
};
/**
diff --git a/src/bootstrap_gui.cpp b/src/bootstrap_gui.cpp
index 70bc4b06db..0a9959133e 100644
--- a/src/bootstrap_gui.cpp
+++ b/src/bootstrap_gui.cpp
@@ -1,4 +1,4 @@
-/* $Id: bootstrap_gui.cpp 26209 2014-01-02 22:41:58Z rubidium $ */
+/* $Id: bootstrap_gui.cpp 26544 2014-04-29 18:41:19Z frosch $ */
/*
* This file is part of OpenTTD.
@@ -244,7 +244,7 @@ bool HandleBootstrap()
new BootstrapAskForDownloadWindow();
/* Process the user events. */
- _video_driver->MainLoop();
+ VideoDriver::GetInstance()->MainLoop();
/* _exit_game is used to get out of the video driver's main loop.
* In case GM_BOOTSTRAP is still set we did not exit it via the
diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp
index fa2866c014..35e4c869df 100644
--- a/src/build_vehicle_gui.cpp
+++ b/src/build_vehicle_gui.cpp
@@ -1,4 +1,4 @@
-/* $Id: build_vehicle_gui.cpp 26241 2014-01-12 18:00:39Z frosch $ */
+/* $Id: build_vehicle_gui.cpp 26972 2014-10-06 20:10:07Z frosch $ */
/*
* This file is part of OpenTTD.
@@ -526,21 +526,20 @@ static GUIEngineList::FilterFunction * const _filter_funcs[] = {
&CargoFilter,
};
-static int DrawCargoCapacityInfo(int left, int right, int y, EngineID engine, bool refittable)
+static int DrawCargoCapacityInfo(int left, int right, int y, EngineID engine)
{
- CargoArray cap = GetCapacityOfArticulatedParts(engine);
+ CargoArray cap;
+ uint32 refits;
+ GetArticulatedVehicleCargoesAndRefits(engine, &cap, &refits);
for (CargoID c = 0; c < NUM_CARGO; c++) {
if (cap[c] == 0) continue;
SetDParam(0, c);
SetDParam(1, cap[c]);
- SetDParam(2, refittable ? STR_PURCHASE_INFO_REFITTABLE : STR_EMPTY);
+ SetDParam(2, HasBit(refits, c) ? STR_PURCHASE_INFO_REFITTABLE : STR_EMPTY);
DrawString(left, right, y, STR_PURCHASE_INFO_CAPACITY);
y += FONT_HEIGHT_NORMAL;
-
- /* Only show as refittable once */
- refittable = false;
}
return y;
@@ -825,7 +824,7 @@ int DrawVehiclePurchaseInfo(int left, int right, int y, EngineID engine_number)
if (articulated_cargo) {
/* Cargo type + capacity, or N/A */
- int new_y = DrawCargoCapacityInfo(left, right, y, engine_number, refittable);
+ int new_y = DrawCargoCapacityInfo(left, right, y, engine_number);
if (new_y == y) {
SetDParam(0, CT_INVALID);
@@ -1444,4 +1443,4 @@ void ShowBuildVehicleWindow(TileIndex tile, VehicleType type)
DeleteWindowById(WC_BUILD_VEHICLE, num);
new BuildVehicleWindow(&_build_vehicle_desc, tile, type);
-}
\ No newline at end of file
+}
diff --git a/src/cargo_table_gui.cpp b/src/cargo_table_gui.cpp
index 625e90ee4e..9e794f2921 100644
--- a/src/cargo_table_gui.cpp
+++ b/src/cargo_table_gui.cpp
@@ -1,217 +1,218 @@
-/* $Id: cargo_table_gui.cpp 21909 2011-01-26 08:14:36Z TheDude $ */
-
-#include "stdafx.h"
-#include "window_gui.h"
-#include "window_func.h"
-#include "strings_func.h"
-#include "company_func.h"
-#include "company_base.h"
-#include "table/strings.h"
-#include "textbuf_gui.h"
-#include "cargotype.h"
-#include "widgets/dropdown_type.h"
-
-#include "widgets/cargo_table_widget.h"
-
-static const uint EXP_TOPPADDING = 5;
-static const uint EXP_LINESPACE = 2; ///< Amount of vertical space for a horizontal (sub-)total line.
-static const uint EXP_BLOCKSPACE = 10; ///< Amount of vertical space between two blocks of numbers.
-
-enum CargoOption {
- WID_CT_OPTION_CARGO_TOTAL = 0,
- WID_CT_OPTION_CARGO_MONTH,
-};
-
-static void DrawPrice(Money amount, int left, int right, int top)
-{
- SetDParam(0, amount);
- DrawString(left, right, top, STR_FINANCES_POSITIVE_INCOME, TC_FROMSTRING, SA_RIGHT);
-}
-
-void InvalidateCargosWindows(CompanyID cid)
-{
- if (cid == _local_company) SetWindowDirty(WC_STATUS_BAR, 0);
- SetWindowDirty(WC_CARGOS, cid);
-}
-
-/** Cargos window handler. */
-struct CargosWindow : Window {
-
- CargoOption cargoPeriod;
- CargosWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
- {
- this->InitNested(window_number);
- this->owner = (Owner)this->window_number;
- this->cargoPeriod = WID_CT_OPTION_CARGO_TOTAL;
- }
-
- virtual void SetStringParameters(int widget) const
- {
- if(widget != WID_CT_CAPTION) return;
- SetDParam(0, (CompanyID)this->window_number);
- SetDParam(1, (CompanyID)this->window_number);
- }
-
- virtual void OnClick(Point pt, int widget, int click_count)
- {
- if(widget != WID_CT_HEADER_CARGO) return;
- this->cargoPeriod = (this->cargoPeriod == WID_CT_OPTION_CARGO_TOTAL) ? WID_CT_OPTION_CARGO_MONTH : WID_CT_OPTION_CARGO_TOTAL;
- this->SetDirty();
- }
-
- void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
- {
- uint extra_width = 0;
- switch(widget){
- case WID_CT_HEADER_AMOUNT:
- case WID_CT_HEADER_INCOME:
- extra_width += 16;
- case WID_CT_HEADER_CARGO:
- size->width = 96 + extra_width;
- size->height = EXP_BLOCKSPACE + EXP_LINESPACE;
- break;
-
- case WID_CT_AMOUNT:
- case WID_CT_INCOME:
- extra_width += 16;
- case WID_CT_LIST:
- size->width = 96 + extra_width;
- size->height = (_sorted_standard_cargo_specs_size + 3) * (EXP_BLOCKSPACE + EXP_LINESPACE);
- break;
- }
- }
-
- void DrawWidget(const Rect &r, int widget) const
- {
- int rect_x = (r.left + WD_FRAMERECT_LEFT);
- int y = r.top;
- const Company *c = Company::Get((CompanyID)this->window_number);
- uint32 sum_cargo_amount = 0;
- Money sum_cargo_income = 0;
-
- switch(widget){
- case WID_CT_HEADER_CARGO:
- //DrawString(r.left, r.right, y, STR_TOOLBAR_CARGOS_HEADER_CARGO, TC_FROMSTRING, SA_LEFT);
- y += EXP_BLOCKSPACE + EXP_LINESPACE;
- break;
- case WID_CT_HEADER_AMOUNT:
- DrawString(r.left, r.right, y, STR_TOOLBAR_CARGOS_HEADER_AMOUNT, TC_FROMSTRING, SA_CENTER);
- y += EXP_BLOCKSPACE + EXP_LINESPACE;
- break;
- case WID_CT_HEADER_INCOME:
- DrawString(r.left, r.right, y, STR_TOOLBAR_CARGOS_HEADER_INCOME, TC_FROMSTRING, SA_RIGHT);
- y += EXP_BLOCKSPACE + EXP_LINESPACE;
- break;
-
- case WID_CT_LIST:{
- y += EXP_TOPPADDING; //top padding
- for (int i = 0; i < _sorted_standard_cargo_specs_size; i++) {
- const CargoSpec *cs = _sorted_cargo_specs[i];
-
- GfxFillRect(rect_x, y, rect_x + 8, y + 5, 0);
- GfxFillRect(rect_x + 1, y + 1, rect_x + 7, y + 4, cs->legend_colour); //coloured cargo rectangles
-
- SetDParam(0, cs->name);
- DrawString(r.left + 14, r.right, y, STR_TOOLBAR_CARGOS_NAME); //cargo name
-
- y += EXP_BLOCKSPACE + EXP_LINESPACE; //padding
- }
-
- //total
- GfxFillRect(rect_x, y, rect_x + 96, y, 0);
- y += EXP_BLOCKSPACE + EXP_LINESPACE;
-
- StringID string_to_draw = STR_TOOLBAR_CARGOS_HEADER_TOTAL;
- if(this->cargoPeriod != WID_CT_OPTION_CARGO_TOTAL) string_to_draw++;
- DrawString(r.left, r.right, y, string_to_draw);
- break;
- }
- case WID_CT_AMOUNT:
- y += EXP_TOPPADDING;
- for (int i = 0; i < _sorted_standard_cargo_specs_size; i++) {
- const CargoSpec *cs = _sorted_cargo_specs[i];
-
- if(this->cargoPeriod == WID_CT_OPTION_CARGO_MONTH){
- sum_cargo_amount += c->cargo_units_period[0][cs->Index()];
- SetDParam(0, c->cargo_units_period[0][cs->Index()]);
- }
- else{
- sum_cargo_amount += c->cargo_units[cs->Index()];
- SetDParam(0, c->cargo_units[cs->Index()]);
- }
-
- DrawString(r.left, r.right, y, STR_TOOLBAR_CARGOS_UNITS, TC_FROMSTRING, SA_RIGHT); //cargo amount in pcs
- y += EXP_BLOCKSPACE + EXP_LINESPACE;
- }
-
- //total
- GfxFillRect(rect_x, y, rect_x + 108, y, 0);
- y += EXP_BLOCKSPACE + EXP_LINESPACE;
- SetDParam(0, sum_cargo_amount);
- DrawString(r.left, r.right, y, STR_TOOLBAR_CARGOS_UNITS_TOTAL, TC_FROMSTRING, SA_RIGHT);
- break;
-
- case WID_CT_INCOME:
- y += EXP_TOPPADDING;
- for (int i = 0; i < _sorted_standard_cargo_specs_size; i++) {
- const CargoSpec *cs = _sorted_cargo_specs[i];
-
- if(this->cargoPeriod == WID_CT_OPTION_CARGO_MONTH){
- sum_cargo_income += c->cargo_income_period[0][cs->Index()];
- DrawPrice(c->cargo_income_period[0][cs->Index()], r.left, r.right, y); //cargo income in money
- }
- else{
- sum_cargo_income += c->cargo_income[cs->Index()];
- DrawPrice(c->cargo_income[cs->Index()], r.left, r.right, y); //cargo income in money
- }
-
- y += EXP_BLOCKSPACE + EXP_LINESPACE;
- }
-
- //total
- GfxFillRect(rect_x, y, rect_x + 108, y, 0);
- y += EXP_BLOCKSPACE + EXP_LINESPACE;
- DrawPrice(sum_cargo_income, r.left, r.right, y);
- break;
- }
- }
-};
-
-static const NWidgetPart _nested_cargos_widgets[] = {
- NWidget(NWID_HORIZONTAL),
- NWidget(WWT_CLOSEBOX, COLOUR_GREY),
- NWidget(WWT_CAPTION, COLOUR_GREY, WID_CT_CAPTION), SetDataTip(STR_TOOLBAR_CARGOS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
- NWidget(WWT_SHADEBOX, COLOUR_GREY),
- NWidget(WWT_STICKYBOX, COLOUR_GREY),
- EndContainer(),
- NWidget(WWT_PANEL, COLOUR_GREY), SetResize(1, 1),
- NWidget(NWID_HORIZONTAL), SetPadding(WD_FRAMERECT_TOP, WD_FRAMERECT_RIGHT, WD_FRAMERECT_BOTTOM, WD_FRAMERECT_LEFT), SetPIP(0, 9, 0),
- NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_CT_HEADER_CARGO), SetMinimalSize(96, 16),SetFill(1, 0), SetPadding(2,2,2,2), SetDataTip(STR_TOOLBAR_CARGOS_HEADER_CARGO, STR_TOOLBAR_CARGOS_HEADER_CARGO),
- NWidget(WWT_EMPTY, COLOUR_GREY, WID_CT_HEADER_AMOUNT), SetMinimalSize(108, 16), SetFill(1, 0), SetPadding(2,2,2,2), SetDataTip(STR_TOOLBAR_CARGOS_HEADER_AMOUNT, STR_TOOLBAR_CARGOS_HEADER_AMOUNT),
- NWidget(WWT_EMPTY, COLOUR_GREY, WID_CT_HEADER_INCOME), SetMinimalSize(108, 16), SetFill(1, 0), SetPadding(2,2,2,2), SetDataTip(STR_TOOLBAR_CARGOS_HEADER_INCOME, STR_TOOLBAR_CARGOS_HEADER_INCOME),
- EndContainer(),
- EndContainer(),
- NWidget(WWT_PANEL, COLOUR_GREY), SetResize(1, 1),
- NWidget(NWID_HORIZONTAL), SetPadding(WD_FRAMERECT_TOP, WD_FRAMERECT_RIGHT, WD_FRAMERECT_BOTTOM, WD_FRAMERECT_LEFT), SetPIP(0, 9, 0),
- NWidget(WWT_EMPTY, COLOUR_GREY, WID_CT_LIST),SetMinimalSize(96, 0),SetFill(1, 0), SetPadding(2,2,2,2), SetResize(1, 1),
- NWidget(WWT_EMPTY, COLOUR_GREY, WID_CT_AMOUNT),SetMinimalSize(108, 0),SetFill(1, 0), SetPadding(2,2,2,2), SetResize(1, 1),
- NWidget(WWT_EMPTY, COLOUR_GREY, WID_CT_INCOME),SetMinimalSize(108, 0),SetFill(1, 0), SetPadding(2,2,2,2), SetResize(1, 1),
- NWidget(NWID_VERTICAL),
- NWidget(NWID_SPACER), SetFill(0, 1), SetResize(0, 1),
- EndContainer(),
- EndContainer(),
- EndContainer(),
-};
-
-static WindowDesc _cargos_desc(
- WDP_AUTO, NULL, 0, 0,
- WC_CARGOS, WC_NONE,
- WDF_CONSTRUCTION,
- _nested_cargos_widgets, lengthof(_nested_cargos_widgets)
-);
-
-void ShowCompanyCargos(CompanyID company)
-{
- if (!Company::IsValidID(company)) return;
- AllocateWindowDescFront(&_cargos_desc, company);
-}
+/* $Id: cargo_table_gui.cpp 21909 2011-01-26 08:14:36Z TheDude $ */
+
+#include "stdafx.h"
+#include "window_gui.h"
+#include "window_func.h"
+#include "strings_func.h"
+#include "company_func.h"
+#include "company_base.h"
+#include "table/strings.h"
+#include "textbuf_gui.h"
+#include "cargotype.h"
+#include "widgets/dropdown_type.h"
+
+#include "widgets/cargo_table_widget.h"
+
+static const uint EXP_TOPPADDING = 5;
+static const uint EXP_LINESPACE = 2; ///< Amount of vertical space for a horizontal (sub-)total line.
+static const uint EXP_BLOCKSPACE = 10; ///< Amount of vertical space between two blocks of numbers.
+
+enum CargoOption {
+ WID_CT_OPTION_CARGO_TOTAL = 0,
+ WID_CT_OPTION_CARGO_MONTH,
+};
+
+static void DrawPrice(Money amount, int left, int right, int top)
+{
+ SetDParam(0, amount);
+ DrawString(left, right, top, STR_FINANCES_POSITIVE_INCOME, TC_FROMSTRING, SA_RIGHT);
+}
+
+void InvalidateCargosWindows(CompanyID cid)
+{
+ if (cid == _local_company) SetWindowDirty(WC_STATUS_BAR, 0);
+ SetWindowDirty(WC_CARGOS, cid);
+}
+
+/** Cargos window handler. */
+struct CargosWindow : Window {
+
+ CargoOption cargoPeriod;
+ CargosWindow(WindowDesc *desc, WindowNumber window_number) : Window(desc)
+ {
+ this->InitNested(window_number);
+ this->owner = (Owner)this->window_number;
+ this->cargoPeriod = WID_CT_OPTION_CARGO_TOTAL;
+ }
+
+ virtual void SetStringParameters(int widget) const
+ {
+ if(widget != WID_CT_CAPTION) return;
+ SetDParam(0, (CompanyID)this->window_number);
+ SetDParam(1, (CompanyID)this->window_number);
+ }
+
+ virtual void OnClick(Point pt, int widget, int click_count)
+ {
+ if(widget != WID_CT_HEADER_CARGO) return;
+ this->cargoPeriod = (this->cargoPeriod == WID_CT_OPTION_CARGO_TOTAL) ? WID_CT_OPTION_CARGO_MONTH : WID_CT_OPTION_CARGO_TOTAL;
+ this->SetDirty();
+ }
+
+ void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize)
+ {
+ uint extra_width = 0;
+ switch(widget){
+ case WID_CT_HEADER_AMOUNT:
+ case WID_CT_HEADER_INCOME:
+ extra_width += 16;
+ case WID_CT_HEADER_CARGO:
+ size->width = 96 + extra_width;
+ size->height = EXP_BLOCKSPACE + EXP_LINESPACE;
+ break;
+
+ case WID_CT_AMOUNT:
+ case WID_CT_INCOME:
+ extra_width += 16;
+ case WID_CT_LIST:
+ size->width = 96 + extra_width;
+ size->height = (_sorted_standard_cargo_specs_size + 3) * (EXP_BLOCKSPACE + EXP_LINESPACE);
+ break;
+ }
+ }
+
+ void DrawWidget(const Rect &r, int widget) const
+ {
+ int rect_x = (r.left + WD_FRAMERECT_LEFT);
+ int y = r.top;
+ const Company *c = Company::Get((CompanyID)this->window_number);
+ uint32 sum_cargo_amount = 0;
+ Money sum_cargo_income = 0;
+
+ switch(widget){
+ case WID_CT_HEADER_CARGO:
+ //DrawString(r.left, r.right, y, STR_TOOLBAR_CARGOS_HEADER_CARGO, TC_FROMSTRING, SA_LEFT);
+ y += EXP_BLOCKSPACE + EXP_LINESPACE;
+ break;
+ case WID_CT_HEADER_AMOUNT:
+ DrawString(r.left, r.right, y, STR_TOOLBAR_CARGOS_HEADER_AMOUNT, TC_FROMSTRING, SA_CENTER);
+ y += EXP_BLOCKSPACE + EXP_LINESPACE;
+ break;
+ case WID_CT_HEADER_INCOME:
+ DrawString(r.left, r.right, y, STR_TOOLBAR_CARGOS_HEADER_INCOME, TC_FROMSTRING, SA_RIGHT);
+ y += EXP_BLOCKSPACE + EXP_LINESPACE;
+ break;
+
+ case WID_CT_LIST:{
+ y += EXP_TOPPADDING; //top padding
+ for (int i = 0; i < _sorted_standard_cargo_specs_size; i++) {
+ const CargoSpec *cs = _sorted_cargo_specs[i];
+
+ GfxFillRect(rect_x, y, rect_x + 8, y + 5, 0);
+ GfxFillRect(rect_x + 1, y + 1, rect_x + 7, y + 4, cs->legend_colour); //coloured cargo rectangles
+
+ SetDParam(0, cs->name);
+ DrawString(r.left + 14, r.right, y, STR_TOOLBAR_CARGOS_NAME); //cargo name
+
+ y += EXP_BLOCKSPACE + EXP_LINESPACE; //padding
+ }
+
+ //total
+ GfxFillRect(rect_x, y, rect_x + 96, y, 0);
+ y += EXP_BLOCKSPACE + EXP_LINESPACE;
+
+ StringID string_to_draw = STR_TOOLBAR_CARGOS_HEADER_TOTAL;
+ if(this->cargoPeriod != WID_CT_OPTION_CARGO_TOTAL) string_to_draw++;
+ DrawString(r.left, r.right, y, string_to_draw);
+ break;
+ }
+ case WID_CT_AMOUNT:
+ y += EXP_TOPPADDING;
+ for (int i = 0; i < _sorted_standard_cargo_specs_size; i++) {
+ const CargoSpec *cs = _sorted_cargo_specs[i];
+
+ if(this->cargoPeriod == WID_CT_OPTION_CARGO_MONTH){
+ sum_cargo_amount += c->cargo_units_period[0][cs->Index()];
+ SetDParam(0, c->cargo_units_period[0][cs->Index()]);
+ }
+ else{
+ sum_cargo_amount += c->cargo_units[cs->Index()];
+ SetDParam(0, c->cargo_units[cs->Index()]);
+ }
+
+ DrawString(r.left, r.right, y, STR_TOOLBAR_CARGOS_UNITS, TC_FROMSTRING, SA_RIGHT); //cargo amount in pcs
+ y += EXP_BLOCKSPACE + EXP_LINESPACE;
+ }
+
+ //total
+ GfxFillRect(rect_x, y, rect_x + 108, y, 0);
+ y += EXP_BLOCKSPACE + EXP_LINESPACE;
+ SetDParam(0, sum_cargo_amount);
+ DrawString(r.left, r.right, y, STR_TOOLBAR_CARGOS_UNITS_TOTAL, TC_FROMSTRING, SA_RIGHT);
+ break;
+
+ case WID_CT_INCOME:
+ y += EXP_TOPPADDING;
+ for (int i = 0; i < _sorted_standard_cargo_specs_size; i++) {
+ const CargoSpec *cs = _sorted_cargo_specs[i];
+
+ if(this->cargoPeriod == WID_CT_OPTION_CARGO_MONTH){
+ sum_cargo_income += c->cargo_income_period[0][cs->Index()];
+ DrawPrice(c->cargo_income_period[0][cs->Index()], r.left, r.right, y); //cargo income in money
+ }
+ else{
+ sum_cargo_income += c->cargo_income[cs->Index()];
+ DrawPrice(c->cargo_income[cs->Index()], r.left, r.right, y); //cargo income in money
+ }
+
+ y += EXP_BLOCKSPACE + EXP_LINESPACE;
+ }
+
+ //total
+ GfxFillRect(rect_x, y, rect_x + 108, y, 0);
+ y += EXP_BLOCKSPACE + EXP_LINESPACE;
+ DrawPrice(sum_cargo_income, r.left, r.right, y);
+ break;
+ }
+ }
+};
+
+static const NWidgetPart _nested_cargos_widgets[] = {
+ NWidget(NWID_HORIZONTAL),
+ NWidget(WWT_CLOSEBOX, COLOUR_GREY),
+ NWidget(WWT_CAPTION, COLOUR_GREY, WID_CT_CAPTION), SetDataTip(STR_TOOLBAR_CARGOS_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
+ NWidget(WWT_SHADEBOX, COLOUR_GREY),
+ NWidget(WWT_STICKYBOX, COLOUR_GREY),
+ EndContainer(),
+ NWidget(WWT_PANEL, COLOUR_GREY), SetResize(1, 1),
+ NWidget(NWID_HORIZONTAL), SetPadding(WD_FRAMERECT_TOP, WD_FRAMERECT_RIGHT, WD_FRAMERECT_BOTTOM, WD_FRAMERECT_LEFT), SetPIP(0, 9, 0),
+ NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_CT_HEADER_CARGO), SetMinimalSize(96, 16),SetFill(1, 0), SetPadding(2,2,2,2), SetDataTip(STR_TOOLBAR_CARGOS_HEADER_CARGO, STR_TOOLBAR_CARGOS_HEADER_CARGO),
+ NWidget(WWT_EMPTY, COLOUR_GREY, WID_CT_HEADER_AMOUNT), SetMinimalSize(108, 16), SetFill(1, 0), SetPadding(2,2,2,2), SetDataTip(STR_TOOLBAR_CARGOS_HEADER_AMOUNT, STR_TOOLBAR_CARGOS_HEADER_AMOUNT),
+ NWidget(WWT_EMPTY, COLOUR_GREY, WID_CT_HEADER_INCOME), SetMinimalSize(108, 16), SetFill(1, 0), SetPadding(2,2,2,2), SetDataTip(STR_TOOLBAR_CARGOS_HEADER_INCOME, STR_TOOLBAR_CARGOS_HEADER_INCOME),
+ EndContainer(),
+ EndContainer(),
+ NWidget(WWT_PANEL, COLOUR_GREY), SetResize(1, 1),
+ NWidget(NWID_HORIZONTAL), SetPadding(WD_FRAMERECT_TOP, WD_FRAMERECT_RIGHT, WD_FRAMERECT_BOTTOM, WD_FRAMERECT_LEFT), SetPIP(0, 9, 0),
+ NWidget(WWT_EMPTY, COLOUR_GREY, WID_CT_LIST),SetMinimalSize(96, 0),SetFill(1, 0), SetPadding(2,2,2,2), SetResize(1, 1),
+ NWidget(WWT_EMPTY, COLOUR_GREY, WID_CT_AMOUNT),SetMinimalSize(108, 0),SetFill(1, 0), SetPadding(2,2,2,2), SetResize(1, 1),
+ NWidget(WWT_EMPTY, COLOUR_GREY, WID_CT_INCOME),SetMinimalSize(108, 0),SetFill(1, 0), SetPadding(2,2,2,2), SetResize(1, 1),
+ NWidget(NWID_VERTICAL),
+ NWidget(NWID_SPACER), SetFill(0, 1), SetResize(0, 1),
+ EndContainer(),
+ EndContainer(),
+ EndContainer(),
+};
+
+static WindowDesc _cargos_desc(
+ WDP_AUTO, NULL, 0, 0,
+ WC_CARGOS, WC_NONE,
+ WDF_CONSTRUCTION,
+ _nested_cargos_widgets, lengthof(_nested_cargos_widgets)
+);
+
+void ShowCompanyCargos(CompanyID company)
+{
+ if (!Company::IsValidID(company)) return;
+ AllocateWindowDescFront(&_cargos_desc, company);
+}
+
diff --git a/src/cargo_table_gui.h b/src/cargo_table_gui.h
index a21b3483a9..a997899aeb 100644
--- a/src/cargo_table_gui.h
+++ b/src/cargo_table_gui.h
@@ -1,14 +1,14 @@
-/* $Id: cargo_table_gui.h 21700 2011-01-03 11:55:08Z $ */
-
-/** @file cargo_table_gui.h GUI Functions related to cargos. */
-
-#ifndef CARGO_TABLE_H
-#define CARGO_TABLE_H
-
-#include "company_type.h"
-#include "gfx_type.h"
-
-void ShowCompanyCargos(CompanyID company);
-void InvalidateCargosWindows(CompanyID cid);
-
-#endif /* CARGO_TABLE_H */
+/* $Id: cargo_table_gui.h 21700 2011-01-03 11:55:08Z $ */
+
+/** @file cargo_table_gui.h GUI Functions related to cargos. */
+
+#ifndef CARGO_TABLE_H
+#define CARGO_TABLE_H
+
+#include "company_type.h"
+#include "gfx_type.h"
+
+void ShowCompanyCargos(CompanyID company);
+void InvalidateCargosWindows(CompanyID cid);
+
+#endif /* CARGO_TABLE_H */
diff --git a/src/cargomonitor.cpp b/src/cargomonitor.cpp
index 529e5e1229..5c1c028393 100644
--- a/src/cargomonitor.cpp
+++ b/src/cargomonitor.cpp
@@ -1,4 +1,4 @@
-/* $Id: cargomonitor.cpp 24986 2013-02-10 19:49:04Z zuu $ */
+/* $Id: cargomonitor.cpp 26714 2014-08-03 14:03:07Z frosch $ */
/*
* This file is part of OpenTTD.
@@ -67,7 +67,7 @@ void ClearCargoDeliveryMonitoring(CompanyID company)
* @param keep_monitoring After returning from this call, continue monitoring.
* @return Amount collected since last query/activation for the monitored combination.
*/
-static uint32 GetAmount(CargoMonitorMap &monitor_map, CargoMonitorID monitor, bool keep_monitoring)
+static int32 GetAmount(CargoMonitorMap &monitor_map, CargoMonitorID monitor, bool keep_monitoring)
{
CargoMonitorMap::iterator iter = monitor_map.find(monitor);
if (iter == monitor_map.end()) {
@@ -77,7 +77,7 @@ static uint32 GetAmount(CargoMonitorMap &monitor_map, CargoMonitorID monitor, bo
}
return 0;
} else {
- uint32 result = iter->second;
+ int32 result = iter->second;
iter->second = 0;
if (!keep_monitoring) monitor_map.erase(iter);
return result;
@@ -90,7 +90,7 @@ static uint32 GetAmount(CargoMonitorMap &monitor_map, CargoMonitorID monitor, bo
* @param keep_monitoring After returning from this call, continue monitoring.
* @return Amount of delivered cargo for the monitored combination.
*/
-uint32 GetDeliveryAmount(CargoMonitorID monitor, bool keep_monitoring)
+int32 GetDeliveryAmount(CargoMonitorID monitor, bool keep_monitoring)
{
return GetAmount(_cargo_deliveries, monitor, keep_monitoring);
}
@@ -102,7 +102,7 @@ uint32 GetDeliveryAmount(CargoMonitorID monitor, bool keep_monitoring)
* @return Amount of picked up cargo for the monitored combination.
* @note Cargo pick up is counted on final delivery, to prevent users getting credit for picking up cargo without delivering it.
*/
-uint32 GetPickupAmount(CargoMonitorID monitor, bool keep_monitoring)
+int32 GetPickupAmount(CargoMonitorID monitor, bool keep_monitoring)
{
return GetAmount(_cargo_pickups, monitor, keep_monitoring);
}
diff --git a/src/cargomonitor.h b/src/cargomonitor.h
index f9f0def6d8..5dcb02705b 100644
--- a/src/cargomonitor.h
+++ b/src/cargomonitor.h
@@ -1,4 +1,4 @@
-/* $Id: cargomonitor.h 24986 2013-02-10 19:49:04Z zuu $ */
+/* $Id: cargomonitor.h 26714 2014-08-03 14:03:07Z frosch $ */
/*
* This file is part of OpenTTD.
@@ -16,6 +16,7 @@
#include "company_func.h"
#include "industry.h"
#include "town.h"
+#include "core/overflowsafe_type.hpp"
#include