mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
This commit is contained in:
parent
a332d10fd9
commit
f35ed4bbc2
|
@ -7,7 +7,7 @@ LANG_DIR = !!LANG_DIR!!
|
|||
BIN_DIR = !!BIN_DIR!!
|
||||
LANGS_SRC = $(shell ls $(LANG_DIR)/*.txt)
|
||||
LANGS = $(LANGS_SRC:$(LANG_DIR)/%.txt=%.lng)
|
||||
CC_BUILD = !!CC_BUILD!!
|
||||
CXX_BUILD = !!CXX_BUILD!!
|
||||
CFLAGS_BUILD = !!CFLAGS_BUILD!!
|
||||
STRGEN_FLAGS = !!STRGEN_FLAGS!!
|
||||
STAGE = !!STAGE!!
|
||||
|
@ -36,13 +36,13 @@ RES := $(shell mkdir -p $(BIN_DIR)/lang )
|
|||
|
||||
all: table/strings.h $(LANGS)
|
||||
|
||||
strgen.o: $(SRC_DIR)/strgen/strgen.c endian_host.h
|
||||
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.c=%.c)'
|
||||
$(Q)$(CC_BUILD) $(CFLAGS_BUILD) -DSTRGEN -c -o $@ $<
|
||||
strgen.o: $(SRC_DIR)/strgen/strgen.cpp endian_host.h
|
||||
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
|
||||
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) -DSTRGEN -c -o $@ $<
|
||||
|
||||
string.o: $(SRC_DIR)/string.c endian_host.h
|
||||
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.c=%.c)'
|
||||
$(Q)$(CC_BUILD) $(CFLAGS_BUILD) -DSTRGEN -c -o $@ $<
|
||||
string.o: $(SRC_DIR)/string.cpp endian_host.h
|
||||
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
|
||||
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) -DSTRGEN -c -o $@ $<
|
||||
|
||||
lang/english.txt: $(LANG_DIR)/english.txt
|
||||
$(Q)mkdir -p lang
|
||||
|
@ -50,7 +50,7 @@ lang/english.txt: $(LANG_DIR)/english.txt
|
|||
|
||||
$(STRGEN): string.o strgen.o
|
||||
$(E) '$(STAGE) Compiling and Linking $@'
|
||||
$(Q)$(CC_BUILD) string.o strgen.o -o $@
|
||||
$(Q)$(CXX_BUILD) string.o strgen.o -o $@
|
||||
|
||||
table/strings.h: lang/english.txt $(STRGEN)
|
||||
$(E) '$(STAGE) Generating $@'
|
||||
|
@ -67,9 +67,9 @@ endian_host.h: $(ENDIAN_CHECK)
|
|||
$(E) '$(STAGE) Testing endianness for host'
|
||||
$(Q)./$(ENDIAN_CHECK) > $@
|
||||
|
||||
$(ENDIAN_CHECK): $(SRC_DIR)/endian_check.c
|
||||
$(ENDIAN_CHECK): $(SRC_DIR)/endian_check.cpp
|
||||
$(E) '$(STAGE) Compiling and Linking $@'
|
||||
$(Q)$(CC_BUILD) $(CFLAGS_BUILD) $< -o $@
|
||||
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $< -o $@
|
||||
|
||||
depend:
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
CC_HOST = !!CC_HOST!!
|
||||
CXX_HOST = !!CXX_HOST!!
|
||||
CC_BUILD = !!CC_BUILD!!
|
||||
CXX_BUILD = !!CXX_BUILD!!
|
||||
WINDRES = !!WINDRES!!
|
||||
STRIP = !!STRIP!!
|
||||
CC_CFLAGS = !!CC_CFLAGS!!
|
||||
|
@ -96,7 +97,7 @@ RES := $(shell if [ "`cat $(CONFIG_CACHE_ENDIAN) 2>/dev/null`" != "$(ENDIAN_FORC
|
|||
|
||||
# If there is a change in the source-file-list, make sure we recheck the deps
|
||||
RES := $(shell if [ "`cat $(CONFIG_CACHE_SOURCE) 2>/dev/null`" != "$(SRCS)" ]; then echo "$(SRCS)" > $(CONFIG_CACHE_SOURCE); fi )
|
||||
# If there is a change in the revision, make sure we recompile rev.c
|
||||
# If there is a change in the revision, make sure we recompile rev.cpp
|
||||
RES := $(shell if [ "`cat $(CONFIG_CACHE_VERSION) 2>/dev/null`" != "$(REV)" ]; then echo "$(REV)" > $(CONFIG_CACHE_VERSION); fi )
|
||||
|
||||
ifndef MAKEDEPEND
|
||||
|
@ -232,25 +233,25 @@ endian_target.h: $(ENDIAN_CHECK) $(CONFIG_CACHE_ENDIAN)
|
|||
$(E) '$(STAGE) Testing endianness for target'
|
||||
$(Q)./$(ENDIAN_CHECK) $(ENDIAN_FORCE) > $@
|
||||
|
||||
$(ENDIAN_CHECK): $(SRC_DIR)/endian_check.c
|
||||
$(ENDIAN_CHECK): $(SRC_DIR)/endian_check.cpp
|
||||
$(E) '$(STAGE) Compiling and Linking $@'
|
||||
$(Q)$(CC_BUILD) $(CFLAGS_BUILD) $< -o $@
|
||||
$(Q)$(CXX_BUILD) $(CFLAGS_BUILD) $< -o $@
|
||||
|
||||
# Revision files
|
||||
|
||||
rev.c: $(CONFIG_CACHE_VERSION)
|
||||
rev.cpp: $(CONFIG_CACHE_VERSION)
|
||||
# setting the revision number in a place, there the binary can read it
|
||||
@echo 'const char _openttd_revision[] = "$(REV)";' > rev.c
|
||||
@echo 'extern const char _openttd_revision[] = "$(REV)";' > rev.cpp
|
||||
# Some additions for MorphOS versions tag
|
||||
ifeq ($(OS),MORPHOS)
|
||||
@echo '#ifdef __MORPHOS__' >> rev.c
|
||||
@echo 'const char morphos_versions_tag[] = "\\0$$VER: OpenTTD $(REV) ('`date +%d.%m.%y`') (C) OpenTTD Team [MorphOS, PowerPC]";' >> rev.c
|
||||
@echo '#endif' >> rev.c
|
||||
@echo '#ifdef __MORPHOS__' >> rev.cpp
|
||||
@echo 'extern const char morphos_versions_tag[] = "\\0$$VER: OpenTTD $(REV) ('`date +%d.%m.%y`') (C) OpenTTD Team [MorphOS, PowerPC]";' >> rev.cpp
|
||||
@echo '#endif' >> rev.cpp
|
||||
endif
|
||||
|
||||
rev.o: rev.c $(FILE_DEP)
|
||||
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.c=%.c)'
|
||||
$(Q)$(CC_HOST) $(CC_CFLAGS) $(CFLAGS) -c -o $@ $<
|
||||
rev.o: rev.cpp $(FILE_DEP)
|
||||
$(E) '$(STAGE) Compiling $(<:$(SRC_DIR)/%.cpp=%.cpp)'
|
||||
$(Q)$(CXX_HOST) $(CFLAGS) -c -o $@ $<
|
||||
|
||||
FORCE:
|
||||
|
||||
|
@ -261,7 +262,7 @@ clean:
|
|||
$(Q)rm -f $(DEPS) $(OBJS) $(TTD) $(TTD:%=$(BIN_DIR)/%) $(CONFIG_CACHE_COMPILER) $(CONFIG_CACHE_LINKER) $(CONFIG_CACHE_ENDIAN) $(CONFIG_CACHE_SOURCE) $(ENDIAN_TARGETS) rev.o
|
||||
|
||||
mrproper: clean
|
||||
$(Q)rm -f rev.c
|
||||
$(Q)rm -f rev.cpp
|
||||
|
||||
%.o:
|
||||
@echo '$(STAGE) No such source-file: $(@:%.o=%).[c|cpp|m|rc]'
|
||||
|
|
19
config.lib
19
config.lib
|
@ -12,6 +12,7 @@ set_default() {
|
|||
host=""
|
||||
cc_build=""
|
||||
cc_host=""
|
||||
cxx_build=""
|
||||
cxx_host=""
|
||||
windres=""
|
||||
strip=""
|
||||
|
@ -54,7 +55,7 @@ set_default() {
|
|||
with_freetype="1"
|
||||
with_fontconfig="1"
|
||||
|
||||
save_params_array="build host cc_build cc_host cxx_host windres strip lipo os revision endian config_log prefix_dir binary_dir data_dir icon_dir personal_dir install_dir custom_lang_dir second_data_dir enable_install enable_debug enable_profiling enable_dedicated enable_network enable_static enable_translator enable_assert enable_strip with_osx_sysroot enable_universal enable_osx_g5 with_application_bundle with_sdl with_cocoa with_zlib with_png with_makedepend with_direct_music with_sort with_iconv with_midi with_midi_arg with_freetype with_fontconfig CC CXX CFLAGS LDFLAGS"
|
||||
save_params_array="build host cc_build cc_host cxx_build cxx_host windres strip lipo os revision endian config_log prefix_dir binary_dir data_dir icon_dir personal_dir install_dir custom_lang_dir second_data_dir enable_install enable_debug enable_profiling enable_dedicated enable_network enable_static enable_translator enable_assert enable_strip with_osx_sysroot enable_universal enable_osx_g5 with_application_bundle with_sdl with_cocoa with_zlib with_png with_makedepend with_direct_music with_sort with_iconv with_midi with_midi_arg with_freetype with_fontconfig CC CXX CFLAGS LDFLAGS"
|
||||
}
|
||||
|
||||
detect_params() {
|
||||
|
@ -90,6 +91,8 @@ detect_params() {
|
|||
--cc-build=*) cc_build="$optarg";;
|
||||
--cc-host) prevp_p="cc_host";;
|
||||
--cc-host=*) cc_host="$optarg";;
|
||||
--cxx-build) prevp_p="cxx_build";;
|
||||
--cxx-build=*) cxx_build="$optarg";;
|
||||
--cxx-host) prevp_p="cxx_host";;
|
||||
--cxx-host=*) cxx_host="$optarg";;
|
||||
--windres) prevp_p="windres";;
|
||||
|
@ -320,7 +323,8 @@ check_params() {
|
|||
log 1 "checking for build gcc... $cc_build"
|
||||
log 1 "checking for host gcc... $cc_host"
|
||||
|
||||
check_cxx
|
||||
check_cxx_build
|
||||
check_cxx_host
|
||||
check_windres
|
||||
check_strip
|
||||
check_lipo
|
||||
|
@ -535,7 +539,7 @@ check_params() {
|
|||
native=`LC_ALL=C uname | tr [:upper:] [:lower:] | grep darwin`
|
||||
# If $host doesn't match $build , we are cross-compiling
|
||||
if [ -n "$native" ] && [ "$build" != "$host" ]; then
|
||||
$cc_build $SRC_DIR/os/macosx/G5_detector.c -o G5_detector
|
||||
$cc_build $SRC_DIR/os/macosx/G5_detector.cpp -o G5_detector
|
||||
res=`./G5_detector`
|
||||
rm -f G5_detector
|
||||
if [ -n "$res" ]; then
|
||||
|
@ -981,7 +985,13 @@ check_host() {
|
|||
check_compiler "host system type" "cc_host" "$host" "$cc_host" "$CC" "gcc" "cc" "0" "-dumpmachine"
|
||||
}
|
||||
|
||||
check_cxx() {
|
||||
check_cxx_build() {
|
||||
check_compiler "build g++" "cxx_build" "$build" "$cxx_build" "$CXX" "g++" "c++" 1 "-dumpmachine"
|
||||
}
|
||||
|
||||
check_cxx_host() {
|
||||
# By default the host is the build
|
||||
if [ -z "$host" ]; then host="$build"; fi
|
||||
check_compiler "host g++" "cxx_host" "$host" "$cxx_host" "$CXX" "g++" "c++" 1 "-dumpmachine"
|
||||
}
|
||||
|
||||
|
@ -1584,6 +1594,7 @@ make_sed() {
|
|||
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;
|
||||
|
|
|
@ -161,220 +161,220 @@
|
|||
Name="Source Files"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\..\src\airport.c">
|
||||
RelativePath=".\..\src\airport.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\aystar.c">
|
||||
RelativePath=".\..\src\aystar.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\bmp.c">
|
||||
RelativePath=".\..\src\bmp.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\callback_table.c">
|
||||
RelativePath=".\..\src\callback_table.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\command.c">
|
||||
RelativePath=".\..\src\command.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\console.c">
|
||||
RelativePath=".\..\src\console.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\console_cmds.c">
|
||||
RelativePath=".\..\src\console_cmds.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\currency.c">
|
||||
RelativePath=".\..\src\currency.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\date.c">
|
||||
RelativePath=".\..\src\date.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\debug.c">
|
||||
RelativePath=".\..\src\debug.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\dedicated.c">
|
||||
RelativePath=".\..\src\dedicated.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\depot.c">
|
||||
RelativePath=".\..\src\depot.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\driver.c">
|
||||
RelativePath=".\..\src\driver.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\economy.c">
|
||||
RelativePath=".\..\src\economy.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\elrail.c">
|
||||
RelativePath=".\..\src\elrail.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\engine.c">
|
||||
RelativePath=".\..\src\engine.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\fileio.c">
|
||||
RelativePath=".\..\src\fileio.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\fios.c">
|
||||
RelativePath=".\..\src\fios.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\fontcache.c">
|
||||
RelativePath=".\..\src\fontcache.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\genworld.c">
|
||||
RelativePath=".\..\src\genworld.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\gfx.c">
|
||||
RelativePath=".\..\src\gfx.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\gfxinit.c">
|
||||
RelativePath=".\..\src\gfxinit.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\heightmap.c">
|
||||
RelativePath=".\..\src\heightmap.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\helpers.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\landscape.c">
|
||||
RelativePath=".\..\src\landscape.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\map.c">
|
||||
RelativePath=".\..\src\map.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\md5.c">
|
||||
RelativePath=".\..\src\md5.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\mersenne.c">
|
||||
RelativePath=".\..\src\mersenne.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\minilzo.c">
|
||||
RelativePath=".\..\src\minilzo.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\misc.c">
|
||||
RelativePath=".\..\src\misc.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\mixer.c">
|
||||
RelativePath=".\..\src\mixer.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\music.c">
|
||||
RelativePath=".\..\src\music.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\namegen.c">
|
||||
RelativePath=".\..\src\namegen.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\network\core\core.c">
|
||||
RelativePath=".\..\src\network\core\core.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\network\core\packet.c">
|
||||
RelativePath=".\..\src\network\core\packet.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\network\core\tcp.c">
|
||||
RelativePath=".\..\src\network\core\tcp.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\network\core\udp.c">
|
||||
RelativePath=".\..\src\network\core\udp.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\network\network.c">
|
||||
RelativePath=".\..\src\network\network.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\network\network_client.c">
|
||||
RelativePath=".\..\src\network\network_client.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\network\network_data.c">
|
||||
RelativePath=".\..\src\network\network_data.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\network\network_gamelist.c">
|
||||
RelativePath=".\..\src\network\network_gamelist.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\network\network_server.c">
|
||||
RelativePath=".\..\src\network\network_server.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\network\network_udp.c">
|
||||
RelativePath=".\..\src\network\network_udp.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\npf.c">
|
||||
RelativePath=".\..\src\npf.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\oldloader.c">
|
||||
RelativePath=".\..\src\oldloader.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\oldpool.c">
|
||||
RelativePath=".\..\src\oldpool.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\openttd.c">
|
||||
RelativePath=".\..\src\openttd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\os_timer.c">
|
||||
RelativePath=".\..\src\os_timer.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\ottdres.rc">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\pathfind.c">
|
||||
RelativePath=".\..\src\pathfind.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\players.c">
|
||||
RelativePath=".\..\src\players.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\queue.c">
|
||||
RelativePath=".\..\src\queue.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\rail.c">
|
||||
RelativePath=".\..\src\rail.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\saveload.c">
|
||||
RelativePath=".\..\src\saveload.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\screenshot.c">
|
||||
RelativePath=".\..\src\screenshot.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\sdl.c">
|
||||
RelativePath=".\..\src\sdl.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\settings.c">
|
||||
RelativePath=".\..\src\settings.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\signs.c">
|
||||
RelativePath=".\..\src\signs.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\sound.c">
|
||||
RelativePath=".\..\src\sound.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\spritecache.c">
|
||||
RelativePath=".\..\src\spritecache.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\string.c">
|
||||
RelativePath=".\..\src\string.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\strings.c">
|
||||
RelativePath=".\..\src\strings.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\texteff.c">
|
||||
RelativePath=".\..\src\texteff.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\tgp.c">
|
||||
RelativePath=".\..\src\tgp.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\thread.c">
|
||||
RelativePath=".\..\src\thread.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\tile.c">
|
||||
RelativePath=".\..\src\tile.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\vehicle.c">
|
||||
RelativePath=".\..\src\vehicle.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\viewport.c">
|
||||
RelativePath=".\..\src\viewport.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\waypoint.c">
|
||||
RelativePath=".\..\src\waypoint.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\widget.c">
|
||||
RelativePath=".\..\src\widget.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\win32.c">
|
||||
RelativePath=".\..\src\win32.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\window.c">
|
||||
RelativePath=".\..\src\window.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
|
@ -664,155 +664,155 @@
|
|||
Name="GUI Source Code"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\..\src\aircraft_gui.c">
|
||||
RelativePath=".\..\src\aircraft_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\airport_gui.c">
|
||||
RelativePath=".\..\src\airport_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\bridge_gui.c">
|
||||
RelativePath=".\..\src\bridge_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\build_vehicle_gui.c">
|
||||
RelativePath=".\..\src\build_vehicle_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\depot_gui.c">
|
||||
RelativePath=".\..\src\depot_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\dock_gui.c">
|
||||
RelativePath=".\..\src\dock_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\engine_gui.c">
|
||||
RelativePath=".\..\src\engine_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\genworld_gui.c">
|
||||
RelativePath=".\..\src\genworld_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\graph_gui.c">
|
||||
RelativePath=".\..\src\graph_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\industry_gui.c">
|
||||
RelativePath=".\..\src\industry_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\intro_gui.c">
|
||||
RelativePath=".\..\src\intro_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\main_gui.c">
|
||||
RelativePath=".\..\src\main_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\misc_gui.c">
|
||||
RelativePath=".\..\src\misc_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\music_gui.c">
|
||||
RelativePath=".\..\src\music_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\network\network_gui.c">
|
||||
RelativePath=".\..\src\network\network_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\newgrf_gui.c">
|
||||
RelativePath=".\..\src\newgrf_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\news_gui.c">
|
||||
RelativePath=".\..\src\news_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\order_gui.c">
|
||||
RelativePath=".\..\src\order_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\player_gui.c">
|
||||
RelativePath=".\..\src\player_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\rail_gui.c">
|
||||
RelativePath=".\..\src\rail_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\road_gui.c">
|
||||
RelativePath=".\..\src\road_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\roadveh_gui.c">
|
||||
RelativePath=".\..\src\roadveh_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\settings_gui.c">
|
||||
RelativePath=".\..\src\settings_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\ship_gui.c">
|
||||
RelativePath=".\..\src\ship_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\smallmap_gui.c">
|
||||
RelativePath=".\..\src\smallmap_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\station_gui.c">
|
||||
RelativePath=".\..\src\station_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\subsidy_gui.c">
|
||||
RelativePath=".\..\src\subsidy_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\terraform_gui.c">
|
||||
RelativePath=".\..\src\terraform_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\town_gui.c">
|
||||
RelativePath=".\..\src\town_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\train_gui.c">
|
||||
RelativePath=".\..\src\train_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\vehicle_gui.c">
|
||||
RelativePath=".\..\src\vehicle_gui.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Landscape"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\..\src\aircraft_cmd.c">
|
||||
RelativePath=".\..\src\aircraft_cmd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\clear_cmd.c">
|
||||
RelativePath=".\..\src\clear_cmd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\disaster_cmd.c">
|
||||
RelativePath=".\..\src\disaster_cmd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\dummy_land.c">
|
||||
RelativePath=".\..\src\dummy_land.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\industry_cmd.c">
|
||||
RelativePath=".\..\src\industry_cmd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\misc_cmd.c">
|
||||
RelativePath=".\..\src\misc_cmd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\order_cmd.c">
|
||||
RelativePath=".\..\src\order_cmd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\rail_cmd.c">
|
||||
RelativePath=".\..\src\rail_cmd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\road_cmd.c">
|
||||
RelativePath=".\..\src\road_cmd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\roadveh_cmd.c">
|
||||
RelativePath=".\..\src\roadveh_cmd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\ship_cmd.c">
|
||||
RelativePath=".\..\src\ship_cmd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\station_cmd.c">
|
||||
RelativePath=".\..\src\station_cmd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\town_cmd.c">
|
||||
RelativePath=".\..\src\town_cmd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\train_cmd.c">
|
||||
RelativePath=".\..\src\train_cmd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\tree_cmd.c">
|
||||
RelativePath=".\..\src\tree_cmd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\tunnelbridge_cmd.c">
|
||||
RelativePath=".\..\src\tunnelbridge_cmd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\unmovable_cmd.c">
|
||||
RelativePath=".\..\src\unmovable_cmd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\water_cmd.c">
|
||||
RelativePath=".\..\src\water_cmd.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
|
@ -901,57 +901,57 @@
|
|||
Name="AI Files"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\..\src\ai\ai.c">
|
||||
RelativePath=".\..\src\ai\ai.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\ai\default\default.c">
|
||||
RelativePath=".\..\src\ai\default\default.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\ai\trolly\build.c">
|
||||
RelativePath=".\..\src\ai\trolly\build.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\ai\trolly\pathfinder.c">
|
||||
RelativePath=".\..\src\ai\trolly\pathfinder.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\ai\trolly\shared.c">
|
||||
RelativePath=".\..\src\ai\trolly\shared.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\ai\trolly\trolly.c">
|
||||
RelativePath=".\..\src\ai\trolly\trolly.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="NewGRF"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\..\src\newgrf.c">
|
||||
RelativePath=".\..\src\newgrf.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\newgrf_cargo.c">
|
||||
RelativePath=".\..\src\newgrf_cargo.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\newgrf_config.c">
|
||||
RelativePath=".\..\src\newgrf_config.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\newgrf_engine.c">
|
||||
RelativePath=".\..\src\newgrf_engine.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\newgrf_sound.c">
|
||||
RelativePath=".\..\src\newgrf_sound.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\newgrf_spritegroup.c">
|
||||
RelativePath=".\..\src\newgrf_spritegroup.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\newgrf_station.c">
|
||||
RelativePath=".\..\src\newgrf_station.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\newgrf_text.c">
|
||||
RelativePath=".\..\src\newgrf_text.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Map Accessors"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\..\src\bridge_map.c">
|
||||
RelativePath=".\..\src\bridge_map.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\bridge_map.h">
|
||||
|
@ -966,13 +966,13 @@
|
|||
RelativePath=".\..\src\rail_map.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\road_map.c">
|
||||
RelativePath=".\..\src\road_map.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\road_map.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\station_map.c">
|
||||
RelativePath=".\..\src\station_map.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\station_map.h">
|
||||
|
@ -984,7 +984,7 @@
|
|||
RelativePath=".\..\src\tree_map.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\tunnel_map.c">
|
||||
RelativePath=".\..\src\tunnel_map.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\tunnel_map.h">
|
||||
|
@ -1091,16 +1091,16 @@
|
|||
Name="Video"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\..\src\video\dedicated_v.c">
|
||||
RelativePath=".\..\src\video\dedicated_v.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\video\null_v.c">
|
||||
RelativePath=".\..\src\video\null_v.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\video\sdl_v.c">
|
||||
RelativePath=".\..\src\video\sdl_v.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\video\win32_v.c">
|
||||
RelativePath=".\..\src\video\win32_v.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
|
@ -1110,23 +1110,23 @@
|
|||
RelativePath=".\..\src\music\dmusic.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\music\null_m.c">
|
||||
RelativePath=".\..\src\music\null_m.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\music\win32_m.c">
|
||||
RelativePath=".\..\src\music\win32_m.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Sound"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\..\src\sound\null_s.c">
|
||||
RelativePath=".\..\src\sound\null_s.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\sound\sdl_s.c">
|
||||
RelativePath=".\..\src\sound\sdl_s.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\sound\win32_s.c">
|
||||
RelativePath=".\..\src\sound\win32_s.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<File
|
||||
|
|
|
@ -444,220 +444,220 @@
|
|||
Name="Source Files"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\..\src\airport.c">
|
||||
RelativePath=".\..\src\airport.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\aystar.c">
|
||||
RelativePath=".\..\src\aystar.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\bmp.c">
|
||||
RelativePath=".\..\src\bmp.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\callback_table.c">
|
||||
RelativePath=".\..\src\callback_table.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\command.c">
|
||||
RelativePath=".\..\src\command.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\console.c">
|
||||
RelativePath=".\..\src\console.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\console_cmds.c">
|
||||
RelativePath=".\..\src\console_cmds.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\currency.c">
|
||||
RelativePath=".\..\src\currency.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\date.c">
|
||||
RelativePath=".\..\src\date.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\debug.c">
|
||||
RelativePath=".\..\src\debug.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\dedicated.c">
|
||||
RelativePath=".\..\src\dedicated.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\depot.c">
|
||||
RelativePath=".\..\src\depot.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\driver.c">
|
||||
RelativePath=".\..\src\driver.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\economy.c">
|
||||
RelativePath=".\..\src\economy.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\elrail.c">
|
||||
RelativePath=".\..\src\elrail.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\engine.c">
|
||||
RelativePath=".\..\src\engine.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\fileio.c">
|
||||
RelativePath=".\..\src\fileio.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\fios.c">
|
||||
RelativePath=".\..\src\fios.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\fontcache.c">
|
||||
RelativePath=".\..\src\fontcache.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\genworld.c">
|
||||
RelativePath=".\..\src\genworld.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\gfx.c">
|
||||
RelativePath=".\..\src\gfx.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\gfxinit.c">
|
||||
RelativePath=".\..\src\gfxinit.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\heightmap.c">
|
||||
RelativePath=".\..\src\heightmap.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\helpers.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\landscape.c">
|
||||
RelativePath=".\..\src\landscape.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\map.c">
|
||||
RelativePath=".\..\src\map.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\md5.c">
|
||||
RelativePath=".\..\src\md5.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\mersenne.c">
|
||||
RelativePath=".\..\src\mersenne.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\minilzo.c">
|
||||
RelativePath=".\..\src\minilzo.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\misc.c">
|
||||
RelativePath=".\..\src\misc.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\mixer.c">
|
||||
RelativePath=".\..\src\mixer.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\music.c">
|
||||
RelativePath=".\..\src\music.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\namegen.c">
|
||||
RelativePath=".\..\src\namegen.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\network\core\core.c">
|
||||
RelativePath=".\..\src\network\core\core.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\network\core\packet.c">
|
||||
RelativePath=".\..\src\network\core\packet.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\network\core\tcp.c">
|
||||
RelativePath=".\..\src\network\core\tcp.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\network\core\udp.c">
|
||||
RelativePath=".\..\src\network\core\udp.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\network\network.c">
|
||||
RelativePath=".\..\src\network\network.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\network\network_client.c">
|
||||
RelativePath=".\..\src\network\network_client.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\network\network_data.c">
|
||||
RelativePath=".\..\src\network\network_data.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\network\network_gamelist.c">
|
||||
RelativePath=".\..\src\network\network_gamelist.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\network\network_server.c">
|
||||
RelativePath=".\..\src\network\network_server.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\network\network_udp.c">
|
||||
RelativePath=".\..\src\network\network_udp.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\npf.c">
|
||||
RelativePath=".\..\src\npf.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\oldloader.c">
|
||||
RelativePath=".\..\src\oldloader.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\oldpool.c">
|
||||
RelativePath=".\..\src\oldpool.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\openttd.c">
|
||||
RelativePath=".\..\src\openttd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\os_timer.c">
|
||||
RelativePath=".\..\src\os_timer.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\ottdres.rc">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\pathfind.c">
|
||||
RelativePath=".\..\src\pathfind.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\players.c">
|
||||
RelativePath=".\..\src\players.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\queue.c">
|
||||
RelativePath=".\..\src\queue.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\rail.c">
|
||||
RelativePath=".\..\src\rail.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\saveload.c">
|
||||
RelativePath=".\..\src\saveload.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\screenshot.c">
|
||||
RelativePath=".\..\src\screenshot.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\sdl.c">
|
||||
RelativePath=".\..\src\sdl.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\settings.c">
|
||||
RelativePath=".\..\src\settings.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\signs.c">
|
||||
RelativePath=".\..\src\signs.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\sound.c">
|
||||
RelativePath=".\..\src\sound.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\spritecache.c">
|
||||
RelativePath=".\..\src\spritecache.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\string.c">
|
||||
RelativePath=".\..\src\string.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\strings.c">
|
||||
RelativePath=".\..\src\strings.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\texteff.c">
|
||||
RelativePath=".\..\src\texteff.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\tgp.c">
|
||||
RelativePath=".\..\src\tgp.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\thread.c">
|
||||
RelativePath=".\..\src\thread.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\tile.c">
|
||||
RelativePath=".\..\src\tile.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\vehicle.c">
|
||||
RelativePath=".\..\src\vehicle.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\viewport.c">
|
||||
RelativePath=".\..\src\viewport.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\waypoint.c">
|
||||
RelativePath=".\..\src\waypoint.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\widget.c">
|
||||
RelativePath=".\..\src\widget.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\win32.c">
|
||||
RelativePath=".\..\src\win32.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\window.c">
|
||||
RelativePath=".\..\src\window.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
|
@ -947,155 +947,155 @@
|
|||
Name="GUI Source Code"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\..\src\aircraft_gui.c">
|
||||
RelativePath=".\..\src\aircraft_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\airport_gui.c">
|
||||
RelativePath=".\..\src\airport_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\bridge_gui.c">
|
||||
RelativePath=".\..\src\bridge_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\build_vehicle_gui.c">
|
||||
RelativePath=".\..\src\build_vehicle_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\depot_gui.c">
|
||||
RelativePath=".\..\src\depot_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\dock_gui.c">
|
||||
RelativePath=".\..\src\dock_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\engine_gui.c">
|
||||
RelativePath=".\..\src\engine_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\genworld_gui.c">
|
||||
RelativePath=".\..\src\genworld_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\graph_gui.c">
|
||||
RelativePath=".\..\src\graph_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\industry_gui.c">
|
||||
RelativePath=".\..\src\industry_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\intro_gui.c">
|
||||
RelativePath=".\..\src\intro_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\main_gui.c">
|
||||
RelativePath=".\..\src\main_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\misc_gui.c">
|
||||
RelativePath=".\..\src\misc_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\music_gui.c">
|
||||
RelativePath=".\..\src\music_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\network\network_gui.c">
|
||||
RelativePath=".\..\src\network\network_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\newgrf_gui.c">
|
||||
RelativePath=".\..\src\newgrf_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\news_gui.c">
|
||||
RelativePath=".\..\src\news_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\order_gui.c">
|
||||
RelativePath=".\..\src\order_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\player_gui.c">
|
||||
RelativePath=".\..\src\player_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\rail_gui.c">
|
||||
RelativePath=".\..\src\rail_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\road_gui.c">
|
||||
RelativePath=".\..\src\road_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\roadveh_gui.c">
|
||||
RelativePath=".\..\src\roadveh_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\settings_gui.c">
|
||||
RelativePath=".\..\src\settings_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\ship_gui.c">
|
||||
RelativePath=".\..\src\ship_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\smallmap_gui.c">
|
||||
RelativePath=".\..\src\smallmap_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\station_gui.c">
|
||||
RelativePath=".\..\src\station_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\subsidy_gui.c">
|
||||
RelativePath=".\..\src\subsidy_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\terraform_gui.c">
|
||||
RelativePath=".\..\src\terraform_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\town_gui.c">
|
||||
RelativePath=".\..\src\town_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\train_gui.c">
|
||||
RelativePath=".\..\src\train_gui.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\vehicle_gui.c">
|
||||
RelativePath=".\..\src\vehicle_gui.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Landscape"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\..\src\aircraft_cmd.c">
|
||||
RelativePath=".\..\src\aircraft_cmd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\clear_cmd.c">
|
||||
RelativePath=".\..\src\clear_cmd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\disaster_cmd.c">
|
||||
RelativePath=".\..\src\disaster_cmd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\dummy_land.c">
|
||||
RelativePath=".\..\src\dummy_land.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\industry_cmd.c">
|
||||
RelativePath=".\..\src\industry_cmd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\misc_cmd.c">
|
||||
RelativePath=".\..\src\misc_cmd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\order_cmd.c">
|
||||
RelativePath=".\..\src\order_cmd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\rail_cmd.c">
|
||||
RelativePath=".\..\src\rail_cmd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\road_cmd.c">
|
||||
RelativePath=".\..\src\road_cmd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\roadveh_cmd.c">
|
||||
RelativePath=".\..\src\roadveh_cmd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\ship_cmd.c">
|
||||
RelativePath=".\..\src\ship_cmd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\station_cmd.c">
|
||||
RelativePath=".\..\src\station_cmd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\town_cmd.c">
|
||||
RelativePath=".\..\src\town_cmd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\train_cmd.c">
|
||||
RelativePath=".\..\src\train_cmd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\tree_cmd.c">
|
||||
RelativePath=".\..\src\tree_cmd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\tunnelbridge_cmd.c">
|
||||
RelativePath=".\..\src\tunnelbridge_cmd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\unmovable_cmd.c">
|
||||
RelativePath=".\..\src\unmovable_cmd.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\water_cmd.c">
|
||||
RelativePath=".\..\src\water_cmd.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
|
@ -1184,57 +1184,57 @@
|
|||
Name="AI Files"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\..\src\ai\ai.c">
|
||||
RelativePath=".\..\src\ai\ai.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\ai\default\default.c">
|
||||
RelativePath=".\..\src\ai\default\default.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\ai\trolly\build.c">
|
||||
RelativePath=".\..\src\ai\trolly\build.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\ai\trolly\pathfinder.c">
|
||||
RelativePath=".\..\src\ai\trolly\pathfinder.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\ai\trolly\shared.c">
|
||||
RelativePath=".\..\src\ai\trolly\shared.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\ai\trolly\trolly.c">
|
||||
RelativePath=".\..\src\ai\trolly\trolly.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="NewGRF"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\..\src\newgrf.c">
|
||||
RelativePath=".\..\src\newgrf.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\newgrf_cargo.c">
|
||||
RelativePath=".\..\src\newgrf_cargo.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\newgrf_config.c">
|
||||
RelativePath=".\..\src\newgrf_config.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\newgrf_engine.c">
|
||||
RelativePath=".\..\src\newgrf_engine.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\newgrf_sound.c">
|
||||
RelativePath=".\..\src\newgrf_sound.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\newgrf_spritegroup.c">
|
||||
RelativePath=".\..\src\newgrf_spritegroup.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\newgrf_station.c">
|
||||
RelativePath=".\..\src\newgrf_station.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\newgrf_text.c">
|
||||
RelativePath=".\..\src\newgrf_text.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Map Accessors"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\..\src\bridge_map.c">
|
||||
RelativePath=".\..\src\bridge_map.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\bridge_map.h">
|
||||
|
@ -1249,13 +1249,13 @@
|
|||
RelativePath=".\..\src\rail_map.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\road_map.c">
|
||||
RelativePath=".\..\src\road_map.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\road_map.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\station_map.c">
|
||||
RelativePath=".\..\src\station_map.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\station_map.h">
|
||||
|
@ -1267,7 +1267,7 @@
|
|||
RelativePath=".\..\src\tree_map.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\tunnel_map.c">
|
||||
RelativePath=".\..\src\tunnel_map.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\tunnel_map.h">
|
||||
|
@ -1374,16 +1374,16 @@
|
|||
Name="Video"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\..\src\video\dedicated_v.c">
|
||||
RelativePath=".\..\src\video\dedicated_v.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\video\null_v.c">
|
||||
RelativePath=".\..\src\video\null_v.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\video\sdl_v.c">
|
||||
RelativePath=".\..\src\video\sdl_v.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\video\win32_v.c">
|
||||
RelativePath=".\..\src\video\win32_v.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
|
@ -1393,23 +1393,23 @@
|
|||
RelativePath=".\..\src\music\dmusic.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\music\null_m.c">
|
||||
RelativePath=".\..\src\music\null_m.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\music\win32_m.c">
|
||||
RelativePath=".\..\src\music\win32_m.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Sound"
|
||||
Filter="">
|
||||
<File
|
||||
RelativePath=".\..\src\sound\null_s.c">
|
||||
RelativePath=".\..\src\sound\null_s.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\sound\sdl_s.c">
|
||||
RelativePath=".\..\src\sound\sdl_s.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\..\src\sound\win32_s.c">
|
||||
RelativePath=".\..\src\sound\win32_s.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
|
|
|
@ -80,10 +80,10 @@
|
|||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
|
||||
<File
|
||||
RelativePath="..\src\strgen\strgen.c">
|
||||
RelativePath="..\src\strgen\strgen.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\string.c">
|
||||
RelativePath="..\src\string.cpp">
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
|
|
|
@ -114,11 +114,11 @@
|
|||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\src\strgen\strgen.c"
|
||||
RelativePath="..\src\strgen\strgen.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\string.c"
|
||||
RelativePath="..\src\string.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
|
|
302
source.list
302
source.list
|
@ -1,86 +1,86 @@
|
|||
# Source Files
|
||||
airport.c
|
||||
aystar.c
|
||||
bmp.c
|
||||
callback_table.c
|
||||
command.c
|
||||
console.c
|
||||
console_cmds.c
|
||||
currency.c
|
||||
date.c
|
||||
debug.c
|
||||
dedicated.c
|
||||
depot.c
|
||||
driver.c
|
||||
economy.c
|
||||
elrail.c
|
||||
engine.c
|
||||
fileio.c
|
||||
fios.c
|
||||
fontcache.c
|
||||
genworld.c
|
||||
gfx.c
|
||||
gfxinit.c
|
||||
heightmap.c
|
||||
airport.cpp
|
||||
aystar.cpp
|
||||
bmp.cpp
|
||||
callback_table.cpp
|
||||
command.cpp
|
||||
console.cpp
|
||||
console_cmds.cpp
|
||||
currency.cpp
|
||||
date.cpp
|
||||
debug.cpp
|
||||
dedicated.cpp
|
||||
depot.cpp
|
||||
driver.cpp
|
||||
economy.cpp
|
||||
elrail.cpp
|
||||
engine.cpp
|
||||
fileio.cpp
|
||||
fios.cpp
|
||||
fontcache.cpp
|
||||
genworld.cpp
|
||||
gfx.cpp
|
||||
gfxinit.cpp
|
||||
heightmap.cpp
|
||||
helpers.cpp
|
||||
landscape.c
|
||||
map.c
|
||||
md5.c
|
||||
mersenne.c
|
||||
minilzo.c
|
||||
misc.c
|
||||
mixer.c
|
||||
music.c
|
||||
namegen.c
|
||||
network/core/core.c
|
||||
network/core/packet.c
|
||||
network/core/tcp.c
|
||||
network/core/udp.c
|
||||
network/network.c
|
||||
network/network_client.c
|
||||
network/network_data.c
|
||||
network/network_gamelist.c
|
||||
network/network_server.c
|
||||
network/network_udp.c
|
||||
npf.c
|
||||
oldloader.c
|
||||
oldpool.c
|
||||
openttd.c
|
||||
os_timer.c
|
||||
landscape.cpp
|
||||
map.cpp
|
||||
md5.cpp
|
||||
mersenne.cpp
|
||||
minilzo.cpp
|
||||
misc.cpp
|
||||
mixer.cpp
|
||||
music.cpp
|
||||
namegen.cpp
|
||||
network/core/core.cpp
|
||||
network/core/packet.cpp
|
||||
network/core/tcp.cpp
|
||||
network/core/udp.cpp
|
||||
network/network.cpp
|
||||
network/network_client.cpp
|
||||
network/network_data.cpp
|
||||
network/network_gamelist.cpp
|
||||
network/network_server.cpp
|
||||
network/network_udp.cpp
|
||||
npf.cpp
|
||||
oldloader.cpp
|
||||
oldpool.cpp
|
||||
openttd.cpp
|
||||
os_timer.cpp
|
||||
#if WIN32
|
||||
ottdres.rc
|
||||
#end
|
||||
pathfind.c
|
||||
players.c
|
||||
queue.c
|
||||
rail.c
|
||||
saveload.c
|
||||
screenshot.c
|
||||
pathfind.cpp
|
||||
players.cpp
|
||||
queue.cpp
|
||||
rail.cpp
|
||||
saveload.cpp
|
||||
screenshot.cpp
|
||||
#if SDL
|
||||
sdl.c
|
||||
sdl.cpp
|
||||
#end
|
||||
settings.c
|
||||
signs.c
|
||||
sound.c
|
||||
spritecache.c
|
||||
string.c
|
||||
strings.c
|
||||
texteff.c
|
||||
tgp.c
|
||||
thread.c
|
||||
tile.c
|
||||
settings.cpp
|
||||
signs.cpp
|
||||
sound.cpp
|
||||
spritecache.cpp
|
||||
string.cpp
|
||||
strings.cpp
|
||||
texteff.cpp
|
||||
tgp.cpp
|
||||
thread.cpp
|
||||
tile.cpp
|
||||
#if WIN32
|
||||
#else
|
||||
unix.c
|
||||
unix.cpp
|
||||
#end
|
||||
vehicle.c
|
||||
viewport.c
|
||||
waypoint.c
|
||||
widget.c
|
||||
vehicle.cpp
|
||||
viewport.cpp
|
||||
waypoint.cpp
|
||||
widget.cpp
|
||||
#if WIN32
|
||||
win32.c
|
||||
win32.cpp
|
||||
#end
|
||||
window.c
|
||||
window.cpp
|
||||
|
||||
# Header Files
|
||||
airport.h
|
||||
|
@ -178,57 +178,57 @@ video/win32_v.h
|
|||
window.h
|
||||
|
||||
# GUI Source Code
|
||||
aircraft_gui.c
|
||||
airport_gui.c
|
||||
bridge_gui.c
|
||||
build_vehicle_gui.c
|
||||
depot_gui.c
|
||||
dock_gui.c
|
||||
engine_gui.c
|
||||
genworld_gui.c
|
||||
graph_gui.c
|
||||
industry_gui.c
|
||||
intro_gui.c
|
||||
main_gui.c
|
||||
misc_gui.c
|
||||
music_gui.c
|
||||
network/network_gui.c
|
||||
newgrf_gui.c
|
||||
news_gui.c
|
||||
order_gui.c
|
||||
player_gui.c
|
||||
rail_gui.c
|
||||
road_gui.c
|
||||
roadveh_gui.c
|
||||
settings_gui.c
|
||||
ship_gui.c
|
||||
smallmap_gui.c
|
||||
station_gui.c
|
||||
subsidy_gui.c
|
||||
terraform_gui.c
|
||||
town_gui.c
|
||||
train_gui.c
|
||||
vehicle_gui.c
|
||||
aircraft_gui.cpp
|
||||
airport_gui.cpp
|
||||
bridge_gui.cpp
|
||||
build_vehicle_gui.cpp
|
||||
depot_gui.cpp
|
||||
dock_gui.cpp
|
||||
engine_gui.cpp
|
||||
genworld_gui.cpp
|
||||
graph_gui.cpp
|
||||
industry_gui.cpp
|
||||
intro_gui.cpp
|
||||
main_gui.cpp
|
||||
misc_gui.cpp
|
||||
music_gui.cpp
|
||||
network/network_gui.cpp
|
||||
newgrf_gui.cpp
|
||||
news_gui.cpp
|
||||
order_gui.cpp
|
||||
player_gui.cpp
|
||||
rail_gui.cpp
|
||||
road_gui.cpp
|
||||
roadveh_gui.cpp
|
||||
settings_gui.cpp
|
||||
ship_gui.cpp
|
||||
smallmap_gui.cpp
|
||||
station_gui.cpp
|
||||
subsidy_gui.cpp
|
||||
terraform_gui.cpp
|
||||
town_gui.cpp
|
||||
train_gui.cpp
|
||||
vehicle_gui.cpp
|
||||
|
||||
# Landscape
|
||||
aircraft_cmd.c
|
||||
clear_cmd.c
|
||||
disaster_cmd.c
|
||||
dummy_land.c
|
||||
industry_cmd.c
|
||||
misc_cmd.c
|
||||
order_cmd.c
|
||||
rail_cmd.c
|
||||
road_cmd.c
|
||||
roadveh_cmd.c
|
||||
ship_cmd.c
|
||||
station_cmd.c
|
||||
town_cmd.c
|
||||
train_cmd.c
|
||||
tree_cmd.c
|
||||
tunnelbridge_cmd.c
|
||||
unmovable_cmd.c
|
||||
water_cmd.c
|
||||
aircraft_cmd.cpp
|
||||
clear_cmd.cpp
|
||||
disaster_cmd.cpp
|
||||
dummy_land.cpp
|
||||
industry_cmd.cpp
|
||||
misc_cmd.cpp
|
||||
order_cmd.cpp
|
||||
rail_cmd.cpp
|
||||
road_cmd.cpp
|
||||
roadveh_cmd.cpp
|
||||
ship_cmd.cpp
|
||||
station_cmd.cpp
|
||||
town_cmd.cpp
|
||||
train_cmd.cpp
|
||||
tree_cmd.cpp
|
||||
tunnelbridge_cmd.cpp
|
||||
unmovable_cmd.cpp
|
||||
water_cmd.cpp
|
||||
|
||||
# Tables
|
||||
table/ai_rail.h
|
||||
|
@ -259,36 +259,36 @@ table/unmovable_land.h
|
|||
table/water_land.h
|
||||
|
||||
# AI Files
|
||||
ai/ai.c
|
||||
ai/default/default.c
|
||||
ai/trolly/build.c
|
||||
ai/trolly/pathfinder.c
|
||||
ai/trolly/shared.c
|
||||
ai/trolly/trolly.c
|
||||
ai/ai.cpp
|
||||
ai/default/default.cpp
|
||||
ai/trolly/build.cpp
|
||||
ai/trolly/pathfinder.cpp
|
||||
ai/trolly/shared.cpp
|
||||
ai/trolly/trolly.cpp
|
||||
|
||||
# NewGRF
|
||||
newgrf.c
|
||||
newgrf_cargo.c
|
||||
newgrf_config.c
|
||||
newgrf_engine.c
|
||||
newgrf_sound.c
|
||||
newgrf_spritegroup.c
|
||||
newgrf_station.c
|
||||
newgrf_text.c
|
||||
newgrf.cpp
|
||||
newgrf_cargo.cpp
|
||||
newgrf_config.cpp
|
||||
newgrf_engine.cpp
|
||||
newgrf_sound.cpp
|
||||
newgrf_spritegroup.cpp
|
||||
newgrf_station.cpp
|
||||
newgrf_text.cpp
|
||||
|
||||
# Map Accessors
|
||||
bridge_map.c
|
||||
bridge_map.cpp
|
||||
bridge_map.h
|
||||
clear_map.h
|
||||
industry_map.h
|
||||
rail_map.h
|
||||
road_map.c
|
||||
road_map.cpp
|
||||
road_map.h
|
||||
station_map.c
|
||||
station_map.cpp
|
||||
station_map.h
|
||||
town_map.h
|
||||
tree_map.h
|
||||
tunnel_map.c
|
||||
tunnel_map.cpp
|
||||
tunnel_map.h
|
||||
unmovable_map.h
|
||||
void_map.h
|
||||
|
@ -325,36 +325,36 @@ yapf/yapf_settings.h
|
|||
yapf/yapf_ship.cpp
|
||||
|
||||
# Video
|
||||
video/dedicated_v.c
|
||||
video/null_v.c
|
||||
video/dedicated_v.cpp
|
||||
video/null_v.cpp
|
||||
#if SDL
|
||||
video/sdl_v.c
|
||||
video/sdl_v.cpp
|
||||
#end
|
||||
#if WIN32
|
||||
video/win32_v.c
|
||||
video/win32_v.cpp
|
||||
#end
|
||||
|
||||
# Music
|
||||
#if DIRECTMUSIC
|
||||
music/dmusic.cpp
|
||||
#end
|
||||
music/null_m.c
|
||||
music/null_m.cpp
|
||||
#if WIN32
|
||||
music/win32_m.c
|
||||
music/win32_m.cpp
|
||||
#else
|
||||
music/extmidi.c
|
||||
music/extmidi.cpp
|
||||
#end
|
||||
#if BEOS
|
||||
music/bemidi.cpp
|
||||
#end
|
||||
|
||||
# Sound
|
||||
sound/null_s.c
|
||||
sound/null_s.cpp
|
||||
#if SDL
|
||||
sound/sdl_s.c
|
||||
sound/sdl_s.cpp
|
||||
#end
|
||||
#if WIN32
|
||||
sound/win32_s.c
|
||||
sound/win32_s.cpp
|
||||
#end
|
||||
|
||||
#if OSX
|
||||
|
@ -363,12 +363,12 @@ sound/null_s.c
|
|||
|
||||
#if DEDICATED
|
||||
#else
|
||||
music/qtmidi.c
|
||||
music/qtmidi.cpp
|
||||
#end
|
||||
|
||||
#if COCOA
|
||||
video/cocoa_v.m
|
||||
sound/cocoa_s.c
|
||||
os/macosx/splash.c
|
||||
sound/cocoa_s.cpp
|
||||
os/macosx/splash.cpp
|
||||
#end
|
||||
#end
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "../variables.h"
|
||||
#include "../command.h"
|
||||
#include "../network/network.h"
|
||||
#include "../helpers.hpp"
|
||||
#include "ai.h"
|
||||
#include "default/default.h"
|
||||
|
||||
|
@ -50,11 +51,11 @@ static void AI_PutCommandInQueue(PlayerID player, TileIndex tile, uint32 p1, uin
|
|||
|
||||
if (_ai_player[player].queue_tail == NULL) {
|
||||
/* There is no item in the queue yet, create the queue */
|
||||
_ai_player[player].queue = malloc(sizeof(AICommand));
|
||||
MallocT(&_ai_player[player].queue, 1);
|
||||
_ai_player[player].queue_tail = _ai_player[player].queue;
|
||||
} else {
|
||||
/* Add an item at the end */
|
||||
_ai_player[player].queue_tail->next = malloc(sizeof(AICommand));
|
||||
MallocT(&_ai_player[player].queue_tail->next, 1);
|
||||
_ai_player[player].queue_tail = _ai_player[player].queue_tail->next;
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
#include "../../variables.h"
|
||||
#include "../../bridge.h"
|
||||
#include "../../date.h"
|
||||
#include "../../helpers.hpp"
|
||||
#include "default.h"
|
||||
|
||||
// remove some day perhaps?
|
||||
|
@ -63,10 +64,10 @@ enum {
|
|||
|
||||
#include "../../table/ai_rail.h"
|
||||
|
||||
static byte GetRailTrackStatus(TileIndex tile)
|
||||
static TrackBits GetRailTrackStatus(TileIndex tile)
|
||||
{
|
||||
uint32 r = GetTileTrackStatus(tile, TRANSPORT_RAIL);
|
||||
return (byte) (r | r >> 8);
|
||||
return (TrackBits)(byte) (r | r >> 8);
|
||||
}
|
||||
|
||||
|
||||
|
@ -644,8 +645,8 @@ static bool AiCheckIfRouteIsGood(Player *p, FoundRoute *fr, byte bitmask)
|
|||
}
|
||||
|
||||
if (fr->cargo == CT_PASSENGERS || fr->cargo == CT_MAIL) {
|
||||
const Town* from = fr->from;
|
||||
const Town* to = fr->to;
|
||||
const Town* from = (const Town*)fr->from;
|
||||
const Town* to = (const Town*)fr->to;
|
||||
|
||||
if (from->pct_pass_transported > 0x99 ||
|
||||
to->pct_pass_transported > 0x99) {
|
||||
|
@ -783,7 +784,7 @@ static void AiWantLongIndustryRoute(Player *p)
|
|||
p->ai.order_list_blocks[2] = 255;
|
||||
|
||||
p->ai.state = AIS_BUILD_DEFAULT_RAIL_BLOCKS;
|
||||
p->ai.state_mode = -1;
|
||||
p->ai.state_mode = UCHAR_MAX;
|
||||
p->ai.state_counter = 0;
|
||||
p->ai.timeout_counter = 0;
|
||||
}
|
||||
|
@ -851,7 +852,7 @@ static void AiWantMediumIndustryRoute(Player *p)
|
|||
p->ai.order_list_blocks[1] = 1;
|
||||
p->ai.order_list_blocks[2] = 255;
|
||||
p->ai.state = AIS_BUILD_DEFAULT_RAIL_BLOCKS;
|
||||
p->ai.state_mode = -1;
|
||||
p->ai.state_mode = UCHAR_MAX;
|
||||
p->ai.state_counter = 0;
|
||||
p->ai.timeout_counter = 0;
|
||||
}
|
||||
|
@ -919,7 +920,7 @@ static void AiWantShortIndustryRoute(Player *p)
|
|||
p->ai.order_list_blocks[1] = 1;
|
||||
p->ai.order_list_blocks[2] = 255;
|
||||
p->ai.state = AIS_BUILD_DEFAULT_RAIL_BLOCKS;
|
||||
p->ai.state_mode = -1;
|
||||
p->ai.state_mode = UCHAR_MAX;
|
||||
p->ai.state_counter = 0;
|
||||
p->ai.timeout_counter = 0;
|
||||
}
|
||||
|
@ -1020,7 +1021,7 @@ static void AiWantMailRoute(Player *p)
|
|||
p->ai.order_list_blocks[1] = 1;
|
||||
p->ai.order_list_blocks[2] = 255;
|
||||
p->ai.state = AIS_BUILD_DEFAULT_RAIL_BLOCKS;
|
||||
p->ai.state_mode = -1;
|
||||
p->ai.state_mode = UCHAR_MAX;
|
||||
p->ai.state_counter = 0;
|
||||
p->ai.timeout_counter = 0;
|
||||
}
|
||||
|
@ -1089,7 +1090,7 @@ static void AiWantPassengerRoute(Player *p)
|
|||
p->ai.order_list_blocks[1] = 1;
|
||||
p->ai.order_list_blocks[2] = 255;
|
||||
p->ai.state = AIS_BUILD_DEFAULT_RAIL_BLOCKS;
|
||||
p->ai.state_mode = -1;
|
||||
p->ai.state_mode = UCHAR_MAX;
|
||||
p->ai.state_counter = 0;
|
||||
p->ai.timeout_counter = 0;
|
||||
}
|
||||
|
@ -1164,7 +1165,7 @@ static void AiWantLongRoadIndustryRoute(Player *p)
|
|||
p->ai.order_list_blocks[2] = 255;
|
||||
|
||||
p->ai.state = AIS_BUILD_DEFAULT_ROAD_BLOCKS;
|
||||
p->ai.state_mode = -1;
|
||||
p->ai.state_mode = UCHAR_MAX;
|
||||
p->ai.state_counter = 0;
|
||||
p->ai.timeout_counter = 0;
|
||||
}
|
||||
|
@ -1220,7 +1221,7 @@ static void AiWantMediumRoadIndustryRoute(Player *p)
|
|||
p->ai.order_list_blocks[2] = 255;
|
||||
|
||||
p->ai.state = AIS_BUILD_DEFAULT_ROAD_BLOCKS;
|
||||
p->ai.state_mode = -1;
|
||||
p->ai.state_mode = UCHAR_MAX;
|
||||
p->ai.state_counter = 0;
|
||||
p->ai.timeout_counter = 0;
|
||||
}
|
||||
|
@ -1278,7 +1279,7 @@ static void AiWantLongRoadPassengerRoute(Player *p)
|
|||
p->ai.order_list_blocks[2] = 255;
|
||||
|
||||
p->ai.state = AIS_BUILD_DEFAULT_ROAD_BLOCKS;
|
||||
p->ai.state_mode = -1;
|
||||
p->ai.state_mode = UCHAR_MAX;
|
||||
p->ai.state_counter = 0;
|
||||
p->ai.timeout_counter = 0;
|
||||
}
|
||||
|
@ -1334,7 +1335,7 @@ static void AiWantPassengerRouteInsideTown(Player *p)
|
|||
p->ai.order_list_blocks[2] = 255;
|
||||
|
||||
p->ai.state = AIS_BUILD_DEFAULT_ROAD_BLOCKS;
|
||||
p->ai.state_mode = -1;
|
||||
p->ai.state_mode = UCHAR_MAX;
|
||||
p->ai.state_counter = 0;
|
||||
p->ai.timeout_counter = 0;
|
||||
}
|
||||
|
@ -1852,7 +1853,7 @@ static bool AiDoFollowTrack(const Player* p)
|
|||
arpfd.tile2 = p->ai.cur_tile_a;
|
||||
arpfd.flag = false;
|
||||
arpfd.count = 0;
|
||||
FollowTrack(p->ai.cur_tile_a + TileOffsByDiagDir(p->ai.cur_dir_a), 0x2000 | TRANSPORT_RAIL, p->ai.cur_dir_a^2,
|
||||
FollowTrack(p->ai.cur_tile_a + TileOffsByDiagDir(p->ai.cur_dir_a), 0x2000 | TRANSPORT_RAIL, (DiagDirection)(p->ai.cur_dir_a^2),
|
||||
(TPFEnumProc*)AiEnumFollowTrack, NULL, &arpfd);
|
||||
return arpfd.count > 8;
|
||||
}
|
||||
|
@ -1941,7 +1942,7 @@ static bool AiCheckRailPathBetter(AiRailFinder *arf, const byte *p)
|
|||
}
|
||||
}
|
||||
arf->recursive_mode = 0;
|
||||
arf->cur_best_dist = (uint)-1;
|
||||
arf->cur_best_dist = UINT_MAX;
|
||||
arf->cur_best_depth = 0xff;
|
||||
|
||||
return better;
|
||||
|
@ -2185,7 +2186,7 @@ static bool AiRemoveTileAndGoForward(Player *p)
|
|||
} else {
|
||||
// Check if the bridge points in the right direction.
|
||||
// This is not really needed the first place AiRemoveTileAndGoForward is called.
|
||||
if (DiagDirToAxis(GetBridgeRampDirection(tile)) != (p->ai.cur_dir_a & 1U)) return false;
|
||||
if (DiagDirToAxis(GetBridgeRampDirection(tile)) != (p->ai.cur_dir_a & 1)) return false;
|
||||
|
||||
tile = GetOtherBridgeEnd(tile);
|
||||
|
||||
|
@ -2820,7 +2821,7 @@ static bool AiCheckRoadFinished(Player *p)
|
|||
are.best_dist = (uint)-1;
|
||||
|
||||
for_each_bit(i, bits) {
|
||||
FollowTrack(tile, 0x3000 | TRANSPORT_ROAD, _dir_by_track[i], (TPFEnumProc*)AiEnumFollowRoad, NULL, &are);
|
||||
FollowTrack(tile, 0x3000 | TRANSPORT_ROAD, (DiagDirection)_dir_by_track[i], (TPFEnumProc*)AiEnumFollowRoad, NULL, &are);
|
||||
}
|
||||
|
||||
if (DistanceManhattan(tile, are.dest) <= are.best_dist) return false;
|
||||
|
@ -3583,7 +3584,7 @@ static void AiStateRemoveStation(Player *p)
|
|||
p->ai.state = AIS_1;
|
||||
|
||||
// Get a list of all stations that are in use by a vehicle
|
||||
in_use = malloc(GetMaxStationIndex() + 1);
|
||||
MallocT(&in_use, GetMaxStationIndex() + 1);
|
||||
memset(in_use, 0, GetMaxStationIndex() + 1);
|
||||
FOR_ALL_ORDERS(ord) {
|
||||
if (ord->type == OT_GOTO_STATION) in_use[ord->dest] = 1;
|
||||
|
@ -3705,7 +3706,7 @@ pos_3:
|
|||
return;
|
||||
}
|
||||
|
||||
rails = 0;
|
||||
rails = TRACK_BIT_NONE;
|
||||
|
||||
switch (GetBridgeRampDirection(tile)) {
|
||||
default:
|
||||
|
@ -3798,7 +3799,6 @@ static void AiHandleTakeover(Player *p)
|
|||
uint asked = p->bankrupt_asked;
|
||||
Player *pp, *best_pl = NULL;
|
||||
int32 best_val = -1;
|
||||
uint old_p;
|
||||
|
||||
// Ask the guy with the highest performance hist.
|
||||
FOR_ALL_PLAYERS(pp) {
|
||||
|
@ -3830,7 +3830,7 @@ static void AiHandleTakeover(Player *p)
|
|||
// Too little money for computer to buy it?
|
||||
if (best_pl->player_money >> 1 >= p->bankrupt_value) {
|
||||
// Computer wants to buy it.
|
||||
old_p = _current_player;
|
||||
PlayerID old_p = _current_player;
|
||||
_current_player = p->index;
|
||||
DoCommand(0, old_p, 0, DC_EXEC, CMD_BUY_COMPANY);
|
||||
_current_player = old_p;
|
||||
|
|
|
@ -57,7 +57,7 @@ static bool IsRoad(TileIndex tile)
|
|||
// Check if the current tile is in our end-area
|
||||
static int32 AyStar_AiPathFinder_EndNodeCheck(AyStar *aystar, OpenListNode *current)
|
||||
{
|
||||
const Ai_PathFinderInfo* PathFinderInfo = aystar->user_target;
|
||||
const Ai_PathFinderInfo* PathFinderInfo = (Ai_PathFinderInfo*)aystar->user_target;
|
||||
|
||||
// It is not allowed to have a station on the end of a bridge or tunnel ;)
|
||||
if (current->path.node.user_data[0] != 0) return AYSTAR_DONE;
|
||||
|
@ -82,7 +82,7 @@ static uint AiPathFinder_Hash(uint key1, uint key2)
|
|||
static void AyStar_AiPathFinder_Free(AyStar *aystar)
|
||||
{
|
||||
AyStarMain_Free(aystar);
|
||||
free(aystar);
|
||||
delete aystar;
|
||||
}
|
||||
|
||||
|
||||
|
@ -99,7 +99,7 @@ AyStar *new_AyStar_AiPathFinder(int max_tiles_around, Ai_PathFinderInfo *PathFin
|
|||
uint x;
|
||||
uint y;
|
||||
// Create AyStar
|
||||
AyStar *result = malloc(sizeof(AyStar));
|
||||
AyStar *result = new AyStar();
|
||||
init_AyStar(result, AiPathFinder_Hash, 1 << 10);
|
||||
// Set the function pointers
|
||||
result->CalculateG = AyStar_AiPathFinder_CalculateG;
|
||||
|
@ -170,7 +170,7 @@ void clean_AyStar_AiPathFinder(AyStar *aystar, Ai_PathFinderInfo *PathFinderInfo
|
|||
// The h-value, simple calculation
|
||||
static int32 AyStar_AiPathFinder_CalculateH(AyStar *aystar, AyStarNode *current, OpenListNode *parent)
|
||||
{
|
||||
const Ai_PathFinderInfo* PathFinderInfo = aystar->user_target;
|
||||
const Ai_PathFinderInfo* PathFinderInfo = (Ai_PathFinderInfo*)aystar->user_target;
|
||||
int r, r2;
|
||||
|
||||
if (PathFinderInfo->end_direction != AI_PATHFINDER_NO_DIRECTION) {
|
||||
|
@ -214,7 +214,6 @@ static void AyStar_AiPathFinder_FoundEndNode(AyStar *aystar, OpenListNode *curre
|
|||
// What tiles are around us.
|
||||
static void AyStar_AiPathFinder_GetNeighbours(AyStar *aystar, OpenListNode *current)
|
||||
{
|
||||
uint i;
|
||||
int ret;
|
||||
int dir;
|
||||
|
||||
|
@ -223,7 +222,7 @@ static void AyStar_AiPathFinder_GetNeighbours(AyStar *aystar, OpenListNode *curr
|
|||
aystar->num_neighbours = 0;
|
||||
|
||||
// Go through all surrounding tiles and check if they are within the limits
|
||||
for (i = 0; i < 4; i++) {
|
||||
for (DiagDirection i = DIAGDIR_BEGIN; i < DIAGDIR_END; i++) {
|
||||
TileIndex ctile = current->path.node.tile; // Current tile
|
||||
TileIndex atile = ctile + TileOffsByDiagDir(i); // Adjacent tile
|
||||
|
||||
|
@ -238,7 +237,7 @@ static void AyStar_AiPathFinder_GetNeighbours(AyStar *aystar, OpenListNode *curr
|
|||
if (IsTunnel(atile)) {
|
||||
if (GetTunnelDirection(atile) != i) continue;
|
||||
} else {
|
||||
if ((_m[atile].m5 & 1U) != DiagDirToAxis(i)) continue;
|
||||
if ((_m[atile].m5 & 1) != DiagDirToAxis(i)) continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -246,7 +245,7 @@ static void AyStar_AiPathFinder_GetNeighbours(AyStar *aystar, OpenListNode *curr
|
|||
if (!PathFinderInfo->rail_or_road && IsRoad(ctile)) {
|
||||
if (IsTileType(ctile, MP_TUNNELBRIDGE)) {
|
||||
// An existing bridge/tunnel... let's test the direction ;)
|
||||
if ((_m[ctile].m5 & 1U) != (i & 1)) continue;
|
||||
if ((_m[ctile].m5 & 1) != (i & 1)) continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -254,7 +253,7 @@ static void AyStar_AiPathFinder_GetNeighbours(AyStar *aystar, OpenListNode *curr
|
|||
(AI_PATHFINDER_FLAG_TUNNEL & current->path.node.user_data[0]) != 0) {
|
||||
// We are a bridge/tunnel, how cool!!
|
||||
// This means we can only point forward.. get the direction from the user_data
|
||||
if (i != (current->path.node.user_data[0] >> 8)) continue;
|
||||
if ((uint)i != (current->path.node.user_data[0] >> 8)) continue;
|
||||
}
|
||||
dir = 0;
|
||||
|
||||
|
@ -371,7 +370,7 @@ static void AyStar_AiPathFinder_GetNeighbours(AyStar *aystar, OpenListNode *curr
|
|||
|
||||
|
||||
extern uint GetRailFoundation(Slope tileh, TrackBits bits); // XXX function declaration in .c
|
||||
extern uint GetRoadFoundation(Slope tileh, uint bits); // XXX function declaration in .c
|
||||
extern uint GetRoadFoundation(Slope tileh, RoadBits bits); // XXX function declaration in .c
|
||||
extern uint GetBridgeFoundation(Slope tileh, Axis); // XXX function declaration in .c
|
||||
enum {
|
||||
BRIDGE_NO_FOUNDATION = 1 << 0 | 1 << 3 | 1 << 6 | 1 << 9 | 1 << 12,
|
||||
|
@ -417,7 +416,7 @@ static int32 AyStar_AiPathFinder_CalculateG(AyStar *aystar, AyStarNode *current,
|
|||
// Skip if the tile was from a bridge or tunnel
|
||||
if (parent->path.node.user_data[0] == 0 && current->user_data[0] == 0) {
|
||||
if (PathFinderInfo->rail_or_road) {
|
||||
r = GetRailFoundation(parent_tileh, 1 << AiNew_GetRailDirection(parent->path.parent->node.tile, parent->path.node.tile, current->tile));
|
||||
r = GetRailFoundation(parent_tileh, (TrackBits)(1 << AiNew_GetRailDirection(parent->path.parent->node.tile, parent->path.node.tile, current->tile)));
|
||||
// Maybe is BRIDGE_NO_FOUNDATION a bit strange here, but it contains just the right information..
|
||||
if (r >= 15 || (r == 0 && HASBIT(BRIDGE_NO_FOUNDATION, tileh))) {
|
||||
res += AI_PATHFINDER_TILE_GOES_UP_PENALTY;
|
||||
|
@ -426,7 +425,7 @@ static int32 AyStar_AiPathFinder_CalculateG(AyStar *aystar, AyStarNode *current,
|
|||
}
|
||||
} else {
|
||||
if (!IsRoad(parent->path.node.tile) || !IsTileType(parent->path.node.tile, MP_TUNNELBRIDGE)) {
|
||||
r = GetRoadFoundation(parent_tileh, AiNew_GetRoadDirection(parent->path.parent->node.tile, parent->path.node.tile, current->tile));
|
||||
r = GetRoadFoundation(parent_tileh, (RoadBits)AiNew_GetRoadDirection(parent->path.parent->node.tile, parent->path.node.tile, current->tile));
|
||||
if (r >= 15 || r == 0) {
|
||||
res += AI_PATHFINDER_TILE_GOES_UP_PENALTY;
|
||||
} else {
|
||||
|
@ -452,13 +451,13 @@ static int32 AyStar_AiPathFinder_CalculateG(AyStar *aystar, AyStarNode *current,
|
|||
// Check if we are going up or down, first for the starting point
|
||||
// In user_data[0] is at the 8th bit the direction
|
||||
if (!HASBIT(BRIDGE_NO_FOUNDATION, parent_tileh)) {
|
||||
if (GetBridgeFoundation(parent_tileh, (current->user_data[0] >> 8) & 1) < 15) {
|
||||
if (GetBridgeFoundation(parent_tileh, (Axis)((current->user_data[0] >> 8) & 1)) < 15) {
|
||||
res += AI_PATHFINDER_BRIDGE_GOES_UP_PENALTY;
|
||||
}
|
||||
}
|
||||
// Second for the end point
|
||||
if (!HASBIT(BRIDGE_NO_FOUNDATION, tileh)) {
|
||||
if (GetBridgeFoundation(tileh, (current->user_data[0] >> 8) & 1) < 15) {
|
||||
if (GetBridgeFoundation(tileh, (Axis)((current->user_data[0] >> 8) & 1)) < 15) {
|
||||
res += AI_PATHFINDER_BRIDGE_GOES_UP_PENALTY;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -794,7 +794,7 @@ static void AiNew_State_FindDepot(Player *p)
|
|||
|
||||
for (i=2;i<p->ainew.path_info.route_length-2;i++) {
|
||||
tile = p->ainew.path_info.route[i];
|
||||
for (j = 0; j < 4; j++) {
|
||||
for (j = DIAGDIR_BEGIN; j < DIAGDIR_END; j++) {
|
||||
TileIndex t = tile + TileOffsByDiagDir(j);
|
||||
|
||||
if (IsTileType(t, MP_STREET) &&
|
||||
|
@ -825,7 +825,7 @@ static void AiNew_State_FindDepot(Player *p)
|
|||
|
||||
tile = p->ainew.path_info.route[i];
|
||||
|
||||
for (j = 0; j < 4; j++) {
|
||||
for (j = DIAGDIR_BEGIN; j < DIAGDIR_END; j++) {
|
||||
TileIndex t = tile + TileOffsByDiagDir(j);
|
||||
|
||||
// It may not be placed on the road/rail itself
|
||||
|
@ -901,7 +901,8 @@ static int AiNew_HowManyVehicles(Player *p)
|
|||
}
|
||||
|
||||
// This is because moving 60% is more than we can dream of!
|
||||
max_cargo *= 0.6;
|
||||
max_cargo *= 6;
|
||||
max_cargo /= 10;
|
||||
// We want all the cargo to be gone in a month.. so, we know the cargo it delivers
|
||||
// we know what the vehicle takes with him, and we know the time it takes him
|
||||
// to get back here.. now let's do some math!
|
||||
|
@ -1051,7 +1052,7 @@ static void AiNew_State_BuildPath(Player *p)
|
|||
dir3 = p->ainew.to_direction;
|
||||
}
|
||||
|
||||
ret = AI_DoCommand(tile, DiagDirToRoadBits(ReverseDiagDir(dir1)), 0, DC_EXEC | DC_NO_WATER, CMD_BUILD_ROAD);
|
||||
ret = AI_DoCommand(tile, DiagDirToRoadBits(ReverseDiagDir((DiagDirection)dir1)), 0, DC_EXEC | DC_NO_WATER, CMD_BUILD_ROAD);
|
||||
if (!CmdFailed(ret)) {
|
||||
dir1 = TileOffsByDiagDir(dir1);
|
||||
if (IsTileType(tile + dir1, MP_CLEAR) || IsTileType(tile + dir1, MP_TREES)) {
|
||||
|
@ -1063,7 +1064,7 @@ static void AiNew_State_BuildPath(Player *p)
|
|||
}
|
||||
}
|
||||
|
||||
ret = AI_DoCommand(tile, DiagDirToRoadBits(ReverseDiagDir(dir2)), 0, DC_EXEC | DC_NO_WATER, CMD_BUILD_ROAD);
|
||||
ret = AI_DoCommand(tile, DiagDirToRoadBits(ReverseDiagDir((DiagDirection)dir2)), 0, DC_EXEC | DC_NO_WATER, CMD_BUILD_ROAD);
|
||||
if (!CmdFailed(ret)) {
|
||||
dir2 = TileOffsByDiagDir(dir2);
|
||||
if (IsTileType(tile + dir2, MP_CLEAR) || IsTileType(tile + dir2, MP_TREES)) {
|
||||
|
@ -1075,7 +1076,7 @@ static void AiNew_State_BuildPath(Player *p)
|
|||
}
|
||||
}
|
||||
|
||||
ret = AI_DoCommand(tile, DiagDirToRoadBits(dir3), 0, DC_EXEC | DC_NO_WATER, CMD_BUILD_ROAD);
|
||||
ret = AI_DoCommand(tile, DiagDirToRoadBits((DiagDirection)dir3), 0, DC_EXEC | DC_NO_WATER, CMD_BUILD_ROAD);
|
||||
if (!CmdFailed(ret)) {
|
||||
dir3 = TileOffsByDiagDir(dir3);
|
||||
if (IsTileType(tile + dir3, MP_CLEAR) || IsTileType(tile + dir3, MP_TREES)) {
|
||||
|
|
|
@ -246,7 +246,7 @@ int32 CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||
|
||||
v->unitnumber = unit_num;
|
||||
v->type = u->type = VEH_Aircraft;
|
||||
v->direction = 3;
|
||||
v->direction = DIR_SE;
|
||||
|
||||
v->owner = u->owner = _current_player;
|
||||
|
||||
|
@ -382,7 +382,7 @@ int32 CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||
u->next = w;
|
||||
|
||||
w->type = VEH_Aircraft;
|
||||
w->direction = 0;
|
||||
w->direction = DIR_N;
|
||||
w->owner = _current_player;
|
||||
w->x_pos = v->x_pos;
|
||||
w->y_pos = v->y_pos;
|
||||
|
@ -907,7 +907,8 @@ static bool AircraftController(Vehicle *v)
|
|||
Station *st;
|
||||
const AirportMovingData *amd;
|
||||
Vehicle *u;
|
||||
byte z,newdir,maxz,curz;
|
||||
byte z, maxz, curz;
|
||||
Direction newdir;
|
||||
GetNewVehiclePosResult gp;
|
||||
uint dist;
|
||||
int x,y;
|
||||
|
@ -1419,7 +1420,7 @@ static void AircraftLeaveHangar(Vehicle *v)
|
|||
v->cur_speed = 0;
|
||||
v->subspeed = 0;
|
||||
v->progress = 0;
|
||||
v->direction = 3;
|
||||
v->direction = DIR_SE;
|
||||
v->vehstatus &= ~VS_HIDDEN;
|
||||
{
|
||||
Vehicle *u = v->next;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "variables.h"
|
||||
#include "airport_movement.h"
|
||||
#include "date.h"
|
||||
#include "helpers.hpp"
|
||||
|
||||
/* Uncomment this to print out a full report of the airport-structure
|
||||
* You should either use
|
||||
|
@ -30,7 +31,7 @@ static AirportFTAClass *HeliStation;
|
|||
|
||||
static void AirportFTAClass_Constructor(AirportFTAClass *apc,
|
||||
const byte *terminals, const byte *helipads,
|
||||
const byte entry_point, const byte acc_planes,
|
||||
const byte entry_point, const AcceptPlanes acc_planes,
|
||||
const AirportFTAbuildup *apFA,
|
||||
const TileIndexDiffC *depots, const byte nof_depots,
|
||||
uint size_x, uint size_y
|
||||
|
@ -49,7 +50,7 @@ static void AirportPrintOut(const AirportFTAClass *apc, bool full_report);
|
|||
void InitializeAirports(void)
|
||||
{
|
||||
// country airport
|
||||
CountryAirport = malloc(sizeof(AirportFTAClass));
|
||||
MallocT(&CountryAirport, 1);
|
||||
|
||||
AirportFTAClass_Constructor(
|
||||
CountryAirport,
|
||||
|
@ -64,7 +65,7 @@ void InitializeAirports(void)
|
|||
);
|
||||
|
||||
// city airport
|
||||
CityAirport = malloc(sizeof(AirportFTAClass));
|
||||
MallocT(&CityAirport, 1);
|
||||
|
||||
AirportFTAClass_Constructor(
|
||||
CityAirport,
|
||||
|
@ -79,7 +80,7 @@ void InitializeAirports(void)
|
|||
);
|
||||
|
||||
// metropolitan airport
|
||||
MetropolitanAirport = malloc(sizeof(AirportFTAClass));
|
||||
MallocT(&MetropolitanAirport, 1);
|
||||
|
||||
AirportFTAClass_Constructor(
|
||||
MetropolitanAirport,
|
||||
|
@ -94,7 +95,7 @@ void InitializeAirports(void)
|
|||
);
|
||||
|
||||
// international airport
|
||||
InternationalAirport = (AirportFTAClass *)malloc(sizeof(AirportFTAClass));
|
||||
MallocT(&InternationalAirport, 1);
|
||||
|
||||
AirportFTAClass_Constructor(
|
||||
InternationalAirport,
|
||||
|
@ -109,7 +110,7 @@ void InitializeAirports(void)
|
|||
);
|
||||
|
||||
// intercontintental airport
|
||||
IntercontinentalAirport = (AirportFTAClass *)malloc(sizeof(AirportFTAClass));
|
||||
MallocT(&IntercontinentalAirport, 1);
|
||||
|
||||
AirportFTAClass_Constructor(
|
||||
IntercontinentalAirport,
|
||||
|
@ -124,7 +125,7 @@ void InitializeAirports(void)
|
|||
);
|
||||
|
||||
// heliport, oilrig
|
||||
Heliport = (AirportFTAClass *)malloc(sizeof(AirportFTAClass));
|
||||
MallocT(&Heliport, 1);
|
||||
|
||||
AirportFTAClass_Constructor(
|
||||
Heliport,
|
||||
|
@ -141,7 +142,7 @@ void InitializeAirports(void)
|
|||
Oilrig = Heliport; // exactly the same structure for heliport/oilrig, so share state machine
|
||||
|
||||
// commuter airport
|
||||
CommuterAirport = malloc(sizeof(AirportFTAClass));
|
||||
MallocT(&CommuterAirport, 1);
|
||||
|
||||
AirportFTAClass_Constructor(
|
||||
CommuterAirport,
|
||||
|
@ -156,7 +157,7 @@ void InitializeAirports(void)
|
|||
);
|
||||
|
||||
// helidepot airport
|
||||
HeliDepot = malloc(sizeof(AirportFTAClass));
|
||||
MallocT(&HeliDepot, 1);
|
||||
|
||||
AirportFTAClass_Constructor(
|
||||
HeliDepot,
|
||||
|
@ -171,7 +172,7 @@ void InitializeAirports(void)
|
|||
);
|
||||
|
||||
// helistation airport
|
||||
HeliStation = malloc(sizeof(AirportFTAClass));
|
||||
MallocT(&HeliStation, 1);
|
||||
|
||||
AirportFTAClass_Constructor(
|
||||
HeliStation,
|
||||
|
@ -202,7 +203,7 @@ void UnInitializeAirports(void)
|
|||
|
||||
static void AirportFTAClass_Constructor(AirportFTAClass *apc,
|
||||
const byte *terminals, const byte *helipads,
|
||||
const byte entry_point, const byte acc_planes,
|
||||
const byte entry_point, const AcceptPlanes acc_planes,
|
||||
const AirportFTAbuildup *apFA,
|
||||
const TileIndexDiffC *depots, const byte nof_depots,
|
||||
uint size_x, uint size_y
|
||||
|
@ -323,7 +324,8 @@ static byte AirportGetTerminalCount(const byte *terminals, byte *groups)
|
|||
static void AirportBuildAutomata(AirportFTAClass *apc, const AirportFTAbuildup *apFA)
|
||||
{
|
||||
AirportFTA *current;
|
||||
AirportFTA *FAutomata = malloc(sizeof(AirportFTA) * apc->nofelements);
|
||||
AirportFTA *FAutomata;
|
||||
MallocT(&FAutomata, apc->nofelements);
|
||||
uint16 internalcounter = 0;
|
||||
uint16 i;
|
||||
|
||||
|
@ -337,7 +339,8 @@ static void AirportBuildAutomata(AirportFTAClass *apc, const AirportFTAbuildup *
|
|||
|
||||
// outgoing nodes from the same position, create linked list
|
||||
while (current->position == apFA[internalcounter + 1].position) {
|
||||
AirportFTA *newNode = malloc(sizeof(AirportFTA));
|
||||
AirportFTA *newNode;
|
||||
MallocT(&newNode, 1);
|
||||
|
||||
newNode->position = apFA[internalcounter + 1].position;
|
||||
newNode->heading = apFA[internalcounter + 1].heading;
|
||||
|
|
|
@ -3,6 +3,8 @@
|
|||
#ifndef AIRPORT_H
|
||||
#define AIRPORT_H
|
||||
|
||||
#include "direction.h"
|
||||
|
||||
enum {MAX_TERMINALS = 10};
|
||||
enum {MAX_HELIPADS = 4};
|
||||
enum {MAX_ELEMENTS = 255};
|
||||
|
@ -23,12 +25,18 @@ enum {
|
|||
};
|
||||
|
||||
// do not change unless you change v->subtype too. This aligns perfectly with its current setting
|
||||
enum {
|
||||
enum AcceptPlanes {
|
||||
ACC_BEGIN = 0,
|
||||
AIRCRAFT_ONLY = 0,
|
||||
ALL = 1,
|
||||
HELICOPTERS_ONLY = 2,
|
||||
ACC_END
|
||||
};
|
||||
|
||||
/** Define basic enum properties */
|
||||
template <> struct EnumPropsT<AcceptPlanes> : MakeEnumPropsT<AcceptPlanes, byte, ACC_BEGIN, ACC_END, ACC_END> {};
|
||||
typedef TinyEnumT<AcceptPlanes> AcceptPlanesByte;
|
||||
|
||||
enum {
|
||||
AMED_NOSPDCLAMP = 1 << 0,
|
||||
AMED_TAKEOFF = 1 << 1,
|
||||
|
@ -122,7 +130,7 @@ enum {
|
|||
typedef struct AirportMovingData {
|
||||
int x,y;
|
||||
byte flag;
|
||||
byte direction;
|
||||
DirectionByte direction;
|
||||
} AirportMovingData;
|
||||
|
||||
// Finite sTate mAchine --> FTA
|
||||
|
@ -131,7 +139,7 @@ typedef struct AirportFTAClass {
|
|||
const byte *terminals;
|
||||
const byte *helipads;
|
||||
byte entry_point; // when an airplane arrives at this airport, enter it at position entry_point
|
||||
byte acc_planes; // accept airplanes or helicopters or both
|
||||
AcceptPlanesByte acc_planes; // accept airplanes or helicopters or both
|
||||
const TileIndexDiffC *airport_depots; // gives the position of the depots on the airports
|
||||
byte nof_depots; // number of depots this airport has
|
||||
struct AirportFTA *layout; // state machine for airport
|
||||
|
|
|
@ -216,7 +216,7 @@ static void BuildAirportPickerWndProc(Window *w, WindowEvent *e)
|
|||
SetWindowDirty(w);
|
||||
break;
|
||||
case 16: case 17:
|
||||
_station_show_coverage = e->we.click.widget - 16;
|
||||
_station_show_coverage = (e->we.click.widget != 16);
|
||||
SetWindowWidgetLoweredState(w, 16, !_station_show_coverage);
|
||||
SetWindowWidgetLoweredState(w, 17, _station_show_coverage);
|
||||
SndPlayFx(SND_15_BEEP);
|
||||
|
|
|
@ -17,354 +17,354 @@ typedef struct AirportFTAbuildup {
|
|||
/////*********Movement Positions on Airports********************///////
|
||||
// Country Airfield (small) 4x3
|
||||
static const AirportMovingData _airport_moving_data_country[22] = {
|
||||
{ 53, 3, AMED_EXACTPOS, 3 }, // 00 In Hangar
|
||||
{ 53, 27, 0, 0 }, // 01 Taxi to right outside depot
|
||||
{ 32, 23, AMED_EXACTPOS, 7 }, // 02 Terminal 1
|
||||
{ 10, 23, AMED_EXACTPOS, 7 }, // 03 Terminal 2
|
||||
{ 43, 37, 0, 0 }, // 04 Going towards terminal 2
|
||||
{ 24, 37, 0, 0 }, // 05 Going towards terminal 2
|
||||
{ 53, 37, 0, 0 }, // 06 Going for takeoff
|
||||
{ 61, 40, AMED_EXACTPOS, 1 }, // 07 Taxi to start of runway (takeoff)
|
||||
{ 3, 40, AMED_NOSPDCLAMP, 0 }, // 08 Accelerate to end of runway
|
||||
{ -79, 40, AMED_NOSPDCLAMP | AMED_TAKEOFF, 0 }, // 09 Take off
|
||||
{ 177, 40, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 10 Fly to landing position in air
|
||||
{ 56, 40, AMED_NOSPDCLAMP | AMED_LAND, 0 }, // 11 Going down for land
|
||||
{ 3, 40, AMED_NOSPDCLAMP | AMED_BRAKE, 0 }, // 12 Just landed, brake until end of runway
|
||||
{ 7, 40, 0, 0 }, // 13 Just landed, turn around and taxi 1 square
|
||||
{ 53, 40, 0, 0 }, // 14 Taxi from runway to crossing
|
||||
{ -31, 193, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 15 Fly around waiting for a landing spot (north-east)
|
||||
{ 1, 1, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 16 Fly around waiting for a landing spot (north-west)
|
||||
{ 257, 1, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 17 Fly around waiting for a landing spot (south-west)
|
||||
{ 273, 49, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 18 Fly around waiting for a landing spot (south)
|
||||
{ 44, 37, AMED_HELI_RAISE, 0 }, // 19 Helicopter takeoff
|
||||
{ 44, 40, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 20 In position above landing spot helicopter
|
||||
{ 44, 40, AMED_HELI_LOWER, 0 }, // 21 Helicopter landing
|
||||
{ 53, 3, AMED_EXACTPOS, {DIR_SE} }, // 00 In Hangar
|
||||
{ 53, 27, 0, {DIR_N} }, // 01 Taxi to right outside depot
|
||||
{ 32, 23, AMED_EXACTPOS, {DIR_NW} }, // 02 Terminal 1
|
||||
{ 10, 23, AMED_EXACTPOS, {DIR_NW} }, // 03 Terminal 2
|
||||
{ 43, 37, 0, {DIR_N} }, // 04 Going towards terminal 2
|
||||
{ 24, 37, 0, {DIR_N} }, // 05 Going towards terminal 2
|
||||
{ 53, 37, 0, {DIR_N} }, // 06 Going for takeoff
|
||||
{ 61, 40, AMED_EXACTPOS, {DIR_NE} }, // 07 Taxi to start of runway (takeoff)
|
||||
{ 3, 40, AMED_NOSPDCLAMP, {DIR_N} }, // 08 Accelerate to end of runway
|
||||
{ -79, 40, AMED_NOSPDCLAMP | AMED_TAKEOFF, {DIR_N} }, // 09 Take off
|
||||
{ 177, 40, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 10 Fly to landing position in air
|
||||
{ 56, 40, AMED_NOSPDCLAMP | AMED_LAND, {DIR_N} }, // 11 Going down for land
|
||||
{ 3, 40, AMED_NOSPDCLAMP | AMED_BRAKE, {DIR_N} }, // 12 Just landed, brake until end of runway
|
||||
{ 7, 40, 0, {DIR_N} }, // 13 Just landed, turn around and taxi 1 square
|
||||
{ 53, 40, 0, {DIR_N} }, // 14 Taxi from runway to crossing
|
||||
{ -31, 193, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 15 Fly around waiting for a landing spot (north-east)
|
||||
{ 1, 1, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 16 Fly around waiting for a landing spot (north-west)
|
||||
{ 257, 1, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 17 Fly around waiting for a landing spot (south-west)
|
||||
{ 273, 49, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 18 Fly around waiting for a landing spot (south)
|
||||
{ 44, 37, AMED_HELI_RAISE, {DIR_N} }, // 19 Helicopter takeoff
|
||||
{ 44, 40, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 20 In position above landing spot helicopter
|
||||
{ 44, 40, AMED_HELI_LOWER, {DIR_N} }, // 21 Helicopter landing
|
||||
};
|
||||
|
||||
// Commuter Airfield (small) 5x4
|
||||
static const AirportMovingData _airport_moving_data_commuter[37] = {
|
||||
{ 69, 3, AMED_EXACTPOS, 3 }, // 00 In Hangar
|
||||
{ 72, 22, 0, 0 }, // 01 Taxi to right outside depot
|
||||
{ 8, 22, AMED_EXACTPOS, 5 }, // 01 Taxi to right outside depot
|
||||
{ 24, 36, AMED_EXACTPOS, 3 }, // 03 Terminal 1
|
||||
{ 40, 36, AMED_EXACTPOS, 3 }, // 04 Terminal 2
|
||||
{ 56, 36, AMED_EXACTPOS, 3 }, // 05 Terminal 3
|
||||
{ 40, 8, AMED_EXACTPOS, 1 }, // 06 Helipad 1
|
||||
{ 56, 8, AMED_EXACTPOS, 1 }, // 07 Helipad 2
|
||||
{ 24, 22, 0, 5 }, // 08 Taxiing
|
||||
{ 40, 22, 0, 5 }, // 09 Taxiing
|
||||
{ 56, 22, 0, 5 }, // 10 Taxiing
|
||||
{ 72, 40, 0, 3 }, // 11 Airport OUTWAY
|
||||
{ 72, 54, AMED_EXACTPOS, 1 }, // 12 Accelerate to end of runway
|
||||
{ 7, 54, AMED_NOSPDCLAMP, 0 }, // 13 Release control of runway, for smoother movement
|
||||
{ 5, 54, AMED_NOSPDCLAMP, 0 }, // 14 End of runway
|
||||
{ -79, 54, AMED_NOSPDCLAMP | AMED_TAKEOFF, 0 }, // 15 Take off
|
||||
{ 145, 54, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 16 Fly to landing position in air
|
||||
{ 73, 54, AMED_NOSPDCLAMP | AMED_LAND, 0 }, // 17 Going down for land
|
||||
{ 3, 54, AMED_NOSPDCLAMP | AMED_BRAKE, 0 }, // 18 Just landed, brake until end of runway
|
||||
{ 12, 54, 0, 7 }, // 19 Just landed, turn around and taxi
|
||||
{ 8, 32, 0, 7 }, // 20 Taxi from runway to crossing
|
||||
{ -31, 149, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 21 Fly around waiting for a landing spot (north-east)
|
||||
{ 1, 6, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 22 Fly around waiting for a landing spot (north-west)
|
||||
{ 193, 6, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 23 Fly around waiting for a landing spot (south-west)
|
||||
{ 225, 81, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 24 Fly around waiting for a landing spot (south)
|
||||
{ 69, 3, AMED_EXACTPOS, {DIR_SE} }, // 00 In Hangar
|
||||
{ 72, 22, 0, {DIR_N} }, // 01 Taxi to right outside depot
|
||||
{ 8, 22, AMED_EXACTPOS, {DIR_SW} }, // 01 Taxi to right outside depot
|
||||
{ 24, 36, AMED_EXACTPOS, {DIR_SE} }, // 03 Terminal 1
|
||||
{ 40, 36, AMED_EXACTPOS, {DIR_SE} }, // 04 Terminal 2
|
||||
{ 56, 36, AMED_EXACTPOS, {DIR_SE} }, // 05 Terminal 3
|
||||
{ 40, 8, AMED_EXACTPOS, {DIR_NE} }, // 06 Helipad 1
|
||||
{ 56, 8, AMED_EXACTPOS, {DIR_NE} }, // 07 Helipad 2
|
||||
{ 24, 22, 0, {DIR_SW} }, // 08 Taxiing
|
||||
{ 40, 22, 0, {DIR_SW} }, // 09 Taxiing
|
||||
{ 56, 22, 0, {DIR_SW} }, // 10 Taxiing
|
||||
{ 72, 40, 0, {DIR_SE} }, // 11 Airport OUTWAY
|
||||
{ 72, 54, AMED_EXACTPOS, {DIR_NE} }, // 12 Accelerate to end of runway
|
||||
{ 7, 54, AMED_NOSPDCLAMP, {DIR_N} }, // 13 Release control of runway, for smoother movement
|
||||
{ 5, 54, AMED_NOSPDCLAMP, {DIR_N} }, // 14 End of runway
|
||||
{ -79, 54, AMED_NOSPDCLAMP | AMED_TAKEOFF, {DIR_N} }, // 15 Take off
|
||||
{ 145, 54, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 16 Fly to landing position in air
|
||||
{ 73, 54, AMED_NOSPDCLAMP | AMED_LAND, {DIR_N} }, // 17 Going down for land
|
||||
{ 3, 54, AMED_NOSPDCLAMP | AMED_BRAKE, {DIR_N} }, // 18 Just landed, brake until end of runway
|
||||
{ 12, 54, 0, {DIR_NW} }, // 19 Just landed, turn around and taxi
|
||||
{ 8, 32, 0, {DIR_NW} }, // 20 Taxi from runway to crossing
|
||||
{ -31, 149, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 21 Fly around waiting for a landing spot (north-east)
|
||||
{ 1, 6, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 22 Fly around waiting for a landing spot (north-west)
|
||||
{ 193, 6, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 23 Fly around waiting for a landing spot (south-west)
|
||||
{ 225, 81, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 24 Fly around waiting for a landing spot (south)
|
||||
// Helicopter
|
||||
{ 80, 0, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 25 Bufferspace before helipad
|
||||
{ 80, 0, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 26 Bufferspace before helipad
|
||||
{ 32, 8, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 27 Get in position for Helipad1
|
||||
{ 48, 8, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 28 Get in position for Helipad2
|
||||
{ 32, 8, AMED_HELI_LOWER, 0 }, // 29 Land at Helipad1
|
||||
{ 48, 8, AMED_HELI_LOWER, 0 }, // 30 Land at Helipad2
|
||||
{ 32, 8, AMED_HELI_RAISE, 0 }, // 31 Takeoff Helipad1
|
||||
{ 48, 8, AMED_HELI_RAISE, 0 }, // 32 Takeoff Helipad2
|
||||
{ 64, 22, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 33 Go to position for Hangarentrance in air
|
||||
{ 64, 22, AMED_HELI_LOWER, 0 }, // 34 Land in front of hangar
|
||||
{ 40, 8, AMED_EXACTPOS, 0 }, // pre-helitakeoff helipad 1
|
||||
{ 56, 8, AMED_EXACTPOS, 0 }, // pre-helitakeoff helipad 2
|
||||
{ 80, 0, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 25 Bufferspace before helipad
|
||||
{ 80, 0, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 26 Bufferspace before helipad
|
||||
{ 32, 8, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 27 Get in position for Helipad1
|
||||
{ 48, 8, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 28 Get in position for Helipad2
|
||||
{ 32, 8, AMED_HELI_LOWER, {DIR_N} }, // 29 Land at Helipad1
|
||||
{ 48, 8, AMED_HELI_LOWER, {DIR_N} }, // 30 Land at Helipad2
|
||||
{ 32, 8, AMED_HELI_RAISE, {DIR_N} }, // 31 Takeoff Helipad1
|
||||
{ 48, 8, AMED_HELI_RAISE, {DIR_N} }, // 32 Takeoff Helipad2
|
||||
{ 64, 22, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 33 Go to position for Hangarentrance in air
|
||||
{ 64, 22, AMED_HELI_LOWER, {DIR_N} }, // 34 Land in front of hangar
|
||||
{ 40, 8, AMED_EXACTPOS, {DIR_N} }, // pre-helitakeoff helipad 1
|
||||
{ 56, 8, AMED_EXACTPOS, {DIR_N} }, // pre-helitakeoff helipad 2
|
||||
};
|
||||
|
||||
// City Airport (large) 6x6
|
||||
static const AirportMovingData _airport_moving_data_town[25] = {
|
||||
{ 85, 3, AMED_EXACTPOS, 3 }, // 00 In Hangar
|
||||
{ 85, 27, 0, 0 }, // 01 Taxi to right outside depot
|
||||
{ 26, 41, AMED_EXACTPOS, 5 }, // 02 Terminal 1
|
||||
{ 56, 20, AMED_EXACTPOS, 3 }, // 03 Terminal 2
|
||||
{ 38, 8, AMED_EXACTPOS, 5 }, // 04 Terminal 3
|
||||
{ 65, 6, 0, 0 }, // 05 Taxi to right in infront of terminal 2/3
|
||||
{ 80, 27, 0, 0 }, // 06 Taxiway terminals 2-3
|
||||
{ 44, 63, 0, 0 }, // 07 Taxi to Airport center
|
||||
{ 58, 71, 0, 0 }, // 08 Towards takeoff
|
||||
{ 72, 85, 0, 0 }, // 09 Taxi to runway (takeoff)
|
||||
{ 89, 85, AMED_EXACTPOS, 1 }, // 10 Taxi to start of runway (takeoff)
|
||||
{ 3, 85, AMED_NOSPDCLAMP, 0 }, // 11 Accelerate to end of runway
|
||||
{ -79, 85, AMED_NOSPDCLAMP | AMED_TAKEOFF, 0 }, // 12 Take off
|
||||
{ 177, 85, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 13 Fly to landing position in air
|
||||
{ 89, 85, AMED_NOSPDCLAMP | AMED_LAND, 0 }, // 14 Going down for land
|
||||
{ 3, 85, AMED_NOSPDCLAMP | AMED_BRAKE, 0 }, // 15 Just landed, brake until end of runway
|
||||
{ 20, 87, 0, 0 }, // 16 Just landed, turn around and taxi 1 square
|
||||
{ 36, 71, 0, 0 }, // 17 Taxi from runway to crossing
|
||||
{ -31, 193, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 18 Fly around waiting for a landing spot (north-east)
|
||||
{ 1, 1, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 19 Fly around waiting for a landing spot (north-west)
|
||||
{ 257, 1, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 20 Fly around waiting for a landing spot (south-west)
|
||||
{ 273, 49, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 21 Fly around waiting for a landing spot (south)
|
||||
{ 44, 63, AMED_HELI_RAISE, 0 }, // 22 Helicopter takeoff
|
||||
{ 28, 74, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 23 In position above landing spot helicopter
|
||||
{ 28, 74, AMED_HELI_LOWER, 0 }, // 24 Helicopter landing
|
||||
{ 85, 3, AMED_EXACTPOS, {DIR_SE} }, // 00 In Hangar
|
||||
{ 85, 27, 0, {DIR_N} }, // 01 Taxi to right outside depot
|
||||
{ 26, 41, AMED_EXACTPOS, {DIR_SW} }, // 02 Terminal 1
|
||||
{ 56, 20, AMED_EXACTPOS, {DIR_SE} }, // 03 Terminal 2
|
||||
{ 38, 8, AMED_EXACTPOS, {DIR_SW} }, // 04 Terminal 3
|
||||
{ 65, 6, 0, {DIR_N} }, // 05 Taxi to right in infront of terminal 2/3
|
||||
{ 80, 27, 0, {DIR_N} }, // 06 Taxiway terminals 2-3
|
||||
{ 44, 63, 0, {DIR_N} }, // 07 Taxi to Airport center
|
||||
{ 58, 71, 0, {DIR_N} }, // 08 Towards takeoff
|
||||
{ 72, 85, 0, {DIR_N} }, // 09 Taxi to runway (takeoff)
|
||||
{ 89, 85, AMED_EXACTPOS, {DIR_NE} }, // 10 Taxi to start of runway (takeoff)
|
||||
{ 3, 85, AMED_NOSPDCLAMP, {DIR_N} }, // 11 Accelerate to end of runway
|
||||
{ -79, 85, AMED_NOSPDCLAMP | AMED_TAKEOFF, {DIR_N} }, // 12 Take off
|
||||
{ 177, 85, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 13 Fly to landing position in air
|
||||
{ 89, 85, AMED_NOSPDCLAMP | AMED_LAND, {DIR_N} }, // 14 Going down for land
|
||||
{ 3, 85, AMED_NOSPDCLAMP | AMED_BRAKE, {DIR_N} }, // 15 Just landed, brake until end of runway
|
||||
{ 20, 87, 0, {DIR_N} }, // 16 Just landed, turn around and taxi 1 square
|
||||
{ 36, 71, 0, {DIR_N} }, // 17 Taxi from runway to crossing
|
||||
{ -31, 193, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 18 Fly around waiting for a landing spot (north-east)
|
||||
{ 1, 1, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 19 Fly around waiting for a landing spot (north-west)
|
||||
{ 257, 1, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 20 Fly around waiting for a landing spot (south-west)
|
||||
{ 273, 49, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 21 Fly around waiting for a landing spot (south)
|
||||
{ 44, 63, AMED_HELI_RAISE, {DIR_N} }, // 22 Helicopter takeoff
|
||||
{ 28, 74, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 23 In position above landing spot helicopter
|
||||
{ 28, 74, AMED_HELI_LOWER, {DIR_N} }, // 24 Helicopter landing
|
||||
};
|
||||
|
||||
// Metropolitan Airport (metropolitan) - 2 runways
|
||||
static const AirportMovingData _airport_moving_data_metropolitan[27] = {
|
||||
{ 85, 3, AMED_EXACTPOS, 3 }, // 00 In Hangar
|
||||
{ 85, 27, 0, 0 }, // 01 Taxi to right outside depot
|
||||
{ 26, 41, AMED_EXACTPOS, 5 }, // 02 Terminal 1
|
||||
{ 56, 20, AMED_EXACTPOS, 3 }, // 03 Terminal 2
|
||||
{ 38, 8, AMED_EXACTPOS, 5 }, // 04 Terminal 3
|
||||
{ 65, 6, 0, 0 }, // 05 Taxi to right in infront of terminal 2/3
|
||||
{ 70, 33, 0, 0 }, // 06 Taxiway terminals 2-3
|
||||
{ 44, 58, 0, 0 }, // 07 Taxi to Airport center
|
||||
{ 72, 58, 0, 0 }, // 08 Towards takeoff
|
||||
{ 72, 69, 0, 0 }, // 09 Taxi to runway (takeoff)
|
||||
{ 89, 69, AMED_EXACTPOS, 1 }, // 10 Taxi to start of runway (takeoff)
|
||||
{ 3, 69, AMED_NOSPDCLAMP, 0 }, // 11 Accelerate to end of runway
|
||||
{ -79, 69, AMED_NOSPDCLAMP | AMED_TAKEOFF, 0 }, // 12 Take off
|
||||
{ 177, 85, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 13 Fly to landing position in air
|
||||
{ 89, 85, AMED_NOSPDCLAMP | AMED_LAND, 0 }, // 14 Going down for land
|
||||
{ 3, 85, AMED_NOSPDCLAMP | AMED_BRAKE, 0 }, // 15 Just landed, brake until end of runway
|
||||
{ 21, 85, 0, 0 }, // 16 Just landed, turn around and taxi 1 square
|
||||
{ 21, 69, 0, 0 }, // 17 On Runway-out taxiing to In-Way
|
||||
{ 21, 54, AMED_EXACTPOS, 5 }, // 18 Taxi from runway to crossing
|
||||
{ -31, 193, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 19 Fly around waiting for a landing spot (north-east)
|
||||
{ 1, 1, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 20 Fly around waiting for a landing spot (north-west)
|
||||
{ 257, 1, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 21 Fly around waiting for a landing spot (south-west)
|
||||
{ 273, 49, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 22 Fly around waiting for a landing spot (south)
|
||||
{ 44, 58, 0, 0 }, // 23 Helicopter takeoff spot on ground (to clear airport sooner)
|
||||
{ 44, 63, AMED_HELI_RAISE, 0 }, // 24 Helicopter takeoff
|
||||
{ 15, 54, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 25 Get in position above landing spot helicopter
|
||||
{ 15, 54, AMED_HELI_LOWER, 0 }, // 26 Helicopter landing
|
||||
{ 85, 3, AMED_EXACTPOS, {DIR_SE} }, // 00 In Hangar
|
||||
{ 85, 27, 0, {DIR_N} }, // 01 Taxi to right outside depot
|
||||
{ 26, 41, AMED_EXACTPOS, {DIR_SW} }, // 02 Terminal 1
|
||||
{ 56, 20, AMED_EXACTPOS, {DIR_SE} }, // 03 Terminal 2
|
||||
{ 38, 8, AMED_EXACTPOS, {DIR_SW} }, // 04 Terminal 3
|
||||
{ 65, 6, 0, {DIR_N} }, // 05 Taxi to right in infront of terminal 2/3
|
||||
{ 70, 33, 0, {DIR_N} }, // 06 Taxiway terminals 2-3
|
||||
{ 44, 58, 0, {DIR_N} }, // 07 Taxi to Airport center
|
||||
{ 72, 58, 0, {DIR_N} }, // 08 Towards takeoff
|
||||
{ 72, 69, 0, {DIR_N} }, // 09 Taxi to runway (takeoff)
|
||||
{ 89, 69, AMED_EXACTPOS, {DIR_NE} }, // 10 Taxi to start of runway (takeoff)
|
||||
{ 3, 69, AMED_NOSPDCLAMP, {DIR_N} }, // 11 Accelerate to end of runway
|
||||
{ -79, 69, AMED_NOSPDCLAMP | AMED_TAKEOFF, {DIR_N} }, // 12 Take off
|
||||
{ 177, 85, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 13 Fly to landing position in air
|
||||
{ 89, 85, AMED_NOSPDCLAMP | AMED_LAND, {DIR_N} }, // 14 Going down for land
|
||||
{ 3, 85, AMED_NOSPDCLAMP | AMED_BRAKE, {DIR_N} }, // 15 Just landed, brake until end of runway
|
||||
{ 21, 85, 0, {DIR_N} }, // 16 Just landed, turn around and taxi 1 square
|
||||
{ 21, 69, 0, {DIR_N} }, // 17 On Runway-out taxiing to In-Way
|
||||
{ 21, 54, AMED_EXACTPOS, {DIR_SW} }, // 18 Taxi from runway to crossing
|
||||
{ -31, 193, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 19 Fly around waiting for a landing spot (north-east)
|
||||
{ 1, 1, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 20 Fly around waiting for a landing spot (north-west)
|
||||
{ 257, 1, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 21 Fly around waiting for a landing spot (south-west)
|
||||
{ 273, 49, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 22 Fly around waiting for a landing spot (south)
|
||||
{ 44, 58, 0, {DIR_N} }, // 23 Helicopter takeoff spot on ground (to clear airport sooner)
|
||||
{ 44, 63, AMED_HELI_RAISE, {DIR_N} }, // 24 Helicopter takeoff
|
||||
{ 15, 54, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 25 Get in position above landing spot helicopter
|
||||
{ 15, 54, AMED_HELI_LOWER, {DIR_N} }, // 26 Helicopter landing
|
||||
};
|
||||
|
||||
// International Airport (international) - 2 runways, 6 terminals, dedicated helipod
|
||||
static const AirportMovingData _airport_moving_data_international[51] = {
|
||||
{ 7, 55, AMED_EXACTPOS, 3 }, // 00 In Hangar 1
|
||||
{ 100, 21, AMED_EXACTPOS, 3 }, // 01 In Hangar 2
|
||||
{ 7, 70, 0, 0 }, // 02 Taxi to right outside depot
|
||||
{ 100, 36, 0, 0 }, // 03 Taxi to right outside depot
|
||||
{ 38, 70, AMED_EXACTPOS, 5 }, // 04 Terminal 1
|
||||
{ 38, 54, AMED_EXACTPOS, 5 }, // 05 Terminal 2
|
||||
{ 38, 38, AMED_EXACTPOS, 5 }, // 06 Terminal 3
|
||||
{ 70, 70, AMED_EXACTPOS, 1 }, // 07 Terminal 4
|
||||
{ 70, 54, AMED_EXACTPOS, 1 }, // 08 Terminal 5
|
||||
{ 70, 38, AMED_EXACTPOS, 1 }, // 09 Terminal 6
|
||||
{ 104, 71, AMED_EXACTPOS, 1 }, // 10 Helipad 1
|
||||
{ 104, 55, AMED_EXACTPOS, 1 }, // 11 Helipad 2
|
||||
{ 22, 87, 0, 0 }, // 12 Towards Terminals 4/5/6, Helipad 1/2
|
||||
{ 60, 87, 0, 0 }, // 13 Towards Terminals 4/5/6, Helipad 1/2
|
||||
{ 66, 87, 0, 0 }, // 14 Towards Terminals 4/5/6, Helipad 1/2
|
||||
{ 86, 87, AMED_EXACTPOS, 7 }, // 15 Towards Terminals 4/5/6, Helipad 1/2
|
||||
{ 86, 70, 0, 0 }, // 16 In Front of Terminal 4 / Helipad 1
|
||||
{ 86, 54, 0, 0 }, // 17 In Front of Terminal 5 / Helipad 2
|
||||
{ 86, 38, 0, 0 }, // 18 In Front of Terminal 6
|
||||
{ 86, 22, 0, 0 }, // 19 Towards Terminals Takeoff (Taxiway)
|
||||
{ 66, 22, 0, 0 }, // 20 Towards Terminals Takeoff (Taxiway)
|
||||
{ 60, 22, 0, 0 }, // 21 Towards Terminals Takeoff (Taxiway)
|
||||
{ 38, 22, 0, 0 }, // 22 Towards Terminals Takeoff (Taxiway)
|
||||
{ 22, 70, 0, 0 }, // 23 In Front of Terminal 1
|
||||
{ 22, 58, 0, 0 }, // 24 In Front of Terminal 2
|
||||
{ 22, 38, 0, 0 }, // 25 In Front of Terminal 3
|
||||
{ 22, 22, AMED_EXACTPOS, 7 }, // 26 Going for Takeoff
|
||||
{ 22, 6, 0, 0 }, // 27 On Runway-out, prepare for takeoff
|
||||
{ 3, 6, AMED_EXACTPOS, 5 }, // 28 Accelerate to end of runway
|
||||
{ 60, 6, AMED_NOSPDCLAMP, 0 }, // 29 Release control of runway, for smoother movement
|
||||
{ 105, 6, AMED_NOSPDCLAMP, 0 }, // 30 End of runway
|
||||
{ 190, 6, AMED_NOSPDCLAMP | AMED_TAKEOFF, 0 }, // 31 Take off
|
||||
{ 193, 104, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 32 Fly to landing position in air
|
||||
{ 105, 104, AMED_NOSPDCLAMP | AMED_LAND, 0 }, // 33 Going down for land
|
||||
{ 3, 104, AMED_NOSPDCLAMP | AMED_BRAKE, 0 }, // 34 Just landed, brake until end of runway
|
||||
{ 12, 104, 0, 0 }, // 35 Just landed, turn around and taxi 1 square
|
||||
{ 7, 84, 0, 0 }, // 36 Taxi from runway to crossing
|
||||
{ -31, 209, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 37 Fly around waiting for a landing spot (north-east)
|
||||
{ 1, 6, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 38 Fly around waiting for a landing spot (north-west)
|
||||
{ 273, 6, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 39 Fly around waiting for a landing spot (south-west)
|
||||
{ 305, 81, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 40 Fly around waiting for a landing spot (south)
|
||||
{ 7, 55, AMED_EXACTPOS, {DIR_SE} }, // 00 In Hangar 1
|
||||
{ 100, 21, AMED_EXACTPOS, {DIR_SE} }, // 01 In Hangar 2
|
||||
{ 7, 70, 0, {DIR_N} }, // 02 Taxi to right outside depot
|
||||
{ 100, 36, 0, {DIR_N} }, // 03 Taxi to right outside depot
|
||||
{ 38, 70, AMED_EXACTPOS, {DIR_SW} }, // 04 Terminal 1
|
||||
{ 38, 54, AMED_EXACTPOS, {DIR_SW} }, // 05 Terminal 2
|
||||
{ 38, 38, AMED_EXACTPOS, {DIR_SW} }, // 06 Terminal 3
|
||||
{ 70, 70, AMED_EXACTPOS, {DIR_NE} }, // 07 Terminal 4
|
||||
{ 70, 54, AMED_EXACTPOS, {DIR_NE} }, // 08 Terminal 5
|
||||
{ 70, 38, AMED_EXACTPOS, {DIR_NE} }, // 09 Terminal 6
|
||||
{ 104, 71, AMED_EXACTPOS, {DIR_NE} }, // 10 Helipad 1
|
||||
{ 104, 55, AMED_EXACTPOS, {DIR_NE} }, // 11 Helipad 2
|
||||
{ 22, 87, 0, {DIR_N} }, // 12 Towards Terminals 4/5/6, Helipad 1/2
|
||||
{ 60, 87, 0, {DIR_N} }, // 13 Towards Terminals 4/5/6, Helipad 1/2
|
||||
{ 66, 87, 0, {DIR_N} }, // 14 Towards Terminals 4/5/6, Helipad 1/2
|
||||
{ 86, 87, AMED_EXACTPOS, {DIR_NW} }, // 15 Towards Terminals 4/5/6, Helipad 1/2
|
||||
{ 86, 70, 0, {DIR_N} }, // 16 In Front of Terminal 4 / Helipad 1
|
||||
{ 86, 54, 0, {DIR_N} }, // 17 In Front of Terminal 5 / Helipad 2
|
||||
{ 86, 38, 0, {DIR_N} }, // 18 In Front of Terminal 6
|
||||
{ 86, 22, 0, {DIR_N} }, // 19 Towards Terminals Takeoff (Taxiway)
|
||||
{ 66, 22, 0, {DIR_N} }, // 20 Towards Terminals Takeoff (Taxiway)
|
||||
{ 60, 22, 0, {DIR_N} }, // 21 Towards Terminals Takeoff (Taxiway)
|
||||
{ 38, 22, 0, {DIR_N} }, // 22 Towards Terminals Takeoff (Taxiway)
|
||||
{ 22, 70, 0, {DIR_N} }, // 23 In Front of Terminal 1
|
||||
{ 22, 58, 0, {DIR_N} }, // 24 In Front of Terminal 2
|
||||
{ 22, 38, 0, {DIR_N} }, // 25 In Front of Terminal 3
|
||||
{ 22, 22, AMED_EXACTPOS, {DIR_NW} }, // 26 Going for Takeoff
|
||||
{ 22, 6, 0, {DIR_N} }, // 27 On Runway-out, prepare for takeoff
|
||||
{ 3, 6, AMED_EXACTPOS, {DIR_SW} }, // 28 Accelerate to end of runway
|
||||
{ 60, 6, AMED_NOSPDCLAMP, {DIR_N} }, // 29 Release control of runway, for smoother movement
|
||||
{ 105, 6, AMED_NOSPDCLAMP, {DIR_N} }, // 30 End of runway
|
||||
{ 190, 6, AMED_NOSPDCLAMP | AMED_TAKEOFF, {DIR_N} }, // 31 Take off
|
||||
{ 193, 104, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 32 Fly to landing position in air
|
||||
{ 105, 104, AMED_NOSPDCLAMP | AMED_LAND, {DIR_N} }, // 33 Going down for land
|
||||
{ 3, 104, AMED_NOSPDCLAMP | AMED_BRAKE, {DIR_N} }, // 34 Just landed, brake until end of runway
|
||||
{ 12, 104, 0, {DIR_N} }, // 35 Just landed, turn around and taxi 1 square
|
||||
{ 7, 84, 0, {DIR_N} }, // 36 Taxi from runway to crossing
|
||||
{ -31, 209, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 37 Fly around waiting for a landing spot (north-east)
|
||||
{ 1, 6, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 38 Fly around waiting for a landing spot (north-west)
|
||||
{ 273, 6, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 39 Fly around waiting for a landing spot (south-west)
|
||||
{ 305, 81, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 40 Fly around waiting for a landing spot (south)
|
||||
// Helicopter
|
||||
{ 128, 80, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 41 Bufferspace before helipad
|
||||
{ 128, 80, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 42 Bufferspace before helipad
|
||||
{ 96, 71, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 43 Get in position for Helipad1
|
||||
{ 96, 55, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 44 Get in position for Helipad2
|
||||
{ 96, 71, AMED_HELI_LOWER, 0 }, // 45 Land at Helipad1
|
||||
{ 96, 55, AMED_HELI_LOWER, 0 }, // 46 Land at Helipad2
|
||||
{ 104, 71, AMED_HELI_RAISE, 0 }, // 47 Takeoff Helipad1
|
||||
{ 104, 55, AMED_HELI_RAISE, 0 }, // 48 Takeoff Helipad2
|
||||
{ 104, 32, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 49 Go to position for Hangarentrance in air
|
||||
{ 104, 32, AMED_HELI_LOWER, 0} // 50 Land in HANGAR2_AREA to go to hangar
|
||||
{ 128, 80, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 41 Bufferspace before helipad
|
||||
{ 128, 80, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 42 Bufferspace before helipad
|
||||
{ 96, 71, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 43 Get in position for Helipad1
|
||||
{ 96, 55, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 44 Get in position for Helipad2
|
||||
{ 96, 71, AMED_HELI_LOWER, {DIR_N} }, // 45 Land at Helipad1
|
||||
{ 96, 55, AMED_HELI_LOWER, {DIR_N} }, // 46 Land at Helipad2
|
||||
{ 104, 71, AMED_HELI_RAISE, {DIR_N} }, // 47 Takeoff Helipad1
|
||||
{ 104, 55, AMED_HELI_RAISE, {DIR_N} }, // 48 Takeoff Helipad2
|
||||
{ 104, 32, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 49 Go to position for Hangarentrance in air
|
||||
{ 104, 32, AMED_HELI_LOWER, {DIR_N} }, // 50 Land in HANGAR2_AREA to go to hangar
|
||||
};
|
||||
|
||||
// Intercontinental Airport - 4 runways, 8 terminals, 2 dedicated helipads
|
||||
static const AirportMovingData _airport_moving_data_intercontinental[77] = {
|
||||
{ 7, 87, AMED_EXACTPOS, 3 }, // 00 In Hangar 1
|
||||
{ 135, 72, AMED_EXACTPOS, 3 }, // 01 In Hangar 2
|
||||
{ 7, 104, 0, 0 }, // 02 Taxi to right outside depot 1
|
||||
{ 135, 88, 0, 0 }, // 03 Taxi to right outside depot 2
|
||||
{ 56, 120, AMED_EXACTPOS, 6 }, // 04 Terminal 1
|
||||
{ 56, 104, AMED_EXACTPOS, 5 }, // 05 Terminal 2
|
||||
{ 56, 88, AMED_EXACTPOS, 5 }, // 06 Terminal 3
|
||||
{ 56, 72, AMED_EXACTPOS, 5 }, // 07 Terminal 4
|
||||
{ 88, 120, AMED_EXACTPOS, 0 }, // 08 Terminal 5
|
||||
{ 88, 104, AMED_EXACTPOS, 1 }, // 09 Terminal 6
|
||||
{ 88, 88, AMED_EXACTPOS, 1 }, // 10 Terminal 7
|
||||
{ 88, 72, AMED_EXACTPOS, 1 }, // 11 Terminal 8
|
||||
{ 88, 56, AMED_EXACTPOS, 3 }, // 12 Helipad 1
|
||||
{ 72, 56, AMED_EXACTPOS, 1 }, // 13 Helipad 2
|
||||
{ 40, 136, 0, 0 }, // 14 Term group 2 enter 1 a
|
||||
{ 56, 136, 0, 0 }, // 15 Term group 2 enter 1 b
|
||||
{ 88, 136, 0, 0 }, // 16 Term group 2 enter 2 a
|
||||
{ 104, 136, 0, 0 }, // 17 Term group 2 enter 2 b
|
||||
{ 104, 120, 0, 0 }, // 18 Term group 2 - opp term 5
|
||||
{ 104, 104, 0, 0 }, // 19 Term group 2 - opp term 6 & exit2
|
||||
{ 104, 88, 0, 0 }, // 20 Term group 2 - opp term 7 & hangar area 2
|
||||
{ 104, 72, 0, 0 }, // 21 Term group 2 - opp term 8
|
||||
{ 104, 56, 0, 0 }, // 22 Taxi Term group 2 exit a
|
||||
{ 104, 40, 0, 0 }, // 23 Taxi Term group 2 exit b
|
||||
{ 56, 40, 0, 0 }, // 24 Term group 2 exit 2a
|
||||
{ 40, 40, 0, 0 }, // 25 Term group 2 exit 2b
|
||||
{ 40, 120, 0, 0 }, // 26 Term group 1 - opp term 1
|
||||
{ 40, 104, 0, 0 }, // 27 Term group 1 - opp term 2 & hangar area 1
|
||||
{ 40, 88, 0, 0 }, // 28 Term group 1 - opp term 3
|
||||
{ 40, 72, 0, 0 }, // 29 Term group 1 - opp term 4
|
||||
{ 18, 72, 0, 7 }, // 30 Outway 1
|
||||
{ 8, 40, 0, 7 }, // 31 Airport OUTWAY
|
||||
{ 8, 24, AMED_EXACTPOS, 5 }, // 32 Accelerate to end of runway
|
||||
{ 119, 24, AMED_NOSPDCLAMP, 0 }, // 33 Release control of runway, for smoother movement
|
||||
{ 117, 24, AMED_NOSPDCLAMP, 0 }, // 34 End of runway
|
||||
{ 197, 24, AMED_NOSPDCLAMP | AMED_TAKEOFF, 0 }, // 35 Take off
|
||||
{ 254, 84, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 36 Flying to landing position in air
|
||||
{ 117, 168, AMED_NOSPDCLAMP | AMED_LAND, 0 }, // 37 Going down for land
|
||||
{ 3, 168, AMED_NOSPDCLAMP | AMED_BRAKE, 0 }, // 38 Just landed, brake until end of runway
|
||||
{ 8, 168, 0, 0 }, // 39 Just landed, turn around and taxi
|
||||
{ 8, 144, 0, 7 }, // 40 Taxi from runway
|
||||
{ 8, 128, 0, 7 }, // 41 Taxi from runway
|
||||
{ 8, 120, AMED_EXACTPOS, 5 }, // 42 Airport entrance
|
||||
{ 56, 344, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 43 Fly around waiting for a landing spot (north-east)
|
||||
{ -200, 88, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 44 Fly around waiting for a landing spot (north-west)
|
||||
{ 56, -168, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 45 Fly around waiting for a landing spot (south-west)
|
||||
{ 312, 88, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 46 Fly around waiting for a landing spot (south)
|
||||
{ 7, 87, AMED_EXACTPOS, {DIR_SE} }, // 00 In Hangar 1
|
||||
{ 135, 72, AMED_EXACTPOS, {DIR_SE} }, // 01 In Hangar 2
|
||||
{ 7, 104, 0, {DIR_N} }, // 02 Taxi to right outside depot 1
|
||||
{ 135, 88, 0, {DIR_N} }, // 03 Taxi to right outside depot 2
|
||||
{ 56, 120, AMED_EXACTPOS, {DIR_W} }, // 04 Terminal 1
|
||||
{ 56, 104, AMED_EXACTPOS, {DIR_SW} }, // 05 Terminal 2
|
||||
{ 56, 88, AMED_EXACTPOS, {DIR_SW} }, // 06 Terminal 3
|
||||
{ 56, 72, AMED_EXACTPOS, {DIR_SW} }, // 07 Terminal 4
|
||||
{ 88, 120, AMED_EXACTPOS, {DIR_N} }, // 08 Terminal 5
|
||||
{ 88, 104, AMED_EXACTPOS, {DIR_NE} }, // 09 Terminal 6
|
||||
{ 88, 88, AMED_EXACTPOS, {DIR_NE} }, // 10 Terminal 7
|
||||
{ 88, 72, AMED_EXACTPOS, {DIR_NE} }, // 11 Terminal 8
|
||||
{ 88, 56, AMED_EXACTPOS, {DIR_SE} }, // 12 Helipad 1
|
||||
{ 72, 56, AMED_EXACTPOS, {DIR_NE} }, // 13 Helipad 2
|
||||
{ 40, 136, 0, {DIR_N} }, // 14 Term group 2 enter 1 a
|
||||
{ 56, 136, 0, {DIR_N} }, // 15 Term group 2 enter 1 b
|
||||
{ 88, 136, 0, {DIR_N} }, // 16 Term group 2 enter 2 a
|
||||
{ 104, 136, 0, {DIR_N} }, // 17 Term group 2 enter 2 b
|
||||
{ 104, 120, 0, {DIR_N} }, // 18 Term group 2 - opp term 5
|
||||
{ 104, 104, 0, {DIR_N} }, // 19 Term group 2 - opp term 6 & exit2
|
||||
{ 104, 88, 0, {DIR_N} }, // 20 Term group 2 - opp term 7 & hangar area 2
|
||||
{ 104, 72, 0, {DIR_N} }, // 21 Term group 2 - opp term 8
|
||||
{ 104, 56, 0, {DIR_N} }, // 22 Taxi Term group 2 exit a
|
||||
{ 104, 40, 0, {DIR_N} }, // 23 Taxi Term group 2 exit b
|
||||
{ 56, 40, 0, {DIR_N} }, // 24 Term group 2 exit 2a
|
||||
{ 40, 40, 0, {DIR_N} }, // 25 Term group 2 exit 2b
|
||||
{ 40, 120, 0, {DIR_N} }, // 26 Term group 1 - opp term 1
|
||||
{ 40, 104, 0, {DIR_N} }, // 27 Term group 1 - opp term 2 & hangar area 1
|
||||
{ 40, 88, 0, {DIR_N} }, // 28 Term group 1 - opp term 3
|
||||
{ 40, 72, 0, {DIR_N} }, // 29 Term group 1 - opp term 4
|
||||
{ 18, 72, 0, {DIR_NW} }, // 30 Outway 1
|
||||
{ 8, 40, 0, {DIR_NW} }, // 31 Airport OUTWAY
|
||||
{ 8, 24, AMED_EXACTPOS, {DIR_SW} }, // 32 Accelerate to end of runway
|
||||
{ 119, 24, AMED_NOSPDCLAMP, {DIR_N} }, // 33 Release control of runway, for smoother movement
|
||||
{ 117, 24, AMED_NOSPDCLAMP, {DIR_N} }, // 34 End of runway
|
||||
{ 197, 24, AMED_NOSPDCLAMP | AMED_TAKEOFF, {DIR_N} }, // 35 Take off
|
||||
{ 254, 84, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 36 Flying to landing position in air
|
||||
{ 117, 168, AMED_NOSPDCLAMP | AMED_LAND, {DIR_N} }, // 37 Going down for land
|
||||
{ 3, 168, AMED_NOSPDCLAMP | AMED_BRAKE, {DIR_N} }, // 38 Just landed, brake until end of runway
|
||||
{ 8, 168, 0, {DIR_N} }, // 39 Just landed, turn around and taxi
|
||||
{ 8, 144, 0, {DIR_NW} }, // 40 Taxi from runway
|
||||
{ 8, 128, 0, {DIR_NW} }, // 41 Taxi from runway
|
||||
{ 8, 120, AMED_EXACTPOS, {DIR_SW} }, // 42 Airport entrance
|
||||
{ 56, 344, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 43 Fly around waiting for a landing spot (north-east)
|
||||
{ -200, 88, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 44 Fly around waiting for a landing spot (north-west)
|
||||
{ 56, -168, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 45 Fly around waiting for a landing spot (south-west)
|
||||
{ 312, 88, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 46 Fly around waiting for a landing spot (south)
|
||||
// Helicopter
|
||||
{ 96, 40, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 47 Bufferspace before helipad
|
||||
{ 96, 40, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 48 Bufferspace before helipad
|
||||
{ 82, 54, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 49 Get in position for Helipad1
|
||||
{ 64, 56, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 50 Get in position for Helipad2
|
||||
{ 81, 55, AMED_HELI_LOWER, 0 }, // 51 Land at Helipad1
|
||||
{ 64, 56, AMED_HELI_LOWER, 0 }, // 52 Land at Helipad2
|
||||
{ 80, 56, AMED_HELI_RAISE, 0 }, // 53 Takeoff Helipad1
|
||||
{ 64, 56, AMED_HELI_RAISE, 0 }, // 54 Takeoff Helipad2
|
||||
{ 136, 96, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 55 Go to position for Hangarentrance in air
|
||||
{ 136, 96, AMED_HELI_LOWER, 0 }, // 56 Land in front of hangar2
|
||||
{ 126, 104, 0, 3 }, // 57 Outway 2
|
||||
{ 136, 136, 0, 1 }, // 58 Airport OUTWAY 2
|
||||
{ 136, 152, AMED_EXACTPOS, 5 }, // 59 Accelerate to end of runway2
|
||||
{ 16, 152, AMED_NOSPDCLAMP, 0 }, // 60 Release control of runway2, for smoother movement
|
||||
{ 20, 152, AMED_NOSPDCLAMP, 0 }, // 61 End of runway2
|
||||
{ -56, 152, AMED_NOSPDCLAMP | AMED_TAKEOFF, 0 }, // 62 Take off2
|
||||
{ 24, 8, AMED_NOSPDCLAMP | AMED_LAND, 0 }, // 63 Going down for land2
|
||||
{ 136, 8, AMED_NOSPDCLAMP | AMED_BRAKE, 0 }, // 64 Just landed, brake until end of runway2in
|
||||
{ 136, 8, 0, 0 }, // 65 Just landed, turn around and taxi
|
||||
{ 136, 24, 0, 3 }, // 66 Taxi from runway 2in
|
||||
{ 136, 40, 0, 3 }, // 67 Taxi from runway 2in
|
||||
{ 136, 56, AMED_EXACTPOS, 1 }, // 68 Airport entrance2
|
||||
{ -56, 8, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 69 Fly to landing position in air2
|
||||
{ 88, 40, 0, 0 }, // 70 Taxi Term group 2 exit - opp heli1
|
||||
{ 72, 40, 0, 0 }, // 71 Taxi Term group 2 exit - opp heli2
|
||||
{ 88, 57, AMED_EXACTPOS, 3 }, // 72 pre-helitakeoff helipad 1
|
||||
{ 71, 56, AMED_EXACTPOS, 1 }, // 73 pre-helitakeoff helipad 2
|
||||
{ 8, 120, AMED_HELI_RAISE, 0 }, // 74 Helitakeoff outside depot 1
|
||||
{ 136, 104, AMED_HELI_RAISE, 0 }, // 75 Helitakeoff outside depot 2
|
||||
{ 197, 168, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0} // 76 Fly to landing position in air1
|
||||
{ 96, 40, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 47 Bufferspace before helipad
|
||||
{ 96, 40, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 48 Bufferspace before helipad
|
||||
{ 82, 54, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 49 Get in position for Helipad1
|
||||
{ 64, 56, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 50 Get in position for Helipad2
|
||||
{ 81, 55, AMED_HELI_LOWER, {DIR_N} }, // 51 Land at Helipad1
|
||||
{ 64, 56, AMED_HELI_LOWER, {DIR_N} }, // 52 Land at Helipad2
|
||||
{ 80, 56, AMED_HELI_RAISE, {DIR_N} }, // 53 Takeoff Helipad1
|
||||
{ 64, 56, AMED_HELI_RAISE, {DIR_N} }, // 54 Takeoff Helipad2
|
||||
{ 136, 96, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 55 Go to position for Hangarentrance in air
|
||||
{ 136, 96, AMED_HELI_LOWER, {DIR_N} }, // 56 Land in front of hangar2
|
||||
{ 126, 104, 0, {DIR_SE} }, // 57 Outway 2
|
||||
{ 136, 136, 0, {DIR_NE} }, // 58 Airport OUTWAY 2
|
||||
{ 136, 152, AMED_EXACTPOS, {DIR_SW} }, // 59 Accelerate to end of runway2
|
||||
{ 16, 152, AMED_NOSPDCLAMP, {DIR_N} }, // 60 Release control of runway2, for smoother movement
|
||||
{ 20, 152, AMED_NOSPDCLAMP, {DIR_N} }, // 61 End of runway2
|
||||
{ -56, 152, AMED_NOSPDCLAMP | AMED_TAKEOFF, {DIR_N} }, // 62 Take off2
|
||||
{ 24, 8, AMED_NOSPDCLAMP | AMED_LAND, {DIR_N} }, // 63 Going down for land2
|
||||
{ 136, 8, AMED_NOSPDCLAMP | AMED_BRAKE, {DIR_N} }, // 64 Just landed, brake until end of runway2in
|
||||
{ 136, 8, 0, {DIR_N} }, // 65 Just landed, turn around and taxi
|
||||
{ 136, 24, 0, {DIR_SE} }, // 66 Taxi from runway 2in
|
||||
{ 136, 40, 0, {DIR_SE} }, // 67 Taxi from runway 2in
|
||||
{ 136, 56, AMED_EXACTPOS, {DIR_NE} }, // 68 Airport entrance2
|
||||
{ -56, 8, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 69 Fly to landing position in air2
|
||||
{ 88, 40, 0, {DIR_N} }, // 70 Taxi Term group 2 exit - opp heli1
|
||||
{ 72, 40, 0, {DIR_N} }, // 71 Taxi Term group 2 exit - opp heli2
|
||||
{ 88, 57, AMED_EXACTPOS, {DIR_SE} }, // 72 pre-helitakeoff helipad 1
|
||||
{ 71, 56, AMED_EXACTPOS, {DIR_NE} }, // 73 pre-helitakeoff helipad 2
|
||||
{ 8, 120, AMED_HELI_RAISE, {DIR_N} }, // 74 Helitakeoff outside depot 1
|
||||
{ 136, 104, AMED_HELI_RAISE, {DIR_N} }, // 75 Helitakeoff outside depot 2
|
||||
{ 197, 168, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 76 Fly to landing position in air1
|
||||
};
|
||||
|
||||
|
||||
// Heliport (heliport)
|
||||
static const AirportMovingData _airport_moving_data_heliport[9] = {
|
||||
{ 5, 9, AMED_EXACTPOS, 1 }, // 0 - At heliport terminal
|
||||
{ 2, 9, AMED_HELI_RAISE, 0 }, // 1 - Take off (play sound)
|
||||
{ -3, 9, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 2 - In position above landing spot helicopter
|
||||
{ -3, 9, AMED_HELI_LOWER, 0 }, // 3 - Land
|
||||
{ 2, 9, 0, 0 }, // 4 - Goto terminal on ground
|
||||
{ -31, 59, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 5 - Circle #1 (north-east)
|
||||
{ -31, -49, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 6 - Circle #2 (north-west)
|
||||
{ 49, -49, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 7 - Circle #3 (south-west)
|
||||
{ 70, 9, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 8 - Circle #4 (south)
|
||||
{ 5, 9, AMED_EXACTPOS, {DIR_NE} }, // 0 - At heliport terminal
|
||||
{ 2, 9, AMED_HELI_RAISE, {DIR_N} }, // 1 - Take off (play sound)
|
||||
{ -3, 9, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 2 - In position above landing spot helicopter
|
||||
{ -3, 9, AMED_HELI_LOWER, {DIR_N} }, // 3 - Land
|
||||
{ 2, 9, 0, {DIR_N} }, // 4 - Goto terminal on ground
|
||||
{ -31, 59, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 5 - Circle #1 (north-east)
|
||||
{ -31, -49, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 6 - Circle #2 (north-west)
|
||||
{ 49, -49, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 7 - Circle #3 (south-west)
|
||||
{ 70, 9, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 8 - Circle #4 (south)
|
||||
};
|
||||
|
||||
// HeliDepot 2x2 (heliport)
|
||||
static const AirportMovingData _airport_moving_data_helidepot[18] = {
|
||||
{ 24, 4, AMED_EXACTPOS, 1 }, // 0 - At depot
|
||||
{ 24, 28, 0, 0 }, // 1 Taxi to right outside depot
|
||||
{ 5, 38, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 2 Flying
|
||||
{ -15, -15, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 3 - Circle #1 (north-east)
|
||||
{ -15, -49, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 4 - Circle #2 (north-west)
|
||||
{ 49, -49, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 5 - Circle #3 (south-west)
|
||||
{ 49, -15, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 6 - Circle #4 (south-east)
|
||||
{ 8, 32, AMED_NOSPDCLAMP | AMED_SLOWTURN, 7 }, // 7 - PreHelipad
|
||||
{ 8, 32, AMED_NOSPDCLAMP | AMED_SLOWTURN, 7 }, // 8 - Helipad
|
||||
{ 8, 16, AMED_NOSPDCLAMP | AMED_SLOWTURN, 7 }, // 9 - Land
|
||||
{ 8, 16, AMED_HELI_LOWER, 7 }, // 10 - Land
|
||||
{ 8, 24, AMED_HELI_RAISE, 0 }, // 11 - Take off (play sound)
|
||||
{ 32, 24, AMED_NOSPDCLAMP | AMED_SLOWTURN, 7 }, // 12 Air to above hangar area
|
||||
{ 32, 24, AMED_HELI_LOWER, 7 }, // 13 Taxi to right outside depot
|
||||
{ 8, 24, AMED_EXACTPOS, 7 }, // 14 - on helipad1
|
||||
{ 24, 28, AMED_HELI_RAISE, 0 }, // 15 Takeoff right outside depot
|
||||
{ 8, 24, AMED_HELI_RAISE, 5 }, // 16 - Take off (play sound)
|
||||
{ 8, 24, AMED_SLOWTURN | AMED_EXACTPOS, 2 }, // 17 - turn on helipad1 for takeoff
|
||||
{ 24, 4, AMED_EXACTPOS, {DIR_NE} }, // 0 - At depot
|
||||
{ 24, 28, 0, {DIR_N} }, // 1 Taxi to right outside depot
|
||||
{ 5, 38, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 2 Flying
|
||||
{ -15, -15, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 3 - Circle #1 (north-east)
|
||||
{ -15, -49, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 4 - Circle #2 (north-west)
|
||||
{ 49, -49, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 5 - Circle #3 (south-west)
|
||||
{ 49, -15, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 6 - Circle #4 (south-east)
|
||||
{ 8, 32, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_NW} }, // 7 - PreHelipad
|
||||
{ 8, 32, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_NW} }, // 8 - Helipad
|
||||
{ 8, 16, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_NW} }, // 9 - Land
|
||||
{ 8, 16, AMED_HELI_LOWER, {DIR_NW} }, // 10 - Land
|
||||
{ 8, 24, AMED_HELI_RAISE, {DIR_N} }, // 11 - Take off (play sound)
|
||||
{ 32, 24, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_NW} }, // 12 Air to above hangar area
|
||||
{ 32, 24, AMED_HELI_LOWER, {DIR_NW} }, // 13 Taxi to right outside depot
|
||||
{ 8, 24, AMED_EXACTPOS, {DIR_NW} }, // 14 - on helipad1
|
||||
{ 24, 28, AMED_HELI_RAISE, {DIR_N} }, // 15 Takeoff right outside depot
|
||||
{ 8, 24, AMED_HELI_RAISE, {DIR_SW} }, // 16 - Take off (play sound)
|
||||
{ 8, 24, AMED_SLOWTURN | AMED_EXACTPOS, {DIR_E} }, // 17 - turn on helipad1 for takeoff
|
||||
};
|
||||
|
||||
// HeliDepot 2x2 (heliport)
|
||||
static const AirportMovingData _airport_moving_data_helistation[33] = {
|
||||
{ 8, 3, AMED_EXACTPOS, 3 }, // 00 In Hangar2
|
||||
{ 8, 22, 0, 0 }, // 01 outside hangar 2
|
||||
{ 116, 24, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 02 Fly to landing position in air
|
||||
{ 14, 22, AMED_HELI_RAISE, 0 }, // 03 Helitakeoff outside hangar1(play sound)
|
||||
{ 24, 22, 0, 0 }, // 04 taxiing
|
||||
{ 40, 22, 0, 0 }, // 05 taxiing
|
||||
{ 40, 8, AMED_EXACTPOS, 1 }, // 06 Helipad 1
|
||||
{ 56, 8, AMED_EXACTPOS, 1 }, // 07 Helipad 2
|
||||
{ 56, 24, AMED_EXACTPOS, 1 }, // 08 Helipad 3
|
||||
{ 40, 8, AMED_EXACTPOS, 0 }, // 09 pre-helitakeoff helipad 1
|
||||
{ 56, 8, AMED_EXACTPOS, 0 }, // 10 pre-helitakeoff helipad 2
|
||||
{ 56, 24, AMED_EXACTPOS, 0 }, // 11 pre-helitakeoff helipad 3
|
||||
{ 32, 8, AMED_HELI_RAISE, 0 }, // 12 Takeoff Helipad1
|
||||
{ 48, 8, AMED_HELI_RAISE, 0 }, // 13 Takeoff Helipad2
|
||||
{ 48, 24, AMED_HELI_RAISE, 0 }, // 14 Takeoff Helipad3
|
||||
{ 84, 24, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 15 Bufferspace before helipad
|
||||
{ 68, 24, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 16 Bufferspace before helipad
|
||||
{ 32, 8, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 17 Get in position for Helipad1
|
||||
{ 48, 8, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 18 Get in position for Helipad2
|
||||
{ 48, 24, AMED_NOSPDCLAMP | AMED_SLOWTURN, 1 }, // 19 Get in position for Helipad3
|
||||
{ 40, 8, AMED_HELI_LOWER, 0 }, // 20 Land at Helipad1
|
||||
{ 48, 8, AMED_HELI_LOWER, 0 }, // 21 Land at Helipad2
|
||||
{ 48, 24, AMED_HELI_LOWER, 0 }, // 22 Land at Helipad3
|
||||
{ 0, 22, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 23 Go to position for Hangarentrance in air
|
||||
{ 0, 22, AMED_HELI_LOWER, 0 }, // 24 Land in front of hangar
|
||||
{ 148, -8, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 25 Fly around waiting for a landing spot (south-east)
|
||||
{ 148, 8, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 26 Fly around waiting for a landing spot (south-west)
|
||||
{ 132, 24, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 27 Fly around waiting for a landing spot (south-west)
|
||||
{ 100, 24, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 28 Fly around waiting for a landing spot (north-east)
|
||||
{ 84, 8, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 29 Fly around waiting for a landing spot (south-east)
|
||||
{ 84, -8, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 30 Fly around waiting for a landing spot (south-west)
|
||||
{ 100, -24, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 31 Fly around waiting for a landing spot (north-west)
|
||||
{ 132, -24, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 32 Fly around waiting for a landing spot (north-east)
|
||||
{ 8, 3, AMED_EXACTPOS, {DIR_SE} }, // 00 In Hangar2
|
||||
{ 8, 22, 0, {DIR_N} }, // 01 outside hangar 2
|
||||
{ 116, 24, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 02 Fly to landing position in air
|
||||
{ 14, 22, AMED_HELI_RAISE, {DIR_N} }, // 03 Helitakeoff outside hangar1(play sound)
|
||||
{ 24, 22, 0, {DIR_N} }, // 04 taxiing
|
||||
{ 40, 22, 0, {DIR_N} }, // 05 taxiing
|
||||
{ 40, 8, AMED_EXACTPOS, {DIR_NE} }, // 06 Helipad 1
|
||||
{ 56, 8, AMED_EXACTPOS, {DIR_NE} }, // 07 Helipad 2
|
||||
{ 56, 24, AMED_EXACTPOS, {DIR_NE} }, // 08 Helipad 3
|
||||
{ 40, 8, AMED_EXACTPOS, {DIR_N} }, // 09 pre-helitakeoff helipad 1
|
||||
{ 56, 8, AMED_EXACTPOS, {DIR_N} }, // 10 pre-helitakeoff helipad 2
|
||||
{ 56, 24, AMED_EXACTPOS, {DIR_N} }, // 11 pre-helitakeoff helipad 3
|
||||
{ 32, 8, AMED_HELI_RAISE, {DIR_N} }, // 12 Takeoff Helipad1
|
||||
{ 48, 8, AMED_HELI_RAISE, {DIR_N} }, // 13 Takeoff Helipad2
|
||||
{ 48, 24, AMED_HELI_RAISE, {DIR_N} }, // 14 Takeoff Helipad3
|
||||
{ 84, 24, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 15 Bufferspace before helipad
|
||||
{ 68, 24, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 16 Bufferspace before helipad
|
||||
{ 32, 8, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 17 Get in position for Helipad1
|
||||
{ 48, 8, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 18 Get in position for Helipad2
|
||||
{ 48, 24, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_NE} }, // 19 Get in position for Helipad3
|
||||
{ 40, 8, AMED_HELI_LOWER, {DIR_N} }, // 20 Land at Helipad1
|
||||
{ 48, 8, AMED_HELI_LOWER, {DIR_N} }, // 21 Land at Helipad2
|
||||
{ 48, 24, AMED_HELI_LOWER, {DIR_N} }, // 22 Land at Helipad3
|
||||
{ 0, 22, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 23 Go to position for Hangarentrance in air
|
||||
{ 0, 22, AMED_HELI_LOWER, {DIR_N} }, // 24 Land in front of hangar
|
||||
{ 148, -8, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 25 Fly around waiting for a landing spot (south-east)
|
||||
{ 148, 8, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 26 Fly around waiting for a landing spot (south-west)
|
||||
{ 132, 24, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 27 Fly around waiting for a landing spot (south-west)
|
||||
{ 100, 24, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 28 Fly around waiting for a landing spot (north-east)
|
||||
{ 84, 8, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 29 Fly around waiting for a landing spot (south-east)
|
||||
{ 84, -8, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 30 Fly around waiting for a landing spot (south-west)
|
||||
{ 100, -24, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 31 Fly around waiting for a landing spot (north-west)
|
||||
{ 132, -24, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 32 Fly around waiting for a landing spot (north-east)
|
||||
};
|
||||
|
||||
// Oilrig
|
||||
static const AirportMovingData _airport_moving_data_oilrig[9] = {
|
||||
{ 31, 9, AMED_EXACTPOS, 1 }, // 0 - At oilrig terminal
|
||||
{ 28, 9, AMED_HELI_RAISE, 0 }, // 1 - Take off (play sound)
|
||||
{ 23, 9, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 2 - In position above landing spot helicopter
|
||||
{ 23, 9, AMED_HELI_LOWER, 0 }, // 3 - Land
|
||||
{ 28, 9, 0, 0 }, // 4 - Goto terminal on ground
|
||||
{ -31, 69, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 5 - circle #1 (north-east)
|
||||
{ -31, -49, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 6 - circle #2 (north-west)
|
||||
{ 69, -49, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 7 - circle #3 (south-west)
|
||||
{ 70, 9, AMED_NOSPDCLAMP | AMED_SLOWTURN, 0 }, // 8 - circle #4 (south)
|
||||
{ 31, 9, AMED_EXACTPOS, {DIR_NE} }, // 0 - At oilrig terminal
|
||||
{ 28, 9, AMED_HELI_RAISE, {DIR_N} }, // 1 - Take off (play sound)
|
||||
{ 23, 9, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 2 - In position above landing spot helicopter
|
||||
{ 23, 9, AMED_HELI_LOWER, {DIR_N} }, // 3 - Land
|
||||
{ 28, 9, 0, {DIR_N} }, // 4 - Goto terminal on ground
|
||||
{ -31, 69, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 5 - circle #1 (north-east)
|
||||
{ -31, -49, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 6 - circle #2 (north-west)
|
||||
{ 69, -49, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 7 - circle #3 (south-west)
|
||||
{ 70, 9, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 8 - circle #4 (south)
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include "stdafx.h"
|
||||
#include "openttd.h"
|
||||
#include "aystar.h"
|
||||
#include "helpers.hpp"
|
||||
|
||||
int _aystar_stats_open_size;
|
||||
int _aystar_stats_closed_size;
|
||||
|
@ -35,7 +36,8 @@ static PathNode* AyStarMain_ClosedList_IsInList(AyStar *aystar, const AyStarNode
|
|||
static void AyStarMain_ClosedList_Add(AyStar *aystar, const PathNode *node)
|
||||
{
|
||||
// Add a node to the ClosedList
|
||||
PathNode *new_node = malloc(sizeof(*new_node));
|
||||
PathNode *new_node;
|
||||
MallocT(&new_node, 1);
|
||||
*new_node = *node;
|
||||
Hash_Set(&aystar->ClosedListHash, node->node.tile, node->node.direction, new_node);
|
||||
}
|
||||
|
@ -66,7 +68,8 @@ static OpenListNode *AyStarMain_OpenList_Pop(AyStar *aystar)
|
|||
static void AyStarMain_OpenList_Add(AyStar *aystar, PathNode *parent, const AyStarNode *node, int f, int g)
|
||||
{
|
||||
// Add a new Node to the OpenList
|
||||
OpenListNode *new_node = malloc(sizeof(*new_node));
|
||||
OpenListNode *new_node;
|
||||
MallocT(&new_node, 1);
|
||||
new_node->g = g;
|
||||
new_node->path.parent = parent;
|
||||
new_node->path.node = *node;
|
||||
|
|
|
@ -30,7 +30,7 @@ enum{
|
|||
typedef struct AyStarNode AyStarNode;
|
||||
struct AyStarNode {
|
||||
TileIndex tile;
|
||||
uint direction;
|
||||
int direction;
|
||||
uint user_data[2];
|
||||
};
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "gfx.h"
|
||||
#include "bmp.h"
|
||||
#include "macros.h"
|
||||
#include "helpers.hpp"
|
||||
|
||||
void BmpInitializeBuffer(BmpBuffer *buffer, FILE *file) {
|
||||
buffer->pos = -1;
|
||||
|
@ -328,7 +329,7 @@ bool BmpReadHeader(BmpBuffer *buffer, BmpInfo *info, BmpData *data)
|
|||
}
|
||||
if (info->palette_size == 0) info->palette_size = 1 << info->bpp;
|
||||
|
||||
data->palette = calloc(info->palette_size, sizeof(*(data->palette)));
|
||||
CallocT(&data->palette, info->palette_size);
|
||||
if (data->palette == NULL) return false;
|
||||
|
||||
for (i = 0; i < info->palette_size; i++) {
|
||||
|
@ -350,7 +351,7 @@ bool BmpReadBitmap(BmpBuffer *buffer, BmpInfo *info, BmpData *data)
|
|||
{
|
||||
assert(info != NULL && data != NULL);
|
||||
|
||||
data->bitmap = calloc(info->width * info->height, ((info->bpp == 24) ? 3 : 1) * sizeof(byte));
|
||||
data->bitmap = (byte*)calloc(info->width * info->height, ((info->bpp == 24) ? 3 : 1) * sizeof(byte));
|
||||
if (data->bitmap == NULL) return false;
|
||||
|
||||
/* Load image */
|
||||
|
|
|
@ -40,7 +40,7 @@ TileIndex GetOtherBridgeEnd(TileIndex tile)
|
|||
uint GetBridgeHeight(TileIndex t)
|
||||
{
|
||||
uint h;
|
||||
uint tileh = GetTileSlope(t, &h);
|
||||
Slope tileh = GetTileSlope(t, &h);
|
||||
uint f = GetBridgeFoundation(tileh, DiagDirToAxis(GetBridgeRampDirection(t)));
|
||||
|
||||
// one height level extra if the ramp is on a flat foundation
|
||||
|
|
|
@ -302,6 +302,8 @@ static void GenerateBuildAircraftList(Window *w)
|
|||
break;
|
||||
|
||||
case ALL: break;
|
||||
default:
|
||||
NOT_REACHED();
|
||||
}
|
||||
EngList_Add(&bv->eng_list, eid);
|
||||
|
||||
|
@ -479,7 +481,7 @@ void ShowBuildVehicleWindow(TileIndex tile, byte type)
|
|||
|
||||
switch (type) {
|
||||
case VEH_Aircraft: {
|
||||
byte acc_planes = (tile == 0) ? ALL : GetAirport(GetStationByTile(tile)->airport_type)->acc_planes;
|
||||
AcceptPlanes acc_planes = (tile == 0) ? ALL : GetAirport(GetStationByTile(tile)->airport_type)->acc_planes;
|
||||
bv->filter.acc_planes = acc_planes;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -548,7 +548,7 @@ static void DrawTile_Clear(TileInfo *ti)
|
|||
static uint GetSlopeZ_Clear(TileIndex tile, uint x, uint y)
|
||||
{
|
||||
uint z;
|
||||
uint tileh = GetTileSlope(tile, &z);
|
||||
Slope tileh = GetTileSlope(tile, &z);
|
||||
|
||||
return z + GetPartialZ(x & 0xF, y & 0xF, tileh);
|
||||
}
|
||||
|
@ -786,7 +786,7 @@ void InitializeClearLand(void)
|
|||
_opt.snow_line = _patches.snow_line_height * TILE_HEIGHT;
|
||||
}
|
||||
|
||||
const TileTypeProcs _tile_type_clear_procs = {
|
||||
extern const TileTypeProcs _tile_type_clear_procs = {
|
||||
DrawTile_Clear, /* draw_tile_proc */
|
||||
GetSlopeZ_Clear, /* get_slope_z_proc */
|
||||
ClearTile_Clear, /* clear_tile_proc */
|
||||
|
|
|
@ -23,7 +23,7 @@ typedef enum ClearGround {
|
|||
static inline ClearGround GetClearGround(TileIndex t)
|
||||
{
|
||||
assert(IsTileType(t, MP_CLEAR));
|
||||
return GB(_m[t].m5, 2, 3);
|
||||
return (ClearGround)GB(_m[t].m5, 2, 3);
|
||||
}
|
||||
|
||||
static inline bool IsClearGround(TileIndex t, ClearGround ct)
|
||||
|
|
|
@ -504,7 +504,7 @@ bool DoCommandP(TileIndex tile, uint32 p1, uint32 p2, CommandCallback *callback,
|
|||
*/
|
||||
if (_networking && !(cmd & CMD_NETWORK_COMMAND)) {
|
||||
PlayerID pbck = _local_player;
|
||||
if (_network_dedicated || (_network_server && pbck == PLAYER_SPECTATOR)) _local_player = 0;
|
||||
if (_network_dedicated || (_network_server && pbck == PLAYER_SPECTATOR)) _local_player = PLAYER_FIRST;
|
||||
NetworkSend_Command(tile, p1, p2, cmd, callback);
|
||||
if (_network_dedicated || (_network_server && pbck == PLAYER_SPECTATOR)) _local_player = pbck;
|
||||
_docommand_recursive = 0;
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include "console.h"
|
||||
#include "helpers.hpp"
|
||||
#include "network/network.h"
|
||||
#include "network/network_data.h"
|
||||
#include "network/network_server.h"
|
||||
|
@ -223,7 +224,7 @@ void IConsoleInit(void)
|
|||
memset(_iconsole_history, 0, sizeof(_iconsole_history));
|
||||
memset(_iconsole_buffer, 0, sizeof(_iconsole_buffer));
|
||||
memset(_iconsole_cbuffer, 0, sizeof(_iconsole_cbuffer));
|
||||
_iconsole_cmdline.buf = calloc(ICON_CMDLN_SIZE, sizeof(*_iconsole_cmdline.buf)); // create buffer and zero it
|
||||
CallocT(&_iconsole_cmdline.buf, ICON_CMDLN_SIZE); // create buffer and zero it
|
||||
_iconsole_cmdline.maxlength = ICON_CMDLN_SIZE;
|
||||
|
||||
IConsolePrintF(13, "OpenTTD Game Console Revision 7 - %s", _openttd_revision);
|
||||
|
@ -612,7 +613,8 @@ void IConsoleVarHookAdd(const char *name, IConsoleHookTypes type, IConsoleHook *
|
|||
void IConsoleCmdRegister(const char *name, IConsoleCmdProc *proc)
|
||||
{
|
||||
char *new_cmd = strdup(name);
|
||||
IConsoleCmd *item_new = malloc(sizeof(IConsoleCmd));
|
||||
IConsoleCmd *item_new;
|
||||
MallocT(&item_new, 1);
|
||||
|
||||
item_new->next = NULL;
|
||||
item_new->proc = proc;
|
||||
|
@ -649,7 +651,8 @@ void IConsoleAliasRegister(const char *name, const char *cmd)
|
|||
{
|
||||
char *new_alias = strdup(name);
|
||||
char *cmd_aliased = strdup(cmd);
|
||||
IConsoleAlias *item_new = malloc(sizeof(IConsoleAlias));
|
||||
IConsoleAlias *item_new;
|
||||
MallocT(&item_new, 1);
|
||||
|
||||
item_new->next = NULL;
|
||||
item_new->cmdline = cmd_aliased;
|
||||
|
@ -784,7 +787,8 @@ void IConsoleVarStringRegister(const char *name, void *addr, uint32 size, const
|
|||
void IConsoleVarRegister(const char *name, void *addr, IConsoleVarTypes type, const char *help)
|
||||
{
|
||||
char *new_cmd = strdup(name);
|
||||
IConsoleVar *item_new = malloc(sizeof(IConsoleVar));
|
||||
IConsoleVar *item_new;
|
||||
MallocT(&item_new, 1);
|
||||
|
||||
item_new->help = (help != NULL) ? strdup(help) : NULL;
|
||||
|
||||
|
@ -861,7 +865,7 @@ static void IConsoleVarSetStringvalue(const IConsoleVar *var, const char *value)
|
|||
if (var->type != ICONSOLE_VAR_STRING || var->addr == NULL) return;
|
||||
|
||||
IConsoleHookHandle(&var->hook, ICONSOLE_HOOK_PRE_ACTION);
|
||||
ttd_strlcpy(var->addr, value, var->size);
|
||||
ttd_strlcpy((char*)var->addr, value, var->size);
|
||||
IConsoleHookHandle(&var->hook, ICONSOLE_HOOK_POST_ACTION);
|
||||
IConsoleVarPrintSetValue(var); // print out the new value, giving feedback
|
||||
return;
|
||||
|
|
|
@ -562,7 +562,7 @@ DEF_CONSOLE_CMD(ConStatus)
|
|||
const NetworkClientInfo *ci = DEREF_CLIENT_INFO(cs);
|
||||
const char* status;
|
||||
|
||||
status = (cs->status < lengthof(stat_str) ? stat_str[cs->status] : "unknown");
|
||||
status = (cs->status < (ptrdiff_t)lengthof(stat_str) ? stat_str[cs->status] : "unknown");
|
||||
IConsolePrintF(8, "Client #%1d name: '%s' status: '%s' frame-lag: %3d company: %1d IP: %s unique-id: '%s'",
|
||||
cs->index, ci->client_name, status, lag,
|
||||
ci->client_playas + (IsValidPlayer(ci->client_playas) ? 1 : 0),
|
||||
|
@ -684,7 +684,7 @@ DEF_CONSOLE_CMD(ConResetCompany)
|
|||
|
||||
if (argc != 2) return false;
|
||||
|
||||
index = atoi(argv[1]) - 1;
|
||||
index = (PlayerID)(atoi(argv[1]) - 1);
|
||||
|
||||
/* Check valid range */
|
||||
if (!IsValidPlayer(index)) {
|
||||
|
@ -770,7 +770,7 @@ DEF_CONSOLE_CMD(ConNetworkConnect)
|
|||
|
||||
IConsolePrintF(_icolour_def, "Connecting to %s...", ip);
|
||||
if (player != NULL) {
|
||||
_network_playas = atoi(player);
|
||||
_network_playas = (PlayerID)atoi(player);
|
||||
IConsolePrintF(_icolour_def, " player-no: %d", _network_playas);
|
||||
|
||||
/* From a user pov 0 is a new player, internally it's different and all
|
||||
|
|
|
@ -3,6 +3,10 @@
|
|||
#ifndef DEBUG_H
|
||||
#define DEBUG_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
/* Debugging messages policy:
|
||||
* These should be the severities used for direct DEBUG() calls
|
||||
* maximum debugging level should be 10 if really deep, deep
|
||||
|
@ -105,4 +109,8 @@ const char *GetDebugString(void);
|
|||
}\
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif //__cplusplus
|
||||
|
||||
#endif /* DEBUG_H */
|
||||
|
|
|
@ -122,6 +122,6 @@ static void Load_DEPT(void)
|
|||
}
|
||||
}
|
||||
|
||||
const ChunkHandler _depot_chunk_handlers[] = {
|
||||
extern const ChunkHandler _depot_chunk_handlers[] = {
|
||||
{ 'DEPT', Save_DEPT, Load_DEPT, CH_ARRAY | CH_LAST},
|
||||
};
|
||||
|
|
|
@ -3,8 +3,11 @@
|
|||
#ifndef DIRECTION_H
|
||||
#define DIRECTION_H
|
||||
|
||||
#include "helpers.hpp"
|
||||
|
||||
/* Direction as commonly used in v->direction, 8 way. */
|
||||
typedef enum Direction {
|
||||
DIR_BEGIN = 0,
|
||||
DIR_N = 0,
|
||||
DIR_NE = 1, /* Northeast, upper right on your monitor */
|
||||
DIR_E = 2,
|
||||
|
@ -17,6 +20,10 @@ typedef enum Direction {
|
|||
INVALID_DIR = 0xFF,
|
||||
} Direction;
|
||||
|
||||
/** Define basic enum properties */
|
||||
template <> struct EnumPropsT<Direction> : MakeEnumPropsT<Direction, byte, DIR_BEGIN, DIR_END, INVALID_DIR> {};
|
||||
typedef TinyEnumT<Direction> DirectionByte;
|
||||
|
||||
static inline Direction ReverseDir(Direction d)
|
||||
{
|
||||
return (Direction)(4 ^ d);
|
||||
|
@ -51,6 +58,7 @@ static inline Direction ChangeDir(Direction d, DirDiff delta)
|
|||
|
||||
/* Direction commonly used as the direction of entering and leaving tiles, 4-way */
|
||||
typedef enum DiagDirection {
|
||||
DIAGDIR_BEGIN = 0,
|
||||
DIAGDIR_NE = 0, /* Northeast, upper right on your monitor */
|
||||
DIAGDIR_SE = 1,
|
||||
DIAGDIR_SW = 2,
|
||||
|
@ -59,6 +67,12 @@ typedef enum DiagDirection {
|
|||
INVALID_DIAGDIR = 0xFF,
|
||||
} DiagDirection;
|
||||
|
||||
DECLARE_POSTFIX_INCREMENT(DiagDirection);
|
||||
|
||||
/** Define basic enum properties */
|
||||
template <> struct EnumPropsT<DiagDirection> : MakeEnumPropsT<DiagDirection, byte, DIAGDIR_BEGIN, DIAGDIR_END, INVALID_DIAGDIR> {};
|
||||
typedef TinyEnumT<DiagDirection> DiagDirectionByte;
|
||||
|
||||
static inline DiagDirection ReverseDiagDir(DiagDirection d)
|
||||
{
|
||||
return (DiagDirection)(2 ^ d);
|
||||
|
|
|
@ -276,7 +276,7 @@ static void DisasterTick_UFO(Vehicle *v)
|
|||
// fly around randomly
|
||||
int x = TileX(v->dest_tile) * TILE_SIZE;
|
||||
int y = TileY(v->dest_tile) * TILE_SIZE;
|
||||
if (abs(x - v->x_pos) + abs(y - v->y_pos) >= TILE_SIZE) {
|
||||
if (delta(x, v->x_pos) + delta(y, v->y_pos) >= TILE_SIZE) {
|
||||
v->direction = GetDirectionTowards(v, x, y);
|
||||
GetNewVehiclePos(v, &gp);
|
||||
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
|
||||
|
@ -305,7 +305,7 @@ static void DisasterTick_UFO(Vehicle *v)
|
|||
return;
|
||||
}
|
||||
|
||||
dist = abs(v->x_pos - u->x_pos) + abs(v->y_pos - u->y_pos);
|
||||
dist = delta(v->x_pos, u->x_pos) + delta(v->y_pos, u->y_pos);
|
||||
|
||||
if (dist < TILE_SIZE && !(u->vehstatus&VS_HIDDEN) && u->breakdown_ctr==0) {
|
||||
u->breakdown_ctr = 3;
|
||||
|
@ -526,7 +526,7 @@ static void DisasterTick_4(Vehicle *v)
|
|||
if (v->current_order.dest == 1) {
|
||||
int x = TileX(v->dest_tile) * TILE_SIZE + TILE_SIZE / 2;
|
||||
int y = TileY(v->dest_tile) * TILE_SIZE + TILE_SIZE / 2;
|
||||
if (abs(v->x_pos - x) + abs(v->y_pos - y) >= 8) {
|
||||
if (delta(v->x_pos, x) + delta(v->y_pos, y) >= 8) {
|
||||
v->direction = GetDirectionTowards(v, x, y);
|
||||
|
||||
GetNewVehiclePos(v, &gp);
|
||||
|
@ -544,7 +544,7 @@ static void DisasterTick_4(Vehicle *v)
|
|||
|
||||
FOR_ALL_VEHICLES(u) {
|
||||
if (u->type == VEH_Train || u->type == VEH_Road) {
|
||||
if (abs(u->x_pos - v->x_pos) + abs(u->y_pos - v->y_pos) <= 12 * TILE_SIZE) {
|
||||
if (delta(u->x_pos, v->x_pos) + delta(u->y_pos, v->y_pos) <= 12 * TILE_SIZE) {
|
||||
u->breakdown_ctr = 5;
|
||||
u->breakdown_delay = 0xF0;
|
||||
}
|
||||
|
@ -578,7 +578,7 @@ static void DisasterTick_4(Vehicle *v)
|
|||
|
||||
int x = TileX(v->dest_tile) * TILE_SIZE;
|
||||
int y = TileY(v->dest_tile) * TILE_SIZE;
|
||||
if (abs(x - v->x_pos) + abs(y - v->y_pos) >= TILE_SIZE) {
|
||||
if (delta(x, v->x_pos) + delta(y, v->y_pos) >= TILE_SIZE) {
|
||||
v->direction = GetDirectionTowards(v, x, y);
|
||||
GetNewVehiclePos(v, &gp);
|
||||
SetDisasterVehiclePos(v, gp.x, gp.y, v->z_pos);
|
||||
|
@ -626,7 +626,7 @@ static void DisasterTick_4b(Vehicle *v)
|
|||
|
||||
if (v->current_order.dest == 0) {
|
||||
u = GetVehicle(v->u.disaster.unk2);
|
||||
if (abs(v->x_pos - u->x_pos) > TILE_SIZE)
|
||||
if (delta(v->x_pos, u->x_pos) > TILE_SIZE)
|
||||
return;
|
||||
v->current_order.dest = 1;
|
||||
|
||||
|
|
|
@ -254,7 +254,7 @@ static void BuildDockStationWndProc(Window *w, WindowEvent *e)
|
|||
case 3:
|
||||
case 4:
|
||||
RaiseWindowWidget(w, _station_show_coverage + 3);
|
||||
_station_show_coverage = e->we.click.widget - 3;
|
||||
_station_show_coverage = (e->we.click.widget != 3);
|
||||
LowerWindowWidget(w, _station_show_coverage + 3);
|
||||
SndPlayFx(SND_15_BEEP);
|
||||
SetWindowDirty(w);
|
||||
|
@ -328,7 +328,7 @@ static void BuildDocksDepotWndProc(Window *w, WindowEvent *e)
|
|||
case 3:
|
||||
case 4:
|
||||
RaiseWindowWidget(w, _ship_depot_direction + 3);
|
||||
_ship_depot_direction = e->we.click.widget - 3;
|
||||
_ship_depot_direction = (e->we.click.widget == 3 ? AXIS_X : AXIS_Y);
|
||||
LowerWindowWidget(w, _ship_depot_direction + 3);
|
||||
SndPlayFx(SND_15_BEEP);
|
||||
UpdateDocksDirection();
|
||||
|
|
|
@ -66,7 +66,7 @@ static uint32 GetTileTrackStatus_Dummy(TileIndex tile, TransportType mode)
|
|||
return 0;
|
||||
}
|
||||
|
||||
const TileTypeProcs _tile_type_dummy_procs = {
|
||||
extern const TileTypeProcs _tile_type_dummy_procs = {
|
||||
DrawTile_Dummy, /* draw_tile_proc */
|
||||
GetSlopeZ_Dummy, /* get_slope_z_proc */
|
||||
ClearTile_Dummy, /* clear_tile_proc */
|
||||
|
|
|
@ -47,7 +47,7 @@ const ScoreInfo _score_info[] = {
|
|||
{ SCORE_TOTAL, 0, 0 }
|
||||
};
|
||||
|
||||
int _score_part[MAX_PLAYERS][NUM_SCORE];
|
||||
int _score_part[MAX_PLAYERS][SCORE_END];
|
||||
|
||||
int64 CalculateCompanyValue(const Player* p)
|
||||
{
|
||||
|
@ -209,11 +209,10 @@ int UpdateCompanyRatingAndValue(Player *p, bool update)
|
|||
|
||||
// Now we calculate the score for each item..
|
||||
{
|
||||
int i;
|
||||
int total_score = 0;
|
||||
int s;
|
||||
score = 0;
|
||||
for (i = 0; i < NUM_SCORE; i++) {
|
||||
for (ScoreID i = SCORE_BEGIN; i < SCORE_END; i++) {
|
||||
// Skip the total
|
||||
if (i == SCORE_TOTAL) continue;
|
||||
// Check the score
|
||||
|
@ -467,7 +466,7 @@ void DrawNewsBankrupcy(Window *w)
|
|||
|
||||
DrawNewsBorder(w);
|
||||
|
||||
p = GetPlayer(GB(WP(w,news_d).ni->string_id, 0, 4));
|
||||
p = GetPlayer((PlayerID)GB(WP(w,news_d).ni->string_id, 0, 4));
|
||||
DrawPlayerFace(p->face, p->player_color, 2, 23);
|
||||
GfxFillRect(3, 23, 3+91, 23+118, 0x323 | USE_COLORTABLE);
|
||||
|
||||
|
@ -536,7 +535,7 @@ void DrawNewsBankrupcy(Window *w)
|
|||
|
||||
StringID GetNewsStringBankrupcy(const NewsItem *ni)
|
||||
{
|
||||
const Player *p = GetPlayer(GB(ni->string_id, 0, 4));
|
||||
const Player *p = GetPlayer((PlayerID)GB(ni->string_id, 0, 4));
|
||||
|
||||
switch (ni->string_id & 0xF0) {
|
||||
case NB_BTROUBLE:
|
||||
|
@ -1562,7 +1561,7 @@ void PlayersMonthlyLoop(void)
|
|||
static void DoAcquireCompany(Player *p)
|
||||
{
|
||||
Player *owner;
|
||||
int i,pi;
|
||||
int i;
|
||||
int64 value;
|
||||
|
||||
SetDParam(0, p->name_1);
|
||||
|
@ -1571,7 +1570,7 @@ static void DoAcquireCompany(Player *p)
|
|||
AddNewsItem( (StringID)(_current_player | NB_BMERGER), NEWS_FLAGS(NM_CALLBACK, 0, NT_COMPANY_INFO, DNC_BANKRUPCY),0,0);
|
||||
|
||||
// original code does this a little bit differently
|
||||
pi = p->index;
|
||||
PlayerID pi = p->index;
|
||||
ChangeOwnershipOfPlayerItems(pi, _current_player);
|
||||
|
||||
if (p->bankrupt_value == 0) {
|
||||
|
@ -1595,7 +1594,7 @@ static void DoAcquireCompany(Player *p)
|
|||
RebuildVehicleLists(); //Updates the open windows to add the newly acquired vehicles to the lists
|
||||
}
|
||||
|
||||
extern int GetAmountOwnedBy(Player *p, byte owner);
|
||||
extern int GetAmountOwnedBy(const Player *p, PlayerID owner);
|
||||
|
||||
/** Acquire shares in an opposing company.
|
||||
* @param tile unused
|
||||
|
@ -1611,7 +1610,7 @@ int32 CmdBuyShareInCompany(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||
if (!IsValidPlayer((PlayerID)p1) || !_patches.allow_shares) return CMD_ERROR;
|
||||
|
||||
SET_EXPENSES_TYPE(EXPENSES_OTHER);
|
||||
p = GetPlayer(p1);
|
||||
p = GetPlayer((PlayerID)p1);
|
||||
|
||||
/* Protect new companies from hostile takeovers */
|
||||
if (_cur_year - p->inaugurated_year < 6) return_cmd_error(STR_7080_PROTECTED);
|
||||
|
@ -1624,7 +1623,7 @@ int32 CmdBuyShareInCompany(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||
|
||||
cost = CalculateCompanyValue(p) >> 2;
|
||||
if (flags & DC_EXEC) {
|
||||
PlayerID* b = p->share_owners;
|
||||
PlayerByte* b = p->share_owners;
|
||||
int i;
|
||||
|
||||
while (*b != PLAYER_SPECTATOR) b++; /* share owners is guaranteed to contain at least one PLAYER_SPECTATOR */
|
||||
|
@ -1656,7 +1655,7 @@ int32 CmdSellShareInCompany(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||
if (!IsValidPlayer((PlayerID)p1) || !_patches.allow_shares) return CMD_ERROR;
|
||||
|
||||
SET_EXPENSES_TYPE(EXPENSES_OTHER);
|
||||
p = GetPlayer(p1);
|
||||
p = GetPlayer((PlayerID)p1);
|
||||
|
||||
/* Those lines are here for network-protection (clients can be slow) */
|
||||
if (GetAmountOwnedBy(p, _current_player) == 0) return 0;
|
||||
|
@ -1666,7 +1665,7 @@ int32 CmdSellShareInCompany(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||
cost = -(cost - (cost >> 7));
|
||||
|
||||
if (flags & DC_EXEC) {
|
||||
PlayerID* b = p->share_owners;
|
||||
PlayerByte* b = p->share_owners;
|
||||
while (*b != _current_player) b++; /* share owners is guaranteed to contain player */
|
||||
*b = PLAYER_SPECTATOR;
|
||||
InvalidateWindow(WC_COMPANY, p1);
|
||||
|
@ -1690,7 +1689,7 @@ int32 CmdBuyCompany(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||
if (!IsValidPlayer((PlayerID)p1) || _networking) return CMD_ERROR;
|
||||
|
||||
SET_EXPENSES_TYPE(EXPENSES_OTHER);
|
||||
p = GetPlayer(p1);
|
||||
p = GetPlayer((PlayerID)p1);
|
||||
|
||||
if (!p->is_ai) return CMD_ERROR;
|
||||
|
||||
|
@ -1730,7 +1729,7 @@ static void SaveLoad_ECMY(void)
|
|||
SlObject(&_economy, _economy_desc);
|
||||
}
|
||||
|
||||
const ChunkHandler _economy_chunk_handlers[] = {
|
||||
extern const ChunkHandler _economy_chunk_handlers[] = {
|
||||
{ 'PRIC', SaveLoad_PRIC, SaveLoad_PRIC, CH_RIFF | CH_AUTO_LENGTH},
|
||||
{ 'CAPR', SaveLoad_CAPR, SaveLoad_CAPR, CH_RIFF | CH_AUTO_LENGTH},
|
||||
{ 'SUBS', Save_SUBS, Load_SUBS, CH_ARRAY},
|
||||
|
|
|
@ -29,7 +29,8 @@ typedef struct Subsidy {
|
|||
} Subsidy;
|
||||
|
||||
|
||||
enum {
|
||||
enum ScoreID {
|
||||
SCORE_BEGIN = 0,
|
||||
SCORE_VEHICLES = 0,
|
||||
SCORE_STATIONS = 1,
|
||||
SCORE_MIN_PROFIT = 2,
|
||||
|
@ -40,13 +41,14 @@ enum {
|
|||
SCORE_MONEY = 7,
|
||||
SCORE_LOAN = 8,
|
||||
SCORE_TOTAL = 9, // This must always be the last entry
|
||||
|
||||
NUM_SCORE = 10, // How many scores are there..
|
||||
SCORE_END = 10, // How many scores are there..
|
||||
|
||||
SCORE_MAX = 1000 // The max score that can be in the performance history
|
||||
// the scores together of score_info is allowed to be more!
|
||||
};
|
||||
|
||||
DECLARE_POSTFIX_INCREMENT(ScoreID);
|
||||
|
||||
typedef struct ScoreInfo {
|
||||
byte id; // Unique ID of the score
|
||||
int needed; // How much you need to get the perfect score
|
||||
|
@ -54,7 +56,7 @@ typedef struct ScoreInfo {
|
|||
} ScoreInfo;
|
||||
|
||||
extern const ScoreInfo _score_info[];
|
||||
extern int _score_part[MAX_PLAYERS][NUM_SCORE];
|
||||
extern int _score_part[MAX_PLAYERS][SCORE_END];
|
||||
|
||||
int UpdateCompanyRatingAndValue(Player *p, bool update);
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
|
||||
static inline TLG GetTLG(TileIndex t)
|
||||
{
|
||||
return (HASBIT(TileX(t), 0) << 1) + HASBIT(TileY(t), 0);
|
||||
return (TLG)((HASBIT(TileX(t), 0) << 1) + HASBIT(TileY(t), 0));
|
||||
}
|
||||
|
||||
/** Finds which Rail Bits are present on a given tile. For bridge tiles,
|
||||
|
@ -77,24 +77,24 @@ static TrackBits GetRailTrackBitsUniversal(TileIndex t, byte *override)
|
|||
{
|
||||
switch (GetTileType(t)) {
|
||||
case MP_RAILWAY:
|
||||
if (GetRailType(t) != RAILTYPE_ELECTRIC) return 0;
|
||||
if (GetRailType(t) != RAILTYPE_ELECTRIC) return TRACK_BIT_NONE;
|
||||
switch (GetRailTileType(t)) {
|
||||
case RAIL_TILE_NORMAL: case RAIL_TILE_SIGNALS:
|
||||
return GetTrackBits(t);
|
||||
case RAIL_TILE_DEPOT_WAYPOINT:
|
||||
if (GetRailTileSubtype(t) == RAIL_SUBTYPE_WAYPOINT) return GetRailWaypointBits(t);
|
||||
default:
|
||||
return 0;
|
||||
return TRACK_BIT_NONE;
|
||||
}
|
||||
break;
|
||||
|
||||
case MP_TUNNELBRIDGE:
|
||||
if (IsTunnel(t)) {
|
||||
if (GetRailType(t) != RAILTYPE_ELECTRIC) return 0;
|
||||
if (GetRailType(t) != RAILTYPE_ELECTRIC) return TRACK_BIT_NONE;
|
||||
if (override != NULL) *override = 1 << GetTunnelDirection(t);
|
||||
return AxisToTrackBits(DiagDirToAxis(GetTunnelDirection(t)));
|
||||
} else {
|
||||
if (GetRailType(t) != RAILTYPE_ELECTRIC) return 0;
|
||||
if (GetRailType(t) != RAILTYPE_ELECTRIC) return TRACK_BIT_NONE;
|
||||
if (override != NULL && DistanceMax(t, GetOtherBridgeEnd(t)) > 1) {
|
||||
*override = 1 << GetBridgeRampDirection(t);
|
||||
}
|
||||
|
@ -102,18 +102,18 @@ static TrackBits GetRailTrackBitsUniversal(TileIndex t, byte *override)
|
|||
}
|
||||
|
||||
case MP_STREET:
|
||||
if (GetRoadTileType(t) != ROAD_TILE_CROSSING) return 0;
|
||||
if (GetRailTypeCrossing(t) != RAILTYPE_ELECTRIC) return 0;
|
||||
if (GetRoadTileType(t) != ROAD_TILE_CROSSING) return TRACK_BIT_NONE;
|
||||
if (GetRailTypeCrossing(t) != RAILTYPE_ELECTRIC) return TRACK_BIT_NONE;
|
||||
return GetCrossingRailBits(t);
|
||||
|
||||
case MP_STATION:
|
||||
if (!IsRailwayStation(t)) return 0;
|
||||
if (GetRailType(t) != RAILTYPE_ELECTRIC) return 0;
|
||||
if (!IsStationTileElectrifiable(t)) return 0;
|
||||
if (!IsRailwayStation(t)) return TRACK_BIT_NONE;
|
||||
if (GetRailType(t) != RAILTYPE_ELECTRIC) return TRACK_BIT_NONE;
|
||||
if (!IsStationTileElectrifiable(t)) return TRACK_BIT_NONE;
|
||||
return TrackToTrackBits(GetRailStationTrack(t));
|
||||
|
||||
default:
|
||||
return 0;
|
||||
return TRACK_BIT_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,7 @@ static void DrawCatenaryRailway(const TileInfo *ti)
|
|||
* which have no middle tiles */
|
||||
trackconfig[TS_HOME] = GetRailTrackBitsUniversal(ti->tile, &OverridePCP);
|
||||
/* If a track bit is present that is not in the main direction, the track is level */
|
||||
isflat[TS_HOME] = trackconfig[TS_HOME] & (TRACK_BIT_HORZ | TRACK_BIT_VERT);
|
||||
isflat[TS_HOME] = ((trackconfig[TS_HOME] & (TRACK_BIT_HORZ | TRACK_BIT_VERT)) != 0);
|
||||
|
||||
AdjustTileh(ti->tile, &tileh[TS_HOME]);
|
||||
|
||||
|
@ -184,8 +184,8 @@ static void DrawCatenaryRailway(const TileInfo *ti)
|
|||
* existing foundataions, so we do have to do that manually later on.*/
|
||||
tileh[TS_NEIGHBOUR] = GetTileSlope(neighbour, NULL);
|
||||
trackconfig[TS_NEIGHBOUR] = GetRailTrackBitsUniversal(neighbour, NULL);
|
||||
if (IsTunnelTile(neighbour) && i != GetTunnelDirection(neighbour)) trackconfig[TS_NEIGHBOUR] = 0;
|
||||
isflat[TS_NEIGHBOUR] = trackconfig[TS_NEIGHBOUR] & (TRACK_BIT_HORZ | TRACK_BIT_VERT);
|
||||
if (IsTunnelTile(neighbour) && i != GetTunnelDirection(neighbour)) trackconfig[TS_NEIGHBOUR] = TRACK_BIT_NONE;
|
||||
isflat[TS_NEIGHBOUR] = ((trackconfig[TS_NEIGHBOUR] & (TRACK_BIT_HORZ | TRACK_BIT_VERT)) != 0);
|
||||
|
||||
PPPpreferred[i] = 0xFF; /* We start with preferring everything (end-of-line in any direction) */
|
||||
PPPallowed[i] = AllowedPPPonPCP[i];
|
||||
|
@ -289,7 +289,7 @@ static void DrawCatenaryRailway(const TileInfo *ti)
|
|||
}
|
||||
|
||||
/* Drawing of pylons is finished, now draw the wires */
|
||||
for (t = 0; t < TRACK_END; t++) {
|
||||
for (t = TRACK_BEGIN; t < TRACK_END; t++) {
|
||||
if (HASBIT(trackconfig[TS_HOME], t)) {
|
||||
|
||||
byte PCPconfig = HASBIT(PCPstatus, PCPpositions[t][0]) +
|
||||
|
@ -321,7 +321,7 @@ static void DrawCatenaryOnBridge(const TileInfo *ti)
|
|||
Axis axis = GetBridgeAxis(ti->tile);
|
||||
TLG tlg = GetTLG(ti->tile);
|
||||
|
||||
CatenarySprite offset = axis == AXIS_X ? 0 : WIRE_Y_FLAT_BOTH - WIRE_X_FLAT_BOTH;
|
||||
CatenarySprite offset = (CatenarySprite)(axis == AXIS_X ? 0 : WIRE_Y_FLAT_BOTH - WIRE_X_FLAT_BOTH);
|
||||
|
||||
if ((length % 2) && num == length) {
|
||||
/* Draw the "short" wire on the southern end of the bridge
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* $Id$ */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
// This pretty simple file checks if the system is LITTLE_ENDIAN or BIG_ENDIAN
|
||||
// it does that by putting a 1 and a 0 in an array, and read it out as one
|
||||
|
|
|
@ -129,7 +129,7 @@ void StartupEngines(void)
|
|||
uint32 r;
|
||||
|
||||
e->age = 0;
|
||||
e->railtype = ei->railtype;
|
||||
e->railtype = (RailType)ei->railtype;
|
||||
e->flags = 0;
|
||||
e->player_avail = 0;
|
||||
|
||||
|
@ -189,7 +189,7 @@ static void AcceptEnginePreview(Engine *e, PlayerID player)
|
|||
SETBIT(e->player_avail, player);
|
||||
SETBIT(p->avail_railtypes, e->railtype);
|
||||
|
||||
e->preview_player = 0xFF;
|
||||
e->preview_player = INVALID_PLAYER;
|
||||
if (player == _local_player) {
|
||||
InvalidateWindowClassesData(WC_BUILD_VEHICLE);
|
||||
InvalidateWindowClasses(WC_REPLACE_VEHICLE);
|
||||
|
@ -217,7 +217,7 @@ static PlayerID GetBestPlayer(PlayerID pp)
|
|||
if (best_player == PLAYER_SPECTATOR) return PLAYER_SPECTATOR;
|
||||
|
||||
SETBIT(mask, best_player);
|
||||
} while (--pp != 0);
|
||||
} while (pp--, pp != 0);
|
||||
|
||||
return best_player;
|
||||
}
|
||||
|
@ -242,7 +242,7 @@ void EnginesDailyLoop(void)
|
|||
PlayerID best_player = GetBestPlayer(e->preview_player);
|
||||
|
||||
if (best_player == PLAYER_SPECTATOR) {
|
||||
e->preview_player = 0xFF;
|
||||
e->preview_player = INVALID_PLAYER;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -364,7 +364,7 @@ void EnginesMonthlyLoop(void)
|
|||
|
||||
// Do not introduce new rail wagons
|
||||
if (!IsWagon(e - _engines))
|
||||
e->preview_player = 1; // Give to the player with the highest rating.
|
||||
e->preview_player = (PlayerID)1; // Give to the player with the highest rating.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -636,7 +636,7 @@ static void LoadSave_ENGS(void)
|
|||
SlArray(_engine_name_strings, lengthof(_engine_name_strings), SLE_STRINGID);
|
||||
}
|
||||
|
||||
const ChunkHandler _engine_chunk_handlers[] = {
|
||||
extern const ChunkHandler _engine_chunk_handlers[] = {
|
||||
{ 'ENGN', Save_ENGN, Load_ENGN, CH_ARRAY },
|
||||
{ 'ENGS', LoadSave_ENGS, LoadSave_ENGS, CH_RIFF },
|
||||
{ 'ERNW', Save_ERNW, Load_ERNW, CH_ARRAY | CH_LAST},
|
||||
|
|
19
src/engine.h
19
src/engine.h
|
@ -6,6 +6,8 @@
|
|||
/** @file engine.h */
|
||||
|
||||
#include "oldpool.h"
|
||||
#include "rail.h"
|
||||
#include "sound.h"
|
||||
|
||||
typedef struct RailVehicleInfo {
|
||||
byte image_index;
|
||||
|
@ -38,8 +40,8 @@ typedef struct ShipVehicleInfo {
|
|||
CargoID cargo_type;
|
||||
uint16 capacity;
|
||||
byte running_cost;
|
||||
byte sfx;
|
||||
byte refittable;
|
||||
SoundFxByte sfx;
|
||||
bool refittable;
|
||||
} ShipVehicleInfo;
|
||||
|
||||
// Aircraft subtypes
|
||||
|
@ -53,7 +55,7 @@ typedef struct AircraftVehicleInfo {
|
|||
byte base_cost;
|
||||
byte running_cost;
|
||||
byte subtype;
|
||||
byte sfx;
|
||||
SoundFxByte sfx;
|
||||
byte acceleration;
|
||||
byte max_speed;
|
||||
byte mail_capacity;
|
||||
|
@ -64,7 +66,7 @@ typedef struct RoadVehicleInfo {
|
|||
byte image_index;
|
||||
byte base_cost;
|
||||
byte running_cost;
|
||||
byte sfx;
|
||||
SoundFxByte sfx;
|
||||
byte max_speed;
|
||||
byte capacity;
|
||||
CargoID cargo_type;
|
||||
|
@ -96,9 +98,9 @@ typedef struct Engine {
|
|||
uint16 duration_phase_1, duration_phase_2, duration_phase_3;
|
||||
byte lifelength;
|
||||
byte flags;
|
||||
byte preview_player;
|
||||
PlayerByte preview_player;
|
||||
byte preview_wait;
|
||||
byte railtype;
|
||||
RailTypeByte railtype;
|
||||
byte player_avail;
|
||||
byte type; // type, ie VEH_Road, VEH_Train, etc. Same as in vehicle.h
|
||||
} Engine;
|
||||
|
@ -122,9 +124,8 @@ enum {
|
|||
NUM_VEHICLE_TYPES = 6
|
||||
};
|
||||
|
||||
enum {
|
||||
INVALID_ENGINE = 0xFFFF,
|
||||
};
|
||||
static const EngineID INVALID_ENGINE = 0xFFFF;
|
||||
|
||||
|
||||
void AddTypeToEngines(void);
|
||||
void StartupEngines(void);
|
||||
|
|
|
@ -24,6 +24,7 @@ static StringID GetEngineCategoryName(EngineID engine)
|
|||
case RAILTYPE_ELECTRIC: return STR_8102_RAILROAD_LOCOMOTIVE;
|
||||
case RAILTYPE_MONO: return STR_8106_MONORAIL_LOCOMOTIVE;
|
||||
case RAILTYPE_MAGLEV: return STR_8107_MAGLEV_LOCOMOTIVE;
|
||||
default: NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "variables.h"
|
||||
#include "functions.h"
|
||||
#include "heightmap.h"
|
||||
#include "helpers.hpp"
|
||||
#include "table/strings.h"
|
||||
#include "fios.h"
|
||||
#include <sys/types.h>
|
||||
|
@ -47,7 +48,7 @@ FiosItem *FiosAlloc(void)
|
|||
{
|
||||
if (_fios_count == _fios_alloc) {
|
||||
_fios_alloc += 256;
|
||||
_fios_items = realloc(_fios_items, _fios_alloc * sizeof(FiosItem));
|
||||
ReallocT(&_fios_items, _fios_alloc);
|
||||
}
|
||||
return &_fios_items[_fios_count++];
|
||||
}
|
||||
|
@ -323,7 +324,7 @@ FiosItem *FiosGetSavegameList(int mode)
|
|||
static char *_fios_save_path = NULL;
|
||||
|
||||
if (_fios_save_path == NULL) {
|
||||
_fios_save_path = malloc(MAX_PATH);
|
||||
MallocT(&_fios_save_path, MAX_PATH);
|
||||
ttd_strlcpy(_fios_save_path, _paths.save_dir, MAX_PATH);
|
||||
}
|
||||
|
||||
|
@ -371,7 +372,7 @@ FiosItem *FiosGetScenarioList(int mode)
|
|||
static char *_fios_scn_path = NULL;
|
||||
|
||||
if (_fios_scn_path == NULL) {
|
||||
_fios_scn_path = malloc(MAX_PATH);
|
||||
MallocT(&_fios_scn_path, MAX_PATH);
|
||||
ttd_strlcpy(_fios_scn_path, _paths.scenario_dir, MAX_PATH);
|
||||
}
|
||||
|
||||
|
@ -402,7 +403,7 @@ FiosItem *FiosGetHeightmapList(int mode)
|
|||
static char *_fios_hmap_path = NULL;
|
||||
|
||||
if (_fios_hmap_path == NULL) {
|
||||
_fios_hmap_path = malloc(MAX_PATH);
|
||||
MallocT(&_fios_hmap_path, MAX_PATH);
|
||||
strcpy(_fios_hmap_path, _paths.heightmap_dir);
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "gfx.h"
|
||||
#include "string.h"
|
||||
#include "fontcache.h"
|
||||
#include "helpers.hpp"
|
||||
|
||||
#ifdef WITH_FREETYPE
|
||||
|
||||
|
@ -77,7 +78,7 @@ static FT_Error GetFontByFaceName(const char *font_name, FT_Face *face)
|
|||
* normal char to match the data returned by RegEnumValue,
|
||||
* otherwise just use parameter */
|
||||
#if defined(UNICODE)
|
||||
font_namep = malloc(MAX_PATH * sizeof(TCHAR));
|
||||
MallocT(&font_namep, MAX_PATH);
|
||||
MB_TO_WIDE_BUFFER(font_name, font_namep, MAX_PATH * sizeof(TCHAR));
|
||||
#else
|
||||
font_namep = (char*)font_name; // only cast because in unicode pointer is not const
|
||||
|
@ -345,12 +346,12 @@ static void SetGlyphPtr(FontSize size, WChar key, const GlyphEntry *glyph)
|
|||
{
|
||||
if (_glyph_ptr[size] == NULL) {
|
||||
DEBUG(freetype, 3, "Allocating root glyph cache for size %u", size);
|
||||
_glyph_ptr[size] = calloc(256, sizeof(**_glyph_ptr));
|
||||
CallocT(&_glyph_ptr[size], 256);
|
||||
}
|
||||
|
||||
if (_glyph_ptr[size][GB(key, 8, 8)] == NULL) {
|
||||
DEBUG(freetype, 3, "Allocating glyph cache for range 0x%02X00, size %u", GB(key, 8, 8), size);
|
||||
_glyph_ptr[size][GB(key, 8, 8)] = calloc(256, sizeof(***_glyph_ptr));
|
||||
CallocT(&_glyph_ptr[size][GB(key, 8, 8)], 256);
|
||||
}
|
||||
|
||||
DEBUG(freetype, 4, "Set glyph for unicode character 0x%04X, size %u", key, size);
|
||||
|
@ -395,7 +396,7 @@ const Sprite *GetGlyph(FontSize size, WChar key)
|
|||
height = max(1, slot->bitmap.rows + (size == FS_NORMAL));
|
||||
|
||||
/* FreeType has rendered the glyph, now we allocate a sprite and copy the image into it */
|
||||
sprite = calloc(width * height + 8, 1);
|
||||
sprite = (Sprite*)calloc(width * height + 8, 1);
|
||||
sprite->info = 1;
|
||||
sprite->width = width;
|
||||
sprite->height = height;
|
||||
|
@ -483,8 +484,8 @@ SpriteID GetUnicodeGlyph(FontSize size, uint32 key)
|
|||
|
||||
void SetUnicodeGlyph(FontSize size, uint32 key, SpriteID sprite)
|
||||
{
|
||||
if (_unicode_glyph_map[size] == NULL) _unicode_glyph_map[size] = calloc(256, sizeof(*_unicode_glyph_map[size]));
|
||||
if (_unicode_glyph_map[size][GB(key, 8, 8)] == NULL) _unicode_glyph_map[size][GB(key, 8, 8)] = calloc(256, sizeof(**_unicode_glyph_map[size]));
|
||||
if (_unicode_glyph_map[size] == NULL) CallocT(&_unicode_glyph_map[size], 256);
|
||||
if (_unicode_glyph_map[size][GB(key, 8, 8)] == NULL) CallocT(&_unicode_glyph_map[size][GB(key, 8, 8)], 256);
|
||||
_unicode_glyph_map[size][GB(key, 8, 8)][GB(key, 0, 8)] = sprite;
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ uint GetPartialZ(int x, int y, Slope corners);
|
|||
uint GetSlopeZ(int x, int y);
|
||||
uint32 GetTileTrackStatus(TileIndex tile, TransportType mode);
|
||||
void GetAcceptedCargo(TileIndex tile, AcceptedCargo ac);
|
||||
void ChangeTileOwner(TileIndex tile, byte old_player, byte new_player);
|
||||
void ChangeTileOwner(TileIndex tile, PlayerID old_player, PlayerID new_player);
|
||||
void AnimateTile(TileIndex tile);
|
||||
void ClickTile(TileIndex tile);
|
||||
void GetTileDesc(TileIndex tile, TileDesc *td);
|
||||
|
@ -217,5 +217,4 @@ void HandleExitGameRequest(void);
|
|||
|
||||
void DeterminePaths(void);
|
||||
|
||||
void CSleep(int milliseconds);
|
||||
#endif /* FUNCTIONS_H */
|
||||
|
|
|
@ -182,7 +182,7 @@ void WaitTillGeneratedWorld(void)
|
|||
{
|
||||
if (_gw.thread == NULL) return;
|
||||
_gw.quit_thread = true;
|
||||
OTTDJoinThread(_gw.thread);
|
||||
OTTDJoinThread((OTTDThread*)_gw.thread);
|
||||
_gw.thread = NULL;
|
||||
_gw.threaded = false;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ typedef struct gw_info {
|
|||
bool quit_thread; //! Do we want to quit the active thread
|
||||
bool threaded; //! Whether we run _GenerateWorld threaded
|
||||
int mode; //! What mode are we making a world in
|
||||
byte lp; //! The local_player before generating
|
||||
PlayerID lp; //! The local_player before generating
|
||||
uint size_x; //! X-size of the map
|
||||
uint size_y; //! Y-size of the map
|
||||
gw_done_proc *proc; //! Proc that is called when done (can be NULL)
|
||||
|
@ -84,8 +84,8 @@ bool IsGeneratingWorldAborted(void);
|
|||
void HandleGeneratingWorldAbortion(void);
|
||||
|
||||
/* genworld_gui.c */
|
||||
void SetGeneratingWorldProgress(gwp_class class, uint total);
|
||||
void IncreaseGeneratingWorldProgress(gwp_class class);
|
||||
void SetGeneratingWorldProgress(gwp_class cls, uint total);
|
||||
void IncreaseGeneratingWorldProgress(gwp_class cls);
|
||||
void PrepareGenerateWorldProgress(void);
|
||||
void ShowGenerateWorldProgress(void);
|
||||
void StartNewGameWithoutGUI(uint seed);
|
||||
|
|
|
@ -196,7 +196,7 @@ void GenerateLandscapeWndProc(Window *w, WindowEvent *e)
|
|||
static querystr_d _genseed_query;
|
||||
static char _genseed_buffer[LEN_RND_SEED];
|
||||
|
||||
uint mode = w->window_number;
|
||||
glwp_modes mode = (glwp_modes)w->window_number;
|
||||
uint y;
|
||||
|
||||
switch (e->event) {
|
||||
|
@ -714,7 +714,7 @@ static const Widget _show_terrain_progress_widgets[] = {
|
|||
|
||||
typedef struct tp_info {
|
||||
uint percent;
|
||||
StringID class;
|
||||
StringID cls;
|
||||
uint current;
|
||||
uint total;
|
||||
int timer;
|
||||
|
@ -753,12 +753,12 @@ static void ShowTerrainProgressProc(Window* w, WindowEvent* e)
|
|||
|
||||
/* Draw the % complete with a bar and a text */
|
||||
DrawFrameRect(19, 20, (w->width - 18), 37, 14, FR_BORDERONLY);
|
||||
DrawFrameRect(20, 21, (int)((w->width - 40) * _tp.percent / 100) + 20, 36, 10, 0);
|
||||
DrawFrameRect(20, 21, (int)((w->width - 40) * _tp.percent / 100) + 20, 36, 10, FR_NONE);
|
||||
SetDParam(0, _tp.percent);
|
||||
DrawStringCentered(90, 25, STR_PROGRESS, 0);
|
||||
|
||||
/* Tell which class we are generating */
|
||||
DrawStringCentered(90, 46, _tp.class, 0);
|
||||
DrawStringCentered(90, 46, _tp.cls, 0);
|
||||
|
||||
/* And say where we are in that class */
|
||||
SetDParam(0, _tp.current);
|
||||
|
@ -783,7 +783,7 @@ static const WindowDesc _show_terrain_progress_desc = {
|
|||
*/
|
||||
void PrepareGenerateWorldProgress(void)
|
||||
{
|
||||
_tp.class = STR_WORLD_GENERATION;
|
||||
_tp.cls = STR_WORLD_GENERATION;
|
||||
_tp.current = 0;
|
||||
_tp.total = 0;
|
||||
_tp.percent = 0;
|
||||
|
@ -798,7 +798,7 @@ void ShowGenerateWorldProgress(void)
|
|||
AllocateWindowDescFront(&_show_terrain_progress_desc, 0);
|
||||
}
|
||||
|
||||
static void _SetGeneratingWorldProgress(gwp_class class, uint progress, uint total)
|
||||
static void _SetGeneratingWorldProgress(gwp_class cls, uint progress, uint total)
|
||||
{
|
||||
static const int percent_table[GWP_CLASS_COUNT + 1] = {0, 5, 15, 20, 40, 60, 65, 80, 85, 99, 100 };
|
||||
static const StringID class_table[GWP_CLASS_COUNT] = {
|
||||
|
@ -814,7 +814,7 @@ static void _SetGeneratingWorldProgress(gwp_class class, uint progress, uint tot
|
|||
STR_PREPARING_GAME
|
||||
};
|
||||
|
||||
assert(class < GWP_CLASS_COUNT);
|
||||
assert(cls < GWP_CLASS_COUNT);
|
||||
|
||||
/* Do not run this function if we aren't in a thread */
|
||||
if (!IsGenerateWorldThreaded() && !_network_dedicated) return;
|
||||
|
@ -822,13 +822,13 @@ static void _SetGeneratingWorldProgress(gwp_class class, uint progress, uint tot
|
|||
if (IsGeneratingWorldAborted()) HandleGeneratingWorldAbortion();
|
||||
|
||||
if (total == 0) {
|
||||
assert(_tp.class == class_table[class]);
|
||||
assert(_tp.cls == class_table[cls]);
|
||||
_tp.current += progress;
|
||||
} else {
|
||||
_tp.class = class_table[class];
|
||||
_tp.cls = class_table[cls];
|
||||
_tp.current = progress;
|
||||
_tp.total = total;
|
||||
_tp.percent = percent_table[class];
|
||||
_tp.percent = percent_table[cls];
|
||||
}
|
||||
|
||||
/* Don't update the screen too often. So update it once in every 200ms.
|
||||
|
@ -837,7 +837,7 @@ static void _SetGeneratingWorldProgress(gwp_class class, uint progress, uint tot
|
|||
if (!_network_dedicated && _tp.timer != 0 && _timer_counter - _tp.timer < (200 * 8 / 30)) return;
|
||||
|
||||
/* Percentage is about the number of completed tasks, so 'current - 1' */
|
||||
_tp.percent = percent_table[class] + (percent_table[class + 1] - percent_table[class]) * (_tp.current == 0 ? 0 : _tp.current - 1) / _tp.total;
|
||||
_tp.percent = percent_table[cls] + (percent_table[cls + 1] - percent_table[cls]) * (_tp.current == 0 ? 0 : _tp.current - 1) / _tp.total;
|
||||
_tp.timer = _timer_counter;
|
||||
|
||||
if (_network_dedicated) {
|
||||
|
@ -877,11 +877,11 @@ static void _SetGeneratingWorldProgress(gwp_class class, uint progress, uint tot
|
|||
* Warning: this function isn't clever. Don't go from class 4 to 3. Go upwards, always.
|
||||
* Also, progress works if total is zero, total works if progress is zero.
|
||||
*/
|
||||
void SetGeneratingWorldProgress(gwp_class class, uint total)
|
||||
void SetGeneratingWorldProgress(gwp_class cls, uint total)
|
||||
{
|
||||
if (total == 0) return;
|
||||
|
||||
_SetGeneratingWorldProgress(class, 0, total);
|
||||
_SetGeneratingWorldProgress(cls, 0, total);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -891,8 +891,8 @@ void SetGeneratingWorldProgress(gwp_class class, uint total)
|
|||
* Warning: this function isn't clever. Don't go from class 4 to 3. Go upwards, always.
|
||||
* Also, progress works if total is zero, total works if progress is zero.
|
||||
*/
|
||||
void IncreaseGeneratingWorldProgress(gwp_class class)
|
||||
void IncreaseGeneratingWorldProgress(gwp_class cls)
|
||||
{
|
||||
/* In fact the param 'class' isn't needed.. but for some security reasons, we want it around */
|
||||
_SetGeneratingWorldProgress(class, 1, 0);
|
||||
_SetGeneratingWorldProgress(cls, 1, 0);
|
||||
}
|
||||
|
|
|
@ -473,7 +473,7 @@ void DrawStringMultiCenter(int x, int y, StringID str, int maxw)
|
|||
tmp = FormatStringLinebreaks(buffer, maxw);
|
||||
num = GB(tmp, 0, 16);
|
||||
|
||||
mt = GetCharacterHeight(GB(tmp, 16, 16));
|
||||
mt = GetCharacterHeight((FontSize)GB(tmp, 16, 16));
|
||||
|
||||
y -= (mt >> 1) * num;
|
||||
|
||||
|
@ -517,7 +517,7 @@ uint DrawStringMultiLine(int x, int y, StringID str, int maxw)
|
|||
tmp = FormatStringLinebreaks(buffer, maxw);
|
||||
num = GB(tmp, 0, 16);
|
||||
|
||||
mt = GetCharacterHeight(GB(tmp, 16, 16));
|
||||
mt = GetCharacterHeight((FontSize)GB(tmp, 16, 16));
|
||||
total_height = (num + 1) * mt;
|
||||
|
||||
src = buffer;
|
||||
|
|
45
src/gfx.h
45
src/gfx.h
|
@ -3,31 +3,7 @@
|
|||
#ifndef GFX_H
|
||||
#define GFX_H
|
||||
|
||||
typedef byte Pixel;
|
||||
|
||||
struct DrawPixelInfo {
|
||||
Pixel *dst_ptr;
|
||||
int left, top, width, height;
|
||||
int pitch;
|
||||
uint16 zoom;
|
||||
};
|
||||
|
||||
|
||||
typedef struct CursorVars {
|
||||
Point pos, size, offs, delta; ///< position, size, offset from top-left, and movement
|
||||
Point draw_pos, draw_size; ///< position and size bounding-box for drawing
|
||||
CursorID sprite; ///< current image of cursor
|
||||
|
||||
int wheel; ///< mouse wheel movement
|
||||
const CursorID *animate_list, *animate_cur; ///< in case of animated cursor, list of frames
|
||||
uint animate_timeout; ///< current frame in list of animated cursor
|
||||
|
||||
bool visible; ///< cursor is visible
|
||||
bool dirty; ///< the rect occupied by the mouse is dirty (redraw)
|
||||
bool fix_at; ///< mouse is moving, but cursor is not (used for scrolling)
|
||||
bool in_window; ///< mouse inside this window, determines drawing logic
|
||||
} CursorVars;
|
||||
|
||||
#include "helpers.hpp"
|
||||
|
||||
typedef enum FontSizes {
|
||||
FS_NORMAL,
|
||||
|
@ -36,6 +12,7 @@ typedef enum FontSizes {
|
|||
FS_END,
|
||||
} FontSize;
|
||||
|
||||
DECLARE_POSTFIX_INCREMENT(FontSize);
|
||||
|
||||
void RedrawScreenRect(int left, int top, int right, int bottom);
|
||||
void GfxScroll(int left, int top, int width, int height, int xo, int yo);
|
||||
|
@ -83,7 +60,7 @@ bool FillDrawPixelInfo(DrawPixelInfo* n, int left, int top, int width, int heigh
|
|||
/* window.c */
|
||||
void DrawOverlappedWindowForAll(int left, int top, int right, int bottom);
|
||||
|
||||
void SetMouseCursor(uint cursor);
|
||||
void SetMouseCursor(CursorID cursor);
|
||||
void SetAnimatedMouseCursor(const CursorID *table);
|
||||
void CursorTick(void);
|
||||
void DrawMouseCursor(void);
|
||||
|
@ -91,7 +68,7 @@ void ScreenSizeChanged(void);
|
|||
void UndrawMouseCursor(void);
|
||||
bool ChangeResInGame(int w, int h);
|
||||
void SortResolutions(int count);
|
||||
void ToggleFullScreen(bool fs);
|
||||
extern "C" void ToggleFullScreen(bool fs);
|
||||
|
||||
/* gfx.c */
|
||||
#define ASCII_LETTERSTART 32
|
||||
|
@ -109,9 +86,7 @@ static inline byte GetCharacterHeight(FontSize size)
|
|||
}
|
||||
}
|
||||
|
||||
VARDEF DrawPixelInfo _screen;
|
||||
VARDEF DrawPixelInfo *_cur_dpi;
|
||||
VARDEF CursorVars _cursor;
|
||||
|
||||
enum {
|
||||
COLOUR_DARK_BLUE,
|
||||
|
@ -138,20 +113,8 @@ enum {
|
|||
*/
|
||||
VARDEF byte _colour_gradient[16][8];
|
||||
|
||||
VARDEF int _pal_first_dirty;
|
||||
VARDEF int _pal_last_dirty;
|
||||
|
||||
VARDEF bool _use_dos_palette;
|
||||
|
||||
typedef struct Colour {
|
||||
byte r;
|
||||
byte g;
|
||||
byte b;
|
||||
} Colour;
|
||||
|
||||
extern Colour _cur_palette[256];
|
||||
|
||||
|
||||
typedef enum StringColorFlags {
|
||||
IS_PALETTE_COLOR = 0x100, // color value is already a real palette color index, not an index of a StringColor
|
||||
} StringColorFlags;
|
||||
|
|
|
@ -17,13 +17,13 @@
|
|||
#include <string.h>
|
||||
|
||||
typedef struct MD5File {
|
||||
const char * const filename; // filename
|
||||
const md5_byte_t hash[16]; // md5 sum of the file
|
||||
const char * filename; // filename
|
||||
md5_byte_t hash[16]; // md5 sum of the file
|
||||
} MD5File;
|
||||
|
||||
typedef struct FileList {
|
||||
const MD5File basic[4]; // grf files that always have to be loaded
|
||||
const MD5File landscape[3]; // landscape specific grf files
|
||||
MD5File basic[4]; // grf files that always have to be loaded
|
||||
MD5File landscape[3]; // landscape specific grf files
|
||||
} FileList;
|
||||
|
||||
enum {
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "debug.h"
|
||||
#include "variables.h"
|
||||
#include "date.h"
|
||||
#include "helpers.hpp"
|
||||
|
||||
const byte _cargo_colours[NUM_CARGO] = {152, 32, 15, 174, 208, 194, 191, 84, 184, 10, 202, 48};
|
||||
|
||||
|
@ -65,7 +66,7 @@ static void DrawGraph(const GraphDrawer *gw)
|
|||
|
||||
/* the colors and cost array of GraphDrawer must accomodate
|
||||
* both values for cargo and players. So if any are higher, quit */
|
||||
assert(GRAPH_NUM >= NUM_CARGO && GRAPH_NUM >= MAX_PLAYERS);
|
||||
assert(GRAPH_NUM >= (int)NUM_CARGO && GRAPH_NUM >= (int)MAX_PLAYERS);
|
||||
|
||||
color = _colour_gradient[gw->bg_line_color][4];
|
||||
|
||||
|
@ -118,7 +119,7 @@ static void DrawGraph(const GraphDrawer *gw)
|
|||
col_ptr = row_ptr;
|
||||
do {
|
||||
if (*col_ptr != INVALID_VALUE) {
|
||||
mx = max64(mx, myabs64(*col_ptr));
|
||||
mx = max64(mx, *col_ptr);
|
||||
}
|
||||
} while (col_ptr++, --num_x);
|
||||
}
|
||||
|
@ -906,11 +907,10 @@ void ShowCompanyLeagueTable(void)
|
|||
|
||||
static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e)
|
||||
{
|
||||
static PlayerID _performance_rating_detail_player = 0;
|
||||
static PlayerID _performance_rating_detail_player = PLAYER_FIRST;
|
||||
|
||||
switch (e->event) {
|
||||
case WE_PAINT: {
|
||||
int i;
|
||||
byte x;
|
||||
uint16 y = 14;
|
||||
int total_score = 0;
|
||||
|
@ -920,7 +920,7 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e)
|
|||
DrawWindowWidgets(w);
|
||||
|
||||
// Paint the player icons
|
||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
||||
for (PlayerID i = PLAYER_FIRST; i < MAX_PLAYERS; i++) {
|
||||
if (!GetPlayer(i)->is_active) {
|
||||
// Check if we have the player as an active player
|
||||
if (!IsWindowWidgetDisabled(w, i + 13)) {
|
||||
|
@ -930,7 +930,7 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e)
|
|||
if (IsWindowWidgetLowered(w, i + 13)) {
|
||||
RaiseWindowWidget(w, i + 13);
|
||||
LowerWindowWidget(w, 13);
|
||||
_performance_rating_detail_player = 0;
|
||||
_performance_rating_detail_player = PLAYER_FIRST;
|
||||
}
|
||||
// We need a repaint
|
||||
SetWindowDirty(w);
|
||||
|
@ -955,7 +955,7 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e)
|
|||
color_notdone = _colour_gradient[COLOUR_RED][4];
|
||||
|
||||
// Draw all the score parts
|
||||
for (i = 0; i < NUM_SCORE; i++) {
|
||||
for (ScoreID i = SCORE_BEGIN; i < SCORE_END; i++) {
|
||||
int val = _score_part[_performance_rating_detail_player][i];
|
||||
int needed = _score_info[i].needed;
|
||||
int score = _score_info[i].score;
|
||||
|
@ -1030,7 +1030,7 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e)
|
|||
// Is it no on disable?
|
||||
if (!IsWindowWidgetDisabled(w, e->we.click.widget)) {
|
||||
RaiseWindowWidget(w, _performance_rating_detail_player + 13);
|
||||
_performance_rating_detail_player = e->we.click.widget - 13;
|
||||
_performance_rating_detail_player = (PlayerID)(e->we.click.widget - 13);
|
||||
LowerWindowWidget(w, _performance_rating_detail_player + 13);
|
||||
SetWindowDirty(w);
|
||||
}
|
||||
|
@ -1038,11 +1038,11 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e)
|
|||
break;
|
||||
|
||||
case WE_CREATE: {
|
||||
int i;
|
||||
PlayerID i;
|
||||
Player *p2;
|
||||
|
||||
/* Disable the players who are not active */
|
||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
||||
for (i = PLAYER_FIRST; i < MAX_PLAYERS; i++) {
|
||||
SetWindowWidgetDisabledState(w, i + 13, !GetPlayer(i)->is_active);
|
||||
}
|
||||
/* Update all player stats with the current data
|
||||
|
@ -1054,7 +1054,7 @@ static void PerformanceRatingDetailWndProc(Window *w, WindowEvent *e)
|
|||
w->custom[0] = DAY_TICKS;
|
||||
w->custom[1] = 5;
|
||||
|
||||
_performance_rating_detail_player = 0;
|
||||
_performance_rating_detail_player = PLAYER_FIRST;
|
||||
LowerWindowWidget(w, _performance_rating_detail_player + 13);
|
||||
SetWindowDirty(w);
|
||||
|
||||
|
@ -1151,7 +1151,7 @@ static void GlobalSortSignList(void)
|
|||
uint n = 0;
|
||||
|
||||
/* Create array for sorting */
|
||||
_sign_sort = realloc((void *)_sign_sort, (GetMaxSignIndex() + 1)* sizeof(_sign_sort[0]));
|
||||
ReallocT(&_sign_sort, GetMaxSignIndex() + 1);
|
||||
if (_sign_sort == NULL) error("Could not allocate memory for the sign-sorting-list");
|
||||
|
||||
FOR_ALL_SIGNS(si) _sign_sort[n++] = si;
|
||||
|
|
|
@ -132,7 +132,7 @@ void ShowMusicWindow(void);
|
|||
|
||||
/* main_gui.c */
|
||||
void HandleOnEditText(const char *str);
|
||||
VARDEF byte _station_show_coverage;
|
||||
VARDEF bool _station_show_coverage;
|
||||
VARDEF PlaceProc *_place_proc;
|
||||
|
||||
/* vehicle_gui.c */
|
||||
|
|
176
src/hal.h
176
src/hal.h
|
@ -3,6 +3,85 @@
|
|||
#ifndef HAL_H
|
||||
#define HAL_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif //__cplusplus
|
||||
|
||||
enum WindowKeyCodes {
|
||||
WKC_SHIFT = 0x8000,
|
||||
WKC_CTRL = 0x4000,
|
||||
WKC_ALT = 0x2000,
|
||||
WKC_META = 0x1000,
|
||||
|
||||
// Special ones
|
||||
WKC_NONE = 0,
|
||||
WKC_ESC = 1,
|
||||
WKC_BACKSPACE = 2,
|
||||
WKC_INSERT = 3,
|
||||
WKC_DELETE = 4,
|
||||
|
||||
WKC_PAGEUP = 5,
|
||||
WKC_PAGEDOWN = 6,
|
||||
WKC_END = 7,
|
||||
WKC_HOME = 8,
|
||||
|
||||
// Arrow keys
|
||||
WKC_LEFT = 9,
|
||||
WKC_UP = 10,
|
||||
WKC_RIGHT = 11,
|
||||
WKC_DOWN = 12,
|
||||
|
||||
// Return & tab
|
||||
WKC_RETURN = 13,
|
||||
WKC_TAB = 14,
|
||||
|
||||
// Numerical keyboard
|
||||
WKC_NUM_0 = 16,
|
||||
WKC_NUM_1 = 17,
|
||||
WKC_NUM_2 = 18,
|
||||
WKC_NUM_3 = 19,
|
||||
WKC_NUM_4 = 20,
|
||||
WKC_NUM_5 = 21,
|
||||
WKC_NUM_6 = 22,
|
||||
WKC_NUM_7 = 23,
|
||||
WKC_NUM_8 = 24,
|
||||
WKC_NUM_9 = 25,
|
||||
WKC_NUM_DIV = 26,
|
||||
WKC_NUM_MUL = 27,
|
||||
WKC_NUM_MINUS = 28,
|
||||
WKC_NUM_PLUS = 29,
|
||||
WKC_NUM_ENTER = 30,
|
||||
WKC_NUM_DECIMAL = 31,
|
||||
|
||||
// Space
|
||||
WKC_SPACE = 32,
|
||||
|
||||
// Function keys
|
||||
WKC_F1 = 33,
|
||||
WKC_F2 = 34,
|
||||
WKC_F3 = 35,
|
||||
WKC_F4 = 36,
|
||||
WKC_F5 = 37,
|
||||
WKC_F6 = 38,
|
||||
WKC_F7 = 39,
|
||||
WKC_F8 = 40,
|
||||
WKC_F9 = 41,
|
||||
WKC_F10 = 42,
|
||||
WKC_F11 = 43,
|
||||
WKC_F12 = 44,
|
||||
|
||||
// backquote is the key left of "1"
|
||||
// we only store this key here, no matter what character is really mapped to it
|
||||
// on a particular keyboard. (US keyboard: ` and ~ ; German keyboard: ^ and °)
|
||||
WKC_BACKQUOTE = 45,
|
||||
WKC_PAUSE = 46,
|
||||
|
||||
// 0-9 are mapped to 48-57
|
||||
// A-Z are mapped to 65-90
|
||||
// a-z are mapped to 97-122
|
||||
};
|
||||
|
||||
|
||||
typedef struct {
|
||||
const char *(*start)(const char * const *parm);
|
||||
void (*stop)(void);
|
||||
|
@ -32,9 +111,9 @@ typedef struct {
|
|||
void (*set_volume)(byte vol);
|
||||
} HalMusicDriver;
|
||||
|
||||
VARDEF HalMusicDriver *_music_driver;
|
||||
VARDEF HalSoundDriver *_sound_driver;
|
||||
VARDEF HalVideoDriver *_video_driver;
|
||||
extern HalMusicDriver *_music_driver;
|
||||
extern HalSoundDriver *_sound_driver;
|
||||
extern HalVideoDriver *_video_driver;
|
||||
|
||||
enum DriverType {
|
||||
VIDEO_DRIVER = 0,
|
||||
|
@ -42,8 +121,99 @@ enum DriverType {
|
|||
MUSIC_DRIVER = 2,
|
||||
};
|
||||
|
||||
enum GameModes {
|
||||
GM_MENU,
|
||||
GM_NORMAL,
|
||||
GM_EDITOR
|
||||
};
|
||||
|
||||
void GameLoop(void);
|
||||
|
||||
void CreateConsole(void);
|
||||
|
||||
typedef int32 CursorID;
|
||||
typedef byte Pixel;
|
||||
|
||||
typedef struct Point {
|
||||
int x,y;
|
||||
} Point;
|
||||
|
||||
typedef struct Rect {
|
||||
int left,top,right,bottom;
|
||||
} Rect;
|
||||
|
||||
|
||||
typedef struct CursorVars {
|
||||
Point pos, size, offs, delta; ///< position, size, offset from top-left, and movement
|
||||
Point draw_pos, draw_size; ///< position and size bounding-box for drawing
|
||||
CursorID sprite; ///< current image of cursor
|
||||
|
||||
int wheel; ///< mouse wheel movement
|
||||
const CursorID *animate_list, *animate_cur; ///< in case of animated cursor, list of frames
|
||||
uint animate_timeout; ///< current frame in list of animated cursor
|
||||
|
||||
bool visible; ///< cursor is visible
|
||||
bool dirty; ///< the rect occupied by the mouse is dirty (redraw)
|
||||
bool fix_at; ///< mouse is moving, but cursor is not (used for scrolling)
|
||||
bool in_window; ///< mouse inside this window, determines drawing logic
|
||||
} CursorVars;
|
||||
|
||||
typedef struct DrawPixelInfo {
|
||||
Pixel *dst_ptr;
|
||||
int left, top, width, height;
|
||||
int pitch;
|
||||
uint16 zoom;
|
||||
} DrawPixelInfo;
|
||||
|
||||
|
||||
extern byte _dirkeys; // 1 = left, 2 = up, 4 = right, 8 = down
|
||||
extern bool _fullscreen;
|
||||
extern CursorVars _cursor;
|
||||
extern bool _ctrl_pressed; // Is Ctrl pressed?
|
||||
extern bool _shift_pressed; // Is Shift pressed?
|
||||
extern byte _fast_forward;
|
||||
|
||||
extern bool _left_button_down;
|
||||
extern bool _left_button_clicked;
|
||||
extern bool _right_button_down;
|
||||
extern bool _right_button_clicked;
|
||||
|
||||
extern DrawPixelInfo _screen;
|
||||
extern bool _exit_game;
|
||||
extern bool _networking; ///< are we in networking mode?
|
||||
extern byte _game_mode;
|
||||
extern byte _pause;
|
||||
|
||||
|
||||
void HandleKeypress(uint32 key);
|
||||
void HandleMouseEvents(void);
|
||||
void CSleep(int milliseconds);
|
||||
void UpdateWindows(void);
|
||||
|
||||
uint32 InteractiveRandom(void); /* Used for random sequences that are not the same on the other end of the multiplayer link */
|
||||
uint InteractiveRandomRange(uint max);
|
||||
void DrawTextMessage(void);
|
||||
void DrawMouseCursor(void);
|
||||
void ScreenSizeChanged(void);
|
||||
void HandleExitGameRequest(void);
|
||||
void GameSizeChanged(void);
|
||||
void UndrawMouseCursor(void);
|
||||
|
||||
extern int _pal_first_dirty;
|
||||
extern int _pal_last_dirty;
|
||||
extern int _num_resolutions;
|
||||
extern uint16 _resolutions[32][2];
|
||||
extern uint16 _cur_resolution[2];
|
||||
|
||||
typedef struct Colour {
|
||||
byte r;
|
||||
byte g;
|
||||
byte b;
|
||||
} Colour;
|
||||
extern Colour _cur_palette[256];
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif //__cplusplus
|
||||
|
||||
#endif /* HAL_H */
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "gui.h"
|
||||
#include "saveload.h"
|
||||
#include "bmp.h"
|
||||
#include "helpers.hpp"
|
||||
|
||||
/**
|
||||
* Convert RGB colors to Grayscale using 29.9% Red, 58.7% Green, 11.4% Blue
|
||||
|
@ -135,7 +136,7 @@ static bool ReadHeightmapPNG(char *filename, uint *x, uint *y, byte **map)
|
|||
}
|
||||
|
||||
if (map != NULL) {
|
||||
*map = malloc(info_ptr->width * info_ptr->height * sizeof(byte));
|
||||
MallocT(/* NO & */map, info_ptr->width * info_ptr->height);
|
||||
|
||||
if (*map == NULL) {
|
||||
ShowErrorMessage(STR_PNGMAP_ERR_MISC, STR_PNGMAP_ERROR, 0, 0);
|
||||
|
@ -248,7 +249,7 @@ static bool ReadHeightmapBMP(char *filename, uint *x, uint *y, byte **map)
|
|||
return false;
|
||||
}
|
||||
|
||||
*map = malloc(info.width * info.height * sizeof(byte));
|
||||
MallocT(map, info.width * info.height);
|
||||
if (*map == NULL) {
|
||||
ShowErrorMessage(STR_PNGMAP_ERR_MISC, STR_BMPMAP_ERROR, 0, 0);
|
||||
fclose(f);
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
/* $Id$ */
|
||||
#include "stdafx.h"
|
||||
|
||||
EXTERN_C_BEGIN
|
||||
#include "openttd.h"
|
||||
#include "engine.h"
|
||||
EXTERN_C_END
|
||||
|
||||
#include <new>
|
||||
#include "yapf/blob.hpp"
|
||||
|
|
|
@ -0,0 +1,178 @@
|
|||
/* $Id$ */
|
||||
|
||||
#ifndef HELPERS_HPP
|
||||
#define HELPERS_HPP
|
||||
|
||||
/** @file helpers.hpp */
|
||||
#include "macros.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
/** When allocating using malloc/calloc in C++ it is usually needed to cast the return value
|
||||
* from void* to the proper pointer type. Another alternative would be MallocT<> as follows */
|
||||
template <typename T> FORCEINLINE bool MallocT(T** t_ptr, size_t num_elements)
|
||||
{
|
||||
*t_ptr = (T*)malloc(num_elements * sizeof(T));
|
||||
return (*t_ptr != NULL);
|
||||
}
|
||||
/** When allocating using malloc/calloc in C++ it is usually needed to cast the return value
|
||||
* from void* to the proper pointer type. Another alternative would be MallocT<> as follows */
|
||||
template <typename T> FORCEINLINE bool CallocT(T** t_ptr, size_t num_elements)
|
||||
{
|
||||
*t_ptr = (T*)calloc(num_elements, sizeof(T));
|
||||
return (*t_ptr != NULL);
|
||||
}
|
||||
/** When allocating using malloc/calloc in C++ it is usually needed to cast the return value
|
||||
* from void* to the proper pointer type. Another alternative would be MallocT<> as follows */
|
||||
template <typename T> FORCEINLINE bool ReallocT(T** t_ptr, size_t num_elements)
|
||||
{
|
||||
*t_ptr = (T*)realloc(*t_ptr, num_elements * sizeof(T));
|
||||
return (*t_ptr != NULL);
|
||||
}
|
||||
|
||||
/** type safe swap operation */
|
||||
template <typename T> void SwapT(T *a, T *b);
|
||||
|
||||
template <typename T> FORCEINLINE void SwapT(T *a, T *b)
|
||||
{
|
||||
T t = *a;
|
||||
*a = *b;
|
||||
*b = t;
|
||||
}
|
||||
|
||||
|
||||
/** returns the absolute value of (scalar) variable. @note assumes variable to be signed */
|
||||
template <typename T> static inline T myabs(T a) { return a < (T)0 ? -a : a; }
|
||||
/** returns the (absolute) difference between two (scalar) variables */
|
||||
template <typename T> static inline T delta(T a, T b) { return a < b ? b - a : a - b; }
|
||||
|
||||
/** Some enums need to have allowed incrementing (i.e. StationClassID) */
|
||||
#define DECLARE_POSTFIX_INCREMENT(type) \
|
||||
FORCEINLINE type operator ++(type& e, int) \
|
||||
{ \
|
||||
type e_org = e; \
|
||||
e = (type)((int)e + 1); \
|
||||
return e_org; \
|
||||
} \
|
||||
FORCEINLINE type operator --(type& e, int) \
|
||||
{ \
|
||||
type e_org = e; \
|
||||
e = (type)((int)e - 1); \
|
||||
return e_org; \
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Operators to allow to work with enum as with type safe bit set in C++ */
|
||||
# define DECLARE_ENUM_AS_BIT_SET(mask_t) \
|
||||
FORCEINLINE mask_t operator | (mask_t m1, mask_t m2) {return (mask_t)((int)m1 | m2);} \
|
||||
FORCEINLINE mask_t operator & (mask_t m1, mask_t m2) {return (mask_t)((int)m1 & m2);} \
|
||||
FORCEINLINE mask_t operator ^ (mask_t m1, mask_t m2) {return (mask_t)((int)m1 ^ m2);} \
|
||||
FORCEINLINE mask_t& operator |= (mask_t& m1, mask_t m2) {m1 = m1 | m2; return m1;} \
|
||||
FORCEINLINE mask_t& operator &= (mask_t& m1, mask_t m2) {m1 = m1 & m2; return m1;} \
|
||||
FORCEINLINE mask_t& operator ^= (mask_t& m1, mask_t m2) {m1 = m1 ^ m2; return m1;} \
|
||||
FORCEINLINE mask_t operator ~(mask_t m) {return (mask_t)(~(int)m);}
|
||||
|
||||
/** probably redundant enum combining operators (as we have conversion functions)
|
||||
* but the old code is full of such arithmetics */
|
||||
# define DECLARE_ENUM_AS_BIT_INDEX(idx_t, mask_t) \
|
||||
FORCEINLINE mask_t operator << (int m, idx_t i) {return (mask_t)(m << (int)i);} \
|
||||
FORCEINLINE mask_t operator << (mask_t m, int i) {return (mask_t)(((int)m) << i);} \
|
||||
FORCEINLINE mask_t operator >> (mask_t m, int i) {return (mask_t)(((int)m) >> i);}
|
||||
|
||||
|
||||
/** Informative template class exposing basic enumeration properties used by several
|
||||
* other templates below. Here we have only forward declaration. For each enum type
|
||||
* we will create specialization derived from MakeEnumPropsT<>. */
|
||||
template <typename Tenum_t> struct EnumPropsT;
|
||||
|
||||
/** Helper template class that makes basic properties of given enumeration type visible
|
||||
* from outsize. It is used as base class of several EnumPropsT specializations each
|
||||
* dedicated to one of commonly used enumeration types. */
|
||||
template <typename Tenum_t, typename Tstorage_t, Tenum_t Tbegin, Tenum_t Tend, Tenum_t Tinvalid>
|
||||
struct MakeEnumPropsT {
|
||||
typedef Tenum_t type; ///< enum type (i.e. Trackdir)
|
||||
typedef Tstorage_t storage; ///< storage type (i.e. byte)
|
||||
static const Tenum_t begin = Tbegin; ///< lowest valid value (i.e. TRACKDIR_BEGIN)
|
||||
static const Tenum_t end = Tend; ///< one after the last valid value (i.e. TRACKDIR_END)
|
||||
static const Tenum_t invalid = Tinvalid; ///< what value is used as invalid value (i.e. INVALID_TRACKDIR)
|
||||
};
|
||||
|
||||
|
||||
|
||||
/** In some cases we use byte or uint16 to store values that are defined as enum. It is
|
||||
* necessary in order to control the sizeof() such values. Some compilers make enum
|
||||
* the same size as int (4 or 8 bytes instead of 1 or 2). As a consequence the strict
|
||||
* compiler type-checking causes errors like:
|
||||
* 'HasPowerOnRail' : cannot convert parameter 1 from 'byte' to 'RailType' when
|
||||
* u->u.rail.railtype is passed as argument or type RailType. In such cases it is better
|
||||
* to teach the compiler that u->u.rail.railtype is to be treated as RailType. */
|
||||
template <typename Tenum_t> struct TinyEnumT;
|
||||
|
||||
/** The general declaration of TinyEnumT<> (above) */
|
||||
template <typename Tenum_t> struct TinyEnumT
|
||||
{
|
||||
typedef Tenum_t enum_type; ///< expose our enumeration type (i.e. Trackdir) to outside
|
||||
typedef EnumPropsT<Tenum_t> Props; ///< make easier access to our enumeration propeties
|
||||
typedef typename Props::storage storage_type; ///< small storage type
|
||||
static const enum_type begin = Props::begin; ///< enum beginning (i.e. TRACKDIR_BEGIN)
|
||||
static const enum_type end = Props::end; ///< enum end (i.e. TRACKDIR_END)
|
||||
static const enum_type invalid = Props::invalid;///< invalid value (i.e. INVALID_TRACKDIR)
|
||||
|
||||
storage_type m_val; ///< here we hold the actual value in small (i.e. byte) form
|
||||
|
||||
/** Cast operator - invoked then the value is assigned to the Tenum_t type */
|
||||
FORCEINLINE operator enum_type () const
|
||||
{
|
||||
return (enum_type)m_val;
|
||||
}
|
||||
|
||||
/** Assignment operator (from Tenum_t type) */
|
||||
FORCEINLINE TinyEnumT& operator = (enum_type e)
|
||||
{
|
||||
m_val = (storage_type)e; return *this;
|
||||
}
|
||||
|
||||
/** postfix ++ operator on tiny type */
|
||||
FORCEINLINE TinyEnumT& operator ++ (int)
|
||||
{
|
||||
if (++m_val >= end) m_val -= (storage_type)(end - begin);
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Tenum_t> FORCEINLINE void SwapT(TinyEnumT<Tenum_t> *a, TinyEnumT<Tenum_t> *b)
|
||||
{
|
||||
SwapT(&a->m_val, &b->m_val);
|
||||
}
|
||||
|
||||
template <typename T> FORCEINLINE T ClrBitT(T t, int bit_index)
|
||||
{
|
||||
int val = t;
|
||||
CLRBIT(val, bit_index);
|
||||
return (T)val;
|
||||
}
|
||||
|
||||
template <typename T> FORCEINLINE T SetBitT(T t, int bit_index)
|
||||
{
|
||||
int val = t;
|
||||
SETBIT(val, bit_index);
|
||||
return (T)val;
|
||||
}
|
||||
|
||||
template <typename T> FORCEINLINE T ToggleBitT(T t, int bit_index)
|
||||
{
|
||||
int val = t;
|
||||
TOGGLEBIT(val, bit_index);
|
||||
return (T)val;
|
||||
}
|
||||
|
||||
#else // __cplusplus
|
||||
|
||||
#define DECLARE_POSTFIX_INCREMENT(E)
|
||||
#define DECLARE_ENUM_AS_BIT_SET(E)
|
||||
#define DECLARE_ENUM_AS_BIT_INDEX(E1,E2)
|
||||
|
||||
#endif // __cplusplus
|
||||
|
||||
#endif /* HELPERS_HPP */
|
|
@ -36,7 +36,7 @@ struct Industry {
|
|||
uint16 counter;
|
||||
|
||||
byte type;
|
||||
byte owner;
|
||||
OwnerByte owner;
|
||||
byte random_color;
|
||||
Year last_prod_year;
|
||||
byte was_cargo_delivered;
|
||||
|
|
|
@ -765,14 +765,14 @@ static void SetupFarmFieldFence(TileIndex tile, int size, byte type, Axis direct
|
|||
tile = TILE_MASK(tile);
|
||||
|
||||
if (IsTileType(tile, MP_CLEAR) || IsTileType(tile, MP_TREES)) {
|
||||
byte or = type;
|
||||
byte or_ = type;
|
||||
|
||||
if (or == 1 && CHANCE16(1, 7)) or = 2;
|
||||
if (or_ == 1 && CHANCE16(1, 7)) or_ = 2;
|
||||
|
||||
if (direction == AXIS_X) {
|
||||
SetFenceSE(tile, or);
|
||||
SetFenceSE(tile, or_);
|
||||
} else {
|
||||
SetFenceSW(tile, or);
|
||||
SetFenceSW(tile, or_);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -942,7 +942,7 @@ static void ProduceIndustryGoods(Industry *i)
|
|||
if ((i->counter & 0x3F) == 0) {
|
||||
if (CHANCE16R(1,14,r) && (num=_industry_sounds[i->type][0]) != 0) {
|
||||
SndPlayTileFx(
|
||||
_industry_sounds[i->type][1] + (((r >> 16) * num) >> 16),
|
||||
(SoundFx)(_industry_sounds[i->type][1] + (((r >> 16) * num) >> 16)),
|
||||
i->xy);
|
||||
}
|
||||
}
|
||||
|
@ -1225,7 +1225,7 @@ static bool CheckCanTerraformSurroundingTiles(TileIndex tile, uint height, int i
|
|||
return false;
|
||||
|
||||
/* Don't allow too big of a change if this is the sub-tile check */
|
||||
if (internal != 0 && myabs(curh - height) > 1) return false;
|
||||
if (internal != 0 && delta(curh, height) > 1) return false;
|
||||
|
||||
/* Different height, so the surrounding tiles of this tile
|
||||
* has to be correct too (in level, or almost in level)
|
||||
|
@ -1353,7 +1353,7 @@ static Industry *AllocateIndustry(void)
|
|||
return AddBlockToPool(&_Industry_pool) ? AllocateIndustry() : NULL;
|
||||
}
|
||||
|
||||
static void DoCreateNewIndustry(Industry *i, TileIndex tile, int type, const IndustryTileTable *it, const Town *t, byte owner)
|
||||
static void DoCreateNewIndustry(Industry *i, TileIndex tile, int type, const IndustryTileTable *it, const Town *t, Owner owner)
|
||||
{
|
||||
const IndustrySpec *indspec = GetIndustrySpec(type);
|
||||
uint32 r;
|
||||
|
@ -1595,25 +1595,25 @@ static void ExtChangeIndustryProduction(Industry *i)
|
|||
default: /* INDUSTRY_PRODUCTION */
|
||||
for (j = 0; j < 2 && i->produced_cargo[j] != CT_INVALID; j++){
|
||||
uint32 r = Random();
|
||||
int old, new, percent;
|
||||
int old_prod, new_prod, percent;
|
||||
int mag;
|
||||
|
||||
new = old = i->production_rate[j];
|
||||
new_prod = old_prod = i->production_rate[j];
|
||||
if (CHANCE16I(20, 1024, r))
|
||||
new -= ((RandomRange(50) + 10) * old) >> 8;
|
||||
new_prod -= ((RandomRange(50) + 10) * old_prod) >> 8;
|
||||
if (CHANCE16I(20 + (i->pct_transported[j] * 20 >> 8), 1024, r >> 16))
|
||||
new += ((RandomRange(50) + 10) * old) >> 8;
|
||||
new_prod += ((RandomRange(50) + 10) * old_prod) >> 8;
|
||||
|
||||
new = clamp(new, 0, 255);
|
||||
if (new == old) {
|
||||
new_prod = clamp(new_prod, 0, 255);
|
||||
if (new_prod == old_prod) {
|
||||
closeit = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
percent = new * 100 / old - 100;
|
||||
i->production_rate[j] = new;
|
||||
percent = new_prod * 100 / old_prod - 100;
|
||||
i->production_rate[j] = new_prod;
|
||||
|
||||
if (new >= indspec->production_rate[j] / 4)
|
||||
if (new_prod >= indspec->production_rate[j] / 4)
|
||||
closeit = false;
|
||||
|
||||
mag = abs(percent);
|
||||
|
@ -1827,7 +1827,7 @@ void InitializeIndustries(void)
|
|||
_industry_sound_tile = 0;
|
||||
}
|
||||
|
||||
const TileTypeProcs _tile_type_industry_procs = {
|
||||
extern const TileTypeProcs _tile_type_industry_procs = {
|
||||
DrawTile_Industry, /* draw_tile_proc */
|
||||
GetSlopeZ_Industry, /* get_slope_z_proc */
|
||||
ClearTile_Industry, /* clear_tile_proc */
|
||||
|
@ -1905,6 +1905,6 @@ static void Load_INDY(void)
|
|||
}
|
||||
}
|
||||
|
||||
const ChunkHandler _industry_chunk_handlers[] = {
|
||||
extern const ChunkHandler _industry_chunk_handlers[] = {
|
||||
{ 'INDY', Save_INDY, Load_INDY, CH_ARRAY | CH_LAST},
|
||||
};
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include "industry.h"
|
||||
#include "town.h"
|
||||
#include "variables.h"
|
||||
#include "helpers.hpp"
|
||||
|
||||
const byte _build_industry_types[4][12] = {
|
||||
{ 1, 2, 4, 6, 8, 0, 3, 5, 9, 11, 18 },
|
||||
|
@ -559,7 +560,7 @@ static void MakeSortedIndustryList(void)
|
|||
if (GetNumIndustries() == 0) return;
|
||||
|
||||
/* Create array for sorting */
|
||||
_industry_sort = realloc((void *)_industry_sort, (GetMaxIndustryIndex() + 1) * sizeof(_industry_sort[0]));
|
||||
ReallocT(&_industry_sort, GetMaxIndustryIndex() + 1);
|
||||
if (_industry_sort == NULL) error("Could not allocate memory for the industry-sorting-list");
|
||||
|
||||
FOR_ALL_INDUSTRIES(i) _industry_sort[n++] = i;
|
||||
|
|
|
@ -55,7 +55,7 @@ const byte _tileh_to_sprite[32] = {
|
|||
0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 17, 0, 15, 18, 0,
|
||||
};
|
||||
|
||||
const byte _inclined_tileh[] = {
|
||||
const Slope _inclined_tileh[] = {
|
||||
SLOPE_SW, SLOPE_NW, SLOPE_SW, SLOPE_SE, SLOPE_NE, SLOPE_SE, SLOPE_NE, SLOPE_NW,
|
||||
SLOPE_E, SLOPE_N, SLOPE_W, SLOPE_S,
|
||||
SLOPE_NWS, SLOPE_WSE, SLOPE_SEN, SLOPE_ENW
|
||||
|
@ -276,7 +276,7 @@ uint32 GetTileTrackStatus(TileIndex tile, TransportType mode)
|
|||
return _tile_type_procs[GetTileType(tile)]->get_tile_track_status_proc(tile, mode);
|
||||
}
|
||||
|
||||
void ChangeTileOwner(TileIndex tile, byte old_player, byte new_player)
|
||||
void ChangeTileOwner(TileIndex tile, PlayerID old_player, PlayerID new_player)
|
||||
{
|
||||
_tile_type_procs[GetTileType(tile)]->change_tile_owner_proc(tile, old_player, new_player);
|
||||
}
|
||||
|
@ -468,13 +468,13 @@ static void GenerateTerrain(int type, int flag)
|
|||
uint y;
|
||||
uint w;
|
||||
uint h;
|
||||
const Sprite* template;
|
||||
const Sprite* templ;
|
||||
const byte *p;
|
||||
Tile* tile;
|
||||
byte direction;
|
||||
|
||||
r = Random();
|
||||
template = GetSprite((((r >> 24) * _genterrain_tbl_1[type]) >> 8) + _genterrain_tbl_2[type] + 4845);
|
||||
templ = GetSprite((((r >> 24) * _genterrain_tbl_1[type]) >> 8) + _genterrain_tbl_2[type] + 4845);
|
||||
|
||||
x = r & MapMaxX();
|
||||
y = (r >> MapLogX()) & MapMaxY();
|
||||
|
@ -484,13 +484,13 @@ static void GenerateTerrain(int type, int flag)
|
|||
|
||||
direction = GB(r, 22, 2);
|
||||
if (direction & 1) {
|
||||
w = template->height;
|
||||
h = template->width;
|
||||
w = templ->height;
|
||||
h = templ->width;
|
||||
} else {
|
||||
w = template->width;
|
||||
h = template->height;
|
||||
w = templ->width;
|
||||
h = templ->height;
|
||||
}
|
||||
p = template->data;
|
||||
p = templ->data;
|
||||
|
||||
if (flag & 4) {
|
||||
uint xw = x * MapSizeY();
|
||||
|
|
|
@ -3,10 +3,12 @@
|
|||
#ifndef LIVERY_H
|
||||
#define LIVERY_H
|
||||
|
||||
#include "helpers.hpp"
|
||||
|
||||
/* List of different livery schemes. */
|
||||
typedef enum LiverySchemes {
|
||||
LS_DEFAULT,
|
||||
LS_BEGIN = 0,
|
||||
LS_DEFAULT = 0,
|
||||
|
||||
/* Rail vehicles */
|
||||
LS_STEAM,
|
||||
|
@ -37,6 +39,7 @@ typedef enum LiverySchemes {
|
|||
LS_END
|
||||
} LiveryScheme;
|
||||
|
||||
DECLARE_POSTFIX_INCREMENT(LiveryScheme);
|
||||
|
||||
/* List of different livery classes, used only by the livery GUI. */
|
||||
typedef enum LiveryClasses {
|
||||
|
|
|
@ -20,9 +20,10 @@
|
|||
#undef max
|
||||
#endif
|
||||
|
||||
static inline int min(int a, int b) { if (a <= b) return a; return b; }
|
||||
static inline int max(int a, int b) { if (a >= b) return a; return b; }
|
||||
static inline int64 max64(int64 a, int64 b) { if (a >= b) return a; return b; }
|
||||
static inline double dmax(double a, double b) { if (a >= b) return a; return b; }
|
||||
static inline uint64 max64(uint64 a, uint64 b) { if (a >= b) return a; return b; }
|
||||
static inline int min(int a, int b) { if (a <= b) return a; return b; }
|
||||
|
||||
static inline uint minu(uint a, uint b) { if (a <= b) return a; return b; }
|
||||
static inline uint maxu(uint a, uint b) { if (a >= b) return a; return b; }
|
||||
|
@ -136,15 +137,11 @@ static inline int KillFirstBit2x64(int value)
|
|||
|
||||
#define abs myabs
|
||||
|
||||
|
||||
static inline int intxchg_(int *a, int b) { int t = *a; *a = b; return t; }
|
||||
#define intswap(a,b) ((b) = intxchg_(&(a), (b)))
|
||||
static inline int uintxchg_(uint *a, uint b) { uint t = *a; *a = b; return t; }
|
||||
#define uintswap(a,b) ((b) = uintxchg_(&(a), (b)))
|
||||
|
||||
static inline int myabs(int a) { if (a<0) a = -a; return a; }
|
||||
static inline int64 myabs64(int64 a) { if (a<0) a = -a; return a; }
|
||||
|
||||
static inline void swap_byte(byte *a, byte *b) { byte t = *a; *a = *b; *b = t; }
|
||||
static inline void swap_uint16(uint16 *a, uint16 *b) { uint16 t = *a; *a = *b; *b = t; }
|
||||
static inline void swap_int16(int16 *a, int16 *b) { int16 t = *a; *a = *b; *b = t; }
|
||||
|
|
|
@ -215,12 +215,12 @@ static void MenuClickSubsidies(int index)
|
|||
|
||||
static void MenuClickStations(int index)
|
||||
{
|
||||
ShowPlayerStations(index);
|
||||
ShowPlayerStations((PlayerID)index);
|
||||
}
|
||||
|
||||
static void MenuClickFinances(int index)
|
||||
{
|
||||
ShowPlayerFinances(index);
|
||||
ShowPlayerFinances((PlayerID)index);
|
||||
}
|
||||
|
||||
static void MenuClickCompany(int index)
|
||||
|
@ -229,7 +229,7 @@ static void MenuClickCompany(int index)
|
|||
ShowClientList();
|
||||
} else {
|
||||
if (_networking) index--;
|
||||
ShowPlayerCompany(index);
|
||||
ShowPlayerCompany((PlayerID)index);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -263,27 +263,27 @@ static void MenuClickIndustry(int index)
|
|||
|
||||
static void MenuClickShowTrains(int index)
|
||||
{
|
||||
ShowVehicleListWindow(index, INVALID_STATION, VEH_Train);
|
||||
ShowVehicleListWindow((PlayerID)index, INVALID_STATION, VEH_Train);
|
||||
}
|
||||
|
||||
static void MenuClickShowRoad(int index)
|
||||
{
|
||||
ShowVehicleListWindow(index, INVALID_STATION, VEH_Road);
|
||||
ShowVehicleListWindow((PlayerID)index, INVALID_STATION, VEH_Road);
|
||||
}
|
||||
|
||||
static void MenuClickShowShips(int index)
|
||||
{
|
||||
ShowVehicleListWindow(index, INVALID_STATION, VEH_Ship);
|
||||
ShowVehicleListWindow((PlayerID)index, INVALID_STATION, VEH_Ship);
|
||||
}
|
||||
|
||||
static void MenuClickShowAir(int index)
|
||||
{
|
||||
ShowVehicleListWindow(index, INVALID_STATION, VEH_Aircraft);
|
||||
ShowVehicleListWindow((PlayerID)index, INVALID_STATION, VEH_Aircraft);
|
||||
}
|
||||
|
||||
static void MenuClickBuildRail(int index)
|
||||
{
|
||||
_last_built_railtype = index;
|
||||
_last_built_railtype = (RailType)index;
|
||||
ShowBuildRailToolbar(_last_built_railtype, -1);
|
||||
}
|
||||
|
||||
|
@ -1564,7 +1564,7 @@ static bool AnyTownExists(void)
|
|||
return false;
|
||||
}
|
||||
|
||||
extern Industry *CreateNewIndustry(TileIndex tile, int type);
|
||||
extern Industry *CreateNewIndustry(TileIndex tile, IndustryType type);
|
||||
|
||||
/**
|
||||
* Search callback function for TryBuildIndustry
|
||||
|
@ -2283,7 +2283,7 @@ static void MainWindowWndProc(Window *w, WindowEvent *e)
|
|||
case '1' | WKC_ALT: /* Gimme money */
|
||||
/* Server can not cheat in advertise mode either! */
|
||||
if (!_networking || !_network_server || !_network_advertise)
|
||||
DoCommandP(0, -10000000, 0, NULL, CMD_MONEY_CHEAT);
|
||||
DoCommandP(0, 10000000, 0, NULL, CMD_MONEY_CHEAT);
|
||||
break;
|
||||
|
||||
case '2' | WKC_ALT: /* Update the coordinates of all station signs */
|
||||
|
@ -2430,7 +2430,7 @@ void GameSizeChanged(void)
|
|||
void InitializeMainGui(void)
|
||||
{
|
||||
/* Clean old GUI values */
|
||||
_last_built_railtype = 0;
|
||||
_last_built_railtype = RAILTYPE_RAIL;
|
||||
}
|
||||
|
||||
|
||||
|
|
21
src/map.cpp
21
src/map.cpp
|
@ -7,10 +7,11 @@
|
|||
#include "macros.h"
|
||||
#include "map.h"
|
||||
#include "direction.h"
|
||||
#include "helpers.hpp"
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1400 /* VStudio 2005 is stupid! */
|
||||
/* Why the hell is that not in all MSVC headers?? */
|
||||
_CRTIMP void __cdecl _assert(void *, void *, unsigned);
|
||||
extern "C" _CRTIMP void __cdecl _assert(void *, void *, unsigned);
|
||||
#endif
|
||||
|
||||
uint _map_log_x;
|
||||
|
@ -41,7 +42,7 @@ void AllocateMap(uint size_x, uint size_y)
|
|||
_map_tile_mask = _map_size - 1;
|
||||
|
||||
free(_m);
|
||||
_m = calloc(_map_size, sizeof(*_m));
|
||||
CallocT(&_m, _map_size);
|
||||
|
||||
// XXX TODO handle memory shortage more gracefully
|
||||
if (_m == NULL) error("Failed to allocate memory for the map");
|
||||
|
@ -121,14 +122,14 @@ uint TileAddWrap(TileIndex tile, int addx, int addy)
|
|||
return INVALID_TILE;
|
||||
}
|
||||
|
||||
const TileIndexDiffC _tileoffs_by_diagdir[] = {
|
||||
extern const TileIndexDiffC _tileoffs_by_diagdir[] = {
|
||||
{-1, 0}, // DIAGDIR_NE
|
||||
{ 0, 1}, // DIAGDIR_SE
|
||||
{ 1, 0}, // DIAGDIR_SW
|
||||
{ 0, -1} // DIAGDIR_NW
|
||||
};
|
||||
|
||||
const TileIndexDiffC _tileoffs_by_dir[] = {
|
||||
extern const TileIndexDiffC _tileoffs_by_dir[] = {
|
||||
{-1, -1}, // DIR_N
|
||||
{-1, 0}, // DIR_NE
|
||||
{-1, 1}, // DIR_E
|
||||
|
@ -141,8 +142,8 @@ const TileIndexDiffC _tileoffs_by_dir[] = {
|
|||
|
||||
uint DistanceManhattan(TileIndex t0, TileIndex t1)
|
||||
{
|
||||
const uint dx = abs(TileX(t0) - TileX(t1));
|
||||
const uint dy = abs(TileY(t0) - TileY(t1));
|
||||
const uint dx = delta(TileX(t0), TileX(t1));
|
||||
const uint dy = delta(TileY(t0), TileY(t1));
|
||||
return dx + dy;
|
||||
}
|
||||
|
||||
|
@ -157,16 +158,16 @@ uint DistanceSquare(TileIndex t0, TileIndex t1)
|
|||
|
||||
uint DistanceMax(TileIndex t0, TileIndex t1)
|
||||
{
|
||||
const uint dx = abs(TileX(t0) - TileX(t1));
|
||||
const uint dy = abs(TileY(t0) - TileY(t1));
|
||||
const uint dx = delta(TileX(t0), TileX(t1));
|
||||
const uint dy = delta(TileY(t0), TileY(t1));
|
||||
return dx > dy ? dx : dy;
|
||||
}
|
||||
|
||||
|
||||
uint DistanceMaxPlusManhattan(TileIndex t0, TileIndex t1)
|
||||
{
|
||||
const uint dx = abs(TileX(t0) - TileX(t1));
|
||||
const uint dy = abs(TileY(t0) - TileY(t1));
|
||||
const uint dx = delta(TileX(t0), TileX(t1));
|
||||
const uint dy = delta(TileY(t0), TileY(t1));
|
||||
return dx > dy ? 2 * dx + dy : 2 * dy + dx;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,13 +67,6 @@ static inline TileIndex TileVirtXY(uint x, uint y)
|
|||
return (y >> 4 << MapLogX()) + (x >> 4);
|
||||
}
|
||||
|
||||
typedef byte Owner;
|
||||
enum Owners {
|
||||
OWNER_TOWN = 0x0F, // a town owns the tile
|
||||
OWNER_NONE = 0x10, // nobody owns the tile
|
||||
OWNER_WATER = 0x11, // "water" owns the tile
|
||||
OWNER_END = 0x12,
|
||||
};
|
||||
|
||||
enum {
|
||||
INVALID_TILE = (TileIndex)-1
|
||||
|
|
|
@ -611,13 +611,13 @@ static void Load_CHTS(void)
|
|||
uint i;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
cht[i].been_used = SlReadByte();
|
||||
cht[i].value = SlReadByte();
|
||||
cht[i].been_used = (SlReadByte() != 0);
|
||||
cht[i].value = (SlReadByte() != 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const ChunkHandler _misc_chunk_handlers[] = {
|
||||
extern const ChunkHandler _misc_chunk_handlers[] = {
|
||||
{ 'MAPS', Save_MAPS, Load_MAPS, CH_RIFF },
|
||||
{ 'MAPT', Save_MAPT, Load_MAPT, CH_RIFF },
|
||||
{ 'MAPO', Save_MAP1, Load_MAP1, CH_RIFF },
|
||||
|
|
|
@ -40,7 +40,7 @@ int32 CmdSetPlayerColor(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||
{
|
||||
Player *p, *pp;
|
||||
byte colour;
|
||||
LiveryScheme scheme = GB(p1, 0, 8);
|
||||
LiveryScheme scheme = (LiveryScheme)GB(p1, 0, 8);
|
||||
byte state = GB(p1, 8, 2);
|
||||
|
||||
if (p2 >= 16) return CMD_ERROR; // max 16 colours
|
||||
|
@ -271,7 +271,7 @@ int32 CmdMoneyCheat(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||
if (_networking) return CMD_ERROR;
|
||||
#endif
|
||||
SET_EXPENSES_TYPE(EXPENSES_OTHER);
|
||||
return (int32)p1;
|
||||
return -(int32)p1;
|
||||
}
|
||||
|
||||
/** Transfer funds (money) from one player to another.
|
||||
|
@ -296,7 +296,7 @@ int32 CmdGiveMoney(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
|
|||
if (flags & DC_EXEC) {
|
||||
/* Add money to player */
|
||||
PlayerID old_cp = _current_player;
|
||||
_current_player = p2;
|
||||
_current_player = (PlayerID)p2;
|
||||
SubtractMoneyFromPlayer(-amount);
|
||||
_current_player = old_cp;
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ static void Place_LandInfo(TileIndex tile)
|
|||
w = AllocateWindowDesc(&_land_info_desc);
|
||||
WP(w, void_d).data = &_landinfo_data;
|
||||
|
||||
p = GetPlayer(IsValidPlayer(_local_player) ? _local_player : 0);
|
||||
p = GetPlayer(IsValidPlayer(_local_player) ? _local_player : PLAYER_FIRST);
|
||||
t = ClosestTownFromTile(tile, _patches.dist_local_authority);
|
||||
|
||||
old_money = p->money64;
|
||||
|
@ -166,7 +166,7 @@ static void Place_LandInfo(TileIndex tile)
|
|||
|
||||
if (td.build_date != 0) {
|
||||
SetDParam(0, td.build_date);
|
||||
GetString(_landinfo_data[6], STR_BUILD_DATE, lastof(_landinfo_data[6]));
|
||||
GetString(_landinfo_data[6], STR_BUILD_DATE, lastof(_landinfo_data[6]));
|
||||
} else {
|
||||
_landinfo_data[6][0] = '\0';
|
||||
}
|
||||
|
@ -505,7 +505,7 @@ static void ErrmsgWndProc(Window *w, WindowEvent *e)
|
|||
_errmsg_message_1,
|
||||
238);
|
||||
} else {
|
||||
const Player *p = GetPlayer(GetDParamX(_errmsg_decode_params,2));
|
||||
const Player *p = GetPlayer((PlayerID)GetDParamX(_errmsg_decode_params,2));
|
||||
DrawPlayerFace(p->face, p->player_color, 2, 16);
|
||||
|
||||
DrawStringMultiCenter(
|
||||
|
@ -1383,7 +1383,7 @@ static void GenerateFileName(void)
|
|||
{
|
||||
/* Check if we are not a specatator who wants to generate a name..
|
||||
Let's use the name of player #0 for now. */
|
||||
const Player *p = GetPlayer(IsValidPlayer(_local_player) ? _local_player : 0);
|
||||
const Player *p = GetPlayer(IsValidPlayer(_local_player) ? _local_player : PLAYER_FIRST);
|
||||
|
||||
SetDParam(0, p->name_1);
|
||||
SetDParam(1, p->name_2);
|
||||
|
@ -1691,7 +1691,7 @@ void SetFiosType(const byte fiostype)
|
|||
|
||||
static int32 ClickMoneyCheat(int32 p1, int32 p2)
|
||||
{
|
||||
DoCommandP(0, -10000000, 0, NULL, CMD_MONEY_CHEAT);
|
||||
DoCommandP(0, 10000000, 0, NULL, CMD_MONEY_CHEAT);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -1739,9 +1739,17 @@ static int32 ClickChangeDateCheat(int32 p1, int32 p2)
|
|||
|
||||
typedef int32 CheckButtonClick(int32, int32);
|
||||
|
||||
enum ce_flags {CE_CLICK = 1 << 0};
|
||||
enum ce_flags_long
|
||||
{
|
||||
CE_NONE = 0,
|
||||
CE_CLICK = 1 << 0,
|
||||
CE_END = 1 << 1,
|
||||
};
|
||||
|
||||
/** Define basic enum properties */
|
||||
template <> struct EnumPropsT<ce_flags_long> : MakeEnumPropsT<ce_flags_long, byte, CE_NONE, CE_END, CE_END> {};
|
||||
typedef TinyEnumT<ce_flags_long> ce_flags;
|
||||
|
||||
typedef byte ce_flags;
|
||||
|
||||
typedef struct CheatEntry {
|
||||
VarType type; // type of selector
|
||||
|
@ -1754,15 +1762,15 @@ typedef struct CheatEntry {
|
|||
} CheatEntry;
|
||||
|
||||
static const CheatEntry _cheats_ui[] = {
|
||||
{SLE_BOOL,CE_CLICK, STR_CHEAT_MONEY, &_cheats.money.value, &_cheats.money.been_used, &ClickMoneyCheat, 0, 0},
|
||||
{SLE_UINT8, 0, STR_CHEAT_CHANGE_PLAYER, &_local_player, &_cheats.switch_player.been_used, &ClickChangePlayerCheat, 0, 11},
|
||||
{SLE_BOOL, 0, STR_CHEAT_EXTRA_DYNAMITE, &_cheats.magic_bulldozer.value, &_cheats.magic_bulldozer.been_used, NULL, 0, 0},
|
||||
{SLE_BOOL, 0, STR_CHEAT_CROSSINGTUNNELS,&_cheats.crossing_tunnels.value,&_cheats.crossing_tunnels.been_used,NULL, 0, 0},
|
||||
{SLE_BOOL, 0, STR_CHEAT_BUILD_IN_PAUSE, &_cheats.build_in_pause.value, &_cheats.build_in_pause.been_used, NULL, 0, 0},
|
||||
{SLE_BOOL, 0, STR_CHEAT_NO_JETCRASH, &_cheats.no_jetcrash.value, &_cheats.no_jetcrash.been_used, NULL, 0, 0},
|
||||
{SLE_BOOL, 0, STR_CHEAT_SETUP_PROD, &_cheats.setup_prod.value, &_cheats.setup_prod.been_used, NULL, 0, 0},
|
||||
{SLE_UINT8, 0, STR_CHEAT_SWITCH_CLIMATE, &_opt.landscape, &_cheats.switch_climate.been_used, &ClickChangeClimateCheat,-1, 4},
|
||||
{SLE_INT32, 0, STR_CHEAT_CHANGE_DATE, &_cur_year, &_cheats.change_date.been_used, &ClickChangeDateCheat, -1, 1},
|
||||
{SLE_BOOL, {CE_CLICK}, STR_CHEAT_MONEY, &_cheats.money.value, &_cheats.money.been_used, &ClickMoneyCheat, 0, 0},
|
||||
{SLE_UINT8, {CE_NONE}, STR_CHEAT_CHANGE_PLAYER, &_local_player, &_cheats.switch_player.been_used, &ClickChangePlayerCheat, 0, 11},
|
||||
{SLE_BOOL, {CE_NONE}, STR_CHEAT_EXTRA_DYNAMITE, &_cheats.magic_bulldozer.value, &_cheats.magic_bulldozer.been_used, NULL, 0, 0},
|
||||
{SLE_BOOL, {CE_NONE}, STR_CHEAT_CROSSINGTUNNELS,&_cheats.crossing_tunnels.value,&_cheats.crossing_tunnels.been_used,NULL, 0, 0},
|
||||
{SLE_BOOL, {CE_NONE}, STR_CHEAT_BUILD_IN_PAUSE, &_cheats.build_in_pause.value, &_cheats.build_in_pause.been_used, NULL, 0, 0},
|
||||
{SLE_BOOL, {CE_NONE}, STR_CHEAT_NO_JETCRASH, &_cheats.no_jetcrash.value, &_cheats.no_jetcrash.been_used, NULL, 0, 0},
|
||||
{SLE_BOOL, {CE_NONE}, STR_CHEAT_SETUP_PROD, &_cheats.setup_prod.value, &_cheats.setup_prod.been_used, NULL, 0, 0},
|
||||
{SLE_UINT8, {CE_NONE}, STR_CHEAT_SWITCH_CLIMATE, &_opt.landscape, &_cheats.switch_climate.been_used, &ClickChangeClimateCheat,-1, 4},
|
||||
{SLE_INT32, {CE_NONE}, STR_CHEAT_CHANGE_DATE, &_cur_year, &_cheats.change_date.been_used, &ClickChangeDateCheat, -1, 1},
|
||||
};
|
||||
|
||||
|
||||
|
@ -1801,14 +1809,14 @@ static void CheatsWndProc(Window *w, WindowEvent *e)
|
|||
bool on = (*(bool*)ce->variable);
|
||||
|
||||
if (ce->flags & CE_CLICK) {
|
||||
DrawFrameRect(x + 20, y + 1, x + 30 + 9, y + 9, 0, (clk - (i * 2) == 1) ? FR_LOWERED : 0);
|
||||
DrawFrameRect(x + 20, y + 1, x + 30 + 9, y + 9, 0, (clk - (i * 2) == 1) ? FR_LOWERED : FR_NONE);
|
||||
if (i == 0) { // XXX - hack/hack for first element which is increase money. Told ya it's a mess
|
||||
SetDParam64(0, 10000000);
|
||||
} else {
|
||||
SetDParam(0, false);
|
||||
}
|
||||
} else {
|
||||
DrawFrameRect(x + 20, y + 1, x + 30 + 9, y + 9, on ? 6 : 4, on ? FR_LOWERED : 0);
|
||||
DrawFrameRect(x + 20, y + 1, x + 30 + 9, y + 9, on ? 6 : 4, on ? FR_LOWERED : FR_NONE);
|
||||
SetDParam(0, on ? STR_CONFIG_PATCHES_ON : STR_CONFIG_PATCHES_OFF);
|
||||
}
|
||||
} break;
|
||||
|
|
|
@ -85,7 +85,7 @@ void MxMixSamples(void *buffer, uint samples)
|
|||
// Mix each channel
|
||||
for (mc = _channels; mc != endof(_channels); mc++) {
|
||||
if (mc->active) {
|
||||
mix_int8_to_int16(mc, buffer, samples);
|
||||
mix_int8_to_int16(mc, (int16*)buffer, samples);
|
||||
if (mc->samples_left == 0) MxCloseChannel(mc);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,12 +4,10 @@
|
|||
|
||||
#ifdef WIN32_ENABLE_DIRECTMUSIC_SUPPORT
|
||||
|
||||
extern "C" {
|
||||
#include "../openttd.h"
|
||||
#include "../debug.h"
|
||||
#include "../win32.h"
|
||||
#include "dmusic.h"
|
||||
}
|
||||
#include "../openttd.h"
|
||||
#include "../debug.h"
|
||||
#include "../win32.h"
|
||||
#include "dmusic.h"
|
||||
|
||||
#include <windows.h>
|
||||
#include <dmksctrl.h>
|
||||
|
|
|
@ -396,11 +396,11 @@ static void MusicWindowWndProc(Window *w, WindowEvent *e)
|
|||
DrawFrameRect(214, 23, 280, 26, 14, FR_LOWERED);
|
||||
|
||||
DrawFrameRect(
|
||||
108 + msf.music_vol / 2, 22, 111 + msf.music_vol / 2, 28, 14, 0
|
||||
108 + msf.music_vol / 2, 22, 111 + msf.music_vol / 2, 28, 14, FR_NONE
|
||||
);
|
||||
|
||||
DrawFrameRect(
|
||||
214 + msf.effect_vol / 2, 22, 217 + msf.effect_vol / 2, 28, 14, 0
|
||||
214 + msf.effect_vol / 2, 22, 217 + msf.effect_vol / 2, 28, 14, FR_NONE
|
||||
);
|
||||
} break;
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#include "../../stdafx.h"
|
||||
#include "../../macros.h"
|
||||
#include "../../string.h"
|
||||
#include "../../helpers.hpp"
|
||||
#include "../network_data.h"
|
||||
|
||||
#include "packet.h"
|
||||
|
||||
|
@ -24,7 +26,8 @@ extern void NORETURN CDECL error(const char *str, ...);
|
|||
*/
|
||||
Packet *NetworkSend_Init(const PacketType type)
|
||||
{
|
||||
Packet *packet = malloc(sizeof(Packet));
|
||||
Packet *packet;
|
||||
MallocT(&packet, 1);
|
||||
/* An error is inplace here, because it simply means we ran out of memory. */
|
||||
if (packet == NULL) error("Failed to allocate Packet");
|
||||
|
||||
|
@ -109,7 +112,7 @@ void NetworkSend_string(Packet *packet, const char* data)
|
|||
*/
|
||||
|
||||
|
||||
extern uint CloseConnection(NetworkClientState *cs);
|
||||
extern NetworkRecvStatus CloseConnection(NetworkClientState *cs);
|
||||
|
||||
/** Is it safe to read from the packet, i.e. didn't we run over the buffer ? */
|
||||
static inline bool CanReadFromPacket(NetworkClientState *cs, const Packet *packet, const uint bytes_to_read)
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "../network_data.h"
|
||||
#include "packet.h"
|
||||
#include "tcp.h"
|
||||
#include "../../helpers.hpp"
|
||||
|
||||
/**
|
||||
* @file tcp.c Basic functions to receive and send TCP packets.
|
||||
|
@ -99,7 +100,7 @@ bool NetworkSend_Packets(NetworkClientState *cs)
|
|||
|
||||
p = cs->packet_queue;
|
||||
while (p != NULL) {
|
||||
res = send(cs->socket, p->buffer + p->pos, p->size - p->pos, 0);
|
||||
res = send(cs->socket, (const char*)p->buffer + p->pos, p->size - p->pos, 0);
|
||||
if (res == -1) {
|
||||
int err = GET_LAST_ERROR();
|
||||
if (err != EWOULDBLOCK) {
|
||||
|
@ -148,7 +149,7 @@ Packet *NetworkRecv_Packet(NetworkClientState *cs, NetworkRecvStatus *status)
|
|||
if (cs->socket == INVALID_SOCKET) return NULL;
|
||||
|
||||
if (cs->packet_recv == NULL) {
|
||||
cs->packet_recv = malloc(sizeof(Packet));
|
||||
MallocT(&cs->packet_recv, 1);
|
||||
if (cs->packet_recv == NULL) error("Failed to allocate packet");
|
||||
/* Set pos to zero! */
|
||||
cs->packet_recv->pos = 0;
|
||||
|
@ -161,7 +162,7 @@ Packet *NetworkRecv_Packet(NetworkClientState *cs, NetworkRecvStatus *status)
|
|||
if (p->pos < sizeof(PacketSize)) {
|
||||
while (p->pos < sizeof(PacketSize)) {
|
||||
/* Read the size of the packet */
|
||||
res = recv(cs->socket, p->buffer + p->pos, sizeof(PacketSize) - p->pos, 0);
|
||||
res = recv(cs->socket, (char*)p->buffer + p->pos, sizeof(PacketSize) - p->pos, 0);
|
||||
if (res == -1) {
|
||||
int err = GET_LAST_ERROR();
|
||||
if (err != EWOULDBLOCK) {
|
||||
|
@ -191,7 +192,7 @@ Packet *NetworkRecv_Packet(NetworkClientState *cs, NetworkRecvStatus *status)
|
|||
|
||||
/* Read rest of packet */
|
||||
while (p->pos < p->size) {
|
||||
res = recv(cs->socket, p->buffer + p->pos, p->size - p->pos, 0);
|
||||
res = recv(cs->socket, (char*)p->buffer + p->pos, p->size - p->pos, 0);
|
||||
if (res == -1) {
|
||||
int err = GET_LAST_ERROR();
|
||||
if (err != EWOULDBLOCK) {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "../../stdafx.h"
|
||||
#include "../../debug.h"
|
||||
#include "../../macros.h"
|
||||
#include "../../helpers.hpp"
|
||||
#include "packet.h"
|
||||
#include "udp.h"
|
||||
|
||||
|
@ -92,7 +93,7 @@ void NetworkSendUDP_Packet(const SOCKET udp, Packet *p, const struct sockaddr_in
|
|||
NetworkSend_FillPacketSize(p);
|
||||
|
||||
/* Send the buffer */
|
||||
res = sendto(udp, p->buffer, p->size, 0, (struct sockaddr *)recv, sizeof(*recv));
|
||||
res = sendto(udp, (const char*)p->buffer, p->size, 0, (struct sockaddr *)recv, sizeof(*recv));
|
||||
|
||||
/* Check for any errors, but ignore it otherwise */
|
||||
if (res == -1) DEBUG(net, 1, "[udp] sendto failed with: %i", GET_LAST_ERROR());
|
||||
|
@ -114,7 +115,7 @@ void NetworkUDPReceive(const SOCKET udp)
|
|||
client_len = sizeof(client_addr);
|
||||
|
||||
/* Try to receive anything */
|
||||
nbytes = recvfrom(udp, p.buffer, packet_len, 0, (struct sockaddr *)&client_addr, &client_len);
|
||||
nbytes = recvfrom(udp, (char*)p.buffer, packet_len, 0, (struct sockaddr *)&client_addr, &client_len);
|
||||
|
||||
/* We got some bytes for the base header of the packet. */
|
||||
if (nbytes > 2) {
|
||||
|
@ -256,7 +257,7 @@ void NetworkRecv_NetworkGameInfo(NetworkClientState *cs, Packet *p, NetworkGameI
|
|||
uint num_grfs = NetworkRecv_uint8(cs, p);
|
||||
|
||||
for (i = 0; i < num_grfs; i++) {
|
||||
c = calloc(1, sizeof(*c));
|
||||
CallocT(&c, 1);
|
||||
NetworkRecv_GRFIdentifier(cs, p, c);
|
||||
HandleIncomingNetworkGameInfoGRFConfig(c);
|
||||
|
||||
|
@ -290,7 +291,7 @@ void NetworkRecv_NetworkGameInfo(NetworkClientState *cs, Packet *p, NetworkGameI
|
|||
info->map_width = NetworkRecv_uint16(cs, p);
|
||||
info->map_height = NetworkRecv_uint16(cs, p);
|
||||
info->map_set = NetworkRecv_uint8 (cs, p);
|
||||
info->dedicated = NetworkRecv_uint8 (cs, p);
|
||||
info->dedicated = (NetworkRecv_uint8 (cs, p) != 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
extern const char _openttd_revision[];
|
||||
#elif defined(WITH_REV_HACK)
|
||||
#define WITH_REV
|
||||
const char _openttd_revision[] = WITH_REV_HACK;
|
||||
extern const char _openttd_revision[] = WITH_REV_HACK;
|
||||
#else
|
||||
const char _openttd_revision[] = NOREV_STRING;
|
||||
extern const char _openttd_revision[] = NOREV_STRING;
|
||||
#endif
|
||||
|
||||
|
||||
|
@ -38,6 +38,19 @@
|
|||
#include <stdarg.h> /* va_list */
|
||||
#include "../md5.h"
|
||||
|
||||
// global variables (declared in network_data.h)
|
||||
CommandPacket *_local_command_queue;
|
||||
|
||||
SOCKET _udp_client_socket; // udp client socket
|
||||
SOCKET _udp_server_socket; // udp server socket
|
||||
SOCKET _udp_master_socket; // udp master socket
|
||||
|
||||
// Here we keep track of the clients
|
||||
// (and the client uses [0] for his own communication)
|
||||
NetworkClientState _clients[MAX_CLIENTS];
|
||||
|
||||
|
||||
|
||||
// The listen socket for the server
|
||||
static SOCKET _listensocket;
|
||||
|
||||
|
@ -277,7 +290,7 @@ char* GetNetworkErrorMsg(char* buf, NetworkErrorCode err, const char* last)
|
|||
STR_NETWORK_ERR_CLIENT_SERVER_FULL
|
||||
};
|
||||
|
||||
if (err >= lengthof(network_error_strings)) err = 0;
|
||||
if (err >= (ptrdiff_t)lengthof(network_error_strings)) err = NETWORK_ERROR_GENERAL;
|
||||
|
||||
return GetString(buf, network_error_strings[err], last);
|
||||
}
|
||||
|
@ -729,7 +742,7 @@ static void NetworkAcceptClients(void)
|
|||
p->buffer[0] = p->size & 0xFF;
|
||||
p->buffer[1] = p->size >> 8;
|
||||
|
||||
send(s, p->buffer, p->size, 0);
|
||||
send(s, (const char*)p->buffer, p->size, 0);
|
||||
closesocket(s);
|
||||
|
||||
free(p);
|
||||
|
@ -750,7 +763,7 @@ static void NetworkAcceptClients(void)
|
|||
p->buffer[0] = p->size & 0xFF;
|
||||
p->buffer[1] = p->size >> 8;
|
||||
|
||||
send(s, p->buffer, p->size, 0);
|
||||
send(s, (const char*)p->buffer, p->size, 0);
|
||||
closesocket(s);
|
||||
|
||||
free(p);
|
||||
|
@ -1032,7 +1045,7 @@ bool NetworkServerStart(void)
|
|||
_network_own_client_index = NETWORK_SERVER_INDEX;
|
||||
|
||||
/* Non-dedicated server will always be player #1 */
|
||||
if (!_network_dedicated) _network_playas = 0;
|
||||
if (!_network_dedicated) _network_playas = PLAYER_FIRST;
|
||||
|
||||
_network_clients_connected = 0;
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ typedef struct NetworkClientInfo {
|
|||
uint16 client_index; // Index of the client (same as ClientState->index)
|
||||
char client_name[NETWORK_CLIENT_NAME_LENGTH]; // Name of the client
|
||||
byte client_lang; // The language of the client
|
||||
byte client_playas; // As which player is this client playing (PlayerID)
|
||||
PlayerID client_playas; // As which player is this client playing (PlayerID)
|
||||
uint32 client_ip; // IP-address of the client (so he can be banned)
|
||||
Date join_date; // Gamedate the player has joined
|
||||
char unique_id[NETWORK_NAME_LENGTH]; // Every play sends an unique id so we can indentify him
|
||||
|
@ -188,7 +188,6 @@ bool NetworkClientConnectGame(const char *host, uint16 port);
|
|||
void NetworkReboot(void);
|
||||
void NetworkDisconnect(void);
|
||||
|
||||
VARDEF bool _networking; ///< are we in networking mode?
|
||||
VARDEF bool _network_server; ///< network-server is active
|
||||
VARDEF bool _network_available; ///< is network mode available?
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "../console.h"
|
||||
#include "../variables.h"
|
||||
#include "../ai/ai.h"
|
||||
|
||||
#include "../helpers.hpp"
|
||||
|
||||
// This file handles all the client-commands
|
||||
|
||||
|
@ -286,14 +286,14 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_COMPANY_INFO)
|
|||
|
||||
if (!MY_CLIENT->has_quit && company_info_version == NETWORK_COMPANY_INFO_VERSION) {
|
||||
byte total;
|
||||
byte current;
|
||||
PlayerID current;
|
||||
|
||||
total = NetworkRecv_uint8(MY_CLIENT, p);
|
||||
|
||||
// There is no data at all..
|
||||
if (total == 0) return NETWORK_RECV_STATUS_CLOSE_QUERY;
|
||||
|
||||
current = NetworkRecv_uint8(MY_CLIENT, p);
|
||||
current = (Owner)NetworkRecv_uint8(MY_CLIENT, p);
|
||||
if (!IsValidPlayer(current)) return NETWORK_RECV_STATUS_CLOSE_QUERY;
|
||||
|
||||
NetworkRecv_string(MY_CLIENT, p, _network_player_info[current].company_name, sizeof(_network_player_info[current].company_name));
|
||||
|
@ -325,7 +325,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_CLIENT_INFO)
|
|||
{
|
||||
NetworkClientInfo *ci;
|
||||
uint16 index = NetworkRecv_uint16(MY_CLIENT, p);
|
||||
PlayerID playas = NetworkRecv_uint8(MY_CLIENT, p);
|
||||
PlayerID playas = (Owner)NetworkRecv_uint8(MY_CLIENT, p);
|
||||
char name[NETWORK_NAME_LENGTH];
|
||||
char unique_id[NETWORK_NAME_LENGTH];
|
||||
|
||||
|
@ -375,7 +375,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_CLIENT_INFO)
|
|||
|
||||
DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_ERROR)
|
||||
{
|
||||
NetworkErrorCode error = NetworkRecv_uint8(MY_CLIENT, p);
|
||||
NetworkErrorCode error = (NetworkErrorCode)NetworkRecv_uint8(MY_CLIENT, p);
|
||||
|
||||
switch (error) {
|
||||
/* We made an error in the protocol, and our connection is closed.... */
|
||||
|
@ -410,7 +410,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_ERROR)
|
|||
|
||||
DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_NEED_PASSWORD)
|
||||
{
|
||||
NetworkPasswordType type = NetworkRecv_uint8(MY_CLIENT, p);
|
||||
NetworkPasswordType type = (NetworkPasswordType)NetworkRecv_uint8(MY_CLIENT, p);
|
||||
|
||||
switch (type) {
|
||||
case NETWORK_GAME_PASSWORD:
|
||||
|
@ -570,8 +570,9 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_SYNC)
|
|||
|
||||
DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_COMMAND)
|
||||
{
|
||||
CommandPacket *cp = malloc(sizeof(CommandPacket));
|
||||
cp->player = NetworkRecv_uint8(MY_CLIENT, p);
|
||||
CommandPacket *cp;
|
||||
MallocT(&cp, 1);
|
||||
cp->player = (PlayerID)NetworkRecv_uint8(MY_CLIENT, p);
|
||||
cp->cmd = NetworkRecv_uint32(MY_CLIENT, p);
|
||||
cp->p1 = NetworkRecv_uint32(MY_CLIENT, p);
|
||||
cp->p2 = NetworkRecv_uint32(MY_CLIENT, p);
|
||||
|
@ -601,9 +602,9 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_CHAT)
|
|||
char name[NETWORK_NAME_LENGTH], msg[MAX_TEXT_MSG_LEN];
|
||||
const NetworkClientInfo *ci = NULL, *ci_to;
|
||||
|
||||
NetworkAction action = NetworkRecv_uint8(MY_CLIENT, p);
|
||||
NetworkAction action = (NetworkAction)NetworkRecv_uint8(MY_CLIENT, p);
|
||||
uint16 index = NetworkRecv_uint16(MY_CLIENT, p);
|
||||
bool self_send = NetworkRecv_uint8(MY_CLIENT, p);
|
||||
bool self_send = (NetworkRecv_uint8(MY_CLIENT, p) != 0);
|
||||
NetworkRecv_string(MY_CLIENT, p, msg, MAX_TEXT_MSG_LEN);
|
||||
|
||||
ci_to = NetworkFindClientInfoFromIndex(index);
|
||||
|
@ -623,7 +624,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_CHAT)
|
|||
if (!IsValidPlayer(ci_to->client_playas)) return NETWORK_RECV_STATUS_OKAY;
|
||||
/* fallthrough */
|
||||
case NETWORK_ACTION_CHAT_COMPANY: {
|
||||
StringID str = IsValidPlayer(ci_to->client_playas) ? GetPlayer(ci_to->client_playas)->name_1 : STR_NETWORK_SPECTATORS;
|
||||
StringID str = IsValidPlayer(ci_to->client_playas) ? GetPlayer(ci_to->client_playas)->name_1 : (uint16)STR_NETWORK_SPECTATORS;
|
||||
|
||||
GetString(name, str, lastof(name));
|
||||
ci = NetworkFindClientInfoFromIndex(_network_own_client_index);
|
||||
|
@ -649,7 +650,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER_ERROR_QUIT)
|
|||
NetworkClientInfo *ci;
|
||||
|
||||
index = NetworkRecv_uint16(MY_CLIENT, p);
|
||||
GetNetworkErrorMsg(str, NetworkRecv_uint8(MY_CLIENT, p), lastof(str));
|
||||
GetNetworkErrorMsg(str, (NetworkErrorCode)NetworkRecv_uint8(MY_CLIENT, p), lastof(str));
|
||||
|
||||
ci = NetworkFindClientInfoFromIndex(index);
|
||||
if (ci != NULL) {
|
||||
|
|
|
@ -9,11 +9,13 @@
|
|||
#include "network_client.h"
|
||||
#include "../command.h"
|
||||
#include "../callback_table.h"
|
||||
#include "../helpers.hpp"
|
||||
|
||||
// Add a command to the local command queue
|
||||
void NetworkAddCommandQueue(NetworkClientState *cs, CommandPacket *cp)
|
||||
{
|
||||
CommandPacket* new_cp = malloc(sizeof(*new_cp));
|
||||
CommandPacket* new_cp;
|
||||
MallocT(&new_cp, 1);
|
||||
|
||||
*new_cp = *cp;
|
||||
|
||||
|
@ -29,7 +31,8 @@ void NetworkAddCommandQueue(NetworkClientState *cs, CommandPacket *cp)
|
|||
// Prepare a DoCommand to be send over the network
|
||||
void NetworkSend_Command(TileIndex tile, uint32 p1, uint32 p2, uint32 cmd, CommandCallback *callback)
|
||||
{
|
||||
CommandPacket *c = malloc(sizeof(CommandPacket));
|
||||
CommandPacket *c;
|
||||
MallocT(&c, 1);
|
||||
byte temp_callback;
|
||||
|
||||
c->player = _local_player;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
typedef struct CommandPacket {
|
||||
struct CommandPacket *next;
|
||||
PlayerID player; /// player that is executing the command
|
||||
PlayerByte player; /// player that is executing the command
|
||||
uint32 cmd; /// command being executed
|
||||
uint32 p1; /// parameter p1
|
||||
uint32 p2; /// parameter p2
|
||||
|
@ -120,15 +120,17 @@ typedef enum {
|
|||
DESTTYPE_CLIENT, ///< Send message/notice to only a certain player (Private)
|
||||
} DestType;
|
||||
|
||||
CommandPacket *_local_command_queue;
|
||||
// following externs are instantiated at network.cpp
|
||||
extern CommandPacket *_local_command_queue;
|
||||
|
||||
SOCKET _udp_client_socket; // udp client socket
|
||||
SOCKET _udp_server_socket; // udp server socket
|
||||
SOCKET _udp_master_socket; // udp master socket
|
||||
extern SOCKET _udp_client_socket; // udp client socket
|
||||
extern SOCKET _udp_server_socket; // udp server socket
|
||||
extern SOCKET _udp_master_socket; // udp master socket
|
||||
|
||||
// Here we keep track of the clients
|
||||
// (and the client uses [0] for his own communication)
|
||||
NetworkClientState _clients[MAX_CLIENTS];
|
||||
extern NetworkClientState _clients[MAX_CLIENTS];
|
||||
|
||||
#define DEREF_CLIENT(i) (&_clients[i])
|
||||
// This returns the NetworkClientInfo from a NetworkClientState
|
||||
#define DEREF_CLIENT_INFO(cs) (&_network_client_info[cs - _clients])
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#include "../debug.h"
|
||||
#include "network_data.h"
|
||||
#include "../newgrf_config.h"
|
||||
#include "../helpers.hpp"
|
||||
|
||||
// This file handles the GameList
|
||||
// Also, it handles the request to a server for data about the server
|
||||
|
@ -25,7 +26,7 @@ NetworkGameList *NetworkGameListAddItem(uint32 ip, uint16 port)
|
|||
prev_item = item;
|
||||
}
|
||||
|
||||
item = malloc(sizeof(*item));
|
||||
MallocT(&item, 1);
|
||||
memset(item, 0, sizeof(*item));
|
||||
item->next = NULL;
|
||||
item->ip = ip;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "../string.h"
|
||||
#include "../town.h"
|
||||
#include "../newgrf.h"
|
||||
#include "../helpers.hpp"
|
||||
|
||||
#define BGC 5
|
||||
#define BTC 15
|
||||
|
@ -166,7 +167,7 @@ static void BuildNetworkGameList(network_ql_d *nqld)
|
|||
|
||||
/* Create temporary array of games to use for listing */
|
||||
free(nqld->sort_list);
|
||||
nqld->sort_list = malloc(n * sizeof(nqld->sort_list[0]));
|
||||
MallocT(&nqld->sort_list, n);
|
||||
if (nqld->sort_list == NULL) error("Could not allocate memory for the network-game-sorting-list");
|
||||
nqld->l.list_length = n;
|
||||
|
||||
|
@ -221,7 +222,7 @@ static void NetworkGameWindowWndProc(Window *w, WindowEvent *e)
|
|||
nd->server = NULL;
|
||||
|
||||
WP(w, network_ql_d).sort_list = NULL;
|
||||
ld->flags = VL_REBUILD | (_ng_sorting.order << (VL_DESC - 1));
|
||||
ld->flags = VL_REBUILD | (_ng_sorting.order ? VL_DESC : VL_NONE);
|
||||
ld->sort_type = _ng_sorting.criteria;
|
||||
break;
|
||||
|
||||
|
@ -787,19 +788,19 @@ static void ShowNetworkStartServerWindow(void)
|
|||
InitializeTextBuffer(&WP(w, network_ql_d).q.text, _edit_str_buf, lengthof(_edit_str_buf), 160);
|
||||
}
|
||||
|
||||
static byte NetworkLobbyFindCompanyIndex(byte pos)
|
||||
static PlayerID NetworkLobbyFindCompanyIndex(byte pos)
|
||||
{
|
||||
byte i;
|
||||
PlayerID i;
|
||||
|
||||
/* Scroll through all _network_player_info and get the 'pos' item
|
||||
that is not empty */
|
||||
for (i = 0; i < MAX_PLAYERS; i++) {
|
||||
for (i = PLAYER_FIRST; i < MAX_PLAYERS; i++) {
|
||||
if (_network_player_info[i].company_name[0] != '\0') {
|
||||
if (pos-- == 0) return i;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return PLAYER_FIRST;
|
||||
}
|
||||
|
||||
/* uses network_d WP macro */
|
||||
|
@ -809,7 +810,7 @@ static void NetworkLobbyWindowWndProc(Window *w, WindowEvent *e)
|
|||
|
||||
switch (e->event) {
|
||||
case WE_CREATE:
|
||||
nd->company = (byte)-1;
|
||||
nd->company = INVALID_PLAYER;
|
||||
break;
|
||||
|
||||
case WE_PAINT: {
|
||||
|
@ -919,7 +920,7 @@ static void NetworkLobbyWindowWndProc(Window *w, WindowEvent *e)
|
|||
if (id_v >= w->vscroll.cap) return;
|
||||
|
||||
id_v += w->vscroll.pos;
|
||||
nd->company = (id_v >= nd->server->info.companies_on) ? (byte)-1 : NetworkLobbyFindCompanyIndex(id_v);
|
||||
nd->company = (id_v >= nd->server->info.companies_on) ? INVALID_PLAYER : NetworkLobbyFindCompanyIndex(id_v);
|
||||
SetWindowDirty(w);
|
||||
} break;
|
||||
case 7: /* Join company */
|
||||
|
@ -1411,7 +1412,7 @@ static void NetworkJoinStatusWindowWndProc(Window *w, WindowEvent *e)
|
|||
}
|
||||
|
||||
/* Draw nice progress bar :) */
|
||||
DrawFrameRect(20, 18, (int)((w->width - 20) * progress / 100), 28, 10, 0);
|
||||
DrawFrameRect(20, 18, (int)((w->width - 20) * progress / 100), 28, 10, FR_NONE);
|
||||
} break;
|
||||
|
||||
case WE_CLICK:
|
||||
|
@ -1465,9 +1466,9 @@ static void SendChat(const char *buf, DestType type, byte dest)
|
|||
{
|
||||
if (buf[0] == '\0') return;
|
||||
if (!_network_server) {
|
||||
SEND_COMMAND(PACKET_CLIENT_CHAT)(NETWORK_ACTION_CHAT + type, type, dest, buf);
|
||||
SEND_COMMAND(PACKET_CLIENT_CHAT)((NetworkAction)(NETWORK_ACTION_CHAT + type), type, dest, buf);
|
||||
} else {
|
||||
NetworkServer_HandleChat(NETWORK_ACTION_CHAT + type, type, dest, buf, NETWORK_SERVER_INDEX);
|
||||
NetworkServer_HandleChat((NetworkAction)(NETWORK_ACTION_CHAT + type), type, dest, buf, NETWORK_SERVER_INDEX);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1635,7 +1636,7 @@ static void ChatWindowWndProc(Window *w, WindowEvent *e)
|
|||
case WE_CLICK:
|
||||
switch (e->we.click.widget) {
|
||||
case 3: { /* Send */
|
||||
DestType type = GB(WP(w, querystr_d).caption, 0, 8);
|
||||
DestType type = (DestType)GB(WP(w, querystr_d).caption, 0, 8);
|
||||
byte dest = GB(WP(w, querystr_d).caption, 8, 8);
|
||||
SendChat(WP(w, querystr_d).text.buf, type, dest);
|
||||
} /* FALLTHROUGH */
|
||||
|
@ -1654,7 +1655,7 @@ static void ChatWindowWndProc(Window *w, WindowEvent *e)
|
|||
_chat_tab_completion_active = false;
|
||||
switch (HandleEditBoxKey(w, &WP(w, querystr_d), 2, e)) {
|
||||
case 1: { /* Return */
|
||||
DestType type = GB(WP(w, querystr_d).caption, 0, 8);
|
||||
DestType type = (DestType)GB(WP(w, querystr_d).caption, 0, 8);
|
||||
byte dest = GB(WP(w, querystr_d).caption, 8, 8);
|
||||
SendChat(WP(w, querystr_d).text.buf, type, dest);
|
||||
} /* FALLTHROUGH */
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "network_data.h"
|
||||
|
||||
void ShowNetworkNeedPassword(NetworkPasswordType npt);
|
||||
void ShowNetworkGiveMoneyWindow(byte player); // PlayerID
|
||||
void ShowNetworkGiveMoneyWindow(PlayerID player); // PlayerID
|
||||
void ShowNetworkChatQueryWindow(DestType type, byte dest);
|
||||
void ShowJoinStatusWindow(void);
|
||||
void ShowNetworkGameWindow(void);
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "../station.h"
|
||||
#include "../variables.h"
|
||||
#include "../genworld.h"
|
||||
#include "../helpers.hpp"
|
||||
|
||||
// This file handles all the server-commands
|
||||
|
||||
|
@ -571,7 +572,7 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_JOIN)
|
|||
char name[NETWORK_CLIENT_NAME_LENGTH];
|
||||
char unique_id[NETWORK_NAME_LENGTH];
|
||||
NetworkClientInfo *ci;
|
||||
byte playas;
|
||||
PlayerID playas;
|
||||
NetworkLanguage client_lang;
|
||||
char client_revision[NETWORK_REVISION_LENGTH];
|
||||
|
||||
|
@ -588,8 +589,8 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_JOIN)
|
|||
#endif
|
||||
|
||||
NetworkRecv_string(cs, p, name, sizeof(name));
|
||||
playas = NetworkRecv_uint8(cs, p);
|
||||
client_lang = NetworkRecv_uint8(cs, p);
|
||||
playas = (Owner)NetworkRecv_uint8(cs, p);
|
||||
client_lang = (NetworkLanguage)NetworkRecv_uint8(cs, p);
|
||||
NetworkRecv_string(cs, p, unique_id, sizeof(unique_id));
|
||||
|
||||
if (cs->has_quit) return;
|
||||
|
@ -654,7 +655,7 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_PASSWORD)
|
|||
char password[NETWORK_PASSWORD_LENGTH];
|
||||
const NetworkClientInfo *ci;
|
||||
|
||||
type = NetworkRecv_uint8(cs, p);
|
||||
type = (NetworkPasswordType)NetworkRecv_uint8(cs, p);
|
||||
NetworkRecv_string(cs, p, password, sizeof(password));
|
||||
|
||||
if (cs->status == STATUS_INACTIVE && type == NETWORK_GAME_PASSWORD) {
|
||||
|
@ -792,7 +793,8 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_COMMAND)
|
|||
const NetworkClientInfo *ci;
|
||||
byte callback;
|
||||
|
||||
CommandPacket *cp = malloc(sizeof(CommandPacket));
|
||||
CommandPacket *cp;
|
||||
MallocT(&cp, 1);
|
||||
|
||||
// The client was never joined.. so this is impossible, right?
|
||||
// Ignore the packet, give the client a warning, and close his connection
|
||||
|
@ -801,7 +803,7 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_COMMAND)
|
|||
return;
|
||||
}
|
||||
|
||||
cp->player = NetworkRecv_uint8(cs, p);
|
||||
cp->player = (Owner)NetworkRecv_uint8(cs, p);
|
||||
cp->cmd = NetworkRecv_uint32(cs, p);
|
||||
cp->p1 = NetworkRecv_uint32(cs, p);
|
||||
cp->p2 = NetworkRecv_uint32(cs, p);
|
||||
|
@ -851,7 +853,7 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_COMMAND)
|
|||
/* XXX - Execute the command as a valid player. Normally this would be done by a
|
||||
* spectator, but that is not allowed any commands. So do an impersonation. The drawback
|
||||
* of this is that the first company's last_built_tile is also updated... */
|
||||
cp->player = 0;
|
||||
cp->player = OWNER_BEGIN;
|
||||
cp->p2 = cs - _clients; // XXX - UGLY! p2 is mis-used to get the client-id in CmdPlayerCtrl
|
||||
}
|
||||
|
||||
|
@ -890,7 +892,7 @@ DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_ERROR)
|
|||
NetworkClientState *new_cs;
|
||||
char str[100];
|
||||
char client_name[NETWORK_CLIENT_NAME_LENGTH];
|
||||
NetworkErrorCode errorno = NetworkRecv_uint8(cs, p);
|
||||
NetworkErrorCode errorno = (NetworkErrorCode)NetworkRecv_uint8(cs, p);
|
||||
|
||||
// The client was never joined.. thank the client for the packet, but ignore it
|
||||
if (cs->status < STATUS_DONE_MAP || cs->has_quit) {
|
||||
|
@ -1044,7 +1046,7 @@ void NetworkServer_HandleChat(NetworkAction action, DestType desttype, int dest,
|
|||
if (ci != NULL && show_local) {
|
||||
if (from_index == NETWORK_SERVER_INDEX) {
|
||||
char name[NETWORK_NAME_LENGTH];
|
||||
StringID str = IsValidPlayer(ci_to->client_playas) ? GetPlayer(ci_to->client_playas)->name_1 : STR_NETWORK_SPECTATORS;
|
||||
StringID str = IsValidPlayer(ci_to->client_playas) ? GetPlayer(ci_to->client_playas)->name_1 : (uint16)STR_NETWORK_SPECTATORS;
|
||||
GetString(name, str, lastof(name));
|
||||
NetworkTextMessage(action, GetDrawStringPlayerColor(ci_own->client_playas), true, name, "%s", msg);
|
||||
} else {
|
||||
|
@ -1073,8 +1075,8 @@ void NetworkServer_HandleChat(NetworkAction action, DestType desttype, int dest,
|
|||
|
||||
DEF_SERVER_RECEIVE_COMMAND(PACKET_CLIENT_CHAT)
|
||||
{
|
||||
NetworkAction action = NetworkRecv_uint8(cs, p);
|
||||
DestType desttype = NetworkRecv_uint8(cs, p);
|
||||
NetworkAction action = (NetworkAction)NetworkRecv_uint8(cs, p);
|
||||
DestType desttype = (DestType)NetworkRecv_uint8(cs, p);
|
||||
int dest = NetworkRecv_uint8(cs, p);
|
||||
char msg[MAX_TEXT_MSG_LEN];
|
||||
|
||||
|
|
|
@ -335,7 +335,7 @@ DEF_UDP_RECEIVE_COMMAND(PACKET_UDP_CLIENT_GET_NEWGRFS)
|
|||
* the current list and do not send the other data.
|
||||
* The name could be an empty string, if so take the filename. */
|
||||
packet_len += sizeof(c.grfid) + sizeof(c.md5sum) +
|
||||
min(strlen((f->name != NULL && strlen(f->name) > 0) ? f->name : f->filename) + 1, NETWORK_GRF_NAME_LENGTH);
|
||||
min(strlen((f->name != NULL && strlen(f->name) > 0) ? f->name : f->filename) + 1, (size_t)NETWORK_GRF_NAME_LENGTH);
|
||||
if (packet_len > SEND_MTU - 4) { // 4 is 3 byte header + grf count in reply
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "newgrf_config.h"
|
||||
#include "newgrf_sound.h"
|
||||
#include "newgrf_spritegroup.h"
|
||||
#include "helpers.hpp"
|
||||
|
||||
/* TTDPatch extended GRF format codec
|
||||
* (c) Petr Baudis 2004 (GPL'd)
|
||||
|
@ -542,7 +543,7 @@ static bool RoadVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
|
|||
break;
|
||||
|
||||
case 0x12: /* SFX */
|
||||
FOR_EACH_OBJECT rvi[i].sfx = grf_load_byte(&buf);
|
||||
FOR_EACH_OBJECT rvi[i].sfx = (SoundFx)grf_load_byte(&buf);
|
||||
break;
|
||||
|
||||
case 0x13: /* Power in 10hp */
|
||||
|
@ -627,7 +628,7 @@ static bool ShipVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
|
|||
break;
|
||||
|
||||
case 0x09: /* Refittable */
|
||||
FOR_EACH_OBJECT svi[i].refittable = grf_load_byte(&buf);
|
||||
FOR_EACH_OBJECT svi[i].refittable = (grf_load_byte(&buf) != 0);
|
||||
break;
|
||||
|
||||
case 0x0A: /* Cost factor */
|
||||
|
@ -666,7 +667,7 @@ static bool ShipVehicleChangeInfo(uint engine, int numinfo, int prop, byte **buf
|
|||
break;
|
||||
|
||||
case 0x10: /* SFX */
|
||||
FOR_EACH_OBJECT svi[i].sfx = grf_load_byte(&buf);
|
||||
FOR_EACH_OBJECT svi[i].sfx = (SoundFx)grf_load_byte(&buf);
|
||||
break;
|
||||
|
||||
case 0x11: /* Cargos available for refitting */
|
||||
|
@ -779,7 +780,7 @@ static bool AircraftVehicleChangeInfo(uint engine, int numinfo, int prop, byte *
|
|||
break;
|
||||
|
||||
case 0x12: /* SFX */
|
||||
FOR_EACH_OBJECT avi[i].sfx = grf_load_byte(&buf);
|
||||
FOR_EACH_OBJECT avi[i].sfx = (SoundFx)grf_load_byte(&buf);
|
||||
break;
|
||||
|
||||
case 0x13: /* Cargos available for refitting */
|
||||
|
@ -841,7 +842,7 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
|
|||
}
|
||||
|
||||
/* Allocate station specs if necessary */
|
||||
if (_cur_grffile->stations == NULL) _cur_grffile->stations = calloc(MAX_STATIONS, sizeof(*_cur_grffile->stations));
|
||||
if (_cur_grffile->stations == NULL) CallocT(&_cur_grffile->stations, MAX_STATIONS);
|
||||
|
||||
statspec = &_cur_grffile->stations[stid];
|
||||
|
||||
|
@ -861,7 +862,7 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
|
|||
uint32 classid;
|
||||
|
||||
/* Property 0x08 is special; it is where the station is allocated */
|
||||
if (statspec[i] == NULL) statspec[i] = calloc(1, sizeof(*statspec[i]));
|
||||
if (statspec[i] == NULL) CallocT(&statspec[i], 1);
|
||||
|
||||
/* Swap classid because we read it in BE meaning WAYP or DFLT */
|
||||
classid = grf_load_dword(&buf);
|
||||
|
@ -875,7 +876,7 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
|
|||
uint t;
|
||||
|
||||
statspec->tiles = grf_load_extended(&buf);
|
||||
statspec->renderdata = calloc(statspec->tiles, sizeof(*statspec->renderdata));
|
||||
CallocT(&statspec->renderdata, statspec->tiles);
|
||||
statspec->copied_renderdata = false;
|
||||
|
||||
for (t = 0; t < statspec->tiles; t++) {
|
||||
|
@ -890,7 +891,7 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
|
|||
DrawTileSeqStruct *dtss;
|
||||
|
||||
// no relative bounding box support
|
||||
dts->seq = realloc((void*)dts->seq, ++seq_count * sizeof(DrawTileSeqStruct));
|
||||
ReallocT((DrawTileSeqStruct**)&dts->seq, ++seq_count);
|
||||
dtss = (DrawTileSeqStruct*) &dts->seq[seq_count - 1];
|
||||
|
||||
dtss->delta_x = grf_load_byte(&buf);
|
||||
|
@ -956,10 +957,10 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
|
|||
|
||||
//debug("l %d > %d ?", length, stat->lengths);
|
||||
if (length > statspec->lengths) {
|
||||
statspec->platforms = realloc(statspec->platforms, length);
|
||||
ReallocT(&statspec->platforms, length);
|
||||
memset(statspec->platforms + statspec->lengths, 0, length - statspec->lengths);
|
||||
|
||||
statspec->layouts = realloc(statspec->layouts, length * sizeof(*statspec->layouts));
|
||||
ReallocT(&statspec->layouts, length);
|
||||
memset(statspec->layouts + statspec->lengths, 0,
|
||||
(length - statspec->lengths) * sizeof(*statspec->layouts));
|
||||
|
||||
|
@ -969,8 +970,7 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
|
|||
|
||||
//debug("p %d > %d ?", number, stat->platforms[l]);
|
||||
if (number > statspec->platforms[l]) {
|
||||
statspec->layouts[l] = realloc(statspec->layouts[l],
|
||||
number * sizeof(**statspec->layouts));
|
||||
ReallocT(&statspec->layouts[l], number);
|
||||
// We expect NULL being 0 here, but C99 guarantees that.
|
||||
memset(statspec->layouts[l] + statspec->platforms[l], 0,
|
||||
(number - statspec->platforms[l]) * sizeof(**statspec->layouts));
|
||||
|
@ -979,7 +979,7 @@ static bool StationChangeInfo(uint stid, int numinfo, int prop, byte **bufp, int
|
|||
}
|
||||
|
||||
p = 0;
|
||||
layout = malloc(length * number);
|
||||
MallocT(&layout, length * number);
|
||||
for (l = 0; l < length; l++) {
|
||||
for (p = 0; p < number; p++) {
|
||||
layout[l * number + p] = grf_load_byte(&buf);
|
||||
|
@ -1075,7 +1075,7 @@ static bool BridgeChangeInfo(uint brid, int numinfo, int prop, byte **bufp, int
|
|||
|
||||
if (bridge->sprite_table == NULL) {
|
||||
/* Allocate memory for sprite table pointers and zero out */
|
||||
bridge->sprite_table = calloc(7, sizeof(*bridge->sprite_table));
|
||||
CallocT(bridge->sprite_table, 7);
|
||||
}
|
||||
|
||||
for (; numtables-- != 0; tableid++) {
|
||||
|
@ -1088,7 +1088,7 @@ static bool BridgeChangeInfo(uint brid, int numinfo, int prop, byte **bufp, int
|
|||
}
|
||||
|
||||
if (bridge->sprite_table[tableid] == NULL) {
|
||||
bridge->sprite_table[tableid] = malloc(32 * sizeof(**bridge->sprite_table));
|
||||
MallocT(&bridge->sprite_table[tableid], 32);
|
||||
}
|
||||
|
||||
for (sprite = 0; sprite < 32; sprite++)
|
||||
|
@ -1595,7 +1595,7 @@ static void NewSpriteGroup(byte *buf, int len)
|
|||
|
||||
if (setid >= _cur_grffile->spritegroups_count) {
|
||||
// Allocate memory for new sprite group references.
|
||||
_cur_grffile->spritegroups = realloc(_cur_grffile->spritegroups, (setid + 1) * sizeof(*_cur_grffile->spritegroups));
|
||||
ReallocT(&_cur_grffile->spritegroups, setid + 1);
|
||||
// Initialise new space to NULL
|
||||
for (; _cur_grffile->spritegroups_count < (setid + 1); _cur_grffile->spritegroups_count++)
|
||||
_cur_grffile->spritegroups[_cur_grffile->spritegroups_count] = NULL;
|
||||
|
@ -1640,18 +1640,18 @@ static void NewSpriteGroup(byte *buf, int len)
|
|||
}
|
||||
|
||||
group->g.determ.num_adjusts++;
|
||||
group->g.determ.adjusts = realloc(group->g.determ.adjusts, group->g.determ.num_adjusts * sizeof(*group->g.determ.adjusts));
|
||||
ReallocT(&group->g.determ.adjusts, group->g.determ.num_adjusts);
|
||||
|
||||
adjust = &group->g.determ.adjusts[group->g.determ.num_adjusts - 1];
|
||||
|
||||
/* The first var adjust doesn't have an operation specified, so we set it to add. */
|
||||
adjust->operation = group->g.determ.num_adjusts == 1 ? DSGA_OP_ADD : grf_load_byte(&buf);
|
||||
adjust->operation = group->g.determ.num_adjusts == 1 ? DSGA_OP_ADD : (DeterministicSpriteGroupAdjustOperation)grf_load_byte(&buf);
|
||||
adjust->variable = grf_load_byte(&buf);
|
||||
adjust->parameter = IS_BYTE_INSIDE(adjust->variable, 0x60, 0x80) ? grf_load_byte(&buf) : 0;
|
||||
|
||||
varadjust = grf_load_byte(&buf);
|
||||
adjust->shift_num = GB(varadjust, 0, 5);
|
||||
adjust->type = GB(varadjust, 6, 2);
|
||||
adjust->type = (DeterministicSpriteGroupAdjustType)GB(varadjust, 6, 2);
|
||||
adjust->and_mask = grf_load_var(varsize, &buf);
|
||||
|
||||
if (adjust->type != DSGA_TYPE_NONE) {
|
||||
|
@ -1666,7 +1666,7 @@ static void NewSpriteGroup(byte *buf, int len)
|
|||
} while (HASBIT(varadjust, 5));
|
||||
|
||||
group->g.determ.num_ranges = grf_load_byte(&buf);
|
||||
group->g.determ.ranges = calloc(group->g.determ.num_ranges, sizeof(*group->g.determ.ranges));
|
||||
CallocT(&group->g.determ.ranges, group->g.determ.num_ranges);
|
||||
|
||||
check_length(bufend - buf, 2 + (2 + 2 * varsize) * group->g.determ.num_ranges, "NewSpriteGroup (Deterministic)");
|
||||
|
||||
|
@ -1698,7 +1698,7 @@ static void NewSpriteGroup(byte *buf, int len)
|
|||
group->g.random.cmp_mode = HASBIT(triggers, 7) ? RSG_CMP_ALL : RSG_CMP_ANY;
|
||||
group->g.random.lowest_randbit = grf_load_byte(&buf);
|
||||
group->g.random.num_groups = grf_load_byte(&buf);
|
||||
group->g.random.groups = calloc(group->g.random.num_groups, sizeof(*group->g.random.groups));
|
||||
CallocT(&group->g.random.groups, group->g.random.num_groups);
|
||||
|
||||
check_length(bufend - buf, 2 * group->g.random.num_groups, "NewSpriteGroup (Randomized) (2)");
|
||||
|
||||
|
@ -1738,8 +1738,8 @@ static void NewSpriteGroup(byte *buf, int len)
|
|||
|
||||
group->g.real.num_loaded = num_loaded;
|
||||
group->g.real.num_loading = num_loading;
|
||||
if (num_loaded > 0) group->g.real.loaded = calloc(num_loaded, sizeof(*group->g.real.loaded));
|
||||
if (num_loading > 0) group->g.real.loading = calloc(num_loading, sizeof(*group->g.real.loading));
|
||||
if (num_loaded > 0) CallocT(&group->g.real.loaded, num_loaded);
|
||||
if (num_loading > 0) CallocT(&group->g.real.loading, num_loading);
|
||||
|
||||
grfmsg(6, "NewSpriteGroup: New SpriteGroup 0x%02X, %u views, %u loaded, %u loading",
|
||||
setid, sprites, num_loaded, num_loading);
|
||||
|
@ -1884,7 +1884,7 @@ static void FeatureMapSpriteGroup(byte *buf, int len)
|
|||
}
|
||||
|
||||
if (!wagover && last_engines_count != idcount) {
|
||||
last_engines = realloc(last_engines, idcount);
|
||||
ReallocT(&last_engines, idcount);
|
||||
last_engines_count = idcount;
|
||||
}
|
||||
|
||||
|
@ -2235,7 +2235,7 @@ static uint32 GetParamVal(byte param, uint32 *cond_val)
|
|||
return _game_mode;
|
||||
|
||||
case 0x9A: /* Always -1 */
|
||||
return -1;
|
||||
return UINT_MAX;
|
||||
|
||||
case 0x9D: /* TTD Platform, 00=TTDPatch, 01=OpenTTD */
|
||||
return 1;
|
||||
|
@ -2249,7 +2249,7 @@ static uint32 GetParamVal(byte param, uint32 *cond_val)
|
|||
|
||||
/* In-game variable. */
|
||||
grfmsg(1, "Unsupported in-game variable 0x%02X", param);
|
||||
return -1;
|
||||
return UINT_MAX;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2274,7 +2274,7 @@ static void CfgApply(byte *buf, int len)
|
|||
|
||||
/* Check if the sprite is a pseudo sprite. We can't operate on real sprites. */
|
||||
if (type == 0xFF) {
|
||||
_preload_sprite = malloc(num);
|
||||
MallocT(&_preload_sprite, num);
|
||||
FioReadBlock(_preload_sprite, num);
|
||||
}
|
||||
|
||||
|
@ -2788,7 +2788,7 @@ static void ParamSet(byte *buf, int len)
|
|||
}
|
||||
|
||||
grfmsg(1, "GRM: Unable to allocate %d vehicles", count);
|
||||
src1 = -1;
|
||||
src1 = UINT_MAX;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -3026,7 +3026,7 @@ static void DefineGotoLabel(byte *buf, int len)
|
|||
check_length(len, 1, "DefineGotoLabel");
|
||||
buf++; len--;
|
||||
|
||||
label = malloc(sizeof(*label));
|
||||
MallocT(&label, 1);
|
||||
label->label = grf_load_byte(&buf);
|
||||
label->nfo_line = _nfo_line;
|
||||
label->pos = FioGetPos();
|
||||
|
@ -3198,7 +3198,7 @@ static void LoadFontGlyph(byte *buf, int len)
|
|||
check_length(len, 1 + num_def * 4, "LoadFontGlyph");
|
||||
|
||||
for (i = 0; i < num_def; i++) {
|
||||
FontSize size = grf_load_byte(&buf);
|
||||
FontSize size = (FontSize)grf_load_byte(&buf);
|
||||
uint8 num_char = grf_load_byte(&buf);
|
||||
uint16 base_char = grf_load_word(&buf);
|
||||
uint c;
|
||||
|
@ -3489,7 +3489,7 @@ static void InitNewGRFFile(const GRFConfig *config, int sprite_offset)
|
|||
return;
|
||||
}
|
||||
|
||||
newfile = calloc(1, sizeof(*newfile));
|
||||
CallocT(&newfile, 1);
|
||||
|
||||
if (newfile == NULL) error ("Out of memory");
|
||||
|
||||
|
@ -3617,7 +3617,7 @@ static void DecodeSpecialSprite(uint num, GrfLoadingStage stage)
|
|||
if (_preload_sprite == NULL) {
|
||||
/* No preloaded sprite to work with; allocate and read the
|
||||
* pseudo sprite content. */
|
||||
buf = malloc(num);
|
||||
MallocT(&buf, num);
|
||||
if (buf == NULL) error("DecodeSpecialSprite: Could not allocate memory");
|
||||
FioReadBlock(buf, num);
|
||||
} else {
|
||||
|
@ -3770,3 +3770,4 @@ void LoadNewGRF(uint load_index, uint file_index)
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
|
||||
#include "station.h"
|
||||
#include "newgrf_config.h"
|
||||
#include "helpers.hpp"
|
||||
|
||||
typedef enum GrfLoadingStage {
|
||||
GLS_FILESCAN,
|
||||
|
@ -15,6 +16,9 @@ typedef enum GrfLoadingStage {
|
|||
GLS_END,
|
||||
} GrfLoadingStage;
|
||||
|
||||
DECLARE_POSTFIX_INCREMENT(GrfLoadingStage);
|
||||
|
||||
|
||||
typedef struct GRFLabel {
|
||||
byte label;
|
||||
uint32 nfo_line;
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "network/network_data.h"
|
||||
#include "newgrf.h"
|
||||
#include "newgrf_config.h"
|
||||
#include "helpers.hpp"
|
||||
|
||||
#include "fileio.h"
|
||||
#include "fios.h"
|
||||
|
@ -123,7 +124,7 @@ GRFConfig **CopyGRFConfigList(GRFConfig **dst, const GRFConfig *src)
|
|||
/* Clear destination as it will be overwritten */
|
||||
ClearGRFConfigList(dst);
|
||||
for (; src != NULL; src = src->next) {
|
||||
c = calloc(1, sizeof(*c));
|
||||
CallocT(&c, 1);
|
||||
*c = *src;
|
||||
if (src->filename != NULL) c->filename = strdup(src->filename);
|
||||
if (src->name != NULL) c->name = strdup(src->name);
|
||||
|
@ -269,7 +270,7 @@ static uint ScanPath(const char *path)
|
|||
if (ext == NULL) continue;
|
||||
if (strcasecmp(ext, ".grf") != 0) continue;
|
||||
|
||||
c = calloc(1, sizeof(*c));
|
||||
CallocT(&c, 1);
|
||||
c->filename = strdup(file);
|
||||
|
||||
if (FillGRFDetails(c, false)) {
|
||||
|
@ -374,7 +375,7 @@ char *FindUnknownGRFName(uint32 grfid, uint8 *md5sum, bool create)
|
|||
|
||||
if (!create) return NULL;
|
||||
|
||||
grf = calloc(1, sizeof(*grf));
|
||||
CallocT(&grf, 1);
|
||||
grf->grfid = grfid;
|
||||
grf->next = unknown_grfs;
|
||||
ttd_strlcpy(grf->name, UNKNOWN_GRF_NAME_PLACEHOLDER, sizeof(grf->name));
|
||||
|
@ -445,7 +446,8 @@ static void Load_NGRF(void)
|
|||
GRFConfig **last = &first;
|
||||
|
||||
while (SlIterateArray() != -1) {
|
||||
GRFConfig *c = calloc(1, sizeof(*c));
|
||||
GRFConfig *c;
|
||||
CallocT(&c, 1);
|
||||
SlObject(c, _grfconfig_desc);
|
||||
|
||||
/* Append our configuration to the list */
|
||||
|
@ -461,7 +463,7 @@ static void Load_NGRF(void)
|
|||
AppendStaticGRFConfigs(&_grfconfig);
|
||||
}
|
||||
|
||||
const ChunkHandler _newgrf_chunk_handlers[] = {
|
||||
extern const ChunkHandler _newgrf_chunk_handlers[] = {
|
||||
{ 'NGRF', Save_NGRF, Load_NGRF, CH_ARRAY | CH_LAST }
|
||||
};
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "newgrf_spritegroup.h"
|
||||
#include "newgrf_cargo.h"
|
||||
#include "date.h"
|
||||
#include "helpers.hpp"
|
||||
|
||||
|
||||
|
||||
|
@ -82,8 +83,7 @@ void SetWagonOverrideSprites(EngineID engine, CargoID cargo, const SpriteGroup *
|
|||
|
||||
wos = &_engine_wagon_overrides[engine];
|
||||
wos->overrides_count++;
|
||||
wos->overrides = realloc(wos->overrides,
|
||||
wos->overrides_count * sizeof(*wos->overrides));
|
||||
ReallocT(&wos->overrides, wos->overrides_count);
|
||||
|
||||
wo = &wos->overrides[wos->overrides_count - 1];
|
||||
/* FIXME: If we are replacing an override, release original SpriteGroup
|
||||
|
@ -92,7 +92,7 @@ void SetWagonOverrideSprites(EngineID engine, CargoID cargo, const SpriteGroup *
|
|||
wo->group = group;
|
||||
wo->cargo = cargo;
|
||||
wo->trains = trains;
|
||||
wo->train_id = malloc(trains);
|
||||
MallocT(&wo->train_id, trains);
|
||||
memcpy(wo->train_id, train_id, trains);
|
||||
}
|
||||
|
||||
|
@ -563,7 +563,7 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by
|
|||
}
|
||||
|
||||
*available = false;
|
||||
return -1;
|
||||
return UINT_MAX;
|
||||
}
|
||||
|
||||
/* Calculated vehicle parameters */
|
||||
|
@ -628,7 +628,7 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by
|
|||
return v->owner;
|
||||
|
||||
case 0x44: /* Aircraft information */
|
||||
if (v->type != VEH_Aircraft) return -1;
|
||||
if (v->type != VEH_Aircraft) return UINT_MAX;
|
||||
|
||||
{
|
||||
const Vehicle *w = v->next;
|
||||
|
@ -806,7 +806,7 @@ static uint32 VehicleGetVariable(const ResolverObject *object, byte variable, by
|
|||
DEBUG(grf, 1, "Unhandled vehicle property 0x%X, type 0x%X", variable, v->type);
|
||||
|
||||
*available = false;
|
||||
return -1;
|
||||
return UINT_MAX;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "table/sprites.h"
|
||||
#include "newgrf.h"
|
||||
#include "newgrf_config.h"
|
||||
#include "helpers.hpp"
|
||||
|
||||
|
||||
/** Parse an integerlist string and set each found value
|
||||
|
@ -164,7 +165,7 @@ static void NewGRFAddDlgWndProc(Window *w, WindowEvent *e)
|
|||
}
|
||||
|
||||
/* Copy GRF details from scanned list */
|
||||
c = calloc(1, sizeof(*c));
|
||||
CallocT(&c, 1);
|
||||
*c = *src;
|
||||
c->filename = strdup(src->filename);
|
||||
if (src->name != NULL) c->name = strdup(src->name);
|
||||
|
|
|
@ -63,6 +63,6 @@ bool PlayVehicleSound(const Vehicle *v, VehicleSoundEvent event)
|
|||
if (callback == CALLBACK_FAILED) return false;
|
||||
if (callback >= GetNumOriginalSounds()) callback += file->sound_offset - GetNumOriginalSounds();
|
||||
|
||||
if (callback < GetNumSounds()) SndPlayVehicleFx(callback, v);
|
||||
if (callback < GetNumSounds()) SndPlayVehicleFx((SoundFx)callback, v);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ static inline uint32 GetVariable(const ResolverObject *object, byte variable, by
|
|||
case 0x10: return object->callback_param1;
|
||||
case 0x11: return 0;
|
||||
case 0x18: return object->callback_param2;
|
||||
case 0x1A: return -1;
|
||||
case 0x1A: return (uint32)-1;
|
||||
case 0x1B: return GB(_display_opt, 0, 6);
|
||||
case 0x1C: return object->last_value;
|
||||
case 0x20: return _opt.landscape == LT_HILLY ? _opt.snow_line : 0xFF;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "newgrf_station.h"
|
||||
#include "newgrf_spritegroup.h"
|
||||
#include "date.h"
|
||||
#include "helpers.hpp"
|
||||
|
||||
static StationClass station_classes[STAT_CLASS_MAX];
|
||||
|
||||
|
@ -31,8 +32,7 @@ enum {
|
|||
*/
|
||||
void ResetStationClasses(void)
|
||||
{
|
||||
StationClassID i;
|
||||
for (i = 0; i < STAT_CLASS_MAX; i++) {
|
||||
for (StationClassID i = STAT_CLASS_BEGIN; i < STAT_CLASS_MAX; i++) {
|
||||
station_classes[i].id = 0;
|
||||
station_classes[i].name = STR_EMPTY;
|
||||
station_classes[i].stations = 0;
|
||||
|
@ -45,13 +45,13 @@ void ResetStationClasses(void)
|
|||
station_classes[0].id = 'DFLT';
|
||||
station_classes[0].name = STR_STAT_CLASS_DFLT;
|
||||
station_classes[0].stations = 1;
|
||||
station_classes[0].spec = malloc(sizeof(*station_classes[0].spec));
|
||||
MallocT(&station_classes[0].spec, 1);
|
||||
station_classes[0].spec[0] = NULL;
|
||||
|
||||
station_classes[1].id = 'WAYP';
|
||||
station_classes[1].name = STR_STAT_CLASS_WAYP;
|
||||
station_classes[1].stations = 1;
|
||||
station_classes[1].spec = malloc(sizeof(*station_classes[1].spec));
|
||||
MallocT(&station_classes[1].spec, 1);
|
||||
station_classes[1].spec[0] = NULL;
|
||||
}
|
||||
|
||||
|
@ -60,17 +60,15 @@ void ResetStationClasses(void)
|
|||
* @param classid A 32 bit value identifying the class.
|
||||
* @return Index into station_classes of allocated class.
|
||||
*/
|
||||
StationClassID AllocateStationClass(uint32 class)
|
||||
StationClassID AllocateStationClass(uint32 cls)
|
||||
{
|
||||
StationClassID i;
|
||||
|
||||
for (i = 0; i < STAT_CLASS_MAX; i++) {
|
||||
if (station_classes[i].id == class) {
|
||||
for (StationClassID i = STAT_CLASS_BEGIN; i < STAT_CLASS_MAX; i++) {
|
||||
if (station_classes[i].id == cls) {
|
||||
// ClassID is already allocated, so reuse it.
|
||||
return i;
|
||||
} else if (station_classes[i].id == 0) {
|
||||
// This class is empty, so allocate it to the ClassID.
|
||||
station_classes[i].id = class;
|
||||
station_classes[i].id = cls;
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
@ -150,7 +148,7 @@ void SetCustomStationSpec(StationSpec *statspec)
|
|||
station_class = &station_classes[statspec->sclass];
|
||||
|
||||
i = station_class->stations++;
|
||||
station_class->spec = realloc(station_class->spec, station_class->stations * sizeof(*station_class->spec));
|
||||
ReallocT(&station_class->spec, station_class->stations);
|
||||
|
||||
station_class->spec[i] = statspec;
|
||||
statspec->allocated = true;
|
||||
|
@ -176,10 +174,9 @@ const StationSpec *GetCustomStationSpec(StationClassID sclass, uint station)
|
|||
|
||||
const StationSpec *GetCustomStationSpecByGrf(uint32 grfid, byte localidx)
|
||||
{
|
||||
StationClassID i;
|
||||
uint j;
|
||||
|
||||
for (i = STAT_CLASS_DFLT; i < STAT_CLASS_MAX; i++) {
|
||||
for (StationClassID i = STAT_CLASS_BEGIN; i < STAT_CLASS_MAX; i++) {
|
||||
for (j = 0; j < station_classes[i].stations; j++) {
|
||||
const StationSpec *statspec = station_classes[i].spec[j];
|
||||
if (statspec == NULL) continue;
|
||||
|
@ -364,7 +361,7 @@ static uint32 StationGetVariable(const ResolverObject *object, byte variable, by
|
|||
}
|
||||
|
||||
*available = false;
|
||||
return -1;
|
||||
return UINT_MAX;
|
||||
}
|
||||
|
||||
switch (variable) {
|
||||
|
@ -430,7 +427,7 @@ static uint32 StationGetVariable(const ResolverObject *object, byte variable, by
|
|||
DEBUG(grf, 1, "Unhandled station property 0x%X", variable);
|
||||
|
||||
*available = false;
|
||||
return -1;
|
||||
return UINT_MAX;
|
||||
}
|
||||
|
||||
|
||||
|
@ -610,7 +607,7 @@ int AllocateSpecToStation(const StationSpec *statspec, Station *st, bool exec)
|
|||
if (exec) {
|
||||
if (i >= st->num_specs) {
|
||||
st->num_specs = i + 1;
|
||||
st->speclist = realloc(st->speclist, st->num_specs * sizeof(*st->speclist));
|
||||
ReallocT(&st->speclist, st->num_specs);
|
||||
|
||||
if (st->num_specs == 2) {
|
||||
/* Initial allocation */
|
||||
|
@ -656,7 +653,7 @@ void DeallocateSpecFromStation(Station* st, byte specindex)
|
|||
for (; st->speclist[st->num_specs - 1].grfid == 0 && st->num_specs > 1; st->num_specs--);
|
||||
|
||||
if (st->num_specs > 1) {
|
||||
st->speclist = realloc(st->speclist, st->num_specs * sizeof(*st->speclist));
|
||||
ReallocT(&st->speclist, st->num_specs);
|
||||
} else {
|
||||
free(st->speclist);
|
||||
st->num_specs = 0;
|
||||
|
@ -696,7 +693,7 @@ bool DrawStationTile(int x, int y, RailType railtype, Axis axis, StationClassID
|
|||
if (statspec->renderdata == NULL) {
|
||||
sprites = GetStationTileLayout(tile + axis);
|
||||
} else {
|
||||
sprites = &statspec->renderdata[(tile < statspec->tiles) ? tile + axis : axis];
|
||||
sprites = &statspec->renderdata[(tile < statspec->tiles) ? tile + axis : (uint)axis];
|
||||
}
|
||||
|
||||
image = sprites->ground_sprite;
|
||||
|
|
|
@ -7,13 +7,22 @@
|
|||
|
||||
#include "engine.h"
|
||||
#include "newgrf_cargo.h"
|
||||
#include "helpers.hpp"
|
||||
|
||||
typedef enum {
|
||||
STAT_CLASS_DFLT, ///< Default station class.
|
||||
STAT_CLASS_WAYP, ///< Waypoint class.
|
||||
STAT_CLASS_MAX = 32, ///< Maximum number of classes.
|
||||
STAT_CLASS_BEGIN = 0, ///< the lowest valid value
|
||||
STAT_CLASS_DFLT = 0, ///< Default station class.
|
||||
STAT_CLASS_WAYP, ///< Waypoint class.
|
||||
STAT_CLASS_MAX = 32, ///< Maximum number of classes.
|
||||
} StationClassID;
|
||||
|
||||
/** Define basic enum properties */
|
||||
template <> struct EnumPropsT<StationClassID> : MakeEnumPropsT<StationClassID, byte, STAT_CLASS_BEGIN, STAT_CLASS_MAX, STAT_CLASS_MAX> {};
|
||||
typedef TinyEnumT<StationClassID> StationClassIDByte;
|
||||
|
||||
/** Allow incrementing of StationClassID variables */
|
||||
DECLARE_POSTFIX_INCREMENT(StationClassID);
|
||||
|
||||
/* Station layout for given dimensions - it is a two-dimensional array
|
||||
* where index is computed as (x * platforms) + platform. */
|
||||
typedef byte *StationLayout;
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "newgrf.h"
|
||||
#include "newgrf_text.h"
|
||||
#include "table/control_codes.h"
|
||||
#include "helpers.hpp"
|
||||
|
||||
#define GRFTAB 28
|
||||
#define TABSIZE 11
|
||||
|
@ -157,7 +158,8 @@ static byte _currentLangID = GRFLX_ENGLISH; //by default, english is used.
|
|||
|
||||
char *TranslateTTDPatchCodes(const char *str)
|
||||
{
|
||||
char *tmp = malloc(strlen(str) * 10 + 1); /* Allocate space to allow for expansion */
|
||||
char *tmp;
|
||||
MallocT(&tmp, strlen(str) * 10 + 1); /* Allocate space to allow for expansion */
|
||||
char *d = tmp;
|
||||
bool unicode = false;
|
||||
WChar c;
|
||||
|
@ -253,7 +255,8 @@ char *TranslateTTDPatchCodes(const char *str)
|
|||
}
|
||||
|
||||
*d = '\0';
|
||||
return realloc(tmp, strlen(tmp) + 1);
|
||||
ReallocT(&tmp, strlen(tmp) + 1);
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
|
@ -295,7 +298,7 @@ StringID AddGRFString(uint32 grfid, uint16 stringid, byte langid_to_add, bool ne
|
|||
|
||||
translatedtext = TranslateTTDPatchCodes(text_to_add);
|
||||
|
||||
newtext = malloc(sizeof(*newtext) + strlen(translatedtext) + 1);
|
||||
newtext = (GRFText*)malloc(sizeof(*newtext) + strlen(translatedtext) + 1);
|
||||
newtext->next = NULL;
|
||||
newtext->langid = langid_to_add;
|
||||
strcpy(newtext->text, translatedtext);
|
||||
|
|
|
@ -74,6 +74,7 @@ static DrawNewsCallbackProc * const _draw_news_callback[] = {
|
|||
DrawNewsBankrupcy, /* DNC_BANKRUPCY */
|
||||
};
|
||||
|
||||
extern GetNewsStringCallbackProc * const _get_news_string_callback[];
|
||||
GetNewsStringCallbackProc * const _get_news_string_callback[] = {
|
||||
GetNewsStringNewTrainAvail, /* DNC_TRAINAVAIL */
|
||||
GetNewsStringNewRoadVehAvail, /* DNC_ROADAVAIL */
|
||||
|
@ -218,7 +219,7 @@ static void NewsWindowProc(Window *w, WindowEvent *e)
|
|||
if (w->viewport != NULL)
|
||||
w->viewport->top += y - w->top;
|
||||
|
||||
diff = abs(w->top - y);
|
||||
diff = delta(w->top, y);
|
||||
w->top = y;
|
||||
|
||||
SetDirtyBlocks(w->left, w->top - diff, w->left + w->width, w->top + w->height);
|
||||
|
@ -367,14 +368,14 @@ static WindowDesc _news_type0_desc = {
|
|||
static const SoundFx _news_sounds[] = {
|
||||
SND_1D_APPLAUSE,
|
||||
SND_1D_APPLAUSE,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
SND_BEGIN,
|
||||
SND_BEGIN,
|
||||
SND_BEGIN,
|
||||
SND_BEGIN,
|
||||
SND_1E_OOOOH,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
SND_BEGIN,
|
||||
SND_BEGIN,
|
||||
SND_BEGIN
|
||||
};
|
||||
|
||||
/** Get the value of an item of the news-display settings. This is
|
||||
|
@ -752,7 +753,7 @@ static void MessageOptionsWndProc(Window *w, WindowEvent *e)
|
|||
for (i = 0, y = 26; i != 10; i++, y += 12, click_state >>= 1, val >>= 2) {
|
||||
bool clicked = !!(click_state & 1);
|
||||
|
||||
DrawFrameRect(13, y, 89, 11 + y, 3, (clicked) ? FR_LOWERED : 0);
|
||||
DrawFrameRect(13, y, 89, 11 + y, 3, (clicked) ? FR_LOWERED : FR_NONE);
|
||||
DrawStringCentered(((13 + 89 + 1) >> 1) + clicked, ((y + 11 + y + 1) >> 1) - 5 + clicked, message_opt[val & 0x3], 0x10);
|
||||
DrawString(103, y + 1, i + STR_0206_ARRIVAL_OF_FIRST_VEHICLE, 0);
|
||||
}
|
||||
|
|
35
src/npf.cpp
35
src/npf.cpp
|
@ -37,8 +37,8 @@ static const uint _trackdir_length[TRACKDIR_END] = {
|
|||
*/
|
||||
static uint NPFDistanceTrack(TileIndex t0, TileIndex t1)
|
||||
{
|
||||
const uint dx = abs(TileX(t0) - TileX(t1));
|
||||
const uint dy = abs(TileY(t0) - TileY(t1));
|
||||
const uint dx = delta(TileX(t0), TileX(t1));
|
||||
const uint dy = delta(TileY(t0), TileY(t1));
|
||||
|
||||
const uint straightTracks = 2 * min(dx, dy); /* The number of straight (not full length) tracks */
|
||||
/* OPTIMISATION:
|
||||
|
@ -74,7 +74,7 @@ static uint NPFHash(uint key1, uint key2)
|
|||
uint part1 = TileX(key1) & NPF_HASH_HALFMASK;
|
||||
uint part2 = TileY(key1) & NPF_HASH_HALFMASK;
|
||||
|
||||
assert(IsValidTrackdir(key2));
|
||||
assert(IsValidTrackdir((Trackdir)key2));
|
||||
assert(IsValidTile(key1));
|
||||
return ((part1 << NPF_HASH_HALFBITS | part2) + (NPF_HASH_SIZE * key2 / TRACKDIR_END)) % NPF_HASH_SIZE;
|
||||
}
|
||||
|
@ -137,7 +137,7 @@ static int32 NPFCalcStationOrTileHeuristic(AyStar* as, AyStarNode* current, Open
|
|||
|
||||
if (dist < ftd->best_bird_dist) {
|
||||
ftd->best_bird_dist = dist;
|
||||
ftd->best_trackdir = current->user_data[NPF_TRACKDIR_CHOICE];
|
||||
ftd->best_trackdir = (Trackdir)current->user_data[NPF_TRACKDIR_CHOICE];
|
||||
}
|
||||
return dist;
|
||||
}
|
||||
|
@ -188,7 +188,7 @@ static inline uint NPFBridgeCost(AyStarNode *current)
|
|||
|
||||
static uint NPFSlopeCost(AyStarNode* current)
|
||||
{
|
||||
TileIndex next = current->tile + TileOffsByDiagDir(TrackdirToExitdir(current->direction));
|
||||
TileIndex next = current->tile + TileOffsByDiagDir(TrackdirToExitdir((Trackdir)current->direction));
|
||||
int x,y;
|
||||
int8 z1,z2;
|
||||
|
||||
|
@ -290,7 +290,7 @@ static int32 NPFRoadPathCost(AyStar* as, AyStarNode* current, OpenListNode* pare
|
|||
|
||||
/* Check for turns. Road vehicles only really drive diagonal, turns are
|
||||
* represented by non-diagonal tracks */
|
||||
if (!IsDiagonalTrackdir(current->direction))
|
||||
if (!IsDiagonalTrackdir((Trackdir)current->direction))
|
||||
cost += _patches.npf_road_curve_penalty;
|
||||
|
||||
NPFMarkTile(tile);
|
||||
|
@ -403,7 +403,7 @@ static int32 NPFFindDepot(AyStar* as, OpenListNode *current)
|
|||
{
|
||||
/* It's not worth caching the result with NPF_FLAG_IS_TARGET here as below,
|
||||
* since checking the cache not that much faster than the actual check */
|
||||
return IsTileDepotType(current->path.node.tile, as->user_data[NPF_TYPE]) ?
|
||||
return IsTileDepotType(current->path.node.tile, (TransportType)as->user_data[NPF_TYPE]) ?
|
||||
AYSTAR_FOUND_END_NODE : AYSTAR_DONE;
|
||||
}
|
||||
|
||||
|
@ -511,8 +511,9 @@ static void NPFFollowTrack(AyStar* aystar, OpenListNode* current)
|
|||
DiagDirection src_exitdir = TrackdirToExitdir(src_trackdir);
|
||||
TileIndex dst_tile = INVALID_TILE;
|
||||
int i;
|
||||
TrackdirBits trackdirbits, ts;
|
||||
TransportType type = aystar->user_data[NPF_TYPE];
|
||||
uint32 ts;
|
||||
TrackdirBits trackdirbits;
|
||||
TransportType type = (TransportType)aystar->user_data[NPF_TYPE];
|
||||
bool override_dst_check = false;
|
||||
/* Initialize to 0, so we can jump out (return) somewhere an have no neighbours */
|
||||
aystar->num_neighbours = 0;
|
||||
|
@ -587,13 +588,13 @@ static void NPFFollowTrack(AyStar* aystar, OpenListNode* current)
|
|||
|
||||
/* check correct rail type (mono, maglev, etc) */
|
||||
if (type == TRANSPORT_RAIL) {
|
||||
RailType dst_type = GetTileRailType(dst_tile, src_trackdir);
|
||||
RailType dst_type = GetTileRailType(dst_tile, TrackdirToTrack(src_trackdir));
|
||||
if (!HASBIT(aystar->user_data[NPF_RAILTYPES], dst_type))
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check the owner of the tile */
|
||||
if (!VehicleMayEnterTile(aystar->user_data[NPF_OWNER], dst_tile, TrackdirToExitdir(src_trackdir))) {
|
||||
if (!VehicleMayEnterTile((Owner)aystar->user_data[NPF_OWNER], dst_tile, TrackdirToExitdir(src_trackdir))) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -614,7 +615,7 @@ static void NPFFollowTrack(AyStar* aystar, OpenListNode* current)
|
|||
} else {
|
||||
ts = GetTileTrackStatus(dst_tile, type);
|
||||
}
|
||||
trackdirbits = ts & TRACKDIR_BIT_MASK; /* Filter out signal status and the unused bits */
|
||||
trackdirbits = (TrackdirBits)(ts & TRACKDIR_BIT_MASK); /* Filter out signal status and the unused bits */
|
||||
|
||||
DEBUG(npf, 4, "Next node: (%d, %d) [%d], possible trackdirs: 0x%X", TileX(dst_tile), TileY(dst_tile), dst_tile, trackdirbits);
|
||||
/* Select only trackdirs we can reach from our current trackdir */
|
||||
|
@ -627,9 +628,7 @@ static void NPFFollowTrack(AyStar* aystar, OpenListNode* current)
|
|||
i = 0;
|
||||
/* Enumerate possible track */
|
||||
while (trackdirbits != 0) {
|
||||
Trackdir dst_trackdir;
|
||||
dst_trackdir = FindFirstBit2x64(trackdirbits);
|
||||
trackdirbits = KillFirstBit2x64(trackdirbits);
|
||||
Trackdir dst_trackdir = RemoveFirstTrackdir(trackdirbits);
|
||||
DEBUG(npf, 5, "Expanded into trackdir: %d, remaining trackdirs: 0x%X", dst_trackdir, trackdirbits);
|
||||
|
||||
/* Check for oneway signal against us */
|
||||
|
@ -739,7 +738,7 @@ NPFFoundTargetData NPFRouteToStationOrTileTwoWay(TileIndex tile1, Trackdir track
|
|||
|
||||
NPFFoundTargetData NPFRouteToStationOrTile(TileIndex tile, Trackdir trackdir, NPFFindStationOrTileData* target, TransportType type, Owner owner, RailTypeMask railtypes)
|
||||
{
|
||||
return NPFRouteToStationOrTileTwoWay(tile, trackdir, INVALID_TILE, 0, target, type, owner, railtypes);
|
||||
return NPFRouteToStationOrTileTwoWay(tile, trackdir, INVALID_TILE, INVALID_TRACKDIR, target, type, owner, railtypes);
|
||||
}
|
||||
|
||||
NPFFoundTargetData NPFRouteToDepotBreadthFirstTwoWay(TileIndex tile1, Trackdir trackdir1, TileIndex tile2, Trackdir trackdir2, TransportType type, Owner owner, RailTypeMask railtypes, uint reverse_penalty)
|
||||
|
@ -763,7 +762,7 @@ NPFFoundTargetData NPFRouteToDepotBreadthFirstTwoWay(TileIndex tile1, Trackdir t
|
|||
|
||||
NPFFoundTargetData NPFRouteToDepotBreadthFirst(TileIndex tile, Trackdir trackdir, TransportType type, Owner owner, RailTypeMask railtypes)
|
||||
{
|
||||
return NPFRouteToDepotBreadthFirstTwoWay(tile, trackdir, INVALID_TILE, 0, type, owner, railtypes, 0);
|
||||
return NPFRouteToDepotBreadthFirstTwoWay(tile, trackdir, INVALID_TILE, INVALID_TRACKDIR, type, owner, railtypes, 0);
|
||||
}
|
||||
|
||||
NPFFoundTargetData NPFRouteToDepotTrialError(TileIndex tile, Trackdir trackdir, TransportType type, Owner owner, RailTypeMask railtypes)
|
||||
|
@ -827,7 +826,7 @@ NPFFoundTargetData NPFRouteToDepotTrialError(TileIndex tile, Trackdir trackdir,
|
|||
best_result.best_bird_dist = (uint)-1;
|
||||
|
||||
/* Just iterate the depots in order of increasing distance */
|
||||
while ((current = depots.pop(&depots))) {
|
||||
while ((current = (Depot*)depots.pop(&depots))) {
|
||||
/* Check to see if we already have a path shorter than this
|
||||
* depot's manhattan distance. HACK: We call DistanceManhattan
|
||||
* again, we should probably modify the queue to give us that
|
||||
|
|
|
@ -80,6 +80,8 @@ typedef enum OldChunkTypes {
|
|||
OC_END = 0 ///< End of the whole chunk, all 32bits set to zero
|
||||
} OldChunkType;
|
||||
|
||||
DECLARE_ENUM_AS_BIT_SET(OldChunkType);
|
||||
|
||||
typedef bool OldChunkProc(LoadgameState *ls, int num);
|
||||
|
||||
typedef struct OldChunks {
|
||||
|
@ -97,9 +99,9 @@ assert_compile(sizeof(TileIndex) == 4);
|
|||
static uint32 _bump_assert_value;
|
||||
static bool _read_ttdpatch_flags;
|
||||
|
||||
static OldChunkType GetOldChunkType(OldChunkType type) {return GB(type, 0, 8);}
|
||||
static OldChunkType GetOldChunkVarType(OldChunkType type) {return GB(type, 8, 8) << 8;}
|
||||
static OldChunkType GetOldChunkFileType(OldChunkType type) {return GB(type, 16, 8) << 16;}
|
||||
static OldChunkType GetOldChunkType(OldChunkType type) {return (OldChunkType)GB(type, 0, 8);}
|
||||
static OldChunkType GetOldChunkVarType(OldChunkType type) {return (OldChunkType)(GB(type, 8, 8) << 8);}
|
||||
static OldChunkType GetOldChunkFileType(OldChunkType type) {return (OldChunkType)(GB(type, 16, 8) << 16);}
|
||||
|
||||
static inline byte CalcOldVarLen(OldChunkType type)
|
||||
{
|
||||
|
@ -189,10 +191,10 @@ static inline uint32 ReadUint32(LoadgameState *ls)
|
|||
static bool LoadChunk(LoadgameState *ls, void *base, const OldChunks *chunks)
|
||||
{
|
||||
const OldChunks *chunk = chunks;
|
||||
byte *base_ptr = base;
|
||||
byte *base_ptr = (byte*)base;
|
||||
|
||||
while (chunk->type != OC_END) {
|
||||
byte* ptr = chunk->ptr;
|
||||
byte* ptr = (byte*)chunk->ptr;
|
||||
uint i;
|
||||
|
||||
for (i = 0; i < chunk->amount; i++) {
|
||||
|
@ -959,9 +961,9 @@ static const OldChunks player_chunk[] = {
|
|||
|
||||
static bool LoadOldPlayer(LoadgameState *ls, int num)
|
||||
{
|
||||
Player *p = GetPlayer(num);
|
||||
Player *p = GetPlayer((PlayerID)num);
|
||||
|
||||
_current_player_id = num;
|
||||
_current_player_id = (PlayerID)num;
|
||||
|
||||
if (!LoadChunk(ls, p, player_chunk)) return false;
|
||||
|
||||
|
@ -996,7 +998,7 @@ static bool LoadOldPlayer(LoadgameState *ls, int num)
|
|||
* really figured out as of now, p->ai.cur_veh; needed for 'sell vehicle'
|
||||
* is NULL and the function will crash. To fix this, just change the state
|
||||
* to some harmless state, like 'loop vehicle'; 1 */
|
||||
if (!IsHumanPlayer(num) && p->ai.state == 20) p->ai.state = 1;
|
||||
if (!IsHumanPlayer((PlayerID)num) && p->ai.state == 20) p->ai.state = 1;
|
||||
|
||||
if (p->is_ai && (!_networking || _network_server) && _ai.enabled)
|
||||
AI_StartNewAI(p->index);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "debug.h"
|
||||
#include "functions.h"
|
||||
#include "oldpool.h"
|
||||
#include "helpers.hpp"
|
||||
|
||||
/**
|
||||
* Clean a pool in a safe way (does free all blocks)
|
||||
|
@ -49,11 +50,11 @@ bool AddBlockToPool(OldMemoryPool *pool)
|
|||
DEBUG(misc, 4, "[Pool] (%s) increasing size of pool to %d items (%d bytes)", pool->name, pool->total_items, pool->total_items * pool->item_size);
|
||||
|
||||
/* Increase the poolsize */
|
||||
pool->blocks = realloc(pool->blocks, sizeof(pool->blocks[0]) * (pool->current_blocks + 1));
|
||||
ReallocT(&pool->blocks, pool->current_blocks + 1);
|
||||
if (pool->blocks == NULL) error("Pool: (%s) could not allocate memory for blocks", pool->name);
|
||||
|
||||
/* Allocate memory to the new block item */
|
||||
pool->blocks[pool->current_blocks] = malloc(pool->item_size * (1 << pool->block_size_bits));
|
||||
MallocT(&pool->blocks[pool->current_blocks], pool->item_size * (1 << pool->block_size_bits));
|
||||
if (pool->blocks[pool->current_blocks] == NULL)
|
||||
error("Pool: (%s) could not allocate memory for blocks", pool->name);
|
||||
|
||||
|
|
|
@ -16,11 +16,11 @@ typedef void OldMemoryPoolCleanBlock(uint start_item, uint end_item);
|
|||
* please try to avoid manual calls!
|
||||
*/
|
||||
struct OldMemoryPool {
|
||||
const char* const name; ///< Name of the pool (just for debugging)
|
||||
const char* name; ///< Name of the pool (just for debugging)
|
||||
|
||||
const uint max_blocks; ///< The max amount of blocks this pool can have
|
||||
const uint block_size_bits; ///< The size of each block in bits
|
||||
const uint item_size; ///< How many bytes one block is
|
||||
uint max_blocks; ///< The max amount of blocks this pool can have
|
||||
uint block_size_bits; ///< The size of each block in bits
|
||||
uint item_size; ///< How many bytes one block is
|
||||
|
||||
/// Pointer to a function that is called after a new block is added
|
||||
OldMemoryPoolNewBlock *new_block_proc;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
/* $Id$ */
|
||||
|
||||
#include "stdafx.h"
|
||||
#define VARDEF
|
||||
#include "string.h"
|
||||
#include "table/strings.h"
|
||||
#include "debug.h"
|
||||
|
@ -10,8 +11,8 @@
|
|||
#include "map.h"
|
||||
#include "tile.h"
|
||||
#include "void_map.h"
|
||||
#include "helpers.hpp"
|
||||
|
||||
#define VARDEF
|
||||
#include "openttd.h"
|
||||
#include "bridge_map.h"
|
||||
#include "functions.h"
|
||||
|
@ -73,7 +74,7 @@ void InitializeStations(void);
|
|||
void DeleteAllPlayerStations(void);
|
||||
|
||||
extern void SetDifficultyLevel(int mode, GameOptions *gm_opt);
|
||||
extern void DoStartupNewPlayer(bool is_ai);
|
||||
extern Player* DoStartupNewPlayer(bool is_ai);
|
||||
extern void ShowOSErrorBox(const char *buf);
|
||||
|
||||
/* TODO: usrerror() for errors which are not of an internal nature but
|
||||
|
@ -119,7 +120,7 @@ void *ReadFileToMem(const char *filename, size_t *lenp, size_t maxsize)
|
|||
fseek(in, 0, SEEK_END);
|
||||
len = ftell(in);
|
||||
fseek(in, 0, SEEK_SET);
|
||||
if (len > maxsize || (mem = malloc(len + 1)) == NULL) {
|
||||
if (len > maxsize || !MallocT(&mem, len + 1)) {
|
||||
fclose(in);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -135,9 +136,9 @@ void *ReadFileToMem(const char *filename, size_t *lenp, size_t maxsize)
|
|||
return mem;
|
||||
}
|
||||
|
||||
extern const char _openttd_revision[];
|
||||
static void showhelp(void)
|
||||
{
|
||||
extern const char _openttd_revision[];
|
||||
char buf[4096], *p;
|
||||
|
||||
p = buf;
|
||||
|
@ -175,25 +176,26 @@ static void showhelp(void)
|
|||
}
|
||||
|
||||
|
||||
typedef struct {
|
||||
struct MyGetOptData {
|
||||
char *opt;
|
||||
int numleft;
|
||||
char **argv;
|
||||
const char *options;
|
||||
char *cont;
|
||||
} MyGetOptData;
|
||||
const char *cont;
|
||||
|
||||
static void MyGetOptInit(MyGetOptData *md, int argc, char **argv, const char *options)
|
||||
{
|
||||
md->cont = NULL;
|
||||
md->numleft = argc;
|
||||
md->argv = argv;
|
||||
md->options = options;
|
||||
}
|
||||
MyGetOptData(int argc, char **argv, const char *options)
|
||||
{
|
||||
opt = NULL;
|
||||
numleft = argc;
|
||||
this->argv = argv;
|
||||
this->options = options;
|
||||
cont = NULL;
|
||||
}
|
||||
};
|
||||
|
||||
static int MyGetOpt(MyGetOptData *md)
|
||||
{
|
||||
char *s,*r,*t;
|
||||
const char *s,*r,*t;
|
||||
|
||||
s = md->cont;
|
||||
if (s != NULL)
|
||||
|
@ -226,7 +228,7 @@ md_continue_here:;
|
|||
md->argv++;
|
||||
}
|
||||
}
|
||||
md->opt = t;
|
||||
md->opt = (char*)t;
|
||||
md->cont = NULL;
|
||||
return *s;
|
||||
}
|
||||
|
@ -244,7 +246,7 @@ md_continue_here:;
|
|||
|
||||
static void ParseResolution(int res[2], const char *s)
|
||||
{
|
||||
char *t = strchr(s, 'x');
|
||||
const char *t = strchr(s, 'x');
|
||||
if (t == NULL) {
|
||||
ShowInfoF("Invalid resolution '%s'", s);
|
||||
return;
|
||||
|
@ -308,7 +310,7 @@ static void LoadIntroGame(void)
|
|||
}
|
||||
|
||||
_pause = 0;
|
||||
SetLocalPlayer(0);
|
||||
SetLocalPlayer(PLAYER_FIRST);
|
||||
/* Make sure you can't scroll in the menu */
|
||||
_scrolling_viewport = 0;
|
||||
_cursor.fix_at = false;
|
||||
|
@ -324,7 +326,6 @@ extern void DedicatedFork(void);
|
|||
|
||||
int ttd_main(int argc, char *argv[])
|
||||
{
|
||||
MyGetOptData mgo;
|
||||
int i;
|
||||
const char *optformat;
|
||||
char musicdriver[16], sounddriver[16], videodriver[16];
|
||||
|
@ -356,7 +357,8 @@ int ttd_main(int argc, char *argv[])
|
|||
#endif
|
||||
;
|
||||
|
||||
MyGetOptInit(&mgo, argc-1, argv+1, optformat);
|
||||
MyGetOptData mgo(argc-1, argv+1, optformat);
|
||||
|
||||
while ((i = MyGetOpt(&mgo)) != -1) {
|
||||
switch (i) {
|
||||
case 'm': ttd_strlcpy(musicdriver, mgo.opt, sizeof(musicdriver)); break;
|
||||
|
@ -512,7 +514,7 @@ int ttd_main(int argc, char *argv[])
|
|||
ParseConnectionString(&player, &port, network_conn);
|
||||
|
||||
if (player != NULL) {
|
||||
_network_playas = atoi(player);
|
||||
_network_playas = (PlayerID)atoi(player);
|
||||
|
||||
if (_network_playas != PLAYER_SPECTATOR) {
|
||||
_network_playas--;
|
||||
|
@ -628,7 +630,7 @@ static void MakeNewGameDone(void)
|
|||
/* Create a single player */
|
||||
DoStartupNewPlayer(false);
|
||||
|
||||
SetLocalPlayer(0);
|
||||
SetLocalPlayer(PLAYER_FIRST);
|
||||
_current_player = _local_player;
|
||||
DoCommandP(0, (_patches.autorenew << 15 ) | (_patches.autorenew_months << 16) | 4, _patches.autorenew_money, NULL, CMD_SET_AUTOREPLACE);
|
||||
|
||||
|
@ -708,7 +710,7 @@ static void StartScenario(void)
|
|||
StartupEngines();
|
||||
StartupDisasters();
|
||||
|
||||
SetLocalPlayer(0);
|
||||
SetLocalPlayer(PLAYER_FIRST);
|
||||
_current_player = _local_player;
|
||||
DoCommandP(0, (_patches.autorenew << 15 ) | (_patches.autorenew_months << 16) | 4, _patches.autorenew_money, NULL, CMD_SET_AUTOREPLACE);
|
||||
|
||||
|
@ -799,7 +801,7 @@ void SwitchMode(int new_mode)
|
|||
} else {
|
||||
/* Update the local player for a loaded game. It is either always
|
||||
* player #1 (eg 0) or in the case of a dedicated server a spectator */
|
||||
SetLocalPlayer(_network_dedicated ? PLAYER_SPECTATOR : 0);
|
||||
SetLocalPlayer(_network_dedicated ? PLAYER_SPECTATOR : PLAYER_FIRST);
|
||||
DoCommandP(0, 0, 0, NULL, CMD_PAUSE); // decrease pause counter (was increased from opening load dialog)
|
||||
#ifdef ENABLE_NETWORK
|
||||
if (_network_server) {
|
||||
|
@ -1096,7 +1098,7 @@ static void UpdateExclusiveRights(void)
|
|||
Town *t;
|
||||
|
||||
FOR_ALL_TOWNS(t) {
|
||||
t->exclusivity = (byte)-1;
|
||||
t->exclusivity = INVALID_PLAYER;
|
||||
}
|
||||
|
||||
/* FIXME old exclusive rights status is not being imported (stored in s->blocked_months_obsolete)
|
||||
|
@ -1312,8 +1314,8 @@ bool AfterLoadGame(void)
|
|||
* becomes player 0, unless we are in the scenario editor where all the
|
||||
* players are 'invalid'.
|
||||
*/
|
||||
if (!_network_dedicated && IsValidPlayer(0)) {
|
||||
p = GetPlayer(0);
|
||||
if (!_network_dedicated && IsValidPlayer(PLAYER_FIRST)) {
|
||||
p = GetPlayer(PLAYER_FIRST);
|
||||
p->engine_renew = _patches.autorenew;
|
||||
p->engine_renew_months = _patches.autorenew_months;
|
||||
p->engine_renew_money = _patches.autorenew_money;
|
||||
|
@ -1387,7 +1389,7 @@ bool AfterLoadGame(void)
|
|||
continue;
|
||||
}
|
||||
if (v->type == VEH_Train) {
|
||||
v->u.rail.track = 0x40;
|
||||
v->u.rail.track = TRACK_BIT_WORMHOLE;
|
||||
} else {
|
||||
v->u.road.state = 0xFF;
|
||||
}
|
||||
|
@ -1567,10 +1569,9 @@ bool AfterLoadGame(void)
|
|||
{
|
||||
/* Set up the engine count for all players */
|
||||
Player *players[MAX_PLAYERS];
|
||||
int i;
|
||||
const Vehicle *v;
|
||||
|
||||
for (i = 0; i < MAX_PLAYERS; i++) players[i] = GetPlayer(i);
|
||||
for (PlayerID i = PLAYER_FIRST; i < MAX_PLAYERS; i++) players[i] = GetPlayer(i);
|
||||
|
||||
FOR_ALL_VEHICLES(v) {
|
||||
if (!IsEngineCountable(v)) continue;
|
||||
|
@ -1702,3 +1703,25 @@ void ReloadNewGRFData(void)
|
|||
/* redraw the whole screen */
|
||||
MarkWholeScreenDirty();
|
||||
}
|
||||
|
||||
HalMusicDriver *_music_driver;
|
||||
HalSoundDriver *_sound_driver;
|
||||
HalVideoDriver *_video_driver;
|
||||
|
||||
byte _dirkeys; // 1 = left, 2 = up, 4 = right, 8 = down
|
||||
bool _fullscreen;
|
||||
CursorVars _cursor;
|
||||
bool _ctrl_pressed; // Is Ctrl pressed?
|
||||
bool _shift_pressed; // Is Shift pressed?
|
||||
byte _fast_forward;
|
||||
bool _left_button_down;
|
||||
bool _left_button_clicked;
|
||||
bool _right_button_down;
|
||||
bool _right_button_clicked;
|
||||
DrawPixelInfo _screen;
|
||||
bool _exit_game;
|
||||
bool _networking; ///< are we in networking mode?
|
||||
byte _game_mode;
|
||||
byte _pause;
|
||||
int _pal_first_dirty;
|
||||
int _pal_last_dirty;
|
||||
|
|
|
@ -8,9 +8,8 @@
|
|||
#define VARDEF extern
|
||||
#endif
|
||||
|
||||
typedef struct Rect {
|
||||
int left,top,right,bottom;
|
||||
} Rect;
|
||||
#include "hal.h"
|
||||
#include "helpers.hpp"
|
||||
|
||||
typedef struct Oblong {
|
||||
int x, y;
|
||||
|
@ -22,10 +21,6 @@ typedef struct BoundingRect {
|
|||
int height;
|
||||
} BoundingRect;
|
||||
|
||||
typedef struct Point {
|
||||
int x,y;
|
||||
} Point;
|
||||
|
||||
typedef struct Pair {
|
||||
int a;
|
||||
int b;
|
||||
|
@ -45,13 +40,11 @@ typedef struct Town Town;
|
|||
typedef struct NewsItem NewsItem;
|
||||
typedef struct Industry Industry;
|
||||
typedef struct DrawPixelInfo DrawPixelInfo;
|
||||
typedef byte PlayerID;
|
||||
typedef byte VehicleOrderID; ///< The index of an order within its current vehicle (not pool related)
|
||||
typedef byte CargoID;
|
||||
typedef byte LandscapeID;
|
||||
typedef uint32 SpriteID; ///< The number of a sprite, without mapping bits and colortables
|
||||
typedef uint32 PalSpriteID; ///< The number of a sprite plus all the mapping bits and colortables
|
||||
typedef uint32 CursorID;
|
||||
typedef uint16 EngineID;
|
||||
typedef uint16 UnitID;
|
||||
typedef uint16 StringID;
|
||||
|
@ -77,7 +70,7 @@ assert_compile(sizeof(DestinationID) == sizeof(DepotID));
|
|||
assert_compile(sizeof(DestinationID) == sizeof(WaypointID));
|
||||
assert_compile(sizeof(DestinationID) == sizeof(StationID));
|
||||
|
||||
typedef uint32 WindowNumber;
|
||||
typedef int32 WindowNumber;
|
||||
typedef byte WindowClass;
|
||||
|
||||
enum {
|
||||
|
@ -89,12 +82,6 @@ typedef int32 Year;
|
|||
typedef int32 Date;
|
||||
|
||||
|
||||
enum GameModes {
|
||||
GM_MENU,
|
||||
GM_NORMAL,
|
||||
GM_EDITOR
|
||||
};
|
||||
|
||||
enum SwitchModes {
|
||||
SM_NONE = 0,
|
||||
SM_NEWGAME = 1,
|
||||
|
@ -124,6 +111,32 @@ enum InitializeGameModes {
|
|||
IG_DATE_RESET = 1, /* Reset the date when initializing a game */
|
||||
};
|
||||
|
||||
enum Owner {
|
||||
PLAYER_INACTIVE_CLIENT = 253,
|
||||
PLAYER_NEW_COMPANY = 254,
|
||||
PLAYER_SPECTATOR = 255,
|
||||
OWNER_BEGIN = 0x00,
|
||||
PLAYER_FIRST = 0x00,
|
||||
MAX_PLAYERS = 8,
|
||||
OWNER_TOWN = 0x0F, // a town owns the tile
|
||||
OWNER_NONE = 0x10, // nobody owns the tile
|
||||
OWNER_WATER = 0x11, // "water" owns the tile
|
||||
OWNER_END = 0x12,
|
||||
INVALID_OWNER = 0xFF,
|
||||
INVALID_PLAYER = 0xFF,
|
||||
/* Player identifiers All players below MAX_PLAYERS are playable
|
||||
* players, above, they are special, computer controlled players */
|
||||
};
|
||||
|
||||
typedef Owner PlayerID;
|
||||
|
||||
DECLARE_POSTFIX_INCREMENT(Owner);
|
||||
|
||||
/** Define basic enum properties */
|
||||
template <> struct EnumPropsT<Owner> : MakeEnumPropsT<Owner, byte, OWNER_BEGIN, OWNER_END, INVALID_OWNER> {};
|
||||
typedef TinyEnumT<Owner> OwnerByte;
|
||||
typedef OwnerByte PlayerByte;
|
||||
|
||||
|
||||
typedef enum TransportTypes {
|
||||
/* These constants are for now linked to the representation of bridges
|
||||
|
@ -132,6 +145,7 @@ typedef enum TransportTypes {
|
|||
* accessing tunnels and bridges. For now, you should just not change
|
||||
* the values for road and rail.
|
||||
*/
|
||||
TRANSPORT_BEGIN = 0,
|
||||
TRANSPORT_RAIL = 0,
|
||||
TRANSPORT_ROAD = 1,
|
||||
TRANSPORT_WATER, // = 2
|
||||
|
@ -139,6 +153,11 @@ typedef enum TransportTypes {
|
|||
INVALID_TRANSPORT = 0xff,
|
||||
} TransportType;
|
||||
|
||||
/** Define basic enum properties */
|
||||
template <> struct EnumPropsT<TransportType> : MakeEnumPropsT<TransportType, byte, TRANSPORT_BEGIN, TRANSPORT_END, INVALID_TRANSPORT> {};
|
||||
typedef TinyEnumT<TransportType> TransportTypeByte;
|
||||
|
||||
|
||||
typedef struct TileInfo {
|
||||
uint x;
|
||||
uint y;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue