1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-18 03:59:09 +00:00

Compare commits

..

1 Commits

Author SHA1 Message Date
rubidium
f322ab97ed (svn r26178) -Release: 1.4.0-beta1 2013-12-24 05:58:54 +00:00
356 changed files with 8396 additions and 15980 deletions

View File

@@ -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 $(GRF_DIR)/assemble_nfo.awk
$(BIN_DIR)/openttd.grf: $(PNG_FILES) $(NFO_FILES) $(OBJS_DIR)/sprites
$(E) '$(STAGE) Assembling openttd.nfo'
$(Q)-cp $(PNG_FILES) $(OBJS_DIR)/sprites 2> /dev/null
$(Q) awk -f $(GRF_DIR)/assemble_nfo.awk $(GRF_DIR)/openttd.nfo > $(OBJS_DIR)/sprites/openttd.nfo
$(Q) $(CC_BUILD) -nostdinc -I$(GRF_DIR) -C -E - < "$(GRF_DIR)/openttd.nfo" | sed -e '/^#/d' -e '/^$$/d' > $(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

View File

@@ -229,22 +229,10 @@ $(OBJS_C): %.o: $(SRC_DIR)/%.c $(DEP_MASK) $(FILE_DEP)
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.c=%.c)'
$(Q)$(CC_HOST) $(CFLAGS) -c -o $@ $<
$(filter-out %sse2.o, $(filter-out %ssse3.o, $(filter-out %sse4.o, $(OBJS_CPP)))): %.o: $(SRC_DIR)/%.cpp $(DEP_MASK) $(FILE_DEP)
$(OBJS_CPP): %.o: $(SRC_DIR)/%.cpp $(DEP_MASK) $(FILE_DEP)
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
$(Q)$(CXX_HOST) $(CFLAGS) $(CXXFLAGS) -c -o $@ $<
$(filter %sse2.o, $(OBJS_CPP)): %.o: $(SRC_DIR)/%.cpp $(DEP_MASK) $(FILE_DEP)
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
$(Q)$(CXX_HOST) $(CFLAGS) $(CXXFLAGS) -c -msse2 -o $@ $<
$(filter %ssse3.o, $(OBJS_CPP)): %.o: $(SRC_DIR)/%.cpp $(DEP_MASK) $(FILE_DEP)
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
$(Q)$(CXX_HOST) $(CFLAGS) $(CXXFLAGS) -c -mssse3 -o $@ $<
$(filter %sse4.o, $(OBJS_CPP)): %.o: $(SRC_DIR)/%.cpp $(DEP_MASK) $(FILE_DEP)
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
$(Q)$(CXX_HOST) $(CFLAGS) $(CXXFLAGS) -c -msse4.1 -o $@ $<
$(OBJS_MM): %.o: $(SRC_DIR)/%.mm $(DEP_MASK) $(FILE_DEP)
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.mm=%.mm)'
$(Q)$(CC_HOST) $(CFLAGS) -c -o $@ $<

View File

@@ -10,7 +10,7 @@ fallback = true
description = A music pack without actual music.
description.af_ZA = 'n Musiek stel sonder enige musiek.
description.ar_EG = مجموعة موسيقى بدون موسيقى
description.be_BY = "Пусты" набор музычнага афармлення, які не зьмяшчае ніякай музыкі.
description.be_BY = "Пусты" набор музычнага афармлення, не змяшчаючы ніякай музыкі.
description.bg_BG = Празен музикален пакет.
description.ca_ES = Un joc de música sense cap música.
description.cs_CZ = Prázná hudební sada.

View File

@@ -10,7 +10,7 @@ fallback = true
description = A sound pack without any sounds.
description.af_ZA = 'n Klank stel sonder enige klanke.
description.ar_EG = مجموعة صوت بدوت اصوات مضافة
description.be_BY = "Пусты" набор гукавога афармленьня, які не зьмяшчае ніякіх гукаў.
description.be_BY = "Пусты" набор гукавога афармленьня, не змяшчаючы ніякіх гукаў.
description.bg_BG = Празен звуков пакет.
description.ca_ES = Un joc de sons sense cap so.
description.cs_CZ = Prázdná sada zvuků.
@@ -22,7 +22,6 @@ 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.

Binary file not shown.

View File

@@ -11,7 +11,7 @@ palette = DOS
description = Original Transport Tycoon Deluxe DOS edition graphics.
description.af_ZA = Oorspronklike Transport Tycoon Deluxe DOS uitgawe grafieke.
description.ar_EG = النسخة الاصلية من ترانسبورت تايكون ديلوكس الرسومية نسخة الدوس
description.be_BY = Арыґінальная ґрафіка з Transport Tycoon Deluxe для DOS.
description.be_BY = Арыгінальная графіка з Transport Tycoon Deluxe для DOS.
description.bg_BG = Оригинални графики на Transport Tycoon Deluxe за DOS.
description.ca_ES = Gràfics originals de Transport Tycoon Deluxe per a DOS.
description.cs_CZ = Původní sada grafik Transport Tycoon Deluxe (verze pro DOS).

View File

@@ -10,7 +10,7 @@ version = 0
description = Original Transport Tycoon Deluxe DOS edition sounds.
description.af_ZA = Oorspronklike Transport Tycoon Deluxe DOS uitgawe klanke.
description.ar_EG = النسخة الاصلية من ترانسبورت تايكون ديلوكس الصوتية نسخة الدوس
description.be_BY = Арыґінальны набор гукавога афармленьня з гульні Transport Tycoon Deluxe для DOS.
description.be_BY = Арыгінальны набор гукавога афармленьня з гульні Transport Tycoon Deluxe для DOS.
description.bg_BG = Оригинални звуци на Transport Tycoon Deluxe за DOS.
description.ca_ES = Sons originals de Transport Tycoon Deluxe per a DOS.
description.cs_CZ = Původní sada zvuků Transport Tycoon Deluxe (verze pro DOS).

View File

@@ -11,7 +11,7 @@ palette = DOS
description = Original Transport Tycoon Deluxe DOS (German) edition graphics.
description.af_ZA = Oorspronklike Transport Tycoon Deluxe DOS (German) uitgawe grafieke.
description.ar_EG = النسخة الاصلية من ترانسبورت تايكون ديلوكس الالمانية نسخة الدوس
description.be_BY = Арыґінальная ґрафіка зь нямецкай версіі Transport Tycoon Deluxe для DOS.
description.be_BY = Арыгінальная графіка з нямецкай версіі Transport Tycoon Deluxe для DOS.
description.bg_BG = Оригинални графики на Transport Tycoon Deluxe за DOS (немски) .
description.ca_ES = Gràfics originals de Transport Tycoon Deluxe per a DOS (Alemany).
description.cs_CZ = Původní sada grafik Transport Tycoon Deluxe (německá verze pro DOS).

View File

@@ -11,7 +11,7 @@ palette = Windows
description = Original Transport Tycoon Deluxe Windows edition graphics.
description.af_ZA = Oorspronklike Transport Tycoon Deluxe Windows uitgawe grafieke.
description.ar_EG = النسخة الاصلية من ترانسبورت تايكون ديلوكس الرسومية نسخة وندوز
description.be_BY = Арыґінальная ґрафіка з Transport Tycoon Deluxe для Windows.
description.be_BY = Арыгінальная графіка з Transport Tycoon Deluxe для Windows.
description.bg_BG = Оригинални графики на Transport Tycoon Deluxe за Windows.
description.ca_ES = Gràfics originals de Transport Tycoon Deluxe per a Windows.
description.cs_CZ = Původní sada grafik Transport Tycoon Deluxe (verze pro Windows).
@@ -33,7 +33,7 @@ description.id_ID = Grafik orisinil Transport Tycoon Deluxe versi Windows.
description.is_IS = Upprunalega grafíkin úr Transport Tycoon Deluxe Windows útgáfunni.
description.it_IT = Grafica originale di Transport Tycoon Deluxe, edizione Windows.
description.ja_JP = Transport Tycoon Deluxe オリジナル版 グラフィック (Windows)
description.ko_KR = 오리지널 트랜스포트 타이쿤 디럭스 윈도 에디션의 그래픽입니다.
description.ko_KR = 오리지널 트랜스포트 타이쿤 디럭스 윈도 에디션의 그래픽입니다.
description.lb_LU = Original Transport Tycoon Deluxe Windows Editioun Grafik.
description.lt_LT = Originali Transport Tycoon Deluxe Windows leidimo grafika.
description.nb_NO = Original grafikk fra Transport Tycoon Deluxe for Windows.

View File

@@ -10,7 +10,7 @@ version = 1
description = Original Transport Tycoon Deluxe Windows edition music.
description.af_ZA = Oorspronklike Transport Tycoon Deluxe Windows uitgawe musiek.
description.ar_EG = النسخة الاصلية من ترانسبورت تايكون ديلوكس الموسيقية نسخة وندوز
description.be_BY = Арыґінальны набор музычнага афармленьня з гульні Transport Tycoon Deluxe для Windows.
description.be_BY = Арыгінальны набор музычнага афармленьня з гульні Transport Tycoon Deluxe для Windows.
description.bg_BG = Оригинална музика на Transport Tycoon Deluxe за Windows.
description.ca_ES = Música Original de Transport Tycoon Deluxe per a Windows.
description.cs_CZ = Původní hudba Transport Tycoon Deluxe (verze pro Windows).
@@ -32,7 +32,7 @@ description.id_ID = Musik pengiring orisinil Transport Tycoon Deluxe versi Windo
description.is_IS = Upprunalega tónlistin úr Transport Tycoon Deluxe Windows útgáfunni.
description.it_IT = Musica originale di Transport Tycoon Deluxe, edizione Windows.
description.ja_JP = Transport Tycoon Deluxe オリジナル版 音楽 (Windows)
description.ko_KR = 오리지널 트랜스포트 타이쿤 디럭스 윈도 에디션의 음악입니다.
description.ko_KR = 오리지널 트랜스포트 타이쿤 디럭스 윈도 에디션의 음악입니다.
description.lb_LU = Original Transport Tycoon Deluxe Windows Editioun Music.
description.lt_LT = Originali Transport Tycoon Deluxe Windows leidimo muzika.
description.lv_LV = Oriģinālā Transport Tycoon Deluxe Windows izdevuma mūzika.

View File

@@ -10,7 +10,7 @@ version = 0
description = Original Transport Tycoon Deluxe Windows edition sounds.
description.af_ZA = Oorspronklike Transport Tycoon Deluxe Windows uitgawe klanke.
description.ar_EG = النسخة الاصلية من ترانسبورت تايكون ديلوكس الصوتية نسخة وندوز
description.be_BY = Арыґінальны набор гукавога афармленьня з гульні Transport Tycoon Deluxe для Windows.
description.be_BY = Арыгінальны набор гукавога афармленьня з гульні Transport Tycoon Deluxe для Windows.
description.bg_BG = Оригинални звуци на Transport Tycoon Deluxe за Windows.
description.ca_ES = Sons originals de Transport Tycoon Deluxe per a Windows.
description.cs_CZ = Původní sada zvuků Transport Tycoon Deluxe (verze pro Windows).
@@ -32,7 +32,7 @@ description.id_ID = Efek suara orisinil Transport Tycoon Deluxe versi Windows.
description.is_IS = Upprunalega hljóðið úr Transport Tycoon Deluxe Windows útgáfunni.
description.it_IT = Suoni originali di Transport Tycoon Deluxe, edizione Windows.
description.ja_JP = Transport Tycoon Deluxe オリジナル版 効果音 (Windows)
description.ko_KR = 오리지널 트랜스포트 타이쿤 디럭스 윈도 에디션의 효과음입니다.
description.ko_KR = 오리지널 트랜스포트 타이쿤 디럭스 윈도 에디션의 효과음입니다.
description.lb_LU = Original Transport Tycoon Deluxe Windows Editioun Sound.
description.lt_LT = Originalūs Transport Tycoon Deluxe Windows leidimo garsai.
description.nb_NO = Originale lyder fra Transport Tycoon Deluxe for Windows.

File diff suppressed because it is too large Load Diff

View File

@@ -57,8 +57,8 @@ set_default() {
enable_translator="0"
enable_unicode="1"
enable_console="1";
enable_assert="0"
enable_strip="1"
enable_assert="1"
enable_strip="0"
enable_universal="0"
enable_osx_g5="0"
enable_cocoa_quartz="1"
@@ -92,7 +92,6 @@ set_default() {
with_ccache="1"
with_nforenum="1"
with_grfcodec="1"
with_sse="1"
save_params_array="
build
@@ -167,7 +166,6 @@ set_default() {
with_ccache
with_grfcodec
with_nforenum
with_sse
CC CXX CFLAGS CXXFLAGS LDFLAGS CFLAGS_BUILD CXXFLAGS_BUILD LDFLAGS_BUILD"
}
@@ -449,10 +447,6 @@ detect_params() {
--with-threads) with_threads="1";;
--with-threads=*) with_threads="$optarg";;
--without-sse) with_sse="0";;
--with-sse) with_sse="1";;
--with-sse=*) with_sse="$optarg";;
CC=* | --CC=*) CC="$optarg";;
CXX=* | --CXX=*) CXX="$optarg";;
CFLAGS=* | --CFLAGS=*) CFLAGS="$optarg";;
@@ -593,7 +587,6 @@ check_params() {
check_makedepend
detect_cputype
detect_sse_capable_architecture
if [ "$enable_static" = "1" ]; then
if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "MORPHOS" ] || [ "$os" = "DOS" ]; then
@@ -1450,11 +1443,7 @@ make_cflags_and_ldflags() {
LDFLAGS="$LDFLAGS -noixemul"
fi
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"
CFLAGS="-O2 -fomit-frame-pointer $CFLAGS"
else
OBJS_SUBDIR="debug"
@@ -1498,16 +1487,13 @@ make_cflags_and_ldflags() {
fi
if [ "$enable_profiling" != "0" ]; then
CFLAGS="$CFLAGS -pg"
CFLAGS="$CFLAGS -p"
LDFLAGS="$LDFLAGS -pg"
fi
if [ "$with_threads" = "0" ]; then
CFLAGS="$CFLAGS -DNO_THREADS"
fi
if [ "$with_sse" = "1" ]; then
CFLAGS="$CFLAGS -DWITH_SSE"
fi
if [ "`echo $1 | cut -c 1-3`" != "icc" ]; then
if [ "$os" = "CYGWIN" ]; then
@@ -1704,18 +1690,17 @@ make_cflags_and_ldflags() {
if [ -n "$png_config" ]; then
CFLAGS="$CFLAGS -DWITH_PNG"
CFLAGS="$CFLAGS `$png_config --cflags | tr '\n\r' ' '`"
CFLAGS="$CFLAGS `$png_config --cppflags --I_opts | 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
# 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]*@@`"
LIBS="$LIBS `$png_config --prefix`/lib/libpng.a"
else
LIBS="$LIBS `$png_config --libs --static | tr '\n\r' ' '`"
LIBS="$LIBS `$png_config --static --ldflags | tr '\n\r' ' '`"
fi
else
LIBS="$LIBS `$png_config --libs | tr '\n\r' ' '`"
LIBS="$LIBS `$png_config --ldflags | tr '\n\r' ' '`"
fi
fi
@@ -2720,64 +2705,80 @@ detect_libtimidity() {
detect_library "$with_libtimidity" "libtimidity" "libtimidity.a" "" "timidity.h"
}
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')
detect_lzma() {
# 0 means no, 1 is auto-detect, 2 is force
if [ "$1" = "0" ]; then
log 1 "checking $2... disabled"
if [ "$with_lzma" = "0" ]; then
log 1 "checking liblzma... disabled"
eval "$3=\"\""
lzma_config=""
return 0
fi
log 2 "detecting $2"
if [ "$1" = "1" ] || [ "$1" = "" ] || [ "$1" = "2" ]; then
pkg_config_call="pkg-config $2"
if [ "$with_lzma" = "1" ] || [ "$with_lzma" = "" ] || [ "$with_lzma" = "2" ]; then
lzma_config="pkg-config liblzma"
else
pkg_config_call="$1"
lzma_config="$with_lzma"
fi
version=`$pkg_config_call --modversion 2>/dev/null`
version=`$lzma_config --modversion 2>/dev/null`
ret=$?
check_version "$4" "$version"
version_ok=$?
log 2 "executing $pkg_config_call --modversion"
log 2 "executing $lzma_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 $2... needs at least version $4, $2 NOT enabled"
else
log 1 "checking $2... not found"
fi
if [ -z "$version" ] || [ "$ret" != "0" ]; then
log 1 "checking liblzma... not found"
# It was forced, so it should be found.
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"
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"
exit 1
fi
eval "$3=\"\""
lzma_config=""
return 0
fi
eval "$3=\"$pkg_config_call\""
log 1 "checking $2... found"
}
detect_lzma() {
detect_pkg_config "$with_lzma" "liblzma" "lzma_config" "5.0"
log 1 "checking liblzma... found"
}
detect_xdg_basedir() {
detect_pkg_config "$with_xdg_basedir" "libxdg-basedir" "xdg_basedir_config" "1.2"
# 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_png() {
@@ -2804,7 +2805,33 @@ detect_png() {
return 0
fi
detect_pkg_config "$with_png" "libpng" "png_config" "1.2"
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_freetype() {
@@ -2899,7 +2926,39 @@ detect_fontconfig() {
return 0
fi
detect_pkg_config "$with_fontconfig" "fontconfig" "fontconfig_config" "2.3"
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_icu() {
@@ -3265,40 +3324,6 @@ detect_cputype() {
rm -f tmp.64bit tmp.64bit.cpp
}
detect_sse_capable_architecture() {
# 0 means no, 1 is auto-detect, 2 is force
if [ "$with_sse" = "0" ]; then
log 1 "checking SSE... disabled"
return
fi
echo "#define _SQ64 1" > tmp.sse.cpp
echo "#include <xmmintrin.h>" >> tmp.sse.cpp
echo "#include <smmintrin.h>" >> tmp.sse.cpp
echo "#include <tmmintrin.h>" >> tmp.sse.cpp
echo "int main() { return 0; }" >> tmp.sse.cpp
execute="$cxx_host -msse4.1 $CFLAGS tmp.sse.cpp -o tmp.sse 2>&1"
sse="`eval $execute 2>/dev/null`"
ret=$?
log 2 "executing $execute"
log 2 " returned $sse"
log 2 " exit code $ret"
if [ "$ret" = "0" ]; then
log 1 "detecting SSE... found"
else
# It was forced, so it should be found.
if [ "$with_sse" != "1" ]; then
log 1 "configure: error: SSE couln't be found"
log 1 "configure: error: you force enabled SSE, but it seems unavailable"
exit 1
fi
log 1 "detecting SSE... not found"
with_sse="0"
fi
rm -f tmp.sse tmp.exe tmp.sse.cpp
}
make_sed() {
T_CFLAGS="$CFLAGS"
T_CXXFLAGS="$CXXFLAGS"
@@ -3689,8 +3714,6 @@ showhelp() {
echo " --with-ccache enables ccache support"
echo " --with-distcc enables distcc support"
echo " --without-grfcodec disable usage of grfcodec and re-generation of base sets"
echo " --without-threads disable threading support"
echo " --without-sse disable SSE support (x86/x86_64 only)"
echo ""
echo "Some influential environment variables:"
echo " CC C compiler command"

1
configure vendored
View File

@@ -129,7 +129,6 @@ AWKCOMMAND='
if ($0 == "DIRECTMUSIC" && "'$with_direct_music'" == "0") { next; }
if ($0 == "LIBTIMIDITY" && "'$libtimidity'" == "" ) { next; }
if ($0 == "HAVE_THREAD" && "'$with_threads'" == "0") { next; }
if ($0 == "SSE" && "'$with_sse'" != "1") { next; }
skip += 1;

View File

@@ -1,262 +0,0 @@
Some explanations about Desyncs
Last updated: 2014-02-23
------------------------------------------------------------------------
Table of contents
-----------------
1.0) Desync theory
* 1.1) OpenTTD multiplayer architecture
* 1.2) What is a Desync and how is it detected
* 1.3) Typical causes of Desyncs
2.0) What to do in case of a Desync
* 2.1) Cache debugging
* 2.2) Desync recording
3.0) Evaluating the Desync records
* 3.1) Replaying
* 3.2) Evaluation the replay
* 3.3) Comparing savegames
1.1) OpenTTD multiplayer architecture
---- --------------------------------
OpenTTD has a huge gamestate, which changes all of the time.
The savegame contains the complete gamestate at a specific point
in time. But this state changes completely each tick: Vehicles move
and trees grow.
However, most of these changes in the gamestate are deterministic:
Without a player interfering a vehicle follows its orders always
in the same way, and trees always grow the same.
In OpenTTD multiplayer synchronisation works by creating a savegame
when clients join, and then transfering that savegame to the client,
so it has the complete gamestate at a fixed point in time.
Afterwards clients only receive 'commands', that is: Stuff which is
not predictable, like
- player actions
- AI actions
- GameScript actions
- Admin Port command
- rcon commands
- ...
These commands contain the information on how to execute the command,
and when to execute it. Time is measured in 'network frames'.
Mind that network frames to not match ingame time. Network frames
also run while the game is paused, to give a defined behaviour to
stuff that is executing while the game is paused.
The deterministic part of the gamestate is run by the clients on
their own. All they get from the server is the instruction to
run the gamestate up to a certain network time, which basically
says that there are no commands scheduled in that time.
When a client (which includes the server itself) wants to execute
a command (i.e. a non-predictable action), it does this by
- calling DoCommandP resp. DoCommandPInternal
- These functions first do a local test-run of the command to
check simple preconditions. (Just to give the client an
immediate response without bothering the server and waiting for
the response.) The test-run may not actually change the
gamestate, all changes must be discarded.
- If the local test-run succeeds the command is sent to the server.
- The server inserts the command into the command queue, which
assigns a network frame to the commands, i.e. when it shall be
executed on all clients.
- Enhanced with this specific timestamp, the command is send to all
clients, which execute the command simultaneously in the same
network frame in the same order.
1.2) What is a Desync and how is it detected
---- ---------------------------------------
In the ideal case all clients have the same gamestate as the server
and run in sync. That is, vehicle movement is the same on all
clients, and commands are executed the same everywhere and
have the same results.
When a Desync happens, it means that the gamestates on the clients
(including the server) are no longer the same. Just imagine
that a vehicle picks the left line instead of the right line at
a junction on one client.
The important thing here is, that noone notices when a Desync
occurs. The desync client will continue to simulate the gamestate
and execute commands from the server. Once the gamestate differs
it will increasingly spiral out of control: If a vehicle picks a
different route, it will arrive at a different time at a station,
which will load different cargo, which causes other vehicles to
load other stuff, which causes industries to notice different
servicing, which causes industries to change production, ...
the client could run all day in a different universe.
To limit how long a Desync can remain unnoticed, the server
transfers some checksums every now and then for the gamestate.
Currently this checksum is the state of the random number
generator of the game logic. A lot of things in OpenTTD depend
on the RNG, and if the gamestate differs, it is likely that the
RNG is called at different times, and the state differs when
checked.
The clients compare this 'checksum' with the checksum of their
own gamestate at the specific network frame. If they differ,
the client disconnects with a Desync error.
The important thing here is: The detection of the Desync is
only an ultimate failure detection. It does not give any
indication on when the Desync happened. The Desync may after
all have occured long ago, and just did not affect the checksum
up to now. The checksum may have matched 10 times or more
since the Desync happend, and only now the Desync has spiraled
enough to finally affect the checksum. (There was once a desync
which was only noticed by the checksum after 20 game years.)
1.3) Typical causes of Desyncs
---- -------------------------
Desyncs can be caused by the following scenarios:
- The savegame does not describe the complete gamestate.
- Some information which affects the progression of the
gamestate is not saved in the savegame.
- Some information which affects the progression of the
gamestate is not loaded from the savegame.
This includes the case that something is not completely
reset before loading the savegame, so data from the
previous game is carried over to the new one.
- The gamestate does not behave deterministic.
- Cache mismatch: The game logic depends on some cached
values, which are not invalidated properly. This is
the usual case for NewGRF-specific Desyncs.
- Undefined behaviour: The game logic performs multiple
things in an undefined order or with an undefined
result. E.g. when sorting something with a key while
some keys are equal. Or some computation that depends
on the CPU architecture (32/64 bit, little/big endian).
- The gamestate is modified when it shall not be modified.
- The test-run of a command alters the gamestate.
- The gamestate is altered by a player or script without
using commands.
2.1) Cache debugging
---- ---------------
Desyncs which are caused by inproper cache validation can
often be found by enabling cache validation:
- Start OpenTTD with '-d desync=2'.
- This will enable validation of caches every tick.
That is, cached values are recomputed every tick and compared
to the cached value.
- Differences are logged to 'commands-out.log' in the autosave
folder.
Mind that this type of debugging can also be done in singleplayer.
2.2) Desync recording
---- ----------------
If you have a server, which happens to encounter Desyncs often,
you can enable recording of the gamestate alterations. This
will later allow the replay the gamestate and locate the Desync
cause.
There are two levels of Desync recording, which are enabled
via '-d desync=2' resp. '-d desync=3'. Both will record all
commands to a file 'commands-out.log' in the autosave folder.
If you have the savegame from the start of the server, and
this command log you can replay the whole game. (see Section 3.1)
If you do not start the server from a savegame, there will
also be a savegame created just after a map has been generated.
The savegame will be named 'dmp_cmds_*.sav' and be put into
the autosave folder.
In addition to that '-d desync=3' also creates regular savegames
at defined spots in network time. (more defined than regular
autosaves). These will be created in the autosave folder
and will also be named 'dmp_cmds_*.sav'.
These saves allow comparing the gamestate with the original
gamestate during replaying, and thus greatly help debugging.
However, they also take a lot of disk space.
3.1) Replaying
---- ---------
To replay a Desync recording, you need these files:
- The savegame from when the server was started, resp.
the automatically created savegame from when the map
was generated.
- The 'commands-out.log' file.
- Optionally the 'dmp_cmds_*.sav'.
Put these files into a safe spot. (Not your autosave folder!)
Next, prepare your OpenTTD for replaying:
- Get the same version of OpenTTD as the original server was running.
- Uncomment/enable the define 'DEBUG_DUMP_COMMANDS' in
'src/network/network_func.h'.
- Put the 'commands-out.log' into the root save folder, and rename
it to 'commands.log'.
- Run 'openttd -D -d desync=3 -g startsavegame.sav'.
This replays the server log and creates new 'commands-out.log'
and 'dmp_cmds_*.sav' in your autosave folder.
3.2) Evaluation the replay
---- ---------------------
The replaying will also compare the checksums which are part of
the 'commands-out.log' with the replayed gamestate.
If they differ, it will trigger a 'NOT_REACHED'.
If the replay succeeds without mismatch, that is the replay reproduces
the original server state:
- Repeat the replay starting from incrementally later 'dmp_cmds_*.sav'
while truncating the 'commands.log' at the beginning appropriately.
The 'dmp_cmds_*.sav' can be your own ones from the first reply, or
the ones from the original server (if you have them).
(This simulates the view of joining clients during the game.)
- If one of those replays fails, you have located the Desync between
the last dmp_cmds that reproduces the replay and the first one
that fails.
If you have the original 'dmp_cmds_*.sav', you can also compare those
savegames with your own ones from the replay. You can also comment/disable
the 'NOT_REACHED' mentioned above, to get another 'dmp_cmds_*.sav' from
the replay after the mismatch has already been detected.
See Section 3.2 on how to compare savegames.
If the saves differ you have located the Desync between the last dmp_cmds
that match and the first one that does not. The difference of the saves
may point you in the direction of what causes it.
If the replay succeeds without mismatch, and you do not have any
'dmp_cmd_*.sav' from the original server, it is a lost case.
Enable creation of the 'dmp_cmd_*.sav' on the server, and wait for the
next Desync.
Finally, you can also compare the 'commands-out.log' from the original
server with the one from the replay. They will differ in stuff like
dates, and the original log will contain the chat, but otherwise they
should match.
3.2) Comparing savegames
---- -------------------
The binary form of the savegames from the original server and from
your replay will always differ:
- The savegame contains paths to used NewGRF files.
- The gamelog will log your loading of the savegame.
- The savegame data of AIs and the Gamescript will differ.
Scripts are not run during the replay, only their recorded commands
are replayed. Their internal state will thus not change in the
replay and will differ.
To compare savegame more semantically, there exist some ugly hackish
tools at:
http://devs.openttd.org/~frosch/texts/zpipe.c
http://devs.openttd.org/~frosch/texts/printhunk.c
The first one decompresses OpenTTD savegames. The second one creates
a textual representation of an uncompressed savegame, by parsing hunks
and arrays and such. With both tools you need to be a bit careful
since they work on stdin and stdout, which may not deal well with
binary data.
If you have the textual representation of the savegames, you can
compare them with regular diff tools.

View File

