mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-08-23 22:49:09 +00:00
Compare commits
1 Commits
0.7.1-RC3
...
0.7.0-beta
Author | SHA1 | Date | |
---|---|---|---|
|
57cbb89fa9 |
2
Doxyfile
2
Doxyfile
@@ -1,7 +1,7 @@
|
||||
#---------------------------------------------------------------------------
|
||||
# Project related configuration options
|
||||
#---------------------------------------------------------------------------
|
||||
PROJECT_NAME = OpenTTD
|
||||
PROJECT_NAME = openttd
|
||||
OUTPUT_DIRECTORY = docs/source/
|
||||
CREATE_SUBDIRS = NO
|
||||
OUTPUT_LANGUAGE = English
|
||||
|
@@ -93,7 +93,7 @@ ifeq ($(shell if test -f config.cache; then echo 1; fi), 1)
|
||||
@echo " Going to reconfigure with last known settings..."
|
||||
@echo "----------------"
|
||||
# Make sure we don't lock config.cache
|
||||
@$(shell cat config.cache | sed 's@\\ @\\\\ @g') || exit 1
|
||||
@$(shell cat config.cache | sed 's~\\ ~\\\\ ~g') || exit 1
|
||||
@echo "----------------"
|
||||
@echo "Reconfig done. Please re-execute make."
|
||||
@echo "----------------"
|
||||
|
@@ -20,7 +20,7 @@ SRC_DIR = "$(ROOT_DIR)/src"
|
||||
BUNDLE_DIR = "$(ROOT_DIR)/bundle"
|
||||
BUNDLES_DIR = "$(ROOT_DIR)/bundles"
|
||||
TTD = "openttd.exe"
|
||||
TARGET := $(shell echo $(PLATFORM) | sed "s@win64@x64@;s@win32@Win32@")
|
||||
TARGET := $(shell echo $(PLATFORM) | sed "s~win64~x64~;s~win32~Win32~")
|
||||
|
||||
all:
|
||||
$(Q)cp objs/$(TARGET)/Release/$(TTD) $(BIN_DIR)/$(TTD)
|
||||
|
@@ -57,7 +57,7 @@ ENDIAN_TARGETS := endian_target.h $(ENDIAN_CHECK)
|
||||
# For more information, please check:
|
||||
# http://maillist.openttd.org/pipermail/devs/2007-April/000284.html
|
||||
# http://maillist.openttd.org/pipermail/devs/2007-February/000248.html
|
||||
GCC295_FIX=sed -r 's@^(\t*)(.*)( const )([A-Za-z0-9_ ]+(\[.*\]){2,})(( = \{)|(;))(.*)$$@\1\2 \4\6\8\9@g'
|
||||
GCC295_FIX=sed -r 's~^(\t*)(.*)( const )([A-Za-z0-9_ ]+(\[.*\]){2,})(( = \{)|(;))(.*)$$~\1\2 \4\6\8\9~g'
|
||||
# This 'sed' removes the 3rd '4' in the # lines of the -E output of
|
||||
# gcc 2.95.3 and lower, as it should indicate that it is a C-linkage, but the
|
||||
# compiler can't handle that information (just don't ask). So we remove it
|
||||
@@ -65,7 +65,7 @@ GCC295_FIX=sed -r 's@^(\t*)(.*)( const )([A-Za-z0-9_ ]+(\[.*\]){2,})(( = \{)|(;)
|
||||
# Furthermore gcc 2.95 has some trouble with protected and private when
|
||||
# accessing the protected/private stuff of the enclosing class (or the
|
||||
# super class of the enclosing class).
|
||||
GCC295_FIX_2=sed -e 's@\(^\# [0-9][0-9]* "[^"]*"[ 0-9]*\) 4$$@\1@g;s@private:@public:@g;s@protected:@public:@g'
|
||||
GCC295_FIX_2=sed -e 's~\(^\# [0-9][0-9]* "[^"]*"[ 0-9]*\) 4$$~\1~g;s~private:~public:~g;s~protected:~public:~g'
|
||||
|
||||
# Check if we want to show what we are doing
|
||||
ifdef VERBOSE
|
||||
@@ -98,7 +98,7 @@ MODIFIED := $(shell echo "$(VERSIONS)" | cut -f 3 -d' ')
|
||||
ifdef REVISION
|
||||
# Use specified revision (which should be of the form "r000").
|
||||
REV := $(REVISION)
|
||||
REV_NR := $(shell echo $(REVISION) | sed "s@[^0-9]@@g")
|
||||
REV_NR := $(shell echo $(REVISION) | sed "s~[^0-9]~~g")
|
||||
else
|
||||
# Use autodetected revisions
|
||||
REV := $(shell echo "$(VERSIONS)" | cut -f 1 -d' ')
|
||||
@@ -143,15 +143,15 @@ endif
|
||||
|
||||
$(OBJS_C:%.o=%.d): %.d: $(SRC_DIR)/%.c $(FILE_DEP)
|
||||
$(E) '$(STAGE) DEP $(<:$(SRC_DIR)/%.c=%.c)'
|
||||
$(Q)$(CC_HOST) $(CC_CFLAGS) $(CFLAGS) -MM $< | sed 's@^$(@F:%.d=%.o):@$@ $(@:%.d=%.o):@' > $@
|
||||
$(Q)$(CC_HOST) $(CC_CFLAGS) $(CFLAGS) -MM $< | sed 's~^$(@F:%.d=%.o):~$@ $(@:%.d=%.o):~' > $@
|
||||
|
||||
$(OBJS_CPP:%.o=%.d): %.d: $(SRC_DIR)/%.cpp $(FILE_DEP)
|
||||
$(E) '$(STAGE) DEP $(<:$(SRC_DIR)/%.cpp=%.cpp)'
|
||||
$(Q)$(CXX_HOST) $(CFLAGS) -MM $< | sed 's@^$(@F:%.d=%.o):@$@ $(@:%.d=%.o):@' > $@
|
||||
$(Q)$(CXX_HOST) $(CFLAGS) -MM $< | sed 's~^$(@F:%.d=%.o):~$@ $(@:%.d=%.o):~' > $@
|
||||
|
||||
$(OBJS_MM:%.o=%.d): %.d: $(SRC_DIR)/%.mm $(FILE_DEP)
|
||||
$(E) '$(STAGE) DEP $(<:$(SRC_DIR)/%.mm=%.mm)'
|
||||
$(Q)$(CC_HOST) $(CFLAGS) -MM $< | sed 's@^$(@F:%.d=%.o):@$@ $(@:%.d=%.o):@' > $@
|
||||
$(Q)$(CC_HOST) $(CFLAGS) -MM $< | sed 's~^$(@F:%.d=%.o):~$@ $(@:%.d=%.o):~' > $@
|
||||
|
||||
$(OBJS_RC:%.o=%.d): %.d: $(SRC_DIR)/%.rc $(FILE_DEP)
|
||||
$(E) '$(STAGE) DEP $(<:$(SRC_DIR)/%.mm=%.mm)'
|
||||
@@ -182,7 +182,7 @@ endif
|
||||
|
||||
# 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
|
||||
@@ -211,7 +211,7 @@ endif
|
||||
{ \
|
||||
print $$0 \
|
||||
} \
|
||||
' < Makefile.dep.tmp | sed 's@ *@ @g;s@ $$@@' | $(SORT) > Makefile.dep
|
||||
' < Makefile.dep.tmp | sed 's~ *~ ~g;s~ $$~~' | $(SORT) > Makefile.dep
|
||||
|
||||
$(Q)rm -f Makefile.dep.tmp Makefile.dep.tmp.bak
|
||||
|
||||
@@ -280,10 +280,10 @@ $(ENDIAN_CHECK): $(SRC_DIR)/endian_check.cpp
|
||||
# Revision files
|
||||
|
||||
$(SRC_DIR)/rev.cpp: $(CONFIG_CACHE_VERSION) $(SRC_DIR)/rev.cpp.in
|
||||
$(Q)cat $(SRC_DIR)/rev.cpp.in | sed "s@\!\!REVISION\!\!@$(REV_NR)@g;s@!!VERSION!!@$(REV)@g;s@!!MODIFIED!!@$(MODIFIED)@g;s@!!DATE!!@`date +%d.%m.%y`@g" > $(SRC_DIR)/rev.cpp
|
||||
$(Q)cat $(SRC_DIR)/rev.cpp.in | sed "s~@@REVISION@@~$(REV_NR)~g;s~@@VERSION@@~$(REV)~g;s~@@MODIFIED@@~$(MODIFIED)~g;s~@@DATE@@~`date +%d.%m.%y`~g" > $(SRC_DIR)/rev.cpp
|
||||
|
||||
$(SRC_DIR)/ottdres.rc: $(CONFIG_CACHE_VERSION) $(SRC_DIR)/ottdres.rc.in
|
||||
$(Q)cat $(SRC_DIR)/ottdres.rc.in | sed "s@\!\!REVISION\!\!@$(REV_NR)@g;s@!!VERSION!!@$(REV)@g;s@!!DATE!!@`date +%d.%m.%y`@g" > $(SRC_DIR)/ottdres.rc
|
||||
$(Q)cat $(SRC_DIR)/ottdres.rc.in | sed "s~@@REVISION@@~$(REV_NR)~g;s~@@VERSION@@~$(REV)~g;s~@@DATE@@~`date +%d.%m.%y`~g" > $(SRC_DIR)/ottdres.rc
|
||||
|
||||
FORCE:
|
||||
|
||||
|
@@ -220,7 +220,6 @@ function Regression::Airport()
|
||||
}
|
||||
|
||||
print(" GetBankBalance(): " + AICompany.GetBankBalance(AICompany.COMPANY_SELF));
|
||||
print(" GetPrice(): " + AIAirport.GetPrice(0));
|
||||
print(" BuildAirport(): " + AIAirport.BuildAirport(32116, 0, AIStation.STATION_JOIN_ADJACENT));
|
||||
print(" IsHangarTile(): " + AIAirport.IsHangarTile(32116));
|
||||
print(" IsAirportTile(): " + AIAirport.IsAirportTile(32116));
|
||||
@@ -257,15 +256,12 @@ function Regression::Bridge()
|
||||
print(" Valid Bridges: " + j);
|
||||
|
||||
print(" IsBridgeTile(): " + AIBridge.IsBridgeTile(33160));
|
||||
print(" GetBridgeID(): " + AIBridge.GetBridgeID(33160));
|
||||
print(" RemoveBridge(): " + AIBridge.RemoveBridge(33155));
|
||||
print(" GetLastErrorString(): " + AIError.GetLastErrorString());
|
||||
print(" GetOtherBridgeEnd(): " + AIBridge.GetOtherBridgeEnd(33160));
|
||||
print(" BuildBridge(): " + AIBridge.BuildBridge(AIVehicle.VT_ROAD, 5, 33160, 33155));
|
||||
print(" IsBridgeTile(): " + AIBridge.IsBridgeTile(33160));
|
||||
print(" GetBridgeID(): " + AIBridge.GetBridgeID(33160));
|
||||
print(" IsBridgeTile(): " + AIBridge.IsBridgeTile(33155));
|
||||
print(" GetBridgeID(): " + AIBridge.GetBridgeID(33155));
|
||||
print(" GetOtherBridgeEnd(): " + AIBridge.GetOtherBridgeEnd(33160));
|
||||
print(" BuildBridge(): " + AIBridge.BuildBridge(AIVehicle.VT_ROAD, 5, 33160, 33155));
|
||||
print(" GetLastErrorString(): " + AIError.GetLastErrorString());
|
||||
@@ -333,7 +329,6 @@ function Regression::Cargo()
|
||||
print(" GetCargoIncome(10, 10): " + AICargo.GetCargoIncome(i, 10, 10));
|
||||
print(" GetCargoIncome(100, 10): " + AICargo.GetCargoIncome(i, 100, 10));
|
||||
print(" GetCargoIncome(10, 100): " + AICargo.GetCargoIncome(i, 10, 100));
|
||||
print(" GetRoadVehicleTypeForCargo(): " + AIRoad.GetRoadVehicleTypeForCargo(i));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -636,9 +631,6 @@ function Regression::IndustryTypeList()
|
||||
print(" GetName(): " + AIIndustryType.GetName(i));
|
||||
print(" CanBuildIndustry(): " + AIIndustryType.CanBuildIndustry(i));
|
||||
print(" CanProspectIndustry(): " + AIIndustryType.CanProspectIndustry(i));
|
||||
print(" IsBuiltOnWater(): " + AIIndustryType.IsBuiltOnWater(i));
|
||||
print(" HasHeliport(): " + AIIndustryType.HasHeliport(i));
|
||||
print(" HasDock(): " + AIIndustryType.HasDock(i));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1077,10 +1069,9 @@ function Regression::Sign()
|
||||
print(" BuildSign(33409, 'Some other Sign'): " + sign_id);
|
||||
print(" RemoveSign(" + sign_id + "): " + AISign.RemoveSign(sign_id));
|
||||
print("");
|
||||
local list = AISignList();
|
||||
list.Sort(AIAbstractList.SORT_BY_ITEM, true);
|
||||
for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
|
||||
j++;
|
||||
print(" GetMaxSignID(): " + AISign.GetMaxSignID());
|
||||
for (local i = -1; i < AISign.GetMaxSignID() + 1; i++) {
|
||||
if (AISign.IsValidSign(i)) j++;
|
||||
print(" Sign " + i);
|
||||
print(" IsValidSign(): " + AISign.IsValidSign(i));
|
||||
print(" GetName(): " + AISign.GetName(i));
|
||||
@@ -1191,7 +1182,7 @@ function Regression::TileList()
|
||||
print("");
|
||||
print("--TileList--");
|
||||
print(" Count(): " + list.Count());
|
||||
list.AddRectangle(34436, 256 * 2 + 34436 + 8);
|
||||
list.AddRectangle(41895 - 256 * 2, 256 * 2 + 41895 + 8);
|
||||
print(" Count(): " + list.Count());
|
||||
|
||||
list.Valuate(AITile.GetHeight);
|
||||
@@ -1202,30 +1193,6 @@ function Regression::TileList()
|
||||
print(" " + i + " => " + list.GetValue(i));
|
||||
}
|
||||
|
||||
list.Valuate(AITile.GetCornerHeight, AITile.CORNER_N);
|
||||
print(" CornerHeight(North): done");
|
||||
print(" Count(): " + list.Count());
|
||||
print(" ListDump:");
|
||||
for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
|
||||
print(" " + i + " => " + list.GetValue(i));
|
||||
}
|
||||
|
||||
list.Valuate(AITile.GetMinHeight);
|
||||
print(" MinHeight(): done");
|
||||
print(" Count(): " + list.Count());
|
||||
print(" ListDump:");
|
||||
for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
|
||||
print(" " + i + " => " + list.GetValue(i));
|
||||
}
|
||||
|
||||
list.Valuate(AITile.GetMaxHeight);
|
||||
print(" MaxHeight(): done");
|
||||
print(" Count(): " + list.Count());
|
||||
print(" ListDump:");
|
||||
for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
|
||||
print(" " + i + " => " + list.GetValue(i));
|
||||
}
|
||||
|
||||
list.Valuate(AITile.GetSlope);
|
||||
list.KeepValue(0);
|
||||
print(" Slope(): done");
|
||||
@@ -1236,8 +1203,6 @@ function Regression::TileList()
|
||||
print(" " + i + " => " + list.GetValue(i));
|
||||
}
|
||||
|
||||
list.Clear();
|
||||
list.AddRectangle(41895 - 256 * 2, 256 * 2 + 41895 + 8);
|
||||
list.Valuate(AITile.IsBuildable);
|
||||
list.KeepValue(1);
|
||||
print(" Buildable(): done");
|
||||
|
File diff suppressed because it is too large
Load Diff
2017
changelog.txt
2017
changelog.txt
File diff suppressed because it is too large
Load Diff
191
config.lib
191
config.lib
@@ -5,7 +5,7 @@ log() {
|
||||
}
|
||||
|
||||
set_default() {
|
||||
released_version="0.7.1-RC3"
|
||||
released_version="0.7.0-beta2"
|
||||
|
||||
ignore_extra_parameters="0"
|
||||
# We set all kinds of defaults for params. Later on the user can override
|
||||
@@ -415,7 +415,7 @@ save_params() {
|
||||
configure="$CONFIGURE_EXECUTABLE --ignore-extra-parameters"
|
||||
for p in $save_params_array; do
|
||||
eval "v=\"\$$p\""
|
||||
p=`echo "$p" | sed 's@_@-@g;s@\n@@g;s@ @\\ @g'`
|
||||
p=`echo "$p" | sed 's~_~-~g;s~\n~~g;s~ ~\\ ~g'`
|
||||
# Only save those params that aren't empty
|
||||
configure="$configure --$p=\"$v\""
|
||||
done
|
||||
@@ -815,7 +815,6 @@ check_params() {
|
||||
fi
|
||||
|
||||
if [ "$os" = "OSX" ]; then
|
||||
check_osx_sdk
|
||||
# Test on G5
|
||||
|
||||
if [ "$enable_osx_g5" != "0" ]; then
|
||||
@@ -904,7 +903,7 @@ check_params() {
|
||||
doc_dir="$data_dir/docs"
|
||||
fi
|
||||
else
|
||||
doc_dir="`echo $doc_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
|
||||
doc_dir="`echo $doc_dir | sed 's~\([^\]\)\\\\ ~\1\\\\\\\\ ~g;s~\([^\]\) ~\1\\\\\\\\ ~g'`"
|
||||
fi
|
||||
|
||||
if [ "$icon_theme_dir" = "1" ]; then
|
||||
@@ -914,7 +913,7 @@ check_params() {
|
||||
icon_theme_dir=""
|
||||
fi
|
||||
else
|
||||
icon_theme_dir="`echo $icon_theme_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
|
||||
icon_theme_dir="`echo $icon_theme_dir | sed 's~\([^\]\)\\\\ ~\1\\\\\\\\ ~g;s~\([^\]\) ~\1\\\\\\\\ ~g'`"
|
||||
fi
|
||||
|
||||
if [ "$personal_dir" = "1" ]; then
|
||||
@@ -926,7 +925,7 @@ check_params() {
|
||||
personal_dir=".openttd"
|
||||
fi
|
||||
else
|
||||
personal_dir="`echo $personal_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
|
||||
personal_dir="`echo $personal_dir | sed 's~\([^\]\)\\\\ ~\1\\\\\\\\ ~g;s~\([^\]\) ~\1\\\\\\\\ ~g'`"
|
||||
fi
|
||||
|
||||
if [ "$shared_dir" = "1" ]; then
|
||||
@@ -937,7 +936,7 @@ check_params() {
|
||||
shared_dir=""
|
||||
fi
|
||||
else
|
||||
shared_dir="`echo $shared_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
|
||||
shared_dir="`echo $shared_dir | sed 's~\([^\]\)\\\\ ~\1\\\\\\\\ ~g;s~\([^\]\) ~\1\\\\\\\\ ~g'`"
|
||||
fi
|
||||
|
||||
if [ "$man_dir" = "1" ]; then
|
||||
@@ -948,7 +947,7 @@ check_params() {
|
||||
man_dir=""
|
||||
fi
|
||||
else
|
||||
man_dir="`echo $man_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
|
||||
man_dir="`echo $man_dir | sed 's~\([^\]\)\\\\ ~\1\\\\\\\\ ~g;s~\([^\]\) ~\1\\\\\\\\ ~g'`"
|
||||
fi
|
||||
|
||||
if [ "$menu_dir" = "1" ]; then
|
||||
@@ -959,7 +958,7 @@ check_params() {
|
||||
menu_dir=""
|
||||
fi
|
||||
else
|
||||
menu_dir="`echo $menu_dir | sed 's@\([^\]\)\\\\ @\1\\\\\\\\ @g;s@\([^\]\) @\1\\\\\\\\ @g'`"
|
||||
menu_dir="`echo $menu_dir | sed 's~\([^\]\)\\\\ ~\1\\\\\\\\ ~g;s~\([^\]\) ~\1\\\\\\\\ ~g'`"
|
||||
fi
|
||||
|
||||
# "set_universal_binary_flags" needs to be before "detect_iconv"
|
||||
@@ -1207,7 +1206,7 @@ make_cflags_and_ldflags() {
|
||||
if [ -n "$sdl_config" ]; then
|
||||
CFLAGS="$CFLAGS -DWITH_SDL"
|
||||
# SDL must not add _GNU_SOURCE as it breaks many platforms
|
||||
CFLAGS="$CFLAGS `$sdl_config --cflags | sed 's@-D_GNU_SOURCE[^ ]*@@'`"
|
||||
CFLAGS="$CFLAGS `$sdl_config --cflags | sed 's~-D_GNU_SOURCE[^ ]*~~'`"
|
||||
if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "WINCE" ]; then
|
||||
if [ "$enable_static" != "0" ]; then
|
||||
LIBS="$LIBS `$sdl_config --static-libs`"
|
||||
@@ -1269,7 +1268,7 @@ make_cflags_and_ldflags() {
|
||||
if [ "$os" = "OSX" ]; then
|
||||
# fontconfig_config goes via pkg-config on all systems, which doesn't know --prefix
|
||||
# Also, despite the reason we link to the .a file ourself (because we can't use -static), we do need to ask pkg-config about possible other deps
|
||||
LIBS="$LIBS `$fontconfig_config --variable=prefix`/lib/libfontconfig.a `$fontconfig_config --libs --static | sed s@-lfontconfig@@`"
|
||||
LIBS="$LIBS `$fontconfig_config --variable=prefix`/lib/libfontconfig.a `$fontconfig_config --libs --static | sed s~-lfontconfig~~`"
|
||||
else
|
||||
LIBS="$LIBS `$fontconfig_config --libs --static | tr '\n\r' ' '`"
|
||||
fi
|
||||
@@ -1401,10 +1400,8 @@ make_cflags_and_ldflags() {
|
||||
# Lovely hackish, not?
|
||||
# Btw, this almost always comes from outside the configure, so it is
|
||||
# not something we can control.
|
||||
# Also make makedepend aware of compiler's built-in defines.
|
||||
if [ "$with_makedepend" != "0" ]; then
|
||||
cflags_makedep="`echo | $cxx_host -E -x c++ -dM - | sed 's@.define @-D@g;s@ .*@ @g;s@(.*)@@g' | tr -d '\r\n'`"
|
||||
cflags_makedep="$cflags_makedep `echo "$CFLAGS" | sed 's@ /@ -@g;s@-I[ ]*[^ ]*@@g'`"
|
||||
cflags_makedep="` echo "$CFLAGS" | sed 's~ /~ -~g;s~-I[ ]*[^ ]*~~g'`"
|
||||
else
|
||||
makedepend=""
|
||||
fi
|
||||
@@ -1620,30 +1617,6 @@ set_universal_binary_flags() {
|
||||
fi
|
||||
}
|
||||
|
||||
check_osx_sdk() {
|
||||
cat > tmp.osx.cpp << EOF
|
||||
#include <AvailabilityMacros.h>
|
||||
#if !defined(MAC_OS_X_VERSION_10_5)
|
||||
# error "Need newer SDK"
|
||||
#endif
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
execute="$cxx_host $CFLAGS -E tmp.osx.cpp -o - 2>&1"
|
||||
eval $execute > /dev/null
|
||||
ret=$?
|
||||
log 2 "executing $execute"
|
||||
log 2 " exit code $ret"
|
||||
rm -f tmp.osx.cpp
|
||||
if [ "$ret" != "0" ]; then
|
||||
log 1 "I couldn't detect any XCode >= 2.5 on your system"
|
||||
log 1 "please install/upgrade your XCode"
|
||||
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
check_direct_music() {
|
||||
echo "
|
||||
#include <windows.h>
|
||||
@@ -2432,7 +2405,7 @@ int main() {
|
||||
}
|
||||
EOF
|
||||
execute="$cxx_host $CFLAGS -c tmp.iconv.cpp -o tmp.iconv -DTESTING 2>&1"
|
||||
eval $execute > /dev/null
|
||||
eval $execute >&/dev/null
|
||||
ret=$?
|
||||
log 2 "executing $execute"
|
||||
log 2 " exit code $ret"
|
||||
@@ -2453,7 +2426,7 @@ int main() {
|
||||
}
|
||||
EOF
|
||||
execute="$cxx_host $CFLAGS tmp.iconv.cpp -o tmp.iconv -DTESTING 2>&1"
|
||||
eval $execute > /dev/null
|
||||
eval $execute >&/dev/null
|
||||
ret=$?
|
||||
log 2 "executing $execute"
|
||||
log 2 " exit code $ret"
|
||||
@@ -2564,104 +2537,104 @@ make_sed() {
|
||||
# use multiple OBJS_DIR, because all in-between
|
||||
# binaries are stored in there, and nowhere else.
|
||||
SRC_REPLACE="
|
||||
s@!!CC_HOST!!@$cc_host@g;
|
||||
s@!!CXX_HOST!!@$cxx_host@g;
|
||||
s@!!CC_BUILD!!@$cc_build@g;
|
||||
s@!!CXX_BUILD!!@$cxx_build@g;
|
||||
s@!!WINDRES!!@$windres@g;
|
||||
s@!!STRIP!!@$strip $strip_arg@g;
|
||||
s@!!LIPO!!@$lipo@g;
|
||||
s@!!CC_CFLAGS!!@$CC_CFLAGS@g;
|
||||
s@!!CFLAGS!!@$T_CFLAGS@g;
|
||||
s@!!CFLAGS_BUILD!!@$CFLAGS_BUILD@g;
|
||||
s@!!STRGEN_FLAGS!!@$strgen_flags@g;
|
||||
s@!!LIBS!!@$LIBS@g;
|
||||
s@!!LDFLAGS!!@$T_LDFLAGS@g;
|
||||
s@!!BIN_DIR!!@$BIN_DIR@g;
|
||||
s@!!ROOT_DIR!!@$ROOT_DIR@g;
|
||||
s@!!MEDIA_DIR!!@$MEDIA_DIR@g;
|
||||
s@!!SOURCE_LIST!!@$SOURCE_LIST@g;
|
||||
s@!!SRC_OBJS_DIR!!@$SRC_OBJS_DIR@g;
|
||||
s@!!LANG_OBJS_DIR!!@$LANG_OBJS_DIR@g;
|
||||
s@!!SRC_DIR!!@$SRC_DIR@g;
|
||||
s@!!SCRIPT_SRC_DIR!!@$SCRIPT_SRC_DIR@g;
|
||||
s@!!OSXAPP!!@$OSXAPP@g;
|
||||
s@!!LANG_DIR!!@$LANG_DIR@g;
|
||||
s@!!TTD!!@$TTD@g;
|
||||
s@!!BINARY_DIR!!@$prefix_dir/$binary_dir@g;
|
||||
s@!!DATA_DIR!!@$prefix_dir/$data_dir@g;
|
||||
s@!!DOC_DIR!!@$prefix_dir/$doc_dir@g;
|
||||
s@!!MAN_DIR!!@$prefix_dir/$man_dir@g;
|
||||
s@!!ICON_DIR!!@$prefix_dir/$icon_dir@g;
|
||||
s@!!ICON_THEME_DIR!!@$prefix_dir/$icon_theme_dir@g;
|
||||
s@!!PERSONAL_DIR!!@$personal_dir@g;
|
||||
s@!!SHARED_DIR!!@$shared_dir@g;
|
||||
s@!!INSTALL_DIR!!@$install_dir@g;
|
||||
s@!!BINARY_NAME!!@$binary_name@g;
|
||||
s@!!STRGEN!!@$STRGEN@g;
|
||||
s@!!ENDIAN_CHECK!!@$ENDIAN_CHECK@g;
|
||||
s@!!ENDIAN_FORCE!!@$endian@g;
|
||||
s@!!STAGE!!@$STAGE@g;
|
||||
s@!!MAKEDEPEND!!@$makedepend@g;
|
||||
s@!!CFLAGS_MAKEDEP!!@$cflags_makedep@g;
|
||||
s@!!SORT!!@$sort@g;
|
||||
s@!!CONFIG_CACHE_COMPILER!!@config.cache.compiler@g;
|
||||
s@!!CONFIG_CACHE_LINKER!!@config.cache.linker@g;
|
||||
s@!!CONFIG_CACHE_ENDIAN!!@config.cache.endian@g;
|
||||
s@!!CONFIG_CACHE_SOURCE!!@config.cache.source@g;
|
||||
s@!!CONFIG_CACHE_VERSION!!@config.cache.version@g;
|
||||
s@!!CONFIG_CACHE_SOURCE_LIST!!@config.cache.source.list@g;
|
||||
s@!!CONFIG_CACHE_PWD!!@config.cache.pwd@g;
|
||||
s@!!LANG_SUPPRESS!!@$lang_suppress@g;
|
||||
s@!!OBJS_C!!@$OBJS_C@g;
|
||||
s@!!OBJS_CPP!!@$OBJS_CPP@g;
|
||||
s@!!OBJS_MM!!@$OBJS_MM@g;
|
||||
s@!!OBJS_RC!!@$OBJS_RC@g;
|
||||
s@!!SRCS!!@$SRCS@g;
|
||||
s@!!OS!!@$os@g;
|
||||
s@!!CONFIGURE_FILES!!@$CONFIGURE_FILES@g;
|
||||
s@!!REVISION!!@$revision@g;
|
||||
s@!!AWK!!@$awk@g;
|
||||
s@!!GCC295!!@$gcc295@g;
|
||||
s@!!DISTCC!!@$distcc@g;
|
||||
s~!!CC_HOST!!~$cc_host~g;
|
||||
s~!!CXX_HOST!!~$cxx_host~g;
|
||||
s~!!CC_BUILD!!~$cc_build~g;
|
||||
s~!!CXX_BUILD!!~$cxx_build~g;
|
||||
s~!!WINDRES!!~$windres~g;
|
||||
s~!!STRIP!!~$strip $strip_arg~g;
|
||||
s~!!LIPO!!~$lipo~g;
|
||||
s~!!CC_CFLAGS!!~$CC_CFLAGS~g;
|
||||
s~!!CFLAGS!!~$T_CFLAGS~g;
|
||||
s~!!CFLAGS_BUILD!!~$CFLAGS_BUILD~g;
|
||||
s~!!STRGEN_FLAGS!!~$strgen_flags~g;
|
||||
s~!!LIBS!!~$LIBS~g;
|
||||
s~!!LDFLAGS!!~$T_LDFLAGS~g;
|
||||
s~!!BIN_DIR!!~$BIN_DIR~g;
|
||||
s~!!ROOT_DIR!!~$ROOT_DIR~g;
|
||||
s~!!MEDIA_DIR!!~$MEDIA_DIR~g;
|
||||
s~!!SOURCE_LIST!!~$SOURCE_LIST~g;
|
||||
s~!!SRC_OBJS_DIR!!~$SRC_OBJS_DIR~g;
|
||||
s~!!LANG_OBJS_DIR!!~$LANG_OBJS_DIR~g;
|
||||
s~!!SRC_DIR!!~$SRC_DIR~g;
|
||||
s~!!SCRIPT_SRC_DIR!!~$SCRIPT_SRC_DIR~g;
|
||||
s~!!OSXAPP!!~$OSXAPP~g;
|
||||
s~!!LANG_DIR!!~$LANG_DIR~g;
|
||||
s~!!TTD!!~$TTD~g;
|
||||
s~!!BINARY_DIR!!~$prefix_dir/$binary_dir~g;
|
||||
s~!!DATA_DIR!!~$prefix_dir/$data_dir~g;
|
||||
s~!!DOC_DIR!!~$prefix_dir/$doc_dir~g;
|
||||
s~!!MAN_DIR!!~$prefix_dir/$man_dir~g;
|
||||
s~!!ICON_DIR!!~$prefix_dir/$icon_dir~g;
|
||||
s~!!ICON_THEME_DIR!!~$prefix_dir/$icon_theme_dir~g;
|
||||
s~!!PERSONAL_DIR!!~$personal_dir~g;
|
||||
s~!!SHARED_DIR!!~$shared_dir~g;
|
||||
s~!!INSTALL_DIR!!~$install_dir~g;
|
||||
s~!!BINARY_NAME!!~$binary_name~g;
|
||||
s~!!STRGEN!!~$STRGEN~g;
|
||||
s~!!ENDIAN_CHECK!!~$ENDIAN_CHECK~g;
|
||||
s~!!ENDIAN_FORCE!!~$endian~g;
|
||||
s~!!STAGE!!~$STAGE~g;
|
||||
s~!!MAKEDEPEND!!~$makedepend~g;
|
||||
s~!!CFLAGS_MAKEDEP!!~$cflags_makedep~g;
|
||||
s~!!SORT!!~$sort~g;
|
||||
s~!!CONFIG_CACHE_COMPILER!!~config.cache.compiler~g;
|
||||
s~!!CONFIG_CACHE_LINKER!!~config.cache.linker~g;
|
||||
s~!!CONFIG_CACHE_ENDIAN!!~config.cache.endian~g;
|
||||
s~!!CONFIG_CACHE_SOURCE!!~config.cache.source~g;
|
||||
s~!!CONFIG_CACHE_VERSION!!~config.cache.version~g;
|
||||
s~!!CONFIG_CACHE_SOURCE_LIST!!~config.cache.source.list~g;
|
||||
s~!!CONFIG_CACHE_PWD!!~config.cache.pwd~g;
|
||||
s~!!LANG_SUPPRESS!!~$lang_suppress~g;
|
||||
s~!!OBJS_C!!~$OBJS_C~g;
|
||||
s~!!OBJS_CPP!!~$OBJS_CPP~g;
|
||||
s~!!OBJS_MM!!~$OBJS_MM~g;
|
||||
s~!!OBJS_RC!!~$OBJS_RC~g;
|
||||
s~!!SRCS!!~$SRCS~g;
|
||||
s~!!OS!!~$os~g;
|
||||
s~!!CONFIGURE_FILES!!~$CONFIGURE_FILES~g;
|
||||
s~!!REVISION!!~$revision~g;
|
||||
s~!!AWK!!~$awk~g;
|
||||
s~!!GCC295!!~$gcc295~g;
|
||||
s~!!DISTCC!!~$distcc~g;
|
||||
"
|
||||
|
||||
if [ "$icon_theme_dir" != "" ]; then
|
||||
SRC_REPLACE="$SRC_REPLACE
|
||||
s@!!ICON_THEME_DIR!!@$prefix_dir/$icon_theme_dir@g;
|
||||
s#!!ICON_THEME_DIR!!#$prefix_dir/$icon_theme_dir#g;
|
||||
"
|
||||
else
|
||||
SRC_REPLACE="$SRC_REPLACE
|
||||
s@!!ICON_THEME_DIR!!@@g;
|
||||
s#!!ICON_THEME_DIR!!##g;
|
||||
"
|
||||
fi
|
||||
|
||||
if [ "$man_dir" != "" ]; then
|
||||
SRC_REPLACE="$SRC_REPLACE
|
||||
s@!!MAN_DIR!!@$prefix_dir/$man_dir@g;
|
||||
s#!!MAN_DIR!!#$prefix_dir/$man_dir#g;
|
||||
"
|
||||
else
|
||||
SRC_REPLACE="$SRC_REPLACE
|
||||
s@!!MAN_DIR!!@@g;
|
||||
s#!!MAN_DIR!!##g;
|
||||
"
|
||||
fi
|
||||
|
||||
if [ "$menu_dir" != "" ]; then
|
||||
SRC_REPLACE="$SRC_REPLACE
|
||||
s@!!MENU_DIR!!@$prefix_dir/$menu_dir@g;
|
||||
s#!!MENU_DIR!!#$prefix_dir/$menu_dir#g;
|
||||
"
|
||||
else
|
||||
SRC_REPLACE="$SRC_REPLACE
|
||||
s@!!MENU_DIR!!@@g;
|
||||
s#!!MENU_DIR!!##g;
|
||||
"
|
||||
fi
|
||||
}
|
||||
|
||||
generate_menu_item() {
|
||||
MENU_REPLACE="
|
||||
s@!!TTD!!@$TTD@g;
|
||||
s@!!MENU_GROUP!!@$menu_group@g;
|
||||
s@!!MENU_NAME!!@$menu_name@g
|
||||
s~!!TTD!!~$TTD~g;
|
||||
s~!!MENU_GROUP!!~$menu_group~g;
|
||||
s~!!MENU_NAME!!~$menu_name~g
|
||||
"
|
||||
log 1 "Generating menu item..."
|
||||
mkdir -p media
|
||||
|
6
configure
vendored
6
configure
vendored
@@ -37,7 +37,7 @@ if [ "$1" = "--reconfig" ] || [ "$1" = "--reconfigure" ]; then
|
||||
exit 1
|
||||
fi
|
||||
# Make sure we don't lock config.cache
|
||||
cat config.cache | sed 's@\\ @\\\\ @g' > cache.tmp
|
||||
cat config.cache | sed 's~\\ ~\\\\ ~g' > cache.tmp
|
||||
sh cache.tmp
|
||||
rm -f cache.tmp
|
||||
exit $?
|
||||
@@ -59,7 +59,7 @@ STRGEN="strgen$EXE"
|
||||
ENDIAN_CHECK="endian_check$EXE"
|
||||
|
||||
if [ -z "$sort" ]; then
|
||||
PIPE_SORT="sed s@a@a@"
|
||||
PIPE_SORT="sed s~a~a~"
|
||||
else
|
||||
PIPE_SORT="$sort"
|
||||
fi
|
||||
@@ -125,7 +125,7 @@ SRCS="` echo \"$SRCS\" | $awk ' { ORS = " " } { print $0; }'`"
|
||||
|
||||
# In makefiles, we always use -u for sort
|
||||
if [ -z "$sort" ]; then
|
||||
sort="sed s@a@a@"
|
||||
sort="sed s~a~a~"
|
||||
else
|
||||
sort="$sort -u"
|
||||
fi
|
||||
|
@@ -86,17 +86,17 @@ elif [ -d "$ROOT_DIR/.git" ]; then
|
||||
fi
|
||||
HASH=`LC_ALL=C git rev-parse --verify HEAD 2>/dev/null`
|
||||
REV="g`echo $HASH | cut -c1-8`"
|
||||
BRANCH=`git branch|grep '[*]' | sed 's@\* @@;s@^master$@@'`
|
||||
REV_NR=`LC_ALL=C git log --pretty=format:%s "$SRC_DIR" | grep "^(svn r[0-9]*)" | head -n 1 | sed "s@.*(svn r\([0-9]*\)).*@\1@"`
|
||||
BRANCH=`git branch|grep '[*]' | sed 's~\* ~~;s~^master$~~'`
|
||||
REV_NR=`LC_ALL=C git log --pretty=format:%s "$SRC_DIR" | grep "^(svn r[0-9]*)" | head -n 1 | sed "s~.*(svn r\([0-9]*\)).*~\1~"`
|
||||
elif [ -d "$ROOT_DIR/.hg" ]; then
|
||||
# We are a hg checkout
|
||||
if [ -n "`hg status \"$SRC_DIR\" | grep -v '^?'`" ]; then
|
||||
MODIFIED="2"
|
||||
fi
|
||||
HASH=`LC_ALL=C hg parents --template="{node}"`
|
||||
HASH=`LC_ALL=C hg parents 2>/dev/null | head -n 1 | cut -d: -f3`
|
||||
REV="h`echo $HASH | cut -c1-8`"
|
||||
BRANCH=`hg branch | sed 's@^default$@@'`
|
||||
REV_NR=`LC_ALL=C hg log -r $HASH:0 -k "svn" -l 1 --template "{desc}\n" "$SRC_DIR" | grep "^(svn r[0-9]*)" | head -n 1 | sed "s@.*(svn r\([0-9]*\)).*@\1@"`
|
||||
BRANCH=`hg branch | sed 's~^default$~~'`
|
||||
REV_NR=`LC_ALL=C hg log -r $HASH:0 -k "svn" -l 1 --template "{desc}\n" "$SRC_DIR" | grep "^(svn r[0-9]*)" | head -n 1 | sed "s~.*(svn r\([0-9]*\)).*~\1~"`
|
||||
else
|
||||
# We don't know
|
||||
MODIFIED="1"
|
||||
|
@@ -11,15 +11,13 @@ by the number below on http://bugs.openttd.org.
|
||||
If the bug report is closed, it has been fixed, which then can be verified
|
||||
in the latest SVN version of /trunk.
|
||||
|
||||
Bugs for 0.7.1-RC1
|
||||
Bugs for 0.7.0-beta2
|
||||
------------------------------------------------------------------------
|
||||
URL: http://bugs.openttd.org
|
||||
|
||||
- 2769 No offer for buying bankrupt AIs
|
||||
- 2737 Self-crossing trains ignore "forbid 90 degree turn" setting
|
||||
- 2689 Capacity ordering of articulated vehicle in build vehicle window is wrong
|
||||
- 2616 Cloning creates vehicles with invalid subcargos
|
||||
- 2585 [OSX] OS' mouse pointer showing
|
||||
- 2484 [OSX] Cannot enter CJK characters
|
||||
- 2427 Vehicle owner gets paid for whole cargo feeder share
|
||||
- 1944 Road vehicles not picking empty drivethrough platform
|
||||
- 1762 Strange Autoreplace behaviour
|
||||
|
@@ -1,46 +1,17 @@
|
||||
openttd (0.7.1~RC3) unstable; urgency=low
|
||||
openttd (0.7~svn-1) UNRELEASED; urgency=low
|
||||
|
||||
* New upstream release.
|
||||
* Unreleased SVN version. Versioned to allow normal upgrades to released
|
||||
versions.
|
||||
|
||||
-- Matthijs Kooijman <matthijs@stdin.nl> Wed, 03 Jun 2008 15:34:56 +0200
|
||||
-- Matthijs Kooijman <matthijs@stdin.nl> Wed, 03 Sep 2008 18:56:04 +0200
|
||||
|
||||
openttd (0.7.1~RC2) unstable; urgency=low
|
||||
|
||||
* New upstream release.
|
||||
|
||||
-- Matthijs Kooijman <matthijs@stdin.nl> Thu, 21 Mar 2008 14:34:56 +0200
|
||||
|
||||
openttd (0.7.1~RC1) unstable; urgency=low
|
||||
|
||||
* New upstream release.
|
||||
|
||||
-- Matthijs Kooijman <matthijs@stdin.nl> Mon, 11 Mar 2008 17:34:56 +0200
|
||||
|
||||
openttd (0.7.0) unstable; urgency=low
|
||||
|
||||
* New upstream release.
|
||||
|
||||
-- Matthijs Kooijman <matthijs@stdin.nl> Wed, 01 Apr 2008 13:37:42 +0000
|
||||
|
||||
openttd (0.7.0~RC2) unstable; urgency=low
|
||||
|
||||
* New upstream release.
|
||||
|
||||
-- Matthijs Kooijman <matthijs@stdin.nl> Mon, 23 Mar 2008 00:42:00 +0200
|
||||
|
||||
openttd (0.7.0~RC1) unstable; urgency=low
|
||||
|
||||
* New upstream release.
|
||||
|
||||
-- Matthijs Kooijman <matthijs@stdin.nl> Mon, 16 Mar 2008 00:07:00 +0200
|
||||
|
||||
openttd (0.7.0~beta2) unstable; urgency=low
|
||||
openttd (0.7.0-beta2) unstable; urgency=low
|
||||
|
||||
* New upstream release.
|
||||
|
||||
-- Matthijs Kooijman <matthijs@stdin.nl> Tue, 10 Mar 2009 00:33:05 +0100
|
||||
|
||||
openttd (0.7.0~beta1) unstable; urgency=low
|
||||
openttd (0.7.0-beta1) unstable; urgency=low
|
||||
|
||||
* New upstream release.
|
||||
|
||||
|
@@ -1,11 +1,11 @@
|
||||
!define APPNAME "OpenTTD" ; Define application name
|
||||
!define APPVERSION "0.7.1-RC3" ; Define application version
|
||||
!define APPVERSIONINTERNAL "0.7.1.0" ; Define application version in X.X.X.X
|
||||
!define INSTALLERVERSION 61 ; NEED TO UPDATE THIS FOR EVERY RELEASE!!!
|
||||
!define APPVERSION "0.7.0" ; Define application version
|
||||
!define INSTALLERVERSION 55 ; NEED TO UPDATE THIS FOR EVERY RELEASE!!!
|
||||
!include ${VERSION_INCLUDE}
|
||||
|
||||
!define APPURLLINK "http://www.openttd.org"
|
||||
!define APPNAMEANDVERSION "${APPNAME} ${APPVERSION}"
|
||||
!define APPVERSIONINTERNAL "${APPVERSION}.0" ; Needs to be of the format X.X.X.X
|
||||
|
||||
!define MUI_ICON "..\..\..\media\openttd.ico"
|
||||
!define MUI_UNICON "..\..\..\media\openttd.ico"
|
||||
@@ -112,6 +112,13 @@ Section "!OpenTTD" Section1
|
||||
File ${PATH_ROOT}bin\data\*.grf
|
||||
File ${PATH_ROOT}bin\data\*.obg
|
||||
File ${PATH_ROOT}bin\data\opntitle.dat
|
||||
; Copy scenario files (don't choke if they don't exist)
|
||||
SetOutPath "$INSTDIR\scenario\"
|
||||
File /nonfatal ${PATH_ROOT}bin\scenario\*.scn
|
||||
|
||||
; Copy heightmap files (don't choke if they don't exist)
|
||||
SetOutPath "$INSTDIR\scenario\heightmap\"
|
||||
File /nonfatal ${PATH_ROOT}bin\scenario\heightmap\*.*
|
||||
|
||||
; Copy the scripts
|
||||
SetOutPath "$INSTDIR\scripts\"
|
||||
|
@@ -16,10 +16,10 @@ End Sub
|
||||
|
||||
Sub UpdateFile(modified, revision, version, cur_date, filename)
|
||||
FSO.CopyFile filename & ".in", filename
|
||||
FindReplaceInFile filename, "!!MODIFIED!!", modified
|
||||
FindReplaceInFile filename, "!!REVISION!!", revision
|
||||
FindReplaceInFile filename, "!!VERSION!!", version
|
||||
FindReplaceInFile filename, "!!DATE!!", cur_date
|
||||
FindReplaceInFile filename, "@@MODIFIED@@", modified
|
||||
FindReplaceInFile filename, "@@REVISION@@", revision
|
||||
FindReplaceInFile filename, "@@VERSION@@", version
|
||||
FindReplaceInFile filename, "@@DATE@@", cur_date
|
||||
End Sub
|
||||
|
||||
Sub UpdateFiles(version)
|
||||
@@ -32,7 +32,6 @@ Sub UpdateFiles(version)
|
||||
modified = Mid(version, InStrRev(version, Chr(9)) + 1)
|
||||
version = Mid(version, 1, InStr(version, Chr(9)) - 1)
|
||||
Else
|
||||
version = "0.7.1-RC3"
|
||||
revision = 0
|
||||
modified = 1
|
||||
End If
|
||||
@@ -279,7 +278,7 @@ Function CheckFile(filename)
|
||||
End Function
|
||||
|
||||
Dim version
|
||||
version = DetermineSVNVersion
|
||||
version = "0.7.0-beta2"
|
||||
If Not (IsCachedVersion(version) And CheckFile("../src/rev.cpp") And CheckFile("../src/ottdres.rc")) Then
|
||||
UpdateFiles version
|
||||
End If
|
||||
|
@@ -436,21 +436,6 @@
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\lang\luxembourgish.txt"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Generating luxembourgish language file"
|
||||
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang "$(InputPath)"
"
|
||||
AdditionalDependencies=""
|
||||
Outputs="..\bin\lang\luxembourgish.lng"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\lang\norwegian_bokmal.txt"
|
||||
>
|
||||
@@ -481,6 +466,21 @@
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\lang\origveh.txt"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Generating origveh language file"
|
||||
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang "$(InputPath)"
"
|
||||
AdditionalDependencies=""
|
||||
Outputs="..\bin\lang\origveh.lng"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\lang\piglatin.txt"
|
||||
>
|
||||
|
@@ -437,21 +437,6 @@
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\lang\luxembourgish.txt"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Generating luxembourgish language file"
|
||||
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang "$(InputPath)"
"
|
||||
AdditionalDependencies=""
|
||||
Outputs="..\bin\lang\luxembourgish.lng"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\lang\norwegian_bokmal.txt"
|
||||
>
|
||||
@@ -482,6 +467,21 @@
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\lang\origveh.txt"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"
|
||||
Description="Generating origveh language file"
|
||||
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang "$(InputPath)"
"
|
||||
AdditionalDependencies=""
|
||||
Outputs="..\bin\lang\origveh.lng"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\lang\piglatin.txt"
|
||||
>
|
||||
|
@@ -1971,10 +1971,6 @@
|
||||
RelativePath=".\..\src\ship_cmd.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\signs_cmd.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\station_cmd.cpp"
|
||||
>
|
||||
@@ -2007,18 +2003,10 @@
|
||||
RelativePath=".\..\src\unmovable_cmd.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\vehicle_cmd.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\water_cmd.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\waypoint_cmd.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Save/Load handlers"
|
||||
@@ -2659,10 +2647,6 @@
|
||||
RelativePath=".\..\src\ai\api\ai_sign.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\ai\api\ai_signlist.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\ai\api\ai_station.hpp"
|
||||
>
|
||||
@@ -2867,10 +2851,6 @@
|
||||
RelativePath=".\..\src\ai\api\ai_sign.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\ai\api\ai_signlist.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\ai\api\ai_station.cpp"
|
||||
>
|
||||
|
@@ -1968,10 +1968,6 @@
|
||||
RelativePath=".\..\src\ship_cmd.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\signs_cmd.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\station_cmd.cpp"
|
||||
>
|
||||
@@ -2004,18 +2000,10 @@
|
||||
RelativePath=".\..\src\unmovable_cmd.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\vehicle_cmd.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\water_cmd.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\waypoint_cmd.cpp"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Save/Load handlers"
|
||||
@@ -2656,10 +2644,6 @@
|
||||
RelativePath=".\..\src\ai\api\ai_sign.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\ai\api\ai_signlist.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\ai\api\ai_station.hpp"
|
||||
>
|
||||
@@ -2864,10 +2848,6 @@
|
||||
RelativePath=".\..\src\ai\api\ai_sign.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\ai\api\ai_signlist.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\ai\api\ai_station.cpp"
|
||||
>
|
||||
|
26
readme.txt
26
readme.txt
@@ -1,6 +1,6 @@
|
||||
OpenTTD README
|
||||
Last updated: 2009-04-01
|
||||
Release version: 0.7.0
|
||||
Last updated: 2009-03-10
|
||||
Release version: 0.7.0-beta2
|
||||
------------------------------------------------------------------------
|
||||
|
||||
|
||||
@@ -65,8 +65,6 @@ Please include the following information in your bug report:
|
||||
version without the bug and the first version including
|
||||
the bug. That way we can fix it quicker by looking at the
|
||||
changes made.
|
||||
- Attach crash.dmp, crash.log and crash.sav from the data
|
||||
directory if they exist.
|
||||
|
||||
2.2) Reporting Desyncs:
|
||||
---- ------------------
|
||||
@@ -253,11 +251,9 @@ features known from TTDPatch (http://www.ttdpatch.net/).
|
||||
|
||||
Several important non-standard controls:
|
||||
|
||||
* Ctrl makes many commands more powerful. For example Ctrl clicking on signals
|
||||
with the build signal tool changes their behaviour.
|
||||
* Use Ctrl to place semaphore signals
|
||||
* Ingame console. More information at
|
||||
http://wiki.openttd.org/index.php/Console
|
||||
* Right clicking shows tooltips
|
||||
|
||||
|
||||
5.1) Logging of potentially dangerous actions:
|
||||
@@ -295,9 +291,6 @@ OpenTTD in debug mode.
|
||||
The configuration file for OpenTTD (openttd.cfg) is in a simple Windows-like
|
||||
.INI format. It's mostly undocumented. Almost all settings can be changed
|
||||
ingame by using the 'Advanced Settings' window.
|
||||
When you can not find openttd.cfg you should look in the directories as
|
||||
described in section 4.2. If you do not have an openttd.cfg OpenTTD will
|
||||
create one after closing.
|
||||
|
||||
|
||||
7.0) Compiling:
|
||||
@@ -474,27 +467,26 @@ The OpenTTD team (in alphabetical order):
|
||||
Matthijs Kooijman (blathijs) - Pathfinder-guru, pool rework
|
||||
Victor Fischer (Celestar) - Programming everywhere you need him to
|
||||
Christoph Elsenhans (frosch) - General coding
|
||||
Loïc Guilloux (glx) - Windows Expert
|
||||
Loïc Guilloux (glx) - General coding
|
||||
Jaroslav Mazanec (KUDr) - YAPG (Yet Another Pathfinder God) ;)
|
||||
Jonathan Coome (Maedhros) - High priest of the NewGRF Temple
|
||||
Michael Lutz (michi_cc) - Path based signals
|
||||
Attila Bán (MiHaMiX) - WebTranslator, Nightlies, Wiki and bugtracker host
|
||||
Owen Rudge (orudge) - Forum host, OS/2 port
|
||||
Peter Nelson (peter1138) - Spiritual descendant from newGRF gods
|
||||
Remko Bijker (Rubidium) - Lead coder and way more
|
||||
Benedikt Brüggemeier (skidd13) - Bug fixer and code reworker
|
||||
Zdenek Sojka (SmatZ) - Bug finder and fixer
|
||||
Thijs Marinussen (Yexo) - AI Framework
|
||||
|
||||
Inactive Developers:
|
||||
Tamás Faragó (Darkvater) - Ex-Lead coder
|
||||
Jaroslav Mazanec (KUDr) - YAPG (Yet Another Pathfinder God) ;)
|
||||
Jonathan Coome (Maedhros) - High priest of the NewGRF Temple
|
||||
Attila Bán (MiHaMiX) - WebTranslator, Nightlies, Wiki and bugtracker host
|
||||
Christoph Mallon (Tron) - Programmer, code correctness police
|
||||
|
||||
Retired Developers:
|
||||
Ludvig Strigeus (ludde) - OpenTTD author, main coder (0.1 - 0.3.3)
|
||||
Serge Paquet (vurlix) - Assistant project manager, coder (0.1 - 0.3.3)
|
||||
Dominik Scherer (dominik81) - Lead programmer, GUI expert (0.3.0 - 0.3.6)
|
||||
Benedikt Brüggemeier (skidd13) - Bug fixer and code reworker
|
||||
Patric Stout (TrueLight) - Programmer, webhoster (0.3 - pre0.7)
|
||||
Patric Stout (TrueLight) - Programmer, webhoster (0.3 - pre0.6)
|
||||
|
||||
Thanks to:
|
||||
Josef Drexler - For his great work on TTDPatch.
|
||||
|
@@ -441,7 +441,6 @@ rail_cmd.cpp
|
||||
road_cmd.cpp
|
||||
roadveh_cmd.cpp
|
||||
ship_cmd.cpp
|
||||
signs_cmd.cpp
|
||||
station_cmd.cpp
|
||||
terraform_cmd.cpp
|
||||
timetable_cmd.cpp
|
||||
@@ -450,9 +449,7 @@ train_cmd.cpp
|
||||
tree_cmd.cpp
|
||||
tunnelbridge_cmd.cpp
|
||||
unmovable_cmd.cpp
|
||||
vehicle_cmd.cpp
|
||||
water_cmd.cpp
|
||||
waypoint_cmd.cpp
|
||||
|
||||
# Save/Load handlers
|
||||
saveload/afterload.cpp
|
||||
@@ -620,7 +617,6 @@ ai/api/ai_rail.hpp
|
||||
ai/api/ai_railtypelist.hpp
|
||||
ai/api/ai_road.hpp
|
||||
ai/api/ai_sign.hpp
|
||||
ai/api/ai_signlist.hpp
|
||||
ai/api/ai_station.hpp
|
||||
ai/api/ai_stationlist.hpp
|
||||
ai/api/ai_subsidy.hpp
|
||||
@@ -673,7 +669,6 @@ ai/api/ai_rail.cpp
|
||||
ai/api/ai_railtypelist.cpp
|
||||
ai/api/ai_road.cpp
|
||||
ai/api/ai_sign.cpp
|
||||
ai/api/ai_signlist.cpp
|
||||
ai/api/ai_station.cpp
|
||||
ai/api/ai_stationlist.cpp
|
||||
ai/api/ai_subsidy.cpp
|
||||
|
1
src/3rdparty/squirrel/include/squirrel.h
vendored
1
src/3rdparty/squirrel/include/squirrel.h
vendored
@@ -275,7 +275,6 @@ typedef struct tagSQRegFunction{
|
||||
}SQRegFunction;
|
||||
|
||||
/*vm*/
|
||||
SQUIRREL_API bool sq_can_suspend(HSQUIRRELVM v);
|
||||
SQUIRREL_API HSQUIRRELVM sq_open(SQInteger initialstacksize);
|
||||
SQUIRREL_API HSQUIRRELVM sq_newthread(HSQUIRRELVM friendvm, SQInteger initialstacksize);
|
||||
SQUIRREL_API void sq_seterrorhandler(HSQUIRRELVM v);
|
||||
|
5
src/3rdparty/squirrel/squirrel/sqapi.cpp
vendored
5
src/3rdparty/squirrel/squirrel/sqapi.cpp
vendored
@@ -90,11 +90,6 @@ SQInteger sq_getvmstate(HSQUIRRELVM v)
|
||||
}
|
||||
}
|
||||
|
||||
bool sq_can_suspend(HSQUIRRELVM v)
|
||||
{
|
||||
return v->_nnativecalls <= 2;
|
||||
}
|
||||
|
||||
void sq_seterrorhandler(HSQUIRRELVM v)
|
||||
{
|
||||
SQObject o = stack_get(v, -1);
|
||||
|
16
src/3rdparty/squirrel/squirrel/sqvm.cpp
vendored
16
src/3rdparty/squirrel/squirrel/sqvm.cpp
vendored
@@ -83,7 +83,7 @@ SQVM::SQVM(SQSharedState *ss)
|
||||
_suspended = SQFalse;
|
||||
_suspended_target=-1;
|
||||
_suspended_root = SQFalse;
|
||||
_suspended_traps=0;
|
||||
_suspended_traps=-1;
|
||||
_foreignptr=NULL;
|
||||
_nnativecalls=0;
|
||||
_lasterror = _null_;
|
||||
@@ -688,7 +688,6 @@ bool SQVM::Execute(SQObjectPtr &closure, SQInteger target, SQInteger nargs, SQIn
|
||||
_suspended = SQFalse;
|
||||
break;
|
||||
case ET_RESUME_OPENTTD:
|
||||
traps = _suspended_traps;
|
||||
_suspended = SQFalse;
|
||||
break;
|
||||
}
|
||||
@@ -699,7 +698,7 @@ exception_restore:
|
||||
for(;;)
|
||||
{
|
||||
DecreaseOps(1);
|
||||
if (ShouldSuspend()) { _suspended = SQTrue; _suspended_traps = traps; return true; }
|
||||
if (ShouldSuspend()) { _suspended = SQTrue; return true; }
|
||||
|
||||
const SQInstruction &_i_ = *ci->_ip++;
|
||||
//dumpstack(_stackbase);
|
||||
@@ -749,16 +748,7 @@ common_call:
|
||||
case OT_NATIVECLOSURE: {
|
||||
bool suspend;
|
||||
_suspended_target = ct_target;
|
||||
try {
|
||||
_GUARD(CallNative(_nativeclosure(clo), arg3, ct_stackbase, clo,suspend));
|
||||
} catch (...) {
|
||||
_suspended = SQTrue;
|
||||
_suspended_target = ct_target;
|
||||
_suspended_root = ci->_root;
|
||||
_suspended_traps = traps;
|
||||
_suspend_varargs = ci->_vargs;
|
||||
throw;
|
||||
}
|
||||
_GUARD(CallNative(_nativeclosure(clo), arg3, ct_stackbase, clo,suspend));
|
||||
if(suspend){
|
||||
_suspended = SQTrue;
|
||||
_suspended_target = ct_target;
|
||||
|
@@ -103,11 +103,6 @@ struct AIListWindow : public Window {
|
||||
sprintf(buf, "%d", selected_info->GetVersion());
|
||||
DoDrawStringTruncated(buf, x + 5, y, TC_BLACK, this->width - x - 8);
|
||||
y += 13;
|
||||
if (selected_info->GetURL() != NULL) {
|
||||
SetDParamStr(0, selected_info->GetURL());
|
||||
DrawString(4, y, STR_AI_URL, TC_BLACK);
|
||||
y += 13;
|
||||
}
|
||||
SetDParamStr(0, selected_info->GetDescription());
|
||||
DrawStringMultiLine(4, y, STR_JUST_RAW_STRING, this->width - 8, this->widget[AIL_WIDGET_INFO_BG].bottom - y);
|
||||
}
|
||||
@@ -200,12 +195,12 @@ static const Widget _ai_list_widgets[] = {
|
||||
};
|
||||
|
||||
/* Window definition for the ai list window. */
|
||||
static const WindowDesc _ai_list_desc(
|
||||
static const WindowDesc _ai_list_desc = {
|
||||
WDP_CENTER, WDP_CENTER, 200, 234, 200, 234,
|
||||
WC_AI_LIST, WC_NONE,
|
||||
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE,
|
||||
_ai_list_widgets
|
||||
);
|
||||
};
|
||||
|
||||
void ShowAIListWindow(CompanyID slot)
|
||||
{
|
||||
@@ -382,12 +377,12 @@ static const Widget _ai_settings_widgets[] = {
|
||||
};
|
||||
|
||||
/* Window definition for the AI settings window. */
|
||||
static const WindowDesc _ai_settings_desc(
|
||||
static const WindowDesc _ai_settings_desc = {
|
||||
WDP_CENTER, WDP_CENTER, 200, 208, 500, 208,
|
||||
WC_AI_SETTINGS, WC_NONE,
|
||||
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE,
|
||||
_ai_settings_widgets
|
||||
);
|
||||
};
|
||||
|
||||
void ShowAISettingsWindow(CompanyID slot)
|
||||
{
|
||||
@@ -410,12 +405,12 @@ static const Widget _ai_config_widgets[] = {
|
||||
};
|
||||
|
||||
/* Window definition for the configure AI window. */
|
||||
static const WindowDesc _ai_config_desc(
|
||||
static const WindowDesc _ai_config_desc = {
|
||||
WDP_CENTER, WDP_CENTER, 300, 172, 300, 172,
|
||||
WC_GAME_OPTIONS, WC_NONE,
|
||||
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
|
||||
_ai_config_widgets
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Window to configure which AIs will start.
|
||||
@@ -580,8 +575,6 @@ struct AIDebugWindow : public Window {
|
||||
|
||||
static CompanyID ai_debug_company;
|
||||
int redraw_timer;
|
||||
int last_vscroll_pos;
|
||||
bool autoscroll;
|
||||
|
||||
AIDebugWindow(const WindowDesc *desc, WindowNumber number) : Window(desc, number)
|
||||
{
|
||||
@@ -594,8 +587,6 @@ struct AIDebugWindow : public Window {
|
||||
this->vscroll.cap = 14;
|
||||
this->vscroll.pos = 0;
|
||||
this->resize.step_height = 12;
|
||||
this->last_vscroll_pos = 0;
|
||||
this->autoscroll = true;
|
||||
|
||||
if (ai_debug_company != INVALID_COMPANY) this->LowerWidget(ai_debug_company + AID_WIDGET_COMPANY_BUTTON_START);
|
||||
|
||||
@@ -673,35 +664,13 @@ struct AIDebugWindow : public Window {
|
||||
AILog::LogData *log = (AILog::LogData *)AIObject::GetLogPointer();
|
||||
_current_company = old_company;
|
||||
|
||||
int scroll_count = (log == NULL) ? 0 : log->used;
|
||||
if (this->vscroll.count != scroll_count) {
|
||||
SetVScrollCount(this, scroll_count);
|
||||
|
||||
/* We need a repaint */
|
||||
this->InvalidateWidget(AID_WIDGET_SCROLLBAR);
|
||||
}
|
||||
|
||||
SetVScrollCount(this, (log == NULL) ? 0 : log->used);
|
||||
this->InvalidateWidget(AID_WIDGET_SCROLLBAR);
|
||||
if (log == NULL) return;
|
||||
|
||||
/* Detect when the user scrolls the window. Enable autoscroll when the
|
||||
* bottom-most line becomes visible. */
|
||||
if (this->last_vscroll_pos != this->vscroll.pos) {
|
||||
this->autoscroll = this->vscroll.pos >= log->used - this->vscroll.cap;
|
||||
}
|
||||
if (this->autoscroll) {
|
||||
int scroll_pos = max(0, log->used - this->vscroll.cap);
|
||||
if (scroll_pos != this->vscroll.pos) {
|
||||
this->vscroll.pos = scroll_pos;
|
||||
|
||||
/* We need a repaint */
|
||||
this->InvalidateWidget(AID_WIDGET_SCROLLBAR);
|
||||
}
|
||||
}
|
||||
last_vscroll_pos = this->vscroll.pos;
|
||||
|
||||
int y = 6;
|
||||
for (int i = this->vscroll.pos; i < (this->vscroll.cap + this->vscroll.pos) && i < log->used; i++) {
|
||||
uint pos = (i + log->pos + 1 - log->used + log->count) % log->count;
|
||||
for (int i = this->vscroll.pos; i < (this->vscroll.cap + this->vscroll.pos); i++) {
|
||||
uint pos = (log->count + log->pos - i) % log->count;
|
||||
if (log->lines[pos] == NULL) break;
|
||||
|
||||
TextColour colour;
|
||||
@@ -719,23 +688,16 @@ struct AIDebugWindow : public Window {
|
||||
}
|
||||
}
|
||||
|
||||
void ChangeToAI(CompanyID show_ai)
|
||||
{
|
||||
this->RaiseWidget(ai_debug_company + AID_WIDGET_COMPANY_BUTTON_START);
|
||||
ai_debug_company = show_ai;
|
||||
this->LowerWidget(ai_debug_company + AID_WIDGET_COMPANY_BUTTON_START);
|
||||
this->autoscroll = true;
|
||||
this->last_vscroll_pos = this->vscroll.pos;
|
||||
this->SetDirty();
|
||||
}
|
||||
|
||||
virtual void OnClick(Point pt, int widget)
|
||||
{
|
||||
/* Check which button is clicked */
|
||||
if (IsInsideMM(widget, AID_WIDGET_COMPANY_BUTTON_START, AID_WIDGET_COMPANY_BUTTON_END + 1)) {
|
||||
/* Is it no on disable? */
|
||||
if (!this->IsWidgetDisabled(widget)) {
|
||||
ChangeToAI((CompanyID)(widget - AID_WIDGET_COMPANY_BUTTON_START));
|
||||
this->RaiseWidget(ai_debug_company + AID_WIDGET_COMPANY_BUTTON_START);
|
||||
ai_debug_company = (CompanyID)(widget - AID_WIDGET_COMPANY_BUTTON_START);
|
||||
this->LowerWidget(ai_debug_company + AID_WIDGET_COMPANY_BUTTON_START);
|
||||
this->SetDirty();
|
||||
}
|
||||
}
|
||||
if (widget == AID_WIDGET_RELOAD_TOGGLE && !this->IsWidgetDisabled(widget)) {
|
||||
@@ -759,7 +721,6 @@ struct AIDebugWindow : public Window {
|
||||
virtual void OnResize(Point new_size, Point delta)
|
||||
{
|
||||
this->vscroll.cap += delta.y / (int)this->resize.step_height;
|
||||
SetVScrollCount(this, this->vscroll.count); // vscroll.pos should be in a valid range
|
||||
}
|
||||
};
|
||||
|
||||
@@ -802,19 +763,17 @@ static const Widget _ai_debug_widgets[] = {
|
||||
{ WIDGETS_END},
|
||||
};
|
||||
|
||||
static const WindowDesc _ai_debug_desc(
|
||||
static const WindowDesc _ai_debug_desc = {
|
||||
WDP_AUTO, WDP_AUTO, 299, 241, 299, 241,
|
||||
WC_AI_DEBUG, WC_NONE,
|
||||
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE,
|
||||
_ai_debug_widgets
|
||||
);
|
||||
};
|
||||
|
||||
void ShowAIDebugWindow(CompanyID show_company)
|
||||
void ShowAIDebugWindow()
|
||||
{
|
||||
if (!_networking || _network_server) {
|
||||
AIDebugWindow *w = (AIDebugWindow *)BringWindowToFrontById(WC_AI_DEBUG, 0);
|
||||
if (w == NULL) w = new AIDebugWindow(&_ai_debug_desc, 0);
|
||||
if (show_company != INVALID_COMPANY) w->ChangeToAI(show_company);
|
||||
AllocateWindowDescFront<AIDebugWindow>(&_ai_debug_desc, 0);
|
||||
} else {
|
||||
ShowErrorMessage(INVALID_STRING_ID, STR_AI_DEBUG_SERVER_ONLY, 0, 0);
|
||||
}
|
||||
|
@@ -5,7 +5,7 @@
|
||||
#ifndef AI_GUI_HPP
|
||||
#define AI_GUI_HPP
|
||||
|
||||
void ShowAIDebugWindow(CompanyID show_company = INVALID_COMPANY);
|
||||
void ShowAIDebugWindow();
|
||||
void ShowAIConfigWindow();
|
||||
|
||||
#endif /* AI_GUI_HPP */
|
||||
|
@@ -36,7 +36,6 @@ AIFileInfo::~AIFileInfo()
|
||||
free((void *)this->description);
|
||||
free((void *)this->date);
|
||||
free((void *)this->instance_name);
|
||||
free((void *)this->url);
|
||||
free(this->main_script);
|
||||
free(this->SQ_instance);
|
||||
}
|
||||
@@ -99,11 +98,6 @@ bool AIFileInfo::CheckMethod(const char *name) const
|
||||
if (!info->engine->CallIntegerMethod(*info->SQ_instance, "GetVersion", &info->version)) return SQ_ERROR;
|
||||
if (!info->engine->CallStringMethodStrdup(*info->SQ_instance, "CreateInstance", &info->instance_name)) return SQ_ERROR;
|
||||
|
||||
/* The GetURL function is optional. */
|
||||
if (info->engine->MethodExists(*info->SQ_instance, "GetURL")) {
|
||||
if (!info->engine->CallStringMethodStrdup(*info->SQ_instance, "GetURL", &info->url)) return SQ_ERROR;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -131,12 +125,6 @@ bool AIFileInfo::CheckMethod(const char *name) const
|
||||
} else {
|
||||
info->min_loadable_version = info->GetVersion();
|
||||
}
|
||||
/* When there is an UseAsRandomAI function, call it. */
|
||||
if (info->engine->MethodExists(*info->SQ_instance, "UseAsRandomAI")) {
|
||||
if (!info->engine->CallBoolMethod(*info->SQ_instance, "UseAsRandomAI", &info->use_as_random)) return SQ_ERROR;
|
||||
} else {
|
||||
info->use_as_random = true;
|
||||
}
|
||||
|
||||
/* Remove the link to the real instance, else it might get deleted by RegisterAI() */
|
||||
sq_setinstanceup(vm, 2, NULL);
|
||||
|
@@ -41,7 +41,7 @@ public:
|
||||
friend class AIInfo;
|
||||
friend class AILibrary;
|
||||
|
||||
AIFileInfo() : SQ_instance(NULL), main_script(NULL), author(NULL), name(NULL), short_name(NULL), description(NULL), date(NULL), instance_name(NULL), url(NULL) {};
|
||||
AIFileInfo() : SQ_instance(NULL), main_script(NULL), author(NULL), name(NULL), short_name(NULL), description(NULL), date(NULL), instance_name(NULL) {};
|
||||
~AIFileInfo();
|
||||
|
||||
/**
|
||||
@@ -84,11 +84,6 @@ public:
|
||||
*/
|
||||
const char *GetInstanceName() const { return this->instance_name; }
|
||||
|
||||
/**
|
||||
* Get the website for this script.
|
||||
*/
|
||||
const char *GetURL() const { return this->url; }
|
||||
|
||||
/**
|
||||
* Get the filename of the main.nut script.
|
||||
*/
|
||||
@@ -116,7 +111,6 @@ private:
|
||||
const char *date;
|
||||
const char *instance_name;
|
||||
int version;
|
||||
const char *url;
|
||||
};
|
||||
|
||||
class AIInfo : public AIFileInfo {
|
||||
@@ -161,15 +155,9 @@ public:
|
||||
*/
|
||||
int GetSettingDefaultValue(const char *name) const;
|
||||
|
||||
/**
|
||||
* Use this AI as a random AI.
|
||||
*/
|
||||
bool UseAsRandomAI() const { return this->use_as_random; }
|
||||
|
||||
private:
|
||||
AIConfigItemList config_list;
|
||||
int min_loadable_version;
|
||||
bool use_as_random;
|
||||
};
|
||||
|
||||
class AILibrary : public AIFileInfo {
|
||||
|
@@ -31,7 +31,7 @@ class DummyAI extends AIController {
|
||||
function Start() { \n\
|
||||
AILog.Error(\"No suitable AI found to load.\"); \n\
|
||||
AILog.Error(\"This AI is a dummy AI and won't do anything.\"); \n\
|
||||
AILog.Error(\"You can download several AIs via the 'Online Content' system.\"); \n\
|
||||
AILog.Error(\"Please add one or several AIs in your ai/ directory.\"); \n\
|
||||
} \n\
|
||||
} \n\
|
||||
");
|
||||
|
@@ -7,7 +7,6 @@
|
||||
#include "../settings_type.h"
|
||||
#include "../vehicle_base.h"
|
||||
#include "../saveload/saveload.h"
|
||||
#include "../gui.h"
|
||||
#include "table/strings.h"
|
||||
|
||||
#include <squirrel.h>
|
||||
@@ -19,10 +18,8 @@
|
||||
#define DEFINE_SCRIPT_FILES
|
||||
|
||||
#include "ai_info.hpp"
|
||||
#include "ai_config.hpp"
|
||||
#include "ai_storage.hpp"
|
||||
#include "ai_instance.hpp"
|
||||
#include "ai_gui.hpp"
|
||||
|
||||
/* Convert all AI related classes to Squirrel data.
|
||||
* Note: this line a marker in squirrel_export.sh. Do not change! */
|
||||
@@ -60,7 +57,6 @@
|
||||
#include "api/ai_railtypelist.hpp.sq"
|
||||
#include "api/ai_road.hpp.sq"
|
||||
#include "api/ai_sign.hpp.sq"
|
||||
#include "api/ai_signlist.hpp.sq"
|
||||
#include "api/ai_station.hpp.sq"
|
||||
#include "api/ai_stationlist.hpp.sq"
|
||||
#include "api/ai_subsidy.hpp.sq"
|
||||
@@ -213,7 +209,6 @@ void AIInstance::RegisterAPI()
|
||||
SQAIRailTypeList_Register(this->engine);
|
||||
SQAIRoad_Register(this->engine);
|
||||
SQAISign_Register(this->engine);
|
||||
SQAISignList_Register(this->engine);
|
||||
SQAIStation_Register(this->engine);
|
||||
SQAIStationList_Register(this->engine);
|
||||
SQAIStationList_Vehicle_Register(this->engine);
|
||||
@@ -256,18 +251,6 @@ void AIInstance::Died()
|
||||
delete this->engine;
|
||||
this->instance = NULL;
|
||||
this->engine = NULL;
|
||||
|
||||
ShowAIDebugWindow(_current_company);
|
||||
|
||||
const AIInfo *info = AIConfig::GetConfig(_current_company)->GetInfo();
|
||||
if (info != NULL) {
|
||||
ShowErrorMessage(INVALID_STRING_ID, STR_AI_PLEASE_REPORT_CRASH, 0, 0);
|
||||
|
||||
if (info->GetURL() != NULL) {
|
||||
AILog::Info("Please report the error to the following URL:");
|
||||
AILog::Info(info->GetURL());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AIInstance::GameLoop()
|
||||
@@ -304,17 +287,9 @@ void AIInstance::GameLoop()
|
||||
AIObject::SetAllowDoCommand(false);
|
||||
/* Run the constructor if it exists. Don't allow any DoCommands in it. */
|
||||
if (this->engine->MethodExists(*this->instance, "constructor")) {
|
||||
if (!this->engine->CallMethod(*this->instance, "constructor", 100000) || this->engine->IsSuspended()) {
|
||||
if (this->engine->IsSuspended()) AILog::Error("This AI took too long to initialize. AI is not started.");
|
||||
this->Died();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!this->CallLoad() || this->engine->IsSuspended()) {
|
||||
if (this->engine->IsSuspended()) AILog::Error("This AI took too long in the Load function. AI is not started.");
|
||||
this->Died();
|
||||
return;
|
||||
if (!this->engine->CallMethod(*this->instance, "constructor")) { this->Died(); return; }
|
||||
}
|
||||
if (!this->CallLoad()) { this->Died(); return; }
|
||||
AIObject::SetAllowDoCommand(true);
|
||||
/* Start the AI by calling Start() */
|
||||
if (!this->engine->CallMethod(*this->instance, "Start", _settings_game.ai.ai_max_opcode_till_suspend) || !this->engine->IsSuspended()) this->Died();
|
||||
@@ -413,7 +388,7 @@ enum {
|
||||
/* static */ bool AIInstance::SaveObject(HSQUIRRELVM vm, SQInteger index, int max_depth, bool test)
|
||||
{
|
||||
if (max_depth == 0) {
|
||||
AILog::Error("Savedata can only be nested to 25 deep. No data saved.");
|
||||
AILog::Error("Savedata can only be nested to 5 deep. No data saved.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -524,7 +499,7 @@ enum {
|
||||
}
|
||||
|
||||
default:
|
||||
AILog::Error("You tried to save an unsupported type. No data saved.");
|
||||
AILog::Error("You tried to save unsupported type. No data saved.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -710,7 +685,7 @@ bool AIInstance::CallLoad()
|
||||
|
||||
/* Call the AI load function. sq_call removes the arguments (but not the
|
||||
* function pointer) from the stack. */
|
||||
if (SQ_FAILED(sq_call(vm, 3, SQFalse, SQFalse, 100000))) return false;
|
||||
if (SQ_FAILED(sq_call(vm, 3, SQFalse, SQFalse))) return false;
|
||||
|
||||
/* Pop 1) The version, 2) the savegame data, 3) the object instance, 4) the function pointer. */
|
||||
sq_pop(vm, 4);
|
||||
|
@@ -30,7 +30,6 @@ private:
|
||||
|
||||
class AIInstance {
|
||||
public:
|
||||
friend class AIObject;
|
||||
AIInstance(class AIInfo *info);
|
||||
~AIInstance();
|
||||
|
||||
|
@@ -20,7 +20,7 @@
|
||||
#include "ai_scanner.hpp"
|
||||
#include "api/ai_controller.hpp"
|
||||
|
||||
void AIScanner::ScanDir(const char *dirname, bool library_scan)
|
||||
void AIScanner::ScanDir(const char *dirname, bool library_scan, bool library_recursive)
|
||||
{
|
||||
extern bool FiosIsValidFile(const char *path, const struct dirent *ent, struct stat *sb);
|
||||
extern bool FiosIsHiddenFile(const struct dirent *ent);
|
||||
@@ -48,10 +48,19 @@ void AIScanner::ScanDir(const char *dirname, bool library_scan)
|
||||
ttd_strlcpy(temp_script, dirname, sizeof(temp_script));
|
||||
ttd_strlcat(temp_script, d_name, sizeof(temp_script));
|
||||
|
||||
if (S_ISREG(sb.st_mode)) {
|
||||
if (S_ISDIR(sb.st_mode)) {
|
||||
/* Libraries are always in a subdirectory of their category, so scan those */
|
||||
if (library_scan && !library_recursive) {
|
||||
ttd_strlcat(temp_script, PATHSEP, sizeof(temp_script));
|
||||
ScanDir(temp_script, library_scan, true);
|
||||
continue;
|
||||
}
|
||||
} else if (S_ISREG(sb.st_mode)) {
|
||||
/* Only .tar files are allowed */
|
||||
char *ext = strrchr(d_name, '.');
|
||||
if (ext == NULL || strcasecmp(ext, ".tar") != 0) continue;
|
||||
/* .tar files are only allowed in the root of the library dir */
|
||||
if (library_recursive) continue;
|
||||
|
||||
/* We always expect a directory in the TAR */
|
||||
const char *first_dir = FioTarFirstDir(temp_script);
|
||||
@@ -60,7 +69,7 @@ void AIScanner::ScanDir(const char *dirname, bool library_scan)
|
||||
ttd_strlcat(temp_script, PATHSEP, sizeof(temp_script));
|
||||
ttd_strlcat(temp_script, first_dir, sizeof(temp_script));
|
||||
FioTarAddLink(temp_script, first_dir);
|
||||
} else if (!S_ISDIR(sb.st_mode)) {
|
||||
} else {
|
||||
/* Skip any other type of file */
|
||||
continue;
|
||||
}
|
||||
@@ -79,7 +88,7 @@ void AIScanner::ScanDir(const char *dirname, bool library_scan)
|
||||
if (!FioCheckFileExists(info_script, AI_DIR) || !FioCheckFileExists(main_script, AI_DIR)) continue;
|
||||
|
||||
DEBUG(ai, 6, "Loading AI at location '%s'", main_script);
|
||||
/* We don't care if one of the other scripts failed to load. */
|
||||
/* We don't care if one of the other scripst failed to load. */
|
||||
this->engine->ResetCrashed();
|
||||
this->engine->LoadScript(info_script);
|
||||
} else {
|
||||
@@ -153,7 +162,7 @@ AIScanner::AIScanner() :
|
||||
|
||||
/* Create the dummy AI */
|
||||
this->engine->ResetCrashed();
|
||||
strecpy(this->main_script, "%_dummy", lastof(this->main_script));
|
||||
strcpy(this->main_script, "%_dummy");
|
||||
extern void AI_CreateAIInfoDummy(HSQUIRRELVM vm);
|
||||
AI_CreateAIInfoDummy(this->engine->GetVM());
|
||||
}
|
||||
@@ -345,31 +354,20 @@ void AIScanner::RegisterAI(AIInfo *info)
|
||||
|
||||
AIInfo *AIScanner::SelectRandomAI()
|
||||
{
|
||||
uint num_random_ais = 0;
|
||||
for (AIInfoList::iterator it = this->info_single_list.begin(); it != this->info_single_list.end(); it++) {
|
||||
if (it->second->UseAsRandomAI()) num_random_ais++;
|
||||
}
|
||||
|
||||
if (num_random_ais == 0) {
|
||||
if (this->info_single_list.size() == 0) {
|
||||
DEBUG(ai, 0, "No suitable AI found, loading 'dummy' AI.");
|
||||
return this->info_dummy;
|
||||
}
|
||||
|
||||
/* Find a random AI */
|
||||
uint pos;
|
||||
if (_networking) {
|
||||
pos = InteractiveRandomRange(num_random_ais);
|
||||
} else {
|
||||
pos = RandomRange(num_random_ais);
|
||||
}
|
||||
if (_networking) pos = InteractiveRandomRange((uint16)this->info_single_list.size());
|
||||
else pos = RandomRange((uint16)this->info_single_list.size());
|
||||
|
||||
/* Find the Nth item from the array */
|
||||
AIInfoList::iterator it = this->info_single_list.begin();
|
||||
while (!it->second->UseAsRandomAI()) it++;
|
||||
for (; pos > 0; pos--) {
|
||||
it++;
|
||||
while (!it->second->UseAsRandomAI()) it++;
|
||||
}
|
||||
for (; pos > 0; pos--) it++;
|
||||
AIInfoList::iterator first_it = it;
|
||||
return (*it).second;
|
||||
}
|
||||
|
||||
@@ -565,7 +563,7 @@ bool AIScanner::HasAI(const ContentInfo *ci, bool md5sum)
|
||||
* @param md5sum whether to check the MD5 checksum
|
||||
* @return true iff we have an AI (library) matching.
|
||||
*/
|
||||
/* static */ bool AI::HasAI(const ContentInfo *ci, bool md5sum)
|
||||
/*static */ bool AI::HasAI(const ContentInfo *ci, bool md5sum)
|
||||
{
|
||||
return AI::ai_scanner->HasAI(ci, md5sum);
|
||||
}
|
||||
|
@@ -56,7 +56,7 @@ public:
|
||||
const AIInfoList *GetUniqueAIInfoList() { return &this->info_single_list; }
|
||||
|
||||
/**
|
||||
* Get the engine of the main squirrel handler (it indexes all available scripts).
|
||||
* Get the engine of the main squirrel handler (it indexes all avialable squirrels).
|
||||
*/
|
||||
class Squirrel *GetEngine() { return this->engine; }
|
||||
|
||||
@@ -88,7 +88,7 @@ private:
|
||||
* For library-scan, if a library is found, AILibrary is created, and the
|
||||
* library is registered to the central system.
|
||||
*/
|
||||
void ScanDir(const char *dirname, bool library_dir);
|
||||
void ScanDir(const char *dirname, bool library_dir, bool library_recursive = false);
|
||||
|
||||
AIInfo *info_dummy;
|
||||
AIInfoList info_list;
|
||||
|
@@ -31,6 +31,7 @@ SHORT_NAMES = NO
|
||||
JAVADOC_AUTOBRIEF = YES
|
||||
QT_AUTOBRIEF = NO
|
||||
MULTILINE_CPP_IS_BRIEF = NO
|
||||
DETAILS_AT_TOP = NO
|
||||
INHERIT_DOCS = YES
|
||||
SEPARATE_MEMBER_PAGES = NO
|
||||
TAB_SIZE = 2
|
||||
|
@@ -8,21 +8,12 @@
|
||||
#include "../../company_func.h"
|
||||
#include "../../command_type.h"
|
||||
#include "../../town.h"
|
||||
#include "../../economy_func.h"
|
||||
|
||||
/* static */ bool AIAirport::IsValidAirportType(AirportType type)
|
||||
{
|
||||
return type >= AT_SMALL && type <= AT_HELISTATION && HasBit(::GetValidAirports(), type);
|
||||
}
|
||||
|
||||
/* static */ Money AIAirport::GetPrice(AirportType type)
|
||||
{
|
||||
if (!IsValidAirportType(type)) return -1;
|
||||
|
||||
const AirportFTAClass *afc = ::GetAirport(type);
|
||||
return _price.build_airport * afc->size_x * afc->size_y;
|
||||
}
|
||||
|
||||
/* static */ bool AIAirport::IsHangarTile(TileIndex tile)
|
||||
{
|
||||
if (!::IsValidTile(tile)) return false;
|
||||
|
@@ -53,13 +53,6 @@ public:
|
||||
*/
|
||||
static bool IsValidAirportType(AirportType type);
|
||||
|
||||
/**
|
||||
* Get the cost to build this AirportType.
|
||||
* @param type The AirportType to check.
|
||||
* @return The cost of building this AirportType.
|
||||
*/
|
||||
static Money GetPrice(AirportType type);
|
||||
|
||||
/**
|
||||
* Checks whether the given tile is actually a tile with a hangar.
|
||||
* @param tile The tile to check.
|
||||
|
@@ -39,7 +39,6 @@ void SQAIAirport_Register(Squirrel *engine) {
|
||||
SQAIAirport.DefSQConst(engine, AIAirport::PT_INVALID, "PT_INVALID");
|
||||
|
||||
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::IsValidAirportType, "IsValidAirportType", 2, ".i");
|
||||
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetPrice, "GetPrice", 2, ".i");
|
||||
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::IsHangarTile, "IsHangarTile", 2, ".i");
|
||||
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::IsAirportTile, "IsAirportTile", 2, ".i");
|
||||
SQAIAirport.DefSQStaticMethod(engine, &AIAirport::GetAirportWidth, "GetAirportWidth", 2, ".i");
|
||||
|
@@ -23,12 +23,6 @@
|
||||
return ::IsBridgeTile(tile);
|
||||
}
|
||||
|
||||
/* static */ BridgeID AIBridge::GetBridgeID(TileIndex tile)
|
||||
{
|
||||
if (!IsBridgeTile(tile)) return (BridgeID)-1;
|
||||
return (BridgeID)::GetBridgeType(tile);
|
||||
}
|
||||
|
||||
static void _DoCommandReturnBuildBridge2(class AIInstance *instance)
|
||||
{
|
||||
if (!AIBridge::_BuildBridgeRoad2()) {
|
||||
@@ -38,7 +32,7 @@ static void _DoCommandReturnBuildBridge2(class AIInstance *instance)
|
||||
}
|
||||
|
||||
/* This can never happen, as in test-mode this callback is never executed,
|
||||
* and in execute-mode, the other callback is called. */
|
||||
* and in execute-mode, the other callback is called. */
|
||||
NOT_REACHED();
|
||||
}
|
||||
|
||||
@@ -51,7 +45,7 @@ static void _DoCommandReturnBuildBridge1(class AIInstance *instance)
|
||||
}
|
||||
|
||||
/* This can never happen, as in test-mode this callback is never executed,
|
||||
* and in execute-mode, the other callback is called. */
|
||||
* and in execute-mode, the other callback is called. */
|
||||
NOT_REACHED();
|
||||
}
|
||||
|
||||
|
@@ -51,14 +51,6 @@ public:
|
||||
*/
|
||||
static bool IsBridgeTile(TileIndex tile);
|
||||
|
||||
/**
|
||||
* Get the BridgeID of a bridge at a given tile.
|
||||
* @param tile The tile to get the BridgeID from.
|
||||
* @pre IsBridgeTile(tile).
|
||||
* @return The BridgeID from the bridge at tile 'tile'.
|
||||
*/
|
||||
static BridgeID GetBridgeID(TileIndex tile);
|
||||
|
||||
/**
|
||||
* Get the name of a bridge.
|
||||
* @param bridge_id The bridge to get the name of.
|
||||
|
@@ -36,7 +36,6 @@ void SQAIBridge_Register(Squirrel *engine) {
|
||||
|
||||
SQAIBridge.DefSQStaticMethod(engine, &AIBridge::IsValidBridge, "IsValidBridge", 2, ".i");
|
||||
SQAIBridge.DefSQStaticMethod(engine, &AIBridge::IsBridgeTile, "IsBridgeTile", 2, ".i");
|
||||
SQAIBridge.DefSQStaticMethod(engine, &AIBridge::GetBridgeID, "GetBridgeID", 2, ".i");
|
||||
SQAIBridge.DefSQStaticMethod(engine, &AIBridge::GetName, "GetName", 2, ".i");
|
||||
SQAIBridge.DefSQStaticMethod(engine, &AIBridge::GetMaxSpeed, "GetMaxSpeed", 2, ".i");
|
||||
SQAIBridge.DefSQStaticMethod(engine, &AIBridge::GetPrice, "GetPrice", 3, ".ii");
|
||||
|
@@ -18,7 +18,7 @@ public:
|
||||
* The classes of cargo (from newgrf_cargo.h).
|
||||
*/
|
||||
enum CargoClass {
|
||||
CC_PASSENGERS = 1 << 0, //!< Passengers. Cargos of this class appear at bus stops. Cargos not of this class appear at truck stops.
|
||||
CC_PASSENGERS = 1 << 0, //!< Passengers
|
||||
CC_MAIL = 1 << 1, //!< Mail
|
||||
CC_EXPRESS = 1 << 2, //!< Express cargo (Goods, Food, Candy, but also possible for passengers)
|
||||
CC_ARMOURED = 1 << 3, //!< Armoured cargo (Valuables, Gold, Diamonds)
|
||||
@@ -52,7 +52,6 @@ public:
|
||||
/**
|
||||
* Gets the string representation of the cargo label.
|
||||
* @param cargo_type The cargo to get the string representation of.
|
||||
* @pre AICargo::IsValidCargo(cargo_type).
|
||||
* @return The cargo label.
|
||||
* @note Never use this to check if it is a certain cargo. NewGRF can
|
||||
* redefine all of the names.
|
||||
@@ -61,10 +60,7 @@ public:
|
||||
|
||||
/**
|
||||
* Checks whether the give cargo is a freight or not.
|
||||
* This defines whether the "freight train weight multiplier" will apply to
|
||||
* trains transporting this cargo.
|
||||
* @param cargo_type The cargo to check on.
|
||||
* @pre AICargo::IsValidCargo(cargo_type).
|
||||
* @return True if and only if the cargo is freight.
|
||||
*/
|
||||
static bool IsFreight(CargoID cargo_type);
|
||||
@@ -72,7 +68,6 @@ public:
|
||||
/**
|
||||
* Check if this cargo is in the requested cargo class.
|
||||
* @param cargo_type The cargo to check on.
|
||||
* @pre AICargo::IsValidCargo(cargo_type).
|
||||
* @param cargo_class The class to check for.
|
||||
* @return True if and only if the cargo is in the cargo class.
|
||||
*/
|
||||
@@ -81,7 +76,6 @@ public:
|
||||
/**
|
||||
* Get the effect this cargo has on a town.
|
||||
* @param cargo_type The cargo to check on.
|
||||
* @pre AICargo::IsValidCargo(cargo_type).
|
||||
* @return The effect this cargo has on a town, or TE_NONE if it has no effect.
|
||||
*/
|
||||
static TownEffect GetTownEffect(CargoID cargo_type);
|
||||
@@ -90,7 +84,6 @@ public:
|
||||
* Get the income for transporting a piece of cargo over the
|
||||
* given distance within the specified time.
|
||||
* @param cargo_type The cargo to transport.
|
||||
* @pre AICargo::IsValidCargo(cargo_type).
|
||||
* @param distance The distance the cargo travels from begin to end.
|
||||
* @param days_in_transit Amount of (game) days the cargo is in transit. The max value of this variable is 637. Any value higher returns the same as 637 would.
|
||||
* @return The amount of money that would be earned by this trip.
|
||||
|
@@ -153,8 +153,7 @@ public:
|
||||
* Return the location of a company's HQ.
|
||||
* @param company The company the get the HQ of.
|
||||
* @pre ResolveCompanyID(company) != COMPANY_INVALID.
|
||||
* @return The tile of the company's HQ, this tile is the most nothern tile
|
||||
* of that HQ, or AIMap::TILE_INVALID if there is no HQ yet.
|
||||
* @return The tile of the company's HQ, this tile is the most nothern tile of that HQ, or TILE_INVALID if there is no HQ yet.
|
||||
*/
|
||||
static TileIndex GetCompanyHQ(CompanyID company);
|
||||
|
||||
|
@@ -5,7 +5,6 @@
|
||||
#include "../../stdafx.h"
|
||||
#include "../../string_func.h"
|
||||
#include "../../company_base.h"
|
||||
#include "../../rev.h"
|
||||
#include "table/strings.h"
|
||||
|
||||
#include "../ai.hpp"
|
||||
@@ -67,11 +66,6 @@ AIController::~AIController()
|
||||
return AIConfig::GetConfig(_current_company)->GetSetting(name);
|
||||
}
|
||||
|
||||
/* static */ uint AIController::GetVersion()
|
||||
{
|
||||
return _openttd_newgrf_version;
|
||||
}
|
||||
|
||||
bool AIController::LoadedLibrary(const char *library_name, int *next_number, char *fake_class_name, int fake_class_name_len)
|
||||
{
|
||||
LoadedLibraryList::iterator iter = this->loaded_library.find(library_name);
|
||||
|
@@ -50,18 +50,6 @@ public:
|
||||
*/
|
||||
static int GetSetting(const char *name);
|
||||
|
||||
/**
|
||||
* Get the OpenTTD version of this executable. The version is formatted
|
||||
* with the bits having the following meaning:
|
||||
* 28-31 major version
|
||||
* 24-27 minor version
|
||||
* 20-23 build
|
||||
* 19 1 if it is a release, 0 if it is not.
|
||||
* 0-18 revision number; 0 when the revision is unknown.
|
||||
* @return The version in newgrf format.
|
||||
*/
|
||||
static uint GetVersion();
|
||||
|
||||
/**
|
||||
* Change the minimum amount of time the AI should be put in suspend mode
|
||||
* when you execute a command. Normally in SP this is 1, and in MP it is
|
||||
|
@@ -5,11 +5,10 @@
|
||||
void SQAIController_Register(Squirrel *engine) {
|
||||
DefSQClass <AIController> SQAIController("AIController");
|
||||
SQAIController.PreRegister(engine);
|
||||
SQAIController.DefSQStaticMethod(engine, &AIController::GetTick, "GetTick", 1, ".");
|
||||
SQAIController.DefSQStaticMethod(engine, &AIController::SetCommandDelay, "SetCommandDelay", 2, ".i");
|
||||
SQAIController.DefSQStaticMethod(engine, &AIController::Sleep, "Sleep", 2, ".i");
|
||||
SQAIController.DefSQStaticMethod(engine, &AIController::GetSetting, "GetSetting", 2, ".s");
|
||||
SQAIController.DefSQStaticMethod(engine, &AIController::GetVersion, "GetVersion", 1, ".");
|
||||
SQAIController.DefSQStaticMethod(engine, &AIController::Print, "Print", 3, ".bs");
|
||||
SQAIController.DefSQStaticMethod(engine, &AIController::GetTick, "GetTick", 1, "?");
|
||||
SQAIController.DefSQStaticMethod(engine, &AIController::SetCommandDelay, "SetCommandDelay", 2, "?i");
|
||||
SQAIController.DefSQStaticMethod(engine, &AIController::Sleep, "Sleep", 2, "?i");
|
||||
SQAIController.DefSQStaticMethod(engine, &AIController::GetSetting, "GetSetting", 2, "?s");
|
||||
SQAIController.DefSQStaticMethod(engine, &AIController::Print, "Print", 3, "?bs");
|
||||
SQAIController.PostRegister(engine);
|
||||
}
|
||||
|
@@ -6,10 +6,9 @@
|
||||
#include "ai_cargo.hpp"
|
||||
#include "../../company_func.h"
|
||||
#include "../../strings_func.h"
|
||||
#include "../../aircraft.h"
|
||||
#include "../../vehicle_func.h"
|
||||
#include "../../settings_type.h"
|
||||
#include "../../rail.h"
|
||||
#include "../../engine_base.h"
|
||||
#include "../../articulated_vehicles.h"
|
||||
#include "table/strings.h"
|
||||
|
||||
@@ -65,11 +64,10 @@
|
||||
{
|
||||
if (!IsValidEngine(engine_id)) return -1;
|
||||
|
||||
const Engine *e = ::GetEngine(engine_id);
|
||||
switch (e->type) {
|
||||
switch (::GetEngine(engine_id)->type) {
|
||||
case VEH_ROAD:
|
||||
case VEH_TRAIN: {
|
||||
uint16 *capacities = GetCapacityOfArticulatedParts(engine_id, e->type);
|
||||
uint16 *capacities = GetCapacityOfArticulatedParts(engine_id, ::GetEngine(engine_id)->type);
|
||||
for (CargoID c = 0; c < NUM_CARGO; c++) {
|
||||
if (capacities[c] == 0) continue;
|
||||
return capacities[c];
|
||||
@@ -77,10 +75,15 @@
|
||||
return -1;
|
||||
} break;
|
||||
|
||||
case VEH_SHIP:
|
||||
case VEH_AIRCRAFT:
|
||||
return e->GetDisplayDefaultCapacity();
|
||||
break;
|
||||
case VEH_SHIP: {
|
||||
const ShipVehicleInfo *vi = ::ShipVehInfo(engine_id);
|
||||
return vi->capacity;
|
||||
} break;
|
||||
|
||||
case VEH_AIRCRAFT: {
|
||||
const AircraftVehicleInfo *vi = ::AircraftVehInfo(engine_id);
|
||||
return vi->passenger_capacity;
|
||||
} break;
|
||||
|
||||
default: NOT_REACHED();
|
||||
}
|
||||
|
@@ -91,7 +91,6 @@ public:
|
||||
/**
|
||||
* Insert an event to the queue for the company.
|
||||
* @param event The event to insert.
|
||||
* @note DO NOT CALL YOURSELF; leave it to the internal AI programming.
|
||||
*/
|
||||
static void InsertEvent(AIEvent *event);
|
||||
|
||||
|
@@ -3,11 +3,9 @@
|
||||
/** @file ai_event_types.cpp Implementation of all EventTypes. */
|
||||
|
||||
#include "ai_event_types.hpp"
|
||||
#include "../../command_type.h"
|
||||
#include "../../strings_func.h"
|
||||
#include "../../settings_type.h"
|
||||
#include "../../rail.h"
|
||||
#include "../../engine_base.h"
|
||||
#include "../../aircraft.h"
|
||||
#include "../../articulated_vehicles.h"
|
||||
#include "table/strings.h"
|
||||
|
||||
@@ -30,11 +28,10 @@ CargoID AIEventEnginePreview::GetCargoType()
|
||||
|
||||
int32 AIEventEnginePreview::GetCapacity()
|
||||
{
|
||||
const Engine *e = ::GetEngine(engine);
|
||||
switch (e->type) {
|
||||
switch (::GetEngine(engine)->type) {
|
||||
case VEH_ROAD:
|
||||
case VEH_TRAIN: {
|
||||
uint16 *capacities = GetCapacityOfArticulatedParts(engine, e->type);
|
||||
uint16 *capacities = GetCapacityOfArticulatedParts(engine, ::GetEngine(engine)->type);
|
||||
for (CargoID c = 0; c < NUM_CARGO; c++) {
|
||||
if (capacities[c] == 0) continue;
|
||||
return capacities[c];
|
||||
@@ -42,10 +39,15 @@ int32 AIEventEnginePreview::GetCapacity()
|
||||
return -1;
|
||||
} break;
|
||||
|
||||
case VEH_SHIP:
|
||||
case VEH_AIRCRAFT:
|
||||
return e->GetDisplayDefaultCapacity();
|
||||
break;
|
||||
case VEH_SHIP: {
|
||||
const ShipVehicleInfo *vi = ::ShipVehInfo(engine);
|
||||
return vi->capacity;
|
||||
} break;
|
||||
|
||||
case VEH_AIRCRAFT: {
|
||||
const AircraftVehicleInfo *vi = ::AircraftVehInfo(engine);
|
||||
return vi->passenger_capacity;
|
||||
} break;
|
||||
|
||||
default: NOT_REACHED();
|
||||
}
|
||||
|
@@ -35,7 +35,6 @@ public:
|
||||
/**
|
||||
* @param vehicle The vehicle that crashed.
|
||||
* @param crash_site Where the vehicle crashed.
|
||||
* @param crash_reason The reason why the vehicle crashed.
|
||||
*/
|
||||
AIEventVehicleCrashed(VehicleID vehicle, TileIndex crash_site, CrashReason crash_reason) :
|
||||
AIEvent(AI_ET_VEHICLE_CRASHED),
|
||||
|
@@ -86,9 +86,7 @@ public:
|
||||
static TileIndex GetLocation(IndustryID industry_id);
|
||||
|
||||
/**
|
||||
* Get the number of stations around an industry. All stations that can
|
||||
* service the industry are counted, your own stations but also your
|
||||
* opponents stations.
|
||||
* Get the number of stations around an industry.
|
||||
* @param industry_id The index of the industry.
|
||||
* @pre IsValidIndustry(industry_id).
|
||||
* @return The number of stations around an industry.
|
||||
|
@@ -111,24 +111,3 @@
|
||||
uint32 seed = ::InteractiveRandom();
|
||||
return AIObject::DoCommand(0, industry_type, seed, CMD_BUILD_INDUSTRY);
|
||||
}
|
||||
|
||||
/* static */ bool AIIndustryType::IsBuiltOnWater(IndustryType industry_type)
|
||||
{
|
||||
if (!IsValidIndustryType(industry_type)) return false;
|
||||
|
||||
return (::GetIndustrySpec(industry_type)->behaviour & INDUSTRYBEH_BUILT_ONWATER) != 0;
|
||||
}
|
||||
|
||||
/* static */ bool AIIndustryType::HasHeliport(IndustryType industry_type)
|
||||
{
|
||||
if (!IsValidIndustryType(industry_type)) return false;
|
||||
|
||||
return (::GetIndustrySpec(industry_type)->behaviour & INDUSTRYBEH_AI_AIRSHIP_ROUTES) != 0;
|
||||
}
|
||||
|
||||
/* static */ bool AIIndustryType::HasDock(IndustryType industry_type)
|
||||
{
|
||||
if (!IsValidIndustryType(industry_type)) return false;
|
||||
|
||||
return (::GetIndustrySpec(industry_type)->behaviour & INDUSTRYBEH_AI_AIRSHIP_ROUTES) != 0;
|
||||
}
|
||||
|
@@ -113,30 +113,6 @@ public:
|
||||
* @note If true is returned the money is paid, whether a new industry was build or not.
|
||||
*/
|
||||
static bool ProspectIndustry(IndustryType industry_type);
|
||||
|
||||
/**
|
||||
* Is this type of industry built on water.
|
||||
* @param industry_type The type of the industry.
|
||||
* @pre IsValidIndustryType(industry_type).
|
||||
* @return True when this type is built on water.
|
||||
*/
|
||||
static bool IsBuiltOnWater(IndustryType industry_type);
|
||||
|
||||
/**
|
||||
* Does this type of industry have a heliport?
|
||||
* @param industry_type The type of the industry.
|
||||
* @pre IsValidIndustryType(industry_type).
|
||||
* @return True when this type has a heliport.
|
||||
*/
|
||||
static bool HasHeliport(IndustryType industry_type);
|
||||
|
||||
/**
|
||||
* Does this type of industry have a dock?
|
||||
* @param industry_type The type of the industry.
|
||||
* @pre IsValidIndustryType(industry_type).
|
||||
* @return True when this type has a dock.
|
||||
*/
|
||||
static bool HasDock(IndustryType industry_type);
|
||||
};
|
||||
|
||||
#endif /* AI_INDUSTRYTYPE_HPP */
|
||||
|
@@ -28,9 +28,6 @@ void SQAIIndustryType_Register(Squirrel *engine) {
|
||||
SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::CanProspectIndustry, "CanProspectIndustry", 2, ".i");
|
||||
SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::BuildIndustry, "BuildIndustry", 3, ".ii");
|
||||
SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::ProspectIndustry, "ProspectIndustry", 2, ".i");
|
||||
SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::IsBuiltOnWater, "IsBuiltOnWater", 2, ".i");
|
||||
SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::HasHeliport, "HasHeliport", 2, ".i");
|
||||
SQAIIndustryType.DefSQStaticMethod(engine, &AIIndustryType::HasDock, "HasDock", 2, ".i");
|
||||
|
||||
SQAIIndustryType.PostRegister(engine);
|
||||
}
|
||||
|
@@ -32,7 +32,7 @@
|
||||
log->lines = CallocT<char *>(80);
|
||||
log->type = CallocT<AILog::AILogType>(80);
|
||||
log->count = 80;
|
||||
log->pos = log->count - 1;
|
||||
log->pos = log->count;
|
||||
log->used = 0;
|
||||
}
|
||||
LogData *log = (LogData *)AIObject::GetLogPointer();
|
||||
|
@@ -17,9 +17,6 @@ public:
|
||||
TILE_INVALID = INVALID_TILE, //!< Invalid TileIndex.
|
||||
};
|
||||
#endif /* DEFINE_SCRIPT_FILES */
|
||||
#ifdef DOXYGEN_SKIP
|
||||
const static TileIndex TILE_INVALID; //!< Invalid TileIndex.
|
||||
#endif /* DOXYGEN_SKIP */
|
||||
|
||||
static const char *GetClassName() { return "AIMap"; }
|
||||
|
||||
|
@@ -2,11 +2,6 @@
|
||||
|
||||
/** @file ai_object.cpp Implementation of AIObject. */
|
||||
|
||||
#include "../../stdafx.h"
|
||||
#include <squirrel.h>
|
||||
#include "../../script/squirrel.hpp"
|
||||
#include "../../company_base.h"
|
||||
|
||||
#include "ai_log.hpp"
|
||||
#include "table/strings.h"
|
||||
#include "../ai.hpp"
|
||||
@@ -162,8 +157,7 @@ void AIObject::SetAllowDoCommand(bool allow)
|
||||
|
||||
bool AIObject::GetAllowDoCommand()
|
||||
{
|
||||
Squirrel *squirrel = GetCompany(_current_company)->ai_instance->engine;
|
||||
return GetStorage()->allow_do_command && squirrel->CanSuspend();
|
||||
return GetStorage()->allow_do_command;
|
||||
}
|
||||
|
||||
void *&AIObject::GetEventPointer()
|
||||
|
@@ -143,24 +143,9 @@ protected:
|
||||
*/
|
||||
static void *&GetEventPointer();
|
||||
|
||||
/**
|
||||
* Set the cost of the last command.
|
||||
*/
|
||||
static void SetLastCost(Money last_cost);
|
||||
|
||||
/**
|
||||
* Get the cost of the last command.
|
||||
*/
|
||||
static Money GetLastCost();
|
||||
|
||||
/**
|
||||
* Set a variable that can be used by callback functions to pass information.
|
||||
*/
|
||||
static void SetCallbackVariable(int index, int value);
|
||||
|
||||
/**
|
||||
* Get the variable that is used by callback functions to pass information.
|
||||
*/
|
||||
static int GetCallbackVariable(int index);
|
||||
|
||||
public:
|
||||
|
@@ -23,10 +23,7 @@ static OrderType GetOrderTypeByTile(TileIndex t)
|
||||
|
||||
switch (::GetTileType(t)) {
|
||||
default: break;
|
||||
case MP_STATION:
|
||||
if (IsHangar(t)) return OT_GOTO_DEPOT;
|
||||
return OT_GOTO_STATION;
|
||||
break;
|
||||
case MP_STATION: return OT_GOTO_STATION; break;
|
||||
case MP_WATER: if (::IsShipDepot(t)) return OT_GOTO_DEPOT; break;
|
||||
case MP_ROAD: if (::GetRoadTileType(t) == ROAD_TILE_DEPOT) return OT_GOTO_DEPOT; break;
|
||||
case MP_RAILWAY:
|
||||
@@ -46,47 +43,6 @@ static OrderType GetOrderTypeByTile(TileIndex t)
|
||||
return AIVehicle::IsValidVehicle(vehicle_id) && order_position >= 0 && (order_position < ::GetVehicle(vehicle_id)->GetNumOrders() || order_position == ORDER_CURRENT);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the current order the vehicle is executing. If the current order is in
|
||||
* the order list, return the order from the orderlist. If the current order
|
||||
* was a manual order, return the current order.
|
||||
*/
|
||||
static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition order_position)
|
||||
{
|
||||
const Vehicle *v = ::GetVehicle(vehicle_id);
|
||||
if (order_position == AIOrder::ORDER_CURRENT) {
|
||||
const Order *order = &v->current_order;
|
||||
if (order->GetType() == OT_GOTO_DEPOT && !(order->GetDepotOrderType() & ODTFB_PART_OF_ORDERS)) return order;
|
||||
order_position = AIOrder::ResolveOrderPosition(vehicle_id, order_position);
|
||||
if (order_position == AIOrder::ORDER_INVALID) return NULL;
|
||||
}
|
||||
return ::GetVehicleOrder(v, order_position);
|
||||
}
|
||||
|
||||
/* static */ bool AIOrder::IsGotoStationOrder(VehicleID vehicle_id, OrderPosition order_position)
|
||||
{
|
||||
if (!IsValidVehicleOrder(vehicle_id, order_position)) return false;
|
||||
|
||||
const Order *order = ::ResolveOrder(vehicle_id, order_position);
|
||||
return order != NULL && order->GetType() == OT_GOTO_STATION;
|
||||
}
|
||||
|
||||
/* static */ bool AIOrder::IsGotoDepotOrder(VehicleID vehicle_id, OrderPosition order_position)
|
||||
{
|
||||
if (!IsValidVehicleOrder(vehicle_id, order_position)) return false;
|
||||
|
||||
const Order *order = ::ResolveOrder(vehicle_id, order_position);
|
||||
return order != NULL && order->GetType() == OT_GOTO_DEPOT;
|
||||
}
|
||||
|
||||
/* static */ bool AIOrder::IsGotoWaypointOrder(VehicleID vehicle_id, OrderPosition order_position)
|
||||
{
|
||||
if (!IsValidVehicleOrder(vehicle_id, order_position)) return false;
|
||||
|
||||
const Order *order = ::ResolveOrder(vehicle_id, order_position);
|
||||
return order != NULL && order->GetType() == OT_GOTO_WAYPOINT;
|
||||
}
|
||||
|
||||
/* static */ bool AIOrder::IsConditionalOrder(VehicleID vehicle_id, OrderPosition order_position)
|
||||
{
|
||||
if (order_position == ORDER_CURRENT) return false;
|
||||
@@ -96,16 +52,6 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or
|
||||
return order->GetType() == OT_CONDITIONAL;
|
||||
}
|
||||
|
||||
/* static */ bool AIOrder::IsCurrentOrderPartOfOrderList(VehicleID vehicle_id)
|
||||
{
|
||||
if (AIVehicle::IsValidVehicle(vehicle_id)) return false;
|
||||
if (GetOrderCount(vehicle_id) == 0) return false;
|
||||
|
||||
const Order *order = &::GetVehicle(vehicle_id)->current_order;
|
||||
if (order->GetType() != OT_GOTO_DEPOT) return true;
|
||||
return (order->GetDepotOrderType() & ODTFB_PART_OF_ORDERS) != 0;
|
||||
}
|
||||
|
||||
/* static */ AIOrder::OrderPosition AIOrder::ResolveOrderPosition(VehicleID vehicle_id, OrderPosition order_position)
|
||||
{
|
||||
if (!AIVehicle::IsValidVehicle(vehicle_id)) return ORDER_INVALID;
|
||||
@@ -128,10 +74,7 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or
|
||||
(((order_flags & AIOF_NO_UNLOAD) == 0) || ((order_flags & AIOF_NO_LOAD) == 0)) &&
|
||||
(((order_flags & AIOF_FULL_LOAD_ANY) == 0) || ((order_flags & AIOF_NO_LOAD) == 0));
|
||||
|
||||
case OT_GOTO_DEPOT:
|
||||
return ((order_flags & ~(AIOF_NON_STOP_FLAGS | AIOF_DEPOT_FLAGS)) == 0) &&
|
||||
(((order_flags & AIOF_SERVICE_IF_NEEDED) == 0) || ((order_flags & AIOF_STOP_IN_DEPOT) == 0));
|
||||
|
||||
case OT_GOTO_DEPOT: return (order_flags & ~(AIOF_NON_STOP_FLAGS | AIOF_SERVICE_IF_NEEDED)) == 0;
|
||||
case OT_GOTO_WAYPOINT: return (order_flags & ~(AIOF_NON_STOP_FLAGS)) == 0;
|
||||
default: return false;
|
||||
}
|
||||
@@ -165,41 +108,21 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or
|
||||
{
|
||||
if (!IsValidVehicleOrder(vehicle_id, order_position)) return INVALID_TILE;
|
||||
|
||||
const Order *order = ::ResolveOrder(vehicle_id, order_position);
|
||||
if (order == NULL || order->GetType() == OT_CONDITIONAL) return INVALID_TILE;
|
||||
const Order *order;
|
||||
const Vehicle *v = ::GetVehicle(vehicle_id);
|
||||
if (order_position == ORDER_CURRENT) {
|
||||
order = &v->current_order;
|
||||
} else {
|
||||
order = ::GetVehicleOrder(GetVehicle(vehicle_id), order_position);
|
||||
if (order->GetType() == OT_CONDITIONAL) return INVALID_TILE;
|
||||
}
|
||||
|
||||
switch (order->GetType()) {
|
||||
case OT_GOTO_DEPOT: {
|
||||
case OT_GOTO_DEPOT:
|
||||
if (v->type != VEH_AIRCRAFT) return ::GetDepot(order->GetDestination())->xy;
|
||||
/* Aircraft's hangars are referenced by StationID, not DepotID */
|
||||
const Station *st = ::GetStation(order->GetDestination());
|
||||
const AirportFTAClass *airport = st->Airport();
|
||||
if (airport == NULL || airport->nof_depots == 0) return INVALID_TILE;
|
||||
return st->airport_tile + ::ToTileIndexDiff(st->Airport()->airport_depots[0]);
|
||||
}
|
||||
/* FALL THROUGH: aircraft's hangars are referenced by StationID, not DepotID */
|
||||
|
||||
case OT_GOTO_STATION: {
|
||||
const Station *st = ::GetStation(order->GetDestination());
|
||||
if (st->train_tile != INVALID_TILE) {
|
||||
for (uint i = 0; i < st->trainst_w; i++) {
|
||||
TileIndex t = st->train_tile + TileDiffXY(i, 0);
|
||||
if (st->TileBelongsToRailStation(t)) return t;
|
||||
}
|
||||
} else if (st->dock_tile != INVALID_TILE) {
|
||||
return st->dock_tile;
|
||||
} else if (st->bus_stops != NULL) {
|
||||
return st->bus_stops->xy;
|
||||
} else if (st->truck_stops != NULL) {
|
||||
return st->truck_stops->xy;
|
||||
} else if (st->airport_tile != INVALID_TILE) {
|
||||
const AirportFTAClass *fta = st->Airport();
|
||||
BEGIN_TILE_LOOP(tile, fta->size_x, fta->size_y, st->airport_tile) {
|
||||
if (!::IsHangar(tile)) return tile;
|
||||
} END_TILE_LOOP(tile, fta->size_x, fta->size_y, st->airport_tile)
|
||||
}
|
||||
return INVALID_TILE;
|
||||
}
|
||||
case OT_GOTO_STATION: return ::GetStation(order->GetDestination())->xy;
|
||||
case OT_GOTO_WAYPOINT: return ::GetWaypoint(order->GetDestination())->xy;
|
||||
default: return INVALID_TILE;
|
||||
}
|
||||
@@ -209,15 +132,19 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or
|
||||
{
|
||||
if (!IsValidVehicleOrder(vehicle_id, order_position)) return AIOF_INVALID;
|
||||
|
||||
const Order *order = ::ResolveOrder(vehicle_id, order_position);
|
||||
if (order == NULL || order->GetType() == OT_CONDITIONAL) return AIOF_INVALID;
|
||||
const Order *order;
|
||||
if (order_position == ORDER_CURRENT) {
|
||||
order = &::GetVehicle(vehicle_id)->current_order;
|
||||
} else {
|
||||
order = ::GetVehicleOrder(GetVehicle(vehicle_id), order_position);
|
||||
if (order->GetType() == OT_CONDITIONAL) return AIOF_INVALID;
|
||||
}
|
||||
|
||||
AIOrderFlags order_flags = AIOF_NONE;
|
||||
order_flags |= (AIOrderFlags)order->GetNonStopType();
|
||||
switch (order->GetType()) {
|
||||
case OT_GOTO_DEPOT:
|
||||
if (order->GetDepotOrderType() & ODTFB_SERVICE) order_flags |= AIOF_SERVICE_IF_NEEDED;
|
||||
if (order->GetDepotActionType() & ODATFB_HALT) order_flags |= AIOF_STOP_IN_DEPOT;
|
||||
break;
|
||||
|
||||
case OT_GOTO_STATION:
|
||||
@@ -333,21 +260,9 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or
|
||||
|
||||
Order order;
|
||||
switch (::GetOrderTypeByTile(destination)) {
|
||||
case OT_GOTO_DEPOT: {
|
||||
OrderDepotTypeFlags odtf = (OrderDepotTypeFlags)(ODTFB_PART_OF_ORDERS | ((order_flags & AIOF_SERVICE_IF_NEEDED) ? ODTFB_SERVICE : 0));
|
||||
OrderDepotActionFlags odaf = (OrderDepotActionFlags)(ODATF_SERVICE_ONLY | ((order_flags & AIOF_STOP_IN_DEPOT) ? ODATFB_HALT : 0));
|
||||
OrderNonStopFlags onsf = (OrderNonStopFlags)((order_flags & AIOF_NON_STOP_INTERMEDIATE) ? ONSF_NO_STOP_AT_INTERMEDIATE_STATIONS : ONSF_STOP_EVERYWHERE);
|
||||
/* Check explicitly if the order is to a station (for aircraft) or
|
||||
* to a depot (other vehicle types). */
|
||||
if (::GetVehicle(vehicle_id)->type == VEH_AIRCRAFT) {
|
||||
if (!::IsTileType(destination, MP_STATION)) return false;
|
||||
order.MakeGoToDepot(::GetStationIndex(destination), odtf, onsf, odaf);
|
||||
} else {
|
||||
if (::IsTileType(destination, MP_STATION)) return false;
|
||||
order.MakeGoToDepot(::GetDepotByTile(destination)->index, odtf, onsf, odaf);
|
||||
}
|
||||
case OT_GOTO_DEPOT:
|
||||
order.MakeGoToDepot(::GetDepotByTile(destination)->index, (OrderDepotTypeFlags)(ODTFB_PART_OF_ORDERS | ((order_flags & AIOF_SERVICE_IF_NEEDED) ? ODTFB_SERVICE : 0)));
|
||||
break;
|
||||
}
|
||||
|
||||
case OT_GOTO_STATION:
|
||||
order.MakeGoToStation(::GetStationIndex(destination));
|
||||
@@ -391,13 +306,6 @@ static const Order *ResolveOrder(VehicleID vehicle_id, AIOrder::OrderPosition or
|
||||
return AIObject::DoCommand(0, vehicle_id, order_position, CMD_DELETE_ORDER);
|
||||
}
|
||||
|
||||
/* static */ bool AIOrder::SkipToOrder(VehicleID vehicle_id, OrderPosition next_order)
|
||||
{
|
||||
EnforcePrecondition(false, IsValidVehicleOrder(vehicle_id, next_order));
|
||||
|
||||
return AIObject::DoCommand(0, vehicle_id, next_order, CMD_SKIP_TO_ORDER);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback handler as SetOrderFlags possibly needs multiple DoCommand calls
|
||||
* to be able to set all order flags correctly. As we need to wait till the
|
||||
@@ -441,11 +349,8 @@ static void _DoCommandReturnSetOrderFlags(class AIInstance *instance)
|
||||
|
||||
switch (order->GetType()) {
|
||||
case OT_GOTO_DEPOT:
|
||||
if ((current & AIOF_DEPOT_FLAGS) != (order_flags & AIOF_DEPOT_FLAGS)) {
|
||||
uint data = DA_ALWAYS_GO;
|
||||
if (order_flags & AIOF_SERVICE_IF_NEEDED) data = DA_SERVICE;
|
||||
if (order_flags & AIOF_STOP_IN_DEPOT) data = DA_STOP;
|
||||
return AIObject::DoCommand(0, vehicle_id | (order_position << 16), (data << 4) | MOF_DEPOT_ACTION, CMD_MODIFY_ORDER, NULL, &_DoCommandReturnSetOrderFlags);
|
||||
if ((current & AIOF_SERVICE_IF_NEEDED) != (order_flags & AIOF_SERVICE_IF_NEEDED)) {
|
||||
return AIObject::DoCommand(0, vehicle_id | (order_position << 16), MOF_DEPOT_ACTION, CMD_MODIFY_ORDER, NULL, &_DoCommandReturnSetOrderFlags);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@@ -57,8 +57,6 @@ public:
|
||||
|
||||
/** Service the vehicle when needed, otherwise skip this order; only for depots. */
|
||||
AIOF_SERVICE_IF_NEEDED = 1 << 2,
|
||||
/** Stop in the depot instead of only go there for servicing; only for depots. */
|
||||
AIOF_STOP_IN_DEPOT = 1 << 3,
|
||||
|
||||
/** All flags related to non-stop settings. */
|
||||
AIOF_NON_STOP_FLAGS = AIOF_NON_STOP_INTERMEDIATE | AIOF_NON_STOP_DESTINATION,
|
||||
@@ -66,8 +64,6 @@ public:
|
||||
AIOF_UNLOAD_FLAGS = AIOF_TRANSFER | AIOF_UNLOAD | AIOF_NO_UNLOAD,
|
||||
/** All flags related to loading. */
|
||||
AIOF_LOAD_FLAGS = AIOF_FULL_LOAD | AIOF_FULL_LOAD_ANY | AIOF_NO_LOAD,
|
||||
/** All flags related to depots. */
|
||||
AIOF_DEPOT_FLAGS = AIOF_SERVICE_IF_NEEDED | AIOF_STOP_IN_DEPOT,
|
||||
|
||||
/** For marking invalid order flags */
|
||||
AIOF_INVALID = 0xFFFF,
|
||||
@@ -118,33 +114,6 @@ public:
|
||||
*/
|
||||
static bool IsValidVehicleOrder(VehicleID vehicle_id, OrderPosition order_position);
|
||||
|
||||
/**
|
||||
* Checks whether the given order is a goto-station order.
|
||||
* @param vehicle_id The vehicle to check.
|
||||
* @param order_position The order index to check.
|
||||
* @pre IsValidVehicleOrder(vehicle_id, order_position).
|
||||
* @return True if and only if the order is a goto-station order.
|
||||
*/
|
||||
static bool IsGotoStationOrder(VehicleID vehicle_id, OrderPosition order_position);
|
||||
|
||||
/**
|
||||
* Checks whether the given order is a goto-depot order.
|
||||
* @param vehicle_id The vehicle to check.
|
||||
* @param order_position The order index to check.
|
||||
* @pre IsValidVehicleOrder(vehicle_id, order_position).
|
||||
* @return True if and only if the order is a goto-depot order.
|
||||
*/
|
||||
static bool IsGotoDepotOrder(VehicleID vehicle_id, OrderPosition order_position);
|
||||
|
||||
/**
|
||||
* Checks whether the given order is a goto-waypoint order.
|
||||
* @param vehicle_id The vehicle to check.
|
||||
* @param order_position The order index to check.
|
||||
* @pre IsValidVehicleOrder(vehicle_id, order_position).
|
||||
* @return True if and only if the order is a goto-waypoint order.
|
||||
*/
|
||||
static bool IsGotoWaypointOrder(VehicleID vehicle_id, OrderPosition order_position);
|
||||
|
||||
/**
|
||||
* Checks whether the given order is a conditional order.
|
||||
* @param vehicle_id The vehicle to check.
|
||||
@@ -154,17 +123,6 @@ public:
|
||||
*/
|
||||
static bool IsConditionalOrder(VehicleID vehicle_id, OrderPosition order_position);
|
||||
|
||||
/**
|
||||
* Checks whether the current order is part of the orderlist.
|
||||
* @param vehicle_id The vehicle to check.
|
||||
* @pre AIVehicle::IsValidVehicle(vehicle_id).
|
||||
* @return True if and only if the current order is part of the order list.
|
||||
* @note If the order is a non-'non-stop' order, and the vehicle is currently
|
||||
* (un)loading at a station that is not the final destination, this function
|
||||
* will still return true.
|
||||
*/
|
||||
static bool IsCurrentOrderPartOfOrderList(VehicleID vehicle_id);
|
||||
|
||||
/**
|
||||
* Resolves the given order index to the correct index for the given vehicle.
|
||||
* If the order index was ORDER_CURRENT it will be resolved to the index of
|
||||
@@ -288,10 +246,8 @@ public:
|
||||
* Sets the OrderCondition of the given order for the given vehicle.
|
||||
* @param vehicle_id The vehicle to set the condition type for.
|
||||
* @param order_position The order to set the condition type for.
|
||||
* @param condition The condition to compare on.
|
||||
* @pre IsValidVehicleOrder(vehicle_id, order_position).
|
||||
* @pre order_position != ORDER_CURRENT && IsConditionalOrder(vehicle_id, order_position).
|
||||
* @pre condition >= OC_LOAD_PERCENTAGE && condition <= OC_UNCONDITIONALLY.
|
||||
* @return Whether the order has been/can be changed.
|
||||
*/
|
||||
static bool SetOrderCondition(VehicleID vehicle_id, OrderPosition order_position, OrderCondition condition);
|
||||
@@ -300,10 +256,8 @@ public:
|
||||
* Sets the CompareFunction of the given order for the given vehicle.
|
||||
* @param vehicle_id The vehicle to set the compare function for.
|
||||
* @param order_position The order to set the compare function for.
|
||||
* @param compare The new compare function of the order.
|
||||
* @pre IsValidVehicleOrder(vehicle_id, order_position).
|
||||
* @pre order_position != ORDER_CURRENT && IsConditionalOrder(vehicle_id, order_position).
|
||||
* @pre compare >= CF_EQUALS && compare <= CF_IS_FALSE.
|
||||
* @return Whether the order has been/can be changed.
|
||||
*/
|
||||
static bool SetOrderCompareFunction(VehicleID vehicle_id, OrderPosition order_position, CompareFunction compare);
|
||||
@@ -312,7 +266,6 @@ public:
|
||||
* Sets the value to compare against of the given order for the given vehicle.
|
||||
* @param vehicle_id The vehicle to set the value for.
|
||||
* @param order_position The order to set the value for.
|
||||
* @param value The value to compare against.
|
||||
* @pre IsValidVehicleOrder(vehicle_id, order_position).
|
||||
* @pre order_position != ORDER_CURRENT && IsConditionalOrder(vehicle_id, order_position).
|
||||
* @pre value >= 0 && value < 2048.
|
||||
@@ -378,7 +331,7 @@ public:
|
||||
* Removes an order from the vehicle's order list.
|
||||
* @param vehicle_id The vehicle to remove the order from.
|
||||
* @param order_position The order to remove from the order list.
|
||||
* @pre IsValidVehicleOrder(vehicle_id, order_position).
|
||||
* @pre AIVehicle::IsValidVehicleOrder(vehicle_id, order_position).
|
||||
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
|
||||
* @return True if and only if the order was removed.
|
||||
*/
|
||||
@@ -424,16 +377,6 @@ public:
|
||||
*/
|
||||
static bool MoveOrder(VehicleID vehicle_id, OrderPosition order_position_move, OrderPosition order_position_target);
|
||||
|
||||
/**
|
||||
* Make a vehicle execute next_order instead of its current order.
|
||||
* @param vehicle_id The vehicle that should skip some orders.
|
||||
* @param next_order The order the vehicle should skip to.
|
||||
* @pre IsValidVehicleOrder(vehicle_id, next_order).
|
||||
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
|
||||
* @return True if and only the current order was changed.
|
||||
*/
|
||||
static bool SkipToOrder(VehicleID vehicle_id, OrderPosition next_order);
|
||||
|
||||
/**
|
||||
* Copies the orders from another vehicle. The orders of the main vehicle
|
||||
* are going to be the orders of the changed vehicle.
|
||||
|
@@ -42,11 +42,9 @@ void SQAIOrder_Register(Squirrel *engine) {
|
||||
SQAIOrder.DefSQConst(engine, AIOrder::AIOF_FULL_LOAD_ANY, "AIOF_FULL_LOAD_ANY");
|
||||
SQAIOrder.DefSQConst(engine, AIOrder::AIOF_NO_LOAD, "AIOF_NO_LOAD");
|
||||
SQAIOrder.DefSQConst(engine, AIOrder::AIOF_SERVICE_IF_NEEDED, "AIOF_SERVICE_IF_NEEDED");
|
||||
SQAIOrder.DefSQConst(engine, AIOrder::AIOF_STOP_IN_DEPOT, "AIOF_STOP_IN_DEPOT");
|
||||
SQAIOrder.DefSQConst(engine, AIOrder::AIOF_NON_STOP_FLAGS, "AIOF_NON_STOP_FLAGS");
|
||||
SQAIOrder.DefSQConst(engine, AIOrder::AIOF_UNLOAD_FLAGS, "AIOF_UNLOAD_FLAGS");
|
||||
SQAIOrder.DefSQConst(engine, AIOrder::AIOF_LOAD_FLAGS, "AIOF_LOAD_FLAGS");
|
||||
SQAIOrder.DefSQConst(engine, AIOrder::AIOF_DEPOT_FLAGS, "AIOF_DEPOT_FLAGS");
|
||||
SQAIOrder.DefSQConst(engine, AIOrder::AIOF_INVALID, "AIOF_INVALID");
|
||||
SQAIOrder.DefSQConst(engine, AIOrder::OC_LOAD_PERCENTAGE, "OC_LOAD_PERCENTAGE");
|
||||
SQAIOrder.DefSQConst(engine, AIOrder::OC_RELIABILITY, "OC_RELIABILITY");
|
||||
@@ -73,38 +71,33 @@ void SQAIOrder_Register(Squirrel *engine) {
|
||||
AIError::RegisterErrorMapString(AIOrder::ERR_ORDER_TOO_MANY, "ERR_ORDER_TOO_MANY");
|
||||
AIError::RegisterErrorMapString(AIOrder::ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION, "ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION");
|
||||
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsValidVehicleOrder, "IsValidVehicleOrder", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsGotoStationOrder, "IsGotoStationOrder", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsGotoDepotOrder, "IsGotoDepotOrder", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsGotoWaypointOrder, "IsGotoWaypointOrder", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsConditionalOrder, "IsConditionalOrder", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsCurrentOrderPartOfOrderList, "IsCurrentOrderPartOfOrderList", 2, ".i");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::ResolveOrderPosition, "ResolveOrderPosition", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::AreOrderFlagsValid, "AreOrderFlagsValid", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsValidConditionalOrder, "IsValidConditionalOrder", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderCount, "GetOrderCount", 2, ".i");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderDestination, "GetOrderDestination", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderFlags, "GetOrderFlags", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderJumpTo, "GetOrderJumpTo", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderCondition, "GetOrderCondition", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderCompareFunction, "GetOrderCompareFunction", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderCompareValue, "GetOrderCompareValue", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetOrderJumpTo, "SetOrderJumpTo", 4, ".iii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetOrderCondition, "SetOrderCondition", 4, ".iii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetOrderCompareFunction, "SetOrderCompareFunction", 4, ".iii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetOrderCompareValue, "SetOrderCompareValue", 4, ".iii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::AppendOrder, "AppendOrder", 4, ".iii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::AppendConditionalOrder, "AppendConditionalOrder", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::InsertOrder, "InsertOrder", 5, ".iiii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::InsertConditionalOrder, "InsertConditionalOrder", 4, ".iii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::RemoveOrder, "RemoveOrder", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetOrderFlags, "SetOrderFlags", 4, ".iii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::ChangeOrder, "ChangeOrder", 4, ".iii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::MoveOrder, "MoveOrder", 4, ".iii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SkipToOrder, "SkipToOrder", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::CopyOrders, "CopyOrders", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::ShareOrders, "ShareOrders", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::UnshareOrders, "UnshareOrders", 2, ".i");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsValidVehicleOrder, "IsValidVehicleOrder", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsConditionalOrder, "IsConditionalOrder", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::ResolveOrderPosition, "ResolveOrderPosition", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::AreOrderFlagsValid, "AreOrderFlagsValid", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::IsValidConditionalOrder, "IsValidConditionalOrder", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderCount, "GetOrderCount", 2, ".i");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderDestination, "GetOrderDestination", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderFlags, "GetOrderFlags", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderJumpTo, "GetOrderJumpTo", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderCondition, "GetOrderCondition", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderCompareFunction, "GetOrderCompareFunction", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::GetOrderCompareValue, "GetOrderCompareValue", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetOrderJumpTo, "SetOrderJumpTo", 4, ".iii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetOrderCondition, "SetOrderCondition", 4, ".iii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetOrderCompareFunction, "SetOrderCompareFunction", 4, ".iii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetOrderCompareValue, "SetOrderCompareValue", 4, ".iii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::AppendOrder, "AppendOrder", 4, ".iii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::AppendConditionalOrder, "AppendConditionalOrder", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::InsertOrder, "InsertOrder", 5, ".iiii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::InsertConditionalOrder, "InsertConditionalOrder", 4, ".iii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::RemoveOrder, "RemoveOrder", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::SetOrderFlags, "SetOrderFlags", 4, ".iii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::ChangeOrder, "ChangeOrder", 4, ".iii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::MoveOrder, "MoveOrder", 4, ".iii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::CopyOrders, "CopyOrders", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::ShareOrders, "ShareOrders", 3, ".ii");
|
||||
SQAIOrder.DefSQStaticMethod(engine, &AIOrder::UnshareOrders, "UnshareOrders", 2, ".i");
|
||||
|
||||
SQAIOrder.PostRegister(engine);
|
||||
}
|
||||
|
@@ -110,7 +110,7 @@
|
||||
{
|
||||
if (!IsRailStationTile(tile)) return RAILTRACK_INVALID;
|
||||
|
||||
return (RailTrack)::GetRailStationTrackBits(tile);
|
||||
return (RailTrack)::GetRailStationTrack(tile);
|
||||
}
|
||||
|
||||
/* static */ bool AIRail::BuildRailDepot(TileIndex tile, TileIndex front)
|
||||
@@ -203,7 +203,6 @@
|
||||
if (IsRailWaypointTile(tile)) return ::GetRailWaypointBits(tile);
|
||||
if (IsRailStationTile(tile)) return ::TrackToTrackBits(::GetRailStationTrack(tile));
|
||||
if (IsLevelCrossingTile(tile)) return ::GetCrossingRailBits(tile);
|
||||
if (IsRailDepotTile(tile)) return ::TRACK_BIT_NONE;
|
||||
return ::GetTrackBits(tile);
|
||||
}
|
||||
|
||||
@@ -317,7 +316,7 @@ static uint32 SimulateDrag(TileIndex from, TileIndex tile, TileIndex *to)
|
||||
EnforcePrecondition(false, ::IsValidTile(tile));
|
||||
EnforcePrecondition(false, ::IsValidTile(to));
|
||||
EnforcePrecondition(false, ::DistanceManhattan(from, tile) == 1);
|
||||
EnforcePrecondition(false, ::DistanceManhattan(tile, to) >= 1);
|
||||
EnforcePrecondition(false, ::DistanceManhattan(tile,to) >= 1);
|
||||
EnforcePrecondition(false, IsRailTypeAvailable(GetCurrentRailType()));
|
||||
int diag_offset = abs(abs((int)::TileX(to) - (int)::TileX(tile)) - abs((int)::TileY(to) - (int)::TileY(tile)));
|
||||
EnforcePrecondition(false, diag_offset <= 1 ||
|
||||
@@ -334,7 +333,7 @@ static uint32 SimulateDrag(TileIndex from, TileIndex tile, TileIndex *to)
|
||||
EnforcePrecondition(false, ::IsValidTile(tile));
|
||||
EnforcePrecondition(false, ::IsValidTile(to));
|
||||
EnforcePrecondition(false, ::DistanceManhattan(from, tile) == 1);
|
||||
EnforcePrecondition(false, ::DistanceManhattan(tile, to) >= 1);
|
||||
EnforcePrecondition(false, ::DistanceManhattan(tile,to) >= 1);
|
||||
int diag_offset = abs(abs((int)::TileX(to) - (int)::TileX(tile)) - abs((int)::TileY(to) - (int)::TileY(tile)));
|
||||
EnforcePrecondition(false, diag_offset <= 1 ||
|
||||
(::TileX(from) == ::TileX(tile) && ::TileX(tile) == ::TileX(to)) ||
|
||||
|
@@ -293,7 +293,6 @@ public:
|
||||
|
||||
/**
|
||||
* Get all RailTracks on the given tile.
|
||||
* @note A depot has no railtracks.
|
||||
* @param tile The tile to check.
|
||||
* @pre IsRailTile(tile).
|
||||
* @return A bitmask of RailTrack with all RailTracks on the tile.
|
||||
|
@@ -5,18 +5,12 @@
|
||||
#include "ai_road.hpp"
|
||||
#include "ai_map.hpp"
|
||||
#include "ai_station.hpp"
|
||||
#include "ai_cargo.hpp"
|
||||
#include "../../station_map.h"
|
||||
#include "../../command_type.h"
|
||||
#include "../../settings_type.h"
|
||||
#include "../../company_func.h"
|
||||
#include "../../script/squirrel_helper_type.hpp"
|
||||
|
||||
/* static */ AIRoad::RoadVehicleType AIRoad::GetRoadVehicleTypeForCargo(CargoID cargo_type)
|
||||
{
|
||||
return AICargo::HasCargoClass(cargo_type, AICargo::CC_PASSENGERS) ? ROADVEHTYPE_BUS : ROADVEHTYPE_TRUCK;
|
||||
}
|
||||
|
||||
/* static */ bool AIRoad::IsRoadTile(TileIndex tile)
|
||||
{
|
||||
if (!::IsValidTile(tile)) return false;
|
||||
@@ -401,7 +395,7 @@ static bool NormaliseTileOffset(int32 *tile)
|
||||
static bool NeighbourHasReachableRoad(::RoadTypes rts, TileIndex start_tile, DiagDirection neighbour)
|
||||
{
|
||||
TileIndex neighbour_tile = ::TileAddByDiagDir(start_tile, neighbour);
|
||||
if ((rts & ::GetRoadTypes(neighbour_tile)) == 0) return false;
|
||||
if ((rts & ::GetRoadTypes(neighbour_tile)) == 0) return false;
|
||||
|
||||
switch (::GetTileType(neighbour_tile)) {
|
||||
case MP_ROAD:
|
||||
|
@@ -56,14 +56,6 @@ public:
|
||||
ROADVEHTYPE_TRUCK, //!< Build objects useable for trucks and cargo trams
|
||||
};
|
||||
|
||||
/**
|
||||
* Determines whether a busstop or a truckstop is needed to transport a certain cargo.
|
||||
* @param cargo_type The cargo to test.
|
||||
* @pre AICargo::IsValidCargo(cargo_type).
|
||||
* @return The road vehicle type needed to transport the cargo.
|
||||
*/
|
||||
static RoadVehicleType GetRoadVehicleTypeForCargo(CargoID cargo_type);
|
||||
|
||||
/**
|
||||
* Checks whether the given tile is actually a tile with road that can be
|
||||
* used to traverse a tile. This excludes road depots and 'normal' road
|
||||
|
@@ -46,7 +46,6 @@ void SQAIRoad_Register(Squirrel *engine) {
|
||||
AIError::RegisterErrorMapString(AIRoad::ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD, "ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD");
|
||||
AIError::RegisterErrorMapString(AIRoad::ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS, "ERR_ROAD_ONE_WAY_ROADS_CANNOT_HAVE_JUNCTIONS");
|
||||
|
||||
SQAIRoad.DefSQStaticMethod(engine, &AIRoad::GetRoadVehicleTypeForCargo, "GetRoadVehicleTypeForCargo", 2, ".i");
|
||||
SQAIRoad.DefSQStaticMethod(engine, &AIRoad::IsRoadTile, "IsRoadTile", 2, ".i");
|
||||
SQAIRoad.DefSQStaticMethod(engine, &AIRoad::IsRoadDepotTile, "IsRoadDepotTile", 2, ".i");
|
||||
SQAIRoad.DefSQStaticMethod(engine, &AIRoad::IsRoadStationTile, "IsRoadStationTile", 2, ".i");
|
||||
|
@@ -30,7 +30,6 @@ public:
|
||||
|
||||
/**
|
||||
* Gets the maximum sign index; there are no valid signs with a higher index.
|
||||
* @deprecated This function is deprecated and might be removed in future versions of the API. Use AISignList() instead.
|
||||
* @return The maximum sign index.
|
||||
* @post Return value is always non-negative.
|
||||
*/
|
||||
|
@@ -1,15 +0,0 @@
|
||||
/* $Id$ */
|
||||
|
||||
/** @file ai_signlist.cpp Implementation of AISignList and friends. */
|
||||
|
||||
#include "ai_signlist.hpp"
|
||||
#include "ai_sign.hpp"
|
||||
#include "../../signs_base.h"
|
||||
|
||||
AISignList::AISignList()
|
||||
{
|
||||
Sign *s;
|
||||
FOR_ALL_SIGNS(s) {
|
||||
if (AISign::IsValidSign(s->index)) this->AddItem(s->index);
|
||||
}
|
||||
}
|
@@ -1,20 +0,0 @@
|
||||
/* $Id$ */
|
||||
|
||||
/** @file ai_signlist.hpp List all the signs of your company. */
|
||||
|
||||
#ifndef AI_SIGNLIST_HPP
|
||||
#define AI_SIGNLIST_HPP
|
||||
|
||||
#include "ai_abstractlist.hpp"
|
||||
|
||||
/**
|
||||
* Create a list of signs your company has created.
|
||||
* @ingroup AIList
|
||||
*/
|
||||
class AISignList : public AIAbstractList {
|
||||
public:
|
||||
static const char *GetClassName() { return "AISignList"; }
|
||||
AISignList();
|
||||
};
|
||||
|
||||
#endif /* AI_SIGNLIST_HPP */
|
@@ -1,21 +0,0 @@
|
||||
/* $Id$ */
|
||||
/* THIS FILE IS AUTO-GENERATED; PLEASE DO NOT ALTER MANUALLY */
|
||||
|
||||
#include "ai_signlist.hpp"
|
||||
|
||||
namespace SQConvert {
|
||||
/* Allow AISignList to be used as Squirrel parameter */
|
||||
template <> AISignList *GetParam(ForceType<AISignList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AISignList *)instance; }
|
||||
template <> AISignList &GetParam(ForceType<AISignList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AISignList *)instance; }
|
||||
template <> const AISignList *GetParam(ForceType<const AISignList *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AISignList *)instance; }
|
||||
template <> const AISignList &GetParam(ForceType<const AISignList &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AISignList *)instance; }
|
||||
template <> int Return<AISignList *>(HSQUIRRELVM vm, AISignList *res) { if (res == NULL) { sq_pushnull(vm); return 1; } res->AddRef(); Squirrel::CreateClassInstanceVM(vm, "AISignList", res, NULL, DefSQDestructorCallback<AISignList>); return 1; }
|
||||
}; // namespace SQConvert
|
||||
|
||||
void SQAISignList_Register(Squirrel *engine) {
|
||||
DefSQClass <AISignList> SQAISignList("AISignList");
|
||||
SQAISignList.PreRegister(engine, "AIAbstractList");
|
||||
SQAISignList.AddConstructor<void (AISignList::*)(), 1>(engine, "x");
|
||||
|
||||
SQAISignList.PostRegister(engine);
|
||||
}
|
@@ -49,10 +49,6 @@ public:
|
||||
STATION_ANY = 0x1F, //!< All station types
|
||||
};
|
||||
|
||||
/**
|
||||
* Special station IDs for building adjacent/new stations when
|
||||
* the adjacent/distant join features are enabled.
|
||||
*/
|
||||
enum SpecialStationIDs {
|
||||
STATION_NEW = 0xFFFD, //!< Build a new station
|
||||
STATION_JOIN_ADJACENT = 0xFFFE, //!< Join an neighbouring station if one exists
|
||||
|
@@ -8,7 +8,7 @@
|
||||
bool AITestMode::ModeProc(TileIndex tile, uint32 p1, uint32 p2, uint procc, CommandCost costs)
|
||||
{
|
||||
/* In test mode we only return 'false', telling the DoCommand it
|
||||
* should stop after testing the command and return with that result. */
|
||||
* should stop after testing the command and return with that result. */
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -11,7 +11,6 @@
|
||||
#include "../../water_map.h"
|
||||
#include "../../clear_map.h"
|
||||
#include "../../town.h"
|
||||
#include "../../landscape.h"
|
||||
|
||||
/* static */ bool AITile::IsBuildable(TileIndex tile)
|
||||
{
|
||||
@@ -73,14 +72,14 @@
|
||||
|
||||
/* static */ bool AITile::IsSteepSlope(Slope slope)
|
||||
{
|
||||
if ((slope & ~(SLOPE_ELEVATED | SLOPE_STEEP | SLOPE_HALFTILE_MASK)) != 0) return false;
|
||||
if (slope == SLOPE_INVALID) return false;
|
||||
|
||||
return ::IsSteepSlope((::Slope)slope);
|
||||
}
|
||||
|
||||
/* static */ bool AITile::IsHalftileSlope(Slope slope)
|
||||
{
|
||||
if ((slope & ~(SLOPE_ELEVATED | SLOPE_STEEP | SLOPE_HALFTILE_MASK)) != 0) return false;
|
||||
if (slope == SLOPE_INVALID) return false;
|
||||
|
||||
return ::IsHalftileSlope((::Slope)slope);
|
||||
}
|
||||
@@ -124,41 +123,20 @@
|
||||
|
||||
/* static */ AITile::Slope AITile::GetComplementSlope(Slope slope)
|
||||
{
|
||||
if ((slope & ~SLOPE_ELEVATED) != 0) return SLOPE_INVALID;
|
||||
if (slope == SLOPE_INVALID) return SLOPE_INVALID;
|
||||
if (IsSteepSlope(slope)) return SLOPE_INVALID;
|
||||
if (IsHalftileSlope(slope)) return SLOPE_INVALID;
|
||||
|
||||
return (Slope)::ComplementSlope((::Slope)slope);
|
||||
}
|
||||
|
||||
/* static */ int32 AITile::GetHeight(TileIndex tile)
|
||||
{
|
||||
if (!::IsValidTile(tile)) return -1;
|
||||
if (!::IsValidTile(tile)) return false;
|
||||
|
||||
return ::TileHeight(tile);
|
||||
}
|
||||
|
||||
/* static */ int32 AITile::GetMinHeight(TileIndex tile)
|
||||
{
|
||||
if (!::IsValidTile(tile)) return -1;
|
||||
|
||||
return ::GetTileZ(tile) / ::TILE_HEIGHT;
|
||||
}
|
||||
|
||||
/* static */ int32 AITile::GetMaxHeight(TileIndex tile)
|
||||
{
|
||||
if (!::IsValidTile(tile)) return -1;
|
||||
|
||||
return ::GetTileMaxZ(tile) / ::TILE_HEIGHT;
|
||||
}
|
||||
|
||||
/* static */ int32 AITile::GetCornerHeight(TileIndex tile, Corner corner)
|
||||
{
|
||||
if (!::IsValidTile(tile) || !::IsValidCorner((::Corner)corner)) return -1;
|
||||
|
||||
uint z;
|
||||
::Slope slope = ::GetTileSlope(tile, &z);
|
||||
return (z + ::GetSlopeZInCorner(slope, (::Corner)corner)) / ::TILE_HEIGHT;
|
||||
}
|
||||
|
||||
/* static */ AICompany::CompanyID AITile::GetOwner(TileIndex tile)
|
||||
{
|
||||
if (!::IsValidTile(tile)) return AICompany::COMPANY_INVALID;
|
||||
|
@@ -29,28 +29,10 @@ public:
|
||||
|
||||
/** Tile can't be lowered any lower */
|
||||
ERR_TILE_TOO_LOW, // [STR_1003_ALREADY_AT_SEA_LEVEL]
|
||||
|
||||
/** The area was already flat */
|
||||
ERR_AREA_ALREADY_FLAT, // [STR_ALREADY_LEVELLED]
|
||||
|
||||
/** There is a tunnel underneed */
|
||||
ERR_EXCAVATION_WOULD_DAMAGE, // [STR_1002_EXCAVATION_WOULD_DAMAGE]
|
||||
};
|
||||
|
||||
/**
|
||||
* Enumeration for corners of tiles.
|
||||
*/
|
||||
enum Corner {
|
||||
CORNER_W = 0, //!< West corner
|
||||
CORNER_S = 1, //!< South corner
|
||||
CORNER_E = 2, //!< East corner
|
||||
CORNER_N = 3, //!< North corner
|
||||
|
||||
CORNER_INVALID = 0xFF,
|
||||
};
|
||||
|
||||
/**
|
||||
* Enumeration for the slope-type.
|
||||
* Enumeration for the slope-type (from slopes.h).
|
||||
*
|
||||
* This enumeration use the chars N, E, S, W corresponding the
|
||||
* direction North, East, South and West. The top corner of a tile
|
||||
@@ -59,18 +41,18 @@ public:
|
||||
enum Slope {
|
||||
/* Values are important, as they represent the internal state of the game. */
|
||||
SLOPE_FLAT = 0x00, //!< A flat tile
|
||||
SLOPE_W = 1 << CORNER_W, //!< The west corner of the tile is raised
|
||||
SLOPE_S = 1 << CORNER_S, //!< The south corner of the tile is raised
|
||||
SLOPE_E = 1 << CORNER_E, //!< The east corner of the tile is raised
|
||||
SLOPE_N = 1 << CORNER_N, //!< The north corner of the tile is raised
|
||||
SLOPE_STEEP = 0x10, //!< Indicates the slope is steep (The corner opposite of the not-raised corner is raised two times)
|
||||
SLOPE_W = 0x01, //!< The west corner of the tile is raised
|
||||
SLOPE_S = 0x02, //!< The south corner of the tile is raised
|
||||
SLOPE_E = 0x04, //!< The east corner of the tile is raised
|
||||
SLOPE_N = 0x08, //!< The north corner of the tile is raised
|
||||
SLOPE_STEEP = 0x10, //!< Indicates the slope is steep
|
||||
SLOPE_NW = SLOPE_N | SLOPE_W, //!< North and west corner are raised
|
||||
SLOPE_SW = SLOPE_S | SLOPE_W, //!< South and west corner are raised
|
||||
SLOPE_SE = SLOPE_S | SLOPE_E, //!< South and east corner are raised
|
||||
SLOPE_NE = SLOPE_N | SLOPE_E, //!< North and east corner are raised
|
||||
SLOPE_EW = SLOPE_E | SLOPE_W, //!< East and west corner are raised
|
||||
SLOPE_NS = SLOPE_N | SLOPE_S, //!< North and south corner are raised
|
||||
SLOPE_ELEVATED = SLOPE_N | SLOPE_E | SLOPE_S | SLOPE_W, //!< Bit mask containing all 'simple' slopes. Does not appear as a slope.
|
||||
SLOPE_ELEVATED = SLOPE_N | SLOPE_E | SLOPE_S | SLOPE_W, //!< All corner are raised, similar to SLOPE_FLAT
|
||||
SLOPE_NWS = SLOPE_N | SLOPE_W | SLOPE_S, //!< North, west and south corner are raised
|
||||
SLOPE_WSE = SLOPE_W | SLOPE_S | SLOPE_E, //!< West, south and east corner are raised
|
||||
SLOPE_SEN = SLOPE_S | SLOPE_E | SLOPE_N, //!< South, east and north corner are raised
|
||||
@@ -80,7 +62,7 @@ public:
|
||||
SLOPE_STEEP_E = SLOPE_STEEP | SLOPE_SEN, //!< A steep slope falling to west (from east)
|
||||
SLOPE_STEEP_N = SLOPE_STEEP | SLOPE_ENW, //!< A steep slope falling to south (from north)
|
||||
|
||||
SLOPE_INVALID = 0xFFFF, //!< An invalid slope
|
||||
SLOPE_INVALID = 0xFF, //!< An invalid slope
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -147,7 +129,6 @@ public:
|
||||
|
||||
/**
|
||||
* Check if a tile has a steep slope.
|
||||
* Steep slopes are slopes with a height difference of 2 across one diagonal of the tile.
|
||||
* @param slope The slope to check on.
|
||||
* @pre slope != SLOPE_INVALID.
|
||||
* @return True if the slope is a steep slope.
|
||||
@@ -156,11 +137,9 @@ public:
|
||||
|
||||
/**
|
||||
* Check if a tile has a halftile slope.
|
||||
* Halftile slopes appear on top of halftile foundations. E.g. the slope you get when building a horizontal railtrack on the top of a SLOPE_N or SLOPE_STEEP_N.
|
||||
* @param slope The slope to check on.
|
||||
* @pre slope != SLOPE_INVALID.
|
||||
* @return True if the slope is a halftile slope.
|
||||
* @note Currently there is no API function that would return or accept a halftile slope.
|
||||
*/
|
||||
static bool IsHalftileSlope(Slope slope);
|
||||
|
||||
@@ -214,10 +193,9 @@ public:
|
||||
|
||||
/**
|
||||
* Get the slope of a tile.
|
||||
* This is the slope of the bare tile. A possible foundation on the tile does not influence this slope.
|
||||
* @param tile The tile to check on.
|
||||
* @pre AIMap::IsValidTile(tile).
|
||||
* @return Bit mask encoding the slope. See #Slope for a description of the returned values.
|
||||
* @return 0 means flat, others indicate internal state of slope.
|
||||
*/
|
||||
static Slope GetSlope(TileIndex tile);
|
||||
|
||||
@@ -233,43 +211,13 @@ public:
|
||||
static Slope GetComplementSlope(Slope slope);
|
||||
|
||||
/**
|
||||
* Get the height of the north corner of a tile.
|
||||
* The returned height is the height of the bare tile. A possible foundation on the tile does not influence this height.
|
||||
* @deprecated This function is deprecated and might be removed in future versions of the API. Use GetMinHeight(), GetMaxHeight() or GetCornerHeight() instead.
|
||||
* Get the height of the tile.
|
||||
* @param tile The tile to check on.
|
||||
* @pre AIMap::IsValidTile(tile).
|
||||
* @return The height of the north corner of the tile, ranging from 0 to 15.
|
||||
* @return The height of the tile, ranging from 0 to 15.
|
||||
*/
|
||||
static int32 GetHeight(TileIndex tile);
|
||||
|
||||
/**
|
||||
* Get the minimal height on a tile.
|
||||
* The returned height is the height of the bare tile. A possible foundation on the tile does not influence this height.
|
||||
* @param tile The tile to check on.
|
||||
* @pre AIMap::IsValidTile(tile).
|
||||
* @return The height of the lowest corner of the tile, ranging from 0 to 15.
|
||||
*/
|
||||
static int32 GetMinHeight(TileIndex tile);
|
||||
|
||||
/**
|
||||
* Get the maximal height on a tile.
|
||||
* The returned height is the height of the bare tile. A possible foundation on the tile does not influence this height.
|
||||
* @param tile The tile to check on.
|
||||
* @pre AIMap::IsValidTile(tile).
|
||||
* @return The height of the highest corner of the tile, ranging from 0 to 15.
|
||||
*/
|
||||
static int32 GetMaxHeight(TileIndex tile);
|
||||
|
||||
/**
|
||||
* Get the height of a certain corner of a tile.
|
||||
* The returned height is the height of the bare tile. A possible foundation on the tile does not influence this height.
|
||||
* @param tile The tile to check on.
|
||||
* @param corner The corner to query.
|
||||
* @pre AIMap::IsValidTile(tile).
|
||||
* @return The height of the lowest corner of the tile, ranging from 0 to 15.
|
||||
*/
|
||||
static int32 GetCornerHeight(TileIndex tile, Corner corner);
|
||||
|
||||
/**
|
||||
* Get the owner of the tile.
|
||||
* @param tile The tile to get the owner from.
|
||||
@@ -340,10 +288,7 @@ public:
|
||||
|
||||
/**
|
||||
* Raise the given corners of the tile. The corners can be combined,
|
||||
* for example: SLOPE_N | SLOPE_W (= SLOPE_NW) will raise the west and the north corner.
|
||||
* @note The corners will be modified in the order west (first), south, east, north (last).
|
||||
* Changing one corner might cause another corner to be changed too. So modifiing
|
||||
* multiple corners may result in changing some corners by multiple steps.
|
||||
* for example: SLOPE_N | SLOPE_W (= SLOPE_NW)
|
||||
* @param tile The tile to raise.
|
||||
* @param slope Corners to raise (SLOPE_xxx).
|
||||
* @pre tile < AIMap::GetMapSize().
|
||||
@@ -356,10 +301,7 @@ public:
|
||||
|
||||
/**
|
||||
* Lower the given corners of the tile. The corners can be combined,
|
||||
* for example: SLOPE_N | SLOPE_W (= SLOPE_NW) will lower the west and the north corner.
|
||||
* @note The corners will be modified in the order west (first), south, east, north (last).
|
||||
* Changing one corner might cause another corner to be changed too. So modifiing
|
||||
* multiple corners may result in changing some corners by multiple steps.
|
||||
* for example: SLOPE_N | SLOPE_W (= SLOPE_NW)
|
||||
* @param tile The tile to lower.
|
||||
* @param slope Corners to lower (SLOPE_xxx).
|
||||
* @pre tile < AIMap::GetMapSize().
|
||||
|
@@ -7,8 +7,6 @@ namespace SQConvert {
|
||||
/* Allow enums to be used as Squirrel parameters */
|
||||
template <> AITile::ErrorMessages GetParam(ForceType<AITile::ErrorMessages>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AITile::ErrorMessages)tmp; }
|
||||
template <> int Return<AITile::ErrorMessages>(HSQUIRRELVM vm, AITile::ErrorMessages res) { sq_pushinteger(vm, (int32)res); return 1; }
|
||||
template <> AITile::Corner GetParam(ForceType<AITile::Corner>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AITile::Corner)tmp; }
|
||||
template <> int Return<AITile::Corner>(HSQUIRRELVM vm, AITile::Corner res) { sq_pushinteger(vm, (int32)res); return 1; }
|
||||
template <> AITile::Slope GetParam(ForceType<AITile::Slope>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AITile::Slope)tmp; }
|
||||
template <> int Return<AITile::Slope>(HSQUIRRELVM vm, AITile::Slope res) { sq_pushinteger(vm, (int32)res); return 1; }
|
||||
template <> AITile::TransportType GetParam(ForceType<AITile::TransportType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AITile::TransportType)tmp; }
|
||||
@@ -27,53 +25,42 @@ void SQAITile_Register(Squirrel *engine) {
|
||||
SQAITile.PreRegister(engine);
|
||||
SQAITile.AddConstructor<void (AITile::*)(), 1>(engine, "x");
|
||||
|
||||
SQAITile.DefSQConst(engine, AITile::ERR_TILE_BASE, "ERR_TILE_BASE");
|
||||
SQAITile.DefSQConst(engine, AITile::ERR_TILE_TOO_HIGH, "ERR_TILE_TOO_HIGH");
|
||||
SQAITile.DefSQConst(engine, AITile::ERR_TILE_TOO_LOW, "ERR_TILE_TOO_LOW");
|
||||
SQAITile.DefSQConst(engine, AITile::ERR_AREA_ALREADY_FLAT, "ERR_AREA_ALREADY_FLAT");
|
||||
SQAITile.DefSQConst(engine, AITile::ERR_EXCAVATION_WOULD_DAMAGE, "ERR_EXCAVATION_WOULD_DAMAGE");
|
||||
SQAITile.DefSQConst(engine, AITile::CORNER_W, "CORNER_W");
|
||||
SQAITile.DefSQConst(engine, AITile::CORNER_S, "CORNER_S");
|
||||
SQAITile.DefSQConst(engine, AITile::CORNER_E, "CORNER_E");
|
||||
SQAITile.DefSQConst(engine, AITile::CORNER_N, "CORNER_N");
|
||||
SQAITile.DefSQConst(engine, AITile::CORNER_INVALID, "CORNER_INVALID");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_FLAT, "SLOPE_FLAT");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_W, "SLOPE_W");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_S, "SLOPE_S");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_E, "SLOPE_E");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_N, "SLOPE_N");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_STEEP, "SLOPE_STEEP");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_NW, "SLOPE_NW");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_SW, "SLOPE_SW");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_SE, "SLOPE_SE");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_NE, "SLOPE_NE");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_EW, "SLOPE_EW");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_NS, "SLOPE_NS");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_ELEVATED, "SLOPE_ELEVATED");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_NWS, "SLOPE_NWS");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_WSE, "SLOPE_WSE");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_SEN, "SLOPE_SEN");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_ENW, "SLOPE_ENW");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_STEEP_W, "SLOPE_STEEP_W");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_STEEP_S, "SLOPE_STEEP_S");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_STEEP_E, "SLOPE_STEEP_E");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_STEEP_N, "SLOPE_STEEP_N");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_INVALID, "SLOPE_INVALID");
|
||||
SQAITile.DefSQConst(engine, AITile::TRANSPORT_RAIL, "TRANSPORT_RAIL");
|
||||
SQAITile.DefSQConst(engine, AITile::TRANSPORT_ROAD, "TRANSPORT_ROAD");
|
||||
SQAITile.DefSQConst(engine, AITile::TRANSPORT_WATER, "TRANSPORT_WATER");
|
||||
SQAITile.DefSQConst(engine, AITile::TRANSPORT_AIR, "TRANSPORT_AIR");
|
||||
SQAITile.DefSQConst(engine, AITile::TRANSPORT_INVALID, "TRANSPORT_INVALID");
|
||||
SQAITile.DefSQConst(engine, AITile::ERR_TILE_BASE, "ERR_TILE_BASE");
|
||||
SQAITile.DefSQConst(engine, AITile::ERR_TILE_TOO_HIGH, "ERR_TILE_TOO_HIGH");
|
||||
SQAITile.DefSQConst(engine, AITile::ERR_TILE_TOO_LOW, "ERR_TILE_TOO_LOW");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_FLAT, "SLOPE_FLAT");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_W, "SLOPE_W");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_S, "SLOPE_S");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_E, "SLOPE_E");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_N, "SLOPE_N");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_STEEP, "SLOPE_STEEP");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_NW, "SLOPE_NW");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_SW, "SLOPE_SW");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_SE, "SLOPE_SE");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_NE, "SLOPE_NE");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_EW, "SLOPE_EW");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_NS, "SLOPE_NS");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_ELEVATED, "SLOPE_ELEVATED");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_NWS, "SLOPE_NWS");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_WSE, "SLOPE_WSE");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_SEN, "SLOPE_SEN");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_ENW, "SLOPE_ENW");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_STEEP_W, "SLOPE_STEEP_W");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_STEEP_S, "SLOPE_STEEP_S");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_STEEP_E, "SLOPE_STEEP_E");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_STEEP_N, "SLOPE_STEEP_N");
|
||||
SQAITile.DefSQConst(engine, AITile::SLOPE_INVALID, "SLOPE_INVALID");
|
||||
SQAITile.DefSQConst(engine, AITile::TRANSPORT_RAIL, "TRANSPORT_RAIL");
|
||||
SQAITile.DefSQConst(engine, AITile::TRANSPORT_ROAD, "TRANSPORT_ROAD");
|
||||
SQAITile.DefSQConst(engine, AITile::TRANSPORT_WATER, "TRANSPORT_WATER");
|
||||
SQAITile.DefSQConst(engine, AITile::TRANSPORT_AIR, "TRANSPORT_AIR");
|
||||
SQAITile.DefSQConst(engine, AITile::TRANSPORT_INVALID, "TRANSPORT_INVALID");
|
||||
|
||||
AIError::RegisterErrorMap(STR_1003_ALREADY_AT_SEA_LEVEL, AITile::ERR_TILE_TOO_HIGH);
|
||||
AIError::RegisterErrorMap(STR_1003_ALREADY_AT_SEA_LEVEL, AITile::ERR_TILE_TOO_LOW);
|
||||
AIError::RegisterErrorMap(STR_ALREADY_LEVELLED, AITile::ERR_AREA_ALREADY_FLAT);
|
||||
AIError::RegisterErrorMap(STR_1002_EXCAVATION_WOULD_DAMAGE, AITile::ERR_EXCAVATION_WOULD_DAMAGE);
|
||||
AIError::RegisterErrorMap(STR_1003_ALREADY_AT_SEA_LEVEL, AITile::ERR_TILE_TOO_HIGH);
|
||||
AIError::RegisterErrorMap(STR_1003_ALREADY_AT_SEA_LEVEL, AITile::ERR_TILE_TOO_LOW);
|
||||
|
||||
AIError::RegisterErrorMapString(AITile::ERR_TILE_TOO_HIGH, "ERR_TILE_TOO_HIGH");
|
||||
AIError::RegisterErrorMapString(AITile::ERR_TILE_TOO_LOW, "ERR_TILE_TOO_LOW");
|
||||
AIError::RegisterErrorMapString(AITile::ERR_AREA_ALREADY_FLAT, "ERR_AREA_ALREADY_FLAT");
|
||||
AIError::RegisterErrorMapString(AITile::ERR_EXCAVATION_WOULD_DAMAGE, "ERR_EXCAVATION_WOULD_DAMAGE");
|
||||
AIError::RegisterErrorMapString(AITile::ERR_TILE_TOO_HIGH, "ERR_TILE_TOO_HIGH");
|
||||
AIError::RegisterErrorMapString(AITile::ERR_TILE_TOO_LOW, "ERR_TILE_TOO_LOW");
|
||||
|
||||
SQAITile.DefSQStaticMethod(engine, &AITile::IsBuildable, "IsBuildable", 2, ".i");
|
||||
SQAITile.DefSQStaticMethod(engine, &AITile::IsBuildableRectangle, "IsBuildableRectangle", 4, ".iii");
|
||||
@@ -91,9 +78,6 @@ void SQAITile_Register(Squirrel *engine) {
|
||||
SQAITile.DefSQStaticMethod(engine, &AITile::GetSlope, "GetSlope", 2, ".i");
|
||||
SQAITile.DefSQStaticMethod(engine, &AITile::GetComplementSlope, "GetComplementSlope", 2, ".i");
|
||||
SQAITile.DefSQStaticMethod(engine, &AITile::GetHeight, "GetHeight", 2, ".i");
|
||||
SQAITile.DefSQStaticMethod(engine, &AITile::GetMinHeight, "GetMinHeight", 2, ".i");
|
||||
SQAITile.DefSQStaticMethod(engine, &AITile::GetMaxHeight, "GetMaxHeight", 2, ".i");
|
||||
SQAITile.DefSQStaticMethod(engine, &AITile::GetCornerHeight, "GetCornerHeight", 3, ".ii");
|
||||
SQAITile.DefSQStaticMethod(engine, &AITile::GetOwner, "GetOwner", 2, ".i");
|
||||
SQAITile.DefSQStaticMethod(engine, &AITile::HasTransportType, "HasTransportType", 3, ".ii");
|
||||
SQAITile.DefSQStaticMethod(engine, &AITile::GetCargoAcceptance, "GetCargoAcceptance", 6, ".iiiii");
|
||||
|
@@ -23,26 +23,14 @@
|
||||
/* If it's a tunnel alread, take the easy way out! */
|
||||
if (IsTunnelTile(tile)) return ::GetOtherTunnelEnd(tile);
|
||||
|
||||
uint start_z;
|
||||
Slope start_tileh = ::GetTileSlope(tile, &start_z);
|
||||
DiagDirection direction = ::GetInclinedSlopeDirection(start_tileh);
|
||||
if (direction == INVALID_DIAGDIR) return INVALID_TILE;
|
||||
|
||||
TileIndexDiff delta = ::TileOffsByDiagDir(direction);
|
||||
uint end_z;
|
||||
do {
|
||||
tile += delta;
|
||||
if (!::IsValidTile(tile)) return INVALID_TILE;
|
||||
|
||||
::GetTileSlope(tile, &end_z);
|
||||
} while (start_z != end_z);
|
||||
|
||||
return tile;
|
||||
::DoCommand(tile, 0, 0, DC_AUTO, CMD_BUILD_TUNNEL);
|
||||
return _build_tunnel_endtile == 0 ? INVALID_TILE : _build_tunnel_endtile;
|
||||
}
|
||||
|
||||
static void _DoCommandReturnBuildTunnel2(class AIInstance *instance)
|
||||
{
|
||||
if (!AITunnel::_BuildTunnelRoad2()) {
|
||||
AIObject::SetLastCommandRes(false);
|
||||
AIInstance::DoCommandReturn(instance);
|
||||
return;
|
||||
}
|
||||
@@ -55,6 +43,7 @@ static void _DoCommandReturnBuildTunnel2(class AIInstance *instance)
|
||||
static void _DoCommandReturnBuildTunnel1(class AIInstance *instance)
|
||||
{
|
||||
if (!AITunnel::_BuildTunnelRoad1()) {
|
||||
AIObject::SetLastCommandRes(false);
|
||||
AIInstance::DoCommandReturn(instance);
|
||||
return;
|
||||
}
|
||||
@@ -73,7 +62,7 @@ static void _DoCommandReturnBuildTunnel1(class AIInstance *instance)
|
||||
uint type = 0;
|
||||
if (vehicle_type == AIVehicle::VT_ROAD) {
|
||||
type |= (TRANSPORT_ROAD << 9);
|
||||
type |= ::RoadTypeToRoadTypes((::RoadType)AIObject::GetRoadType());
|
||||
type |= RoadTypeToRoadTypes((::RoadType)AIObject::GetRoadType());
|
||||
} else {
|
||||
type |= (TRANSPORT_RAIL << 9);
|
||||
type |= AIRail::GetCurrentRailType();
|
||||
@@ -85,7 +74,10 @@ static void _DoCommandReturnBuildTunnel1(class AIInstance *instance)
|
||||
}
|
||||
|
||||
AIObject::SetCallbackVariable(0, start);
|
||||
return AIObject::DoCommand(start, type, 0, CMD_BUILD_TUNNEL, NULL, &_DoCommandReturnBuildTunnel1);
|
||||
if (!AIObject::DoCommand(start, type, 0, CMD_BUILD_TUNNEL, NULL, &_DoCommandReturnBuildTunnel1)) return false;
|
||||
|
||||
/* In case of test-mode, test if we can build both road pieces */
|
||||
return _BuildTunnelRoad1();
|
||||
}
|
||||
|
||||
/* static */ bool AITunnel::_BuildTunnelRoad1()
|
||||
@@ -97,7 +89,10 @@ static void _DoCommandReturnBuildTunnel1(class AIInstance *instance)
|
||||
DiagDirection dir_1 = (DiagDirection)((::TileX(start) == ::TileX(end)) ? (::TileY(start) < ::TileY(end) ? DIAGDIR_NW : DIAGDIR_SE) : (::TileX(start) < ::TileX(end) ? DIAGDIR_NE : DIAGDIR_SW));
|
||||
DiagDirection dir_2 = ::ReverseDiagDir(dir_1);
|
||||
|
||||
return AIObject::DoCommand(start + ::TileOffsByDiagDir(dir_1), ::DiagDirToRoadBits(dir_2) | (AIObject::GetRoadType() << 4), 0, CMD_BUILD_ROAD, NULL, &_DoCommandReturnBuildTunnel2);
|
||||
if (!AIObject::DoCommand(start + ::TileOffsByDiagDir(dir_1), ::DiagDirToRoadBits(dir_2) | (AIObject::GetRoadType() << 4), 0, CMD_BUILD_ROAD, NULL, &_DoCommandReturnBuildTunnel2)) return false;
|
||||
|
||||
/* In case of test-mode, test the other road piece too */
|
||||
return _BuildTunnelRoad2();
|
||||
}
|
||||
|
||||
/* static */ bool AITunnel::_BuildTunnelRoad2()
|
||||
|
@@ -46,15 +46,11 @@ public:
|
||||
|
||||
/**
|
||||
* Get the tile that exits on the other end of a (would be) tunnel starting
|
||||
* at tile. If there is no 'simple' inclined slope at the start tile,
|
||||
* this function will return AIMap::TILE_INVALID.
|
||||
* at tile.
|
||||
* @param tile The tile that is an entrance to a tunnel or the tile where you may want to build a tunnel.
|
||||
* @pre AIMap::IsValidTile(tile).
|
||||
* @return The TileIndex that is the other end of the (would be) tunnel, or
|
||||
* AIMap::TILE_INVALID if no other end was found (can't build tunnel).
|
||||
* @note Even if this function returns a valid tile, that is no guarantee
|
||||
* that building a tunnel will succeed. Use BuildTunnel in AITestMode to
|
||||
* check whether a tunnel can actually be build.
|
||||
* TILE_INVALID if no other end was found (can't build tunnel).
|
||||
*/
|
||||
static TileIndex GetOtherTunnelEnd(TileIndex tile);
|
||||
|
||||
|
@@ -1,75 +1,6 @@
|
||||
/* $Id$ */
|
||||
|
||||
/** @file ai_types.hpp Defines all the types of the game, like IDs of various objects.
|
||||
*
|
||||
* IDs are used to identify certain objects. They are only unique within the object type, so for example a vehicle may have VehicleID 2009,
|
||||
* while a station has StationID 2009 at the same time. Also IDs are assigned arbitrary, you cannot assume them to be consecutive.
|
||||
* Also note, that some IDs are static and never change, while others are allocated dynamically and might be
|
||||
* reused for other objects once they are released. So be careful, which IDs you store for which purpose and whether they stay valid all the time.
|
||||
*
|
||||
* <table>
|
||||
* <tr><th>type </th><th> object </th>
|
||||
* <th> acquired </th>
|
||||
* <th> released </th>
|
||||
* <th> reused </th></tr>
|
||||
* <tr><td>#BridgeID </td><td> bridge type </td>
|
||||
* <td> introduction \ref newgrf_changes "(1)" </td>
|
||||
* <td> never \ref newgrf_changes "(1)" </td>
|
||||
* <td> no \ref newgrf_changes "(1)" </td></tr>
|
||||
* <tr><td>#CargoID </td><td> cargo type </td>
|
||||
* <td> game start \ref newgrf_changes "(1)" </td>
|
||||
* <td> never \ref newgrf_changes "(1)" </td>
|
||||
* <td> no \ref newgrf_changes "(1)" </td></tr>
|
||||
* <tr><td>#EngineID </td><td> engine type </td>
|
||||
* <td> introduction, preview \ref dynamic_engines "(2)" </td>
|
||||
* <td> engines retires \ref dynamic_engines "(2)" </td>
|
||||
* <td> no \ref dynamic_engines "(2)" </td></tr>
|
||||
* <tr><td>#GroupID </td><td> vehicle group </td>
|
||||
* <td> creation </td>
|
||||
* <td> deletion </td>
|
||||
* <td> yes </td></tr>
|
||||
* <tr><td>#IndustryID </td><td> industry </td>
|
||||
* <td> construction </td>
|
||||
* <td> closure </td>
|
||||
* <td> yes </td></tr>
|
||||
* <tr><td>#IndustryType</td><td> industry type </td>
|
||||
* <td> game start \ref newgrf_changes "(1)" </td>
|
||||
* <td> never \ref newgrf_changes "(1)" </td>
|
||||
* <td> no </td></tr>
|
||||
* <tr><td>#SignID </td><td> sign </td>
|
||||
* <td> construction </td>
|
||||
* <td> deletion </td>
|
||||
* <td> yes </td></tr>
|
||||
* <tr><td>#StationID </td><td> station </td>
|
||||
* <td> construction </td>
|
||||
* <td> expiration of 'grey' station sign after deletion </td>
|
||||
* <td> yes </td></tr>
|
||||
* <tr><td>#SubsidyID </td><td> subsidy </td>
|
||||
* <td> offer announcement </td>
|
||||
* <td> (offer) expiration </td>
|
||||
* <td> yes </td></tr>
|
||||
* <tr><td>#TileIndex </td><td> tile on map </td>
|
||||
* <td> game start </td>
|
||||
* <td> never </td>
|
||||
* <td> no </td></tr>
|
||||
* <tr><td>#TownID </td><td> town </td>
|
||||
* <td> game start </td>
|
||||
* <td> never </td>
|
||||
* <td> no </td></tr>
|
||||
* <tr><td>#VehicleID </td><td> vehicle </td>
|
||||
* <td> construction, autorenew, autoreplace </td>
|
||||
* <td> destruction, autorenew, autoreplace </td>
|
||||
* <td> yes </td></tr>
|
||||
* <tr><td>#WaypointID </td><td> waypoint </td>
|
||||
* <td> construction </td>
|
||||
* <td> destruction </td>
|
||||
* <td> yes </td></tr>
|
||||
* </table>
|
||||
*
|
||||
* @remarks
|
||||
* \li \anchor newgrf_changes (1) in-game changes of newgrfs may reassign/invalidate IDs (will also cause other trouble though).
|
||||
* \li \anchor dynamic_engines (2) engine IDs are reassigned/invalidated on changing 'allow multiple newgrf engine sets' (only allowed as long as no vehicles are built).
|
||||
*/
|
||||
/** @file ai_types.hpp Defines all the types of the game, like VehicleID, .... */
|
||||
|
||||
#ifndef AI_TYPES_HPP
|
||||
#define AI_TYPES_HPP
|
||||
|
@@ -160,13 +160,6 @@
|
||||
return AIObject::DoCommand(0, vehicle_id, 0, GetCmdSendToDepot(::GetVehicle(vehicle_id)));
|
||||
}
|
||||
|
||||
/* static */ bool AIVehicle::SendVehicleToDepotForServicing(VehicleID vehicle_id)
|
||||
{
|
||||
EnforcePrecondition(false, IsValidVehicle(vehicle_id));
|
||||
|
||||
return AIObject::DoCommand(0, vehicle_id, DEPOT_SERVICE, GetCmdSendToDepot(::GetVehicle(vehicle_id)));
|
||||
}
|
||||
|
||||
/* static */ bool AIVehicle::IsInDepot(VehicleID vehicle_id)
|
||||
{
|
||||
if (!IsValidVehicle(vehicle_id)) return false;
|
||||
|
@@ -422,25 +422,14 @@ public:
|
||||
static bool SellWagonChain(VehicleID vehicle_id, int wagon);
|
||||
|
||||
/**
|
||||
* Sends the given vehicle to a depot. If the vehicle has already been
|
||||
* sent to a depot it continues with its normal orders instead.
|
||||
* Sends the given vehicle to a depot.
|
||||
* @param vehicle_id The vehicle to send to a depot.
|
||||
* @pre IsValidVehicle(vehicle_id).
|
||||
* @exception AIVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT
|
||||
* @return True if the current order was changed.
|
||||
* @return True if and only if the vehicle has been sent to a depot.
|
||||
*/
|
||||
static bool SendVehicleToDepot(VehicleID vehicle_id);
|
||||
|
||||
/**
|
||||
* Sends the given vehicle to a depot for servicing. If the vehicle has
|
||||
* already been sent to a depot it continues with its normal orders instead.
|
||||
* @param vehicle_id The vehicle to send to a depot for servicing.
|
||||
* @pre IsValidVehicle(vehicle_id).
|
||||
* @exception AIVehicle::ERR_VEHICLE_CANNOT_SEND_TO_DEPOT
|
||||
* @return True if the current order was changed.
|
||||
*/
|
||||
static bool SendVehicleToDepotForServicing(VehicleID vehicle_id);
|
||||
|
||||
/**
|
||||
* Starts or stops the given vehicle depending on the current state.
|
||||
* @param vehicle_id The vehicle to start/stop.
|
||||
|
@@ -98,48 +98,47 @@ void SQAIVehicle_Register(Squirrel *engine) {
|
||||
AIError::RegisterErrorMapString(AIVehicle::ERR_VEHICLE_IN_FLIGHT, "ERR_VEHICLE_IN_FLIGHT");
|
||||
AIError::RegisterErrorMapString(AIVehicle::ERR_VEHCILE_NO_POWER, "ERR_VEHCILE_NO_POWER");
|
||||
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::IsValidVehicle, "IsValidVehicle", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetNumWagons, "GetNumWagons", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SetName, "SetName", 3, ".is");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetName, "GetName", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetLocation, "GetLocation", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetEngineType, "GetEngineType", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetWagonEngineType, "GetWagonEngineType", 3, ".ii");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetUnitNumber, "GetUnitNumber", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetAge, "GetAge", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetWagonAge, "GetWagonAge", 3, ".ii");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetMaxAge, "GetMaxAge", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetAgeLeft, "GetAgeLeft", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetCurrentSpeed, "GetCurrentSpeed", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetState, "GetState", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetRunningCost, "GetRunningCost", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetProfitThisYear, "GetProfitThisYear", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetProfitLastYear, "GetProfitLastYear", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetCurrentValue, "GetCurrentValue", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetVehicleType, "GetVehicleType", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetRoadType, "GetRoadType", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::IsInDepot, "IsInDepot", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::IsStoppedInDepot, "IsStoppedInDepot", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::BuildVehicle, "BuildVehicle", 3, ".ii");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::CloneVehicle, "CloneVehicle", 4, ".iib");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::MoveWagon, "MoveWagon", 5, ".iiii");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::MoveWagonChain, "MoveWagonChain", 5, ".iiii");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetRefitCapacity, "GetRefitCapacity", 3, ".ii");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::RefitVehicle, "RefitVehicle", 3, ".ii");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SellVehicle, "SellVehicle", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SellWagon, "SellWagon", 3, ".ii");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SellWagonChain, "SellWagonChain", 3, ".ii");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SendVehicleToDepot, "SendVehicleToDepot", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SendVehicleToDepotForServicing, "SendVehicleToDepotForServicing", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::StartStopVehicle, "StartStopVehicle", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SkipToVehicleOrder, "SkipToVehicleOrder", 3, ".ii");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::ReverseVehicle, "ReverseVehicle", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetCapacity, "GetCapacity", 3, ".ii");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetLength, "GetLength", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetCargoLoad, "GetCargoLoad", 3, ".ii");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetGroupID, "GetGroupID", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::IsArticulated, "IsArticulated", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::HasSharedOrders, "HasSharedOrders", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::IsValidVehicle, "IsValidVehicle", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetNumWagons, "GetNumWagons", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SetName, "SetName", 3, ".is");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetName, "GetName", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetLocation, "GetLocation", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetEngineType, "GetEngineType", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetWagonEngineType, "GetWagonEngineType", 3, ".ii");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetUnitNumber, "GetUnitNumber", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetAge, "GetAge", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetWagonAge, "GetWagonAge", 3, ".ii");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetMaxAge, "GetMaxAge", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetAgeLeft, "GetAgeLeft", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetCurrentSpeed, "GetCurrentSpeed", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetState, "GetState", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetRunningCost, "GetRunningCost", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetProfitThisYear, "GetProfitThisYear", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetProfitLastYear, "GetProfitLastYear", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetCurrentValue, "GetCurrentValue", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetVehicleType, "GetVehicleType", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetRoadType, "GetRoadType", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::IsInDepot, "IsInDepot", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::IsStoppedInDepot, "IsStoppedInDepot", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::BuildVehicle, "BuildVehicle", 3, ".ii");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::CloneVehicle, "CloneVehicle", 4, ".iib");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::MoveWagon, "MoveWagon", 5, ".iiii");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::MoveWagonChain, "MoveWagonChain", 5, ".iiii");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetRefitCapacity, "GetRefitCapacity", 3, ".ii");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::RefitVehicle, "RefitVehicle", 3, ".ii");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SellVehicle, "SellVehicle", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SellWagon, "SellWagon", 3, ".ii");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SellWagonChain, "SellWagonChain", 3, ".ii");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SendVehicleToDepot, "SendVehicleToDepot", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::StartStopVehicle, "StartStopVehicle", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::SkipToVehicleOrder, "SkipToVehicleOrder", 3, ".ii");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::ReverseVehicle, "ReverseVehicle", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetCapacity, "GetCapacity", 3, ".ii");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetLength, "GetLength", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetCargoLoad, "GetCargoLoad", 3, ".ii");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::GetGroupID, "GetGroupID", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::IsArticulated, "IsArticulated", 2, ".i");
|
||||
SQAIVehicle.DefSQStaticMethod(engine, &AIVehicle::HasSharedOrders, "HasSharedOrders", 2, ".i");
|
||||
|
||||
SQAIVehicle.PostRegister(engine);
|
||||
}
|
||||
|
@@ -41,7 +41,7 @@ public:
|
||||
static const char *GetClassName() { return "AIVehicleList_SharedOrders"; }
|
||||
|
||||
/**
|
||||
* @param vehicle_id The vehicle that the rest shared orders with.
|
||||
* @param station_id The vehicle that the rest shared orders with.
|
||||
*/
|
||||
AIVehicleList_SharedOrders(VehicleID vehicle_id);
|
||||
};
|
||||
|
@@ -15,11 +15,8 @@ class AIWaypoint : public AIObject {
|
||||
public:
|
||||
static const char *GetClassName() { return "AIWaypoint"; }
|
||||
|
||||
/**
|
||||
* Special waypoint IDs signalling different kinds of waypoints.
|
||||
*/
|
||||
enum SpecialWaypointIDs {
|
||||
WAYPOINT_INVALID = 0xFFFF, //!< An invalid WaypointID.
|
||||
WAYPOINT_INVALID = -1, //!< An invalid WaypointID.
|
||||
};
|
||||
|
||||
/**
|
||||
|
@@ -337,6 +337,24 @@ CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
||||
u->subtype = AIR_SHADOW;
|
||||
u->UpdateDeltaXY(INVALID_DIR);
|
||||
|
||||
if (v->cargo_type != CT_PASSENGERS) {
|
||||
uint16 callback = CALLBACK_FAILED;
|
||||
|
||||
if (HasBit(EngInfo(p1)->callbackmask, CBM_VEHICLE_REFIT_CAPACITY)) {
|
||||
callback = GetVehicleCallback(CBID_VEHICLE_REFIT_CAPACITY, 0, 0, v->engine_type, v);
|
||||
}
|
||||
|
||||
if (callback == CALLBACK_FAILED) {
|
||||
/* Callback failed, or not executed; use the default cargo capacity */
|
||||
v->cargo_cap = AircraftDefaultCargoCapacity(v->cargo_type, avi);
|
||||
} else {
|
||||
v->cargo_cap = callback;
|
||||
}
|
||||
|
||||
/* Set the 'second compartent' capacity to none */
|
||||
u->cargo_cap = 0;
|
||||
}
|
||||
|
||||
v->reliability = e->reliability;
|
||||
v->reliability_spd_dec = e->reliability_spd_dec;
|
||||
v->max_age = e->lifelength * DAYS_IN_LEAP_YEAR;
|
||||
@@ -377,32 +395,10 @@ CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
||||
v->vehicle_flags = 0;
|
||||
if (e->flags & ENGINE_EXCLUSIVE_PREVIEW) SetBit(v->vehicle_flags, VF_BUILT_AS_PROTOTYPE);
|
||||
|
||||
v->InvalidateNewGRFCacheOfChain();
|
||||
|
||||
if (v->cargo_type != CT_PASSENGERS) {
|
||||
uint16 callback = CALLBACK_FAILED;
|
||||
|
||||
if (HasBit(EngInfo(p1)->callbackmask, CBM_VEHICLE_REFIT_CAPACITY)) {
|
||||
callback = GetVehicleCallback(CBID_VEHICLE_REFIT_CAPACITY, 0, 0, v->engine_type, v);
|
||||
}
|
||||
|
||||
if (callback == CALLBACK_FAILED) {
|
||||
/* Callback failed, or not executed; use the default cargo capacity */
|
||||
v->cargo_cap = AircraftDefaultCargoCapacity(v->cargo_type, avi);
|
||||
} else {
|
||||
v->cargo_cap = callback;
|
||||
}
|
||||
|
||||
/* Set the 'second compartent' capacity to none */
|
||||
u->cargo_cap = 0;
|
||||
}
|
||||
|
||||
v->InvalidateNewGRFCacheOfChain();
|
||||
|
||||
UpdateAircraftCache(v);
|
||||
|
||||
VehicleMove(v, false);
|
||||
VehicleMove(u, false);
|
||||
VehiclePositionChanged(v);
|
||||
VehiclePositionChanged(u);
|
||||
|
||||
/* Aircraft with 3 vehicles (chopper)? */
|
||||
if (v->subtype == AIR_HELICOPTER) {
|
||||
@@ -425,14 +421,14 @@ CommandCost CmdBuildAircraft(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
||||
w->UpdateDeltaXY(INVALID_DIR);
|
||||
|
||||
u->SetNext(w);
|
||||
VehicleMove(w, false);
|
||||
VehiclePositionChanged(w);
|
||||
}
|
||||
|
||||
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
|
||||
InvalidateWindowClassesData(WC_AIRCRAFT_LIST, 0);
|
||||
InvalidateWindow(WC_COMPANY, v->owner);
|
||||
if (IsLocalCompany())
|
||||
InvalidateAutoreplaceWindow(v->engine_type, v->group_id); // updates the replace Aircraft window
|
||||
InvalidateAutoreplaceWindow(v->engine_type, v->group_id); //updates the replace Aircraft window
|
||||
|
||||
GetCompany(_current_company)->num_engines[p1]++;
|
||||
}
|
||||
@@ -584,7 +580,6 @@ CommandCost CmdRefitAircraft(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
|
||||
v->cargo_type = new_cid;
|
||||
v->cargo_subtype = new_subtype;
|
||||
v->colourmap = PAL_NONE; // invalidate vehicle colour map
|
||||
v->InvalidateNewGRFCacheOfChain();
|
||||
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
|
||||
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
|
||||
InvalidateWindowClassesData(WC_AIRCRAFT_LIST, 0);
|
||||
@@ -697,7 +692,9 @@ static void HelicopterTickHandler(Vehicle *v)
|
||||
|
||||
u->cur_image = img;
|
||||
|
||||
VehicleMove(u, true);
|
||||
BeginVehicleMove(u);
|
||||
VehiclePositionChanged(u);
|
||||
EndVehicleMove(u);
|
||||
}
|
||||
|
||||
void SetAircraftPosition(Vehicle *v, int x, int y, int z)
|
||||
@@ -709,7 +706,9 @@ void SetAircraftPosition(Vehicle *v, int x, int y, int z)
|
||||
v->cur_image = v->GetImage(v->direction);
|
||||
if (v->subtype == AIR_HELICOPTER) v->Next()->Next()->cur_image = GetRotorImage(v);
|
||||
|
||||
VehicleMove(v, true);
|
||||
BeginVehicleMove(v);
|
||||
VehiclePositionChanged(v);
|
||||
EndVehicleMove(v);
|
||||
|
||||
Vehicle *u = v->Next();
|
||||
|
||||
@@ -722,7 +721,9 @@ void SetAircraftPosition(Vehicle *v, int x, int y, int z)
|
||||
u->z_pos = GetSlopeZ(safe_x, safe_y);
|
||||
u->cur_image = v->cur_image;
|
||||
|
||||
VehicleMove(u, true);
|
||||
BeginVehicleMove(u);
|
||||
VehiclePositionChanged(u);
|
||||
EndVehicleMove(u);
|
||||
|
||||
u = u->Next();
|
||||
if (u != NULL) {
|
||||
@@ -730,7 +731,9 @@ void SetAircraftPosition(Vehicle *v, int x, int y, int z)
|
||||
u->y_pos = y;
|
||||
u->z_pos = z + 5;
|
||||
|
||||
VehicleMove(u, true);
|
||||
BeginVehicleMove(u);
|
||||
VehiclePositionChanged(u);
|
||||
EndVehicleMove(u);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1153,7 +1156,7 @@ static bool AircraftController(Vehicle *v)
|
||||
|
||||
static void HandleCrashedAircraft(Vehicle *v)
|
||||
{
|
||||
v->u.air.crashed_counter += 3;
|
||||
v->u.air.crashed_counter++;
|
||||
|
||||
Station *st = GetTargetAirportIfValid(v);
|
||||
|
||||
@@ -1627,9 +1630,9 @@ static void AircraftEventHandler_Flying(Vehicle *v, const AirportFTAClass *apc)
|
||||
if (apc->flags & (v->subtype == AIR_HELICOPTER ? AirportFTAClass::HELICOPTERS : AirportFTAClass::AIRPLANES) &&
|
||||
st->airport_tile != INVALID_TILE &&
|
||||
(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 */
|
||||
// {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
|
||||
byte landingtype = (v->subtype == AIR_HELICOPTER) ? HELILANDING : LANDING;
|
||||
const AirportFTA *current = apc->layout[v->u.air.pos].next;
|
||||
while (current != NULL) {
|
||||
|
@@ -15,12 +15,12 @@
|
||||
#include "table/strings.h"
|
||||
|
||||
/**
|
||||
* Draw the details for the given vehicle at the position (x, y)
|
||||
*
|
||||
* @param v current vehicle
|
||||
* @param x The x coordinate
|
||||
* @param y The y coordinate
|
||||
*/
|
||||
* Draw the details for the given vehicle at the position (x,y)
|
||||
*
|
||||
* @param v current vehicle
|
||||
* @param x The x coordinate
|
||||
* @param y The y coordinate
|
||||
*/
|
||||
void DrawAircraftDetails(const Vehicle *v, int x, int y)
|
||||
{
|
||||
int y_offset = (v->Next()->cargo_cap != 0) ? -11 : 0;
|
||||
|
@@ -69,8 +69,8 @@ enum {
|
||||
HELIPAD4 = 22
|
||||
};
|
||||
|
||||
/* Movement Blocks on Airports
|
||||
* blocks (eg_airport_flags) */
|
||||
/* Movement Blocks on Airports */
|
||||
/* blocks (eg_airport_flags) */
|
||||
static const uint64
|
||||
TERM1_block = 1ULL << 0,
|
||||
TERM2_block = 1ULL << 1,
|
||||
|
@@ -138,12 +138,12 @@ static const Widget _air_toolbar_widgets[] = {
|
||||
};
|
||||
|
||||
|
||||
static const WindowDesc _air_toolbar_desc(
|
||||
static const WindowDesc _air_toolbar_desc = {
|
||||
WDP_ALIGN_TBR, 22, 64, 36, 64, 36,
|
||||
WC_BUILD_TOOLBAR, WC_NONE,
|
||||
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON | WDF_CONSTRUCTION,
|
||||
_air_toolbar_widgets
|
||||
);
|
||||
_air_toolbar_widgets,
|
||||
};
|
||||
|
||||
void ShowBuildAirToolbar()
|
||||
{
|
||||
@@ -299,12 +299,12 @@ static const Widget _build_airport_picker_widgets[] = {
|
||||
{ WIDGETS_END},
|
||||
};
|
||||
|
||||
static const WindowDesc _build_airport_desc(
|
||||
static const WindowDesc _build_airport_desc = {
|
||||
WDP_AUTO, WDP_AUTO, 148, 240, 148, 240,
|
||||
WC_BUILD_STATION, WC_BUILD_TOOLBAR,
|
||||
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_CONSTRUCTION,
|
||||
_build_airport_picker_widgets
|
||||
);
|
||||
_build_airport_picker_widgets,
|
||||
};
|
||||
|
||||
static void ShowBuildAirportPicker(Window *parent)
|
||||
{
|
||||
|
@@ -6,8 +6,8 @@
|
||||
#define AIRPORT_MOVEMENT_H
|
||||
|
||||
|
||||
/* state machine input struct (from external file, etc.)
|
||||
* Finite sTate mAchine --> FTA */
|
||||
// state machine input struct (from external file, etc.)
|
||||
// Finite sTate mAchine --> FTA
|
||||
struct AirportFTAbuildup {
|
||||
byte position; // the position that an airplane is at
|
||||
byte heading; // the current orders (eg. TAKEOFF, HANGAR, ENDLANDING, etc.)
|
||||
@@ -25,7 +25,7 @@ static const AirportMovingData _airport_moving_data_dummy[] = {
|
||||
{ 96, 0, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} },
|
||||
};
|
||||
|
||||
/* Country Airfield (small) 4x3 */
|
||||
// Country Airfield (small) 4x3
|
||||
static const AirportMovingData _airport_moving_data_country[22] = {
|
||||
{ 53, 3, AMED_EXACTPOS, {DIR_SE} }, // 00 In Hangar
|
||||
{ 53, 27, 0, {DIR_N} }, // 01 Taxi to right outside depot
|
||||
@@ -51,7 +51,7 @@ static const AirportMovingData _airport_moving_data_country[22] = {
|
||||
{ 44, 40, AMED_HELI_LOWER, {DIR_N} }, // 21 Helicopter landing
|
||||
};
|
||||
|
||||
/* Commuter Airfield (small) 5x4 */
|
||||
// Commuter Airfield (small) 5x4
|
||||
static const AirportMovingData _airport_moving_data_commuter[37] = {
|
||||
{ 69, 3, AMED_EXACTPOS, {DIR_SE} }, // 00 In Hangar
|
||||
{ 72, 22, 0, {DIR_N} }, // 01 Taxi to right outside depot
|
||||
@@ -78,7 +78,7 @@ static const AirportMovingData _airport_moving_data_commuter[37] = {
|
||||
{ 1, 6, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 22 Fly around waiting for a landing spot (north-west)
|
||||
{ 193, 6, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 23 Fly around waiting for a landing spot (south-west)
|
||||
{ 225, 81, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 24 Fly around waiting for a landing spot (south)
|
||||
/* Helicopter */
|
||||
// Helicopter
|
||||
{ 80, 0, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 25 Bufferspace before helipad
|
||||
{ 80, 0, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 26 Bufferspace before helipad
|
||||
{ 32, 8, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 27 Get in position for Helipad1
|
||||
@@ -93,7 +93,7 @@ static const AirportMovingData _airport_moving_data_commuter[37] = {
|
||||
{ 56, 8, AMED_EXACTPOS, {DIR_N} }, // pre-helitakeoff helipad 2
|
||||
};
|
||||
|
||||
/* City Airport (large) 6x6 */
|
||||
// City Airport (large) 6x6
|
||||
static const AirportMovingData _airport_moving_data_town[] = {
|
||||
{ 85, 3, AMED_EXACTPOS, {DIR_SE} }, // 00 In Hangar
|
||||
{ 85, 27, 0, {DIR_N} }, // 01 Taxi to right outside depot
|
||||
@@ -111,7 +111,7 @@ static const AirportMovingData _airport_moving_data_town[] = {
|
||||
{ 177, 87, AMED_HOLD | AMED_SLOWTURN, {DIR_N} }, // 13 Fly to landing position in air
|
||||
{ 89, 87, AMED_HOLD | AMED_LAND, {DIR_N} }, // 14 Going down for land
|
||||
{ 20, 87, AMED_NOSPDCLAMP | AMED_BRAKE, {DIR_N} }, // 15 Just landed, brake until end of runway
|
||||
{ 20, 87, 0, {DIR_N} }, // 16 Just landed, turn around and taxi 1 square // NOT USED
|
||||
{ 20, 87, 0, {DIR_N} }, // 16 Just landed, turn around and taxi 1 square /* NOT USED */
|
||||
{ 36, 71, 0, {DIR_N} }, // 17 Taxi from runway to crossing
|
||||
{ 160, 87, AMED_HOLD | AMED_SLOWTURN, {DIR_N} }, // 18 Fly around waiting for a landing spot (north-east)
|
||||
{ 140, 1, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 19 Final approach fix
|
||||
@@ -127,7 +127,7 @@ static const AirportMovingData _airport_moving_data_town[] = {
|
||||
{ -32, 120, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 29 Initial approach fix (east)
|
||||
};
|
||||
|
||||
/* Metropolitan Airport (metropolitan) - 2 runways */
|
||||
// Metropolitan Airport (metropolitan) - 2 runways
|
||||
static const AirportMovingData _airport_moving_data_metropolitan[27] = {
|
||||
{ 85, 3, AMED_EXACTPOS, {DIR_SE} }, // 00 In Hangar
|
||||
{ 85, 27, 0, {DIR_N} }, // 01 Taxi to right outside depot
|
||||
@@ -158,7 +158,7 @@ static const AirportMovingData _airport_moving_data_metropolitan[27] = {
|
||||
{ 15, 54, AMED_HELI_LOWER, {DIR_N} }, // 26 Helicopter landing
|
||||
};
|
||||
|
||||
/* International Airport (international) - 2 runways, 6 terminals, dedicated helipod */
|
||||
// International Airport (international) - 2 runways, 6 terminals, dedicated helipod
|
||||
static const AirportMovingData _airport_moving_data_international[51] = {
|
||||
{ 7, 55, AMED_EXACTPOS, {DIR_SE} }, // 00 In Hangar 1
|
||||
{ 100, 21, AMED_EXACTPOS, {DIR_SE} }, // 01 In Hangar 2
|
||||
@@ -201,7 +201,7 @@ static const AirportMovingData _airport_moving_data_international[51] = {
|
||||
{ 1, 6, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 38 Fly around waiting for a landing spot (north-west)
|
||||
{ 273, 6, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 39 Fly around waiting for a landing spot (south-west)
|
||||
{ 305, 81, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 40 Fly around waiting for a landing spot (south)
|
||||
/* Helicopter */
|
||||
// Helicopter
|
||||
{ 128, 80, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 41 Bufferspace before helipad
|
||||
{ 128, 80, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 42 Bufferspace before helipad
|
||||
{ 96, 71, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 43 Get in position for Helipad1
|
||||
@@ -214,7 +214,7 @@ static const AirportMovingData _airport_moving_data_international[51] = {
|
||||
{ 104, 32, AMED_HELI_LOWER, {DIR_N} }, // 50 Land in HANGAR2_AREA to go to hangar
|
||||
};
|
||||
|
||||
/* Intercontinental Airport - 4 runways, 8 terminals, 2 dedicated helipads */
|
||||
// Intercontinental Airport - 4 runways, 8 terminals, 2 dedicated helipads
|
||||
static const AirportMovingData _airport_moving_data_intercontinental[77] = {
|
||||
{ 7, 87, AMED_EXACTPOS, {DIR_SE} }, // 00 In Hangar 1
|
||||
{ 135, 72, AMED_EXACTPOS, {DIR_SE} }, // 01 In Hangar 2
|
||||
@@ -263,7 +263,7 @@ static const AirportMovingData _airport_moving_data_intercontinental[77] = {
|
||||
{ -200, 88, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 44 Fly around waiting for a landing spot (north-west)
|
||||
{ 56, -168, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 45 Fly around waiting for a landing spot (south-west)
|
||||
{ 312, 88, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 46 Fly around waiting for a landing spot (south)
|
||||
/* Helicopter */
|
||||
// Helicopter
|
||||
{ 96, 40, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 47 Bufferspace before helipad
|
||||
{ 96, 40, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 48 Bufferspace before helipad
|
||||
{ 82, 54, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 49 Get in position for Helipad1
|
||||
@@ -297,7 +297,7 @@ static const AirportMovingData _airport_moving_data_intercontinental[77] = {
|
||||
};
|
||||
|
||||
|
||||
/* Heliport (heliport) */
|
||||
// Heliport (heliport)
|
||||
static const AirportMovingData _airport_moving_data_heliport[9] = {
|
||||
{ 5, 9, AMED_EXACTPOS, {DIR_NE} }, // 0 - At heliport terminal
|
||||
{ 2, 9, AMED_HELI_RAISE, {DIR_N} }, // 1 - Take off (play sound)
|
||||
@@ -310,7 +310,7 @@ static const AirportMovingData _airport_moving_data_heliport[9] = {
|
||||
{ 70, 9, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 8 - Circle #4 (south)
|
||||
};
|
||||
|
||||
/* HeliDepot 2x2 (heliport) */
|
||||
// HeliDepot 2x2 (heliport)
|
||||
static const AirportMovingData _airport_moving_data_helidepot[18] = {
|
||||
{ 24, 4, AMED_EXACTPOS, {DIR_NE} }, // 0 - At depot
|
||||
{ 24, 28, 0, {DIR_N} }, // 1 Taxi to right outside depot
|
||||
@@ -332,7 +332,7 @@ static const AirportMovingData _airport_moving_data_helidepot[18] = {
|
||||
{ 8, 24, AMED_SLOWTURN | AMED_EXACTPOS, {DIR_E} }, // 17 - turn on helipad1 for takeoff
|
||||
};
|
||||
|
||||
/* HeliDepot 2x2 (heliport) */
|
||||
// HeliDepot 2x2 (heliport)
|
||||
static const AirportMovingData _airport_moving_data_helistation[33] = {
|
||||
{ 8, 3, AMED_EXACTPOS, {DIR_SE} }, // 00 In Hangar2
|
||||
{ 8, 22, 0, {DIR_N} }, // 01 outside hangar 2
|
||||
@@ -369,7 +369,7 @@ static const AirportMovingData _airport_moving_data_helistation[33] = {
|
||||
{ 132, -24, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 32 Fly around waiting for a landing spot (north-east)
|
||||
};
|
||||
|
||||
/* Oilrig */
|
||||
// Oilrig
|
||||
static const AirportMovingData _airport_moving_data_oilrig[9] = {
|
||||
{ 31, 9, AMED_EXACTPOS, {DIR_NE} }, // 0 - At oilrig terminal
|
||||
{ 28, 9, AMED_HELI_RAISE, {DIR_N} }, // 1 - Take off (play sound)
|
||||
@@ -406,17 +406,17 @@ static const AirportFTAbuildup _airport_fta_country[] = {
|
||||
{ 4, 255, AIRPORT_BUSY_block, 0 }, { 4, TERM2, 0, 5 }, { 4, HANGAR, 0, 1 }, { 4, TAKEOFF, 0, 6 }, { 4, HELITAKEOFF, 0, 1 },
|
||||
{ 5, 255, AIRPORT_BUSY_block, 0 }, { 5, TERM2, TERM2_block, 3 }, { 5, 0, 0, 4 },
|
||||
{ 6, 0, AIRPORT_BUSY_block, 7 },
|
||||
/* takeoff */
|
||||
// takeoff
|
||||
{ 7, TAKEOFF, AIRPORT_BUSY_block, 8 },
|
||||
{ 8, STARTTAKEOFF, NOTHING_block, 9 },
|
||||
{ 9, ENDTAKEOFF, NOTHING_block, 0 },
|
||||
/* landing */
|
||||
// landing
|
||||
{ 10, FLYING, NOTHING_block, 15 }, { 10, LANDING, 0, 11 }, { 10, HELILANDING, 0, 20 },
|
||||
{ 11, LANDING, AIRPORT_BUSY_block, 12 },
|
||||
{ 12, 0, AIRPORT_BUSY_block, 13 },
|
||||
{ 13, ENDLANDING, AIRPORT_BUSY_block, 14 }, { 13, TERM2, 0, 5 }, { 13, 0, 0, 14 },
|
||||
{ 14, 0, AIRPORT_BUSY_block, 1 },
|
||||
/* In air */
|
||||
// In air
|
||||
{ 15, 0, NOTHING_block, 16 },
|
||||
{ 16, 0, NOTHING_block, 17 },
|
||||
{ 17, 0, NOTHING_block, 18 },
|
||||
@@ -444,31 +444,31 @@ static const AirportFTAbuildup _airport_fta_commuter[] = {
|
||||
{ 9, 255, TAXIWAY_BUSY_block, 9 }, { 9, TAKEOFF, TAXIWAY_BUSY_block, 10 }, { 9, HANGAR, TAXIWAY_BUSY_block, 10 }, { 9, TERM2, TERM2_block, 4 }, { 9, HELIPAD1, HELIPAD1_block, 6 }, { 9, HELITAKEOFF, HELIPAD1_block, 6 }, { 9, TERM1, TAXIWAY_BUSY_block, 8 }, { 9, 0, TAXIWAY_BUSY_block, 10 },
|
||||
{ 10, 255, TAXIWAY_BUSY_block, 10 }, { 10, TERM3, TERM3_block, 5 }, { 10, HELIPAD1, 0, 9 }, { 10, HELIPAD2, HELIPAD2_block, 7 }, { 10, HELITAKEOFF, HELIPAD2_block, 7 }, { 10, TAKEOFF, TAXIWAY_BUSY_block, 1 }, { 10, HANGAR, TAXIWAY_BUSY_block, 1 }, { 10, 0, TAXIWAY_BUSY_block, 9 },
|
||||
{ 11, 0, OUT_WAY_block, 12 },
|
||||
/* takeoff */
|
||||
// takeoff
|
||||
{ 12, TAKEOFF, RUNWAY_IN_OUT_block, 13 },
|
||||
{ 13, 0, RUNWAY_IN_OUT_block, 14 },
|
||||
{ 14, STARTTAKEOFF, RUNWAY_IN_OUT_block, 15 },
|
||||
{ 15, ENDTAKEOFF, NOTHING_block, 0 },
|
||||
/* landing */
|
||||
// landing
|
||||
{ 16, FLYING, NOTHING_block, 21 }, { 16, LANDING, IN_WAY_block, 17 }, { 16, HELILANDING, 0, 25 },
|
||||
{ 17, LANDING, RUNWAY_IN_OUT_block, 18 },
|
||||
{ 18, 0, RUNWAY_IN_OUT_block, 19 },
|
||||
{ 19, 0, RUNWAY_IN_OUT_block, 20 },
|
||||
{ 20, ENDLANDING, IN_WAY_block, 2 },
|
||||
/* In Air */
|
||||
// In Air
|
||||
{ 21, 0, NOTHING_block, 22 },
|
||||
{ 22, 0, NOTHING_block, 23 },
|
||||
{ 23, 0, NOTHING_block, 24 },
|
||||
{ 24, 0, NOTHING_block, 16 },
|
||||
/* Helicopter -- stay in air in special place as a buffer to choose from helipads */
|
||||
// Helicopter -- stay in air in special place as a buffer to choose from helipads
|
||||
{ 25, HELILANDING, PRE_HELIPAD_block, 26 },
|
||||
{ 26, HELIENDLANDING, PRE_HELIPAD_block, 26 }, { 26, HELIPAD1, 0, 27 }, { 26, HELIPAD2, 0, 28 }, { 26, HANGAR, 0, 33 },
|
||||
{ 27, 0, NOTHING_block, 29 }, // helipad1 approach
|
||||
{ 27, 0, NOTHING_block, 29 }, //helipad1 approach
|
||||
{ 28, 0, NOTHING_block, 30 },
|
||||
/* landing */
|
||||
// landing
|
||||
{ 29, 255, NOTHING_block, 0 }, { 29, HELIPAD1, HELIPAD1_block, 6 },
|
||||
{ 30, 255, NOTHING_block, 0 }, { 30, HELIPAD2, HELIPAD2_block, 7 },
|
||||
/* Helicopter -- takeoff */
|
||||
// Helicopter -- takeoff
|
||||
{ 31, HELITAKEOFF, NOTHING_block, 0 },
|
||||
{ 32, HELITAKEOFF, NOTHING_block, 0 },
|
||||
{ 33, 0, TAXIWAY_BUSY_block, 34 }, // need to go to hangar when waiting in air
|
||||
@@ -492,22 +492,22 @@ static const AirportFTAbuildup _airport_fta_city[] = {
|
||||
{ 7, 255, TAXIWAY_BUSY_block, 0 }, { 7, TERM1, TERM1_block, 2 }, { 7, TAKEOFF, OUT_WAY_block, 8 }, { 7, HELITAKEOFF, 0, 22 }, { 7, HANGAR, 0, 1 }, { 7, 0, 0, 6 },
|
||||
{ 8, 0, OUT_WAY_block, 9 },
|
||||
{ 9, 0, RUNWAY_IN_OUT_block, 10 },
|
||||
/* takeoff */
|
||||
// takeoff
|
||||
{ 10, TAKEOFF, RUNWAY_IN_OUT_block, 11 },
|
||||
{ 11, STARTTAKEOFF, NOTHING_block, 12 },
|
||||
{ 12, ENDTAKEOFF, NOTHING_block, 0 },
|
||||
/* landing */
|
||||
// landing
|
||||
{ 13, FLYING, NOTHING_block, 18 }, { 13, LANDING, 0, 14 }, { 13, HELILANDING, 0, 23 },
|
||||
{ 14, LANDING, RUNWAY_IN_OUT_block, 15 },
|
||||
{ 15, 0, RUNWAY_IN_OUT_block, 17 },
|
||||
{ 16, 0, RUNWAY_IN_OUT_block, 17 }, // not used, left for compatibility
|
||||
{ 16, 0, RUNWAY_IN_OUT_block, 17 }, /* not used, left for compatibility */
|
||||
{ 17, ENDLANDING, IN_WAY_block, 7 },
|
||||
/* In Air */
|
||||
// In Air
|
||||
{ 18, 0, NOTHING_block, 25 },
|
||||
{ 19, 0, NOTHING_block, 20 },
|
||||
{ 20, 0, NOTHING_block, 21 },
|
||||
{ 21, 0, NOTHING_block, 13 },
|
||||
/* helicopter */
|
||||
// helicopter
|
||||
{ 22, HELITAKEOFF, NOTHING_block, 0 },
|
||||
{ 23, HELILANDING, IN_WAY_block, 24 },
|
||||
{ 24, HELIENDLANDING, IN_WAY_block, 17 },
|
||||
@@ -533,23 +533,23 @@ static const AirportFTAbuildup _airport_fta_metropolitan[] = {
|
||||
{ 7, 255, TAXIWAY_BUSY_block, 0 }, { 7, TERM1, TERM1_block, 2 }, { 7, TAKEOFF, 0, 8 }, { 7, HELITAKEOFF, 0, 23 }, { 7, HANGAR, 0, 1 }, { 7, 0, 0, 6 },
|
||||
{ 8, 0, OUT_WAY_block, 9 },
|
||||
{ 9, 0, RUNWAY_OUT_block, 10 },
|
||||
/* takeoff */
|
||||
// takeoff
|
||||
{ 10, TAKEOFF, RUNWAY_OUT_block, 11 },
|
||||
{ 11, STARTTAKEOFF, NOTHING_block, 12 },
|
||||
{ 12, ENDTAKEOFF, NOTHING_block, 0 },
|
||||
/* landing */
|
||||
// landing
|
||||
{ 13, FLYING, NOTHING_block, 19 }, { 13, LANDING, 0, 14 }, { 13, HELILANDING, 0, 25 },
|
||||
{ 14, LANDING, RUNWAY_IN_block, 15 },
|
||||
{ 15, 0, RUNWAY_IN_block, 16 },
|
||||
{ 16, 255, RUNWAY_IN_block, 0 }, { 16, ENDLANDING, IN_WAY_block, 17 },
|
||||
{ 17, 255, RUNWAY_OUT_block, 0 }, { 17, ENDLANDING, IN_WAY_block, 18 },
|
||||
{ 18, ENDLANDING, IN_WAY_block, 7 },
|
||||
/* In Air */
|
||||
// In Air
|
||||
{ 19, 0, NOTHING_block, 20 },
|
||||
{ 20, 0, NOTHING_block, 21 },
|
||||
{ 21, 0, NOTHING_block, 22 },
|
||||
{ 22, 0, NOTHING_block, 13 },
|
||||
/* helicopter */
|
||||
// helicopter
|
||||
{ 23, 0, NOTHING_block, 24 },
|
||||
{ 24, HELITAKEOFF, NOTHING_block, 0 },
|
||||
{ 25, HELILANDING, IN_WAY_block, 26 },
|
||||
@@ -590,31 +590,31 @@ static const AirportFTAbuildup _airport_fta_international[] = {
|
||||
{ 25, 255, TERM_GROUP1_block, 0 }, { 25, TERM3, TERM3_block, 6 }, { 25, TAKEOFF, 0, 26 }, { 25, 0, 0, 24 },
|
||||
{ 26, 255, TAXIWAY_BUSY_block, 0 }, { 26, TAKEOFF, 0, 27 }, { 26, 0, 0, 25 },
|
||||
{ 27, 0, OUT_WAY_block, 28 },
|
||||
/* takeoff */
|
||||
// takeoff
|
||||
{ 28, TAKEOFF, OUT_WAY_block, 29 },
|
||||
{ 29, 0, RUNWAY_OUT_block, 30 },
|
||||
{ 30, STARTTAKEOFF, NOTHING_block, 31 },
|
||||
{ 31, ENDTAKEOFF, NOTHING_block, 0 },
|
||||
/* landing */
|
||||
// landing
|
||||
{ 32, FLYING, NOTHING_block, 37 }, { 32, LANDING, 0, 33 }, { 32, HELILANDING, 0, 41 },
|
||||
{ 33, LANDING, RUNWAY_IN_block, 34 },
|
||||
{ 34, 0, RUNWAY_IN_block, 35 },
|
||||
{ 35, 0, RUNWAY_IN_block, 36 },
|
||||
{ 36, ENDLANDING, IN_WAY_block, 36 }, { 36, 255, TERM_GROUP1_block, 0 }, { 36, 255, TERM_GROUP2_ENTER1_block, 1 }, { 36, TERM4, 0, 12 }, { 36, TERM5, 0, 12 }, { 36, TERM6, 0, 12 }, { 36, 0, 0, 2 },
|
||||
/* In Air */
|
||||
// In Air
|
||||
{ 37, 0, NOTHING_block, 38 },
|
||||
{ 38, 0, NOTHING_block, 39 },
|
||||
{ 39, 0, NOTHING_block, 40 },
|
||||
{ 40, 0, NOTHING_block, 32 },
|
||||
/* Helicopter -- stay in air in special place as a buffer to choose from helipads */
|
||||
// Helicopter -- stay in air in special place as a buffer to choose from helipads
|
||||
{ 41, HELILANDING, PRE_HELIPAD_block, 42 },
|
||||
{ 42, HELIENDLANDING, PRE_HELIPAD_block, 42 }, { 42, HELIPAD1, 0, 43 }, { 42, HELIPAD2, 0, 44 }, { 42, HANGAR, 0, 49 },
|
||||
{ 43, 0, NOTHING_block, 45 },
|
||||
{ 44, 0, NOTHING_block, 46 },
|
||||
/* landing */
|
||||
// landing
|
||||
{ 45, 255, NOTHING_block, 0 }, { 45, HELIPAD1, HELIPAD1_block, 10 },
|
||||
{ 46, 255, NOTHING_block, 0 }, { 46, HELIPAD2, HELIPAD2_block, 11 },
|
||||
/* Helicopter -- takeoff */
|
||||
// Helicopter -- takeoff
|
||||
{ 47, HELITAKEOFF, NOTHING_block, 0 },
|
||||
{ 48, HELITAKEOFF, NOTHING_block, 0 },
|
||||
{ 49, 0, HANGAR2_AREA_block, 50 }, // need to go to hangar when waiting in air
|
||||
@@ -622,7 +622,7 @@ static const AirportFTAbuildup _airport_fta_international[] = {
|
||||
{ MAX_ELEMENTS, 0, 0, 0 } // end marker. DO NOT REMOVE
|
||||
};
|
||||
|
||||
/* intercontinental */
|
||||
// intercontinental
|
||||
static const TileIndexDiffC _airport_depots_intercontinental[] = { { 0, 5 }, { 8, 4 } };
|
||||
static const byte _airport_terminal_intercontinental[] = { 2, 4, 4 };
|
||||
static const byte _airport_helipad_intercontinental[] = { 1, 2 };
|
||||
@@ -660,12 +660,12 @@ static const AirportFTAbuildup _airport_fta_intercontinental[] = {
|
||||
{ 29, 255, TERM_GROUP1_block, 0 }, { 29, TERM4, TERM4_block, 7 }, { 29, HANGAR, HANGAR1_AREA_block, 27 }, { 29, TAKEOFF, 0, 30 }, { 29, 0, 0, 28 },
|
||||
{ 30, 0, OUT_WAY_block2, 31 },
|
||||
{ 31, 0, OUT_WAY_block, 32 },
|
||||
/* takeoff */
|
||||
// takeoff
|
||||
{ 32, TAKEOFF, RUNWAY_OUT_block, 33 },
|
||||
{ 33, 0, RUNWAY_OUT_block, 34 },
|
||||
{ 34, STARTTAKEOFF, NOTHING_block, 35 },
|
||||
{ 35, ENDTAKEOFF, NOTHING_block, 0 },
|
||||
/* landing */
|
||||
// landing
|
||||
{ 36, 0, 0, 0 },
|
||||
{ 37, LANDING, RUNWAY_IN_block, 38 },
|
||||
{ 38, 0, RUNWAY_IN_block, 39 },
|
||||
@@ -673,32 +673,32 @@ static const AirportFTAbuildup _airport_fta_intercontinental[] = {
|
||||
{ 40, ENDLANDING, RUNWAY_IN_block, 41 },
|
||||
{ 41, 0, IN_WAY_block, 42 },
|
||||
{ 42, 255, IN_WAY_block, 0 }, { 42, 255, TERM_GROUP1_block, 0 }, { 42, 255, TERM_GROUP1_block, 1 }, { 42, HANGAR, 0, 2 }, { 42, 0, 0, 26 },
|
||||
/* In Air */
|
||||
// In Air
|
||||
{ 43, 0, 0, 44 },
|
||||
{ 44, FLYING, 0, 45 }, { 44, HELILANDING, 0, 47 }, { 44, LANDING, 0, 69 }, { 44, 0, 0, 45 },
|
||||
{ 45, 0, 0, 46 },
|
||||
{ 46, FLYING, 0, 43 }, { 46, LANDING, 0, 76 }, { 46, 0, 0, 43 },
|
||||
/* Helicopter -- stay in air in special place as a buffer to choose from helipads */
|
||||
// Helicopter -- stay in air in special place as a buffer to choose from helipads
|
||||
{ 47, HELILANDING, PRE_HELIPAD_block, 48 },
|
||||
{ 48, HELIENDLANDING, PRE_HELIPAD_block, 48 }, { 48, HELIPAD1, 0, 49 }, { 48, HELIPAD2, 0, 50 }, { 48, HANGAR, 0, 55 },
|
||||
{ 49, 0, NOTHING_block, 51 },
|
||||
{ 50, 0, NOTHING_block, 52 },
|
||||
/* landing */
|
||||
// landing
|
||||
{ 51, 255, NOTHING_block, 0 }, { 51, HELIPAD1, HELIPAD1_block, 12 }, { 51, HANGAR, 0, 55 }, { 51, 0, 0, 12 },
|
||||
{ 52, 255, NOTHING_block, 0 }, { 52, HELIPAD2, HELIPAD2_block, 13 }, { 52, HANGAR, 0, 55 }, { 52, 0, 0, 13 },
|
||||
/* Helicopter -- takeoff */
|
||||
// Helicopter -- takeoff
|
||||
{ 53, HELITAKEOFF, NOTHING_block, 0 },
|
||||
{ 54, HELITAKEOFF, NOTHING_block, 0 },
|
||||
{ 55, 0, HANGAR2_AREA_block, 56 }, // need to go to hangar when waiting in air
|
||||
{ 56, 0, HANGAR2_AREA_block, 3 },
|
||||
/* runway 2 out support */
|
||||
// runway 2 out support
|
||||
{ 57, 255, OUT_WAY2_block, 0 }, { 57, TAKEOFF, 0, 58 }, { 57, 0, 0, 58 },
|
||||
{ 58, 0, OUT_WAY2_block, 59 },
|
||||
{ 59, TAKEOFF, RUNWAY_OUT2_block, 60 }, // takeoff
|
||||
{ 60, 0, RUNWAY_OUT2_block, 61 },
|
||||
{ 61, STARTTAKEOFF, NOTHING_block, 62 },
|
||||
{ 62, ENDTAKEOFF, NOTHING_block, 0 },
|
||||
/* runway 2 in support */
|
||||
// runway 2 in support
|
||||
{ 63, LANDING, RUNWAY_IN2_block, 64 },
|
||||
{ 64, 0, RUNWAY_IN2_block, 65 },
|
||||
{ 65, 0, RUNWAY_IN2_block, 66 },
|
||||
@@ -717,7 +717,7 @@ static const AirportFTAbuildup _airport_fta_intercontinental[] = {
|
||||
};
|
||||
|
||||
|
||||
/* heliports, oilrigs don't have depots */
|
||||
// heliports, oilrigs don't have depots
|
||||
static const byte _airport_helipad_heliport_oilrig[] = { 1, 1 };
|
||||
static const byte _airport_entries_heliport_oilrig[] = { 7, 7, 7, 7 };
|
||||
static const AirportFTAbuildup _airport_fta_heliport_oilrig[] = {
|
||||
@@ -726,7 +726,7 @@ static const AirportFTAbuildup _airport_fta_heliport_oilrig[] = {
|
||||
{ 2, 255, AIRPORT_BUSY_block, 0 }, { 2, HELILANDING, 0, 3 }, { 2, HELITAKEOFF, 0, 1 },
|
||||
{ 3, HELILANDING, AIRPORT_BUSY_block, 4 },
|
||||
{ 4, HELIENDLANDING, AIRPORT_BUSY_block, 4 }, { 4, HELIPAD1, HELIPAD1_block, 0 }, { 4, HELITAKEOFF, 0, 2 },
|
||||
/* In Air */
|
||||
// In Air
|
||||
{ 5, 0, NOTHING_block, 6 },
|
||||
{ 6, 0, NOTHING_block, 7 },
|
||||
{ 7, 0, NOTHING_block, 8 },
|
||||
@@ -734,7 +734,7 @@ static const AirportFTAbuildup _airport_fta_heliport_oilrig[] = {
|
||||
{ MAX_ELEMENTS, 0, 0, 0 } // end marker. DO NOT REMOVE
|
||||
};
|
||||
|
||||
/* helidepots */
|
||||
// helidepots
|
||||
static const TileIndexDiffC _airport_depots_helidepot[] = { { 1, 0 } };
|
||||
static const byte _airport_helipad_helidepot[] = { 1, 1 };
|
||||
static const byte _airport_entries_helidepot[] = { 4, 4, 4, 4 };
|
||||
@@ -742,18 +742,18 @@ static const AirportFTAbuildup _airport_fta_helidepot[] = {
|
||||
{ 0, HANGAR, NOTHING_block, 1 },
|
||||
{ 1, 255, HANGAR2_AREA_block, 0 }, { 1, HANGAR, 0, 0 }, { 1, HELIPAD1, HELIPAD1_block, 14 }, { 1, HELITAKEOFF, 0, 15 }, { 1, 0, 0, 0 },
|
||||
{ 2, FLYING, NOTHING_block, 3 }, { 2, HELILANDING, PRE_HELIPAD_block, 7 }, { 2, HANGAR, 0, 12 }, { 2, HELITAKEOFF, NOTHING_block, 16 },
|
||||
/* In Air */
|
||||
// In Air
|
||||
{ 3, 0, NOTHING_block, 4 },
|
||||
{ 4, 0, NOTHING_block, 5 },
|
||||
{ 5, 0, NOTHING_block, 6 },
|
||||
{ 6, 0, NOTHING_block, 2 },
|
||||
/* Helicopter -- stay in air in special place as a buffer to choose from helipads */
|
||||
// Helicopter -- stay in air in special place as a buffer to choose from helipads
|
||||
{ 7, HELILANDING, PRE_HELIPAD_block, 8 },
|
||||
{ 8, HELIENDLANDING, PRE_HELIPAD_block, 8 }, { 8, HELIPAD1, 0, 9 }, { 8, HANGAR, 0, 12 }, { 8, 0, 0, 2 },
|
||||
{ 9, 0, NOTHING_block, 10 },
|
||||
/* landing */
|
||||
// landing
|
||||
{ 10, 255, NOTHING_block, 10 }, { 10, HELIPAD1, HELIPAD1_block, 14 }, { 10, HANGAR, 0, 1 }, { 10, 0, 0, 14 },
|
||||
/* Helicopter -- takeoff */
|
||||
// Helicopter -- takeoff
|
||||
{ 11, HELITAKEOFF, NOTHING_block, 0 },
|
||||
{ 12, 0, HANGAR2_AREA_block, 13 }, // need to go to hangar when waiting in air
|
||||
{ 13, 0, HANGAR2_AREA_block, 1 },
|
||||
@@ -764,16 +764,16 @@ static const AirportFTAbuildup _airport_fta_helidepot[] = {
|
||||
{ MAX_ELEMENTS, 0, 0, 0 } // end marker. DO NOT REMOVE
|
||||
};
|
||||
|
||||
/* helistation */
|
||||
// helistation
|
||||
static const TileIndexDiffC _airport_depots_helistation[] = { { 0, 0 } };
|
||||
static const byte _airport_helipad_helistation[] = { 1, 3 };
|
||||
static const byte _airport_entries_helistation[] = { 25, 25, 25, 25 };
|
||||
static const AirportFTAbuildup _airport_fta_helistation[] = {
|
||||
{ 0, HANGAR, NOTHING_block, 8 }, { 0, HELIPAD1, 0, 1 }, { 0, HELIPAD2, 0, 1 }, { 0, HELIPAD3, 0, 1 }, { 0, HELITAKEOFF, 0, 1 }, { 0, 0, 0, 0 },
|
||||
{ 1, 255, HANGAR2_AREA_block, 0 }, { 1, HANGAR, 0, 0 }, { 1, HELITAKEOFF, 0, 3 }, { 1, 0, 0, 4 },
|
||||
/* landing */
|
||||
// landing
|
||||
{ 2, FLYING, NOTHING_block, 28 }, { 2, HELILANDING, 0, 15 }, { 2, 0, 0, 28 },
|
||||
/* helicopter side */
|
||||
// helicopter side
|
||||
{ 3, HELITAKEOFF, NOTHING_block, 0 }, // helitakeoff outside hangar2
|
||||
{ 4, 255, TAXIWAY_BUSY_block, 0 }, { 4, HANGAR, HANGAR2_AREA_block, 1 }, { 4, HELITAKEOFF, 0, 1 }, { 4, 0, 0, 5 },
|
||||
{ 5, 255, TAXIWAY_BUSY_block, 0 }, { 5, HELIPAD1, HELIPAD1_block, 6 }, { 5, HELIPAD2, HELIPAD2_block, 7 }, { 5, HELIPAD3, HELIPAD3_block, 8 }, { 5, 0, 0, 4 },
|
||||
@@ -786,13 +786,13 @@ static const AirportFTAbuildup _airport_fta_helistation[] = {
|
||||
{ 12, HELITAKEOFF, NOTHING_block, 0 },
|
||||
{ 13, HELITAKEOFF, NOTHING_block, 0 },
|
||||
{ 14, HELITAKEOFF, NOTHING_block, 0 },
|
||||
/* heli - in flight moves */
|
||||
// heli - in flight moves
|
||||
{ 15, HELILANDING, PRE_HELIPAD_block, 16 },
|
||||
{ 16, HELIENDLANDING, PRE_HELIPAD_block, 16 }, { 16, HELIPAD1, 0, 17 }, { 16, HELIPAD2, 0, 18 }, { 16, HELIPAD3, 0, 19 }, { 16, HANGAR, 0, 23 },
|
||||
{ 17, 0, NOTHING_block, 20 },
|
||||
{ 18, 0, NOTHING_block, 21 },
|
||||
{ 19, 0, NOTHING_block, 22 },
|
||||
/* heli landing */
|
||||
// heli landing
|
||||
{ 20, 255, NOTHING_block, 0 }, { 20, HELIPAD1, HELIPAD1_block, 6 }, { 20, HANGAR, 0, 23 }, { 20, 0, 0, 6 },
|
||||
{ 21, 255, NOTHING_block, 0 }, { 21, HELIPAD2, HELIPAD2_block, 7 }, { 21, HANGAR, 0, 23 }, { 21, 0, 0, 7 },
|
||||
{ 22, 255, NOTHING_block, 0 }, { 22, HELIPAD3, HELIPAD3_block, 8 }, { 22, HANGAR, 0, 23 }, { 22, 0, 0, 8 },
|
||||
|
@@ -5,11 +5,10 @@
|
||||
#include "stdafx.h"
|
||||
#include "train.h"
|
||||
#include "roadveh.h"
|
||||
#include "aircraft.h"
|
||||
#include "newgrf_engine.h"
|
||||
#include "vehicle_func.h"
|
||||
|
||||
#include "table/strings.h"
|
||||
|
||||
static const uint MAX_ARTICULATED_PARTS = 100; ///< Maximum of articulated parts per vehicle, i.e. when to abort calling the articulated vehicle callback.
|
||||
|
||||
uint CountArticulatedParts(EngineID engine_type, bool purchase_window)
|
||||
@@ -51,7 +50,22 @@ static inline uint16 GetVehicleDefaultCapacity(EngineID engine, VehicleType type
|
||||
CargoID cargo = (e->CanCarryCargo() ? e->GetDefaultCargoType() : (CargoID)CT_INVALID);
|
||||
if (cargo_type != NULL) *cargo_type = cargo;
|
||||
if (cargo == CT_INVALID) return 0;
|
||||
return e->GetDisplayDefaultCapacity();
|
||||
switch (type) {
|
||||
case VEH_TRAIN:
|
||||
return GetEngineProperty(engine, 0x14, e->u.rail.capacity) + (e->u.rail.railveh_type == RAILVEH_MULTIHEAD ? e->u.rail.capacity : 0);
|
||||
|
||||
case VEH_ROAD:
|
||||
return GetEngineProperty(engine, 0x0F, e->u.road.capacity);
|
||||
|
||||
case VEH_SHIP:
|
||||
return GetEngineProperty(engine, 0x0D, e->u.ship.capacity);
|
||||
|
||||
case VEH_AIRCRAFT:
|
||||
return AircraftDefaultCargoCapacity(cargo, &e->u.air);
|
||||
|
||||
default: NOT_REACHED();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -224,64 +238,6 @@ bool IsArticulatedVehicleCarryingDifferentCargos(const Vehicle *v, CargoID *carg
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks whether the specs of freshly build articulated vehicles are consistent with the information specified in the purchase list.
|
||||
* Only essential information is checked to leave room for magic tricks/workarounds to grfcoders.
|
||||
* It checks:
|
||||
* For autoreplace/-renew:
|
||||
* - Default cargo type (without capacity)
|
||||
* - intersection and union of refit masks.
|
||||
*/
|
||||
void CheckConsistencyOfArticulatedVehicle(const Vehicle *v)
|
||||
{
|
||||
const Engine *engine = GetEngine(v->engine_type);
|
||||
|
||||
uint32 purchase_refit_union = GetUnionOfArticulatedRefitMasks(v->engine_type, v->type, true);
|
||||
uint32 purchase_refit_intersection = GetIntersectionOfArticulatedRefitMasks(v->engine_type, v->type, true);
|
||||
uint16 *purchase_default_capacity = GetCapacityOfArticulatedParts(v->engine_type, v->type);
|
||||
|
||||
uint32 real_refit_union = 0;
|
||||
uint32 real_refit_intersection = UINT_MAX;
|
||||
uint16 real_default_capacity[NUM_CARGO];
|
||||
memset(real_default_capacity, 0, sizeof(real_default_capacity));
|
||||
|
||||
do {
|
||||
uint32 refit_mask = GetAvailableVehicleCargoTypes(v->engine_type, v->type, true);
|
||||
real_refit_union |= refit_mask;
|
||||
if (refit_mask != 0) real_refit_intersection &= refit_mask;
|
||||
|
||||
assert(v->cargo_type < NUM_CARGO);
|
||||
real_default_capacity[v->cargo_type] += v->cargo_cap;
|
||||
|
||||
switch (v->type) {
|
||||
case VEH_TRAIN:
|
||||
v = (EngineHasArticPart(v) ? GetNextArticPart(v) : NULL);
|
||||
break;
|
||||
|
||||
case VEH_ROAD:
|
||||
v = (RoadVehHasArticPart(v) ? v->Next() : NULL);
|
||||
break;
|
||||
|
||||
default:
|
||||
v = NULL;
|
||||
break;
|
||||
}
|
||||
} while (v != NULL);
|
||||
|
||||
/* Check whether the vehicle carries more cargos than expected */
|
||||
bool carries_more = false;
|
||||
for (CargoID cid = 0; cid < NUM_CARGO; cid++) {
|
||||
if (real_default_capacity[cid] != 0 && purchase_default_capacity[cid] == 0) {
|
||||
carries_more = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* show a warning once for each GRF after each game load */
|
||||
if (real_refit_union != purchase_refit_union || real_refit_intersection != purchase_refit_intersection || carries_more) {
|
||||
ShowNewGrfVehicleError(engine->index, STR_NEWGRF_BUGGY, STR_NEWGRF_BUGGY_ARTICULATED_CARGO, GBUG_VEH_REFIT, false);
|
||||
}
|
||||
}
|
||||
|
||||
void AddArticulatedParts(Vehicle **vl, VehicleType type)
|
||||
{
|
||||
@@ -373,6 +329,6 @@ void AddArticulatedParts(Vehicle **vl, VehicleType type)
|
||||
|
||||
if (flip_image) u->spritenum++;
|
||||
|
||||
VehicleMove(u, false);
|
||||
VehiclePositionChanged(u);
|
||||
}
|
||||
}
|
||||
|
@@ -15,7 +15,5 @@ uint32 GetUnionOfArticulatedRefitMasks(EngineID engine, VehicleType type, bool i
|
||||
uint32 GetIntersectionOfArticulatedRefitMasks(EngineID engine, VehicleType type, bool include_initial_cargo_type);
|
||||
bool IsArticulatedVehicleCarryingDifferentCargos(const Vehicle *v, CargoID *cargo_type);
|
||||
bool IsArticulatedVehicleRefittable(EngineID engine);
|
||||
void CheckConsistencyOfArticulatedVehicle(const Vehicle *v);
|
||||
|
||||
|
||||
#endif /* ARTICULATED_VEHICLES_H */
|
||||
|
@@ -342,6 +342,7 @@ static CommandCost CopyHeadSpecificThings(Vehicle *old_head, Vehicle *new_head,
|
||||
/** Replace a single unit in a free wagon chain
|
||||
* @param single_unit vehicle to let autoreplace/renew operator on
|
||||
* @param flags command flags
|
||||
* @param wagon_removal remove wagons when the resulting chain occupies more tiles than the old did
|
||||
* @param nothing_to_do is set to 'false' when something was done (only valid when not failed)
|
||||
* @return cost or error
|
||||
*/
|
||||
@@ -513,7 +514,7 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
|
||||
*chain = new_head;
|
||||
}
|
||||
|
||||
/* Transfer cargo of old vehicles and sell them */
|
||||
/* Transfer cargo of old vehicles and sell them*/
|
||||
for (int i = 0; i < num_units; i++) {
|
||||
Vehicle *w = old_vehs[i];
|
||||
/* Is the vehicle again part of the new chain?
|
||||
@@ -522,10 +523,7 @@ static CommandCost ReplaceChain(Vehicle **chain, DoCommandFlag flags, bool wagon
|
||||
|
||||
if ((flags & DC_EXEC) != 0) TransferCargo(w, new_head, true);
|
||||
|
||||
/* Sell the vehicle.
|
||||
* Note: This might temporarly construct new trains, so use DC_AUTOREPLACE to prevent
|
||||
* it from failing due to engine limits. */
|
||||
cost.AddCost(DoCommand(0, w->index, 0, flags | DC_AUTOREPLACE, GetCmdSellVeh(w)));
|
||||
cost.AddCost(DoCommand(0, w->index, 0, flags, GetCmdSellVeh(w)));
|
||||
if ((flags & DC_EXEC) != 0) {
|
||||
old_vehs[i] = NULL;
|
||||
if (i == 0) old_head = NULL;
|
||||
|
@@ -207,7 +207,7 @@ public:
|
||||
if (vehicletype == VEH_TRAIN) {
|
||||
this->wagon_btnstate = true;
|
||||
/* The train window is bigger so we will move some of the widgets to fit the new size.
|
||||
* We will start by moving the resize button to the lower right corner. */
|
||||
* We will start by moving the resize button to the lower right corner. */
|
||||
widget[RVW_WIDGET_RESIZE].top = widget[RVW_WIDGET_TRAIN_ENGINEWAGON_TOGGLE].top;
|
||||
widget[RVW_WIDGET_RESIZE].bottom = widget[RVW_WIDGET_TRAIN_ENGINEWAGON_TOGGLE].bottom;
|
||||
widget[RVW_WIDGET_STOP_REPLACE].right = widget[RVW_WIDGET_RESIZE].right;
|
||||
@@ -342,7 +342,7 @@ public:
|
||||
this->SetDirty();
|
||||
break;
|
||||
|
||||
case RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN: { // Railtype selection dropdown menu
|
||||
case RVW_WIDGET_TRAIN_RAILTYPE_DROPDOWN: { /* Railtype selection dropdown menu */
|
||||
const Company *c = GetCompany(_local_company);
|
||||
DropDownList *list = new DropDownList();
|
||||
for (RailType rt = RAILTYPE_BEGIN; rt != RAILTYPE_END; rt++) {
|
||||
@@ -355,18 +355,18 @@ public:
|
||||
break;
|
||||
}
|
||||
|
||||
case RVW_WIDGET_TRAIN_WAGONREMOVE_TOGGLE: // toggle renew_keep_length
|
||||
case RVW_WIDGET_TRAIN_WAGONREMOVE_TOGGLE: /* toggle renew_keep_length */
|
||||
DoCommandP(0, 5, GetCompany(_local_company)->renew_keep_length ? 0 : 1, CMD_SET_AUTOREPLACE);
|
||||
break;
|
||||
|
||||
case RVW_WIDGET_START_REPLACE: { // Start replacing
|
||||
case RVW_WIDGET_START_REPLACE: { /* Start replacing */
|
||||
EngineID veh_from = this->sel_engine[0];
|
||||
EngineID veh_to = this->sel_engine[1];
|
||||
DoCommandP(0, 3 + (this->sel_group << 16) , veh_from + (veh_to << 16), CMD_SET_AUTOREPLACE);
|
||||
this->SetDirty();
|
||||
} break;
|
||||
|
||||
case RVW_WIDGET_STOP_REPLACE: { // Stop replacing
|
||||
case RVW_WIDGET_STOP_REPLACE: { /* Stop replacing */
|
||||
EngineID veh_from = this->sel_engine[0];
|
||||
DoCommandP(0, 3 + (this->sel_group << 16), veh_from + (INVALID_ENGINE << 16), CMD_SET_AUTOREPLACE);
|
||||
this->SetDirty();
|
||||
@@ -421,12 +421,12 @@ public:
|
||||
|
||||
if (delta.x != 0) {
|
||||
/* We changed the width of the window so we have to resize the lists.
|
||||
* Because ResizeButtons() makes each widget the same size it can't be used on the lists
|
||||
* because then the lists would have the same size as the scrollbars.
|
||||
* Instead we use it on the detail panels.
|
||||
* Afterwards we use the new location of the detail panels (the middle of the window)
|
||||
* to place the lists.
|
||||
* This way the lists will have equal size while keeping the width of the scrollbars unchanged. */
|
||||
* Because ResizeButtons() makes each widget the same size it can't be used on the lists
|
||||
* because then the lists would have the same size as the scrollbars.
|
||||
* Instead we use it on the detail panels.
|
||||
* Afterwards we use the new location of the detail panels (the middle of the window)
|
||||
* to place the lists.
|
||||
* This way the lists will have equal size while keeping the width of the scrollbars unchanged. */
|
||||
ResizeButtons(this, RVW_WIDGET_LEFT_DETAILS, RVW_WIDGET_RIGHT_DETAILS);
|
||||
widget[RVW_WIDGET_RIGHT_MATRIX].left = widget[RVW_WIDGET_RIGHT_DETAILS].left;
|
||||
widget[RVW_WIDGET_LEFT_SCROLLBAR].right = widget[RVW_WIDGET_LEFT_DETAILS].right;
|
||||
@@ -470,19 +470,19 @@ static const Widget _replace_vehicle_widgets[] = {
|
||||
{ WIDGETS_END},
|
||||
};
|
||||
|
||||
static const WindowDesc _replace_rail_vehicle_desc(
|
||||
static const WindowDesc _replace_rail_vehicle_desc = {
|
||||
WDP_AUTO, WDP_AUTO, 456, 140, 456, 140,
|
||||
WC_REPLACE_VEHICLE, WC_NONE,
|
||||
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE | WDF_CONSTRUCTION,
|
||||
_replace_vehicle_widgets
|
||||
);
|
||||
_replace_vehicle_widgets,
|
||||
};
|
||||
|
||||
static const WindowDesc _replace_vehicle_desc(
|
||||
static const WindowDesc _replace_vehicle_desc = {
|
||||
WDP_AUTO, WDP_AUTO, 456, 118, 456, 118,
|
||||
WC_REPLACE_VEHICLE, WC_NONE,
|
||||
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE | WDF_CONSTRUCTION,
|
||||
_replace_vehicle_widgets
|
||||
);
|
||||
_replace_vehicle_widgets,
|
||||
};
|
||||
|
||||
RailType ReplaceVehicleWindow::sel_railtype = RAILTYPE_RAIL;
|
||||
|
||||
|
@@ -25,36 +25,36 @@
|
||||
int _aystar_stats_open_size;
|
||||
int _aystar_stats_closed_size;
|
||||
|
||||
/* This looks in the Hash if a node exists in ClosedList
|
||||
* If so, it returns the PathNode, else NULL */
|
||||
// This looks in the Hash if a node exists in ClosedList
|
||||
// If so, it returns the PathNode, else NULL
|
||||
static PathNode *AyStarMain_ClosedList_IsInList(AyStar *aystar, const AyStarNode *node)
|
||||
{
|
||||
return (PathNode*)Hash_Get(&aystar->ClosedListHash, node->tile, node->direction);
|
||||
}
|
||||
|
||||
/* This adds a node to the ClosedList
|
||||
* It makes a copy of the data */
|
||||
// This adds a node to the ClosedList
|
||||
// It makes a copy of the data
|
||||
static void AyStarMain_ClosedList_Add(AyStar *aystar, const PathNode *node)
|
||||
{
|
||||
/* Add a node to the ClosedList */
|
||||
// Add a node to the ClosedList
|
||||
PathNode *new_node = MallocT<PathNode>(1);
|
||||
*new_node = *node;
|
||||
Hash_Set(&aystar->ClosedListHash, node->node.tile, node->node.direction, new_node);
|
||||
}
|
||||
|
||||
/* Checks if a node is in the OpenList
|
||||
* If so, it returns the OpenListNode, else NULL */
|
||||
// Checks if a node is in the OpenList
|
||||
// If so, it returns the OpenListNode, else NULL
|
||||
static OpenListNode *AyStarMain_OpenList_IsInList(AyStar *aystar, const AyStarNode *node)
|
||||
{
|
||||
return (OpenListNode*)Hash_Get(&aystar->OpenListHash, node->tile, node->direction);
|
||||
}
|
||||
|
||||
/* Gets the best node from OpenList
|
||||
* returns the best node, or NULL of none is found
|
||||
* Also it deletes the node from the OpenList */
|
||||
// Gets the best node from OpenList
|
||||
// returns the best node, or NULL of none is found
|
||||
// Also it deletes the node from the OpenList
|
||||
static OpenListNode *AyStarMain_OpenList_Pop(AyStar *aystar)
|
||||
{
|
||||
/* Return the item the Queue returns.. the best next OpenList item. */
|
||||
// Return the item the Queue returns.. the best next OpenList item.
|
||||
OpenListNode *res = (OpenListNode*)aystar->OpenListQueue.pop(&aystar->OpenListQueue);
|
||||
if (res != NULL) {
|
||||
Hash_Delete(&aystar->OpenListHash, res->path.node.tile, res->path.node.direction);
|
||||
@@ -63,18 +63,18 @@ static OpenListNode *AyStarMain_OpenList_Pop(AyStar *aystar)
|
||||
return res;
|
||||
}
|
||||
|
||||
/* Adds a node to the OpenList
|
||||
* It makes a copy of node, and puts the pointer of parent in the struct */
|
||||
// Adds a node to the OpenList
|
||||
// It makes a copy of node, and puts the pointer of parent in the struct
|
||||
static void AyStarMain_OpenList_Add(AyStar *aystar, PathNode *parent, const AyStarNode *node, int f, int g)
|
||||
{
|
||||
/* Add a new Node to the OpenList */
|
||||
// Add a new Node to the OpenList
|
||||
OpenListNode *new_node = MallocT<OpenListNode>(1);
|
||||
new_node->g = g;
|
||||
new_node->path.parent = parent;
|
||||
new_node->path.node = *node;
|
||||
Hash_Set(&aystar->OpenListHash, node->tile, node->direction, new_node);
|
||||
|
||||
/* Add it to the queue */
|
||||
// Add it to the queue
|
||||
aystar->OpenListQueue.push(&aystar->OpenListQueue, new_node, f);
|
||||
}
|
||||
|
||||
@@ -89,49 +89,49 @@ int AyStarMain_CheckTile(AyStar *aystar, AyStarNode *current, OpenListNode *pare
|
||||
PathNode *closedlist_parent;
|
||||
OpenListNode *check;
|
||||
|
||||
/* Check the new node against the ClosedList */
|
||||
// Check the new node against the ClosedList
|
||||
if (AyStarMain_ClosedList_IsInList(aystar, current) != NULL) return AYSTAR_DONE;
|
||||
|
||||
/* Calculate the G-value for this node */
|
||||
// Calculate the G-value for this node
|
||||
new_g = aystar->CalculateG(aystar, current, parent);
|
||||
/* If the value was INVALID_NODE, we don't do anything with this node */
|
||||
// If the value was INVALID_NODE, we don't do anything with this node
|
||||
if (new_g == AYSTAR_INVALID_NODE) return AYSTAR_DONE;
|
||||
|
||||
/* There should not be given any other error-code.. */
|
||||
// There should not be given any other error-code..
|
||||
assert(new_g >= 0);
|
||||
/* Add the parent g-value to the new g-value */
|
||||
// Add the parent g-value to the new g-value
|
||||
new_g += parent->g;
|
||||
if (aystar->max_path_cost != 0 && (uint)new_g > aystar->max_path_cost) return AYSTAR_DONE;
|
||||
|
||||
/* Calculate the h-value */
|
||||
// Calculate the h-value
|
||||
new_h = aystar->CalculateH(aystar, current, parent);
|
||||
/* There should not be given any error-code.. */
|
||||
// There should not be given any error-code..
|
||||
assert(new_h >= 0);
|
||||
|
||||
/* The f-value if g + h */
|
||||
// The f-value if g + h
|
||||
new_f = new_g + new_h;
|
||||
|
||||
/* Get the pointer to the parent in the ClosedList (the currentone is to a copy of the one in the OpenList) */
|
||||
// Get the pointer to the parent in the ClosedList (the currentone is to a copy of the one in the OpenList)
|
||||
closedlist_parent = AyStarMain_ClosedList_IsInList(aystar, &parent->path.node);
|
||||
|
||||
/* Check if this item is already in the OpenList */
|
||||
// Check if this item is already in the OpenList
|
||||
check = AyStarMain_OpenList_IsInList(aystar, current);
|
||||
if (check != NULL) {
|
||||
uint i;
|
||||
/* Yes, check if this g value is lower.. */
|
||||
// Yes, check if this g value is lower..
|
||||
if (new_g > check->g) return AYSTAR_DONE;
|
||||
aystar->OpenListQueue.del(&aystar->OpenListQueue, check, 0);
|
||||
/* It is lower, so change it to this item */
|
||||
// It is lower, so change it to this item
|
||||
check->g = new_g;
|
||||
check->path.parent = closedlist_parent;
|
||||
/* Copy user data, will probably have changed */
|
||||
for (i = 0; i < lengthof(current->user_data); i++) {
|
||||
check->path.node.user_data[i] = current->user_data[i];
|
||||
}
|
||||
/* Readd him in the OpenListQueue */
|
||||
// Readd him in the OpenListQueue
|
||||
aystar->OpenListQueue.push(&aystar->OpenListQueue, check, new_f);
|
||||
} else {
|
||||
/* A new node, add him to the OpenList */
|
||||
// A new node, add him to the OpenList
|
||||
AyStarMain_OpenList_Add(aystar, closedlist_parent, current, new_f, new_g);
|
||||
}
|
||||
|
||||
@@ -153,12 +153,12 @@ int AyStarMain_Loop(AyStar *aystar)
|
||||
{
|
||||
int i, r;
|
||||
|
||||
/* Get the best node from OpenList */
|
||||
// Get the best node from OpenList
|
||||
OpenListNode *current = AyStarMain_OpenList_Pop(aystar);
|
||||
/* If empty, drop an error */
|
||||
// If empty, drop an error
|
||||
if (current == NULL) return AYSTAR_EMPTY_OPENLIST;
|
||||
|
||||
/* Check for end node and if found, return that code */
|
||||
// Check for end node and if found, return that code
|
||||
if (aystar->EndNodeCheck(aystar, current) == AYSTAR_FOUND_END_NODE) {
|
||||
if (aystar->FoundEndNode != NULL)
|
||||
aystar->FoundEndNode(aystar, current);
|
||||
@@ -166,26 +166,26 @@ int AyStarMain_Loop(AyStar *aystar)
|
||||
return AYSTAR_FOUND_END_NODE;
|
||||
}
|
||||
|
||||
/* Add the node to the ClosedList */
|
||||
// Add the node to the ClosedList
|
||||
AyStarMain_ClosedList_Add(aystar, ¤t->path);
|
||||
|
||||
/* Load the neighbours */
|
||||
// Load the neighbours
|
||||
aystar->GetNeighbours(aystar, current);
|
||||
|
||||
/* Go through all neighbours */
|
||||
// Go through all neighbours
|
||||
for (i = 0; i < aystar->num_neighbours; i++) {
|
||||
/* Check and add them to the OpenList if needed */
|
||||
// Check and add them to the OpenList if needed
|
||||
r = aystar->checktile(aystar, &aystar->neighbours[i], current);
|
||||
}
|
||||
|
||||
/* Free the node */
|
||||
// Free the node
|
||||
free(current);
|
||||
|
||||
if (aystar->max_search_nodes != 0 && Hash_Size(&aystar->ClosedListHash) >= aystar->max_search_nodes) {
|
||||
/* We've expanded enough nodes */
|
||||
return AYSTAR_LIMIT_REACHED;
|
||||
} else {
|
||||
/* Return that we are still busy */
|
||||
// Return that we are still busy
|
||||
return AYSTAR_STILL_BUSY;
|
||||
}
|
||||
}
|
||||
@@ -211,10 +211,10 @@ void AyStarMain_Free(AyStar *aystar)
|
||||
*/
|
||||
void AyStarMain_Clear(AyStar *aystar)
|
||||
{
|
||||
/* Clean the Queue, but not the elements within. That will be done by
|
||||
* the hash. */
|
||||
// Clean the Queue, but not the elements within. That will be done by
|
||||
// the hash.
|
||||
aystar->OpenListQueue.clear(&aystar->OpenListQueue, false);
|
||||
/* Clean the hashes */
|
||||
// Clean the hashes
|
||||
clear_Hash(&aystar->OpenListHash, true);
|
||||
clear_Hash(&aystar->ClosedListHash, true);
|
||||
|
||||
@@ -235,8 +235,8 @@ void AyStarMain_Clear(AyStar *aystar)
|
||||
*/
|
||||
int AyStarMain_Main(AyStar *aystar) {
|
||||
int r, i = 0;
|
||||
/* Loop through the OpenList
|
||||
* Quit if result is no AYSTAR_STILL_BUSY or is more than loops_per_tick */
|
||||
// Loop through the OpenList
|
||||
// Quit if result is no AYSTAR_STILL_BUSY or is more than loops_per_tick
|
||||
while ((r = aystar->loop(aystar)) == AYSTAR_STILL_BUSY && (aystar->loops_per_tick == 0 || ++i < aystar->loops_per_tick)) { }
|
||||
#ifdef AYSTAR_DEBUG
|
||||
switch (r) {
|
||||
@@ -279,14 +279,14 @@ void AyStarMain_AddStartNode(AyStar *aystar, AyStarNode *start_node, uint g)
|
||||
|
||||
void init_AyStar(AyStar *aystar, Hash_HashProc hash, uint num_buckets)
|
||||
{
|
||||
/* Allocated the Hash for the OpenList and ClosedList */
|
||||
// Allocated the Hash for the OpenList and ClosedList
|
||||
init_Hash(&aystar->OpenListHash, hash, num_buckets);
|
||||
init_Hash(&aystar->ClosedListHash, hash, num_buckets);
|
||||
|
||||
/* Set up our sorting queue
|
||||
* BinaryHeap allocates a block of 1024 nodes
|
||||
* When thatone gets full it reserves an otherone, till this number
|
||||
* That is why it can stay this high */
|
||||
// Set up our sorting queue
|
||||
// BinaryHeap allocates a block of 1024 nodes
|
||||
// When thatone gets full it reserves an otherone, till this number
|
||||
// That is why it can stay this high
|
||||
init_BinaryHeap(&aystar->OpenListQueue, 102400);
|
||||
|
||||
aystar->addstart = AyStarMain_AddStartNode;
|
||||
|
12
src/aystar.h
12
src/aystar.h
@@ -35,16 +35,16 @@ struct AyStarNode {
|
||||
uint user_data[2];
|
||||
};
|
||||
|
||||
/* The resulting path has nodes looking like this. */
|
||||
// The resulting path has nodes looking like this.
|
||||
struct PathNode {
|
||||
AyStarNode node;
|
||||
/* The parent of this item */
|
||||
// The parent of this item
|
||||
PathNode *parent;
|
||||
};
|
||||
|
||||
/* For internal use only
|
||||
* We do not save the h-value, because it is only needed to calculate the f-value.
|
||||
* h-value should _always_ be the distance left to the end-tile. */
|
||||
// For internal use only
|
||||
// We do not save the h-value, because it is only needed to calculate the f-value.
|
||||
// h-value should _always_ be the distance left to the end-tile.
|
||||
struct OpenListNode {
|
||||
int g;
|
||||
PathNode path;
|
||||
@@ -97,7 +97,7 @@ typedef void AyStar_GetNeighbours(AyStar *aystar, OpenListNode *current);
|
||||
*/
|
||||
typedef void AyStar_FoundEndNode(AyStar *aystar, OpenListNode *current);
|
||||
|
||||
/* For internal use, see aystar.cpp */
|
||||
// For internal use, see aystar.c
|
||||
typedef void AyStar_AddStartNode(AyStar *aystar, AyStarNode *start_node, uint g);
|
||||
typedef int AyStar_Main(AyStar *aystar);
|
||||
typedef int AyStar_Loop(AyStar *aystar);
|
||||
|
@@ -128,7 +128,7 @@ void Blitter_32bppBase::ScrollBuffer(void *video, int &left, int &top, int &widt
|
||||
uint32 *dst;
|
||||
|
||||
if (scroll_y > 0) {
|
||||
/* Calculate pointers */
|
||||
/*Calculate pointers */
|
||||
dst = (uint32 *)video + left + (top + height - 1) * _screen.pitch;
|
||||
src = dst - scroll_y * _screen.pitch;
|
||||
|
||||
|
@@ -97,12 +97,12 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a pixel looks like it is transparent.
|
||||
* @param colour the colour already on the screen.
|
||||
* @param nom the amount of transparency, nominator, makes colour lighter.
|
||||
* @param denom denominator, makes colour darker.
|
||||
* @return the new colour for the screen.
|
||||
*/
|
||||
* Make a pixel looks like it is transparent.
|
||||
* @param colour the colour already on the screen.
|
||||
* @param nom the amount of transparency, nominator, makes colour lighter.
|
||||
* @param denom denominator, makes colour darker.
|
||||
* @return the new colour for the screen.
|
||||
*/
|
||||
static inline uint32 MakeTransparent(uint32 colour, uint nom, uint denom = 256)
|
||||
{
|
||||
uint r = GB(colour, 16, 8);
|
||||
@@ -113,10 +113,10 @@ public:
|
||||
}
|
||||
|
||||
/**
|
||||
* Make a colour grey - based.
|
||||
* @param colour the colour to make grey.
|
||||
* @return the new colour, now grey.
|
||||
*/
|
||||
* Make a colour grey - based.
|
||||
* @param colour the colour to make grey.
|
||||
* @return the new colour, now grey.
|
||||
*/
|
||||
static inline uint32 MakeGrey(uint32 colour)
|
||||
{
|
||||
uint r = GB(colour, 16, 8);
|
||||
@@ -124,8 +124,8 @@ public:
|
||||
uint b = GB(colour, 0, 8);
|
||||
|
||||
/* To avoid doubles and stuff, multiple it with a total of 65536 (16bits), then
|
||||
* divide by it to normalize the value to a byte again. See heightmap.cpp for
|
||||
* information about the formula. */
|
||||
* divide by it to normalize the value to a byte again. See heightmap.cpp for
|
||||
* information about the formula. */
|
||||
colour = ((r * 19595) + (g * 38470) + (b * 7471)) / 65536;
|
||||
|
||||
return ComposeColour(0xFF, colour, colour, colour);
|
||||
|
@@ -132,7 +132,7 @@ void Blitter_8bppBase::ScrollBuffer(void *video, int &left, int &top, int &width
|
||||
uint8 *dst;
|
||||
|
||||
if (scroll_y > 0) {
|
||||
/* Calculate pointers */
|
||||
/*Calculate pointers */
|
||||
dst = (uint8 *)video + left + (top + height - 1) * _screen.pitch;
|
||||
src = dst - scroll_y * _screen.pitch;
|
||||
|
||||
|
@@ -67,7 +67,7 @@ private:
|
||||
|
||||
/* Constants for sorting the bridges */
|
||||
static const StringID sorter_names[];
|
||||
static GUIBridgeList::SortFunction * const sorter_funcs[];
|
||||
static GUIBridgeList::SortFunction *const sorter_funcs[];
|
||||
|
||||
/* Internal variables */
|
||||
TileIndex start_tile;
|
||||
@@ -268,12 +268,12 @@ static const Widget _build_bridge_widgets[] = {
|
||||
};
|
||||
|
||||
/* Window definition for the rail bridge selection window */
|
||||
static const WindowDesc _build_bridge_desc(
|
||||
static const WindowDesc _build_bridge_desc = {
|
||||
WDP_AUTO, WDP_AUTO, 200, 114, 200, 114,
|
||||
WC_BUILD_BRIDGE, WC_BUILD_TOOLBAR,
|
||||
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE | WDF_CONSTRUCTION,
|
||||
_build_bridge_widgets
|
||||
);
|
||||
_build_bridge_widgets,
|
||||
};
|
||||
|
||||
/**
|
||||
* Prepare the data for the build a bridge window.
|
||||
|
@@ -55,7 +55,6 @@ static const Widget _build_vehicle_widgets[] = {
|
||||
{ WIDGETS_END},
|
||||
};
|
||||
|
||||
|
||||
static bool _internal_sort_order; // descending/ascending
|
||||
static byte _last_sort_criteria[] = {0, 0, 0, 0};
|
||||
static bool _last_sort_order[] = {false, false, false, false};
|
||||
@@ -75,8 +74,10 @@ static int CDECL EngineIntroDateSorter(const void *a, const void *b)
|
||||
const int vb = GetEngine(*(const EngineID*)b)->intro_date;
|
||||
const int r = va - vb;
|
||||
|
||||
/* Use EngineID to sort instead since we want consistent sorting */
|
||||
if (r == 0) return EngineNumberSorter(a, b);
|
||||
if (r == 0) {
|
||||
/* Use EngineID to sort instead since we want consistent sorting */
|
||||
return EngineNumberSorter(a, b);
|
||||
}
|
||||
return _internal_sort_order ? -r : r;
|
||||
}
|
||||
|
||||
@@ -87,6 +88,7 @@ static int CDECL EngineNameSorter(const void *a, const void *b)
|
||||
|
||||
const EngineID va = *(const EngineID*)a;
|
||||
const EngineID vb = *(const EngineID*)b;
|
||||
int r;
|
||||
|
||||
if (va != last_engine[0]) {
|
||||
last_engine[0] = va;
|
||||
@@ -100,10 +102,12 @@ static int CDECL EngineNameSorter(const void *a, const void *b)
|
||||
GetString(last_name[1], STR_ENGINE_NAME, lastof(last_name[1]));
|
||||
}
|
||||
|
||||
int r = strcmp(last_name[0], last_name[1]); // sort by name
|
||||
r = strcmp(last_name[0], last_name[1]); // sort by name
|
||||
|
||||
/* Use EngineID to sort instead since we want consistent sorting */
|
||||
if (r == 0) return EngineNumberSorter(a, b);
|
||||
if (r == 0) {
|
||||
/* Use EngineID to sort instead since we want consistent sorting */
|
||||
return EngineNumberSorter(a, b);
|
||||
}
|
||||
return _internal_sort_order ? -r : r;
|
||||
}
|
||||
|
||||
@@ -113,73 +117,68 @@ static int CDECL EngineReliabilitySorter(const void *a, const void *b)
|
||||
const int vb = GetEngine(*(const EngineID*)b)->reliability;
|
||||
const int r = va - vb;
|
||||
|
||||
/* Use EngineID to sort instead since we want consistent sorting */
|
||||
if (r == 0) return EngineNumberSorter(a, b);
|
||||
if (r == 0) {
|
||||
/* Use EngineID to sort instead since we want consistent sorting */
|
||||
return EngineNumberSorter(a, b);
|
||||
}
|
||||
return _internal_sort_order ? -r : r;
|
||||
}
|
||||
|
||||
static int CDECL EngineCostSorter(const void *a, const void *b)
|
||||
/* Train sorting functions */
|
||||
static int CDECL TrainEngineCostSorter(const void *a, const void *b)
|
||||
{
|
||||
Money va = GetEngine(*(const EngineID*)a)->GetCost();
|
||||
Money vb = GetEngine(*(const EngineID*)b)->GetCost();
|
||||
int r = ClampToI32(va - vb);
|
||||
|
||||
/* Use EngineID to sort instead since we want consistent sorting */
|
||||
if (r == 0) return EngineNumberSorter(a, b);
|
||||
return _internal_sort_order ? -r : r;
|
||||
}
|
||||
|
||||
static int CDECL EngineSpeedSorter(const void *a, const void *b)
|
||||
{
|
||||
int va = GetEngine(*(const EngineID*)a)->GetDisplayMaxSpeed();
|
||||
int vb = GetEngine(*(const EngineID*)b)->GetDisplayMaxSpeed();
|
||||
int va = RailVehInfo(*(const EngineID*)a)->cost_factor;
|
||||
int vb = RailVehInfo(*(const EngineID*)b)->cost_factor;
|
||||
int r = va - vb;
|
||||
|
||||
/* Use EngineID to sort instead since we want consistent sorting */
|
||||
if (r == 0) return EngineNumberSorter(a, b);
|
||||
return _internal_sort_order ? -r : r;
|
||||
}
|
||||
|
||||
static int CDECL EnginePowerSorter(const void *a, const void *b)
|
||||
static int CDECL TrainEngineSpeedSorter(const void *a, const void *b)
|
||||
{
|
||||
int va = GetEngine(*(const EngineID*)a)->GetPower();
|
||||
int vb = GetEngine(*(const EngineID*)b)->GetPower();
|
||||
int va = RailVehInfo(*(const EngineID*)a)->max_speed;
|
||||
int vb = RailVehInfo(*(const EngineID*)b)->max_speed;
|
||||
int r = va - vb;
|
||||
|
||||
/* Use EngineID to sort instead since we want consistent sorting */
|
||||
if (r == 0) return EngineNumberSorter(a, b);
|
||||
return _internal_sort_order ? -r : r;
|
||||
}
|
||||
|
||||
static int CDECL EngineRunningCostSorter(const void *a, const void *b)
|
||||
static int CDECL TrainEnginePowerSorter(const void *a, const void *b)
|
||||
{
|
||||
const RailVehicleInfo *rvi_a = RailVehInfo(*(const EngineID*)a);
|
||||
const RailVehicleInfo *rvi_b = RailVehInfo(*(const EngineID*)b);
|
||||
|
||||
int va = rvi_a->power;
|
||||
int vb = rvi_b->power;
|
||||
int r = va - vb;
|
||||
|
||||
return _internal_sort_order ? -r : r;
|
||||
}
|
||||
|
||||
static int CDECL TrainEngineRunningCostSorter(const void *a, const void *b)
|
||||
{
|
||||
Money va = GetEngine(*(const EngineID*)a)->GetRunningCost();
|
||||
Money vb = GetEngine(*(const EngineID*)b)->GetRunningCost();
|
||||
int r = ClampToI32(va - vb);
|
||||
|
||||
/* Use EngineID to sort instead since we want consistent sorting */
|
||||
if (r == 0) return EngineNumberSorter(a, b);
|
||||
return _internal_sort_order ? -r : r;
|
||||
}
|
||||
|
||||
/* Train sorting functions */
|
||||
static int CDECL TrainEnginePowerVsRunningCostSorter(const void *a, const void *b)
|
||||
{
|
||||
const Engine *e_a = GetEngine(*(const EngineID*)a);
|
||||
const Engine *e_b = GetEngine(*(const EngineID*)b);
|
||||
const RailVehicleInfo *rvi_a = RailVehInfo(*(const EngineID*)a);
|
||||
const RailVehicleInfo *rvi_b = RailVehInfo(*(const EngineID*)b);
|
||||
|
||||
/* Here we are using a few tricks to get the right sort.
|
||||
* We want power/running cost, but since we usually got higher running cost than power and we store the result in an int,
|
||||
* we will actually calculate cunning cost/power (to make it more than 1).
|
||||
* Because of this, the return value have to be reversed as well and we return b - a instead of a - b.
|
||||
* Another thing is that both power and running costs should be doubled for multiheaded engines.
|
||||
* Since it would be multipling with 2 in both numerator and denumerator, it will even themselves out and we skip checking for multiheaded. */
|
||||
Money va = (e_a->GetRunningCost()) / max(1U, (uint)e_a->GetPower());
|
||||
Money vb = (e_b->GetRunningCost()) / max(1U, (uint)e_b->GetPower());
|
||||
* We want power/running cost, but since we usually got higher running cost than power and we store the result in an int,
|
||||
* we will actually calculate cunning cost/power (to make it more than 1).
|
||||
* Because of this, the return value have to be reversed as well and we return b - a instead of a - b.
|
||||
* Another thing is that both power and running costs should be doubled for multiheaded engines.
|
||||
* Since it would be multipling with 2 in both numerator and denumerator, it will even themselves out and we skip checking for multiheaded. */
|
||||
Money va = (GetEngine(*(const EngineID*)a)->GetRunningCost()) / max(1U, (uint)rvi_a->power);
|
||||
Money vb = (GetEngine(*(const EngineID*)b)->GetRunningCost()) / max(1U, (uint)rvi_b->power);
|
||||
int r = ClampToI32(vb - va);
|
||||
|
||||
/* Use EngineID to sort instead since we want consistent sorting */
|
||||
if (r == 0) return EngineNumberSorter(a, b);
|
||||
return _internal_sort_order ? -r : r;
|
||||
}
|
||||
|
||||
@@ -188,12 +187,14 @@ static int CDECL TrainEngineCapacitySorter(const void *a, const void *b)
|
||||
const RailVehicleInfo *rvi_a = RailVehInfo(*(const EngineID*)a);
|
||||
const RailVehicleInfo *rvi_b = RailVehInfo(*(const EngineID*)b);
|
||||
|
||||
int va = GetTotalCapacityOfArticulatedParts(*(const EngineID*)a, VEH_TRAIN) * (rvi_a->railveh_type == RAILVEH_MULTIHEAD ? 2 : 1);
|
||||
int vb = GetTotalCapacityOfArticulatedParts(*(const EngineID*)b, VEH_TRAIN) * (rvi_b->railveh_type == RAILVEH_MULTIHEAD ? 2 : 1);
|
||||
int va = rvi_a->capacity * (rvi_a->railveh_type == RAILVEH_MULTIHEAD ? 2 : 1);
|
||||
int vb = rvi_b->capacity * (rvi_b->railveh_type == RAILVEH_MULTIHEAD ? 2 : 1);
|
||||
int r = va - vb;
|
||||
|
||||
/* Use EngineID to sort instead since we want consistent sorting */
|
||||
if (r == 0) return EngineNumberSorter(a, b);
|
||||
if (r == 0) {
|
||||
/* Use EngineID to sort instead since we want consistent sorting */
|
||||
return EngineNumberSorter(a, b);
|
||||
}
|
||||
return _internal_sort_order ? -r : r;
|
||||
}
|
||||
|
||||
@@ -207,44 +208,141 @@ static int CDECL TrainEnginesThenWagonsSorter(const void *a, const void *b)
|
||||
|
||||
/* Use EngineID to sort instead since we want consistent sorting */
|
||||
if (r == 0) return EngineNumberSorter(a, b);
|
||||
|
||||
return _internal_sort_order ? -r : r;
|
||||
}
|
||||
|
||||
/* Road vehicle sorting functions */
|
||||
static int CDECL RoadVehEngineCapacitySorter(const void *a, const void *b)
|
||||
static int CDECL RoadVehEngineCostSorter(const void *a, const void *b)
|
||||
{
|
||||
int va = GetTotalCapacityOfArticulatedParts(*(const EngineID*)a, VEH_ROAD);
|
||||
int vb = GetTotalCapacityOfArticulatedParts(*(const EngineID*)b, VEH_ROAD);
|
||||
int va = RoadVehInfo(*(const EngineID*)a)->cost_factor;
|
||||
int vb = RoadVehInfo(*(const EngineID*)b)->cost_factor;
|
||||
int r = va - vb;
|
||||
|
||||
/* Use EngineID to sort instead since we want consistent sorting */
|
||||
if (r == 0) return EngineNumberSorter(a, b);
|
||||
return _internal_sort_order ? -r : r;
|
||||
}
|
||||
|
||||
/* Ship vehicle sorting functions */
|
||||
static int CDECL ShipEngineCapacitySorter(const void *a, const void *b)
|
||||
static int CDECL RoadVehEngineSpeedSorter(const void *a, const void *b)
|
||||
{
|
||||
const Engine *e_a = GetEngine(*(const EngineID*)a);
|
||||
const Engine *e_b = GetEngine(*(const EngineID*)b);
|
||||
|
||||
int va = e_a->GetDisplayDefaultCapacity();
|
||||
int vb = e_b->GetDisplayDefaultCapacity();
|
||||
int va = RoadVehInfo(*(const EngineID*)a)->max_speed;
|
||||
int vb = RoadVehInfo(*(const EngineID*)b)->max_speed;
|
||||
int r = va - vb;
|
||||
|
||||
/* Use EngineID to sort instead since we want consistent sorting */
|
||||
if (r == 0) return EngineNumberSorter(a, b);
|
||||
return _internal_sort_order ? -r : r;
|
||||
}
|
||||
|
||||
static int CDECL RoadVehEngineRunningCostSorter(const void *a, const void *b)
|
||||
{
|
||||
Money va = GetEngine(*(const EngineID*)a)->GetRunningCost();
|
||||
Money vb = GetEngine(*(const EngineID*)b)->GetRunningCost();
|
||||
int r = ClampToI32(va - vb);
|
||||
|
||||
if (r == 0) {
|
||||
/* Use EngineID to sort instead since we want consistent sorting */
|
||||
return EngineNumberSorter(a, b);
|
||||
}
|
||||
return _internal_sort_order ? -r : r;
|
||||
}
|
||||
|
||||
static int CDECL RoadVehEngineCapacitySorter(const void *a, const void *b)
|
||||
{
|
||||
int va = RoadVehInfo(*(const EngineID*)a)->capacity;
|
||||
int vb = RoadVehInfo(*(const EngineID*)b)->capacity;
|
||||
int r = va - vb;
|
||||
|
||||
if (r == 0) {
|
||||
/* Use EngineID to sort instead since we want consistent sorting */
|
||||
return EngineNumberSorter(a, b);
|
||||
}
|
||||
return _internal_sort_order ? -r : r;
|
||||
}
|
||||
|
||||
/* Road vehicle sorting functions */
|
||||
static int CDECL ShipEngineCostSorter(const void *a, const void *b)
|
||||
{
|
||||
int va = ShipVehInfo(*(const EngineID*)a)->cost_factor;
|
||||
int vb = ShipVehInfo(*(const EngineID*)b)->cost_factor;
|
||||
int r = va - vb;
|
||||
|
||||
return _internal_sort_order ? -r : r;
|
||||
}
|
||||
|
||||
static int CDECL ShipEngineSpeedSorter(const void *a, const void *b)
|
||||
{
|
||||
int va = ShipVehInfo(*(const EngineID*)a)->max_speed;
|
||||
int vb = ShipVehInfo(*(const EngineID*)b)->max_speed;
|
||||
int r = va - vb;
|
||||
|
||||
return _internal_sort_order ? -r : r;
|
||||
}
|
||||
|
||||
static int CDECL ShipEngineRunningCostSorter(const void *a, const void *b)
|
||||
{
|
||||
const int va = GetEngine(*(const EngineID*)a)->GetRunningCost();
|
||||
const int vb = GetEngine(*(const EngineID*)b)->GetRunningCost();
|
||||
const int r = va - vb;
|
||||
|
||||
if (r == 0) {
|
||||
/* Use EngineID to sort instead since we want consistent sorting */
|
||||
return EngineNumberSorter(a, b);
|
||||
}
|
||||
return _internal_sort_order ? -r : r;
|
||||
}
|
||||
|
||||
static int CDECL ShipEngineCapacitySorter(const void *a, const void *b)
|
||||
{
|
||||
int va = ShipVehInfo(*(const EngineID*)a)->capacity;
|
||||
int vb = ShipVehInfo(*(const EngineID*)b)->capacity;
|
||||
int r = va - vb;
|
||||
|
||||
if (r == 0) {
|
||||
/* Use EngineID to sort instead since we want consistent sorting */
|
||||
return EngineNumberSorter(a, b);
|
||||
}
|
||||
return _internal_sort_order ? -r : r;
|
||||
}
|
||||
|
||||
/* Aircraft sorting functions */
|
||||
|
||||
static int CDECL AircraftEngineCostSorter(const void *a, const void *b)
|
||||
{
|
||||
const int va = AircraftVehInfo(*(const EngineID*)a)->cost_factor;
|
||||
const int vb = AircraftVehInfo(*(const EngineID*)b)->cost_factor;
|
||||
int r = va - vb;
|
||||
|
||||
return _internal_sort_order ? -r : r;
|
||||
}
|
||||
|
||||
static int CDECL AircraftEngineSpeedSorter(const void *a, const void *b)
|
||||
{
|
||||
const int va = AircraftVehInfo(*(const EngineID*)a)->max_speed;
|
||||
const int vb = AircraftVehInfo(*(const EngineID*)b)->max_speed;
|
||||
const int r = va - vb;
|
||||
|
||||
if (r == 0) {
|
||||
/* Use EngineID to sort instead since we want consistent sorting */
|
||||
return EngineNumberSorter(a, b);
|
||||
}
|
||||
return _internal_sort_order ? -r : r;
|
||||
}
|
||||
|
||||
static int CDECL AircraftEngineRunningCostSorter(const void *a, const void *b)
|
||||
{
|
||||
const int va = GetEngine(*(const EngineID*)a)->GetRunningCost();
|
||||
const int vb = GetEngine(*(const EngineID*)b)->GetRunningCost();
|
||||
const int r = va - vb;
|
||||
|
||||
if (r == 0) {
|
||||
/* Use EngineID to sort instead since we want consistent sorting */
|
||||
return EngineNumberSorter(a, b);
|
||||
}
|
||||
return _internal_sort_order ? -r : r;
|
||||
}
|
||||
|
||||
static int CDECL AircraftEngineCargoSorter(const void *a, const void *b)
|
||||
{
|
||||
const Engine *e_a = GetEngine(*(const EngineID*)a);
|
||||
const Engine *e_b = GetEngine(*(const EngineID*)b);
|
||||
|
||||
int va = e_a->GetDisplayDefaultCapacity();
|
||||
int vb = e_b->GetDisplayDefaultCapacity();
|
||||
int va = AircraftVehInfo(*(const EngineID*)a)->passenger_capacity;
|
||||
int vb = AircraftVehInfo(*(const EngineID*)b)->passenger_capacity;
|
||||
int r = va - vb;
|
||||
|
||||
if (r == 0) {
|
||||
@@ -264,43 +362,43 @@ static int CDECL AircraftEngineCargoSorter(const void *a, const void *b)
|
||||
static EngList_SortTypeFunction * const _sorter[][10] = {{
|
||||
/* Trains */
|
||||
&EngineNumberSorter,
|
||||
&EngineCostSorter,
|
||||
&EngineSpeedSorter,
|
||||
&EnginePowerSorter,
|
||||
&TrainEngineCostSorter,
|
||||
&TrainEngineSpeedSorter,
|
||||
&TrainEnginePowerSorter,
|
||||
&EngineIntroDateSorter,
|
||||
&EngineNameSorter,
|
||||
&EngineRunningCostSorter,
|
||||
&TrainEngineRunningCostSorter,
|
||||
&TrainEnginePowerVsRunningCostSorter,
|
||||
&EngineReliabilitySorter,
|
||||
&TrainEngineCapacitySorter,
|
||||
}, {
|
||||
/* Road vehicles */
|
||||
&EngineNumberSorter,
|
||||
&EngineCostSorter,
|
||||
&EngineSpeedSorter,
|
||||
&RoadVehEngineCostSorter,
|
||||
&RoadVehEngineSpeedSorter,
|
||||
&EngineIntroDateSorter,
|
||||
&EngineNameSorter,
|
||||
&EngineRunningCostSorter,
|
||||
&RoadVehEngineRunningCostSorter,
|
||||
&EngineReliabilitySorter,
|
||||
&RoadVehEngineCapacitySorter,
|
||||
}, {
|
||||
/* Ships */
|
||||
&EngineNumberSorter,
|
||||
&EngineCostSorter,
|
||||
&EngineSpeedSorter,
|
||||
&ShipEngineCostSorter,
|
||||
&ShipEngineSpeedSorter,
|
||||
&EngineIntroDateSorter,
|
||||
&EngineNameSorter,
|
||||
&EngineRunningCostSorter,
|
||||
&ShipEngineRunningCostSorter,
|
||||
&EngineReliabilitySorter,
|
||||
&ShipEngineCapacitySorter,
|
||||
}, {
|
||||
/* Aircraft */
|
||||
&EngineNumberSorter,
|
||||
&EngineCostSorter,
|
||||
&EngineSpeedSorter,
|
||||
&AircraftEngineCostSorter,
|
||||
&AircraftEngineSpeedSorter,
|
||||
&EngineIntroDateSorter,
|
||||
&EngineNameSorter,
|
||||
&EngineRunningCostSorter,
|
||||
&AircraftEngineRunningCostSorter,
|
||||
&EngineReliabilitySorter,
|
||||
&AircraftEngineCargoSorter,
|
||||
}};
|
||||
@@ -386,7 +484,7 @@ static int DrawRailWagonPurchaseInfo(int x, int y, EngineID engine_number, const
|
||||
/* Wagon weight - (including cargo) */
|
||||
uint weight = e->GetDisplayWeight();
|
||||
SetDParam(0, weight);
|
||||
uint cargo_weight = (e->CanCarryCargo() ? GetCargo(e->GetDefaultCargoType())->weight * e->GetDisplayDefaultCapacity() >> 4 : 0);
|
||||
uint cargo_weight = (e->CanCarryCargo() ? GetCargo(e->GetDefaultCargoType())->weight * GetEngineProperty(engine_number, 0x14, rvi->capacity) >> 4 : 0);
|
||||
SetDParam(1, cargo_weight + weight);
|
||||
DrawString(x, y, STR_PURCHASE_INFO_WEIGHT_CWEIGHT, TC_FROMSTRING);
|
||||
y += 10;
|
||||
@@ -485,7 +583,7 @@ static int DrawShipPurchaseInfo(int x, int y, EngineID engine_number, const Ship
|
||||
|
||||
/* Cargo type + capacity */
|
||||
SetDParam(0, e->GetDefaultCargoType());
|
||||
SetDParam(1, e->GetDisplayDefaultCapacity());
|
||||
SetDParam(1, GetEngineProperty(engine_number, 0x0D, svi->capacity));
|
||||
SetDParam(2, refittable ? STR_9842_REFITTABLE : STR_EMPTY);
|
||||
DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, TC_FROMSTRING);
|
||||
y += 10;
|
||||
@@ -512,14 +610,14 @@ static int DrawAircraftPurchaseInfo(int x, int y, EngineID engine_number, const
|
||||
|
||||
/* Cargo capacity */
|
||||
if (cargo == CT_INVALID || cargo == CT_PASSENGERS) {
|
||||
SetDParam(0, e->GetDisplayDefaultCapacity());
|
||||
SetDParam(0, avi->passenger_capacity);
|
||||
SetDParam(1, avi->mail_capacity);
|
||||
DrawString(x, y, STR_PURCHASE_INFO_AIRCRAFT_CAPACITY, TC_FROMSTRING);
|
||||
} else {
|
||||
/* Note, if the default capacity is selected by the refit capacity
|
||||
* callback, then the capacity shown is likely to be incorrect. */
|
||||
* callback, then the capacity shown is likely to be incorrect. */
|
||||
SetDParam(0, cargo);
|
||||
SetDParam(1, e->GetDisplayDefaultCapacity());
|
||||
SetDParam(1, AircraftDefaultCargoCapacity(cargo, avi));
|
||||
SetDParam(2, refittable ? STR_9842_REFITTABLE : STR_EMPTY);
|
||||
DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, TC_FROMSTRING);
|
||||
}
|
||||
@@ -812,9 +910,9 @@ struct BuildVehicleWindow : Window {
|
||||
this->eng_list.Clear();
|
||||
|
||||
/* 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 */
|
||||
const Engine *e;
|
||||
FOR_ALL_ENGINES_OF_TYPE(e, VEH_TRAIN) {
|
||||
EngineID eid = e->index;
|
||||
@@ -894,9 +992,9 @@ struct BuildVehicleWindow : Window {
|
||||
const Station *st = this->listview_mode ? NULL : GetStationByTile(this->window_number);
|
||||
|
||||
/* Make list of all available planes.
|
||||
* Also check to see if the previously selected plane is still available,
|
||||
* and if not, reset selection to INVALID_ENGINE. This could be the case
|
||||
* when planes become obsolete and are removed */
|
||||
* Also check to see if the previously selected plane is still available,
|
||||
* and if not, reset selection to INVALID_ENGINE. This could be the case
|
||||
* when planes become obsolete and are removed */
|
||||
const Engine *e;
|
||||
FOR_ALL_ENGINES_OF_TYPE(e, VEH_AIRCRAFT) {
|
||||
EngineID eid = e->index;
|
||||
@@ -1090,12 +1188,12 @@ struct BuildVehicleWindow : Window {
|
||||
}
|
||||
};
|
||||
|
||||
static const WindowDesc _build_vehicle_desc(
|
||||
static const WindowDesc _build_vehicle_desc = {
|
||||
WDP_AUTO, WDP_AUTO, 240, 174, 240, 256,
|
||||
WC_BUILD_VEHICLE, WC_NONE,
|
||||
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE | WDF_CONSTRUCTION,
|
||||
_build_vehicle_widgets
|
||||
);
|
||||
_build_vehicle_widgets,
|
||||
};
|
||||
|
||||
void ShowBuildVehicleWindow(TileIndex tile, VehicleType type)
|
||||
{
|
||||
|
@@ -235,12 +235,12 @@ struct CheatWindow : Window {
|
||||
}
|
||||
};
|
||||
|
||||
static const WindowDesc _cheats_desc(
|
||||
static const WindowDesc _cheats_desc = {
|
||||
240, 22, 400, 170, 400, 170,
|
||||
WC_CHEATS, WC_NONE,
|
||||
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
|
||||
_cheat_widgets
|
||||
);
|
||||
_cheat_widgets,
|
||||
};
|
||||
|
||||
|
||||
void ShowCheatWindow()
|
||||
|
@@ -21,7 +21,7 @@ template<> struct ExtractBits<RoadBits> { static const uint Count = 4; };
|
||||
|
||||
template<typename T, uint N, typename U> static inline T Extract(U v)
|
||||
{
|
||||
/* Check if there are enough bits in v */
|
||||
// Check if there are enough bits in v
|
||||
ExtractValid<N + ExtractBits<T>::Count <= sizeof(U) * 8>();
|
||||
return (T)GB(v, N, ExtractBits<T>::Count);
|
||||
}
|
||||
|
216
src/command.cpp
216
src/command.cpp
@@ -201,140 +201,140 @@ DEF_COMMAND(CmdAutofillTimetable);
|
||||
* as the value from the CMD_* enums.
|
||||
*/
|
||||
static const Command _command_proc_table[] = {
|
||||
{CmdBuildRailroadTrack, CMD_NO_WATER | CMD_AUTO}, // CMD_BUILD_RAILROAD_TRACK
|
||||
{CmdRemoveRailroadTrack, CMD_AUTO}, // CMD_REMOVE_RAILROAD_TRACK
|
||||
{CmdBuildSingleRail, CMD_NO_WATER | CMD_AUTO}, // CMD_BUILD_SINGLE_RAIL
|
||||
{CmdRemoveSingleRail, CMD_AUTO}, // CMD_REMOVE_SINGLE_RAIL
|
||||
{CmdLandscapeClear, 0}, // CMD_LANDSCAPE_CLEAR
|
||||
{CmdBuildBridge, CMD_AUTO}, // CMD_BUILD_BRIDGE
|
||||
{CmdBuildRailroadStation, CMD_NO_WATER | CMD_AUTO}, // CMD_BUILD_RAILROAD_STATION
|
||||
{CmdBuildTrainDepot, CMD_NO_WATER | CMD_AUTO}, // CMD_BUILD_TRAIN_DEPOT
|
||||
{CmdBuildSingleSignal, CMD_AUTO}, // CMD_BUILD_SIGNALS
|
||||
{CmdRemoveSingleSignal, CMD_AUTO}, // CMD_REMOVE_SIGNALS
|
||||
{CmdTerraformLand, CMD_ALL_TILES | CMD_AUTO}, // CMD_TERRAFORM_LAND
|
||||
{CmdPurchaseLandArea, CMD_NO_WATER | CMD_AUTO}, // CMD_PURCHASE_LAND_AREA
|
||||
{CmdSellLandArea, 0}, // CMD_SELL_LAND_AREA
|
||||
{CmdBuildTunnel, CMD_AUTO}, // CMD_BUILD_TUNNEL
|
||||
{CmdRemoveFromRailroadStation, 0}, // CMD_REMOVE_FROM_RAILROAD_STATION
|
||||
{CmdConvertRail, 0}, // CMD_CONVERT_RAILD
|
||||
{CmdBuildTrainWaypoint, 0}, // CMD_BUILD_TRAIN_WAYPOINT
|
||||
{CmdRenameWaypoint, 0}, // CMD_RENAME_WAYPOINT
|
||||
{CmdRemoveTrainWaypoint, 0}, // CMD_REMOVE_TRAIN_WAYPOINT
|
||||
{CmdBuildRailroadTrack, CMD_NO_WATER | CMD_AUTO}, /* CMD_BUILD_RAILROAD_TRACK */
|
||||
{CmdRemoveRailroadTrack, CMD_AUTO}, /* CMD_REMOVE_RAILROAD_TRACK */
|
||||
{CmdBuildSingleRail, CMD_NO_WATER | CMD_AUTO}, /* CMD_BUILD_SINGLE_RAIL */
|
||||
{CmdRemoveSingleRail, CMD_AUTO}, /* CMD_REMOVE_SINGLE_RAIL */
|
||||
{CmdLandscapeClear, 0}, /* CMD_LANDSCAPE_CLEAR */
|
||||
{CmdBuildBridge, CMD_AUTO}, /* CMD_BUILD_BRIDGE */
|
||||
{CmdBuildRailroadStation, CMD_NO_WATER | CMD_AUTO}, /* CMD_BUILD_RAILROAD_STATION */
|
||||
{CmdBuildTrainDepot, CMD_NO_WATER | CMD_AUTO}, /* CMD_BUILD_TRAIN_DEPOT */
|
||||
{CmdBuildSingleSignal, CMD_AUTO}, /* CMD_BUILD_SIGNALS */
|
||||
{CmdRemoveSingleSignal, CMD_AUTO}, /* CMD_REMOVE_SIGNALS */
|
||||
{CmdTerraformLand, CMD_ALL_TILES | CMD_AUTO}, /* CMD_TERRAFORM_LAND */
|
||||
{CmdPurchaseLandArea, CMD_NO_WATER | CMD_AUTO}, /* CMD_PURCHASE_LAND_AREA */
|
||||
{CmdSellLandArea, 0}, /* CMD_SELL_LAND_AREA */
|
||||
{CmdBuildTunnel, CMD_AUTO}, /* CMD_BUILD_TUNNEL */
|
||||
{CmdRemoveFromRailroadStation, 0}, /* CMD_REMOVE_FROM_RAILROAD_STATION */
|
||||
{CmdConvertRail, 0}, /* CMD_CONVERT_RAILD */
|
||||
{CmdBuildTrainWaypoint, 0}, /* CMD_BUILD_TRAIN_WAYPOINT */
|
||||
{CmdRenameWaypoint, 0}, /* CMD_RENAME_WAYPOINT */
|
||||
{CmdRemoveTrainWaypoint, 0}, /* CMD_REMOVE_TRAIN_WAYPOINT */
|
||||
|
||||
{CmdBuildRoadStop, CMD_NO_WATER | CMD_AUTO}, // CMD_BUILD_ROAD_STOP
|
||||
{CmdRemoveRoadStop, 0}, // CMD_REMOVE_ROAD_STOP
|
||||
{CmdBuildLongRoad, CMD_NO_WATER | CMD_AUTO}, // CMD_BUILD_LONG_ROAD
|
||||
{CmdRemoveLongRoad, CMD_NO_TEST | CMD_AUTO}, // CMD_REMOVE_LONG_ROAD; towns may disallow removing road bits (as they are connected) in test, but in exec they're removed and thus removing is allowed.
|
||||
{CmdBuildRoad, 0}, // CMD_BUILD_ROAD
|
||||
{CmdRemoveRoad, 0}, // CMD_REMOVE_ROAD
|
||||
{CmdBuildRoadDepot, CMD_NO_WATER | CMD_AUTO}, // CMD_BUILD_ROAD_DEPOT
|
||||
{CmdBuildRoadStop, CMD_NO_WATER | CMD_AUTO}, /* CMD_BUILD_ROAD_STOP */
|
||||
{CmdRemoveRoadStop, 0}, /* CMD_REMOVE_ROAD_STOP */
|
||||
{CmdBuildLongRoad, CMD_NO_WATER | CMD_AUTO}, /* CMD_BUILD_LONG_ROAD */
|
||||
{CmdRemoveLongRoad, CMD_NO_TEST | CMD_AUTO}, /* CMD_REMOVE_LONG_ROAD; towns may disallow removing road bits (as they are connected) in test, but in exec they're removed and thus removing is allowed. */
|
||||
{CmdBuildRoad, 0}, /* CMD_BUILD_ROAD */
|
||||
{CmdRemoveRoad, 0}, /* CMD_REMOVE_ROAD */
|
||||
{CmdBuildRoadDepot, CMD_NO_WATER | CMD_AUTO}, /* CMD_BUILD_ROAD_DEPOT */
|
||||
|
||||
{CmdBuildAirport, CMD_NO_WATER | CMD_AUTO}, // CMD_BUILD_AIRPORT
|
||||
{CmdBuildDock, CMD_AUTO}, // CMD_BUILD_DOCK
|
||||
{CmdBuildShipDepot, CMD_AUTO}, // CMD_BUILD_SHIP_DEPOT
|
||||
{CmdBuildBuoy, CMD_AUTO}, // CMD_BUILD_BUOY
|
||||
{CmdPlantTree, CMD_AUTO}, // CMD_PLANT_TREE
|
||||
{CmdBuildRailVehicle, 0}, // CMD_BUILD_RAIL_VEHICLE
|
||||
{CmdMoveRailVehicle, 0}, // CMD_MOVE_RAIL_VEHICLE
|
||||
{CmdBuildAirport, CMD_NO_WATER | CMD_AUTO}, /* CMD_BUILD_AIRPORT */
|
||||
{CmdBuildDock, CMD_AUTO}, /* CMD_BUILD_DOCK */
|
||||
{CmdBuildShipDepot, CMD_AUTO}, /* CMD_BUILD_SHIP_DEPOT */
|
||||
{CmdBuildBuoy, CMD_AUTO}, /* CMD_BUILD_BUOY */
|
||||
{CmdPlantTree, CMD_AUTO}, /* CMD_PLANT_TREE */
|
||||
{CmdBuildRailVehicle, 0}, /* CMD_BUILD_RAIL_VEHICLE */
|
||||
{CmdMoveRailVehicle, 0}, /* CMD_MOVE_RAIL_VEHICLE */
|
||||
|
||||
{CmdSellRailWagon, 0}, // CMD_SELL_RAIL_WAGON
|
||||
{CmdSendTrainToDepot, 0}, // CMD_SEND_TRAIN_TO_DEPOT
|
||||
{CmdForceTrainProceed, 0}, // CMD_FORCE_TRAIN_PROCEED
|
||||
{CmdReverseTrainDirection, 0}, // CMD_REVERSE_TRAIN_DIRECTION
|
||||
{CmdSellRailWagon, 0}, /* CMD_SELL_RAIL_WAGON */
|
||||
{CmdSendTrainToDepot, 0}, /* CMD_SEND_TRAIN_TO_DEPOT */
|
||||
{CmdForceTrainProceed, 0}, /* CMD_FORCE_TRAIN_PROCEED */
|
||||
{CmdReverseTrainDirection, 0}, /* CMD_REVERSE_TRAIN_DIRECTION */
|
||||
|
||||
{CmdModifyOrder, 0}, // CMD_MODIFY_ORDER
|
||||
{CmdSkipToOrder, 0}, // CMD_SKIP_TO_ORDER
|
||||
{CmdDeleteOrder, 0}, // CMD_DELETE_ORDER
|
||||
{CmdInsertOrder, 0}, // CMD_INSERT_ORDER
|
||||
{CmdModifyOrder, 0}, /* CMD_MODIFY_ORDER */
|
||||
{CmdSkipToOrder, 0}, /* CMD_SKIP_TO_ORDER */
|
||||
{CmdDeleteOrder, 0}, /* CMD_DELETE_ORDER */
|
||||
{CmdInsertOrder, 0}, /* CMD_INSERT_ORDER */
|
||||
|
||||
{CmdChangeServiceInt, 0}, // CMD_CHANGE_SERVICE_INT
|
||||
{CmdChangeServiceInt, 0}, /* CMD_CHANGE_SERVICE_INT */
|
||||
|
||||
{CmdBuildIndustry, 0}, // CMD_BUILD_INDUSTRY
|
||||
{CmdBuildCompanyHQ, CMD_NO_WATER | CMD_AUTO}, // CMD_BUILD_COMPANY_HQ
|
||||
{CmdSetCompanyManagerFace, 0}, // CMD_SET_COMPANY_MANAGER_FACE
|
||||
{CmdSetCompanyColour, 0}, // CMD_SET_COMPANY_COLOUR
|
||||
{CmdBuildIndustry, 0}, /* CMD_BUILD_INDUSTRY */
|
||||
{CmdBuildCompanyHQ, CMD_NO_WATER | CMD_AUTO}, /* CMD_BUILD_COMPANY_HQ */
|
||||
{CmdSetCompanyManagerFace, 0}, /* CMD_SET_COMPANY_MANAGER_FACE */
|
||||
{CmdSetCompanyColour, 0}, /* CMD_SET_COMPANY_COLOUR */
|
||||
|
||||
{CmdIncreaseLoan, 0}, // CMD_INCREASE_LOAN
|
||||
{CmdDecreaseLoan, 0}, // CMD_DECREASE_LOAN
|
||||
{CmdIncreaseLoan, 0}, /* CMD_INCREASE_LOAN */
|
||||
{CmdDecreaseLoan, 0}, /* CMD_DECREASE_LOAN */
|
||||
|
||||
{CmdWantEnginePreview, 0}, // CMD_WANT_ENGINE_PREVIEW
|
||||
{CmdWantEnginePreview, 0}, /* CMD_WANT_ENGINE_PREVIEW */
|
||||
|
||||
{CmdRenameVehicle, 0}, // CMD_RENAME_VEHICLE
|
||||
{CmdRenameEngine, 0}, // CMD_RENAME_ENGINE
|
||||
{CmdRenameVehicle, 0}, /* CMD_RENAME_VEHICLE */
|
||||
{CmdRenameEngine, 0}, /* CMD_RENAME_ENGINE */
|
||||
|
||||
{CmdRenameCompany, 0}, // CMD_RENAME_COMPANY
|
||||
{CmdRenamePresident, 0}, // CMD_RENAME_PRESIDENT
|
||||
{CmdRenameCompany, 0}, /* CMD_RENAME_COMPANY */
|
||||
{CmdRenamePresident, 0}, /* CMD_RENAME_PRESIDENT */
|
||||
|
||||
{CmdRenameStation, 0}, // CMD_RENAME_STATION
|
||||
{CmdRenameStation, 0}, /* CMD_RENAME_STATION */
|
||||
|
||||
{CmdSellAircraft, 0}, // CMD_SELL_AIRCRAFT
|
||||
{CmdSellAircraft, 0}, /* CMD_SELL_AIRCRAFT */
|
||||
|
||||
{CmdBuildAircraft, 0}, // CMD_BUILD_AIRCRAFT
|
||||
{CmdSendAircraftToHangar, 0}, // CMD_SEND_AIRCRAFT_TO_HANGAR
|
||||
{CmdRefitAircraft, 0}, // CMD_REFIT_AIRCRAFT
|
||||
{CmdBuildAircraft, 0}, /* CMD_BUILD_AIRCRAFT */
|
||||
{CmdSendAircraftToHangar, 0}, /* CMD_SEND_AIRCRAFT_TO_HANGAR */
|
||||
{CmdRefitAircraft, 0}, /* CMD_REFIT_AIRCRAFT */
|
||||
|
||||
{CmdPlaceSign, 0}, // CMD_PLACE_SIGN
|
||||
{CmdRenameSign, 0}, // CMD_RENAME_SIGN
|
||||
{CmdPlaceSign, 0}, /* CMD_PLACE_SIGN */
|
||||
{CmdRenameSign, 0}, /* CMD_RENAME_SIGN */
|
||||
|
||||
{CmdBuildRoadVeh, 0}, // CMD_BUILD_ROAD_VEH
|
||||
{CmdSellRoadVeh, 0}, // CMD_SELL_ROAD_VEH
|
||||
{CmdSendRoadVehToDepot, 0}, // CMD_SEND_ROADVEH_TO_DEPOT
|
||||
{CmdTurnRoadVeh, 0}, // CMD_TURN_ROADVEH
|
||||
{CmdRefitRoadVeh, 0}, // CMD_REFIT_ROAD_VEH
|
||||
{CmdBuildRoadVeh, 0}, /* CMD_BUILD_ROAD_VEH */
|
||||
{CmdSellRoadVeh, 0}, /* CMD_SELL_ROAD_VEH */
|
||||
{CmdSendRoadVehToDepot, 0}, /* CMD_SEND_ROADVEH_TO_DEPOT */
|
||||
{CmdTurnRoadVeh, 0}, /* CMD_TURN_ROADVEH */
|
||||
{CmdRefitRoadVeh, 0}, /* CMD_REFIT_ROAD_VEH */
|
||||
|
||||
{CmdPause, CMD_SERVER}, // CMD_PAUSE
|
||||
{CmdPause, CMD_SERVER}, /* CMD_PAUSE */
|
||||
|
||||
{CmdBuyShareInCompany, 0}, // CMD_BUY_SHARE_IN_COMPANY
|
||||
{CmdSellShareInCompany, 0}, // CMD_SELL_SHARE_IN_COMPANY
|
||||
{CmdBuyCompany, 0}, // CMD_BUY_COMANY
|
||||
{CmdBuyShareInCompany, 0}, /* CMD_BUY_SHARE_IN_COMPANY */
|
||||
{CmdSellShareInCompany, 0}, /* CMD_SELL_SHARE_IN_COMPANY */
|
||||
{CmdBuyCompany, 0}, /* CMD_BUY_COMANY */
|
||||
|
||||
{CmdBuildTown, CMD_OFFLINE}, // CMD_BUILD_TOWN
|
||||
{CmdRenameTown, CMD_SERVER}, // CMD_RENAME_TOWN
|
||||
{CmdDoTownAction, 0}, // CMD_DO_TOWN_ACTION
|
||||
{CmdBuildTown, CMD_OFFLINE}, /* CMD_BUILD_TOWN */
|
||||
{CmdRenameTown, CMD_SERVER}, /* CMD_RENAME_TOWN */
|
||||
{CmdDoTownAction, 0}, /* CMD_DO_TOWN_ACTION */
|
||||
|
||||
{CmdSellShip, 0}, // CMD_SELL_SHIP
|
||||
{CmdBuildShip, 0}, // CMD_BUILD_SHIP
|
||||
{CmdSendShipToDepot, 0}, // CMD_SEND_SHIP_TO_DEPOT
|
||||
{CmdRefitShip, 0}, // CMD_REFIT_SHIP
|
||||
{CmdSellShip, 0}, /* CMD_SELL_SHIP */
|
||||
{CmdBuildShip, 0}, /* CMD_BUILD_SHIP */
|
||||
{CmdSendShipToDepot, 0}, /* CMD_SEND_SHIP_TO_DEPOT */
|
||||
{CmdRefitShip, 0}, /* CMD_REFIT_SHIP */
|
||||
|
||||
{CmdOrderRefit, 0}, // CMD_ORDER_REFIT
|
||||
{CmdCloneOrder, 0}, // CMD_CLONE_ORDER
|
||||
{CmdOrderRefit, 0}, /* CMD_ORDER_REFIT */
|
||||
{CmdCloneOrder, 0}, /* CMD_CLONE_ORDER */
|
||||
|
||||
{CmdClearArea, CMD_NO_TEST}, // CMD_CLEAR_AREA; destroying multi-tile houses makes town rating differ between test and execution
|
||||
{CmdClearArea, CMD_NO_TEST}, /* CMD_CLEAR_AREA; destroying multi-tile houses makes town rating differ between test and execution */
|
||||
|
||||
{CmdMoneyCheat, CMD_OFFLINE}, // CMD_MONEY_CHEAT
|
||||
{CmdBuildCanal, CMD_AUTO}, // CMD_BUILD_CANAL
|
||||
{CmdCompanyCtrl, CMD_SPECTATOR}, // CMD_COMPANY_CTRL
|
||||
{CmdMoneyCheat, CMD_OFFLINE}, /* CMD_MONEY_CHEAT */
|
||||
{CmdBuildCanal, CMD_AUTO}, /* CMD_BUILD_CANAL */
|
||||
{CmdCompanyCtrl, CMD_SPECTATOR}, /* CMD_COMPANY_CTRL */
|
||||
|
||||
{CmdLevelLand, CMD_ALL_TILES | CMD_NO_TEST | CMD_AUTO}, // CMD_LEVEL_LAND; test run might clear tiles multiple times, in execution that only happens once
|
||||
{CmdLevelLand, CMD_ALL_TILES | CMD_NO_TEST | CMD_AUTO}, /* CMD_LEVEL_LAND; test run might clear tiles multiple times, in execution that only happens once */
|
||||
|
||||
{CmdRefitRailVehicle, 0}, // CMD_REFIT_RAIL_VEHICLE
|
||||
{CmdRestoreOrderIndex, 0}, // CMD_RESTORE_ORDER_INDEX
|
||||
{CmdBuildLock, CMD_AUTO}, // CMD_BUILD_LOCK
|
||||
{CmdRefitRailVehicle, 0}, /* CMD_REFIT_RAIL_VEHICLE */
|
||||
{CmdRestoreOrderIndex, 0}, /* CMD_RESTORE_ORDER_INDEX */
|
||||
{CmdBuildLock, CMD_AUTO}, /* CMD_BUILD_LOCK */
|
||||
|
||||
{CmdBuildSignalTrack, CMD_AUTO}, // CMD_BUILD_SIGNAL_TRACK
|
||||
{CmdRemoveSignalTrack, CMD_AUTO}, // CMD_REMOVE_SIGNAL_TRACK
|
||||
{CmdBuildSignalTrack, CMD_AUTO}, /* CMD_BUILD_SIGNAL_TRACK */
|
||||
{CmdRemoveSignalTrack, CMD_AUTO}, /* CMD_REMOVE_SIGNAL_TRACK */
|
||||
|
||||
{CmdGiveMoney, 0}, // CMD_GIVE_MONEY
|
||||
{CmdChangeSetting, CMD_SERVER}, // CMD_CHANGE_SETTING
|
||||
{CmdSetAutoReplace, 0}, // CMD_SET_AUTOREPLACE
|
||||
{CmdCloneVehicle, CMD_NO_TEST}, // CMD_CLONE_VEHICLE; NewGRF callbacks influence building and refitting making it impossible to correctly estimate the cost
|
||||
{CmdStartStopVehicle, 0}, // CMD_START_STOP_VEHICLE
|
||||
{CmdMassStartStopVehicle, 0}, // CMD_MASS_START_STOP
|
||||
{CmdAutoreplaceVehicle, 0}, // CMD_AUTOREPLACE_VEHICLE
|
||||
{CmdDepotSellAllVehicles, 0}, // CMD_DEPOT_SELL_ALL_VEHICLES
|
||||
{CmdDepotMassAutoReplace, 0}, // CMD_DEPOT_MASS_AUTOREPLACE
|
||||
{CmdCreateGroup, 0}, // CMD_CREATE_GROUP
|
||||
{CmdDeleteGroup, 0}, // CMD_DELETE_GROUP
|
||||
{CmdRenameGroup, 0}, // CMD_RENAME_GROUP
|
||||
{CmdAddVehicleGroup, 0}, // CMD_ADD_VEHICLE_GROUP
|
||||
{CmdAddSharedVehicleGroup, 0}, // CMD_ADD_SHARE_VEHICLE_GROUP
|
||||
{CmdRemoveAllVehiclesGroup, 0}, // CMD_REMOVE_ALL_VEHICLES_GROUP
|
||||
{CmdSetGroupReplaceProtection, 0}, // CMD_SET_GROUP_REPLACE_PROTECTION
|
||||
{CmdMoveOrder, 0}, // CMD_MOVE_ORDER
|
||||
{CmdChangeTimetable, 0}, // CMD_CHANGE_TIMETABLE
|
||||
{CmdSetVehicleOnTime, 0}, // CMD_SET_VEHICLE_ON_TIME
|
||||
{CmdAutofillTimetable, 0}, // CMD_AUTOFILL_TIMETABLE
|
||||
{CmdGiveMoney, 0}, /* CMD_GIVE_MONEY */
|
||||
{CmdChangeSetting, CMD_SERVER}, /* CMD_CHANGE_SETTING */
|
||||
{CmdSetAutoReplace, 0}, /* CMD_SET_AUTOREPLACE */
|
||||
{CmdCloneVehicle, CMD_NO_TEST}, /* CMD_CLONE_VEHICLE; NewGRF callbacks influence building and refitting making it impossible to correctly estimate the cost */
|
||||
{CmdStartStopVehicle, 0}, /* CMD_START_STOP_VEHICLE */
|
||||
{CmdMassStartStopVehicle, 0}, /* CMD_MASS_START_STOP */
|
||||
{CmdAutoreplaceVehicle, 0}, /* CMD_AUTOREPLACE_VEHICLE */
|
||||
{CmdDepotSellAllVehicles, 0}, /* CMD_DEPOT_SELL_ALL_VEHICLES */
|
||||
{CmdDepotMassAutoReplace, 0}, /* CMD_DEPOT_MASS_AUTOREPLACE */
|
||||
{CmdCreateGroup, 0}, /* CMD_CREATE_GROUP */
|
||||
{CmdDeleteGroup, 0}, /* CMD_DELETE_GROUP */
|
||||
{CmdRenameGroup, 0}, /* CMD_RENAME_GROUP */
|
||||
{CmdAddVehicleGroup, 0}, /* CMD_ADD_VEHICLE_GROUP */
|
||||
{CmdAddSharedVehicleGroup, 0}, /* CMD_ADD_SHARE_VEHICLE_GROUP */
|
||||
{CmdRemoveAllVehiclesGroup, 0}, /* CMD_REMOVE_ALL_VEHICLES_GROUP */
|
||||
{CmdSetGroupReplaceProtection, 0}, /* CMD_SET_GROUP_REPLACE_PROTECTION */
|
||||
{CmdMoveOrder, 0}, /* CMD_MOVE_ORDER */
|
||||
{CmdChangeTimetable, 0}, /* CMD_CHANGE_TIMETABLE */
|
||||
{CmdSetVehicleOnTime, 0}, /* CMD_SET_VEHICLE_ON_TIME */
|
||||
{CmdAutofillTimetable, 0}, /* CMD_AUTOFILL_TIMETABLE */
|
||||
};
|
||||
|
||||
/*!
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user