1
0
mirror of https://github.com/OpenTTD/OpenTTD.git synced 2025-08-13 17:49:10 +00:00

Compare commits

..

1 Commits

Author SHA1 Message Date
rubidium
f71e754e5c (svn r15829) -Release: 0.7.0-RC2 2009-03-23 00:22:57 +00:00
336 changed files with 10409 additions and 16256 deletions

View File

@@ -93,7 +93,7 @@ ifeq ($(shell if test -f config.cache; then echo 1; fi), 1)
@echo " Going to reconfigure with last known settings..."
@echo "----------------"
# 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 "----------------"

View File

@@ -19,8 +19,8 @@ BIN_DIR = "$(ROOT_DIR)/bin"
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@")
TTD = "openttd.exe"
TARGET := $(shell echo $(PLATFORM) | sed "s~win64~x64~;s~win32~Win32~")
all:
$(Q)cp objs/$(TARGET)/Release/$(TTD) $(BIN_DIR)/$(TTD)

View File

@@ -4,6 +4,7 @@ CC_BUILD = !!CC_BUILD!!
CXX_BUILD = !!CXX_BUILD!!
WINDRES = !!WINDRES!!
STRIP = !!STRIP!!
CC_CFLAGS = !!CC_CFLAGS!!
CFLAGS = !!CFLAGS!!
CFLAGS_BUILD = !!CFLAGS_BUILD!!
LIBS = !!LIBS!!
@@ -27,6 +28,7 @@ CFLAGS_MAKEDEP= !!CFLAGS_MAKEDEP!!
SORT = !!SORT!!
REVISION = !!REVISION!!
AWK = !!AWK!!
GCC295 = !!GCC295!!
CONFIG_CACHE_COMPILER = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_COMPILER!!
CONFIG_CACHE_LINKER = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_LINKER!!
CONFIG_CACHE_ENDIAN = $(SRC_OBJS_DIR)/!!CONFIG_CACHE_ENDIAN!!
@@ -51,6 +53,20 @@ CFLAGS_MAKEDEP += -I $(SRC_OBJS_DIR) -I $(LANG_OBJS_DIR) -I $(SCRIPT_SRC_DIR)
ENDIAN_TARGETS := endian_target.h $(ENDIAN_CHECK)
# This 'sed' basicly just removes 'const' from the line if it is a 2+D array
# 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'
# 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
# and then it compiles happily and without bitching :)
# 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'
# Check if we want to show what we are doing
ifdef VERBOSE
Q =
@@ -82,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' ')
@@ -98,7 +114,7 @@ REV_NR := 0
endif
# This helps to recompile if flags change
RES := $(shell if [ "`cat $(CONFIG_CACHE_COMPILER) 2>/dev/null`" != "$(CFLAGS)" ]; then echo "$(CFLAGS)" > $(CONFIG_CACHE_COMPILER); fi )
RES := $(shell if [ "`cat $(CONFIG_CACHE_COMPILER) 2>/dev/null`" != "$(CC_CFLAGS) $(CFLAGS)" ]; then echo "$(CC_CFLAGS) $(CFLAGS)" > $(CONFIG_CACHE_COMPILER); fi )
RES := $(shell if [ "`cat $(CONFIG_CACHE_LINKER) 2>/dev/null`" != "$(LDFLAGS) $(LIBS)" ]; then echo "$(LDFLAGS) $(LIBS)" > $(CONFIG_CACHE_LINKER); fi )
RES := $(shell if [ "`cat $(CONFIG_CACHE_ENDIAN) 2>/dev/null`" != "$(ENDIAN_FORCE)" ]; then echo "$(ENDIAN_FORCE)" > $(CONFIG_CACHE_ENDIAN); fi )
@@ -127,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)'
@@ -166,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
@@ -176,7 +192,7 @@ endif
@$(AWK) ' \
/^# DO NOT/ { print $$0 ; next} \
/^#/ {next} \
/: / { \
/:/ { \
left = NF - 1; \
for (n = 2; n <= NF; n++) { \
if (match($$n, "^$(ROOT_DIR)") == 0) { \
@@ -195,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
@@ -210,9 +226,17 @@ endif
# Compile all the files according to the targets
$(OBJS_C): %.o: $(SRC_DIR)/%.c $(DEP_MASK) $(FILE_DEP)
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.c=%.c)'
$(Q)$(CC_HOST) $(CC_CFLAGS) $(CFLAGS) -c -o $@ $<
$(OBJS_CPP): %.o: $(SRC_DIR)/%.cpp $(DEP_MASK) $(FILE_DEP)
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
ifeq ($(GCC295), 1)
$(Q)$(CXX_HOST) -E $(CFLAGS) $< | $(GCC295_FIX) | $(GCC295_FIX_2) | $(CXX_HOST) $(CFLAGS) -c -o $@ -x c++ -
else
$(Q)$(CXX_HOST) $(CFLAGS) -c -o $@ $<
endif
$(OBJS_MM): %.o: $(SRC_DIR)/%.mm $(DEP_MASK) $(FILE_DEP)
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.mm=%.mm)'
@@ -256,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:

View File