@@ -1,6 +1,6 @@
OpenTTD's known bugs
Last updated: 2014-09-23
Release version: 1.4.3
Last updated: 2013-12-24
Release version: 1.4.0-beta1
------------------------------------------------------------------------
@@ -33,13 +33,12 @@ 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: 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.
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.
After a while of playing, colours get corrupted
In Windows 7 the background slideshow corrupts the colour mapping of
@@ -445,11 +444,3 @@ Trains might not stop at platforms that are currently being changed [FS#5553]:
just anywhere in the station because then it would never leave the station
if you have the same station in the order list multiple times in a row or
if there is only one station in the order list (see FS#5684).
Some houses and industries are not affected by transparency [FS#5817]:
Some of the default houses and industries (f.e. the iron ore mine) are
not affected by the transparency options. This is because the graphics do
not (completely) separate the ground from the building.
This is a bug of the original graphics, and unfortunately cannot be
fixed with OpenGFX for the sake of maintaining compatibility with the
original graphics.

View File

@@ -1,32 +0,0 @@
# $Id$
# This file is part of OpenTTD.
# OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
# OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
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;
}
}

View File

@@ -1,98 +1,8 @@
openttd (1.4.3-0) unstable; urgency=low
* New upstream release 1.4.3
-- OpenTTD <info@openttd.org> 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 <info@openttd.org> 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 <info@openttd.org> Sun, 07 Sep 2014 19:00:00 +0200
openttd (1.4.2-0) unstable; urgency=low
* New upstream release 1.4.2
-- OpenTTD <info@openttd.org> 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 <info@openttd.org> 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 <info@openttd.org> Thu, 03 Jul 2014 21:00:00 +0200
openttd (1.4.1-0) unstable; urgency=low
* New upstream release 1.4.1
-- OpenTTD <info@openttd.org> 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 <info@openttd.org> 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 <info@openttd.org> Sun, 04 May 2014 21:00:00 +0200
openttd (1.4.0-0) unstable; urgency=low
* New upstream release 1.4.0
-- OpenTTD <info@openttd.org> Tue, 01 Apr 2014 21:00:00 +0200
openttd (1.4.0~RC1-0) unstable; urgency=low
* New upstream release 1.4.0-RC1
-- OpenTTD <info@openttd.org> Tue, 17 Mar 2014 21:00:00 +0100
openttd (1.4.0~beta5-0) unstable; urgency=low
* New upstream release 1.4.0-beta5
-- OpenTTD <info@openttd.org> Tue, 25 Feb 2014 10:15:00 +0100
openttd (1.4.0~beta4-0) unstable; urgency=low
* New upstream release 1.4.0-beta4
-- OpenTTD <info@openttd.org> Thu, 06 Feb 2014 21:00:00 +0100
openttd (1.4.0~beta3-0) unstable; urgency=low
* New upstream release 1.4.0-beta3
-- OpenTTD <info@openttd.org> Tue, 21 Jan 2014 21:00:00 +0100
openttd (1.4.0~beta2-0) unstable; urgency=low
* New upstream release 1.4.0-beta2
-- OpenTTD <info@openttd.org> Tue, 07 Jan 2014 21:00:00 +0100
openttd (1.4.0~beta1-0) unstable; urgency=low
openttd (1.4.0~beta1) unstable; urgency=low
* New upstream release 1.4.0-beta1
-- OpenTTD <info@openttd.org> Tue, 24 Dec 2013 00:00:00 +0100
-- OpenTTD <info@openttd.org> Tue, 24 Dec 2012 00:00:00 +0100
openttd (1.3.3-0) unstable; urgency=low

View File

@@ -3,7 +3,7 @@ Section: games
Priority: optional
Maintainer: Matthijs Kooijman <matthijs@stdin.nl>
Uploaders: Jordi Mallach <jordi@debian.org>
Build-Depends: debhelper (>= 7.0.50), libsdl-dev, zlib1g-dev, libpng-dev, libfreetype6-dev, libfontconfig-dev, libicu-dev, liblzma-dev, liblzo2-dev
Build-Depends: debhelper (>= 7.0.50), libsdl-dev, zlib1g-dev, libpng-dev, libfreetype6-dev, libfontconfig-dev, libicu-dev, liblzma-dev, liblzo2-dev, libxdg-basedir-dev
Standards-Version: 3.8.4
Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/openttd.git
Vcs-Git: git://anonscm.debian.org/collab-maint/openttd.git

View File

@@ -29,7 +29,7 @@ include /usr/share/dpkg/buildflags.mk
# to be explicit about the dependencies, in case we're not running in a
# clean build root.
override_dh_auto_configure:
./configure $(CROSS) --prefix-dir=/usr --install-dir=debian/openttd --without-allegro --with-zlib --with-sdl --with-png --with-freetype --with-fontconfig --with-icu --with-liblzo2 --with-lzma --without-xdg-basedir --without-iconv --disable-strip CFLAGS="$(CFLAGS) $(CPPFLAGS)" CXXFLAGS="$(CXXFLAGS) $(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" CFLAGS_BUILD="$(CFLAGS) $(CPPFLAGS)" CXXFLAGS_BUILD="$(CXXFLAGS) $(CPPFLAGS)" LDFLAGS_BUILD="$(LDFLAGS)"
./configure $(CROSS) --prefix-dir=/usr --install-dir=debian/openttd --without-allegro --with-zlib --with-sdl --with-png --with-freetype --with-fontconfig --with-icu --with-liblzo2 --with-lzma --with-xdg-basedir --without-iconv --disable-strip CFLAGS="$(CFLAGS) $(CPPFLAGS)" CXXFLAGS="$(CXXFLAGS) $(CPPFLAGS)" LDFLAGS="$(LDFLAGS)" CFLAGS_BUILD="$(CFLAGS) $(CPPFLAGS)" CXXFLAGS_BUILD="$(CXXFLAGS) $(CPPFLAGS)" LDFLAGS_BUILD="$(LDFLAGS)"
# Do some extra installation
override_dh_auto_install:

View File

@@ -1,9 +1,9 @@
# Version numbers to update
!define APPV_MAJOR 1
!define APPV_MINOR 4
!define APPV_MAINT 3
!define APPV_BUILD 2
!define APPV_EXTRA ""
!define APPV_MAINT 0
!define APPV_BUILD 0
!define APPV_EXTRA "-beta1"
!define APPNAME "OpenTTD" ; Define application name
!define APPVERSION "${APPV_MAJOR}.${APPV_MINOR}.${APPV_MAINT}${APPV_EXTRA}" ; Define application version

View File

@@ -173,7 +173,6 @@ Function load_main_data(filename, ByRef vcxproj, ByRef filters, ByRef files)
line = "MSVC" Or _
line = "DIRECTMUSIC" Or _
line = "AI" Or _
line = "SSE" Or _
line = "HAVE_THREAD" _
) Then skip = skip + 1
deep = deep + 1

View File

@@ -102,7 +102,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";WITH_ASSERT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -156,7 +156,7 @@
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
@@ -204,7 +204,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;WITH_ASSERT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -256,7 +256,7 @@
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
@@ -304,7 +304,6 @@
<ClCompile Include="..\src\command.cpp" />
<ClCompile Include="..\src\console.cpp" />
<ClCompile Include="..\src\console_cmds.cpp" />
<ClCompile Include="..\src\cpu.cpp" />
<ClCompile Include="..\src\crashlog.cpp" />
<ClCompile Include="..\src\currency.cpp" />
<ClCompile Include="..\src\date.cpp" />
@@ -355,6 +354,7 @@
<ClCompile Include="..\src\network\network_udp.cpp" />
<ClCompile Include="..\src\openttd.cpp" />
<ClCompile Include="..\src\order_backup.cpp" />
<ClCompile Include="..\src\os_timer.cpp" />
<ClCompile Include="..\src\pbs.cpp" />
<ClCompile Include="..\src\progress.cpp" />
<ClCompile Include="..\src\rail.cpp" />
@@ -385,7 +385,6 @@
<ClCompile Include="..\src\vehicle.cpp" />
<ClCompile Include="..\src\vehiclelist.cpp" />
<ClCompile Include="..\src\viewport.cpp" />
<ClCompile Include="..\src\viewport_sprite_sorter_sse4.cpp" />
<ClCompile Include="..\src\waypoint.cpp" />
<ClCompile Include="..\src\widget.cpp" />
<ClCompile Include="..\src\window.cpp" />
@@ -423,7 +422,6 @@
<ClInclude Include="..\src\console_gui.h" />
<ClInclude Include="..\src\console_internal.h" />
<ClInclude Include="..\src\console_type.h" />
<ClInclude Include="..\src\cpu.h" />
<ClInclude Include="..\src\crashlog.h" />
<ClInclude Include="..\src\currency.h" />
<ClInclude Include="..\src\date_func.h" />
@@ -642,7 +640,6 @@
<ClInclude Include="..\src\vehicle_type.h" />
<ClInclude Include="..\src\vehiclelist.h" />
<ClInclude Include="..\src\viewport_func.h" />
<ClInclude Include="..\src\viewport_sprite_sorter.h" />
<ClInclude Include="..\src\viewport_type.h" />
<ClInclude Include="..\src\water.h" />
<ClInclude Include="..\src\waypoint_base.h" />
@@ -1036,8 +1033,6 @@
<ClInclude Include="..\src\script\api\script_station.hpp" />
<ClInclude Include="..\src\script\api\script_stationlist.hpp" />
<ClInclude Include="..\src\script\api\script_story_page.hpp" />
<ClInclude Include="..\src\script\api\script_storypagelist.hpp" />
<ClInclude Include="..\src\script\api\script_storypageelementlist.hpp" />
<ClInclude Include="..\src\script\api\script_subsidy.hpp" />
<ClInclude Include="..\src\script\api\script_subsidylist.hpp" />
<ClInclude Include="..\src\script\api\script_testmode.hpp" />
@@ -1100,8 +1095,6 @@
<ClCompile Include="..\src\script\api\script_station.cpp" />
<ClCompile Include="..\src\script\api\script_stationlist.cpp" />
<ClCompile Include="..\src\script\api\script_story_page.cpp" />
<ClCompile Include="..\src\script\api\script_storypagelist.cpp" />
<ClCompile Include="..\src\script\api\script_storypageelementlist.cpp" />
<ClCompile Include="..\src\script\api\script_subsidy.cpp" />
<ClCompile Include="..\src\script\api\script_subsidylist.cpp" />
<ClCompile Include="..\src\script\api\script_testmode.cpp" />
@@ -1119,22 +1112,12 @@
<ClCompile Include="..\src\script\api\script_window.cpp" />
<ClCompile Include="..\src\blitter\32bpp_anim.cpp" />
<ClInclude Include="..\src\blitter\32bpp_anim.hpp" />
<ClCompile Include="..\src\blitter\32bpp_anim_sse4.cpp" />
<ClInclude Include="..\src\blitter\32bpp_anim_sse4.hpp" />
<ClCompile Include="..\src\blitter\32bpp_base.cpp" />
<ClInclude Include="..\src\blitter\32bpp_base.hpp" />
<ClCompile Include="..\src\blitter\32bpp_optimized.cpp" />
<ClInclude Include="..\src\blitter\32bpp_optimized.hpp" />
<ClCompile Include="..\src\blitter\32bpp_simple.cpp" />
<ClInclude Include="..\src\blitter\32bpp_simple.hpp" />
<ClInclude Include="..\src\blitter\32bpp_sse_func.hpp" />
<ClInclude Include="..\src\blitter\32bpp_sse_type.h" />
<ClCompile Include="..\src\blitter\32bpp_sse2.cpp" />
<ClInclude Include="..\src\blitter\32bpp_sse2.hpp" />
<ClCompile Include="..\src\blitter\32bpp_sse4.cpp" />
<ClInclude Include="..\src\blitter\32bpp_sse4.hpp" />
<ClCompile Include="..\src\blitter\32bpp_ssse3.cpp" />
<ClInclude Include="..\src\blitter\32bpp_ssse3.hpp" />
<ClCompile Include="..\src\blitter\8bpp_base.cpp" />
<ClInclude Include="..\src\blitter\8bpp_base.hpp" />
<ClCompile Include="..\src\blitter\8bpp_optimized.cpp" />

View File

@@ -141,9 +141,6 @@
<ClCompile Include="..\src\console_cmds.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\cpu.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\crashlog.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -294,6 +291,9 @@
<ClCompile Include="..\src\order_backup.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\os_timer.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\pbs.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -384,9 +384,6 @@
<ClCompile Include="..\src\viewport.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\viewport_sprite_sorter_sse4.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\src\waypoint.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@@ -498,9 +495,6 @@
<ClInclude Include="..\src\console_type.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\cpu.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\crashlog.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -1155,9 +1149,6 @@
<ClInclude Include="..\src\viewport_func.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\viewport_sprite_sorter.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\src\viewport_type.h">
<Filter>Header Files</Filter>
</ClInclude>
@@ -2337,12 +2328,6 @@
<ClInclude Include="..\src\script\api\script_story_page.hpp">
<Filter>Script API</Filter>
</ClInclude>
<ClInclude Include="..\src\script\api\script_storypagelist.hpp">
<Filter>Script API</Filter>
</ClInclude>
<ClInclude Include="..\src\script\api\script_storypageelementlist.hpp">
<Filter>Script API</Filter>
</ClInclude>
<ClInclude Include="..\src\script\api\script_subsidy.hpp">
<Filter>Script API</Filter>
</ClInclude>
@@ -2529,12 +2514,6 @@
<ClCompile Include="..\src\script\api\script_story_page.cpp">
<Filter>Script API Implementation</Filter>
</ClCompile>
<ClCompile Include="..\src\script\api\script_storypagelist.cpp">
<Filter>Script API Implementation</Filter>
</ClCompile>
<ClCompile Include="..\src\script\api\script_storypageelementlist.cpp">
<Filter>Script API Implementation</Filter>
</ClCompile>
<ClCompile Include="..\src\script\api\script_subsidy.cpp">
<Filter>Script API Implementation</Filter>
</ClCompile>
@@ -2586,12 +2565,6 @@
<ClInclude Include="..\src\blitter\32bpp_anim.hpp">
<Filter>Blitters</Filter>
</ClInclude>
<ClCompile Include="..\src\blitter\32bpp_anim_sse4.cpp">
<Filter>Blitters</Filter>
</ClCompile>
<ClInclude Include="..\src\blitter\32bpp_anim_sse4.hpp">
<Filter>Blitters</Filter>
</ClInclude>
<ClCompile Include="..\src\blitter\32bpp_base.cpp">
<Filter>Blitters</Filter>
</ClCompile>
@@ -2610,30 +2583,6 @@
<ClInclude Include="..\src\blitter\32bpp_simple.hpp">
<Filter>Blitters</Filter>
</ClInclude>
<ClInclude Include="..\src\blitter\32bpp_sse_func.hpp">
<Filter>Blitters</Filter>
</ClInclude>
<ClInclude Include="..\src\blitter\32bpp_sse_type.h">
<Filter>Blitters</Filter>
</ClInclude>
<ClCompile Include="..\src\blitter\32bpp_sse2.cpp">
<Filter>Blitters</Filter>
</ClCompile>
<ClInclude Include="..\src\blitter\32bpp_sse2.hpp">
<Filter>Blitters</Filter>
</ClInclude>
<ClCompile Include="..\src\blitter\32bpp_sse4.cpp">
<Filter>Blitters</Filter>
</ClCompile>
<ClInclude Include="..\src\blitter\32bpp_sse4.hpp">
<Filter>Blitters</Filter>
</ClInclude>
<ClCompile Include="..\src\blitter\32bpp_ssse3.cpp">
<Filter>Blitters</Filter>
</ClCompile>
<ClInclude Include="..\src\blitter\32bpp_ssse3.hpp">
<Filter>Blitters</Filter>
</ClInclude>
<ClCompile Include="..\src\blitter\8bpp_base.cpp">
<Filter>Blitters</Filter>
</ClCompile>

View File

@@ -102,7 +102,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";WITH_ASSERT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -156,7 +156,7 @@
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>
@@ -204,7 +204,7 @@
<FavorSizeOrSpeed>Size</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;WITH_ASSERT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<ExceptionHandling>Sync</ExceptionHandling>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
@@ -256,7 +256,7 @@
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR="OpenTTD";_SQ64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>

View File

@@ -52,7 +52,7 @@
FavorSizeOrSpeed="2"
OmitFramePointers="true"
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;WITH_ASSERT"
StringPooling="true"
ExceptionHandling="1"
RuntimeLibrary="0"
@@ -156,7 +156,7 @@
AdditionalOptions="/MP"
Optimization="0"
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
@@ -257,7 +257,7 @@
FavorSizeOrSpeed="2"
OmitFramePointers="true"
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64;WITH_ASSERT"
StringPooling="true"
ExceptionHandling="1"
RuntimeLibrary="0"
@@ -362,7 +362,7 @@
AdditionalOptions="/MP"
Optimization="0"
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
@@ -486,10 +486,6 @@
RelativePath=".\..\src\console_cmds.cpp"
>
</File>
<File
RelativePath=".\..\src\cpu.cpp"
>
</File>
<File
RelativePath=".\..\src\crashlog.cpp"
>
@@ -690,6 +686,10 @@
RelativePath=".\..\src\order_backup.cpp"
>
</File>
<File
RelativePath=".\..\src\os_timer.cpp"
>
</File>
<File
RelativePath=".\..\src\pbs.cpp"
>
@@ -810,10 +810,6 @@
RelativePath=".\..\src\viewport.cpp"
>
</File>
<File
RelativePath=".\..\src\viewport_sprite_sorter_sse4.cpp"
>
</File>
<File
RelativePath=".\..\src\waypoint.cpp"
>
@@ -966,10 +962,6 @@
RelativePath=".\..\src\console_type.h"
>
</File>
<File
RelativePath=".\..\src\cpu.h"
>
</File>
<File
RelativePath=".\..\src\crashlog.h"
>
@@ -1842,10 +1834,6 @@
RelativePath=".\..\src\viewport_func.h"
>
</File>
<File
RelativePath=".\..\src\viewport_sprite_sorter.h"
>
</File>
<File
RelativePath=".\..\src\viewport_type.h"
>
@@ -3478,14 +3466,6 @@
RelativePath=".\..\src\script\api\script_story_page.hpp"
>
</File>
<File
RelativePath=".\..\src\script\api\script_storypagelist.hpp"
>
</File>
<File
RelativePath=".\..\src\script\api\script_storypageelementlist.hpp"
>
</File>
<File
RelativePath=".\..\src\script\api\script_subsidy.hpp"
>
@@ -3738,14 +3718,6 @@
RelativePath=".\..\src\script\api\script_story_page.cpp"
>
</File>
<File
RelativePath=".\..\src\script\api\script_storypagelist.cpp"
>
</File>
<File
RelativePath=".\..\src\script\api\script_storypageelementlist.cpp"
>
</File>
<File
RelativePath=".\..\src\script\api\script_subsidy.cpp"
>
@@ -3818,14 +3790,6 @@
RelativePath=".\..\src\blitter\32bpp_anim.hpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_anim_sse4.cpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_anim_sse4.hpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_base.cpp"
>
@@ -3850,38 +3814,6 @@
RelativePath=".\..\src\blitter\32bpp_simple.hpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_sse_func.hpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_sse_type.h"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_sse2.cpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_sse2.hpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_sse4.cpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_sse4.hpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_ssse3.cpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_ssse3.hpp"
>
</File>
<File
RelativePath=".\..\src\blitter\8bpp_base.cpp"
>

View File

@@ -52,7 +52,7 @@
FavorSizeOrSpeed="2"
OmitFramePointers="true"
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;WITH_ASSERT"
StringPooling="true"
ExceptionHandling="1"
RuntimeLibrary="0"
@@ -156,7 +156,7 @@
AdditionalOptions="/MP"
Optimization="0"
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
@@ -257,7 +257,7 @@
FavorSizeOrSpeed="2"
OmitFramePointers="true"
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64;WITH_ASSERT"
StringPooling="true"
ExceptionHandling="1"
RuntimeLibrary="0"
@@ -362,7 +362,7 @@
AdditionalOptions="/MP"
Optimization="0"
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"

View File

@@ -53,7 +53,7 @@
FavorSizeOrSpeed="2"
OmitFramePointers="true"
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;WITH_ASSERT"
StringPooling="true"
ExceptionHandling="1"
RuntimeLibrary="0"
@@ -155,7 +155,7 @@
AdditionalOptions="/MP"
Optimization="0"
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
@@ -255,7 +255,7 @@
FavorSizeOrSpeed="2"
OmitFramePointers="true"
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64;WITH_ASSERT"
StringPooling="true"
ExceptionHandling="1"
RuntimeLibrary="0"
@@ -359,7 +359,7 @@
AdditionalOptions="/MP"
Optimization="0"
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
@@ -483,10 +483,6 @@
RelativePath=".\..\src\console_cmds.cpp"
>
</File>
<File
RelativePath=".\..\src\cpu.cpp"
>
</File>
<File
RelativePath=".\..\src\crashlog.cpp"
>
@@ -687,6 +683,10 @@
RelativePath=".\..\src\order_backup.cpp"
>
</File>
<File
RelativePath=".\..\src\os_timer.cpp"
>
</File>
<File
RelativePath=".\..\src\pbs.cpp"
>
@@ -807,10 +807,6 @@
RelativePath=".\..\src\viewport.cpp"
>
</File>
<File
RelativePath=".\..\src\viewport_sprite_sorter_sse4.cpp"
>
</File>
<File
RelativePath=".\..\src\waypoint.cpp"
>
@@ -963,10 +959,6 @@
RelativePath=".\..\src\console_type.h"
>
</File>
<File
RelativePath=".\..\src\cpu.h"
>
</File>
<File
RelativePath=".\..\src\crashlog.h"
>
@@ -1839,10 +1831,6 @@
RelativePath=".\..\src\viewport_func.h"
>
</File>
<File
RelativePath=".\..\src\viewport_sprite_sorter.h"
>
</File>
<File
RelativePath=".\..\src\viewport_type.h"
>
@@ -3475,14 +3463,6 @@
RelativePath=".\..\src\script\api\script_story_page.hpp"
>
</File>
<File
RelativePath=".\..\src\script\api\script_storypagelist.hpp"
>
</File>
<File
RelativePath=".\..\src\script\api\script_storypageelementlist.hpp"
>
</File>
<File
RelativePath=".\..\src\script\api\script_subsidy.hpp"
>
@@ -3735,14 +3715,6 @@
RelativePath=".\..\src\script\api\script_story_page.cpp"
>
</File>
<File
RelativePath=".\..\src\script\api\script_storypagelist.cpp"
>
</File>
<File
RelativePath=".\..\src\script\api\script_storypageelementlist.cpp"
>
</File>
<File
RelativePath=".\..\src\script\api\script_subsidy.cpp"
>
@@ -3815,14 +3787,6 @@
RelativePath=".\..\src\blitter\32bpp_anim.hpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_anim_sse4.cpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_anim_sse4.hpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_base.cpp"
>
@@ -3847,38 +3811,6 @@
RelativePath=".\..\src\blitter\32bpp_simple.hpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_sse_func.hpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_sse_type.h"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_sse2.cpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_sse2.hpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_sse4.cpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_sse4.hpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_ssse3.cpp"
>
</File>
<File
RelativePath=".\..\src\blitter\32bpp_ssse3.hpp"
>
</File>
<File
RelativePath=".\..\src\blitter\8bpp_base.cpp"
>

View File

@@ -53,7 +53,7 @@
FavorSizeOrSpeed="2"
OmitFramePointers="true"
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;WITH_ASSERT"
StringPooling="true"
ExceptionHandling="1"
RuntimeLibrary="0"
@@ -155,7 +155,7 @@
AdditionalOptions="/MP"
Optimization="0"
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WIN32_ENABLE_DIRECTMUSIC_SUPPORT;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"
@@ -255,7 +255,7 @@
FavorSizeOrSpeed="2"
OmitFramePointers="true"
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64;WITH_ASSERT"
StringPooling="true"
ExceptionHandling="1"
RuntimeLibrary="0"
@@ -359,7 +359,7 @@
AdditionalOptions="/MP"
Optimization="0"
AdditionalIncludeDirectories="..\objs\langs;..\objs\settings;..\src\3rdparty\squirrel\include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WITH_SSE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;WITH_ZLIB;WITH_LZO;WITH_LZMA;LZMA_API_STATIC;WITH_PNG;WITH_FREETYPE;WITH_ICU;U_STATIC_IMPLEMENTATION;ENABLE_NETWORK;WITH_PERSONAL_DIR;PERSONAL_DIR=\&quot;OpenTTD\&quot;;_SQ64"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
UsePrecompiledHeader="0"

View File

@@ -1,5 +1,5 @@
Last updated: 2014-09-23
Release version: 1.4.3
Last updated: 2013-12-24
Release version: 1.4.0-beta1
------------------------------------------------------------------------
@@ -674,47 +674,46 @@ http://homer.rice.edu/~sandmann/cwsdpmi/csdpmi5s.zip
X.X) Credits
---- -------
The OpenTTD team (in alphabetical order):
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)
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
Inactive Developers:
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)
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
Retired Developers:
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)
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)
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
@@ -723,7 +722,6 @@ Thanks to:
George - Canal graphics
Andrew Parkhouse (andythenorth) - River graphics
David Dallaston (Pikka) - Tram tracks
Fleashosio - Titlegame
All Translators - For their support to make OpenTTD a truly international game
Bug Reporters - Thanks for all bug reports
Chris Sawyer - For an amazing game!

View File

@@ -12,7 +12,6 @@ cheat.cpp
command.cpp
console.cpp
console_cmds.cpp
cpu.cpp
crashlog.cpp
currency.cpp
date.cpp
@@ -63,6 +62,7 @@ network/network_server.cpp
network/network_udp.cpp
openttd.cpp
order_backup.cpp
os_timer.cpp
pbs.cpp
progress.cpp
rail.cpp
@@ -111,9 +111,6 @@ townname.cpp
vehicle.cpp
vehiclelist.cpp
viewport.cpp
#if SSE
viewport_sprite_sorter_sse4.cpp
#end
waypoint.cpp
widget.cpp
window.cpp
@@ -158,7 +155,6 @@ console_func.h
console_gui.h
console_internal.h
console_type.h
cpu.h
crashlog.h
currency.h
date_func.h
@@ -377,7 +373,6 @@ vehicle_gui_base.h
vehicle_type.h
vehiclelist.h
viewport_func.h
viewport_sprite_sorter.h
viewport_type.h
water.h
waypoint_base.h
@@ -816,8 +811,6 @@ script/api/script_signlist.hpp
script/api/script_station.hpp
script/api/script_stationlist.hpp
script/api/script_story_page.hpp
script/api/script_storypagelist.hpp
script/api/script_storypageelementlist.hpp
script/api/script_subsidy.hpp
script/api/script_subsidylist.hpp
script/api/script_testmode.hpp
@@ -882,8 +875,6 @@ script/api/script_signlist.cpp
script/api/script_station.cpp
script/api/script_stationlist.cpp
script/api/script_story_page.cpp
script/api/script_storypagelist.cpp
script/api/script_storypageelementlist.cpp
script/api/script_subsidy.cpp
script/api/script_subsidylist.cpp
script/api/script_testmode.cpp
@@ -905,26 +896,12 @@ script/api/script_window.cpp
#else
blitter/32bpp_anim.cpp
blitter/32bpp_anim.hpp
#if SSE
blitter/32bpp_anim_sse4.cpp
blitter/32bpp_anim_sse4.hpp
#end
blitter/32bpp_base.cpp
blitter/32bpp_base.hpp
blitter/32bpp_optimized.cpp
blitter/32bpp_optimized.hpp
blitter/32bpp_simple.cpp
blitter/32bpp_simple.hpp
#if SSE
blitter/32bpp_sse_func.hpp
blitter/32bpp_sse_type.h
blitter/32bpp_sse2.cpp
blitter/32bpp_sse2.hpp
blitter/32bpp_sse4.cpp
blitter/32bpp_sse4.hpp
blitter/32bpp_ssse3.cpp
blitter/32bpp_ssse3.hpp
#end
blitter/8bpp_base.cpp
blitter/8bpp_base.hpp
blitter/8bpp_optimized.cpp

View File

@@ -66,7 +66,7 @@ public:
static SQChar temp[256];
va_list vl;
va_start(vl, s);
scvsnprintf(temp, sizeof(temp), s, vl);
scvsprintf(temp, s, vl);
va_end(vl);
throw temp;
}

View File

@@ -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 && _game_mode != GM_NORMAL) ShowAIListWindow((CompanyID)this->selected_slot);
if (click_count > 1 && this->selected_slot != INVALID_COMPANY) ShowAIListWindow((CompanyID)this->selected_slot);
break;
}

View File

