# HG changeset patch
# User bjarni
# Date 1172622820 0
# Node ID 4b5241e5dd102939c864411fc50c610fb2f65b1e
# Parent 7c8ec33959b1a7788a41e4c3a0d2a58270271b8d
(svn r8938) [cpp_gui] -Sync with trunk (r8772..r8900)
diff -r 7c8ec33959b1 -r 4b5241e5dd10 Makefile.in
--- a/Makefile.in Tue Feb 27 23:54:28 2007 +0000
+++ b/Makefile.in Wed Feb 28 00:33:40 2007 +0000
@@ -30,6 +30,7 @@
OS = !!OS!!
OSXAPP = !!OSXAPP!!
REVISION = !!REVISION!!
+AWK = !!AWK!!
RES := $(shell if ! [ -f $(CONFIG_CACHE_SOURCE_LIST) ] || [ -n "`cmp $(CONFIG_CACHE_SOURCE_LIST) $(SOURCE_LIST)`" ]; then cp $(SOURCE_LIST) $(CONFIG_CACHE_SOURCE_LIST); fi )
@@ -118,7 +119,7 @@
# Find if the local source if modified
REV_MODIFIED := $(shell svnversion $(SRC_DIR) | sed -n 's/.*\(M\).*/\1/p' )
# Find the revision like: rXXXX-branch
-REV := $(shell LC_ALL=C svn info $(SRC_DIR) | awk '/^URL:.*branches/ { split($$2, a, "/"); BRANCH="-"a[5] } /^Last Changed Rev:/ { REV="r"$$4"$(REV_MODIFIED)" } END { print REV BRANCH }')
+REV := $(shell LC_ALL=C svn info $(SRC_DIR) | $(AWK) '/^URL:.*branches/ { split($$2, a, "/"); BRANCH="-"a[5] } /^Last Changed Rev:/ { REV="r"$$4"$(REV_MODIFIED)" } END { print REV BRANCH }')
endif
endif
# Make sure we have something in REV
diff -r 7c8ec33959b1 -r 4b5241e5dd10 Makefile.src.in
--- a/Makefile.src.in Tue Feb 27 23:54:28 2007 +0000
+++ b/Makefile.src.in Wed Feb 28 00:33:40 2007 +0000
@@ -27,6 +27,7 @@
CFLAGS_MAKEDEP= !!CFLAGS_MAKEDEP!!
SORT = !!SORT!!
REVISION = !!REVISION!!
+AWK = !!AWK!!
CONFIG_CACHE_COMPILER = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_COMPILER!!
CONFIG_CACHE_LINKER = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_LINKER!!
CONFIG_CACHE_ENDIAN = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_ENDIAN!!
@@ -82,7 +83,7 @@
# Find if the local source if modified
REV_MODIFIED := $(shell svnversion $(SRC_DIR) | sed -n 's/.*\(M\).*/\1/p' )
# Find the revision like: rXXXX-branch
-REV := $(shell LC_ALL=C svn info $(SRC_DIR) | awk '/^URL:.*branch/ { split($$2, a, "/"); BRANCH="-"a[5] } /^Last Changed Rev:/ { REV="r"$$4"$(REV_MODIFIED)" } END { print REV BRANCH }')
+REV := $(shell LC_ALL=C svn info $(SRC_DIR) | $(AWK) '/^URL:.*branch/ { split($$2, a, "/"); BRANCH="-"a[5] } /^Last Changed Rev:/ { REV="r"$$4"$(REV_MODIFIED)" } END { print REV BRANCH }')
endif
endif
# Make sure we have something in REV
@@ -159,14 +160,14 @@
# Convert x:/... paths to /x/... for mingw
ifeq ($(OS), MINGW)
- @cat Makefile.dep.tmp | sed 's@\([a-zA-Z]\):/@/\1/@g' > Makefile.dep.tmp.mingw
+ @cat Makefile.dep.tmp | sed 's@\([a-zA-Z]\):\/@\/\1\/@g' > Makefile.dep.tmp.mingw
@cp Makefile.dep.tmp.mingw Makefile.dep.tmp
@rm -f Makefile.dep.tmp.mingw
endif
# Remove all comments and includes that don't start with $(SRC_DIR)
# Remove $(SRC_DIR) from object-file-name
- @awk ' \
+ @$(AWK) ' \
/^# DO NOT/ { print $$0 ; next} \
/^#/ {next} \
/:/ { \
@@ -225,6 +226,9 @@
$(TTD): rev.o $(OBJS) $(CONFIG_CACHE_LINKER)
$(E) '$(STAGE) Linking $@'
ifeq ($(OS), PSP)
+ # Because of a bug in the PSP GCC tools, linking via CXX results
+ # in total chaos and more problems then you can handle. So we need
+ # CC to link OpenTTD for PSP
$(Q)$(CC_HOST) $(LDFLAGS) rev.o $(OBJS) $(LIBS) -o $@
else
$(Q)$(CXX_HOST) $(LDFLAGS) rev.o $(OBJS) $(LIBS) -o $@
diff -r 7c8ec33959b1 -r 4b5241e5dd10 bin/data/openttd.grf
Binary file bin/data/openttd.grf has changed
diff -r 7c8ec33959b1 -r 4b5241e5dd10 config.lib
--- a/config.lib Tue Feb 27 23:54:28 2007 +0000
+++ b/config.lib Wed Feb 28 00:33:40 2007 +0000
@@ -17,6 +17,7 @@
windres=""
strip=""
lipo=""
+ awk="awk"
os="DETECT"
endian="AUTO"
revision=""
@@ -57,7 +58,7 @@
with_fontconfig="1"
with_psp_config="1"
- save_params_array="build host cc_build cc_host cxx_build cxx_host windres strip lipo os revision endian config_log prefix_dir binary_dir data_dir icon_dir personal_dir install_dir custom_lang_dir second_data_dir enable_install enable_debug enable_profiling enable_dedicated enable_network enable_static enable_translator enable_assert enable_strip with_osx_sysroot enable_universal enable_osx_g5 with_application_bundle with_sdl with_cocoa with_zlib with_png with_makedepend with_direct_music with_sort with_iconv with_midi with_midi_arg with_libtimidity with_freetype with_fontconfig with_psp_config CC CXX CFLAGS LDFLAGS"
+ save_params_array="build host cc_build cc_host cxx_build cxx_host windres strip awk lipo os revision endian config_log prefix_dir binary_dir data_dir icon_dir personal_dir install_dir custom_lang_dir second_data_dir enable_install enable_debug enable_profiling enable_dedicated enable_network enable_static enable_translator enable_assert enable_strip with_osx_sysroot enable_universal enable_osx_g5 with_application_bundle with_sdl with_cocoa with_zlib with_png with_makedepend with_direct_music with_sort with_iconv with_midi with_midi_arg with_libtimidity with_freetype with_fontconfig with_psp_config CC CXX CFLAGS LDFLAGS"
}
detect_params() {
@@ -99,6 +100,8 @@
--cxx-host=*) cxx_host="$optarg";;
--windres) prevp_p="windres";;
--windres=*) windres="$optarg";;
+ --awk) prevp_p="awk";;
+ --awk=*) awk="$optarg";;
--strip) prevp_p="strip";;
--strip=*) strip="$optarg";;
--lipo) prevp_p="lipo";;
@@ -285,30 +288,32 @@
# Some params want to be in full uppercase, else they might not work as
# expected.. fix that here
- endian=`echo $endian | tr [:lower:] [:upper:]`
- os=`echo $os | tr [:lower:] [:upper:]`
+ endian=`echo $endian | tr '[a-z]' '[A-Z]'`
+ os=`echo $os | tr '[a-z]' '[A-Z]'`
# Check if all params have valid values
# Endian only allows AUTO, LE and, BE
- if ! echo $endian | grep -Eq "^(AUTO|LE|BE)$"; then
+ if [ -z "`echo $endian | egrep '^(AUTO|LE|BE)$'`" ]; then
echo "configure: error: invalid option --endian=$endian"
echo " Available options are: --endian=[AUTO|LE|BE]"
exit 1
fi
# OS only allows DETECT, UNIX, OSX, FREEBSD, MORPHOS, BEOS, SUNOS, CYGWIN, MINGW, OS2, WINCE, and PSP
- if ! echo $os | grep -Eq "^(DETECT|UNIX|OSX|FREEBSD|MORPHOS|BEOS|SUNOS|CYGWIN|MINGW|OS2|WINCE|PSP)$"; then
+ if [ -z "`echo $os | egrep '^(DETECT|UNIX|OSX|FREEBSD|MORPHOS|BEOS|SUNOS|CYGWIN|MINGW|OS2|WINCE|PSP)$'`" ]; then
echo "configure: error: invalid option --os=$os"
echo " Available options are: --os=[DETECT|UNIX|OSX|FREEBSD|MORPHOS|BEOS|SUNOS|CYGWIN|MINGW|OS2|WINCE|PSP]"
exit 1
fi
# enable_debug should be between 0 and 4
- if ! echo $enable_debug | grep -q "^[0123]$"; then
+ if [ -z "`echo $enable_debug | grep '^[0123]$'`" ]; then
echo "configure: error: invalid option --enable-debug=$enable_debug"
echo " Available options are: --enable-debug[=0123]"
exit 1
fi
+ detect_awk
+
check_build
check_host
@@ -336,7 +341,11 @@
check_cxx_build
check_cxx_host
check_windres
- check_strip
+ if [ "$enable_strip" != "0" ]; then
+ check_strip
+ else
+ log 1 "checking strip... disabled"
+ fi
check_lipo
check_makedepend
@@ -548,7 +557,7 @@
log 1 "detecting G5... yes (forced)"
else
# First, are we a real OSX system, else we can't detect it
- native=`LC_ALL=C uname | tr [:upper:] [:lower:] | grep darwin`
+ native=`LC_ALL=C uname | tr '[A-Z]' '[a-z]' | grep darwin`
# If $host doesn't match $build , we are cross-compiling
if [ -n "$native" ] && [ "$build" != "$host" ]; then
$cc_build $SRC_DIR/os/macosx/G5_detector.cpp -o G5_detector
@@ -602,6 +611,7 @@
if [ "$os" = "MORPHOS" ]; then
CFLAGS="$CFLAGS -I/gg/os-include -noixemul -fstrict-aliasing -fexpensive-optimizations"
CFLAGS="$CFLAGS -mcpu=604 -fno-inline -mstring -mmultiple"
+ LDFLAGS="$LDFLAGS -noixemul"
fi
CFLAGS="$CFLAGS -O2 -fomit-frame-pointer"
@@ -1138,12 +1148,51 @@
log 1 "checking makedepend... $makedepend"
}
+detect_awk() {
+ # Not all awks allow gsub(), so we test for that here! It is in fact all we need...
+
+ # These awks are known to work. Test for them explicit
+ awks="gawk mawk nawk"
+
+ awk_prefix="echo \"a.c b.c c.c\" | tr ' ' \\\\n | "
+ awk_param="' { ORS = \" \" } /\.c$/ { gsub(\".c$\", \".o\", \$0); print \$0; }' 2>/dev/null"
+ awk_result="a.o b.o c.o "
+ log 2 "Detecing awk..."
+
+ log 2 "Trying: $awk_prefix $awk $awk_param"
+ res=`eval $awk_prefix $awk $awk_param`
+ log 2 "Result: '$res'"
+ if [ "$res" != "$awk_result" ] && [ "$awk" = "awk" ]; then
+ # User didn't supply his own awk, so try to detect some other known working names for an awk
+ for awk in $awks; do
+ log 2 "Trying: $awk_prefix $awk $awk_param"
+ res=`eval $awk_prefix $awk $awk_param`
+ log 2 "Result: '$res'"
+ if [ "$res" = "$awk_result" ]; then break; fi
+ done
+
+ if [ "$res" != "$awk_result" ]; then
+ log 1 "checking awk... not found"
+ log 1 "configure: error: no awk found"
+ log 1 "configure: error: please install one of the following: $awks"
+ exit 1
+ fi
+ fi
+ if [ "$res" != "$awk_result" ]; then
+ log 1 "checking awk... not found"
+ log 1 "configure: error: you supplied '$awk' but it doesn't seem a valid gawk or mawk"
+ exit 1
+ fi
+
+ log 1 "checking awk... $awk"
+}
+
detect_os() {
- if [ $os = "DETECT" ]; then
+ if [ "$os" = "DETECT" ]; then
# Detect UNIX, OSX, FREEBSD, MORPHOS, BEOS, SUNOS, CYGWIN, MINGW, OS2, WINCE, and PSP
# Try first via dumpmachine, then via uname
- os=`echo "$host" | tr [:upper:] [:lower:] | awk '
+ os=`echo "$host" | tr '[A-Z]' '[a-z]' | $awk '
/linux/ { print "UNIX"; exit}
/darwin/ { print "OSX"; exit}
/freebsd/ { print "FREEBSD"; exit}
@@ -1158,7 +1207,7 @@
'`
if [ -z "$os" ]; then
- os=`LC_ALL=C uname | tr [:upper:] [:lower:] | awk '
+ os=`LC_ALL=C uname | tr '[A-Z]' '[a-z]' | $awk '
/linux/ { print "UNIX"; exit}
/darwin/ { print "OSX"; exit}
/freebsd/ { print "FREEBSD"; exit}
@@ -1753,6 +1802,7 @@
s#!!OS!!#$os#g;
s#!!CONFIGURE_FILES!!#$CONFIGURE_FILES#g;
s#!!REVISION!!#$revision#g;
+ s#!!AWK!!#$awk#g;
s#!!ENABLE_INSTALL!!#$enable_install#g;
"
}
@@ -1849,6 +1899,7 @@
echo " on HOST [BUILD]"
echo " --windres=WINDRES the windres to use [HOST-windres]"
echo " --strip=STRIP the strip to use [HOST-strip]"
+ echo " --awk=AWK the awk to use in configure [awk]"
echo " --lipo=LIPO the lipo to use (OSX ONLY) [HOST-lipo]"
echo " --os=OS the OS we are compiling for [DETECT]"
echo " DETECT/UNIX/OSX/FREEBSD/MORPHOS/BEOS/"
diff -r 7c8ec33959b1 -r 4b5241e5dd10 configure
--- a/configure Tue Feb 27 23:54:28 2007 +0000
+++ b/configure Wed Feb 28 00:33:40 2007 +0000
@@ -58,7 +58,7 @@
fi
# Read the source.list and process it
-SRCS="`< $ROOT_DIR/source.list tr '\r' '\n' | awk '
+SRCS="`< $ROOT_DIR/source.list tr '\r' '\n' | $awk '
{ }
/^( *)#end/ { if (deep == skip) { skip -= 1; } deep -= 1; next; }
/^( *)#else/ { if (deep == skip) { skip -= 1; } else if (deep - 1 == skip) { skip += 1; } next; }
@@ -100,11 +100,11 @@
}
' | $PIPE_SORT`"
-OBJS_C="` echo \"$SRCS\" | awk ' { ORS = " " } /\.c$/ { gsub(".c$", ".o", $0); print $0; }'`"
-OBJS_CPP="`echo \"$SRCS\" | awk ' { ORS = " " } /\.cpp$/ { gsub(".cpp$", ".o", $0); print $0; }'`"
-OBJS_MM="` echo \"$SRCS\" | awk ' { ORS = " " } /\.mm$/ { gsub(".mm$", ".o", $0); print $0; }'`"
-OBJS_RC="` echo \"$SRCS\" | awk ' { ORS = " " } /\.rc$/ { gsub(".rc$", ".o", $0); print $0; }'`"
-SRCS="` echo \"$SRCS\" | awk ' { ORS = " " } { print $0; }'`"
+OBJS_C="` echo \"$SRCS\" | $awk ' { ORS = " " } /\.c$/ { gsub(".c$", ".o", $0); print $0; }'`"
+OBJS_CPP="`echo \"$SRCS\" | $awk ' { ORS = " " } /\.cpp$/ { gsub(".cpp$", ".o", $0); print $0; }'`"
+OBJS_MM="` echo \"$SRCS\" | $awk ' { ORS = " " } /\.mm$/ { gsub(".mm$", ".o", $0); print $0; }'`"
+OBJS_RC="` echo \"$SRCS\" | $awk ' { ORS = " " } /\.rc$/ { gsub(".rc$", ".o", $0); print $0; }'`"
+SRCS="` echo \"$SRCS\" | $awk ' { ORS = " " } { print $0; }'`"
# In makefiles, we always use -u for sort
if [ -z "$sort" ]; then
diff -r 7c8ec33959b1 -r 4b5241e5dd10 docs/landscape.html
--- a/docs/landscape.html Tue Feb 27 23:54:28 2007 +0000
+++ b/docs/landscape.html Wed Feb 28 00:33:40 2007 +0000
@@ -488,6 +488,7 @@
m3 bits 0..3: track type for railway stations, must be 0 for all the other stations
m3 bits 4..7: persistent random data for newstations
m4: custom station id; 0 means standard graphics
+ m6 bit 3: 1 when a drive through road stop is built over a town owned road, otherwise 0
diff -r 7c8ec33959b1 -r 4b5241e5dd10 docs/landscape_grid.html
--- a/docs/landscape_grid.html Tue Feb 27 23:54:28 2007 +0000
+++ b/docs/landscape_grid.html Wed Feb 28 00:33:40 2007 +0000
@@ -171,7 +171,7 @@
XXXX XXXX |
XXXX XXXX |
XXXX XXXX |
- OOOO OOXX |
+ OOOO OXXX |
6 |
diff -r 7c8ec33959b1 -r 4b5241e5dd10 projects/generate
--- a/projects/generate Tue Feb 27 23:54:28 2007 +0000
+++ b/projects/generate Wed Feb 28 00:33:40 2007 +0000
@@ -111,8 +111,7 @@
i=`basename $i | sed s/.txt$//g`
RES="$RES
+ RelativePath=\"..\\src\\lang\\"$i".txt\">
+ Outputs=\"..\\bin\\lang\\"$i".lng\"/>
"
done
@@ -141,7 +139,15 @@
' > \"$ROOT_DIR/projects/$2\"`"
# The files-list
- echo "$1" >> "$ROOT_DIR/projects/$2"
+ if [ "$3" = "msvc2003" ]; then
+ echo "$1" | sed 's@\
\
@\n@' >> "$ROOT_DIR/projects/$2"
+ else
+ echo "$1" | sed '
+ s@Filter="">@>@;
+ s@^\([ ]*\)\([^ <].*[^/]\)>$@\1\2\n\1>@g;
+ s@^ \([ ]*\)\([^ <].*\)/>$@ \1\2\n\1/>@g;
+ ' >> "$ROOT_DIR/projects/$2"
+ fi
# Everything below the !!FILES!! marker
RES="`cat \"$ROOT_DIR/projects/$2\".in | tr '\r' '\n' | awk '
@@ -158,7 +164,7 @@
load_main_data "$ROOT_DIR/source.list" openttd
load_lang_data "$ROOT_DIR/src/lang/*.txt" lang
-generate "$openttd" "openttd.vcproj"
-generate "$openttd" "openttd_vs80.vcproj"
-generate "$lang" "langs_vs80.vcproj"
-generate "$lang" "langs.vcproj"
+generate "$openttd" "openttd.vcproj" "msvc2003"
+generate "$openttd" "openttd_vs80.vcproj" "msvc2005"
+generate "$lang" "langs.vcproj" "msvc2003"
+generate "$lang" "langs_vs80.vcproj" "msvc2005"
diff -r 7c8ec33959b1 -r 4b5241e5dd10 projects/langs.vcproj
--- a/projects/langs.vcproj Tue Feb 27 23:54:28 2007 +0000
+++ b/projects/langs.vcproj Wed Feb 28 00:33:40 2007 +0000
@@ -39,493 +39,423 @@
+ RelativePath="..\src\lang\american.txt">
+ Outputs="..\bin\lang\american.lng"/>
+ RelativePath="..\src\lang\brazilian_portuguese.txt">
+ Outputs="..\bin\lang\brazilian_portuguese.lng"/>
+ RelativePath="..\src\lang\bulgarian.txt">
+ Outputs="..\bin\lang\bulgarian.lng"/>
+ RelativePath="..\src\lang\catalan.txt">
+ Outputs="..\bin\lang\catalan.lng"/>
+ RelativePath="..\src\lang\czech.txt">
+ Outputs="..\bin\lang\czech.lng"/>
+ RelativePath="..\src\lang\danish.txt">
+ Outputs="..\bin\lang\danish.lng"/>
+ RelativePath="..\src\lang\dutch.txt">
+ Outputs="..\bin\lang\dutch.lng"/>
+ RelativePath="..\src\lang\english.txt">
+ Outputs="..\bin\lang\english.lng"/>
+ RelativePath="..\src\lang\esperanto.txt">
+ Outputs="..\bin\lang\esperanto.lng"/>
+ RelativePath="..\src\lang\estonian.txt">
+ Outputs="..\bin\lang\estonian.lng"/>
+ RelativePath="..\src\lang\finnish.txt">
+ Outputs="..\bin\lang\finnish.lng"/>
+ RelativePath="..\src\lang\french.txt">
+ Outputs="..\bin\lang\french.lng"/>
+ RelativePath="..\src\lang\galician.txt">
+ Outputs="..\bin\lang\galician.lng"/>
+ RelativePath="..\src\lang\german.txt">
+ Outputs="..\bin\lang\german.lng"/>
+ RelativePath="..\src\lang\hungarian.txt">
+ Outputs="..\bin\lang\hungarian.lng"/>
+ RelativePath="..\src\lang\icelandic.txt">
+ Outputs="..\bin\lang\icelandic.lng"/>
+ RelativePath="..\src\lang\italian.txt">
+ Outputs="..\bin\lang\italian.lng"/>
+ RelativePath="..\src\lang\japanese.txt">
+ Outputs="..\bin\lang\japanese.lng"/>
+ RelativePath="..\src\lang\korean.txt">
+ Outputs="..\bin\lang\korean.lng"/>
+ RelativePath="..\src\lang\lithuanian.txt">
+ Outputs="..\bin\lang\lithuanian.lng"/>
+ RelativePath="..\src\lang\norwegian_bokmal.txt">
+ Outputs="..\bin\lang\norwegian_bokmal.lng"/>
+ RelativePath="..\src\lang\norwegian_nynorsk.txt">
+ Outputs="..\bin\lang\norwegian_nynorsk.lng"/>
+ RelativePath="..\src\lang\origveh.txt">
+ Outputs="..\bin\lang\origveh.lng"/>
+ RelativePath="..\src\lang\polish.txt">
+ Outputs="..\bin\lang\polish.lng"/>
+ RelativePath="..\src\lang\portuguese.txt">
+ Outputs="..\bin\lang\portuguese.lng"/>
+ RelativePath="..\src\lang\romanian.txt">
+ Outputs="..\bin\lang\romanian.lng"/>
+ RelativePath="..\src\lang\russian.txt">
+ Outputs="..\bin\lang\russian.lng"/>
+ RelativePath="..\src\lang\simplified_chinese.txt">
+ Outputs="..\bin\lang\simplified_chinese.lng"/>
+ RelativePath="..\src\lang\slovak.txt">
+ Outputs="..\bin\lang\slovak.lng"/>
+ RelativePath="..\src\lang\slovenian.txt">
+ Outputs="..\bin\lang\slovenian.lng"/>
+ RelativePath="..\src\lang\spanish.txt">
+ Outputs="..\bin\lang\spanish.lng"/>
+ RelativePath="..\src\lang\swedish.txt">
+ Outputs="..\bin\lang\swedish.lng"/>
+ RelativePath="..\src\lang\traditional_chinese.txt">
+ Outputs="..\bin\lang\traditional_chinese.lng"/>
+ RelativePath="..\src\lang\turkish.txt">
+ Outputs="..\bin\lang\turkish.lng"/>
+ RelativePath="..\src\lang\ukrainian.txt">
+ Outputs="..\bin\lang\ukrainian.lng"/>
diff -r 7c8ec33959b1 -r 4b5241e5dd10 projects/langs_vs80.vcproj
--- a/projects/langs_vs80.vcproj Tue Feb 27 23:54:28 2007 +0000
+++ b/projects/langs_vs80.vcproj Wed Feb 28 00:33:40 2007 +0000
@@ -25,6 +25,11 @@
ATLMinimizesCRunTimeLibraryUsage="false"
>
+
-
@@ -47,493 +47,423 @@
+ RelativePath="..\src\lang\american.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\american.lng"n />
+ RelativePath="..\src\lang\brazilian_portuguese.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\brazilian_portuguese.lng"n />
+ RelativePath="..\src\lang\bulgarian.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\bulgarian.lng"n />
+ RelativePath="..\src\lang\catalan.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\catalan.lng"n />
+ RelativePath="..\src\lang\czech.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\czech.lng"n />
+ RelativePath="..\src\lang\danish.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\danish.lng"n />
+ RelativePath="..\src\lang\dutch.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\dutch.lng"n />
+ RelativePath="..\src\lang\english.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\english.lng"n />
+ RelativePath="..\src\lang\esperanto.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\esperanto.lng"n />
+ RelativePath="..\src\lang\estonian.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\estonian.lng"n />
+ RelativePath="..\src\lang\finnish.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\finnish.lng"n />
+ RelativePath="..\src\lang\french.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\french.lng"n />
+ RelativePath="..\src\lang\galician.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\galician.lng"n />
+ RelativePath="..\src\lang\german.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\german.lng"n />
+ RelativePath="..\src\lang\hungarian.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\hungarian.lng"n />
+ RelativePath="..\src\lang\icelandic.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\icelandic.lng"n />
+ RelativePath="..\src\lang\italian.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\italian.lng"n />
+ RelativePath="..\src\lang\japanese.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\japanese.lng"n />
+ RelativePath="..\src\lang\korean.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\korean.lng"n />
+ RelativePath="..\src\lang\lithuanian.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\lithuanian.lng"n />
+ RelativePath="..\src\lang\norwegian_bokmal.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\norwegian_bokmal.lng"n />
+ RelativePath="..\src\lang\norwegian_nynorsk.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\norwegian_nynorsk.lng"n />
+ RelativePath="..\src\lang\origveh.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\origveh.lng"n />
+ RelativePath="..\src\lang\polish.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\polish.lng"n />
+ RelativePath="..\src\lang\portuguese.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\portuguese.lng"n />
+ RelativePath="..\src\lang\romanian.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\romanian.lng"n />
+ RelativePath="..\src\lang\russian.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\russian.lng"n />
+ RelativePath="..\src\lang\simplified_chinese.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\simplified_chinese.lng"n />
+ RelativePath="..\src\lang\slovak.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\slovak.lng"n />
+ RelativePath="..\src\lang\slovenian.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\slovenian.lng"n />
+ RelativePath="..\src\lang\spanish.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\spanish.lng"n />
+ RelativePath="..\src\lang\swedish.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\swedish.lng"n />
+ RelativePath="..\src\lang\traditional_chinese.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\traditional_chinese.lng"n />
+ RelativePath="..\src\lang\turkish.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\turkish.lng"n />
+ RelativePath="..\src\lang\ukrainian.txt"n >
+ Name="Debug|Win32"n >
+ Outputs="..\bin\lang\ukrainian.lng"n />
diff -r 7c8ec33959b1 -r 4b5241e5dd10 projects/langs_vs80.vcproj.in
--- a/projects/langs_vs80.vcproj.in Tue Feb 27 23:54:28 2007 +0000
+++ b/projects/langs_vs80.vcproj.in Wed Feb 28 00:33:40 2007 +0000
@@ -25,6 +25,11 @@
ATLMinimizesCRunTimeLibraryUsage="false"
>
+
-
diff -r 7c8ec33959b1 -r 4b5241e5dd10 projects/openttd.sln
--- a/projects/openttd.sln Tue Feb 27 23:54:28 2007 +0000
+++ b/projects/openttd.sln Wed Feb 28 00:33:40 2007 +0000
@@ -19,17 +19,15 @@
Debug = Debug
Release = Release
EndGlobalSection
- GlobalSection(ProjectDependencies) = postSolution
- EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
+ {668328A0-B40E-4CDB-BD72-D0064424414A}.Debug.ActiveCfg = Debug|Win32
+ {668328A0-B40E-4CDB-BD72-D0064424414A}.Debug.Build.0 = Debug|Win32
+ {668328A0-B40E-4CDB-BD72-D0064424414A}.Release.ActiveCfg = Release|Win32
+ {668328A0-B40E-4CDB-BD72-D0064424414A}.Release.Build.0 = Release|Win32
{A133A442-BD0A-4ADE-B117-AD7545E4BDD1}.Debug.ActiveCfg = Release|Win32
{A133A442-BD0A-4ADE-B117-AD7545E4BDD1}.Debug.Build.0 = Release|Win32
{A133A442-BD0A-4ADE-B117-AD7545E4BDD1}.Release.ActiveCfg = Release|Win32
{A133A442-BD0A-4ADE-B117-AD7545E4BDD1}.Release.Build.0 = Release|Win32
- {668328A0-B40E-4CDB-BD72-D0064424414A}.Debug.ActiveCfg = Debug|Win32
- {668328A0-B40E-4CDB-BD72-D0064424414A}.Debug.Build.0 = Debug|Win32
- {668328A0-B40E-4CDB-BD72-D0064424414A}.Release.ActiveCfg = Release|Win32
- {668328A0-B40E-4CDB-BD72-D0064424414A}.Release.Build.0 = Release|Win32
{0F066B23-18DF-4284-8265-F4A5E7E3B966}.Debug.ActiveCfg = Debug|Win32
{0F066B23-18DF-4284-8265-F4A5E7E3B966}.Debug.Build.0 = Debug|Win32
{0F066B23-18DF-4284-8265-F4A5E7E3B966}.Release.ActiveCfg = Debug|Win32
diff -r 7c8ec33959b1 -r 4b5241e5dd10 projects/openttd.vcproj
--- a/projects/openttd.vcproj Tue Feb 27 23:54:28 2007 +0000
+++ b/projects/openttd.vcproj Wed Feb 28 00:33:40 2007 +0000
@@ -3,7 +3,7 @@
ProjectType="Visual C++"
Version="7.10"
Name="openttd"
- RootNameSpace="openttd"
+ RootNamespace="openttd"
SccProjectName=""
SccLocalPath="">
@@ -173,6 +173,9 @@
RelativePath=".\..\src\callback_table.cpp">
+
+
-
-
-
-
-
-
-
-
+
+
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
-
+ RelativePath=".\..\src\ai\trolly\build.cpp">
+ RelativePath=".\..\src\ai\default\default.cpp">
@@ -941,9 +914,6 @@
RelativePath=".\..\src\newgrf.cpp">
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r 7c8ec33959b1 -r 4b5241e5dd10 projects/openttd_vs80.sln
--- a/projects/openttd_vs80.sln Tue Feb 27 23:54:28 2007 +0000
+++ b/projects/openttd_vs80.sln Wed Feb 28 00:33:40 2007 +0000
@@ -21,6 +21,14 @@
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {668328A0-B40E-4CDB-BD72-D0064424414A}.Debug|Win32.ActiveCfg = Debug|Win32
+ {668328A0-B40E-4CDB-BD72-D0064424414A}.Debug|Win32.Build.0 = Debug|Win32
+ {668328A0-B40E-4CDB-BD72-D0064424414A}.Debug|x64.ActiveCfg = Debug|x64
+ {668328A0-B40E-4CDB-BD72-D0064424414A}.Debug|x64.Build.0 = Debug|x64
+ {668328A0-B40E-4CDB-BD72-D0064424414A}.Release|Win32.ActiveCfg = Release|Win32
+ {668328A0-B40E-4CDB-BD72-D0064424414A}.Release|Win32.Build.0 = Release|Win32
+ {668328A0-B40E-4CDB-BD72-D0064424414A}.Release|x64.ActiveCfg = Release|x64
+ {668328A0-B40E-4CDB-BD72-D0064424414A}.Release|x64.Build.0 = Release|x64
{A133A442-BD0A-4ADE-B117-AD7545E4BDD1}.Debug|Win32.ActiveCfg = Debug|Win32
{A133A442-BD0A-4ADE-B117-AD7545E4BDD1}.Debug|Win32.Build.0 = Debug|Win32
{A133A442-BD0A-4ADE-B117-AD7545E4BDD1}.Debug|x64.ActiveCfg = Debug|Win32
@@ -29,14 +37,6 @@
{A133A442-BD0A-4ADE-B117-AD7545E4BDD1}.Release|Win32.Build.0 = Debug|Win32
{A133A442-BD0A-4ADE-B117-AD7545E4BDD1}.Release|x64.ActiveCfg = Debug|Win32
{A133A442-BD0A-4ADE-B117-AD7545E4BDD1}.Release|x64.Build.0 = Debug|Win32
- {668328A0-B40E-4CDB-BD72-D0064424414A}.Debug|Win32.ActiveCfg = Debug|Win32
- {668328A0-B40E-4CDB-BD72-D0064424414A}.Debug|Win32.Build.0 = Debug|Win32
- {668328A0-B40E-4CDB-BD72-D0064424414A}.Debug|x64.ActiveCfg = Debug|x64
- {668328A0-B40E-4CDB-BD72-D0064424414A}.Debug|x64.Build.0 = Debug|x64
- {668328A0-B40E-4CDB-BD72-D0064424414A}.Release|Win32.ActiveCfg = Release|Win32
- {668328A0-B40E-4CDB-BD72-D0064424414A}.Release|Win32.Build.0 = Release|Win32
- {668328A0-B40E-4CDB-BD72-D0064424414A}.Release|x64.ActiveCfg = Release|x64
- {668328A0-B40E-4CDB-BD72-D0064424414A}.Release|x64.Build.0 = Release|x64
{0F066B23-18DF-4284-8265-F4A5E7E3B966}.Debug|Win32.ActiveCfg = Debug|Win32
{0F066B23-18DF-4284-8265-F4A5E7E3B966}.Debug|Win32.Build.0 = Debug|Win32
{0F066B23-18DF-4284-8265-F4A5E7E3B966}.Debug|x64.ActiveCfg = Debug|Win32
diff -r 7c8ec33959b1 -r 4b5241e5dd10 projects/openttd_vs80.vcproj
--- a/projects/openttd_vs80.vcproj Tue Feb 27 23:54:28 2007 +0000
+++ b/projects/openttd_vs80.vcproj Wed Feb 28 00:33:40 2007 +0000
@@ -442,1069 +442,1076 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ >
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ RelativePath=".\..\src\airport.cpp"n >
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ RelativePath=".\..\src\aystar.cpp"n >
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ RelativePath=".\..\src\bmp.cpp"n >
-
-
-
-
-
-
-
-
+ RelativePath=".\..\src\callback_table.cpp"n >
-
-
+ RelativePath=".\..\src\cargotype.cpp"n >
+ RelativePath=".\..\src\command.cpp"n >
+ RelativePath=".\..\src\console.cpp"n >
+ RelativePath=".\..\src\console_cmds.cpp"n >
+ RelativePath=".\..\src\currency.cpp"n >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ >
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ RelativePath=".\..\src\aircraft.h"n >
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ RelativePath=".\..\src\airport.h"n >
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ RelativePath=".\..\src\airport_movement.h"n >
-
-
-
-
-
-
-
-
-
-
+ RelativePath=".\..\src\aystar.h"n >
-
-
-
-
+ RelativePath=".\..\src\bmp.h"n >
+ RelativePath=".\..\src\cargotype.h"n >
+ RelativePath=".\..\src\command.h"n >
+ RelativePath=".\..\src\console.h"n >
+ RelativePath=".\..\src\currency.h"n >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
+ >
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ RelativePath=".\..\src\aircraft_gui.cpp"n >
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ RelativePath=".\..\src\airport_gui.cpp"n >
-
-
-
-
-
-
+ RelativePath=".\..\src\autoreplace_gui.cpp"n >
-
-
+ RelativePath=".\..\src\bridge_gui.cpp"n >
+ RelativePath=".\..\src\build_vehicle_gui.cpp"n >
+ RelativePath=".\..\src\depot_gui.cpp"n >
+ RelativePath=".\..\src\dock_gui.cpp"n >
+ RelativePath=".\..\src\engine_gui.cpp"n >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+ >
-
-
-
-
-
-
-
-
+ RelativePath=".\..\src\aircraft_cmd.cpp"n >
-
-
-
-
-
-
+ RelativePath=".\..\src\clear_cmd.cpp"n >
-
-
+ RelativePath=".\..\src\disaster_cmd.cpp"n >
+ RelativePath=".\..\src\dummy_land.cpp"n >
+ RelativePath=".\..\src\industry_cmd.cpp"n >
+ RelativePath=".\..\src\misc_cmd.cpp"n >
+ RelativePath=".\..\src\order_cmd.cpp"n >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+ >
-
-
-
-
-
-
-
-
-
-
-
-
+ RelativePath=".\..\src\table\ai_rail.h"n >
-
-
-
-
-
-
-
-
-
-
+ RelativePath=".\..\src\table\allstrings.h"n >
-
-
-
-
+ RelativePath=".\..\src\table\animcursors.h"n >
-
-
+ RelativePath=".\..\src\table\autorail.h"n >
+ RelativePath=".\..\src\table\build_industry.h"n >
+ RelativePath=".\..\src\table\cargo_const.h"n >
+ RelativePath=".\..\src\table\clear_land.h"n >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ >
-
-
+ RelativePath=".\..\src\ai\ai.cpp"n >
+ RelativePath=".\..\src\ai\trolly\build.cpp"n >
+ RelativePath=".\..\src\ai\default\default.cpp"n >
+ RelativePath=".\..\src\ai\trolly\pathfinder.cpp"n >
+ RelativePath=".\..\src\ai\trolly\shared.cpp"n >
+
+
+ >
-
-
-
-
+ RelativePath=".\..\src\newgrf.cpp"n >
-
-
+ RelativePath=".\..\src\newgrf_config.cpp"n >
+ RelativePath=".\..\src\newgrf_engine.cpp"n >
+ RelativePath=".\..\src\newgrf_sound.cpp"n >
+ RelativePath=".\..\src\newgrf_spritegroup.cpp"n >
+
+
+
+
-
-
-
-
+ >
-
-
-
-
-
-
-
-
+ RelativePath=".\..\src\bridge_map.cpp"n >
-
-
-
-
-
-
+ RelativePath=".\..\src\bridge_map.h"n >
-
-
+ RelativePath=".\..\src\clear_map.h"n >
+ RelativePath=".\..\src\industry_map.h"n >
+ RelativePath=".\..\src\rail_map.h"n >
+ RelativePath=".\..\src\road_map.cpp"n >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+ >
-
-
-
-
+ RelativePath=".\..\src\misc\array.hpp"n >
-
-
-
-
+ RelativePath=".\..\src\misc\autocopyptr.hpp"n >
+ RelativePath=".\..\src\misc\autoptr.hpp"n >
+ RelativePath=".\..\src\misc\binaryheap.hpp"n >
+ RelativePath=".\..\src\misc\blob.hpp"n >
+ RelativePath=".\..\src\misc\countedobj.cpp"n >
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+ >
-
-
-
-
-
-
-
-
-
-
+ RelativePath=".\..\src\widget\widget.h"n >
-
-
-
-
-
-
-
-
+ RelativePath=".\..\src\widget\widget_base.cpp"n >
-
-
-
-
+ RelativePath=".\..\src\widget\widget_button.cpp"n >
+ RelativePath=".\..\src\widget\widget_button_img2.cpp"n >
+ RelativePath=".\..\src\widget\widget_button_img.cpp"n >
+ RelativePath=".\..\src\widget\widget_button_txt2.cpp"n >
+ RelativePath=".\..\src\widget\widget_button_txt.cpp"n >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+ >
-
-
-
-
-
-
-
-
-
-
+ RelativePath=".\..\src\yapf\follow_track.cpp"n >
-
-
-
-
-
-
-
-
+ RelativePath=".\..\src\yapf\follow_track.hpp"n >
-
-
+ RelativePath=".\..\src\yapf\nodelist.hpp"n >
+ RelativePath=".\..\src\yapf\track_dir.hpp"n >
+ RelativePath=".\..\src\yapf\yapf.h"n >
+ RelativePath=".\..\src\yapf\yapf.hpp"n >
+ RelativePath=".\..\src\yapf\yapf_base.hpp"n >
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ >
+ RelativePath=".\..\src\video\dedicated_v.cpp"n >
+ RelativePath=".\..\src\video\null_v.cpp"n >
+ RelativePath=".\..\src\video\sdl_v.cpp"n >
+ RelativePath=".\..\src\video\win32_v.cpp"n >
+ >
+ RelativePath=".\..\src\music\dmusic.cpp"n >
+ RelativePath=".\..\src\music\null_m.cpp"n >
+ RelativePath=".\..\src\music\win32_m.cpp"n >
+ >
+ RelativePath=".\..\src\sound\null_s.cpp"n >
+ RelativePath=".\..\src\sound\sdl_s.cpp"n >
+ RelativePath=".\..\src\sound\win32_s.cpp"n >
+ RelativePath=".\..\media\mainicon.ico"
+ >
+ RelativePath=".\..\media\openttd.ico"
+ >
+ RelativePath=".\..\readme.txt"
+ >
diff -r 7c8ec33959b1 -r 4b5241e5dd10 projects/openttd_vs80.vcproj.in
--- a/projects/openttd_vs80.vcproj.in Tue Feb 27 23:54:28 2007 +0000
+++ b/projects/openttd_vs80.vcproj.in Wed Feb 28 00:33:40 2007 +0000
@@ -485,13 +485,16 @@
+ RelativePath=".\..\media\mainicon.ico"
+ >
+ RelativePath=".\..\media\openttd.ico"
+ >
+ RelativePath=".\..\readme.txt"
+ >
diff -r 7c8ec33959b1 -r 4b5241e5dd10 projects/strgen_vs80.vcproj
--- a/projects/strgen_vs80.vcproj Tue Feb 27 23:54:28 2007 +0000
+++ b/projects/strgen_vs80.vcproj Wed Feb 28 00:33:40 2007 +0000
@@ -44,7 +44,6 @@
+ Name="Release|Win32"
+ >
-
-
+ ObjectFile="$(IntDir)/$(InputName)1.obj"
+ />
+
+
attr, 1, 3);
h = GB(p->attr, 4, 3);
- if (p->attr & 1) uintswap(w, h);
+ if (p->attr & 1) Swap(w, h);
if (cargo & 0x80) {
GetProductionAroundTiles(values, tile2, w, h, rad);
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/aircraft.h
--- a/src/aircraft.h Tue Feb 27 23:54:28 2007 +0000
+++ b/src/aircraft.h Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file aircraft.h */
+
#ifndef AIRCRAFT_H
#define AIRCRAFT_H
@@ -40,11 +42,13 @@
return IsAircraftInHangar(v) && v->vehstatus & VS_STOPPED;
}
-uint16 AircraftDefaultCargoCapacity(CargoID cid, EngineID engine_type);
+uint16 AircraftDefaultCargoCapacity(CargoID cid, const AircraftVehicleInfo*);
void CcBuildAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2);
void CcCloneAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2);
void HandleAircraftEnterHangar(Vehicle *v);
void GetAircraftSpriteSize(EngineID engine, uint &width, uint &height);
+void UpdateAirplanesOnNewStation(const Station *st);
+
#endif /* AIRCRAFT_H */
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/aircraft_cmd.cpp
--- a/src/aircraft_cmd.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/aircraft_cmd.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,8 @@
/* $Id$ */
+/** @file aircraft_cmd.cpp
+ * This file deals with aircraft and airport movements functionalities */
+
#include "stdafx.h"
#include "openttd.h"
#include "aircraft.h"
@@ -28,17 +31,16 @@
#include "date.h"
#include "spritecache.h"
-// this maps the terminal to its corresponding state and block flag
-// currently set for 10 terms, 4 helipads
+/** this maps the terminal to its corresponding state and block flag
+ * currently set for 10 terms, 4 helipads */
static const byte _airport_terminal_state[] = {2, 3, 4, 5, 6, 7, 19, 20, 0, 0, 8, 9, 21, 22};
static const byte _airport_terminal_flag[] = {0, 1, 2, 3, 4, 5, 22, 23, 0, 0, 6, 7, 24, 25};
static bool AirportMove(Vehicle *v, const AirportFTAClass *apc);
-static bool AirportSetBlocks(Vehicle *v, AirportFTA *current_pos, const AirportFTAClass *apc);
+static bool AirportSetBlocks(Vehicle *v, const AirportFTA *current_pos, const AirportFTAClass *apc);
static bool AirportHasBlock(Vehicle *v, const AirportFTA *current_pos, const AirportFTAClass *apc);
static bool AirportFindFreeTerminal(Vehicle *v, const AirportFTAClass *apc);
static bool AirportFindFreeHelipad(Vehicle *v, const AirportFTAClass *apc);
-static void AirportGoToNextPosition(Vehicle *v, const AirportFTAClass *apc);
static void CrashAirplane(Vehicle *v);
static void AircraftNextAirportPos_and_Order(Vehicle *v);
@@ -54,7 +56,7 @@
0x0EBD, 0x0EC5
};
-/* Helicopter rotor animation states */
+/** Helicopter rotor animation states */
enum HelicopterRotorStates {
HRS_ROTOR_STOPPED,
HRS_ROTOR_MOVING_1,
@@ -62,9 +64,11 @@
HRS_ROTOR_MOVING_3,
};
-/* Find the nearest hangar to v
+/** Find the nearest hangar to v
* INVALID_STATION is returned, if the player does not have any suitable
* airports (like helipads only)
+ * @param v vehicle looking for a hangar
+ * @return the StationID if one is found, otherwise, INVALID_STATION
*/
static StationID FindNearestHangar(const Vehicle *v)
{
@@ -86,7 +90,7 @@
continue;
}
- // v->tile can't be used here, when aircraft is flying v->tile is set to 0
+ /* v->tile can't be used here, when aircraft is flying v->tile is set to 0 */
uint distance = DistanceSquare(vtile, st->airport_tile);
if (distance < best || index == INVALID_STATION) {
best = distance;
@@ -97,7 +101,9 @@
}
#if 0
-// returns true if vehicle v have an airport in the schedule, that has a hangar
+/** Check if given vehicle has a goto hangar in his orders
+ * @param v vehicle to inquiry
+ * @return true if vehicle v has an airport in the schedule, that has a hangar */
static bool HaveHangarInOrderList(Vehicle *v)
{
const Order *order;
@@ -105,7 +111,7 @@
FOR_VEHICLE_ORDERS(v, order) {
const Station *st = GetStation(order->station);
if (st->owner == v->owner && st->facilities & FACIL_AIRPORT) {
- // If an airport doesn't have a hangar, skip it
+ /* If an airport doesn't have a hangar, skip it */
if (st->Airport()->nof_depots != 0)
return true;
}
@@ -130,11 +136,9 @@
SpriteID GetRotorImage(const Vehicle *v)
{
- const Vehicle *w;
-
assert(v->subtype == AIR_HELICOPTER);
- w = v->next->next;
+ const Vehicle *w = v->next->next;
if (is_custom_sprite(v->spritenum)) {
SpriteID spritenum = GetCustomRotorSprite(v, false);
if (spritenum != 0) return spritenum;
@@ -205,10 +209,8 @@
* @param engine Which engine to find a cargo capacity for.
* @return New cargo capacity value.
*/
-uint16 AircraftDefaultCargoCapacity(CargoID cid, EngineID engine_type)
+uint16 AircraftDefaultCargoCapacity(CargoID cid, const AircraftVehicleInfo *avi)
{
- const AircraftVehicleInfo *avi = AircraftVehInfo(engine_type);
-
assert(cid != CT_INVALID);
/* An aircraft can carry twice as much goods as normal cargo,
@@ -228,27 +230,26 @@
/** Build an aircraft.
* @param tile tile of depot where aircraft is built
+ * @param flags for command
* @param p1 aircraft type being built (engine)
* @param p2 bit 0 when set, the unitnumber will be 0, otherwise it will be a free number
+ * return result of operation. Could be cost, error
*/
int32 CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
- Vehicle *vl[3];
- UnitID unit_num;
-
if (!IsEngineBuildable(p1, VEH_Aircraft, _current_player)) return_cmd_error(STR_ENGINE_NOT_BUILDABLE);
const AircraftVehicleInfo *avi = AircraftVehInfo(p1);
int32 value = EstimateAircraftCost(avi);
- // to just query the cost, it is not neccessary to have a valid tile (automation/AI)
+ /* to just query the cost, it is not neccessary to have a valid tile (automation/AI) */
if (flags & DC_QUERY_COST) return value;
if (!IsHangarTile(tile) || !IsTileOwner(tile, _current_player)) return CMD_ERROR;
SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
- // Prevent building aircraft types at places which can't handle them
+ /* Prevent building aircraft types at places which can't handle them */
const Station* st = GetStationByTile(tile);
const AirportFTAClass* apc = st->Airport();
if (!(apc->flags & (avi->subtype & AIR_CTOL ? AirportFTAClass::AIRPLANES : AirportFTAClass::HELICOPTERS))) {
@@ -257,19 +258,16 @@
/* Allocate 2 or 3 vehicle structs, depending on type
* vl[0] = aircraft, vl[1] = shadow, [vl[2] = rotor] */
+ Vehicle *vl[3];
if (!AllocateVehicles(vl, avi->subtype & AIR_CTOL ? 2 : 3)) {
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
}
- unit_num = HASBIT(p2, 0) ? 0 : GetFreeUnitNumber(VEH_Aircraft);
+ UnitID unit_num = HASBIT(p2, 0) ? 0 : GetFreeUnitNumber(VEH_Aircraft);
if (unit_num > _patches.max_aircraft)
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
if (flags & DC_EXEC) {
- CargoID cargo;
- uint x;
- uint y;
-
Vehicle *v = vl[0]; // aircraft
Vehicle *u = vl[1]; // shadow
@@ -282,8 +280,8 @@
v->tile = tile;
// u->tile = 0;
- x = TileX(tile) * TILE_SIZE + 5;
- y = TileY(tile) * TILE_SIZE + 3;
+ uint x = TileX(tile) * TILE_SIZE + 5;
+ uint y = TileY(tile) * TILE_SIZE + 3;
v->x_pos = u->x_pos = x;
v->y_pos = u->y_pos = y;
@@ -336,7 +334,7 @@
* passengers, we select the cargo type from the refit mask.
* This is a fairly nasty hack to get around the fact that TTD
* has no default cargo type specifier for planes... */
- cargo = FindFirstRefittableCargo(p1);
+ CargoID cargo = FindFirstRefittableCargo(p1);
if (cargo != CT_INVALID && cargo != CT_PASSENGERS) {
uint16 callback = CALLBACK_FAILED;
@@ -348,7 +346,7 @@
if (callback == CALLBACK_FAILED) {
/* Callback failed, or not executed; use the default cargo capacity */
- v->cargo_cap = AircraftDefaultCargoCapacity(v->cargo_type, v->engine_type);
+ v->cargo_cap = AircraftDefaultCargoCapacity(v->cargo_type, avi);
} else {
v->cargo_cap = callback;
}
@@ -395,7 +393,7 @@
VehiclePositionChanged(v);
VehiclePositionChanged(u);
- // Aircraft with 3 vehicles (chopper)?
+ /* Aircraft with 3 vehicles (chopper)? */
if (v->subtype == AIR_HELICOPTER) {
Vehicle *w = vl[2];
@@ -445,16 +443,16 @@
/** Sell an aircraft.
* @param tile unused
+ * @param flags for command type
* @param p1 vehicle ID to be sold
* @param p2 unused
+ * @return result of operation. Error or sold value
*/
int32 CmdSellAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
- Vehicle *v;
-
if (!IsValidVehicleID(p1)) return CMD_ERROR;
- v = GetVehicle(p1);
+ Vehicle *v = GetVehicle(p1);
if (v->type != VEH_Aircraft || !CheckOwnership(v->owner)) return CMD_ERROR;
if (!IsAircraftInHangarStopped(v)) return_cmd_error(STR_A01B_AIRCRAFT_MUST_BE_STOPPED);
@@ -472,27 +470,26 @@
/** Start/Stop an aircraft.
* @param tile unused
+ * @param flags for command type
* @param p1 aircraft ID to start/stop
* @param p2 unused
+ * @return result of operation. Nothing if everything went well
*/
int32 CmdStartStopAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
- Vehicle *v;
- uint16 callback;
-
if (!IsValidVehicleID(p1)) return CMD_ERROR;
- v = GetVehicle(p1);
+ Vehicle *v = GetVehicle(p1);
if (v->type != VEH_Aircraft || !CheckOwnership(v->owner)) return CMD_ERROR;
- // cannot stop airplane when in flight, or when taking off / landing
+ /* cannot stop airplane when in flight, or when taking off / landing */
if (v->u.air.state >= STARTTAKEOFF && v->u.air.state < TERM7)
return_cmd_error(STR_A017_AIRCRAFT_IS_IN_FLIGHT);
/* Check if this aircraft can be started/stopped. The callback will fail or
* return 0xFF if it can. */
- callback = GetVehicleCallback(CBID_VEHICLE_START_STOP_CHECK, 0, 0, v->engine_type, v);
+ uint16 callback = GetVehicleCallback(CBID_VEHICLE_START_STOP_CHECK, 0, 0, v->engine_type, v);
if (callback != CALLBACK_FAILED && callback != 0xFF) {
StringID error = GetGRFStringID(GetEngineGRFID(v->engine_type), 0xD000 + callback);
return_cmd_error(error);
@@ -514,15 +511,15 @@
/** Send an aircraft to the hangar.
* @param tile unused
+ * @param flags for command type
* @param p1 vehicle ID to send to the hangar
* @param p2 various bitmasked elements
* - p2 bit 0-3 - DEPOT_ flags (see vehicle.h)
* - p2 bit 8-10 - VLW flag (for mass goto depot)
+ * @return o if everything went well
*/
int32 CmdSendAircraftToHangar(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
- Vehicle *v;
-
if (p2 & DEPOT_MASS_SEND) {
/* Mass goto depot requested */
if (!ValidVLWFlags(p2 & VLW_MASK)) return CMD_ERROR;
@@ -531,7 +528,7 @@
if (!IsValidVehicleID(p1)) return CMD_ERROR;
- v = GetVehicle(p1);
+ Vehicle *v = GetVehicle(p1);
if (v->type != VEH_Aircraft || !CheckOwnership(v->owner) || IsAircraftInHangar(v)) return CMD_ERROR;
@@ -560,16 +557,12 @@
const Station *st = GetStation(next_airport_index);
/* If the station is not a valid airport or if it has no hangars */
if (!st->IsValid() || st->airport_tile == 0 || st->Airport()->nof_depots == 0) {
- StationID station;
-
- // the aircraft has to search for a hangar on its own
- station = FindNearestHangar(v);
+ /* the aircraft has to search for a hangar on its own */
+ StationID station = FindNearestHangar(v);
next_airport_has_hangar = false;
if (station == INVALID_STATION) return CMD_ERROR;
- st = GetStation(station);
next_airport_index = station;
-
}
if (flags & DC_EXEC) {
@@ -592,36 +585,32 @@
/** Refits an aircraft to the specified cargo type.
* @param tile unused
+ * @param flags for command type
* @param p1 vehicle ID of the aircraft to refit
* @param p2 various bitstuffed elements
* - p2 = (bit 0-7) - the new cargo type to refit to
* - p2 = (bit 8-15) - the new cargo subtype to refit to
+ * @return cost of refit or error
*/
int32 CmdRefitAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
- Vehicle *v;
- int pass, mail;
- int32 cost;
- CargoID new_cid = GB(p2, 0, 8);
byte new_subtype = GB(p2, 8, 8);
- const AircraftVehicleInfo *avi;
- uint16 callback = CALLBACK_FAILED;
if (!IsValidVehicleID(p1)) return CMD_ERROR;
- v = GetVehicle(p1);
+ Vehicle *v = GetVehicle(p1);
if (v->type != VEH_Aircraft || !CheckOwnership(v->owner)) return CMD_ERROR;
if (!IsAircraftInHangarStopped(v)) return_cmd_error(STR_A01B_AIRCRAFT_MUST_BE_STOPPED);
- avi = AircraftVehInfo(v->engine_type);
-
/* Check cargo */
+ CargoID new_cid = GB(p2, 0, 8);
if (new_cid > NUM_CARGO || !CanRefitTo(v->engine_type, new_cid)) return CMD_ERROR;
SET_EXPENSES_TYPE(EXPENSES_AIRCRAFT_RUN);
/* Check the refit capacity callback */
+ uint16 callback = CALLBACK_FAILED;
if (HASBIT(EngInfo(v->engine_type)->callbackmask, CBM_REFIT_CAPACITY)) {
/* Back up the existing cargo type */
CargoID temp_cid = v->cargo_type;
@@ -636,26 +625,28 @@
v->cargo_subtype = temp_subtype;
}
+ const AircraftVehicleInfo *avi = AircraftVehInfo(v->engine_type);
+
+ uint pass;
if (callback == CALLBACK_FAILED) {
/* If the callback failed, or wasn't executed, use the aircraft's
* default cargo capacity */
- pass = AircraftDefaultCargoCapacity(new_cid, v->engine_type);
+ pass = AircraftDefaultCargoCapacity(new_cid, avi);
} else {
pass = callback;
}
_returned_refit_capacity = pass;
- cost = 0;
+ int32 cost = 0;
if (IsHumanPlayer(v->owner) && new_cid != v->cargo_type) {
cost = GetRefitCost(v->engine_type);
}
if (flags & DC_EXEC) {
- Vehicle *u;
v->cargo_cap = pass;
- u = v->next;
- mail = (new_cid != CT_PASSENGERS) ? 0 : avi->mail_capacity;
+ Vehicle *u = v->next;
+ uint mail = new_cid != CT_PASSENGERS ? 0 : avi->mail_capacity;
u->cargo_cap = mail;
if (v->cargo_type == new_cid) {
v->cargo_count = min(pass, v->cargo_count);
@@ -677,8 +668,6 @@
static void CheckIfAircraftNeedsService(Vehicle *v)
{
- const Station* st;
-
if (_patches.servint_aircraft == 0) return;
if (!VehicleNeedsService(v)) return;
if (v->vehstatus & VS_STOPPED) return;
@@ -694,8 +683,8 @@
return;
}
- st = GetStation(v->current_order.dest);
- // only goto depot if the target airport has terminals (eg. it is airport)
+ const Station *st = GetStation(v->current_order.dest);
+ /* only goto depot if the target airport has terminals (eg. it is airport) */
if (st->IsValid() && st->airport_tile != 0 && st->Airport()->terminals != NULL) {
// printf("targetairport = %d, st->index = %d\n", v->u.air.targetairport, st->index);
// v->u.air.targetairport = st->index;
@@ -711,8 +700,6 @@
void OnNewDay_Aircraft(Vehicle *v)
{
- int32 cost;
-
if (!IsNormalAircraft(v)) return;
if ((++v->day_counter & 7) == 0) DecreaseVehicleValue(v);
@@ -725,7 +712,7 @@
if (v->vehstatus & VS_STOPPED) return;
- cost = AircraftVehInfo(v->engine_type)->running_cost * _price.aircraft_running / 364;
+ int32 cost = AircraftVehInfo(v->engine_type)->running_cost * _price.aircraft_running / 364;
v->profit_this_year -= cost >> 8;
@@ -761,16 +748,12 @@
static void HelicopterTickHandler(Vehicle *v)
{
- Vehicle *u;
- int tick,spd;
- SpriteID img;
-
- u = v->next->next;
+ Vehicle *u = v->next->next;
if (u->vehstatus & VS_HIDDEN) return;
- // if true, helicopter rotors do not rotate. This should only be the case if a helicopter is
- // loading/unloading at a terminal or stopped
+ /* if true, helicopter rotors do not rotate. This should only be the case if a helicopter is
+ * loading/unloading at a terminal or stopped */
if (v->current_order.type == OT_LOADING || (v->vehstatus & VS_STOPPED)) {
if (u->cur_speed != 0) {
u->cur_speed++;
@@ -786,9 +769,10 @@
u->cur_speed--;
}
- tick = ++u->tick_counter;
- spd = u->cur_speed >> 4;
+ int tick = ++u->tick_counter;
+ int spd = u->cur_speed >> 4;
+ SpriteID img;
if (spd == 0) {
u->u.air.state = HRS_ROTOR_STOPPED;
img = GetRotorImage(v);
@@ -811,10 +795,6 @@
static void SetAircraftPosition(Vehicle *v, int x, int y, int z)
{
- Vehicle *u;
- int safe_x;
- int safe_y;
-
v->x_pos = x;
v->y_pos = y;
v->z_pos = z;
@@ -826,10 +806,10 @@
VehiclePositionChanged(v);
EndVehicleMove(v);
- u = v->next;
+ Vehicle *u = v->next;
- safe_x = clamp(x, 0, MapMaxX() * TILE_SIZE);
- safe_y = clamp(y - 1, 0, MapMaxY() * TILE_SIZE);
+ int safe_x = clamp(x, 0, MapMaxX() * TILE_SIZE);
+ int safe_y = clamp(y - 1, 0, MapMaxY() * TILE_SIZE);
u->x_pos = x;
u->y_pos = y - ((v->z_pos-GetSlopeZ(safe_x, safe_y)) >> 3);;
@@ -858,12 +838,10 @@
*/
void HandleAircraftEnterHangar(Vehicle *v)
{
- Vehicle *u;
-
v->subspeed = 0;
v->progress = 0;
- u = v->next;
+ Vehicle *u = v->next;
u->vehstatus |= VS_HIDDEN;
u = u->next;
if (u != NULL) {
@@ -898,10 +876,10 @@
if (speed_limit == SPEED_LIMIT_NONE) speed_limit = v->max_speed;
spd = min(v->cur_speed + (spd >> 8) + (v->subspeed < t), speed_limit);
- // adjust speed for broken vehicles
+ /* adjust speed for broken vehicles */
if (v->vehstatus & VS_AIRCRAFT_BROKEN) spd = min(spd, SPEED_LIMIT_BROKEN);
- //updates statusbar only if speed have changed to save CPU time
+ /* updates statusbar only if speed have changed to save CPU time */
if (spd != v->cur_speed) {
v->cur_speed = spd;
if (_patches.vehicle_speed)
@@ -937,7 +915,13 @@
* other by providing them with vertical seperation
*/
switch (v->direction) {
- case DIR_N: case DIR_NE: case DIR_E: case DIR_SE: base_altitude += 15; break;
+ case DIR_N:
+ case DIR_NE:
+ case DIR_E:
+ case DIR_SE:
+ base_altitude += 15;
+ break;
+
default: break;
}
@@ -949,35 +933,23 @@
static bool AircraftController(Vehicle *v)
{
- Station *st;
- Vehicle *u;
- byte z, maxz, curz;
- Direction newdir;
- GetNewVehiclePosResult gp;
- uint dist;
- int x,y;
-
- st = GetStation(v->u.air.targetairport);
+ const Station *st = GetStation(v->u.air.targetairport);
- // prevent going to 0,0 if airport is deleted.
- {
- TileIndex tile = st->airport_tile;
+ /* prevent going to 0,0 if airport is deleted. */
+ TileIndex tile = st->airport_tile;
+ if (tile == 0) tile = st->xy;
+ int x = TileX(tile) * TILE_SIZE;
+ int y = TileY(tile) * TILE_SIZE;
- if (tile == 0) tile = st->xy;
- // xy of destination
- x = TileX(tile) * TILE_SIZE;
- y = TileY(tile) * TILE_SIZE;
- }
-
- // get airport moving data
+ /* get airport moving data */
const AirportFTAClass *afc = st->Airport();
const AirportMovingData *amd = afc->MovingData(v->u.air.pos);
- // Helicopter raise
+ /* Helicopter raise */
if (amd->flag & AMED_HELI_RAISE) {
- u = v->next->next;
+ Vehicle *u = v->next->next;
- // Make sure the rotors don't rotate too fast
+ /* Make sure the rotors don't rotate too fast */
if (u->cur_speed > 32) {
v->cur_speed = 0;
if (--u->cur_speed == 32) SndPlayVehicleFx(SND_18_HELICOPTER, v);
@@ -986,7 +958,7 @@
if (UpdateAircraftSpeed(v, SPEED_LIMIT_NONE)) {
v->tile = 0;
- // Reached altitude?
+ /* Reached altitude? */
if (v->z_pos >= 184) {
v->cur_speed = 0;
return true;
@@ -997,28 +969,28 @@
return false;
}
- // Helicopter landing.
+ /* Helicopter landing. */
if (amd->flag & AMED_HELI_LOWER) {
if (UpdateAircraftSpeed(v, SPEED_LIMIT_NONE)) {
if (st->airport_tile == 0) {
- // FIXME - AircraftController -> if station no longer exists, do not land
- // helicopter will circle until sign disappears, then go to next order
- // * what to do when it is the only order left, right now it just stays in 1 place
+ /* FIXME - AircraftController -> if station no longer exists, do not land
+ * helicopter will circle until sign disappears, then go to next order
+ * what to do when it is the only order left, right now it just stays in 1 place */
v->u.air.state = FLYING;
AircraftNextAirportPos_and_Order(v);
return false;
}
- // Vehicle is now at the airport.
+ /* Vehicle is now at the airport. */
v->tile = st->airport_tile;
- // Find altitude of landing position.
- z = GetSlopeZ(x, y) + 1 + afc->delta_z;
+ /* Find altitude of landing position. */
+ uint z = GetSlopeZ(x, y) + 1 + afc->delta_z;
if (z == v->z_pos) {
- u = v->next->next;
+ Vehicle *u = v->next->next;
- // Increase speed of rotors. When speed is 80, we've landed.
+ /* Increase speed of rotors. When speed is 80, we've landed. */
if (u->cur_speed >= 80) return true;
u->cur_speed += 4;
} else if (v->z_pos > z) {
@@ -1030,21 +1002,19 @@
return false;
}
- // Get distance from destination pos to current pos.
- dist = myabs(x + amd->x - v->x_pos) + myabs(y + amd->y - v->y_pos);
+ /* Get distance from destination pos to current pos. */
+ uint dist = myabs(x + amd->x - v->x_pos) + myabs(y + amd->y - v->y_pos);
- // Need exact position?
+ /* Need exact position? */
if (!(amd->flag & AMED_EXACTPOS) && dist <= (amd->flag & AMED_SLOWTURN ? 8U : 4U))
return true;
- // At final pos?
+ /* At final pos? */
if (dist == 0) {
- DirDiff dirdiff;
-
- // Change direction smoothly to final direction.
- dirdiff = DirDifference(amd->direction, v->direction);
- // if distance is 0, and plane points in right direction, no point in calling
- // UpdateAircraftSpeed(). So do it only afterwards
+ /* Change direction smoothly to final direction. */
+ DirDiff dirdiff = DirDifference(amd->direction, v->direction);
+ /* if distance is 0, and plane points in right direction, no point in calling
+ * UpdateAircraftSpeed(). So do it only afterwards */
if (dirdiff == DIRDIFF_SAME) {
v->cur_speed = 0;
return true;
@@ -1063,8 +1033,8 @@
if (v->load_unload_time_rem != 0) v->load_unload_time_rem--;
- // Turn. Do it slowly if in the air.
- newdir = GetDirectionTowards(v, x + amd->x, y + amd->y);
+ /* Turn. Do it slowly if in the air. */
+ Direction newdir = GetDirectionTowards(v, x + amd->x, y + amd->y);
if (newdir != v->direction) {
if (amd->flag & AMED_SLOWTURN) {
if (v->load_unload_time_rem == 0) v->load_unload_time_rem = 8;
@@ -1075,32 +1045,30 @@
}
}
- // Move vehicle.
- GetNewVehiclePos(v, &gp);
+ /* Move vehicle. */
+ GetNewVehiclePosResult gp = GetNewVehiclePos(v);
v->tile = gp.new_tile;
- // If vehicle is in the air, use tile coordinate 0.
+ /* If vehicle is in the air, use tile coordinate 0. */
if (amd->flag & (AMED_TAKEOFF | AMED_SLOWTURN | AMED_LAND)) v->tile = 0;
- // Adjust Z for land or takeoff?
- z = v->z_pos;
+ /* Adjust Z for land or takeoff? */
+ uint z = v->z_pos;
if (amd->flag & AMED_TAKEOFF) {
- z += 2;
- maxz = GetAircraftFlyingAltitude(v);
- if (z > maxz) z = maxz;
+ z = min(z + 2, GetAircraftFlyingAltitude(v));
}
if (amd->flag & AMED_LAND) {
if (st->airport_tile == 0) {
v->u.air.state = FLYING;
AircraftNextAirportPos_and_Order(v);
- // get aircraft back on running altitude
+ /* get aircraft back on running altitude */
SetAircraftPosition(v, gp.x, gp.y, GetAircraftFlyingAltitude(v));
return false;
}
- curz = GetSlopeZ(x, y) + 1;
+ uint curz = GetSlopeZ(x, y) + 1;
if (curz > z) {
z++;
@@ -1112,9 +1080,9 @@
}
}
- // We've landed. Decrase speed when we're reaching end of runway.
+ /* We've landed. Decrase speed when we're reaching end of runway. */
if (amd->flag & AMED_BRAKE) {
- curz = GetSlopeZ(x, y) + 1;
+ uint curz = GetSlopeZ(x, y) + 1;
if (z > curz) {
z--;
@@ -1132,17 +1100,13 @@
static void HandleCrashedAircraft(Vehicle *v)
{
- uint32 r;
- Station *st;
- int z;
-
v->u.air.crashed_counter++;
- st = GetStation(v->u.air.targetairport);
+ Station *st = GetStation(v->u.air.targetairport);
- // make aircraft crash down to the ground
+ /* make aircraft crash down to the ground */
if (v->u.air.crashed_counter < 500 && st->airport_tile==0 && ((v->u.air.crashed_counter % 3) == 0) ) {
- z = GetSlopeZ(v->x_pos, v->y_pos);
+ uint z = GetSlopeZ(v->x_pos, v->y_pos);
v->z_pos -= 1;
if (v->z_pos == z) {
v->u.air.crashed_counter = 500;
@@ -1151,6 +1115,7 @@
}
if (v->u.air.crashed_counter < 650) {
+ uint32 r;
if (CHANCE16R(1,32,r)) {
static const DirDiff delta[] = {
DIRDIFF_45LEFT, DIRDIFF_SAME, DIRDIFF_SAME, DIRDIFF_45RIGHT
@@ -1166,14 +1131,14 @@
EV_EXPLOSION_SMALL);
}
} else if (v->u.air.crashed_counter >= 10000) {
- // remove rubble of crashed airplane
+ /* remove rubble of crashed airplane */
- // clear runway-in on all airports, set by crashing plane
- // small airports use AIRPORT_BUSY, city airports use RUNWAY_IN_OUT_block, etc.
- // but they all share the same number
+ /* clear runway-in on all airports, set by crashing plane
+ * small airports use AIRPORT_BUSY, city airports use RUNWAY_IN_OUT_block, etc.
+ * but they all share the same number */
CLRBITS(st->airport_flags, RUNWAY_IN_block);
CLRBITS(st->airport_flags, RUNWAY_IN_OUT_block); // commuter airport
- CLRBITS(st->airport_flags, RUNWAY_IN2_block); // intercontinental
+ CLRBITS(st->airport_flags, RUNWAY_IN2_block); // intercontinental
BeginVehicleMove(v);
EndVehicleMove(v);
@@ -1232,8 +1197,6 @@
static void ProcessAircraftOrder(Vehicle *v)
{
- const Order *order;
-
switch (v->current_order.type) {
case OT_GOTO_DEPOT:
if (!(v->current_order.flags & OF_PART_OF_ORDERS)) return;
@@ -1250,7 +1213,7 @@
if (v->cur_order_index >= v->num_orders) v->cur_order_index = 0;
- order = GetVehicleOrder(v, v->cur_order_index);
+ const Order *order = GetVehicleOrder(v, v->cur_order_index);
if (order == NULL) {
v->current_order.type = OT_NOTHING;
@@ -1267,7 +1230,7 @@
v->current_order = *order;
- // orders are changed in flight, ensure going to the right station
+ /* orders are changed in flight, ensure going to the right station */
if (order->type == OT_GOTO_STATION && v->u.air.state == FLYING) {
AircraftNextAirportPos_and_Order(v);
}
@@ -1325,10 +1288,6 @@
static void CrashAirplane(Vehicle *v)
{
- uint16 amt;
- Station *st;
- StringID newsitem;
-
v->vehstatus |= VS_CRASHED;
v->u.air.crashed_counter = 0;
@@ -1336,13 +1295,14 @@
InvalidateWindow(WC_VEHICLE_VIEW, v->index);
- amt = 2;
+ uint amt = 2;
if (v->cargo_type == CT_PASSENGERS) amt += v->cargo_count;
SetDParam(0, amt);
v->cargo_count = 0;
v->next->cargo_count = 0;
- st = GetStation(v->u.air.targetairport);
+ const Station *st = GetStation(v->u.air.targetairport);
+ StringID newsitem;
if (st->airport_tile == 0) {
newsitem = STR_PLANE_CRASH_OUT_OF_FUEL;
} else {
@@ -1361,14 +1321,10 @@
static void MaybeCrashAirplane(Vehicle *v)
{
- Station *st;
- uint16 prob;
- uint i;
+ Station *st = GetStation(v->u.air.targetairport);
- st = GetStation(v->u.air.targetairport);
-
- //FIXME -- MaybeCrashAirplane -> increase crashing chances of very modern airplanes on smaller than AT_METROPOLITAN airports
- prob = 0x10000 / 1500;
+ /* FIXME -- MaybeCrashAirplane -> increase crashing chances of very modern airplanes on smaller than AT_METROPOLITAN airports */
+ uint16 prob = 0x10000 / 1500;
if (st->Airport()->flags & AirportFTAClass::SHORT_STRIP &&
AircraftVehInfo(v->engine_type)->subtype & AIR_FAST &&
!_cheats.no_jetcrash.value) {
@@ -1377,8 +1333,8 @@
if (GB(Random(), 0, 16) > prob) return;
- // Crash the airplane. Remove all goods stored at the station.
- for (i = 0; i != NUM_CARGO; i++) {
+ /* Crash the airplane. Remove all goods stored at the station. */
+ for (uint i = 0; i != NUM_CARGO; i++) {
st->goods[i].rating = 1;
SB(st->goods[i].waiting_acceptance, 0, 12, 0);
}
@@ -1386,15 +1342,12 @@
CrashAirplane(v);
}
-// we've landed and just arrived at a terminal
+/** we've landed and just arrived at a terminal */
static void AircraftEntersTerminal(Vehicle *v)
{
- Station *st;
- Order old_order;
-
if (v->current_order.type == OT_GOTO_DEPOT) return;
- st = GetStation(v->u.air.targetairport);
+ Station *st = GetStation(v->u.air.targetairport);
v->last_station_visited = v->u.air.targetairport;
/* Check if station was ever visited before */
@@ -1403,7 +1356,7 @@
st->had_vehicle_of_type |= HVOT_AIRCRAFT;
SetDParam(0, st->index);
- // show newsitem of celebrating citizens
+ /* show newsitem of celebrating citizens */
flags = (v->owner == _local_player) ? NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ARRIVAL_PLAYER, 0) : NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_VEHICLE, NT_ARRIVAL_OTHER, 0);
AddNewsItem(
STR_A033_CITIZENS_CELEBRATE_FIRST,
@@ -1412,7 +1365,7 @@
0);
}
- old_order = v->current_order;
+ Order old_order = v->current_order;
v->BeginLoading();
v->current_order.flags = 0;
@@ -1480,7 +1433,7 @@
}
-// set the right pos when heading to other airports after takeoff
+/** set the right pos when heading to other airports after takeoff */
static void AircraftNextAirportPos_and_Order(Vehicle *v)
{
if (v->current_order.type == OT_GOTO_STATION ||
@@ -1502,7 +1455,7 @@
Vehicle *u = v->next;
u->vehstatus &= ~VS_HIDDEN;
- // Rotor blades
+ /* Rotor blades */
u = u->next;
if (u != NULL) {
u->vehstatus &= ~VS_HIDDEN;
@@ -1532,16 +1485,16 @@
v->u.air.state = apc->layout[v->u.air.pos].heading;
}
-// In an Airport Hangar
+/** In an Airport Hangar */
static void AircraftEventHandler_InHangar(Vehicle *v, const AirportFTAClass *apc)
{
- // if we just arrived, execute EnterHangar first
+ /* if we just arrived, execute EnterHangar first */
if (v->u.air.previous_pos != v->u.air.pos) {
AircraftEventHandler_EnterHangar(v, apc);
return;
}
- // if we were sent to the depot, stay there
+ /* if we were sent to the depot, stay there */
if (v->current_order.type == OT_GOTO_DEPOT && (v->vehstatus & VS_STOPPED)) {
v->current_order.type = OT_NOTHING;
v->current_order.flags = 0;
@@ -1552,37 +1505,37 @@
v->current_order.type != OT_GOTO_DEPOT)
return;
- // if the block of the next position is busy, stay put
+ /* if the block of the next position is busy, stay put */
if (AirportHasBlock(v, &apc->layout[v->u.air.pos], apc)) return;
- // We are already at the target airport, we need to find a terminal
+ /* We are already at the target airport, we need to find a terminal */
if (v->current_order.dest == v->u.air.targetairport) {
- // FindFreeTerminal:
- // 1. Find a free terminal, 2. Occupy it, 3. Set the vehicle's state to that terminal
+ /* FindFreeTerminal:
+ * 1. Find a free terminal, 2. Occupy it, 3. Set the vehicle's state to that terminal */
if (v->subtype == AIR_HELICOPTER) {
if (!AirportFindFreeHelipad(v, apc)) return; // helicopter
} else {
if (!AirportFindFreeTerminal(v, apc)) return; // airplane
}
} else { // Else prepare for launch.
- // airplane goto state takeoff, helicopter to helitakeoff
+ /* airplane goto state takeoff, helicopter to helitakeoff */
v->u.air.state = (v->subtype == AIR_HELICOPTER) ? HELITAKEOFF : TAKEOFF;
}
AircraftLeaveHangar(v);
AirportMove(v, apc);
}
-// At one of the Airport's Terminals
+/** At one of the Airport's Terminals */
static void AircraftEventHandler_AtTerminal(Vehicle *v, const AirportFTAClass *apc)
{
- // if we just arrived, execute EnterTerminal first
+ /* if we just arrived, execute EnterTerminal first */
if (v->u.air.previous_pos != v->u.air.pos) {
AircraftEventHandler_EnterTerminal(v, apc);
- // on an airport with helipads, a helicopter will always land there
- // and get serviced at the same time - patch setting
+ /* on an airport with helipads, a helicopter will always land there
+ * and get serviced at the same time - patch setting */
if (_patches.serviceathelipad) {
if (v->subtype == AIR_HELICOPTER && apc->helipads != NULL) {
- // an exerpt of ServiceAircraft, without the invisibility stuff
+ /* an exerpt of ServiceAircraft, without the invisibility stuff */
v->date_of_last_service = _date;
v->breakdowns_since_last_service = 0;
v->reliability = GetEngine(v->engine_type)->reliability;
@@ -1594,15 +1547,15 @@
if (v->current_order.type == OT_NOTHING) return;
- // if the block of the next position is busy, stay put
+ /* if the block of the next position is busy, stay put */
if (AirportHasBlock(v, &apc->layout[v->u.air.pos], apc)) return;
- // airport-road is free. We either have to go to another airport, or to the hangar
- // ---> start moving
+ /* airport-road is free. We either have to go to another airport, or to the hangar
+ * ---> start moving */
switch (v->current_order.type) {
case OT_GOTO_STATION: // ready to fly to another airport
- // airplane goto state takeoff, helicopter to helitakeoff
+ /* airplane goto state takeoff, helicopter to helitakeoff */
v->u.air.state = (v->subtype == AIR_HELICOPTER) ? HELITAKEOFF : TAKEOFF;
break;
case OT_GOTO_DEPOT: // visit hangar for serivicing, sale, etc.
@@ -1625,7 +1578,8 @@
assert("OK, you shouldn't be here, check your Airport Scheme!" && 0);
}
-static void AircraftEventHandler_TakeOff(Vehicle *v, const AirportFTAClass *apc) {
+static void AircraftEventHandler_TakeOff(Vehicle *v, const AirportFTAClass *apc)
+{
PlayAircraftSound(v); // play takeoffsound for airplanes
v->u.air.state = STARTTAKEOFF;
}
@@ -1639,7 +1593,7 @@
static void AircraftEventHandler_EndTakeOff(Vehicle *v, const AirportFTAClass *apc)
{
v->u.air.state = FLYING;
- // get the next position to go to, differs per airport
+ /* get the next position to go to, differs per airport */
AircraftNextAirportPos_and_Order(v);
}
@@ -1648,11 +1602,11 @@
const Player* p = GetPlayer(v->owner);
v->sprite_width = v->sprite_height = 24; // ??? no idea what this is
v->u.air.state = FLYING;
- // get the next position to go to, differs per airport
+ /* get the next position to go to, differs per airport */
AircraftNextAirportPos_and_Order(v);
- // check if the aircraft needs to be replaced or renewed and send it to a hangar if needed
- // unless it is due for renewal but the engine is no longer available
+ /* check if the aircraft needs to be replaced or renewed and send it to a hangar if needed
+ * unless it is due for renewal but the engine is no longer available */
if (v->owner == _local_player && (
EngineHasReplacementForPlayer(p, v->engine_type) ||
((p->engine_renew && v->age - v->max_age > p->engine_renew_months * 30) &&
@@ -1666,33 +1620,29 @@
static void AircraftEventHandler_Flying(Vehicle *v, const AirportFTAClass *apc)
{
- Station *st;
- byte landingtype;
- AirportFTA *current;
- uint16 tcur_speed, tsubspeed;
+ Station *st = GetStation(v->u.air.targetairport);
- st = GetStation(v->u.air.targetairport);
- // runway busy or not allowed to use this airstation, circle
+ /* runway busy or not allowed to use this airstation, circle */
if (apc->flags & (v->subtype == AIR_HELICOPTER ? AirportFTAClass::HELICOPTERS : AirportFTAClass::AIRPLANES) &&
st->airport_tile != 0 &&
(st->owner == OWNER_NONE || st->owner == v->owner)) {
// {32,FLYING,NOTHING_block,37}, {32,LANDING,N,33}, {32,HELILANDING,N,41},
// if it is an airplane, look for LANDING, for helicopter HELILANDING
// it is possible to choose from multiple landing runways, so loop until a free one is found
- landingtype = (v->subtype == AIR_HELICOPTER) ? HELILANDING : LANDING;
- current = apc->layout[v->u.air.pos].next;
+ byte landingtype = (v->subtype == AIR_HELICOPTER) ? HELILANDING : LANDING;
+ const AirportFTA *current = apc->layout[v->u.air.pos].next;
while (current != NULL) {
if (current->heading == landingtype) {
- // save speed before, since if AirportHasBlock is false, it resets them to 0
- // we don't want that for plane in air
- // hack for speed thingie
- tcur_speed = v->cur_speed;
- tsubspeed = v->subspeed;
+ /* save speed before, since if AirportHasBlock is false, it resets them to 0
+ * we don't want that for plane in air
+ * hack for speed thingie */
+ uint16 tcur_speed = v->cur_speed;
+ uint16 tsubspeed = v->subspeed;
if (!AirportHasBlock(v, current, apc)) {
v->u.air.state = landingtype; // LANDING / HELILANDING
- // it's a bit dirty, but I need to set position to next position, otherwise
- // if there are multiple runways, plane won't know which one it took (because
- // they all have heading LANDING). And also occupy that block!
+ /* it's a bit dirty, but I need to set position to next position, otherwise
+ * if there are multiple runways, plane won't know which one it took (because
+ * they all have heading LANDING). And also occupy that block! */
v->u.air.pos = current->next_position;
SETBITS(st->airport_flags, apc->layout[v->u.air.pos].block);
return;
@@ -1709,15 +1659,15 @@
static void AircraftEventHandler_Landing(Vehicle *v, const AirportFTAClass *apc)
{
- const Player* p = GetPlayer(v->owner);
AircraftLandAirplane(v); // maybe crash airplane
v->u.air.state = ENDLANDING;
- // check if the aircraft needs to be replaced or renewed and send it to a hangar if needed
+ /* check if the aircraft needs to be replaced or renewed and send it to a hangar if needed */
if (v->current_order.type != OT_GOTO_DEPOT && v->owner == _local_player) {
- // only the vehicle owner needs to calculate the rest (locally)
+ /* only the vehicle owner needs to calculate the rest (locally) */
+ const Player* p = GetPlayer(v->owner);
if (EngineHasReplacementForPlayer(p, v->engine_type) ||
(p->engine_renew && v->age - v->max_age > (p->engine_renew_months * 30))) {
- // send the aircraft to the hangar at next airport
+ /* send the aircraft to the hangar at next airport */
_current_player = _local_player;
DoCommandP(v->tile, v->index, DEPOT_SERVICE, NULL, CMD_SEND_AIRCRAFT_TO_HANGAR | CMD_SHOW_NO_ERROR);
_current_player = OWNER_NONE;
@@ -1733,13 +1683,13 @@
static void AircraftEventHandler_EndLanding(Vehicle *v, const AirportFTAClass *apc)
{
- // next block busy, don't do a thing, just wait
+ /* next block busy, don't do a thing, just wait */
if (AirportHasBlock(v, &apc->layout[v->u.air.pos], apc)) return;
- // if going to terminal (OT_GOTO_STATION) choose one
- // 1. in case all terminals are busy AirportFindFreeTerminal() returns false or
- // 2. not going for terminal (but depot, no order),
- // --> get out of the way to the hangar.
+ /* if going to terminal (OT_GOTO_STATION) choose one
+ * 1. in case all terminals are busy AirportFindFreeTerminal() returns false or
+ * 2. not going for terminal (but depot, no order),
+ * --> get out of the way to the hangar. */
if (v->current_order.type == OT_GOTO_STATION) {
if (AirportFindFreeTerminal(v, apc)) return;
}
@@ -1749,16 +1699,16 @@
static void AircraftEventHandler_HeliEndLanding(Vehicle *v, const AirportFTAClass *apc)
{
- // next block busy, don't do a thing, just wait
+ /* next block busy, don't do a thing, just wait */
if (AirportHasBlock(v, &apc->layout[v->u.air.pos], apc)) return;
- // if going to helipad (OT_GOTO_STATION) choose one. If airport doesn't have helipads, choose terminal
- // 1. in case all terminals/helipads are busy (AirportFindFreeHelipad() returns false) or
- // 2. not going for terminal (but depot, no order),
- // --> get out of the way to the hangar IF there are terminals on the airport.
- // --> else TAKEOFF
- // the reason behind this is that if an airport has a terminal, it also has a hangar. Airplanes
- // must go to a hangar.
+ /* if going to helipad (OT_GOTO_STATION) choose one. If airport doesn't have helipads, choose terminal
+ * 1. in case all terminals/helipads are busy (AirportFindFreeHelipad() returns false) or
+ * 2. not going for terminal (but depot, no order),
+ * --> get out of the way to the hangar IF there are terminals on the airport.
+ * --> else TAKEOFF
+ * the reason behind this is that if an airport has a terminal, it also has a hangar. Airplanes
+ * must go to a hangar. */
if (v->current_order.type == OT_GOTO_STATION) {
if (AirportFindFreeHelipad(v, apc)) return;
}
@@ -1794,7 +1744,7 @@
static void AirportClearBlock(const Vehicle *v, const AirportFTAClass *apc)
{
- // we have left the previous block, and entered the new one. Free the previous block
+ /* we have left the previous block, and entered the new one. Free the previous block */
if (apc->layout[v->u.air.previous_pos].block != apc->layout[v->u.air.pos].block) {
Station *st = GetStation(v->u.air.targetairport);
@@ -1802,31 +1752,30 @@
}
}
-static void AirportGoToNextPosition(Vehicle *v, const AirportFTAClass *apc)
+static void AirportGoToNextPosition(Vehicle *v)
{
- // if aircraft is not in position, wait until it is
+ /* if aircraft is not in position, wait until it is */
if (!AircraftController(v)) return;
+ const AirportFTAClass *apc = GetStation(v->u.air.targetairport)->Airport();
+
AirportClearBlock(v, apc);
AirportMove(v, apc); // move aircraft to next position
}
-// gets pos from vehicle and next orders
+/* gets pos from vehicle and next orders */
static bool AirportMove(Vehicle *v, const AirportFTAClass *apc)
{
- AirportFTA *current;
- byte prev_pos;
-
- // error handling
+ /* error handling */
if (v->u.air.pos >= apc->nofelements) {
DEBUG(misc, 0, "[Ap] position %d is not valid for current airport. Max position is %d", v->u.air.pos, apc->nofelements-1);
assert(v->u.air.pos < apc->nofelements);
}
- current = &apc->layout[v->u.air.pos];
- // we have arrived in an important state (eg terminal, hangar, etc.)
+ const AirportFTA *current = &apc->layout[v->u.air.pos];
+ /* we have arrived in an important state (eg terminal, hangar, etc.) */
if (current->heading == v->u.air.state) {
- prev_pos = v->u.air.pos; // location could be changed in state, so save it before-hand
+ byte prev_pos = v->u.air.pos; // location could be changed in state, so save it before-hand
_aircraft_state_handlers[v->u.air.state](v, apc);
if (v->u.air.state != FLYING) v->u.air.previous_pos = prev_pos;
return true;
@@ -1834,7 +1783,7 @@
v->u.air.previous_pos = v->u.air.pos; // save previous location
- // there is only one choice to move to
+ /* there is only one choice to move to */
if (current->next == NULL) {
if (AirportSetBlocks(v, current, apc)) {
v->u.air.pos = current->next_position;
@@ -1842,8 +1791,8 @@
return false;
}
- // there are more choices to choose from, choose the one that
- // matches our heading
+ /* there are more choices to choose from, choose the one that
+ * matches our heading */
do {
if (v->u.air.state == current->heading || current->heading == TO_ALL) {
if (AirportSetBlocks(v, current, apc)) {
@@ -1859,18 +1808,18 @@
return false;
}
-// returns true if the road ahead is busy, eg. you must wait before proceeding
+/* returns true if the road ahead is busy, eg. you must wait before proceeding */
static bool AirportHasBlock(Vehicle *v, const AirportFTA *current_pos, const AirportFTAClass *apc)
{
const AirportFTA *reference = &apc->layout[v->u.air.pos];
const AirportFTA *next = &apc->layout[current_pos->next_position];
- // same block, then of course we can move
+ /* same block, then of course we can move */
if (apc->layout[current_pos->position].block != next->block) {
const Station *st = GetStation(v->u.air.targetairport);
uint64 airport_flags = next->block;
- // check additional possible extra blocks
+ /* check additional possible extra blocks */
if (current_pos != reference && current_pos->block != NOTHING_block) {
airport_flags |= current_pos->block;
}
@@ -1884,19 +1833,24 @@
return false;
}
-// returns true on success. Eg, next block was free and we have occupied it
-static bool AirportSetBlocks(Vehicle *v, AirportFTA *current_pos, const AirportFTAClass *apc)
+/**
+ * ...
+ * @param v airplane that requires the operation
+ * @param currentpos of the vehicle in the list of blocks
+ * @param apc airport on which block is requsted to be set
+ * @returns true on success. Eg, next block was free and we have occupied it
+ */
+static bool AirportSetBlocks(Vehicle *v, const AirportFTA *current_pos, const AirportFTAClass *apc)
{
- AirportFTA *next = &apc->layout[current_pos->next_position];
- AirportFTA *reference = &apc->layout[v->u.air.pos];
+ const AirportFTA *next = &apc->layout[current_pos->next_position];
+ const AirportFTA *reference = &apc->layout[v->u.air.pos];
- // if the next position is in another block, check it and wait until it is free
+ /* if the next position is in another block, check it and wait until it is free */
if ((apc->layout[current_pos->position].block & next->block) != next->block) {
uint64 airport_flags = next->block;
- Station* st = GetStation(v->u.air.targetairport);
- //search for all all elements in the list with the same state, and blocks != N
- // this means more blocks should be checked/set
- AirportFTA *current = current_pos;
+ /* search for all all elements in the list with the same state, and blocks != N
+ * this means more blocks should be checked/set */
+ const AirportFTA *current = current_pos;
if (current == reference) current = current->next;
while (current != NULL) {
if (current->heading == current_pos->heading && current->block != 0) {
@@ -1906,10 +1860,11 @@
current = current->next;
};
- // if the block to be checked is in the next position, then exclude that from
- // checking, because it has been set by the airplane before
+ /* if the block to be checked is in the next position, then exclude that from
+ * checking, because it has been set by the airplane before */
if (current_pos->block == next->block) airport_flags ^= next->block;
+ Station* st = GetStation(v->u.air.targetairport);
if (HASBITS(st->airport_flags, airport_flags)) {
v->cur_speed = 0;
v->subspeed = 0;
@@ -1928,7 +1883,7 @@
Station *st = GetStation(v->u.air.targetairport);
for (; i < last_terminal; i++) {
if (!HASBIT(st->airport_flags, _airport_terminal_flag[i])) {
- // TERMINAL# HELIPAD#
+ /* TERMINAL# HELIPAD# */
v->u.air.state = _airport_terminal_state[i]; // start moving to that terminal/helipad
SETBIT(st->airport_flags, _airport_terminal_flag[i]); // occupy terminal/helipad
return true;
@@ -1940,9 +1895,8 @@
static uint GetNumTerminals(const AirportFTAClass *apc)
{
uint num = 0;
- uint i;
- for (i = apc->terminals[0]; i > 0; i--) num += apc->terminals[i];
+ for (uint i = apc->terminals[0]; i > 0; i--) num += apc->terminals[i];
return num;
}
@@ -1960,28 +1914,25 @@
* fails, then attempt fails and plane waits
*/
if (apc->terminals[0] > 1) {
- Station *st = GetStation(v->u.air.targetairport);
- AirportFTA *temp = apc->layout[v->u.air.pos].next;
+ const Station *st = GetStation(v->u.air.targetairport);
+ const AirportFTA *temp = apc->layout[v->u.air.pos].next;
while (temp != NULL) {
if (temp->heading == 255) {
if (!HASBITS(st->airport_flags, temp->block)) {
- int target_group;
- int i;
- int group_start = 0;
- int group_end;
+ /* read which group do we want to go to?
+ * (the first free group) */
+ uint target_group = temp->next_position + 1;
- //read which group do we want to go to?
- //(the first free group)
- target_group = temp->next_position + 1;
+ /* at what terminal does the group start?
+ * that means, sum up all terminals of
+ * groups with lower number */
+ uint group_start = 0;
+ for (uint i = 1; i < target_group; i++) {
+ group_start += apc->terminals[i];
+ }
- //at what terminal does the group start?
- //that means, sum up all terminals of
- //groups with lower number
- for (i = 1; i < target_group; i++)
- group_start += apc->terminals[i];
-
- group_end = group_start + apc->terminals[target_group];
+ uint group_end = group_start + apc->terminals[target_group];
if (FreeTerminal(v, group_start, group_end)) return true;
}
} else {
@@ -1993,16 +1944,15 @@
}
}
- // if there is only 1 terminalgroup, all terminals are checked (starting from 0 to max)
+ /* if there is only 1 terminalgroup, all terminals are checked (starting from 0 to max) */
return FreeTerminal(v, 0, GetNumTerminals(apc));
}
static uint GetNumHelipads(const AirportFTAClass *apc)
{
uint num = 0;
- uint i;
- for (i = apc->helipads[0]; i > 0; i--) num += apc->helipads[i];
+ for (uint i = apc->helipads[0]; i > 0; i--) num += apc->helipads[i];
return num;
}
@@ -2010,10 +1960,10 @@
static bool AirportFindFreeHelipad(Vehicle *v, const AirportFTAClass *apc)
{
- // if an airport doesn't have helipads, use terminals
+ /* if an airport doesn't have helipads, use terminals */
if (apc->helipads == NULL) return AirportFindFreeTerminal(v, apc);
- // if there are more helicoptergroups, pick one, just as in AirportFindFreeTerminal()
+ /* if there are more helicoptergroups, pick one, just as in AirportFindFreeTerminal() */
if (apc->helipads[0] > 1) {
const Station* st = GetStation(v->u.air.targetairport);
const AirportFTA* temp = apc->layout[v->u.air.pos].next;
@@ -2021,22 +1971,20 @@
while (temp != NULL) {
if (temp->heading == 255) {
if (!HASBITS(st->airport_flags, temp->block)) {
- int target_group;
- int i;
- int group_start = 0;
- int group_end;
- //read which group do we want to go to?
- //(the first free group)
- target_group = temp->next_position + 1;
+ /* read which group do we want to go to?
+ * (the first free group) */
+ uint target_group = temp->next_position + 1;
- //at what terminal does the group start?
- //that means, sum up all terminals of
- //groups with lower number
- for (i = 1; i < target_group; i++)
+ /* at what terminal does the group start?
+ * that means, sum up all terminals of
+ * groups with lower number */
+ uint group_start = 0;
+ for (uint i = 1; i < target_group; i++) {
group_start += apc->helipads[i];
+ }
- group_end = group_start + apc->helipads[target_group];
+ uint group_end = group_start + apc->helipads[target_group];
if (FreeTerminal(v, group_start, group_end)) return true;
}
} else {
@@ -2047,8 +1995,8 @@
temp = temp->next;
}
} else {
- // only 1 helicoptergroup, check all helipads
- // The blocks for helipads start after the last terminal (MAX_TERMINALS)
+ /* only 1 helicoptergroup, check all helipads
+ * The blocks for helipads start after the last terminal (MAX_TERMINALS) */
return FreeTerminal(v, MAX_TERMINALS, GetNumHelipads(apc) + MAX_TERMINALS);
}
return false; // it shouldn't get here anytime, but just to be sure
@@ -2080,20 +2028,18 @@
if (v->current_order.type >= OT_LOADING) return;
- AirportGoToNextPosition(v, GetStation(v->u.air.targetairport)->Airport());
+ AirportGoToNextPosition(v);
}
void Aircraft_Tick(Vehicle *v)
{
- int i;
-
if (!IsNormalAircraft(v)) return;
if (v->subtype == AIR_HELICOPTER) HelicopterTickHandler(v);
AgeAircraftCargo(v);
- for (i = 0; i != 6; i++) {
+ for (uint i = 0; i != 6; i++) {
AircraftEventHandler(v, i);
if (v->type != VEH_Aircraft) // In case it was deleted
break;
@@ -2101,23 +2047,21 @@
}
-// need to be called to load aircraft from old version
+/** need to be called to load aircraft from old version */
void UpdateOldAircraft(void)
{
+ /* set airport_flags to 0 for all airports just to be sure */
Station *st;
- Vehicle *v_oldstyle;
- GetNewVehiclePosResult gp;
-
- // set airport_flags to 0 for all airports just to be sure
FOR_ALL_STATIONS(st) {
st->airport_flags = 0; // reset airport
}
+ Vehicle *v_oldstyle;
FOR_ALL_VEHICLES(v_oldstyle) {
- // airplane has another vehicle with subtype 4 (shadow), helicopter also has 3 (rotor)
- // skip those
+ /* airplane has another vehicle with subtype 4 (shadow), helicopter also has 3 (rotor)
+ * skip those */
if (v_oldstyle->type == VEH_Aircraft && IsNormalAircraft(v_oldstyle)) {
- // airplane in terminal stopped doesn't hurt anyone, so goto next
+ /* airplane in terminal stopped doesn't hurt anyone, so goto next */
if (v_oldstyle->vehstatus & VS_STOPPED && v_oldstyle->u.air.state == 0) {
v_oldstyle->u.air.state = HANGAR;
continue;
@@ -2127,46 +2071,43 @@
v_oldstyle->vehstatus &= ~VS_STOPPED; // make airplane moving
v_oldstyle->u.air.state = FLYING;
AircraftNextAirportPos_and_Order(v_oldstyle); // move it to the entry point of the airport
- GetNewVehiclePos(v_oldstyle, &gp); // get the position of the plane (to be used for setting)
+ GetNewVehiclePosResult gp = GetNewVehiclePos(v_oldstyle);
v_oldstyle->tile = 0; // aircraft in air is tile=0
- // correct speed of helicopter-rotors
+ /* correct speed of helicopter-rotors */
if (v_oldstyle->subtype == AIR_HELICOPTER) v_oldstyle->next->next->cur_speed = 32;
- // set new position x,y,z
+ /* set new position x,y,z */
SetAircraftPosition(v_oldstyle, gp.x, gp.y, GetAircraftFlyingAltitude(v_oldstyle));
}
}
}
-void UpdateAirplanesOnNewStation(Station *st)
+void UpdateAirplanesOnNewStation(const Station *st)
{
- GetNewVehiclePosResult gp;
+ /* only 1 station is updated per function call, so it is enough to get entry_point once */
+ const AirportFTAClass *ap = st->Airport();
+
Vehicle *v;
- byte takeofftype;
- uint16 cnt;
- // only 1 station is updated per function call, so it is enough to get entry_point once
- const AirportFTAClass *ap = st->Airport();
FOR_ALL_VEHICLES(v) {
if (v->type == VEH_Aircraft && IsNormalAircraft(v)) {
if (v->u.air.targetairport == st->index) { // if heading to this airport
/* update position of airplane. If plane is not flying, landing, or taking off
- *you cannot delete airport, so it doesn't matter
- */
+ *you cannot delete airport, so it doesn't matter */
if (v->u.air.state >= FLYING) { // circle around
v->u.air.pos = v->u.air.previous_pos = AircraftGetEntryPoint(v, ap);
v->u.air.state = FLYING;
- // landing plane needs to be reset to flying height (only if in pause mode upgrade,
- // in normal mode, plane is reset in AircraftController. It doesn't hurt for FLYING
- GetNewVehiclePos(v, &gp);
- // set new position x,y,z
+ /* landing plane needs to be reset to flying height (only if in pause mode upgrade,
+ * in normal mode, plane is reset in AircraftController. It doesn't hurt for FLYING */
+ GetNewVehiclePosResult gp = GetNewVehiclePos(v);
+ /* set new position x,y,z */
SetAircraftPosition(v, gp.x, gp.y, GetAircraftFlyingAltitude(v));
} else {
assert(v->u.air.state == ENDTAKEOFF || v->u.air.state == HELITAKEOFF);
- takeofftype = (v->subtype == AIR_HELICOPTER) ? HELITAKEOFF : ENDTAKEOFF;
- // search in airportdata for that heading
- // easiest to do, since this doesn't happen a lot
- for (cnt = 0; cnt < ap->nofelements; cnt++) {
+ byte takeofftype = (v->subtype == AIR_HELICOPTER) ? HELITAKEOFF : ENDTAKEOFF;
+ /* search in airportdata for that heading
+ * easiest to do, since this doesn't happen a lot */
+ for (uint cnt = 0; cnt < ap->nofelements; cnt++) {
if (ap->layout[cnt].heading == takeofftype) {
v->u.air.pos = ap->layout[cnt].position;
break;
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/aircraft_gui.cpp
--- a/src/aircraft_gui.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/aircraft_gui.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file aircraft_gui.cpp */
+
#include "stdafx.h"
#include "openttd.h"
#include "aircraft.h"
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/airport.cpp
--- a/src/airport.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/airport.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file airport.cpp */
+
#include "stdafx.h"
#include "openttd.h"
#include "debug.h"
@@ -288,11 +290,10 @@
* know one element from the other by differing 'position' identifiers */
static uint16 AirportGetNofElements(const AirportFTAbuildup *apFA)
{
- int i;
uint16 nofelements = 0;
int temp = apFA[0].position;
- for (i = 0; i < MAX_ELEMENTS; i++) {
+ for (uint i = 0; i < MAX_ELEMENTS; i++) {
if (temp != apFA[i].position) {
nofelements++;
temp = apFA[i].position;
@@ -307,12 +308,11 @@
* groups there are, and then the number of terminals for each group */
static byte AirportGetTerminalCount(const byte *terminals, byte *groups)
{
- byte i;
byte nof_terminals = 0;
*groups = 0;
if (terminals != NULL) {
- i = terminals[0];
+ uint i = terminals[0];
*groups = i;
while (i-- > 0) {
terminals++;
@@ -326,12 +326,11 @@
static AirportFTA* AirportBuildAutomata(uint nofelements, const AirportFTAbuildup *apFA)
{
- AirportFTA *current;
AirportFTA *FAutomata = MallocT(nofelements);
uint16 internalcounter = 0;
for (uint i = 0; i < nofelements; i++) {
- current = &FAutomata[i];
+ AirportFTA *current = &FAutomata[i];
current->position = apFA[internalcounter].position;
current->heading = apFA[internalcounter].heading;
current->block = apFA[internalcounter].block;
@@ -349,7 +348,7 @@
current->next = newNode;
current = current->next;
internalcounter++;
- } // while
+ }
current->next = NULL;
internalcounter++;
}
@@ -365,9 +364,8 @@
uint position = layout[i].position;
if (position != next_position) return i;
const AirportFTA *first = &layout[i];
- const AirportFTA *current = first;
- for (; current != NULL; current = current->next) {
+ for (const AirportFTA *current = first; current != NULL; current = current->next) {
/* A heading must always be valid. The only exceptions are
* - multiple choices as start, identified by a special value of 255
* - terminal group which is identified by a special value of 255 */
@@ -434,9 +432,7 @@
if (!full_report) printf("(P = Current Position; NP = Next Position)\n");
for (uint i = 0; i < nofelements; i++) {
- const AirportFTA *current = &layout[i];
-
- for (; current != NULL; current = current->next) {
+ for (const AirportFTA *current = &layout[i]; current != NULL; current = current->next) {
if (full_report) {
byte heading = (current->heading == 255) ? MAX_HEADINGS + 1 : current->heading;
printf("\tPos:%2d NPos:%2d Heading:%15s Block:%2d\n", current->position,
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/airport.h
--- a/src/airport.h Tue Feb 27 23:54:28 2007 +0000
+++ b/src/airport.h Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file airport.h Various declarations for airports */
+
#ifndef AIRPORT_H
#define AIRPORT_H
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/airport_gui.cpp
--- a/src/airport_gui.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/airport_gui.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file airport_gui.cpp */
+
#include "stdafx.h"
#include "openttd.h"
#include "table/sprites.h"
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/airport_movement.h
--- a/src/airport_movement.h Tue Feb 27 23:54:28 2007 +0000
+++ b/src/airport_movement.h Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file airport_movement.h Heart of the airports and their finite state machines */
+
#ifndef AIRPORT_MOVEMENT_H
#define AIRPORT_MOVEMENT_H
@@ -406,7 +408,7 @@
static const TileIndexDiffC _airport_depots_commuter[] = { { 4, 0 } };
static const byte _airport_terminal_commuter[] = { 1, 3 };
static const byte _airport_helipad_commuter[] = { 1, 2 };
-static const byte _airport_entries_commuter[] = {7, 7, 7, 7};
+static const byte _airport_entries_commuter[] = {21, 21, 21, 21};
static const AirportFTAbuildup _airport_fta_commuter[] = {
{ 0, HANGAR, NOTHING_block, 1 }, { 0, HELITAKEOFF, HELIPAD2_block, 1 }, { 0, 0, 0, 1 },
{ 1, 255, TAXIWAY_BUSY_block, 0 }, { 1, HANGAR, 0, 0 }, { 1, TAKEOFF, 0, 11 }, { 1, TERM1, TAXIWAY_BUSY_block, 10 }, { 1, TERM2, TAXIWAY_BUSY_block, 10 }, { 1, TERM3, TAXIWAY_BUSY_block, 10 }, { 1, HELIPAD1, TAXIWAY_BUSY_block, 10 }, { 1, HELIPAD2, TAXIWAY_BUSY_block, 10 }, { 1, HELITAKEOFF, TAXIWAY_BUSY_block, 10 }, { 1, 0, 0, 0 },
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/autoreplace_gui.cpp
--- a/src/autoreplace_gui.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/autoreplace_gui.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file autoreplace_gui.cpp */
+
#include "stdafx.h"
#include "openttd.h"
#include "debug.h"
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/aystar.cpp
--- a/src/aystar.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/aystar.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file aystar.cpp */
+
/*
* This file has the core function for AyStar
* AyStar is a fast pathfinding routine and is used for things like
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/aystar.h
--- a/src/aystar.h Tue Feb 27 23:54:28 2007 +0000
+++ b/src/aystar.h Wed Feb 28 00:33:40 2007 +0000
@@ -1,6 +1,6 @@
/* $Id$ */
-/*
+/** @file aystar.h
* This file has the header for AyStar
* AyStar is a fast pathfinding routine and is used for things like
* AI_pathfinding and Train_pathfinding.
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/bmp.cpp
--- a/src/bmp.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/bmp.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file bmp.cpp */
+
#include "stdafx.h"
#include "openttd.h"
#include "gfx.h"
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/bmp.h
--- a/src/bmp.h Tue Feb 27 23:54:28 2007 +0000
+++ b/src/bmp.h Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file bmp.h */
+
#ifndef BMP_H
#define BMP_H
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/bridge.h
--- a/src/bridge.h Tue Feb 27 23:54:28 2007 +0000
+++ b/src/bridge.h Wed Feb 28 00:33:40 2007 +0000
@@ -28,6 +28,11 @@
extern Bridge _bridge[MAX_BRIDGES];
uint GetBridgeFoundation(Slope tileh, Axis axis);
-uint SetSpeedLimitOnBridge(Vehicle *);
+
+static inline const Bridge *GetBridge(uint i)
+{
+ assert(i < lengthof(_bridge));
+ return &_bridge[i];
+}
#endif /* BRIDGE_H */
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/bridge_gui.cpp
--- a/src/bridge_gui.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/bridge_gui.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -1,6 +1,6 @@
/* $Id$ */
-/** @file bridge_gui.c Graphical user interface for bridge construction*/
+/** @file bridge_gui.cpp Graphical user interface for bridge construction */
#include "stdafx.h"
#include "openttd.h"
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/bridge_map.cpp
--- a/src/bridge_map.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/bridge_map.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file bridge_map.cpp */
+
#include "stdafx.h"
#include "openttd.h"
#include "bridge_map.h"
@@ -43,7 +45,7 @@
Slope tileh = GetTileSlope(t, &h);
uint f = GetBridgeFoundation(tileh, DiagDirToAxis(GetBridgeRampDirection(t)));
- // one height level extra if the ramp is on a flat foundation
+ /* one height level extra if the ramp is on a flat foundation */
return
h + TILE_HEIGHT +
(IS_INT_INSIDE(f, 1, 15) ? TILE_HEIGHT : 0) +
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/bridge_map.h
--- a/src/bridge_map.h Tue Feb 27 23:54:28 2007 +0000
+++ b/src/bridge_map.h Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file bridge_map.h */
+
#ifndef BRIDGE_MAP_H
#define BRIDGE_MAP_H
@@ -59,6 +61,8 @@
/**
* Get the direction pointing onto the bridge
+ * @param tile The tile to analyze
+ * @return the above mentionned direction
*/
static inline DiagDirection GetBridgeRampDirection(TileIndex t)
{
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/build_vehicle_gui.cpp
--- a/src/build_vehicle_gui.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/build_vehicle_gui.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file build_vehicle_gui.cpp */
+
#include "stdafx.h"
#include "openttd.h"
#include "train.h"
@@ -24,6 +26,7 @@
#include "newgrf_engine.h"
#include "date.h"
#include "strings.h"
+#include "cargotype.h"
enum BuildVehicleWidgets {
@@ -381,7 +384,7 @@
/* Wagon weight - (including cargo) */
SetDParam(0, rvi->weight);
- SetDParam(1, (_cargoc.weights[rvi->cargo_type] * rvi->capacity >> 4) + rvi->weight);
+ SetDParam(1, (GetCargo(rvi->cargo_type)->weight * rvi->capacity >> 4) + rvi->weight);
DrawString(x, y, STR_PURCHASE_INFO_WEIGHT_CWEIGHT, 0);
y += 10;
@@ -505,7 +508,7 @@
/* Note, if the default capacity is selected by the refit capacity
* callback, then the capacity shown is likely to be incorrect. */
SetDParam(0, cargo);
- SetDParam(1, AircraftDefaultCargoCapacity(cargo, engine_number));
+ SetDParam(1, AircraftDefaultCargoCapacity(cargo, avi));
SetDParam(2, STR_9842_REFITTABLE);
DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, 0);
}
@@ -606,9 +609,9 @@
EngList_RemoveAll(&bv->eng_list);
/* Make list of all available train engines and wagons.
- * Also check to see if the previously selected engine is still available,
- * and if not, reset selection to INVALID_ENGINE. This could be the case
- * when engines become obsolete and are removed */
+ * Also check to see if the previously selected engine is still available,
+ * and if not, reset selection to INVALID_ENGINE. This could be the case
+ * when engines become obsolete and are removed */
for (sel_id = INVALID_ENGINE, eid = 0; eid < NUM_TRAIN_ENGINES; eid++) {
const RailVehicleInfo *rvi = RailVehInfo(eid);
@@ -627,15 +630,15 @@
bv->sel_engine = sel_id;
- // make engines first, and then wagons, sorted by ListPositionOfEngine()
+ /* make engines first, and then wagons, sorted by ListPositionOfEngine() */
_internal_sort_order = false;
EngList_Sort(&bv->eng_list, TrainEnginesThenWagonsSorter);
- // and then sort engines
+ /* and then sort engines */
_internal_sort_order = bv->descending_sort_order;
EngList_SortPartial(&bv->eng_list, _sorter[0][bv->sort_criteria], 0, num_engines);
- // and finally sort wagons
+ /* and finally sort wagons */
EngList_SortPartial(&bv->eng_list, _sorter[0][bv->sort_criteria], num_engines, num_wagons);
}
@@ -693,13 +696,13 @@
for (eid = AIRCRAFT_ENGINES_INDEX; eid < AIRCRAFT_ENGINES_INDEX + NUM_AIRCRAFT_ENGINES; eid++) {
if (IsEngineBuildable(eid, VEH_Aircraft, _local_player)) {
const AircraftVehicleInfo *avi = AircraftVehInfo(eid);
- switch (bv->filter.flags & ~AirportFTAClass::SHORT_STRIP /* we don't care about the length of the runway here */) {
+ switch (bv->filter.flags & ~AirportFTAClass::SHORT_STRIP) { // we don't care about the length of the runway here
case AirportFTAClass::HELICOPTERS:
- if (avi->subtype != AIR_HELICOPTER) continue;
+ if (avi->subtype != AIR_HELI) continue;
break;
case AirportFTAClass::AIRPLANES:
- if (avi->subtype != AIR_AIRCRAFT) continue;
+ if (!(avi->subtype & AIR_CTOL)) continue;
break;
case AirportFTAClass::ALL: break;
@@ -707,9 +710,6 @@
NOT_REACHED();
}
- if (bv->filter.flags & AirportFTAClass::SHORT_STRIP &&
- avi->subtype & AIR_FAST && !_cheats.no_jetcrash.value) continue; // don't build large aircraft in small airports
-
EngList_Add(&bv->eng_list, eid);
if (eid == bv->sel_engine) sel_id = eid;
@@ -936,7 +936,7 @@
break;
}
- case WE_DROPDOWN_SELECT: /* we have selected a dropdown item in the list */
+ case WE_DROPDOWN_SELECT: // we have selected a dropdown item in the list
if (bv->sort_criteria != e->we.dropdown.index) {
bv->sort_criteria = e->we.dropdown.index;
_last_sort_criteria[bv->vehicle_type] = bv->sort_criteria;
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/callback_table.cpp
--- a/src/callback_table.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/callback_table.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -1,57 +1,59 @@
/* $Id$ */
+/** @file callback_table.cpp */
+
#include "stdafx.h"
#include "openttd.h"
#include "callback_table.h"
#include "functions.h"
-// If you add a callback for DoCommandP, also add the callback in here
-// see below for the full list!
-// If you don't do it, it won't work across the network!!
+/* If you add a callback for DoCommandP, also add the callback in here
+ * see below for the full list!
+ * If you don't do it, it won't work across the network!! */
-/* aircraft_gui.c */
+/* aircraft_gui.cpp */
CommandCallback CcBuildAircraft;
CommandCallback CcCloneAircraft;
-/* airport_gui.c */
+/* airport_gui.cpp */
CommandCallback CcBuildAirport;
-/* bridge_gui.c */
+/* bridge_gui.cpp */
CommandCallback CcBuildBridge;
-/* dock_gui.c */
+/* dock_gui.cpp */
CommandCallback CcBuildDocks;
CommandCallback CcBuildCanal;
-/* depot_gui.c */
+/* depot_gui.cpp */
CommandCallback CcCloneVehicle;
-/* main_gui.c */
+/* main_gui.cpp */
CommandCallback CcPlaySound10;
CommandCallback CcPlaceSign;
CommandCallback CcTerraform;
CommandCallback CcBuildTown;
-/* rail_gui.c */
+/* rail_gui.cpp */
CommandCallback CcPlaySound1E;
CommandCallback CcRailDepot;
CommandCallback CcStation;
CommandCallback CcBuildRailTunnel;
-/* road_gui.c */
+/* road_gui.cpp */
CommandCallback CcPlaySound1D;
CommandCallback CcBuildRoadTunnel;
CommandCallback CcRoadDepot;
-/* roadveh_gui.c */
+/* roadveh_gui.cpp */
CommandCallback CcBuildRoadVeh;
CommandCallback CcCloneRoadVeh;
-/* ship_gui.c */
+/* ship_gui.cpp */
CommandCallback CcBuildShip;
CommandCallback CcCloneShip;
-/* train_gui.c */
+/* train_gui.cpp */
CommandCallback CcBuildWagon;
CommandCallback CcBuildLoco;
CommandCallback CcCloneTrain;
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/callback_table.h
--- a/src/callback_table.h Tue Feb 27 23:54:28 2007 +0000
+++ b/src/callback_table.h Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file callback_table.h */
+
#ifndef CALLBACK_TABLE_H
#define CALLBACK_TABLE_H
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/cargotype.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/cargotype.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -0,0 +1,72 @@
+/* $Id$ */
+
+/** @file cargotype.cpp */
+
+#include "stdafx.h"
+#include "openttd.h"
+#include "macros.h"
+#include "table/sprites.h"
+#include "table/strings.h"
+#include "newgrf_cargo.h"
+#include "cargotype.h"
+
+#include "table/cargo_const.h"
+
+static CargoSpec _cargo[NUM_CARGO];
+
+static const byte INVALID_CARGO = 0xFF;
+
+/* Bitmask of cargo types available */
+uint32 _cargo_mask;
+
+
+void SetupCargoForClimate(LandscapeID l)
+{
+ assert(l < lengthof(_default_climate_cargo));
+
+ /* Reset and disable all cargo types */
+ memset(_cargo, 0, sizeof(_cargo));
+ for (CargoID i = 0; i < lengthof(_cargo); i++) _cargo[i].bitnum = INVALID_CARGO;
+
+ _cargo_mask = 0;
+
+ for (CargoID i = 0; i < lengthof(_default_climate_cargo[l]); i++) {
+ CargoLabel cl = _default_climate_cargo[l][i];
+
+ /* Loop through each of the default cargo types to see if
+ * the label matches */
+ for (uint j = 0; j < lengthof(_default_cargo); j++) {
+ if (_default_cargo[j].label == cl) {
+ _cargo[i] = _default_cargo[j];
+
+ /* Populate the available cargo mask */
+ SETBIT(_cargo_mask, i);
+ break;
+ }
+ }
+ }
+}
+
+
+const CargoSpec *GetCargo(CargoID c)
+{
+ assert(c < lengthof(_cargo));
+ return &_cargo[c];
+}
+
+
+bool CargoSpec::IsValid() const
+{
+ return bitnum != INVALID_CARGO;
+}
+
+
+CargoID GetCargoIDByLabel(CargoLabel cl)
+{
+ for (CargoID c = 0; c < lengthof(_cargo); c++) {
+ if (_cargo[c].label == cl) return c;
+ }
+
+ /* No matching label was found, so it is invalid */
+ return CT_INVALID;
+}
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/cargotype.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/cargotype.h Wed Feb 28 00:33:40 2007 +0000
@@ -0,0 +1,52 @@
+/* $Id$ */
+
+/** @file cargotype.h */
+
+#ifndef CARGOTYPE_H
+#define CARGOTYPE_H
+
+
+typedef uint32 CargoLabel;
+
+
+typedef struct CargoSpec {
+ uint8 bitnum;
+ CargoLabel label;
+ uint32 grfid;
+ uint8 legend_colour;
+ uint8 rating_colour;
+ uint8 weight;
+ uint16 initial_payment;
+ uint8 transit_days[2];
+
+ bool is_freight;
+ uint8 substitutetowngrowth;
+ uint16 multipliertowngrowth;
+ uint8 callbackflags;
+
+ StringID name;
+ StringID name_plural;
+ StringID units_volume;
+ StringID quantifier;
+ StringID abbrev;
+
+ SpriteID sprite;
+
+ uint16 classes;
+
+ bool IsValid() const;
+} CargoSpec;
+
+
+extern uint32 _cargo_mask;
+
+
+/* Set up the default cargo types for the given landscape type */
+void SetupCargoForClimate(LandscapeID l);
+/* Retrieve cargo details for the given cargo ID */
+const CargoSpec *GetCargo(CargoID c);
+/* Get the cargo ID with the cargo label */
+CargoID GetCargoIDByLabel(CargoLabel cl);
+
+
+#endif /* CARGOTYPE_H */
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/clear_cmd.cpp
--- a/src/clear_cmd.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/clear_cmd.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file clear_cmd.cpp */
+
#include "stdafx.h"
#include "openttd.h"
#include "clear_map.h"
@@ -107,9 +109,9 @@
Slope tileh;
uint z;
- // Nothing could be built at the steep slope - this avoids a bug
- // when you have a single diagonal track in one corner on a
- // basement and then you raise/lower the other corner.
+ /* Nothing could be built at the steep slope - this avoids a bug
+ * when you have a single diagonal track in one corner on a
+ * basement and then you raise/lower the other corner. */
tileh = GetTileSlope(tile, &z);
if (tileh == unsafe_slope[mode] ||
tileh == ComplementSlope(unsafe_slope[mode])) {
@@ -118,8 +120,8 @@
return -1;
}
- // If we have a single diagonal track there, the other side of
- // tile can be terraformed.
+ /* If we have a single diagonal track there, the other side of
+ * tile can be terraformed. */
if (IsPlainRailTile(tile) && GetTrackBits(tile) == safe_track[mode]) {
/* If terraforming downwards prevent damaging a potential tunnel below.
* This check is only necessary for flat tiles, because if the tile is
@@ -223,8 +225,10 @@
/** Terraform land
* @param tile tile to terraform
+ * @param flags for this command type
* @param p1 corners to terraform.
* @param p2 direction; eg up or down
+ * @return error or cost of terraforming
*/
int32 CmdTerraformLand(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
@@ -346,8 +350,10 @@
/** Levels a selected (rectangle) area of land
* @param tile end tile of area-drag
+ * @param flags for this command type
* @param p1 start tile of area drag
* @param p2 unused
+ * @return error or cost of terraforming
*/
int32 CmdLevelLand(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
@@ -362,16 +368,16 @@
SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
- // remember level height
+ /* remember level height */
h = TileHeight(p1);
- // make sure sx,sy are smaller than ex,ey
+ /* make sure sx,sy are smaller than ex,ey */
ex = TileX(tile);
ey = TileY(tile);
sx = TileX(p1);
sy = TileY(p1);
- if (ex < sx) intswap(ex, sx);
- if (ey < sy) intswap(ey, sy);
+ if (ex < sx) Swap(ex, sx);
+ if (ey < sy) Swap(ey, sy);
tile = TileXY(sx, sy);
size_x = ex-sx+1;
@@ -405,8 +411,10 @@
/** Purchase a land area. Actually you only purchase one tile, so
* the name is a bit confusing ;p
* @param tile the tile the player is purchasing
+ * @param flags for this command type
* @param p1 unused
* @param p2 unused
+ * @return error of cost of operation
*/
int32 CmdPurchaseLandArea(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
@@ -459,8 +467,10 @@
/** Sell a land area. Actually you only sell one tile, so
* the name is a bit confusing ;p
* @param tile the tile the player is selling
+ * @param flags for this command type
* @param p1 unused
* @param p2 unused
+ * @return error or cost of operation
*/
int32 CmdSellLandArea(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
@@ -787,17 +797,17 @@
}
extern const TileTypeProcs _tile_type_clear_procs = {
- DrawTile_Clear, /* draw_tile_proc */
- GetSlopeZ_Clear, /* get_slope_z_proc */
- ClearTile_Clear, /* clear_tile_proc */
- GetAcceptedCargo_Clear, /* get_accepted_cargo_proc */
- GetTileDesc_Clear, /* get_tile_desc_proc */
- GetTileTrackStatus_Clear, /* get_tile_track_status_proc */
- ClickTile_Clear, /* click_tile_proc */
- AnimateTile_Clear, /* animate_tile_proc */
- TileLoop_Clear, /* tile_loop_clear */
- ChangeTileOwner_Clear, /* change_tile_owner_clear */
- NULL, /* get_produced_cargo_proc */
- NULL, /* vehicle_enter_tile_proc */
- GetSlopeTileh_Clear, /* get_slope_tileh_proc */
+ DrawTile_Clear, ///< draw_tile_proc
+ GetSlopeZ_Clear, ///< get_slope_z_proc
+ ClearTile_Clear, ///< clear_tile_proc
+ GetAcceptedCargo_Clear, ///< get_accepted_cargo_proc
+ GetTileDesc_Clear, ///< get_tile_desc_proc
+ GetTileTrackStatus_Clear, ///< get_tile_track_status_proc
+ ClickTile_Clear, ///< click_tile_proc
+ AnimateTile_Clear, ///< animate_tile_proc
+ TileLoop_Clear, ///< tile_loop_clear
+ ChangeTileOwner_Clear, ///< change_tile_owner_clear
+ NULL, ///< get_produced_cargo_proc
+ NULL, ///< vehicle_enter_tile_proc
+ GetSlopeTileh_Clear, ///< get_slope_tileh_proc
};
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/clear_map.h
--- a/src/clear_map.h Tue Feb 27 23:54:28 2007 +0000
+++ b/src/clear_map.h Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file clear_map.h */
+
#ifndef CLEAR_MAP_H
#define CLEAR_MAP_H
@@ -11,12 +13,12 @@
* valid densities (bits 0...1) in comments after the enum
*/
typedef enum ClearGround {
- CLEAR_GRASS = 0, // 0-3
- CLEAR_ROUGH = 1, // 3
- CLEAR_ROCKS = 2, // 3
- CLEAR_FIELDS = 3, // 3
- CLEAR_SNOW = 4, // 0-3
- CLEAR_DESERT = 5 // 1,3
+ CLEAR_GRASS = 0, ///< 0-3
+ CLEAR_ROUGH = 1, ///< 3
+ CLEAR_ROCKS = 2, ///< 3
+ CLEAR_FIELDS = 3, ///< 3
+ CLEAR_SNOW = 4, ///< 0-3
+ CLEAR_DESERT = 5 ///< 1,3
} ClearGround;
@@ -134,7 +136,7 @@
_m[t].m3 = 0;
_m[t].m4 = 0 << 5 | 0 << 2;
SetClearGroundDensity(t, g, density);
- SB(_m[t].m6, 2, 4, 0); ///< Clear the rest of m6, bits 2 to 5
+ SB(_m[t].m6, 2, 4, 0); // Clear the rest of m6, bits 2 to 5
}
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/cmd_helper.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/cmd_helper.h Wed Feb 28 00:33:40 2007 +0000
@@ -0,0 +1,28 @@
+/* $Id$ */
+
+#ifndef CMD_HELPER_H
+#define CMD_HELPER_H
+
+#include "direction.h"
+#include "macros.h"
+#include "road.h"
+
+
+template static inline void ExtractValid();
+template<> static inline void ExtractValid<1>() {}
+
+
+template struct ExtractBits;
+template<> struct ExtractBits { static const uint Count = 1; };
+template<> struct ExtractBits { static const uint Count = 2; };
+template<> struct ExtractBits { static const uint Count = 4; };
+
+
+template static inline T Extract(U v)
+{
+ // Check if there are enough bits in v
+ ExtractValid::Count <= sizeof(U) * 8>();
+ return (T)GB(v, N, ExtractBits::Count);
+}
+
+#endif
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/command.cpp
--- a/src/command.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/command.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file command.cpp */
+
#include "stdafx.h"
#include "openttd.h"
#include "table/strings.h"
@@ -347,7 +349,7 @@
_docommand_recursive++;
- // only execute the test call if it's toplevel, or we're not execing.
+ /* only execute the test call if it's toplevel, or we're not execing. */
if (_docommand_recursive == 1 || !(flags & DC_EXEC) || (flags & DC_FORCETEST) ) {
res = proc(tile, flags & ~DC_EXEC, p1, p2);
if (CmdFailed(res)) {
@@ -380,10 +382,10 @@
return CMD_ERROR;
}
- // if toplevel, subtract the money.
+ /* if toplevel, subtract the money. */
if (--_docommand_recursive == 0) {
SubtractMoneyFromPlayer(res);
- // XXX - Old AI hack which doesn't use DoCommandDP; update last build coord of player
+ /* XXX - Old AI hack which doesn't use DoCommandDP; update last build coord of player */
if (tile != 0 && IsValidPlayer(_current_player)) {
GetPlayer(_current_player)->last_build_coordinate = tile;
}
@@ -400,8 +402,8 @@
return GetPlayer(pid)->player_money;
}
-// toplevel network safe docommand function for the current player. must not be called recursively.
-// the callback is called when the command succeeded or failed.
+/* toplevel network safe docommand function for the current player. must not be called recursively.
+ * the callback is called when the command succeeded or failed. */
bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback, uint32 cmd)
{
int32 res = 0,res2;
@@ -437,7 +439,7 @@
if (cmd & CMD_AUTO) flags |= DC_AUTO;
if (cmd & CMD_NO_WATER) flags |= DC_NO_WATER;
- // get pointer to command handler
+ /* get pointer to command handler */
assert((cmd & 0xFF) < lengthof(_command_proc_table));
proc = _command_proc_table[cmd & 0xFF].proc;
if (proc == NULL) {
@@ -445,15 +447,15 @@
return false;
}
- // Some commands have a different output in dryrun than the realrun
- // e.g.: if you demolish a whole town, the dryrun would say okay.
- // but by really destroying, your rating drops and at a certain point
- // it will fail. so res and res2 are different
- // CMD_REMOVE_ROAD: This command has special local authority
- // restrictions which may cause the test run to fail (the previous
- // road fragments still stay there and the town won't let you
- // disconnect the road system), but the exec will succeed and this
- // fact will trigger an assertion failure. --pasky
+ /* Some commands have a different output in dryrun than the realrun
+ * e.g.: if you demolish a whole town, the dryrun would say okay.
+ * but by really destroying, your rating drops and at a certain point
+ * it will fail. so res and res2 are different
+ * CMD_REMOVE_ROAD: This command has special local authority
+ * restrictions which may cause the test run to fail (the previous
+ * road fragments still stay there and the town won't let you
+ * disconnect the road system), but the exec will succeed and this
+ * fact will trigger an assertion failure. --pasky */
notest =
(cmd & 0xFF) == CMD_CLEAR_AREA ||
(cmd & 0xFF) == CMD_CONVERT_RAIL ||
@@ -463,13 +465,13 @@
_docommand_recursive = 1;
- // cost estimation only?
+ /* cost estimation only? */
if (!IsGeneratingWorld() &&
_shift_pressed &&
IsLocalPlayer() &&
!(cmd & (CMD_NETWORK_COMMAND | CMD_SHOW_NO_ERROR)) &&
(cmd & 0xFF) != CMD_PAUSE) {
- // estimate the cost.
+ /* estimate the cost. */
res = proc(tile, flags, p1, p2);
if (CmdFailed(res)) {
if (res & 0xFFFF) _error_message = res & 0xFFFF;
@@ -485,13 +487,13 @@
if (!((cmd & CMD_NO_TEST_IF_IN_NETWORK) && _networking)) {
- // first test if the command can be executed.
+ /* first test if the command can be executed. */
res = proc(tile, flags, p1, p2);
if (CmdFailed(res)) {
if (res & 0xFFFF) _error_message = res & 0xFFFF;
goto show_error;
}
- // no money? Only check if notest is off
+ /* no money? Only check if notest is off */
if (!notest && res != 0 && !CheckPlayerHasMoney(res)) goto show_error;
}
@@ -514,7 +516,7 @@
}
#endif /* ENABLE_NETWORK */
- // update last build coordinate of player.
+ /* update last build coordinate of player. */
if (tile != 0 && IsValidPlayer(_current_player)) {
GetPlayer(_current_player)->last_build_coordinate = tile;
}
@@ -524,8 +526,8 @@
_yearly_expenses_type = EXPENSES_CONSTRUCTION;
res2 = proc(tile, flags | DC_EXEC, p1, p2);
- // If notest is on, it means the result of the test can be different than
- // the real command.. so ignore the test
+ /* If notest is on, it means the result of the test can be different than
+ * the real command.. so ignore the test */
if (!notest && !((cmd & CMD_NO_TEST_IF_IN_NETWORK) && _networking)) {
assert(res == res2); // sanity check
} else {
@@ -553,7 +555,7 @@
return true;
show_error:
- // show error message if the command fails?
+ /* show error message if the command fails? */
if (IsLocalPlayer() && error_part1 != 0) {
ShowErrorMessage(_error_message, error_part1, x,y);
}
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/command.h
--- a/src/command.h Tue Feb 27 23:54:28 2007 +0000
+++ b/src/command.h Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file command.h */
+
#ifndef COMMAND_H
#define COMMAND_H
@@ -122,8 +124,8 @@
CMD_MONEY_CHEAT = 102,
CMD_BUILD_CANAL = 103,
- CMD_PLAYER_CTRL = 104, // used in multiplayer to create a new player etc.
- CMD_LEVEL_LAND = 105, // level land
+ CMD_PLAYER_CTRL = 104, ///< used in multiplayer to create a new player etc.
+ CMD_LEVEL_LAND = 105, ///< level land
CMD_REFIT_RAIL_VEHICLE = 106,
CMD_RESTORE_ORDER_INDEX = 107,
@@ -145,13 +147,13 @@
enum {
DC_EXEC = 0x01,
- DC_AUTO = 0x02, // don't allow building on structures
- DC_QUERY_COST = 0x04, // query cost only, don't build.
- DC_NO_WATER = 0x08, // don't allow building on water
- DC_NO_RAIL_OVERLAP = 0x10, // don't allow overlap of rails (used in buildrail)
- DC_AI_BUILDING = 0x20, // special building rules for AI
- DC_NO_TOWN_RATING = 0x40, // town rating does not disallow you from building
- DC_FORCETEST = 0x80, // force test too.
+ DC_AUTO = 0x02, ///< don't allow building on structures
+ DC_QUERY_COST = 0x04, ///< query cost only, don't build.
+ DC_NO_WATER = 0x08, ///< don't allow building on water
+ DC_NO_RAIL_OVERLAP = 0x10, ///< don't allow overlap of rails (used in buildrail)
+ DC_AI_BUILDING = 0x20, ///< special building rules for AI
+ DC_NO_TOWN_RATING = 0x40, ///< town rating does not disallow you from building
+ DC_FORCETEST = 0x80, ///< force test too.
CMD_ERROR = ((int32)0x80000000),
};
@@ -161,17 +163,15 @@
enum {
CMD_AUTO = 0x0200,
CMD_NO_WATER = 0x0400,
- CMD_NETWORK_COMMAND = 0x0800, // execute the command without sending it on the network
- CMD_NO_TEST_IF_IN_NETWORK = 0x1000, // When enabled, the command will bypass the no-DC_EXEC round if in network
+ CMD_NETWORK_COMMAND = 0x0800, ///< execute the command without sending it on the network
+ CMD_NO_TEST_IF_IN_NETWORK = 0x1000, ///< When enabled, the command will bypass the no-DC_EXEC round if in network
CMD_SHOW_NO_ERROR = 0x2000,
};
-/** Command flags for the command table
- * @see _command_proc_table
- */
+/** Command flags for the command table _command_proc_table */
enum {
- CMD_SERVER = 0x1, /// the command can only be initiated by the server
- CMD_OFFLINE = 0x2, /// the command cannot be executed in a multiplayer game; single-player only
+ CMD_SERVER = 0x1, ///< the command can only be initiated by the server
+ CMD_OFFLINE = 0x2, ///< the command cannot be executed in a multiplayer game; single-player only
};
typedef int32 CommandProc(TileIndex tile, uint32 flags, uint32 p1, uint32 p2);
@@ -191,11 +191,11 @@
*/
static inline bool CmdFailed(int32 res)
{
- // lower 16bits are the StringID of the possible error
+ /* lower 16bits are the StringID of the possible error */
return res <= (CMD_ERROR | INVALID_STRING_ID);
}
-/* command.c */
+/* command.cpp */
typedef void CommandCallback(bool success, TileIndex tile, uint32 p1, uint32 p2);
int32 DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint procc);
bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback, uint32 cmd);
@@ -205,7 +205,7 @@
void NetworkSend_Command(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback);
#endif /* ENABLE_NETWORK */
-extern const char* _cmd_text; // Text, which gets sent with a command
+extern const char* _cmd_text; ///< Text, which gets sent with a command
bool IsValidCommand(uint cmd);
byte GetCommandFlags(uint cmd);
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/console.cpp
--- a/src/console.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/console.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file console.cpp */
+
#include "stdafx.h"
#include "openttd.h"
#include "table/strings.h"
@@ -26,23 +28,23 @@
#define ICON_MAX_ALIAS_LINES 40
#define ICON_TOKEN_COUNT 20
-// ** main console ** //
+/* ** main console ** */
static char *_iconsole_buffer[ICON_BUFFER + 1];
static uint16 _iconsole_cbuffer[ICON_BUFFER + 1];
static Textbuf _iconsole_cmdline;
-// ** stdlib ** //
+/* ** stdlib ** */
byte _stdlib_developer = 1;
bool _stdlib_con_developer = false;
FILE *_iconsole_output_file;
-// ** main console cmd buffer
+/* ** main console cmd buffer ** */
static char *_iconsole_history[ICON_HISTORY_SIZE];
static byte _iconsole_historypos;
-/* *************** */
-/* end of header */
-/* *************** */
+/* *************** *
+ * end of header *
+ * *************** */
static void IConsoleClearCommand(void)
{
@@ -60,7 +62,7 @@
static void IConsoleHistoryAdd(const char *cmd);
static void IConsoleHistoryNavigate(int direction);
-// ** console window ** //
+/* ** console window ** */
static void IConsoleWndProc(BaseWindow *w, WindowEvent *e)
{
static byte iconsole_scroll = ICON_BUFFER;
@@ -254,7 +256,7 @@
static void IConsoleWriteToLogFile(const char *string)
{
if (_iconsole_output_file != NULL) {
- // if there is an console output file ... also print it there
+ /* if there is an console output file ... also print it there */
fwrite(string, strlen(string), 1, _iconsole_output_file);
fwrite("\n", 1, 1, _iconsole_output_file);
}
@@ -337,7 +339,7 @@
{
int i = _iconsole_historypos + direction;
- // watch out for overflows, just wrap around
+ /* watch out for overflows, just wrap around */
if (i < 0) i = ICON_HISTORY_SIZE - 1;
if (i >= ICON_HISTORY_SIZE) i = 0;
@@ -350,7 +352,7 @@
_iconsole_historypos = i;
IConsoleClearCommand();
- // copy history to 'command prompt / bash'
+ /* copy history to 'command prompt / bash' */
assert(_iconsole_history[i] != NULL && IS_INT_INSIDE(i, 0, ICON_HISTORY_SIZE));
ttd_strlcpy(_iconsole_cmdline.buf, _iconsole_history[i], _iconsole_cmdline.maxlength);
UpdateTextBufferSize(&_iconsole_cmdline);
@@ -478,9 +480,10 @@
return arg != endptr;
}
-// * ************************* * //
-// * hooking code * //
-// * ************************* * //
+/* * *************************
+ * hooking code *
+ * *************************/
+
/**
* General internal hooking code that is the same for both commands and variables
* @param hooks @IConsoleHooks structure that will be set according to
@@ -706,18 +709,18 @@
if (a_index >= lengthof(aliases) || astream_i >= lengthof(aliasstream)) break;
switch (*cmdptr) {
- case '\'': /* ' will double for "" */
+ case '\'': // ' will double for ""
aliasstream[astream_i++] = '"';
break;
- case ';': /* Cmd seperator, start new command */
+ case ';': // Cmd seperator, start new command
aliasstream[astream_i] = '\0';
aliases[++a_index] = &aliasstream[++astream_i];
cmdptr++;
break;
- case '%': /* Some or all parameters */
+ case '%': // Some or all parameters
cmdptr++;
switch (*cmdptr) {
- case '+': { /* All parameters seperated: "[param 1]" "[param 2]" */
+ case '+': { // All parameters seperated: "[param 1]" "[param 2]"
for (i = 0; i != tokencount; i++) {
aliasstream[astream_i++] = '"';
astream_i += IConsoleCopyInParams(&aliasstream[astream_i], tokens[i], astream_i);
@@ -725,7 +728,7 @@
aliasstream[astream_i++] = ' ';
}
} break;
- case '!': { /* Merge the parameters to one: "[param 1] [param 2] [param 3...]" */
+ case '!': { // Merge the parameters to one: "[param 1] [param 2] [param 3...]"
aliasstream[astream_i++] = '"';
for (i = 0; i != tokencount; i++) {
astream_i += IConsoleCopyInParams(&aliasstream[astream_i], tokens[i], astream_i);
@@ -734,7 +737,7 @@
aliasstream[astream_i++] = '"';
} break;
- default: { /* One specific parameter: %A = [param 1] %B = [param 2] ... */
+ default: { // One specific parameter: %A = [param 1] %B = [param 2] ...
int param = *cmdptr - 'A';
if (param < 0 || param >= tokencount) {
@@ -1083,16 +1086,16 @@
tstream_i++;
break;
- case '"': /* Tokens enclosed in "" are one token */
+ case '"': // Tokens enclosed in "" are one token
longtoken = !longtoken;
break;
- case '\\': /* Escape character for "" */
+ case '\\': // Escape character for ""
if (cmdptr[1] == '"' && tstream_i + 1 < lengthof(tokenstream)) {
tokenstream[tstream_i++] = *++cmdptr;
break;
}
/* fallthrough */
- default: /* Normal character */
+ default: // Normal character
tokenstream[tstream_i++] = *cmdptr;
if (!foundtoken) {
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/console.h
--- a/src/console.h Tue Feb 27 23:54:28 2007 +0000
+++ b/src/console.h Wed Feb 28 00:33:40 2007 +0000
@@ -1,11 +1,13 @@
/* $Id$ */
+/** @file console.h */
+
#ifndef CONSOLE_H
#define CONSOLE_H
-// maximum length of a typed in command
+/* maximum length of a typed in command */
#define ICON_CMDLN_SIZE 255
-// maximum length of a totally expanded command
+/* maximum length of a totally expanded command */
#define ICON_MAX_STREAMSIZE 1024
typedef enum IConsoleVarTypes {
@@ -37,9 +39,9 @@
*/
typedef bool IConsoleHook(void);
typedef struct IConsoleHooks{
- IConsoleHook *access; // trigger when accessing the variable/command
- IConsoleHook *pre; // trigger before the variable/command is changed/executed
- IConsoleHook *post; // trigger after the variable/command is changed/executed
+ IConsoleHook *access; ///< trigger when accessing the variable/command
+ IConsoleHook *pre; ///< trigger before the variable/command is changed/executed
+ IConsoleHook *post; ///< trigger after the variable/command is changed/executed
} IConsoleHooks;
/** --Commands--
@@ -53,11 +55,11 @@
struct IConsoleCmd;
typedef struct IConsoleCmd {
- char *name; // name of command
- struct IConsoleCmd *next; // next command in list
+ char *name; ///< name of command
+ struct IConsoleCmd *next; ///< next command in list
- IConsoleCmdProc *proc; // process executed when command is typed
- IConsoleHooks hook; // any special trigger action that needs executing
+ IConsoleCmdProc *proc; ///< process executed when command is typed
+ IConsoleHooks hook; ///< any special trigger action that needs executing
} IConsoleCmd;
/** --Variables--
@@ -71,15 +73,15 @@
*/
struct IConsoleVar;
typedef struct IConsoleVar {
- char *name; // name of the variable
- struct IConsoleVar *next; // next variable in list
+ char *name; ///< name of the variable
+ struct IConsoleVar *next; ///< next variable in list
- void *addr; // the address where the variable is pointing at
- uint32 size; // size of the variable, used for strings
- char *help; // the optional help string shown when requesting information
- IConsoleVarTypes type; // type of variable (for correct assignment/output)
- IConsoleCmdProc *proc; // some variables need really special handling, use a callback function for that
- IConsoleHooks hook; // any special trigger action that needs executing
+ void *addr; ///< the address where the variable is pointing at
+ uint32 size; ///< size of the variable, used for strings
+ char *help; ///< the optional help string shown when requesting information
+ IConsoleVarTypes type; ///< type of variable (for correct assignment/output)
+ IConsoleCmdProc *proc; ///< some variables need really special handling, use a callback function for that
+ IConsoleHooks hook; ///< any special trigger action that needs executing
} IConsoleVar;
/** --Aliases--
@@ -95,16 +97,16 @@
*/
struct IConsoleAlias;
typedef struct IConsoleAlias {
- char *name; // name of the alias
- struct IConsoleAlias *next; // next alias in list
+ char *name; ///< name of the alias
+ struct IConsoleAlias *next; ///< next alias in list
- char *cmdline; // command(s) that is/are being aliased
+ char *cmdline; ///< command(s) that is/are being aliased
} IConsoleAlias;
/* console parser */
-VARDEF IConsoleCmd *_iconsole_cmds; // list of registred commands
-VARDEF IConsoleVar *_iconsole_vars; // list of registred vars
-VARDEF IConsoleAlias *_iconsole_aliases; // list of registred aliases
+VARDEF IConsoleCmd *_iconsole_cmds; ///< list of registred commands
+VARDEF IConsoleVar *_iconsole_vars; ///< list of registred vars
+VARDEF IConsoleAlias *_iconsole_aliases; ///< list of registred aliases
/* console colors/modes */
VARDEF byte _icolour_def;
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/console_cmds.cpp
--- a/src/console_cmds.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/console_cmds.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file console_cmds.cpp */
+
#include "stdafx.h"
#include "openttd.h"
#include "console.h"
@@ -226,7 +228,7 @@
if (strcmp(file, _fios_list[i].title) == 0) break;
}
- if (i == _fios_num) { /* If no name matches, try to parse it as number */
+ if (i == _fios_num) { // If no name matches, try to parse it as number
char* endptr;
i = strtol(file, &endptr, 10);
@@ -614,7 +616,7 @@
DEF_CONSOLE_HOOK(ConHookValidateMaxSpectatorsCount)
{
- /* XXX @see ConHookValidateMaxClientsCount */
+ /* XXX see ConHookValidateMaxClientsCount */
if (_network_game_info.spectators_max > 10) {
_network_game_info.spectators_max = 10;
IConsoleError("Maximum spectators out of bounds, truncating to limit.");
@@ -1342,7 +1344,7 @@
if (ci == NULL) return false;
- // Don't change the name if it is the same as the old name
+ /* Don't change the name if it is the same as the old name */
if (strcmp(ci->client_name, _network_player_name) != 0) {
if (!_network_server) {
SEND_COMMAND(PACKET_CLIENT_SET_NAME)(_network_player_name);
@@ -1441,8 +1443,8 @@
static void IConsoleDebugLibRegister(void)
{
- // debugging variables and functions
- extern bool _stdlib_con_developer; /* XXX extern in .c */
+ /* debugging variables and functions */
+ extern bool _stdlib_con_developer; // XXX extern in .cpp
IConsoleVarRegister("con_developer", &_stdlib_con_developer, ICONSOLE_VAR_BOOLEAN, "Enable/disable console debugging information (internal)");
IConsoleCmdRegister("resettile", ConResetTile);
@@ -1458,10 +1460,10 @@
void IConsoleStdLibRegister(void)
{
- // stdlib
- extern byte _stdlib_developer; /* XXX extern in .c */
+ /* stdlib */
+ extern byte _stdlib_developer; // XXX extern in .cpp
- // default variables and functions
+ /* default variables and functions */
IConsoleCmdRegister("debug_level", ConDebugLevel);
IConsoleCmdRegister("dump_vars", ConListDumpVariables);
IConsoleCmdRegister("echo", ConEcho);
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/currency.cpp
--- a/src/currency.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/currency.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file currency.cpp **/
+
#include "stdafx.h"
#include "openttd.h"
#include "currency.h"
@@ -13,34 +15,34 @@
// | | Euro year | | | name
// | | | | | | |
static const CurrencySpec origin_currency_specs[NUM_CURRENCY] = {
- { 1, ',', CF_NOEURO, "£", "", 0, STR_CURR_GBP }, // british pounds
- { 2, ',', CF_NOEURO, "$", "", 0, STR_CURR_USD }, // us dollars
- { 2, ',', CF_ISEURO, "€", "", 0, STR_CURR_EUR }, // Euro
- { 220, ',', CF_NOEURO, "Â¥", "", 0, STR_CURR_YEN }, // yen
- { 20, ',', 2002, "", " S.", 1, STR_CURR_ATS }, // austrian schilling
- { 59, ',', 2002, "BEF ", "", 0, STR_CURR_BEF }, // belgian franc
- { 2, ',', CF_NOEURO, "CHF ", "", 0, STR_CURR_CHF }, // swiss franc
- { 41, ',', CF_NOEURO, "", " KÄ", 1, STR_CURR_CZK }, // czech koruna
- { 3, '.', 2002, "DM ", "", 0, STR_CURR_DEM }, // deutsche mark
- { 11, '.', CF_NOEURO, "", " kr", 1, STR_CURR_DKK }, // danish krone
- { 245, '.', 2002, "Pts ", "", 0, STR_CURR_ESP }, // spanish pesetas
- { 9, ',', 2002, "", " mk", 1, STR_CURR_FIM }, // finnish markka
- { 10, '.', 2002, "FF ", "", 0, STR_CURR_FRF }, // french francs
- { 500, ',', 2002, "", "Dr.", 1, STR_CURR_GRD }, // greek drachma
- { 378, ',', 2010, "", " Ft", 1, STR_CURR_HUF }, // hungarian forint
- { 130, '.', CF_NOEURO, "", " Kr", 1, STR_CURR_ISK }, // icelandic krona
- { 2850, ',', 2002, "", " L.", 1, STR_CURR_ITL }, // italian lira
- { 3, ',', 2002, "NLG ", "", 0, STR_CURR_NLG }, // dutch gulden
- { 12, '.', CF_NOEURO, "", " Kr", 1, STR_CURR_NOK }, // norwegian krone
- { 6, ' ', CF_NOEURO, "", " zl", 1, STR_CURR_PLN }, // polish zloty
- { 5, '.', CF_NOEURO, "", " Lei", 1, STR_CURR_ROL }, // romanian Lei
- { 50, ' ', CF_NOEURO, "", " p", 1, STR_CURR_RUR }, // russian rouble
- { 352, '.', CF_NOEURO, "", " SIT", 1, STR_CURR_SIT }, // slovenian tolar
- { 13, '.', CF_NOEURO, "", " Kr", 1, STR_CURR_SEK }, // swedish krona
- { 3, '.', CF_NOEURO, "", " YTL", 1, STR_CURR_YTL }, // turkish lira
- { 52, ',', CF_NOEURO, "", " Sk", 1, STR_CURR_SKK }, // slovak koruna
- { 4, ',', CF_NOEURO, "R$ ", "", 0, STR_CURR_BRR }, // brazil real
- { 1, ' ', CF_NOEURO, "", "", 2, STR_CURR_CUSTOM }, // custom currency
+ { 1, ',', CF_NOEURO, "£", "", 0, STR_CURR_GBP }, ///< british pounds
+ { 2, ',', CF_NOEURO, "$", "", 0, STR_CURR_USD }, ///< us dollars
+ { 2, ',', CF_ISEURO, "€", "", 0, STR_CURR_EUR }, ///< Euro
+ { 220, ',', CF_NOEURO, "Â¥", "", 0, STR_CURR_YEN }, ///< yen
+ { 20, ',', 2002, "", " S.", 1, STR_CURR_ATS }, ///< austrian schilling
+ { 59, ',', 2002, "BEF ", "", 0, STR_CURR_BEF }, ///< belgian franc
+ { 2, ',', CF_NOEURO, "CHF ", "", 0, STR_CURR_CHF }, ///< swiss franc
+ { 41, ',', CF_NOEURO, "", " KÄ", 1, STR_CURR_CZK }, ///< czech koruna
+ { 3, '.', 2002, "DM ", "", 0, STR_CURR_DEM }, ///< deutsche mark
+ { 11, '.', CF_NOEURO, "", " kr", 1, STR_CURR_DKK }, ///< danish krone
+ { 245, '.', 2002, "Pts ", "", 0, STR_CURR_ESP }, ///< spanish pesetas
+ { 9, ',', 2002, "", " mk", 1, STR_CURR_FIM }, ///< finnish markka
+ { 10, '.', 2002, "FF ", "", 0, STR_CURR_FRF }, ///< french francs
+ { 500, ',', 2002, "", "Dr.", 1, STR_CURR_GRD }, ///< greek drachma
+ { 378, ',', 2010, "", " Ft", 1, STR_CURR_HUF }, ///< hungarian forint
+ { 130, '.', CF_NOEURO, "", " Kr", 1, STR_CURR_ISK }, ///< icelandic krona
+ { 2850, ',', 2002, "", " L.", 1, STR_CURR_ITL }, ///< italian lira
+ { 3, ',', 2002, "NLG ", "", 0, STR_CURR_NLG }, ///< dutch gulden
+ { 12, '.', CF_NOEURO, "", " Kr", 1, STR_CURR_NOK }, ///< norwegian krone
+ { 6, ' ', CF_NOEURO, "", " zl", 1, STR_CURR_PLN }, ///< polish zloty
+ { 5, '.', CF_NOEURO, "", " Lei", 1, STR_CURR_ROL }, ///< romanian Lei
+ { 50, ' ', CF_NOEURO, "", " p", 1, STR_CURR_RUR }, ///< russian rouble
+ { 352, '.', CF_NOEURO, "", " SIT", 1, STR_CURR_SIT }, ///< slovenian tolar
+ { 13, '.', CF_NOEURO, "", " Kr", 1, STR_CURR_SEK }, ///< swedish krona
+ { 3, '.', CF_NOEURO, "", " YTL", 1, STR_CURR_YTL }, ///< turkish lira
+ { 52, ',', CF_NOEURO, "", " Sk", 1, STR_CURR_SKK }, ///< slovak koruna
+ { 4, ',', CF_NOEURO, "R$ ", "", 0, STR_CURR_BRR }, ///< brazil real
+ { 1, ' ', CF_NOEURO, "", "", 2, STR_CURR_CUSTOM }, ///< custom currency
};
/* Array of currencies used by the system */
@@ -122,7 +124,10 @@
return (grfcurr_id >= lengthof(TTDPatch_To_OTTDIndex)) ? grfcurr_id : TTDPatch_To_OTTDIndex[grfcurr_id];
}
-/* get a mask of the allowed currencies depending on the year */
+/**
+ * get a mask of the allowed currencies depending on the year
+ * @return mask of currencies
+ */
uint GetMaskOfAllowedCurrencies(void)
{
uint mask = 0;
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/currency.h
--- a/src/currency.h Tue Feb 27 23:54:28 2007 +0000
+++ b/src/currency.h Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file currency.h */
+
#ifndef CURRENCY_H
#define CURRENCY_H
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/date.cpp
--- a/src/date.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/date.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file date.cpp */
+
#include "stdafx.h"
#include "openttd.h"
#include "date.h"
@@ -197,11 +199,11 @@
static const Month _autosave_months[] = {
- 0, // never
- 1, // every month
- 3, // every 3 months
- 6, // every 6 months
- 12, // every 12 months
+ 0, ///< never
+ 1, ///< every month
+ 3, ///< every 3 months
+ 6, ///< every 6 months
+ 12, ///< every 12 months
};
/**
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/date.h
--- a/src/date.h Tue Feb 27 23:54:28 2007 +0000
+++ b/src/date.h Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file date.h */
+
#ifndef DATE_H
#define DATE_H
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/debug.cpp
--- a/src/debug.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/debug.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file debug.cpp */
+
#include "stdafx.h"
#include
#include
@@ -105,7 +107,7 @@
char *end;
const char *t;
- // global debugging level?
+ /* global debugging level? */
if (*s >= '0' && *s <= '9') {
const DebugLevel *i;
@@ -115,19 +117,19 @@
for (i = debug_level; i != endof(debug_level); ++i) *i->level = v;
}
- // individual levels
+ /* individual levels */
for (;;) {
const DebugLevel *i;
int *p;
- // skip delimiters
+ /* skip delimiters */
while (*s == ' ' || *s == ',' || *s == '\t') s++;
if (*s == '\0') break;
t = s;
while (*s >= 'a' && *s <= 'z') s++;
- // check debugging levels
+ /* check debugging levels */
p = NULL;
for (i = debug_level; i != endof(debug_level); ++i)
if (s == t + strlen(i->name) && strncmp(t, i->name, s - t) == 0) {
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/dedicated.cpp
--- a/src/dedicated.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/dedicated.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file dedicated.cpp */
+
#include "stdafx.h"
#ifdef ENABLE_NETWORK
@@ -43,7 +45,7 @@
}
default:
- // We're the parent
+ /* We're the parent */
printf("Loading dedicated server...\n");
printf(" - Forked to background with pid %d\n", pid);
exit(0);
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/depot.cpp
--- a/src/depot.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/depot.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file depot.cpp */
+
#include "stdafx.h"
#include "openttd.h"
#include "depot.h"
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/depot.h
--- a/src/depot.h Tue Feb 27 23:54:28 2007 +0000
+++ b/src/depot.h Wed Feb 28 00:33:40 2007 +0000
@@ -1,11 +1,10 @@
/* $Id$ */
+/** @file depot.h Header files for depots (not hangars) */
+
#ifndef DEPOT_H
#define DEPOT_H
-/** @file depot.h Header files for depots (not hangars)
- * @see depot.c */
-
#include "direction.h"
#include "oldpool.h"
#include "tile.h"
@@ -55,6 +54,7 @@
* Get the new proposed service interval for the vehicle is indeed, clamped
* within the given bounds. @see MIN_SERVINT_PERCENT ,etc.
* @param index proposed service interval
+ * @return service interval
*/
static inline Date GetServiceIntervalClamped(uint index)
{
@@ -85,7 +85,7 @@
/**
* Find out if the slope of the tile is suitable to build a depot of given direction
- * @param direction The direction in which the depot's exit points. Starts with 0 as NE and goes Clockwise
+ * @param direction The direction in which the depot's exit points
* @param tileh The slope of the tile in question
* @return true if the construction is possible
@@ -98,7 +98,7 @@
* 03 (exit towards NW) we need either bit 0 or 4 set in tileh: 0x4C >> 3 = 1001
* So ((0x4C >> direction) & tileh) determines whether the depot can be built on the current tileh
*/
-static inline bool CanBuildDepotByTileh(uint32 direction, Slope tileh)
+static inline bool CanBuildDepotByTileh(DiagDirection direction, Slope tileh)
{
return ((0x4C >> direction) & tileh) != 0;
}
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/depot_gui.cpp
--- a/src/depot_gui.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/depot_gui.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** depot_gui.cpp */
+
#include "stdafx.h"
#include "openttd.h"
#include "functions.h"
@@ -36,8 +38,8 @@
DEPOT_WIDGET_SELL_ALL,
DEPOT_WIDGET_AUTOREPLACE,
DEPOT_WIDGET_MATRIX,
- DEPOT_WIDGET_V_SCROLL, // Vertical scrollbar
- DEPOT_WIDGET_H_SCROLL, // Horizontal scrollbar
+ DEPOT_WIDGET_V_SCROLL, ///< Vertical scrollbar
+ DEPOT_WIDGET_H_SCROLL, ///< Horizontal scrollbar
DEPOT_WIDGET_BUILD,
DEPOT_WIDGET_CLONE,
DEPOT_WIDGET_LOCATION,
@@ -636,7 +638,7 @@
/* Array to hold the default resize capacities
* First part is the vehicle type, while the last is 0 = x, 1 = y */
const uint _resize_cap[][2] = {
-/* VEH_Train */ {6, 10 * 29 + 36}, // flags, unitnumber and unit count uses a total of 36 pixels and we set default to 10 units
+/* VEH_Train */ {6, 10 * 29 + 36}, ///< flags, unitnumber and unit count uses a total of 36 pixels and we set default to 10 units
/* VEH_Road */ {5, 5},
/* VEH_Ship */ {3, 3},
/* VEH_Aircraft */ {3, 4},
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/direction.h
--- a/src/direction.h Tue Feb 27 23:54:28 2007 +0000
+++ b/src/direction.h Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file direction.h */
+
#ifndef DIRECTION_H
#define DIRECTION_H
@@ -9,7 +11,7 @@
typedef enum Direction {
DIR_BEGIN = 0,
DIR_N = 0,
- DIR_NE = 1, /* Northeast, upper right on your monitor */
+ DIR_NE = 1, ///< Northeast, upper right on your monitor
DIR_E = 2,
DIR_SE = 3,
DIR_S = 4,
@@ -59,7 +61,7 @@
/* Direction commonly used as the direction of entering and leaving tiles, 4-way */
typedef enum DiagDirection {
DIAGDIR_BEGIN = 0,
- DIAGDIR_NE = 0, /* Northeast, upper right on your monitor */
+ DIAGDIR_NE = 0, ///< Northeast, upper right on your monitor
DIAGDIR_SE = 1,
DIAGDIR_SW = 2,
DIAGDIR_NW = 3,
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/disaster_cmd.cpp
--- a/src/disaster_cmd.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/disaster_cmd.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -1,6 +1,6 @@
/* $Id$ */
-/** @file
+/** @file disaster_cmd.cpp
* All disaster/easter egg vehicles are handled here.
* The general flow of control for the disaster vehicles is as follows:
*
@@ -99,13 +99,13 @@
static const SpriteID _disaster_images_9[] = {SPR_ROTOR_MOVING_1, SPR_ROTOR_MOVING_1, SPR_ROTOR_MOVING_1, SPR_ROTOR_MOVING_1, SPR_ROTOR_MOVING_1, SPR_ROTOR_MOVING_1, SPR_ROTOR_MOVING_1, SPR_ROTOR_MOVING_1};
static const SpriteID * const _disaster_images[] = {
- _disaster_images_1, _disaster_images_1, // zeppeliner and zeppeliner shadow
- _disaster_images_2, _disaster_images_2, // small ufo and small ufo shadow
- _disaster_images_3, _disaster_images_3, // combat aircraft and shadow
- _disaster_images_8, _disaster_images_8, _disaster_images_9, // combat helicopter, shadow and rotor
- _disaster_images_6, _disaster_images_6, // big ufo and shadow
- _disaster_images_7, _disaster_images_7, // skyranger and shadow
- _disaster_images_4, _disaster_images_5, // small and big submarine sprites
+ _disaster_images_1, _disaster_images_1, ///< zeppeliner and zeppeliner shadow
+ _disaster_images_2, _disaster_images_2, ///< small ufo and small ufo shadow
+ _disaster_images_3, _disaster_images_3, ///< combat aircraft and shadow
+ _disaster_images_8, _disaster_images_8, _disaster_images_9, ///< combat helicopter, shadow and rotor
+ _disaster_images_6, _disaster_images_6, ///< big ufo and shadow
+ _disaster_images_7, _disaster_images_7, ///< skyranger and shadow
+ _disaster_images_4, _disaster_images_5, ///< small and big submarine sprites
};
static void DisasterVehicleUpdateImage(Vehicle *v)
@@ -200,7 +200,6 @@
*/
static void DisasterTick_Zeppeliner(Vehicle *v)
{
- GetNewVehiclePosResult gp;
Station *st;
int x, y;
byte z;
@@ -211,7 +210,7 @@
if (v->current_order.dest < 2) {
if (HASBIT(v->tick_counter, 0)) return;
- GetNewVehiclePos(v, &gp);
+ GetNewVehiclePosResult gp = GetNewVehiclePos(v);
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
@@ -308,7 +307,6 @@
*/
static void DisasterTick_Ufo(Vehicle *v)
{
- GetNewVehiclePosResult gp;
Vehicle *u;
uint dist;
byte z;
@@ -321,7 +319,7 @@
int y = TileY(v->dest_tile) * TILE_SIZE;
if (delta(x, v->x_pos) + delta(y, v->y_pos) >= TILE_SIZE) {
v->direction = GetDirectionTowards(v, x, y);
- GetNewVehiclePos(v, &gp);
+ GetNewVehiclePosResult gp = GetNewVehiclePos(v);
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
return;
}
@@ -356,7 +354,7 @@
}
v->direction = GetDirectionTowards(v, u->x_pos, u->y_pos);
- GetNewVehiclePos(v, &gp);
+ GetNewVehiclePosResult gp = GetNewVehiclePos(v);
z = v->z_pos;
if (dist <= TILE_SIZE && z > u->z_pos) z--;
@@ -406,13 +404,11 @@
*/
static void DisasterTick_Airplane(Vehicle *v)
{
- GetNewVehiclePosResult gp;
-
v->tick_counter++;
v->u.disaster.image_override =
(v->current_order.dest == 1 && HASBIT(v->tick_counter, 2)) ? SPR_F_15_FIRING : 0;
- GetNewVehiclePos(v, &gp);
+ GetNewVehiclePosResult gp = GetNewVehiclePos(v);
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
if (gp.x < (-10 * TILE_SIZE)) {
@@ -481,13 +477,11 @@
*/
static void DisasterTick_Helicopter(Vehicle *v)
{
- GetNewVehiclePosResult gp;
-
v->tick_counter++;
v->u.disaster.image_override =
(v->current_order.dest == 1 && HASBIT(v->tick_counter, 2)) ? SPR_AH_64A_FIRING : 0;
- GetNewVehiclePos(v, &gp);
+ GetNewVehiclePosResult gp = GetNewVehiclePos(v);
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
if (gp.x > (int)MapSizeX() * TILE_SIZE + 9 * TILE_SIZE - 1) {
@@ -568,7 +562,6 @@
*/
static void DisasterTick_Big_Ufo(Vehicle *v)
{
- GetNewVehiclePosResult gp;
byte z;
Vehicle *u, *w;
Town *t;
@@ -583,7 +576,7 @@
if (delta(v->x_pos, x) + delta(v->y_pos, y) >= 8) {
v->direction = GetDirectionTowards(v, x, y);
- GetNewVehiclePos(v, &gp);
+ GetNewVehiclePosResult gp = GetNewVehiclePos(v);
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
return;
}
@@ -632,7 +625,7 @@
int y = TileY(v->dest_tile) * TILE_SIZE;
if (delta(x, v->x_pos) + delta(y, v->y_pos) >= TILE_SIZE) {
v->direction = GetDirectionTowards(v, x, y);
- GetNewVehiclePos(v, &gp);
+ GetNewVehiclePosResult gp = GetNewVehiclePos(v);
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
return;
}
@@ -665,13 +658,12 @@
*/
static void DisasterTick_Big_Ufo_Destroyer(Vehicle *v)
{
- GetNewVehiclePosResult gp;
Vehicle *u;
int i;
v->tick_counter++;
- GetNewVehiclePos(v, &gp);
+ GetNewVehiclePosResult gp = GetNewVehiclePos(v);
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
if (gp.x > (int)MapSizeX() * TILE_SIZE + 9 * TILE_SIZE - 1) {
@@ -711,7 +703,6 @@
*/
static void DisasterTick_Submarine(Vehicle *v)
{
- GetNewVehiclePosResult gp;
TileIndex tile;
v->tick_counter++;
@@ -731,7 +722,7 @@
TrackdirBits r = (TrackdirBits)GetTileTrackStatus(tile, TRANSPORT_WATER);
if (TrackdirBitsToTrackBits(r) == TRACK_BIT_ALL && !CHANCE16(1, 90)) {
- GetNewVehiclePos(v, &gp);
+ GetNewVehiclePosResult gp = GetNewVehiclePos(v);
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
return;
}
@@ -1029,14 +1020,14 @@
Year min;
Year max;
} _dis_years[] = {
- { 1930, 1955 }, // zeppeliner
- { 1940, 1970 }, // ufo (small)
- { 1960, 1990 }, // airplane
- { 1970, 2000 }, // helicopter
- { 2000, 2100 }, // ufo (big)
- { 1940, 1965 }, // submarine (small)
- { 1975, 2010 }, // submarine (big)
- { 1950, 1985 } // coalmine
+ { 1930, 1955 }, ///< zeppeliner
+ { 1940, 1970 }, ///< ufo (small)
+ { 1960, 1990 }, ///< airplane
+ { 1970, 2000 }, ///< helicopter
+ { 2000, 2100 }, ///< ufo (big)
+ { 1940, 1965 }, ///< submarine (small)
+ { 1975, 2010 }, ///< submarine (big)
+ { 1950, 1985 } ///< coalmine
};
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/dock_gui.cpp
--- a/src/dock_gui.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/dock_gui.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file dock_gui.cpp */
+
#include "stdafx.h"
#include "openttd.h"
#include "table/sprites.h"
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/driver.cpp
--- a/src/driver.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/driver.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file driver.cpp */
+
#include "stdafx.h"
#include "openttd.h"
#include "debug.h"
@@ -143,13 +145,13 @@
char buffer[256];
const char* parms[32];
- // Extract the driver name and put parameter list in parm
+ /* Extract the driver name and put parameter list in parm */
ttd_strlcpy(buffer, name, sizeof(buffer));
parm = strchr(buffer, ':');
parms[0] = NULL;
if (parm != NULL) {
uint np = 0;
- // Tokenize the parm.
+ /* Tokenize the parm. */
do {
*parm++ = '\0';
if (np < lengthof(parms) - 1)
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/driver.h
--- a/src/driver.h Tue Feb 27 23:54:28 2007 +0000
+++ b/src/driver.h Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file driver.h */
+
#ifndef DRIVER_H
#define DRIVER_H
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/dummy_land.cpp
--- a/src/dummy_land.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/dummy_land.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file dummy_land.cpp */
+
#include "stdafx.h"
#include "openttd.h"
#include "table/strings.h"
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/economy.cpp
--- a/src/economy.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/economy.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file economy.cpp */
+
#include "stdafx.h"
#include "openttd.h"
#include "currency.h"
@@ -33,8 +35,9 @@
#include "newgrf_callbacks.h"
#include "unmovable.h"
#include "date.h"
+#include "cargotype.h"
-// Score info
+/* Score info */
const ScoreInfo _score_info[] = {
{ SCORE_VEHICLES, 120, 100 },
{ SCORE_STATIONS, 80, 100 },
@@ -89,8 +92,12 @@
return max(value, 1LL);
}
-// if update is set to true, the economy is updated with this score
-// (also the house is updated, should only be true in the on-tick event)
+/** if update is set to true, the economy is updated with this score
+ * (also the house is updated, should only be true in the on-tick event)
+ * @param update the economy with calculated score
+ * @param p player been evaluated
+ * @return actual score of this player
+ * */
int UpdateCompanyRatingAndValue(Player *p, bool update)
{
byte owner = p->index;
@@ -208,15 +215,15 @@
_score_part[owner][SCORE_LOAN] = _score_info[SCORE_LOAN].needed - p->current_loan;
}
- // Now we calculate the score for each item..
+ /* Now we calculate the score for each item.. */
{
int total_score = 0;
int s;
score = 0;
for (ScoreID i = SCORE_BEGIN; i < SCORE_END; i++) {
- // Skip the total
+ /* Skip the total */
if (i == SCORE_TOTAL) continue;
- // Check the score
+ /* Check the score */
s = (_score_part[owner][i] >= _score_info[i].needed) ?
_score_info[i].score :
_score_part[owner][i] * _score_info[i].score / _score_info[i].needed;
@@ -227,7 +234,7 @@
_score_part[owner][SCORE_TOTAL] = score;
- // We always want the score scaled to SCORE_MAX (1000)
+ /* We always want the score scaled to SCORE_MAX (1000) */
if (total_score != SCORE_MAX) score = score * SCORE_MAX / total_score;
}
@@ -241,7 +248,7 @@
return score;
}
-// use PLAYER_SPECTATOR as new_player to delete the player.
+/* use PLAYER_SPECTATOR as new_player to delete the player. */
void ChangeOwnershipOfPlayerItems(PlayerID old_player, PlayerID new_player)
{
Town *t;
@@ -293,7 +300,7 @@
int num_aircraft = 0;
Vehicle *v;
- // Determine Ids for the new vehicles
+ /* Determine Ids for the new vehicles */
FOR_ALL_VEHICLES(v) {
if (v->owner == new_player) {
switch (v->type) {
@@ -327,7 +334,7 @@
}
}
- // Change ownership of tiles
+ /* Change ownership of tiles */
{
TileIndex tile = 0;
do {
@@ -367,7 +374,7 @@
PlayerID owner;
int64 val;
- // If the player has money again, it does not go bankrupt
+ /* If the player has money again, it does not go bankrupt */
if (p->player_money >= 0) {
p->quarters_of_bankrupcy = 0;
return;
@@ -391,8 +398,8 @@
break;
}
- // Check if the company has any value.. if not, declare it bankrupt
- // right now
+ /* Check if the company has any value.. if not, declare it bankrupt
+ * right now */
val = CalculateCompanyValue(p);
if (val > 0) {
p->bankrupt_value = val;
@@ -400,13 +407,13 @@
p->bankrupt_timeout = 0;
break;
}
- // Else, falltrue to case 4...
+ /* Else, falltrue to case 4... */
}
case 4: {
- // Close everything the owner has open
+ /* Close everything the owner has open */
DeletePlayerWindows(owner);
-// Show bankrupt news
+ /* Show bankrupt news */
SetDParam(0, p->name_1);
SetDParam(1, p->name_2);
AddNewsItem( (StringID)(owner | NB_BBANKRUPT), NEWS_FLAGS(NM_CALLBACK, 0, NT_COMPANY_INFO, DNC_BANKRUPCY),0,0);
@@ -612,19 +619,21 @@
static void AddSingleInflation(int32 *value, uint16 *frac, int32 amt)
{
- int64 tmp;
- int32 low;
- tmp = BIGMULS(*value, amt);
- *frac = (uint16)(low = (uint16)tmp + *frac);
- *value += (int32)(tmp >> 16) + (low >> 16);
+ int64 tmp = (int64)*value * amt + *frac;
+ *frac = GB(tmp, 0, 16);
+ *value += tmp >> 16;
}
static void AddInflation(void)
{
- int i;
+ /* Approximation for (100 + infl_amount)% ** (1 / 12) - 100%
+ * scaled by 65536
+ * 12 -> months per year
+ * This is only a good approxiamtion for small values
+ */
int32 inf = _economy.infl_amount * 54;
- for (i = 0; i != NUM_PRICES; i++) {
+ for (uint i = 0; i != NUM_PRICES; i++) {
AddSingleInflation((int32*)&_price + i, _price_frac + i, inf);
}
@@ -634,7 +643,7 @@
_economy.max_loan += 50000;
inf = _economy.infl_amount_pr * 54;
- for (i = 0; i != NUM_CARGO; i++) {
+ for (uint i = 0; i != NUM_CARGO; i++) {
AddSingleInflation(
(int32*)_cargo_payment_rates + i,
_cargo_payment_rates_frac + i,
@@ -690,55 +699,55 @@
};
static const int32 _price_base[NUM_PRICES] = {
- 100, // station_value
- 100, // build_rail
- 95, // build_road
- 65, // build_signals
- 275, // build_bridge
- 600, // build_train_depot
- 500, // build_road_depot
- 700, // build_ship_depot
- 450, // build_tunnel
- 200, // train_station_track
- 180, // train_station_length
- 600, // build_airport
- 200, // build_bus_station
- 200, // build_truck_station
- 350, // build_dock
- 400000, // build_railvehicle
- 2000, // build_railwagon
- 700000, // aircraft_base
- 14000, // roadveh_base
- 65000, // ship_base
- 20, // build_trees
- 250, // terraform
- 20, // clear_1
- 40, // purchase_land
- 200, // clear_2
- 500, // clear_3
- 20, // remove_trees
- -70, // remove_rail
- 10, // remove_signals
- 50, // clear_bridge
- 80, // remove_train_depot
- 80, // remove_road_depot
- 90, // remove_ship_depot
- 30, // clear_tunnel
- 10000, // clear_water
- 50, // remove_rail_station
- 30, // remove_airport
- 50, // remove_bus_station
- 50, // remove_truck_station
- 55, // remove_dock
- 1600, // remove_house
- 40, // remove_road
- 5600, // running_rail[0] railroad
- 5200, // running_rail[1] monorail
- 4800, // running_rail[2] maglev
- 9600, // aircraft_running
- 1600, // roadveh_running
- 5600, // ship_running
- 1000000, // build_industry
+ 100, ///< station_value
+ 100, ///< build_rail
+ 95, ///< build_road
+ 65, ///< build_signals
+ 275, ///< build_bridge
+ 600, ///< build_train_depot
+ 500, ///< build_road_depot
+ 700, ///< build_ship_depot
+ 450, ///< build_tunnel
+ 200, ///< train_station_track
+ 180, ///< train_station_length
+ 600, ///< build_airport
+ 200, ///< build_bus_station
+ 200, ///< build_truck_station
+ 350, ///< build_dock
+ 400000, ///< build_railvehicle
+ 2000, ///< build_railwagon
+ 700000, ///< aircraft_base
+ 14000, ///< roadveh_base
+ 65000, ///< ship_base
+ 20, ///< build_trees
+ 250, ///< terraform
+ 20, ///< clear_1
+ 40, ///< purchase_land
+ 200, ///< clear_2
+ 500, ///< clear_3
+ 20, ///< remove_trees
+ -70, ///< remove_rail
+ 10, ///< remove_signals
+ 50, ///< clear_bridge
+ 80, ///< remove_train_depot
+ 80, ///< remove_road_depot
+ 90, ///< remove_ship_depot
+ 30, ///< clear_tunnel
+ 10000, ///< clear_water
+ 50, ///< remove_rail_station
+ 30, ///< remove_airport
+ 50, ///< remove_bus_station
+ 50, ///< remove_truck_station
+ 55, ///< remove_dock
+ 1600, ///< remove_house
+ 40, ///< remove_road
+ 5600, ///< running_rail[0] railroad
+ 5200, ///< running_rail[1] monorail
+ 4800, ///< running_rail[2] maglev
+ 9600, ///< aircraft_running
+ 1600, ///< roadveh_running
+ 5600, ///< ship_running
+ 1000000, ///< build_industry
};
static byte price_base_multiplier[NUM_PRICES];
@@ -750,7 +759,7 @@
{
uint i;
- // 8 means no multiplier.
+ /* 8 means no multiplier. */
for (i = 0; i < NUM_PRICES; i++)
price_base_multiplier[i] = 8;
}
@@ -807,7 +816,8 @@
Pair tp;
/* if mode is false, use the singular form */
- SetDParam(0, _cargoc.names_s[s->cargo_type] + (mode ? 0 : 32));
+ const CargoSpec *cs = GetCargo(s->cargo_type);
+ SetDParam(0, mode ? cs->name_plural : cs->name);
if (s->age < 12) {
if (s->cargo_type != CT_PASSENGERS && s->cargo_type != CT_MAIL) {
@@ -924,7 +934,7 @@
fr->from = i = GetRandomIndustry();
if (i == NULL) return;
- // Randomize cargo type
+ /* Randomize cargo type */
if (Random()&1 && i->produced_cargo[1] != CT_INVALID) {
cargo = i->produced_cargo[1];
trans = i->pct_transported[1];
@@ -935,28 +945,28 @@
total = i->total_production[0];
}
- // Quit if no production in this industry
- // or if the cargo type is passengers
- // or if the pct transported is already large enough
+ /* Quit if no production in this industry
+ * or if the cargo type is passengers
+ * or if the pct transported is already large enough */
if (total == 0 || trans > 42 || cargo == CT_INVALID || cargo == CT_PASSENGERS)
return;
fr->cargo = cargo;
if (cargo == CT_GOODS || cargo == CT_FOOD) {
- // The destination is a town
+ /* The destination is a town */
Town *t = GetRandomTown();
- // Only want big towns
+ /* Only want big towns */
if (t == NULL || t->population < 900) return;
fr->distance = DistanceManhattan(i->xy, t->xy);
fr->to = t;
} else {
- // The destination is an industry
+ /* The destination is an industry */
Industry *i2 = GetRandomIndustry();
- // The industry must accept the cargo
+ /* The industry must accept the cargo */
if (i == i2 || i == NULL ||
(cargo != i2->accepts_cargo[0] &&
cargo != i2->accepts_cargo[1] &&
@@ -1014,9 +1024,9 @@
}
}
- // 25% chance to go on
+ /* 25% chance to go on */
if (CHANCE16(1,4)) {
- // Find a free slot
+ /* Find a free slot*/
s = _subsidies;
while (s->cargo_type != CT_INVALID) {
if (++s == endof(_subsidies))
@@ -1087,6 +1097,7 @@
int32 GetTransportedGoodsIncome(uint num_pieces, uint dist, byte transit_days, CargoID cargo_type)
{
CargoID cargo = cargo_type;
+ const CargoSpec *cs = GetCargo(cargo_type);
byte f;
/* zero the distance if it's the bank and very short transport. */
@@ -1094,12 +1105,12 @@
dist = 0;
f = 255;
- if (transit_days > _cargoc.transit_days_1[cargo]) {
- transit_days -= _cargoc.transit_days_1[cargo];
+ if (transit_days > cs->transit_days[0]) {
+ transit_days -= cs->transit_days[0];
f -= transit_days;
- if (transit_days > _cargoc.transit_days_2[cargo]) {
- transit_days -= _cargoc.transit_days_2[cargo];
+ if (transit_days > cs->transit_days[1]) {
+ transit_days -= cs->transit_days[1];
if (f < transit_days) {
f = 0;
@@ -1119,10 +1130,10 @@
Industry* ind;
uint u;
- // Check if there's an industry close to the station that accepts the cargo
- // XXX - Think of something better to
- // 1) Only deliver to industries which are withing the catchment radius
- // 2) Distribute between industries if more then one is present
+ /* Check if there's an industry close to the station that accepts the cargo
+ * XXX - Think of something better to
+ * 1) Only deliver to industries which are withing the catchment radius
+ * 2) Distribute between industries if more then one is present */
u = (_patches.station_spread + 8) * 2;
FOR_ALL_INDUSTRIES(ind) {
uint t;
@@ -1153,7 +1164,7 @@
Pair pair;
Player *p;
- // check if there is an already existing subsidy that applies to us
+ /* check if there is an already existing subsidy that applies to us */
for (s = _subsidies; s != endof(_subsidies); s++) {
if (s->cargo_type == cargo_type &&
s->age >= 12 &&
@@ -1222,31 +1233,31 @@
assert(num_pieces > 0);
- // Update player statistics
+ /* Update player statistics */
{
Player *p = GetPlayer(_current_player);
p->cur_economy.delivered_cargo += num_pieces;
SETBIT(p->cargo_types, cargo_type);
}
- // Get station pointers.
+ /* Get station pointers. */
s_from = GetStation(source);
s_to = GetStation(dest);
- // Check if a subsidy applies.
+ /* Check if a subsidy applies. */
subsidised = CheckSubsidised(s_from, s_to, cargo_type);
- // Increase town's counter for some special goods types
+ /* Increase town's counter for some special goods types */
if (cargo_type == CT_FOOD) s_to->town->new_act_food += num_pieces;
if (cargo_type == CT_WATER) s_to->town->new_act_water += num_pieces;
- // Give the goods to the industry.
+ /* Give the goods to the industry. */
DeliverGoodsToIndustry(s_to->xy, cargo_type, num_pieces);
- // Determine profit
+ /* Determine profit */
profit = GetTransportedGoodsIncome(num_pieces, DistanceManhattan(source_tile, s_to->xy), days_in_transit, cargo_type);
- // Modify profit if a subsidy is in effect
+ /* Modify profit if a subsidy is in effect */
if (subsidised) {
switch (_opt.diff.subsidy_multiplier) {
case 0: profit += profit >> 1; break;
@@ -1372,10 +1383,10 @@
CLRBIT(u->load_status, LS_LOADING_FINISHED);
if (v->cargo_source != last_visited && ge->waiting_acceptance & 0x8000 && !(u->current_order.flags & OF_TRANSFER)) {
- // deliver goods to the station
+ /* deliver goods to the station */
st->time_since_unload = 0;
- unloading_time += v->cargo_count; /* TTDBUG: bug in original TTD */
+ unloading_time += v->cargo_count; // TTDBUG: bug in original TTD
if (just_arrived && v->cargo_paid_for < v->cargo_count) {
profit += DeliverGoods(v->cargo_count - v->cargo_paid_for, v->cargo_type, v->cargo_source, last_visited, v->cargo_source_xy, v->cargo_days);
v->cargo_paid_for = v->cargo_count;
@@ -1401,12 +1412,12 @@
unloading_time += v->cargo_count;
t = GB(ge->waiting_acceptance, 0, 12);
if (t == 0) {
- // No goods waiting at station
+ /* No goods waiting at station */
ge->enroute_time = v->cargo_days;
ge->enroute_from = v->cargo_source;
ge->enroute_from_xy = v->cargo_source_xy;
} else {
- // Goods already waiting at station. Set counters to the worst value.
+ /* Goods already waiting at station. Set counters to the worst value. */
if (v->cargo_days >= ge->enroute_time) ge->enroute_time = v->cargo_days;
if (last_visited != ge->enroute_from) {
@@ -1414,7 +1425,7 @@
ge->enroute_from_xy = v->cargo_source_xy;
}
}
- // Update amount of waiting cargo
+ /* Update amount of waiting cargo */
SB(ge->waiting_acceptance, 0, 12, min(amount_unloaded + t, 0xFFF));
if (u->current_order.flags & OF_TRANSFER) {
@@ -1448,12 +1459,12 @@
default: t = u->max_speed; break;
}
- // if last speed is 0, we treat that as if no vehicle has ever visited the station.
+ /* if last speed is 0, we treat that as if no vehicle has ever visited the station. */
ge->last_speed = min(t, 255);
ge->last_age = _cur_year - v->build_year;
- // If there's goods waiting at the station, and the vehicle
- // has capacity for it, load it on the vehicle.
+ /* If there's goods waiting at the station, and the vehicle
+ * has capacity for it, load it on the vehicle. */
if (count != 0 &&
(cap = v->cargo_cap - v->cargo_count) != 0) {
int cargoshare;
@@ -1470,7 +1481,7 @@
* loading them. Since this will cause
* VEHICLE_TRIGGER_EMPTY to be called at the time when
* the whole vehicle chain is really totally empty, the
- * @completely_empty assignment can then be safely
+ * completely_empty assignment can then be safely
* removed; that's how TTDPatch behaves too. --pasky */
completely_empty = false;
anything_loaded = true;
@@ -1487,7 +1498,7 @@
unloading_time += cap;
st->time_since_load = 0;
- // And record the source of the cargo, and the days in travel.
+ /* And record the source of the cargo, and the days in travel. */
v->cargo_source = ge->enroute_from;
v->cargo_source_xy = ge->enroute_from_xy;
v->cargo_days = ge->enroute_time;
@@ -1518,7 +1529,7 @@
}
if (v->type == VEH_Train) {
- // Each platform tile is worth 2 rail vehicles.
+ /* Each platform tile is worth 2 rail vehicles. */
int overhang = v->u.rail.cached_total_length - st->GetPlatformLength(v->tile) * TILE_SIZE;
if (overhang > 0) {
unloading_time <<= 1;
@@ -1560,7 +1571,7 @@
if (_patches.inflation && _cur_year < MAX_YEAR)
AddInflation();
PlayersPayInterest();
- // Reset the _current_player flag
+ /* Reset the _current_player flag */
_current_player = OWNER_NONE;
HandleEconomyFluctuations();
SubsidyMonthlyHandler();
@@ -1577,7 +1588,7 @@
SetDParam(2, p->bankrupt_value);
AddNewsItem( (StringID)(_current_player | NB_BMERGER), NEWS_FLAGS(NM_CALLBACK, 0, NT_COMPANY_INFO, DNC_BANKRUPCY),0,0);
- // original code does this a little bit differently
+ /* original code does this a little bit differently */
PlayerID pi = p->index;
ChangeOwnershipOfPlayerItems(pi, _current_player);
@@ -1674,7 +1685,7 @@
if (flags & DC_EXEC) {
PlayerByte* b = p->share_owners;
- while (*b != _current_player) b++; /* share owners is guaranteed to contain player */
+ while (*b != _current_player) b++; // share owners is guaranteed to contain player
*b = PLAYER_SPECTATOR;
InvalidateWindow(WC_COMPANY, p1);
}
@@ -1707,14 +1718,14 @@
return p->bankrupt_value;
}
-// Prices
+/** Prices */
static void SaveLoad_PRIC(void)
{
SlArray(&_price, NUM_PRICES, SLE_INT32);
SlArray(&_price_frac, NUM_PRICES, SLE_UINT16);
}
-// Cargo payment rates
+/** Cargo payment rates */
static void SaveLoad_CAPR(void)
{
SlArray(&_cargo_payment_rates, NUM_CARGO, SLE_INT32);
@@ -1731,7 +1742,7 @@
SLE_END()
};
-// Economy variables
+/** Economy variables */
static void SaveLoad_ECMY(void)
{
SlObject(&_economy, _economy_desc);
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/economy.h
--- a/src/economy.h Tue Feb 27 23:54:28 2007 +0000
+++ b/src/economy.h Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file economy.h */
+
#ifndef ECONOMY_H
#define ECONOMY_H
@@ -7,15 +9,12 @@
void SetPriceBaseMultiplier(uint price, byte factor);
typedef struct {
- // Maximum possible loan
- int32 max_loan;
- int32 max_loan_unround;
- // Economy fluctuation status
+ int32 max_loan; ///< Maximum possible loan
+ int32 max_loan_unround; ///< Economy fluctuation status
int fluct;
- // Interest
- byte interest_rate;
- byte infl_amount;
- byte infl_amount_pr;
+ byte interest_rate; ///< Interest
+ byte infl_amount; ///< inflation amount
+ byte infl_amount_pr; ///< "floating" portion of inflation
} Economy;
VARDEF Economy _economy;
@@ -40,19 +39,19 @@
SCORE_CARGO = 6,
SCORE_MONEY = 7,
SCORE_LOAN = 8,
- SCORE_TOTAL = 9, // This must always be the last entry
- SCORE_END = 10, // How many scores are there..
+ SCORE_TOTAL = 9, ///< This must always be the last entry
+ SCORE_END = 10, ///< How many scores are there..
- SCORE_MAX = 1000 // The max score that can be in the performance history
- // the scores together of score_info is allowed to be more!
+ SCORE_MAX = 1000 ///< The max score that can be in the performance history
+ /* the scores together of score_info is allowed to be more! */
};
DECLARE_POSTFIX_INCREMENT(ScoreID);
typedef struct ScoreInfo {
- byte id; // Unique ID of the score
- int needed; // How much you need to get the perfect score
- int score; // How much score it will give
+ byte id; ///< Unique ID of the score
+ int needed; ///< How much you need to get the perfect score
+ int score; ///< How much score it will give
} ScoreInfo;
extern const ScoreInfo _score_info[];
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/elrail.cpp
--- a/src/elrail.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/elrail.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,5 @@
/* $Id$ */
-/** @file elrail.c
+/** @file elrail.cpp
* This file deals with displaying wires and pylons for electric railways.
* Basics
*
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/endian_check.cpp
--- a/src/endian_check.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/endian_check.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -1,16 +1,17 @@
/* $Id$ */
+/** @file endian_check.cpp
+ * This pretty simple file checks if the system is LITTLE_ENDIAN or BIG_ENDIAN
+ * it does that by putting a 1 and a 0 in an array, and read it out as one
+ * number. If it is 1, it is LITTLE_ENDIAN, if it is 256, it is BIG_ENDIAN
+ *
+ * After that it outputs the contents of an include files (endian.h)
+ * that says or TTD_LITTLE_ENDIAN, or TTD_BIG_ENDIAN. Makefile takes
+ * care of the real writing to the file. */
+
#include
#include
-// This pretty simple file checks if the system is LITTLE_ENDIAN or BIG_ENDIAN
-// it does that by putting a 1 and a 0 in an array, and read it out as one
-// number. If it is 1, it is LITTLE_ENDIAN, if it is 256, it is BIG_ENDIAN
-//
-// After that it outputs the contents of an include files (endian.h)
-// that says or TTD_LITTLE_ENDIAN, or TTD_BIG_ENDIAN. Makefile takes
-// care of the real writing to the file.
-
int main (int argc, char *argv[]) {
unsigned char EndianTest[2] = { 1, 0 };
int force_BE = 0, force_LE = 0, force_PREPROCESSOR = 0;
@@ -31,9 +32,9 @@
printf("#define TTD_BIG_ENDIAN\n");
} else {
if (force_PREPROCESSOR == 1) {
- // adding support for universal binaries on OSX
- // Universal binaries supports both PPC and x86
- // If a compiler for OSX gets this setting, it will always pick the correct endian and no test is needed
+ /** adding support for universal binaries on OSX
+ * Universal binaries supports both PPC and x86
+ * If a compiler for OSX gets this setting, it will always pick the correct endian and no test is needed */
printf("#ifdef __BIG_ENDIAN__\n");
printf("#define TTD_BIG_ENDIAN\n");
printf("#else\n");
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/engine.cpp
--- a/src/engine.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/engine.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file engine.cpp */
+
#include "stdafx.h"
#include "openttd.h"
#include "debug.h"
@@ -122,9 +124,9 @@
e->flags = 0;
e->player_avail = 0;
- // The magic value of 729 days below comes from the NewGRF spec. If the
- // base intro date is before 1922 then the random number of days is not
- // added.
+ /* The magic value of 729 days below comes from the NewGRF spec. If the
+ * base intro date is before 1922 then the random number of days is not
+ * added. */
r = Random();
e->intro_date = ei->base_intro <= ConvertYMDToDate(1922, 0, 1) ? ei->base_intro : (Date)GB(r, 0, 9) + ei->base_intro;
if (e->intro_date <= _date) {
@@ -154,7 +156,7 @@
e->lifelength = ei->lifelength + _patches.extend_vehicle_life;
- // prevent certain engines from ever appearing.
+ /* prevent certain engines from ever appearing. */
if (!HASBIT(ei->climates, _opt.landscape)) {
e->flags |= ENGINE_AVAILABLE;
e->player_avail = 0;
@@ -269,7 +271,7 @@
return 0;
}
-// Determine if an engine type is a wagon (and not a loco)
+/* Determine if an engine type is a wagon (and not a loco) */
static bool IsWagon(EngineID index)
{
return index < NUM_TRAIN_ENGINES && RailVehInfo(index)->railveh_type == RAILVEH_WAGON;
@@ -281,8 +283,8 @@
Player *p;
EngineID index = e - _engines;
- // In case the player didn't build the vehicle during the intro period,
- // prevent that player from getting future intro periods for a while.
+ /* In case the player didn't build the vehicle during the intro period,
+ * prevent that player from getting future intro periods for a while. */
if (e->flags & ENGINE_INTRODUCING) {
FOR_ALL_PLAYERS(p) {
uint block_preview = p->block_preview;
@@ -308,14 +310,14 @@
e->flags = (e->flags & ~ENGINE_INTRODUCING) | ENGINE_AVAILABLE;
AddRemoveEngineFromAutoreplaceAndBuildWindows(e->type);
- // Now available for all players
+ /* Now available for all players */
e->player_avail = (byte)-1;
- // Do not introduce new rail wagons
+ /* Do not introduce new rail wagons */
if (IsWagon(index)) return;
if (index < NUM_TRAIN_ENGINES) {
- // maybe make another rail type available
+ /* maybe make another rail type available */
RailType railtype = RailVehInfo(index)->railtype;
assert(railtype < RAILTYPE_END);
FOR_ALL_PLAYERS(p) {
@@ -338,20 +340,20 @@
if (_cur_year < YEAR_ENGINE_AGING_STOPS) {
for (e = _engines; e != endof(_engines); e++) {
- // Age the vehicle
+ /* Age the vehicle */
if (e->flags & ENGINE_AVAILABLE && e->age != 0xFFFF) {
e->age++;
CalcEngineReliability(e);
}
if (!(e->flags & ENGINE_AVAILABLE) && _date >= (e->intro_date + 365)) {
- // Introduce it to all players
+ /* Introduce it to all players */
NewVehicleAvailable(e);
} else if (!(e->flags & (ENGINE_AVAILABLE|ENGINE_INTRODUCING)) && _date >= e->intro_date) {
- // Introduction date has passed.. show introducing dialog to one player.
+ /* Introduction date has passed.. show introducing dialog to one player. */
e->flags |= ENGINE_INTRODUCING;
- // Do not introduce new rail wagons
+ /* Do not introduce new rail wagons */
if (!IsWagon(e - _engines))
e->preview_player = (PlayerID)1; // Give to the player with the highest rating.
}
@@ -399,15 +401,15 @@
{
const Engine *e;
- // check if it's an engine that is in the engine array
+ /* check if it's an engine that is in the engine array */
if (!IsEngineIndex(engine)) return false;
e = GetEngine(engine);
- // check if it's an engine of specified type
+ /* check if it's an engine of specified type */
if (e->type != type) return false;
- // check if it's available
+ /* check if it's available */
if (!HASBIT(e->player_avail, player)) return false;
return true;
@@ -595,7 +597,7 @@
SLE_CONDNULL(1, 0, 44),
SLE_VAR(Engine, player_avail, SLE_UINT8),
- // reserve extra space in savegame here. (currently 16 bytes)
+ /* reserve extra space in savegame here. (currently 16 bytes) */
SLE_CONDNULL(16, 2, SL_MAX_VERSION),
SLE_END()
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/engine.h
--- a/src/engine.h Tue Feb 27 23:54:28 2007 +0000
+++ b/src/engine.h Wed Feb 28 00:33:40 2007 +0000
@@ -1,19 +1,19 @@
/* $Id$ */
+/** @file engine.h */
+
#ifndef ENGINE_H
#define ENGINE_H
-/** @file engine.h */
-
#include "oldpool.h"
#include "rail.h"
#include "sound.h"
#include "vehicle.h"
enum RailVehicleTypes {
- RAILVEH_SINGLEHEAD,
- RAILVEH_MULTIHEAD,
- RAILVEH_WAGON,
+ RAILVEH_SINGLEHEAD, ///< indicates a "standalone" locomotive
+ RAILVEH_MULTIHEAD, ///< indicates a combination of two locomotives
+ RAILVEH_WAGON, ///< simple wagon, not motorized
};
typedef struct RailVehicleInfo {
@@ -26,7 +26,7 @@
uint16 weight;
byte running_cost_base;
byte running_cost_class;
- byte engclass; // 0: steam, 1: diesel, 2: electric
+ byte engclass; ///< 0: steam, 1: diesel, 2: electric
byte capacity;
CargoID cargo_type;
byte ai_rank;
@@ -36,9 +36,9 @@
// for when the 'powered wagon' callback fails. But it should really also determine what
// kind of visual effect to generate for a vehicle (default, steam, diesel, electric).
// Same goes for the callback result, which atm is only used to check if a wagon is powered.
- byte shorten_factor; // length on main map for this type is 8 - shorten_factor
+ byte shorten_factor; ///< length on main map for this type is 8 - shorten_factor
byte tractive_effort; ///< Tractive effort coefficient
- byte user_def_data; ///! Property 0x25: "User-defined bit mask" Used only for (very few) NewGRF vehicles
+ byte user_def_data; ///< Property 0x25: "User-defined bit mask" Used only for (very few) NewGRF vehicles
} RailVehicleInfo;
typedef struct ShipVehicleInfo {
@@ -57,7 +57,7 @@
* in which case bit 1 tells us whether it's a big(fast) plane or not */
enum {
AIR_HELI = 0,
- AIR_CTOL = 1, // Conventional Take Off and Landing, i.e. planes
+ AIR_CTOL = 1, ///< Conventional Take Off and Landing, i.e. planes
AIR_FAST = 2
};
@@ -111,7 +111,7 @@
PlayerByte preview_player;
byte preview_wait;
byte player_avail;
- byte type; // type, ie VEH_Road, VEH_Train, etc. Same as in vehicle.h
+ byte type; ///< type, ie VEH_Road, VEH_Train, etc. Same as in vehicle.h
} Engine;
/**
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/engine_gui.cpp
--- a/src/engine_gui.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/engine_gui.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file engine_gui.cpp */
+
#include "stdafx.h"
#include "openttd.h"
#include "table/strings.h"
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/fios.cpp
--- a/src/fios.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/fios.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -1,6 +1,6 @@
/* $Id$ */
-/** @file fios.c
+/** @file fios.cpp
* This file contains functions for building file lists for the save/load dialogs.
*/
@@ -21,7 +21,6 @@
# include
#else
# include
-# include
#endif /* WIN32 */
/* Variables to display file lists */
@@ -187,9 +186,7 @@
{
#if defined(WINCE)
/* There is always one platform that doesn't support basic commands... */
- HANDLE hand;
-
- hand = CreateFile(OTTD2FS(filename), 0, 0, NULL, OPEN_EXISTING, 0, NULL);
+ HANDLE hand = CreateFile(OTTD2FS(filename), 0, 0, NULL, OPEN_EXISTING, 0, NULL);
if (hand == INVALID_HANDLE_VALUE) return 1;
CloseHandle(hand);
return 0;
@@ -212,6 +209,7 @@
DIR *dir;
FiosItem *fios;
int sort_start;
+ char d_name[sizeof(fios->name)];
/* A parent directory link exists if we are not in the root directory */
if (!FiosIsRoot(_fios_path) && mode != SLD_NEW_GAME) {
@@ -223,9 +221,9 @@
}
/* Show subdirectories */
- if (mode != SLD_NEW_GAME && (dir = opendir(_fios_path)) != NULL) {
+ if (mode != SLD_NEW_GAME && (dir = ttd_opendir(_fios_path)) != NULL) {
while ((dirent = readdir(dir)) != NULL) {
- const char *d_name = FS2OTTD(dirent->d_name);
+ ttd_strlcpy(d_name, FS2OTTD(dirent->d_name), sizeof(d_name));
/* found file must be directory, but not '.' or '..' */
if (FiosIsValidFile(_fios_path, dirent, &sb) && (sb.st_mode & S_IFDIR) &&
@@ -253,13 +251,12 @@
sort_start = _fios_count;
/* Show files */
- dir = opendir(_fios_path);
+ dir = ttd_opendir(_fios_path);
if (dir != NULL) {
while ((dirent = readdir(dir)) != NULL) {
char fios_title[64];
char *t;
- char *d_name = (char*)FS2OTTD(dirent->d_name);
- byte type;
+ ttd_strlcpy(d_name, FS2OTTD(dirent->d_name), sizeof(d_name));
if (!FiosIsValidFile(_fios_path, dirent, &sb) || !(sb.st_mode & S_IFREG)) continue;
@@ -267,7 +264,7 @@
if ((t = strrchr(d_name, '.')) == NULL) continue;
fios_title[0] = '\0'; // reset the title;
- type = callback_proc(mode, d_name, t, fios_title);
+ byte type = callback_proc(mode, d_name, t, fios_title);
if (type != FIOS_TYPE_INVALID) {
fios = FiosAlloc();
fios->mtime = sb.st_mtime;
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/fios.h
--- a/src/fios.h Tue Feb 27 23:54:28 2007 +0000
+++ b/src/fios.h Wed Feb 28 00:33:40 2007 +0000
@@ -77,10 +77,25 @@
bool at_first_entry;
};
-DIR *opendir(const char *path);
+DIR *opendir(const wchar_t *path);
struct dirent *readdir(DIR *d);
int closedir(DIR *d);
-
+#else
+/* Use system-supplied opendir/readdir/closedir functions */
+# include
+# include
#endif /* defined(WIN32) */
+/**
+ * A wrapper around opendir() which will convert the string from
+ * OPENTTD encoding to that of the filesystem. For all purposes this
+ * function behaves the same as the original opendir function
+ * @param path string to open directory of
+ * @return DIR pointer
+ */
+static inline DIR *ttd_opendir(const char *path)
+{
+ return opendir(OTTD2FS(path));
+}
+
#endif /* FIOS_H */
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/gfx.cpp
--- a/src/gfx.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/gfx.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -1987,18 +1987,14 @@
static void SwitchAnimatedCursor(void)
{
- CursorVars *cv = &_cursor;
- const CursorID *cur = cv->animate_cur;
- CursorID sprite;
+ const AnimCursor *cur = _cursor.animate_cur;
- // ANIM_CURSOR_END is 0xFFFF in table/animcursors.h
- if (cur == NULL || *cur == 0xFFFF) cur = cv->animate_list;
+ if (cur == NULL || cur->sprite == AnimCursor::LAST) cur = _cursor.animate_list;
- sprite = cur[0];
- cv->animate_timeout = cur[1];
- cv->animate_cur = cur + 2;
+ SetCursorSprite(cur->sprite, _cursor.pal);
- SetCursorSprite(sprite, cv->pal);
+ _cursor.animate_timeout = cur->display_time;
+ _cursor.animate_cur = cur + 1;
}
void CursorTick(void)
@@ -2015,7 +2011,7 @@
SetCursorSprite(sprite, pal);
}
-void SetAnimatedMouseCursor(const CursorID *table)
+void SetAnimatedMouseCursor(const AnimCursor *table)
{
_cursor.animate_list = table;
_cursor.animate_cur = NULL;
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/gfx.h
--- a/src/gfx.h Tue Feb 27 23:54:28 2007 +0000
+++ b/src/gfx.h Wed Feb 28 00:33:40 2007 +0000
@@ -96,6 +96,12 @@
int left,top,right,bottom;
} Rect;
+/** A single sprite of a list of animated cursors */
+struct AnimCursor {
+ static const CursorID LAST = MAX_UVALUE(CursorID);
+ CursorID sprite; ///< Must be set to LAST_ANIM when it is the last sprite of the loop
+ byte display_time; ///< Amount of ticks this sprite will be shown
+};
typedef struct CursorVars {
Point pos, size, offs, delta; ///< position, size, offset from top-left, and movement
@@ -104,8 +110,9 @@
SpriteID pal;
int wheel; ///< mouse wheel movement
- const CursorID *animate_list, *animate_cur; ///< in case of animated cursor, list of frames
- uint animate_timeout; ///< current frame in list of animated cursor
+ const AnimCursor *animate_list; ///< in case of animated cursor, list of frames
+ const AnimCursor *animate_cur; ///< in case of animated cursor, current frame
+ uint animate_timeout; ///< in case of animated cursor, number of ticks to show the current cursor
bool visible; ///< cursor is visible
bool dirty; ///< the rect occupied by the mouse is dirty (redraw)
@@ -226,7 +233,7 @@
void SetMouseCursor(CursorID cursor);
void SetMouseCursor(SpriteID sprite, SpriteID pal);
-void SetAnimatedMouseCursor(const CursorID *table);
+void SetAnimatedMouseCursor(const AnimCursor *table);
void CursorTick(void);
void DrawMouseCursor(void);
void ScreenSizeChanged(void);
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/gfxinit.cpp
--- a/src/gfxinit.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/gfxinit.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -333,6 +333,7 @@
377, 377, // · small
153, 153, // · medium
601, 601, // · large
+ SPR_WARNING_SIGN, SPR_WARNING_SIGN,
END
};
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/graph_gui.cpp
--- a/src/graph_gui.cpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/graph_gui.cpp Wed Feb 28 00:33:40 2007 +0000
@@ -13,8 +13,7 @@
#include "variables.h"
#include "date.h"
#include "helpers.hpp"
-
-const byte _cargo_colours[NUM_CARGO] = {152, 32, 15, 174, 208, 194, 191, 84, 184, 10, 202, 48};
+#include "cargotype.h"
/* Bitmasks of player and cargo indices that shouldn't be drawn. */
static uint _legend_excluded_players;
@@ -749,13 +748,14 @@
* clk_dif will move one pixel down and one pixel to the right
* when the button is clicked */
byte clk_dif = w->IsWidgetLowered(i + 3) ? 1 : 0;
+ const CargoSpec *cs = GetCargo(i);
GfxFillRect(x + clk_dif, y + clk_dif, x + 8 + clk_dif, y + 5 + clk_dif, 0);
- GfxFillRect(x + 1 + clk_dif, y + 1 + clk_dif, x + 7 + clk_dif, y + 4 + clk_dif, _cargo_colours[i]);
- SetDParam(0, _cargoc.names_s[i]);
+ GfxFillRect(x + 1 + clk_dif, y + 1 + clk_dif, x + 7 + clk_dif, y + 4 + clk_dif, cs->legend_colour);
+ SetDParam(0, cs->name != 0 ? cs->name : (StringID)STR_EMPTY);
DrawString(x + 14 + clk_dif, y + clk_dif, STR_7065, 0);
y += 8;
- gd.colors[i] = _cargo_colours[i];
+ gd.colors[i] = cs->legend_colour;
for (j = 0; j != 20; j++) {
gd.cost[i][j] = GetTransportedGoodsIncome(10, 20, j * 6 + 6, i);
}
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/gui.h
--- a/src/gui.h Tue Feb 27 23:54:28 2007 +0000
+++ b/src/gui.h Wed Feb 28 00:33:40 2007 +0000
@@ -20,7 +20,6 @@
void DrawArrowButtons(int x, int y, int ctab, byte state, bool clickable_left, bool clickable_right);
/* graph_gui.c */
-extern const byte _cargo_colours[NUM_CARGO];
void ShowOperatingProfitGraph(void);
void ShowIncomeGraph(void);
void ShowDeliveredCargoGraph(void);
diff -r 7c8ec33959b1 -r 4b5241e5dd10 src/helpers.hpp
--- a/src/helpers.hpp Tue Feb 27 23:54:28 2007 +0000
+++ b/src/helpers.hpp Wed Feb 28 00:33:40 2007 +0000
@@ -6,8 +6,6 @@
/** @file helpers.hpp */
#include "macros.h"
-#ifdef __cplusplus
-
/** When allocating using malloc/calloc in C++ it is usually needed to cast the return value
* from void* to the proper pointer type. Another alternative would be MallocT<> as follows */
template FORCEINLINE T* MallocT(size_t num_elements)
@@ -82,12 +80,23 @@
/** Informative template class exposing basic enumeration properties used by several
* other templates below. Here we have only forward declaration. For each enum type
- * we will create specialization derived from MakeEnumPropsT<>. */
+ * we will create specialization derived from MakeEnumPropsT<>.
+ * i.e.:
+ * template <> struct EnumPropsT