@@ -58,7 +58,7 @@ function Regression::TestInit()
}
list = AIList();
list.Sort(AIAbstractList.SORT_BY_VALUE, AIAbstractList.SORT_ASCENDING);
list.Sort(AIAbstractList.SORT_BY_VALUE, true);
print("");
print(" Value Ascending");
list.AddItem( 5, 10);
@@ -93,7 +93,7 @@ function Regression::TestInit()
}
list = AIList();
list.Sort(AIAbstractList.SORT_BY_ITEM, AIAbstractList.SORT_DESCENDING);
list.Sort(AIAbstractList.SORT_BY_ITEM, false);
print("");
print(" Item Descending");
list.AddItem( 5, 10);
@@ -128,7 +128,7 @@ function Regression::TestInit()
}
list = AIList();
list.Sort(AIAbstractList.SORT_BY_ITEM, AIAbstractList.SORT_ASCENDING);
list.Sort(AIAbstractList.SORT_BY_ITEM, true);
print("");
print(" Item Ascending");
list.AddItem( 5, 10);
@@ -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));
}
}
@@ -545,7 +540,7 @@ function Regression::Industry()
print("--Industry--");
print(" GetIndustryCount(): " + AIIndustry.GetIndustryCount());
local list = AIIndustryList();
list.Sort(AIAbstractList.SORT_BY_ITEM, AIAbstractList.SORT_ASCENDING);
list.Sort(AIAbstractList.SORT_BY_ITEM, true);
for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
if (AIIndustry.IsValidIndustry(i)) j++;
print(" Industry " + 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));
}
}
@@ -667,7 +659,7 @@ function Regression::List()
print(" HasItem(1050): " + list.HasItem(1050));
print(" HasItem(1051): " + list.HasItem(1051));
print(" IsEmpty(): " + list.IsEmpty());
list.Sort(AIAbstractList.SORT_BY_ITEM, AIAbstractList.SORT_ASCENDING);
list.Sort(AIAbstractList.SORT_BY_ITEM, true);
print(" List Dump:");
for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
print(" " + i + " => " + list.GetValue(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, AIAbstractList.SORT_ASCENDING);
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");
@@ -1347,7 +1312,7 @@ function Regression::Town()
print("--Town--");
print(" GetTownCount(): " + AITown.GetTownCount());
local list = AITownList();
list.Sort(AIAbstractList.SORT_BY_ITEM, AIAbstractList.SORT_ASCENDING);
list.Sort(AIAbstractList.SORT_BY_ITEM, true);
for (local i = list.Begin(); list.HasNext(); i = list.Next()) {
if (AITown.IsValidTown(i)) j++;
print(" Town " + i);

View File

@@ -620,7 +620,6 @@
GetAirportHeight(9): -1
GetAirportCoverageRadius(9): -1
GetBankBalance(): 100000
GetPrice(): 84
BuildAirport(): true
IsHangarTile(): false
IsAirportTile(): true
@@ -648,70 +647,70 @@
IsValidBridge(): true
GetName(): Wooden rail bridge
GetMaxSpeed(): 32
GetPrice(): 15
GetPrice(): 10
GetMaxLength(): 102
GetMinLength(): 2
Bridge 1
IsValidBridge(): true
GetName(): Concrete rail bridge
GetMaxSpeed(): 48
GetPrice(): 21
GetPrice(): 15
GetMaxLength(): 4
GetMinLength(): 2
Bridge 2
IsValidBridge(): true
GetName(): Steel girder rail bridge
GetMaxSpeed(): 64
GetPrice(): 27
GetPrice(): 19
GetMaxLength(): 7
GetMinLength(): 2
Bridge 3
IsValidBridge(): true
GetName(): Reinforced concrete suspension rail bridge
GetMaxSpeed(): 80
GetPrice(): 32
GetPrice(): 22
GetMaxLength(): 12
GetMinLength(): 4
Bridge 4
IsValidBridge(): true
GetName(): Steel suspension rail bridge
GetMaxSpeed(): 96
GetPrice(): 35
GetPrice(): 25
GetMaxLength(): 102
GetMinLength(): 5
Bridge 5
IsValidBridge(): true
GetName(): Steel suspension rail bridge
GetMaxSpeed(): 112
GetPrice(): 36
GetPrice(): 26
GetMaxLength(): 102
GetMinLength(): 5
Bridge 6
IsValidBridge(): true
GetName(): Steel cantilever rail bridge
GetMaxSpeed(): 160
GetPrice(): 42
GetPrice(): 30
GetMaxLength(): 9
GetMinLength(): 5
Bridge 7
IsValidBridge(): true
GetName(): Steel cantilever rail bridge
GetMaxSpeed(): 208
GetPrice(): 44
GetPrice(): 31
GetMaxLength(): 10
GetMinLength(): 5
Bridge 8
IsValidBridge(): true
GetName(): Steel cantilever rail bridge
GetMaxSpeed(): 240
GetPrice(): 47
GetPrice(): 33
GetMaxLength(): 11
GetMinLength(): 5
Bridge 9
IsValidBridge(): true
GetName(): Steel girder rail bridge
GetMaxSpeed(): 256
GetPrice(): 45
GetPrice(): 32
GetMaxLength(): 4
GetMinLength(): 2
Bridge 10
@@ -744,15 +743,12 @@
GetMinLength(): -1
Valid Bridges: 10
IsBridgeTile(): false
GetBridgeID(): -1
RemoveBridge(): false
GetLastErrorString(): ERR_PRECONDITION_FAILED
GetOtherBridgeEnd(): -1
BuildBridge(): true
IsBridgeTile(): true
GetBridgeID(): 5
IsBridgeTile(): true
GetBridgeID(): 5
GetOtherBridgeEnd(): 33155
BuildBridge(): false
GetLastErrorString(): ERR_ALREADY_BUILT
@@ -773,16 +769,16 @@
1 => 48
0 => 32
Price ListDump:
8 => 47
9 => 45
7 => 44
6 => 42
5 => 36
4 => 35
3 => 32
2 => 27
1 => 21
0 => 15
8 => 33
9 => 32
7 => 31
6 => 30
5 => 26
4 => 25
3 => 22
2 => 19
1 => 15
0 => 10
MaxLength ListDump:
5 => 102
4 => 102
@@ -813,9 +809,9 @@
4 => 96
0 => 32
Price ListDump:
5 => 220
4 => 212
0 => 91
5 => 73
4 => 70
0 => 30
--AICargo--
Cargo -1
@@ -828,7 +824,6 @@
GetCargoIncome(10, 10): -1
GetCargoIncome(100, 10): -1
GetCargoIncome(10, 100): -1
GetRoadVehicleTypeForCargo(): 1
Cargo 0
IsValidCargo(): true
GetCargoLabel(): 'PASS'
@@ -839,7 +834,6 @@
GetCargoIncome(10, 10): 3
GetCargoIncome(100, 10): 39
GetCargoIncome(10, 100): 3
GetRoadVehicleTypeForCargo(): 0
Cargo 1
IsValidCargo(): true
GetCargoLabel(): 'COAL'
@@ -850,7 +844,6 @@
GetCargoIncome(10, 10): 7
GetCargoIncome(100, 10): 75
GetCargoIncome(10, 100): 6
GetRoadVehicleTypeForCargo(): 1
Cargo 2
IsValidCargo(): true
GetCargoLabel(): 'MAIL'
@@ -861,7 +854,6 @@
GetCargoIncome(10, 10): 5
GetCargoIncome(100, 10): 58
GetCargoIncome(10, 100): 5
GetRoadVehicleTypeForCargo(): 1
Cargo 3
IsValidCargo(): true
GetCargoLabel(): 'OIL_'
@@ -872,7 +864,6 @@
GetCargoIncome(10, 10): 5
GetCargoIncome(100, 10): 56
GetCargoIncome(10, 100): 5
GetRoadVehicleTypeForCargo(): 1
Cargo 4
IsValidCargo(): true
GetCargoLabel(): 'LVST'
@@ -883,7 +874,6 @@
GetCargoIncome(10, 10): 5
GetCargoIncome(100, 10): 55
GetCargoIncome(10, 100): 4
GetRoadVehicleTypeForCargo(): 1
Cargo 5
IsValidCargo(): true
GetCargoLabel(): 'GOOD'
@@ -894,7 +884,6 @@
GetCargoIncome(10, 10): 7
GetCargoIncome(100, 10): 78
GetCargoIncome(10, 100): 6
GetRoadVehicleTypeForCargo(): 1
Cargo 6
IsValidCargo(): true
GetCargoLabel(): 'GRAI'
@@ -905,7 +894,6 @@
GetCargoIncome(10, 10): 6
GetCargoIncome(100, 10): 60
GetCargoIncome(10, 100): 5
GetRoadVehicleTypeForCargo(): 1
Cargo 7
IsValidCargo(): true
GetCargoLabel(): 'WOOD'
@@ -916,7 +904,6 @@
GetCargoIncome(10, 10): 6
GetCargoIncome(100, 10): 63
GetCargoIncome(10, 100): 5
GetRoadVehicleTypeForCargo(): 1
Cargo 8
IsValidCargo(): true
GetCargoLabel(): 'IORE'
@@ -927,7 +914,6 @@
GetCargoIncome(10, 10): 6
GetCargoIncome(100, 10): 65
GetCargoIncome(10, 100): 5
GetRoadVehicleTypeForCargo(): 1
Cargo 9
IsValidCargo(): true
GetCargoLabel(): 'STEL'
@@ -938,7 +924,6 @@
GetCargoIncome(10, 10): 7
GetCargoIncome(100, 10): 72
GetCargoIncome(10, 100): 6
GetRoadVehicleTypeForCargo(): 1
Cargo 10
IsValidCargo(): true
GetCargoLabel(): 'VALU'
@@ -949,7 +934,6 @@
GetCargoIncome(10, 10): 9
GetCargoIncome(100, 10): 94
GetCargoIncome(10, 100): 7
GetRoadVehicleTypeForCargo(): 1
Cargo 11
IsValidCargo(): false
GetCargoLabel(): '(null : 0x00000000)'
@@ -960,7 +944,6 @@
GetCargoIncome(10, 10): -1
GetCargoIncome(100, 10): -1
GetCargoIncome(10, 100): -1
GetRoadVehicleTypeForCargo(): 1
Cargo 12
IsValidCargo(): false
GetCargoLabel(): '(null : 0x00000000)'
@@ -971,7 +954,6 @@
GetCargoIncome(10, 10): -1
GetCargoIncome(100, 10): -1
GetCargoIncome(10, 100): -1
GetRoadVehicleTypeForCargo(): 1
Cargo 13
IsValidCargo(): false
GetCargoLabel(): '(null : 0x00000000)'
@@ -982,7 +964,6 @@
GetCargoIncome(10, 10): -1
GetCargoIncome(100, 10): -1
GetCargoIncome(10, 100): -1
GetRoadVehicleTypeForCargo(): 1
Cargo 14
IsValidCargo(): false
GetCargoLabel(): '(null : 0x00000000)'
@@ -993,7 +974,6 @@
GetCargoIncome(10, 10): -1
GetCargoIncome(100, 10): -1
GetCargoIncome(10, 100): -1
GetRoadVehicleTypeForCargo(): 1
--CargoList--
Count(): 11
@@ -1072,7 +1052,7 @@
GetAutoRenewStatus(); true
SetAutoRenewStatus(true); false
SetAutoRenewStatus(false); true
GetAutoRenewMonths(); 6
GetAutoRenewMonths(); -6
SetAutoRenewMonths(-12); true
GetAutoRenewMonths(); -12
SetAutoRenewMonths(-12); false
@@ -6927,9 +6907,6 @@
GetName(): Farm
CanBuildIndustry(): false
CanProspectIndustry(): false
IsBuiltOnWater(): false
HasHeliport(): false
HasDock(): false
Id: 5
IsRawIndustry(): true
ProductionCanIncrease(): true
@@ -6937,9 +6914,6 @@
GetName(): Oil Rig
CanBuildIndustry(): false
CanProspectIndustry(): false
IsBuiltOnWater(): true
HasHeliport(): true
HasDock(): true
Id: 12
IsRawIndustry(): false
ProductionCanIncrease(): true
@@ -6947,9 +6921,6 @@
GetName(): Bank
CanBuildIndustry(): true
CanProspectIndustry(): false
IsBuiltOnWater(): false
HasHeliport(): false
HasDock(): false
Id: 11
IsRawIndustry(): true
ProductionCanIncrease(): false
@@ -6957,9 +6928,6 @@
GetName(): Oil Wells
CanBuildIndustry(): false
CanProspectIndustry(): false
IsBuiltOnWater(): false
HasHeliport(): false
HasDock(): false
Id: 1
IsRawIndustry(): false
ProductionCanIncrease(): true
@@ -6967,9 +6935,6 @@
GetName(): Power Station
CanBuildIndustry(): true
CanProspectIndustry(): false
IsBuiltOnWater(): false
HasHeliport(): false
HasDock(): false
Id: 3
IsRawIndustry(): true
ProductionCanIncrease(): true
@@ -6977,9 +6942,6 @@
GetName(): Forest
CanBuildIndustry(): false
CanProspectIndustry(): false
IsBuiltOnWater(): false
HasHeliport(): false
HasDock(): false
Id: 2
IsRawIndustry(): false
ProductionCanIncrease(): true
@@ -6987,9 +6949,6 @@
GetName(): Sawmill
CanBuildIndustry(): true
CanProspectIndustry(): false
IsBuiltOnWater(): false
HasHeliport(): false
HasDock(): false
Id: 18
IsRawIndustry(): true
ProductionCanIncrease(): true
@@ -6997,9 +6956,6 @@
GetName(): Iron Ore Mine
CanBuildIndustry(): false
CanProspectIndustry(): false
IsBuiltOnWater(): false
HasHeliport(): false
HasDock(): false
Id: 0
IsRawIndustry(): true
ProductionCanIncrease(): true
@@ -7007,9 +6963,6 @@
GetName(): Coal Mine
CanBuildIndustry(): false
CanProspectIndustry(): false
IsBuiltOnWater(): false
HasHeliport(): false
HasDock(): false
Id: 8
IsRawIndustry(): false
ProductionCanIncrease(): true
@@ -7017,9 +6970,6 @@
GetName(): Steel Mill
CanBuildIndustry(): true
CanProspectIndustry(): false
IsBuiltOnWater(): false
HasHeliport(): false
HasDock(): false
Id: 4
IsRawIndustry(): false
ProductionCanIncrease(): true
@@ -7027,9 +6977,6 @@
GetName(): Oil Refinery
CanBuildIndustry(): true
CanProspectIndustry(): false
IsBuiltOnWater(): false
HasHeliport(): false
HasDock(): false
Id: 6
IsRawIndustry(): false
ProductionCanIncrease(): true
@@ -7037,9 +6984,6 @@
GetName(): Factory
CanBuildIndustry(): true
CanProspectIndustry(): false
IsBuiltOnWater(): false
HasHeliport(): false
HasDock(): false
--Map--
GetMapSize(): 65536
@@ -7242,6 +7186,11 @@
BuildSign(33409, 'Some other Sign'): 2
RemoveSign(2): true
GetMaxSignID(): 3
Sign -1
IsValidSign(): false
GetName(): (null : 0x00000000)
GetLocation(): -1
Sign 0
IsValidSign(): true
GetName(): Some Sign
@@ -7250,6 +7199,14 @@
IsValidSign(): true
GetName(): Test2
GetLocation(): 33411
Sign 2
IsValidSign(): false
GetName(): (null : 0x00000000)
GetLocation(): -1
Sign 3
IsValidSign(): false
GetName(): (null : 0x00000000)
GetLocation(): -1
Valid Signs: 2
--Station--
@@ -7316,7 +7273,7 @@
Count(): 9
ListDump:
27631 => 29
27631 => 65535
27631 => 255
27631 => true
27631 => false
27888 => 13
@@ -7354,178 +7311,125 @@
--TileList--
Count(): 0
Count(): 27
Count(): 45
Height(): done
Count(): 27
Count(): 45
ListDump:
34956 => 4
34700 => 4
34444 => 4
34955 => 3
34954 => 3
34953 => 3
34699 => 3
34698 => 3
34697 => 3
34693 => 3
34692 => 3
34443 => 3
34442 => 3
34441 => 3
34439 => 3
34438 => 3
34437 => 3
34436 => 3
34952 => 2
34951 => 2
34950 => 2
34949 => 2
34948 => 2
34696 => 2
34695 => 2
34694 => 2
34440 => 2
CornerHeight(North): done
Count(): 27
ListDump:
34956 => 4
34700 => 4
34444 => 4
34955 => 3
34954 => 3
34953 => 3
34699 => 3
34698 => 3
34697 => 3
34693 => 3
34692 => 3
34443 => 3
34442 => 3
34441 => 3
34439 => 3
34438 => 3
34437 => 3
34436 => 3
34952 => 2
34951 => 2
34950 => 2
34949 => 2
34948 => 2
34696 => 2
34695 => 2
34694 => 2
34440 => 2
MinHeight(): done
Count(): 27
ListDump:
34956 => 4
34700 => 4
34444 => 4
34955 => 3
34954 => 3
34953 => 3
34699 => 3
34698 => 3
34697 => 3
34443 => 3
34442 => 3
34441 => 3
34436 => 3
34952 => 2
34951 => 2
34950 => 2
34949 => 2
34948 => 2
34696 => 2
34695 => 2
34694 => 2
34693 => 2
34692 => 2
34440 => 2
34439 => 2
34438 => 2
34437 => 2
MaxHeight(): done
Count(): 27
ListDump:
34956 => 4
34955 => 4
34700 => 4
34699 => 4
34444 => 4
34443 => 4
34954 => 3
34953 => 3
34952 => 3
34951 => 3
34950 => 3
34949 => 3
34948 => 3
34698 => 3
34697 => 3
34696 => 3
34693 => 3
34692 => 3
34442 => 3
34441 => 3
34440 => 3
34439 => 3
34438 => 3
34437 => 3
34436 => 3
34695 => 2
34694 => 2
Slope(): done
KeepValue(0): done
Count(): 12
ListDump:
34956 => 0
34954 => 0
34953 => 0
34700 => 0
34698 => 0
34697 => 0
34695 => 0
34694 => 0
34444 => 0
34442 => 0
34441 => 0
34436 => 0
Buildable(): done
KeepValue(1): done
Count(): 35
BuildableRectangle(3, 3) ListDump:
42411 => 2
42410 => 2
42409 => 2
42408 => 2
42407 => 2
42154 => 2
42153 => 2
42152 => 2
42151 => 2
41898 => 2
41897 => 2
41896 => 2
41895 => 2
41642 => 2
41641 => 2
41640 => 2
41639 => 2
41386 => 2
41385 => 2
41384 => 2
41383 => 2
42415 => 1
42414 => 1
42413 => 1
42412 => 1
42411 => 1
42410 => 1
42159 => 1
42158 => 1
42157 => 1
42156 => 1
42155 => 1
42154 => 1
41903 => 1
41902 => 1
41901 => 1
41900 => 1
41899 => 1
41898 => 1
41647 => 1
41646 => 1
41645 => 1
41644 => 1
41643 => 1
41642 => 1
41391 => 1
41390 => 1
41389 => 1
41388 => 1
41387 => 1
Slope(): done
KeepValue(0): done
Count(): 38
ListDump:
42415 => 0
42414 => 0
42413 => 0
42410 => 0
42409 => 0
42408 => 0
42407 => 0
42159 => 0
42158 => 0
42157 => 0
42156 => 0
42153 => 0
42152 => 0
42151 => 0
41903 => 0
41902 => 0
41901 => 0
41900 => 0
41899 => 0
41897 => 0
41896 => 0
41895 => 0
41647 => 0
41646 => 0
41645 => 0
41644 => 0
41643 => 0
41641 => 0
41640 => 0
41639 => 0
41391 => 0
41390 => 0
41389 => 0
41388 => 0
41387 => 0
41385 => 0
41384 => 0
41383 => 0
Buildable(): done
KeepValue(1): done
Count(): 28
BuildableRectangle(3, 3) ListDump:
42415 => 1
42414 => 1
42413 => 1
42410 => 1
42159 => 1
42158 => 1
42157 => 1
42156 => 1
41903 => 1
41902 => 1
41901 => 1
41900 => 1
41899 => 1
41647 => 1
41646 => 1
41645 => 1
41644 => 1
41643 => 1
41641 => 1
41391 => 1
41390 => 1
41389 => 1
41388 => 1
41387 => 1
41386 => 1
41385 => 1
42153 => 0
41897 => 0
@@ -7537,33 +7441,26 @@
42413 => 173
42158 => 173
41903 => 173
42412 => 172
42157 => 172
41902 => 172
41647 => 172
42411 => 171
42156 => 171
41901 => 171
41646 => 171
41391 => 171
42410 => 170
42155 => 170
41900 => 170
41645 => 170
41390 => 170
42154 => 169
41899 => 169
41644 => 169
41389 => 169
42153 => 168
41898 => 168
41643 => 168
41388 => 168
41897 => 167
41642 => 167
41387 => 167
41641 => 166
41386 => 166
41385 => 165
41384 => 164
DistanceSquareToTile(30000) ListDump:
@@ -7580,24 +7477,17 @@
42157 => 17834
41390 => 17812
41901 => 17741
42412 => 17680
41645 => 17650
42156 => 17585
41389 => 17561
41900 => 17492
42411 => 17433
41644 => 17401
42155 => 17338
41388 => 17312
41899 => 17245
42410 => 17188
41643 => 17154
42154 => 17093
41387 => 17065
41898 => 17000
41642 => 16909
42153 => 16850
41386 => 16820
41897 => 16757
41641 => 16666
41385 => 16577
@@ -7606,77 +7496,63 @@
42415 => -1
42414 => -1
42413 => -1
42412 => -1
42411 => -1
42410 => -1
42159 => -1
42158 => -1
42157 => -1
42156 => -1
42155 => -1
42154 => -1
42153 => -1
41903 => -1
41902 => -1
41901 => -1
41900 => -1
41899 => -1
41898 => -1
41897 => -1
41647 => -1
41646 => -1
41645 => -1
41644 => -1
41643 => -1
41642 => -1
41641 => -1
41391 => -1
41390 => -1
41389 => -1
41388 => -1
41387 => -1
41386 => -1
41385 => -1
41384 => -1
GetClosestTown() ListDump:
42415 => 3
42414 => 3
42413 => 3
42412 => 3
42411 => 3
42410 => 3
42159 => 3
42158 => 3
42157 => 3
42156 => 3
42155 => 3
42154 => 3
42153 => 3
41903 => 3
41902 => 3
41901 => 3
41900 => 3
41899 => 3
41898 => 3
41897 => 3
41647 => 3
41646 => 3
41645 => 3
41644 => 3
41643 => 3
41642 => 3
41641 => 3
41391 => 3
41390 => 3
41389 => 3
41388 => 3
41387 => 3
41386 => 3
41385 => 3
41384 => 3
CargoAcceptance(): done
KeepAboveValue(10): done
Count(): 15
Count(): 9
ListDump:
41897 => 29
41385 => 26
@@ -7684,15 +7560,9 @@
42153 => 25
41641 => 23
41899 => 17
41898 => 17
41387 => 17
41386 => 17
41643 => 14
41642 => 14
42411 => 13
42410 => 13
42155 => 13
42154 => 13
RoadTile(): done
KeepValue(1): done
Count(): 0

Binary file not shown.

View File

@@ -1,7 +1,7 @@
; $Id$
;
; This represents the original graphics as on the Transport
; Tycoon Deluxe for Windows CD.
; Tycoon Deluxe for Windows.
;
[metadata]
name = original_windows

File diff suppressed because it is too large Load Diff

View File

@@ -5,7 +5,7 @@ log() {
}
set_default() {
released_version="0.7.3-RC1"
released_version="0.7.0-RC2"
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"
@@ -1009,74 +1008,13 @@ check_params() {
fi
}
make_compiler_cflags() {
# Params:
# $1 - compiler
# $2 - the current cflags
# $3 - variable to finally write to
flags="$2"
if [ `echo $1 | cut -c 1-3` = "icc" ]; then
# Enable some things only for certain ICC versions
cc_version=`$1 -dumpversion | cut -c 1-4`
if [ "$cc_version" = "10.1" ]; then
flags="$flags -Wno-multichar"
fi
if [ "$cc_version" = "11.0" ]; then
# warning 1899: multicharacter character literal (potential portability problem) (e.g. 'FOOD')
# vec report defaults to telling where it did loop vectorisation, which is not very important
flags="$flags -vec-report=0 -wd1899"
fi
else
# Enable some things only for certain GCC versions
cc_version=`$1 -dumpversion | cut -c 1,3`
if [ $cc_version -lt 30 ]; then
log 1 "configure: error: gcc older than 3.0 can't compile OpenTTD because of its poor template support"
exit 1
fi
flags="$flags -Wall -Wno-multichar -Wsign-compare -Wundef"
flags="$flags -Wwrite-strings -Wpointer-arith"
flags="$flags -Wno-uninitialized"
flags="$flags -W -Wno-unused-parameter -Wformat=2"
flags="$flags -Wredundant-decls"
if [ $enable_assert -eq 0 ]; then
# Do not warn about unused variables when building without asserts
flags="$flags -Wno-unused-variable"
fi
if [ $cc_version -ge 40 ]; then
# GCC 4.0+ complains about that we break strict-aliasing.
# On most places we don't see how to fix it, and it doesn't
# break anything. So disable strict-aliasing to make the
# compiler all happy.
flags="$flags -fno-strict-aliasing"
fi
if [ $cc_version -ge 42 ]; then
# GCC 4.2+ automatically assumes that signed overflows do
# not occur in signed arithmetics, whereas we are not
# sure that they will not happen. It furthermore complains
# about it's own optimized code in some places.
flags="$flags -fno-strict-overflow"
fi
fi
eval "$3=\"$flags\""
}
make_cflags_and_ldflags() {
# General CFlags for BUILD
CFLAGS_BUILD=""
# General CFlags for HOST
CFLAGS="$CFLAGS -D$os"
# CFlags for HOST and C-Compiler
CC_FLAGS=""
# Libs to compile. In fact this is just LDFLAGS
LIBS="-lstdc++"
# LDFLAGS used for HOST
@@ -1125,16 +1063,58 @@ make_cflags_and_ldflags() {
CFLAGS="$CFLAGS -DNO_THREADS"
fi
make_compiler_cflags "$cc_build" "$CFLAGS_BUILD" "CFLAGS_BUILD"
make_compiler_cflags "$cc_host" "$CFLAGS" "CFLAGS"
if [ `echo $cc_host | cut -c 1-3` = "icc" ]; then
# Enable some things only for certain ICC versions
cc_version=`$cc_host -dumpversion | cut -c 1-4`
if [ "$cc_version" = "10.1" ]; then
CFLAGS="$CFLAGS -Wno-multichar"
fi
else
# Enable some things only for certain GCC versions
cc_version=`$cc_host -dumpversion | cut -c 1,3`
if [ $cc_version -ge 29 ]; then
CFLAGS="$CFLAGS -Wall -Wno-multichar -Wsign-compare -Wundef"
CFLAGS="$CFLAGS -Wwrite-strings -Wpointer-arith"
CFLAGS="$CFLAGS -Wno-uninitialized"
CC_CFLAGS="$CC_CFLAGS -Wstrict-prototypes"
fi
gcc295=""
if [ "$cc_version" = 29 ]; then
# Make sure we mark GCC 2.95 flag for Makefile.src.in, as we
# need a lovely hack there to make it compile correctly.
gcc295="1"
# Disable warnings about unused variables when
# compiling with asserts disabled
if [ $enable_assert -eq 0 ]; then
CFLAGS="$CFLAGS -Wno-unused"
fi
fi
if [ $cc_version -ge 30 ]; then
CFLAGS="$CFLAGS -W -Wno-unused-parameter -Wformat=2"
CFLAGS="$CFLAGS -Wredundant-decls"
# Do not warn about unused variables when building without asserts
if [ $enable_assert -eq 0 ]; then
CFLAGS="$CFLAGS -Wno-unused-variable"
fi
fi
if [ $cc_version -ge 34 ]; then
CC_CFLAGS="$CC_CFLAGS -Wdeclaration-after-statement -Wold-style-definition"
fi
if [ "`echo $1 | cut -c 1-3`" != "icc" ]; then
if [ "$os" = "CYGWIN" ]; then
flags="$flags -mwin32"
CFLAGS="$CFLAGS -mwin32"
LDFLAGS="$LDFLAGS -mwin32"
fi
if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
flags="$flags -mno-cygwin"
CFLAGS="$CFLAGS -mno-cygwin"
LDFLAGS="$LDFLAGS -mno-cygwin"
fi
@@ -1142,6 +1122,22 @@ make_cflags_and_ldflags() {
LDFLAGS="$LDFLAGS -Wl,--subsystem,windows"
LIBS="$LIBS -lws2_32 -lwinmm -lgdi32 -ldxguid -lole32"
fi
# GCC 4.0+ complains about that we break strict-aliasing.
# On most places we don't see how to fix it, and it doesn't
# break anything. So disable strict-aliasing to make the
# compiler all happy.
if [ $cc_version -ge 40 ]; then
CFLAGS="$CFLAGS -fno-strict-aliasing"
fi
# GCC 4.2+ automatically assumes that signed overflows do
# not occur in signed arithmetics, whereas we are not
# sure that they will not happen. It furthermore complains
# about it's own optimized code in some places.
if [ $cc_version -ge 42 ]; then
CFLAGS="$CFLAGS -fno-strict-overflow"
fi
fi
if [ "$os" != "CYGWIN" ] && [ "$os" != "FREEBSD" ] && [ "$os" != "OPENBSD" ] && [ "$os" != "MINGW" ] && [ "$os" != "MORPHOS" ] && [ "$os" != "OSX" ] && [ "$os" != "DOS" ] && [ "$os" != "WINCE" ] && [ "$os" != "PSP" ] && [ "$os" != "OS2" ]; then
@@ -1210,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`"
@@ -1272,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
@@ -1301,8 +1297,7 @@ make_cflags_and_ldflags() {
CFLAGS="$CFLAGS -DWITH_ICU"
CFLAGS="$CFLAGS `$icu_config --cppflags | tr '\n\r' ' '`"
# Some icu-configs have the 'feature' of not adding a space where others do add the space
LIBS="$LIBS `$icu_config --ldflags-searchpath` `$icu_config --ldflags-libsonly | tr '\n\r' ' '`"
LIBS="$LIBS `$icu_config --ldflags-libsonly | tr '\n\r' ' '`"
fi
@@ -1383,7 +1378,7 @@ make_cflags_and_ldflags() {
fi
if [ "$enable_osx_g5" != "0" ]; then
CFLAGS="$CFLAGS -mcpu=G5 -mpowerpc64 -mtune=970 -mcpu=970 -mpowerpc-gpopt"
CFLAGS="$CFLAGS -mtune=970 -mcpu=970 -mpowerpc-gpopt"
fi
if [ -n "$personal_dir" ]; then
@@ -1396,7 +1391,7 @@ make_cflags_and_ldflags() {
CFLAGS="$CFLAGS -DGLOBAL_DATA_DIR=\\\\\"$prefix_dir/$data_dir\\\\\""
log 1 "using CFLAGS... $CFLAGS"
log 1 "using CFLAGS... $CFLAGS $CC_CFLAGS"
log 1 "using LDFLAGS... $LIBS $LDFLAGS"
# Makedepend doesn't like something like: -isysroot /OSX/blabla
@@ -1405,12 +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'`"
# Please escape ALL " within ` because e.g. "" terminates the string in some sh implementations
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
@@ -1589,7 +1580,7 @@ check_strip() {
elif [ "$os" = "OSX" ]; then
# Most targets have -V in strip, to see if they exists... OSX doesn't.. so execute something
echo "int main(int argc, char *argv[]) { }" > strip.test.c
$cxx_host strip.test.c -o strip.test
$cc_host strip.test.c -o strip.test
check_compiler "host strip" "strip" "$host" "$strip" "$STRIP" "strip" "strip" "3" "strip.test"
rm -f strip.test.c strip.test
else
@@ -1600,7 +1591,7 @@ check_strip() {
check_lipo() {
if [ "$os" = "OSX" ] && [ "$enable_universal" != "0" ]; then
echo "int main(int argc, char *argv[]) { }" > lipo.test.c
$cxx_host lipo.test.c -o lipo.test
$cc_host lipo.test.c -o lipo.test
check_compiler "host lipo" "lipo" "$host" "$lipo" "$LIPO" "lipo" "lipo" "4" "-info lipo.test"
rm -f lipo.test.c lipo.test
fi
@@ -1626,28 +1617,6 @@ set_universal_binary_flags() {
fi
}
check_osx_sdk() {
cat > tmp.osx.mm << EOF
#include <Cocoa/Cocoa.h>
int main() {
kCGBitmapByteOrder32Host;
return 0;
}
EOF
execute="$cxx_host $CFLAGS tmp.osx.mm -framework Cocoa -o tmp.osx 2>&1"
eval $execute > /dev/null
ret=$?
log 2 "executing $execute"
log 2 " exit code $ret"
rm -f tmp.osx.mm tmp.osx
if [ "$ret" != "0" ]; then
log 1 "Your system SDK is probably too old"
log 1 "Please install/upgrade your Xcode to >= 2.5"
exit 1
fi
}
check_direct_music() {
echo "
#include <windows.h>
@@ -2297,9 +2266,9 @@ detect_icu() {
log 2 " returned $version"
log 2 " exit code $ret"
if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$shortversion" -lt "22" ]; then
if [ -n "$shortversion" ] && [ "$shortversion" -lt "22" ]; then
log 1 "checking libicu... needs at least version 2.2.0, icu NOT enabled"
if [ -z "$version" ] || [ "$ret" != "0" ] || [ "$shortversion" -lt "20" ]; then
if [ -n "$shortversion" ] && [ "$shortversion" -lt "20" ]; then
log 1 "checking libicu... needs at least version 2.0.0, icu NOT enabled"
else
log 1 "checking libicu... not found"
fi
@@ -2436,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"
@@ -2457,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"
@@ -2532,8 +2501,7 @@ detect_cputype() {
log 1 "forcing cpu-type... $cpu_type bits"
return;
fi
echo "#define _SQ64 1" > tmp.64bit.cpp
echo "#include \"src/stdafx.h\"" >> tmp.64bit.cpp
echo "#include \"src/stdafx.h\"" > tmp.64bit.cpp
echo "assert_compile(sizeof(size_t) == 8);" >> tmp.64bit.cpp
echo "int main() { return 0; }" >> tmp.64bit.cpp
execute="$cxx_host $CFLAGS tmp.64bit.cpp -o tmp.64bit -DTESTING 2>&1"
@@ -2551,6 +2519,17 @@ make_sed() {
T_CFLAGS="$CFLAGS"
T_LDFLAGS="$LDFLAGS"
# We check here if we are PPC, because then we need to enable FOUR_BYTE_BOOL
# We do this here, and not sooner, so universal builds also have this
# automatically correct
# FOUR_BYTE_BOOL is needed, because C++ uses 4byte for a bool on PPC, where
# we use 1 byte per bool normally in C part. So convert that last one to 4
# bytes too, but only for PPC.
ppc=`$cc_host -dumpmachine | egrep "powerpc|ppc"`
if [ -n "$ppc" ]; then
T_CFLAGS="$T_CFLAGS -DFOUR_BYTE_BOOL"
fi
SRC_OBJS_DIR="$BASE_SRC_OBJS_DIR/$OBJS_SUBDIR"
# All the data needed to compile a single target
@@ -2558,102 +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@!!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@!!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

48
configure vendored
View File

@@ -1,13 +1,5 @@
#!/bin/sh
check_path_characters() {
if [ -n "`echo $ROOT_DIR | grep '[^-_A-Za-z0-9\/\\\.:]'`" ]; then
echo "WARNING: The path contains a non-alphanumeric character that might cause"
echo " failures in subsequent build stages. Any failures with the build"
echo " will most likely be caused by this."
fi
}
CONFIGURE_EXECUTABLE="$_"
# On *nix systems those two are equal when ./configure is done
if [ "$0" != "$CONFIGURE_EXECUTABLE" ]; then
@@ -22,16 +14,9 @@ if [ "$0" != "$CONFIGURE_EXECUTABLE" ]; then
fi
# Find out where configure is (in what dir)
ROOT_DIR="`dirname $0`"
# For MSYS/MinGW we want to know the FULL path. This as that path is generated
# once you call an outside binary. Having the same path for the rest is needed
# for dependency checking.
# pwd -W returns said FULL path, but doesn't exist on others so fall back.
ROOT_DIR="`cd $ROOT_DIR && (pwd -W 2>/dev/null || pwd 2>/dev/null)`"
ROOT_DIR="`cd $ROOT_DIR && pwd`"
check_path_characters
# Same here as for the ROOT_DIR above
PWD="`pwd -W 2>/dev/null || pwd 2>/dev/null`"
PWD="`pwd`"
PREFIX="$PWD/bin"
. $ROOT_DIR/config.lib
@@ -52,11 +37,10 @@ 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
RET=$?
rm -f cache.tmp
exit $RET
exit $?
fi
set_default
@@ -75,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
@@ -86,7 +70,7 @@ if [ ! -f "$LANG_DIR/english.txt" ]; then
fi
# Read the source.list and process it
AWKCOMMAND='
SRCS="`< $ROOT_DIR/source.list tr '\r' '\n' | $awk '
{ }
/^( *)#end/ { if (deep == skip) { skip -= 1; } deep -= 1; next; }
/^( *)#else/ { if (deep == skip) { skip -= 1; } else if (deep - 1 == skip) { skip += 1; } next; }
@@ -131,21 +115,17 @@ AWKCOMMAND='
print $0;
}
}
'
' | $PIPE_SORT`"
# Read the source.list and process it
# Please escape ALL " within ` because e.g. "" terminates the string in some sh implementations
SRCS="`< $ROOT_DIR/source.list tr '\r' '\n' | $awk \"$AWKCOMMAND\" | $PIPE_SORT`"
OBJS_C="` echo \"$SRCS\" | $awk ' { ORS = \" \" } /\.c$/ { gsub(\".c$\", \".o\", $0); print $0; }'`"
OBJS_CPP="`echo \"$SRCS\" | $awk ' { ORS = \" \" } /\.cpp$/ { gsub(\".cpp$\", \".o\", $0); print $0; }'`"
OBJS_MM="` echo \"$SRCS\" | $awk ' { ORS = \" \" } /\.mm$/ { gsub(\".mm$\", \".o\", $0); print $0; }'`"
OBJS_RC="` echo \"$SRCS\" | $awk ' { ORS = \" \" } /\.rc$/ { gsub(\".rc$\", \".o\", $0); print $0; }'`"
SRCS="` echo \"$SRCS\" | $awk ' { ORS = \" \" } { print $0; }'`"
OBJS_C="` echo \"$SRCS\" | $awk ' { ORS = " " } /\.c$/ { gsub(".c$", ".o", $0); print $0; }'`"
OBJS_CPP="`echo \"$SRCS\" | $awk ' { ORS = " " } /\.cpp$/ { gsub(".cpp$", ".o", $0); print $0; }'`"
OBJS_MM="` echo \"$SRCS\" | $awk ' { ORS = " " } /\.mm$/ { gsub(".mm$", ".o", $0); print $0; }'`"
OBJS_RC="` echo \"$SRCS\" | $awk ' { ORS = " " } /\.rc$/ { gsub(".rc$", ".o", $0); print $0; }'`"
SRCS="` echo \"$SRCS\" | $awk ' { ORS = " " } { print $0; }'`"
# In makefiles, we always use -u for sort
if [ -z "$sort" ]; then
sort="sed s@a@a@"
sort="sed s~a~a~"
else
sort="$sort -u"
fi
@@ -155,5 +135,3 @@ CONFIGURE_FILES="$ROOT_DIR/configure $ROOT_DIR/config.lib $ROOT_DIR/Makefile.in
generate_main
generate_lang
generate_src
check_path_characters

View File

@@ -1,7 +1,7 @@
STRGEN USAGE
------------
This guide is only interesting for people who want to alter something
themselves without access to translator.openttd.org. Please note that
themselves without access to WT2 (translator2.openttd.org). Please note that
your compiled language file will only be compatible with the OpenTTD version
you have downloaded english.txt, the master language file, for. While this is
not always true, namely when changes in the code have not touched language

View File

@@ -26,7 +26,7 @@
[metadata]
; the name of the pack, preferably less than 16 characters
name = example
; the short name (4 characters), used to identify this set
; the short name (4 characters), used to identify this set within NewGRFs
shortname = XMPL
; the version of this graphics set (read as single integer)
version = 0
@@ -49,8 +49,6 @@ tropical = TRGH.GRF
; GRF file with extra toyland sprites
toyland = TRGT.GRF
; NewGRF file using Actions 5, 7, 9 and A to replace sprites
; Must use a GRF ID starting with FF so it cannot be selected from
; the in-game NewGRF list and (thus) be loaded twice.
extra = OPENTTDD.GRF
; The md5s section lists the MD5 checksum for the files that replace them.

View File

@@ -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"

View File

@@ -11,19 +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.2
Bugs for 0.7.0-RC2
------------------------------------------------------------------------
URL: http://bugs.openttd.org
- 3057 Road vehicle sometimes 'forget' the need for servicing
- 3040 Not all alternatives are always shown in the "Join station" list
- 2955 With path signals depots are less likely to be visited
- 2891 Ignore signal does not keep the train running when in path signalled block till the next signal
- 2769 No offer for buying bankrupt AIs
- 2737 Self-crossing trains ignore "forbid 90 degree turn" setting
- 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

View File

@@ -1,6 +1,7 @@
# $Id$
# http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-1.1.html
[Desktop Entry]
Encoding=UTF-8
Type=Application
Version=1.1
Name=!!MENU_NAME!!

View File

@@ -1,76 +1,22 @@
openttd (0.7.3~RC1) unstable; urgency=low
openttd (0.7.0-RC2) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <matthijs@stdin.nl> Sun, 13 Sep 2009 10:25:56 +0200
-- Matthijs Kooijman <matthijs@stdin.nl> Mon, 23 Mar 2008 00:42:00 +0200
openttd (0.7.2) unstable; urgency=low
openttd (0.7.0-RC1) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <matthijs@stdin.nl> Sat, 01 Aug 2009 00:19:43 +0200
-- Matthijs Kooijman <matthijs@stdin.nl> Mon, 16 Mar 2008 00:07:00 +0200
openttd (0.7.2~RC2) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <matthijs@stdin.nl> Tue, 21 Jul 2009 20:25:56 +0200
openttd (0.7.2~RC1) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <matthijs@stdin.nl> Wed, 15 Jul 2009 22:25:56 +0200
openttd (0.7.1) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <matthijs@stdin.nl> Tue, 09 Jun 2009 01:34:56 +0200
openttd (0.7.1~RC3) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <matthijs@stdin.nl> Wed, 03 Jun 2009 15:34:56 +0200
openttd (0.7.1~RC2) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <matthijs@stdin.nl> Thu, 21 Mar 2009 14:34:56 +0200
openttd (0.7.1~RC1) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <matthijs@stdin.nl> Mon, 11 Mar 2009 17:34:56 +0200
openttd (0.7.0) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <matthijs@stdin.nl> Wed, 01 Apr 2009 13:37:42 +0000
openttd (0.7.0~RC2) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <matthijs@stdin.nl> Mon, 23 Mar 2009 00:42:00 +0200
openttd (0.7.0~RC1) unstable; urgency=low
* New upstream release.
-- Matthijs Kooijman <matthijs@stdin.nl> Mon, 16 Mar 2009 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.

View File

@@ -7,13 +7,10 @@
# This file and all modifications and additions to the pristine
# package are under the same license as the package itself
#
# Note: for (at least) CentOS '#' comments end '\' continue command on new line.
# So place all '#' commented parameters of e.g. configure to the end.
#
#-------------------------------------------------------------------------------
Name: openttd
Version: 0.7.3
Version: 0.7.0
Release: 1%{?dist}
Group: Amusements/Games
@@ -21,7 +18,7 @@ License: GPLv2
URL: http://www.openttd.org
Summary: OpenTTD is an Open Source clone of Chris Sawyer's Transport Tycoon Deluxe
Source: %{name}-%{version}-source.tar.bz2
Source: %{name}-%{version}.tar.bz2
Requires: fontconfig
Requires: libicu
@@ -79,23 +76,22 @@ download of the game.
--prefix-dir="%{_prefix}" \
--binary-dir="bin" \
--binary-name="%{name}" \
--enable-debug=0 \
--with-sdl \
--with-zlib \
--with-png \
--with-freetype \
--with-fontconfig \
--with-icu \
--enable-strip \
# --menu_group="Game;" \
# --menu-name="OpenTTD" \
# --data-dir="share\games\%{name}" \
# --doc-dir="share\doc\%{name}" \
# --icon-dir="share/pixmaps" \
# --icon-theme-dir="share/icons/hicolor" \
# --man-dir="share/man/man6" \
# --menu-dir="share/applications"
# --menu-dir="share/applications" \
--enable-debug=0 \
# --menu_group="Game;" \
--with-sdl \
--with-zlib \
--with-png \
--with-freetype \
--with-fontconfig \
--with-icu \
--enable-strip
make %{?_smp_mflags}
%install
@@ -105,11 +101,11 @@ make install INSTALL_DIR="%{buildroot}"
# Validate menu entrys (vendor specific)
%if %{_vendor} == "redhat" || %{_vendor}=="fedora"
desktop-file-install \
# --delete-original \
--vendor="%{_vendor}" \
--remove-key Version \
--dir="%{buildroot}/%{_datadir}/applications/" \
"%{buildroot}/%{_datadir}/applications/%{name}.desktop" \
# --delete-original
"%{buildroot}/%{_datadir}/applications/%{name}.desktop"
%endif
%clean
@@ -152,8 +148,7 @@ fi
%{_datadir}/doc/%{name}/*
%{_datadir}/games/%{name}/lang/*
%{_datadir}/games/%{name}/data/*
%{_datadir}/games/%{name}/scripts/*
%{_datadir}/applications/*%{name}.desktop
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/*
%{_datadir}/icons/hicolor/*/apps/%{name}.png
%doc %{_mandir}/man6/%{name}.6.gz

View File

@@ -1,11 +1,11 @@
!define APPNAME "OpenTTD" ; Define application name
!define APPVERSION "0.7.3-RC1" ; Define application version
!define APPVERSIONINTERNAL "0.7.3.0" ; Define application version in X.X.X.X
!define INSTALLERVERSION 66 ; NEED TO UPDATE THIS FOR EVERY RELEASE!!!
!define APPVERSION "0.7.0" ; Define application version
!define INSTALLERVERSION 57 ; 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"
@@ -71,6 +71,10 @@ Page custom SelectCDEnter SelectCDExit ": TTD folder"
!insertmacro MUI_PAGE_INSTFILES
;-----------------------------------------------------
; New custom page to show UNICODE and MSLU information
Page custom ShowWarningsPage
!define MUI_FINISHPAGE_TITLE_3LINES
!define MUI_FINISHPAGE_RUN_TEXT "Run ${APPNAMEANDVERSION} now!"
!define MUI_FINISHPAGE_RUN "$INSTDIR\openttd.exe"
@@ -108,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\"
@@ -129,6 +140,7 @@ Section "!OpenTTD" Section1
; Delete old files from the main dir. they are now placed in data/ and lang/
Delete "$INSTDIR\*.lng"
Delete "$INSTDIR\*.grf"
Delete "$INSTDIR\*.obg"
Delete "$INSTDIR\sample.cat"
Delete "$INSTDIR\ttd.exe"
@@ -367,6 +379,23 @@ WinNT:
ClearErrors
FunctionEnd
;----------------------------------------------------------------------------------
; Custom page function to show notices for running OpenTTD (only for win32 systems)
; We have extracted this custom page as Notice in the .onInit function
Function ShowWarningsPage
Call GetWindowsVersion
Pop $R0
; Don't show the UNICODE notice if the installer is run on Win9x systems
StrCmp $R0 "win9x" 0 WinNT
Abort
WinNT:
!insertmacro MUI_HEADER_TEXT "Installation Complete" "Important notices for OpenTTD usage."
!insertmacro MUI_INSTALLOPTIONS_EXTRACT_AS "notice.ini" "Notice"
!insertmacro MUI_INSTALLOPTIONS_INITDIALOG "Notice"
ClearErrors
!insertmacro MUI_INSTALLOPTIONS_SHOW
FunctionEnd
;-------------------------------------------------------------------------------
; Determine windows version, returns "win9x" if Win9x/Me or "winnt" on the stack
Function GetWindowsVersion

View File

@@ -0,0 +1,30 @@
; Ini file generated by the HM NIS Edit IO designer.
[Settings]
NumFields=3
CancelEnabled=0
[Field 1]
Type=Groupbox
Text=UNICODE support
Left=8
Right=292
Top=0
Bottom=75
[Field 2]
Type=Label
Text=This version of OpenTTD has support for UNICODE, allowing users to use non-ASCII character sets such as Russian or Japanese.\r\nSelecting such a language will result in an unusable and garbled interface. You will need to specify a font that has support for these characters in openttd.cfg, or alternatively use an appropiate grf file.\r\n\r\nFor more information please refer to the readme or the wiki.
Left=13
Right=284
Top=9
Bottom=65
[Field 3]
Type=Link
Text=OpenTTD wiki
Left=238
Right=284
Top=64
Bottom=72
State=http://wiki.openttd.org/index.php/Unicode

View File

@@ -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,7 @@ Sub UpdateFiles(version)
modified = Mid(version, InStrRev(version, Chr(9)) + 1)
version = Mid(version, 1, InStr(version, Chr(9)) - 1)
Else
version = "0.7.3-RC1"
version = "0.7.0-RC2"
revision = 0
modified = 1
End If

View File

@@ -153,7 +153,7 @@ load_lang_data() {
Name=\"VCCustomBuildTool\"
Description=\"Generating "$i" language file\"
CommandLine=\"..\\objs\\strgen\\strgen.exe -s ..\\src\\lang -d ..\\bin\\lang &quot;\$(InputPath)&quot;&#x0D;&#x0A;\"
AdditionalDependencies=\"..\\src\\lang\\english.txt\"
AdditionalDependencies=\"\"
Outputs=\"..\\bin\\lang\\"$i".lng\"
/>
</FileConfiguration>

View File

@@ -203,7 +203,7 @@ Function load_lang_data(dir)
& vbCrLf & " Name=" & Chr(34) & "VCCustomBuildTool" & Chr(34) _
& vbCrLf & " Description=" & Chr(34) & "Generating " & file & " language file" & Chr(34) _
& vbCrLf & " CommandLine=" & Chr(34) & "..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;" & Chr(34) _
& vbCrLf & " AdditionalDependencies=" & Chr(34) & "..\src\lang\english.txt" & Chr(34) _
& vbCrLf & " AdditionalDependencies=" & Chr(34) & Chr(34) _
& vbCrLf & " Outputs=" & Chr(34) & "..\bin\lang\" & file & ".lng" & Chr(34) _
& vbCrLf & " />" _
& vbCrLf & " </FileConfiguration>" _

View File

@@ -56,7 +56,7 @@
Name="VCCustomBuildTool"
Description="Generating afrikaans language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\afrikaans.lng"
/>
</FileConfiguration>
@@ -71,7 +71,7 @@
Name="VCCustomBuildTool"
Description="Generating arabic_egypt language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\arabic_egypt.lng"
/>
</FileConfiguration>
@@ -86,7 +86,7 @@
Name="VCCustomBuildTool"
Description="Generating brazilian_portuguese language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\brazilian_portuguese.lng"
/>
</FileConfiguration>
@@ -101,7 +101,7 @@
Name="VCCustomBuildTool"
Description="Generating bulgarian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\bulgarian.lng"
/>
</FileConfiguration>
@@ -116,7 +116,7 @@
Name="VCCustomBuildTool"
Description="Generating catalan language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\catalan.lng"
/>
</FileConfiguration>
@@ -131,7 +131,7 @@
Name="VCCustomBuildTool"
Description="Generating croatian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\croatian.lng"
/>
</FileConfiguration>
@@ -146,7 +146,7 @@
Name="VCCustomBuildTool"
Description="Generating czech language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\czech.lng"
/>
</FileConfiguration>
@@ -161,7 +161,7 @@
Name="VCCustomBuildTool"
Description="Generating danish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\danish.lng"
/>
</FileConfiguration>
@@ -176,7 +176,7 @@
Name="VCCustomBuildTool"
Description="Generating dutch language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\dutch.lng"
/>
</FileConfiguration>
@@ -191,7 +191,7 @@
Name="VCCustomBuildTool"
Description="Generating english language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\english.lng"
/>
</FileConfiguration>
@@ -206,7 +206,7 @@
Name="VCCustomBuildTool"
Description="Generating english_US language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\english_US.lng"
/>
</FileConfiguration>
@@ -221,7 +221,7 @@
Name="VCCustomBuildTool"
Description="Generating esperanto language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\esperanto.lng"
/>
</FileConfiguration>
@@ -236,7 +236,7 @@
Name="VCCustomBuildTool"
Description="Generating estonian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\estonian.lng"
/>
</FileConfiguration>
@@ -251,7 +251,7 @@
Name="VCCustomBuildTool"
Description="Generating finnish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\finnish.lng"
/>
</FileConfiguration>
@@ -266,7 +266,7 @@
Name="VCCustomBuildTool"
Description="Generating french language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\french.lng"
/>
</FileConfiguration>
@@ -281,7 +281,7 @@
Name="VCCustomBuildTool"
Description="Generating galician language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\galician.lng"
/>
</FileConfiguration>
@@ -296,7 +296,7 @@
Name="VCCustomBuildTool"
Description="Generating german language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\german.lng"
/>
</FileConfiguration>
@@ -311,7 +311,7 @@
Name="VCCustomBuildTool"
Description="Generating hebrew language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\hebrew.lng"
/>
</FileConfiguration>
@@ -326,7 +326,7 @@
Name="VCCustomBuildTool"
Description="Generating hungarian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\hungarian.lng"
/>
</FileConfiguration>
@@ -341,7 +341,7 @@
Name="VCCustomBuildTool"
Description="Generating icelandic language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\icelandic.lng"
/>
</FileConfiguration>
@@ -356,7 +356,7 @@
Name="VCCustomBuildTool"
Description="Generating indonesian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\indonesian.lng"
/>
</FileConfiguration>
@@ -371,7 +371,7 @@
Name="VCCustomBuildTool"
Description="Generating italian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\italian.lng"
/>
</FileConfiguration>
@@ -386,7 +386,7 @@
Name="VCCustomBuildTool"
Description="Generating japanese language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\japanese.lng"
/>
</FileConfiguration>
@@ -401,7 +401,7 @@
Name="VCCustomBuildTool"
Description="Generating korean language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\korean.lng"
/>
</FileConfiguration>
@@ -416,7 +416,7 @@
Name="VCCustomBuildTool"
Description="Generating latvian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\latvian.lng"
/>
</FileConfiguration>
@@ -431,7 +431,7 @@
Name="VCCustomBuildTool"
Description="Generating lithuanian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\lithuanian.lng"
/>
</FileConfiguration>
@@ -446,7 +446,7 @@
Name="VCCustomBuildTool"
Description="Generating luxembourgish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\luxembourgish.lng"
/>
</FileConfiguration>
@@ -461,7 +461,7 @@
Name="VCCustomBuildTool"
Description="Generating norwegian_bokmal language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\norwegian_bokmal.lng"
/>
</FileConfiguration>
@@ -476,7 +476,7 @@
Name="VCCustomBuildTool"
Description="Generating norwegian_nynorsk language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\norwegian_nynorsk.lng"
/>
</FileConfiguration>
@@ -491,7 +491,7 @@
Name="VCCustomBuildTool"
Description="Generating piglatin language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\piglatin.lng"
/>
</FileConfiguration>
@@ -506,7 +506,7 @@
Name="VCCustomBuildTool"
Description="Generating polish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\polish.lng"
/>
</FileConfiguration>
@@ -521,7 +521,7 @@
Name="VCCustomBuildTool"
Description="Generating portuguese language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\portuguese.lng"
/>
</FileConfiguration>
@@ -536,7 +536,7 @@
Name="VCCustomBuildTool"
Description="Generating romanian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\romanian.lng"
/>
</FileConfiguration>
@@ -551,26 +551,11 @@
Name="VCCustomBuildTool"
Description="Generating russian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\russian.lng"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\serbian.txt"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Generating serbian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\serbian.lng"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\simplified_chinese.txt"
>
@@ -581,7 +566,7 @@
Name="VCCustomBuildTool"
Description="Generating simplified_chinese language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\simplified_chinese.lng"
/>
</FileConfiguration>
@@ -596,7 +581,7 @@
Name="VCCustomBuildTool"
Description="Generating slovak language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\slovak.lng"
/>
</FileConfiguration>
@@ -611,7 +596,7 @@
Name="VCCustomBuildTool"
Description="Generating slovenian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\slovenian.lng"
/>
</FileConfiguration>
@@ -626,7 +611,7 @@
Name="VCCustomBuildTool"
Description="Generating spanish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\spanish.lng"
/>
</FileConfiguration>
@@ -641,7 +626,7 @@
Name="VCCustomBuildTool"
Description="Generating swedish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\swedish.lng"
/>
</FileConfiguration>
@@ -656,7 +641,7 @@
Name="VCCustomBuildTool"
Description="Generating traditional_chinese language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\traditional_chinese.lng"
/>
</FileConfiguration>
@@ -671,7 +656,7 @@
Name="VCCustomBuildTool"
Description="Generating turkish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\turkish.lng"
/>
</FileConfiguration>
@@ -686,7 +671,7 @@
Name="VCCustomBuildTool"
Description="Generating ukrainian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\ukrainian.lng"
/>
</FileConfiguration>
@@ -701,7 +686,7 @@
Name="VCCustomBuildTool"
Description="Generating welsh language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\welsh.lng"
/>
</FileConfiguration>

View File

@@ -57,7 +57,7 @@
Name="VCCustomBuildTool"
Description="Generating afrikaans language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\afrikaans.lng"
/>
</FileConfiguration>
@@ -72,7 +72,7 @@
Name="VCCustomBuildTool"
Description="Generating arabic_egypt language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\arabic_egypt.lng"
/>
</FileConfiguration>
@@ -87,7 +87,7 @@
Name="VCCustomBuildTool"
Description="Generating brazilian_portuguese language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\brazilian_portuguese.lng"
/>
</FileConfiguration>
@@ -102,7 +102,7 @@
Name="VCCustomBuildTool"
Description="Generating bulgarian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\bulgarian.lng"
/>
</FileConfiguration>
@@ -117,7 +117,7 @@
Name="VCCustomBuildTool"
Description="Generating catalan language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\catalan.lng"
/>
</FileConfiguration>
@@ -132,7 +132,7 @@
Name="VCCustomBuildTool"
Description="Generating croatian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\croatian.lng"
/>
</FileConfiguration>
@@ -147,7 +147,7 @@
Name="VCCustomBuildTool"
Description="Generating czech language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\czech.lng"
/>
</FileConfiguration>
@@ -162,7 +162,7 @@
Name="VCCustomBuildTool"
Description="Generating danish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\danish.lng"
/>
</FileConfiguration>
@@ -177,7 +177,7 @@
Name="VCCustomBuildTool"
Description="Generating dutch language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\dutch.lng"
/>
</FileConfiguration>
@@ -192,7 +192,7 @@
Name="VCCustomBuildTool"
Description="Generating english language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\english.lng"
/>
</FileConfiguration>
@@ -207,7 +207,7 @@
Name="VCCustomBuildTool"
Description="Generating english_US language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\english_US.lng"
/>
</FileConfiguration>
@@ -222,7 +222,7 @@
Name="VCCustomBuildTool"
Description="Generating esperanto language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\esperanto.lng"
/>
</FileConfiguration>
@@ -237,7 +237,7 @@
Name="VCCustomBuildTool"
Description="Generating estonian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\estonian.lng"
/>
</FileConfiguration>
@@ -252,7 +252,7 @@
Name="VCCustomBuildTool"
Description="Generating finnish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\finnish.lng"
/>
</FileConfiguration>
@@ -267,7 +267,7 @@
Name="VCCustomBuildTool"
Description="Generating french language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\french.lng"
/>
</FileConfiguration>
@@ -282,7 +282,7 @@
Name="VCCustomBuildTool"
Description="Generating galician language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\galician.lng"
/>
</FileConfiguration>
@@ -297,7 +297,7 @@
Name="VCCustomBuildTool"
Description="Generating german language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\german.lng"
/>
</FileConfiguration>
@@ -312,7 +312,7 @@
Name="VCCustomBuildTool"
Description="Generating hebrew language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\hebrew.lng"
/>
</FileConfiguration>
@@ -327,7 +327,7 @@
Name="VCCustomBuildTool"
Description="Generating hungarian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\hungarian.lng"
/>
</FileConfiguration>
@@ -342,7 +342,7 @@
Name="VCCustomBuildTool"
Description="Generating icelandic language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\icelandic.lng"
/>
</FileConfiguration>
@@ -357,7 +357,7 @@
Name="VCCustomBuildTool"
Description="Generating indonesian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\indonesian.lng"
/>
</FileConfiguration>
@@ -372,7 +372,7 @@
Name="VCCustomBuildTool"
Description="Generating italian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\italian.lng"
/>
</FileConfiguration>
@@ -387,7 +387,7 @@
Name="VCCustomBuildTool"
Description="Generating japanese language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\japanese.lng"
/>
</FileConfiguration>
@@ -402,7 +402,7 @@
Name="VCCustomBuildTool"
Description="Generating korean language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\korean.lng"
/>
</FileConfiguration>
@@ -417,7 +417,7 @@
Name="VCCustomBuildTool"
Description="Generating latvian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\latvian.lng"
/>
</FileConfiguration>
@@ -432,7 +432,7 @@
Name="VCCustomBuildTool"
Description="Generating lithuanian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\lithuanian.lng"
/>
</FileConfiguration>
@@ -447,7 +447,7 @@
Name="VCCustomBuildTool"
Description="Generating luxembourgish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\luxembourgish.lng"
/>
</FileConfiguration>
@@ -462,7 +462,7 @@
Name="VCCustomBuildTool"
Description="Generating norwegian_bokmal language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\norwegian_bokmal.lng"
/>
</FileConfiguration>
@@ -477,7 +477,7 @@
Name="VCCustomBuildTool"
Description="Generating norwegian_nynorsk language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\norwegian_nynorsk.lng"
/>
</FileConfiguration>
@@ -492,7 +492,7 @@
Name="VCCustomBuildTool"
Description="Generating piglatin language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\piglatin.lng"
/>
</FileConfiguration>
@@ -507,7 +507,7 @@
Name="VCCustomBuildTool"
Description="Generating polish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\polish.lng"
/>
</FileConfiguration>
@@ -522,7 +522,7 @@
Name="VCCustomBuildTool"
Description="Generating portuguese language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\portuguese.lng"
/>
</FileConfiguration>
@@ -537,7 +537,7 @@
Name="VCCustomBuildTool"
Description="Generating romanian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\romanian.lng"
/>
</FileConfiguration>
@@ -552,26 +552,11 @@
Name="VCCustomBuildTool"
Description="Generating russian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\russian.lng"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\serbian.txt"
>
<FileConfiguration
Name="Debug|Win32"
>
<Tool
Name="VCCustomBuildTool"
Description="Generating serbian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
Outputs="..\bin\lang\serbian.lng"
/>
</FileConfiguration>
</File>
<File
RelativePath="..\src\lang\simplified_chinese.txt"
>
@@ -582,7 +567,7 @@
Name="VCCustomBuildTool"
Description="Generating simplified_chinese language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\simplified_chinese.lng"
/>
</FileConfiguration>
@@ -597,7 +582,7 @@
Name="VCCustomBuildTool"
Description="Generating slovak language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\slovak.lng"
/>
</FileConfiguration>
@@ -612,7 +597,7 @@
Name="VCCustomBuildTool"
Description="Generating slovenian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\slovenian.lng"
/>
</FileConfiguration>
@@ -627,7 +612,7 @@
Name="VCCustomBuildTool"
Description="Generating spanish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\spanish.lng"
/>
</FileConfiguration>
@@ -642,7 +627,7 @@
Name="VCCustomBuildTool"
Description="Generating swedish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\swedish.lng"
/>
</FileConfiguration>
@@ -657,7 +642,7 @@
Name="VCCustomBuildTool"
Description="Generating traditional_chinese language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\traditional_chinese.lng"
/>
</FileConfiguration>
@@ -672,7 +657,7 @@
Name="VCCustomBuildTool"
Description="Generating turkish language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\turkish.lng"
/>
</FileConfiguration>
@@ -687,7 +672,7 @@
Name="VCCustomBuildTool"
Description="Generating ukrainian language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\ukrainian.lng"
/>
</FileConfiguration>
@@ -702,7 +687,7 @@
Name="VCCustomBuildTool"
Description="Generating welsh language file"
CommandLine="..\objs\strgen\strgen.exe -s ..\src\lang -d ..\bin\lang &quot;$(InputPath)&quot;&#x0D;&#x0A;"
AdditionalDependencies="..\src\lang\english.txt"
AdditionalDependencies=""
Outputs="..\bin\lang\welsh.lng"
/>
</FileConfiguration>

View File

@@ -103,8 +103,6 @@
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
SubSystem="2"
StackReserveSize="1048576"
StackCommitSize="1048576"
OptimizeReferences="2"
OptimizeForWindows98="1"
TargetMachine="1"
@@ -203,8 +201,6 @@
IgnoreDefaultLibraryNames="LIBCMT.lib"
GenerateDebugInformation="true"
SubSystem="2"
StackReserveSize="1048576"
StackCommitSize="1048576"
TargetMachine="1"
/>
<Tool
@@ -316,8 +312,6 @@
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
SubSystem="2"
StackReserveSize="1048576"
StackCommitSize="1048576"
OptimizeReferences="2"
OptimizeForWindows98="1"
TargetMachine="17"
@@ -419,8 +413,6 @@
IgnoreDefaultLibraryNames="LIBCMT.lib"
GenerateDebugInformation="true"
SubSystem="2"
StackReserveSize="1048576"
StackCommitSize="1048576"
TargetMachine="17"
/>
<Tool
@@ -955,10 +947,6 @@
RelativePath=".\..\src\driver.h"
>
</File>
<File
RelativePath=".\..\src\economy_base.h"
>
</File>
<File
RelativePath=".\..\src\economy_func.h"
>
@@ -2563,10 +2551,6 @@
RelativePath=".\..\src\ai\api\ai_cargolist.hpp"
>
</File>
<File
RelativePath=".\..\src\ai\api\ai_changelog.hpp"
>
</File>
<File
RelativePath=".\..\src\ai\api\ai_company.hpp"
>
@@ -2675,10 +2659,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"
>
@@ -2883,10 +2863,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"
>

View File

@@ -103,8 +103,6 @@
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
SubSystem="2"
StackReserveSize="1048576"
StackCommitSize="1048576"
OptimizeReferences="2"
OptimizeForWindows98="1"
TargetMachine="1"
@@ -203,8 +201,6 @@
IgnoreDefaultLibraryNames="LIBCMT.lib"
GenerateDebugInformation="true"
SubSystem="2"
StackReserveSize="1048576"
StackCommitSize="1048576"
TargetMachine="1"
/>
<Tool
@@ -316,8 +312,6 @@
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
SubSystem="2"
StackReserveSize="1048576"
StackCommitSize="1048576"
OptimizeReferences="2"
OptimizeForWindows98="1"
TargetMachine="17"
@@ -419,8 +413,6 @@
IgnoreDefaultLibraryNames="LIBCMT.lib"
GenerateDebugInformation="true"
SubSystem="2"
StackReserveSize="1048576"
StackCommitSize="1048576"
TargetMachine="17"
/>
<Tool

View File

@@ -104,8 +104,6 @@
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
SubSystem="2"
StackReserveSize="1048576"
StackCommitSize="1048576"
OptimizeReferences="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
@@ -202,8 +200,6 @@
IgnoreDefaultLibraryNames="LIBCMT.lib"
GenerateDebugInformation="true"
SubSystem="2"
StackReserveSize="1048576"
StackCommitSize="1048576"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
@@ -314,8 +310,6 @@
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
SubSystem="2"
StackReserveSize="1048576"
StackCommitSize="1048576"
OptimizeReferences="2"
TargetMachine="17"
/>
@@ -416,8 +410,6 @@
IgnoreDefaultLibraryNames="LIBCMT.lib"
GenerateDebugInformation="true"
SubSystem="2"
StackReserveSize="1048576"
StackCommitSize="1048576"
TargetMachine="17"
/>
<Tool
@@ -952,10 +944,6 @@
RelativePath=".\..\src\driver.h"
>
</File>
<File
RelativePath=".\..\src\economy_base.h"
>
</File>
<File
RelativePath=".\..\src\economy_func.h"
>
@@ -2560,10 +2548,6 @@
RelativePath=".\..\src\ai\api\ai_cargolist.hpp"
>
</File>
<File
RelativePath=".\..\src\ai\api\ai_changelog.hpp"
>
</File>
<File
RelativePath=".\..\src\ai\api\ai_company.hpp"
>
@@ -2672,10 +2656,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"
>
@@ -2880,10 +2860,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"
>

View File

@@ -104,8 +104,6 @@
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
SubSystem="2"
StackReserveSize="1048576"
StackCommitSize="1048576"
OptimizeReferences="2"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
@@ -202,8 +200,6 @@
IgnoreDefaultLibraryNames="LIBCMT.lib"
GenerateDebugInformation="true"
SubSystem="2"
StackReserveSize="1048576"
StackCommitSize="1048576"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="1"
@@ -314,8 +310,6 @@
IgnoreDefaultLibraryNames=""
GenerateDebugInformation="true"
SubSystem="2"
StackReserveSize="1048576"
StackCommitSize="1048576"
OptimizeReferences="2"
TargetMachine="17"
/>
@@ -416,8 +410,6 @@
IgnoreDefaultLibraryNames="LIBCMT.lib"
GenerateDebugInformation="true"
SubSystem="2"
StackReserveSize="1048576"
StackCommitSize="1048576"
TargetMachine="17"
/>
<Tool

View File

@@ -1,6 +1,6 @@
OpenTTD README
Last updated: 2009-08-18
Release version: 0.7.2
Last updated: 2009-03-23
Release version: 0.7.0-RC2
------------------------------------------------------------------------
@@ -17,7 +17,6 @@ Table of Contents:
5.0) OpenTTD features
6.0) Configuration File
7.0) Compiling
* 7.1) Required/optional libraries
8.0) Translating
* 8.1 Guidelines
* 8.2 Translation
@@ -192,19 +191,6 @@ Do NOT copy files included with OpenTTD into "shared" directories (explained in
the following sections) as sooner or later you will run into graphical glitches
when using other versions of the game.
If you want AIs use the in-game content downloader. If for some reason that is
not possible or you want to use an AI that has not been uploaded to the content
download system download the tar file and place it in the ai/ directory. If the
AI needs libraries you'll have to download those too and put them in the
ai/library/ directory. All AIs and AI Libraries that have been uploaded to
the content download system can be found at http://noai.openttd.org/downloads/
The AIs and libraries can be found their in the form of .tar.gz packages.
OpenTTD can read inside tar files but it does not extract .tar.gz files by
itself.
To figure out which libraries you need for an AI you have to start the AI and
wait for an error message to pop up. The error message will tell you
"couldn't find library 'lib-name'". Download that library and try again.
4.2) OpenTTD directories
---- -------------------------------
@@ -330,12 +316,18 @@ Windows:
You can also build it using the Makefile with MSYS/MinGW or Cygwin/MinGW.
Please read the Makefile for more information.
Solaris, FreeBSD, OpenBSD:
Use "gmake", but do a "./configure" before the first build.
Solaris 10:
You need g++ (version 3 or higher), together with SDL. Installation of
libpng and zlib is recommended. For the first build it is required
to execute "bash configure" first. Note that ./configure does not work
yet. It is likely that you don't have a strip binary, so use the
--disable-strip option in that case. Fontconfig (>2.3.0) and freetype
are optional. "make run" will then run the program.
Linux/Unix:
Unix:
OpenTTD can be built with GNU "make". On non-GNU systems it's called "gmake".
However, for the first build one has to do a "./configure" first.
Note that you need SDL-devel 1.2.5 (or higher) to compile OpenTTD.
MacOS X:
Use "make" or Xcode (which will then call make for you)
@@ -347,6 +339,15 @@ MacOS X:
BeOS:
Use "make", but do a "./configure" before the first build.
FreeBSD:
You need the port devel/sdl12 for a non-dedicated build.
graphics/png is optional for screenshots in the PNG format.
Use "gmake", but do a "./configure" before the first build.
OpenBSD:
Use "gmake", but do a "./configure" before the first build.
Note that you need the port devel/sdl to compile OpenTTD.
MorphOS:
Use "make". However, for the first build one has to do a "./configure" first.
Note that you need the MorphOS SDK, latest libnix updates (else C++ parts of
@@ -367,8 +368,6 @@ DOS:
will be generated that does not need cwsdpmi.exe by adding the cswdstub.exe
to the created OpenTTD binary.
7.1) Required/optional libraries:
---- -------------------
The following libraries are used by OpenTTD for:
- libSDL/liballegro: hardware access (video, sound, mouse)
- zlib: (de)compressing of savegames
@@ -377,18 +376,15 @@ The following libraries are used by OpenTTD for:
- libfontconfig: searching for fonts, resolving font names to actual fonts
- libicu: handling of right-to-left scripts (e.g. Arabic and Persian)
OpenTTD does not require any of the libraries to be present, but without
zlib you cannot open most savegames or use the content downloading system.
Without libSDL/liballegro on non-Windows and non-MacOS X machines you have
no graphical user interface; you would be building a dedicated server.
8.0) Translating:
---- -------------------
See http://www.openttd.org/development for up-to-date information.
The use of the online Translator service, located at
http://translator.openttd.org/, is highly encouraged. For getting an account
simply follow the guidelines in the FAQ of the translator website.
http://translator2.openttd.org/, is highly encouraged. For a username/password
combo you should contact the development team, either by mail, IRC or the
forums. The system is straightforward to use, and if you have any problems,
read the online help located there.
If for some reason the website is down for a longer period of time, the
information below might be of help.
@@ -490,7 +486,7 @@ 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 1 and 2
Attila Bán (MiHaMiX) - WebTranslator, Nightlies, Wiki and bugtracker host
Christoph Mallon (Tron) - Programmer, code correctness police
Retired Developers:
@@ -498,7 +494,7 @@ Retired Developers:
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 (0.3 - pre0.7), sys op (active)
Patric Stout (TrueLight) - Programmer, webhoster (0.3 - pre0.7)
Thanks to:
Josef Drexler - For his great work on TTDPatch.
@@ -511,8 +507,6 @@ Thanks to:
Christian Rosentreter (tokai) - MorphOS / AmigaOS port
Richard Kempton (RichK67) - Additional airports, initial TGP implementation
Alberto Demichelis - Squirrel scripting language
Markus F.X.J. Oberhumer - MiniLZO for loading old savegames
L. Peter Deutsch - MD5 implementation
Michael Blunck - For revolutionizing TTD with awesome graphics
George - Canal graphics
David Dallaston (Pikka) - Tram tracks

View File

@@ -167,7 +167,6 @@ direction_func.h
direction_type.h
music/dmusic.h
driver.h
economy_base.h
economy_func.h
economy_type.h
effectvehicle_base.h
@@ -594,7 +593,6 @@ ai/api/ai_bridge.hpp
ai/api/ai_bridgelist.hpp
ai/api/ai_cargo.hpp
ai/api/ai_cargolist.hpp
ai/api/ai_changelog.hpp
ai/api/ai_company.hpp
ai/api/ai_controller.hpp
ai/api/ai_date.hpp
@@ -622,7 +620,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
@@ -675,7 +672,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

View File

@@ -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);
@@ -286,7 +285,6 @@ SQUIRREL_API void sq_setprintfunc(HSQUIRRELVM v, SQPRINTFUNCTION printfunc);
SQUIRREL_API SQPRINTFUNCTION sq_getprintfunc(HSQUIRRELVM v);
SQUIRREL_API SQRESULT sq_suspendvm(HSQUIRRELVM v);
SQUIRREL_API bool sq_resumecatch(HSQUIRRELVM v, int suspend = -1);
SQUIRREL_API bool sq_resumeerror(HSQUIRRELVM v);
SQUIRREL_API SQRESULT sq_wakeupvm(HSQUIRRELVM v,SQBool resumedret,SQBool retval,SQBool raiseerror);
SQUIRREL_API SQInteger sq_getvmstate(HSQUIRRELVM v);

View File

@@ -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);
@@ -1010,14 +1005,6 @@ bool sq_resumecatch(HSQUIRRELVM v, int suspend)
return v->Execute(_null_, v->_top, -1, -1, ret, SQTrue, SQVM::ET_RESUME_OPENTTD);
}
bool sq_resumeerror(HSQUIRRELVM v)
{
SQObjectPtr ret;
v->_can_suspend = true;
v->_ops_till_suspend = 1;
return v->Execute(_null_, v->_top, -1, -1, ret, SQTrue, SQVM::ET_RESUME_THROW_VM);
}
void sq_setreleasehook(HSQUIRRELVM v,SQInteger idx,SQRELEASEHOOK hook)
{
if(sq_gettop(v) >= 1){

View File

@@ -128,17 +128,7 @@ public:
}
void Release() {
_uiRef++;
try {
if (_hook) { _hook(_userpointer,0);}
} catch (...) {
_uiRef--;
if (_uiRef == 0) {
SQInteger size = _memsize;
this->~SQInstance();
SQ_FREE(this, size);
}
throw;
}
if (_hook) { _hook(_userpointer,0);}
_uiRef--;
if(_uiRef > 0) return;
SQInteger size = _memsize;

View File

@@ -1110,23 +1110,6 @@ public:
case TK_STRING_LITERAL:
val = _fs->CreateString(_lex._svalue,_lex._longstr.size()-1);
break;
case '-':
Lex();
switch(_token)
{
case TK_INTEGER:
val._type = OT_INTEGER;
val._unVal.nInteger = -_lex._nvalue;
break;
case TK_FLOAT:
val._type = OT_FLOAT;
val._unVal.fFloat = -_lex._fvalue;
break;
default:
Error(_SC("scalar expected : integer,float"));
val._type = OT_NULL; // Silent compile-warning
}
break;
default:
Error(_SC("scalar expected : integer,float or string"));
val._type = OT_NULL; // Silent compile-warning

View File

@@ -188,13 +188,9 @@ SQSharedState::~SQSharedState()
#ifndef NO_GARBAGE_COLLECTOR
SQCollectable *t = _gc_chain;
SQCollectable *nx = NULL;
while(t) {
t->_uiRef++;
t = t->_next;
}
t = _gc_chain;
while(t) {
t->UnMark();
t->_uiRef++;
t->Finalize();
nx = t->_next;
if(--t->_uiRef == 0)

View File

@@ -88,7 +88,7 @@ public:
}
SQUnsignedInteger capacity() { return _allocated; }
inline T &back() const { return _vals[_size - 1]; }
inline T& operator[](SQUnsignedInteger pos) const{ assert(pos < _allocated); return _vals[pos]; }
inline T& operator[](SQUnsignedInteger pos) const{ return _vals[pos]; }
T* _vals;
private:
void _realloc(SQUnsignedInteger newsize)

View File

@@ -50,9 +50,7 @@ bool SQVM::ARITH_OP(SQUnsignedInteger op,SQObjectPtr &trg,const SQObjectPtr &o1,
res = i1 / i2;
break;
case '*': res = i1 * i2; break;
case '%': if(i2 == 0) { Raise_Error(_SC("modulo by zero")); return false; }
res = i1 % i2;
break;
case '%': res = i1 % i2; break;
default: res = 0xDEADBEEF;
}
trg = res;
@@ -85,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_;
@@ -323,10 +321,6 @@ bool SQVM::StartCall(SQClosure *closure,SQInteger target,SQInteger args,SQIntege
SQInteger ndef = func->_ndefaultparams;
if(ndef && nargs < paramssize) {
SQInteger diff = paramssize - nargs;
if (diff > ndef) {
Raise_Error(_SC("wrong number of parameters"));
return false;
}
for(SQInteger n = ndef - diff; n < ndef; n++) {
_stack._vals[stackbase + (nargs++)] = closure->_defaultparams[n];
}
@@ -688,15 +682,12 @@ bool SQVM::Execute(SQObjectPtr &closure, SQInteger target, SQInteger nargs, SQIn
break;
case ET_RESUME_GENERATOR: _generator(closure)->Resume(this, target); ci->_root = SQTrue; traps += ci->_etraps; break;
case ET_RESUME_VM:
case ET_RESUME_THROW_VM:
traps = _suspended_traps;
ci->_root = _suspended_root;
ci->_vargs = _suspend_varargs;
_suspended = SQFalse;
if(et == ET_RESUME_THROW_VM) { SQ_THROW(); }
break;
case ET_RESUME_OPENTTD:
traps = _suspended_traps;
_suspended = SQFalse;
break;
}
@@ -707,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,23 +740,15 @@ common_call:
_GUARD(gen->Yield(this));
Return(1, ct_target, clo);
STK(ct_target) = gen;
while (last_top >= _top) _stack._vals[last_top--].Null();
continue;
}
while (last_top >= _top) _stack._vals[last_top--].Null();
}
continue;
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;
@@ -945,7 +928,7 @@ common_call:
traps -= ci->_etraps;
if(sarg1 != MAX_FUNC_STACKSIZE) STK(arg1) = temp_reg;
}
else { Raise_Error(_SC("trying to yield a '%s',only genenerator can be yielded"), GetTypeName(ci->_closure)); SQ_THROW();}
else { Raise_Error(_SC("trying to yield a '%s',only genenerator can be yielded"), GetTypeName(ci->_generator)); SQ_THROW();}
if(Return(arg0, arg1, temp_reg)){
assert(traps == 0);
outres = temp_reg;
@@ -1142,8 +1125,6 @@ bool SQVM::CallNative(SQNativeClosure *nclosure,SQInteger nargs,SQInteger stackb
}
/* Store the call stack size, so we can restore that */
SQInteger cstksize = _callsstacksize;
SQInteger ret;
try {
SQBool can_suspend = this->_can_suspend;
@@ -1154,7 +1135,6 @@ bool SQVM::CallNative(SQNativeClosure *nclosure,SQInteger nargs,SQInteger stackb
_nnativecalls--;
suspend = false;
_callsstacksize = cstksize;
_stackbase = oldstackbase;
_top = oldtop;
@@ -1164,8 +1144,6 @@ bool SQVM::CallNative(SQNativeClosure *nclosure,SQInteger nargs,SQInteger stackb
throw;
}
assert(cstksize == _callsstacksize);
_nnativecalls--;
suspend = false;
if( ret == SQ_SUSPEND_FLAG) suspend = true;
@@ -1508,19 +1486,7 @@ void SQVM::Pop(SQInteger n) {
}
}
void SQVM::Push(const SQObjectPtr &o) {
/* Normally the stack shouldn't get this full, sometimes it might. As of now
* all cases have been bugs in "our" (OpenTTD) code. Trigger an assert for
* all debug builds and for the release builds just increase the stack size.
* This way getting a false positive isn't that bad (releases work fine) and
* if there is something fishy it can be caught in RCs/nightlies. */
#ifdef NDEBUG
if (_top >= (int)_stack.capacity()) _stack.resize(2 * _stack.capacity());
#else
assert(_top < (int)_stack.capacity());
#endif
_stack[_top++] = o;
}
void SQVM::Push(const SQObjectPtr &o) { _stack[_top++] = o; }
SQObjectPtr &SQVM::Top() { return _stack[_top-1]; }
SQObjectPtr &SQVM::PopGet() { return _stack[--_top]; }
SQObjectPtr &SQVM::GetUp(SQInteger n) { return _stack[_top+n]; }

View File

@@ -53,7 +53,7 @@ struct SQVM : public CHAINABLE_OBJ
typedef sqvector<CallInfo> CallInfoVec;
public:
enum ExecutionType { ET_CALL, ET_RESUME_GENERATOR, ET_RESUME_VM, ET_RESUME_THROW_VM, ET_RESUME_OPENTTD };
enum ExecutionType { ET_CALL, ET_RESUME_GENERATOR, ET_RESUME_VM, ET_RESUME_OPENTTD };
SQVM(SQSharedState *ss);
~SQVM();
bool Init(SQVM *friendvm, SQInteger stacksize);

View File

@@ -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);
}
@@ -561,7 +556,6 @@ struct AIDebugWindow : public Window {
enum AIDebugWindowWidgets {
AID_WIDGET_CLOSEBOX = 0,
AID_WIDGET_CAPTION,
AID_WIDGET_STICKY,
AID_WIDGET_VIEW,
AID_WIDGET_NAME_TEXT,
AID_WIDGET_RELOAD_TOGGLE,
@@ -581,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)
{
@@ -595,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);
@@ -606,7 +596,7 @@ struct AIDebugWindow : public Window {
virtual void OnPaint()
{
/* Check if the currently selected company is still active. */
if (ai_debug_company == INVALID_COMPANY || !IsValidCompanyID(ai_debug_company) || !GetCompany(ai_debug_company)->is_ai) {
if (ai_debug_company == INVALID_COMPANY || !IsValidCompanyID(ai_debug_company)) {
if (ai_debug_company != INVALID_COMPANY) {
/* Raise and disable the widget for the previous selection. */
this->RaiseWidget(ai_debug_company + AID_WIDGET_COMPANY_BUTTON_START);
@@ -674,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;
@@ -725,8 +693,6 @@ struct AIDebugWindow : public Window {
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();
}
@@ -742,7 +708,7 @@ struct AIDebugWindow : public Window {
if (widget == AID_WIDGET_RELOAD_TOGGLE && !this->IsWidgetDisabled(widget)) {
/* First kill the company of the AI, then start a new one. This should start the current AI again */
DoCommandP(0, 2, ai_debug_company, CMD_COMPANY_CTRL);
DoCommandP(0, 1, ai_debug_company, CMD_COMPANY_CTRL);
DoCommandP(0, 1, 0, CMD_COMPANY_CTRL);
}
}
@@ -760,7 +726,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
}
};
@@ -769,7 +734,6 @@ CompanyID AIDebugWindow::ai_debug_company = INVALID_COMPANY;
static const Widget _ai_debug_widgets[] = {
{ WWT_CLOSEBOX, RESIZE_NONE, COLOUR_GREY, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // AID_WIDGET_CLOSEBOX
{ WWT_CAPTION, RESIZE_RIGHT, COLOUR_GREY, 11, 298, 0, 13, STR_AI_DEBUG, STR_018C_WINDOW_TITLE_DRAG_THIS}, // AID_WIDGET_CAPTION
{ WWT_STICKYBOX, RESIZE_LR, COLOUR_GREY, 287, 298, 0, 13, 0x0, STR_STICKY_BUTTON }, // AID_WIDGET_STICKY
{ WWT_PANEL, RESIZE_RIGHT, COLOUR_GREY, 0, 298, 14, 40, 0x0, STR_NULL}, // AID_WIDGET_VIEW
{ WWT_PANEL, RESIZE_RIGHT, COLOUR_GREY, 0, 149, 41, 60, 0x0, STR_AI_DEBUG_NAME_TIP}, // AID_WIDGET_NAME_TEXT
@@ -807,7 +771,7 @@ static const Widget _ai_debug_widgets[] = {
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_STICKY_BUTTON | WDF_RESIZABLE,
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_RESIZABLE,
_ai_debug_widgets
);

View File

@@ -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);

View File

@@ -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 {

View File

@@ -19,7 +19,6 @@
#define DEFINE_SCRIPT_FILES
#include "ai_info.hpp"
#include "ai_config.hpp"
#include "ai_storage.hpp"
#include "ai_instance.hpp"
#include "ai_gui.hpp"
@@ -60,7 +59,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"
@@ -100,7 +98,6 @@ AIInstance::AIInstance(AIInfo *info) :
instance(NULL),
is_started(false),
is_dead(false),
is_save_data_on_stack(false),
suspend(0),
callback(NULL)
{
@@ -119,9 +116,6 @@ AIInstance::AIInstance(AIInfo *info) :
/* Register the AIController */
SQAIController_Register(this->engine);
/* Register the API functions and classes */
this->RegisterAPI();
/* Load and execute the script for this AI */
const char *main_script = info->GetMainScript();
if (strcmp(main_script, "%_dummy") == 0) {
@@ -138,6 +132,13 @@ AIInstance::AIInstance(AIInfo *info) :
this->Died();
return;
}
/* Register the API functions and classes */
this->RegisterAPI();
/* The topmost stack item is true if there is data from a savegame
* and false otherwise. */
sq_pushbool(this->engine->vm, false);
}
AIInstance::~AIInstance()
@@ -210,7 +211,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);
@@ -255,21 +255,14 @@ void AIInstance::Died()
this->engine = NULL;
ShowAIDebugWindow(_current_company);
const AIInfo *info = AIConfig::GetConfig(_current_company)->GetInfo();
if (info != NULL) {
if (strcmp(GetCompany(_current_company)->ai_info->GetMainScript(), "%_dummy") != 0) {
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()
{
if (this->IsDead()) return;
if (this->is_dead) return;
if (this->engine->HasScriptCrashed()) {
/* The script crashed during saving, kill it here. */
this->Died();
@@ -283,10 +276,6 @@ void AIInstance::GameLoop()
/* If there is a callback to call, call that first */
if (this->callback != NULL) {
if (this->is_save_data_on_stack) {
sq_poptop(this->engine->GetVM());
this->is_save_data_on_stack = false;
}
try {
this->callback(this);
} catch (AI_VMSuspend e) {
@@ -305,37 +294,20 @@ 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();
} catch (AI_VMSuspend e) {
this->suspend = e.GetSuspendTime();
this->callback = e.GetSuspendCallback();
} catch (AI_FatalError e) {
this->is_dead = true;
this->engine->ThrowError(e.GetErrorMessage());
this->engine->ResumeError();
this->Died();
}
this->is_started = true;
return;
}
if (this->is_save_data_on_stack) {
sq_poptop(this->engine->GetVM());
this->is_save_data_on_stack = false;
}
/* Continue the VM */
try {
@@ -343,17 +315,12 @@ void AIInstance::GameLoop()
} catch (AI_VMSuspend e) {
this->suspend = e.GetSuspendTime();
this->callback = e.GetSuspendCallback();
} catch (AI_FatalError e) {
this->is_dead = true;
this->engine->ThrowError(e.GetErrorMessage());
this->engine->ResumeError();
this->Died();
}
}
void AIInstance::CollectGarbage()
{
if (this->is_started && !this->IsDead()) this->engine->CollectGarbage();
if (this->is_started && !this->is_dead) this->engine->CollectGarbage();
}
/* static */ void AIInstance::DoCommandReturn(AIInstance *instance)
@@ -559,38 +526,29 @@ void AIInstance::Save()
}
HSQUIRRELVM vm = this->engine->GetVM();
if (this->is_save_data_on_stack) {
if (!this->is_started) {
SQBool res;
sq_getbool(vm, -1, &res);
if (!res) {
SaveEmpty();
return;
}
/* Push the loaded savegame data to the top of the stack. */
sq_push(vm, -2);
_ai_sl_byte = 1;
SlObject(NULL, _ai_byte);
/* Save the data that was just loaded. */
SaveObject(vm, -1, AISAVE_MAX_DEPTH, false);
} else if (!this->is_started) {
SaveEmpty();
return;
sq_poptop(vm);
} else if (this->engine->MethodExists(*this->instance, "Save")) {
HSQOBJECT savedata;
/* We don't want to be interrupted during the save function. */
bool backup_allow = AIObject::GetAllowDoCommand();
AIObject::SetAllowDoCommand(false);
try {
if (!this->engine->CallMethod(*this->instance, "Save", &savedata)) {
/* The script crashed in the Save function. We can't kill
* it here, but do so in the next AI tick. */
SaveEmpty();
this->engine->CrashOccurred();
return;
}
} catch (AI_FatalError e) {
/* If we don't mark the AI as dead here cleaning up the squirrel
* stack could throw AI_FatalError again. */
this->is_dead = true;
this->engine->ThrowError(e.GetErrorMessage());
this->engine->ResumeError();
if (!this->engine->CallMethod(*this->instance, "Save", &savedata)) {
/* The script crashed in the Save function. We can't kill
* it here, but do so in the next AI tick. */
SaveEmpty();
/* We can't kill the AI here, so mark it as crashed (not dead) and
* kill it in the next AI tick. */
this->is_dead = false;
this->engine->CrashOccurred();
return;
}
AIObject::SetAllowDoCommand(backup_allow);
@@ -598,7 +556,6 @@ void AIInstance::Save()
if (!sq_istable(savedata)) {
AILog::Error("Save function should return a table.");
SaveEmpty();
this->engine->CrashOccurred();
return;
}
sq_pushobject(vm, savedata);
@@ -606,11 +563,11 @@ void AIInstance::Save()
_ai_sl_byte = 1;
SlObject(NULL, _ai_byte);
SaveObject(vm, -1, AISAVE_MAX_DEPTH, false);
this->is_save_data_on_stack = true;
} else {
SaveEmpty();
this->engine->CrashOccurred();
_ai_sl_byte = 0;
SlObject(NULL, _ai_byte);
}
sq_pop(vm, 1);
} else {
AILog::Warning("Save function is not implemented");
_ai_sl_byte = 0;
@@ -697,18 +654,21 @@ void AIInstance::Load(int version)
/* Check if there was anything saved at all. */
if (_ai_sl_byte == 0) return;
/* First remove the value "false" since we have data to load. */
sq_poptop(vm);
sq_pushinteger(vm, version);
LoadObjects(vm);
this->is_save_data_on_stack = true;
sq_pushbool(vm, true);
}
bool AIInstance::CallLoad()
{
HSQUIRRELVM vm = this->engine->GetVM();
/* Is there save data that we should load? */
if (!this->is_save_data_on_stack) return true;
/* Whatever happens, after CallLoad the savegame data is removed from the stack. */
this->is_save_data_on_stack = false;
SQBool res;
sq_getbool(vm, -1, &res);
sq_poptop(vm);
if (!res) return true;
if (!this->engine->MethodExists(*this->instance, "Load")) {
AILog::Warning("Loading failed: there was data for the AI to load, but the AI does not have a Load() function.");
@@ -732,7 +692,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);

View File

@@ -18,7 +18,7 @@ public:
AI_VMSuspend(int time, AISuspendCallbackProc *callback) :
time(time),
callback(callback)
{}
{}
int GetSuspendTime() { return time; }
AISuspendCallbackProc *GetSuspendCallback() { return callback; }
@@ -28,24 +28,8 @@ private:
AISuspendCallbackProc *callback;
};
/**
* A throw-class that is given when the AI made a fatal error.
*/
class AI_FatalError {
public:
AI_FatalError(const char *msg) :
msg(msg)
{}
const char *GetErrorMessage() { return msg; }
private:
const char *msg;
};
class AIInstance {
public:
friend class AIObject;
AIInstance(class AIInfo *info);
~AIInstance();
@@ -95,11 +79,6 @@ public:
*/
class AIController *GetController() { return controller; }
/**
* Return the "this AI died" value
*/
inline bool IsDead() { return this->is_dead; }
/**
* Call the AI Save function and save all data in the savegame.
*/
@@ -138,7 +117,6 @@ private:
bool is_started;
bool is_dead;
bool is_save_data_on_stack;
int suspend;
AISuspendCallbackProc *callback;

View File

@@ -153,7 +153,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 +345,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;
}
@@ -412,7 +401,7 @@ AIInfo *AIScanner::FindInfo(const char *nameParam, int versionParam)
snprintf(ai_name_compare, sizeof(ai_name_compare), "%s", (*it).second->GetName());
strtolower(ai_name_compare);
if (strcasecmp(ai_name, ai_name_compare) == 0 && (*it).second->CanLoadFromVersion(versionParam) && (version == -1 || (*it).second->GetVersion() > version)) {
if (strcasecmp(ai_name, ai_name_compare) == 0 && (*it).second->CanLoadFromVersion(versionParam)) {
version = (*it).second->GetVersion();
info = (*it).second;
}

View File

@@ -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

View File

@@ -375,7 +375,6 @@ AIAbstractList::AIAbstractList()
this->sorter_type = SORT_BY_VALUE;
this->sort_ascending = false;
this->initialized = false;
this->modifications = 0;
}
AIAbstractList::~AIAbstractList()
@@ -390,8 +389,6 @@ bool AIAbstractList::HasItem(int32 item)
void AIAbstractList::Clear()
{
this->modifications++;
this->items.clear();
this->buckets.clear();
this->sorter->End();
@@ -399,8 +396,6 @@ void AIAbstractList::Clear()
void AIAbstractList::AddItem(int32 item)
{
this->modifications++;
if (this->HasItem(item)) return;
this->items[item] = 0;
@@ -409,8 +404,6 @@ void AIAbstractList::AddItem(int32 item)
void AIAbstractList::RemoveItem(int32 item)
{
this->modifications++;
if (!this->HasItem(item)) return;
int32 value = this->GetValue(item);
@@ -464,8 +457,6 @@ int32 AIAbstractList::GetValue(int32 item)
bool AIAbstractList::SetValue(int32 item, int32 value)
{
this->modifications++;
if (!this->HasItem(item)) return false;
int32 value_old = this->GetValue(item);
@@ -481,8 +472,6 @@ bool AIAbstractList::SetValue(int32 item, int32 value)
void AIAbstractList::Sort(SorterType sorter, bool ascending)
{
this->modifications++;
if (sorter != SORT_BY_VALUE && sorter != SORT_BY_ITEM) return;
if (sorter == this->sorter_type && ascending == this->sort_ascending) return;
@@ -517,8 +506,6 @@ void AIAbstractList::AddList(AIAbstractList *list)
void AIAbstractList::RemoveAboveValue(int32 value)
{
this->modifications++;
for (AIAbstractListMap::iterator next_iter, iter = this->items.begin(); iter != this->items.end(); iter = next_iter) {
next_iter = iter; next_iter++;
if ((*iter).second > value) this->items.erase(iter);
@@ -532,8 +519,6 @@ void AIAbstractList::RemoveAboveValue(int32 value)
void AIAbstractList::RemoveBelowValue(int32 value)
{
this->modifications++;
for (AIAbstractListMap::iterator next_iter, iter = this->items.begin(); iter != this->items.end(); iter = next_iter) {
next_iter = iter; next_iter++;
if ((*iter).second < value) this->items.erase(iter);
@@ -547,8 +532,6 @@ void AIAbstractList::RemoveBelowValue(int32 value)
void AIAbstractList::RemoveBetweenValue(int32 start, int32 end)
{
this->modifications++;
for (AIAbstractListMap::iterator next_iter, iter = this->items.begin(); iter != this->items.end(); iter = next_iter) {
next_iter = iter; next_iter++;
if ((*iter).second > start && (*iter).second < end) this->items.erase(iter);
@@ -562,8 +545,6 @@ void AIAbstractList::RemoveBetweenValue(int32 start, int32 end)
void AIAbstractList::RemoveValue(int32 value)
{
this->modifications++;
for (AIAbstractListMap::iterator next_iter, iter = this->items.begin(); iter != this->items.end(); iter = next_iter) {
next_iter = iter; next_iter++;
if ((*iter).second == value) this->items.erase(iter);
@@ -577,8 +558,6 @@ void AIAbstractList::RemoveValue(int32 value)
void AIAbstractList::RemoveTop(int32 count)
{
this->modifications++;
if (!this->sort_ascending) {
this->Sort(this->sorter_type, !this->sort_ascending);
this->RemoveBottom(count);
@@ -614,8 +593,6 @@ void AIAbstractList::RemoveTop(int32 count)
void AIAbstractList::RemoveBottom(int32 count)
{
this->modifications++;
if (!this->sort_ascending) {
this->Sort(this->sorter_type, !this->sort_ascending);
this->RemoveTop(count);
@@ -650,8 +627,6 @@ void AIAbstractList::RemoveBottom(int32 count)
void AIAbstractList::RemoveList(AIAbstractList *list)
{
this->modifications++;
AIAbstractListMap *list_items = &list->items;
for (AIAbstractListMap::iterator iter = list_items->begin(); iter != list_items->end(); iter++) {
this->RemoveItem((*iter).first);
@@ -660,8 +635,6 @@ void AIAbstractList::RemoveList(AIAbstractList *list)
void AIAbstractList::KeepAboveValue(int32 value)
{
this->modifications++;
for (AIAbstractListMap::iterator next_iter, iter = this->items.begin(); iter != this->items.end(); iter = next_iter) {
next_iter = iter; next_iter++;
if ((*iter).second <= value) this->items.erase(iter);
@@ -675,8 +648,6 @@ void AIAbstractList::KeepAboveValue(int32 value)
void AIAbstractList::KeepBelowValue(int32 value)
{
this->modifications++;
for (AIAbstractListMap::iterator next_iter, iter = this->items.begin(); iter != this->items.end(); iter = next_iter) {
next_iter = iter; next_iter++;
if ((*iter).second >= value) this->items.erase(iter);
@@ -690,8 +661,6 @@ void AIAbstractList::KeepBelowValue(int32 value)
void AIAbstractList::KeepBetweenValue(int32 start, int32 end)
{
this->modifications++;
for (AIAbstractListMap::iterator next_iter, iter = this->items.begin(); iter != this->items.end(); iter = next_iter) {
next_iter = iter; next_iter++;
if ((*iter).second <= start || (*iter).second >= end) this->items.erase(iter);
@@ -705,8 +674,6 @@ void AIAbstractList::KeepBetweenValue(int32 start, int32 end)
void AIAbstractList::KeepValue(int32 value)
{
this->modifications++;
for (AIAbstractListMap::iterator next_iter, iter = this->items.begin(); iter != this->items.end(); iter = next_iter) {
next_iter = iter; next_iter++;
if ((*iter).second != value) this->items.erase(iter);
@@ -720,22 +687,16 @@ void AIAbstractList::KeepValue(int32 value)
void AIAbstractList::KeepTop(int32 count)
{
this->modifications++;
this->RemoveBottom(this->Count() - count);
}
void AIAbstractList::KeepBottom(int32 count)
{
this->modifications++;
this->RemoveTop(this->Count() - count);
}
void AIAbstractList::KeepList(AIAbstractList *list)
{
this->modifications++;
AIAbstractList tmp;
for (AIAbstractListMap::iterator iter = this->items.begin(); iter != this->items.end(); iter++) {
tmp.AddItem((*iter).first);
@@ -785,8 +746,6 @@ SQInteger AIAbstractList::_nexti(HSQUIRRELVM vm)
SQInteger AIAbstractList::Valuate(HSQUIRRELVM vm)
{
this->modifications++;
/* The first parameter is the instance of AIAbstractList. */
int nparam = sq_gettop(vm) - 1;
@@ -812,10 +771,6 @@ SQInteger AIAbstractList::Valuate(HSQUIRRELVM vm)
/* Walk all items, and query the result */
this->buckets.clear();
/* Check for changing of items. */
int begin_modification_count = this->modifications;
for (AIAbstractListMap::iterator iter = this->items.begin(); iter != this->items.end(); iter++) {
/* Push the root table as instance object, this is what squirrel does for meta-functions. */
sq_pushroottable(vm);
@@ -853,15 +808,6 @@ SQInteger AIAbstractList::Valuate(HSQUIRRELVM vm)
}
}
/* Was something changed? */
if (begin_modification_count != this->modifications) {
/* See below for explanation. The extra pop is the return value. */
sq_pop(vm, nparam + 4);
AIObject::SetAllowDoCommand(backup_allow);
return sq_throwerror(vm, _SC("modifying valuated list outside of valuator function"));
}
(*iter).second = (int32)value;
this->buckets[(int32)value].insert((*iter).first);

View File

@@ -25,17 +25,11 @@ public:
SORT_BY_ITEM, //!< Sort the list based on the item itself.
};
/** Sort ascending */
static const bool SORT_ASCENDING = true;
/** Sort descnding */
static const bool SORT_DESCENDING = false;
private:
AIAbstractListSorter *sorter; //!< Sorting algorithm
SorterType sorter_type; //!< Sorting type
bool sort_ascending; //!< Whether to sort ascending or descending
bool initialized; //!< Whether an iteration has been started
int modifications; //!< Number of modification that has been done. To prevent changing data while valuating.
AIAbstractListSorter *sorter;
SorterType sorter_type;
bool sort_ascending;
bool initialized;
public:
typedef std::set<int32> AIItemList; //!< The list of items inside the bucket
@@ -129,7 +123,6 @@ public:
* @param sorter the type of sorter to use
* @param ascending if true, lowest value is on top, else at bottom.
* @note the current item stays at the same place.
* @see SORT_ASCENDING SORT_DESCENDING
*/
void Sort(SorterType sorter, bool ascending);
@@ -252,8 +245,6 @@ public:
* @param valuator_function The function which will be doing the valuation.
* @param params The params to give to the valuators (minus the first param,
* which is always the index-value we are valuating).
* @note You may not add, remove or change (setting the value of) items while
* valuating. You may also not (re)sort while valuating.
* @note You can write your own valuators and use them. Just remember that
* the first parameter should be the index-value, and it should return
* an integer.

View File

@@ -24,9 +24,6 @@ void SQAIAbstractList_Register(Squirrel *engine) {
SQAIAbstractList.DefSQConst(engine, AIAbstractList::SORT_BY_VALUE, "SORT_BY_VALUE");
SQAIAbstractList.DefSQConst(engine, AIAbstractList::SORT_BY_ITEM, "SORT_BY_ITEM");
SQAIAbstractList.DefSQConst(engine, AIAbstractList::SORT_ASCENDING, "SORT_ASCENDING");
SQAIAbstractList.DefSQConst(engine, AIAbstractList::SORT_DESCENDING, "SORT_DESCENDING");
SQAIAbstractList.DefSQMethod(engine, &AIAbstractList::Clear, "Clear", 1, "x");
SQAIAbstractList.DefSQMethod(engine, &AIAbstractList::HasItem, "HasItem", 2, "xi");
SQAIAbstractList.DefSQMethod(engine, &AIAbstractList::Begin, "Begin", 1, "x");

View File

@@ -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;

View File

@@ -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.
@@ -129,7 +122,7 @@ public:
* @exception AIError::ERR_FLAT_LAND_REQUIRED
* @exception AIError::ERR_LOCAL_AUTHORITY_REFUSES
* @exception AIStation::ERR_STATION_TOO_LARGE
* @exception AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION
* @exception AIStation::ERR_STATION_TOO_CLOSE_TO_OTHER_STATION
* @return Whether the airport has been/can be build or not.
*/
static bool BuildAirport(TileIndex tile, AirportType type, StationID station_id);

View File

@@ -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");

View File

@@ -23,15 +23,10 @@
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()) {
AIObject::SetLastCommandRes(false);
AIInstance::DoCommandReturn(instance);
return;
}
@@ -44,6 +39,7 @@ static void _DoCommandReturnBuildBridge2(class AIInstance *instance)
static void _DoCommandReturnBuildBridge1(class AIInstance *instance)
{
if (!AIBridge::_BuildBridgeRoad1()) {
AIObject::SetLastCommandRes(false);
AIInstance::DoCommandReturn(instance);
return;
}
@@ -65,7 +61,7 @@ static void _DoCommandReturnBuildBridge1(class AIInstance *instance)
switch (vehicle_type) {
case AIVehicle::VT_ROAD:
type |= (TRANSPORT_ROAD << 15);
type |= (::RoadTypeToRoadTypes((::RoadType)AIObject::GetRoadType()) << 8);
type |= (RoadTypeToRoadTypes((::RoadType)AIObject::GetRoadType()) << 8);
break;
case AIVehicle::VT_RAIL:
type |= (TRANSPORT_RAIL << 15);
@@ -84,7 +80,10 @@ static void _DoCommandReturnBuildBridge1(class AIInstance *instance)
AIObject::SetCallbackVariable(0, start);
AIObject::SetCallbackVariable(1, end);
return AIObject::DoCommand(end, start, type | bridge_id, CMD_BUILD_BRIDGE, NULL, &_DoCommandReturnBuildBridge1);
if (!AIObject::DoCommand(end, start, type | bridge_id, CMD_BUILD_BRIDGE, NULL, &_DoCommandReturnBuildBridge1)) return false;
/* In case of test-mode, test if we can build both road pieces */
return _BuildBridgeRoad1();
}
/* static */ bool AIBridge::_BuildBridgeRoad1()
@@ -96,7 +95,10 @@ static void _DoCommandReturnBuildBridge1(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, &_DoCommandReturnBuildBridge2);
if (!AIObject::DoCommand(start + ::TileOffsByDiagDir(dir_1), ::DiagDirToRoadBits(dir_2) | (AIObject::GetRoadType() << 4), 0, CMD_BUILD_ROAD, NULL, &_DoCommandReturnBuildBridge2)) return false;
/* In case of test-mode, test the other road piece too */
return _BuildBridgeRoad2();
}
/* static */ bool AIBridge::_BuildBridgeRoad2()
@@ -139,7 +141,7 @@ static void _DoCommandReturnBuildBridge1(class AIInstance *instance)
{
if (!IsValidBridge(bridge_id)) return -1;
return ::CalcBridgeLenCostFactor(length) * _price.build_bridge * ::GetBridgeSpec(bridge_id)->price >> 8;
return length * _price.build_bridge * ::GetBridgeSpec(bridge_id)->price >> 8;
}
/* static */ int32 AIBridge::GetMaxLength(BridgeID bridge_id)

View File

@@ -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.

View File

@@ -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");

View File

@@ -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.

View File

@@ -1,70 +0,0 @@
/* $Id$ */
/*
* This file is part of OpenTTD.
* OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
* OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
*/
/** @file ai_changelog.hpp Lists all changes / additions to the API.
*
* Only new / renamed / deleted api functions will be listed here. A list of
* bug fixes can be found in the normal changelog. Note that removed API
* functions may still be available if you return an older API version
* in GetAPIVersion() in info.nut.
*
* \b 0.7.3
*
* API additions:
* \li AIAbstractList::SORT_ASCENDING
* \li AIAbstractList::SORT_DESCENDING
* \li AICompany::GetPresidentGender
* \li AICompany::SetPresidentGender
* \li AIEngine::GetDesignDate
* \li AIStation::GetConstructionDate
*
* Other changes:
* \li AIs are now killed when they execute a DoCommand or Sleep at a time
* they are not allowed to do so.
* \li When the API requests a string as parameter you can give ever squirrel
* type and it'll be converted to a string
* \li AIs can create subclasses of API classes and use API constants as part
* of their own constants
*
* \b 0.7.2
*
* API additions:
* \li AIVehicle::GetReliability
*
* Other changes:
* \li DoCommands and sleeps in call, acall, pcall and valuators are disallowed
*
* \b 0.7.1
*
* API additions:
* \li AIAirport::GetPrice
* \li AIController::GetVersion
* \li AIOrder::AIOF_DEPOT_FLAGS
* \li AIOrder::AIOF_STOP_IN_DEPOT
* \li AIOrder::IsCurrentOrderPartOfOrderList
* \li AIOrder::IsGotoDepotOrder
* \li AIOrder::IsGotoStationOrder
* \li AIOrder::IsGotoWaypointOrder
* \li AISignList
* \li AITile::CORNER_[WSEN]
* \li AITile::ERR_AREA_ALREADY_FLAT
* \li AITile::ERR_EXCAVATION_WOULD_DAMAGE
* \li AITile::GetCornerHeight
* \li AITile::GetMaxHeight
* \li AITile::GetMinHeight
* \li AIVehicle::SendVehicleToDepotForServicing
*
* Other changes:
* \li GetURL() was added as optional function to info.nut
* \li UseAsRandomAI() was added as optional function to info.nut
* \li A limit was introduced on the time the AI spends in the constructor and Load function
*
* \b 0.7.0
* \li First stable release with the NoAI framework.
*/

View File

@@ -8,7 +8,6 @@
#include "../../command_func.h"
#include "../../company_func.h"
#include "../../company_base.h"
#include "../../company_manager_face.h"
#include "../../economy_func.h"
#include "../../strings_func.h"
#include "../../tile_map.h"
@@ -72,27 +71,6 @@
return president_name;
}
/* static */ bool AICompany::SetPresidentGender(Gender gender)
{
EnforcePrecondition(false, gender == GENDER_MALE || gender == GENDER_FEMALE);
EnforcePrecondition(false, GetPresidentGender(AICompany::COMPANY_SELF) != gender);
CompanyManagerFace cmf;
GenderEthnicity ge = (GenderEthnicity)((gender == GENDER_FEMALE ? (1 << ::GENDER_FEMALE) : 0) | (::InteractiveRandom() & (1 << ETHNICITY_BLACK)));
RandomCompanyManagerFaceBits(cmf, ge, false);
return AIObject::DoCommand(0, 0, cmf, CMD_SET_COMPANY_MANAGER_FACE);
}
/* static */ AICompany::Gender AICompany::GetPresidentGender(CompanyID company)
{
company = ResolveCompanyID(company);
if (company == COMPANY_INVALID) return GENDER_INVALID;
GenderEthnicity ge = (GenderEthnicity)GetCompanyManagerFaceBits(GetCompany(company)->face, CMFV_GEN_ETHN, GE_WM);
return HasBit(ge, ::GENDER_FEMALE) ? GENDER_FEMALE : GENDER_MALE;
}
/* static */ Money AICompany::GetCompanyValue(AICompany::CompanyID company)
{
company = ResolveCompanyID(company);

View File

@@ -26,13 +26,6 @@ public:
COMPANY_SELF = 254, //!< Constant that gets resolved to the correct company index for your company.
};
/** Possible genders for company presidents. */
enum Gender {
GENDER_MALE, //!< A male person.
GENDER_FEMALE, //!< A female person.
GENDER_INVALID = -1, //!< An invalid gender.
};
/**
* Resolved the given company index to the correct index for the company. If
* the company index was COMPANY_SELF it will be resolved to the index of
@@ -85,22 +78,6 @@ public:
*/
static char *GetPresidentName(CompanyID company);
/**
* Set the gender of the president of your company.
* @param gender The new gender for your president.
* @pre GetPresidentGender(AICompany.COMPANY_SELF) != gender.
* @return True if the gender was changed.
* @note When succesfull a random face will be created.
*/
static bool SetPresidentGender(Gender gender);
/**
* Get the gender of the president of the given company.
* @param company The company to get the presidents gender off.
* @return The gender of the president.
*/
static Gender GetPresidentGender(CompanyID company);
/**
* Sets the amount to loan.
* @param loan The amount to loan (multiplier of GetLoanInterval()).
@@ -176,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);

View File

@@ -7,8 +7,6 @@ namespace SQConvert {
/* Allow enums to be used as Squirrel parameters */
template <> AICompany::CompanyID GetParam(ForceType<AICompany::CompanyID>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AICompany::CompanyID)tmp; }
template <> int Return<AICompany::CompanyID>(HSQUIRRELVM vm, AICompany::CompanyID res) { sq_pushinteger(vm, (int32)res); return 1; }
template <> AICompany::Gender GetParam(ForceType<AICompany::Gender>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AICompany::Gender)tmp; }
template <> int Return<AICompany::Gender>(HSQUIRRELVM vm, AICompany::Gender res) { sq_pushinteger(vm, (int32)res); return 1; }
/* Allow AICompany to be used as Squirrel parameter */
template <> AICompany *GetParam(ForceType<AICompany *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AICompany *)instance; }
@@ -27,18 +25,13 @@ void SQAICompany_Register(Squirrel *engine) {
SQAICompany.DefSQConst(engine, AICompany::COMPANY_FIRST, "COMPANY_FIRST");
SQAICompany.DefSQConst(engine, AICompany::COMPANY_LAST, "COMPANY_LAST");
SQAICompany.DefSQConst(engine, AICompany::COMPANY_SELF, "COMPANY_SELF");
SQAICompany.DefSQConst(engine, AICompany::GENDER_MALE, "GENDER_MALE");
SQAICompany.DefSQConst(engine, AICompany::GENDER_FEMALE, "GENDER_FEMALE");
SQAICompany.DefSQConst(engine, AICompany::GENDER_INVALID, "GENDER_INVALID");
SQAICompany.DefSQStaticMethod(engine, &AICompany::ResolveCompanyID, "ResolveCompanyID", 2, ".i");
SQAICompany.DefSQStaticMethod(engine, &AICompany::IsMine, "IsMine", 2, ".i");
SQAICompany.DefSQStaticMethod(engine, &AICompany::SetName, "SetName", 2, "..");
SQAICompany.DefSQStaticMethod(engine, &AICompany::SetName, "SetName", 2, ".s");
SQAICompany.DefSQStaticMethod(engine, &AICompany::GetName, "GetName", 2, ".i");
SQAICompany.DefSQStaticMethod(engine, &AICompany::SetPresidentName, "SetPresidentName", 2, "..");
SQAICompany.DefSQStaticMethod(engine, &AICompany::SetPresidentName, "SetPresidentName", 2, ".s");
SQAICompany.DefSQStaticMethod(engine, &AICompany::GetPresidentName, "GetPresidentName", 2, ".i");
SQAICompany.DefSQStaticMethod(engine, &AICompany::SetPresidentGender, "SetPresidentGender", 2, ".i");
SQAICompany.DefSQStaticMethod(engine, &AICompany::GetPresidentGender, "GetPresidentGender", 2, ".i");
SQAICompany.DefSQStaticMethod(engine, &AICompany::SetLoanAmount, "SetLoanAmount", 2, ".i");
SQAICompany.DefSQStaticMethod(engine, &AICompany::SetMinimumLoanAmount, "SetMinimumLoanAmount", 2, ".i");
SQAICompany.DefSQStaticMethod(engine, &AICompany::GetLoanAmount, "GetLoanAmount", 1, ".");

View File

@@ -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"
@@ -23,8 +22,9 @@
/* static */ void AIController::Sleep(int ticks)
{
if (!AIObject::CanSuspend()) {
throw AI_FatalError("You are not allowed to call Sleep in your constructor, Save(), Load(), and any valuator.");
if (!AIObject::GetAllowDoCommand()) {
AILog::Error("You are not allowed to call Sleep in your constructor, Save(), Load(), and any valuator.\n");
return;
}
if (ticks <= 0) {
@@ -66,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);

View File

@@ -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

View File

@@ -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);
}

View File

@@ -25,7 +25,7 @@ AIDepotList::AIDepotList(AITile::TransportType transport_type)
if (st->owner == ::_current_company) {
const AirportFTAClass *afc = st->Airport();
for (uint i = 0; i < afc->nof_depots; i++) {
this->AddItem(st->airport_tile + ToTileIndexDiff(afc->airport_depots[i]));
this->AddItem(st->xy + ToTileIndexDiff(afc->airport_depots[i]));
}
}
}

View File

@@ -152,13 +152,6 @@
return ::GetEngine(engine_id)->GetDisplayMaxTractiveEffort();
}
/* static */ int32 AIEngine::GetDesignDate(EngineID engine_id)
{
if (!IsValidEngine(engine_id)) return -1;
return ::GetEngine(engine_id)->intro_date;
}
/* static */ AIVehicle::VehicleType AIEngine::GetVehicleType(EngineID engine_id)
{
if (!IsValidEngine(engine_id)) return AIVehicle::VT_INVALID;

View File

@@ -152,14 +152,6 @@ public:
*/
static int32 GetMaxTractiveEffort(EngineID engine_id);
/**
* Get the date this engine was designed.
* @param engine_id The engine to get the design date of.
* @pre IsValidEngine(engine_id).
* @return The date this engine was designed.
*/
static int32 GetDesignDate(EngineID engine_id);
/**
* Get the type of an engine.
* @param engine_id The engine to get the type of.

View File

@@ -31,7 +31,6 @@ void SQAIEngine_Register(Squirrel *engine) {
SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetPower, "GetPower", 2, ".i");
SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetWeight, "GetWeight", 2, ".i");
SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetMaxTractiveEffort, "GetMaxTractiveEffort", 2, ".i");
SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetDesignDate, "GetDesignDate", 2, ".i");
SQAIEngine.DefSQStaticMethod(engine, &AIEngine::GetVehicleType, "GetVehicleType", 2, ".i");
SQAIEngine.DefSQStaticMethod(engine, &AIEngine::IsWagon, "IsWagon", 2, ".i");
SQAIEngine.DefSQStaticMethod(engine, &AIEngine::CanRunOnRail, "CanRunOnRail", 3, ".ii");

View File

@@ -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),

View File

@@ -4,9 +4,6 @@
#include "ai_execmode.hpp"
#include "../../command_type.h"
#include "../../company_base.h"
#include "../../company_func.h"
#include "../ai_instance.hpp"
bool AIExecMode::ModeProc(TileIndex tile, uint32 p1, uint32 p2, uint procc, CommandCost costs)
{
@@ -24,12 +21,6 @@ AIExecMode::AIExecMode()
AIExecMode::~AIExecMode()
{
if (this->GetDoCommandModeInstance() != this) {
AIInstance *instance = GetCompany(_current_company)->ai_instance;
/* Ignore this error if the AI already died. */
if (!instance->IsDead()) {
throw AI_FatalError("AIExecMode object was removed while it was not the latest AI*Mode object created.");
}
}
assert(this->GetDoCommandModeInstance() == this);
this->SetDoCommandMode(this->last_mode, this->last_instance);
}

View File

@@ -17,8 +17,8 @@ void SQAIGameSettings_Register(Squirrel *engine) {
SQAIGameSettings.PreRegister(engine);
SQAIGameSettings.AddConstructor<void (AIGameSettings::*)(), 1>(engine, "x");
SQAIGameSettings.DefSQStaticMethod(engine, &AIGameSettings::IsValid, "IsValid", 2, "..");
SQAIGameSettings.DefSQStaticMethod(engine, &AIGameSettings::GetValue, "GetValue", 2, "..");
SQAIGameSettings.DefSQStaticMethod(engine, &AIGameSettings::IsValid, "IsValid", 2, ".s");
SQAIGameSettings.DefSQStaticMethod(engine, &AIGameSettings::GetValue, "GetValue", 2, ".s");
SQAIGameSettings.DefSQStaticMethod(engine, &AIGameSettings::IsDisabledVehicleType, "IsDisabledVehicleType", 2, ".i");
SQAIGameSettings.PostRegister(engine);

View File

@@ -29,7 +29,7 @@ void SQAIGroup_Register(Squirrel *engine) {
SQAIGroup.DefSQStaticMethod(engine, &AIGroup::CreateGroup, "CreateGroup", 2, ".i");
SQAIGroup.DefSQStaticMethod(engine, &AIGroup::DeleteGroup, "DeleteGroup", 2, ".i");
SQAIGroup.DefSQStaticMethod(engine, &AIGroup::GetVehicleType, "GetVehicleType", 2, ".i");
SQAIGroup.DefSQStaticMethod(engine, &AIGroup::SetName, "SetName", 3, ".i.");
SQAIGroup.DefSQStaticMethod(engine, &AIGroup::SetName, "SetName", 3, ".is");
SQAIGroup.DefSQStaticMethod(engine, &AIGroup::GetName, "GetName", 2, ".i");
SQAIGroup.DefSQStaticMethod(engine, &AIGroup::EnableAutoReplaceProtection, "EnableAutoReplaceProtection", 3, ".ib");
SQAIGroup.DefSQStaticMethod(engine, &AIGroup::GetAutoReplaceProtection, "GetAutoReplaceProtection", 2, ".i");

View File

@@ -91,20 +91,6 @@
return -1;
}
/* static */ int32 AIIndustry::GetLastMonthTransportedPercentage(IndustryID industry_id, CargoID cargo_id)
{
if (!IsValidIndustry(industry_id)) return -1;
if (!AICargo::IsValidCargo(cargo_id)) return -1;
const Industry *i = ::GetIndustry(industry_id);
for (byte j = 0; j < lengthof(i->produced_cargo); j++) {
if (i->produced_cargo[j] == cargo_id) return i->last_month_pct_transported[j] * 100 >> 8;
}
return -1;
}
/* static */ TileIndex AIIndustry::GetLocation(IndustryID industry_id)
{
if (!IsValidIndustry(industry_id)) return INVALID_TILE;

View File

@@ -77,16 +77,6 @@ public:
*/
static int32 GetLastMonthTransported(IndustryID industry_id, CargoID cargo_id);
/**
* Get the percentage of cargo transported from an industry last month.
* @param industry_id The index of the industry.
* @param cargo_id The index of the cargo.
* @pre IsValidIndustry(industry_id).
* @pre AICargo::IsValidCargo(cargo_id).
* @return The percentage of given cargo transported from this industry last month.
*/
static int32 GetLastMonthTransportedPercentage(IndustryID industry_id, CargoID cargo_id);
/**
* Gets the location of the industry.
* @param industry_id The index of the industry.
@@ -96,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.

View File

@@ -17,24 +17,23 @@ void SQAIIndustry_Register(Squirrel *engine) {
SQAIIndustry.PreRegister(engine);
SQAIIndustry.AddConstructor<void (AIIndustry::*)(), 1>(engine, "x");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetIndustryCount, "GetIndustryCount", 1, ".");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::IsValidIndustry, "IsValidIndustry", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetName, "GetName", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::IsCargoAccepted, "IsCargoAccepted", 3, ".ii");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetStockpiledCargo, "GetStockpiledCargo", 3, ".ii");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetLastMonthProduction, "GetLastMonthProduction", 3, ".ii");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetLastMonthTransported, "GetLastMonthTransported", 3, ".ii");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetLastMonthTransportedPercentage, "GetLastMonthTransportedPercentage", 3, ".ii");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetLocation, "GetLocation", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetAmountOfStationsAround, "GetAmountOfStationsAround", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetDistanceManhattanToTile, "GetDistanceManhattanToTile", 3, ".ii");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetDistanceSquareToTile, "GetDistanceSquareToTile", 3, ".ii");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::IsBuiltOnWater, "IsBuiltOnWater", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::HasHeliport, "HasHeliport", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetHeliportLocation, "GetHeliportLocation", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::HasDock, "HasDock", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetDockLocation, "GetDockLocation", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetIndustryType, "GetIndustryType", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetIndustryCount, "GetIndustryCount", 1, ".");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::IsValidIndustry, "IsValidIndustry", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetName, "GetName", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::IsCargoAccepted, "IsCargoAccepted", 3, ".ii");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetStockpiledCargo, "GetStockpiledCargo", 3, ".ii");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetLastMonthProduction, "GetLastMonthProduction", 3, ".ii");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetLastMonthTransported, "GetLastMonthTransported", 3, ".ii");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetLocation, "GetLocation", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetAmountOfStationsAround, "GetAmountOfStationsAround", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetDistanceManhattanToTile, "GetDistanceManhattanToTile", 3, ".ii");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetDistanceSquareToTile, "GetDistanceSquareToTile", 3, ".ii");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::IsBuiltOnWater, "IsBuiltOnWater", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::HasHeliport, "HasHeliport", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetHeliportLocation, "GetHeliportLocation", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::HasDock, "HasDock", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetDockLocation, "GetDockLocation", 2, ".i");
SQAIIndustry.DefSQStaticMethod(engine, &AIIndustry::GetIndustryType, "GetIndustryType", 2, ".i");
SQAIIndustry.PostRegister(engine);
}

View File

@@ -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;
}

View File

@@ -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 */

View File

@@ -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);
}

View File

@@ -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();

View File

@@ -17,9 +17,9 @@ void SQAILog_Register(Squirrel *engine) {
SQAILog.PreRegister(engine);
SQAILog.AddConstructor<void (AILog::*)(), 1>(engine, "x");
SQAILog.DefSQStaticMethod(engine, &AILog::Info, "Info", 2, "..");
SQAILog.DefSQStaticMethod(engine, &AILog::Warning, "Warning", 2, "..");
SQAILog.DefSQStaticMethod(engine, &AILog::Error, "Error", 2, "..");
SQAILog.DefSQStaticMethod(engine, &AILog::Info, "Info", 2, ".s");
SQAILog.DefSQStaticMethod(engine, &AILog::Warning, "Warning", 2, ".s");
SQAILog.DefSQStaticMethod(engine, &AILog::Error, "Error", 2, ".s");
SQAILog.PostRegister(engine);
}

View File

@@ -13,11 +13,10 @@
class AIMap : public AIObject {
public:
#ifdef DEFINE_SCRIPT_FILES
static const int TILE_INVALID = INVALID_TILE; //!< Invalid TileIndex.
enum MapType {
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"; }

View File

@@ -4,6 +4,10 @@
#include "ai_map.hpp"
namespace SQConvert {
/* Allow enums to be used as Squirrel parameters */
template <> AIMap::MapType GetParam(ForceType<AIMap::MapType>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQInteger tmp; sq_getinteger(vm, index, &tmp); return (AIMap::MapType)tmp; }
template <> int Return<AIMap::MapType>(HSQUIRRELVM vm, AIMap::MapType res) { sq_pushinteger(vm, (int32)res); return 1; }
/* Allow AIMap to be used as Squirrel parameter */
template <> AIMap *GetParam(ForceType<AIMap *>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return (AIMap *)instance; }
template <> AIMap &GetParam(ForceType<AIMap &>, HSQUIRRELVM vm, int index, SQAutoFreePointers *ptr) { SQUserPointer instance; sq_getinstanceup(vm, index, &instance, 0); return *(AIMap *)instance; }

View File

@@ -55,13 +55,13 @@
DiagDirection to_other_tile = (TileX(t1) == TileX(t2)) ? DIAGDIR_SE : DIAGDIR_SW;
/* Determine the reachable tracks from the shared edge */
TrackBits gtts1 = ::TrackStatusToTrackBits(::GetTileTrackStatus(t1, TRANSPORT_WATER, 0, to_other_tile)) & ::DiagdirReachesTracks(to_other_tile);
if (gtts1 == TRACK_BIT_NONE) return false;
TrackBits gtts2 = ::TrackStatusToTrackBits(::GetTileTrackStatus(t2, TRANSPORT_WATER, 0, to_other_tile)) & ::DiagdirReachesTracks(to_other_tile);
if (gtts2 == TRACK_BIT_NONE) return false;
to_other_tile = ReverseDiagDir(to_other_tile);
TrackBits gtts2 = ::TrackStatusToTrackBits(::GetTileTrackStatus(t2, TRANSPORT_WATER, 0, to_other_tile)) & ::DiagdirReachesTracks(to_other_tile);
TrackBits gtts1 = ::TrackStatusToTrackBits(::GetTileTrackStatus(t1, TRANSPORT_WATER, 0, to_other_tile)) & ::DiagdirReachesTracks(to_other_tile);
return gtts2 != TRACK_BIT_NONE;
return gtts1 != TRACK_BIT_NONE;
}
/* static */ bool AIMarine::BuildWaterDepot(TileIndex tile, TileIndex front)

View File

@@ -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"
@@ -165,12 +160,6 @@ bool AIObject::GetAllowDoCommand()
return GetStorage()->allow_do_command;
}
bool AIObject::CanSuspend()
{
Squirrel *squirrel = GetCompany(_current_company)->ai_instance->engine;
return GetStorage()->allow_do_command && squirrel->CanSuspend();
}
void *&AIObject::GetEventPointer()
{
return GetStorage()->event_data;
@@ -194,8 +183,9 @@ int AIObject::GetCallbackVariable(int index)
bool AIObject::DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint cmd, const char *text, AISuspendCallbackProc *callback)
{
if (!AIObject::CanSuspend()) {
throw AI_FatalError("You are not allowed to execute any DoCommand (even indirect) in your constructor, Save(), Load(), and any valuator.");
if (AIObject::GetAllowDoCommand() == false) {
AILog::Error("You are not allowed to execute any DoCommand (even indirect) in your constructor, Save(), Load(), and any valuator.\n");
return false;
}
CommandCost res;

View File

@@ -133,15 +133,8 @@ protected:
static GroupID GetNewGroupID();
/**
* Can we suspend the AI at this moment?
*/
static bool CanSuspend();
/**
* Get the internal value of allow_do_command. This can differ
* from CanSuspend() if the reason we are not allowed
* to execute a DoCommand is in squirrel and not the API.
* In that case use this function to restore the previous value.
* Get the latest stored allow_do_command.
* If this is false, you are not allowed to do any DoCommands.
*/
static bool GetAllowDoCommand();
@@ -150,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:

View File

@@ -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));
@@ -441,11 +356,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;

View File

@@ -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.
@@ -328,7 +281,7 @@ public:
* @pre AIVehicle::IsValidVehicle(vehicle_id).
* @pre AreOrderFlagsValid(destination, order_flags).
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
* @exception AIOrder::ERR_ORDER_TOO_MANY
* @exception AIOrder::ERR_ORDER_NO_MORE_SPACE
* @exception AIOrder::ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION
* @return True if and only if the order was appended.
*/
@@ -341,7 +294,7 @@ public:
* @pre AIVehicle::IsValidVehicle(vehicle_id).
* @pre IsValidVehicleOrder(vehicle_id, jump_to).
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
* @exception AIOrder::ERR_ORDER_TOO_MANY
* @exception AIOrder::ERR_ORDER_NO_MORE_SPACE
* @return True if and only if the order was appended.
*/
static bool AppendConditionalOrder(VehicleID vehicle_id, OrderPosition jump_to);
@@ -355,7 +308,7 @@ public:
* @pre IsValidVehicleOrder(vehicle_id, order_position).
* @pre AreOrderFlagsValid(destination, order_flags).
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
* @exception AIOrder::ERR_ORDER_TOO_MANY
* @exception AIOrder::ERR_ORDER_NO_MORE_SPACE
* @exception AIOrder::ERR_ORDER_TOO_FAR_AWAY_FROM_PREVIOUS_DESTINATION
* @return True if and only if the order was inserted.
*/
@@ -369,7 +322,7 @@ public:
* @pre IsValidVehicleOrder(vehicle_id, order_position).
* @pre IsValidVehicleOrder(vehicle_id, jump_to).
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
* @exception AIOrder::ERR_ORDER_TOO_MANY
* @exception AIOrder::ERR_ORDER_NO_MORE_SPACE
* @return True if and only if the order was inserted.
*/
static bool InsertConditionalOrder(VehicleID vehicle_id, OrderPosition order_position, OrderPosition jump_to);
@@ -442,7 +395,7 @@ public:
* @pre AIVehicle::IsValidVehicle(vehicle_id).
* @pre AIVehicle::IsValidVehicle(main_vehicle_id).
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
* @exception AIOrder::ERR_ORDER_TOO_MANY
* @exception AIOrder::ERR_ORDER_NO_MORE_SPACE
* @return True if and only if the copying succeeded.
*/
static bool CopyOrders(VehicleID vehicle_id, VehicleID main_vehicle_id);

View File

@@ -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,34 @@ 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::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.PostRegister(engine);
}

View File

@@ -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);
}
@@ -221,7 +220,7 @@
/* static */ bool AIRail::RemoveRailTrack(TileIndex tile, RailTrack rail_track)
{
EnforcePrecondition(false, ::IsValidTile(tile));
EnforcePrecondition(false, ::IsPlainRailTile(tile) || ::IsLevelCrossingTile(tile));
EnforcePrecondition(false, ::IsTileType(tile, MP_RAILWAY) && ::IsPlainRailTile(tile));
EnforcePrecondition(false, GetRailTracks(tile) & rail_track);
EnforcePrecondition(false, KillFirstBit((uint)rail_track) == 0);
@@ -404,7 +403,7 @@ static bool IsValidSignalType(int signal_type)
/* static */ bool AIRail::BuildSignal(TileIndex tile, TileIndex front, SignalType signal)
{
EnforcePrecondition(false, AIMap::DistanceManhattan(tile, front) == 1)
EnforcePrecondition(false, ::IsPlainRailTile(tile));
EnforcePrecondition(false, ::IsTileType(tile, MP_RAILWAY) && ::IsPlainRailTile(tile));
EnforcePrecondition(false, ::IsValidSignalType(signal));
Track track = INVALID_TRACK;

View File

@@ -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.

View File

@@ -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;
@@ -75,7 +69,6 @@
{
if (!::IsValidTile(t1)) return false;
if (!::IsValidTile(t2)) return false;
if (!IsRoadTypeAvailable(GetCurrentRoadType())) return false;
/* Tiles not neighbouring */
if ((abs((int)::TileX(t1) - (int)::TileX(t2)) + abs((int)::TileY(t1) - (int)::TileY(t2))) != 1) return false;
@@ -422,7 +415,6 @@ static bool NeighbourHasReachableRoad(::RoadTypes rts, TileIndex start_tile, Dia
/* static */ int32 AIRoad::GetNeighbourRoadCount(TileIndex tile)
{
if (!::IsValidTile(tile)) return false;
if (!IsRoadTypeAvailable(GetCurrentRoadType())) return false;
::RoadTypes rts = ::RoadTypeToRoadTypes((::RoadType)GetCurrentRoadType());
int32 neighbour = 0;
@@ -463,7 +455,6 @@ static bool NeighbourHasReachableRoad(::RoadTypes rts, TileIndex start_tile, Dia
EnforcePrecondition(false, ::IsValidTile(end));
EnforcePrecondition(false, ::TileX(start) == ::TileX(end) || ::TileY(start) == ::TileY(end));
EnforcePrecondition(false, !one_way || AIObject::GetRoadType() == ::ROADTYPE_ROAD);
EnforcePrecondition(false, IsRoadTypeAvailable(GetCurrentRoadType()));
return AIObject::DoCommand(end, start, (::TileY(start) != ::TileY(end) ? 4 : 0) | (((start < end) == !full) ? 1 : 2) | (AIObject::GetRoadType() << 3) | ((one_way ? 1 : 0) << 5), CMD_BUILD_LONG_ROAD);
}
@@ -494,7 +485,6 @@ static bool NeighbourHasReachableRoad(::RoadTypes rts, TileIndex start_tile, Dia
EnforcePrecondition(false, ::IsValidTile(tile));
EnforcePrecondition(false, ::IsValidTile(front));
EnforcePrecondition(false, ::TileX(tile) == ::TileX(front) || ::TileY(tile) == ::TileY(front));
EnforcePrecondition(false, IsRoadTypeAvailable(GetCurrentRoadType()));
uint entrance_dir = (::TileX(tile) == ::TileX(front)) ? (::TileY(tile) < ::TileY(front) ? 1 : 3) : (::TileX(tile) < ::TileX(front) ? 2 : 0);
@@ -509,7 +499,6 @@ static bool NeighbourHasReachableRoad(::RoadTypes rts, TileIndex start_tile, Dia
EnforcePrecondition(false, ::TileX(tile) == ::TileX(front) || ::TileY(tile) == ::TileY(front));
EnforcePrecondition(false, station_id == AIStation::STATION_NEW || station_id == AIStation::STATION_JOIN_ADJACENT || AIStation::IsValidStation(station_id));
EnforcePrecondition(false, road_veh_type == ROADVEHTYPE_BUS || road_veh_type == ROADVEHTYPE_TRUCK);
EnforcePrecondition(false, IsRoadTypeAvailable(GetCurrentRoadType()));
uint entrance_dir;
if (drive_through) {
@@ -541,7 +530,6 @@ static bool NeighbourHasReachableRoad(::RoadTypes rts, TileIndex start_tile, Dia
EnforcePrecondition(false, ::IsValidTile(start));
EnforcePrecondition(false, ::IsValidTile(end));
EnforcePrecondition(false, ::TileX(start) == ::TileX(end) || ::TileY(start) == ::TileY(end));
EnforcePrecondition(false, IsRoadTypeAvailable(GetCurrentRoadType()));
return AIObject::DoCommand(end, start, (::TileY(start) != ::TileY(end) ? 4 : 0) | (start < end ? 1 : 2) | (AIObject::GetRoadType() << 3), CMD_REMOVE_LONG_ROAD);
}
@@ -551,7 +539,6 @@ static bool NeighbourHasReachableRoad(::RoadTypes rts, TileIndex start_tile, Dia
EnforcePrecondition(false, ::IsValidTile(start));
EnforcePrecondition(false, ::IsValidTile(end));
EnforcePrecondition(false, ::TileX(start) == ::TileX(end) || ::TileY(start) == ::TileY(end));
EnforcePrecondition(false, IsRoadTypeAvailable(GetCurrentRoadType()));
return AIObject::DoCommand(end, start, (::TileY(start) != ::TileY(end) ? 4 : 0) | (start < end ? 2 : 1) | (AIObject::GetRoadType() << 3), CMD_REMOVE_LONG_ROAD);
}

View File

@@ -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
@@ -134,7 +126,6 @@ public:
* center of the second tile.
* @param tile_from The source tile.
* @param tile_to The destination tile.
* @pre IsRoadTypeAvailable(GetCurrentRoadType()).
* @pre AIMap::IsValidTile(tile_from).
* @pre AIMap::IsValidTile(tile_to).
* @pre 'tile_from' and 'tile_to' are directly neighbouring tiles.
@@ -198,7 +189,6 @@ public:
* Count how many neighbours are road.
* @param tile The tile to check on.
* @pre AIMap::IsValidTile(tile).
* @pre IsRoadTypeAvailable(GetCurrentRoadType()).
* @return 0 means no neighbour road; max value is 4.
*/
static int32 GetNeighbourRoadCount(TileIndex tile);
@@ -239,7 +229,6 @@ public:
* @pre 'start' and 'end' are in a straight line, i.e.
* AIMap::GetTileX(start) == AIMap::GetTileX(end) or
* AIMap::GetTileY(start) == AIMap::GetTileY(end).
* @pre IsRoadTypeAvailable(GetCurrentRoadType()).
* @exception AIError::ERR_ALREADY_BUILT
* @exception AIError::ERR_LAND_SLOPED_WRONG
* @exception AIError::ERR_AREA_NOT_CLEAR
@@ -287,7 +276,6 @@ public:
* @pre 'start' and 'end' are in a straight line, i.e.
* AIMap::GetTileX(start) == AIMap::GetTileX(end) or
* AIMap::GetTileY(start) == AIMap::GetTileY(end).
* @pre IsRoadTypeAvailable(GetCurrentRoadType()).
* @exception AIError::ERR_ALREADY_BUILT
* @exception AIError::ERR_LAND_SLOPED_WRONG
* @exception AIError::ERR_AREA_NOT_CLEAR
@@ -332,7 +320,6 @@ public:
* @pre AIMap::IsValidTile(tile).
* @pre AIMap::IsValidTile(front).
* @pre 'tile' is not equal to 'front', but in a straight line of it.
* @pre IsRoadTypeAvailable(GetCurrentRoadType()).
* @exception AIError::ERR_FLAT_LAND_REQUIRED
* @exception AIError::ERR_AREA_NOT_CLEAR
* @return Whether the road depot has been/can be build or not.
@@ -349,13 +336,12 @@ public:
* @pre AIMap::IsValidTile(front).
* @pre 'tile' is not equal to 'front', but in a straight line of it.
* @pre station_id == AIStation::STATION_NEW || station_id == AIStation::STATION_JOIN_ADJACENT || AIStation::IsValidStation(station_id).
* @pre GetCurrentRoadType() == ROADTYPE_ROAD.
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
* @exception AIError::ERR_AREA_NOT_CLEAR
* @exception AIError::ERR_FLAT_LAND_REQUIRED
* @exception AIRoad::ERR_ROAD_DRIVE_THROUGH_WRONG_DIRECTION
* @exception AIRoad::ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD
* @exception AIError::ERR_VEHICLE_IN_THE_WAY
* @exception AIError:ERR_VEHICLE_IN_THE_WAY
* @exception AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION
* @exception AIStation::ERR_STATION_TOO_MANY_STATIONS
* @exception AIStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN
@@ -365,7 +351,7 @@ public:
/**
* Builds a drive-through road bus or truck station.
* @param tile Place to build the station.
* @param tile Place to build the depot.
* @param front A tile on the same axis with 'tile' as the station shall be oriented.
* @param road_veh_type Whether to build a truck or bus station.
* @param station_id The station to join, AIStation::STATION_NEW or AIStation::STATION_JOIN_ADJACENT.
@@ -373,13 +359,12 @@ public:
* @pre AIMap::IsValidTile(front).
* @pre 'tile' is not equal to 'front', but in a straight line of it.
* @pre station_id == AIStation::STATION_NEW || station_id == AIStation::STATION_JOIN_ADJACENT || AIStation::IsValidStation(station_id).
* @pre IsRoadTypeAvailable(GetCurrentRoadType()).
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
* @exception AIError::ERR_AREA_NOT_CLEAR
* @exception AIError::ERR_FLAT_LAND_REQUIRED
* @exception AIRoad::ERR_ROAD_DRIVE_THROUGH_WRONG_DIRECTION
* @exception AIRoad::ERR_ROAD_CANNOT_BUILD_ON_TOWN_ROAD
* @exception AIError::ERR_VEHICLE_IN_THE_WAY
* @exception AIError:ERR_VEHICLE_IN_THE_WAY
* @exception AIStation::ERR_STATION_TOO_CLOSE_TO_ANOTHER_STATION
* @exception AIStation::ERR_STATION_TOO_MANY_STATIONS
* @exception AIStation::ERR_STATION_TOO_MANY_STATIONS_IN_TOWN
@@ -396,7 +381,6 @@ public:
* @pre 'start' and 'end' are in a straight line, i.e.
* AIMap::GetTileX(start) == AIMap::GetTileX(end) or
* AIMap::GetTileY(start) == AIMap::GetTileY(end).
* @pre IsRoadTypeAvailable(GetCurrentRoadType()).
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
* @exception AIError::ERR_VEHICLE_IN_THE_WAY
* @exception AIRoad::ERR_ROAD_WORKS_IN_PROGRESS
@@ -414,7 +398,6 @@ public:
* @pre 'start' and 'end' are in a straight line, i.e.
* AIMap::GetTileX(start) == AIMap::GetTileX(end) or
* AIMap::GetTileY(start) == AIMap::GetTileY(end).
* @pre IsRoadTypeAvailable(GetCurrentRoadType()).
* @exception AIError::ERR_OWNED_BY_ANOTHER_COMPANY
* @exception AIError::ERR_VEHICLE_IN_THE_WAY
* @exception AIRoad::ERR_ROAD_WORKS_IN_PROGRESS

View File

@@ -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");

View File

@@ -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.
*/

View File

@@ -30,10 +30,10 @@ void SQAISign_Register(Squirrel *engine) {
SQAISign.DefSQStaticMethod(engine, &AISign::GetMaxSignID, "GetMaxSignID", 1, ".");
SQAISign.DefSQStaticMethod(engine, &AISign::IsValidSign, "IsValidSign", 2, ".i");
SQAISign.DefSQStaticMethod(engine, &AISign::SetName, "SetName", 3, ".i.");
SQAISign.DefSQStaticMethod(engine, &AISign::SetName, "SetName", 3, ".is");
SQAISign.DefSQStaticMethod(engine, &AISign::GetName, "GetName", 2, ".i");
SQAISign.DefSQStaticMethod(engine, &AISign::GetLocation, "GetLocation", 2, ".i");
SQAISign.DefSQStaticMethod(engine, &AISign::BuildSign, "BuildSign", 3, ".i.");
SQAISign.DefSQStaticMethod(engine, &AISign::BuildSign, "BuildSign", 3, ".is");
SQAISign.DefSQStaticMethod(engine, &AISign::RemoveSign, "RemoveSign", 2, ".i");
SQAISign.PostRegister(engine);

View File

@@ -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);
}
}

View File

@@ -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 */

View File

@@ -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);
}

View File

@@ -17,8 +17,7 @@
/* static */ bool AIStation::IsValidStation(StationID station_id)
{
const Station *st = ::IsValidStationID(station_id) ? GetStation(station_id) : NULL;
return st != NULL && (st->owner == _current_company || st->owner == OWNER_NONE);
return ::IsValidStationID(station_id) && ::GetStation(station_id)->owner == _current_company;
}
/* static */ StationID AIStation::GetStationID(TileIndex tile)
@@ -55,13 +54,6 @@
return ::GetStation(station_id)->xy;
}
/* static */ int32 AIStation::GetConstructionDate(StationID station_id)
{
if (!IsValidStation(station_id)) return -1;
return ::GetStation(station_id)->build_date;
}
/* static */ int32 AIStation::GetCargoWaiting(StationID station_id, CargoID cargo_id)
{
if (!IsValidStation(station_id)) return -1;

View File

@@ -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
@@ -102,13 +98,6 @@ public:
*/
static TileIndex GetLocation(StationID station_id);
/**
* Get the last date a station part was added to this station.
* @param station_id The station to look at.
* @return The last date some part of this station was build.
*/
static int32 GetConstructionDate(StationID station_id);
/**
* See how much cargo there is waiting on a station.
* @param station_id The station to get the cargo-waiting of.

View File

@@ -57,9 +57,8 @@ void SQAIStation_Register(Squirrel *engine) {
SQAIStation.DefSQStaticMethod(engine, &AIStation::IsValidStation, "IsValidStation", 2, ".i");
SQAIStation.DefSQStaticMethod(engine, &AIStation::GetStationID, "GetStationID", 2, ".i");
SQAIStation.DefSQStaticMethod(engine, &AIStation::GetName, "GetName", 2, ".i");
SQAIStation.DefSQStaticMethod(engine, &AIStation::SetName, "SetName", 3, ".i.");
SQAIStation.DefSQStaticMethod(engine, &AIStation::SetName, "SetName", 3, ".is");
SQAIStation.DefSQStaticMethod(engine, &AIStation::GetLocation, "GetLocation", 2, ".i");
SQAIStation.DefSQStaticMethod(engine, &AIStation::GetConstructionDate, "GetConstructionDate", 2, ".i");
SQAIStation.DefSQStaticMethod(engine, &AIStation::GetCargoWaiting, "GetCargoWaiting", 3, ".ii");
SQAIStation.DefSQStaticMethod(engine, &AIStation::GetCargoRating, "GetCargoRating", 3, ".ii");
SQAIStation.DefSQStaticMethod(engine, &AIStation::GetCoverageRadius, "GetCoverageRadius", 2, ".i");

View File

@@ -4,9 +4,6 @@
#include "ai_testmode.hpp"
#include "../../command_type.h"
#include "../../company_base.h"
#include "../../company_func.h"
#include "../ai_instance.hpp"
bool AITestMode::ModeProc(TileIndex tile, uint32 p1, uint32 p2, uint procc, CommandCost costs)
{
@@ -24,12 +21,6 @@ AITestMode::AITestMode()
AITestMode::~AITestMode()
{
if (this->GetDoCommandModeInstance() != this) {
AIInstance *instance = GetCompany(_current_company)->ai_instance;
/* Ignore this error if the AI already died. */
if (!instance->IsDead()) {
throw AI_FatalError("AITestmode object was removed while it was not the latest AI*Mode object created.");
}
}
assert(this->GetDoCommandModeInstance() == this);
this->SetDoCommandMode(this->last_mode, this->last_instance);
}

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