@@ -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_OTHER, tile);
if (_settings_client.sound.confirm) SndPlayTileFx(SND_1F_SPLAT, tile);
if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
}
@@ -226,27 +226,8 @@ public:
this->SetWidgetLoweredState(WID_AP_BTN_DOHILIGHT, _settings_client.gui.station_show_coverage);
this->OnInvalidateData();
/* 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);
this->vscroll->SetCount(AirportClass::Get(_selected_airport_class)->GetSpecCount());
this->SelectFirstAvailableAirport(true);
}
virtual ~BuildAirportWindow()

View File

@@ -160,7 +160,7 @@ static void TransferCargo(Vehicle *old_veh, Vehicle *new_head, bool part_of_chai
}
/* Update train weight etc., the old vehicle will be sold anyway */
if (part_of_chain && new_head->type == VEH_TRAIN) Train::From(new_head)->ConsistChanged(CCF_LOADUNLOAD);
if (part_of_chain && new_head->type == VEH_TRAIN) Train::From(new_head)->ConsistChanged(true);
}
/**

View File

@@ -276,8 +276,10 @@ public:
}
case WID_RV_INFO_TAB: {
Dimension d = GetStringBoundingBox(STR_REPLACE_NOT_REPLACING);
d = maxdim(d, GetStringBoundingBox(STR_REPLACE_NOT_REPLACING_VEHICLE_SELECTED));
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));
d.width += WD_FRAMETEXT_LEFT + WD_FRAMETEXT_RIGHT;
d.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM;
*size = maxdim(*size, d);
@@ -349,21 +351,20 @@ 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)) {
str = STR_REPLACE_NOT_REPLACING;
SetDParam(0, STR_REPLACE_NOT_REPLACING);
} else {
bool when_old = false;
EngineID e = EngineReplacementForCompany(c, this->sel_engine[0], this->sel_group, &when_old);
str = when_old ? STR_REPLACE_REPLACING_WHEN_OLD : STR_ENGINE_NAME;
SetDParam(0, e);
SetDParam(0, when_old ? STR_REPLACE_REPLACING_WHEN_OLD : STR_ENGINE_NAME);
SetDParam(1, e);
}
} else {
str = STR_REPLACE_NOT_REPLACING_VEHICLE_SELECTED;
SetDParam(0, STR_REPLACE_NOT_REPLACING_VEHICLE_SELECTED);
}
DrawString(r.left + WD_FRAMETEXT_LEFT, r.right - WD_FRAMETEXT_RIGHT, r.top + WD_FRAMERECT_TOP, str, TC_BLACK, SA_HOR_CENTER);
DrawString(r.left + WD_FRAMETEXT_LEFT, r.right - WD_FRAMETEXT_RIGHT, r.top + WD_FRAMERECT_TOP, STR_BLACK_STRING, TC_FROMSTRING, SA_HOR_CENTER);
break;
}

View File

@@ -100,7 +100,7 @@ bool BaseSet<T, Tnum_files, Tsearch_in_tars>::FillSetDetails(IniFile *ini, const
/* Then find the MD5 checksum */
item = md5s->GetItem(filename, false);
if (item == NULL || item->value == NULL) {
if (item == NULL) {
DEBUG(grf, 0, "No MD5 checksum specified for: %s (in %s)", filename, full_filename);
return false;
}

View File

@@ -133,46 +133,6 @@ 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:
@@ -248,7 +208,6 @@ void Blitter_32bppAnim::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomL
case BM_NORMAL: Draw<BM_NORMAL> (bp, zoom); return;
case BM_COLOUR_REMAP: Draw<BM_COLOUR_REMAP>(bp, zoom); return;
case BM_TRANSPARENT: Draw<BM_TRANSPARENT> (bp, zoom); return;
case BM_CRASH_REMAP: Draw<BM_CRASH_REMAP> (bp, zoom); return;
}
}
@@ -480,7 +439,7 @@ void Blitter_32bppAnim::PaletteAnimate(const Palette &palette)
}
/* Make sure the backend redraws the whole screen */
VideoDriver::GetInstance()->MakeDirty(0, 0, _screen.width, _screen.height);
_video_driver->MakeDirty(0, 0, _screen.width, _screen.height);
}
Blitter::PaletteAnimation Blitter_32bppAnim::UsePaletteAnimation()

View File

@@ -15,8 +15,8 @@
#include "32bpp_optimized.hpp"
/** The optimised 32 bpp blitter with palette animation. */
class Blitter_32bppAnim : public Blitter_32bppOptimized {
protected:
class Blitter_32bppAnim FINAL : public Blitter_32bppOptimized {
private:
uint16 *anim_buf; ///< In this buffer we keep track of the 8bpp indexes so we can do palette animation
int anim_buf_width; ///< The width of the animation buffer.
int anim_buf_height; ///< The height of the animation buffer.
@@ -56,9 +56,10 @@ public:
};
/** Factory for the 32bpp blitter with animation. */
class FBlitter_32bppAnim : public BlitterFactory {
class FBlitter_32bppAnim : public BlitterFactory<FBlitter_32bppAnim> {
public:
FBlitter_32bppAnim() : BlitterFactory("32bpp-anim", "32bpp Animation Blitter (palette animation)") {}
/* virtual */ const char *GetName() { return "32bpp-anim"; }
/* virtual */ const char *GetDescription() { return "32bpp Animation Blitter (palette animation)"; }
/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppAnim(); }
};

View File

@@ -1,399 +0,0 @@
/* $Id$ */
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file 32bpp_sse4_anim.cpp Implementation of the SSE4 32 bpp blitter with animation support. */
#ifdef WITH_SSE
#include "../stdafx.h"
#include "../video/video_driver.hpp"
#include "../table/sprites.h"
#include "32bpp_anim_sse4.hpp"
#include "32bpp_sse_func.hpp"
/** Instantiation of the SSE4 32bpp blitter factory. */
static FBlitter_32bppSSE4_Anim iFBlitter_32bppSSE4_Anim;
/**
* Draws a sprite to a (screen) buffer. It is templated to allow faster operation.
*
* @tparam mode blitter mode
* @param bp further blitting parameters
* @param zoom zoom level at which we are drawing
*/
IGNORE_UNINITIALIZED_WARNING_START
template <BlitterMode mode, Blitter_32bppSSE2::ReadMode read_mode, Blitter_32bppSSE2::BlockType bt_last, bool translucent, bool animated>
inline void Blitter_32bppSSE4_Anim::Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom)
{
const byte * const remap = bp->remap;
Colour *dst_line = (Colour *) bp->dst + bp->top * bp->pitch + bp->left;
uint16 *anim_line = this->anim_buf + ((uint32 *)bp->dst - (uint32 *)_screen.dst_ptr) + bp->top * this->anim_buf_width + bp->left;
int effective_width = bp->width;
/* Find where to start reading in the source sprite. */
const Blitter_32bppSSE_Base::SpriteData * const sd = (const Blitter_32bppSSE_Base::SpriteData *) bp->sprite;
const SpriteInfo * const si = &sd->infos[zoom];
const MapValue *src_mv_line = (const MapValue *) &sd->data[si->mv_offset] + bp->skip_top * si->sprite_width;
const Colour *src_rgba_line = (const Colour *) ((const byte *) &sd->data[si->sprite_offset] + bp->skip_top * si->sprite_line_size);
if (read_mode != RM_WITH_MARGIN) {
src_rgba_line += bp->skip_left;
src_mv_line += bp->skip_left;
}
const MapValue *src_mv = src_mv_line;
/* Load these variables into register before loop. */
const __m128i a_cm = ALPHA_CONTROL_MASK;
const __m128i pack_low_cm = PACK_LOW_CONTROL_MASK;
const __m128i tr_nom_base = TRANSPARENT_NOM_BASE;
for (int y = bp->height; y != 0; y--) {
Colour *dst = dst_line;
const Colour *src = src_rgba_line + META_LENGTH;
if (mode != BM_TRANSPARENT) src_mv = src_mv_line;
uint16 *anim = anim_line;
if (read_mode == RM_WITH_MARGIN) {
assert(bt_last == BT_NONE); // or you must ensure block type is preserved
anim += src_rgba_line[0].data;
src += src_rgba_line[0].data;
dst += src_rgba_line[0].data;
if (mode != BM_TRANSPARENT) 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;
const int new_width = effective_width - delta_diff;
effective_width = delta_diff > 0 ? new_width : effective_width;
if (effective_width <= 0) goto next_line;
}
switch (mode) {
default:
if (!translucent) {
for (uint x = (uint) effective_width; x > 0; x--) {
if (src->a) {
if (animated) {
*anim = *(const uint16*) src_mv;
*dst = (src_mv->m >= PALETTE_ANIM_START) ? AdjustBrightneSSE(this->LookupColourInPalette(src_mv->m), src_mv->v) : src->data;
} else {
*anim = 0;
*dst = *src;
}
}
if (animated) src_mv++;
anim++;
src++;
dst++;
}
break;
}
for (uint x = (uint) effective_width/2; x != 0; x--) {
uint32 mvX2 = *((uint32 *) const_cast<MapValue *>(src_mv));
__m128i srcABCD = _mm_loadl_epi64((const __m128i*) src);
__m128i dstABCD = _mm_loadl_epi64((__m128i*) dst);
if (animated) {
/* Remap colours. */
const byte m0 = mvX2;
if (m0 >= PALETTE_ANIM_START) {
const Colour c0 = (this->LookupColourInPalette(m0).data & 0x00FFFFFF) | (src[0].data & 0xFF000000);
InsertFirstUint32(AdjustBrightneSSE(c0, (byte) (mvX2 >> 8)).data, srcABCD);
}
const byte m1 = mvX2 >> 16;
if (m1 >= PALETTE_ANIM_START) {
const Colour c1 = (this->LookupColourInPalette(m1).data & 0x00FFFFFF) | (src[1].data & 0xFF000000);
InsertSecondUint32(AdjustBrightneSSE(c1, (byte) (mvX2 >> 24)).data, srcABCD);
}
/* Update anim buffer. */
const byte a0 = src[0].a;
const byte a1 = src[1].a;
uint32 anim01 = 0;
if (a0 == 255) {
if (a1 == 255) {
*(uint32*) anim = mvX2;
goto bmno_full_opacity;
}
anim01 = (uint16) mvX2;
} else if (a0 == 0) {
if (a1 == 0) {
goto bmno_full_transparency;
} else {
if (a1 == 255) anim[1] = (uint16) (mvX2 >> 16);
goto bmno_alpha_blend;
}
}
if (a1 > 0) {
if (a1 == 255) anim01 |= mvX2 & 0xFFFF0000;
*(uint32*) anim = anim01;
} else {
anim[0] = (uint16) anim01;
}
} else {
if (src[0].a) anim[0] = 0;
if (src[1].a) anim[1] = 0;
}
/* Blend colours. */
bmno_alpha_blend:
srcABCD = AlphaBlendTwoPixels(srcABCD, dstABCD, a_cm, pack_low_cm);
bmno_full_opacity:
_mm_storel_epi64((__m128i *) dst, srcABCD);
bmno_full_transparency:
src_mv += 2;
src += 2;
anim += 2;
dst += 2;
}
if ((bt_last == BT_NONE && effective_width & 1) || bt_last == BT_ODD) {
if (src->a == 0) {
} else if (src->a == 255) {
*anim = *(const uint16*) src_mv;
*dst = (src_mv->m >= PALETTE_ANIM_START) ? AdjustBrightneSSE(LookupColourInPalette(src_mv->m), src_mv->v) : *src;
} else {
*anim = 0;
__m128i srcABCD;
__m128i dstABCD = _mm_cvtsi32_si128(dst->data);
if (src_mv->m >= PALETTE_ANIM_START) {
Colour colour = AdjustBrightneSSE(LookupColourInPalette(src_mv->m), src_mv->v);
colour.a = src->a;
srcABCD = _mm_cvtsi32_si128(colour.data);
} else {
srcABCD = _mm_cvtsi32_si128(src->data);
}
dst->data = _mm_cvtsi128_si32(AlphaBlendTwoPixels(srcABCD, dstABCD, a_cm, pack_low_cm));
}
}
break;
case BM_COLOUR_REMAP:
for (uint x = (uint) effective_width / 2; x != 0; x--) {
uint32 mvX2 = *((uint32 *) const_cast<MapValue *>(src_mv));
__m128i srcABCD = _mm_loadl_epi64((const __m128i*) src);
__m128i dstABCD = _mm_loadl_epi64((__m128i*) dst);
/* Remap colours. */
const uint m0 = (byte) mvX2;
const uint r0 = remap[m0];
const uint m1 = (byte) (mvX2 >> 16);
const uint r1 = remap[m1];
if (mvX2 & 0x00FF00FF) {
#define CMOV_REMAP(m_colour, m_colour_init, m_src, m_m) \
/* Written so the compiler uses CMOV. */ \
Colour m_colour = m_colour_init; \
{ \
const Colour srcm = (Colour) (m_src); \
const uint m = (byte) (m_m); \
const uint r = remap[m]; \
const Colour cmap = (this->LookupColourInPalette(r).data & 0x00FFFFFF) | (srcm.data & 0xFF000000); \
m_colour = r == 0 ? m_colour : cmap; \
m_colour = m != 0 ? m_colour : srcm; \
}
#ifdef _SQ64
uint64 srcs = _mm_cvtsi128_si64(srcABCD);
uint64 dsts;
if (animated) dsts = _mm_cvtsi128_si64(dstABCD);
uint64 remapped_src = 0;
CMOV_REMAP(c0, animated ? dsts : 0, srcs, mvX2);
remapped_src = c0.data;
CMOV_REMAP(c1, animated ? dsts >> 32 : 0, srcs >> 32, mvX2 >> 16);
remapped_src |= (uint64) c1.data << 32;
srcABCD = _mm_cvtsi64_si128(remapped_src);
#else
Colour remapped_src[2];
CMOV_REMAP(c0, animated ? _mm_cvtsi128_si32(dstABCD) : 0, _mm_cvtsi128_si32(srcABCD), mvX2);
remapped_src[0] = c0.data;
CMOV_REMAP(c1, animated ? dst[1] : 0, src[1], mvX2 >> 16);
remapped_src[1] = c1.data;
srcABCD = _mm_loadl_epi64((__m128i*) &remapped_src);
#endif
if ((mvX2 & 0xFF00FF00) != 0x80008000) srcABCD = AdjustBrightnessOfTwoPixels(srcABCD, mvX2);
}
/* Update anim buffer. */
if (animated) {
const byte a0 = src[0].a;
const byte a1 = src[1].a;
uint32 anim01 = mvX2 & 0xFF00FF00;
if (a0 == 255) {
anim01 |= r0;
if (a1 == 255) {
*(uint32*) anim = anim01 | (r1 << 16);
goto bmcr_full_opacity;
}
} else if (a0 == 0) {
if (a1 == 0) {
goto bmcr_full_transparency;
} else {
if (a1 == 255) {
anim[1] = r1 | (anim01 >> 16);
}
goto bmcr_alpha_blend;
}
}
if (a1 > 0) {
if (a1 == 255) anim01 |= r1 << 16;
*(uint32*) anim = anim01;
} else {
anim[0] = (uint16) anim01;
}
} else {
if (src[0].a) anim[0] = 0;
if (src[1].a) anim[1] = 0;
}
/* Blend colours. */
bmcr_alpha_blend:
srcABCD = AlphaBlendTwoPixels(srcABCD, dstABCD, a_cm, pack_low_cm);
bmcr_full_opacity:
_mm_storel_epi64((__m128i *) dst, srcABCD);
bmcr_full_transparency:
src_mv += 2;
dst += 2;
src += 2;
anim += 2;
}
if ((bt_last == BT_NONE && effective_width & 1) || bt_last == BT_ODD) {
/* In case the m-channel is zero, do not remap this pixel in any way. */
__m128i srcABCD;
if (src->a == 0) break;
if (src_mv->m) {
const uint r = remap[src_mv->m];
*anim = (animated && src->a == 255) ? r | ((uint16) src_mv->v << 8 ) : 0;
if (r != 0) {
Colour remapped_colour = AdjustBrightneSSE(this->LookupColourInPalette(r), src_mv->v);
if (src->a == 255) {
*dst = remapped_colour;
} else {
remapped_colour.a = src->a;
srcABCD = _mm_cvtsi32_si128(remapped_colour.data);
goto bmcr_alpha_blend_single;
}
}
} else {
*anim = 0;
srcABCD = _mm_cvtsi32_si128(src->data);
if (src->a < 255) {
bmcr_alpha_blend_single:
__m128i dstABCD = _mm_cvtsi32_si128(dst->data);
srcABCD = AlphaBlendTwoPixels(srcABCD, dstABCD, a_cm, pack_low_cm);
}
dst->data = _mm_cvtsi128_si32(srcABCD);
}
}
break;
case BM_TRANSPARENT:
/* Make the current colour a bit more black, so it looks like this image is transparent. */
for (uint x = (uint) bp->width / 2; x > 0; x--) {
__m128i srcABCD = _mm_loadl_epi64((const __m128i*) src);
__m128i dstABCD = _mm_loadl_epi64((__m128i*) dst);
_mm_storel_epi64((__m128i *) dst, DarkenTwoPixels(srcABCD, dstABCD, a_cm, tr_nom_base));
src += 2;
dst += 2;
anim += 2;
if (src[-2].a) anim[-2] = 0;
if (src[-1].a) anim[-1] = 0;
}
if ((bt_last == BT_NONE && bp->width & 1) || bt_last == BT_ODD) {
__m128i srcABCD = _mm_cvtsi32_si128(src->data);
__m128i dstABCD = _mm_cvtsi32_si128(dst->data);
dst->data = _mm_cvtsi128_si32(DarkenTwoPixels(srcABCD, dstABCD, a_cm, tr_nom_base));
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:
if (mode != BM_TRANSPARENT) src_mv_line += si->sprite_width;
src_rgba_line = (const Colour*) ((const byte*) src_rgba_line + si->sprite_line_size);
dst_line += bp->pitch;
anim_line += this->anim_buf_width;
}
}
IGNORE_UNINITIALIZED_WARNING_STOP
/**
* Draws a sprite to a (screen) buffer. Calls adequate templated function.
*
* @param bp further blitting parameters
* @param mode blitter mode
* @param zoom zoom level at which we are drawing
*/
void Blitter_32bppSSE4_Anim::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
{
const Blitter_32bppSSE_Base::SpriteFlags sprite_flags = ((const Blitter_32bppSSE_Base::SpriteData *) bp->sprite)->flags;
switch (mode) {
default: {
bm_normal:
if (bp->skip_left != 0 || bp->width <= MARGIN_NORMAL_THRESHOLD) {
const BlockType bt_last = (BlockType) (bp->width & 1);
if (bt_last == BT_EVEN) {
if (sprite_flags & SF_NO_ANIM) Draw<BM_NORMAL, RM_WITH_SKIP, BT_EVEN, true, false>(bp, zoom);
else Draw<BM_NORMAL, RM_WITH_SKIP, BT_EVEN, true, true>(bp, zoom);
} else {
if (sprite_flags & SF_NO_ANIM) Draw<BM_NORMAL, RM_WITH_SKIP, BT_ODD, true, false>(bp, zoom);
else Draw<BM_NORMAL, RM_WITH_SKIP, BT_ODD, true, true>(bp, zoom);
}
} else {
#ifdef _SQ64
if (sprite_flags & SF_TRANSLUCENT) {
if (sprite_flags & SF_NO_ANIM) Draw<BM_NORMAL, RM_WITH_MARGIN, BT_NONE, true, false>(bp, zoom);
else Draw<BM_NORMAL, RM_WITH_MARGIN, BT_NONE, true, true>(bp, zoom);
} else {
if (sprite_flags & SF_NO_ANIM) Draw<BM_NORMAL, RM_WITH_MARGIN, BT_NONE, false, false>(bp, zoom);
else Draw<BM_NORMAL, RM_WITH_MARGIN, BT_NONE, false, true>(bp, zoom);
}
#else
if (sprite_flags & SF_NO_ANIM) Draw<BM_NORMAL, RM_WITH_MARGIN, BT_NONE, true, false>(bp, zoom);
else Draw<BM_NORMAL, RM_WITH_MARGIN, BT_NONE, true, true>(bp, zoom);
#endif
}
break;
}
case BM_COLOUR_REMAP:
if (sprite_flags & SF_NO_REMAP) goto bm_normal;
if (bp->skip_left != 0 || bp->width <= MARGIN_REMAP_THRESHOLD) {
if (sprite_flags & SF_NO_ANIM) Draw<BM_COLOUR_REMAP, RM_WITH_SKIP, BT_NONE, true, false>(bp, zoom);
else Draw<BM_COLOUR_REMAP, RM_WITH_SKIP, BT_NONE, true, true>(bp, zoom);
} else {
if (sprite_flags & SF_NO_ANIM) Draw<BM_COLOUR_REMAP, RM_WITH_MARGIN, BT_NONE, true, false>(bp, zoom);
else Draw<BM_COLOUR_REMAP, RM_WITH_MARGIN, BT_NONE, true, true>(bp, zoom);
}
break;
case BM_TRANSPARENT: Draw<BM_TRANSPARENT, RM_NONE, BT_NONE, true, true>(bp, zoom); return;
case BM_CRASH_REMAP: Draw<BM_CRASH_REMAP, RM_NONE, BT_NONE, true, true>(bp, zoom); return;
}
}
#endif /* WITH_SSE */

View File

@@ -1,53 +0,0 @@
/* $Id$ */
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file 32bpp_sse4_anim.hpp A SSE4 32 bpp blitter with animation support. */
#ifndef BLITTER_32BPP_SSE4_ANIM_HPP
#define BLITTER_32BPP_SSE4_ANIM_HPP
#ifdef WITH_SSE
#ifndef SSE_VERSION
#define SSE_VERSION 4
#endif
#ifndef FULL_ANIMATION
#define FULL_ANIMATION 1
#endif
#include "32bpp_anim.hpp"
#include "32bpp_sse4.hpp"
#undef MARGIN_NORMAL_THRESHOLD
#define MARGIN_NORMAL_THRESHOLD 4
/** The SSE4 32 bpp blitter with palette animation. */
class Blitter_32bppSSE4_Anim FINAL : public Blitter_32bppAnim, public Blitter_32bppSSE_Base {
private:
public:
template <BlitterMode mode, Blitter_32bppSSE_Base::ReadMode read_mode, Blitter_32bppSSE_Base::BlockType bt_last, bool translucent, bool animated>
/* virtual */ void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
/* virtual */ Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) {
return Blitter_32bppSSE_Base::Encode(sprite, allocator);
}
/* virtual */ const char *GetName() { return "32bpp-sse4-anim"; }
};
/** Factory for the SSE4 32 bpp blitter (with palette animation). */
class FBlitter_32bppSSE4_Anim: public BlitterFactory {
public:
FBlitter_32bppSSE4_Anim() : BlitterFactory("32bpp-sse4-anim", "SSE4 Blitter (palette animation)", HasCPUIDFlag(1, 2, 19)) {}
/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppSSE4_Anim(); }
};
#endif /* WITH_SSE */
#endif /* BLITTER_32BPP_SSE4_ANIM_HPP */

View File

@@ -112,19 +112,6 @@ 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.

View File

@@ -141,40 +141,6 @@ 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:
@@ -238,7 +204,6 @@ void Blitter_32bppOptimized::Draw(Blitter::BlitterParams *bp, BlitterMode mode,
case BM_NORMAL: Draw<BM_NORMAL> (bp, zoom); return;
case BM_COLOUR_REMAP: Draw<BM_COLOUR_REMAP>(bp, zoom); return;
case BM_TRANSPARENT: Draw<BM_TRANSPARENT> (bp, zoom); return;
case BM_CRASH_REMAP: Draw<BM_CRASH_REMAP> (bp, zoom); return;
}
}

View File

@@ -32,9 +32,10 @@ public:
};
/** Factory for the optimised 32 bpp blitter (without palette animation). */
class FBlitter_32bppOptimized : public BlitterFactory {
class FBlitter_32bppOptimized : public BlitterFactory<FBlitter_32bppOptimized> {
public:
FBlitter_32bppOptimized() : BlitterFactory("32bpp-optimized", "32bpp Optimized Blitter (no palette animation)") {}
/* virtual */ const char *GetName() { return "32bpp-optimized"; }
/* virtual */ const char *GetDescription() { return "32bpp Optimized Blitter (no palette animation)"; }
/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppOptimized(); }
};

View File

@@ -45,17 +45,6 @@ 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:

View File

@@ -34,9 +34,10 @@ public:
};
/** Factory for the simple 32 bpp blitter. */
class FBlitter_32bppSimple : public BlitterFactory {
class FBlitter_32bppSimple : public BlitterFactory<FBlitter_32bppSimple> {
public:
FBlitter_32bppSimple() : BlitterFactory("32bpp-simple", "32bpp Simple Blitter (no palette animation)") {}
/* virtual */ const char *GetName() { return "32bpp-simple"; }
/* virtual */ const char *GetDescription() { return "32bpp Simple Blitter (no palette animation)"; }
/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppSimple(); }
};

View File

@@ -1,141 +0,0 @@
/* $Id$ */
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file 32bpp_sse2.cpp Implementation of the SSE2 32 bpp blitter. */
#ifdef WITH_SSE
#include "../stdafx.h"
#include "../zoom_func.h"
#include "../settings_type.h"
#include "32bpp_sse2.hpp"
#include "32bpp_sse_func.hpp"
/** Instantiation of the SSE2 32bpp blitter factory. */
static FBlitter_32bppSSE2 iFBlitter_32bppSSE2;
Sprite *Blitter_32bppSSE_Base::Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator)
{
/* First uint32 of a line = the number of transparent pixels from the left.
* Second uint32 of a line = the number of transparent pixels from the right.
* Then all RGBA then all MV.
*/
ZoomLevel zoom_min = ZOOM_LVL_NORMAL;
ZoomLevel zoom_max = ZOOM_LVL_NORMAL;
if (sprite->type != ST_FONT) {
zoom_min = _settings_client.gui.zoom_min;
zoom_max = _settings_client.gui.zoom_max;
if (zoom_max == zoom_min) zoom_max = ZOOM_LVL_MAX;
}
/* 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];
sd.infos[z].sprite_width = src_sprite->width;
sd.infos[z].sprite_offset = all_sprites_size;
sd.infos[z].sprite_line_size = sizeof(Colour) * src_sprite->width + sizeof(uint32) * META_LENGTH;
const uint rgba_size = sd.infos[z].sprite_line_size * src_sprite->height;
sd.infos[z].mv_offset = all_sprites_size + rgba_size;
const uint mv_size = sizeof(MapValue) * src_sprite->width * src_sprite->height;
all_sprites_size += rgba_size + mv_size;
}
Sprite *dst_sprite = (Sprite *) allocator(sizeof(Sprite) + sizeof(SpriteData) + all_sprites_size);
dst_sprite->height = sprite->height;
dst_sprite->width = sprite->width;
dst_sprite->x_offs = sprite->x_offs;
dst_sprite->y_offs = sprite->y_offs;
memcpy(dst_sprite->data, &sd, sizeof(SpriteData));
/* Copy colours and determine flags. */
bool has_remap = false;
bool has_anim = false;
bool has_translucency = false;
for (ZoomLevel z = zoom_min; z <= zoom_max; z++) {
const SpriteLoader::Sprite *src_sprite = &sprite[z];
const SpriteLoader::CommonPixel *src = (const SpriteLoader::CommonPixel *) src_sprite->data;
Colour *dst_rgba_line = (Colour *) &dst_sprite->data[sizeof(SpriteData) + sd.infos[z].sprite_offset];
MapValue *dst_mv = (MapValue *) &dst_sprite->data[sizeof(SpriteData) + sd.infos[z].mv_offset];
for (uint y = src_sprite->height; y != 0; y--) {
Colour *dst_rgba = dst_rgba_line + META_LENGTH;
for (uint x = src_sprite->width; x != 0; x--) {
if (src->a != 0) {
dst_rgba->a = src->a;
if (src->a != 0 && src->a != 255) has_translucency = true;
dst_mv->m = src->m;
if (src->m != 0) {
/* Do some accounting for flags. */
has_remap = true;
if (src->m >= PALETTE_ANIM_START) has_anim = true;
/* Get brightest value (or default brightness if it's a black pixel). */
const uint8 rgb_max = max(src->r, max(src->g, src->b));
dst_mv->v = (rgb_max == 0) ? Blitter_32bppBase::DEFAULT_BRIGHTNESS : rgb_max;
/* Pre-convert the mapping channel to a RGB value. */
const Colour colour = AdjustBrightneSSE(Blitter_32bppBase::LookupColourInPalette(src->m), dst_mv->v);
dst_rgba->r = colour.r;
dst_rgba->g = colour.g;
dst_rgba->b = colour.b;
} else {
dst_rgba->r = src->r;
dst_rgba->g = src->g;
dst_rgba->b = src->b;
dst_mv->v = Blitter_32bppBase::DEFAULT_BRIGHTNESS;
}
} else {
dst_rgba->data = 0;
*(uint16*) dst_mv = 0;
}
dst_rgba++;
dst_mv++;
src++;
}
/* Count the number of transparent pixels from the left. */
dst_rgba = dst_rgba_line + META_LENGTH;
uint32 nb_pix_transp = 0;
for (uint x = src_sprite->width; x != 0; x--) {
if (dst_rgba->a == 0) nb_pix_transp++;
else break;
dst_rgba++;
}
(*dst_rgba_line).data = nb_pix_transp;
Colour *nb_right = dst_rgba_line + 1;
dst_rgba_line = (Colour*) ((byte*) dst_rgba_line + sd.infos[z].sprite_line_size);
/* Count the number of transparent pixels from the right. */
dst_rgba = dst_rgba_line - 1;
nb_pix_transp = 0;
for (uint x = src_sprite->width; x != 0; x--) {
if (dst_rgba->a == 0) nb_pix_transp++;
else break;
dst_rgba--;
}
(*nb_right).data = nb_pix_transp;
}
}
/* Store sprite flags. */
sd.flags = SF_NONE;
if (has_translucency) sd.flags |= SF_TRANSLUCENT;
if (!has_remap) sd.flags |= SF_NO_REMAP;
if (!has_anim) sd.flags |= SF_NO_ANIM;
memcpy(dst_sprite->data, &sd, sizeof(SpriteData));
return dst_sprite;
}
#endif /* WITH_SSE */

View File

