1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-09-01 02:49:10 +00:00

Compare commits

...

6 Commits

Author SHA1 Message Date
rubidium
8a1c079edf (svn r16365) -Release: 0.7.1-RC2 2009-05-21 12:08:52 +00:00
rubidium
ba01583ce3 (svn r16364) [0.7] -Backport from trunk:
- Fix: The previously selected NewGRF station type was still remembered after switching to a different game without newstations enabled, preventing stations from being built (r16363)
- Fix: Pointer incremented with wrong count (r16361)
- Fix: Delete invalid depots in TTD savegames caused by improper SVXConverter conversions (r16357)
2009-05-21 11:47:45 +00:00
rubidium
498e5989d1 (svn r16355) [0.7] -Backport from trunk:
- Fix: Invalid read when OTTD savegame contains VEH_INVALID (r16353)
- Fix: Signal handler could end in endless loop (r16351)
- Fix: [NewGRF] When overriding 'original sounds', only allow overriding of the 'original sounds' and not any other that is already loaded (r16339)
- Fix: Desyncs when removing lots of stations/towns (r16329, r16328)
[0.7] -Cleanup: unify style of changelog
2009-05-18 20:17:28 +00:00
rubidium
ab7b117c50 (svn r16324) [0.7] -Backport from trunk:
- Fix: Desyncs due to the fact that depot searching with a maximum search depth simply does not work with YAPF's caches [FS#2900] (r16323)
- Fix: Trains could get stuck in a depot when they wanted to go to the same depot again [FS#2873] (r16322)
- Fix: In the scenario editor change the (starting) game year of the scenario, not the (starting) game year for new games/scenarios (r16321)
- Fix: Loading of savegames created in revision between 0.3.5 and 0.3.6 caused crash (r16320)
- Fix: [NoAI] Set the autorenew settings for new AI companies to the default values, not to 0 or the local settings (r16316)
- Fix: [NewGRF] Allow accessing the house age when the house is not yet built (r16314)
- Fix: (Get|Set)TrackBits() is only valid for RAIL_TILE_NORMAL and _SIGNALS (r16311)
2009-05-16 20:29:53 +00:00
rubidium
085b498c28 (svn r16310) [0.7] -Backport from trunk:
- Fix: Parameter is invalid when it is equal to length of an array (r16308)
- Fix: Close all windows before unloading the AI system as closing the content-download window will rescan for AIs [FS#2901] (r16306)
- Fix: ICC (Intel C++ Compiler) defined __GNUC__ but does not define __builtin_bswap32, so fall back to the default swap method for ICC (r16295)
- Fix: Road vehicles were unable to find a depot when turning around (in some cases), causing 'nearest depot' orders to be occasionally lost [FS#2893] (r16291
2009-05-15 10:24:13 +00:00
rubidium
30eff93341 (svn r16309) [0.7] -Backport from trunk:
- Fix: Unable to (re)set the desert state for watery tiles [FS#2888] (r16290)
- Fix: Possible (in theory) desync related to autorenew settings (r16287)
- Fix: Crash after using the 'Reset landscape' function and remove all waypoint signs and buoys after resetting landscape (r16280)
- Fix: [NewGRF] Disable multitile houses for which the newgrf does not define proper additional tiles (r16274)
2009-05-15 10:17:00 +00:00
46 changed files with 1252 additions and 1145 deletions

View File

@@ -93,7 +93,7 @@ ifeq ($(shell if test -f config.cache; then echo 1; fi), 1)
@echo " Going to reconfigure with last known settings..." @echo " Going to reconfigure with last known settings..."
@echo "----------------" @echo "----------------"
# Make sure we don't lock config.cache # Make sure we don't lock config.cache
@$(shell cat config.cache | sed 's~\\ ~\\\\ ~g') || exit 1 @$(shell cat config.cache | sed 's@\\ @\\\\ @g') || exit 1
@echo "----------------" @echo "----------------"
@echo "Reconfig done. Please re-execute make." @echo "Reconfig done. Please re-execute make."
@echo "----------------" @echo "----------------"

View File

@@ -20,7 +20,7 @@ SRC_DIR = "$(ROOT_DIR)/src"
BUNDLE_DIR = "$(ROOT_DIR)/bundle" BUNDLE_DIR = "$(ROOT_DIR)/bundle"
BUNDLES_DIR = "$(ROOT_DIR)/bundles" BUNDLES_DIR = "$(ROOT_DIR)/bundles"
TTD = "openttd.exe" TTD = "openttd.exe"
TARGET := $(shell echo $(PLATFORM) | sed "s~win64~x64~;s~win32~Win32~") TARGET := $(shell echo $(PLATFORM) | sed "s@win64@x64@;s@win32@Win32@")
all: all:
$(Q)cp objs/$(TARGET)/Release/$(TTD) $(BIN_DIR)/$(TTD) $(Q)cp objs/$(TARGET)/Release/$(TTD) $(BIN_DIR)/$(TTD)

View File

@@ -57,7 +57,7 @@ ENDIAN_TARGETS := endian_target.h $(ENDIAN_CHECK)
# For more information, please check: # For more information, please check:
# http://maillist.openttd.org/pipermail/devs/2007-April/000284.html # http://maillist.openttd.org/pipermail/devs/2007-April/000284.html
# http://maillist.openttd.org/pipermail/devs/2007-February/000248.html # http://maillist.openttd.org/pipermail/devs/2007-February/000248.html
GCC295_FIX=sed -r 's~^(\t*)(.*)( const )([A-Za-z0-9_ ]+(\[.*\]){2,})(( = \{)|(;))(.*)$$~\1\2 \4\6\8\9~g' GCC295_FIX=sed -r 's@^(\t*)(.*)( const )([A-Za-z0-9_ ]+(\[.*\]){2,})(( = \{)|(;))(.*)$$@\1\2 \4\6\8\9@g'
# This 'sed' removes the 3rd '4' in the # lines of the -E output of # This 'sed' removes the 3rd '4' in the # lines of the -E output of
# gcc 2.95.3 and lower, as it should indicate that it is a C-linkage, but the # gcc 2.95.3 and lower, as it should indicate that it is a C-linkage, but the
# compiler can't handle that information (just don't ask). So we remove it # compiler can't handle that information (just don't ask). So we remove it
@@ -65,7 +65,7 @@ GCC295_FIX=sed -r 's~^(\t*)(.*)( const )([A-Za-z0-9_ ]+(\[.*\]){2,})(( = \{)|(;)
# Furthermore gcc 2.95 has some trouble with protected and private when # Furthermore gcc 2.95 has some trouble with protected and private when
# accessing the protected/private stuff of the enclosing class (or the # accessing the protected/private stuff of the enclosing class (or the
# super class of the enclosing class). # super class of the enclosing class).
GCC295_FIX_2=sed -e 's~\(^\# [0-9][0-9]* "[^"]*"[ 0-9]*\) 4$$~\1~g;s~private:~public:~g;s~protected:~public:~g' GCC295_FIX_2=sed -e 's@\(^\# [0-9][0-9]* "[^"]*"[ 0-9]*\) 4$$@\1@g;s@private:@public:@g;s@protected:@public:@g'
# Check if we want to show what we are doing # Check if we want to show what we are doing
ifdef VERBOSE ifdef VERBOSE
@@ -98,7 +98,7 @@ MODIFIED := $(shell echo "$(VERSIONS)" | cut -f 3 -d' ')
ifdef REVISION ifdef REVISION
# Use specified revision (which should be of the form "r000"). # Use specified revision (which should be of the form "r000").
REV := $(REVISION) REV := $(REVISION)
REV_NR := $(shell echo $(REVISION) | sed "s~[^0-9]~~g") REV_NR := $(shell echo $(REVISION) | sed "s@[^0-9]@@g")
else else
# Use autodetected revisions # Use autodetected revisions
REV := $(shell echo "$(VERSIONS)" | cut -f 1 -d' ') REV := $(shell echo "$(VERSIONS)" | cut -f 1 -d' ')
@@ -143,15 +143,15 @@ endif
$(OBJS_C:%.o=%.d): %.d: $(SRC_DIR)/%.c $(FILE_DEP) $(OBJS_C:%.o=%.d): %.d: $(SRC_DIR)/%.c $(FILE_DEP)
$(E) '$(STAGE) DEP $(<:$(SRC_DIR)/%.c=%.c)' $(E) '$(STAGE) DEP $(<:$(SRC_DIR)/%.c=%.c)'
$(Q)$(CC_HOST) $(CC_CFLAGS) $(CFLAGS) -MM $< | sed 's~^$(@F:%.d=%.o):~$@ $(@:%.d=%.o):~' > $@ $(Q)$(CC_HOST) $(CC_CFLAGS) $(CFLAGS) -MM $< | sed 's@^$(@F:%.d=%.o):@$@ $(@:%.d=%.o):@' > $@
$(OBJS_CPP:%.o=%.d): %.d: $(SRC_DIR)/%.cpp $(FILE_DEP) $(OBJS_CPP:%.o=%.d): %.d: $(SRC_DIR)/%.cpp $(FILE_DEP)
$(E) '$(STAGE) DEP $(<:$(SRC_DIR)/%.cpp=%.cpp)' $(E) '$(STAGE) DEP $(<:$(SRC_DIR)/%.cpp=%.cpp)'
$(Q)$(CXX_HOST) $(CFLAGS) -MM $< | sed 's~^$(@F:%.d=%.o):~$@ $(@:%.d=%.o):~' > $@ $(Q)$(CXX_HOST) $(CFLAGS) -MM $< | sed 's@^$(@F:%.d=%.o):@$@ $(@:%.d=%.o):@' > $@
$(OBJS_MM:%.o=%.d): %.d: $(SRC_DIR)/%.mm $(FILE_DEP) $(OBJS_MM:%.o=%.d): %.d: $(SRC_DIR)/%.mm $(FILE_DEP)
$(E) '$(STAGE) DEP $(<:$(SRC_DIR)/%.mm=%.mm)' $(E) '$(STAGE) DEP $(<:$(SRC_DIR)/%.mm=%.mm)'
$(Q)$(CC_HOST) $(CFLAGS) -MM $< | sed 's~^$(@F:%.d=%.o):~$@ $(@:%.d=%.o):~' > $@ $(Q)$(CC_HOST) $(CFLAGS) -MM $< | sed 's@^$(@F:%.d=%.o):@$@ $(@:%.d=%.o):@' > $@
$(OBJS_RC:%.o=%.d): %.d: $(SRC_DIR)/%.rc $(FILE_DEP) $(OBJS_RC:%.o=%.d): %.d: $(SRC_DIR)/%.rc $(FILE_DEP)
$(E) '$(STAGE) DEP $(<:$(SRC_DIR)/%.mm=%.mm)' $(E) '$(STAGE) DEP $(<:$(SRC_DIR)/%.mm=%.mm)'
@@ -182,7 +182,7 @@ endif
# Convert x:/... paths to /x/... for mingw # Convert x:/... paths to /x/... for mingw
ifeq ($(OS), MINGW) ifeq ($(OS), MINGW)
@cat Makefile.dep.tmp | sed 's~\([a-zA-Z]\):\/~\/\1\/~g' > Makefile.dep.tmp.mingw @cat Makefile.dep.tmp | sed 's@\([a-zA-Z]\):\/@\/\1\/@g' > Makefile.dep.tmp.mingw
@cp Makefile.dep.tmp.mingw Makefile.dep.tmp @cp Makefile.dep.tmp.mingw Makefile.dep.tmp
@rm -f Makefile.dep.tmp.mingw @rm -f Makefile.dep.tmp.mingw
endif endif
@@ -211,7 +211,7 @@ endif
{ \ { \
print $$0 \ print $$0 \
} \ } \
' < Makefile.dep.tmp | sed 's~ *~ ~g;s~ $$~~' | $(SORT) > Makefile.dep ' < Makefile.dep.tmp | sed 's@ *@ @g;s@ $$@@' | $(SORT) > Makefile.dep
$(Q)rm -f Makefile.dep.tmp Makefile.dep.tmp.bak $(Q)rm -f Makefile.dep.tmp Makefile.dep.tmp.bak
@@ -280,10 +280,10 @@ $(ENDIAN_CHECK): $(SRC_DIR)/endian_check.cpp
# Revision files # Revision files
$(SRC_DIR)/rev.cpp: $(CONFIG_CACHE_VERSION) $(SRC_DIR)/rev.cpp.in $(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 $(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)/ottdres.rc: $(CONFIG_CACHE_VERSION) $(SRC_DIR)/ottdres.rc.in $(SRC_DIR)/ottdres.rc: $(CONFIG_CACHE_VERSION) $(SRC_DIR)/ottdres.rc.in
$(Q)cat $(SRC_DIR)/ottdres.rc.in | sed "s~@@REVISION@@~$(REV_NR)~g;s~@@VERSION@@~$(REV)~g;s~@@DATE@@~`date +%d.%m.%y`~g" > $(SRC_DIR)/ottdres.rc $(Q)cat $(SRC_DIR)/ottdres.rc.in | sed "s@\!\!REVISION\!\!@$(REV_NR)@g;s@!!VERSION!!@$(REV)@g;s@!!DATE!!@`date +%d.%m.%y`@g" > $(SRC_DIR)/ottdres.rc
FORCE: FORCE:

View File

@@ -1072,7 +1072,7 @@
GetAutoRenewStatus(); true GetAutoRenewStatus(); true
SetAutoRenewStatus(true); false SetAutoRenewStatus(true); false
SetAutoRenewStatus(false); true SetAutoRenewStatus(false); true
GetAutoRenewMonths(); -6 GetAutoRenewMonths(); 6
SetAutoRenewMonths(-12); true SetAutoRenewMonths(-12); true
GetAutoRenewMonths(); -12 GetAutoRenewMonths(); -12
SetAutoRenewMonths(-12); false SetAutoRenewMonths(-12); false

File diff suppressed because it is too large Load Diff

View File

@@ -5,7 +5,7 @@ log() {
} }
set_default() { set_default() {
released_version="" released_version="0.7.1-RC2"
ignore_extra_parameters="0" ignore_extra_parameters="0"
# We set all kinds of defaults for params. Later on the user can override # We set all kinds of defaults for params. Later on the user can override
@@ -415,7 +415,7 @@ save_params() {
configure="$CONFIGURE_EXECUTABLE --ignore-extra-parameters" configure="$CONFIGURE_EXECUTABLE --ignore-extra-parameters"
for p in $save_params_array; do for p in $save_params_array; do
eval "v=\"\$$p\"" eval "v=\"\$$p\""
p=`echo "$p" | sed 's~_~-~g;s~\n~~g;s~ ~\\ ~g'` p=`echo "$p" | sed 's@_@-@g;s@\n@@g;s@ @\\ @g'`
# Only save those params that aren't empty # Only save those params that aren't empty
configure="$configure --$p=\"$v\"" configure="$configure --$p=\"$v\""
done done
@@ -815,6 +815,7 @@ check_params() {
fi fi
if [ "$os" = "OSX" ]; then if [ "$os" = "OSX" ]; then
check_osx_sdk
# Test on G5 # Test on G5
if [ "$enable_osx_g5" != "0" ]; then if [ "$enable_osx_g5" != "0" ]; then
@@ -903,7 +904,7 @@ check_params() {
doc_dir="$data_dir/docs" doc_dir="$data_dir/docs"
fi fi
else else
doc_dir="`echo $doc_dir | sed 's~\([^\]\)\\\\ ~\1\\\\\\\\ ~g;s~\([^\]\) ~\1\\\\\\\\ ~g'`" doc_dir="`echo $doc_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
fi fi
if [ "$icon_theme_dir" = "1" ]; then if [ "$icon_theme_dir" = "1" ]; then
@@ -913,7 +914,7 @@ check_params() {
icon_theme_dir="" icon_theme_dir=""
fi fi
else else
icon_theme_dir="`echo $icon_theme_dir | sed 's~\([^\]\)\\\\ ~\1\\\\\\\\ ~g;s~\([^\]\) ~\1\\\\\\\\ ~g'`" icon_theme_dir="`echo $icon_theme_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
fi fi
if [ "$personal_dir" = "1" ]; then if [ "$personal_dir" = "1" ]; then
@@ -925,7 +926,7 @@ check_params() {
personal_dir=".openttd" personal_dir=".openttd"
fi fi
else else
personal_dir="`echo $personal_dir | sed 's~\([^\]\)\\\\ ~\1\\\\\\\\ ~g;s~\([^\]\) ~\1\\\\\\\\ ~g'`" personal_dir="`echo $personal_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
fi fi
if [ "$shared_dir" = "1" ]; then if [ "$shared_dir" = "1" ]; then
@@ -936,7 +937,7 @@ check_params() {
shared_dir="" shared_dir=""
fi fi
else else
shared_dir="`echo $shared_dir | sed 's~\([^\]\)\\\\ ~\1\\\\\\\\ ~g;s~\([^\]\) ~\1\\\\\\\\ ~g'`" shared_dir="`echo $shared_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
fi fi
if [ "$man_dir" = "1" ]; then if [ "$man_dir" = "1" ]; then
@@ -947,7 +948,7 @@ check_params() {
man_dir="" man_dir=""
fi fi
else else
man_dir="`echo $man_dir | sed 's~\([^\]\)\\\\ ~\1\\\\\\\\ ~g;s~\([^\]\) ~\1\\\\\\\\ ~g'`" man_dir="`echo $man_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
fi fi
if [ "$menu_dir" = "1" ]; then if [ "$menu_dir" = "1" ]; then
@@ -958,7 +959,7 @@ check_params() {
menu_dir="" menu_dir=""
fi fi
else else
menu_dir="`echo $menu_dir | sed 's~\([^\]\)\\\\ ~\1\\\\\\\\ ~g;s~\([^\]\) ~\1\\\\\\\\ ~g'`" menu_dir="`echo $menu_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
fi fi
# "set_universal_binary_flags" needs to be before "detect_iconv" # "set_universal_binary_flags" needs to be before "detect_iconv"
@@ -1206,7 +1207,7 @@ make_cflags_and_ldflags() {
if [ -n "$sdl_config" ]; then if [ -n "$sdl_config" ]; then
CFLAGS="$CFLAGS -DWITH_SDL" CFLAGS="$CFLAGS -DWITH_SDL"
# SDL must not add _GNU_SOURCE as it breaks many platforms # SDL must not add _GNU_SOURCE as it breaks many platforms
CFLAGS="$CFLAGS `$sdl_config --cflags | sed 's~-D_GNU_SOURCE[^ ]*~~'`" CFLAGS="$CFLAGS `$sdl_config --cflags | sed 's@-D_GNU_SOURCE[^ ]*@@'`"
if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "WINCE" ]; then if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "WINCE" ]; then
if [ "$enable_static" != "0" ]; then if [ "$enable_static" != "0" ]; then
LIBS="$LIBS `$sdl_config --static-libs`" LIBS="$LIBS `$sdl_config --static-libs`"
@@ -1268,7 +1269,7 @@ make_cflags_and_ldflags() {
if [ "$os" = "OSX" ]; then if [ "$os" = "OSX" ]; then
# fontconfig_config goes via pkg-config on all systems, which doesn't know --prefix # 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 # 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 `$fontconfig_config --variable=prefix`/lib/libfontconfig.a `$fontconfig_config --libs --static | sed s~-lfontconfig~~`" LIBS="$LIBS `$fontconfig_config --variable=prefix`/lib/libfontconfig.a `$fontconfig_config --libs --static | sed s@-lfontconfig@@`"
else else
LIBS="$LIBS `$fontconfig_config --libs --static | tr '\n\r' ' '`" LIBS="$LIBS `$fontconfig_config --libs --static | tr '\n\r' ' '`"
fi fi
@@ -1400,8 +1401,10 @@ make_cflags_and_ldflags() {
# Lovely hackish, not? # Lovely hackish, not?
# Btw, this almost always comes from outside the configure, so it is # Btw, this almost always comes from outside the configure, so it is
# not something we can control. # not something we can control.
# Also make makedepend aware of compiler's built-in defines.
if [ "$with_makedepend" != "0" ]; then if [ "$with_makedepend" != "0" ]; then
cflags_makedep="` echo "$CFLAGS" | sed 's~ /~ -~g;s~-I[ ]*[^ ]*~~g'`" cflags_makedep="`echo | $cxx_host -E -x c++ -dM - | sed 's@.define @-D@g;s@ .*@ @g;s@(.*)@@g' | tr -d '\r\n'`"
cflags_makedep="$cflags_makedep `echo "$CFLAGS" | sed 's@ /@ -@g;s@-I[ ]*[^ ]*@@g'`"
else else
makedepend="" makedepend=""
fi fi
@@ -1617,6 +1620,30 @@ set_universal_binary_flags() {
fi fi
} }
check_osx_sdk() {
cat > tmp.osx.cpp << EOF
#include <AvailabilityMacros.h>
#if !defined(MAC_OS_X_VERSION_10_5)
# error "Need newer SDK"
#endif
int main() {
return 0;
}
EOF
execute="$cxx_host $CFLAGS -E tmp.osx.cpp -o - 2>&1"
eval $execute > /dev/null
ret=$?
log 2 "executing $execute"
log 2 " exit code $ret"
rm -f tmp.osx.cpp
if [ "$ret" != "0" ]; then
log 1 "I couldn't detect any XCode >= 2.5 on your system"
log 1 "please install/upgrade your XCode"
exit 1
fi
}
check_direct_music() { check_direct_music() {
echo " echo "
#include <windows.h> #include <windows.h>
@@ -2537,104 +2564,104 @@ make_sed() {
# use multiple OBJS_DIR, because all in-between # use multiple OBJS_DIR, because all in-between
# binaries are stored in there, and nowhere else. # binaries are stored in there, and nowhere else.
SRC_REPLACE=" SRC_REPLACE="
s~!!CC_HOST!!~$cc_host~g; s@!!CC_HOST!!@$cc_host@g;
s~!!CXX_HOST!!~$cxx_host~g; s@!!CXX_HOST!!@$cxx_host@g;
s~!!CC_BUILD!!~$cc_build~g; s@!!CC_BUILD!!@$cc_build@g;
s~!!CXX_BUILD!!~$cxx_build~g; s@!!CXX_BUILD!!@$cxx_build@g;
s~!!WINDRES!!~$windres~g; s@!!WINDRES!!@$windres@g;
s~!!STRIP!!~$strip $strip_arg~g; s@!!STRIP!!@$strip $strip_arg@g;
s~!!LIPO!!~$lipo~g; s@!!LIPO!!@$lipo@g;
s~!!CC_CFLAGS!!~$CC_CFLAGS~g; s@!!CC_CFLAGS!!@$CC_CFLAGS@g;
s~!!CFLAGS!!~$T_CFLAGS~g; s@!!CFLAGS!!@$T_CFLAGS@g;
s~!!CFLAGS_BUILD!!~$CFLAGS_BUILD~g; s@!!CFLAGS_BUILD!!@$CFLAGS_BUILD@g;
s~!!STRGEN_FLAGS!!~$strgen_flags~g; s@!!STRGEN_FLAGS!!@$strgen_flags@g;
s~!!LIBS!!~$LIBS~g; s@!!LIBS!!@$LIBS@g;
s~!!LDFLAGS!!~$T_LDFLAGS~g; s@!!LDFLAGS!!@$T_LDFLAGS@g;
s~!!BIN_DIR!!~$BIN_DIR~g; s@!!BIN_DIR!!@$BIN_DIR@g;
s~!!ROOT_DIR!!~$ROOT_DIR~g; s@!!ROOT_DIR!!@$ROOT_DIR@g;
s~!!MEDIA_DIR!!~$MEDIA_DIR~g; s@!!MEDIA_DIR!!@$MEDIA_DIR@g;
s~!!SOURCE_LIST!!~$SOURCE_LIST~g; s@!!SOURCE_LIST!!@$SOURCE_LIST@g;
s~!!SRC_OBJS_DIR!!~$SRC_OBJS_DIR~g; s@!!SRC_OBJS_DIR!!@$SRC_OBJS_DIR@g;
s~!!LANG_OBJS_DIR!!~$LANG_OBJS_DIR~g; s@!!LANG_OBJS_DIR!!@$LANG_OBJS_DIR@g;
s~!!SRC_DIR!!~$SRC_DIR~g; s@!!SRC_DIR!!@$SRC_DIR@g;
s~!!SCRIPT_SRC_DIR!!~$SCRIPT_SRC_DIR~g; s@!!SCRIPT_SRC_DIR!!@$SCRIPT_SRC_DIR@g;
s~!!OSXAPP!!~$OSXAPP~g; s@!!OSXAPP!!@$OSXAPP@g;
s~!!LANG_DIR!!~$LANG_DIR~g; s@!!LANG_DIR!!@$LANG_DIR@g;
s~!!TTD!!~$TTD~g; s@!!TTD!!@$TTD@g;
s~!!BINARY_DIR!!~$prefix_dir/$binary_dir~g; s@!!BINARY_DIR!!@$prefix_dir/$binary_dir@g;
s~!!DATA_DIR!!~$prefix_dir/$data_dir~g; s@!!DATA_DIR!!@$prefix_dir/$data_dir@g;
s~!!DOC_DIR!!~$prefix_dir/$doc_dir~g; s@!!DOC_DIR!!@$prefix_dir/$doc_dir@g;
s~!!MAN_DIR!!~$prefix_dir/$man_dir~g; s@!!MAN_DIR!!@$prefix_dir/$man_dir@g;
s~!!ICON_DIR!!~$prefix_dir/$icon_dir~g; s@!!ICON_DIR!!@$prefix_dir/$icon_dir@g;
s~!!ICON_THEME_DIR!!~$prefix_dir/$icon_theme_dir~g; s@!!ICON_THEME_DIR!!@$prefix_dir/$icon_theme_dir@g;
s~!!PERSONAL_DIR!!~$personal_dir~g; s@!!PERSONAL_DIR!!@$personal_dir@g;
s~!!SHARED_DIR!!~$shared_dir~g; s@!!SHARED_DIR!!@$shared_dir@g;
s~!!INSTALL_DIR!!~$install_dir~g; s@!!INSTALL_DIR!!@$install_dir@g;
s~!!BINARY_NAME!!~$binary_name~g; s@!!BINARY_NAME!!@$binary_name@g;
s~!!STRGEN!!~$STRGEN~g; s@!!STRGEN!!@$STRGEN@g;
s~!!ENDIAN_CHECK!!~$ENDIAN_CHECK~g; s@!!ENDIAN_CHECK!!@$ENDIAN_CHECK@g;
s~!!ENDIAN_FORCE!!~$endian~g; s@!!ENDIAN_FORCE!!@$endian@g;
s~!!STAGE!!~$STAGE~g; s@!!STAGE!!@$STAGE@g;
s~!!MAKEDEPEND!!~$makedepend~g; s@!!MAKEDEPEND!!@$makedepend@g;
s~!!CFLAGS_MAKEDEP!!~$cflags_makedep~g; s@!!CFLAGS_MAKEDEP!!@$cflags_makedep@g;
s~!!SORT!!~$sort~g; s@!!SORT!!@$sort@g;
s~!!CONFIG_CACHE_COMPILER!!~config.cache.compiler~g; s@!!CONFIG_CACHE_COMPILER!!@config.cache.compiler@g;
s~!!CONFIG_CACHE_LINKER!!~config.cache.linker~g; s@!!CONFIG_CACHE_LINKER!!@config.cache.linker@g;
s~!!CONFIG_CACHE_ENDIAN!!~config.cache.endian~g; s@!!CONFIG_CACHE_ENDIAN!!@config.cache.endian@g;
s~!!CONFIG_CACHE_SOURCE!!~config.cache.source~g; s@!!CONFIG_CACHE_SOURCE!!@config.cache.source@g;
s~!!CONFIG_CACHE_VERSION!!~config.cache.version~g; s@!!CONFIG_CACHE_VERSION!!@config.cache.version@g;
s~!!CONFIG_CACHE_SOURCE_LIST!!~config.cache.source.list~g; s@!!CONFIG_CACHE_SOURCE_LIST!!@config.cache.source.list@g;
s~!!CONFIG_CACHE_PWD!!~config.cache.pwd~g; s@!!CONFIG_CACHE_PWD!!@config.cache.pwd@g;
s~!!LANG_SUPPRESS!!~$lang_suppress~g; s@!!LANG_SUPPRESS!!@$lang_suppress@g;
s~!!OBJS_C!!~$OBJS_C~g; s@!!OBJS_C!!@$OBJS_C@g;
s~!!OBJS_CPP!!~$OBJS_CPP~g; s@!!OBJS_CPP!!@$OBJS_CPP@g;
s~!!OBJS_MM!!~$OBJS_MM~g; s@!!OBJS_MM!!@$OBJS_MM@g;
s~!!OBJS_RC!!~$OBJS_RC~g; s@!!OBJS_RC!!@$OBJS_RC@g;
s~!!SRCS!!~$SRCS~g; s@!!SRCS!!@$SRCS@g;
s~!!OS!!~$os~g; s@!!OS!!@$os@g;
s~!!CONFIGURE_FILES!!~$CONFIGURE_FILES~g; s@!!CONFIGURE_FILES!!@$CONFIGURE_FILES@g;
s~!!REVISION!!~$revision~g; s@!!REVISION!!@$revision@g;
s~!!AWK!!~$awk~g; s@!!AWK!!@$awk@g;
s~!!GCC295!!~$gcc295~g; s@!!GCC295!!@$gcc295@g;
s~!!DISTCC!!~$distcc~g; s@!!DISTCC!!@$distcc@g;
" "
if [ "$icon_theme_dir" != "" ]; then if [ "$icon_theme_dir" != "" ]; then
SRC_REPLACE="$SRC_REPLACE SRC_REPLACE="$SRC_REPLACE
s#!!ICON_THEME_DIR!!#$prefix_dir/$icon_theme_dir#g; s@!!ICON_THEME_DIR!!@$prefix_dir/$icon_theme_dir@g;
" "
else else
SRC_REPLACE="$SRC_REPLACE SRC_REPLACE="$SRC_REPLACE
s#!!ICON_THEME_DIR!!##g; s@!!ICON_THEME_DIR!!@@g;
" "
fi fi
if [ "$man_dir" != "" ]; then if [ "$man_dir" != "" ]; then
SRC_REPLACE="$SRC_REPLACE SRC_REPLACE="$SRC_REPLACE
s#!!MAN_DIR!!#$prefix_dir/$man_dir#g; s@!!MAN_DIR!!@$prefix_dir/$man_dir@g;
" "
else else
SRC_REPLACE="$SRC_REPLACE SRC_REPLACE="$SRC_REPLACE
s#!!MAN_DIR!!##g; s@!!MAN_DIR!!@@g;
" "
fi fi
if [ "$menu_dir" != "" ]; then if [ "$menu_dir" != "" ]; then
SRC_REPLACE="$SRC_REPLACE SRC_REPLACE="$SRC_REPLACE
s#!!MENU_DIR!!#$prefix_dir/$menu_dir#g; s@!!MENU_DIR!!@$prefix_dir/$menu_dir@g;
" "
else else
SRC_REPLACE="$SRC_REPLACE SRC_REPLACE="$SRC_REPLACE
s#!!MENU_DIR!!##g; s@!!MENU_DIR!!@@g;
" "
fi fi
} }
generate_menu_item() { generate_menu_item() {
MENU_REPLACE=" MENU_REPLACE="
s~!!TTD!!~$TTD~g; s@!!TTD!!@$TTD@g;
s~!!MENU_GROUP!!~$menu_group~g; s@!!MENU_GROUP!!@$menu_group@g;
s~!!MENU_NAME!!~$menu_name~g s@!!MENU_NAME!!@$menu_name@g
" "
log 1 "Generating menu item..." log 1 "Generating menu item..."
mkdir -p media mkdir -p media

6
configure vendored
View File

@@ -37,7 +37,7 @@ if [ "$1" = "--reconfig" ] || [ "$1" = "--reconfigure" ]; then
exit 1 exit 1
fi fi
# Make sure we don't lock config.cache # Make sure we don't lock config.cache
cat config.cache | sed 's~\\ ~\\\\ ~g' > cache.tmp cat config.cache | sed 's@\\ @\\\\ @g' > cache.tmp
sh cache.tmp sh cache.tmp
rm -f cache.tmp rm -f cache.tmp
exit $? exit $?
@@ -59,7 +59,7 @@ STRGEN="strgen$EXE"
ENDIAN_CHECK="endian_check$EXE" ENDIAN_CHECK="endian_check$EXE"
if [ -z "$sort" ]; then if [ -z "$sort" ]; then
PIPE_SORT="sed s~a~a~" PIPE_SORT="sed s@a@a@"
else else
PIPE_SORT="$sort" PIPE_SORT="$sort"
fi fi
@@ -125,7 +125,7 @@ SRCS="` echo \"$SRCS\" | $awk ' { ORS = " " } { print $0; }'`"
# In makefiles, we always use -u for sort # In makefiles, we always use -u for sort
if [ -z "$sort" ]; then if [ -z "$sort" ]; then
sort="sed s~a~a~" sort="sed s@a@a@"
else else
sort="$sort -u" sort="$sort -u"
fi fi

View File

@@ -86,8 +86,8 @@ elif [ -d "$ROOT_DIR/.git" ]; then
fi fi
HASH=`LC_ALL=C git rev-parse --verify HEAD 2>/dev/null` HASH=`LC_ALL=C git rev-parse --verify HEAD 2>/dev/null`
REV="g`echo $HASH | cut -c1-8`" REV="g`echo $HASH | cut -c1-8`"
BRANCH=`git branch|grep '[*]' | sed 's~\* ~~;s~^master$~~'` BRANCH=`git branch|grep '[*]' | sed 's@\* @@;s@^master$@@'`
REV_NR=`LC_ALL=C git log --pretty=format:%s "$SRC_DIR" | grep "^(svn r[0-9]*)" | head -n 1 | sed "s~.*(svn r\([0-9]*\)).*~\1~"` REV_NR=`LC_ALL=C git log --pretty=format:%s "$SRC_DIR" | grep "^(svn r[0-9]*)" | head -n 1 | sed "s@.*(svn r\([0-9]*\)).*@\1@"`
elif [ -d "$ROOT_DIR/.hg" ]; then elif [ -d "$ROOT_DIR/.hg" ]; then
# We are a hg checkout # We are a hg checkout
if [ -n "`hg status \"$SRC_DIR\" | grep -v '^?'`" ]; then if [ -n "`hg status \"$SRC_DIR\" | grep -v '^?'`" ]; then
@@ -95,8 +95,8 @@ elif [ -d "$ROOT_DIR/.hg" ]; then
fi fi
HASH=`LC_ALL=C hg parents 2>/dev/null | head -n 1 | cut -d: -f3` HASH=`LC_ALL=C hg parents 2>/dev/null | head -n 1 | cut -d: -f3`
REV="h`echo $HASH | cut -c1-8`" REV="h`echo $HASH | cut -c1-8`"
BRANCH=`hg branch | sed 's~^default$~~'` BRANCH=`hg branch | sed 's@^default$@@'`
REV_NR=`LC_ALL=C hg log -r $HASH:0 -k "svn" -l 1 --template "{desc}\n" "$SRC_DIR" | grep "^(svn r[0-9]*)" | head -n 1 | sed "s~.*(svn r\([0-9]*\)).*~\1~"` REV_NR=`LC_ALL=C hg log -r $HASH:0 -k "svn" -l 1 --template "{desc}\n" "$SRC_DIR" | grep "^(svn r[0-9]*)" | head -n 1 | sed "s@.*(svn r\([0-9]*\)).*@\1@"`
else else
# We don't know # We don't know
MODIFIED="1" MODIFIED="1"

View File

@@ -1,3 +1,9 @@
openttd (0.7.1~RC2) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <matthijs@stdin.nl> Thu, 21 Mar 2008 14:34:56 +0200
openttd (0.7.1~RC1) unstable; urgency=low openttd (0.7.1~RC1) unstable; urgency=low
* New upstream release. * New upstream release.

View File

@@ -1,11 +1,11 @@
!define APPNAME "OpenTTD" ; Define application name !define APPNAME "OpenTTD" ; Define application name
!define APPVERSION "0.7.1-RC1" ; Define application version !define APPVERSION "0.7.1-RC2" ; Define application version
!define APPVERSIONINTERNAL "0.7.1.0" ; Define application version in X.X.X.X !define APPVERSIONINTERNAL "0.7.1.0" ; Define application version in X.X.X.X
!define INSTALLERVERSION 59 ; NEED TO UPDATE THIS FOR EVERY RELEASE!!! !define INSTALLERVERSION 60 ; NEED TO UPDATE THIS FOR EVERY RELEASE!!!
!include ${VERSION_INCLUDE} !include ${VERSION_INCLUDE}
!define APPURLLINK "http://www.openttd.org" !define APPURLLINK "http://www.openttd.org"
!define APPNAMEANDVERSION "${APPNAME} ${APPVERSION_FULL}" !define APPNAMEANDVERSION "${APPNAME} ${APPVERSION}"
!define MUI_ICON "..\..\..\media\openttd.ico" !define MUI_ICON "..\..\..\media\openttd.ico"
!define MUI_UNICON "..\..\..\media\openttd.ico" !define MUI_UNICON "..\..\..\media\openttd.ico"
@@ -112,13 +112,6 @@ Section "!OpenTTD" Section1
File ${PATH_ROOT}bin\data\*.grf File ${PATH_ROOT}bin\data\*.grf
File ${PATH_ROOT}bin\data\*.obg File ${PATH_ROOT}bin\data\*.obg
File ${PATH_ROOT}bin\data\opntitle.dat File ${PATH_ROOT}bin\data\opntitle.dat
; Copy scenario files (don't choke if they don't exist)
SetOutPath "$INSTDIR\scenario\"
File /nonfatal ${PATH_ROOT}bin\scenario\*.scn
; Copy heightmap files (don't choke if they don't exist)
SetOutPath "$INSTDIR\scenario\heightmap\"
File /nonfatal ${PATH_ROOT}bin\scenario\heightmap\*.*
; Copy the scripts ; Copy the scripts
SetOutPath "$INSTDIR\scripts\" SetOutPath "$INSTDIR\scripts\"

View File

@@ -16,10 +16,10 @@ End Sub
Sub UpdateFile(modified, revision, version, cur_date, filename) Sub UpdateFile(modified, revision, version, cur_date, filename)
FSO.CopyFile filename & ".in", filename FSO.CopyFile filename & ".in", filename
FindReplaceInFile filename, "@@MODIFIED@@", modified FindReplaceInFile filename, "!!MODIFIED!!", modified
FindReplaceInFile filename, "@@REVISION@@", revision FindReplaceInFile filename, "!!REVISION!!", revision
FindReplaceInFile filename, "@@VERSION@@", version FindReplaceInFile filename, "!!VERSION!!", version
FindReplaceInFile filename, "@@DATE@@", cur_date FindReplaceInFile filename, "!!DATE!!", cur_date
End Sub End Sub
Sub UpdateFiles(version) Sub UpdateFiles(version)
@@ -32,6 +32,7 @@ Sub UpdateFiles(version)
modified = Mid(version, InStrRev(version, Chr(9)) + 1) modified = Mid(version, InStrRev(version, Chr(9)) + 1)
version = Mid(version, 1, InStr(version, Chr(9)) - 1) version = Mid(version, 1, InStr(version, Chr(9)) - 1)
Else Else
version = "0.7.1-RC2"
revision = 0 revision = 0
modified = 1 modified = 1
End If End If

View File

@@ -203,6 +203,7 @@
if (IsRailWaypointTile(tile)) return ::GetRailWaypointBits(tile); if (IsRailWaypointTile(tile)) return ::GetRailWaypointBits(tile);
if (IsRailStationTile(tile)) return ::TrackToTrackBits(::GetRailStationTrack(tile)); if (IsRailStationTile(tile)) return ::TrackToTrackBits(::GetRailStationTrack(tile));
if (IsLevelCrossingTile(tile)) return ::GetCrossingRailBits(tile); if (IsLevelCrossingTile(tile)) return ::GetCrossingRailBits(tile);
if (IsRailDepotTile(tile)) return ::TRACK_BIT_NONE;
return ::GetTrackBits(tile); return ::GetTrackBits(tile);
} }

View File

@@ -293,6 +293,7 @@ public:
/** /**
* Get all RailTracks on the given tile. * Get all RailTracks on the given tile.
* @note A depot has no railtracks.
* @param tile The tile to check. * @param tile The tile to check.
* @pre IsRailTile(tile). * @pre IsRailTile(tile).
* @return A bitmask of RailTrack with all RailTracks on the tile. * @return A bitmask of RailTrack with all RailTracks on the tile.

View File

@@ -445,12 +445,11 @@ Company *DoStartupNewCompany(bool is_ai)
c->inaugurated_year = _cur_year; c->inaugurated_year = _cur_year;
RandomCompanyManagerFaceBits(c->face, (GenderEthnicity)Random(), false); // create a random company manager face RandomCompanyManagerFaceBits(c->face, (GenderEthnicity)Random(), false); // create a random company manager face
/* Engine renewal settings */ /* Settings for non-ai companies are copied from the client settings later. */
c->engine_renew_list = NULL; if (is_ai) {
c->renew_keep_length = false; c->engine_renew_money = 100000;
c->engine_renew = _settings_client.gui.autorenew; c->engine_renew_months = 6;
c->engine_renew_months = _settings_client.gui.autorenew_months; }
c->engine_renew_money = _settings_client.gui.autorenew_money;
GeneratePresidentName(c); GeneratePresidentName(c);
@@ -756,6 +755,9 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
/* This is the client (or non-dedicated server) who wants a new company */ /* This is the client (or non-dedicated server) who wants a new company */
if (cid == _network_own_client_id) { if (cid == _network_own_client_id) {
/* Create p1 and p2 here because SetLocalCompany resets the gui.autorenew* settings. */
uint32 p1 = (_settings_client.gui.autorenew << 15 ) | (_settings_client.gui.autorenew_months << 16) | 4;
uint32 p2 = _settings_client.gui.autorenew_money;
assert(_local_company == COMPANY_SPECTATOR); assert(_local_company == COMPANY_SPECTATOR);
SetLocalCompany(c->index); SetLocalCompany(c->index);
if (!StrEmpty(_settings_client.network.default_company_pass)) { if (!StrEmpty(_settings_client.network.default_company_pass)) {
@@ -767,13 +769,7 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
/* Now that we have a new company, broadcast our autorenew settings to /* Now that we have a new company, broadcast our autorenew settings to
* all clients so everything is in sync */ * all clients so everything is in sync */
NetworkSend_Command(0, NetworkSend_Command(0, p1, p2, CMD_SET_AUTOREPLACE, NULL, NULL);
(_settings_client.gui.autorenew << 15 ) | (_settings_client.gui.autorenew_months << 16) | 4,
_settings_client.gui.autorenew_money,
CMD_SET_AUTOREPLACE,
NULL,
NULL
);
MarkWholeScreenDirty(); MarkWholeScreenDirty();
} }

View File

@@ -318,7 +318,7 @@ static FORCEINLINE T ROR(const T x, const uint8 n)
*/ */
static FORCEINLINE uint32 BSWAP32(uint32 x) static FORCEINLINE uint32 BSWAP32(uint32 x)
{ {
#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && __GNUC_MINOR__ >= 3)) #if !defined(__ICC) && defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && __GNUC_MINOR__ >= 3))
/* GCC >= 4.3 provides a builtin, resulting in faster code */ /* GCC >= 4.3 provides a builtin, resulting in faster code */
return (uint32)__builtin_bswap32((int32)x); return (uint32)__builtin_bswap32((int32)x);
#else #else

View File

@@ -187,7 +187,7 @@ void ClientNetworkContentSocketHandler::RequestContentList(uint count, const Con
this->Send_Packet(p); this->Send_Packet(p);
count -= p_count; count -= p_count;
content_ids += count; content_ids += p_count;
} }
} }
@@ -271,7 +271,7 @@ void ClientNetworkContentSocketHandler::DownloadSelectedContent(uint &files, uin
this->Send_Packet(p); this->Send_Packet(p);
count -= p_count; count -= p_count;
content_ids += count; content_ids += p_count;
} }
free(ids); free(ids);

View File

@@ -2038,8 +2038,8 @@ static ChangeInfoResult SoundEffectChangeInfo(uint sid, int numinfo, int prop, b
case 0x0A: { // Override old sound case 0x0A: { // Override old sound
uint orig_sound = grf_load_byte(&buf); uint orig_sound = grf_load_byte(&buf);
if (orig_sound >= GetNumSounds()) { if (orig_sound >= ORIGINAL_SAMPLE_COUNT) {
grfmsg(1, "SoundEffectChangeInfo: Original sound %d not defined (max %d)", orig_sound, GetNumSounds()); grfmsg(1, "SoundEffectChangeInfo: Original sound %d not defined (max %d)", orig_sound, ORIGINAL_SAMPLE_COUNT);
} else { } else {
FileEntry *newfe = GetSound(sound); FileEntry *newfe = GetSound(sound);
FileEntry *oldfe = GetSound(orig_sound); FileEntry *oldfe = GetSound(orig_sound);
@@ -5834,10 +5834,25 @@ static void FinaliseHouseArray()
for (int i = 0; i < HOUSE_MAX; i++) { for (int i = 0; i < HOUSE_MAX; i++) {
HouseSpec *hs = file->housespec[i]; HouseSpec *hs = file->housespec[i];
if (hs != NULL) {
_house_mngr.SetEntitySpec(hs); if (hs == NULL) continue;
if (hs->min_year < min_year) min_year = hs->min_year;
const HouseSpec *next1 = (i + 1 < HOUSE_MAX ? file->housespec[i + 1] : NULL);
const HouseSpec *next2 = (i + 2 < HOUSE_MAX ? file->housespec[i + 2] : NULL);
const HouseSpec *next3 = (i + 3 < HOUSE_MAX ? file->housespec[i + 3] : NULL);
if (((hs->building_flags & BUILDING_HAS_2_TILES) != 0 &&
(next1 == NULL || !next1->enabled || (next1->building_flags & BUILDING_HAS_1_TILE) != 0)) ||
((hs->building_flags & BUILDING_HAS_4_TILES) != 0 &&
(next2 == NULL || !next2->enabled || (next2->building_flags & BUILDING_HAS_1_TILE) != 0 ||
next3 == NULL || !next3->enabled || (next3->building_flags & BUILDING_HAS_1_TILE) != 0))) {
hs->enabled = false;
DEBUG(grf, 1, "FinaliseHouseArray: %s defines house %d as multitile, but no suitable tiles follow. Disabling house.", file->filename, hs->local_id);
continue;
} }
_house_mngr.SetEntitySpec(hs);
if (hs->min_year < min_year) min_year = hs->min_year;
} }
} }

View File

@@ -255,7 +255,7 @@ static uint32 HouseGetVariable(const ResolverObject *object, byte variable, byte
case 0x40: return (IsTileType(tile, MP_HOUSE) ? GetHouseBuildingStage(tile) : 0) | TileHash2Bit(TileX(tile), TileY(tile)) << 2; case 0x40: return (IsTileType(tile, MP_HOUSE) ? GetHouseBuildingStage(tile) : 0) | TileHash2Bit(TileX(tile), TileY(tile)) << 2;
/* Building age. */ /* Building age. */
case 0x41: return GetHouseAge(tile); case 0x41: return IsTileType(tile, MP_HOUSE) ? GetHouseAge(tile) : 0;
/* Town zone */ /* Town zone */
case 0x42: return GetTownRadiusGroup(town, tile); case 0x42: return GetTownRadiusGroup(town, tile);

View File

@@ -300,9 +300,6 @@ static void InitializeDynamicVariables()
*/ */
static void ShutdownGame() static void ShutdownGame()
{ {
/* stop the AI */
AI::Uninitialize(false);
IConsoleFree(); IConsoleFree();
if (_network_available) NetworkShutDown(); // Shut down the network and close any open connections if (_network_available) NetworkShutDown(); // Shut down the network and close any open connections
@@ -311,6 +308,9 @@ static void ShutdownGame()
UnInitWindowSystem(); UnInitWindowSystem();
/* stop the AI */
AI::Uninitialize(false);
/* Uninitialize airport state machines */ /* Uninitialize airport state machines */
UnInitializeAirports(); UnInitializeAirports();
@@ -745,6 +745,11 @@ static void MakeNewGameDone()
/* Create a single company */ /* Create a single company */
DoStartupNewCompany(false); DoStartupNewCompany(false);
Company *c = GetCompany(COMPANY_FIRST);
c->engine_renew = _settings_client.gui.autorenew;
c->engine_renew_months = _settings_client.gui.autorenew_months;
c->engine_renew_money = _settings_client.gui.autorenew_money;
IConsoleCmdExec("exec scripts/game_start.scr 0"); IConsoleCmdExec("exec scripts/game_start.scr 0");
SetLocalCompany(COMPANY_FIRST); SetLocalCompany(COMPANY_FIRST);

View File

@@ -64,8 +64,8 @@ END
// //
VS_VERSION_INFO VERSIONINFO VS_VERSION_INFO VERSIONINFO
FILEVERSION 0,7,0,@@REVISION@@ FILEVERSION 0,7,1,16365
PRODUCTVERSION 0,7,0,@@REVISION@@ PRODUCTVERSION 0,7,1,16365
FILEFLAGSMASK 0x3fL FILEFLAGSMASK 0x3fL
#ifdef _DEBUG #ifdef _DEBUG
FILEFLAGS 0x1L FILEFLAGS 0x1L
@@ -83,14 +83,14 @@ BEGIN
VALUE "Comments", "This program is licensed under the GNU General Public License.\0" VALUE "Comments", "This program is licensed under the GNU General Public License.\0"
VALUE "CompanyName", "OpenTTD Development Team\0" VALUE "CompanyName", "OpenTTD Development Team\0"
VALUE "FileDescription", "OpenTTD\0" VALUE "FileDescription", "OpenTTD\0"
VALUE "FileVersion", "Development @@VERSION@@\0" VALUE "FileVersion", "0.7.1-RC2\0"
VALUE "InternalName", "openttd\0" VALUE "InternalName", "openttd\0"
VALUE "LegalCopyright", "Copyright \xA9 OpenTTD Developers 2002-2009. All Rights Reserved.\0" VALUE "LegalCopyright", "Copyright \xA9 OpenTTD Developers 2002-2009. All Rights Reserved.\0"
VALUE "LegalTrademarks", "\0" VALUE "LegalTrademarks", "\0"
VALUE "OriginalFilename", "openttd.exe\0" VALUE "OriginalFilename", "openttd.exe\0"
VALUE "PrivateBuild", "\0" VALUE "PrivateBuild", "\0"
VALUE "ProductName", "OpenTTD\0" VALUE "ProductName", "OpenTTD\0"
VALUE "ProductVersion", "Development @@VERSION@@\0" VALUE "ProductVersion", "0.7.1-RC2\0"
VALUE "SpecialBuild", "-\0" VALUE "SpecialBuild", "-\0"
END END
END END

View File

@@ -321,6 +321,8 @@ CommandCost CmdBuildSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, u
case MP_RAILWAY: case MP_RAILWAY:
if (!CheckTileOwnership(tile)) return CMD_ERROR; if (!CheckTileOwnership(tile)) return CMD_ERROR;
if (!IsPlainRailTile(tile)) return CMD_ERROR;
if (!IsCompatibleRail(GetRailType(tile), railtype)) return_cmd_error(STR_1001_IMPOSSIBLE_TRACK_COMBINATION); if (!IsCompatibleRail(GetRailType(tile), railtype)) return_cmd_error(STR_1001_IMPOSSIBLE_TRACK_COMBINATION);
if (!CheckTrackCombination(tile, trackbit, flags) || if (!CheckTrackCombination(tile, trackbit, flags) ||
@@ -554,6 +556,8 @@ CommandCost CmdRemoveSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1,
*/ */
bool FloodHalftile(TileIndex t) bool FloodHalftile(TileIndex t)
{ {
assert(IsPlainRailTile(t));
bool flooded = false; bool flooded = false;
if (GetRailGroundType(t) == RAIL_GROUND_WATER) return flooded; if (GetRailGroundType(t) == RAIL_GROUND_WATER) return flooded;
@@ -1043,7 +1047,7 @@ static CommandCost CmdSignalTrackHelper(TileIndex tile, DoCommandFlag flags, uin
end_tile = p1; end_tile = p1;
if (signal_density == 0 || signal_density > 20) return CMD_ERROR; if (signal_density == 0 || signal_density > 20) return CMD_ERROR;
if (!IsTileType(tile, MP_RAILWAY)) return CMD_ERROR; if (!IsTileType(tile, MP_RAILWAY) || !IsPlainRailTile(tile)) return CMD_ERROR;
/* for vertical/horizontal tracks, double the given signals density /* for vertical/horizontal tracks, double the given signals density
* since the original amount will be too dense (shorter tracks) */ * since the original amount will be too dense (shorter tracks) */
@@ -1169,6 +1173,7 @@ CommandCost CmdRemoveSingleSignal(TileIndex tile, DoCommandFlag flags, uint32 p1
if (!ValParamTrackOrientation(track) || if (!ValParamTrackOrientation(track) ||
!IsTileType(tile, MP_RAILWAY) || !IsTileType(tile, MP_RAILWAY) ||
!IsPlainRailTile(tile) ||
!HasTrack(tile, track) || !HasTrack(tile, track) ||
!EnsureNoTrainOnTrack(tile, track) || !EnsureNoTrainOnTrack(tile, track) ||
!HasSignalOnTrack(tile, track)) { !HasSignalOnTrack(tile, track)) {
@@ -2175,7 +2180,7 @@ static void TileLoop_Track(TileIndex tile)
(rail & TRACK_BIT_X) (rail & TRACK_BIT_X)
)) { )) {
TileIndex n = tile + TileDiffXY(0, -1); TileIndex n = tile + TileDiffXY(0, -1);
TrackBits nrail = GetTrackBits(n); TrackBits nrail = (IsTileType(n, MP_RAILWAY) && IsPlainRailTile(n) ? GetTrackBits(n) : TRACK_BIT_NONE);
if (!IsTileType(n, MP_RAILWAY) || if (!IsTileType(n, MP_RAILWAY) ||
!IsTileOwner(n, owner) || !IsTileOwner(n, owner) ||
@@ -2190,7 +2195,7 @@ static void TileLoop_Track(TileIndex tile)
(rail & TRACK_BIT_X) (rail & TRACK_BIT_X)
)) { )) {
TileIndex n = tile + TileDiffXY(0, 1); TileIndex n = tile + TileDiffXY(0, 1);
TrackBits nrail = GetTrackBits(n); TrackBits nrail = (IsTileType(n, MP_RAILWAY) && IsPlainRailTile(n) ? GetTrackBits(n) : TRACK_BIT_NONE);
if (!IsTileType(n, MP_RAILWAY) || if (!IsTileType(n, MP_RAILWAY) ||
!IsTileOwner(n, owner) || !IsTileOwner(n, owner) ||
@@ -2206,7 +2211,7 @@ static void TileLoop_Track(TileIndex tile)
(rail & TRACK_BIT_Y) (rail & TRACK_BIT_Y)
)) { )) {
TileIndex n = tile + TileDiffXY(-1, 0); TileIndex n = tile + TileDiffXY(-1, 0);
TrackBits nrail = GetTrackBits(n); TrackBits nrail = (IsTileType(n, MP_RAILWAY) && IsPlainRailTile(n) ? GetTrackBits(n) : TRACK_BIT_NONE);
if (!IsTileType(n, MP_RAILWAY) || if (!IsTileType(n, MP_RAILWAY) ||
!IsTileOwner(n, owner) || !IsTileOwner(n, owner) ||
@@ -2221,7 +2226,7 @@ static void TileLoop_Track(TileIndex tile)
(rail & TRACK_BIT_Y) (rail & TRACK_BIT_Y)
)) { )) {
TileIndex n = tile + TileDiffXY(1, 0); TileIndex n = tile + TileDiffXY(1, 0);
TrackBits nrail = GetTrackBits(n); TrackBits nrail = (IsTileType(n, MP_RAILWAY) && IsPlainRailTile(n) ? GetTrackBits(n) : TRACK_BIT_NONE);
if (!IsTileType(n, MP_RAILWAY) || if (!IsTileType(n, MP_RAILWAY) ||
!IsTileOwner(n, owner) || !IsTileOwner(n, owner) ||

View File

@@ -989,6 +989,11 @@ public:
this->vscroll.count = _railstation.station_count; this->vscroll.count = _railstation.station_count;
this->vscroll.cap = 5; this->vscroll.cap = 5;
this->vscroll.pos = Clamp(_railstation.station_type - 2, 0, this->vscroll.count - this->vscroll.cap); this->vscroll.pos = Clamp(_railstation.station_type - 2, 0, this->vscroll.count - this->vscroll.cap);
} else {
/* New stations are not available, so ensure the default station
* type is 'selected'. */
_railstation.station_class = STAT_CLASS_DFLT;
_railstation.station_type = 0;
} }
} }

View File

@@ -141,6 +141,7 @@ static inline void SetRailType(TileIndex t, RailType r)
*/ */
static inline TrackBits GetTrackBits(TileIndex tile) static inline TrackBits GetTrackBits(TileIndex tile)
{ {
assert(IsPlainRailTile(tile));
return (TrackBits)GB(_m[tile].m5, 0, 6); return (TrackBits)GB(_m[tile].m5, 0, 6);
} }
@@ -151,6 +152,7 @@ static inline TrackBits GetTrackBits(TileIndex tile)
*/ */
static inline void SetTrackBits(TileIndex t, TrackBits b) static inline void SetTrackBits(TileIndex t, TrackBits b)
{ {
assert(IsPlainRailTile(t));
SB(_m[t].m5, 0, 6, b); SB(_m[t].m5, 0, 6, b);
} }

View File

@@ -20,7 +20,7 @@
* norev000 is for non-releases that are made on systems without * norev000 is for non-releases that are made on systems without
* subversion or sources that are not a checkout of subversion. * subversion or sources that are not a checkout of subversion.
*/ */
const char _openttd_revision[] = "@@VERSION@@"; const char _openttd_revision[] = "0.7.1-RC2";
/** /**
* Let us know if current build was modified. This detection * Let us know if current build was modified. This detection
@@ -30,7 +30,7 @@ const char _openttd_revision[] = "@@VERSION@@";
* (compiling from sources without any version control software) * (compiling from sources without any version control software)
* and 2 is for modified revision. * and 2 is for modified revision.
*/ */
const byte _openttd_revision_modified = @@MODIFIED@@; const byte _openttd_revision_modified = !!MODIFIED!!;
/** /**
* The NewGRF revision of OTTD: * The NewGRF revision of OTTD:
@@ -45,11 +45,11 @@ const byte _openttd_revision_modified = @@MODIFIED@@;
* final release will always have a lower version number than the released * final release will always have a lower version number than the released
* version, thus making comparisions on specific revisions easy. * version, thus making comparisions on specific revisions easy.
*/ */
const uint32 _openttd_newgrf_version = 0 << 28 | 7 << 24 | 0 << 20 | 0 << 19 | (@@REVISION@@ & ((1 << 19) - 1)); const uint32 _openttd_newgrf_version = 0 << 28 | 7 << 24 | 1 << 20 | 0 << 19 | (16365 & ((1 << 19) - 1));
#ifdef __MORPHOS__ #ifdef __MORPHOS__
/** /**
* Variable used by MorphOS to show the version. * Variable used by MorphOS to show the version.
*/ */
extern const char morphos_versions_tag[] = "$VER: OpenTTD @@VERSION@@ (@@DATE@@) OpenTTD Team [MorphOS, PowerPC]"; extern const char morphos_versions_tag[] = "$VER: OpenTTD 0.7.1-RC2 (!!DATE!!) OpenTTD Team [MorphOS, PowerPC]";
#endif #endif

View File

@@ -18,7 +18,7 @@
bool IsPossibleCrossing(const TileIndex tile, Axis ax) bool IsPossibleCrossing(const TileIndex tile, Axis ax)
{ {
return (IsTileType(tile, MP_RAILWAY) && return (IsTileType(tile, MP_RAILWAY) &&
!HasSignals(tile) && GetRailTileType(tile) == RAIL_TILE_NORMAL &&
GetTrackBits(tile) == (ax == AXIS_X ? TRACK_BIT_Y : TRACK_BIT_X) && GetTrackBits(tile) == (ax == AXIS_X ? TRACK_BIT_Y : TRACK_BIT_X) &&
GetFoundationSlope(tile, NULL) == SLOPE_FLAT); GetFoundationSlope(tile, NULL) == SLOPE_FLAT);
} }

View File

@@ -321,6 +321,7 @@ static CommandCost RemoveRoad(TileIndex tile, DoCommandFlag flags, RoadBits piec
if (rt == ROADTYPE_ROAD && HasTileRoadType(tile, ROADTYPE_TRAM) && (flags & DC_EXEC || crossing_check)) return CMD_ERROR; if (rt == ROADTYPE_ROAD && HasTileRoadType(tile, ROADTYPE_TRAM) && (flags & DC_EXEC || crossing_check)) return CMD_ERROR;
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
Track railtrack = GetCrossingRailTrack(tile);
RoadTypes rts = GetRoadTypes(tile) & ComplementRoadTypes(RoadTypeToRoadTypes(rt)); RoadTypes rts = GetRoadTypes(tile) & ComplementRoadTypes(RoadTypeToRoadTypes(rt));
if (rts == ROADTYPES_NONE) { if (rts == ROADTYPES_NONE) {
TrackBits tracks = GetCrossingRailBits(tile); TrackBits tracks = GetCrossingRailBits(tile);
@@ -332,7 +333,7 @@ static CommandCost RemoveRoad(TileIndex tile, DoCommandFlag flags, RoadBits piec
/* If we ever get HWAY and it is possible without road then we will need to promote ownership and invalidate town index here, too */ /* If we ever get HWAY and it is possible without road then we will need to promote ownership and invalidate town index here, too */
} }
MarkTileDirtyByTile(tile); MarkTileDirtyByTile(tile);
YapfNotifyTrackLayoutChange(tile, FindFirstTrack(GetTrackBits(tile))); YapfNotifyTrackLayoutChange(tile, railtrack);
} }
return CommandCost(EXPENSES_CONSTRUCTION, _price.remove_road * 2); return CommandCost(EXPENSES_CONSTRUCTION, _price.remove_road * 2);
} }
@@ -549,9 +550,10 @@ CommandCost CmdBuildRoad(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR; if (!EnsureNoVehicleOnGround(tile)) return CMD_ERROR;
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
YapfNotifyTrackLayoutChange(tile, FindFirstTrack(GetTrackBits(tile))); Track railtrack = AxisToTrack(OtherAxis(roaddir));
YapfNotifyTrackLayoutChange(tile, railtrack);
/* Always add road to the roadtypes (can't draw without it) */ /* Always add road to the roadtypes (can't draw without it) */
bool reserved = HasBit(GetTrackReservation(tile), AxisToTrack(OtherAxis(roaddir))); bool reserved = HasBit(GetTrackReservation(tile), railtrack);
MakeRoadCrossing(tile, _current_company, _current_company, GetTileOwner(tile), roaddir, GetRailType(tile), RoadTypeToRoadTypes(rt) | ROADTYPES_ROAD, p2); MakeRoadCrossing(tile, _current_company, _current_company, GetTileOwner(tile), roaddir, GetRailType(tile), RoadTypeToRoadTypes(rt) | ROADTYPES_ROAD, p2);
SetCrossingReservation(tile, reserved); SetCrossingReservation(tile, reserved);
UpdateLevelCrossing(tile, false); UpdateLevelCrossing(tile, false);

View File

@@ -235,14 +235,41 @@ static bool InitializeWindowsAndCaches()
return true; return true;
} }
typedef void (CDECL *SignalHandlerPointer)(int);
static SignalHandlerPointer _prev_segfault = NULL;
static SignalHandlerPointer _prev_abort = NULL;
static void CDECL HandleSavegameLoadCrash(int signum);
/**
* Replaces signal handlers of SIGSEGV and SIGABRT
* and stores pointers to original handlers in memory.
*/
static void SetSignalHandlers()
{
_prev_segfault = signal(SIGSEGV, HandleSavegameLoadCrash);
_prev_abort = signal(SIGABRT, HandleSavegameLoadCrash);
}
/**
* Resets signal handlers back to original handlers.
*/
static void ResetSignalHandlers()
{
signal(SIGSEGV, _prev_segfault);
signal(SIGABRT, _prev_abort);
}
/** /**
* Signal handler used to give a user a more useful report for crashes during * Signal handler used to give a user a more useful report for crashes during
* the savegame loading process; especially when there's problems with the * the savegame loading process; especially when there's problems with the
* NewGRFs that are required by the savegame. * NewGRFs that are required by the savegame.
* @param unused well... unused * @param signum received signal
*/ */
void CDECL HandleSavegameLoadCrash(int unused) static void CDECL HandleSavegameLoadCrash(int signum)
{ {
ResetSignalHandlers();
char buffer[8192]; char buffer[8192];
char *p = buffer; char *p = buffer;
p += seprintf(p, lastof(buffer), p += seprintf(p, lastof(buffer),
@@ -272,6 +299,9 @@ void CDECL HandleSavegameLoadCrash(int unused)
} }
ShowInfo(buffer); ShowInfo(buffer);
SignalHandlerPointer call = signum == SIGSEGV ? _prev_segfault : _prev_abort;
if (call != NULL) call(signum);
} }
/** /**
@@ -322,9 +352,7 @@ static void FixOwnerOfRailTrack(TileIndex t)
bool AfterLoadGame() bool AfterLoadGame()
{ {
typedef void (CDECL *SignalHandlerPointer)(int); SetSignalHandlers();
SignalHandlerPointer prev_segfault = signal(SIGSEGV, HandleSavegameLoadCrash);
SignalHandlerPointer prev_abort = signal(SIGABRT, HandleSavegameLoadCrash);
TileIndex map_size = MapSize(); TileIndex map_size = MapSize();
Company *c; Company *c;
@@ -433,8 +461,7 @@ bool AfterLoadGame()
if (_networking && gcf_res != GLC_ALL_GOOD) { if (_networking && gcf_res != GLC_ALL_GOOD) {
SetSaveLoadError(STR_NETWORK_ERR_CLIENT_NEWGRF_MISMATCH); SetSaveLoadError(STR_NETWORK_ERR_CLIENT_NEWGRF_MISMATCH);
/* Restore the signals */ /* Restore the signals */
signal(SIGSEGV, prev_segfault); ResetSignalHandlers();
signal(SIGABRT, prev_abort);
return false; return false;
} }
@@ -486,8 +513,7 @@ bool AfterLoadGame()
if (_game_mode == GM_NORMAL && !ClosestTownFromTile(0, UINT_MAX)) { if (_game_mode == GM_NORMAL && !ClosestTownFromTile(0, UINT_MAX)) {
SetSaveLoadError(STR_NO_TOWN_IN_SCENARIO); SetSaveLoadError(STR_NO_TOWN_IN_SCENARIO);
/* Restore the signals */ /* Restore the signals */
signal(SIGSEGV, prev_segfault); ResetSignalHandlers();
signal(SIGABRT, prev_abort);
return false; return false;
} }
@@ -550,8 +576,7 @@ bool AfterLoadGame()
SetStationGfx(t, gfx - 170 + GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET); SetStationGfx(t, gfx - 170 + GFX_TRUCK_BUS_DRIVETHROUGH_OFFSET);
} else { } else {
/* Restore the signals */ /* Restore the signals */
signal(SIGSEGV, prev_segfault); ResetSignalHandlers();
signal(SIGABRT, prev_abort);
return false; return false;
} }
SB(_m[t].m6, 3, 3, st); SB(_m[t].m6, 3, 3, st);
@@ -1801,8 +1826,7 @@ bool AfterLoadGame()
bool ret = InitializeWindowsAndCaches(); bool ret = InitializeWindowsAndCaches();
/* Restore the signals */ /* Restore the signals */
signal(SIGSEGV, prev_segfault); ResetSignalHandlers();
signal(SIGABRT, prev_abort);
return ret; return ret;
} }

View File

@@ -65,17 +65,17 @@ static const SaveLoadGlobVarList _date_desc[] = {
SLEG_CONDVAR(_cur_tileloop_tile, SLE_FILE_U16 | SLE_VAR_U32, 0, 5), SLEG_CONDVAR(_cur_tileloop_tile, SLE_FILE_U16 | SLE_VAR_U32, 0, 5),
SLEG_CONDVAR(_cur_tileloop_tile, SLE_UINT32, 6, SL_MAX_VERSION), SLEG_CONDVAR(_cur_tileloop_tile, SLE_UINT32, 6, SL_MAX_VERSION),
SLEG_VAR(_disaster_delay, SLE_UINT16), SLEG_VAR(_disaster_delay, SLE_UINT16),
SLEG_VAR(_station_tick_ctr, SLE_UINT16), SLE_CONDNULL(2, 0, 119),
SLEG_VAR(_random.state[0], SLE_UINT32), SLEG_VAR(_random.state[0], SLE_UINT32),
SLEG_VAR(_random.state[1], SLE_UINT32), SLEG_VAR(_random.state[1], SLE_UINT32),
SLEG_CONDVAR(_cur_town_ctr, SLE_FILE_U8 | SLE_VAR_U32, 0, 9), SLE_CONDNULL(1, 0, 9),
SLEG_CONDVAR(_cur_town_ctr, SLE_UINT32, 10, SL_MAX_VERSION), SLE_CONDNULL(4, 10, 119),
SLEG_VAR(_cur_company_tick_index, SLE_FILE_U8 | SLE_VAR_U32), SLEG_VAR(_cur_company_tick_index, SLE_FILE_U8 | SLE_VAR_U32),
SLEG_CONDVAR(_next_competitor_start, SLE_FILE_U16 | SLE_VAR_U32, 0, 108), SLEG_CONDVAR(_next_competitor_start, SLE_FILE_U16 | SLE_VAR_U32, 0, 108),
SLEG_CONDVAR(_next_competitor_start, SLE_UINT32, 109, SL_MAX_VERSION), SLEG_CONDVAR(_next_competitor_start, SLE_UINT32, 109, SL_MAX_VERSION),
SLEG_VAR(_trees_tick_ctr, SLE_UINT8), SLEG_VAR(_trees_tick_ctr, SLE_UINT8),
SLEG_CONDVAR(_pause_game, SLE_UINT8, 4, SL_MAX_VERSION), SLEG_CONDVAR(_pause_game, SLE_UINT8, 4, SL_MAX_VERSION),
SLEG_CONDVAR(_cur_town_iter, SLE_UINT32, 11, SL_MAX_VERSION), SLE_CONDNULL(4, 11, 119),
SLEG_END() SLEG_END()
}; };

View File

@@ -96,6 +96,17 @@ static void FixTTDMapArray()
FixOldMapArray(); FixOldMapArray();
} }
static void FixTTDDepots()
{
const Depot *d;
FOR_ALL_DEPOTS_FROM(d, 252) {
if (!IsRoadDepotTile(d->xy) && !IsRailDepotTile(d->xy) && !IsShipDepotTile(d->xy) && !IsHangarTile(d->xy)) {
/** Workaround for SVXConverter bug, depots 252-255 could be invalid */
delete d;
}
}
}
#define FIXNUM(x, y, z) (((((x) << 16) / (y)) + 1) << z) #define FIXNUM(x, y, z) (((((x) << 16) / (y)) + 1) << z)
static uint32 RemapOldTownName(uint32 townnameparts, byte old_town_name_type) static uint32 RemapOldTownName(uint32 townnameparts, byte old_town_name_type)
@@ -1260,7 +1271,7 @@ bool LoadOldVehicle(LoadgameState *ls, int num)
uint type = ReadByte(ls); uint type = ReadByte(ls);
switch (type) { switch (type) {
default: return false; default: return false;
case 0x00 /* VEH_INVALID */: v = new (_current_vehicle_id) InvalidVehicle(); break; case 0x00 /* VEH_INVALID */: v = new (_current_vehicle_id) InvalidVehicle(); break;
case 0x25 /* MONORAIL */: case 0x25 /* MONORAIL */:
case 0x20 /* VEH_TRAIN */: v = new (_current_vehicle_id) Train(); break; case 0x20 /* VEH_TRAIN */: v = new (_current_vehicle_id) Train(); break;
case 0x21 /* VEH_ROAD */: v = new (_current_vehicle_id) RoadVehicle(); break; case 0x21 /* VEH_ROAD */: v = new (_current_vehicle_id) RoadVehicle(); break;
@@ -1583,7 +1594,6 @@ static bool LoadTTDPatchExtraChunks(LoadgameState *ls, int num)
} }
extern TileIndex _cur_tileloop_tile; extern TileIndex _cur_tileloop_tile;
static uint32 _old_cur_town_ctr;
static const OldChunks main_chunk[] = { static const OldChunks main_chunk[] = {
OCL_ASSERT( OC_TTD, 0 ), OCL_ASSERT( OC_TTD, 0 ),
OCL_ASSERT( OC_TTO, 0 ), OCL_ASSERT( OC_TTO, 0 ),
@@ -1618,7 +1628,7 @@ static const OldChunks main_chunk[] = {
OCL_ASSERT( OC_TTD, 0x4B26 ), OCL_ASSERT( OC_TTD, 0x4B26 ),
OCL_ASSERT( OC_TTO, 0x3A20 ), OCL_ASSERT( OC_TTO, 0x3A20 ),
OCL_VAR ( OC_UINT32, 1, &_old_cur_town_ctr ), OCL_NULL( 4 ), ///< town counter, no longer in use
OCL_NULL( 2 ), ///< timer_counter, no longer in use OCL_NULL( 2 ), ///< timer_counter, no longer in use
OCL_NULL( 2 ), ///< land_code, no longer in use OCL_NULL( 2 ), ///< land_code, no longer in use
@@ -1707,8 +1717,7 @@ static const OldChunks main_chunk[] = {
OCL_CNULL( OC_TTD, 144 ), ///< AI cargo-stuff, calculated in InitializeLandscapeVariables OCL_CNULL( OC_TTD, 144 ), ///< AI cargo-stuff, calculated in InitializeLandscapeVariables
OCL_NULL( 2 ), ///< Company indexes of companies, no longer in use OCL_NULL( 2 ), ///< Company indexes of companies, no longer in use
OCL_NULL( 1 ), ///< Station tick counter, no longer in use
OCL_VAR ( OC_FILE_U8 | OC_VAR_U16, 1, &_station_tick_ctr ),
OCL_VAR ( OC_UINT8, 1, &_settings_game.locale.currency ), OCL_VAR ( OC_UINT8, 1, &_settings_game.locale.currency ),
OCL_VAR ( OC_UINT8, 1, &_settings_game.locale.units ), OCL_VAR ( OC_UINT8, 1, &_settings_game.locale.units ),
@@ -1771,13 +1780,11 @@ bool LoadTTDMain(LoadgameState *ls)
DEBUG(oldloader, 3, "Done, converting game data..."); DEBUG(oldloader, 3, "Done, converting game data...");
FixTTDMapArray(); FixTTDMapArray();
FixTTDDepots();
/* Fix some general stuff */ /* Fix some general stuff */
_settings_game.game_creation.landscape = _settings_game.game_creation.landscape & 0xF; _settings_game.game_creation.landscape = _settings_game.game_creation.landscape & 0xF;
/* Remap some pointers */
_cur_town_ctr = RemapTownIndex(_old_cur_town_ctr);
/* Fix the game to be compatible with OpenTTD */ /* Fix the game to be compatible with OpenTTD */
FixOldTowns(); FixOldTowns();
FixOldVehicles(); FixOldVehicles();
@@ -1814,8 +1821,6 @@ bool LoadTTOMain(LoadgameState *ls)
_settings_game.game_creation.landscape = 0; _settings_game.game_creation.landscape = 0;
_trees_tick_ctr = 0xFF; _trees_tick_ctr = 0xFF;
_cur_town_ctr = RemapTownIndex(_old_cur_town_ctr);
if (!FixTTOMapArray() || !FixTTOEngines()) { if (!FixTTOMapArray() || !FixTTOEngines()) {
DEBUG(oldloader, 0, "Conversion failed"); DEBUG(oldloader, 0, "Conversion failed");
return false; return false;

View File

@@ -138,8 +138,8 @@ static void Load_ORDR()
free(orders); free(orders);
} else if (CheckSavegameVersionOldStyle(5, 2)) { } else if (CheckSavegameVersionOldStyle(5, 2)) {
len /= sizeof(uint16); len /= sizeof(uint32);
uint16 *orders = MallocT<uint16>(len + 1); uint32 *orders = MallocT<uint32>(len + 1);
SlArray(orders, len, SLE_UINT32); SlArray(orders, len, SLE_UINT32);

View File

@@ -195,9 +195,6 @@ static void Load_STNS()
SaveLoad_STNS(st); SaveLoad_STNS(st);
} }
/* This is to ensure all pointers are within the limits of _stations_size */
if (_station_tick_ctr > GetMaxStationIndex()) _station_tick_ctr = 0;
} }
static void Save_ROADSTOP() static void Save_ROADSTOP()

View File

@@ -189,11 +189,6 @@ static void Load_TOWN()
_total_towns++; _total_towns++;
} }
/* This is to ensure all pointers are within the limits of
* the size of the TownPool */
if (_cur_town_ctr > GetMaxTownIndex())
_cur_town_ctr = 0;
} }
extern const ChunkHandler _town_chunk_handlers[] = { extern const ChunkHandler _town_chunk_handlers[] = {

View File

@@ -698,7 +698,7 @@ void Load_VEHS()
case VEH_AIRCRAFT: v = new (index) Aircraft(); break; case VEH_AIRCRAFT: v = new (index) Aircraft(); break;
case VEH_EFFECT: v = new (index) EffectVehicle(); break; case VEH_EFFECT: v = new (index) EffectVehicle(); break;
case VEH_DISASTER: v = new (index) DisasterVehicle(); break; case VEH_DISASTER: v = new (index) DisasterVehicle(); break;
case VEH_INVALID: v = new (index) InvalidVehicle(); break; case VEH_INVALID: /* Savegame shouldn't contain invalid vehicles */
default: NOT_REACHED(); default: NOT_REACHED();
} }

View File

@@ -20,9 +20,6 @@ MusicFileSettings msf;
/* Number of levels of panning per side */ /* Number of levels of panning per side */
#define PANNING_LEVELS 16 #define PANNING_LEVELS 16
/** The number of sounds in the original sample.cat */
static const uint ORIGINAL_SAMPLE_COUNT = 73;
static void OpenBankFile(const char *filename) static void OpenBankFile(const char *filename)
{ {
FileEntry *fe = CallocT<FileEntry>(ORIGINAL_SAMPLE_COUNT); FileEntry *fe = CallocT<FileEntry>(ORIGINAL_SAMPLE_COUNT);

View File

@@ -110,4 +110,7 @@ enum SoundFx {
template <> struct EnumPropsT<SoundFx> : MakeEnumPropsT<SoundFx, byte, SND_BEGIN, SND_END, SND_END> {}; template <> struct EnumPropsT<SoundFx> : MakeEnumPropsT<SoundFx, byte, SND_BEGIN, SND_END, SND_END> {};
typedef TinyEnumT<SoundFx> SoundFxByte; typedef TinyEnumT<SoundFx> SoundFxByte;
/** The number of sounds in the original sample.cat */
static const uint ORIGINAL_SAMPLE_COUNT = 73;
#endif /* SOUND_TYPE_H */ #endif /* SOUND_TYPE_H */

View File

@@ -1820,7 +1820,7 @@ CommandCost CmdBuildAirport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
if (distant_join && (!_settings_game.station.distant_join_stations || !IsValidStationID(station_to_join))) return CMD_ERROR; if (distant_join && (!_settings_game.station.distant_join_stations || !IsValidStationID(station_to_join))) return CMD_ERROR;
/* Check if a valid, buildable airport was chosen for construction */ /* Check if a valid, buildable airport was chosen for construction */
if (p1 > lengthof(_airport_sections) || !HasBit(GetValidAirports(), p1)) return CMD_ERROR; if (p1 >= lengthof(_airport_sections) || !HasBit(GetValidAirports(), p1)) return CMD_ERROR;
if (!CheckIfAuthorityAllowsNewStation(tile, flags)) { if (!CheckIfAuthorityAllowsNewStation(tile, flags)) {
return CMD_ERROR; return CMD_ERROR;
@@ -2086,8 +2086,8 @@ bool HasStationInUse(StationID station, CompanyID company)
static CommandCost RemoveBuoy(Station *st, DoCommandFlag flags) static CommandCost RemoveBuoy(Station *st, DoCommandFlag flags)
{ {
/* XXX: strange stuff */ /* XXX: strange stuff, allow clearing as invalid company when clearing landscape */
if (!IsValidCompanyID(_current_company)) return_cmd_error(INVALID_STRING_ID); if (!IsValidCompanyID(_current_company) && !(flags & DC_BANKRUPT)) return_cmd_error(INVALID_STRING_ID);
TileIndex tile = st->dock_tile; TileIndex tile = st->dock_tile;
@@ -2689,7 +2689,11 @@ static VehicleEnterTileStatus VehicleEnter_Station(Vehicle *v, TileIndex tile, i
return VETSB_CONTINUE; return VETSB_CONTINUE;
} }
/* this function is called for one station each tick */ /**
* This function is called for each station once every 250 ticks.
* Not all stations will get the tick at the same time.
* @param st the station receiving the tick.
*/
static void StationHandleBigTick(Station *st) static void StationHandleBigTick(Station *st)
{ {
UpdateStationAcceptance(st, true); UpdateStationAcceptance(st, true);
@@ -2829,11 +2833,6 @@ void OnTick_Station()
{ {
if (_game_mode == GM_EDITOR) return; if (_game_mode == GM_EDITOR) return;
uint i = _station_tick_ctr;
if (++_station_tick_ctr > GetMaxStationIndex()) _station_tick_ctr = 0;
if (IsValidStationID(i)) StationHandleBigTick(GetStation(i));
Station *st; Station *st;
FOR_ALL_STATIONS(st) { FOR_ALL_STATIONS(st) {
StationHandleSmallTick(st); StationHandleSmallTick(st);
@@ -2842,6 +2841,7 @@ void OnTick_Station()
* Station index is included so that triggers are not all done * Station index is included so that triggers are not all done
* at the same time. */ * at the same time. */
if ((_tick_counter + st->index) % 250 == 0) { if ((_tick_counter + st->index) % 250 == 0) {
StationHandleBigTick(st);
StationAnimationTrigger(st, st->xy, STAT_ANIM_250_TICKS); StationAnimationTrigger(st, st->xy, STAT_ANIM_250_TICKS);
} }
} }
@@ -3201,8 +3201,6 @@ void InitializeStations()
/* Clean the roadstop pool and create 1 block in it */ /* Clean the roadstop pool and create 1 block in it */
_RoadStop_pool.CleanPool(); _RoadStop_pool.CleanPool();
_RoadStop_pool.AddBlockToPool(); _RoadStop_pool.AddBlockToPool();
_station_tick_ctr = 0;
} }
static CommandCost TerraformTile_Station(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new) static CommandCost TerraformTile_Station(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new)

View File

@@ -22,9 +22,11 @@
#include "textbuf_gui.h" #include "textbuf_gui.h"
#include "genworld.h" #include "genworld.h"
#include "tree_map.h" #include "tree_map.h"
#include "station_map.h"
#include "landscape_type.h" #include "landscape_type.h"
#include "tilehighlight_func.h" #include "tilehighlight_func.h"
#include "settings_type.h" #include "settings_type.h"
#include "waypoint.h"
#include "table/sprites.h" #include "table/sprites.h"
#include "table/strings.h" #include "table/strings.h"
@@ -58,11 +60,9 @@ static void GenerateDesertArea(TileIndex end, TileIndex start)
_generating_world = true; _generating_world = true;
BEGIN_TILE_LOOP(tile, size_x, size_y, TileXY(sx, sy)) { BEGIN_TILE_LOOP(tile, size_x, size_y, TileXY(sx, sy)) {
if (GetTileType(tile) != MP_WATER) { SetTropicZone(tile, (_ctrl_pressed) ? TROPICZONE_NORMAL : TROPICZONE_DESERT);
SetTropicZone(tile, (_ctrl_pressed) ? TROPICZONE_NORMAL : TROPICZONE_DESERT); DoCommandP(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
DoCommandP(tile, 0, 0, CMD_LANDSCAPE_CLEAR); MarkTileDirtyByTile(tile);
MarkTileDirtyByTile(tile);
}
} END_TILE_LOOP(tile, size_x, size_y, 0); } END_TILE_LOOP(tile, size_x, size_y, 0);
_generating_world = false; _generating_world = false;
} }
@@ -572,24 +572,34 @@ static OnButtonClick * const _editor_terraform_button_proc[] = {
static void ResetLandscapeConfirmationCallback(Window *w, bool confirmed) static void ResetLandscapeConfirmationCallback(Window *w, bool confirmed)
{ {
if (confirmed) { if (confirmed) {
Company *c;
/* Set generating_world to true to get instant-green grass after removing /* Set generating_world to true to get instant-green grass after removing
* company property. */ * company property. */
_generating_world = true; _generating_world = true;
/* Delete all stations owned by a company */
Station *st;
FOR_ALL_STATIONS(st) {
if (IsValidCompanyID(st->owner)) delete st;
}
/* Delete all companies */ /* Delete all companies */
Company *c;
FOR_ALL_COMPANIES(c) { FOR_ALL_COMPANIES(c) {
ChangeOwnershipOfCompanyItems(c->index, INVALID_OWNER); ChangeOwnershipOfCompanyItems(c->index, INVALID_OWNER);
delete c; delete c;
} }
_generating_world = false; _generating_world = false;
/* Delete all station signs */
Station *st;
FOR_ALL_STATIONS(st) {
/* There can be buoys, remove them */
if (st->IsBuoy() && IsBuoyTile(st->xy)) DoCommand(st->xy, 0, 0, DC_EXEC | DC_BANKRUPT, CMD_LANDSCAPE_CLEAR);
if (st->facilities == 0) delete st;
}
/* The same for waypoints */
Waypoint *wp;
FOR_ALL_WAYPOINTS(wp) {
delete wp;
}
MarkWholeScreenDirty();
} }
} }

View File

@@ -784,8 +784,8 @@ static void ToolbarScenDateBackward(Window *w)
w->HandleButtonClick(TBSE_DATEBACKWARD); w->HandleButtonClick(TBSE_DATEBACKWARD);
w->SetDirty(); w->SetDirty();
_settings_newgame.game_creation.starting_year = Clamp(_settings_newgame.game_creation.starting_year - 1, MIN_YEAR, MAX_YEAR); _settings_game.game_creation.starting_year = Clamp(_settings_game.game_creation.starting_year - 1, MIN_YEAR, MAX_YEAR);
SetDate(ConvertYMDToDate(_settings_newgame.game_creation.starting_year, 0, 1)); SetDate(ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1));
} }
_left_button_clicked = false; _left_button_clicked = false;
} }
@@ -797,8 +797,8 @@ static void ToolbarScenDateForward(Window *w)
w->HandleButtonClick(TBSE_DATEFORWARD); w->HandleButtonClick(TBSE_DATEFORWARD);
w->SetDirty(); w->SetDirty();
_settings_newgame.game_creation.starting_year = Clamp(_settings_newgame.game_creation.starting_year + 1, MIN_YEAR, MAX_YEAR); _settings_game.game_creation.starting_year = Clamp(_settings_game.game_creation.starting_year + 1, MIN_YEAR, MAX_YEAR);
SetDate(ConvertYMDToDate(_settings_newgame.game_creation.starting_year, 0, 1)); SetDate(ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1));
} }
_left_button_clicked = false; _left_button_clicked = false;
} }
@@ -1233,8 +1233,8 @@ public:
virtual void OnPaint() virtual void OnPaint()
{ {
this->SetWidgetDisabledState(TBSE_DATEBACKWARD, _settings_newgame.game_creation.starting_year <= MIN_YEAR); this->SetWidgetDisabledState(TBSE_DATEBACKWARD, _settings_game.game_creation.starting_year <= MIN_YEAR);
this->SetWidgetDisabledState(TBSE_DATEFORWARD, _settings_newgame.game_creation.starting_year >= MAX_YEAR); this->SetWidgetDisabledState(TBSE_DATEFORWARD, _settings_game.game_creation.starting_year >= MAX_YEAR);
/* Draw brown-red toolbar bg. */ /* Draw brown-red toolbar bg. */
GfxFillRect(0, 0, this->width - 1, this->height - 1, 0xB2); GfxFillRect(0, 0, this->width - 1, this->height - 1, 0xB2);
@@ -1242,7 +1242,7 @@ public:
this->DrawWidgets(); this->DrawWidgets();
SetDParam(0, ConvertYMDToDate(_settings_newgame.game_creation.starting_year, 0, 1)); SetDParam(0, ConvertYMDToDate(_settings_game.game_creation.starting_year, 0, 1));
DrawStringCenteredTruncated(this->widget[TBSE_DATEBACKWARD].right, this->widget[TBSE_DATEFORWARD].left, 6, STR_00AF, TC_FROMSTRING); DrawStringCenteredTruncated(this->widget[TBSE_DATEBACKWARD].right, this->widget[TBSE_DATEFORWARD].left, 6, STR_00AF, TC_FROMSTRING);
/* We hide this panel when the toolbar space gets too small */ /* We hide this panel when the toolbar space gets too small */

View File

@@ -43,6 +43,7 @@ enum BuildingFlags {
BUILDING_IS_CHURCH = 1U << 6, BUILDING_IS_CHURCH = 1U << 6,
BUILDING_IS_STADIUM = 1U << 7, BUILDING_IS_STADIUM = 1U << 7,
BUILDING_HAS_1_TILE = TILE_SIZE_1x1 | TILE_SIZE_2x1 | TILE_SIZE_1x2 | TILE_SIZE_2x2, BUILDING_HAS_1_TILE = TILE_SIZE_1x1 | TILE_SIZE_2x1 | TILE_SIZE_1x2 | TILE_SIZE_2x2,
BUILDING_HAS_2_TILES = TILE_SIZE_2x1 | TILE_SIZE_1x2 | TILE_SIZE_2x2,
BUILDING_2_TILES_X = TILE_SIZE_2x1 | TILE_SIZE_2x2, BUILDING_2_TILES_X = TILE_SIZE_2x1 | TILE_SIZE_2x2,
BUILDING_2_TILES_Y = TILE_SIZE_1x2 | TILE_SIZE_2x2, BUILDING_2_TILES_Y = TILE_SIZE_1x2 | TILE_SIZE_2x2,
BUILDING_HAS_4_TILES = TILE_SIZE_2x2, BUILDING_HAS_4_TILES = TILE_SIZE_2x2,
@@ -351,8 +352,6 @@ Town *CalcClosestTownFromTile(TileIndex tile, uint threshold = UINT_MAX);
extern Town *_cleared_town; extern Town *_cleared_town;
extern int _cleared_town_rating; extern int _cleared_town_rating;
extern uint32 _cur_town_ctr;
extern uint32 _cur_town_iter;
void ResetHouses(); void ResetHouses();

View File

@@ -683,17 +683,12 @@ void OnTick_Town()
{ {
if (_game_mode == GM_EDITOR) return; if (_game_mode == GM_EDITOR) return;
/* Make sure each town's tickhandler invocation frequency is about the Town *t;
* same - TOWN_GROWTH_FREQUENCY - independent on the number of towns. */ FOR_ALL_TOWNS(t) {
for (_cur_town_iter += GetMaxTownIndex() + 1; /* Run town tick at regular intervals, but not all at once. */
_cur_town_iter >= TOWN_GROWTH_FREQUENCY; if ((_tick_counter + t->index) % TOWN_GROWTH_FREQUENCY == 0) {
_cur_town_iter -= TOWN_GROWTH_FREQUENCY) { TownTickHandler(t);
uint32 i = _cur_town_ctr; }
if (++_cur_town_ctr > GetMaxTownIndex())
_cur_town_ctr = 0;
if (IsValidTownID(i)) TownTickHandler(GetTown(i));
} }
} }
@@ -2429,7 +2424,7 @@ uint GetMaskOfTownActions(int *nump, CompanyID cid, const Town *t)
*/ */
CommandCost CmdDoTownAction(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text) CommandCost CmdDoTownAction(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{ {
if (!IsValidTownID(p1) || p2 > lengthof(_town_action_proc)) return CMD_ERROR; if (!IsValidTownID(p1) || p2 >= lengthof(_town_action_proc)) return CMD_ERROR;
Town *t = GetTown(p1); Town *t = GetTown(p1);
@@ -2751,8 +2746,6 @@ void InitializeTowns()
s->cargo_type = CT_INVALID; s->cargo_type = CT_INVALID;
} }
_cur_town_ctr = 0;
_cur_town_iter = 0;
_total_towns = 0; _total_towns = 0;
} }

View File

@@ -2383,6 +2383,15 @@ static bool CheckTrainStayInDepot(Vehicle *v)
seg_state = _settings_game.pf.reserve_paths ? SIGSEG_PBS : UpdateSignalsOnSegment(v->tile, INVALID_DIAGDIR, v->owner); seg_state = _settings_game.pf.reserve_paths ? SIGSEG_PBS : UpdateSignalsOnSegment(v->tile, INVALID_DIAGDIR, v->owner);
} }
/* We are leaving a depot, but have to go to the exact same one; re-enter */
if (v->tile == v->dest_tile) {
/* We need to have a reservation for this to work. */
if (GetDepotWaypointReservation(v->tile)) return true;
SetDepotWaypointReservation(v->tile, true);
VehicleEnterDepot(v);
return true;
}
/* Only leave when we can reserve a path to our destination. */ /* Only leave when we can reserve a path to our destination. */
if (seg_state == SIGSEG_PBS && !TryPathReserve(v) && v->u.rail.force_proceed == 0) { if (seg_state == SIGSEG_PBS && !TryPathReserve(v) && v->u.rail.force_proceed == 0) {
/* No path and no force proceed. */ /* No path and no force proceed. */

View File

@@ -18,10 +18,6 @@ VARDEF byte _age_cargo_skip_counter;
/* Also save scrollpos_x, scrollpos_y and zoom */ /* Also save scrollpos_x, scrollpos_y and zoom */
VARDEF uint16 _disaster_delay; VARDEF uint16 _disaster_delay;
/* Determines what station to operate on in the
* tick handler. */
VARDEF uint16 _station_tick_ctr;
/* Determines how often to run the tree loop */ /* Determines how often to run the tree loop */
VARDEF byte _trees_tick_ctr; VARDEF byte _trees_tick_ctr;

View File

@@ -1219,13 +1219,12 @@ Trackdir GetVehicleTrackdir(const Vehicle *v)
if (IsStandardRoadStopTile(v->tile)) // We'll assume the road vehicle is facing outwards if (IsStandardRoadStopTile(v->tile)) // We'll assume the road vehicle is facing outwards
return DiagDirToDiagTrackdir(GetRoadStopDir(v->tile)); // Road vehicle in a station return DiagDirToDiagTrackdir(GetRoadStopDir(v->tile)); // Road vehicle in a station
if (IsDriveThroughStopTile(v->tile)) return DiagDirToDiagTrackdir(DirToDiagDir(v->direction)); /* Drive through road stops / wormholes (tunnels) */
if (v->u.road.state > RVSB_TRACKDIR_MASK) return DiagDirToDiagTrackdir(DirToDiagDir(v->direction));
/* If vehicle's state is a valid track direction (vehicle is not turning around) return it */ /* If vehicle's state is a valid track direction (vehicle is not turning around) return it,
if (!IsReversingRoadTrackdir((Trackdir)v->u.road.state)) return (Trackdir)v->u.road.state; * otherwise transform it into a valid track direction */
return (Trackdir)((IsReversingRoadTrackdir((Trackdir)v->u.road.state)) ? (v->u.road.state - 6) : v->u.road.state);
/* Vehicle is turning around, get the direction from vehicle's direction */
return DiagDirToDiagTrackdir(DirToDiagDir(v->direction));
/* case VEH_AIRCRAFT: case VEH_EFFECT: case VEH_DISASTER: */ /* case VEH_AIRCRAFT: case VEH_EFFECT: case VEH_DISASTER: */
default: return INVALID_TRACKDIR; default: return INVALID_TRACKDIR;

View File

@@ -1219,7 +1219,7 @@ const char *FS2OTTD(const TCHAR *name)
wchar_t w; wchar_t w;
int len = MultiByteToWideChar(_codepage, 0, name, 1, &w, 1); int len = MultiByteToWideChar(_codepage, 0, name, 1, &w, 1);
if (len != 1) { if (len != 1) {
DEBUG(misc, 0, "[utf8] M2W error converting '%c'. Errno %d", *name, GetLastError()); DEBUG(misc, 0, "[utf8] M2W error converting '%c'. Errno %lu", *name, GetLastError());
continue; continue;
} }
@@ -1258,7 +1258,7 @@ const TCHAR *OTTD2FS(const char *name)
char mb; char mb;
int len = WideCharToMultiByte(_codepage, 0, (wchar_t*)&c, 1, &mb, 1, NULL, NULL); int len = WideCharToMultiByte(_codepage, 0, (wchar_t*)&c, 1, &mb, 1, NULL, NULL);
if (len != 1) { if (len != 1) {
DEBUG(misc, 0, "[utf8] W2M error converting '0x%X'. Errno %d", c, GetLastError()); DEBUG(misc, 0, "[utf8] W2M error converting '0x%X'. Errno %lu", c, GetLastError());
continue; continue;
} }

View File

@@ -54,6 +54,10 @@ protected:
}; };
protected: protected:
/**
* @note maximum cost doesn't work with caching enabled
* @todo fix maximum cost failing with caching (e.g. FS#2900)
*/
int m_max_cost; int m_max_cost;
CBlobT<int> m_sig_look_ahead_costs; CBlobT<int> m_sig_look_ahead_costs;
bool m_disable_cache; bool m_disable_cache;
@@ -111,7 +115,7 @@ public:
FORCEINLINE int SwitchCost(TileIndex tile1, TileIndex tile2, DiagDirection exitdir) FORCEINLINE int SwitchCost(TileIndex tile1, TileIndex tile2, DiagDirection exitdir)
{ {
if (IsTileType(tile1, MP_RAILWAY) && IsTileType(tile2, MP_RAILWAY)) { if (IsTileType(tile1, MP_RAILWAY) && IsTileType(tile2, MP_RAILWAY) && IsPlainRailTile(tile1) && IsPlainRailTile(tile2)) {
bool t1 = KillFirstBit(GetTrackBits(tile1) & DiagdirReachesTracks(ReverseDiagDir(exitdir))) != TRACK_BIT_NONE; bool t1 = KillFirstBit(GetTrackBits(tile1) & DiagdirReachesTracks(ReverseDiagDir(exitdir))) != TRACK_BIT_NONE;
bool t2 = KillFirstBit(GetTrackBits(tile2) & DiagdirReachesTracks(exitdir)) != TRACK_BIT_NONE; bool t2 = KillFirstBit(GetTrackBits(tile2) & DiagdirReachesTracks(exitdir)) != TRACK_BIT_NONE;
if (t1 && t2) return Yapf().PfGetSettings().rail_doubleslip_penalty; if (t1 && t2) return Yapf().PfGetSettings().rail_doubleslip_penalty;

View File

@@ -198,6 +198,16 @@ public:
static bool stFindNearestDepotTwoWay(const Vehicle *v, TileIndex t1, Trackdir td1, TileIndex t2, Trackdir td2, int max_distance, int reverse_penalty, TileIndex *depot_tile, bool *reversed) static bool stFindNearestDepotTwoWay(const Vehicle *v, TileIndex t1, Trackdir td1, TileIndex t2, Trackdir td2, int max_distance, int reverse_penalty, TileIndex *depot_tile, bool *reversed)
{ {
Tpf pf1; Tpf pf1;
/*
* With caching enabled it simply cannot get a reliable result when you
* have limited the distance a train may travel. This means that the
* cached result does not match uncached result in all cases and that
* causes desyncs. So disable caching when finding for a depot that is
* nearby. This only happens with automatic servicing of vehicles,
* so it will only impact performance when you do not manually set
* depot orders and you do not disable automatic servicing.
*/
if (max_distance != 0) pf1.DisableCache(true);
bool result1 = pf1.FindNearestDepotTwoWay(v, t1, td1, t2, td2, max_distance, reverse_penalty, depot_tile, reversed); bool result1 = pf1.FindNearestDepotTwoWay(v, t1, td1, t2, td2, max_distance, reverse_penalty, depot_tile, reversed);
#if DEBUG_YAPF_CACHE #if DEBUG_YAPF_CACHE