@@ -1,104 +0,0 @@
/* $Id$ */
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file 32bpp_sse2.hpp SSE2 32 bpp blitter. */
#ifndef BLITTER_32BPP_SSE2_HPP
#define BLITTER_32BPP_SSE2_HPP
#ifdef WITH_SSE
#ifndef SSE_VERSION
#define SSE_VERSION 2
#endif
#ifndef FULL_ANIMATION
#define FULL_ANIMATION 0
#endif
#include "32bpp_sse_type.h"
/** Base methods for 32bpp SSE blitters. */
class Blitter_32bppSSE_Base {
public:
virtual ~Blitter_32bppSSE_Base() {}
struct MapValue {
uint8 m;
uint8 v;
};
assert_compile(sizeof(MapValue) == 2);
/** Helper for creating specialised functions for specific optimisations. */
enum ReadMode {
RM_WITH_SKIP, ///< Use normal code for skipping empty pixels.
RM_WITH_MARGIN, ///< Use cached number of empty pixels at begin and end of line to reduce work.
RM_NONE, ///< No specialisation.
};
/** Helper for creating specialised functions for the case where the sprite width is odd or even. */
enum BlockType {
BT_EVEN, ///< An even number of pixels in the width; no need for a special case for the last pixel.
BT_ODD, ///< An odd number of pixels in the width; special case for the last pixel.
BT_NONE, ///< No specialisation for either case.
};
/** Helper for using specialised functions designed to prevent whenever it's possible things like:
* - IO (reading video buffer),
* - calculations (alpha blending),
* - heavy branching (remap lookups and animation buffer handling).
*/
enum SpriteFlags {
SF_NONE = 0,
SF_TRANSLUCENT = 1 << 1, ///< The sprite has at least 1 translucent pixel.
SF_NO_REMAP = 1 << 2, ///< The sprite has no remappable colour pixel.
SF_NO_ANIM = 1 << 3, ///< The sprite has no palette animated pixel.
};
/** Data stored about a (single) sprite. */
struct SpriteInfo {
uint32 sprite_offset; ///< The offset to the sprite data.
uint32 mv_offset; ///< The offset to the map value data.
uint16 sprite_line_size; ///< The size of a single line (pitch).
uint16 sprite_width; ///< The width of the sprite.
};
struct SpriteData {
SpriteFlags flags;
SpriteInfo infos[ZOOM_LVL_COUNT];
byte data[]; ///< Data, all zoomlevels.
};
Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator);
};
DECLARE_ENUM_AS_BIT_SET(Blitter_32bppSSE_Base::SpriteFlags);
/** The SSE2 32 bpp blitter (without palette animation). */
class Blitter_32bppSSE2 : public Blitter_32bppSimple, public Blitter_32bppSSE_Base {
public:
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
template <BlitterMode mode, Blitter_32bppSSE_Base::ReadMode read_mode, Blitter_32bppSSE_Base::BlockType bt_last, bool translucent>
void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);
/* virtual */ Sprite *Encode(const SpriteLoader::Sprite *sprite, AllocatorProc *allocator) {
return Blitter_32bppSSE_Base::Encode(sprite, allocator);
}
/* virtual */ const char *GetName() { return "32bpp-sse2"; }
};
/** Factory for the SSE2 32 bpp blitter (without palette animation). */
class FBlitter_32bppSSE2 : public BlitterFactory {
public:
FBlitter_32bppSSE2() : BlitterFactory("32bpp-sse2", "32bpp SSE2 Blitter (no palette animation)", HasCPUIDFlag(1, 3, 26)) {}
/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppSSE2(); }
};
#endif /* WITH_SSE */
#endif /* BLITTER_32BPP_SSE2_HPP */

View File

@@ -1,23 +0,0 @@
/* $Id$ */
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file 32bpp_sse4.cpp Implementation of the SSE4 32 bpp blitter. */
#ifdef WITH_SSE
#include "../stdafx.h"
#include "../zoom_func.h"
#include "../settings_type.h"
#include "32bpp_sse4.hpp"
#include "32bpp_sse_func.hpp"
/** Instantiation of the SSE4 32bpp blitter factory. */
static FBlitter_32bppSSE4 iFBlitter_32bppSSE4;
#endif /* WITH_SSE */

View File

@@ -1,44 +0,0 @@
/* $Id$ */
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file 32bpp_sse4.hpp SSE4 32 bpp blitter. */
#ifndef BLITTER_32BPP_SSE4_HPP
#define BLITTER_32BPP_SSE4_HPP
#ifdef WITH_SSE
#ifndef SSE_VERSION
#define SSE_VERSION 4
#endif
#ifndef FULL_ANIMATION
#define FULL_ANIMATION 0
#endif
#include "32bpp_ssse3.hpp"
/** The SSE4 32 bpp blitter (without palette animation). */
class Blitter_32bppSSE4 : public Blitter_32bppSSSE3 {
public:
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
template <BlitterMode mode, Blitter_32bppSSE_Base::ReadMode read_mode, Blitter_32bppSSE_Base::BlockType bt_last, bool translucent>
void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);
/* virtual */ const char *GetName() { return "32bpp-sse4"; }
};
/** Factory for the SSE4 32 bpp blitter (without palette animation). */
class FBlitter_32bppSSE4: public BlitterFactory {
public:
FBlitter_32bppSSE4() : BlitterFactory("32bpp-sse4", "32bpp SSE4 Blitter (no palette animation)", HasCPUIDFlag(1, 2, 19)) {}
/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppSSE4(); }
};
#endif /* WITH_SSE */
#endif /* BLITTER_32BPP_SSE4_HPP */

View File

@@ -1,455 +0,0 @@
/* $Id$ */
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file 32bpp_sse_func.hpp Functions related to SSE 32 bpp blitter. */
#ifndef BLITTER_32BPP_SSE_FUNC_HPP
#define BLITTER_32BPP_SSE_FUNC_HPP
#ifdef WITH_SSE
static inline void InsertFirstUint32(const uint32 value, __m128i &into)
{
#if (SSE_VERSION >= 4)
into = _mm_insert_epi32(into, value, 0);
#else
into = _mm_insert_epi16(into, value, 0);
into = _mm_insert_epi16(into, value >> 16, 1);
#endif
}
static inline void InsertSecondUint32(const uint32 value, __m128i &into)
{
#if (SSE_VERSION >= 4)
into = _mm_insert_epi32(into, value, 1);
#else
into = _mm_insert_epi16(into, value, 2);
into = _mm_insert_epi16(into, value >> 16, 3);
#endif
}
static inline void LoadUint64(const uint64 value, __m128i &into)
{
#ifdef _SQ64
into = _mm_cvtsi64_si128(value);
#else
#if (SSE_VERSION >= 4)
into = _mm_cvtsi32_si128(value);
InsertSecondUint32(value >> 32, into);
#else
(*(um128i*) &into).m128i_u64[0] = value;
#endif
#endif
}
static inline __m128i PackUnsaturated(__m128i from, const __m128i &mask)
{
#if (SSE_VERSION == 2)
from = _mm_and_si128(from, mask); // PAND, wipe high bytes to keep low bytes when packing
return _mm_packus_epi16(from, from); // PACKUSWB, pack 2 colours (with saturation)
#else
return _mm_shuffle_epi8(from, mask);
#endif
}
static inline __m128i DistributeAlpha(const __m128i from, const __m128i &mask)
{
#if (SSE_VERSION == 2)
__m128i alphaAB = _mm_shufflelo_epi16(from, 0x3F); // PSHUFLW, put alpha1 in front of each rgb1
return _mm_shufflehi_epi16(alphaAB, 0x3F); // PSHUFHW, put alpha2 in front of each rgb2
#else
return _mm_shuffle_epi8(from, mask);
#endif
}
static inline __m128i AlphaBlendTwoPixels(__m128i src, __m128i dst, const __m128i &distribution_mask, const __m128i &pack_mask)
{
__m128i srcAB = _mm_unpacklo_epi8(src, _mm_setzero_si128()); // PUNPCKLBW, expand each uint8 into uint16
__m128i dstAB = _mm_unpacklo_epi8(dst, _mm_setzero_si128());
__m128i alphaAB = _mm_cmpgt_epi16(srcAB, _mm_setzero_si128()); // PCMPGTW, if (alpha > 0) a++;
alphaAB = _mm_srli_epi16(alphaAB, 15);
alphaAB = _mm_add_epi16(alphaAB, srcAB);
alphaAB = DistributeAlpha(alphaAB, distribution_mask);
srcAB = _mm_sub_epi16(srcAB, dstAB); // PSUBW, (r - Cr)
srcAB = _mm_mullo_epi16(srcAB, alphaAB); // PMULLW, a*(r - Cr)
srcAB = _mm_srli_epi16(srcAB, 8); // PSRLW, a*(r - Cr)/256
srcAB = _mm_add_epi16(srcAB, dstAB); // PADDW, a*(r - Cr)/256 + Cr
return PackUnsaturated(srcAB, pack_mask);
}
/* Darken 2 pixels.
* rgb = rgb * ((256/4) * 4 - (alpha/4)) / ((256/4) * 4)
*/
static inline __m128i DarkenTwoPixels(__m128i src, __m128i dst, const __m128i &distribution_mask, const __m128i &tr_nom_base)
{
__m128i srcAB = _mm_unpacklo_epi8(src, _mm_setzero_si128());
__m128i dstAB = _mm_unpacklo_epi8(dst, _mm_setzero_si128());
__m128i alphaAB = DistributeAlpha(srcAB, distribution_mask);
alphaAB = _mm_srli_epi16(alphaAB, 2); // Reduce to 64 levels of shades so the max value fits in 16 bits.
__m128i nom = _mm_sub_epi16(tr_nom_base, alphaAB);
dstAB = _mm_mullo_epi16(dstAB, nom);
dstAB = _mm_srli_epi16(dstAB, 8);
return _mm_packus_epi16(dstAB, dstAB);
}
IGNORE_UNINITIALIZED_WARNING_START
static Colour ReallyAdjustBrightness(Colour colour, uint8 brightness)
{
uint64 c16 = colour.b | (uint64) colour.g << 16 | (uint64) colour.r << 32;
c16 *= brightness;
uint64 c16_ob = c16; // Helps out of order execution.
c16 /= Blitter_32bppBase::DEFAULT_BRIGHTNESS;
c16 &= 0x01FF01FF01FFULL;
/* Sum overbright (maximum for each rgb is 508, 9 bits, -255 is changed in -256 so we just have to take the 8 lower bits into account). */
c16_ob = (((c16_ob >> (8 + 7)) & 0x0100010001ULL) * 0xFF) & c16;
const uint ob = ((uint16) c16_ob + (uint16) (c16_ob >> 16) + (uint16) (c16_ob >> 32)) / 2;
const uint32 alpha32 = colour.data & 0xFF000000;
__m128i ret;
LoadUint64(c16, ret);
if (ob != 0) {
__m128i ob128 = _mm_cvtsi32_si128(ob);
ob128 = _mm_shufflelo_epi16(ob128, 0xC0);
__m128i white = OVERBRIGHT_VALUE_MASK;
__m128i c128 = ret;
ret = _mm_subs_epu16(white, c128); // PSUBUSW, (255 - rgb)
ret = _mm_mullo_epi16(ret, ob128); // PMULLW, ob*(255 - rgb)
ret = _mm_srli_epi16(ret, 8); // PSRLW, ob*(255 - rgb)/256
ret = _mm_add_epi16(ret, c128); // PADDW, ob*(255 - rgb)/256 + rgb
}
ret = _mm_packus_epi16(ret, ret); // PACKUSWB, saturate and pack.
return alpha32 | _mm_cvtsi128_si32(ret);
}
IGNORE_UNINITIALIZED_WARNING_STOP
/** ReallyAdjustBrightness() is not called that often.
* Inlining this function implies a far jump, which has a huge latency.
*/
static inline Colour AdjustBrightneSSE(Colour colour, uint8 brightness)
{
/* Shortcut for normal brightness. */
if (brightness == Blitter_32bppBase::DEFAULT_BRIGHTNESS) return colour;
return ReallyAdjustBrightness(colour, brightness);
}
static inline __m128i AdjustBrightnessOfTwoPixels(__m128i from, uint32 brightness)
{
#if (SSE_VERSION < 3)
NOT_REACHED();
#else
/* The following dataflow differs from the one of AdjustBrightness() only for alpha.
* In order to keep alpha in colAB, insert a 1 in a unused brightness byte (a*1->a).
* OK, not a 1 but DEFAULT_BRIGHTNESS to compensate the div.
*/
brightness &= 0xFF00FF00;
brightness += Blitter_32bppBase::DEFAULT_BRIGHTNESS;
__m128i colAB = _mm_unpacklo_epi8(from, _mm_setzero_si128());
__m128i briAB = _mm_cvtsi32_si128(brightness);
briAB = _mm_shuffle_epi8(briAB, BRIGHTNESS_LOW_CONTROL_MASK); // DEFAULT_BRIGHTNESS in 0, 0x00 in 2.
colAB = _mm_mullo_epi16(colAB, briAB);
__m128i colAB_ob = _mm_srli_epi16(colAB, 8+7);
colAB = _mm_srli_epi16(colAB, 7);
/* Sum overbright.
* Maximum for each rgb is 508 => 9 bits. The highest bit tells if there is overbright.
* -255 is changed in -256 so we just have to take the 8 lower bits into account.
*/
colAB = _mm_and_si128(colAB, BRIGHTNESS_DIV_CLEANER);
colAB_ob = _mm_and_si128(colAB_ob, OVERBRIGHT_PRESENCE_MASK);
colAB_ob = _mm_mullo_epi16(colAB_ob, OVERBRIGHT_VALUE_MASK);
colAB_ob = _mm_and_si128(colAB_ob, colAB);
__m128i obAB = _mm_hadd_epi16(_mm_hadd_epi16(colAB_ob, _mm_setzero_si128()), _mm_setzero_si128());
obAB = _mm_srli_epi16(obAB, 1); // Reduce overbright strength.
obAB = _mm_shuffle_epi8(obAB, OVERBRIGHT_CONTROL_MASK);
__m128i retAB = OVERBRIGHT_VALUE_MASK; // ob_mask is equal to white.
retAB = _mm_subs_epu16(retAB, colAB); // (255 - rgb)
retAB = _mm_mullo_epi16(retAB, obAB); // ob*(255 - rgb)
retAB = _mm_srli_epi16(retAB, 8); // ob*(255 - rgb)/256
retAB = _mm_add_epi16(retAB, colAB); // ob*(255 - rgb)/256 + rgb
return _mm_packus_epi16(retAB, retAB);
#endif
}
#if FULL_ANIMATION == 0
/**
* Draws a sprite to a (screen) buffer. It is templated to allow faster operation.
*
* @tparam mode blitter mode
* @param bp further blitting parameters
* @param zoom zoom level at which we are drawing
*/
IGNORE_UNINITIALIZED_WARNING_START
template <BlitterMode mode, Blitter_32bppSSE2::ReadMode read_mode, Blitter_32bppSSE2::BlockType bt_last, bool translucent>
#if (SSE_VERSION == 2)
inline void Blitter_32bppSSE2::Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom)
#elif (SSE_VERSION == 3)
inline void Blitter_32bppSSSE3::Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom)
#elif (SSE_VERSION == 4)
inline void Blitter_32bppSSE4::Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom)
#endif
{
const byte * const remap = bp->remap;
Colour *dst_line = (Colour *) bp->dst + bp->top * bp->pitch + bp->left;
int effective_width = bp->width;
/* Find where to start reading in the source sprite. */
const SpriteData * const sd = (const SpriteData *) bp->sprite;
const SpriteInfo * const si = &sd->infos[zoom];
const MapValue *src_mv_line = (const MapValue *) &sd->data[si->mv_offset] + bp->skip_top * si->sprite_width;
const Colour *src_rgba_line = (const Colour *) ((const byte *) &sd->data[si->sprite_offset] + bp->skip_top * si->sprite_line_size);
if (read_mode != RM_WITH_MARGIN) {
src_rgba_line += bp->skip_left;
src_mv_line += bp->skip_left;
}
const MapValue *src_mv = src_mv_line;
/* Load these variables into register before loop. */
#if (SSE_VERSION == 2)
const __m128i clear_hi = CLEAR_HIGH_BYTE_MASK;
#define ALPHA_BLEND_PARAM_1 clear_hi
#define ALPHA_BLEND_PARAM_2 clear_hi
#define DARKEN_PARAM_1 tr_nom_base
#define DARKEN_PARAM_2 tr_nom_base
#else
const __m128i a_cm = ALPHA_CONTROL_MASK;
const __m128i pack_low_cm = PACK_LOW_CONTROL_MASK;
#define ALPHA_BLEND_PARAM_1 a_cm
#define ALPHA_BLEND_PARAM_2 pack_low_cm
#define DARKEN_PARAM_1 a_cm
#define DARKEN_PARAM_2 tr_nom_base
#endif
const __m128i tr_nom_base = TRANSPARENT_NOM_BASE;
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 || 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 || 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;
const int new_width = effective_width - delta_diff;
effective_width = delta_diff > 0 ? new_width : effective_width;
if (effective_width <= 0) goto next_line;
}
switch (mode) {
default:
if (!translucent) {
for (uint x = (uint) effective_width; x > 0; x--) {
if (src->a) *dst = *src;
src++;
dst++;
}
break;
}
for (uint x = (uint) effective_width / 2; x > 0; x--) {
__m128i srcABCD = _mm_loadl_epi64((const __m128i*) src);
__m128i dstABCD = _mm_loadl_epi64((__m128i*) dst);
_mm_storel_epi64((__m128i*) dst, AlphaBlendTwoPixels(srcABCD, dstABCD, ALPHA_BLEND_PARAM_1, ALPHA_BLEND_PARAM_2));
src += 2;
dst += 2;
}
if ((bt_last == BT_NONE && effective_width & 1) || bt_last == BT_ODD) {
__m128i srcABCD = _mm_cvtsi32_si128(src->data);
__m128i dstABCD = _mm_cvtsi32_si128(dst->data);
dst->data = _mm_cvtsi128_si32(AlphaBlendTwoPixels(srcABCD, dstABCD, ALPHA_BLEND_PARAM_1, ALPHA_BLEND_PARAM_2));
}
break;
case BM_COLOUR_REMAP:
#if (SSE_VERSION >= 3)
for (uint x = (uint) effective_width / 2; x > 0; x--) {
__m128i srcABCD = _mm_loadl_epi64((const __m128i*) src);
__m128i dstABCD = _mm_loadl_epi64((__m128i*) dst);
uint32 mvX2 = *((uint32 *) const_cast<MapValue *>(src_mv));
/* Remap colours. */
if (mvX2 & 0x00FF00FF) {
#define CMOV_REMAP(m_colour, m_colour_init, m_src, m_m) \
/* Written so the compiler uses CMOV. */ \
Colour m_colour = m_colour_init; \
{ \
const Colour srcm = (Colour) (m_src); \
const uint m = (byte) (m_m); \
const uint r = remap[m]; \
const Colour cmap = (this->LookupColourInPalette(r).data & 0x00FFFFFF) | (srcm.data & 0xFF000000); \
m_colour = r == 0 ? m_colour : cmap; \
m_colour = m != 0 ? m_colour : srcm; \
}
#ifdef _SQ64
uint64 srcs = _mm_cvtsi128_si64(srcABCD);
uint64 remapped_src = 0;
CMOV_REMAP(c0, 0, srcs, mvX2);
remapped_src = c0.data;
CMOV_REMAP(c1, 0, srcs >> 32, mvX2 >> 16);
remapped_src |= (uint64) c1.data << 32;
srcABCD = _mm_cvtsi64_si128(remapped_src);
#else
Colour remapped_src[2];
CMOV_REMAP(c0, 0, _mm_cvtsi128_si32(srcABCD), mvX2);
remapped_src[0] = c0.data;
CMOV_REMAP(c1, 0, src[1], mvX2 >> 16);
remapped_src[1] = c1.data;
srcABCD = _mm_loadl_epi64((__m128i*) &remapped_src);
#endif
if ((mvX2 & 0xFF00FF00) != 0x80008000) srcABCD = AdjustBrightnessOfTwoPixels(srcABCD, mvX2);
}
/* Blend colours. */
_mm_storel_epi64((__m128i *) dst, AlphaBlendTwoPixels(srcABCD, dstABCD, ALPHA_BLEND_PARAM_1, ALPHA_BLEND_PARAM_2));
dst += 2;
src += 2;
src_mv += 2;
}
if ((bt_last == BT_NONE && effective_width & 1) || bt_last == BT_ODD) {
#else
for (uint x = (uint) effective_width; x > 0; x--) {
#endif
/* In case the m-channel is zero, do not remap this pixel in any way. */
__m128i srcABCD;
if (src_mv->m) {
const uint r = remap[src_mv->m];
if (r != 0) {
Colour remapped_colour = AdjustBrightneSSE(this->LookupColourInPalette(r), src_mv->v);
if (src->a == 255) {
*dst = remapped_colour;
} else {
remapped_colour.a = src->a;
srcABCD = _mm_cvtsi32_si128(remapped_colour.data);
goto bmcr_alpha_blend_single;
}
}
} else {
srcABCD = _mm_cvtsi32_si128(src->data);
if (src->a < 255) {
bmcr_alpha_blend_single:
__m128i dstABCD = _mm_cvtsi32_si128(dst->data);
srcABCD = AlphaBlendTwoPixels(srcABCD, dstABCD, ALPHA_BLEND_PARAM_1, ALPHA_BLEND_PARAM_2);
}
dst->data = _mm_cvtsi128_si32(srcABCD);
}
#if (SSE_VERSION == 2)
src_mv++;
dst++;
src++;
#endif
}
break;
case BM_TRANSPARENT:
/* Make the current colour a bit more black, so it looks like this image is transparent. */
for (uint x = (uint) bp->width / 2; x > 0; x--) {
__m128i srcABCD = _mm_loadl_epi64((const __m128i*) src);
__m128i dstABCD = _mm_loadl_epi64((__m128i*) dst);
_mm_storel_epi64((__m128i *) dst, DarkenTwoPixels(srcABCD, dstABCD, DARKEN_PARAM_1, DARKEN_PARAM_2));
src += 2;
dst += 2;
}
if ((bt_last == BT_NONE && bp->width & 1) || bt_last == BT_ODD) {
__m128i srcABCD = _mm_cvtsi32_si128(src->data);
__m128i dstABCD = _mm_cvtsi32_si128(dst->data);
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 || 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;
}
}
IGNORE_UNINITIALIZED_WARNING_STOP
/**
* Draws a sprite to a (screen) buffer. Calls adequate templated function.
*
* @param bp further blitting parameters
* @param mode blitter mode
* @param zoom zoom level at which we are drawing
*/
#if (SSE_VERSION == 2)
void Blitter_32bppSSE2::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
#elif (SSE_VERSION == 3)
void Blitter_32bppSSSE3::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
#elif (SSE_VERSION == 4)
void Blitter_32bppSSE4::Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom)
#endif
{
switch (mode) {
default: {
if (bp->skip_left != 0 || bp->width <= MARGIN_NORMAL_THRESHOLD) {
bm_normal:
const BlockType bt_last = (BlockType) (bp->width & 1);
switch (bt_last) {
default: Draw<BM_NORMAL, RM_WITH_SKIP, BT_EVEN, true>(bp, zoom); return;
case BT_ODD: Draw<BM_NORMAL, RM_WITH_SKIP, BT_ODD, true>(bp, zoom); return;
}
} else {
if (((const Blitter_32bppSSE_Base::SpriteData *) bp->sprite)->flags & SF_TRANSLUCENT) {
Draw<BM_NORMAL, RM_WITH_MARGIN, BT_NONE, true>(bp, zoom);
} else {
Draw<BM_NORMAL, RM_WITH_MARGIN, BT_NONE, false>(bp, zoom);
}
return;
}
break;
}
case BM_COLOUR_REMAP:
if (((const Blitter_32bppSSE_Base::SpriteData *) bp->sprite)->flags & SF_NO_REMAP) goto bm_normal;
if (bp->skip_left != 0 || bp->width <= MARGIN_REMAP_THRESHOLD) {
Draw<BM_COLOUR_REMAP, RM_WITH_SKIP, BT_NONE, true>(bp, zoom); return;
} else {
Draw<BM_COLOUR_REMAP, RM_WITH_MARGIN, BT_NONE, true>(bp, zoom); return;
}
case BM_TRANSPARENT: Draw<BM_TRANSPARENT, RM_NONE, BT_NONE, true>(bp, zoom); return;
case BM_CRASH_REMAP: Draw<BM_CRASH_REMAP, RM_NONE, BT_NONE, true>(bp, zoom); return;
}
}
#endif /* FULL_ANIMATION */
#endif /* WITH_SSE */
#endif /* BLITTER_32BPP_SSE_FUNC_HPP */

View File

@@ -1,56 +0,0 @@
/* $Id$ */
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file 32bpp_sse_type.hpp Types related to SSE 32 bpp blitter. */
#ifndef BLITTER_32BPP_SSE_TYPE_HPP
#define BLITTER_32BPP_SSE_TYPE_HPP
#ifdef WITH_SSE
#include "32bpp_simple.hpp"
#if (SSE_VERSION == 2)
#include <emmintrin.h>
#elif (SSE_VERSION == 3)
#include <tmmintrin.h>
#elif (SSE_VERSION == 4)
#include <smmintrin.h>
#endif
#define META_LENGTH 2 ///< Number of uint32 inserted before each line of pixels in a sprite.
#define MARGIN_NORMAL_THRESHOLD (zoom == ZOOM_LVL_OUT_32X ? 8 : 4) ///< Minimum width to use margins with BM_NORMAL.
#define MARGIN_REMAP_THRESHOLD 4 ///< Minimum width to use margins with BM_COLOUR_REMAP.
#ifdef _MSC_VER
#define ALIGN(n) __declspec(align(n))
#else
#define ALIGN(n) __attribute__ ((aligned (n)))
#endif
typedef union ALIGN(16) um128i {
__m128i m128i;
uint8 m128i_u8[16];
uint16 m128i_u16[8];
uint32 m128i_u32[4];
uint64 m128i_u64[2];
} um128i;
#define CLEAR_HIGH_BYTE_MASK _mm_setr_epi8(-1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0, -1, 0)
#define ALPHA_CONTROL_MASK _mm_setr_epi8( 6, 7, 6, 7, 6, 7, -1, -1, 14, 15, 14, 15, 14, 15, -1, -1)
#define PACK_LOW_CONTROL_MASK _mm_setr_epi8( 0, 2, 4, -1, 8, 10, 12, -1, -1, -1, -1, -1, -1, -1, -1, -1)
#define PACK_HIGH_CONTROL_MASK _mm_setr_epi8(-1, -1, -1, -1, -1, -1, -1, -1, 0, 2, 4, -1, 8, 10, 12, -1)
#define BRIGHTNESS_LOW_CONTROL_MASK _mm_setr_epi8( 1, 2, 1, 2, 1, 2, 0, 2, 3, 2, 3, 2, 3, 2, 0, 2)
#define BRIGHTNESS_DIV_CLEANER _mm_setr_epi8(-1, 1, -1, 1, -1, 1, -1, 0, -1, 1, -1, 1, -1, 1, -1, 0)
#define OVERBRIGHT_PRESENCE_MASK _mm_setr_epi8( 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0)
#define OVERBRIGHT_VALUE_MASK _mm_setr_epi8(-1, 0, -1, 0, -1, 0, 0, 0, -1, 0, -1, 0, -1, 0, 0, 0)
#define OVERBRIGHT_CONTROL_MASK _mm_setr_epi8( 0, 1, 0, 1, 0, 1, 7, 7, 2, 3, 2, 3, 2, 3, 7, 7)
#define TRANSPARENT_NOM_BASE _mm_setr_epi16(256, 256, 256, 256, 256, 256, 256, 256)
#endif /* WITH_SSE */
#endif /* BLITTER_32BPP_SSE_TYPE_HPP */

View File

@@ -1,23 +0,0 @@
/* $Id$ */
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file 32bpp_ssse3.cpp Implementation of the SSSE3 32 bpp blitter. */
#ifdef WITH_SSE
#include "../stdafx.h"
#include "../zoom_func.h"
#include "../settings_type.h"
#include "32bpp_ssse3.hpp"
#include "32bpp_sse_func.hpp"
/** Instantiation of the SSSE3 32bpp blitter factory. */
static FBlitter_32bppSSSE3 iFBlitter_32bppSSSE3;
#endif /* WITH_SSE */

View File

@@ -1,44 +0,0 @@
/* $Id$ */
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file 32bpp_ssse3.hpp SSSE3 32 bpp blitter. */
#ifndef BLITTER_32BPP_SSSE3_HPP
#define BLITTER_32BPP_SSSE3_HPP
#ifdef WITH_SSE
#ifndef SSE_VERSION
#define SSE_VERSION 3
#endif
#ifndef FULL_ANIMATION
#define FULL_ANIMATION 0
#endif
#include "32bpp_sse2.hpp"
/** The SSSE3 32 bpp blitter (without palette animation). */
class Blitter_32bppSSSE3 : public Blitter_32bppSSE2 {
public:
/* virtual */ void Draw(Blitter::BlitterParams *bp, BlitterMode mode, ZoomLevel zoom);
template <BlitterMode mode, Blitter_32bppSSE_Base::ReadMode read_mode, Blitter_32bppSSE_Base::BlockType bt_last, bool translucent>
void Draw(const Blitter::BlitterParams *bp, ZoomLevel zoom);
/* virtual */ const char *GetName() { return "32bpp-ssse3"; }
};
/** Factory for the SSSE3 32 bpp blitter (without palette animation). */
class FBlitter_32bppSSSE3: public BlitterFactory {
public:
FBlitter_32bppSSSE3() : BlitterFactory("32bpp-ssse3", "32bpp SSSE3 Blitter (no palette animation)", HasCPUIDFlag(1, 2, 9)) {}
/* virtual */ Blitter *CreateInstance() { return new Blitter_32bppSSSE3(); }
};
#endif /* WITH_SSE */
#endif /* BLITTER_32BPP_SSSE3_HPP */

View File

@@ -83,8 +83,7 @@ void Blitter_8bppOptimized::Draw(Blitter::BlitterParams *bp, BlitterMode mode, Z
width -= pixels;
switch (mode) {
case BM_COLOUR_REMAP:
case BM_CRASH_REMAP: {
case BM_COLOUR_REMAP: {
const uint8 *remap = bp->remap;
do {
uint m = remap[*src];

View File

@@ -31,9 +31,10 @@ public:
};
/** Factory for the 8bpp blitter optimised for speed. */
class FBlitter_8bppOptimized : public BlitterFactory {
class FBlitter_8bppOptimized : public BlitterFactory<FBlitter_8bppOptimized> {
public:
FBlitter_8bppOptimized() : BlitterFactory("8bpp-optimized", "8bpp Optimized Blitter (compression + all-ZoomLevel cache)") {}
/* virtual */ const char *GetName() { return "8bpp-optimized"; }
/* virtual */ const char *GetDescription() { return "8bpp Optimized Blitter (compression + all-ZoomLevel cache)"; }
/* virtual */ Blitter *CreateInstance() { return new Blitter_8bppOptimized(); }
};

View File

@@ -37,7 +37,6 @@ 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;

View File

@@ -25,9 +25,10 @@ public:
};
/** Factory for the most trivial 8bpp blitter. */
class FBlitter_8bppSimple : public BlitterFactory {
class FBlitter_8bppSimple : public BlitterFactory<FBlitter_8bppSimple> {
public:
FBlitter_8bppSimple() : BlitterFactory("8bpp-simple", "8bpp Simple Blitter (relative slow, but never wrong)") {}
/* virtual */ const char *GetName() { return "8bpp-simple"; }
/* virtual */ const char *GetDescription() { return "8bpp Simple Blitter (relative slow, but never wrong)"; }
/* virtual */ Blitter *CreateInstance() { return new Blitter_8bppSimple(); }
};

View File

@@ -20,7 +20,6 @@ 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.
};
/**

View File

@@ -25,12 +25,11 @@ bool QZ_CanDisplay8bpp();
/**
* The base factory, keeping track of all blitters.
*/
class BlitterFactory {
class BlitterFactoryBase {
private:
const char *name; ///< The name of the blitter factory.
const char *description; ///< The description of the blitter.
const char *name; ///< The name of the blitter factory.
typedef std::map<const char *, BlitterFactory *, StringCompare> Blitters; ///< Map of blitter factories.
typedef std::map<const char *, BlitterFactoryBase *, StringCompare> Blitters; ///< Map of blitter factories.
/**
* Get the map with currently known blitters.
@@ -54,38 +53,32 @@ private:
protected:
/**
* Construct the blitter, and register it.
* @param name The name of the blitter.
* @param description A longer description for the blitter.
* @param usable Whether the blitter is usable (on the current computer). For example for disabling SSE blitters when the CPU can't handle them.
* @pre name != NULL.
* @pre description != NULL.
* @pre There is no blitter registered with this name.
* Register a blitter internally, based on his name.
* @param name the name of the blitter.
* @note an assert() will be trigger if 2 blitters with the same name try to register.
*/
BlitterFactory(const char *name, const char *description, bool usable = true) :
name(strdup(name)), description(strdup(description))
void RegisterBlitter(const char *name)
{
if (usable) {
/*
* Only add when the blitter is usable. Do not bail out or
* do more special things since the blitters are always
* instantiated upon start anyhow and freed upon shutdown.
*/
std::pair<Blitters::iterator, bool> P = GetBlitters().insert(Blitters::value_type(this->name, this));
assert(P.second);
} else {
DEBUG(driver, 1, "Not registering blitter %s as it is not usable", name);
}
/* Don't register nameless Blitters */
if (name == NULL) return;
this->name = strdup(name);
std::pair<Blitters::iterator, bool> P = GetBlitters().insert(Blitters::value_type(name, this));
assert(P.second);
}
public:
virtual ~BlitterFactory()
BlitterFactoryBase() :
name(NULL)
{}
virtual ~BlitterFactoryBase()
{
if (this->name == NULL) return;
GetBlitters().erase(this->name);
if (GetBlitters().empty()) delete &GetBlitters();
free(this->name);
free(this->description);
}
/**
@@ -94,24 +87,6 @@ public:
* @post Sets the blitter so GetCurrentBlitter() returns it too.
*/
static Blitter *SelectBlitter(const char *name)
{
BlitterFactory *b = GetBlitterFactory(name);
if (b == NULL) return NULL;
Blitter *newb = b->CreateInstance();
delete *GetActiveBlitter();
*GetActiveBlitter() = newb;
DEBUG(driver, 1, "Successfully %s blitter '%s'", StrEmpty(name) ? "probed" : "loaded", newb->GetName());
return newb;
}
/**
* Get the blitter factory with the given name.
* @param name the blitter factory to select.
* @return The blitter factory, or NULL when there isn't one with the wanted name.
*/
static BlitterFactory *GetBlitterFactory(const char *name)
{
#if defined(DEDICATED)
const char *default_blitter = "null";
@@ -133,9 +108,14 @@ public:
Blitters::iterator it = GetBlitters().begin();
for (; it != GetBlitters().end(); it++) {
BlitterFactory *b = (*it).second;
BlitterFactoryBase *b = (*it).second;
if (strcasecmp(bname, b->name) == 0) {
return b;
Blitter *newb = b->CreateInstance();
delete *GetActiveBlitter();
*GetActiveBlitter() = newb;
DEBUG(driver, 1, "Successfully %s blitter '%s'", StrEmpty(name) ? "probed" : "loaded", bname);
return newb;
}
}
return NULL;
@@ -160,7 +140,7 @@ public:
p += seprintf(p, last, "List of blitters:\n");
Blitters::iterator it = GetBlitters().begin();
for (; it != GetBlitters().end(); it++) {
BlitterFactory *b = (*it).second;
BlitterFactoryBase *b = (*it).second;
p += seprintf(p, last, "%18s: %s\n", b->name, b->GetDescription());
}
p += seprintf(p, last, "\n");
@@ -168,21 +148,10 @@ public:
return p;
}
/**
* Get the long, human readable, name for the Blitter-class.
*/
const char *GetName() const
{
return this->name;
}
/**
* Get a nice description of the blitter-class.
*/
const char *GetDescription() const
{
return this->description;
}
virtual const char *GetDescription() = 0;
/**
* Create an instance of this Blitter-class.
@@ -190,6 +159,20 @@ public:
virtual Blitter *CreateInstance() = 0;
};
/**
* A template factory, so ->GetName() works correctly. This because else some compiler will complain.
*/
template <class T>
class BlitterFactory : public BlitterFactoryBase {
public:
BlitterFactory() { this->RegisterBlitter(((T *)this)->GetName()); }
/**
* Get the long, human readable, name for the Blitter-class.
*/
const char *GetName();
};
extern char *_ini_blitter;
extern bool _blitter_autodetected;

View File

@@ -38,9 +38,10 @@ public:
};
/** Factory for the blitter that does nothing. */
class FBlitter_Null : public BlitterFactory {
class FBlitter_Null : public BlitterFactory<FBlitter_Null> {
public:
FBlitter_Null() : BlitterFactory("null", "Null Blitter (does nothing)") {}
/* virtual */ const char *GetName() { return "null"; }
/* virtual */ const char *GetDescription() { return "Null Blitter (does nothing)"; }
/* virtual */ Blitter *CreateInstance() { return new Blitter_Null(); }
};

View File

@@ -215,7 +215,7 @@ bool HandleBootstrap()
if (BaseGraphics::GetUsedSet() != NULL) return true;
/* No user interface, bail out with an error. */
if (BlitterFactory::GetCurrentBlitter()->GetScreenDepth() == 0) goto failure;
if (BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth() == 0) goto failure;
/* If there is no network or no freetype, then there is nothing we can do. Go straight to failure. */
#if defined(ENABLE_NETWORK) && defined(WITH_FREETYPE) && (defined(WITH_FONTCONFIG) || defined(WIN32) || defined(__APPLE__))
@@ -244,7 +244,7 @@ bool HandleBootstrap()
new BootstrapAskForDownloadWindow();
/* Process the user events. */
VideoDriver::GetInstance()->MainLoop();
_video_driver->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

View File

@@ -772,14 +772,13 @@ static uint ShowAdditionalText(int left, int right, int y, EngineID engine)
{
uint16 callback = GetVehicleCallback(CBID_VEHICLE_ADDITIONAL_TEXT, 0, 0, engine, NULL);
if (callback == CALLBACK_FAILED || callback == 0x400) return y;
const GRFFile *grffile = Engine::Get(engine)->GetGRF();
if (callback > 0x400) {
ErrorUnknownCallbackResult(grffile->grfid, CBID_VEHICLE_ADDITIONAL_TEXT, callback);
ErrorUnknownCallbackResult(Engine::Get(engine)->GetGRFID(), CBID_VEHICLE_ADDITIONAL_TEXT, callback);
return y;
}
StartTextRefStackUsage(grffile, 6);
uint result = DrawStringMultiLine(left, right, y, INT32_MAX, GetGRFStringID(grffile->grfid, 0xD000 + callback), TC_BLACK);
StartTextRefStackUsage(6);
uint result = DrawStringMultiLine(left, right, y, INT32_MAX, GetGRFStringID(Engine::Get(engine)->GetGRFID(), 0xD000 + callback), TC_BLACK);
StopTextRefStackUsage();
return result;
}

View File

@@ -224,7 +224,8 @@ bool VehicleCargoReroute::operator()(CargoPacket *cp)
}
if (this->source != this->destination) {
this->source->RemoveFromMeta(cp_new, VehicleCargoList::MTA_TRANSFER, cp_new->Count());
this->destination->AddToMeta(cp_new, VehicleCargoList::MTA_TRANSFER);
this->source->AddToMeta(cp_new, VehicleCargoList::MTA_TRANSFER);
this->destination->action_counts[VehicleCargoList::MTA_TRANSFER] += cp_new->Count();
}
/* Legal, as front pushing doesn't invalidate iterators in std::list. */

View File

@@ -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 int32 GetAmount(CargoMonitorMap &monitor_map, CargoMonitorID monitor, bool keep_monitoring)
static uint32 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 int32 GetAmount(CargoMonitorMap &monitor_map, CargoMonitorID monitor, boo
}
return 0;
} else {
int32 result = iter->second;
uint32 result = iter->second;
iter->second = 0;
if (!keep_monitoring) monitor_map.erase(iter);
return result;
@@ -90,7 +90,7 @@ static int32 GetAmount(CargoMonitorMap &monitor_map, CargoMonitorID monitor, boo
* @param keep_monitoring After returning from this call, continue monitoring.
* @return Amount of delivered cargo for the monitored combination.
*/
int32 GetDeliveryAmount(CargoMonitorID monitor, bool keep_monitoring)
uint32 GetDeliveryAmount(CargoMonitorID monitor, bool keep_monitoring)
{
return GetAmount(_cargo_deliveries, monitor, keep_monitoring);
}
@@ -102,7 +102,7 @@ int32 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.
*/
int32 GetPickupAmount(CargoMonitorID monitor, bool keep_monitoring)
uint32 GetPickupAmount(CargoMonitorID monitor, bool keep_monitoring)
{
return GetAmount(_cargo_pickups, monitor, keep_monitoring);
}

View File

@@ -16,7 +16,6 @@
#include "company_func.h"
#include "industry.h"
#include "town.h"
#include "core/overflowsafe_type.hpp"
#include <map>
struct Station;
@@ -32,7 +31,7 @@ struct Station;
typedef uint32 CargoMonitorID; ///< Type of the cargo monitor number.
/** Map type for storing and updating active cargo monitor numbers and their amounts. */
typedef std::map<CargoMonitorID, OverflowSafeInt32> CargoMonitorMap;
typedef std::map<CargoMonitorID, uint32> CargoMonitorMap;
extern CargoMonitorMap _cargo_pickups;
extern CargoMonitorMap _cargo_deliveries;
@@ -142,8 +141,8 @@ static inline TownID DecodeMonitorTown(CargoMonitorID num)
void ClearCargoPickupMonitoring(CompanyID company = INVALID_OWNER);
void ClearCargoDeliveryMonitoring(CompanyID company = INVALID_OWNER);
int32 GetDeliveryAmount(CargoMonitorID monitor, bool keep_monitoring);
int32 GetPickupAmount(CargoMonitorID monitor, bool keep_monitoring);
uint32 GetDeliveryAmount(CargoMonitorID monitor, bool keep_monitoring);
uint32 GetPickupAmount(CargoMonitorID monitor, bool keep_monitoring);
void AddCargoDelivery(CargoID cargo_type, CompanyID company, uint32 amount, SourceType src_type, SourceID src, const Station *st);
#endif /* CARGOMONITOR_H */

View File

@@ -544,54 +544,17 @@ void VehicleCargoList::InvalidateCache()
/**
* Moves some cargo from one designation to another. You can only move
* between adjacent designations. E.g. you can keep cargo that was previously
* reserved (MTA_LOAD), but you can't reserve cargo that's marked as to be
* delivered. Furthermore, as this method doesn't change the actual packets,
* you cannot move cargo from or to MTA_TRANSFER. You need a specialized
* template method for that.
* @tparam from Previous designation of cargo.
* @tparam to New designation of cargo.
* @param max_move Maximum amount of cargo to reassign.
* @return Amount of cargo actually reassigned.
* between adjacent designations. E.g. you can keep cargo that was
* previously reserved (MTA_LOAD) or you can mark cargo to be transferred
* that was previously marked as to be delivered, but you can't reserve
* cargo that's marked as to be delivered.
*/
template<VehicleCargoList::MoveToAction Tfrom, VehicleCargoList::MoveToAction Tto>
uint VehicleCargoList::Reassign(uint max_move, TileOrStationID)
uint VehicleCargoList::Reassign(uint max_move, MoveToAction from, MoveToAction to)
{
assert_tcompile(Tfrom != MTA_TRANSFER && Tto != MTA_TRANSFER);
assert_tcompile(Tfrom - Tto == 1 || Tto - Tfrom == 1);
max_move = min(this->action_counts[Tfrom], max_move);
this->action_counts[Tfrom] -= max_move;
this->action_counts[Tto] += max_move;
return max_move;
}
/**
* Reassign cargo from MTA_DELIVER to MTA_TRANSFER and take care of the next
* station the cargo wants to visit.
* @param max_move Maximum amount of cargo to reassign.
* @param next_station Station to record as next hop in the reassigned packets.
* @return Amount of cargo actually reassigned.
*/
template<>
uint VehicleCargoList::Reassign<VehicleCargoList::MTA_DELIVER, VehicleCargoList::MTA_TRANSFER>(uint max_move, TileOrStationID next_station)
{
max_move = min(this->action_counts[MTA_DELIVER], max_move);
uint sum = 0;
for (Iterator it(this->packets.begin()); sum < this->action_counts[MTA_TRANSFER] + max_move;) {
CargoPacket *cp = *it++;
sum += cp->Count();
if (sum <= this->action_counts[MTA_TRANSFER]) continue;
if (sum > this->action_counts[MTA_TRANSFER] + max_move) {
CargoPacket *cp_split = cp->Split(sum - this->action_counts[MTA_TRANSFER] + max_move);
sum -= cp_split->Count();
this->packets.insert(it, cp_split);
}
cp->next_station = next_station;
}
this->action_counts[MTA_DELIVER] -= max_move;
this->action_counts[MTA_TRANSFER] += max_move;
max_move = min(this->action_counts[from], max_move);
assert(Delta((int)from, (int)to) == 1);
this->action_counts[from] -= max_move;
this->action_counts[to] += max_move;
return max_move;
}
@@ -843,7 +806,7 @@ uint StationCargoList::Load(uint max_move, VehicleCargoList *dest, TileIndex loa
uint move = min(dest->ActionCount(VehicleCargoList::MTA_LOAD), max_move);
if (move > 0) {
this->reserved_count -= move;
dest->Reassign<VehicleCargoList::MTA_LOAD, VehicleCargoList::MTA_KEEP>(move);
dest->Reassign(move, VehicleCargoList::MTA_LOAD, VehicleCargoList::MTA_KEEP);
return move;
} else {
return this->ShiftCargo(CargoLoad(this, dest, max_move, load_place), next_station, true);
@@ -868,4 +831,3 @@ uint StationCargoList::Reroute(uint max_move, StationCargoList *dest, StationID
*/
template class CargoList<VehicleCargoList, CargoPacketList>;
template class CargoList<StationCargoList, StationCargoPacketMap>;
template uint VehicleCargoList::Reassign<VehicleCargoList::MTA_DELIVER, VehicleCargoList::MTA_KEEP>(uint, TileOrStationID);

View File

@@ -157,7 +157,7 @@ public:
* Gets the ID of the station where the cargo was loaded for the first time.
* @return StationID.
*/
inline StationID SourceStation() const
inline SourceID SourceStation() const
{
return this->source;
}
@@ -429,8 +429,7 @@ public:
* amount of cargo to be moved. Second parameter is destination (if
* applicable), return value is amount of cargo actually moved. */
template<MoveToAction Tfrom, MoveToAction Tto>
uint Reassign(uint max_move, TileOrStationID update = INVALID_TILE);
uint Reassign(uint max_move, MoveToAction from, MoveToAction to);
uint Return(uint max_move, StationCargoList *dest, StationID next_station);
uint Unload(uint max_move, StationCargoList *dest, CargoPayment *payment);
uint Shift(uint max_move, VehicleCargoList *dest);

View File

@@ -160,10 +160,8 @@ CommandProc CmdCreateStoryPage;
CommandProc CmdCreateStoryPageElement;
CommandProc CmdUpdateStoryPageElement;
CommandProc CmdSetStoryPageTitle;
CommandProc CmdSetStoryPageDate;
CommandProc CmdShowStoryPage;
CommandProc CmdRemoveStoryPage;
CommandProc CmdRemoveStoryPageElement;
CommandProc CmdLevelLand;
@@ -246,7 +244,7 @@ static const Command _command_proc_table[] = {
DEF_CMD(CmdForceTrainProceed, 0, CMDT_VEHICLE_MANAGEMENT ), // CMD_FORCE_TRAIN_PROCEED
DEF_CMD(CmdReverseTrainDirection, 0, CMDT_VEHICLE_MANAGEMENT ), // CMD_REVERSE_TRAIN_DIRECTION
DEF_CMD(CmdClearOrderBackup, CMD_CLIENT_ID, CMDT_SERVER_SETTING ), // CMD_CLEAR_ORDER_BACKUP
DEF_CMD(CmdClearOrderBackup, CMD_CLIENT_ID, CMDT_ROUTE_MANAGEMENT ), // CMD_CLEAR_ORDER_BACKUP
DEF_CMD(CmdModifyOrder, 0, CMDT_ROUTE_MANAGEMENT ), // CMD_MODIFY_ORDER
DEF_CMD(CmdSkipToOrder, 0, CMDT_ROUTE_MANAGEMENT ), // CMD_SKIP_TO_ORDER
DEF_CMD(CmdDeleteOrder, 0, CMDT_ROUTE_MANAGEMENT ), // CMD_DELETE_ORDER
@@ -314,10 +312,8 @@ static const Command _command_proc_table[] = {
DEF_CMD(CmdCreateStoryPageElement, CMD_STR_CTRL | CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_CREATE_STORY_PAGE_ELEMENT
DEF_CMD(CmdUpdateStoryPageElement, CMD_STR_CTRL | CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_UPDATE_STORY_PAGE_ELEMENT
DEF_CMD(CmdSetStoryPageTitle, CMD_STR_CTRL | CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_SET_STORY_PAGE_TITLE
DEF_CMD(CmdSetStoryPageDate, CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_SET_STORY_PAGE_DATE
DEF_CMD(CmdShowStoryPage, CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_SHOW_STORY_PAGE
DEF_CMD(CmdRemoveStoryPage, CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_REMOVE_STORY_PAGE
DEF_CMD(CmdRemoveStoryPageElement, CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_REMOVE_STORY_ELEMENT_PAGE
DEF_CMD(CmdRemoveStoryPage, CMD_STR_CTRL | CMD_DEITY, CMDT_OTHER_MANAGEMENT ), // CMD_REMOVE_STORY_PAGE
DEF_CMD(CmdLevelLand, CMD_ALL_TILES | CMD_NO_TEST | CMD_AUTO, CMDT_LANDSCAPE_CONSTRUCTION), // CMD_LEVEL_LAND; test run might clear tiles multiple times, in execution that only happens once
@@ -575,7 +571,7 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallbac
/* Only show the error when it's for us. */
StringID error_part1 = GB(cmd, 16, 16);
if (estimate_only || (IsLocalCompany() && error_part1 != 0 && my_cmd)) {
ShowErrorMessage(error_part1, res.GetErrorMessage(), WL_INFO, x, y, res.GetTextRefStackGRF(), res.GetTextRefStackSize(), res.GetTextRefStack());
ShowErrorMessage(error_part1, res.GetErrorMessage(), WL_INFO, x, y, res.GetTextRefStackSize(), res.GetTextRefStack());
}
} else if (estimate_only) {
ShowEstimatedCostOrIncome(res.GetCost(), x, y);
@@ -601,7 +597,7 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallbac
* @param cmd the command cost to return.
* @param clear whether to keep the storage changes or not.
*/
#define return_dcpi(cmd) { _docommand_recursive = 0; return cmd; }
#define return_dcpi(cmd, clear) { _docommand_recursive = 0; ClearPersistentStorageChanges(clear); return cmd; }
/*!
* Helper function for the toplevel network safe docommand function for the current company.
@@ -645,7 +641,7 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd,
#endif
/* Do not even think about executing out-of-bounds tile-commands */
if (tile != 0 && (tile >= MapSize() || (!IsValidTile(tile) && (cmd_flags & CMD_ALL_TILES) == 0))) return_dcpi(CMD_ERROR);
if (tile != 0 && (tile >= MapSize() || (!IsValidTile(tile) && (cmd_flags & CMD_ALL_TILES) == 0))) return_dcpi(CMD_ERROR, false);
/* Always execute server and spectator commands as spectator */
bool exec_as_spectator = (cmd_flags & (CMD_SPECTATOR | CMD_SERVER)) != 0;
@@ -654,7 +650,7 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd,
* The server will ditch any server commands a client sends to it, so effectively
* this guards the server from executing functions for an invalid company. */
if (_game_mode == GM_NORMAL && !exec_as_spectator && !Company::IsValidID(_current_company) && !(_current_company == OWNER_DEITY && (cmd_flags & CMD_DEITY) != 0)) {
return_dcpi(CMD_ERROR);
return_dcpi(CMD_ERROR, false);
}
Backup<CompanyByte> cur_company(_current_company, FILE_LINE);
@@ -665,9 +661,8 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd,
/* Test the command. */
_cleared_object_areas.Clear();
SetTownRatingTestMode(true);
BasePersistentStorageArray::SwitchMode(PSM_ENTER_TESTMODE);
ClearPersistentStorageChanges(false);
CommandCost res = proc(tile, flags, p1, p2, text);
BasePersistentStorageArray::SwitchMode(PSM_LEAVE_TESTMODE);
SetTownRatingTestMode(false);
/* Make sure we're not messing things up here. */
@@ -686,7 +681,7 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd,
DEBUG(desync, 1, "cmdf: %08x; %02x; %02x; %06x; %08x; %08x; %08x; \"%s\" (%s)", _date, _date_fract, (int)_current_company, tile, p1, p2, cmd & ~CMD_NETWORK_COMMAND, text, GetCommandName(cmd));
}
cur_company.Restore();
return_dcpi(res);
return_dcpi(res, false);
}
#ifdef ENABLE_NETWORK
@@ -702,7 +697,7 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd,
* This way it's not handled by DoCommand and only the
* actual execution of the command causes messages. Also
* reset the storages as we've not executed the command. */
return_dcpi(CommandCost());
return_dcpi(CommandCost(), false);
}
#endif /* ENABLE_NETWORK */
DEBUG(desync, 1, "cmd: %08x; %02x; %02x; %06x; %08x; %08x; %08x; \"%s\" (%s)", _date, _date_fract, (int)_current_company, tile, p1, p2, cmd & ~CMD_NETWORK_COMMAND, text, GetCommandName(cmd));
@@ -710,9 +705,8 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd,
/* Actually try and execute the command. If no cost-type is given
* use the construction one */
_cleared_object_areas.Clear();
BasePersistentStorageArray::SwitchMode(PSM_ENTER_COMMAND);
ClearPersistentStorageChanges(false);
CommandCost res2 = proc(tile, flags | DC_EXEC, p1, p2, text);
BasePersistentStorageArray::SwitchMode(PSM_LEAVE_COMMAND);
if (cmd_id == CMD_COMPANY_CTRL) {
cur_company.Trash();
@@ -733,7 +727,7 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd,
if (!test_and_exec_can_differ) {
assert(res.GetCost() == res2.GetCost() && res.Failed() == res2.Failed()); // sanity check
} else if (res2.Failed()) {
return_dcpi(res2);
return_dcpi(res2, false);
}
/* If we're needing more money and we haven't done
@@ -743,7 +737,7 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd,
* So make sure the signal buffer is empty even in this case */
UpdateSignalsInBuffer();
SetDParam(0, _additional_cash_required);
return_dcpi(CommandCost(STR_ERROR_NOT_ENOUGH_CASH_REQUIRES_CURRENCY));
return_dcpi(CommandCost(STR_ERROR_NOT_ENOUGH_CASH_REQUIRES_CURRENCY), false);
}
/* update last build coordinate of company. */
@@ -757,7 +751,7 @@ CommandCost DoCommandPInternal(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd,
/* update signals if needed */
UpdateSignalsInBuffer();
return_dcpi(res2);
return_dcpi(res2, true);
}
#undef return_dcpi
@@ -785,15 +779,13 @@ uint32 CommandCost::textref_stack[16];
/**
* Activate usage of the NewGRF #TextRefStack for the error message.
* @param grffile NewGRF that provides the #TextRefStack
* @param num_registers number of entries to copy from the temporary NewGRF registers
* @param number of entries to copy from the temporary NewGRF registers
*/
void CommandCost::UseTextRefStack(const GRFFile *grffile, uint num_registers)
void CommandCost::UseTextRefStack(uint num_registers)
{
extern TemporaryStorageArray<int32, 0x110> _temp_store;
assert(num_registers < lengthof(textref_stack));
this->textref_stack_grffile = grffile;
this->textref_stack_size = num_registers;
for (uint i = 0; i < num_registers; i++) {
textref_stack[i] = _temp_store.GetValue(0x100 + i);

View File

@@ -16,8 +16,6 @@
#include "strings_type.h"
#include "tile_type.h"
struct GRFFile;
/**
* Common return value for all commands. Wraps the cost and
* a possible error message/state together.
@@ -27,7 +25,6 @@ class CommandCost {
Money cost; ///< The cost of this action
StringID message; ///< Warning message for when success is unset
bool success; ///< Whether the comment went fine up to this moment
const GRFFile *textref_stack_grffile; ///< NewGRF providing the #TextRefStack content.
uint textref_stack_size; ///< Number of uint32 values to put on the #TextRefStack for the error message.
static uint32 textref_stack[16];
@@ -36,25 +33,25 @@ public:
/**
* Creates a command cost return with no cost and no error
*/
CommandCost() : expense_type(INVALID_EXPENSES), cost(0), message(INVALID_STRING_ID), success(true), textref_stack_grffile(NULL), textref_stack_size(0) {}
CommandCost() : expense_type(INVALID_EXPENSES), cost(0), message(INVALID_STRING_ID), success(true), textref_stack_size(0) {}
/**
* Creates a command return value the is failed with the given message
*/
explicit CommandCost(StringID msg) : expense_type(INVALID_EXPENSES), cost(0), message(msg), success(false), textref_stack_grffile(NULL), textref_stack_size(0) {}
explicit CommandCost(StringID msg) : expense_type(INVALID_EXPENSES), cost(0), message(msg), success(false), textref_stack_size(0) {}
/**
* Creates a command cost with given expense type and start cost of 0
* @param ex_t the expense type
*/
explicit CommandCost(ExpensesType ex_t) : expense_type(ex_t), cost(0), message(INVALID_STRING_ID), success(true), textref_stack_grffile(NULL), textref_stack_size(0) {}
explicit CommandCost(ExpensesType ex_t) : expense_type(ex_t), cost(0), message(INVALID_STRING_ID), success(true), textref_stack_size(0) {}
/**
* Creates a command return value with the given start cost and expense type
* @param ex_t the expense type
* @param cst the initial cost of this command
*/
CommandCost(ExpensesType ex_t, const Money &cst) : expense_type(ex_t), cost(cst), message(INVALID_STRING_ID), success(true), textref_stack_grffile(NULL), textref_stack_size(0) {}
CommandCost(ExpensesType ex_t, const Money &cst) : expense_type(ex_t), cost(cst), message(INVALID_STRING_ID), success(true), textref_stack_size(0) {}
/**
@@ -106,16 +103,7 @@ public:
this->message = message;
}
void UseTextRefStack(const GRFFile *grffile, uint num_registers);
/**
* Returns the NewGRF providing the #TextRefStack of the error message.
* @return the NewGRF.
*/
const GRFFile *GetTextRefStackGRF() const
{
return this->textref_stack_grffile;
}
void UseTextRefStack(uint num_registers);
/**
* Returns the number of uint32 values for the #TextRefStack of the error message.
@@ -288,10 +276,8 @@ enum Commands {
CMD_CREATE_STORY_PAGE_ELEMENT, ///< create a new story page element
CMD_UPDATE_STORY_PAGE_ELEMENT, ///< update a story page element
CMD_SET_STORY_PAGE_TITLE, ///< update title of a story page
CMD_SET_STORY_PAGE_DATE, ///< update date of a story page
CMD_SHOW_STORY_PAGE, ///< show a story page
CMD_REMOVE_STORY_PAGE, ///< remove a story page
CMD_REMOVE_STORY_PAGE_ELEMENT, ///< remove a story page element
CMD_LEVEL_LAND, ///< level land
CMD_BUILD_LOCK, ///< build a lock

View File

@@ -853,21 +853,59 @@ CommandCost CmdCompanyCtrl(TileIndex tile, DoCommandFlag flags, uint32 p1, uint3
MarkWholeScreenDirty();
}
NetworkServerNewCompany(c, ci);
if (_network_server) {
if (ci != NULL) {
/* ci is only NULL when replaying.
* When replaying no client is actually in need of an update. */
ci->client_playas = c->index;
NetworkUpdateClientInfo(ci->client_id);
}
if (Company::IsValidID(c->index)) {
_network_company_states[c->index].months_empty = 0;
_network_company_states[c->index].password[0] = '\0';
NetworkServerUpdateCompanyPassworded(c->index, false);
/* XXX - When a client joins, we automatically set its name to the
* client's name (for some reason). As it stands now only the server
* knows the client's name, so it needs to send out a "broadcast" to
* do this. To achieve this we send a network command. However, it
* uses _local_company to execute the command as. To prevent abuse
* (eg. only yourself can change your name/company), we 'cheat' by
* impersonation _local_company as the server. Not the best solution;
* but it works.
* TODO: Perhaps this could be improved by when the client is ready
* with joining to let it send itself the command, and not the server?
* For example in network_client.c:534? */
if (ci != NULL) {
/* ci is only NULL when replaying.
* When replaying, the command to rename the president will
* automatically be ran, so this is not even needed to get
* the exact same state. */
NetworkSendCommand(0, 0, 0, CMD_RENAME_PRESIDENT, NULL, ci->client_name, c->index);
}
}
/* Announce new company on network. */
NetworkAdminCompanyInfo(c, true);
if (ci != NULL) {
/* ci is only NULL when replaying.
* When replaying, the message that someone started a new company
* is not interesting at all. */
NetworkServerSendChat(NETWORK_ACTION_COMPANY_NEW, DESTTYPE_BROADCAST, 0, "", ci->client_id, c->index + 1);
}
}
#endif /* ENABLE_NETWORK */
break;
}
case 1: { // Make a new AI company
case 1: // Make a new AI company
if (!(flags & DC_EXEC)) return CommandCost();
if (company_id != INVALID_COMPANY && (company_id >= MAX_COMPANIES || Company::IsValidID(company_id))) return CMD_ERROR;
Company *c = DoStartupNewCompany(true, company_id);
#ifdef ENABLE_NETWORK
if (c != NULL) NetworkServerNewCompany(c, NULL);
#endif /* ENABLE_NETWORK */
DoStartupNewCompany(true, company_id);
break;
}
case 2: { // Delete a company
CompanyRemoveReason reason = (CompanyRemoveReason)GB(p2, 0, 2);

View File

@@ -2013,7 +2013,7 @@ struct CompanyWindow : Window
NWidgetStacked *wi = this->GetWidget<NWidgetStacked>(WID_C_SELECT_BUTTONS);
if (plane != wi->shown_plane) {
wi->SetDisplayedPlane(plane);
this->InvalidateData();
this->SetDirty();
return;
}

View File

@@ -475,7 +475,7 @@ void IConsoleCmdExec(const char *cmdstr)
DEBUG(console, 8, "Token %d is: '%s'", i, tokens[i]);
}
if (StrEmpty(tokens[0])) return; // don't execute empty commands
if (tokens[0] == '\0') return; // don't execute empty commands
/* 2. Determine type of command (cmd or alias) and execute
* First try commands, then aliases. Execute
* the found action taking into account its hooking code

View File

@@ -185,7 +185,7 @@ struct IConsoleWindow : Window
~IConsoleWindow()
{
_iconsole_mode = ICONSOLE_CLOSED;
VideoDriver::GetInstance()->EditBoxLostFocus();
_video_driver->EditBoxLostFocus();
}
/**
@@ -374,7 +374,7 @@ struct IConsoleWindow : Window
virtual void OnFocusLost()
{
VideoDriver::GetInstance()->EditBoxLostFocus();
_video_driver->EditBoxLostFocus();
}
};

View File

@@ -12,7 +12,6 @@
#ifndef OVERFLOWSAFE_TYPE_HPP
#define OVERFLOWSAFE_TYPE_HPP
#include "math_func.hpp"
/**
* Overflow safe template for integers, i.e. integers that will never overflow
@@ -152,6 +151,5 @@ template <class T, int64 T_MAX, int64 T_MIN> inline OverflowSafeInt<T, T_MAX, T_
template <class T, int64 T_MAX, int64 T_MIN> inline OverflowSafeInt<T, T_MAX, T_MIN> operator / (byte a, OverflowSafeInt<T, T_MAX, T_MIN> b) { return (OverflowSafeInt<T, T_MAX, T_MIN>)a / (int)b; }
typedef OverflowSafeInt<int64, INT64_MAX, INT64_MIN> OverflowSafeInt64;
typedef OverflowSafeInt<int32, INT32_MAX, INT32_MIN> OverflowSafeInt32;
#endif /* OVERFLOWSAFE_TYPE_HPP */

View File

@@ -81,9 +81,6 @@ private:
*/
template <class Titem, typename Tindex, size_t Tgrowth_step, size_t Tmax_size, PoolType Tpool_type = PT_NORMAL, bool Tcache = false, bool Tzero = true>
struct Pool : PoolBase {
/* Ensure Tmax_size is within the bounds of Tindex. */
assert_compile((uint64)(Tmax_size - 1) >> 8 * sizeof(Tindex) == 0);
static const size_t MAX_SIZE = Tmax_size; ///< Make template parameter accessible from outside
const char * const name; ///< Name of this pool

View File

@@ -12,90 +12,16 @@
#ifndef SMALLSTACK_TYPE_HPP
#define SMALLSTACK_TYPE_HPP
#include "smallvec_type.hpp"
#include "../thread/thread.h"
/**
* A simplified pool which stores values instead of pointers and doesn't
* redefine operator new/delete. It also never zeroes memory and always reuses
* it.
*/
template<typename Titem, typename Tindex, Tindex Tgrowth_step, Tindex Tmax_size>
class SimplePool {
public:
inline SimplePool() : first_unused(0), first_free(0), mutex(ThreadMutex::New()) {}
inline ~SimplePool() { delete this->mutex; }
/**
* Get the mutex. We don't lock the mutex in the pool methods as the
* SmallStack isn't necessarily in a consistent state after each method.
* @return Mutex.
*/
inline ThreadMutex *GetMutex() { return this->mutex; }
/**
* Get the item at position index.
* @return Item at index.
*/
inline Titem &Get(Tindex index) { return this->data[index]; }
/**
* Create a new item and return its index.
* @return Index of new item.
*/
inline Tindex Create()
{
Tindex index = this->FindFirstFree();
if (index < Tmax_size) {
this->data[index].valid = true;
this->first_free = index + 1;
this->first_unused = max(this->first_unused, this->first_free);
}
return index;
}
/**
* Destroy (or rather invalidate) the item at the given index.
* @param index Index of item to be destroyed.
*/
inline void Destroy(Tindex index)
{
this->data[index].valid = false;
this->first_free = min(this->first_free, index);
}
private:
inline Tindex FindFirstFree()
{
Tindex index = this->first_free;
for (; index < this->first_unused; index++) {
if (!this->data[index].valid) return index;
}
if (index >= this->data.Length() && index < Tmax_size) {
this->data.Resize(index + 1);
}
return index;
}
struct SimplePoolPoolItem : public Titem {
bool valid;
};
Tindex first_unused;
Tindex first_free;
ThreadMutex *mutex;
SmallVector<SimplePoolPoolItem, Tgrowth_step> data;
};
#include "pool_type.hpp"
#include "pool_func.hpp"
/**
* Base class for SmallStack. We cannot add this into SmallStack itself as
* certain compilers don't like it.
*/
template <typename Titem, typename Tindex>
struct SmallStackItem {
template <typename Tindex, typename Titem>
class SmallStackItem {
protected:
Tindex next; ///< Pool index of next item.
Titem value; ///< Value of current item.
@@ -124,30 +50,30 @@ struct SmallStackItem {
* 5. You can choose your own index type, so that you can align it with your
* value type. E.G. value types of 16 bits length like to be combined with
* index types of the same length.
* 6. All accesses to the underlying pool are guarded by a mutex and atomic in
* the sense that the mutex stays locked until the pool has reacquired a
* consistent state. This means that even though a common data structure is
* used the SmallStack is still reentrant.
* @tparam Titem Value type to be used.
* @tparam Tindex Index type to use for the pool.
* @tparam Tinvalid Invalid item to keep at the bottom of each stack.
* @tparam Tgrowth_step Growth step for pool.
* @tparam Tmax_size Maximum size for pool.
*/
template <typename Titem, typename Tindex, Titem Tinvalid, Tindex Tgrowth_step, Tindex Tmax_size>
class SmallStack : public SmallStackItem<Titem, Tindex> {
public:
typedef SmallStackItem<Titem, Tindex> Item;
template <typename Titem, typename Tindex, Titem Tinvalid, size_t Tgrowth_step, size_t Tmax_size>
class SmallStack : public SmallStackItem<Tindex, Titem> {
protected:
class PooledSmallStack;
/**
* SmallStack item that can be kept in a pool.
* Create a branch in the pool if necessary.
*/
struct PooledSmallStack : public Item {
Tindex branch_count; ///< Number of branches in the tree structure this item is parent of
};
void Branch()
{
if (PooledSmallStack::IsValidID(this->next)) {
PooledSmallStack::Get(this->next)->CreateBranch();
}
}
typedef SimplePool<PooledSmallStack, Tindex, Tgrowth_step, Tmax_size> SmallStackPool;
public:
typedef SmallStackItem<Tindex, Titem> Item;
typedef Pool<PooledSmallStack, Tindex, Tgrowth_step, Tmax_size, PT_NORMAL, true, false> SmallStackPool;
/**
* Constructor for a stack with one or two items in it.
@@ -160,8 +86,14 @@ public:
*/
inline ~SmallStack()
{
/* Pop() locks the mutex and after each pop the pool is consistent.*/
while (this->next != Tmax_size) this->Pop();
if (PooledSmallStack::IsValidID(this->next)) {
PooledSmallStack *item = PooledSmallStack::Get(this->next);
if (item->NumBranches() == 0) {
delete item;
} else {
item->DeleteBranch();
}
}
}
/**
@@ -178,32 +110,23 @@ public:
inline SmallStack &operator=(const SmallStack &other)
{
if (this == &other) return *this;
while (this->next != Tmax_size) this->Pop();
this->~SmallStack();
this->next = other.next;
this->value = other.value;
/* Deleting and branching are independent operations, so it's fine to
* acquire separate locks for them. */
this->Branch();
return *this;
}
/**
* Pushes a new item onto the stack if there is still space in the
* underlying pool. Otherwise the topmost item's value gets overwritten.
* Push a new item onto the stack.
* @param item Item to be pushed.
*/
inline void Push(const Titem &item)
{
if (this->value != Tinvalid) {
ThreadMutexLocker lock(_pool.GetMutex());
Tindex new_item = _pool.Create();
if (new_item != Tmax_size) {
PooledSmallStack &pushed = _pool.Get(new_item);
pushed.value = this->value;
pushed.next = this->next;
pushed.branch_count = 0;
this->next = new_item;
}
assert(PooledSmallStack::CanAllocateItem());
PooledSmallStack *next = new PooledSmallStack(this->value, this->next);
this->next = next->index;
}
this->value = item;
}
@@ -215,26 +138,17 @@ public:
inline Titem Pop()
{
Titem ret = this->value;
if (this->next == Tmax_size) {
if (!PooledSmallStack::IsValidID(this->next)) {
this->value = Tinvalid;
} else {
ThreadMutexLocker lock(_pool.GetMutex());
PooledSmallStack &popped = _pool.Get(this->next);
this->value = popped.value;
if (popped.branch_count == 0) {
_pool.Destroy(this->next);
PooledSmallStack *next = PooledSmallStack::Get(this->next);
static_cast<Item &>(*this) = *next;
if (next->NumBranches() == 0) {
delete next;
} else {
--popped.branch_count;
/* We can't use Branch() here as we already have the mutex.*/
if (popped.next != Tmax_size) {
++(_pool.Get(popped.next).branch_count);
}
next->DeleteBranch();
this->Branch();
}
/* Accessing popped here is no problem as the pool will only set
* the validity flag, not actually delete the item, on Destroy().
* It's impossible for another thread to acquire the same item in
* the mean time because of the mutex. */
this->next = popped.next;
}
return ret;
}
@@ -245,7 +159,7 @@ public:
*/
inline bool IsEmpty() const
{
return this->value == Tinvalid && this->next == Tmax_size;
return this->value == Tinvalid && !PooledSmallStack::IsValidID(this->next);
}
/**
@@ -256,14 +170,11 @@ public:
inline bool Contains(const Titem &item) const
{
if (item == Tinvalid || item == this->value) return true;
if (this->next != Tmax_size) {
ThreadMutexLocker lock(_pool.GetMutex());
const SmallStack *in_list = this;
do {
in_list = static_cast<const SmallStack *>(
static_cast<const Item *>(&_pool.Get(in_list->next)));
if (in_list->value == item) return true;
} while (in_list->next != Tmax_size);
const SmallStack *in_list = this;
while (PooledSmallStack::IsValidID(in_list->next)) {
in_list = static_cast<const SmallStack *>(
static_cast<const Item *>(PooledSmallStack::Get(in_list->next)));
if (in_list->value == item) return true;
}
return false;
}
@@ -272,15 +183,19 @@ protected:
static SmallStackPool _pool;
/**
* Create a branch in the pool if necessary.
* SmallStack item that can be kept in a pool (by having an index).
*/
inline void Branch()
{
if (this->next != Tmax_size) {
ThreadMutexLocker lock(_pool.GetMutex());
++(_pool.Get(this->next).branch_count);
}
}
class PooledSmallStack : public Item, public SmallStackPool::template PoolItem<&SmallStack::_pool> {
private:
Tindex branch_count; ///< Number of branches in the tree structure this item is parent of
public:
PooledSmallStack(Titem value, Tindex next) : Item(value, next), branch_count(0) {}
inline void CreateBranch() { ++this->branch_count; }
inline void DeleteBranch() { --this->branch_count; }
inline Tindex NumBranches() { return this->branch_count; }
};
};
#endif

View File

@@ -1,37 +0,0 @@
/* $Id$ */
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file cpu.h Functions related to CPU specific instructions. */
#ifndef CPU_H
#define CPU_H
/**
* Get the tick counter from the CPU (high precision timing).
* @return The count.
*/
uint64 ottd_rdtsc();
/**
* Get the CPUID information from the CPU.
* @param info The retrieved info. All zeros on architectures without CPUID.
* @param type The information this instruction should retrieve.
*/
void ottd_cpuid(int info[4], int type);
/**
* Check whether the current CPU has the given flag.
* @param type The type to be passing to cpuid (usually 1).
* @param index The index in the returned info array.
* @param bit The bit index that needs to be set.
* @return The value of the bit, or false when there is no CPUID or the type is not available.
*/
bool HasCPUIDFlag(uint type, uint index, uint bit);
#endif /* CPU_H */

View File

@@ -134,18 +134,18 @@ char *CrashLog::LogConfiguration(char *buffer, const char *last) const
" Sound driver: %s\n"
" Sound set: %s (%u)\n"
" Video driver: %s\n\n",
BlitterFactory::GetCurrentBlitter() == NULL ? "none" : BlitterFactory::GetCurrentBlitter()->GetName(),
BlitterFactoryBase::GetCurrentBlitter() == NULL ? "none" : BlitterFactoryBase::GetCurrentBlitter()->GetName(),
BaseGraphics::GetUsedSet() == NULL ? "none" : BaseGraphics::GetUsedSet()->name,
BaseGraphics::GetUsedSet() == NULL ? UINT32_MAX : BaseGraphics::GetUsedSet()->version,
_current_language == NULL ? "none" : _current_language->file,
MusicDriver::GetInstance() == NULL ? "none" : MusicDriver::GetInstance()->GetName(),
_music_driver == NULL ? "none" : _music_driver->GetName(),
BaseMusic::GetUsedSet() == NULL ? "none" : BaseMusic::GetUsedSet()->name,
BaseMusic::GetUsedSet() == NULL ? UINT32_MAX : BaseMusic::GetUsedSet()->version,
_networking ? (_network_server ? "server" : "client") : "no",
SoundDriver::GetInstance() == NULL ? "none" : SoundDriver::GetInstance()->GetName(),
_sound_driver == NULL ? "none" : _sound_driver->GetName(),
BaseSounds::GetUsedSet() == NULL ? "none" : BaseSounds::GetUsedSet()->name,
BaseSounds::GetUsedSet() == NULL ? UINT32_MAX : BaseSounds::GetUsedSet()->version,
VideoDriver::GetInstance() == NULL ? "none" : VideoDriver::GetInstance()->GetName()
_video_driver == NULL ? "none" : _video_driver->GetName()
);
buffer += seprintf(buffer, last,
@@ -482,7 +482,7 @@ bool CrashLog::MakeCrashLog() const
*/
/* static */ void CrashLog::AfterCrashLogCleanup()
{
if (MusicDriver::GetInstance() != NULL) MusicDriver::GetInstance()->Stop();
if (SoundDriver::GetInstance() != NULL) SoundDriver::GetInstance()->Stop();
if (VideoDriver::GetInstance() != NULL) VideoDriver::GetInstance()->Stop();
if (_music_driver != NULL) _music_driver->Stop();
if (_sound_driver != NULL) _sound_driver->Stop();
if (_video_driver != NULL) _video_driver->Stop();
}

View File

@@ -144,14 +144,14 @@ void CheckSwitchToEuro()
* Will fill _currency_specs array with
* default values from origin_currency_specs
* Called only from newgrf.cpp and settings.cpp.
* @param preserve_custom will not reset custom currency
* @param preserve_custom will not reset custom currency (the latest one on the list)
* if ever it is flagged to true. In which case, the total size of the memory to move
* will be one currency spec less, thus preserving the custom currency from been
* overwritten.
*/
void ResetCurrencies(bool preserve_custom)
{
for (uint i = 0; i < CURRENCY_END; i++) {
if (preserve_custom && i == CURRENCY_CUSTOM) continue;
_currency_specs[i] = origin_currency_specs[i];
}
memcpy(&_currency_specs, &origin_currency_specs, sizeof(origin_currency_specs) - (preserve_custom ? sizeof(_custom_currency) : 0));
}
/**

View File

@@ -73,7 +73,7 @@ struct SetDateWindow : Window {
case WID_SD_DAY:
for (uint i = 0; i < 31; i++) {
*list->Append() = new DropDownListStringItem(STR_DAY_NUMBER_1ST + i, i + 1, false);
*list->Append() = new DropDownListStringItem(STR_ORDINAL_NUMBER_1ST + i, i + 1, false);
}
selected = this->date.day;
break;
@@ -106,7 +106,7 @@ struct SetDateWindow : Window {
case WID_SD_DAY:
for (uint i = 0; i < 31; i++) {
d = maxdim(d, GetStringBoundingBox(STR_DAY_NUMBER_1ST + i));
d = maxdim(d, GetStringBoundingBox(STR_ORDINAL_NUMBER_1ST + i));
}
break;
@@ -130,7 +130,7 @@ struct SetDateWindow : Window {
virtual void SetStringParameters(int widget) const
{
switch (widget) {
case WID_SD_DAY: SetDParam(0, this->date.day - 1 + STR_DAY_NUMBER_1ST); break;
case WID_SD_DAY: SetDParam(0, this->date.day - 1 + STR_ORDINAL_NUMBER_1ST); break;
case WID_SD_MONTH: SetDParam(0, this->date.month + STR_MONTH_JAN); break;
case WID_SD_YEAR: SetDParam(0, this->date.year); break;
}

View File

@@ -12,8 +12,6 @@
#ifndef DEBUG_H
#define DEBUG_H
#include "cpu.h"
/* Debugging messages policy:
* These should be the severities used for direct DEBUG() calls
* maximum debugging level should be 10 if really deep, deep
@@ -67,6 +65,12 @@ const char *GetDebugString();
/* Shorter form for passing filename and linenumber */
#define FILE_LINE __FILE__, __LINE__
/**
* Get the tick counter from the CPU (high precision timing).
* @return The count.
*/
uint64 ottd_rdtsc();
/* Used for profiling
*
* Usage:

View File

@@ -41,13 +41,13 @@ void CcBuildDocks(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p
{
if (result.Failed()) return;
if (_settings_client.sound.confirm) SndPlayTileFx(SND_02_SPLAT_WATER, tile);
if (_settings_client.sound.confirm) SndPlayTileFx(SND_02_SPLAT, tile);
if (!_settings_client.gui.persistent_buildingtools) ResetObjectToPlace();
}
void CcBuildCanal(const CommandCost &result, TileIndex tile, uint32 p1, uint32 p2)
{
if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_02_SPLAT_WATER, tile);
if (result.Succeeded() && _settings_client.sound.confirm) SndPlayTileFx(SND_02_SPLAT, tile);
}

View File

@@ -16,14 +16,17 @@
#include "video/video_driver.hpp"
#include "string_func.h"
VideoDriver *_video_driver; ///< The currently active video driver.
char *_ini_videodriver; ///< The video driver a stored in the configuration file.
int _num_resolutions; ///< The number of resolutions.
Dimension _resolutions[32]; ///< List of resolutions.
Dimension _cur_resolution; ///< The current resolution.
bool _rightclick_emulate; ///< Whether right clicking is emulated.
SoundDriver *_sound_driver; ///< The currently active sound driver.
char *_ini_sounddriver; ///< The sound driver a stored in the configuration file.
MusicDriver *_music_driver; ///< The currently active music driver.
char *_ini_musicdriver; ///< The music driver a stored in the configuration file.
char *_ini_blitter; ///< The blitter as stored in the configuration file.
@@ -83,25 +86,9 @@ int GetDriverParamInt(const char * const *parm, const char *name, int def)
* @param type the type of driver to select
* @post Sets the driver so GetCurrentDriver() returns it too.
*/
void DriverFactoryBase::SelectDriver(const char *name, Driver::Type type)
Driver *DriverFactoryBase::SelectDriver(const char *name, Driver::Type type)
{
if (!DriverFactoryBase::SelectDriverImpl(name, type)) {
StrEmpty(name) ?
usererror("Failed to autoprobe %s driver", GetDriverTypeName(type)) :
usererror("Failed to select requested %s driver '%s'", GetDriverTypeName(type), name);
}
}
/**
* Find the requested driver and return its class.
* @param name the driver to select.
* @param type the type of driver to select
* @post Sets the driver so GetCurrentDriver() returns it too.
* @return True upon success, otherwise false.
*/
bool DriverFactoryBase::SelectDriverImpl(const char *name, Driver::Type type)
{
if (GetDrivers().size() == 0) return false;
if (GetDrivers().size() == 0) return NULL;
if (StrEmpty(name)) {
/* Probe for this driver, but do not fall back to dedicated/null! */
@@ -114,18 +101,15 @@ bool DriverFactoryBase::SelectDriverImpl(const char *name, Driver::Type type)
if (d->type != type) continue;
if (d->priority != priority) continue;
Driver *oldd = *GetActiveDriver(type);
Driver *newd = d->CreateInstance();
*GetActiveDriver(type) = newd;
const char *err = newd->Start(NULL);
if (err == NULL) {
DEBUG(driver, 1, "Successfully probed %s driver '%s'", GetDriverTypeName(type), d->name);
delete oldd;
return true;
delete *GetActiveDriver(type);
*GetActiveDriver(type) = newd;
return newd;
}
*GetActiveDriver(type) = oldd;
DEBUG(driver, 1, "Probing %s driver '%s' failed with error: %s", GetDriverTypeName(type), d->name, err);
delete newd;
}
@@ -174,7 +158,7 @@ bool DriverFactoryBase::SelectDriverImpl(const char *name, Driver::Type type)
DEBUG(driver, 1, "Successfully loaded %s driver '%s'", GetDriverTypeName(type), d->name);
delete *GetActiveDriver(type);
*GetActiveDriver(type) = newd;
return true;
return newd;
}
usererror("No such %s driver: %s\n", GetDriverTypeName(type), buffer);
}

View File

@@ -59,10 +59,6 @@ DECLARE_POSTFIX_INCREMENT(Driver::Type)
/** Base for all driver factories. */
class DriverFactoryBase {
private:
friend class MusicDriver;
friend class SoundDriver;
friend class VideoDriver;
Driver::Type type; ///< The type of driver.
int priority; ///< The priority of this factory.
const char *name; ///< The name of the drivers of this factory.
@@ -101,8 +97,6 @@ private:
return driver_type_name[type];
}
static bool SelectDriverImpl(const char *name, Driver::Type type);
protected:
DriverFactoryBase(Driver::Type type, int priority, const char *name, const char *description);
@@ -120,7 +114,7 @@ public:
}
}
static void SelectDriver(const char *name, Driver::Type type);
static Driver *SelectDriver(const char *name, Driver::Type type);
static char *GetDriversInfo(char *p, const char *last);
/**

View File

@@ -19,7 +19,6 @@
#include "network/network_func.h"
#include "ai/ai.hpp"
#include "aircraft.h"
#include "train.h"
#include "newgrf_engine.h"
#include "engine_base.h"
#include "ground_vehicle.hpp"
@@ -1067,9 +1066,9 @@ static Money DeliverGoods(int num_pieces, CargoID cargo_type, StationID dest, Ti
/* Update station statistics */
if (accepted > 0) {
SetBit(st->goods[cargo_type].status, GoodsEntry::GES_EVER_ACCEPTED);
SetBit(st->goods[cargo_type].status, GoodsEntry::GES_CURRENT_MONTH);
SetBit(st->goods[cargo_type].status, GoodsEntry::GES_ACCEPTED_BIGTICK);
SetBit(st->goods[cargo_type].acceptance_pickup, GoodsEntry::GES_EVER_ACCEPTED);
SetBit(st->goods[cargo_type].acceptance_pickup, GoodsEntry::GES_CURRENT_MONTH);
SetBit(st->goods[cargo_type].acceptance_pickup, GoodsEntry::GES_ACCEPTED_BIGTICK);
}
/* Update company statistics */
@@ -1241,7 +1240,7 @@ void PrepareUnload(Vehicle *front_v)
const GoodsEntry *ge = &st->goods[v->cargo_type];
if (v->cargo_cap > 0 && v->cargo.TotalCount() > 0) {
v->cargo.Stage(
HasBit(ge->status, GoodsEntry::GES_ACCEPTANCE),
HasBit(ge->acceptance_pickup, GoodsEntry::GES_ACCEPTANCE),
front_v->last_station_visited, next_station,
front_v->current_order.GetUnloadType(), ge,
front_v->cargo_payment);
@@ -1339,192 +1338,21 @@ static void ReserveConsist(Station *st, Vehicle *u, CargoArray *consist_capleft,
}
/**
* Iterate the articulated parts of a vehicle, also considering the special cases of "normal"
* aircraft and double headed trains. Apply an action to each vehicle and immediately return false
* if that action does so. Otherwise return true.
* @tparam Taction Class of action to be applied. Must implement bool operator()([const] Vehicle *).
* @param v First articulated part.
* @param action Instance of Taction.
* @return false if any of the action invocations returned false, true otherwise.
* Checks whether an articulated vehicle is empty.
* @param v Vehicle
* @return true if all parts are empty.
*/
template<class Taction>
bool IterateVehicleParts(Vehicle *v, Taction action)
static bool IsArticulatedVehicleEmpty(Vehicle *v)
{
for (Vehicle *w = v; w != NULL;
w = w->HasArticulatedPart() ? w->GetNextArticulatedPart() : NULL) {
if (!action(w)) return false;
if (w->type == VEH_TRAIN) {
Train *train = Train::From(w);
if (train->IsMultiheaded() && !action(train->other_multiheaded_part)) return false;
}
v = v->GetFirstEnginePart();
for (; v != NULL; v = v->HasArticulatedPart() ? v->GetNextArticulatedPart() : NULL) {
if (v->cargo.TotalCount() != 0) return false;
}
if (v->type == VEH_AIRCRAFT && Aircraft::From(v)->IsNormalAircraft()) return action(v->Next());
return true;
}
/**
* Action to check if a vehicle has no stored cargo.
*/
struct IsEmptyAction
{
/**
* Checks if the vehicle has stored cargo.
* @param v Vehicle to be checked.
* @return true if v is either empty or has only reserved cargo, false otherwise.
*/
bool operator()(const Vehicle *v)
{
return v->cargo.StoredCount() == 0;
}
};
/**
* Refit preparation action.
*/
struct PrepareRefitAction
{
CargoArray &consist_capleft; ///< Capacities left in the consist.
uint32 &refit_mask; ///< Bitmask of possible refit cargoes.
/**
* Create a refit preparation action.
* @param consist_capleft Capacities left in consist, to be updated here.
* @param refit_mask Refit mask to be constructed from refit information of vehicles.
*/
PrepareRefitAction(CargoArray &consist_capleft, uint32 &refit_mask) :
consist_capleft(consist_capleft), refit_mask(refit_mask) {}
/**
* Prepares for refitting of a vehicle, subtracting its free capacity from consist_capleft and
* adding the cargoes it can refit to to the refit mask.
* @param v The vehicle to be refitted.
* @return true.
*/
bool operator()(const Vehicle *v)
{
this->consist_capleft[v->cargo_type] -= v->cargo_cap - v->cargo.ReservedCount();
this->refit_mask |= EngInfo(v->engine_type)->refit_mask;
return true;
}
};
/**
* Action for returning reserved cargo.
*/
struct ReturnCargoAction
{
Station *st; ///< Station to give the returned cargo to.
StationID next_hop; ///< Next hop the cargo should be assigned to.
/**
* Construct a cargo return action.
* @param st Station to give the returned cargo to.
* @param next_one Next hop the cargo should be assigned to.
*/
ReturnCargoAction(Station *st, StationID next_one) : st(st), next_hop(next_one) {}
/**
* Return all reserved cargo from a vehicle.
* @param v Vehicle to return cargo from.
* @return true.
*/
bool operator()(Vehicle *v)
{
v->cargo.Return(UINT_MAX, &this->st->goods[v->cargo_type].cargo, this->next_hop);
return true;
}
};
/**
* Action for finalizing a refit.
*/
struct FinalizeRefitAction
{
CargoArray &consist_capleft; ///< Capacities left in the consist.
Station *st; ///< Station to reserve cargo from.
StationIDStack &next_station; ///< Next hops to reserve cargo for.
/**
* Create a finalizing action.
* @param consist_capleft Capacities left in the consist.
* @param st Station to reserve cargo from.
* @param next_station Next hops to reserve cargo for.
*/
FinalizeRefitAction(CargoArray &consist_capleft, Station *st, StationIDStack &next_station) :
consist_capleft(consist_capleft), st(st), next_station(next_station) {}
/**
* Reserve cargo from the station and update the remaining consist capacities with the
* vehicle's remaining free capacity.
* @param v Vehicle to be finalized.
* @return true.
*/
bool operator()(Vehicle *v)
{
this->st->goods[v->cargo_type].cargo.Reserve(v->cargo_cap - v->cargo.RemainingCount(),
&v->cargo, st->xy, next_station);
this->consist_capleft[v->cargo_type] += v->cargo_cap - v->cargo.RemainingCount();
return true;
}
};
/**
* Refit a vehicle in a station.
* @param v Vehicle to be refitted.
* @param consist_capleft Added cargo capacities in the consist.
* @param st Station the vehicle is loading at.
* @param next_station Possible next stations the vehicle can travel to.
* @param new_cid Target cargo for refit.
*/
static void HandleStationRefit(Vehicle *v, CargoArray &consist_capleft, Station *st, StationIDStack next_station, CargoID new_cid)
{
Vehicle *v_start = v->GetFirstEnginePart();
if (!IterateVehicleParts(v_start, IsEmptyAction())) return;
Backup<CompanyByte> cur_company(_current_company, v->owner, FILE_LINE);
uint32 refit_mask = v->GetEngine()->info.refit_mask;
/* Remove old capacity from consist capacity and collect refit mask. */
IterateVehicleParts(v_start, PrepareRefitAction(consist_capleft, refit_mask));
if (new_cid == CT_AUTO_REFIT) {
/* Get a refittable cargo type with waiting cargo for next_station or INVALID_STATION. */
CargoID cid;
new_cid = v_start->cargo_type;
FOR_EACH_SET_CARGO_ID(cid, refit_mask) {
if (st->goods[cid].cargo.HasCargoFor(next_station)) {
/* Try to find out if auto-refitting would succeed. In case the refit is allowed,
* the returned refit capacity will be greater than zero. */
DoCommand(v_start->tile, v_start->index, cid | 1U << 6 | 0xFF << 8 | 1U << 16, DC_QUERY_COST, GetCmdRefitVeh(v_start)); // Auto-refit and only this vehicle including artic parts.
/* Try to balance different loadable cargoes between parts of the consist, so that
* all of them can be loaded. Avoid a situation where all vehicles suddenly switch
* to the first loadable cargo for which there is only one packet. If the capacities
* are equal refit to the cargo of which most is available. This is important for
* consists of only a single vehicle as those will generally have a consist_capleft
* of 0 for all cargoes. */
if (_returned_refit_capacity > 0 && (consist_capleft[cid] < consist_capleft[new_cid] ||
(consist_capleft[cid] == consist_capleft[new_cid] &&
st->goods[cid].cargo.AvailableCount() > st->goods[new_cid].cargo.AvailableCount()))) {
new_cid = cid;
}
}
}
}
/* Refit if given a valid cargo. */
if (new_cid < NUM_CARGO && new_cid != v_start->cargo_type) {
IterateVehicleParts(v_start, ReturnCargoAction(st, StationIDStack(next_station).Pop()));
CommandCost cost = DoCommand(v_start->tile, v_start->index, new_cid | 1U << 6 | 0xFF << 8 | 1U << 16, DC_EXEC, GetCmdRefitVeh(v_start)); // Auto-refit and only this vehicle including artic parts.
if (cost.Succeeded()) v->First()->profit_this_year -= cost.GetCost() << 8;
}
/* Add new capacity to consist capacity and reserve cargo */
IterateVehicleParts(v_start, FinalizeRefitAction(consist_capleft, st, next_station));
cur_company.Restore();
}
/**
* Loads/unload the vehicle if possible.
* @param front the vehicle to be (un)loaded
@@ -1590,12 +1418,12 @@ static void LoadUnloadVehicle(Vehicle *front)
payment->SetCargo(v->cargo_type);
if (!HasBit(ge->status, GoodsEntry::GES_ACCEPTANCE) && v->cargo.ActionCount(VehicleCargoList::MTA_DELIVER) > 0) {
if (!HasBit(ge->acceptance_pickup, GoodsEntry::GES_ACCEPTANCE) && v->cargo.ActionCount(VehicleCargoList::MTA_DELIVER) > 0) {
/* The station does not accept our goods anymore. */
if (front->current_order.GetUnloadType() & (OUFB_TRANSFER | OUFB_UNLOAD)) {
/* Transfer instead of delivering. */
v->cargo.Reassign<VehicleCargoList::MTA_DELIVER, VehicleCargoList::MTA_TRANSFER>(
v->cargo.ActionCount(VehicleCargoList::MTA_DELIVER), INVALID_STATION);
v->cargo.Reassign(v->cargo.ActionCount(VehicleCargoList::MTA_DELIVER),
VehicleCargoList::MTA_DELIVER, VehicleCargoList::MTA_TRANSFER);
} else {
uint new_remaining = v->cargo.RemainingCount() + v->cargo.ActionCount(VehicleCargoList::MTA_DELIVER);
if (v->cargo_cap < new_remaining) {
@@ -1604,8 +1432,8 @@ static void LoadUnloadVehicle(Vehicle *front)
}
/* Keep instead of delivering. This may lead to no cargo being unloaded, so ...*/
v->cargo.Reassign<VehicleCargoList::MTA_DELIVER, VehicleCargoList::MTA_KEEP>(
v->cargo.ActionCount(VehicleCargoList::MTA_DELIVER));
v->cargo.Reassign(v->cargo.ActionCount(VehicleCargoList::MTA_DELIVER),
VehicleCargoList::MTA_DELIVER, VehicleCargoList::MTA_KEEP);
/* ... say we unloaded something, otherwise we'll think we didn't unload
* something and we didn't load something, so we must be finished
@@ -1615,18 +1443,8 @@ static void LoadUnloadVehicle(Vehicle *front)
}
}
if (v->cargo.ActionCount(VehicleCargoList::MTA_TRANSFER) > 0) {
/* Mark the station dirty if we transfer, but not if we only deliver. */
dirty_station = true;
if (!ge->HasRating()) {
/* Upon transfering cargo, make sure the station has a rating. Fake a pickup for the
* first unload to prevent the cargo from quickly decaying after the initial drop. */
ge->time_since_pickup = 0;
SetBit(ge->status, GoodsEntry::GES_RATING);
}
}
/* Mark the station dirty if we transfer, but not if we only deliver. */
dirty_station = v->cargo.ActionCount(VehicleCargoList::MTA_TRANSFER) > 0;
amount_unloaded = v->cargo.Unload(amount_unloaded, &ge->cargo, payment);
remaining = v->cargo.UnloadCount() > 0;
if (amount_unloaded > 0) {
@@ -1652,9 +1470,64 @@ static void LoadUnloadVehicle(Vehicle *front)
if (front->current_order.GetLoadType() & OLFB_NO_LOAD || HasBit(front->vehicle_flags, VF_STOP_LOADING)) continue;
/* This order has a refit, if this is the first vehicle part carrying cargo and the whole vehicle is empty, try refitting. */
if (front->current_order.IsRefit() && artic_part == 1) {
HandleStationRefit(v, consist_capleft, st, next_station, front->current_order.GetRefitCargo());
ge = &st->goods[v->cargo_type];
if (front->current_order.IsRefit() && artic_part == 1 && IsArticulatedVehicleEmpty(v) &&
(v->type != VEH_AIRCRAFT || (Aircraft::From(v)->IsNormalAircraft() && v->Next()->cargo.TotalCount() == 0))) {
Vehicle *v_start = v->GetFirstEnginePart();
CargoID new_cid = front->current_order.GetRefitCargo();
/* Remove old capacity from consist capacity */
consist_capleft[v_start->cargo_type] -= v_start->cargo_cap;
for (Vehicle *w = v_start; w->HasArticulatedPart(); ) {
w = w->GetNextArticulatedPart();
consist_capleft[w->cargo_type] -= w->cargo_cap;
}
Backup<CompanyByte> cur_company(_current_company, front->owner, FILE_LINE);
/* Check if all articulated parts are empty and collect refit mask. */
uint32 refit_mask = v->GetEngine()->info.refit_mask;
Vehicle *w = v_start;
while (w->HasArticulatedPart()) {
w = w->GetNextArticulatedPart();
if (w->cargo.TotalCount() > 0) new_cid = CT_NO_REFIT;
refit_mask |= EngInfo(w->engine_type)->refit_mask;
}
if (new_cid == CT_AUTO_REFIT) {
/* Get a refittable cargo type with waiting cargo for next_station or INVALID_STATION. */
CargoID cid;
new_cid = v_start->cargo_type;
FOR_EACH_SET_CARGO_ID(cid, refit_mask) {
if (st->goods[cid].cargo.HasCargoFor(next_station)) {
/* Try to find out if auto-refitting would succeed. In case the refit is allowed,
* the returned refit capacity will be greater than zero. */
DoCommand(v_start->tile, v_start->index, cid | 1U << 6 | 0xFF << 8 | 1U << 16, DC_QUERY_COST, GetCmdRefitVeh(v_start)); // Auto-refit and only this vehicle including artic parts.
/* Try to balance different loadable cargoes between parts of the consist, so that
* all of them can be loaded. Avoid a situation where all vehicles suddenly switch
* to the first loadable cargo for which there is only one packet. */
if (_returned_refit_capacity > 0 && consist_capleft[cid] < consist_capleft[new_cid]) {
new_cid = cid;
}
}
}
}
/* Refit if given a valid cargo. */
if (new_cid < NUM_CARGO && new_cid != v_start->cargo_type) {
CommandCost cost = DoCommand(v_start->tile, v_start->index, new_cid | 1U << 6 | 0xFF << 8 | 1U << 16, DC_EXEC, GetCmdRefitVeh(v_start)); // Auto-refit and only this vehicle including artic parts.
if (cost.Succeeded()) front->profit_this_year -= cost.GetCost() << 8;
ge = &st->goods[v->cargo_type];
}
/* Add new capacity to consist capacity and reserve cargo */
w = v_start;
do {
st->goods[w->cargo_type].cargo.Reserve(w->cargo_cap, &w->cargo, st->xy, next_station);
consist_capleft[w->cargo_type] += w->cargo_cap - w->cargo.RemainingCount();
w = w->HasArticulatedPart() ? w->GetNextArticulatedPart() : NULL;
} while (w != NULL);
cur_company.Restore();
}
/* As we're loading here the following link can carry the full capacity of the vehicle. */
@@ -1835,7 +1708,6 @@ static void LoadUnloadVehicle(Vehicle *front)
if (dirty_station) {
st->MarkTilesDirty(true);
SetWindowDirty(WC_STATION_VIEW, last_visited);
InvalidateWindowData(WC_STATION_LIST, last_visited);
}
}

View File

@@ -627,7 +627,7 @@ bool SettingsDisableElrail(int32 p1)
FOR_ALL_TRAINS(t) {
/* power and acceleration is cached only for front engines */
if (t->IsFrontEngine()) {
t->ConsistChanged(CCF_TRACK);
t->ConsistChanged(true);
}
}

View File

@@ -16,8 +16,6 @@
#include "company_type.h"
#include "core/geometry_type.hpp"
struct GRFFile;
/** Message severity/type */
enum WarningLevel {
WL_INFO, ///< Used for DoCommand-like (and some non-fatal AI GUI) errors/information
@@ -32,7 +30,6 @@ protected:
uint duration; ///< Length of display of the message. 0 means forever,
uint64 decode_params[20]; ///< Parameters of the message strings.
const char *strings[20]; ///< Copies of raw strings that were used.
const GRFFile *textref_stack_grffile; ///< NewGRF that filled the #TextRefStack for the error message.
uint textref_stack_size; ///< Number of uint32 values to put on the #TextRefStack for the error message.
uint32 textref_stack[16]; ///< Values to put on the #TextRefStack for the error message.
StringID summary_msg; ///< General error message showed in first line. Must be valid.
@@ -43,7 +40,7 @@ protected:
public:
ErrorMessageData(const ErrorMessageData &data);
~ErrorMessageData();
ErrorMessageData(StringID summary_msg, StringID detailed_msg, uint duration = 0, int x = 0, int y = 0, const GRFFile *textref_stack_grffile = NULL, uint textref_stack_size = 0, const uint32 *textref_stack = NULL);
ErrorMessageData(StringID summary_msg, StringID detailed_msg, uint duration = 0, int x = 0, int y = 0, uint textref_stack_size = 0, const uint32 *textref_stack = NULL);
/** Check whether error window shall display a company manager face */
bool HasFace() const { return face != INVALID_COMPANY; }
@@ -56,7 +53,7 @@ public:
void ScheduleErrorMessage(const ErrorMessageData &data);
void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, WarningLevel wl, int x = 0, int y = 0, const GRFFile *textref_stack_grffile = NULL, uint textref_stack_size = 0, const uint32 *textref_stack = NULL);
void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, WarningLevel wl, int x = 0, int y = 0, uint textref_stack_size = 0, const uint32 *textref_stack = NULL);
void ClearErrorMessages();
void ShowFirstError();
void UnshowCriticalError();

View File

@@ -94,13 +94,11 @@ ErrorMessageData::~ErrorMessageData()
* @param duration The amount of time to show this error message.
* @param x World X position (TileVirtX) of the error location. Set both x and y to 0 to just center the message when there is no related error tile.
* @param y World Y position (TileVirtY) of the error location. Set both x and y to 0 to just center the message when there is no related error tile.
* @param textref_stack_grffile NewGRF that provides the #TextRefStack for the error message.
* @param textref_stack_size Number of uint32 values to put on the #TextRefStack for the error message; 0 if the #TextRefStack shall not be used.
* @param textref_stack Values to put on the #TextRefStack.
*/
ErrorMessageData::ErrorMessageData(StringID summary_msg, StringID detailed_msg, uint duration, int x, int y, const GRFFile *textref_stack_grffile, uint textref_stack_size, const uint32 *textref_stack) :
ErrorMessageData::ErrorMessageData(StringID summary_msg, StringID detailed_msg, uint duration, int x, int y, uint textref_stack_size, const uint32 *textref_stack) :
duration(duration),
textref_stack_grffile(textref_stack_grffile),
textref_stack_size(textref_stack_size),
summary_msg(summary_msg),
detailed_msg(detailed_msg),
@@ -128,7 +126,7 @@ void ErrorMessageData::CopyOutDParams()
memset(this->strings, 0, sizeof(this->strings));
/* Get parameters using type information */
if (this->textref_stack_size > 0) StartTextRefStackUsage(this->textref_stack_grffile, this->textref_stack_size, this->textref_stack);
if (this->textref_stack_size > 0) StartTextRefStackUsage(this->textref_stack_size, this->textref_stack);
CopyOutDParam(this->decode_params, this->strings, this->detailed_msg == INVALID_STRING_ID ? this->summary_msg : this->detailed_msg, lengthof(this->decode_params));
if (this->textref_stack_size > 0) StopTextRefStackUsage();
@@ -183,7 +181,7 @@ public:
if (widget != WID_EM_MESSAGE) return;
CopyInDParam(0, this->decode_params, lengthof(this->decode_params));
if (this->textref_stack_size > 0) StartTextRefStackUsage(this->textref_stack_grffile, this->textref_stack_size, this->textref_stack);
if (this->textref_stack_size > 0) StartTextRefStackUsage(this->textref_stack_size, this->textref_stack);
int text_width = max(0, (int)size->width - WD_FRAMETEXT_LEFT - WD_FRAMETEXT_RIGHT);
this->height_summary = GetStringHeight(this->summary_msg, text_width);
@@ -255,7 +253,7 @@ public:
case WID_EM_MESSAGE:
CopyInDParam(0, this->decode_params, lengthof(this->decode_params));
if (this->textref_stack_size > 0) StartTextRefStackUsage(this->textref_stack_grffile, this->textref_stack_size, this->textref_stack);
if (this->textref_stack_size > 0) StartTextRefStackUsage(this->textref_stack_size, this->textref_stack);
if (this->detailed_msg == INVALID_STRING_ID) {
DrawStringMultiLine(r.left + WD_FRAMETEXT_LEFT, r.right - WD_FRAMETEXT_RIGHT, r.top + WD_FRAMERECT_TOP, r.bottom - WD_FRAMERECT_BOTTOM,
@@ -360,20 +358,19 @@ void UnshowCriticalError()
* @param wl Message severity.
* @param x World X position (TileVirtX) of the error location. Set both x and y to 0 to just center the message when there is no related error tile.
* @param y World Y position (TileVirtY) of the error location. Set both x and y to 0 to just center the message when there is no related error tile.
* @param textref_stack_grffile NewGRF providing the #TextRefStack for the error message.
* @param textref_stack_size Number of uint32 values to put on the #TextRefStack for the error message; 0 if the #TextRefStack shall not be used.
* @param textref_stack Values to put on the #TextRefStack.
*/
void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, WarningLevel wl, int x, int y, const GRFFile *textref_stack_grffile, uint textref_stack_size, const uint32 *textref_stack)
void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, WarningLevel wl, int x, int y, uint textref_stack_size, const uint32 *textref_stack)
{
assert(textref_stack_size == 0 || (textref_stack_grffile != NULL && textref_stack != NULL));
assert(textref_stack_size == 0 || textref_stack != NULL);
if (summary_msg == STR_NULL) summary_msg = STR_EMPTY;
if (wl != WL_INFO) {
/* Print message to console */
char buf[DRAW_STRING_BUFFER];
if (textref_stack_size > 0) StartTextRefStackUsage(textref_stack_grffile, textref_stack_size, textref_stack);
if (textref_stack_size > 0) StartTextRefStackUsage(textref_stack_size, textref_stack);
char *b = GetString(buf, summary_msg, lastof(buf));
if (detailed_msg != INVALID_STRING_ID) {
@@ -393,7 +390,7 @@ void ShowErrorMessage(StringID summary_msg, StringID detailed_msg, WarningLevel
if (_settings_client.gui.errmsg_duration == 0 && !no_timeout) return;
ErrorMessageData data(summary_msg, detailed_msg, no_timeout ? 0 : _settings_client.gui.errmsg_duration, x, y, textref_stack_grffile, textref_stack_size, textref_stack);
ErrorMessageData data(summary_msg, detailed_msg, no_timeout ? 0 : _settings_client.gui.errmsg_duration, x, y, textref_stack_size, textref_stack);
data.CopyOutDParams();
ErrmsgWindow *w = (ErrmsgWindow*)FindWindowById(WC_ERRMSG, 0);

View File

@@ -849,38 +849,29 @@ bool TarScanner::AddFile(const char *filename, size_t basepath_length, const cha
char *pos = link;
while (*pos != '\0') {
char *next = strchr(pos, PATHSEPCHAR);
if (next == NULL) {
next = pos + strlen(pos);
} else {
/* Terminate the substring up to the path separator character. */
*next++= '\0';
}
char *next = strchr(link, PATHSEPCHAR);
if (next == NULL) next = pos + strlen(pos);
if (strcmp(pos, ".") == 0) {
/* Skip '.' (current dir) */
} else if (strcmp(pos, "..") == 0) {
/* level up */
if (dest[0] == '\0') {
DEBUG(misc, 1, "Ignoring link pointing outside of data directory: %s -> %s", name, link);
break;
/* Skip '.' (current dir) */
if (next != pos + 1 || pos[0] != '.') {
if (next == pos + 2 && pos[0] == '.' && pos[1] == '.') {
/* level up */
if (dest[0] == '\0') {
DEBUG(misc, 1, "Ignoring link pointing outside of data directory: %s -> %s", name, link);
break;
}
/* Truncate 'dest' after last PATHSEPCHAR.
* This assumes that the truncated part is a real directory and not a link. */
destpos = strrchr(dest, PATHSEPCHAR);
if (destpos == NULL) destpos = dest;
} else {
/* Append at end of 'dest' */
if (destpos != dest) *(destpos++) = PATHSEPCHAR;
strncpy(destpos, pos, next - pos); // Safe as we do '\0'-termination ourselves
destpos += next - pos;
}
/* Truncate 'dest' after last PATHSEPCHAR.
* This assumes that the truncated part is a real directory and not a link. */
destpos = strrchr(dest, PATHSEPCHAR);
if (destpos == NULL) destpos = dest;
*destpos = '\0';
} else {
/* Append at end of 'dest' */
if (destpos != dest) destpos = strecpy(destpos, PATHSEP, lastof(dest));
destpos = strecpy(destpos, pos, lastof(dest));
}
if (destpos >= lastof(dest)) {
DEBUG(misc, 0, "The length of a link in tar-file '%s' is too large (malformed?)", filename);
fclose(f);
return false;
}
pos = next;

View File

@@ -400,10 +400,6 @@ FiosType FiosGetSavegameListCallback(SaveLoadDialogMode mode, const char *file,
* .SS1 Transport Tycoon Deluxe preset game
* .SV1 Transport Tycoon Deluxe (Patch) saved game
* .SV2 Transport Tycoon Deluxe (Patch) saved 2-player game */
/* Don't crash if we supply no extension */
if (ext == NULL) return FIOS_TYPE_INVALID;
if (strcasecmp(ext, ".sav") == 0) {
GetFileTitle(file, title, last, SAVE_DIR);
return FIOS_TYPE_FILE;

View File

@@ -133,11 +133,9 @@ static const NWidgetPart _nested_load_heightmap_dialog_widgets[] = {
SetDataTip(0x0, STR_SAVELOAD_LIST_TOOLTIP), SetResize(1, 10), SetScrollbar(WID_SL_SCROLLBAR), EndContainer(),
NWidget(NWID_VSCROLLBAR, COLOUR_GREY, WID_SL_SCROLLBAR),
EndContainer(),
NWidget(NWID_HORIZONTAL, NC_EQUALSIZE),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_CONTENT_DOWNLOAD), SetResize(1, 0), SetFill(1, 0),
NWidget(NWID_HORIZONTAL),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_CONTENT_DOWNLOAD), SetResize(1, 0),
SetDataTip(STR_INTRO_ONLINE_CONTENT, STR_INTRO_TOOLTIP_ONLINE_CONTENT),
NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, WID_SL_LOAD_BUTTON), SetResize(1, 0), SetFill(1, 0),
SetDataTip(STR_SAVELOAD_LOAD_BUTTON, STR_SAVELOAD_LOAD_HEIGHTMAP_TOOLTIP),
NWidget(WWT_RESIZEBOX, COLOUR_GREY),
EndContainer(),
EndContainer(),
@@ -523,21 +521,16 @@ public:
break;
case WID_SL_LOAD_BUTTON:
if (this->selected != NULL && !_load_check_data.HasErrors()) {
if (this->selected != NULL && !_load_check_data.HasErrors() && (_load_check_data.grf_compatibility != GLC_NOT_FOUND || _settings_client.gui.UserIsAllowedToChangeNewGRFs())) {
_switch_mode = (_game_mode == GM_EDITOR) ? SM_LOAD_SCENARIO : SM_LOAD_GAME;
const char *name = FiosBrowseTo(this->selected);
SetFiosType(this->selected->type);
strecpy(_file_to_saveload.name, name, lastof(_file_to_saveload.name));
strecpy(_file_to_saveload.title, this->selected->title, lastof(_file_to_saveload.title));
if (_saveload_mode == SLD_LOAD_HEIGHTMAP) {
delete this;
ShowHeightmapLoad();
} else if (!_load_check_data.HasNewGrfs() || _load_check_data.grf_compatibility != GLC_NOT_FOUND || _settings_client.gui.UserIsAllowedToChangeNewGRFs()) {
_switch_mode = (_game_mode == GM_EDITOR) ? SM_LOAD_SCENARIO : SM_LOAD_GAME;
ClearErrorMessages();
delete this;
}
ClearErrorMessages();
delete this;
}
break;
@@ -550,7 +543,7 @@ public:
case WID_SL_MISSING_NEWGRFS:
if (!_network_available) {
ShowErrorMessage(STR_NETWORK_ERROR_NOTAVAILABLE, INVALID_STRING_ID, WL_ERROR);
} else if (_load_check_data.HasNewGrfs()) {
} else {
#if defined(ENABLE_NETWORK)
ShowMissingContentWindow(_load_check_data.grfconfig);
#endif
@@ -686,12 +679,9 @@ public:
case 1:
/* Selection changes */
if (!gui_scope) break;
if (_saveload_mode == SLD_LOAD_HEIGHTMAP) {
this->SetWidgetDisabledState(WID_SL_LOAD_BUTTON, this->selected == NULL || _load_check_data.HasErrors());
}
if (_saveload_mode == SLD_LOAD_GAME || _saveload_mode == SLD_LOAD_SCENARIO) {
this->SetWidgetDisabledState(WID_SL_LOAD_BUTTON,
this->selected == NULL || _load_check_data.HasErrors() || !(!_load_check_data.HasNewGrfs() || _load_check_data.grf_compatibility != GLC_NOT_FOUND || _settings_client.gui.UserIsAllowedToChangeNewGRFs()));
this->selected == NULL || _load_check_data.HasErrors() || !(_load_check_data.grf_compatibility != GLC_NOT_FOUND || _settings_client.gui.UserIsAllowedToChangeNewGRFs()));
this->SetWidgetDisabledState(WID_SL_NEWGRF_INFO,
!_load_check_data.HasNewGrfs());
this->SetWidgetDisabledState(WID_SL_MISSING_NEWGRFS,

View File

@@ -274,35 +274,23 @@ FreeTypeFontCache::FreeTypeFontCache(FontSize fs, FT_Face face, int pixels) : Fo
}
FT_Error err = FT_Set_Pixel_Sizes(this->face, 0, pixels);
if (err != FT_Err_Ok) {
if (err == FT_Err_Invalid_Pixel_Size) {
/* Find nearest size to that requested */
FT_Bitmap_Size *bs = this->face->available_sizes;
int i = this->face->num_fixed_sizes;
if (i > 0) { // In pathetic cases one might get no fixed sizes at all.
int n = bs->height;
FT_Int chosen = 0;
for (; --i; bs++) {
if (abs(pixels - bs->height) >= abs(pixels - n)) continue;
n = bs->height;
chosen = this->face->num_fixed_sizes - i;
}
/* Don't use FT_Set_Pixel_Sizes here - it might give us another
* error, even though the size is available (FS#5885). */
err = FT_Select_Size(this->face, chosen);
int n = bs->height;
for (; --i; bs++) {
if (abs(pixels - bs->height) < abs(pixels - n)) n = bs->height;
}
FT_Set_Pixel_Sizes(this->face, 0, n);
}
if (err == FT_Err_Ok) {
this->units_per_em = this->face->units_per_EM;
this->ascender = this->face->size->metrics.ascender >> 6;
this->descender = this->face->size->metrics.descender >> 6;
this->height = this->ascender - this->descender;
} else {
/* Both FT_Set_Pixel_Sizes and FT_Select_Size failed. */
DEBUG(freetype, 0, "Font size selection failed. Using FontCache defaults.");
}
this->units_per_em = this->face->units_per_EM;
this->ascender = this->face->size->metrics.ascender >> 6;
this->descender = this->face->size->metrics.descender >> 6;
this->height = this->ascender - this->descender;
}
/**
@@ -451,7 +439,7 @@ static void *AllocateFont(size_t size)
static bool GetFontAAState(FontSize size)
{
/* AA is only supported for 32 bpp */
if (BlitterFactory::GetCurrentBlitter()->GetScreenDepth() != 32) return false;
if (BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth() != 32) return false;
switch (size) {
default: NOT_REACHED();
@@ -506,7 +494,7 @@ const Sprite *FreeTypeFontCache::GetGlyph(GlyphID key)
builtin_questionmark_data
};
Sprite *spr = BlitterFactory::GetCurrentBlitter()->Encode(&builtin_questionmark, AllocateFont);
Sprite *spr = BlitterFactoryBase::GetCurrentBlitter()->Encode(&builtin_questionmark, AllocateFont);
assert(spr != NULL);
new_glyph.sprite = spr;
new_glyph.width = spr->width + (this->fs != FS_NORMAL);
@@ -563,7 +551,7 @@ const Sprite *FreeTypeFontCache::GetGlyph(GlyphID key)
}
}
new_glyph.sprite = BlitterFactory::GetCurrentBlitter()->Encode(&sprite, AllocateFont);
new_glyph.sprite = BlitterFactoryBase::GetCurrentBlitter()->Encode(&sprite, AllocateFont);
new_glyph.width = slot->advance.x >> 6;
this->SetGlyphPtr(key, &new_glyph);

View File

@@ -392,7 +392,7 @@ FT_Error GetFontByFaceName(const char *font_name, FT_Face *face)
} else
#endif
{
#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5) && !defined(__LP64__)
#if (MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5) && !__LP64__
/* This type was introduced with the 10.5 SDK. */
#if (MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5)
#define ATSFSSpec FSSpec

View File

@@ -67,8 +67,6 @@
#include "../script/api/game/game_station.hpp.sq"
#include "../script/api/game/game_stationlist.hpp.sq"
#include "../script/api/game/game_story_page.hpp.sq"
#include "../script/api/game/game_storypageelementlist.hpp.sq"
#include "../script/api/game/game_storypagelist.hpp.sq"
#include "../script/api/game/game_subsidy.hpp.sq"
#include "../script/api/game/game_subsidylist.hpp.sq"
#include "../script/api/game/game_testmode.hpp.sq"
@@ -173,8 +171,6 @@ void GameInstance::RegisterAPI()
SQGSStationList_Register(this->engine);
SQGSStationList_Vehicle_Register(this->engine);
SQGSStoryPage_Register(this->engine);
SQGSStoryPageElementList_Register(this->engine);
SQGSStoryPageList_Register(this->engine);
SQGSSubsidy_Register(this->engine);
SQGSSubsidyList_Register(this->engine);
SQGSTestMode_Register(this->engine);

View File

@@ -377,7 +377,7 @@ void ReconsiderGameScriptLanguage()
if (_current_data == NULL) return;
char temp[MAX_PATH];
strecpy(temp, _current_language->file, lastof(temp));
strecpy(temp, _current_language->file, temp + sizeof(temp));
/* Remove the extension */
char *l = strrchr(temp, '.');

View File

@@ -98,15 +98,13 @@ static void _GenerateWorld(void *)
try {
_generating_world = true;
_modal_progress_work_mutex->BeginCritical();
if (_network_dedicated) DEBUG(net, 1, "Generating map, please wait...");
if (_network_dedicated) DEBUG(net, 0, "Generating map, please wait...");
/* Set the Random() seed to generation_seed so we produce the same map with the same seed */
if (_settings_game.game_creation.generation_seed == GENERATE_NEW_SEED) _settings_game.game_creation.generation_seed = _settings_newgame.game_creation.generation_seed = InteractiveRandom();
_random.SetSeed(_settings_game.game_creation.generation_seed);
SetGeneratingWorldProgress(GWP_MAP_INIT, 2);
SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, HT_NONE, WC_MAIN_WINDOW, 0);
BasePersistentStorageArray::SwitchMode(PSM_ENTER_GAMELOOP);
IncreaseGeneratingWorldProgress(GWP_MAP_INIT);
/* Must start economy early because of the costs. */
StartupEconomy();
@@ -143,6 +141,8 @@ static void _GenerateWorld(void *)
}
}
ClearPersistentStorageChanges(true);
/* These are probably pointless when inside the scenario editor. */
SetGeneratingWorldProgress(GWP_GAME_INIT, 3);
StartupCompanies();
@@ -179,8 +179,6 @@ static void _GenerateWorld(void *)
}
}
BasePersistentStorageArray::SwitchMode(PSM_LEAVE_GAMELOOP);
ResetObjectToPlace();
_cur_company.Trash();
_current_company = _local_company = _gw.lc;
@@ -195,7 +193,7 @@ static void _GenerateWorld(void *)
ShowNewGRFError();
if (_network_dedicated) DEBUG(net, 1, "Map generated, starting game");
if (_network_dedicated) DEBUG(net, 0, "Map generated, starting game");
DEBUG(desync, 1, "new_map: %08x", _settings_game.game_creation.generation_seed);
if (_debug_desync_level > 0) {
@@ -204,7 +202,6 @@ static void _GenerateWorld(void *)
SaveOrLoad(name, SL_SAVE, AUTOSAVE_DIR, false);
}
} catch (...) {
BasePersistentStorageArray::SwitchMode(PSM_LEAVE_GAMELOOP, true);
if (_cur_company.IsValid()) _cur_company.Restore();
_generating_world = false;
_modal_progress_work_mutex->EndCritical();
@@ -328,7 +325,7 @@ void GenerateWorld(GenWorldMode mode, uint size_x, uint size_y, bool reset_setti
_gw.thread = NULL;
}
if (!VideoDriver::GetInstance()->HasGUI() || !ThreadObject::New(&_GenerateWorld, NULL, &_gw.thread)) {
if (!_video_driver->HasGUI() || !ThreadObject::New(&_GenerateWorld, NULL, &_gw.thread)) {
DEBUG(misc, 1, "Cannot create genworld thread, reverting to single-threaded mode");
_gw.threaded = false;
_modal_progress_work_mutex->EndCritical();

View File

@@ -73,7 +73,7 @@ extern uint _dirty_block_colour;
void GfxScroll(int left, int top, int width, int height, int xo, int yo)
{
Blitter *blitter = BlitterFactory::GetCurrentBlitter();
Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
if (xo == 0 && yo == 0) return;
@@ -85,7 +85,7 @@ void GfxScroll(int left, int top, int width, int height, int xo, int yo)
blitter->ScrollBuffer(_screen.dst_ptr, left, top, width, height, xo, yo);
/* This part of the screen is now dirty. */
VideoDriver::GetInstance()->MakeDirty(left, top, width, height);
_video_driver->MakeDirty(left, top, width, height);
}
@@ -105,7 +105,7 @@ void GfxScroll(int left, int top, int width, int height, int xo, int yo)
*/
void GfxFillRect(int left, int top, int right, int bottom, int colour, FillRectMode mode)
{
Blitter *blitter = BlitterFactory::GetCurrentBlitter();
Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
const DrawPixelInfo *dpi = _cur_dpi;
void *dst;
const int otop = top;
@@ -166,7 +166,7 @@ void GfxFillRect(int left, int top, int right, int bottom, int colour, FillRectM
*/
static inline void GfxDoDrawLine(void *video, int x, int y, int x2, int y2, int screen_width, int screen_height, uint8 colour, int width, int dash = 0)
{
Blitter *blitter = BlitterFactory::GetCurrentBlitter();
Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
assert(width > 0);
@@ -418,21 +418,19 @@ static int DrawLayoutLine(const ParagraphLayouter::Line *line, int y, int left,
NOT_REACHED();
}
TextColour colour = TC_BLACK;
bool draw_shadow = false;
for (int run_index = 0; run_index < line->CountRuns(); run_index++) {
const ParagraphLayouter::VisualRun *run = line->GetVisualRun(run_index);
const Font *f = (const Font*)run->GetFont();
FontCache *fc = f->fc;
colour = f->colour;
TextColour colour = f->colour;
SetColourRemap(colour);
DrawPixelInfo *dpi = _cur_dpi;
int dpi_left = dpi->left;
int dpi_right = dpi->left + dpi->width - 1;
draw_shadow = fc->GetDrawGlyphShadow() && (colour & TC_NO_SHADE) == 0 && colour != TC_BLACK;
bool draw_shadow = fc->GetDrawGlyphShadow() && colour != TC_BLACK;
for (int i = 0; i < run->GetGlyphCount(); i++) {
GlyphID glyph = run->GetGlyphs()[i];
@@ -463,11 +461,6 @@ static int DrawLayoutLine(const ParagraphLayouter::Line *line, int y, int left,
if (truncation) {
int x = (_current_text_dir == TD_RTL) ? left : (right - 3 * dot_width);
for (int i = 0; i < 3; i++, x += dot_width) {
if (draw_shadow) {
SetColourRemap(TC_BLACK);
GfxMainBlitter(dot_sprite, x + 1, y + 1, BM_COLOUR_REMAP);
SetColourRemap(colour);
}
GfxMainBlitter(dot_sprite, x, y, BM_COLOUR_REMAP);
}
}
@@ -795,7 +788,7 @@ void DrawSpriteViewport(SpriteID img, PaletteID pal, int x, int y, const SubSpri
GfxMainBlitterViewport(GetSprite(real_sprite, ST_NORMAL), x, y, BM_TRANSPARENT, sub, real_sprite);
} else if (pal != PAL_NONE) {
_colour_remap_ptr = GetNonSprite(GB(pal, 0, PALETTE_WIDTH), ST_RECOLOUR) + 1;
GfxMainBlitterViewport(GetSprite(real_sprite, ST_NORMAL), x, y, pal == PALETTE_CRASH ? BM_CRASH_REMAP : BM_COLOUR_REMAP, sub, real_sprite);
GfxMainBlitterViewport(GetSprite(real_sprite, ST_NORMAL), x, y, BM_COLOUR_REMAP, sub, real_sprite);
} else {
GfxMainBlitterViewport(GetSprite(real_sprite, ST_NORMAL), x, y, BM_NORMAL, sub, real_sprite);
}
@@ -818,70 +811,43 @@ void DrawSprite(SpriteID img, PaletteID pal, int x, int y, const SubSprite *sub,
GfxMainBlitter(GetSprite(real_sprite, ST_NORMAL), x, y, BM_TRANSPARENT, sub, real_sprite, zoom);
} else if (pal != PAL_NONE) {
_colour_remap_ptr = GetNonSprite(GB(pal, 0, PALETTE_WIDTH), ST_RECOLOUR) + 1;
GfxMainBlitter(GetSprite(real_sprite, ST_NORMAL), x, y, pal == PALETTE_CRASH ? BM_CRASH_REMAP : BM_COLOUR_REMAP, sub, real_sprite, zoom);
GfxMainBlitter(GetSprite(real_sprite, ST_NORMAL), x, y, BM_COLOUR_REMAP, sub, real_sprite, zoom);
} else {
GfxMainBlitter(GetSprite(real_sprite, ST_NORMAL), x, y, BM_NORMAL, sub, real_sprite, zoom);
}
}
/**
* The code for setting up the blitter mode and sprite information before finally drawing the sprite.
* @param sprite The sprite to draw.
* @param x The X location to draw.
* @param y The Y location to draw.
* @param mode The settings for the blitter to pass.
* @param sub Whether to only draw a sub set of the sprite.
* @param zoom The zoom level at which to draw the sprites.
* @tparam ZOOM_BASE The factor required to get the sub sprite information into the right size.
* @tparam SCALED_XY Whether the X and Y are scaled or unscaled.
*/
template <int ZOOM_BASE, bool SCALED_XY>
static void GfxBlitter(const Sprite * const sprite, int x, int y, BlitterMode mode, const SubSprite * const sub, SpriteID sprite_id, ZoomLevel zoom)
static void GfxMainBlitterViewport(const Sprite *sprite, int x, int y, BlitterMode mode, const SubSprite *sub, SpriteID sprite_id)
{
const DrawPixelInfo *dpi = _cur_dpi;
Blitter::BlitterParams bp;
if (SCALED_XY) {
/* Scale it */
x = ScaleByZoom(x, zoom);
y = ScaleByZoom(y, zoom);
}
/* Amount of pixels to clip from the source sprite */
int clip_left = (sub != NULL ? max(0, -sprite->x_offs + sub->left * ZOOM_LVL_BASE ) : 0);
int clip_top = (sub != NULL ? max(0, -sprite->y_offs + sub->top * ZOOM_LVL_BASE ) : 0);
int clip_right = (sub != NULL ? max(0, sprite->width - (-sprite->x_offs + (sub->right + 1) * ZOOM_LVL_BASE)) : 0);
int clip_bottom = (sub != NULL ? max(0, sprite->height - (-sprite->y_offs + (sub->bottom + 1) * ZOOM_LVL_BASE)) : 0);
if (clip_left + clip_right >= sprite->width) return;
if (clip_top + clip_bottom >= sprite->height) return;
/* Move to the correct offset */
x += sprite->x_offs;
y += sprite->y_offs;
if (sub == NULL) {
/* No clipping. */
bp.skip_left = 0;
bp.skip_top = 0;
bp.width = UnScaleByZoom(sprite->width, zoom);
bp.height = UnScaleByZoom(sprite->height, zoom);
} else {
/* Amount of pixels to clip from the source sprite */
int clip_left = max(0, -sprite->x_offs + sub->left * ZOOM_BASE );
int clip_top = max(0, -sprite->y_offs + sub->top * ZOOM_BASE );
int clip_right = max(0, sprite->width - (-sprite->x_offs + (sub->right + 1) * ZOOM_BASE));
int clip_bottom = max(0, sprite->height - (-sprite->y_offs + (sub->bottom + 1) * ZOOM_BASE));
if (clip_left + clip_right >= sprite->width) return;
if (clip_top + clip_bottom >= sprite->height) return;
bp.skip_left = UnScaleByZoomLower(clip_left, zoom);
bp.skip_top = UnScaleByZoomLower(clip_top, zoom);
bp.width = UnScaleByZoom(sprite->width - clip_left - clip_right, zoom);
bp.height = UnScaleByZoom(sprite->height - clip_top - clip_bottom, zoom);
x += ScaleByZoom(bp.skip_left, zoom);
y += ScaleByZoom(bp.skip_top, zoom);
}
/* Copy the main data directly from the sprite */
bp.sprite = sprite->data;
bp.sprite_width = sprite->width;
bp.sprite_height = sprite->height;
bp.width = UnScaleByZoom(sprite->width - clip_left - clip_right, dpi->zoom);
bp.height = UnScaleByZoom(sprite->height - clip_top - clip_bottom, dpi->zoom);
bp.top = 0;
bp.left = 0;
bp.skip_left = UnScaleByZoomLower(clip_left, dpi->zoom);
bp.skip_top = UnScaleByZoomLower(clip_top, dpi->zoom);
x += ScaleByZoom(bp.skip_left, dpi->zoom);
y += ScaleByZoom(bp.skip_top, dpi->zoom);
bp.dst = dpi->dst_ptr;
bp.pitch = dpi->pitch;
@@ -893,50 +859,48 @@ static void GfxBlitter(const Sprite * const sprite, int x, int y, BlitterMode mo
if (bp.width <= 0) return;
if (bp.height <= 0) return;
y -= SCALED_XY ? ScaleByZoom(dpi->top, zoom) : dpi->top;
int y_unscaled = UnScaleByZoom(y, zoom);
y -= dpi->top;
/* Check for top overflow */
if (y < 0) {
bp.height -= -y_unscaled;
bp.height -= -UnScaleByZoom(y, dpi->zoom);
if (bp.height <= 0) return;
bp.skip_top += -y_unscaled;
bp.skip_top += -UnScaleByZoom(y, dpi->zoom);
y = 0;
} else {
bp.top = y_unscaled;
bp.top = UnScaleByZoom(y, dpi->zoom);
}
/* Check for bottom overflow */
y += SCALED_XY ? ScaleByZoom(bp.height - dpi->height, zoom) : ScaleByZoom(bp.height, zoom) - dpi->height;
y += ScaleByZoom(bp.height, dpi->zoom) - dpi->height;
if (y > 0) {
bp.height -= UnScaleByZoom(y, zoom);
bp.height -= UnScaleByZoom(y, dpi->zoom);
if (bp.height <= 0) return;
}
x -= SCALED_XY ? ScaleByZoom(dpi->left, zoom) : dpi->left;
int x_unscaled = UnScaleByZoom(x, zoom);
x -= dpi->left;
/* Check for left overflow */
if (x < 0) {
bp.width -= -x_unscaled;
bp.width -= -UnScaleByZoom(x, dpi->zoom);
if (bp.width <= 0) return;
bp.skip_left += -x_unscaled;
bp.skip_left += -UnScaleByZoom(x, dpi->zoom);
x = 0;
} else {
bp.left = x_unscaled;
bp.left = UnScaleByZoom(x, dpi->zoom);
}
/* Check for right overflow */
x += SCALED_XY ? ScaleByZoom(bp.width - dpi->width, zoom) : ScaleByZoom(bp.width, zoom) - dpi->width;
x += ScaleByZoom(bp.width, dpi->zoom) - dpi->width;
if (x > 0) {
bp.width -= UnScaleByZoom(x, zoom);
bp.width -= UnScaleByZoom(x, dpi->zoom);
if (bp.width <= 0) return;
}
assert(bp.skip_left + bp.width <= UnScaleByZoom(sprite->width, zoom));
assert(bp.skip_top + bp.height <= UnScaleByZoom(sprite->height, zoom));
assert(bp.skip_left + bp.width <= UnScaleByZoom(sprite->width, dpi->zoom));
assert(bp.skip_top + bp.height <= UnScaleByZoom(sprite->height, dpi->zoom));
/* We do not want to catch the mouse. However we also use that spritenumber for unknown (text) sprites. */
if (_newgrf_debug_sprite_picker.mode == SPM_REDRAW && sprite_id != SPR_CURSOR_MOUSE) {
Blitter *blitter = BlitterFactory::GetCurrentBlitter();
Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
void *topleft = blitter->MoveTo(bp.dst, bp.left, bp.top);
void *bottomright = blitter->MoveTo(topleft, bp.width - 1, bp.height - 1);
@@ -950,17 +914,111 @@ static void GfxBlitter(const Sprite * const sprite, int x, int y, BlitterMode mo
}
}
BlitterFactory::GetCurrentBlitter()->Draw(&bp, mode, zoom);
}
static void GfxMainBlitterViewport(const Sprite *sprite, int x, int y, BlitterMode mode, const SubSprite *sub, SpriteID sprite_id)
{
GfxBlitter<ZOOM_LVL_BASE, false>(sprite, x, y, mode, sub, sprite_id, _cur_dpi->zoom);
BlitterFactoryBase::GetCurrentBlitter()->Draw(&bp, mode, dpi->zoom);
}
static void GfxMainBlitter(const Sprite *sprite, int x, int y, BlitterMode mode, const SubSprite *sub, SpriteID sprite_id, ZoomLevel zoom)
{
GfxBlitter<1, true>(sprite, x, y, mode, sub, sprite_id, zoom);
const DrawPixelInfo *dpi = _cur_dpi;
Blitter::BlitterParams bp;
/* Amount of pixels to clip from the source sprite */
int clip_left = (sub != NULL ? max(0, -sprite->x_offs + sub->left ) : 0);
int clip_top = (sub != NULL ? max(0, -sprite->y_offs + sub->top ) : 0);
int clip_right = (sub != NULL ? max(0, sprite->width - (-sprite->x_offs + sub->right + 1)) : 0);
int clip_bottom = (sub != NULL ? max(0, sprite->height - (-sprite->y_offs + sub->bottom + 1)) : 0);
if (clip_left + clip_right >= sprite->width) return;
if (clip_top + clip_bottom >= sprite->height) return;
/* Scale it */
x = ScaleByZoom(x, zoom);
y = ScaleByZoom(y, zoom);
/* Move to the correct offset */
x += sprite->x_offs;
y += sprite->y_offs;
/* Copy the main data directly from the sprite */
bp.sprite = sprite->data;
bp.sprite_width = sprite->width;
bp.sprite_height = sprite->height;
bp.width = UnScaleByZoom(sprite->width - clip_left - clip_right, zoom);
bp.height = UnScaleByZoom(sprite->height - clip_top - clip_bottom, zoom);
bp.top = 0;
bp.left = 0;
bp.skip_left = UnScaleByZoomLower(clip_left, zoom);
bp.skip_top = UnScaleByZoomLower(clip_top, zoom);
x += ScaleByZoom(bp.skip_left, zoom);
y += ScaleByZoom(bp.skip_top, zoom);
bp.dst = dpi->dst_ptr;
bp.pitch = dpi->pitch;
bp.remap = _colour_remap_ptr;
assert(sprite->width > 0);
assert(sprite->height > 0);
if (bp.width <= 0) return;
if (bp.height <= 0) return;
y -= ScaleByZoom(dpi->top, zoom);
/* Check for top overflow */
if (y < 0) {
bp.height -= -UnScaleByZoom(y, zoom);
if (bp.height <= 0) return;
bp.skip_top += -UnScaleByZoom(y, zoom);
y = 0;
} else {
bp.top = UnScaleByZoom(y, zoom);
}
/* Check for bottom overflow */
y += ScaleByZoom(bp.height - dpi->height, zoom);
if (y > 0) {
bp.height -= UnScaleByZoom(y, zoom);
if (bp.height <= 0) return;
}
x -= ScaleByZoom(dpi->left, zoom);
/* Check for left overflow */
if (x < 0) {
bp.width -= -UnScaleByZoom(x, zoom);
if (bp.width <= 0) return;
bp.skip_left += -UnScaleByZoom(x, zoom);
x = 0;
} else {
bp.left = UnScaleByZoom(x, zoom);
}
/* Check for right overflow */
x += ScaleByZoom(bp.width - dpi->width, zoom);
if (x > 0) {
bp.width -= UnScaleByZoom(x, zoom);
if (bp.width <= 0) return;
}
assert(bp.skip_left + bp.width <= UnScaleByZoom(sprite->width, zoom));
assert(bp.skip_top + bp.height <= UnScaleByZoom(sprite->height, zoom));
/* We do not want to catch the mouse. However we also use that spritenumber for unknown (text) sprites. */
if (_newgrf_debug_sprite_picker.mode == SPM_REDRAW && sprite_id != SPR_CURSOR_MOUSE) {
Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
void *topleft = blitter->MoveTo(bp.dst, bp.left, bp.top);
void *bottomright = blitter->MoveTo(topleft, bp.width - 1, bp.height - 1);
void *clicked = _newgrf_debug_sprite_picker.clicked_pixel;
if (topleft <= clicked && clicked <= bottomright) {
uint offset = (((size_t)clicked - (size_t)topleft) / (blitter->GetScreenDepth() / 8)) % bp.pitch;
if (offset < (uint)bp.width) {
_newgrf_debug_sprite_picker.sprites.Include(sprite_id);
}
}
}
BlitterFactoryBase::GetCurrentBlitter()->Draw(&bp, mode, zoom);
}
void DoPaletteAnimations();
@@ -980,7 +1038,7 @@ void DoPaletteAnimations()
static int palette_animation_counter = 0;
palette_animation_counter += 8;
Blitter *blitter = BlitterFactory::GetCurrentBlitter();
Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
const Colour *s;
const ExtraPaletteValues *ev = &_extra_palette_values;
Colour old_val[PALETTE_ANIM_SIZE];
@@ -1180,10 +1238,10 @@ void UndrawMouseCursor()
if (_screen.dst_ptr == NULL) return;
if (_cursor.visible) {
Blitter *blitter = BlitterFactory::GetCurrentBlitter();
Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
_cursor.visible = false;
blitter->CopyFromBuffer(blitter->MoveTo(_screen.dst_ptr, _cursor.draw_pos.x, _cursor.draw_pos.y), _cursor_backup.GetBuffer(), _cursor.draw_size.x, _cursor.draw_size.y);
VideoDriver::GetInstance()->MakeDirty(_cursor.draw_pos.x, _cursor.draw_pos.y, _cursor.draw_size.x, _cursor.draw_size.y);
_video_driver->MakeDirty(_cursor.draw_pos.x, _cursor.draw_pos.y, _cursor.draw_size.x, _cursor.draw_size.y);
}
}
@@ -1197,7 +1255,7 @@ void DrawMouseCursor()
/* Don't draw the mouse cursor if the screen is not ready */
if (_screen.dst_ptr == NULL) return;
Blitter *blitter = BlitterFactory::GetCurrentBlitter();
Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
int x;
int y;
int w;
@@ -1243,7 +1301,7 @@ void DrawMouseCursor()
_cur_dpi = &_screen;
DrawSprite(_cursor.sprite, _cursor.pal, _cursor.pos.x + _cursor.short_vehicle_offset, _cursor.pos.y);
VideoDriver::GetInstance()->MakeDirty(_cursor.draw_pos.x, _cursor.draw_pos.y, _cursor.draw_size.x, _cursor.draw_size.y);
_video_driver->MakeDirty(_cursor.draw_pos.x, _cursor.draw_pos.y, _cursor.draw_size.x, _cursor.draw_size.y);
_cursor.visible = true;
_cursor.dirty = false;
@@ -1267,7 +1325,7 @@ void RedrawScreenRect(int left, int top, int right, int bottom)
DrawOverlappedWindowForAll(left, top, right, bottom);
VideoDriver::GetInstance()->MakeDirty(left, top, right - left, bottom - top);
_video_driver->MakeDirty(left, top, right - left, bottom - top);
}
/**
@@ -1450,7 +1508,7 @@ void MarkWholeScreenDirty()
*/
bool FillDrawPixelInfo(DrawPixelInfo *n, int left, int top, int width, int height)
{
Blitter *blitter = BlitterFactory::GetCurrentBlitter();
Blitter *blitter = BlitterFactoryBase::GetCurrentBlitter();
const DrawPixelInfo *o = _cur_dpi;
n->zoom = ZOOM_LVL_NORMAL;
@@ -1576,12 +1634,12 @@ void SetAnimatedMouseCursor(const AnimCursor *table)
bool ChangeResInGame(int width, int height)
{
return (_screen.width == width && _screen.height == height) || VideoDriver::GetInstance()->ChangeResolution(width, height);
return (_screen.width == width && _screen.height == height) || _video_driver->ChangeResolution(width, height);
}
bool ToggleFullScreen(bool fs)
{
bool result = VideoDriver::GetInstance()->ToggleFullscreen(fs);
bool result = _video_driver->ToggleFullscreen(fs);
if (_fullscreen != fs && _num_resolutions == 0) {
DEBUG(driver, 0, "Could not find a suitable fullscreen resolution");
}

View File

@@ -137,7 +137,6 @@ void SetDirtyBlocks(int left, int top, int right, int bottom);
void MarkWholeScreenDirty();
void GfxInitPalettes();
void CheckBlitter();
bool FillDrawPixelInfo(DrawPixelInfo *n, int left, int top, int width, int height);

View File

@@ -15,7 +15,6 @@
#include "3rdparty/md5/md5.h"
#include "fontcache.h"
#include "gfx_func.h"
#include "transparency.h"
#include "blitter/factory.hpp"
#include "video/video_driver.hpp"
@@ -226,77 +225,29 @@ static void LoadSpriteTables()
/**
* Check blitter needed by NewGRF config and switch if needed.
* @return False when nothing changed, true otherwise.
*/
static bool SwitchNewGRFBlitter()
static void SwitchNewGRFBlitter()
{
/* Never switch if the blitter was specified by the user. */
if (!_blitter_autodetected) return false;
/* Get blitter of base set. */
bool is_32bpp = BaseGraphics::GetUsedSet()->blitter == BLT_32BPP;
/* Null driver => dedicated server => do nothing. */
if (BlitterFactory::GetCurrentBlitter()->GetScreenDepth() == 0) return false;
/* Get preferred depth. */
uint depth_wanted_by_base = BaseGraphics::GetUsedSet()->blitter == BLT_32BPP ? 32 : 8;
uint depth_wanted_by_grf = 8;
/* Get combined blitter mode of all NewGRFs. */
for (GRFConfig *c = _grfconfig; c != NULL; c = c->next) {
if (c->status == GCS_DISABLED || c->status == GCS_NOT_FOUND || HasBit(c->flags, GCF_INIT_ONLY)) continue;
if (c->palette & GRFP_BLT_32BPP) depth_wanted_by_grf = 32;
if (c->palette & GRFP_BLT_32BPP) is_32bpp = true;
}
/* Search the best blitter. */
struct {
const char *name;
uint animation; ///< 0: no support, 1: do support, 2: both
uint min_base_depth, max_base_depth, min_grf_depth, max_grf_depth;
} replacement_blitters[] = {
#ifdef WITH_SSE
{ "32bpp-sse4", 0, 32, 32, 8, 32 },
{ "32bpp-ssse3", 0, 32, 32, 8, 32 },
{ "32bpp-sse2", 0, 32, 32, 8, 32 },
{ "32bpp-sse4-anim", 1, 32, 32, 8, 32 },
#endif
{ "8bpp-optimized", 2, 8, 8, 8, 8 },
{ "32bpp-optimized", 0, 8, 32, 8, 32 },
{ "32bpp-anim", 1, 8, 32, 8, 32 },
};
const bool animation_wanted = HasBit(_display_opt, DO_FULL_ANIMATION);
const char *cur_blitter = BlitterFactory::GetCurrentBlitter()->GetName();
for (uint i = 0; i < lengthof(replacement_blitters); i++) {
if (animation_wanted && (replacement_blitters[i].animation == 0)) continue;
if (!animation_wanted && (replacement_blitters[i].animation == 1)) continue;
if (!IsInsideMM(depth_wanted_by_base, replacement_blitters[i].min_base_depth, replacement_blitters[i].max_base_depth + 1)) continue;
if (!IsInsideMM(depth_wanted_by_grf, replacement_blitters[i].min_grf_depth, replacement_blitters[i].max_grf_depth + 1)) continue;
const char *repl_blitter = replacement_blitters[i].name;
if (strcmp(repl_blitter, cur_blitter) == 0) return false;
if (BlitterFactory::GetBlitterFactory(repl_blitter) == NULL) continue;
DEBUG(misc, 1, "Switching blitter from '%s' to '%s'... ", cur_blitter, repl_blitter);
Blitter *new_blitter = BlitterFactory::SelectBlitter(repl_blitter);
if (new_blitter == NULL) NOT_REACHED();
DEBUG(misc, 1, "Successfully switched to %s.", repl_blitter);
break;
/* A GRF would like a 32 bpp blitter, switch blitter if needed. Never switch if the blitter was specified by the user. */
if (_blitter_autodetected && is_32bpp && BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth() != 0 && BlitterFactoryBase::GetCurrentBlitter()->GetScreenDepth() < 16) {
const char *cur_blitter = BlitterFactoryBase::GetCurrentBlitter()->GetName();
if (BlitterFactoryBase::SelectBlitter("32bpp-anim") != NULL) {
if (!_video_driver->AfterBlitterChange()) {
/* Failed to switch blitter, let's hope we can return to the old one. */
if (BlitterFactoryBase::SelectBlitter(cur_blitter) == NULL || !_video_driver->AfterBlitterChange()) usererror("Failed to reinitialize video driver for 32 bpp blitter. Specify a fixed blitter in the config");
}
}
}
if (!VideoDriver::GetInstance()->AfterBlitterChange()) {
/* Failed to switch blitter, let's hope we can return to the old one. */
if (BlitterFactory::SelectBlitter(cur_blitter) == NULL || !VideoDriver::GetInstance()->AfterBlitterChange()) usererror("Failed to reinitialize video driver. Specify a fixed blitter in the config");
}
return true;
}
/** Check whether we still use the right blitter, or use another (better) one. */
void CheckBlitter()
{
if (!SwitchNewGRFBlitter()) return;
ClearFontCache();
GfxClearSpriteCache();
}
/** Initialise and load all the sprites. */

Some files were not shown because too many files have changed in this diff Show More