--- a/Makefile.in Sat Mar 10 11:07:13 2007 +0000
+++ b/Makefile.in Sun Mar 11 16:31:18 2007 +0000
@@ -94,7 +94,7 @@
done
run: all
- $(Q)cd !!BIN_DIR!! && ./!!TTD!!
+ $(Q)cd !!BIN_DIR!! && ./!!TTD!! $(OPENTTD_ARGS)
%.o:
@for dir in $(SRC_DIRS); do \
--- a/config.lib Sat Mar 10 11:07:13 2007 +0000
+++ b/config.lib Sun Mar 11 16:31:18 2007 +0000
@@ -41,6 +41,7 @@
enable_strip="1"
enable_universal="1"
enable_osx_g5="0"
+ enable_unicode="1"
with_osx_sysroot="1"
with_application_bundle="1"
with_sdl="1"
@@ -58,7 +59,7 @@
with_fontconfig="1"
with_psp_config="1"
- save_params_array="build host cc_build cc_host cxx_build cxx_host windres strip awk lipo os revision endian config_log prefix_dir binary_dir data_dir icon_dir personal_dir install_dir custom_lang_dir second_data_dir enable_install enable_debug enable_profiling enable_dedicated enable_network enable_static enable_translator enable_assert enable_strip with_osx_sysroot enable_universal enable_osx_g5 with_application_bundle with_sdl with_cocoa with_zlib with_png with_makedepend with_direct_music with_sort with_iconv with_midi with_midi_arg with_libtimidity with_freetype with_fontconfig with_psp_config CC CXX CFLAGS LDFLAGS"
+ save_params_array="build host cc_build cc_host cxx_build cxx_host windres strip awk lipo os revision endian config_log prefix_dir binary_dir data_dir icon_dir personal_dir install_dir custom_lang_dir second_data_dir enable_install enable_debug enable_profiling enable_dedicated enable_network enable_static enable_translator enable_assert enable_strip with_osx_sysroot enable_universal enable_osx_g5 enable_unicode with_application_bundle with_sdl with_cocoa with_zlib with_png with_makedepend with_direct_music with_sort with_iconv with_midi with_midi_arg with_libtimidity with_freetype with_fontconfig with_psp_config CC CXX CFLAGS LDFLAGS"
}
detect_params() {
@@ -168,6 +169,9 @@
--disable-osx-g5) enable_osx_g5="0";;
--enable-osx-g5) enable_osx_g5="2";;
--enable-osx-g5=*) enable_osx_g5="$optarg";;
+ --disable-unicode) enable_unicode="0";;
+ --enable-unicode) enable_unicode="2";;
+ --enable-unicode=*) enable_unicode="$optarg";;
--with-sdl) with_sdl="2";;
--without-sdl) with_sdl="0";;
@@ -271,7 +275,7 @@
echo "Running configure with following options:" >> $config_log
echo "" >> $config_log
- configure="$0 --ignore-extra-parameters"
+ configure="$CONFIGURE_EXECUTABLE --ignore-extra-parameters"
for p in $save_params_array; do
eval "v=\"\$$p\""
p=`echo "$p" | sed 's/_/-/g;s/\n//g;'`
@@ -370,6 +374,20 @@
log 1 "checking static... no"
fi
+ if [ "$enable_unicode" = "1" ]; then
+ if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ]; then
+ enable_unicode="2"
+ else
+ enable_unicode="0"
+ fi
+ fi
+
+ if [ "$enable_unicode" != "0" ]; then
+ log 1 "checking unicode... yes"
+ else
+ log 1 "checking unicode... no"
+ fi
+
# Show what we configured
if [ "$enable_debug" = "0" ]; then
log 1 "using debug level... no"
@@ -478,6 +496,10 @@
strip_arg=""
# OS2 uses strip via gcc, because it needs to be feed to emxbind
LDFLAGS="$LDFLAGS -s"
+ elif [ "$os" = "SUNOS" ]; then
+ # The GNU strip does know -s, the non-GNU doesn't
+ # So try to detect it (in a bit of an ugly way)
+ strip_arg="`$strip -s strip.test 2>/dev/null && echo \"-s\"`"
else
strip_arg="-s"
fi
@@ -727,10 +749,12 @@
if [ -n "$sdl_config" ]; then
CFLAGS="$CFLAGS -DWITH_SDL"
CFLAGS="$CFLAGS `$sdl_config --cflags`"
- if [ "$enable_static" != "0" ]; then
- LIBS="$LIBS `$sdl_config --static-libs`"
- else
- LIBS="$LIBS `$sdl_config --libs`"
+ if [ "$os" != "MINGW" ] && [ "$os" != "CYGWIN" ] && [ "$os" != "WINCE" ]; then
+ if [ "$enable_static" != "0" ]; then
+ LIBS="$LIBS `$sdl_config --static-libs`"
+ else
+ LIBS="$LIBS `$sdl_config --libs`"
+ fi
fi
fi
@@ -757,10 +781,27 @@
if [ "$os" = "OSX" ]; then
LIBS="$LIBS `$png_config --prefix`/lib/libpng.a"
else
- LIBS="$LIBS `$png_config --static --ldflags --libs --L_opts | tr '\n\r' ' '`"
+ LIBS="$LIBS `$png_config --static --ldflags | tr '\n\r' ' '`"
fi
else
- LIBS="$LIBS `$png_config --ldflags --libs --L_opts | tr '\n\r' ' '`"
+ LIBS="$LIBS `$png_config --ldflags | tr '\n\r' ' '`"
+ fi
+ fi
+
+ if [ -n "$fontconfig_config" ]; then
+ CFLAGS="$CFLAGS -DWITH_FONTCONFIG"
+ CFLAGS="$CFLAGS `$fontconfig_config --cflags | tr '\n\r' ' '`"
+
+ if [ "$enable_static" != "0" ]; then
+ if [ "$os" = "OSX" ]; then
+ # fontconfig_config goes via pkg-config on all systems, which doesn't know --prefix
+ # Also, despite the reason we link to the .a file ourself (because we can't use -static), we do need to ask pkg-config about possible other deps
+ LIBS="$LIBS `$fontconfig_config --variable=prefix`/lib/libfontconfig.a `$fontconfig_config --libs --static | sed s/-lfontconfig//`"
+ else
+ LIBS="$LIBS `$fontconfig_config --libs --static | tr '\n\r' ' '`"
+ fi
+ else
+ LIBS="$LIBS `$fontconfig_config --libs | tr '\n\r' ' '`"
fi
fi
@@ -780,21 +821,6 @@
fi
fi
- if [ -n "$fontconfig_config" ]; then
- CFLAGS="$CFLAGS -DWITH_FONTCONFIG"
- CFLAGS="$CFLAGS `$fontconfig_config --cflags | tr '\n\r' ' '`"
-
- if [ "$enable_static" != "0" ]; then
- if [ "$os" = "OSX" ]; then
- LIBS="$LIBS `$fontconfig_config --prefix`/lib/libfontconfig.a"
- else
- LIBS="$LIBS `$fontconfig_config --libs --static | tr '\n\r' ' '`"
- fi
- else
- LIBS="$LIBS `$fontconfig_config --libs | tr '\n\r' ' '`"
- fi
- fi
-
if [ "$with_direct_music" != "0" ]; then
CFLAGS="$CFLAGS -DWIN32_ENABLE_DIRECTMUSIC_SUPPORT"
# GCC 4.0+ doesn't like the DirectX includes (gives tons of
@@ -834,6 +860,10 @@
CFLAGS="$CFLAGS -DDEDICATED"
fi
+ if [ "$enable_unicode" != "0" ]; then
+ CFLAGS="$CFLAGS -DUNICODE -D_UNICODE"
+ fi
+
if [ "$enable_network" != "0" ]; then
CFLAGS="$CFLAGS -DENABLE_NETWORK"
@@ -1212,6 +1242,7 @@
/morphos/ { print "MORPHOS"; exit}
/beos/ { print "BEOS"; exit}
/sunos/ { print "SUNOS"; exit}
+ /solaris/ { print "SUNOS"; exit}
/cygwin/ { print "CYGWIN"; exit}
/mingw/ { print "MINGW"; exit}
/os2/ { print "OS2"; exit}
@@ -1540,6 +1571,12 @@
return 0
fi
+ if [ "$os" = "MINGW" ] || [ "$os" = "CYGWIN" ] || [ "$os" = "WINCE" ]; then
+ log 1 "checking libfontconfig... WIN32, skipping"
+ fontconfig_config=""
+ return 0
+ fi
+
if [ "$with_fontconfig" = "1" ] || [ "$with_fontconfig" = "" ] || [ "$with_fontconfig" = "2" ]; then
fontconfig_config="pkg-config fontconfig"
else
--- a/configure Sat Mar 10 11:07:13 2007 +0000
+++ b/configure Sun Mar 11 16:31:18 2007 +0000
@@ -1,5 +1,10 @@
#!/bin/sh
+CONFIGURE_EXECUTABLE="$_"
+# On *nix systems those two are equal when ./configure is done
+if [ "$0" != "$CONFIGURE_EXECUTABLE" ]; then
+ CONFIGURE_EXECUTABLE="$CONFIGURE_EXECUTABLE $0"
+fi
# Find out where configure is (in what dir)
ROOT_DIR="`dirname $0`"
ROOT_DIR="`cd $ROOT_DIR && pwd`"
--- a/projects/openttd.vcproj Sat Mar 10 11:07:13 2007 +0000
+++ b/projects/openttd.vcproj Sun Mar 11 16:31:18 2007 +0000
@@ -13,12 +13,12 @@
<Configurations>
<Configuration
Name="Release|Win32"
- OutputDirectory="..\objs\$(ConfigurationName)"
- IntermediateDirectory="..\objs\$(ConfigurationName)"
+ OutputDirectory="..\objs\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="..\objs\$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
- CharacterSet="2"
+ CharacterSet="1"
WholeProgramOptimization="TRUE">
<Tool
Name="VCCLCompilerTool"
@@ -57,7 +57,7 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="unicows.lib winmm.lib ws2_32.lib libpng.lib zlibstat.lib dxguid.lib libfreetype2.lib"
+ AdditionalDependencies="winmm.lib ws2_32.lib libpng.lib zlibstat.lib dxguid.lib libfreetype2.lib"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
IgnoreDefaultLibraryNames=""
@@ -93,8 +93,8 @@
</Configuration>
<Configuration
Name="Debug|Win32"
- OutputDirectory="..\objs\$(ConfigurationName)\"
- IntermediateDirectory="..\objs\$(ConfigurationName)\"
+ OutputDirectory="..\objs\$(PlatformName)\$(ConfigurationName)\"
+ IntermediateDirectory="..\objs\$(PlatformName)\$(ConfigurationName)\"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
@@ -167,6 +167,9 @@
RelativePath=".\..\src\aystar.cpp">
</File>
<File
+ RelativePath=".\..\src\autoreplace_cmd.cpp">
+ </File>
+ <File
RelativePath=".\..\src\bmp.cpp">
</File>
<File
--- a/projects/openttd.vcproj.in Sat Mar 10 11:07:13 2007 +0000
+++ b/projects/openttd.vcproj.in Sun Mar 11 16:31:18 2007 +0000
@@ -13,12 +13,12 @@
<Configurations>
<Configuration
Name="Release|Win32"
- OutputDirectory="..\objs\$(ConfigurationName)"
- IntermediateDirectory="..\objs\$(ConfigurationName)"
+ OutputDirectory="..\objs\$(PlatformName)\$(ConfigurationName)"
+ IntermediateDirectory="..\objs\$(PlatformName)\$(ConfigurationName)"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
- CharacterSet="2"
+ CharacterSet="1"
WholeProgramOptimization="TRUE">
<Tool
Name="VCCLCompilerTool"
@@ -57,7 +57,7 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
- AdditionalDependencies="unicows.lib winmm.lib ws2_32.lib libpng.lib zlibstat.lib dxguid.lib libfreetype2.lib"
+ AdditionalDependencies="winmm.lib ws2_32.lib libpng.lib zlibstat.lib dxguid.lib libfreetype2.lib"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
IgnoreDefaultLibraryNames=""
@@ -93,8 +93,8 @@
</Configuration>
<Configuration
Name="Debug|Win32"
- OutputDirectory="..\objs\$(ConfigurationName)\"
- IntermediateDirectory="..\objs\$(ConfigurationName)\"
+ OutputDirectory="..\objs\$(PlatformName)\$(ConfigurationName)\"
+ IntermediateDirectory="..\objs\$(PlatformName)\$(ConfigurationName)\"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
--- a/projects/openttd_vs80.vcproj Sat Mar 10 11:07:13 2007 +0000
+++ b/projects/openttd_vs80.vcproj Sun Mar 11 16:31:18 2007 +0000
@@ -28,7 +28,7 @@
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="2"
+ CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
@@ -139,7 +139,7 @@
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="2"
+ CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
@@ -251,7 +251,7 @@
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="2"
+ CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
@@ -346,7 +346,7 @@
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="2"
+ CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
@@ -452,6 +452,10 @@
>
</File>
<File
+ RelativePath=".\..\src\autoreplace_cmd.cpp"
+ >
+ </File>
+ <File
RelativePath=".\..\src\bmp.cpp"
>
</File>
--- a/projects/openttd_vs80.vcproj.in Sat Mar 10 11:07:13 2007 +0000
+++ b/projects/openttd_vs80.vcproj.in Sun Mar 11 16:31:18 2007 +0000
@@ -28,7 +28,7 @@
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="2"
+ CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
@@ -139,7 +139,7 @@
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="2"
+ CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
@@ -251,7 +251,7 @@
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="2"
+ CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
@@ -346,7 +346,7 @@
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
- CharacterSet="2"
+ CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
--- a/projects/strgen.tgt Sat Mar 10 11:07:13 2007 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,131 +0,0 @@
-40
-targetIdent
-0
-MProject
-1
-MComponent
-0
-2
-WString
-4
-OEXE
-3
-WString
-5
-oc2en
-1
-0
-0
-4
-MCommand
-0
-5
-MCommand
-26
-..\os\os2\build_lang.cmd
-
-6
-MItem
-10
-strgen.exe
-7
-WString
-4
-OEXE
-8
-WVList
-2
-9
-MRState
-10
-WString
-7
-OS2LINK
-11
-WString
-25
-?????No debug information
-1
-1
-12
-MRState
-13
-WString
-7
-OS2LINK
-14
-WString
-14
-?????Debug All
-1
-0
-15
-WVList
-0
--1
-1
-1
-0
-16
-WPickList
-2
-17
-MItem
-3
-*.c
-18
-WString
-4
-COBJ
-19
-WVList
-2
-20
-MRState
-21
-WString
-3
-WCC
-22
-WString
-29
-?????No debugging information
-0
-1
-23
-MRState
-24
-WString
-3
-WCC
-25
-WString
-28
-?????Line number information
-0
-0
-26
-WVList
-0
--1
-1
-1
-0
-27
-MItem
-8
-strgen.c
-28
-WString
-4
-COBJ
-29
-WVList
-0
-30
-WVList
-0
-17
-1
-1
-0
--- a/projects/strgen.vcproj Sat Mar 10 11:07:13 2007 +0000
+++ b/projects/strgen.vcproj Sun Mar 11 16:31:18 2007 +0000
@@ -31,7 +31,7 @@
AssemblerOutput="2"
AssemblerListingLocation="$(IntDir)"
ObjectFile="$(IntDir)"
- ProgramDataBaseFileName="$(IntDir)"
+ ProgramDataBaseFileName="$(IntDir)\$(TargetName).pdb"
WarningLevel="3"
WarnAsError="TRUE"
SuppressStartupBanner="TRUE"
@@ -40,11 +40,11 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
- OutputFile="$(OutDir)\strgen.exe"
+ OutputFile="$(IntDir)\strgen.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
GenerateDebugInformation="TRUE"
- ProgramDatabaseFile="$(OutDir)\strgen.pdb"
+ ProgramDatabaseFile="$(IntDir)\strgen.pdb"
SubSystem="1"
TargetMachine="1"/>
<Tool
@@ -84,12 +84,6 @@
</File>
<File
RelativePath="..\src\string.cpp">
- <FileConfiguration
- Name="Release|Win32">
- <Tool
- Name="VCCLCompilerTool"
- ObjectFile="$(IntDir)/$(InputName)1.obj"/>
- </FileConfiguration>
</File>
</Filter>
<File
--- a/projects/strgen_vs80.vcproj Sat Mar 10 11:07:13 2007 +0000
+++ b/projects/strgen_vs80.vcproj Sun Mar 11 16:31:18 2007 +0000
@@ -119,14 +119,6 @@
<File
RelativePath="..\src\string.cpp"
>
- <FileConfiguration
- Name="Release|Win32"
- >
- <Tool
- Name="VCCLCompilerTool"
- ObjectFile="$(IntDir)/$(InputName)1.obj"
- />
- </FileConfiguration>
</File>
</Filter>
<File
--- a/readme.txt Sat Mar 10 11:07:13 2007 +0000
+++ b/readme.txt Sun Mar 11 16:31:18 2007 +0000
@@ -146,6 +146,14 @@
You can also build it using the Makefile with MSYS/MinGW or Cygwin/MinGW.
Please read the Makefile for more information.
+Solaris 10:
+ You need g++ (version 3 or higher), together with SDL. Installation of
+ libpng and zlib is recommended. For the first build it is required
+ to execute "bash configure" first. Note that ./configure does not work
+ yet. It is likely that you don't have a strip binary, so use the
+ --disable-strip option in that case. Fontconfig (>2.3.0) and freetype
+ are optional. "make run" will then run the program.
+
Unix:
OpenTTD can be built with GNU "make". On non-GNU systems it's called "gmake".
However, for the first build one has to do a "./configure" first.
--- a/source.list Sat Mar 10 11:07:13 2007 +0000
+++ b/source.list Sun Mar 11 16:31:18 2007 +0000
@@ -1,6 +1,7 @@
# Source Files
airport.cpp
aystar.cpp
+autoreplace_cmd.cpp
bmp.cpp
callback_table.cpp
cargotype.cpp
--- a/src/ai/ai.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/ai/ai.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -166,7 +166,7 @@
* The gameloop for AIs.
* Handles one tick for all the AIs.
*/
-void AI_RunGameLoop(void)
+void AI_RunGameLoop()
{
/* Don't do anything if ai is disabled */
if (!_ai.enabled) return;
@@ -224,7 +224,7 @@
/**
* Initialize some AI-related stuff.
*/
-void AI_Initialize(void)
+void AI_Initialize()
{
/* First, make sure all AIs are DEAD! */
AI_Uninitialize();
@@ -238,7 +238,7 @@
/**
* Deinitializer for AI-related stuff.
*/
-void AI_Uninitialize(void)
+void AI_Uninitialize()
{
const Player* p;
--- a/src/ai/ai.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/ai/ai.h Sun Mar 11 16:31:18 2007 +0000
@@ -7,7 +7,7 @@
#include "../command.h"
/* How DoCommands look like for an AI */
-typedef struct AICommand {
+struct AICommand {
uint32 tile;
uint32 p1;
uint32 p2;
@@ -17,22 +17,22 @@
char *text;
uint uid;
- struct AICommand *next;
-} AICommand;
+ AICommand *next;
+};
/* The struct for an AIScript Player */
-typedef struct AIPlayer {
+struct AIPlayer {
bool active; ///< Is this AI active?
AICommand *queue; ///< The commands that he has in his queue
AICommand *queue_tail; ///< The tail of this queue
-} AIPlayer;
+};
/* The struct to keep some data about the AI in general */
-typedef struct AIStruct {
+struct AIStruct {
/* General */
bool enabled; ///< Is AI enabled?
uint tick; ///< The current tick (something like _frame_counter, only for AIs)
-} AIStruct;
+};
VARDEF AIStruct _ai;
VARDEF AIPlayer _ai_player[MAX_PLAYERS];
@@ -40,9 +40,9 @@
// ai.c
void AI_StartNewAI(PlayerID player);
void AI_PlayerDied(PlayerID player);
-void AI_RunGameLoop(void);
-void AI_Initialize(void);
-void AI_Uninitialize(void);
+void AI_RunGameLoop();
+void AI_Initialize();
+void AI_Uninitialize();
int32 AI_DoCommand(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint procc);
int32 AI_DoCommandCc(TileIndex tile, uint32 p1, uint32 p2, uint32 flags, uint procc, CommandCallback* callback);
@@ -50,7 +50,7 @@
* This function checks some boundries to see if we should launch a new AI.
* @return True if we can start a new AI.
*/
-static inline bool AI_AllowNewAI(void)
+static inline bool AI_AllowNewAI()
{
/* If disabled, no AI */
if (!_ai.enabled)
@@ -97,7 +97,7 @@
/**
* The random-function that should be used by ALL AIs.
*/
-static inline uint32 AI_Random(void)
+static inline uint32 AI_Random()
{
/* We pick RandomRange if we are in SP (so when saved, we do the same over and over)
* but we pick InteractiveRandomRange if we are a network_server or network-client.
--- a/src/ai/default/default.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/ai/default/default.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -93,12 +93,12 @@
FOR_ALL_VEHICLES_FROM(v, index) {
if (v->owner != _current_player) continue;
- if ((v->type == VEH_Train && v->subtype == 0) ||
- v->type == VEH_Road ||
- (v->type == VEH_Aircraft && IsNormalAircraft(v)) ||
- v->type == VEH_Ship) {
+ if ((v->type == VEH_TRAIN && v->subtype == 0) ||
+ v->type == VEH_ROAD ||
+ (v->type == VEH_AIRCRAFT && IsNormalAircraft(v)) ||
+ v->type == VEH_SHIP) {
/* replace engine? */
- if (v->type == VEH_Train && v->engine_type < 3 &&
+ if (v->type == VEH_TRAIN && v->engine_type < 3 &&
(_price.build_railvehicle >> 3) < p->player_money) {
p->ai.state = AIS_VEH_CHECK_REPLACE_VEHICLE;
p->ai.cur_veh = v;
@@ -427,8 +427,8 @@
if (!IsValidVehicle(v) ||
v->owner != _current_player ||
- v->type > VEH_Ship ||
- _veh_check_replace_proc[v->type - VEH_Train](p, v) == INVALID_ENGINE) {
+ v->type > VEH_SHIP ||
+ _veh_check_replace_proc[v->type - VEH_TRAIN](p, v) == INVALID_ENGINE) {
p->ai.state = AIS_VEH_LOOP;
} else {
p->ai.state_counter = 0;
@@ -443,22 +443,22 @@
p->ai.state = AIS_VEH_LOOP;
// vehicle is not owned by the player anymore, something went very wrong.
if (!IsValidVehicle(v) || v->owner != _current_player) return;
- _veh_do_replace_proc[v->type - VEH_Train](p);
+ _veh_do_replace_proc[v->type - VEH_TRAIN](p);
}
-typedef struct FoundRoute {
+struct FoundRoute {
int distance;
CargoID cargo;
void *from;
void *to;
-} FoundRoute;
-
-static Town *AiFindRandomTown(void)
+};
+
+static Town *AiFindRandomTown()
{
return GetRandomTown();
}
-static Industry *AiFindRandomIndustry(void)
+static Industry *AiFindRandomIndustry()
{
return GetRandomIndustry();
}
@@ -1824,12 +1824,12 @@
return tile + ToTileIndexDiff(p->tileoffs) - TileOffsByDiagDir(*dir = p->attr);
}
-typedef struct AiRailPathFindData {
+struct AiRailPathFindData {
TileIndex tile;
TileIndex tile2;
int count;
bool flag;
-} AiRailPathFindData;
+};
static bool AiEnumFollowTrack(TileIndex tile, AiRailPathFindData *a, int track, uint length, byte *state)
{
@@ -1858,7 +1858,7 @@
return arpfd.count > 8;
}
-typedef struct AiRailFinder {
+struct AiRailFinder {
TileIndex final_tile;
byte final_dir;
byte depth;
@@ -1873,7 +1873,7 @@
TileIndex cur_best_tile, best_tile;
TileIndex bridge_end_tile;
Player *player;
-} AiRailFinder;
+};
static const byte _ai_table_15[4][8] = {
{0, 0, 4, 3, 3, 1, 128 + 0, 64},
@@ -2713,7 +2713,7 @@
p->ai.state_mode = 255;
}
-typedef struct {
+struct AiRoadFinder {
TileIndex final_tile;
byte final_dir;
byte depth;
@@ -2728,14 +2728,14 @@
TileIndex cur_best_tile, best_tile;
TileIndex bridge_end_tile;
Player *player;
-} AiRoadFinder;
-
-typedef struct AiRoadEnum {
+};
+
+struct AiRoadEnum {
TileIndex dest;
TileIndex best_tile;
int best_track;
uint best_dist;
-} AiRoadEnum;
+};
static const byte _dir_by_track[] = {
0, 1, 0, 1, 2, 1,
@@ -3515,7 +3515,7 @@
Vehicle *v = p->ai.cur_veh;
if (v->owner == _current_player) {
- if (v->type == VEH_Train) {
+ if (v->type == VEH_TRAIN) {
if (!IsTileDepotType(v->tile, TRANSPORT_RAIL) || v->u.rail.track != 0x80 || !(v->vehstatus&VS_STOPPED)) {
if (v->current_order.type != OT_GOTO_DEPOT)
@@ -3526,7 +3526,7 @@
// Sell whole train
DoCommand(v->tile, v->index, 1, DC_EXEC, CMD_SELL_RAIL_WAGON);
- } else if (v->type == VEH_Road) {
+ } else if (v->type == VEH_ROAD) {
if (!IsRoadVehInDepotStopped(v)) {
if (v->current_order.type != OT_GOTO_DEPOT)
DoCommand(0, v->index, 0, DC_EXEC, CMD_SEND_ROADVEH_TO_DEPOT);
@@ -3534,7 +3534,7 @@
}
DoCommand(0, v->index, 0, DC_EXEC, CMD_SELL_ROAD_VEH);
- } else if (v->type == VEH_Aircraft) {
+ } else if (v->type == VEH_AIRCRAFT) {
if (!IsAircraftInHangarStopped(v)) {
if (v->current_order.type != OT_GOTO_DEPOT)
DoCommand(0, v->index, 0, DC_EXEC, CMD_SEND_AIRCRAFT_TO_HANGAR);
@@ -3542,9 +3542,9 @@
}
DoCommand(0, v->index, 0, DC_EXEC, CMD_SELL_AIRCRAFT);
- } else if (v->type == VEH_Ship) {
+ } else if (v->type == VEH_SHIP) {
// XXX: not implemented
- error("!v->type == VEH_Ship");
+ error("!v->type == VEH_SHIP");
}
}
--- a/src/ai/trolly/pathfinder.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/ai/trolly/pathfinder.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -372,9 +372,9 @@
extern uint GetRailFoundation(Slope tileh, TrackBits 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
-typedef enum BridgeFoundations{
+enum BridgeFoundation {
BRIDGE_NO_FOUNDATION = 1 << 0 | 1 << 3 | 1 << 6 | 1 << 9 | 1 << 12,
-} BridgeFoundation;
+};
// The most important function: it calculates the g-value
static int32 AyStar_AiPathFinder_CalculateG(AyStar *aystar, AyStarNode *current, OpenListNode *parent)
--- a/src/ai/trolly/trolly.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/ai/trolly/trolly.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -126,7 +126,7 @@
p->ainew.last_vehiclecheck_date = _date;
} else if (c < 100 && !_patches.ai_disable_veh_roadveh) {
// Do we have any spots for road-vehicles left open?
- if (GetFreeUnitNumber(VEH_Road) <= _patches.max_roadveh) {
+ if (GetFreeUnitNumber(VEH_ROAD) <= _patches.max_roadveh) {
if (c < 85) {
p->ainew.action = AI_ACTION_TRUCK_ROUTE;
} else {
@@ -135,7 +135,7 @@
}
#if 0
} else if (c < 200 && !_patches.ai_disable_veh_train) {
- if (GetFreeUnitNumber(VEH_Train) <= _patches.max_trains) {
+ if (GetFreeUnitNumber(VEH_TRAIN) <= _patches.max_trains) {
p->ainew.action = AI_ACTION_TRAIN_ROUTE;
}
#endif
@@ -173,7 +173,7 @@
// to build the route anyway..
if (p->ainew.action == AI_ACTION_BUS_ROUTE &&
money > AI_MINIMUM_BUS_ROUTE_MONEY) {
- if (GetFreeUnitNumber(VEH_Road) > _patches.max_roadveh) {
+ if (GetFreeUnitNumber(VEH_ROAD) > _patches.max_roadveh) {
p->ainew.action = AI_ACTION_NONE;
return;
}
@@ -184,7 +184,7 @@
}
if (p->ainew.action == AI_ACTION_TRUCK_ROUTE &&
money > AI_MINIMUM_TRUCK_ROUTE_MONEY) {
- if (GetFreeUnitNumber(VEH_Road) > _patches.max_roadveh) {
+ if (GetFreeUnitNumber(VEH_ROAD) > _patches.max_roadveh) {
p->ainew.action = AI_ACTION_NONE;
return;
}
@@ -1264,7 +1264,7 @@
// We are already sending him back
if (AiNew_GetSpecialVehicleFlag(p, v) & AI_VEHICLEFLAG_SELL) {
- if (v->type == VEH_Road && IsTileDepotType(v->tile, TRANSPORT_ROAD) &&
+ if (v->type == VEH_ROAD && IsTileDepotType(v->tile, TRANSPORT_ROAD) &&
(v->vehstatus&VS_STOPPED)) {
// We are at the depot, sell the vehicle
AI_DoCommand(0, v->index, 0, DC_EXEC, CMD_SELL_ROAD_VEH);
@@ -1275,7 +1275,7 @@
if (!AiNew_SetSpecialVehicleFlag(p, v, AI_VEHICLEFLAG_SELL)) return;
{
int ret = 0;
- if (v->type == VEH_Road)
+ if (v->type == VEH_ROAD)
ret = AI_DoCommand(0, v->index, 0, DC_EXEC, CMD_SEND_ROADVEH_TO_DEPOT);
// This means we can not find a depot :s
// if (CmdFailed(ret))
@@ -1293,7 +1293,7 @@
FOR_ALL_VEHICLES(v) {
if (v->owner != p->index) continue;
// Currently, we only know how to handle road-vehicles
- if (v->type != VEH_Road) continue;
+ if (v->type != VEH_ROAD) continue;
AiNew_CheckVehicle(p, v);
}
--- a/src/aircraft.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/aircraft.h Sun Mar 11 16:31:18 2007 +0000
@@ -8,12 +8,12 @@
#include "station_map.h"
#include "vehicle.h"
-typedef enum AircraftSubTypes {
+enum AircraftSubType {
AIR_HELICOPTER = 0,
AIR_AIRCRAFT = 2,
AIR_SHADOW = 4,
AIR_ROTOR = 6
-} AircraftSubType;
+};
/** Check if the aircraft type is a normal flying device; eg
@@ -23,7 +23,7 @@
* false if it is a shadow or a rotor) */
static inline bool IsNormalAircraft(const Vehicle *v)
{
- assert(v->type == VEH_Aircraft);
+ assert(v->type == VEH_AIRCRAFT);
/* To be fully correct the commented out functionality is the proper one,
* but since value can only be 0 or 2, it is sufficient to only check <= 2
* return (v->subtype == AIR_HELICOPTER) || (v->subtype == AIR_AIRCRAFT); */
@@ -33,7 +33,7 @@
static inline bool IsAircraftInHangar(const Vehicle* v)
{
- assert(v->type == VEH_Aircraft);
+ assert(v->type == VEH_AIRCRAFT);
return v->vehstatus & VS_HIDDEN && IsHangarTile(v->tile);
}
@@ -42,6 +42,20 @@
return IsAircraftInHangar(v) && v->vehstatus & VS_STOPPED;
}
+/** Checks if an aircraft is buildable at the tile in question
+ * @param engine The engine to test
+ * @param tile The tile where the hangar is
+ * @return true if the aircraft can be build
+ */
+static inline bool IsAircraftBuildableAtStation(EngineID engine, TileIndex tile)
+{
+ const Station *st = GetStationByTile(tile);
+ const AirportFTAClass *apc = st->Airport();
+ const AircraftVehicleInfo *avi = AircraftVehInfo(engine);
+
+ return (apc->flags & (avi->subtype & AIR_CTOL ? AirportFTAClass::AIRPLANES : AirportFTAClass::HELICOPTERS)) != 0;
+}
+
uint16 AircraftDefaultCargoCapacity(CargoID cid, const AircraftVehicleInfo*);
void CcBuildAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2);
--- a/src/aircraft_cmd.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/aircraft_cmd.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -227,7 +227,6 @@
}
}
-
/** Build an aircraft.
* @param tile tile of depot where aircraft is built
* @param flags for command
@@ -237,7 +236,7 @@
*/
int32 CmdBuildAircraft(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
- if (!IsEngineBuildable(p1, VEH_Aircraft, _current_player)) return_cmd_error(STR_ENGINE_NOT_BUILDABLE);
+ if (!IsEngineBuildable(p1, VEH_AIRCRAFT, _current_player)) return_cmd_error(STR_ENGINE_NOT_BUILDABLE);
const AircraftVehicleInfo *avi = AircraftVehInfo(p1);
int32 value = EstimateAircraftCost(avi);
@@ -250,11 +249,7 @@
SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
/* Prevent building aircraft types at places which can't handle them */
- const Station* st = GetStationByTile(tile);
- const AirportFTAClass* apc = st->Airport();
- if (!(apc->flags & (avi->subtype & AIR_CTOL ? AirportFTAClass::AIRPLANES : AirportFTAClass::HELICOPTERS))) {
- return CMD_ERROR;
- }
+ if (!IsAircraftBuildableAtStation(p1, tile)) return CMD_ERROR;
/* Allocate 2 or 3 vehicle structs, depending on type
* vl[0] = aircraft, vl[1] = shadow, [vl[2] = rotor] */
@@ -263,7 +258,7 @@
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
}
- UnitID unit_num = HASBIT(p2, 0) ? 0 : GetFreeUnitNumber(VEH_Aircraft);
+ UnitID unit_num = HASBIT(p2, 0) ? 0 : GetFreeUnitNumber(VEH_AIRCRAFT);
if (unit_num > _patches.max_aircraft)
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
@@ -272,7 +267,7 @@
Vehicle *u = vl[1]; // shadow
v->unitnumber = unit_num;
- v->type = u->type = VEH_Aircraft;
+ v->type = u->type = VEH_AIRCRAFT;
v->direction = DIR_SE;
v->owner = u->owner = _current_player;
@@ -367,6 +362,9 @@
* layout for #th position of depot. Since layout must start with a listing
* of all depots, it is simple */
for (uint i = 0;; i++) {
+ const Station *st = GetStationByTile(tile);
+ const AirportFTAClass *apc = st->Airport();
+
assert(i != apc->nof_depots);
if (st->airport_tile + ToTileIndexDiff(apc->airport_depots[i]) == tile) {
assert(apc->layout[i].heading == HANGAR);
@@ -402,7 +400,7 @@
u->next = w;
- w->type = VEH_Aircraft;
+ w->type = VEH_AIRCRAFT;
w->direction = DIR_N;
w->owner = _current_player;
w->x_pos = v->x_pos;
@@ -425,7 +423,7 @@
RebuildVehicleLists();
InvalidateWindow(WC_COMPANY, v->owner);
if (IsLocalPlayer())
- InvalidateAutoreplaceWindow(VEH_Aircraft); //updates the replace Aircraft window
+ InvalidateAutoreplaceWindow(VEH_AIRCRAFT); //updates the replace Aircraft window
GetPlayer(_current_player)->num_engines[p1]++;
}
@@ -457,7 +455,7 @@
Vehicle *v = GetVehicle(p1);
- if (v->type != VEH_Aircraft || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_AIRCRAFT || !CheckOwnership(v->owner)) return CMD_ERROR;
if (!IsAircraftInHangarStopped(v)) return_cmd_error(STR_A01B_AIRCRAFT_MUST_BE_STOPPED);
SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
@@ -484,7 +482,7 @@
Vehicle *v = GetVehicle(p1);
- if (v->type != VEH_Aircraft || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_AIRCRAFT || !CheckOwnership(v->owner)) return CMD_ERROR;
/* cannot stop airplane when in flight, or when taking off / landing */
if (v->u.air.state >= STARTTAKEOFF && v->u.air.state < TERM7)
@@ -526,14 +524,14 @@
if (p2 & DEPOT_MASS_SEND) {
/* Mass goto depot requested */
if (!ValidVLWFlags(p2 & VLW_MASK)) return CMD_ERROR;
- return SendAllVehiclesToDepot(VEH_Aircraft, flags, p2 & DEPOT_SERVICE, _current_player, (p2 & VLW_MASK), p1);
+ return SendAllVehiclesToDepot(VEH_AIRCRAFT, flags, p2 & DEPOT_SERVICE, _current_player, (p2 & VLW_MASK), p1);
}
if (!IsValidVehicleID(p1)) return CMD_ERROR;
Vehicle *v = GetVehicle(p1);
- if (v->type != VEH_Aircraft || !CheckOwnership(v->owner) || IsAircraftInHangar(v)) return CMD_ERROR;
+ if (v->type != VEH_AIRCRAFT || !CheckOwnership(v->owner) || IsAircraftInHangar(v)) return CMD_ERROR;
if (v->current_order.type == OT_GOTO_DEPOT && !(p2 & DEPOT_LOCATE_HANGAR)) {
if (!!(p2 & DEPOT_SERVICE) == HASBIT(v->current_order.flags, OFB_HALT_IN_DEPOT)) {
@@ -603,7 +601,7 @@
Vehicle *v = GetVehicle(p1);
- if (v->type != VEH_Aircraft || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_AIRCRAFT || !CheckOwnership(v->owner)) return CMD_ERROR;
if (!IsAircraftInHangarStopped(v)) return_cmd_error(STR_A01B_AIRCRAFT_MUST_BE_STOPPED);
/* Check cargo */
@@ -726,12 +724,12 @@
InvalidateWindowClasses(WC_AIRCRAFT_LIST);
}
-void AircraftYearlyLoop(void)
+void AircraftYearlyLoop()
{
Vehicle *v;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Aircraft && IsNormalAircraft(v)) {
+ if (v->type == VEH_AIRCRAFT && IsNormalAircraft(v)) {
v->profit_last_year = v->profit_this_year;
v->profit_this_year = 0;
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
@@ -1275,8 +1273,7 @@
if (CmdFailed(ret)) CrashAirplane(v);
} else if (v->current_order.type != OT_GOTO_DEPOT) {
- v->current_order.type = OT_NOTHING;
- v->current_order.flags = 0;
+ v->current_order.Free();
}
return;
}
@@ -1328,8 +1325,7 @@
}
Order b = v->current_order;
- v->current_order.type = OT_NOTHING;
- v->current_order.flags = 0;
+ v->current_order.Free();
MarkAircraftDirty(v);
if (!(b.flags & OF_NON_STOP)) return;
break;
@@ -1554,8 +1550,7 @@
/* if we were sent to the depot, stay there */
if (v->current_order.type == OT_GOTO_DEPOT && (v->vehstatus & VS_STOPPED)) {
- v->current_order.type = OT_NOTHING;
- v->current_order.flags = 0;
+ v->current_order.Free();
return;
}
@@ -1603,7 +1598,7 @@
return;
}
- if (v->current_order.type == OT_NOTHING) return;
+ if (!v->current_order.IsValid()) return;
/* if the block of the next position is busy, stay put */
if (AirportHasBlock(v, &apc->layout[v->u.air.pos], apc)) return;
@@ -1624,8 +1619,7 @@
}
break;
default: // orders have been deleted (no orders), goto depot and don't bother us
- v->current_order.type = OT_NOTHING;
- v->current_order.flags = 0;
+ v->current_order.Free();
v->u.air.state = HANGAR;
}
AirportMove(v, apc);
@@ -2099,14 +2093,14 @@
for (uint i = 0; i != 2; i++) {
AircraftEventHandler(v, i);
- if (v->type != VEH_Aircraft) // In case it was deleted
+ if (v->type != VEH_AIRCRAFT) // In case it was deleted
break;
}
}
/** need to be called to load aircraft from old version */
-void UpdateOldAircraft(void)
+void UpdateOldAircraft()
{
/* set airport_flags to 0 for all airports just to be sure */
Station *st;
@@ -2118,7 +2112,7 @@
FOR_ALL_VEHICLES(v_oldstyle) {
/* airplane has another vehicle with subtype 4 (shadow), helicopter also has 3 (rotor)
* skip those */
- if (v_oldstyle->type == VEH_Aircraft && IsNormalAircraft(v_oldstyle)) {
+ if (v_oldstyle->type == VEH_AIRCRAFT && IsNormalAircraft(v_oldstyle)) {
/* airplane in terminal stopped doesn't hurt anyone, so goto next */
if (v_oldstyle->vehstatus & VS_STOPPED && v_oldstyle->u.air.state == 0) {
v_oldstyle->u.air.state = HANGAR;
@@ -2148,7 +2142,7 @@
Vehicle *v;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Aircraft && IsNormalAircraft(v)) {
+ if (v->type == VEH_AIRCRAFT && IsNormalAircraft(v)) {
if (v->u.air.targetairport == st->index) { // if heading to this airport
/* update position of airplane. If plane is not flying, landing, or taking off
*you cannot delete airport, so it doesn't matter */
--- a/src/airport.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/airport.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -32,7 +32,7 @@
static AirportFTAClass *HeliStation;
-void InitializeAirports(void)
+void InitializeAirports()
{
CountryAirport = new AirportFTAClass(
_airport_moving_data_country,
@@ -175,7 +175,7 @@
);
}
-void UnInitializeAirports(void)
+void UnInitializeAirports()
{
delete CountryAirport;
delete CityAirport;
@@ -467,7 +467,7 @@
}
-uint32 GetValidAirports(void)
+uint32 GetValidAirports()
{
uint32 mask = 0;
--- a/src/airport.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/airport.h Sun Mar 11 16:31:18 2007 +0000
@@ -112,17 +112,17 @@
NOTHING_block = 1 << 30;
-typedef struct AirportMovingData {
+struct AirportMovingData {
int16 x;
int16 y;
uint16 flag;
DirectionByte direction;
-} AirportMovingData;
+};
struct AirportFTAbuildup;
// Finite sTate mAchine --> FTA
-typedef struct AirportFTAClass {
+struct AirportFTAClass {
public:
enum Flags {
AIRPLANES = 0x1,
@@ -167,22 +167,22 @@
byte size_y;
byte delta_z; // Z adjustment for helicopter pads
byte catchment;
-} AirportFTAClass;
+};
DECLARE_ENUM_AS_BIT_SET(AirportFTAClass::Flags)
// internal structure used in openttd - Finite sTate mAchine --> FTA
-typedef struct AirportFTA {
- struct AirportFTA *next; // possible extra movement choices from this position
+struct AirportFTA {
+ AirportFTA *next; // possible extra movement choices from this position
uint64 block; // 64 bit blocks (st->airport_flags), should be enough for the most complex airports
byte position; // the position that an airplane is at
byte next_position; // next position from this position
byte heading; // heading (current orders), guiding an airplane to its target on an airport
-} AirportFTA;
+};
-void InitializeAirports(void);
-void UnInitializeAirports(void);
+void InitializeAirports();
+void UnInitializeAirports();
const AirportFTAClass *GetAirport(const byte airport_type);
/** Get buildable airport bitmask.
@@ -190,6 +190,6 @@
* Bit 0 means the small airport is buildable, etc.
* @todo set availability of airports by year, instead of airplane
*/
-uint32 GetValidAirports(void);
+uint32 GetValidAirports();
#endif /* AIRPORT_H */
--- a/src/airport_gui.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/airport_gui.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -21,7 +21,7 @@
static byte _selected_airport_type;
-static void ShowBuildAirportPicker(void);
+static void ShowBuildAirportPicker();
void CcBuildAirport(bool success, TileIndex tile, uint32 p1, uint32 p2)
@@ -132,7 +132,7 @@
BuildAirToolbWndProc
};
-void ShowBuildAirToolbar(void)
+void ShowBuildAirToolbar()
{
if (!IsValidPlayer(_current_player)) return;
@@ -256,12 +256,12 @@
BuildAirportPickerWndProc
};
-static void ShowBuildAirportPicker(void)
+static void ShowBuildAirportPicker()
{
BaseWindow::Allocate(&_build_airport_desc);
}
-void InitializeAirportGui(void)
+void InitializeAirportGui()
{
_selected_airport_type = AT_SMALL;
}
--- a/src/airport_movement.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/airport_movement.h Sun Mar 11 16:31:18 2007 +0000
@@ -8,12 +8,12 @@
// state machine input struct (from external file, etc.)
// Finite sTate mAchine --> FTA
-typedef struct AirportFTAbuildup {
+struct AirportFTAbuildup {
byte position; // the position that an airplane is at
byte heading; // the current orders (eg. TAKEOFF, HANGAR, ENDLANDING, etc.)
uint64 block; // the block this position is on on the airport (st->airport_flags)
byte next; // next position from this position
-} AirportFTAbuildup;
+};
///////////////////////////////////////////////////////////////////////
/////*********Movement Positions on Airports********************///////
@@ -371,7 +371,7 @@
{ -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)
+ { 69, 9, AMED_NOSPDCLAMP | AMED_SLOWTURN, {DIR_N} }, // 8 - circle #4 (south)
};
///////////////////////////////////////////////////////////////////////
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/autoreplace_cmd.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -0,0 +1,414 @@
+/* $Id$ */
+
+#include "stdafx.h"
+#include "openttd.h"
+#include "roadveh.h"
+#include "ship.h"
+#include "table/strings.h"
+#include "functions.h"
+#include "news.h"
+#include "command.h"
+#include "player.h"
+#include "engine.h"
+#include "debug.h"
+#include "vehicle_gui.h"
+#include "depot.h"
+#include "train.h"
+#include "aircraft.h"
+#include "cargotype.h"
+
+
+/*
+ * move the cargo from one engine to another if possible
+ */
+static void MoveVehicleCargo(Vehicle *dest, Vehicle *source)
+{
+ Vehicle *v = dest;
+ int units_moved;
+
+ do {
+ do {
+ if (source->cargo_type != dest->cargo_type)
+ continue; // cargo not compatible
+
+ if (dest->cargo_count == dest->cargo_cap)
+ continue; // the destination vehicle is already full
+
+ units_moved = min(source->cargo_count, dest->cargo_cap - dest->cargo_count);
+ source->cargo_count -= units_moved;
+ dest->cargo_count += units_moved;
+ dest->cargo_source = source->cargo_source;
+
+ // copy the age of the cargo
+ dest->cargo_days = source->cargo_days;
+ dest->day_counter = source->day_counter;
+ dest->tick_counter = source->tick_counter;
+
+ } while (source->cargo_count > 0 && (dest = dest->next) != NULL);
+ dest = v;
+ } while ((source = source->next) != NULL);
+
+ /*
+ * The of the train will be incorrect at this moment. This is due
+ * to the fact that removing the old wagon updates the weight of
+ * the complete train, which is without the weight of cargo we just
+ * moved back into some (of the) new wagon(s).
+ */
+ if (dest->type == VEH_TRAIN) TrainConsistChanged(dest->first);
+}
+
+static bool VerifyAutoreplaceRefitForOrders(const Vehicle *v, const EngineID engine_type)
+{
+ const Order *o;
+ const Vehicle *u;
+
+ if (v->type == VEH_TRAIN) {
+ u = GetFirstVehicleInChain(v);
+ } else {
+ u = v;
+ }
+
+ FOR_VEHICLE_ORDERS(u, o) {
+ if (!(o->refit_cargo < NUM_CARGO)) continue;
+ if (!CanRefitTo(v->engine_type, o->refit_cargo)) continue;
+ if (!CanRefitTo(engine_type, o->refit_cargo)) return false;
+ }
+
+ return true;
+}
+
+/**
+ * Function to find what type of cargo to refit to when autoreplacing
+ * @param *v Original vehicle, that is being replaced
+ * @param engine_type The EngineID of the vehicle that is being replaced to
+ * @return The cargo type to replace to
+ * CT_NO_REFIT is returned if no refit is needed
+ * CT_INVALID is returned when both old and new vehicle got cargo capacity and refitting the new one to the old one's cargo type isn't possible
+ */
+static CargoID GetNewCargoTypeForReplace(Vehicle *v, EngineID engine_type)
+{
+ bool new_cargo_capacity = true;
+ CargoID new_cargo_type = CT_INVALID;
+
+ switch (v->type) {
+ case VEH_TRAIN:
+ new_cargo_capacity = (RailVehInfo(engine_type)->capacity > 0);
+ new_cargo_type = RailVehInfo(engine_type)->cargo_type;
+ break;
+
+ case VEH_ROAD:
+ new_cargo_capacity = (RoadVehInfo(engine_type)->capacity > 0);
+ new_cargo_type = RoadVehInfo(engine_type)->cargo_type;
+ break;
+ case VEH_SHIP:
+ new_cargo_capacity = (ShipVehInfo(engine_type)->capacity > 0);
+ new_cargo_type = ShipVehInfo(engine_type)->cargo_type;
+ break;
+
+ case VEH_AIRCRAFT:
+ /* all aircraft starts as passenger planes with cargo capacity
+ * new_cargo_capacity is always true for aircraft, which is the init value. No need to set it here */
+ new_cargo_type = CT_PASSENGERS;
+ break;
+
+ default: NOT_REACHED(); break;
+ }
+
+ if (!new_cargo_capacity) return CT_NO_REFIT; // Don't try to refit an engine with no cargo capacity
+
+ if (v->cargo_type == new_cargo_type || CanRefitTo(engine_type, v->cargo_type)) {
+ if (VerifyAutoreplaceRefitForOrders(v, engine_type)) {
+ return v->cargo_type == new_cargo_type ? (CargoID)CT_NO_REFIT : v->cargo_type;
+ } else {
+ return CT_INVALID;
+ }
+ }
+ if (v->type != VEH_TRAIN) return CT_INVALID; // We can't refit the vehicle to carry the cargo we want
+
+ /* Below this line it's safe to assume that the vehicle in question is a train */
+
+ if (v->cargo_cap != 0) return CT_INVALID; // trying to replace a vehicle with cargo capacity into another one with incompatible cargo type
+
+ /* the old engine didn't have cargo capacity, but the new one does
+ * now we will figure out what cargo the train is carrying and refit to fit this */
+ v = GetFirstVehicleInChain(v);
+ do {
+ if (v->cargo_cap == 0) continue;
+ /* Now we found a cargo type being carried on the train and we will see if it is possible to carry to this one */
+ if (v->cargo_type == new_cargo_type) return CT_NO_REFIT;
+ if (CanRefitTo(engine_type, v->cargo_type)) return v->cargo_type;
+ } while ((v=v->next) != NULL);
+ return CT_NO_REFIT; // We failed to find a cargo type on the old vehicle and we will not refit the new one
+}
+
+/* Replaces a vehicle (used to be called autorenew)
+ * This function is only called from MaybeReplaceVehicle()
+ * Must be called with _current_player set to the owner of the vehicle
+ * @param w Vehicle to replace
+ * @param flags is the flags to use when calling DoCommand(). Mainly DC_EXEC counts
+ * @return value is cost of the replacement or CMD_ERROR
+ */
+static int32 ReplaceVehicle(Vehicle **w, byte flags, int32 total_cost)
+{
+ int32 cost;
+ int32 sell_value;
+ Vehicle *old_v = *w;
+ const Player *p = GetPlayer(old_v->owner);
+ EngineID new_engine_type;
+ const UnitID cached_unitnumber = old_v->unitnumber;
+ bool new_front = false;
+ Vehicle *new_v = NULL;
+ char vehicle_name[32];
+ CargoID replacement_cargo_type;
+
+ new_engine_type = EngineReplacementForPlayer(p, old_v->engine_type);
+ if (new_engine_type == INVALID_ENGINE) new_engine_type = old_v->engine_type;
+
+ replacement_cargo_type = GetNewCargoTypeForReplace(old_v, new_engine_type);
+
+ /* check if we can't refit to the needed type, so no replace takes place to prevent the vehicle from altering cargo type */
+ if (replacement_cargo_type == CT_INVALID) return 0;
+
+ sell_value = DoCommand(0, old_v->index, 0, DC_QUERY_COST, GetCmdSellVeh(old_v));
+
+ /* We give the player a loan of the same amount as the sell value.
+ * This is needed in case he needs the income from the sale to build the new vehicle.
+ * We take it back if building fails or when we really sell the old engine */
+ SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
+ SubtractMoneyFromPlayer(sell_value);
+
+ cost = DoCommand(old_v->tile, new_engine_type, 3, flags, GetCmdBuildVeh(old_v));
+ if (CmdFailed(cost)) {
+ SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
+ SubtractMoneyFromPlayer(-sell_value); // Take back the money we just gave the player
+ return cost;
+ }
+
+ if (replacement_cargo_type != CT_NO_REFIT) cost += GetRefitCost(new_engine_type); // add refit cost
+
+ if (flags & DC_EXEC) {
+ new_v = GetVehicle(_new_vehicle_id);
+ *w = new_v; //we changed the vehicle, so MaybeReplaceVehicle needs to work on the new one. Now we tell it what the new one is
+
+ /* refit if needed */
+ if (replacement_cargo_type != CT_NO_REFIT) {
+ if (CmdFailed(DoCommand(0, new_v->index, replacement_cargo_type, DC_EXEC, GetCmdRefitVeh(new_v)))) {
+ /* Being here shows a failure, which most likely is in GetNewCargoTypeForReplace() or incorrect estimation costs */
+ error("Autoreplace failed to refit. Replace engine %d to %d and refit to cargo %d", old_v->engine_type, new_v->engine_type, replacement_cargo_type);
+ }
+ }
+
+ if (new_v->type == VEH_TRAIN && HASBIT(old_v->u.rail.flags, VRF_REVERSE_DIRECTION) && !IsMultiheaded(new_v) && !(new_v->next != NULL && IsArticulatedPart(new_v->next))) {
+ // we are autorenewing to a single engine, so we will turn it as the old one was turned as well
+ SETBIT(new_v->u.rail.flags, VRF_REVERSE_DIRECTION);
+ }
+
+ if (old_v->type == VEH_TRAIN && !IsFrontEngine(old_v)) {
+ /* this is a railcar. We need to move the car into the train
+ * We add the new engine after the old one instead of replacing it. It will give the same result anyway when we
+ * sell the old engine in a moment
+ */
+ DoCommand(0, (GetPrevVehicleInChain(old_v)->index << 16) | new_v->index, 1, DC_EXEC, CMD_MOVE_RAIL_VEHICLE);
+ /* Now we move the old one out of the train */
+ DoCommand(0, (INVALID_VEHICLE << 16) | old_v->index, 0, DC_EXEC, CMD_MOVE_RAIL_VEHICLE);
+ } else {
+ // copy/clone the orders
+ DoCommand(0, (old_v->index << 16) | new_v->index, IsOrderListShared(old_v) ? CO_SHARE : CO_COPY, DC_EXEC, CMD_CLONE_ORDER);
+ new_v->cur_order_index = old_v->cur_order_index;
+ ChangeVehicleViewWindow(old_v, new_v);
+ new_v->profit_this_year = old_v->profit_this_year;
+ new_v->profit_last_year = old_v->profit_last_year;
+ new_v->service_interval = old_v->service_interval;
+ new_front = true;
+ new_v->unitnumber = old_v->unitnumber; // use the same unit number
+
+ new_v->current_order = old_v->current_order;
+ if (old_v->type == VEH_TRAIN && GetNextVehicle(old_v) != NULL){
+ Vehicle *temp_v = GetNextVehicle(old_v);
+
+ // move the entire train to the new engine, excluding the old engine
+ if (IsMultiheaded(old_v) && temp_v == old_v->u.rail.other_multiheaded_part) {
+ // we got front and rear of a multiheaded engine right after each other. We should work with the next in line instead
+ temp_v = GetNextVehicle(temp_v);
+ }
+
+ if (temp_v != NULL) {
+ DoCommand(0, (new_v->index << 16) | temp_v->index, 1, DC_EXEC, CMD_MOVE_RAIL_VEHICLE);
+ }
+ }
+ }
+ /* We are done setting up the new vehicle. Now we move the cargo from the old one to the new one */
+ MoveVehicleCargo(new_v->type == VEH_TRAIN ? GetFirstVehicleInChain(new_v) : new_v, old_v);
+
+ // Get the name of the old vehicle if it has a custom name.
+ if (!IsCustomName(old_v->string_id)) {
+ vehicle_name[0] = '\0';
+ } else {
+ GetName(vehicle_name, old_v->string_id & 0x7FF, lastof(vehicle_name));
+ }
+ } else { // flags & DC_EXEC not set
+ /* Ensure that the player will not end up having negative money while autoreplacing
+ * This is needed because the only other check is done after the income from selling the old vehicle is substracted from the cost */
+ if (p->money64 < (cost + total_cost)) {
+ SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
+ SubtractMoneyFromPlayer(-sell_value); // Pay back the loan
+ return CMD_ERROR;
+ }
+ }
+
+ /* Take back the money we just gave the player just before building the vehicle
+ * The player will get the same amount now that the sale actually takes place */
+ SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
+ SubtractMoneyFromPlayer(-sell_value);
+
+ /* sell the engine/ find out how much you get for the old engine (income is returned as negative cost) */
+ cost += DoCommand(0, old_v->index, 0, flags, GetCmdSellVeh(old_v));
+
+ if (new_front) {
+ /* now we assign the old unitnumber to the new vehicle */
+ new_v->unitnumber = cached_unitnumber;
+ }
+
+ /* Transfer the name of the old vehicle */
+ if ((flags & DC_EXEC) && vehicle_name[0] != '\0') {
+ _cmd_text = vehicle_name;
+ DoCommand(0, new_v->index, 0, DC_EXEC, CMD_NAME_VEHICLE);
+ }
+
+ return cost;
+}
+
+/** replaces a vehicle if it's set for autoreplace or is too old
+ * (used to be called autorenew)
+ * @param v The vehicle to replace
+ * if the vehicle is a train, v needs to be the front engine
+ * @param check Checks if the replace is valid. No action is done at all
+ * @param display_costs If set, a cost animation is shown (only if check is false)
+ * @return CMD_ERROR if something went wrong. Otherwise the price of the replace
+ */
+int32 MaybeReplaceVehicle(Vehicle *v, bool check, bool display_costs)
+{
+ Vehicle *w;
+ const Player *p = GetPlayer(v->owner);
+ byte flags = 0;
+ int32 cost, temp_cost = 0;
+ bool stopped;
+
+ /* Remember the length in case we need to trim train later on
+ * If it's not a train, the value is unused
+ * round up to the length of the tiles used for the train instead of the train length instead
+ * Useful when newGRF uses custom length */
+ uint16 old_total_length = (v->type == VEH_TRAIN ?
+ (v->u.rail.cached_total_length + TILE_SIZE - 1) / TILE_SIZE * TILE_SIZE :
+ -1
+ );
+
+
+ _current_player = v->owner;
+
+ assert(IsPlayerBuildableVehicleType(v));
+
+ assert(v->vehstatus & VS_STOPPED); // the vehicle should have been stopped in VehicleEnteredDepotThisTick() if needed
+
+ /* Remember the flag v->leave_depot_instantly because if we replace the vehicle, the vehicle holding this flag will be sold
+ * If it is set, then we only stopped the vehicle to replace it (if needed) and we will need to start it again.
+ * We also need to reset the flag since it should remain false except from when the vehicle enters a depot until autoreplace is handled in the same tick */
+ stopped = v->leave_depot_instantly;
+ v->leave_depot_instantly = false;
+
+ for (;;) {
+ cost = 0;
+ w = v;
+ do {
+ if (w->type == VEH_TRAIN && IsMultiheaded(w) && !IsTrainEngine(w)) {
+ /* we build the rear ends of multiheaded trains with the front ones */
+ continue;
+ }
+
+ // check if the vehicle should be replaced
+ if (!p->engine_renew ||
+ w->age - w->max_age < (p->engine_renew_months * 30) || // replace if engine is too old
+ w->max_age == 0) { // rail cars got a max age of 0
+ if (!EngineHasReplacementForPlayer(p, w->engine_type)) // updates to a new model
+ continue;
+ }
+
+ /* Now replace the vehicle */
+ temp_cost = ReplaceVehicle(&w, flags, cost);
+
+ if (flags & DC_EXEC &&
+ (w->type != VEH_TRAIN || w->u.rail.first_engine == INVALID_ENGINE)) {
+ /* now we bought a new engine and sold the old one. We need to fix the
+ * pointers in order to avoid pointing to the old one for trains: these
+ * pointers should point to the front engine and not the cars
+ */
+ v = w;
+ }
+
+ if (!CmdFailed(temp_cost)) {
+ cost += temp_cost;
+ }
+ } while (w->type == VEH_TRAIN && (w = GetNextVehicle(w)) != NULL);
+
+ if (!(flags & DC_EXEC) && (p->money64 < (int32)(cost + p->engine_renew_money) || cost == 0)) {
+ if (!check && p->money64 < (int32)(cost + p->engine_renew_money) && ( _local_player == v->owner ) && cost != 0) {
+ StringID message;
+ SetDParam(0, v->unitnumber);
+ switch (v->type) {
+ case VEH_TRAIN: message = STR_TRAIN_AUTORENEW_FAILED; break;
+ case VEH_ROAD: message = STR_ROADVEHICLE_AUTORENEW_FAILED; break;
+ case VEH_SHIP: message = STR_SHIP_AUTORENEW_FAILED; break;
+ case VEH_AIRCRAFT: message = STR_AIRCRAFT_AUTORENEW_FAILED; break;
+ // This should never happen
+ default: NOT_REACHED(); message = 0; break;
+ }
+
+ AddNewsItem(message, NEWS_FLAGS(NM_SMALL, NF_VIEWPORT|NF_VEHICLE, NT_ADVICE, 0), v->index, 0);
+ }
+ if (stopped) v->vehstatus &= ~VS_STOPPED;
+ if (display_costs) _current_player = OWNER_NONE;
+ return CMD_ERROR;
+ }
+
+ if (flags & DC_EXEC) {
+ break; // we are done replacing since the loop ran once with DC_EXEC
+ } else if (check) {
+ /* It's a test only and we know that we can do this
+ * NOTE: payment for wagon removal is NOT included in this price */
+ return cost;
+ }
+ // now we redo the loop, but this time we actually do stuff since we know that we can do it
+ flags |= DC_EXEC;
+ }
+
+ /* If setting is on to try not to exceed the old length of the train with the replacement */
+ if (v->type == VEH_TRAIN && p->renew_keep_length) {
+ Vehicle *temp;
+ w = v;
+
+ while (v->u.rail.cached_total_length > old_total_length) {
+ // the train is too long. We will remove cars one by one from the start of the train until it's short enough
+ while (w != NULL && RailVehInfo(w->engine_type)->railveh_type != RAILVEH_WAGON) {
+ w = GetNextVehicle(w);
+ }
+ if (w == NULL) {
+ // we failed to make the train short enough
+ SetDParam(0, v->unitnumber);
+ AddNewsItem(STR_TRAIN_TOO_LONG_AFTER_REPLACEMENT, NEWS_FLAGS(NM_SMALL, NF_VIEWPORT|NF_VEHICLE, NT_ADVICE, 0), v->index, 0);
+ break;
+ }
+ temp = w;
+ w = GetNextVehicle(w);
+ DoCommand(0, (INVALID_VEHICLE << 16) | temp->index, 0, DC_EXEC, CMD_MOVE_RAIL_VEHICLE);
+ MoveVehicleCargo(v, temp);
+ cost += DoCommand(0, temp->index, 0, DC_EXEC, CMD_SELL_RAIL_WAGON);
+ }
+ }
+
+ if (stopped) v->vehstatus &= ~VS_STOPPED;
+ if (display_costs) {
+ if (IsLocalPlayer()) ShowCostOrIncomeAnimation(v->x_pos, v->y_pos, v->z_pos, cost);
+ _current_player = OWNER_NONE;
+ }
+ return cost;
+}
--- a/src/autoreplace_gui.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/autoreplace_gui.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -30,7 +30,7 @@
};
/* General Vehicle GUI based procedures that are independent of vehicle types */
-void InitializeVehiclesGuiList(void)
+void InitializeVehiclesGuiList()
{
_railtype_selected_in_replace_gui = RAILTYPE_RAIL;
}
@@ -80,12 +80,12 @@
switch (GetEngine(engine)->type) {
default: NOT_REACHED();
- case VEH_Train:
+ case VEH_TRAIN:
if (RailVehInfo(engine)->capacity == 0) return CT_INVALID; // no capacity -> can't carry cargo
return RailVehInfo(engine)->cargo_type;
- case VEH_Road: return RoadVehInfo(engine)->cargo_type;
- case VEH_Ship: return ShipVehInfo(engine)->cargo_type;
- case VEH_Aircraft: return CT_PASSENGERS; // all planes are build with passengers by default
+ case VEH_ROAD: return RoadVehInfo(engine)->cargo_type;
+ case VEH_SHIP: return ShipVehInfo(engine)->cargo_type;
+ case VEH_AIRCRAFT: return CT_PASSENGERS; // all planes are build with passengers by default
}
}
@@ -147,7 +147,7 @@
EngList_RemoveAll(list);
FOR_ALL_ENGINEIDS_OF_TYPE(e, type) {
- if (type == VEH_Train && !GenerateReplaceRailList(e, draw_left, WP(w, replaceveh_d).wagon_btnstate)) continue; // special rules for trains
+ if (type == VEH_TRAIN && !GenerateReplaceRailList(e, draw_left, WP(w, replaceveh_d).wagon_btnstate)) continue; // special rules for trains
if (draw_left) {
/* Skip drawing the engines we don't have any of and haven't set for replacement */
@@ -255,7 +255,7 @@
/* now the actual drawing of the window itself takes place */
SetDParam(0, _vehicle_type_names[w->window_number]);
- if (w->window_number == VEH_Train) {
+ if (w->window_number == VEH_TRAIN) {
/* set on/off for renew_keep_length */
SetDParam(1, p->renew_keep_length ? STR_CONFIG_PATCHES_ON : STR_CONFIG_PATCHES_OFF);
@@ -269,7 +269,7 @@
w->DrawWidgets();
- if (w->window_number == VEH_Train) {
+ if (w->window_number == VEH_TRAIN) {
/* Draw the selected railtype in the pulldown menu */
RailType railtype = _railtype_selected_in_replace_gui;
DrawString(157, w->widget[14].top + 1, _rail_types_list[railtype], 0x10);
@@ -487,19 +487,19 @@
DeleteWindowById(WC_REPLACE_VEHICLE, vehicletype);
switch (vehicletype) {
- case VEH_Train:
+ case VEH_TRAIN:
w = BaseWindow::AllocateFront(&_replace_rail_vehicle_desc, vehicletype);
w->vscroll.cap = 8;
w->resize.step_height = 14;
WP(w, replaceveh_d).wagon_btnstate = true;
break;
- case VEH_Road:
+ case VEH_ROAD:
w = BaseWindow::AllocateFront(&_replace_road_vehicle_desc, vehicletype);
w->vscroll.cap = 8;
w->resize.step_height = 14;
break;
- case VEH_Ship:
- case VEH_Aircraft:
+ case VEH_SHIP:
+ case VEH_AIRCRAFT:
w = BaseWindow::AllocateFront(&_replace_ship_aircraft_vehicle_desc, vehicletype);
w->vscroll.cap = 4;
w->resize.step_height = 24;
--- a/src/aystar.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/aystar.h Sun Mar 11 16:31:18 2007 +0000
@@ -27,7 +27,6 @@
AYSTAR_INVALID_NODE = -1,
};
-typedef struct AyStarNode AyStarNode;
struct AyStarNode {
TileIndex tile;
int direction;
@@ -35,7 +34,6 @@
};
// The resulting path has nodes looking like this.
-typedef struct PathNode PathNode;
struct PathNode {
AyStarNode node;
// The parent of this item
@@ -45,13 +43,12 @@
// For internal use only
// We do not save the h-value, because it is only needed to calculate the f-value.
// h-value should _always_ be the distance left to the end-tile.
-typedef struct OpenListNode OpenListNode;
struct OpenListNode {
int g;
PathNode path;
};
-typedef struct AyStar AyStar;
+struct AyStar;
/*
* This function is called to check if the end-tile is found
* return values can be:
--- a/src/bmp.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/bmp.h Sun Mar 11 16:31:18 2007 +0000
@@ -5,7 +5,7 @@
#ifndef BMP_H
#define BMP_H
-typedef struct {
+struct BmpInfo {
uint32 offset; ///< offset of bitmap data from .bmp file begining
uint32 width; ///< bitmap width
uint32 height; ///< bitmap height
@@ -13,22 +13,22 @@
uint16 bpp; ///< bits per pixel
uint32 compression; ///< compression method (0 = none, 1 = 8-bit RLE, 2 = 4-bit RLE)
uint32 palette_size; ///< number of colors in palette
-} BmpInfo;
+};
-typedef struct {
+struct BmpData {
Colour *palette;
byte *bitmap;
-} BmpData;
+};
#define BMP_BUFFER_SIZE 1024
-typedef struct {
+struct BmpBuffer {
byte data[BMP_BUFFER_SIZE];
int pos;
int read;
FILE *file;
uint real_pos;
-} BmpBuffer;
+};
void BmpInitializeBuffer(BmpBuffer *buffer, FILE *file);
bool BmpReadHeader(BmpBuffer *buffer, BmpInfo *info, BmpData *data);
--- a/src/bridge.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/bridge.h Sun Mar 11 16:31:18 2007 +0000
@@ -11,7 +11,7 @@
/** Struct containing information about a single bridge type
*/
-typedef struct Bridge {
+struct Bridge {
Year avail_year; ///< the year in which the bridge becomes available
byte min_length; ///< the minimum length of the bridge (not counting start and end tile)
byte max_length; ///< the maximum length of the bridge (not counting start and end tile)
@@ -22,7 +22,7 @@
StringID material; ///< the string that contains the bridge description
PalSpriteID **sprite_table; ///< table of sprites for drawing the bridge
byte flags; ///< bit 0 set: disable drawing of far pillars.
-} Bridge;
+};
extern const Bridge orig_bridge[MAX_BRIDGES];
extern Bridge _bridge[MAX_BRIDGES];
--- a/src/build_vehicle_gui.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/build_vehicle_gui.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -63,7 +63,7 @@
static void SetupWindowStrings(BaseWindow *w, byte type)
{
switch (type) {
- case VEH_Train:
+ case VEH_TRAIN:
w->widget[BUILD_VEHICLE_WIDGET_CAPTION].data = STR_JUST_STRING;
w->widget[BUILD_VEHICLE_WIDGET_LIST].tooltips = STR_8843_TRAIN_VEHICLE_SELECTION;
w->widget[BUILD_VEHICLE_WIDGET_BUILD].data = STR_881F_BUILD_VEHICLE;
@@ -71,7 +71,7 @@
w->widget[BUILD_VEHICLE_WIDGET_RENAME].data = STR_8820_RENAME;
w->widget[BUILD_VEHICLE_WIDGET_RENAME].tooltips = STR_8845_RENAME_TRAIN_VEHICLE_TYPE;
break;
- case VEH_Road:
+ case VEH_ROAD:
w->widget[BUILD_VEHICLE_WIDGET_CAPTION].data = STR_9006_NEW_ROAD_VEHICLES;
w->widget[BUILD_VEHICLE_WIDGET_LIST].tooltips = STR_9026_ROAD_VEHICLE_SELECTION;
w->widget[BUILD_VEHICLE_WIDGET_BUILD].data = STR_9007_BUILD_VEHICLE;
@@ -79,7 +79,7 @@
w->widget[BUILD_VEHICLE_WIDGET_RENAME].data = STR_9034_RENAME;
w->widget[BUILD_VEHICLE_WIDGET_RENAME].tooltips = STR_9035_RENAME_ROAD_VEHICLE_TYPE;
break;
- case VEH_Ship:
+ case VEH_SHIP:
w->widget[BUILD_VEHICLE_WIDGET_CAPTION].data = STR_9808_NEW_SHIPS;
w->widget[BUILD_VEHICLE_WIDGET_LIST].tooltips = STR_9825_SHIP_SELECTION_LIST_CLICK;
w->widget[BUILD_VEHICLE_WIDGET_BUILD].data = STR_9809_BUILD_SHIP;
@@ -87,7 +87,7 @@
w->widget[BUILD_VEHICLE_WIDGET_RENAME].data = STR_9836_RENAME;
w->widget[BUILD_VEHICLE_WIDGET_RENAME].tooltips = STR_9837_RENAME_SHIP_TYPE;
break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
w->widget[BUILD_VEHICLE_WIDGET_CAPTION].data = STR_A005_NEW_AIRCRAFT;
w->widget[BUILD_VEHICLE_WIDGET_LIST].tooltips = STR_A025_AIRCRAFT_SELECTION_LIST;
w->widget[BUILD_VEHICLE_WIDGET_BUILD].data = STR_A006_BUILD_AIRCRAFT;
@@ -536,7 +536,7 @@
bool refitable = false;
switch (e->type) {
- case VEH_Train: {
+ case VEH_TRAIN: {
const RailVehicleInfo *rvi = RailVehInfo(engine_number);
refitable = (EngInfo(engine_number)->refit_mask != 0) && (rvi->capacity > 0);
@@ -562,23 +562,23 @@
y += 10;
}
break;
- case VEH_Road:
+ case VEH_ROAD:
y = DrawRoadVehPurchaseInfo(x, y, engine_number, RoadVehInfo(engine_number));
refitable = true;
break;
- case VEH_Ship: {
+ case VEH_SHIP: {
const ShipVehicleInfo *svi = ShipVehInfo(engine_number);
y = DrawShipPurchaseInfo(x, y, engine_number, svi);
refitable = svi->refittable;
} break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
y = DrawAircraftPurchaseInfo(x, y, engine_number, AircraftVehInfo(engine_number));
refitable = true;
break;
}
/* Draw details, that applies to all types except rail wagons */
- if (e->type != VEH_Train || RailVehInfo(engine_number)->railveh_type != RAILVEH_WAGON) {
+ if (e->type != VEH_TRAIN || RailVehInfo(engine_number)->railveh_type != RAILVEH_WAGON) {
/* Design date - Life length */
SetDParam(0, ymd.year);
SetDParam(1, e->lifelength);
@@ -616,7 +616,7 @@
const RailVehicleInfo *rvi = RailVehInfo(eid);
if (bv->filter.railtype != RAILTYPE_END && !HasPowerOnRail(rvi->railtype, bv->filter.railtype)) continue;
- if (!IsEngineBuildable(eid, VEH_Train, _local_player)) continue;
+ if (!IsEngineBuildable(eid, VEH_TRAIN, _local_player)) continue;
EngList_Add(&bv->eng_list, eid);
if (rvi->railveh_type != RAILVEH_WAGON) {
@@ -653,7 +653,7 @@
sel_id = INVALID_ENGINE;
for (eid = ROAD_ENGINES_INDEX; eid < ROAD_ENGINES_INDEX + NUM_ROAD_ENGINES; eid++) {
- if (!IsEngineBuildable(eid, VEH_Road, _local_player)) continue;
+ if (!IsEngineBuildable(eid, VEH_ROAD, _local_player)) continue;
EngList_Add(&bv->eng_list, eid);
if (eid == bv->sel_engine) sel_id = eid;
@@ -672,7 +672,7 @@
sel_id = INVALID_ENGINE;
for (eid = SHIP_ENGINES_INDEX; eid < SHIP_ENGINES_INDEX + NUM_SHIP_ENGINES; eid++) {
- if (!IsEngineBuildable(eid, VEH_Ship, _local_player)) continue;
+ if (!IsEngineBuildable(eid, VEH_SHIP, _local_player)) continue;
EngList_Add(&bv->eng_list, eid);
if (eid == bv->sel_engine) sel_id = eid;
@@ -694,26 +694,11 @@
* when planes become obsolete and are removed */
sel_id = INVALID_ENGINE;
for (eid = AIRCRAFT_ENGINES_INDEX; eid < AIRCRAFT_ENGINES_INDEX + NUM_AIRCRAFT_ENGINES; eid++) {
- if (IsEngineBuildable(eid, VEH_Aircraft, _local_player)) {
- const AircraftVehicleInfo *avi = AircraftVehInfo(eid);
- switch (bv->filter.flags & ~AirportFTAClass::SHORT_STRIP) { // we don't care about the length of the runway here
- case AirportFTAClass::HELICOPTERS:
- if (avi->subtype != AIR_HELI) continue;
- break;
+ if (!IsEngineBuildable(eid, VEH_AIRCRAFT, _local_player)) continue;
+ if (w->window_number != 0 && !IsAircraftBuildableAtStation(eid, w->window_number)) continue;
- case AirportFTAClass::AIRPLANES:
- if (!(avi->subtype & AIR_CTOL)) continue;
- break;
-
- case AirportFTAClass::ALL: break;
- default:
- NOT_REACHED();
- }
-
- EngList_Add(&bv->eng_list, eid);
-
- if (eid == bv->sel_engine) sel_id = eid;
- }
+ EngList_Add(&bv->eng_list, eid);
+ if (eid == bv->sel_engine) sel_id = eid;
}
bv->sel_engine = sel_id;
@@ -725,16 +710,16 @@
buildvehicle_d *bv = &WP(w, buildvehicle_d);
switch (bv->vehicle_type) {
- case VEH_Train:
+ case VEH_TRAIN:
GenerateBuildTrainList(w);
return; // trains should not reach the last sorting
- case VEH_Road:
+ case VEH_ROAD:
GenerateBuildRoadVehList(w);
break;
- case VEH_Ship:
+ case VEH_SHIP:
GenerateBuildShipList(w);
break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
GenerateBuildAircraftList(w);
break;
}
@@ -745,10 +730,10 @@
static void DrawVehicleEngine(byte type, int x, int y, EngineID engine, SpriteID pal)
{
switch (type) {
- case VEH_Train: DrawTrainEngine( x, y, engine, pal); break;
- case VEH_Road: DrawRoadVehEngine( x, y, engine, pal); break;
- case VEH_Ship: DrawShipEngine( x, y, engine, pal); break;
- case VEH_Aircraft: DrawAircraftEngine(x, y, engine, pal); break;
+ case VEH_TRAIN: DrawTrainEngine( x, y, engine, pal); break;
+ case VEH_ROAD: DrawRoadVehEngine( x, y, engine, pal); break;
+ case VEH_SHIP: DrawShipEngine( x, y, engine, pal); break;
+ case VEH_AIRCRAFT: DrawAircraftEngine(x, y, engine, pal); break;
default: NOT_REACHED();
}
}
@@ -772,22 +757,22 @@
assert(max <= EngList_Count(&eng_list));
switch (type) {
- case VEH_Train:
+ case VEH_TRAIN:
x++; // train and road vehicles use the same offset, except trains are one more pixel to the right
/* Fallthough */
- case VEH_Road:
+ case VEH_ROAD:
x += 26;
x_offset = 30;
y += 2;
y_offset = 4;
break;
- case VEH_Ship:
+ case VEH_SHIP:
x += 35;
x_offset = 40;
y += 7;
y_offset = 3;
break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
x += 27;
x_offset = 33;
y += 7;
@@ -858,17 +843,17 @@
EngineID sel_eng = bv->sel_engine;
if (sel_eng != INVALID_ENGINE) {
switch (bv->vehicle_type) {
- case VEH_Train:
+ case VEH_TRAIN:
DoCommandP(w->window_number, sel_eng, 0, (RailVehInfo(sel_eng)->railveh_type == RAILVEH_WAGON) ? CcBuildWagon : CcBuildLoco,
CMD_BUILD_RAIL_VEHICLE | CMD_MSG(STR_882B_CAN_T_BUILD_RAILROAD_VEHICLE));
break;
- case VEH_Road:
+ case VEH_ROAD:
DoCommandP(w->window_number, sel_eng, 0, CcBuildRoadVeh, CMD_BUILD_ROAD_VEH | CMD_MSG(STR_9009_CAN_T_BUILD_ROAD_VEHICLE));
break;
- case VEH_Ship:
+ case VEH_SHIP:
DoCommandP(w->window_number, sel_eng, 0, CcBuildShip, CMD_BUILD_SHIP | CMD_MSG(STR_980D_CAN_T_BUILD_SHIP));
break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
DoCommandP(w->window_number, sel_eng, 0, CcBuildAircraft, CMD_BUILD_AIRCRAFT | CMD_MSG(STR_A008_CAN_T_BUILD_AIRCRAFT));
break;
}
@@ -883,10 +868,10 @@
bv->rename_engine = sel_eng;
switch (bv->vehicle_type) {
- case VEH_Train: str = STR_886A_RENAME_TRAIN_VEHICLE_TYPE; break;
- case VEH_Road: str = STR_9036_RENAME_ROAD_VEHICLE_TYPE; break;
- case VEH_Ship: str = STR_9838_RENAME_SHIP_TYPE; break;
- case VEH_Aircraft: str = STR_A039_RENAME_AIRCRAFT_TYPE; break;
+ case VEH_TRAIN: str = STR_886A_RENAME_TRAIN_VEHICLE_TYPE; break;
+ case VEH_ROAD: str = STR_9036_RENAME_ROAD_VEHICLE_TYPE; break;
+ case VEH_SHIP: str = STR_9838_RENAME_SHIP_TYPE; break;
+ case VEH_AIRCRAFT: str = STR_A039_RENAME_AIRCRAFT_TYPE; break;
}
ShowQueryString(GetCustomEngineName(sel_eng), str, 31, 160, w, CS_ALPHANUMERAL);
}
@@ -926,10 +911,10 @@
StringID str = STR_NULL;
_cmd_text = e->we.edittext.str;
switch (bv->vehicle_type) {
- case VEH_Train: str = STR_886B_CAN_T_RENAME_TRAIN_VEHICLE; break;
- case VEH_Road: str = STR_9037_CAN_T_RENAME_ROAD_VEHICLE; break;
- case VEH_Ship: str = STR_9839_CAN_T_RENAME_SHIP_TYPE; break;
- case VEH_Aircraft: str = STR_A03A_CAN_T_RENAME_AIRCRAFT_TYPE; break;
+ case VEH_TRAIN: str = STR_886B_CAN_T_RENAME_TRAIN_VEHICLE; break;
+ case VEH_ROAD: str = STR_9037_CAN_T_RENAME_ROAD_VEHICLE; break;
+ case VEH_SHIP: str = STR_9839_CAN_T_RENAME_SHIP_TYPE; break;
+ case VEH_AIRCRAFT: str = STR_A03A_CAN_T_RENAME_AIRCRAFT_TYPE; break;
}
DoCommandP(0, bv->rename_engine, 0, NULL, CMD_RENAME_ENGINE | CMD_MSG(str));
}
@@ -992,16 +977,16 @@
bv->descending_sort_order = _last_sort_order[type];
switch (type) {
- case VEH_Train:
+ case VEH_TRAIN:
WP(w,buildvehicle_d).filter.railtype = (tile == 0) ? RAILTYPE_END : GetRailType(tile);
w->Resize(0, 16);
break;
- case VEH_Road:
+ case VEH_ROAD:
w->Resize(20, 16);
- case VEH_Ship:
+ case VEH_SHIP:
w->Resize(27, 0);
break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
bv->filter.flags =
tile == 0 ? AirportFTAClass::ALL : GetStationByTile(tile)->Airport()->flags;
w->Resize(12, 0);
--- a/src/cargotype.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/cargotype.h Sun Mar 11 16:31:18 2007 +0000
@@ -9,7 +9,7 @@
typedef uint32 CargoLabel;
-typedef struct CargoSpec {
+struct CargoSpec {
uint8 bitnum;
CargoLabel label;
uint32 grfid;
@@ -35,7 +35,7 @@
uint16 classes;
bool IsValid() const;
-} CargoSpec;
+};
extern uint32 _cargo_mask;
--- a/src/clear_cmd.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/clear_cmd.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -22,12 +22,12 @@
#include "genworld.h"
#include "industry.h"
-typedef struct TerraformerHeightMod {
+struct TerraformerHeightMod {
TileIndex tile;
byte height;
-} TerraformerHeightMod;
+};
-typedef struct TerraformerState {
+struct TerraformerState {
int height[4];
uint32 flags;
@@ -40,7 +40,7 @@
TileIndex *tile_table;
TerraformerHeightMod *modheight;
-} TerraformerState;
+};
static int TerraformAllowTileProcess(TerraformerState *ts, TileIndex tile)
{
@@ -718,7 +718,7 @@
MarkTileDirtyByTile(tile);
}
-void GenerateClearTile(void)
+void GenerateClearTile()
{
uint i, gi;
TileIndex tile;
@@ -792,7 +792,7 @@
return;
}
-void InitializeClearLand(void)
+void InitializeClearLand()
{
_opt.snow_line = _patches.snow_line_height * TILE_HEIGHT;
}
--- a/src/clear_map.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/clear_map.h Sun Mar 11 16:31:18 2007 +0000
@@ -12,14 +12,14 @@
/* ground type, m5 bits 2...4
* valid densities (bits 0...1) in comments after the enum
*/
-typedef enum ClearGround {
+enum ClearGround {
CLEAR_GRASS = 0, ///< 0-3
CLEAR_ROUGH = 1, ///< 3
CLEAR_ROCKS = 2, ///< 3
CLEAR_FIELDS = 3, ///< 3
CLEAR_SNOW = 4, ///< 0-3
CLEAR_DESERT = 5 ///< 1,3
-} ClearGround;
+};
static inline ClearGround GetClearGround(TileIndex t)
--- a/src/command.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/command.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -395,7 +395,7 @@
return res;
}
-int32 GetAvailableMoneyForCommand(void)
+int32 GetAvailableMoneyForCommand()
{
PlayerID pid = _current_player;
if (!IsValidPlayer(pid)) return 0x7FFFFFFF; // max int
--- a/src/command.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/command.h Sun Mar 11 16:31:18 2007 +0000
@@ -176,10 +176,10 @@
typedef int32 CommandProc(TileIndex tile, uint32 flags, uint32 p1, uint32 p2);
-typedef struct Command {
+struct Command {
CommandProc *proc;
byte flags;
-} Command;
+};
//#define return_cmd_error(errcode) do { _error_message=(errcode); return CMD_ERROR; } while(0)
#define return_cmd_error(errcode) do { return CMD_ERROR | (errcode); } while (0)
@@ -209,6 +209,6 @@
bool IsValidCommand(uint cmd);
byte GetCommandFlags(uint cmd);
-int32 GetAvailableMoneyForCommand(void);
+int32 GetAvailableMoneyForCommand();
#endif /* COMMAND_H */
--- a/src/console.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/console.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -46,7 +46,7 @@
* end of header *
* *************** */
-static void IConsoleClearCommand(void)
+static void IConsoleClearCommand()
{
memset(_iconsole_cmdline.buf, 0, ICON_CMDLN_SIZE);
_iconsole_cmdline.length = 0;
@@ -56,7 +56,7 @@
BaseWindow::SetDirtyById(WC_CONSOLE, 0);
}
-static inline void IConsoleResetHistoryPos(void) {_iconsole_historypos = ICON_HISTORY_SIZE - 1;}
+static inline void IConsoleResetHistoryPos() {_iconsole_historypos = ICON_HISTORY_SIZE - 1;}
static void IConsoleHistoryAdd(const char *cmd);
@@ -207,7 +207,7 @@
IConsoleWndProc,
};
-void IConsoleInit(void)
+void IConsoleInit()
{
extern const char _openttd_revision[];
_iconsole_output_file = NULL;
@@ -238,7 +238,7 @@
IConsoleHistoryAdd("");
}
-void IConsoleClearBuffer(void)
+void IConsoleClearBuffer()
{
uint i;
for (i = 0; i <= ICON_BUFFER; i++) {
@@ -247,7 +247,7 @@
}
}
-static void IConsoleClear(void)
+static void IConsoleClear()
{
free(_iconsole_cmdline.buf);
IConsoleClearBuffer();
@@ -262,7 +262,7 @@
}
}
-bool CloseConsoleLogIfActive(void)
+bool CloseConsoleLogIfActive()
{
if (_iconsole_output_file != NULL) {
IConsolePrintF(_icolour_def, "file output complete");
@@ -274,7 +274,7 @@
return false;
}
-void IConsoleFree(void)
+void IConsoleFree()
{
IConsoleClear();
CloseConsoleLogIfActive();
@@ -295,7 +295,7 @@
MarkWholeScreenDirty();
}
-void IConsoleSwitch(void)
+void IConsoleSwitch()
{
switch (_iconsole_mode) {
case ICONSOLE_CLOSED: {
@@ -314,8 +314,8 @@
MarkWholeScreenDirty();
}
-void IConsoleClose(void) {if (_iconsole_mode == ICONSOLE_OPENED) IConsoleSwitch();}
-void IConsoleOpen(void) {if (_iconsole_mode == ICONSOLE_CLOSED) IConsoleSwitch();}
+void IConsoleClose() {if (_iconsole_mode == ICONSOLE_OPENED) IConsoleSwitch();}
+void IConsoleOpen() {if (_iconsole_mode == ICONSOLE_CLOSED) IConsoleSwitch();}
/**
* Add the entered line into the history so you can look it back
--- a/src/console.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/console.h Sun Mar 11 16:31:18 2007 +0000
@@ -5,12 +5,14 @@
#ifndef CONSOLE_H
#define CONSOLE_H
+#include "window.h"
+
/* maximum length of a typed in command */
#define ICON_CMDLN_SIZE 255
/* maximum length of a totally expanded command */
#define ICON_MAX_STREAMSIZE 1024
-typedef enum IConsoleVarTypes {
+enum IConsoleVarTypes {
ICONSOLE_VAR_BOOLEAN,
ICONSOLE_VAR_BYTE,
ICONSOLE_VAR_UINT16,
@@ -18,31 +20,31 @@
ICONSOLE_VAR_INT16,
ICONSOLE_VAR_INT32,
ICONSOLE_VAR_STRING
-} IConsoleVarTypes;
+};
-typedef enum IConsoleModes {
+enum IConsoleModes {
ICONSOLE_FULL,
ICONSOLE_OPENED,
ICONSOLE_CLOSED
-} IConsoleModes;
+};
-typedef enum IConsoleHookTypes {
+enum IConsoleHookTypes {
ICONSOLE_HOOK_ACCESS,
ICONSOLE_HOOK_PRE_ACTION,
ICONSOLE_HOOK_POST_ACTION
-} IConsoleHookTypes;
+};
/** --Hooks--
* Hooks are certain triggers get get accessed/executed on either
* access, before execution/change or after execution/change. This allows
* for general flow of permissions or special action needed in some cases
*/
-typedef bool IConsoleHook(void);
-typedef struct IConsoleHooks{
+typedef bool IConsoleHook();
+struct IConsoleHooks{
IConsoleHook *access; ///< trigger when accessing the variable/command
IConsoleHook *pre; ///< trigger before the variable/command is changed/executed
IConsoleHook *post; ///< trigger after the variable/command is changed/executed
-} IConsoleHooks;
+};
/** --Commands--
* Commands are commands, or functions. They get executed once and any
@@ -53,14 +55,13 @@
*/
typedef bool (IConsoleCmdProc)(byte argc, char *argv[]);
-struct IConsoleCmd;
-typedef struct IConsoleCmd {
+struct IConsoleCmd {
char *name; ///< name of command
- struct IConsoleCmd *next; ///< next command in list
+ IConsoleCmd *next; ///< next command in list
IConsoleCmdProc *proc; ///< process executed when command is typed
IConsoleHooks hook; ///< any special trigger action that needs executing
-} IConsoleCmd;
+};
/** --Variables--
* Variables are pointers to real ingame variables which allow for
@@ -71,10 +72,9 @@
* - '++' to increase value by one
* - '--' to decrease value by one
*/
-struct IConsoleVar;
-typedef struct IConsoleVar {
+struct IConsoleVar {
char *name; ///< name of the variable
- struct IConsoleVar *next; ///< next variable in list
+ IConsoleVar *next; ///< next variable in list
void *addr; ///< the address where the variable is pointing at
uint32 size; ///< size of the variable, used for strings
@@ -82,7 +82,7 @@
IConsoleVarTypes type; ///< type of variable (for correct assignment/output)
IConsoleCmdProc *proc; ///< some variables need really special handling, use a callback function for that
IConsoleHooks hook; ///< any special trigger action that needs executing
-} IConsoleVar;
+};
/** --Aliases--
* Aliases are like shortcuts for complex functions, variable assignments,
@@ -95,13 +95,12 @@
* - "%!" also lists all parameters but presenting them to the aliased command as one argument
* - ";" allows for combining commands (see example 'ng')
*/
-struct IConsoleAlias;
-typedef struct IConsoleAlias {
+struct IConsoleAlias {
char *name; ///< name of the alias
- struct IConsoleAlias *next; ///< next alias in list
+ IConsoleAlias *next; ///< next alias in list
char *cmdline; ///< command(s) that is/are being aliased
-} IConsoleAlias;
+};
/* console parser */
VARDEF IConsoleCmd *_iconsole_cmds; ///< list of registred commands
@@ -117,13 +116,13 @@
VARDEF IConsoleModes _iconsole_mode;
/* console functions */
-void IConsoleInit(void);
-void IConsoleFree(void);
-void IConsoleClearBuffer(void);
+void IConsoleInit();
+void IConsoleFree();
+void IConsoleClearBuffer();
void IConsoleResize(BaseWindow *w);
-void IConsoleSwitch(void);
-void IConsoleClose(void);
-void IConsoleOpen(void);
+void IConsoleSwitch();
+void IConsoleClose();
+void IConsoleOpen();
/* console output */
void IConsolePrint(uint16 color_code, const char *string);
@@ -150,7 +149,7 @@
void IConsoleVarExec(const IConsoleVar *var, byte tokencount, char *token[]);
/* console std lib (register ingame commands/aliases/variables) */
-void IConsoleStdLibRegister(void);
+void IConsoleStdLibRegister();
/* Hooking code */
void IConsoleCmdHookAdd(const char *name, IConsoleHookTypes type, IConsoleHook *proc);
--- a/src/console_cmds.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/console_cmds.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -32,7 +32,7 @@
// ** console command / variable defines ** //
#define DEF_CONSOLE_CMD(function) static bool function(byte argc, char *argv[])
-#define DEF_CONSOLE_HOOK(function) static bool function(void)
+#define DEF_CONSOLE_HOOK(function) static bool function()
/* **************************** */
@@ -41,7 +41,7 @@
#ifdef ENABLE_NETWORK
-static inline bool NetworkAvailable(void)
+static inline bool NetworkAvailable()
{
if (!_network_available) {
IConsoleError("You cannot use this command because there is no network available.");
@@ -141,7 +141,7 @@
FOR_ALL_VEHICLES(v) {
/* Code ripped from CmdStartStopTrain. Can't call it, because of
* ownership problems, so we'll duplicate some code, for now */
- if (v->type == VEH_Train)
+ if (v->type == VEH_TRAIN)
v->u.rail.days_since_order_progr = 0;
v->vehstatus |= VS_STOPPED;
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
@@ -175,7 +175,7 @@
}
extern bool SafeSaveOrLoad(const char *filename, int mode, int newgm);
-extern void BuildFileList(void);
+extern void BuildFileList();
extern void SetFiosType(const byte fiostype);
/* Save the map to a file */
@@ -499,7 +499,7 @@
return true;
}
- if (_pause == 0) {
+ if (_pause_game == 0) {
DoCommandP(0, 1, 0, NULL, CMD_PAUSE);
IConsolePrint(_icolour_def, "Game paused.");
} else {
@@ -516,7 +516,7 @@
return true;
}
- if (_pause != 0) {
+ if (_pause_game != 0) {
DoCommandP(0, 0, 0, NULL, CMD_PAUSE);
IConsolePrint(_icolour_def, "Game unpaused.");
} else {
@@ -544,6 +544,7 @@
{
static const char* const stat_str[] = {
"inactive",
+ "authorizing",
"authorized",
"waiting",
"loading map",
@@ -852,7 +853,7 @@
/* **************************** */
/* default console commands */
/* **************************** */
-extern bool CloseConsoleLogIfActive(void);
+extern bool CloseConsoleLogIfActive();
DEF_CONSOLE_CMD(ConScript)
{
@@ -1441,7 +1442,7 @@
/* debug commands and variables */
/* ****************************************** */
-static void IConsoleDebugLibRegister(void)
+static void IConsoleDebugLibRegister()
{
/* debugging variables and functions */
extern bool _stdlib_con_developer; // XXX extern in .cpp
@@ -1458,7 +1459,7 @@
/* console command and variable registration */
/* ****************************************** */
-void IConsoleStdLibRegister(void)
+void IConsoleStdLibRegister()
{
/* stdlib */
extern byte _stdlib_developer; // XXX extern in .cpp
--- a/src/currency.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/currency.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -128,7 +128,7 @@
* get a mask of the allowed currencies depending on the year
* @return mask of currencies
*/
-uint GetMaskOfAllowedCurrencies(void)
+uint GetMaskOfAllowedCurrencies()
{
uint mask = 0;
uint i;
@@ -147,7 +147,7 @@
/**
* Verify if the currency chosen by the user is about to be converted to Euro
**/
-void CheckSwitchToEuro(void)
+void CheckSwitchToEuro()
{
if (_currency_specs[_opt.currency].to_euro != CF_NOEURO &&
_currency_specs[_opt.currency].to_euro != CF_ISEURO &&
@@ -161,7 +161,7 @@
* Called only from newgrf.c. Will fill _currency_specs array with
* default values from origin_currency_specs
**/
-void ResetCurrencies(void)
+void ResetCurrencies()
{
memcpy(&_currency_specs, &origin_currency_specs, sizeof(origin_currency_specs));
}
@@ -170,10 +170,10 @@
* Build a list of currency names StringIDs to use in a dropdown list
* @return Pointer to a (static) array of StringIDs
*/
-StringID* BuildCurrencyDropdown(void)
+StringID* BuildCurrencyDropdown()
{
/* Allow room for all currencies, plus a terminator entry */
- static StringID names[CUSTOM_CURRENCY_ID];
+ static StringID names[NUM_CURRENCY + 1];
uint i;
/* Add each name */
--- a/src/currency.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/currency.h Sun Mar 11 16:31:18 2007 +0000
@@ -12,7 +12,7 @@
CUSTOM_CURRENCY_ID = NUM_CURRENCY - 1
};
-typedef struct {
+struct CurrencySpec {
uint16 rate;
char separator;
Year to_euro;
@@ -29,7 +29,7 @@
*/
byte symbol_pos;
StringID name;
-} CurrencySpec;
+};
extern CurrencySpec _currency_specs[NUM_CURRENCY];
@@ -38,10 +38,10 @@
#define _custom_currency (_currency_specs[CUSTOM_CURRENCY_ID])
#define _currency ((const CurrencySpec*)&_currency_specs[_opt_ptr->currency])
-uint GetMaskOfAllowedCurrencies(void);
-void CheckSwitchToEuro(void);
-void ResetCurrencies(void);
-StringID* BuildCurrencyDropdown(void);
+uint GetMaskOfAllowedCurrencies();
+void CheckSwitchToEuro();
+void ResetCurrencies();
+StringID* BuildCurrencyDropdown();
byte GetNewgrfCurrencyIdConverted(byte grfcurr_id);
#endif /* CURRENCY_H */
--- a/src/date.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/date.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -178,24 +178,24 @@
OnNewDay_DisasterVehicle,
};
-extern void WaypointsDailyLoop(void);
-extern void TextMessageDailyLoop(void);
-extern void EnginesDailyLoop(void);
-extern void DisasterDailyLoop(void);
+extern void WaypointsDailyLoop();
+extern void TextMessageDailyLoop();
+extern void EnginesDailyLoop();
+extern void DisasterDailyLoop();
-extern void PlayersMonthlyLoop(void);
-extern void EnginesMonthlyLoop(void);
-extern void TownsMonthlyLoop(void);
-extern void IndustryMonthlyLoop(void);
-extern void StationMonthlyLoop(void);
+extern void PlayersMonthlyLoop();
+extern void EnginesMonthlyLoop();
+extern void TownsMonthlyLoop();
+extern void IndustryMonthlyLoop();
+extern void StationMonthlyLoop();
-extern void PlayersYearlyLoop(void);
-extern void TrainsYearlyLoop(void);
-extern void RoadVehiclesYearlyLoop(void);
-extern void AircraftYearlyLoop(void);
-extern void ShipsYearlyLoop(void);
+extern void PlayersYearlyLoop();
+extern void TrainsYearlyLoop();
+extern void RoadVehiclesYearlyLoop();
+extern void AircraftYearlyLoop();
+extern void ShipsYearlyLoop();
-extern void ShowEndGameChart(void);
+extern void ShowEndGameChart();
static const Month _autosave_months[] = {
@@ -221,7 +221,7 @@
}
}
-void IncreaseDate(void)
+void IncreaseDate()
{
YearMonthDay ymd;
--- a/src/date.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/date.h Sun Mar 11 16:31:18 2007 +0000
@@ -44,11 +44,11 @@
typedef uint8 Day;
typedef uint16 DateFract;
-typedef struct YearMonthDay {
+struct YearMonthDay {
Year year;
Month month;
Day day;
-} YearMonthDay;
+};
extern Year _cur_year;
extern Month _cur_month;
--- a/src/debug.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/debug.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -33,10 +33,10 @@
int _debug_station_level;
-typedef struct DebugLevel {
+struct DebugLevel {
const char *name;
int *level;
-} DebugLevel;
+};
#define DEBUG_LEVEL(x) { #x, &_debug_##x##_level }
static const DebugLevel debug_level[] = {
@@ -153,7 +153,7 @@
* Just return a string with the values of all the debug categorites
* @return string with debug-levels
*/
-const char *GetDebugString(void)
+const char *GetDebugString()
{
const DebugLevel *i;
static char dbgstr[100];
--- a/src/debug.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/debug.h Sun Mar 11 16:31:18 2007 +0000
@@ -84,7 +84,7 @@
#endif /* NO_DEBUG_MESSAGES */
void SetDebugString(const char *s);
-const char *GetDebugString(void);
+const char *GetDebugString();
/* MSVCRT of course has to have a different syntax for long long *sigh* */
#if defined(_MSC_VER) || defined(__MINGW32__)
@@ -95,7 +95,7 @@
/* Used for profiling */
#define TIC() {\
- extern uint64 _rdtsc(void);\
+ extern uint64 _rdtsc();\
uint64 _xxx_ = _rdtsc();\
static uint64 __sum__ = 0;\
static uint32 __i__ = 0;
--- a/src/dedicated.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/dedicated.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -14,7 +14,15 @@
#include <sys/types.h>
#include <unistd.h>
-void DedicatedFork(void)
+#if defined(SUNOS) && !defined(_LP64) && !defined(_I32LPx)
+/* Solaris has, in certain situation, pid_t defined as long, while in other
+ * cases it has it defined as int... this handles all cases nicely. */
+# define PRINTF_PID_T "%ld"
+#else
+# define PRINTF_PID_T "%d"
+#endif
+
+void DedicatedFork()
{
/* Fork the program */
pid_t pid = fork();
@@ -47,7 +55,7 @@
default:
/* We're the parent */
printf("Loading dedicated server...\n");
- printf(" - Forked to background with pid %d\n", pid);
+ printf(" - Forked to background with pid " PRINTF_PID_T "\n", pid);
exit(0);
}
}
@@ -55,6 +63,6 @@
#else
-void DedicatedFork(void) {}
+void DedicatedFork() {}
#endif /* ENABLE_NETWORK */
--- a/src/depot.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/depot.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -47,7 +47,7 @@
/**
* Allocate a new depot
*/
-Depot *AllocateDepot(void)
+Depot *AllocateDepot()
{
Depot *d;
@@ -85,7 +85,7 @@
DeleteWindowById(WC_VEHICLE_DEPOT, depot->xy);
}
-void InitializeDepots(void)
+void InitializeDepots()
{
CleanPool(&_Depot_pool);
AddBlockToPool(&_Depot_pool);
@@ -99,7 +99,7 @@
SLE_END()
};
-static void Save_DEPT(void)
+static void Save_DEPT()
{
Depot *depot;
@@ -109,7 +109,7 @@
}
}
-static void Load_DEPT(void)
+static void Load_DEPT()
{
int index;
--- a/src/depot.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/depot.h Sun Mar 11 16:31:18 2007 +0000
@@ -107,8 +107,8 @@
}
Depot *GetDepotByTile(TileIndex tile);
-void InitializeDepots(void);
-Depot *AllocateDepot(void);
+void InitializeDepots();
+Depot *AllocateDepot();
void DeleteDepotHighlightOfVehicle(const Vehicle *v);
--- a/src/depot_gui.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/depot_gui.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -133,20 +133,20 @@
{
if (!success) return;
switch(GetVehicle(p1)->type) {
- case VEH_Train: CcCloneTrain( true, tile, p1, p2); break;
- case VEH_Road: CcCloneRoadVeh( true, tile, p1, p2); break;
- case VEH_Ship: CcCloneShip( true, tile, p1, p2); break;
- case VEH_Aircraft: CcCloneAircraft(true, tile, p1, p2); break;
+ case VEH_TRAIN: CcCloneTrain( true, tile, p1, p2); break;
+ case VEH_ROAD: CcCloneRoadVeh( true, tile, p1, p2); break;
+ case VEH_SHIP: CcCloneShip( true, tile, p1, p2); break;
+ case VEH_AIRCRAFT: CcCloneAircraft(true, tile, p1, p2); break;
}
}
static inline void ShowVehicleViewWindow(const Vehicle *v)
{
switch (v->type) {
- case VEH_Train: ShowTrainViewWindow(v); break;
- case VEH_Road: ShowRoadVehViewWindow(v); break;
- case VEH_Ship: ShowShipViewWindow(v); break;
- case VEH_Aircraft: ShowAircraftViewWindow(v); break;
+ case VEH_TRAIN: ShowTrainViewWindow(v); break;
+ case VEH_ROAD: ShowRoadVehViewWindow(v); break;
+ case VEH_SHIP: ShowShipViewWindow(v); break;
+ case VEH_AIRCRAFT: ShowAircraftViewWindow(v); break;
default: NOT_REACHED();
}
}
@@ -175,7 +175,7 @@
int sprite_y = y + w->resize.step_height - GetVehicleListHeight(v->type);
switch (v->type) {
- case VEH_Train:
+ case VEH_TRAIN:
DrawTrainImage(v, x + 21, sprite_y, w->widget[DEPOT_WIDGET_MATRIX].right - 32, w->hscroll.pos, WP(w,depot_d).sel);
/* Number of wagons relative to a standard length wagon (rounded up) */
@@ -183,9 +183,9 @@
DrawStringRightAligned(w->widget[DEPOT_WIDGET_MATRIX].right - 1, y + 4, STR_TINY_BLACK, 0); // Draw the counter
break;
- case VEH_Road: DrawRoadVehImage( v, x + 24, sprite_y, WP(w, depot_d).sel); break;
- case VEH_Ship: DrawShipImage( v, x + 19, sprite_y - 1, WP(w, depot_d).sel); break;
- case VEH_Aircraft: {
+ case VEH_ROAD: DrawRoadVehImage( v, x + 24, sprite_y, WP(w, depot_d).sel); break;
+ case VEH_SHIP: DrawShipImage( v, x + 19, sprite_y - 1, WP(w, depot_d).sel); break;
+ case VEH_AIRCRAFT: {
const Sprite *spr = GetSprite(GetAircraftImage(v, DIR_W));
DrawAircraftImage(v, x + 12,
y + max(spr->height + spr->y_offs - 14, 0), // tall sprites needs an y offset
@@ -195,10 +195,10 @@
}
if (w->resize.step_height == 14) {
- /* VEH_Train and VEH_Road, which are low */
+ /* VEH_TRAIN and VEH_ROAD, which are low */
diff_x = 15;
} else {
- /* VEH_Ship and VEH_Aircraft, which are tall */
+ /* VEH_SHIP and VEH_AIRCRAFT, which are tall */
diff_y = 12;
}
@@ -233,7 +233,7 @@
WIDGET_LIST_END);
/* determine amount of items for scroller */
- if (WP(w, depot_d).type == VEH_Train) {
+ if (WP(w, depot_d).type == VEH_TRAIN) {
hnum = 8;
for (num = 0; num < WP(w, depot_d).engine_count; num++) {
const Vehicle *v = vl[num];
@@ -247,7 +247,7 @@
}
/* locate the depot struct */
- if (WP(w, depot_d).type == VEH_Aircraft) {
+ if (WP(w, depot_d).type == VEH_AIRCRAFT) {
SetDParam(0, GetStationIndex(tile)); // Airport name
} else {
Depot *depot = GetDepotByTile(tile);
@@ -290,10 +290,10 @@
}
}
-typedef struct GetDepotVehiclePtData {
+struct GetDepotVehiclePtData {
Vehicle *head;
Vehicle *wagon;
-} GetDepotVehiclePtData;
+};
enum {
MODE_ERROR = 1,
@@ -309,7 +309,7 @@
int pos, skip = 0;
uint16 boxes_in_each_row = w->widget[DEPOT_WIDGET_MATRIX].data & 0xFF;
- if (WP(w, depot_d).type == VEH_Train) {
+ if (WP(w, depot_d).type == VEH_TRAIN) {
xt = 0;
x -= 23;
} else {
@@ -326,7 +326,7 @@
pos = ((row + w->vscroll.pos) * boxes_in_each_row) + xt;
if (WP(w, depot_d).engine_count + WP(w, depot_d).wagon_count <= pos) {
- if (WP(w, depot_d).type == VEH_Train) {
+ if (WP(w, depot_d).type == VEH_TRAIN) {
d->head = NULL;
d->wagon = NULL;
return MODE_DRAG_VEHICLE;
@@ -347,7 +347,7 @@
}
switch (WP(w, depot_d).type) {
- case VEH_Train: {
+ case VEH_TRAIN: {
Vehicle *v = *veh;
d->head = d->wagon = v;
@@ -372,17 +372,17 @@
}
break;
- case VEH_Road:
+ case VEH_ROAD:
if (xm >= 24) return MODE_DRAG_VEHICLE;
if (xm <= 16) return MODE_SHOW_VEHICLE;
break;
- case VEH_Ship:
+ case VEH_SHIP:
if (xm >= 19) return MODE_DRAG_VEHICLE;
if (ym <= 10) return MODE_SHOW_VEHICLE;
break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
if (xm >= 12) return MODE_DRAG_VEHICLE;
if (ym <= 12) return MODE_SHOW_VEHICLE;
break;
@@ -420,11 +420,11 @@
/* share / copy orders */
if (_thd.place_mode && mode <= 0) {
- _place_clicked_vehicle = (WP(w, depot_d).type == VEH_Train ? gdvp.head : v);
+ _place_clicked_vehicle = (WP(w, depot_d).type == VEH_TRAIN ? gdvp.head : v);
return;
}
- if (WP(w, depot_d).type == VEH_Train) v = gdvp.wagon;
+ if (WP(w, depot_d).type == VEH_TRAIN) v = gdvp.wagon;
switch (mode) {
case MODE_ERROR: // invalid
@@ -433,17 +433,17 @@
case MODE_DRAG_VEHICLE: { // start dragging of vehicle
VehicleID sel = WP(w, depot_d).sel;
- if (WP(w, depot_d).type == VEH_Train && sel != INVALID_VEHICLE) {
+ if (WP(w, depot_d).type == VEH_TRAIN && sel != INVALID_VEHICLE) {
WP(w,depot_d).sel = INVALID_VEHICLE;
TrainDepotMoveVehicle(v, sel, gdvp.head);
} else if (v != NULL) {
int image;
switch (WP(w, depot_d).type) {
- case VEH_Train: image = GetTrainImage(v, DIR_W); break;
- case VEH_Road: image = GetRoadVehImage(v, DIR_W); break;
- case VEH_Ship: image = GetShipImage(v, DIR_W); break;
- case VEH_Aircraft: image = GetAircraftImage(v, DIR_W); break;
+ case VEH_TRAIN: image = GetTrainImage(v, DIR_W); break;
+ case VEH_ROAD: image = GetRoadVehImage(v, DIR_W); break;
+ case VEH_SHIP: image = GetShipImage(v, DIR_W); break;
+ case VEH_AIRCRAFT: image = GetAircraftImage(v, DIR_W); break;
default: NOT_REACHED(); image = 0;
}
@@ -462,10 +462,10 @@
uint command;
switch (WP(w, depot_d).type) {
- case VEH_Train: command = CMD_START_STOP_TRAIN | CMD_MSG(STR_883B_CAN_T_STOP_START_TRAIN); break;
- case VEH_Road: command = CMD_START_STOP_ROADVEH | CMD_MSG(STR_9015_CAN_T_STOP_START_ROAD_VEHICLE); break;
- case VEH_Ship: command = CMD_START_STOP_SHIP | CMD_MSG(STR_9818_CAN_T_STOP_START_SHIP); break;
- case VEH_Aircraft: command = CMD_START_STOP_AIRCRAFT | CMD_MSG(STR_A016_CAN_T_STOP_START_AIRCRAFT); break;
+ case VEH_TRAIN: command = CMD_START_STOP_TRAIN | CMD_MSG(STR_883B_CAN_T_STOP_START_TRAIN); break;
+ case VEH_ROAD: command = CMD_START_STOP_ROADVEH | CMD_MSG(STR_9015_CAN_T_STOP_START_ROAD_VEHICLE); break;
+ case VEH_SHIP: command = CMD_START_STOP_SHIP | CMD_MSG(STR_9818_CAN_T_STOP_START_SHIP); break;
+ case VEH_AIRCRAFT: command = CMD_START_STOP_AIRCRAFT | CMD_MSG(STR_A016_CAN_T_STOP_START_AIRCRAFT); break;
default: NOT_REACHED(); command = 0;
}
DoCommandP(v->tile, v->index, 0, NULL, command);
@@ -487,17 +487,17 @@
if (v == NULL) return;
- if (v->type == VEH_Train && !IsFrontEngine(v)) {
+ if (v->type == VEH_TRAIN && !IsFrontEngine(v)) {
v = GetFirstVehicleInChain(v);
/* Do nothing when clicking on a train in depot with no loc attached */
if (!IsFrontEngine(v)) return;
}
switch (v->type) {
- case VEH_Train: error_str = CMD_MSG(STR_882B_CAN_T_BUILD_RAILROAD_VEHICLE); break;
- case VEH_Road: error_str = CMD_MSG(STR_9009_CAN_T_BUILD_ROAD_VEHICLE); break;
- case VEH_Ship: error_str = CMD_MSG(STR_980D_CAN_T_BUILD_SHIP); break;
- case VEH_Aircraft: error_str = CMD_MSG(STR_A008_CAN_T_BUILD_AIRCRAFT); break;
+ case VEH_TRAIN: error_str = CMD_MSG(STR_882B_CAN_T_BUILD_RAILROAD_VEHICLE); break;
+ case VEH_ROAD: error_str = CMD_MSG(STR_9009_CAN_T_BUILD_ROAD_VEHICLE); break;
+ case VEH_SHIP: error_str = CMD_MSG(STR_980D_CAN_T_BUILD_SHIP); break;
+ case VEH_AIRCRAFT: error_str = CMD_MSG(STR_A008_CAN_T_BUILD_AIRCRAFT); break;
default: return;
}
@@ -517,7 +517,7 @@
{
w->ResizeButtons(DEPOT_WIDGET_BUILD, DEPOT_WIDGET_LOCATION);
- if (WP(w, depot_d).type == VEH_Train) {
+ if (WP(w, depot_d).type == VEH_TRAIN) {
/* Divide the size of DEPOT_WIDGET_SELL into two equally big buttons so DEPOT_WIDGET_SELL and DEPOT_WIDGET_SELL_CHAIN will get the same size.
* This way it will stay the same even if DEPOT_WIDGET_SELL_CHAIN is resized for some reason */
w->widget[DEPOT_WIDGET_SELL_CHAIN].top = ((w->widget[DEPOT_WIDGET_SELL_CHAIN].bottom - w->widget[DEPOT_WIDGET_SELL].top) / 2) + w->widget[DEPOT_WIDGET_SELL].top;
@@ -532,7 +532,7 @@
static void SetupStringsForDepotWindow(BaseWindow *w, byte type)
{
switch (type) {
- case VEH_Train:
+ case VEH_TRAIN:
w->widget[DEPOT_WIDGET_CAPTION].data = STR_8800_TRAIN_DEPOT;
w->widget[DEPOT_WIDGET_STOP_ALL].tooltips = STR_MASS_STOP_DEPOT_TRAIN_TIP;
w->widget[DEPOT_WIDGET_START_ALL].tooltips= STR_MASS_START_DEPOT_TRAIN_TIP;
@@ -556,7 +556,7 @@
w->widget[DEPOT_WIDGET_AUTOREPLACE].data = SPR_REPLACE_TRAIN;
break;
- case VEH_Road:
+ case VEH_ROAD:
w->widget[DEPOT_WIDGET_CAPTION].data = STR_9003_ROAD_VEHICLE_DEPOT;
w->widget[DEPOT_WIDGET_STOP_ALL].tooltips = STR_MASS_STOP_DEPOT_ROADVEH_TIP;
w->widget[DEPOT_WIDGET_START_ALL].tooltips= STR_MASS_START_DEPOT_ROADVEH_TIP;
@@ -580,7 +580,7 @@
w->widget[DEPOT_WIDGET_AUTOREPLACE].data = SPR_REPLACE_ROADVEH;
break;
- case VEH_Ship:
+ case VEH_SHIP:
w->widget[DEPOT_WIDGET_CAPTION].data = STR_9803_SHIP_DEPOT;
w->widget[DEPOT_WIDGET_STOP_ALL].tooltips = STR_MASS_STOP_DEPOT_SHIP_TIP;
w->widget[DEPOT_WIDGET_START_ALL].tooltips= STR_MASS_START_DEPOT_SHIP_TIP;
@@ -604,7 +604,7 @@
w->widget[DEPOT_WIDGET_AUTOREPLACE].data = SPR_REPLACE_SHIP;
break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
w->widget[DEPOT_WIDGET_CAPTION].data = STR_A002_AIRCRAFT_HANGAR;
w->widget[DEPOT_WIDGET_STOP_ALL].tooltips = STR_MASS_STOP_HANGAR_TIP;
w->widget[DEPOT_WIDGET_START_ALL].tooltips= STR_MASS_START_HANGAR_TIP;
@@ -638,22 +638,22 @@
/* Array to hold the default resize capacities
* First part is the vehicle type, while the last is 0 = x, 1 = y */
const uint _resize_cap[][2] = {
-/* VEH_Train */ {6, 10 * 29 + 36}, ///< flags, unitnumber and unit count uses a total of 36 pixels and we set default to 10 units
-/* VEH_Road */ {5, 5},
-/* VEH_Ship */ {3, 3},
-/* VEH_Aircraft */ {3, 4},
+/* VEH_TRAIN */ {6, 10 * 29 + 36}, ///< flags, unitnumber and unit count uses a total of 36 pixels and we set default to 10 units
+/* VEH_ROAD */ {5, 5},
+/* VEH_SHIP */ {3, 3},
+/* VEH_AIRCRAFT */ {3, 4},
};
static void ResizeDefaultWindowSizeForTrains()
{
- _block_sizes[VEH_Train][0] = 1;
- _block_sizes[VEH_Train][1] = GetVehicleListHeight(VEH_Train);
+ _block_sizes[VEH_TRAIN][0] = 1;
+ _block_sizes[VEH_TRAIN][1] = GetVehicleListHeight(VEH_TRAIN);
}
static void ResizeDefaultWindowSizeForRoadVehicles()
{
- _block_sizes[VEH_Road][0] = 56;
- _block_sizes[VEH_Road][1] = GetVehicleListHeight(VEH_Road);
+ _block_sizes[VEH_ROAD][0] = 56;
+ _block_sizes[VEH_ROAD][1] = GetVehicleListHeight(VEH_ROAD);
}
static void ResizeDefaultWindowSize(byte type)
@@ -667,8 +667,8 @@
switch (type) {
default: NOT_REACHED();
- case VEH_Ship: GetShipSpriteSize( engine, x, y); break;
- case VEH_Aircraft: GetAircraftSpriteSize(engine, x, y); break;
+ case VEH_SHIP: GetShipSpriteSize( engine, x, y); break;
+ case VEH_AIRCRAFT: GetAircraftSpriteSize(engine, x, y); break;
}
if (x > max_width) max_width = x;
if (y > max_height) max_height = y;
@@ -676,11 +676,11 @@
switch (type) {
default: NOT_REACHED();
- case VEH_Ship:
- _block_sizes[VEH_Ship][0] = max(90U, max_width + 20); // we need 20 pixels from the right edge to the sprite
+ case VEH_SHIP:
+ _block_sizes[VEH_SHIP][0] = max(90U, max_width + 20); // we need 20 pixels from the right edge to the sprite
break;
- case VEH_Aircraft:
- _block_sizes[VEH_Aircraft][0] = max(74U, max_width);
+ case VEH_AIRCRAFT:
+ _block_sizes[VEH_AIRCRAFT][0] = max(74U, max_width);
break;
}
_block_sizes[type][1] = max(GetVehicleListHeight(type), max_height);
@@ -692,8 +692,8 @@
{
ResizeDefaultWindowSizeForTrains();
ResizeDefaultWindowSizeForRoadVehicles();
- ResizeDefaultWindowSize(VEH_Ship);
- ResizeDefaultWindowSize(VEH_Aircraft);
+ ResizeDefaultWindowSize(VEH_SHIP);
+ ResizeDefaultWindowSize(VEH_AIRCRAFT);
}
static void CreateDepotListWindow(BaseWindow *w, byte type)
@@ -717,7 +717,7 @@
w->Resize(_block_sizes[type][0] * w->hscroll.cap,
_block_sizes[type][1] * w->vscroll.cap);
- if (type == VEH_Train) {
+ if (type == VEH_TRAIN) {
/* The train depot has a horizontal scroller so we should make room for it */
w->Resize(0, 12);
/* substract the newly added space from the matrix since it was meant for the scrollbar */
@@ -732,10 +732,10 @@
w->widget[DEPOT_WIDGET_MATRIX].data =
(w->vscroll.cap * 0x100) // number of rows to draw on the background
- + (type == VEH_Train ? 1 : w->hscroll.cap); // number of boxes in each row. Trains always have just one
+ + (type == VEH_TRAIN ? 1 : w->hscroll.cap); // number of boxes in each row. Trains always have just one
- w->SetWidgetsHiddenState(type != VEH_Train,
+ w->SetWidgetsHiddenState(type != VEH_TRAIN,
DEPOT_WIDGET_H_SCROLL,
DEPOT_WIDGET_SELL_CHAIN,
WIDGET_LIST_END);
@@ -840,7 +840,7 @@
TileIndex tile = w->window_number;
byte vehtype = WP(w, depot_d).type;
- SetDParam(0, (vehtype == VEH_Aircraft) ? GetStationIndex(tile) : GetDepotByTile(tile)->town_index);
+ SetDParam(0, (vehtype == VEH_AIRCRAFT) ? GetStationIndex(tile) : GetDepotByTile(tile)->town_index);
ShowQuery(
confirm_captions[vehtype],
STR_DEPOT_SELL_CONFIRMATION_TEXT,
@@ -896,7 +896,7 @@
WP(w, depot_d).sel = INVALID_VEHICLE;
w->SetDirty();
- if (WP(w, depot_d).type == VEH_Train) {
+ if (WP(w, depot_d).type == VEH_TRAIN) {
GetDepotVehiclePtData gdvp;
if (GetVehicleFromDepotWndPt(w, e->we.dragdrop.pt.x, e->we.dragdrop.pt.y, &v, &gdvp) == MODE_DRAG_VEHICLE &&
@@ -933,9 +933,9 @@
WP(w, depot_d).sel = INVALID_VEHICLE;
w->SetDirty();
- sell_cmd = (v->type == VEH_Train && (e->we.click.widget == DEPOT_WIDGET_SELL_CHAIN || _ctrl_pressed)) ? 1 : 0;
+ sell_cmd = (v->type == VEH_TRAIN && (e->we.click.widget == DEPOT_WIDGET_SELL_CHAIN || _ctrl_pressed)) ? 1 : 0;
- is_engine = (!(v->type == VEH_Train && !IsFrontEngine(v)));
+ is_engine = (!(v->type == VEH_TRAIN && !IsFrontEngine(v)));
if (is_engine) {
_backup_orders_tile = v->tile;
@@ -943,10 +943,10 @@
}
switch (v->type) {
- case VEH_Train: command = CMD_SELL_RAIL_WAGON | CMD_MSG(STR_8839_CAN_T_SELL_RAILROAD_VEHICLE); break;
- case VEH_Road: command = CMD_SELL_ROAD_VEH | CMD_MSG(STR_9014_CAN_T_SELL_ROAD_VEHICLE); break;
- case VEH_Ship: command = CMD_SELL_SHIP | CMD_MSG(STR_980C_CAN_T_SELL_SHIP); break;
- case VEH_Aircraft: command = CMD_SELL_AIRCRAFT | CMD_MSG(STR_A01C_CAN_T_SELL_AIRCRAFT); break;
+ case VEH_TRAIN: command = CMD_SELL_RAIL_WAGON | CMD_MSG(STR_8839_CAN_T_SELL_RAILROAD_VEHICLE); break;
+ case VEH_ROAD: command = CMD_SELL_ROAD_VEH | CMD_MSG(STR_9014_CAN_T_SELL_ROAD_VEHICLE); break;
+ case VEH_SHIP: command = CMD_SELL_SHIP | CMD_MSG(STR_980C_CAN_T_SELL_SHIP); break;
+ case VEH_AIRCRAFT: command = CMD_SELL_AIRCRAFT | CMD_MSG(STR_A01C_CAN_T_SELL_AIRCRAFT); break;
default: NOT_REACHED(); command = 0;
}
@@ -962,7 +962,7 @@
case WE_RESIZE:
w->vscroll.cap += e->we.sizing.diff.y / (int)w->resize.step_height;
w->hscroll.cap += e->we.sizing.diff.x / (int)w->resize.step_width;
- w->widget[DEPOT_WIDGET_MATRIX].data = (w->vscroll.cap << 8) + (WP(w, depot_d).type == VEH_Train ? 1 : w->hscroll.cap);
+ w->widget[DEPOT_WIDGET_MATRIX].data = (w->vscroll.cap << 8) + (WP(w, depot_d).type == VEH_TRAIN ? 1 : w->hscroll.cap);
ResizeDepotButtons(w);
break;
}
@@ -978,13 +978,13 @@
switch (type) {
default: NOT_REACHED();
- case VEH_Train:
+ case VEH_TRAIN:
w = BaseWindow::AllocateFront(&_train_depot_desc, tile); break;
- case VEH_Road:
+ case VEH_ROAD:
w = BaseWindow::AllocateFront(&_road_depot_desc, tile); break;
- case VEH_Ship:
+ case VEH_SHIP:
w = BaseWindow::AllocateFront(&_ship_depot_desc, tile); break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
w = BaseWindow::AllocateFront(&_aircraft_depot_desc, tile); break;
}
--- a/src/direction.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/direction.h Sun Mar 11 16:31:18 2007 +0000
@@ -8,7 +8,7 @@
#include "helpers.hpp"
/* Direction as commonly used in v->direction, 8 way. */
-typedef enum Direction {
+enum Direction {
DIR_BEGIN = 0,
DIR_N = 0,
DIR_NE = 1, ///< Northeast, upper right on your monitor
@@ -20,7 +20,7 @@
DIR_NW = 7,
DIR_END,
INVALID_DIR = 0xFF,
-} Direction;
+};
/** Define basic enum properties */
template <> struct EnumPropsT<Direction> : MakeEnumPropsT<Direction, byte, DIR_BEGIN, DIR_END, INVALID_DIR> {};
@@ -32,14 +32,14 @@
}
-typedef enum DirDiff {
+enum DirDiff {
DIRDIFF_SAME = 0,
DIRDIFF_45RIGHT = 1,
DIRDIFF_90RIGHT = 2,
DIRDIFF_REVERSE = 4,
DIRDIFF_90LEFT = 6,
DIRDIFF_45LEFT = 7
-} DirDiff;
+};
static inline DirDiff DirDifference(Direction d0, Direction d1)
{
@@ -59,7 +59,7 @@
/* Direction commonly used as the direction of entering and leaving tiles, 4-way */
-typedef enum DiagDirection {
+enum DiagDirection {
DIAGDIR_BEGIN = 0,
DIAGDIR_NE = 0, ///< Northeast, upper right on your monitor
DIAGDIR_SE = 1,
@@ -67,7 +67,7 @@
DIAGDIR_NW = 3,
DIAGDIR_END,
INVALID_DIAGDIR = 0xFF,
-} DiagDirection;
+};
DECLARE_POSTFIX_INCREMENT(DiagDirection);
@@ -81,12 +81,12 @@
}
-typedef enum DiagDirDiff {
+enum DiagDirDiff {
DIAGDIRDIFF_SAME = 0,
DIAGDIRDIFF_90RIGHT = 1,
DIAGDIRDIFF_REVERSE = 2,
DIAGDIRDIFF_90LEFT = 3
-} DiagDirDiff;
+};
static inline DiagDirection ChangeDiagDir(DiagDirection d, DiagDirDiff delta)
{
@@ -107,11 +107,11 @@
/* the 2 axis */
-typedef enum Axis {
+enum Axis {
AXIS_X = 0,
AXIS_Y = 1,
AXIS_END
-} Axis;
+};
static inline Axis OtherAxis(Axis a)
--- a/src/disaster_cmd.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/disaster_cmd.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -116,11 +116,11 @@
}
-/** Initialize a disaster vehicle. These vehicles are of type VEH_Disaster, are unclickable
+/** Initialize a disaster vehicle. These vehicles are of type VEH_DISASTER, are unclickable
* and owned by nobody */
static void InitializeDisasterVehicle(Vehicle *v, int x, int y, byte z, Direction direction, byte subtype)
{
- v->type = VEH_Disaster;
+ v->type = VEH_DISASTER;
v->x_pos = x;
v->y_pos = y;
v->z_pos = z;
@@ -135,9 +135,7 @@
v->owner = OWNER_NONE;
v->vehstatus = VS_UNCLICKABLE;
v->u.disaster.image_override = 0;
- v->current_order.type = OT_NOTHING;
- v->current_order.flags = 0;
- v->current_order.dest = 0;
+ v->current_order.Free();
DisasterVehicleUpdateImage(v);
VehiclePositionChanged(v);
@@ -330,7 +328,7 @@
v->current_order.dest = 1;
FOR_ALL_VEHICLES(u) {
- if (u->type == VEH_Road && IsHumanPlayer(u->owner)) {
+ if (u->type == VEH_ROAD && IsHumanPlayer(u->owner)) {
v->dest_tile = u->index;
v->age = 0;
return;
@@ -341,7 +339,7 @@
} else {
/* Target a vehicle */
u = GetVehicle(v->dest_tile);
- if (u->type != VEH_Road) {
+ if (u->type != VEH_ROAD) {
DeleteDisasterVeh(v);
return;
}
@@ -590,7 +588,7 @@
v->current_order.dest = 2;
FOR_ALL_VEHICLES(u) {
- if (u->type == VEH_Train || u->type == VEH_Road) {
+ if (u->type == VEH_TRAIN || u->type == VEH_ROAD) {
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;
@@ -758,12 +756,12 @@
// not used
}
-typedef void DisasterInitProc(void);
+typedef void DisasterInitProc();
/** Zeppeliner which crashes on a small airport if one found,
* otherwise crashes on a random tile */
-static void Disaster_Zeppeliner_Init(void)
+static void Disaster_Zeppeliner_Init()
{
Vehicle *v = ForceAllocateSpecialVehicle(), *u;
Station *st;
@@ -797,7 +795,7 @@
/** Ufo which flies around aimlessly from the middle of the map a bit
* until it locates a road vehicle which it targets and then destroys */
-static void Disaster_Small_Ufo_Init(void)
+static void Disaster_Small_Ufo_Init()
{
Vehicle *v = ForceAllocateSpecialVehicle(), *u;
int x;
@@ -821,7 +819,7 @@
/* Combat airplane which destroys an oil refinery */
-static void Disaster_Airplane_Init(void)
+static void Disaster_Airplane_Init()
{
Industry *i, *found;
Vehicle *v, *u;
@@ -857,7 +855,7 @@
/** Combat helicopter that destroys a factory */
-static void Disaster_Helicopter_Init(void)
+static void Disaster_Helicopter_Init()
{
Industry *i, *found;
Vehicle *v, *u, *w;
@@ -899,7 +897,7 @@
/* Big Ufo which lands on a piece of rail and will consequently be shot
* down by a combat airplane, destroying the surroundings */
-static void Disaster_Big_Ufo_Init(void)
+static void Disaster_Big_Ufo_Init()
{
Vehicle *v = ForceAllocateSpecialVehicle(), *u;
int x, y;
@@ -924,7 +922,7 @@
/* Curious submarine #1, just floats around */
-static void Disaster_Small_Submarine_Init(void)
+static void Disaster_Small_Submarine_Init()
{
Vehicle *v = ForceAllocateSpecialVehicle();
int x, y;
@@ -949,7 +947,7 @@
/* Curious submarine #2, just floats around */
-static void Disaster_Big_Submarine_Init(void)
+static void Disaster_Big_Submarine_Init()
{
Vehicle *v = ForceAllocateSpecialVehicle();
int x,y;
@@ -975,7 +973,7 @@
/** Coal mine catastrophe, destroys a stretch of 30 tiles of
* land in a certain direction */
-static void Disaster_CoalMine_Init(void)
+static void Disaster_CoalMine_Init()
{
int index = GB(Random(), 0, 4);
uint m;
@@ -1031,7 +1029,7 @@
};
-static void DoDisaster(void)
+static void DoDisaster()
{
byte buf[lengthof(_dis_years)];
uint i;
@@ -1048,12 +1046,12 @@
}
-static void ResetDisasterDelay(void)
+static void ResetDisasterDelay()
{
_disaster_delay = GB(Random(), 0, 9) + 730;
}
-void DisasterDailyLoop(void)
+void DisasterDailyLoop()
{
if (--_disaster_delay != 0) return;
@@ -1062,7 +1060,7 @@
if (_opt.diff.disasters != 0) DoDisaster();
}
-void StartupDisasters(void)
+void StartupDisasters()
{
ResetDisasterDelay();
}
--- a/src/dock_gui.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/dock_gui.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -17,8 +17,8 @@
#include "command.h"
#include "variables.h"
-static void ShowBuildDockStationPicker(void);
-static void ShowBuildDocksDepotPicker(void);
+static void ShowBuildDockStationPicker();
+static void ShowBuildDocksDepotPicker();
static Axis _ship_depot_direction;
@@ -216,7 +216,7 @@
BuildDocksToolbWndProc
};
-void ShowBuildDocksToolbar(void)
+void ShowBuildDocksToolbar()
{
if (!IsValidPlayer(_current_player)) return;
@@ -290,12 +290,12 @@
BuildDockStationWndProc
};
-static void ShowBuildDockStationPicker(void)
+static void ShowBuildDockStationPicker()
{
BaseWindow::Allocate(&_build_dock_station_desc);
}
-static void UpdateDocksDirection(void)
+static void UpdateDocksDirection()
{
if (_ship_depot_direction != AXIS_X) {
SetTileSelectSize(1, 2);
@@ -360,14 +360,14 @@
};
-static void ShowBuildDocksDepotPicker(void)
+static void ShowBuildDocksDepotPicker()
{
BaseWindow::Allocate(&_build_docks_depot_desc);
UpdateDocksDirection();
}
-void InitializeDockGui(void)
+void InitializeDockGui()
{
_ship_depot_direction = AXIS_X;
}
--- a/src/driver.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/driver.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -30,17 +30,17 @@
#include "video/cocoa_v.h"
#include "video/win32_v.h"
-typedef struct DriverDesc {
+struct DriverDesc {
const char* name;
const char* longname;
const HalCommonDriver* drv;
-} DriverDesc;
+};
-typedef struct DriverClass {
+struct DriverClass {
const DriverDesc *descs;
const char *name;
const HalCommonDriver** drv;
-} DriverClass;
+};
#define M(x, y, z) { x, y, (const HalCommonDriver *)(void *)z }
--- a/src/economy.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/economy.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -79,10 +79,10 @@
FOR_ALL_VEHICLES(v) {
if (v->owner != owner) continue;
- if (v->type == VEH_Train ||
- v->type == VEH_Road ||
- (v->type == VEH_Aircraft && IsNormalAircraft(v)) ||
- v->type == VEH_Ship) {
+ if (v->type == VEH_TRAIN ||
+ v->type == VEH_ROAD ||
+ (v->type == VEH_AIRCRAFT && IsNormalAircraft(v)) ||
+ v->type == VEH_SHIP) {
value += v->value * 3 >> 1;
}
}
@@ -115,10 +115,10 @@
FOR_ALL_VEHICLES(v) {
if (v->owner != owner) continue;
- if ((v->type == VEH_Train && IsFrontEngine(v)) ||
- v->type == VEH_Road ||
- (v->type == VEH_Aircraft && IsNormalAircraft(v)) ||
- v->type == VEH_Ship) {
+ if ((v->type == VEH_TRAIN && IsFrontEngine(v)) ||
+ v->type == VEH_ROAD ||
+ (v->type == VEH_AIRCRAFT && IsNormalAircraft(v)) ||
+ v->type == VEH_SHIP) {
num++;
if (v->age > 730) {
/* Find the vehicle with the lowest amount of profit */
@@ -305,17 +305,17 @@
FOR_ALL_VEHICLES(v) {
if (v->owner == new_player) {
switch (v->type) {
- case VEH_Train: if (IsFrontEngine(v)) num_train++; break;
- case VEH_Road: num_road++; break;
- case VEH_Ship: num_ship++; break;
- case VEH_Aircraft: if (IsNormalAircraft(v)) num_aircraft++; break;
+ case VEH_TRAIN: if (IsFrontEngine(v)) num_train++; break;
+ case VEH_ROAD: num_road++; break;
+ case VEH_SHIP: num_ship++; break;
+ case VEH_AIRCRAFT: if (IsNormalAircraft(v)) num_aircraft++; break;
default: break;
}
}
}
FOR_ALL_VEHICLES(v) {
- if (v->owner == old_player && IS_BYTE_INSIDE(v->type, VEH_Train, VEH_Aircraft + 1)) {
+ if (v->owner == old_player && IS_BYTE_INSIDE(v->type, VEH_TRAIN, VEH_AIRCRAFT + 1)) {
if (new_player == PLAYER_SPECTATOR) {
DeleteWindowById(WC_VEHICLE_VIEW, v->index);
DeleteWindowById(WC_VEHICLE_DETAILS, v->index);
@@ -325,10 +325,10 @@
v->owner = new_player;
if (IsEngineCountable(v)) GetPlayer(new_player)->num_engines[v->engine_type]++;
switch (v->type) {
- case VEH_Train: if (IsFrontEngine(v)) v->unitnumber = ++num_train; break;
- case VEH_Road: v->unitnumber = ++num_road; break;
- case VEH_Ship: v->unitnumber = ++num_ship; break;
- case VEH_Aircraft: if (IsNormalAircraft(v)) v->unitnumber = ++num_aircraft; break;
+ case VEH_TRAIN: if (IsFrontEngine(v)) v->unitnumber = ++num_train; break;
+ case VEH_ROAD: v->unitnumber = ++num_road; break;
+ case VEH_SHIP: v->unitnumber = ++num_ship; break;
+ case VEH_AIRCRAFT: if (IsNormalAircraft(v)) v->unitnumber = ++num_aircraft; break;
}
}
}
@@ -370,6 +370,40 @@
MarkWholeScreenDirty();
}
+static void ChangeNetworkOwner(PlayerID current_player, PlayerID new_player)
+{
+#ifdef ENABLE_NETWORK
+ if (!_networking) return;
+
+ if (current_player == _local_player) {
+ _network_playas = new_player;
+ SetLocalPlayer(new_player);
+ }
+
+ if (!_network_server) return;
+
+ /* The server has to handle all administrative issues, for example
+ * updating and notifying all clients of what has happened */
+ NetworkTCPSocketHandler *cs;
+ NetworkClientInfo *ci = NetworkFindClientInfoFromIndex(NETWORK_SERVER_INDEX);
+
+ /* The server has just changed from player */
+ if (current_player == ci->client_playas) {
+ ci->client_playas = new_player;
+ NetworkUpdateClientInfo(NETWORK_SERVER_INDEX);
+ }
+
+ /* Find all clients that were in control of this company, and mark them as new_player */
+ FOR_ALL_CLIENTS(cs) {
+ ci = DEREF_CLIENT_INFO(cs);
+ if (current_player == ci->client_playas) {
+ ci->client_playas = new_player;
+ NetworkUpdateClientInfo(ci->client_index);
+ }
+ }
+#endif /* ENABLE_NETWORK */
+}
+
static void PlayersCheckBankrupt(Player *p)
{
PlayerID owner;
@@ -427,35 +461,9 @@
p->bankrupt_asked = 0xFF;
p->bankrupt_timeout = 0x456;
break;
- } else if (owner == _local_player) {
- _network_playas = PLAYER_SPECTATOR;
- SetLocalPlayer(PLAYER_SPECTATOR);
}
-#ifdef ENABLE_NETWORK
- /* The server has to handle all administrative issues, for example
- * updating and notifying all clients of what has happened */
- if (_network_server) {
- NetworkTCPSocketHandler *cs;
- NetworkClientInfo *ci = NetworkFindClientInfoFromIndex(NETWORK_SERVER_INDEX);
-
- /* The server has just gone belly-up, mark it as spectator */
- if (owner == ci->client_playas) {
- ci->client_playas = PLAYER_SPECTATOR;
- NetworkUpdateClientInfo(NETWORK_SERVER_INDEX);
- }
-
- /* Find all clients that were in control of this company,
- * and mark them as spectator; broadcast this message to everyone */
- FOR_ALL_CLIENTS(cs) {
- ci = DEREF_CLIENT_INFO(cs);
- if (ci->client_playas == owner) {
- ci->client_playas = PLAYER_SPECTATOR;
- NetworkUpdateClientInfo(ci->client_index);
- }
- }
- }
-#endif /* ENABLE_NETWORK */
+ ChangeNetworkOwner(owner, PLAYER_SPECTATOR);
}
/* Remove the player */
@@ -581,7 +589,7 @@
return 0;
}
-static void PlayersGenStatistics(void)
+static void PlayersGenStatistics()
{
Station *st;
Player *p;
@@ -625,7 +633,7 @@
*value += tmp >> 16;
}
-static void AddInflation(void)
+static void AddInflation()
{
/* Approximation for (100 + infl_amount)% ** (1 / 12) - 100%
* scaled by 65536
@@ -658,7 +666,7 @@
InvalidateWindow(WC_PAYMENT_RATES, 0);
}
-static void PlayersPayInterest(void)
+static void PlayersPayInterest()
{
const Player* p;
int interest = _economy.interest_rate * 54;
@@ -676,7 +684,7 @@
}
}
-static void HandleEconomyFluctuations(void)
+static void HandleEconomyFluctuations()
{
if (_opt.diff.economy == 0) return;
@@ -756,7 +764,7 @@
/**
* Reset changes to the price base multipliers.
*/
-void ResetPriceBaseMultipliers(void)
+void ResetPriceBaseMultipliers()
{
uint i;
@@ -778,7 +786,7 @@
price_base_multiplier[price] = factor;
}
-void StartupEconomy(void)
+void StartupEconomy()
{
int i;
@@ -901,12 +909,12 @@
InvalidateWindow(WC_SUBSIDIES_LIST, 0);
}
-typedef struct FoundRoute {
+struct FoundRoute {
uint distance;
CargoID cargo;
void *from;
void *to;
-} FoundRoute;
+};
static void FindSubsidyPassengerRoute(FoundRoute *fr)
{
@@ -995,7 +1003,7 @@
}
-static void SubsidyMonthlyHandler(void)
+static void SubsidyMonthlyHandler()
{
Subsidy *s;
Pair pair;
@@ -1074,7 +1082,7 @@
SLE_END()
};
-static void Save_SUBS(void)
+static void Save_SUBS()
{
int i;
Subsidy *s;
@@ -1088,7 +1096,7 @@
}
}
-static void Load_SUBS(void)
+static void Load_SUBS()
{
int index;
while ((index = SlIterateArray()) != -1)
@@ -1295,7 +1303,7 @@
}
FOR_ALL_VEHICLES(x) {
- if ((x->type != VEH_Train || IsFrontEngine(x)) && // for all locs
+ if ((x->type != VEH_TRAIN || IsFrontEngine(x)) && // for all locs
u->last_station_visited == x->last_station_visited && // at the same station
!(x->vehstatus & (VS_STOPPED | VS_CRASHED)) && // not stopped or crashed
x->current_order.type == OT_LOADING && // loading
@@ -1368,7 +1376,7 @@
for (; v != NULL; v = v->next) {
GoodsEntry* ge;
load_amount = EngInfo(v->engine_type)->load_amount;
- if (_patches.gradual_loading) {
+ if (_patches.gradual_loading && HASBIT(EngInfo(v->engine_type)->callbackmask, CBM_LOAD_AMOUNT)) {
uint16 cb_load_amount = GetVehicleCallback(CBID_VEHICLE_LOAD_AMOUNT, 0, 0, v->engine_type, v);
if (cb_load_amount != CALLBACK_FAILED) load_amount = cb_load_amount & 0xFF;
}
@@ -1481,8 +1489,8 @@
/* update stats */
ge->days_since_pickup = 0;
switch (u->type) {
- case VEH_Train: t = u->u.rail.cached_max_speed; break;
- case VEH_Road: t = u->max_speed / 2; break;
+ case VEH_TRAIN: t = u->u.rail.cached_max_speed; break;
+ case VEH_ROAD: t = u->max_speed / 2; break;
default: t = u->max_speed; break;
}
@@ -1566,7 +1574,7 @@
ShowFeederIncomeAnimation(v->x_pos, v->y_pos, v->z_pos, virtual_profit_total);
}
- if (v->type == VEH_Train) {
+ if (v->type == VEH_TRAIN) {
/* Each platform tile is worth 2 rail vehicles. */
int overhang = v->u.rail.cached_total_length - st->GetPlatformLength(v->tile) * TILE_SIZE;
if (overhang > 0) {
@@ -1603,7 +1611,7 @@
return result;
}
-void PlayersMonthlyLoop(void)
+void PlayersMonthlyLoop()
{
PlayersGenStatistics();
if (_patches.inflation && _cur_year < MAX_YEAR)
@@ -1628,6 +1636,7 @@
/* original code does this a little bit differently */
PlayerID pi = p->index;
+ ChangeNetworkOwner(pi, _current_player);
ChangeOwnershipOfPlayerItems(pi, _current_player);
if (p->bankrupt_value == 0) {
@@ -1757,14 +1766,14 @@
}
/** Prices */
-static void SaveLoad_PRIC(void)
+static void SaveLoad_PRIC()
{
SlArray(&_price, NUM_PRICES, SLE_INT32);
SlArray(&_price_frac, NUM_PRICES, SLE_UINT16);
}
/** Cargo payment rates */
-static void SaveLoad_CAPR(void)
+static void SaveLoad_CAPR()
{
SlArray(&_cargo_payment_rates, NUM_CARGO, SLE_INT32);
SlArray(&_cargo_payment_rates_frac, NUM_CARGO, SLE_UINT16);
@@ -1781,7 +1790,7 @@
};
/** Economy variables */
-static void SaveLoad_ECMY(void)
+static void SaveLoad_ECMY()
{
SlObject(&_economy, _economy_desc);
}
--- a/src/economy.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/economy.h Sun Mar 11 16:31:18 2007 +0000
@@ -5,27 +5,27 @@
#ifndef ECONOMY_H
#define ECONOMY_H
-void ResetPriceBaseMultipliers(void);
+void ResetPriceBaseMultipliers();
void SetPriceBaseMultiplier(uint price, byte factor);
-typedef struct {
+struct Economy {
int32 max_loan; ///< Maximum possible loan
int32 max_loan_unround; ///< Economy fluctuation status
int fluct;
byte interest_rate; ///< Interest
byte infl_amount; ///< inflation amount
byte infl_amount_pr; ///< "floating" portion of inflation
-} Economy;
+};
VARDEF Economy _economy;
-typedef struct Subsidy {
+struct Subsidy {
CargoID cargo_type;
byte age;
/* from and to can either be TownID, StationID or IndustryID */
uint16 from;
uint16 to;
-} Subsidy;
+};
enum ScoreID {
@@ -48,11 +48,11 @@
DECLARE_POSTFIX_INCREMENT(ScoreID);
-typedef struct ScoreInfo {
+struct ScoreInfo {
byte id; ///< Unique ID of the score
int needed; ///< How much you need to get the perfect score
int score; ///< How much score it will give
-} ScoreInfo;
+};
extern const ScoreInfo _score_info[];
extern int _score_part[MAX_PLAYERS][SCORE_END];
--- a/src/elrail.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/elrail.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -125,18 +125,16 @@
{
if (IsTileType(tile, MP_TUNNELBRIDGE)) {
if (IsTunnel(tile)) {
+ *tileh = SLOPE_STEEP; // XXX - Hack to make tunnel entrances to always have a pylon
+ } else if (*tileh != SLOPE_FLAT) {
*tileh = SLOPE_FLAT;
} else {
- if (*tileh != SLOPE_FLAT) {
- *tileh = SLOPE_FLAT;
- } else {
- switch (GetBridgeRampDirection(tile)) {
- case DIAGDIR_NE: *tileh = SLOPE_NE; break;
- case DIAGDIR_SE: *tileh = SLOPE_SE; break;
- case DIAGDIR_SW: *tileh = SLOPE_SW; break;
- case DIAGDIR_NW: *tileh = SLOPE_NW; break;
- default: NOT_REACHED();
- }
+ switch (GetBridgeRampDirection(tile)) {
+ case DIAGDIR_NE: *tileh = SLOPE_NE; break;
+ case DIAGDIR_SE: *tileh = SLOPE_SE; break;
+ case DIAGDIR_SW: *tileh = SLOPE_SW; break;
+ case DIAGDIR_NW: *tileh = SLOPE_NW; break;
+ default: NOT_REACHED();
}
}
}
@@ -187,7 +185,7 @@
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) */
+ PPPpreferred[i] = 0xFF; // We start with preferring everything (end-of-line in any direction)
PPPallowed[i] = AllowedPPPonPCP[i];
/* We cycle through all the existing tracks at a PCP and see what
@@ -206,7 +204,7 @@
/* track found, if track is in the neighbour tile, adjust the number
* of the PCP for preferred/allowed determination*/
DiagDirection PCPpos = (TrackSourceTile[i][k] == TS_HOME) ? i : ReverseDiagDir(i);
- SETBIT(PCPstatus, i); /* This PCP is in use */
+ SETBIT(PCPstatus, i); // This PCP is in use
PPPpreferred[i] &= PreferredPPPofTrackAtPCP[TracksAtPCP[i][k]][PCPpos];
PPPallowed[i] &= ~DisallowedPPPofTrackAtPCP[TracksAtPCP[i][k]][PCPpos];
@@ -227,11 +225,7 @@
}
if (foundation != 0) {
- if (foundation < 15) {
- tileh[TS_NEIGHBOUR] = SLOPE_FLAT;
- } else {
- tileh[TS_NEIGHBOUR] = _inclined_tileh[foundation - 15];
- }
+ tileh[TS_NEIGHBOUR] = foundation < 15 ? SLOPE_FLAT : _inclined_tileh[foundation - 15];
}
AdjustTileh(neighbour, &tileh[TS_NEIGHBOUR]);
@@ -255,7 +249,9 @@
uint height = GetBridgeHeight(GetNorthernBridgeEnd(ti->tile));
if ((height <= TilePixelHeight(ti->tile) + TILE_HEIGHT) &&
- (i == PCPpositions[bridgetrack][0] || i == PCPpositions[bridgetrack][1])) SETBIT(OverridePCP, i);
+ (i == PCPpositions[bridgetrack][0] || i == PCPpositions[bridgetrack][1])) {
+ SETBIT(OverridePCP, i);
+ }
}
if (PPPallowed[i] != 0 && HASBIT(PCPstatus, i) && !HASBIT(OverridePCP, i)) {
@@ -291,7 +287,16 @@
/* Drawing of pylons is finished, now draw the wires */
for (t = TRACK_BEGIN; t < TRACK_END; t++) {
if (HASBIT(trackconfig[TS_HOME], t)) {
+ if (IsTunnelTile(ti->tile)) {
+ const SortableSpriteStruct *sss = &CatenarySpriteData_Tunnel[GetTunnelDirection(ti->tile)];
+ AddSortableSpriteToDraw(
+ sss->image, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset,
+ sss->x_size, sss->y_size, sss->z_size,
+ GetTileZ(ti->tile) + sss->z_offset
+ );
+ break;
+ }
byte PCPconfig = HASBIT(PCPstatus, PCPpositions[t][0]) +
(HASBIT(PCPstatus, PCPpositions[t][1]) << 1);
@@ -372,7 +377,7 @@
switch (GetTileType(ti->tile)) {
case MP_RAILWAY:
if (IsRailDepot(ti->tile)) {
- const SortableSpriteStruct* sss = &CatenarySpriteData_Depot[GetRailDepotDirection(ti->tile)];
+ const SortableSpriteStruct *sss = &CatenarySpriteData_Depot[GetRailDepotDirection(ti->tile)];
AddSortableSpriteToDraw(
sss->image, PAL_NONE, ti->x + sss->x_offset, ti->y + sss->y_offset,
@@ -396,7 +401,7 @@
int32 SettingsDisableElrail(int32 p1)
{
EngineID e_id;
- Vehicle* v;
+ Vehicle *v;
Player *p;
bool disable = (p1 != 0);
@@ -418,7 +423,7 @@
* normal rail too */
if (disable) {
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Train && v->u.rail.railtype == RAILTYPE_ELECTRIC) {
+ if (v->type == VEH_TRAIN && v->u.rail.railtype == RAILTYPE_ELECTRIC) {
/* this railroad vehicle is now compatible only with elrail,
* so add there also normal rail compatibility */
v->u.rail.compatible_railtypes |= (1 << RAILTYPE_RAIL);
@@ -431,7 +436,7 @@
/* setup total power for trains */
FOR_ALL_VEHICLES(v) {
/* power is cached only for front engines */
- if (v->type == VEH_Train && IsFrontEngine(v)) TrainPowerChanged(v);
+ if (v->type == VEH_TRAIN && IsFrontEngine(v)) TrainPowerChanged(v);
}
FOR_ALL_PLAYERS(p) p->avail_railtypes = GetPlayerRailtypes(p->index);
--- a/src/engine.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/engine.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -34,7 +34,7 @@
void ShowEnginePreviewWindow(EngineID engine);
-void DeleteCustomEngineNames(void)
+void DeleteCustomEngineNames()
{
uint i;
StringID old;
@@ -48,13 +48,13 @@
_vehicle_design_names &= ~1;
}
-void LoadCustomEngineNames(void)
+void LoadCustomEngineNames()
{
/* XXX: not done */
DEBUG(misc, 1, "LoadCustomEngineNames: not done");
}
-static void SetupEngineNames(void)
+static void SetupEngineNames()
{
StringID *name;
@@ -92,17 +92,17 @@
InvalidateWindowClasses(WC_REPLACE_VEHICLE);
}
-void AddTypeToEngines(void)
+void AddTypeToEngines()
{
Engine* e = _engines;
- do e->type = VEH_Train; while (++e < &_engines[ROAD_ENGINES_INDEX]);
- do e->type = VEH_Road; while (++e < &_engines[SHIP_ENGINES_INDEX]);
- do e->type = VEH_Ship; while (++e < &_engines[AIRCRAFT_ENGINES_INDEX]);
- do e->type = VEH_Aircraft; while (++e < &_engines[TOTAL_NUM_ENGINES]);
+ do e->type = VEH_TRAIN; while (++e < &_engines[ROAD_ENGINES_INDEX]);
+ do e->type = VEH_ROAD; while (++e < &_engines[SHIP_ENGINES_INDEX]);
+ do e->type = VEH_SHIP; while (++e < &_engines[AIRCRAFT_ENGINES_INDEX]);
+ do e->type = VEH_AIRCRAFT; while (++e < &_engines[TOTAL_NUM_ENGINES]);
}
-void StartupEngines(void)
+void StartupEngines()
{
Engine *e;
const EngineInfo *ei;
@@ -169,7 +169,7 @@
Engine *e = GetEngine(eid);
SETBIT(e->player_avail, player);
- if (e->type == VEH_Train) {
+ if (e->type == VEH_TRAIN) {
const RailVehicleInfo *rvi = RailVehInfo(eid);
Player *p = GetPlayer(player);
@@ -209,7 +209,7 @@
return best_player;
}
-void EnginesDailyLoop(void)
+void EnginesDailyLoop()
{
EngineID i;
@@ -289,8 +289,8 @@
p->block_preview = 20;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Train || v->type == VEH_Road || v->type == VEH_Ship ||
- (v->type == VEH_Aircraft && IsNormalAircraft(v))) {
+ if (v->type == VEH_TRAIN || v->type == VEH_ROAD || v->type == VEH_SHIP ||
+ (v->type == VEH_AIRCRAFT && IsNormalAircraft(v))) {
if (v->owner == p->index && v->engine_type == index) {
/* The user did prove me wrong, so restore old value */
p->block_preview = block_preview;
@@ -321,7 +321,7 @@
AddNewsItem(index, NEWS_FLAGS(NM_CALLBACK, 0, NT_NEW_VEHICLES, DNC_VEHICLEAVAIL), 0, 0);
}
-void EnginesMonthlyLoop(void)
+void EnginesMonthlyLoop()
{
Engine *e;
@@ -423,7 +423,7 @@
}
-static EngineRenew *AllocateEngineRenew(void)
+static EngineRenew *AllocateEngineRenew()
{
EngineRenew *er;
@@ -538,7 +538,7 @@
SLE_END()
};
-static void Save_ERNW(void)
+static void Save_ERNW()
{
EngineRenew *er;
@@ -548,7 +548,7 @@
}
}
-static void Load_ERNW(void)
+static void Load_ERNW()
{
int index;
@@ -590,7 +590,7 @@
SLE_END()
};
-static void Save_ENGN(void)
+static void Save_ENGN()
{
uint i;
@@ -600,7 +600,7 @@
}
}
-static void Load_ENGN(void)
+static void Load_ENGN()
{
int index;
while ((index = SlIterateArray()) != -1) {
@@ -608,7 +608,7 @@
}
}
-static void LoadSave_ENGS(void)
+static void LoadSave_ENGS()
{
SlArray(_engine_name_strings, lengthof(_engine_name_strings), SLE_STRINGID);
}
@@ -619,7 +619,7 @@
{ 'ERNW', Save_ERNW, Load_ERNW, CH_ARRAY | CH_LAST},
};
-void InitializeEngines(void)
+void InitializeEngines()
{
/* Clean the engine renew pool and create 1 block in it */
CleanPool(&_EngineRenew_pool);
--- a/src/engine.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/engine.h Sun Mar 11 16:31:18 2007 +0000
@@ -16,7 +16,7 @@
RAILVEH_WAGON, ///< simple wagon, not motorized
};
-typedef struct RailVehicleInfo {
+struct RailVehicleInfo {
byte image_index;
RailVehicleTypes railveh_type;
byte base_cost;
@@ -39,9 +39,9 @@
byte shorten_factor; ///< length on main map for this type is 8 - shorten_factor
byte tractive_effort; ///< Tractive effort coefficient
byte user_def_data; ///< Property 0x25: "User-defined bit mask" Used only for (very few) NewGRF vehicles
-} RailVehicleInfo;
+};
-typedef struct ShipVehicleInfo {
+struct ShipVehicleInfo {
byte image_index;
byte base_cost;
uint16 max_speed;
@@ -50,7 +50,7 @@
byte running_cost;
SoundFxByte sfx;
bool refittable;
-} ShipVehicleInfo;
+};
/* AircraftVehicleInfo subtypes, bitmask type.
* If bit 0 is 0 then it is a helicopter, otherwise it is a plane
@@ -61,7 +61,7 @@
AIR_FAST = 2
};
-typedef struct AircraftVehicleInfo {
+struct AircraftVehicleInfo {
byte image_index;
byte base_cost;
byte running_cost;
@@ -71,9 +71,9 @@
uint16 max_speed;
byte mail_capacity;
uint16 passenger_capacity;
-} AircraftVehicleInfo;
+};
-typedef struct RoadVehicleInfo {
+struct RoadVehicleInfo {
byte image_index;
byte base_cost;
byte running_cost;
@@ -81,12 +81,12 @@
byte max_speed;
byte capacity;
CargoID cargo_type;
-} RoadVehicleInfo;
+};
/** Information about a vehicle
* @see table/engines.h
*/
-typedef struct EngineInfo {
+struct EngineInfo {
Date base_intro;
Year lifelength;
Year base_life;
@@ -97,9 +97,9 @@
byte refit_cost;
byte misc_flags;
byte callbackmask;
-} EngineInfo;
+};
-typedef struct Engine {
+struct Engine {
Date intro_date;
Date age;
uint16 reliability;
@@ -111,8 +111,8 @@
PlayerByte preview_player;
byte preview_wait;
byte player_avail;
- byte type; ///< type, ie VEH_Road, VEH_Train, etc. Same as in vehicle.h
-} Engine;
+ byte type; ///< type, ie VEH_ROAD, VEH_TRAIN, etc. Same as in vehicle.h
+};
/**
* EngineInfo.misc_flags is a bitmask, with the following values
@@ -140,8 +140,8 @@
static const EngineID INVALID_ENGINE = 0xFFFF;
-void AddTypeToEngines(void);
-void StartupEngines(void);
+void AddTypeToEngines();
+void StartupEngines();
void DrawTrainEngine(int x, int y, EngineID engine, SpriteID pal);
@@ -149,8 +149,8 @@
void DrawShipEngine(int x, int y, EngineID engine, SpriteID pal);
void DrawAircraftEngine(int x, int y, EngineID engine, SpriteID pal);
-void LoadCustomEngineNames(void);
-void DeleteCustomEngineNames(void);
+void LoadCustomEngineNames();
+void DeleteCustomEngineNames();
bool IsEngineBuildable(EngineID engine, byte type, PlayerID player);
@@ -261,11 +261,9 @@
EngineRenewID index;
EngineID from;
EngineID to;
- struct EngineRenew *next;
+ EngineRenew *next;
};
-typedef struct EngineRenew EngineRenew;
-
/**
* Memory pool for engine renew elements. DO NOT USE outside of engine.c. Is
* placed here so the only exception to this rule, the saveload code, can use
--- a/src/engine_gui.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/engine_gui.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -22,10 +22,10 @@
{
switch (GetEngine(engine)->type) {
default: NOT_REACHED();
- case VEH_Road: return STR_8103_ROAD_VEHICLE;
- case VEH_Aircraft: return STR_8104_AIRCRAFT;
- case VEH_Ship: return STR_8105_SHIP;
- case VEH_Train:
+ case VEH_ROAD: return STR_8103_ROAD_VEHICLE;
+ case VEH_AIRCRAFT: return STR_8104_AIRCRAFT;
+ case VEH_SHIP: return STR_8105_SHIP;
+ case VEH_TRAIN:
switch (RailVehInfo(engine)->railtype) {
default: NOT_REACHED();
case RAILTYPE_RAIL: return STR_8102_RAILROAD_LOCOMOTIVE;
@@ -48,10 +48,10 @@
typedef void DrawEngineProc(int x, int y, EngineID engine, SpriteID pal);
typedef void DrawEngineInfoProc(EngineID, int x, int y, int maxw);
-typedef struct DrawEngineInfo {
+struct DrawEngineInfo {
DrawEngineProc *engine_proc;
DrawEngineInfoProc *info_proc;
-} DrawEngineInfo;
+};
static void DrawTrainEngineInfo(EngineID engine, int x, int y, int maxw);
static void DrawRoadVehEngineInfo(EngineID engine, int x, int y, int maxw);
--- a/src/fileio.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/fileio.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -18,7 +18,7 @@
#define FIO_BUFFER_SIZE 512
#define MAX_HANDLES 64
-typedef struct {
+struct Fio {
byte *buffer, *buffer_end; ///< position pointer in local buffer and last valid byte of buffer
uint32 pos; ///< current (system) position in file
FILE *cur_fh; ///< current file handle
@@ -29,12 +29,12 @@
const char *filename[MAX_HANDLES]; ///< array of filenames we (should) have open
uint usage_count[MAX_HANDLES]; ///< count how many times this file has been opened
#endif /* LIMITED_FDS */
-} Fio;
+};
static Fio _fio;
/* Get current position in file */
-uint32 FioGetPos(void)
+uint32 FioGetPos()
{
return _fio.pos + (_fio.buffer - _fio.buffer_start) - FIO_BUFFER_SIZE;
}
@@ -73,7 +73,7 @@
FioSeekTo(GB(pos, 0, 24), SEEK_SET);
}
-byte FioReadByte(void)
+byte FioReadByte()
{
if (_fio.buffer == _fio.buffer_end) {
_fio.pos += FIO_BUFFER_SIZE;
@@ -94,13 +94,13 @@
}
}
-uint16 FioReadWord(void)
+uint16 FioReadWord()
{
byte b = FioReadByte();
return (FioReadByte() << 8) | b;
}
-uint32 FioReadDword(void)
+uint32 FioReadDword()
{
uint b = FioReadWord();
return (FioReadWord() << 16) | b;
@@ -124,7 +124,7 @@
}
}
-void FioCloseAll(void)
+void FioCloseAll()
{
int i;
--- a/src/fileio.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/fileio.h Sun Mar 11 16:31:18 2007 +0000
@@ -7,11 +7,11 @@
void FioSeekTo(uint32 pos, int mode);
void FioSeekToFile(uint32 pos);
-uint32 FioGetPos(void);
-byte FioReadByte(void);
-uint16 FioReadWord(void);
-uint32 FioReadDword(void);
-void FioCloseAll(void);
+uint32 FioGetPos();
+byte FioReadByte();
+uint16 FioReadWord();
+uint32 FioReadDword();
+void FioCloseAll();
FILE *FioFOpenFile(const char *filename);
void FioOpenFile(int slot, const char *filename);
void FioReadBlock(void *ptr, uint size);
--- a/src/fios.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/fios.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -18,6 +18,7 @@
#include <sys/stat.h>
#ifdef WIN32
+# include <tchar.h>
# include <io.h>
#else
# include <unistd.h>
@@ -33,7 +34,8 @@
/* OS-specific functions are taken from their respective files (win32/unix/os2 .c) */
extern bool FiosIsRoot(const char *path);
extern bool FiosIsValidFile(const char *path, const struct dirent *ent, struct stat *sb);
-extern void FiosGetDrives(void);
+extern bool FiosIsHiddenFile(const struct dirent *ent);
+extern void FiosGetDrives();
extern bool FiosGetDiskFreeSpace(const char *path, uint32 *tot);
/* get the name of an oldstyle savegame */
@@ -43,7 +45,7 @@
* Allocate a new FiosItem.
* @return A pointer to the newly allocated FiosItem.
*/
-FiosItem *FiosAlloc(void)
+FiosItem *FiosAlloc()
{
if (_fios_count == _fios_alloc) {
_fios_alloc += 256;
@@ -77,7 +79,7 @@
/**
* Free the list of savegames
*/
-void FiosFreeSavegameList(void)
+void FiosFreeSavegameList()
{
free(_fios_items);
_fios_items = NULL;
@@ -170,8 +172,8 @@
snprintf(buf, size, "%s" PATHSEP "%s%s", _fios_path, name, extension);
}
-#if defined(WIN32) || defined(WIN64)
-# define unlink _wunlink
+#if defined(WIN32)
+# define unlink _tunlink
#endif
bool FiosDelete(const char *name)
@@ -227,7 +229,8 @@
/* found file must be directory, but not '.' or '..' */
if (FiosIsValidFile(_fios_path, dirent, &sb) && (sb.st_mode & S_IFDIR) &&
- strcmp(d_name, ".") != 0 && strcmp(d_name, "..") != 0) {
+ (!FiosIsHiddenFile(dirent) || strncasecmp(d_name, PERSONAL_DIR, strlen(d_name)) == 0) &&
+ strcmp(d_name, ".") != 0 && strcmp(d_name, "..") != 0) {
fios = FiosAlloc();
fios->type = FIOS_TYPE_DIR;
fios->mtime = 0;
@@ -258,7 +261,7 @@
char *t;
ttd_strlcpy(d_name, FS2OTTD(dirent->d_name), sizeof(d_name));
- if (!FiosIsValidFile(_fios_path, dirent, &sb) || !(sb.st_mode & S_IFREG)) continue;
+ if (!FiosIsValidFile(_fios_path, dirent, &sb) || !(sb.st_mode & S_IFREG) || FiosIsHiddenFile(dirent)) continue;
/* File has no extension, skip it */
if ((t = strrchr(d_name, '.')) == NULL) continue;
--- a/src/fios.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/fios.h Sun Mar 11 16:31:18 2007 +0000
@@ -6,12 +6,12 @@
#define FIOS_H
/* Deals with finding savegames */
-typedef struct {
+struct FiosItem {
byte type;
uint64 mtime;
char title[64];
char name[256 - 12 - 64];
-} FiosItem;
+};
enum {
FIOS_TYPE_DRIVE = 0,
@@ -39,7 +39,7 @@
/* Get a list of Heightmaps */
FiosItem *FiosGetHeightmapList(int mode);
/* Free the list of savegames */
-void FiosFreeSavegameList(void);
+void FiosFreeSavegameList();
/* Browse to. Returns a filename w/path if we reached a file. */
char *FiosBrowseTo(const FiosItem *item);
/* Return path, free space and stringID */
@@ -49,22 +49,22 @@
/* Make a filename from a name */
void FiosMakeSavegameName(char *buf, const char *name, size_t size);
/* Allocate a new FiosItem */
-FiosItem *FiosAlloc(void);
+FiosItem *FiosAlloc();
int CDECL compare_FiosItems(const void *a, const void *b);
/* Implementation of opendir/readdir/closedir for Windows */
#if defined(WIN32)
#include <windows.h>
-typedef struct DIR DIR;
+struct DIR;
-typedef struct dirent { // XXX - only d_name implemented
- wchar_t *d_name; // name of found file
+struct dirent { // XXX - only d_name implemented
+ TCHAR *d_name; // name of found file
/* little hack which will point to parent DIR struct which will
* save us a call to GetFileAttributes if we want information
* about the file (for example in function fio_bla) */
DIR *dir;
-} dirent;
+};
struct DIR {
HANDLE hFind;
@@ -72,14 +72,14 @@
* note: having only one global instance is not possible because
* multiple independent opendir/readdir sequences must be supported. */
dirent ent;
- WIN32_FIND_DATAW fd;
+ WIN32_FIND_DATA fd;
/* since opendir calls FindFirstFile, we need a means of telling the
* first call to readdir that we already have a file.
* that's the case iff this is true */
bool at_first_entry;
};
-DIR *opendir(const wchar_t *path);
+DIR *opendir(const TCHAR *path);
struct dirent *readdir(DIR *d);
int closedir(DIR *d);
#else
--- a/src/fontcache.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/fontcache.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -278,7 +278,7 @@
}
-void InitFreeType(void)
+void InitFreeType()
{
if (StrEmpty(_freetype.small_font) && StrEmpty(_freetype.medium_font) && StrEmpty(_freetype.large_font)) {
DEBUG(freetype, 1, "No font faces specified, using sprite fonts instead");
@@ -315,10 +315,10 @@
}
-typedef struct GlyphEntry {
+struct GlyphEntry {
Sprite *sprite;
byte width;
-} GlyphEntry;
+};
/* The glyph cache. This is structured to reduce memory consumption.
@@ -492,7 +492,7 @@
}
-void InitializeUnicodeGlyphMap(void)
+void InitializeUnicodeGlyphMap()
{
FontSize size;
SpriteID base;
--- a/src/fontcache.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/fontcache.h Sun Mar 11 16:31:18 2007 +0000
@@ -10,29 +10,29 @@
void SetUnicodeGlyph(FontSize size, uint32 key, SpriteID sprite);
/** Initialize the glyph map */
-void InitializeUnicodeGlyphMap(void);
+void InitializeUnicodeGlyphMap();
#ifdef WITH_FREETYPE
-typedef struct FreeTypeSettings {
+struct FreeTypeSettings {
char small_font[260];
char medium_font[260];
char large_font[260];
uint small_size;
uint medium_size;
uint large_size;
-} FreeTypeSettings;
+};
extern FreeTypeSettings _freetype;
-void InitFreeType(void);
+void InitFreeType();
const struct Sprite *GetGlyph(FontSize size, uint32 key);
uint GetGlyphWidth(FontSize size, uint32 key);
#else
/* Stub for initializiation */
-static inline void InitFreeType(void) {}
+static inline void InitFreeType() {}
/** Get the Sprite for a glyph */
static inline const Sprite *GetGlyph(FontSize size, uint32 key)
--- a/src/functions.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/functions.h Sun Mar 11 16:31:18 2007 +0000
@@ -6,9 +6,10 @@
#define FUNCTIONS_H
#include "gfx.h"
+#include "window.h"
void DoClearSquare(TileIndex tile);
-void RunTileLoop(void);
+void RunTileLoop();
uint GetPartialZ(int x, int y, Slope corners);
uint GetSlopeZ(int x, int y);
@@ -80,11 +81,11 @@
// Mersenne twister functions
void SeedMT(uint32 seed);
-uint32 RandomMT(void);
+uint32 RandomMT();
#ifdef MERSENNE_TWISTER
- static inline uint32 Random(void) { return RandomMT(); }
+ static inline uint32 Random() { return RandomMT(); }
uint RandomRange(uint max);
#else
@@ -94,33 +95,33 @@
#define RandomRange(max) DoRandomRange(max, __LINE__, __FILE__)
uint DoRandomRange(uint max, int line, const char *file);
#else
- uint32 Random(void);
+ uint32 Random();
uint RandomRange(uint max);
#endif
#endif // MERSENNE_TWISTER
static inline TileIndex RandomTileSeed(uint32 r) { return TILE_MASK(r); }
-static inline TileIndex RandomTile(void) { return TILE_MASK(Random()); }
+static inline TileIndex RandomTile() { return TILE_MASK(Random()); }
-uint32 InteractiveRandom(void); // Used for random sequences that are not the same on the other end of the multiplayer link
+uint32 InteractiveRandom(); // Used for random sequences that are not the same on the other end of the multiplayer link
uint InteractiveRandomRange(uint max);
/* texteff.cpp */
-void MoveAllTextEffects(void);
+void MoveAllTextEffects();
void AddTextEffect(StringID msg, int x, int y, uint16 duration);
-void InitTextEffects(void);
+void InitTextEffects();
void DrawTextEffects(DrawPixelInfo *dpi);
-void InitTextMessage(void);
-void DrawTextMessage(void);
+void InitTextMessage();
+void DrawTextMessage();
void CDECL AddTextMessage(uint16 color, uint8 duration, const char *message, ...);
-void UndrawTextMessage(void);
+void UndrawTextMessage();
bool AddAnimatedTile(TileIndex tile);
void DeleteAnimatedTile(TileIndex tile);
-void AnimateAnimatedTiles(void);
-void InitializeAnimatedTiles(void);
+void AnimateAnimatedTiles();
+void InitializeAnimatedTiles();
/* tunnelbridge_cmd.cpp */
bool CheckBridge_Stuff(byte bridge_type, uint bridge_len);
@@ -128,7 +129,7 @@
int CalcBridgeLenCostFactor(int x);
/* misc_cmd.cpp */
-void PlaceTreesRandomly(void);
+void PlaceTreesRandomly();
void InitializeLandscapeVariables(bool only_constants);
@@ -142,7 +143,7 @@
#define AllocateNameUnique(name, skip) RealAllocateName(name, skip, true)
#define AllocateName(name, skip) RealAllocateName(name, skip, false)
StringID RealAllocateName(const char *name, byte skip, bool check_double);
-void ConvertNameArray(void);
+void ConvertNameArray();
/* misc functions */
void MarkTileDirty(int x, int y);
@@ -157,7 +158,7 @@
void SetObjectToPlaceWnd(CursorID icon, SpriteID pal, byte mode, BaseWindow *w);
void SetObjectToPlace(CursorID icon, SpriteID pal, byte mode, WindowClass window_class, WindowNumber window_num);
-void ResetObjectToPlace(void);
+void ResetObjectToPlace();
bool ScrollWindowTo(int x, int y, BaseWindow * w);
@@ -181,12 +182,12 @@
void ShowHighscoreTable(int difficulty, int8 rank);
TileIndex AdjustTileCoordRandomly(TileIndex a, byte rng);
-void AfterLoadTown(void);
-void UpdatePatches(void);
-void AskExitGame(void);
-void AskExitToGameMenu(void);
+void AfterLoadTown();
+void UpdatePatches();
+void AskExitGame();
+void AskExitToGameMenu();
-void RedrawAutosave(void);
+void RedrawAutosave();
StringID RemapOldStringID(StringID s);
@@ -203,19 +204,19 @@
void ShowSaveLoadDialog(int mode);
/* callback from drivers that is called if the game size changes dynamically */
-void GameSizeChanged(void);
+void GameSizeChanged();
bool FileExists(const char *filename);
bool ReadLanguagePack(int index);
-void InitializeLanguagePacks(void);
+void InitializeLanguagePacks();
const char *GetCurrentLocale(const char *param);
void *ReadFileToMem(const char *filename, size_t *lenp, size_t maxsize);
-void LoadFromConfig(void);
-void SaveToConfig(void);
-void CheckConfig(void);
+void LoadFromConfig();
+void SaveToConfig();
+void CheckConfig();
int ttd_main(int argc, char* argv[]);
-void HandleExitGameRequest(void);
+void HandleExitGameRequest();
-void DeterminePaths(void);
+void DeterminePaths();
#endif /* FUNCTIONS_H */
--- a/src/genworld.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/genworld.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -20,19 +20,19 @@
#include "date.h"
void GenerateLandscape(byte mode);
-void GenerateClearTile(void);
-void GenerateIndustries(void);
-void GenerateUnmovables(void);
-bool GenerateTowns(void);
-void GenerateTrees(void);
+void GenerateClearTile();
+void GenerateIndustries();
+void GenerateUnmovables();
+bool GenerateTowns();
+void GenerateTrees();
-void StartupEconomy(void);
-void StartupPlayers(void);
-void StartupDisasters(void);
+void StartupEconomy();
+void StartupPlayers();
+void StartupDisasters();
void InitializeGame(int mode, uint size_x, uint size_y);
-void ConvertGroundTilesIntoWaterTiles(void);
+void ConvertGroundTilesIntoWaterTiles();
/* Please only use this variable in genworld.h and genworld.c and
* nowhere else. For speed improvements we need it to be global, but
@@ -58,7 +58,7 @@
* writing in a thread, it can cause damaged data (reading and writing the
* same tile at the same time).
*/
-bool IsGeneratingWorldReadyForPaint(void)
+bool IsGeneratingWorldReadyForPaint()
{
/* If we are in quit_thread mode, ignore this and always return false. This
* forces the screen to not be drawn, and the GUI not to wait for a draw. */
@@ -70,7 +70,7 @@
/**
* Tells if the world generation is done in a thread or not.
*/
-bool IsGenerateWorldThreaded(void)
+bool IsGenerateWorldThreaded()
{
return _gw.threaded && !_gw.quit_thread;
}
@@ -180,7 +180,7 @@
* This will wait for the thread to finish up his work. It will not continue
* till the work is done.
*/
-void WaitTillGeneratedWorld(void)
+void WaitTillGeneratedWorld()
{
if (_gw.thread == NULL) return;
_gw.quit_thread = true;
@@ -192,7 +192,7 @@
/**
* Initializes the abortion process
*/
-void AbortGeneratingWorld(void)
+void AbortGeneratingWorld()
{
_gw.abort = true;
}
@@ -200,7 +200,7 @@
/**
* Is the generation being aborted?
*/
-bool IsGeneratingWorldAborted(void)
+bool IsGeneratingWorldAborted()
{
return _gw.abort;
}
@@ -208,7 +208,7 @@
/**
* Really handle the abortion, i.e. clean up some of the mess
*/
-void HandleGeneratingWorldAbortion(void)
+void HandleGeneratingWorldAbortion()
{
/* Clean up - in SE create an empty map, otherwise, go to intro menu */
_switch_mode = (_game_mode == GM_EDITOR) ? SM_EDITOR : SM_MENU;
--- a/src/genworld.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/genworld.h Sun Mar 11 16:31:18 2007 +0000
@@ -26,10 +26,10 @@
GENERATE_NEW_SEED = (uint)-1, ///< Create a new random seed
};
-typedef void gw_done_proc(void);
-typedef void gw_abort_proc(void);
+typedef void gw_done_proc();
+typedef void gw_abort_proc();
-typedef struct gw_info {
+struct gw_info {
bool active; ///< Is generating world active
bool abort; ///< Whether to abort the thread ASAP
bool wait_for_draw; ///< Are we waiting on a draw event
@@ -42,14 +42,14 @@
gw_done_proc *proc; ///< Proc that is called when done (can be NULL)
gw_abort_proc *abortp; ///< Proc that is called when aborting (can be NULL)
OTTDThread *thread; ///< The thread we are in (can be NULL)
-} gw_info;
+};
#ifdef TEMPORARY_OTTDTHREAD_DEFINITION
#undef OTTDThread
#undef TEMPORARY_OTTDTHREAD_DEFINITION
#endif
-typedef enum gwp_classes {
+enum gwp_class {
GWP_MAP_INIT, ///< Initialize/allocate the map, start economy
GWP_LANDSCAPE, ///< Create the landscape
GWP_ROUGH_ROCKY, ///< Make rough and rocky areas
@@ -61,12 +61,12 @@
GWP_RUNTILELOOP, ///< Runs the tile loop 1280 times to make snow etc
GWP_GAME_START, ///< Really prepare to start the game
GWP_CLASS_COUNT
-} gwp_class;
+};
/**
* Check if we are currently in the process of generating a world.
*/
-static inline bool IsGeneratingWorld(void)
+static inline bool IsGeneratingWorld()
{
extern gw_info _gw;
@@ -75,23 +75,23 @@
/* genworld.cpp */
void SetGeneratingWorldPaintStatus(bool status);
-bool IsGeneratingWorldReadyForPaint(void);
-bool IsGenerateWorldThreaded(void);
+bool IsGeneratingWorldReadyForPaint();
+bool IsGenerateWorldThreaded();
void GenerateWorldSetCallback(gw_done_proc *proc);
void GenerateWorldSetAbortCallback(gw_abort_proc *proc);
-void WaitTillGeneratedWorld(void);
+void WaitTillGeneratedWorld();
void GenerateWorld(int mode, uint size_x, uint size_y);
-void AbortGeneratingWorld(void);
-bool IsGeneratingWorldAborted(void);
-void HandleGeneratingWorldAbortion(void);
+void AbortGeneratingWorld();
+bool IsGeneratingWorldAborted();
+void HandleGeneratingWorldAbortion();
/* genworld_gui.cpp */
void SetGeneratingWorldProgress(gwp_class cls, uint total);
void IncreaseGeneratingWorldProgress(gwp_class cls);
-void PrepareGenerateWorldProgress(void);
-void ShowGenerateWorldProgress(void);
+void PrepareGenerateWorldProgress();
+void ShowGenerateWorldProgress();
void StartNewGameWithoutGUI(uint seed);
-void ShowCreateScenario(void);
-void StartScenarioEditor(void);
+void ShowCreateScenario();
+void StartScenarioEditor();
#endif /* GENWORLD_H */
--- a/src/genworld_gui.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/genworld_gui.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -29,12 +29,12 @@
/**
* In what 'mode' the GenerateLandscapeWindowProc is.
*/
-typedef enum glwp_modes {
+enum glwp_modes {
GLWP_GENERATE,
GLWP_HEIGHTMAP,
GLWP_SCENARIO,
GLWP_END
-} glwp_modes;
+};
static uint _heightmap_x = 0;
static uint _heightmap_y = 0;
@@ -533,17 +533,17 @@
if (w != NULL) InvalidateWindow(WC_GENERATE_LANDSCAPE, mode);
}
-void ShowGenerateLandscape(void)
+void ShowGenerateLandscape()
{
_ShowGenerateLandscape(GLWP_GENERATE);
}
-void ShowHeightmapLoad(void)
+void ShowHeightmapLoad()
{
_ShowGenerateLandscape(GLWP_HEIGHTMAP);
}
-void StartScenarioEditor(void)
+void StartScenarioEditor()
{
StartGeneratingLandscape(GLWP_SCENARIO);
}
@@ -726,7 +726,7 @@
CreateScenarioWndProc,
};
-void ShowCreateScenario(void)
+void ShowCreateScenario()
{
DeleteWindowByClass(WC_GENERATE_LANDSCAPE);
BaseWindow::AllocateFront(&_create_scenario_desc, GLWP_SCENARIO);
@@ -740,13 +740,13 @@
{ WIDGETS_END},
};
-typedef struct tp_info {
+struct tp_info {
uint percent;
StringID cls;
uint current;
uint total;
int timer;
-} tp_info;
+};
static tp_info _tp;
@@ -809,7 +809,7 @@
/**
* Initializes the progress counters to the starting point.
*/
-void PrepareGenerateWorldProgress(void)
+void PrepareGenerateWorldProgress()
{
_tp.cls = STR_WORLD_GENERATION;
_tp.current = 0;
@@ -821,7 +821,7 @@
/**
* Show the window where a user can follow the process of the map generation.
*/
-void ShowGenerateWorldProgress(void)
+void ShowGenerateWorldProgress()
{
BaseWindow::AllocateFront(&_show_terrain_progress_desc, 0);
}
--- a/src/gfx.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/gfx.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -37,18 +37,18 @@
bool _exit_game;
bool _networking; ///< are we in networking mode?
byte _game_mode;
-byte _pause;
+byte _pause_game;
int _pal_first_dirty;
int _pal_last_dirty;
Colour _cur_palette[256];
byte _stringwidth_table[FS_END][224];
-typedef enum BlitterModes {
+enum BlitterMode {
BM_NORMAL,
BM_COLOUR_REMAP,
BM_TRANSPARENT,
-} BlitterMode;
+};
static void GfxMainBlitter(const Sprite *sprite, int x, int y, BlitterMode mode);
@@ -296,7 +296,7 @@
if (w >= maxw) {
/* string got too big... insert dotdotdot */
ddd_pos[0] = ddd_pos[1] = ddd_pos[2] = '.';
- ddd_pos[3] = 0;
+ ddd_pos[3] = '\0';
return ddd_w;
}
} else {
@@ -440,7 +440,7 @@
for (;;) {
WChar c = Utf8Consume((const char **)&str);
/* whitespace is where we will insert the line-break */
- if (c == ' ') last_space = str;
+ if (IsWhitespace(c)) last_space = str;
if (IsPrintable(c)) {
w += GetCharacterWidth(size, c);
@@ -451,7 +451,7 @@
* 2. In all other cases force a linebreak at the last seen whitespace */
if (w > maxw) {
if (last_space == NULL) {
- str[-1] = '\0';
+ *Utf8PrevChar(str) = '\0';
return num + (size << 16);
}
str = last_space;
@@ -469,9 +469,17 @@
}
}
end_of_inner_loop:
- /* string didn't fit on line, so 'dummy' terminate and increase linecount */
+ /* String didn't fit on line (or a '\n' was encountered), so 'dummy' terminate
+ * and increase linecount. We use Utf8PrevChar() as also non 1 char long
+ * whitespace seperators are supported */
num++;
- str[-1] = '\0';
+ char *s = Utf8PrevChar(str);
+ *s++ = '\0';
+
+ /* In which case (see above) we will shift remainder to left and close the gap */
+ if (str - s >= 1) {
+ for (; str[-1] != '\0';) *s++ = *str++;
+ }
}
}
@@ -710,7 +718,7 @@
}
}
-typedef struct BlitterParams {
+struct BlitterParams {
int start_x, start_y;
const byte *sprite;
Pixel *dst;
@@ -718,7 +726,7 @@
int width, height;
int width_org;
int pitch;
-} BlitterParams;
+};
static void GfxBlitTileZoomIn(BlitterParams *bp)
{
@@ -1516,9 +1524,9 @@
}
}
-void DoPaletteAnimations(void);
+void DoPaletteAnimations();
-void GfxInitPalettes(void)
+void GfxInitPalettes()
{
memcpy(_cur_palette, _palettes[_use_dos_palette ? 1 : 0], sizeof(_cur_palette));
@@ -1530,7 +1538,7 @@
#define EXTR(p, q) (((uint16)(_timer_counter * (p)) * (q)) >> 16)
#define EXTR2(p, q) (((uint16)(~_timer_counter * (p)) * (q)) >> 16)
-void DoPaletteAnimations(void)
+void DoPaletteAnimations()
{
const Colour *s;
Colour *d;
@@ -1641,7 +1649,7 @@
}
-void LoadStringWidthTable(void)
+void LoadStringWidthTable()
{
uint i;
@@ -1670,7 +1678,7 @@
}
-void ScreenSizeChanged(void)
+void ScreenSizeChanged()
{
/* check the dirty rect */
if (_invalid_rect.right >= _screen.width) _invalid_rect.right = _screen.width;
@@ -1680,7 +1688,7 @@
_cursor.visible = false;
}
-void UndrawMouseCursor(void)
+void UndrawMouseCursor()
{
if (_cursor.visible) {
_cursor.visible = false;
@@ -1693,7 +1701,7 @@
}
}
-void DrawMouseCursor(void)
+void DrawMouseCursor()
{
int x;
int y;
@@ -1786,7 +1794,7 @@
_video_driver->make_dirty(left, top, right - left, bottom - top);
}
-void DrawDirtyBlocks(void)
+void DrawDirtyBlocks()
{
byte *b = _dirty_blocks;
const int w = ALIGN(_screen.width, 64);
@@ -1908,7 +1916,7 @@
} while (--height != 0);
}
-void MarkWholeScreenDirty(void)
+void MarkWholeScreenDirty()
{
SetDirtyBlocks(0, 0, _screen.width, _screen.height);
}
@@ -1987,7 +1995,7 @@
cv->dirty = true;
}
-static void SwitchAnimatedCursor(void)
+static void SwitchAnimatedCursor()
{
const AnimCursor *cur = _cursor.animate_cur;
@@ -1999,7 +2007,7 @@
_cursor.animate_cur = cur + 1;
}
-void CursorTick(void)
+void CursorTick()
{
if (_cursor.animate_timeout != 0 && --_cursor.animate_timeout == 0)
SwitchAnimatedCursor();
--- a/src/gfx.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/gfx.h Sun Mar 11 16:31:18 2007 +0000
@@ -87,16 +87,16 @@
GM_EDITOR
};
-void GameLoop(void);
+void GameLoop();
-void CreateConsole(void);
+void CreateConsole();
typedef int32 CursorID;
typedef byte Pixel;
-typedef struct Rect {
+struct Rect {
int left,top,right,bottom;
-} Rect;
+};
/** A single sprite of a list of animated cursors */
struct AnimCursor {
@@ -105,7 +105,7 @@
byte display_time; ///< Amount of ticks this sprite will be shown
};
-typedef struct CursorVars {
+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
SpriteID sprite; ///< current image of cursor
@@ -120,20 +120,20 @@
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 {
+struct DrawPixelInfo {
Pixel *dst_ptr;
int left, top, width, height;
int pitch;
uint16 zoom;
-} DrawPixelInfo;
+};
-typedef struct Colour {
+struct Colour {
byte r;
byte g;
byte b;
-} Colour;
+};
@@ -153,7 +153,7 @@
extern bool _exit_game;
extern bool _networking; ///< are we in networking mode?
extern byte _game_mode;
-extern byte _pause;
+extern byte _pause_game;
extern int _pal_first_dirty;
extern int _pal_last_dirty;
@@ -163,27 +163,27 @@
extern Colour _cur_palette[256];
void HandleKeypress(uint32 key);
-void HandleMouseEvents(void);
+void HandleMouseEvents();
void CSleep(int milliseconds);
-void UpdateWindows(void);
+void UpdateWindows();
-uint32 InteractiveRandom(void); //< Used for random sequences that are not the same on the other end of the multiplayer link
+uint32 InteractiveRandom(); //< 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);
+void DrawTextMessage();
+void DrawMouseCursor();
+void ScreenSizeChanged();
+void HandleExitGameRequest();
+void GameSizeChanged();
+void UndrawMouseCursor();
#include "helpers.hpp"
-typedef enum FontSizes {
+enum FontSize {
FS_NORMAL,
FS_SMALL,
FS_LARGE,
FS_END,
-} FontSize;
+};
DECLARE_POSTFIX_INCREMENT(FontSize);
@@ -221,14 +221,14 @@
BoundingRect GetStringBoundingBox(const char *str);
uint32 FormatStringLinebreaks(char *str, int maxw);
-void LoadStringWidthTable(void);
+void LoadStringWidthTable();
void DrawStringMultiCenter(int x, int y, StringID str, int maxw);
uint DrawStringMultiLine(int x, int y, StringID str, int maxw);
-void DrawDirtyBlocks(void);
+void DrawDirtyBlocks();
void SetDirtyBlocks(int left, int top, int right, int bottom);
-void MarkWholeScreenDirty(void);
+void MarkWholeScreenDirty();
-void GfxInitPalettes(void);
+void GfxInitPalettes();
bool FillDrawPixelInfo(DrawPixelInfo* n, int left, int top, int width, int height);
@@ -238,10 +238,10 @@
void SetMouseCursor(CursorID cursor);
void SetMouseCursor(SpriteID sprite, SpriteID pal);
void SetAnimatedMouseCursor(const AnimCursor *table);
-void CursorTick(void);
-void DrawMouseCursor(void);
-void ScreenSizeChanged(void);
-void UndrawMouseCursor(void);
+void CursorTick();
+void DrawMouseCursor();
+void ScreenSizeChanged();
+void UndrawMouseCursor();
bool ChangeResInGame(int w, int h);
void SortResolutions(int count);
void ToggleFullScreen(bool fs);
@@ -293,9 +293,9 @@
VARDEF bool _use_dos_palette;
-typedef enum StringColorFlags {
+enum StringColorFlags {
IS_PALETTE_COLOR = 0x100, ///< color value is already a real palette color index, not an index of a StringColor
-} StringColorFlags;
+};
/**
* Create instance of this class on the stack (as local var) to set new clipping
--- a/src/gfxinit.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/gfxinit.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -18,15 +18,15 @@
#include "fontcache.h"
#include <string.h>
-typedef struct MD5File {
+struct MD5File {
const char * filename; ///< filename
md5_byte_t hash[16]; ///< md5 sum of the file
-} MD5File;
+};
-typedef struct FileList {
+struct FileList {
MD5File basic[4]; ///< grf files that always have to be loaded
MD5File landscape[3]; ///< landscape specific grf files
-} FileList;
+};
enum {
SKIP = 0xFFFE,
@@ -162,7 +162,7 @@
* If neither are found, Windows palette is assumed.
*
* (Note: Also checks sample.cat for corruption) */
-void CheckExternalFiles(void)
+void CheckExternalFiles()
{
uint i;
/* count of files from this version */
@@ -340,7 +340,7 @@
};
-static void LoadSpriteTables(void)
+static void LoadSpriteTables()
{
const FileList* files = _use_dos_palette ? &files_dos : &files_win;
uint load_index;
@@ -400,7 +400,7 @@
}
-void GfxLoadSprites(void)
+void GfxLoadSprites()
{
DEBUG(sprite, 2, "Loading sprite set %d", _opt.landscape);
--- a/src/gfxinit.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/gfxinit.h Sun Mar 11 16:31:18 2007 +0000
@@ -5,7 +5,7 @@
#ifndef GFXINIT_H
#define GFXINIT_H
-void CheckExternalFiles(void);
-void GfxLoadSprites(void);
+void CheckExternalFiles();
+void GfxLoadSprites();
#endif /* GFXINIT_H */
--- a/src/graph_gui.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/graph_gui.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -43,7 +43,7 @@
static const int64 INVALID_DATAPOINT = INT64_MAX; // Value used for a datapoint that shouldn't be drawn.
static const uint INVALID_DATAPOINT_POS = UINT_MAX; // Used to determine if the previous point was drawn.
-typedef struct GraphDrawer {
+struct GraphDrawer {
uint excluded_data; ///< bitmask of the datasets that shouldn't be displayed.
byte num_dataset;
byte num_on_x_axis;
@@ -65,7 +65,7 @@
StringID format_str_y_axis;
byte colors[GRAPH_MAX_DATASETS];
int64 cost[GRAPH_MAX_DATASETS][24]; ///< last 2 years
-} GraphDrawer;
+};
static void DrawGraph(const GraphDrawer *gw)
{
@@ -317,7 +317,7 @@
GraphLegendWndProc
};
-static void ShowGraphLegend(void)
+static void ShowGraphLegend()
{
BaseWindow::AllocateFront(&_graph_legend_desc, 0);
}
@@ -416,7 +416,7 @@
};
-void ShowOperatingProfitGraph(void)
+void ShowOperatingProfitGraph()
{
if (BaseWindow::AllocateFront(&_operating_profit_desc, 0)) {
InvalidateWindow(WC_GRAPH_LEGEND, 0);
@@ -484,7 +484,7 @@
IncomeGraphWndProc
};
-void ShowIncomeGraph(void)
+void ShowIncomeGraph()
{
if (BaseWindow::AllocateFront(&_income_graph_desc, 0)) {
InvalidateWindow(WC_GRAPH_LEGEND, 0);
@@ -551,7 +551,7 @@
DeliveredCargoGraphWndProc
};
-void ShowDeliveredCargoGraph(void)
+void ShowDeliveredCargoGraph()
{
if (BaseWindow::AllocateFront(&_delivered_cargo_graph_desc, 0)) {
InvalidateWindow(WC_GRAPH_LEGEND, 0);
@@ -620,7 +620,7 @@
PerformanceHistoryWndProc
};
-void ShowPerformanceHistoryGraph(void)
+void ShowPerformanceHistoryGraph()
{
if (BaseWindow::AllocateFront(&_performance_history_desc, 0)) {
InvalidateWindow(WC_GRAPH_LEGEND, 0);
@@ -687,7 +687,7 @@
CompanyValueGraphWndProc
};
-void ShowCompanyValueGraph(void)
+void ShowCompanyValueGraph()
{
if (BaseWindow::AllocateFront(&_company_value_graph_desc, 0)) {
InvalidateWindow(WC_GRAPH_LEGEND, 0);
@@ -785,7 +785,7 @@
};
-void ShowCargoPaymentRates(void)
+void ShowCargoPaymentRates()
{
BaseWindow *w = BaseWindow::AllocateFront(&_cargo_payment_rates_desc, 0);
if (w == NULL) return;
@@ -800,8 +800,9 @@
w->Resize(0, num_active * 8);
/* Add widgets for each cargo type */
- w->widget_count = 3 + num_active;
- w->widget = ReallocT(w->widget, w->widget_count);
+ w->widget_count += num_active;
+ w->widget = ReallocT(w->widget, w->widget_count + 1);
+ w->widget[w->widget_count].type = WWT_LAST;
/* Set the properties of each widget */
for (uint i = 0; i != num_active; i++) {
@@ -906,7 +907,7 @@
CompanyLeagueWndProc
};
-void ShowCompanyLeagueTable(void)
+void ShowCompanyLeagueTable()
{
BaseWindow::AllocateFront(&_company_league_desc,0);
}
@@ -1145,7 +1146,7 @@
PerformanceRatingDetailWndProc
};
-void ShowPerformanceRatingDetail(void)
+void ShowPerformanceRatingDetail()
{
BaseWindow::AllocateFront(&_performance_rating_detail_desc, 0);
}
--- a/src/gui.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/gui.h Sun Mar 11 16:31:18 2007 +0000
@@ -10,31 +10,31 @@
#include "string.h"
/* main_gui.cpp */
-void SetupColorsAndInitialWindow(void);
+void SetupColorsAndInitialWindow();
void CcPlaySound10(bool success, TileIndex tile, uint32 p1, uint32 p2);
void CcBuildCanal(bool success, TileIndex tile, uint32 p1, uint32 p2);
void CcTerraform(bool success, TileIndex tile, uint32 p1, uint32 p2);
/* settings_gui.cpp */
-void ShowGameOptions(void);
-void ShowGameDifficulty(void);
-void ShowPatchesSelection(void);
+void ShowGameOptions();
+void ShowGameDifficulty();
+void ShowPatchesSelection();
void DrawArrowButtons(int x, int y, int ctab, byte state, bool clickable_left, bool clickable_right);
/* graph_gui.cpp */
-void ShowOperatingProfitGraph(void);
-void ShowIncomeGraph(void);
-void ShowDeliveredCargoGraph(void);
-void ShowPerformanceHistoryGraph(void);
-void ShowCompanyValueGraph(void);
-void ShowCargoPaymentRates(void);
-void ShowCompanyLeagueTable(void);
-void ShowPerformanceRatingDetail(void);
+void ShowOperatingProfitGraph();
+void ShowIncomeGraph();
+void ShowDeliveredCargoGraph();
+void ShowPerformanceHistoryGraph();
+void ShowCompanyValueGraph();
+void ShowCargoPaymentRates();
+void ShowCompanyLeagueTable();
+void ShowPerformanceRatingDetail();
/* news_gui.cpp */
-void ShowLastNewsMessage(void);
-void ShowMessageOptions(void);
-void ShowMessageHistory(void);
+void ShowLastNewsMessage();
+void ShowMessageOptions();
+void ShowMessageHistory();
/* rail_gui.cpp */
void ShowBuildRailToolbar(RailType railtype, int button);
@@ -46,23 +46,23 @@
void ShowOrdersWindow(const Vehicle *v);
/* road_gui.cpp */
-void ShowBuildRoadToolbar(void);
-void ShowBuildRoadScenToolbar(void);
+void ShowBuildRoadToolbar();
+void ShowBuildRoadScenToolbar();
void ShowRoadVehViewWindow(const Vehicle *v);
/* dock_gui.cpp */
-void ShowBuildDocksToolbar(void);
+void ShowBuildDocksToolbar();
void ShowShipViewWindow(const Vehicle *v);
/* aircraft_gui.cpp */
-void ShowBuildAirToolbar(void);
+void ShowBuildAirToolbar();
/* terraform_gui.cpp */
void ShowTerraformToolbar(BaseWindow *link = NULL);
/* tgp_gui.cpp */
-void ShowGenerateLandscape(void);
-void ShowHeightmapLoad(void);
+void ShowGenerateLandscape();
+void ShowHeightmapLoad();
void PlaceProc_DemolishArea(TileIndex tile);
void PlaceProc_LevelLand(TileIndex tile);
@@ -78,13 +78,13 @@
};
/* misc_gui.cpp */
-void PlaceLandBlockInfo(void);
-void ShowAboutWindow(void);
-void ShowBuildTreesToolbar(void);
-void ShowBuildTreesScenToolbar(void);
-void ShowTownDirectory(void);
-void ShowIndustryDirectory(void);
-void ShowSubsidiesList(void);
+void PlaceLandBlockInfo();
+void ShowAboutWindow();
+void ShowBuildTreesToolbar();
+void ShowBuildTreesScenToolbar();
+void ShowTownDirectory();
+void ShowIndustryDirectory();
+void ShowSubsidiesList();
void ShowPlayerStations(PlayerID player);
void ShowPlayerFinances(PlayerID player);
void ShowPlayerCompany(PlayerID player);
@@ -95,13 +95,13 @@
void DrawStationCoverageAreaText(int sx, int sy, uint mask,int rad);
void CheckRedrawStationCoverage(const BaseWindow *w);
-void ShowSmallMap(void);
-void ShowExtraViewPortWindow(void);
+void ShowSmallMap();
+void ShowExtraViewPortWindow();
void SetVScrollCount(BaseWindow *w, int num);
void SetVScroll2Count(BaseWindow *w, int num);
void SetHScrollCount(BaseWindow *w, int num);
-void ShowCheatWindow(void);
+void ShowCheatWindow();
void DrawEditBox(BaseWindow *w, querystr_d *string, int wid);
void HandleEditBox(BaseWindow *w, querystr_d *string, int wid);
@@ -116,7 +116,7 @@
void InitializeTextBuffer(Textbuf *tb, const char *buf, uint16 maxlength, uint16 maxwidth);
void UpdateTextBufferSize(Textbuf *tb);
-void BuildFileList(void);
+void BuildFileList();
void SetFiosType(const byte fiostype);
/* FIOS_TYPE_FILE, FIOS_TYPE_OLDFILE etc. different colours */
@@ -125,10 +125,10 @@
/* bridge_gui.cpp */
void ShowBuildBridgeWindow(uint start, uint end, byte type);
-void ShowBuildIndustryWindow(void);
+void ShowBuildIndustryWindow();
void ShowQueryString(StringID str, StringID caption, uint maxlen, uint maxwidth, BaseWindow *parent, CharSetFilter afilter);
void ShowQuery(StringID caption, StringID message, BaseWindow *w, void (*callback)(BaseWindow*, bool));
-void ShowMusicWindow(void);
+void ShowMusicWindow();
/* main_gui.cpp */
void HandleOnEditText(const char *str);
@@ -136,6 +136,6 @@
VARDEF PlaceProc *_place_proc;
/* vehicle_gui.cpp */
-void InitializeGUI(void);
+void InitializeGUI();
#endif /* GUI_H */
--- a/src/hal.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/hal.h Sun Mar 11 16:31:18 2007 +0000
@@ -5,34 +5,34 @@
#ifndef HAL_H
#define HAL_H
-typedef struct {
+struct HalCommonDriver {
const char *(*start)(const char * const *parm);
- void (*stop)(void);
-} HalCommonDriver;
+ void (*stop)();
+};
-typedef struct {
+struct HalVideoDriver {
const char *(*start)(const char * const *parm);
- void (*stop)(void);
+ void (*stop)();
void (*make_dirty)(int left, int top, int width, int height);
- void (*main_loop)(void);
+ void (*main_loop)();
bool (*change_resolution)(int w, int h);
void (*toggle_fullscreen)(bool fullscreen);
-} HalVideoDriver;
+};
-typedef struct {
+struct HalSoundDriver {
const char *(*start)(const char * const *parm);
- void (*stop)(void);
-} HalSoundDriver;
+ void (*stop)();
+};
-typedef struct {
+struct HalMusicDriver {
const char *(*start)(const char * const *parm);
- void (*stop)(void);
+ void (*stop)();
void (*play_song)(const char *filename);
- void (*stop_song)(void);
- bool (*is_song_playing)(void);
+ void (*stop_song)();
+ bool (*is_song_playing)();
void (*set_volume)(byte vol);
-} HalMusicDriver;
+};
extern HalMusicDriver *_music_driver;
extern HalSoundDriver *_sound_driver;
--- a/src/heightmap.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/heightmap.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -32,7 +32,7 @@
#ifdef WITH_PNG
-#include "png.h"
+#include <png.h>
/**
* The PNG Heightmap loader.
@@ -353,7 +353,7 @@
* This function takes care of the fact that land in OpenTTD can never differ
* more than 1 in height
*/
-static void FixSlopes(void)
+static void FixSlopes()
{
uint width, height;
uint row, col;
--- a/src/industry.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/industry.h Sun Mar 11 16:31:18 2007 +0000
@@ -14,11 +14,11 @@
INVALID_INDUSTRY = 0xFFFF,
};
-typedef enum IndustryLifeTypes {
+enum IndustryLifeType {
INDUSTRYLIFE_NOT_CLOSABLE, ///< Industry can never close
INDUSTRYLIFE_PRODUCTION, ///< Industry can close and change of production
INDUSTRYLIFE_CLOSABLE, ///< Industry can only close (no production change)
-} IndustryLifeType;
+};
/**
* Defines the internal data of a functionnal industry
@@ -49,15 +49,15 @@
IndustryID index; ///< index of the industry in the pool of industries
};
-typedef struct IndustryTileTable {
+struct IndustryTileTable {
TileIndexDiffC ti;
IndustryGfx gfx;
-} IndustryTileTable;
+};
/**
* Defines the data structure for constructing industry.
*/
-typedef struct IndustrySpec {
+struct IndustrySpec {
const IndustryTileTable *const *table;///< List of the tiles composing the industry
byte num_table; ///< Number of elements in the table
byte cost_multiplier; ///< Base cost multiplier*/
@@ -71,18 +71,19 @@
IndustryLifeType life_type; ///< This is also known as Industry production flag, in newgrf specs
byte climate_availability; ///< Bitmask, giving landscape enums as bit position
StringID name; ///< Displayed name of the industry
+ StringID new_industry_text; ///< Message appearing when the industry is built
StringID closure_text; ///< Message appearing when the industry closes
StringID production_up_text; ///< Message appearing when the industry's production is increasing
StringID production_down_text; ///< Message appearing when the industry's production is decreasing
-} IndustrySpec;
+};
/**
* Defines the data structure of each indivudual tile of an industry.
*/
-typedef struct IndustryTileSpec {
+struct IndustryTileSpec {
CargoID accepts_cargo[3]; ///< Cargo accepted by this tile
Slope slopes_refused; ///< slope pattern on which this tile cannot be built
-} IndustryTileSpec;
+};
const IndustrySpec *GetIndustrySpec(IndustryType thistype); ///< Array of industries default data
const IndustryTileSpec *GetIndustryTileSpec(IndustryGfx gfx); ///< Array of industry tiles default data
@@ -111,7 +112,7 @@
VARDEF int _total_industries; //general counter
-static inline IndustryID GetMaxIndustryIndex(void)
+static inline IndustryID GetMaxIndustryIndex()
{
/* TODO - This isn't the real content of the function, but
* with the new pool-system this will be replaced with one that
@@ -121,7 +122,7 @@
return GetIndustryPoolSize() - 1;
}
-static inline uint GetNumIndustries(void)
+static inline uint GetNumIndustries()
{
return _total_industries;
}
@@ -129,7 +130,7 @@
/**
* Return a random valid industry.
*/
-static inline Industry *GetRandomIndustry(void)
+static inline Industry *GetRandomIndustry()
{
int num = RandomRange(GetNumIndustries());
IndustryID index = INVALID_INDUSTRY;
--- a/src/industry_cmd.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/industry_cmd.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -985,7 +985,7 @@
}
}
-void OnTick_Industry(void)
+void OnTick_Industry()
{
Industry *i;
@@ -1355,7 +1355,7 @@
return true;
}
-static Industry *AllocateIndustry(void)
+static Industry *AllocateIndustry()
{
Industry *i;
@@ -1582,7 +1582,7 @@
}
}
-void GenerateIndustries(void)
+void GenerateIndustries()
{
const byte *b;
uint i = 0;
@@ -1670,7 +1670,7 @@
SetDParam(0, i->index);
AddNewsItem(
indspec->closure_text,
- NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_ECONOMY, 0),
+ NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_OPENCLOSE, 0),
i->xy + TileDiffXY(1, 1), 0
);
}
@@ -1731,11 +1731,10 @@
static void MaybeNewIndustry(uint32 r)
{
- int type;
+ int type =_new_industry_rand[_opt.landscape][GB(r, 16, 5)];
int j;
Industry *i;
-
- type = _new_industry_rand[_opt.landscape][GB(r, 16, 5)];
+ const IndustrySpec *ind_spc = GetIndustrySpec(type);;
if (type == IT_OIL_WELL && _cur_year > 1950) return;
if (type == IT_OIL_RIG && _cur_year < 1960) return;
@@ -1747,13 +1746,10 @@
if (--j == 0) return;
}
- SetDParam(0, GetIndustrySpec(type)->name);
+ SetDParam(0, ind_spc->name);
SetDParam(1, i->town->index);
- AddNewsItem(
- (type != IT_FOREST && type != IT_FRUIT_PLANTATION && type != IT_RUBBER_PLANTATION && type != IT_COTTON_CANDY) ?
- STR_482D_NEW_UNDER_CONSTRUCTION : STR_482E_NEW_BEING_PLANTED_NEAR,
- NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_ECONOMY,0), i->xy, 0
- );
+ AddNewsItem(ind_spc->new_industry_text,
+ NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_OPENCLOSE, 0), i->xy, 0);
}
static void ChangeIndustryProduction(Industry *i)
@@ -1820,11 +1816,11 @@
if (str != STR_NULL) {
SetDParam(0, i->index);
- AddNewsItem(str, NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, NT_ECONOMY, 0), i->xy + TileDiffXY(1, 1), 0);
+ AddNewsItem(str, NEWS_FLAGS(NM_THIN, NF_VIEWPORT|NF_TILE, str == indspec->closure_text ? NT_OPENCLOSE : NT_ECONOMY, 0), i->xy + TileDiffXY(1, 1), 0);
}
}
-void IndustryMonthlyLoop(void)
+void IndustryMonthlyLoop()
{
Industry *i;
PlayerID old_player = _current_player;
@@ -1850,7 +1846,7 @@
}
-void InitializeIndustries(void)
+void InitializeIndustries()
{
CleanPool(&_Industry_pool);
AddBlockToPool(&_Industry_pool);
@@ -1908,7 +1904,7 @@
SLE_END()
};
-static void Save_INDY(void)
+static void Save_INDY()
{
Industry *ind;
@@ -1919,7 +1915,7 @@
}
}
-static void Load_INDY(void)
+static void Load_INDY()
{
int index;
--- a/src/industry_gui.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/industry_gui.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -271,7 +271,7 @@
},
};
-void ShowBuildIndustryWindow(void)
+void ShowBuildIndustryWindow()
{
if (!IsValidPlayer(_current_player)) return;
BaseWindow::AllocateFront(_industry_window_desc[_patches.build_rawmaterial_ind][_opt_ptr->landscape],0);
@@ -561,7 +561,7 @@
* starts a new game without industries after playing a game with industries
* the list is not populated with invalid industries from the previous game.
*/
-static void MakeSortedIndustryList(void)
+static void MakeSortedIndustryList()
{
const Industry* i;
int n = 0;
@@ -690,7 +690,7 @@
};
-void ShowIndustryDirectory(void)
+void ShowIndustryDirectory()
{
BaseWindow *w = BaseWindow::AllocateFront(&_industry_directory_desc, 0);
--- a/src/industry_map.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/industry_map.h Sun Mar 11 16:31:18 2007 +0000
@@ -166,10 +166,10 @@
_m[tile].m1 = 0;
}
-typedef struct IndustryTypeSolver {
+struct IndustryTypeSolver {
IndustryGfx MinGfx;
IndustryGfx MaxGfx;
-} IndustryTypeSolver;
+};
static const IndustryTypeSolver industry_gfx_Solver [IT_END] = {
{ 0, 6}, ///< IT_COAL_MINE
--- a/src/intro_gui.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/intro_gui.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -99,7 +99,7 @@
SelectGameWndProc
};
-void ShowSelectGameWindow(void)
+void ShowSelectGameWindow()
{
BaseWindow::Allocate(&_select_game_desc);
WindowFactory::NewWindow(WC_TEST1, 0);
@@ -110,7 +110,7 @@
if (confirmed) _exit_game = true;
}
-void AskExitGame(void)
+void AskExitGame()
{
#if defined(_WIN32)
SetDParam(0, STR_0133_WINDOWS);
@@ -124,6 +124,8 @@
SetDParam(0, STR_OSNAME_AMIGAOS);
#elif defined(__OS2__)
SetDParam(0, STR_OSNAME_OS2);
+#elif defined(SUNOS)
+ SetDParam(0, STR_OSNAME_SUNOS);
#else
SetDParam(0, STR_0134_UNIX);
#endif
@@ -141,7 +143,7 @@
if (confirmed) _switch_mode = SM_MENU;
}
-void AskExitToGameMenu(void)
+void AskExitToGameMenu()
{
ShowQuery(
STR_0161_QUIT_GAME,
--- a/src/landscape.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/landscape.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -379,7 +379,7 @@
#define TILELOOP_ASSERTMASK ((TILELOOP_SIZE-1) + ((TILELOOP_SIZE-1) << MapLogX()))
#define TILELOOP_CHKMASK (((1 << (MapLogX() - TILELOOP_BITS))-1) << TILELOOP_BITS)
-void RunTileLoop(void)
+void RunTileLoop()
{
TileIndex tile;
uint count;
@@ -405,7 +405,7 @@
_cur_tileloop_tile = tile;
}
-void InitializeLandscape(void)
+void InitializeLandscape()
{
uint maxx = MapMaxX();
uint maxy = MapMaxY();
@@ -425,7 +425,7 @@
for (x = 0; x < sizex; x++) MakeVoid(sizex * y + x);
}
-void ConvertGroundTilesIntoWaterTiles(void)
+void ConvertGroundTilesIntoWaterTiles()
{
TileIndex tile;
uint z;
@@ -587,7 +587,7 @@
#include "table/genland.h"
-static void CreateDesertOrRainForest(void)
+static void CreateDesertOrRainForest()
{
TileIndex tile;
TileIndex update_freq = MapSize() / 4;
@@ -697,15 +697,15 @@
if (_opt.landscape == LT_DESERT) CreateDesertOrRainForest();
}
-void OnTick_Town(void);
-void OnTick_Trees(void);
-void OnTick_Station(void);
-void OnTick_Industry(void);
+void OnTick_Town();
+void OnTick_Trees();
+void OnTick_Station();
+void OnTick_Industry();
-void OnTick_Players(void);
-void OnTick_Train(void);
+void OnTick_Players();
+void OnTick_Train();
-void CallLandscapeTick(void)
+void CallLandscapeTick()
{
OnTick_Town();
OnTick_Trees();
--- a/src/lang/american.txt Sat Mar 10 11:07:13 2007 +0000
+++ b/src/lang/american.txt Sun Mar 11 16:31:18 2007 +0000
@@ -2633,6 +2633,10 @@
STR_TRAIN_NO_POWER :{RED}No power
STR_TRAIN_START_NO_CATENARY :This track lacks catenary, so the train can't start
+STR_NEW_VEHICLE_NOW_AVAILABLE :{BLACK}{BIGFONT}New {STRING} now available!
+STR_NEW_VEHICLE_TYPE :{BLACK}{BIGFONT}{STRING}
+STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}New {STRING} now available! - {STRING}
+
##id 0x9000
STR_9000_ROAD_VEHICLE_IN_THE_WAY :{WHITE}Road vehicle in the way
STR_9001_ROAD_VEHICLES :{WHITE}{COMPANY} - {COMMA} Road Vehicle{P "" s}
@@ -2893,6 +2897,16 @@
STR_NEWGRF_MD5SUM :{BLACK}MD5sum: {SILVER}{STRING}
STR_NEWGRF_CONFIRMATION_TEXT :{YELLOW}You are about to make changes to a running game; this can crash OpenTTD.{}Are you absolutely sure about this?
+STR_NEWGRF_ERROR_MSG_INFO :{SILVER}{STRING}
+STR_NEWGRF_ERROR_MSG_WARNING :{RED}Warning: {SILVER}{STRING}
+STR_NEWGRF_ERROR_MSG_ERROR :{RED}Error: {SILVER}{STRING}
+STR_NEWGRF_ERROR_MSG_FATAL :{RED}Fatal: {SILVER}{STRING}
+STR_NEWGRF_ERROR_VERSION_NUMBER :{STRING} will not work with the TTDPatch version reported by OpenTTD.
+STR_NEWGRF_ERROR_DOS_OR_WINDOWS :{STRING} is for the {STRING} version of TTD.
+STR_NEWGRF_ERROR_UNSET_SWITCH :{STRING} is designed to be used with {STRING}
+STR_NEWGRF_ERROR_INVALID_PARAMETER :Invalid parameter for {STRING}: parameter {STRING} ({NUM})
+STR_NEWGRF_ERROR_LOAD_BEFORE :{STRING} must be loaded before {STRING}.
+STR_NEWGRF_ERROR_LOAD_AFTER :{STRING} must be loaded after {STRING}.
STR_NEWGRF_ADD :{BLACK}Add
STR_NEWGRF_ADD_TIP :{BLACK}Add a NewGRF file to the list
@@ -3120,5 +3134,10 @@
STR_MEASURE_AREA_HEIGHTDIFF :{BLACK}Area: {NUM} x {NUM}{}Height difference: {NUM} m
############ Date formatting
+STR_DATE_TINY :{STRING}-{STRING}-{NUM}
+STR_DATE_SHORT :{STRING} {NUM}
+STR_DATE_LONG :{STRING} {STRING} {NUM}
########
+
+STR_FEEDER_CARGO_VALUE :{BLACK}Transfer Credits: {LTBLUE}{CURRENCY}
--- a/src/lang/brazilian_portuguese.txt Sat Mar 10 11:07:13 2007 +0000
+++ b/src/lang/brazilian_portuguese.txt Sun Mar 11 16:31:18 2007 +0000
@@ -2637,6 +2637,10 @@
STR_TRAIN_NO_POWER :{RED}Sem força
STR_TRAIN_START_NO_CATENARY :Essa linha não tem energia, portanto o trem não parte
+STR_NEW_VEHICLE_NOW_AVAILABLE :{BLACK}{BIGFONT}Novo {STRING} agora disponível!
+STR_NEW_VEHICLE_TYPE :{BLACK}{BIGFONT}{STRING}
+STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}Novo {STRING} agora disponível! - {STRING}
+
##id 0x9000
STR_9000_ROAD_VEHICLE_IN_THE_WAY :{WHITE}Automóvel no caminho
STR_9001_ROAD_VEHICLES :{WHITE}{COMPANY} - {COMMA} Automóve{P l is}
@@ -3139,3 +3143,5 @@
STR_DATE_LONG :{STRING} {STRING} {NUM}
########
+
+STR_FEEDER_CARGO_VALUE :{BLACK}Transferir Dinheiro: {LTBLUE}{CURRENCY}
--- a/src/lang/bulgarian.txt Sat Mar 10 11:07:13 2007 +0000
+++ b/src/lang/bulgarian.txt Sun Mar 11 16:31:18 2007 +0000
@@ -2635,6 +2635,8 @@
STR_TRAIN_NO_POWER :{RED}Няма мощност
STR_TRAIN_START_NO_CATENARY :Влака не може да тръгне, защото ЖП линията няма catenary
+STR_NEW_VEHICLE_TYPE :{BLACK}{BIGFONT}{STRING}
+
##id 0x9000
STR_9000_ROAD_VEHICLE_IN_THE_WAY :{WHITE}Кола на пътя
STR_9001_ROAD_VEHICLES :{WHITE}{COMPANY} - {COMMA} Кол{P а и}
@@ -2895,6 +2897,17 @@
STR_NEWGRF_MD5SUM :{BLACK}MD5 сума: {SILVER}{STRING}
STR_NEWGRF_CONFIRMATION_TEXT :{YELLOW}На път си да извършиш промени в активна игра; това може да крашне OpenTTD.{}Напълно ли си сигурен в това?
+STR_NEWGRF_ERROR_MSG_INFO :{SILVER}{STRING}
+STR_NEWGRF_ERROR_MSG_WARNING :{RED}Внимание: {SILVER}{STRING}
+STR_NEWGRF_ERROR_MSG_ERROR :{RED}Грешка: {SILVER}{STRING}
+STR_NEWGRF_ERROR_MSG_FATAL :{RED}Критично: {SILVER}{STRING}
+STR_NEWGRF_ERROR_VERSION_NUMBER :{STRING} няма да работи с версията на TTDPatch указана от OpenTTD.
+STR_NEWGRF_ERROR_DOS_OR_WINDOWS :{STRING} е за {STRING} версията на TTD.
+STR_NEWGRF_ERROR_UNSET_SWITCH :{STRING} е проектиран да работи с {STRING}
+STR_NEWGRF_ERROR_INVALID_PARAMETER :Невалиден параметър за {STRING}: параметър {STRING} ({NUM})
+STR_NEWGRF_ERROR_LOAD_BEFORE :{STRING} трябва да бъде зареден преди {STRING}.
+STR_NEWGRF_ERROR_LOAD_AFTER :{STRING} трябва да бъде зареден след {STRING}.
+
STR_NEWGRF_ADD :{BLACK}Добави
STR_NEWGRF_ADD_TIP :{BLACK}Добавяне на NewGRF файл към списъка
STR_NEWGRF_REMOVE :{BLACK}Махни
@@ -3120,4 +3133,10 @@
STR_MEASURE_LENGTH_HEIGHTDIFF :{BLACK}Дължина: {NUM}{}Разлика във височината: {NUM} м
STR_MEASURE_AREA_HEIGHTDIFF :{BLACK}Площ: {NUM} x {NUM}{}Разлика във височината: {NUM} м
+############ Date formatting
+STR_DATE_TINY :{STRING}-{STRING}-{NUM}
+STR_DATE_SHORT :{STRING} {NUM}
+STR_DATE_LONG :{STRING} {STRING} {NUM}
+
########
+
--- a/src/lang/catalan.txt Sat Mar 10 11:07:13 2007 +0000
+++ b/src/lang/catalan.txt Sun Mar 11 16:31:18 2007 +0000
@@ -280,6 +280,7 @@
STR_OSNAME_MORPHOS :MorphOS
STR_OSNAME_AMIGAOS :AmigaOS
STR_OSNAME_OS2 :OS/2
+STR_OSNAME_SUNOS :SunOS
STR_013B_OWNED_BY :{WHITE}...propietat de {STRING}
STR_013C_CARGO :{BLACK}Càrrega
@@ -2633,6 +2634,10 @@
STR_TRAIN_NO_POWER :{RED}Sense energia
STR_TRAIN_START_NO_CATENARY :Aquesta via no té catenària, el tren no pot arrencar
+STR_NEW_VEHICLE_NOW_AVAILABLE :{BLACK}{BIGFONT}Nou {STRING} disponible!
+STR_NEW_VEHICLE_TYPE :{BLACK}{BIGFONT}{STRING}
+STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}Nou {STRING} disponible! - {STRING}
+
##id 0x9000
STR_9000_ROAD_VEHICLE_IN_THE_WAY :{WHITE}Automòbil en camí
STR_9001_ROAD_VEHICLES :{WHITE}{COMPANY} - {COMMA} Vehicles Rodats
@@ -2903,6 +2908,7 @@
STR_NEWGRF_ERROR_INVALID_PARAMETER :Paràmetre invàlid per {STRING}: paràmetre {STRING} ({NUM})
STR_NEWGRF_ERROR_LOAD_BEFORE :{STRING} ha de ser carregat abans de {STRING}.
STR_NEWGRF_ERROR_LOAD_AFTER :{STRING} ha de ser carregat després de {STRING}.
+STR_NEWGRF_ERROR_AFTER_TRANSLATED_FILE :l'arxiu GRF dissenyat està pendent de traduir
STR_NEWGRF_ADD :{BLACK}Afegeix
STR_NEWGRF_ADD_TIP :{BLACK}Afegeix un arxiu NewGRF a la llista
@@ -3135,3 +3141,5 @@
STR_DATE_LONG :{STRING} {STRING} {NUM}
########
+
+STR_FEEDER_CARGO_VALUE :{BLACK}Transferir Crèdits: {LTBLUE}{CURRENCY}
--- a/src/lang/czech.txt Sat Mar 10 11:07:13 2007 +0000
+++ b/src/lang/czech.txt Sun Mar 11 16:31:18 2007 +0000
@@ -338,6 +338,7 @@
STR_OSNAME_MORPHOS :MorphOS
STR_OSNAME_AMIGAOS :AmigaOS
STR_OSNAME_OS2 :OS/2
+STR_OSNAME_SUNOS :SunOS
STR_013B_OWNED_BY :{WHITE}... vlastněno {STRING}
STR_013C_CARGO :{BLACK}Náklad
@@ -443,13 +444,13 @@
STR_SORT_BY_FACILITY :druhu stanice
STR_SORT_BY_WAITING :množství čekajícího nákladu
STR_SORT_BY_RATING_MAX :hodnocení přepravy
-STR_ENGINE_SORT_ENGINE_ID :ID lokomotivy (klasické pořadí)
-STR_ENGINE_SORT_COST :Cena
-STR_ENGINE_SORT_POWER :Výkon
-STR_ENGINE_SORT_INTRO_DATE :Datum uvedení na trh
-STR_ENGINE_SORT_RUNNING_COST :Provozní náklady
-STR_ENGINE_SORT_POWER_VS_RUNNING_COST :Výkon/Provozní náklady
-STR_ENGINE_SORT_CARGO_CAPACITY :Přepravní kapacita
+STR_ENGINE_SORT_ENGINE_ID :ID vozu (klasické pořadí)
+STR_ENGINE_SORT_COST :ceny
+STR_ENGINE_SORT_POWER :výkonu
+STR_ENGINE_SORT_INTRO_DATE :data uvedení na trh
+STR_ENGINE_SORT_RUNNING_COST :provozních nákladů
+STR_ENGINE_SORT_POWER_VS_RUNNING_COST :výkon/provozních nákladů
+STR_ENGINE_SORT_CARGO_CAPACITY :přepravní kapacity
STR_NO_WAITING_CARGO :{BLACK}Nečeká žádná komodita jakéhokoli druhu
STR_SELECT_ALL_FACILITIES :{BLACK}Označit všechny druhy stanic
STR_SELECT_ALL_TYPES :{BLACK}Označit všechny druhy komodit (včetne žádného čekajícího nákladu)
@@ -1696,7 +1697,7 @@
STR_202D_UNTIL :{YELLOW}, do {DATE_SHORT})
STR_202E_OFFER_OF_SUBSIDY_EXPIRED :{BLACK}{BIGFONT}Nabídka dotace přepravy vypršela:{}{}Dotace dopravy {STRING.gen} z{NBSP}{STRING} do {STRING} nebude dále nabízena.
STR_202F_SUBSIDY_WITHDRAWN_SERVICE :{BLACK}{BIGFONT}Ukončení dotování dopravy:{}{}Dotace pro {STRING} z{NBSP}{STATION} do {STATION} již nebude dále poskytována.
-STR_2030_SERVICE_SUBSIDY_OFFERED :{BLACK}{BIGFONT}Nabídka dotace:{}{}Doprava {STRING} z{NBSP}{STRING} do {STRING} bude jeden rok dotována místní správou!
+STR_2030_SERVICE_SUBSIDY_OFFERED :{BLACK}{BIGFONT}Nabídka dotace:{}{}Doprava {STRING.gen} z{NBSP}{STRING} do {STRING} bude jeden rok dotována místní správou!
STR_2031_SERVICE_SUBSIDY_AWARDED :{BLACK}{BIGFONT}Dotace přidělena společnosti {COMPANY}.{}{}Doprava {STRING.gen} z {STATION} do {STATION} bude po jeden rok vynášet 150 % normální ceny.
STR_2032_SERVICE_SUBSIDY_AWARDED :{BLACK}{BIGFONT}Dotace přidělena společnosti {COMPANY}.{}{}Doprava {STRING.gen} z {STATION} do {STATION} bude po jeden rok vynášet dvojnásobek normální ceny!
STR_2033_SERVICE_SUBSIDY_AWARDED :{BLACK}{BIGFONT}Dotace přidělena společnosti {COMPANY}.{}{}Doprava {STRING.gen} z {STATION} do {STATION} bude po jeden rok vynášet trojnásobek normální ceny!
@@ -2307,60 +2308,60 @@
STR_8018_SH_40_ELECTRIC :SH '40' (elektrická)
STR_8019_T_I_M_ELECTRIC :'T.I.M.' (elektrická)
STR_801A_ASIASTAR_ELECTRIC :'AsiaStar' (elektrická)
-STR_801B_PASSENGER_CAR :Osobní vagon pro cestující
+STR_801B_PASSENGER_CAR :Osobní vagon
STR_801C_MAIL_VAN :Poštovní vagon
STR_801D_COAL_CAR :Vagon na uhlí
STR_801E_OIL_TANKER :Cisternový vagon na ropu
-STR_801F_LIVESTOCK_VAN :Vagon pro dobytek
-STR_8020_GOODS_VAN :Vagon na zboží
-STR_8021_GRAIN_HOPPER :Vagon na zrní
+STR_801F_LIVESTOCK_VAN :Krytý vůz na dobytek
+STR_8020_GOODS_VAN :Krytý vůz na zboží
+STR_8021_GRAIN_HOPPER :Násypný vůz na zrní
STR_8022_WOOD_TRUCK :Vagon na dřevo
-STR_8023_IRON_ORE_HOPPER :Vagon na železnou rudu
+STR_8023_IRON_ORE_HOPPER :Násypný vůz na železnou rudu
STR_8024_STEEL_TRUCK :Vagon na ocel
-STR_8025_ARMORED_VAN :Vagon na ceniny
-STR_8026_FOOD_VAN :Vagon na jídlo
+STR_8025_ARMORED_VAN :Krytý vůz na ceniny
+STR_8026_FOOD_VAN :Krytý vůz na jídlo
STR_8027_PAPER_TRUCK :Vagon na papír
-STR_8028_COPPER_ORE_HOPPER :Vagon na měděnou rudu
+STR_8028_COPPER_ORE_HOPPER :Násypný vůz na měděnou rudu
STR_8029_WATER_TANKER :Cisternový vagon na vodu
STR_802A_FRUIT_TRUCK :Vagon na ovoce
STR_802B_RUBBER_TRUCK :Vagon na kaučuk
STR_802C_SUGAR_TRUCK :Vagon na cukr
-STR_802D_COTTON_CANDY_HOPPER :Vagon na cukrovou vatu
-STR_802E_TOFFEE_HOPPER :Vagon na karamel
-STR_802F_BUBBLE_VAN :Vagon na bubliny
+STR_802D_COTTON_CANDY_HOPPER :Násypný vůz na cukrovou vatu
+STR_802E_TOFFEE_HOPPER :Násypný vůz na karamel
+STR_802F_BUBBLE_VAN :Krytý vůz na bubliny
STR_8030_COLA_TANKER :Cisternový vagon na kolu
-STR_8031_CANDY_VAN :Vagon na bonbony
-STR_8032_TOY_VAN :Vagon na hračky
+STR_8031_CANDY_VAN :Krytý vůz na bonbony
+STR_8032_TOY_VAN :Krytý vůz na hračky
STR_8033_BATTERY_TRUCK :Vagon na baterie
STR_8034_FIZZY_DRINK_TRUCK :Vagon na limonády
STR_8035_PLASTIC_TRUCK :Vagon na plast
STR_8036_X2001_ELECTRIC :'X2001' (elektrická)
STR_8037_MILLENNIUM_Z1_ELECTRIC :'Millennium Z1' (elektrická)
STR_8038_WIZZOWOW_Z99 :Wizzowow Z99
-STR_8039_PASSENGER_CAR :Osobní vagon pro cestující
+STR_8039_PASSENGER_CAR :Osobní vagon
STR_803A_MAIL_VAN :Poštovní vagon
STR_803B_COAL_CAR :Vagon na uhlí
STR_803C_OIL_TANKER :Cisternový vagon na ropu
-STR_803D_LIVESTOCK_VAN :Vagon pro dobytek
-STR_803E_GOODS_VAN :Vagon na zboží
-STR_803F_GRAIN_HOPPER :Vagon na zrní
+STR_803D_LIVESTOCK_VAN :Krytý vůz na dobytek
+STR_803E_GOODS_VAN :Krytý vůz na zboží
+STR_803F_GRAIN_HOPPER :Násypný vůz na zrní
STR_8040_WOOD_TRUCK :Vagon na dřevo
-STR_8041_IRON_ORE_HOPPER :Vagon na železnou rudu
+STR_8041_IRON_ORE_HOPPER :Násypný vůz na železnou rudu
STR_8042_STEEL_TRUCK :Vagon na ocel
-STR_8043_ARMORED_VAN :Vagon na ceniny
-STR_8044_FOOD_VAN :Vagon na jídlo
+STR_8043_ARMORED_VAN :Krytý vůz na ceniny
+STR_8044_FOOD_VAN :Krytý vůz na jídlo
STR_8045_PAPER_TRUCK :Vagon na papír
-STR_8046_COPPER_ORE_HOPPER :Vagon na měděnou rudu
+STR_8046_COPPER_ORE_HOPPER :Násypný vůz na měděnou rudu
STR_8047_WATER_TANKER :Cisternový vagon na vodu
STR_8048_FRUIT_TRUCK :Vagon na ovoce
STR_8049_RUBBER_TRUCK :Vagon na kaučuk
STR_804A_SUGAR_TRUCK :Vagon na cukr
-STR_804B_COTTON_CANDY_HOPPER :Vagon na cukrovou vatu
-STR_804C_TOFFEE_HOPPER :Vagon na karamel
-STR_804D_BUBBLE_VAN :Vagon na bubliny
+STR_804B_COTTON_CANDY_HOPPER :Násypný vůz na cukrovou vatu
+STR_804C_TOFFEE_HOPPER :Násypný vůz na karamel
+STR_804D_BUBBLE_VAN :Krytý vůz na bubliny
STR_804E_COLA_TANKER :Cisternový vagon na kolu
-STR_804F_CANDY_VAN :Vagon na bonbony
-STR_8050_TOY_VAN :Vagon na hračky
+STR_804F_CANDY_VAN :Krytý vůz na bonbony
+STR_8050_TOY_VAN :Krytý vůz na hračky
STR_8051_BATTERY_TRUCK :Vagon na baterie
STR_8052_FIZZY_DRINK_TRUCK :Vagon na limonády
STR_8053_PLASTIC_TRUCK :Vagon na plast
@@ -2369,132 +2370,132 @@
STR_8056_LEV3_PEGASUS_ELECTRIC :Lev3 'Pegasus' (elektrická)
STR_8057_LEV4_CHIMAERA_ELECTRIC :Lev4 'Chimaera' (elektrická)
STR_8058_WIZZOWOW_ROCKETEER :Wizzowow Rocketeer
-STR_8059_PASSENGER_CAR :Osobní vagon pro cestující
+STR_8059_PASSENGER_CAR :Osobní vagon
STR_805A_MAIL_VAN :Poštovní vagon
STR_805B_COAL_CAR :Vagon na uhlí
STR_805C_OIL_TANKER :Cisternový vagon na ropu
-STR_805D_LIVESTOCK_VAN :Vagon pro dobytek
-STR_805E_GOODS_VAN :Vagon na zboží
-STR_805F_GRAIN_HOPPER :Vagon na zrní
+STR_805D_LIVESTOCK_VAN :Krytý vůz na dobytek
+STR_805E_GOODS_VAN :Krytý vůz na zboží
+STR_805F_GRAIN_HOPPER :Násypný vůz na zrní
STR_8060_WOOD_TRUCK :Vagon na dřevo
-STR_8061_IRON_ORE_HOPPER :Vagon na železnou rudu
+STR_8061_IRON_ORE_HOPPER :Násypný vůz na železnou rudu
STR_8062_STEEL_TRUCK :Vagon na ocel
-STR_8063_ARMORED_VAN :Vagon na ceniny
-STR_8064_FOOD_VAN :Vagon na jídlo
+STR_8063_ARMORED_VAN :Krytý vůz na ceniny
+STR_8064_FOOD_VAN :Krytý vůz na jídlo
STR_8065_PAPER_TRUCK :Vagon na papír
-STR_8066_COPPER_ORE_HOPPER :Vagon na měděnou rudu
+STR_8066_COPPER_ORE_HOPPER :Násypný vůz na měděnou rudu
STR_8067_WATER_TANKER :Cisternový vagon na vodu
STR_8068_FRUIT_TRUCK :Vagon na ovoce
STR_8069_RUBBER_TRUCK :Vagon na kaučuk
STR_806A_SUGAR_TRUCK :Vagon na cukr
-STR_806B_COTTON_CANDY_HOPPER :Vagon na cukrovou vatu
-STR_806C_TOFFEE_HOPPER :Vagon na karamel
-STR_806D_BUBBLE_VAN :Vagon na bubliny
+STR_806B_COTTON_CANDY_HOPPER :Násypný vůz na cukrovou vatu
+STR_806C_TOFFEE_HOPPER :Násypný vůz na karamel
+STR_806D_BUBBLE_VAN :Krytý vůz na bubliny
STR_806E_COLA_TANKER :Cisternový vagon na kolu
-STR_806F_CANDY_VAN :Vagon na bonbony
-STR_8070_TOY_VAN :Vagon na hračky
+STR_806F_CANDY_VAN :Krytý vůz na bonbony
+STR_8070_TOY_VAN :Krytý vůz na hračky
STR_8071_BATTERY_TRUCK :Vagon na baterie
STR_8072_FIZZY_DRINK_TRUCK :Vagon na limonády
STR_8073_PLASTIC_TRUCK :Vagon na plast
-STR_8074_MPS_REGAL_BUS :MPS Regal Bus
-STR_8075_HEREFORD_LEOPARD_BUS :Hereford Leopard Bus
-STR_8076_FOSTER_BUS :Foster Bus
-STR_8077_FOSTER_MKII_SUPERBUS :Foster MkII Superbus
-STR_8078_PLODDYPHUT_MKI_BUS :Ploddyphut MkI Bus
-STR_8079_PLODDYPHUT_MKII_BUS :Ploddyphut MkII Bus
-STR_807A_PLODDYPHUT_MKIII_BUS :Ploddyphut MkIII Bus
-STR_807B_BALOGH_COAL_TRUCK :Balogh vůz na uhlí
-STR_807C_UHL_COAL_TRUCK :Uhl vůz na uhlí
-STR_807D_DW_COAL_TRUCK :DW vůz na uhlí
-STR_807E_MPS_MAIL_TRUCK :MPS poštovní vůz
-STR_807F_REYNARD_MAIL_TRUCK :Reynard poštovní vůz
-STR_8080_PERRY_MAIL_TRUCK :Perry poštovní vůz
-STR_8081_MIGHTYMOVER_MAIL_TRUCK :MightyMover poštovní vůz
-STR_8082_POWERNAUGHT_MAIL_TRUCK :Powernaught poštovní vůz
-STR_8083_WIZZOWOW_MAIL_TRUCK :Wizzowow poštovní vůz
-STR_8084_WITCOMBE_OIL_TANKER :Witcombe cisterna na ropu
-STR_8085_FOSTER_OIL_TANKER :Foster cisterna na ropu
-STR_8086_PERRY_OIL_TANKER :Perry cisterna na ropu
-STR_8087_TALBOTT_LIVESTOCK_VAN :Talbott vůz na dobytek
-STR_8088_UHL_LIVESTOCK_VAN :Uhl vůz na dobytek
-STR_8089_FOSTER_LIVESTOCK_VAN :Foster vůz na dobytek
-STR_808A_BALOGH_GOODS_TRUCK :Balogh vůz na zboží
-STR_808B_CRAIGHEAD_GOODS_TRUCK :Craighead vůz na zboží
-STR_808C_GOSS_GOODS_TRUCK :Goss vůz na zboží
-STR_808D_HEREFORD_GRAIN_TRUCK :Hereford vůz na zrní
-STR_808E_THOMAS_GRAIN_TRUCK :Thomas vůz na zrní
-STR_808F_GOSS_GRAIN_TRUCK :Goss vůz na zrní
-STR_8090_WITCOMBE_WOOD_TRUCK :Witcombe vůz na dřevo
-STR_8091_FOSTER_WOOD_TRUCK :Foster vůz na dřevo
-STR_8092_MORELAND_WOOD_TRUCK :Moreland vůz na dřevo
-STR_8093_MPS_IRON_ORE_TRUCK :MPS vůz na železnou rudu
-STR_8094_UHL_IRON_ORE_TRUCK :Uhl vůz na železnou rudu
-STR_8095_CHIPPY_IRON_ORE_TRUCK :Chippy vůz na železnou rudu
-STR_8096_BALOGH_STEEL_TRUCK :Balogh vůz na ocel
-STR_8097_UHL_STEEL_TRUCK :Uhl vůz na ocel
-STR_8098_KELLING_STEEL_TRUCK :Kelling vůz na ocel
-STR_8099_BALOGH_ARMORED_TRUCK :Balogh obrněný vůz
-STR_809A_UHL_ARMORED_TRUCK :Uhl obrněný vůz
-STR_809B_FOSTER_ARMORED_TRUCK :Foster obrněný vůz
-STR_809C_FOSTER_FOOD_VAN :Foster vůz na jídlo
-STR_809D_PERRY_FOOD_VAN :Perry vůz na jídlo
-STR_809E_CHIPPY_FOOD_VAN :Chippy vůz na jídlo
-STR_809F_UHL_PAPER_TRUCK :Uhl vůz na papír
-STR_80A0_BALOGH_PAPER_TRUCK :Balogh vůz na papír
-STR_80A1_MPS_PAPER_TRUCK :MPS vůz na papír
-STR_80A2_MPS_COPPER_ORE_TRUCK :MPS vůz na měděnou rudu
-STR_80A3_UHL_COPPER_ORE_TRUCK :Uhl vůz na měděnou rudu
-STR_80A4_GOSS_COPPER_ORE_TRUCK :Goss vůz na měděnou rudu
-STR_80A5_UHL_WATER_TANKER :Uhl cisterna na vodu
-STR_80A6_BALOGH_WATER_TANKER :Balogh cisterna na vodu
-STR_80A7_MPS_WATER_TANKER :MPS cisterna na vodu
-STR_80A8_BALOGH_FRUIT_TRUCK :Balogh vůz na ovoce
-STR_80A9_UHL_FRUIT_TRUCK :Uhl vůz na ovoce
-STR_80AA_KELLING_FRUIT_TRUCK :Kelling vůz na ovoce
-STR_80AB_BALOGH_RUBBER_TRUCK :Balogh vůz na kaučuk
-STR_80AC_UHL_RUBBER_TRUCK :Uhl vůz na kaučuk
-STR_80AD_RMT_RUBBER_TRUCK :RMT vůz na kaučuk
-STR_80AE_MIGHTYMOVER_SUGAR_TRUCK :MightyMover vůz na cukr
-STR_80AF_POWERNAUGHT_SUGAR_TRUCK :Powernaught vůz na cukr
-STR_80B0_WIZZOWOW_SUGAR_TRUCK :Wizzowow vůz na cukr
-STR_80B1_MIGHTYMOVER_COLA_TRUCK :MightyMover cisterna na kolu
-STR_80B2_POWERNAUGHT_COLA_TRUCK :Powernaught cisterna na kolu
-STR_80B3_WIZZOWOW_COLA_TRUCK :Wizzowow cisterna na kolu
-STR_80B4_MIGHTYMOVER_COTTON_CANDY :MightyMover vůz na cukrovou vatu
-STR_80B5_POWERNAUGHT_COTTON_CANDY :Powernaught vůz na cukrovou vatu
-STR_80B6_WIZZOWOW_COTTON_CANDY_TRUCK :Wizzowow vůz na cukrovou vatu
-STR_80B7_MIGHTYMOVER_TOFFEE_TRUCK :MightyMover vůz na karamel
-STR_80B8_POWERNAUGHT_TOFFEE_TRUCK :Powernaught vůz na karamel
-STR_80B9_WIZZOWOW_TOFFEE_TRUCK :Wizzowow vůz na karamel
-STR_80BA_MIGHTYMOVER_TOY_VAN :MightyMover vůz na hračky
-STR_80BB_POWERNAUGHT_TOY_VAN :Powernaught vůz na hračky
-STR_80BC_WIZZOWOW_TOY_VAN :Wizzowow vůz na hračky
-STR_80BD_MIGHTYMOVER_CANDY_TRUCK :MightyMover vůz na bonbony
-STR_80BE_POWERNAUGHT_CANDY_TRUCK :Powernaught vůz na bonbony
-STR_80BF_WIZZOWOW_CANDY_TRUCK :Wizzowow vůz na bonbony
-STR_80C0_MIGHTYMOVER_BATTERY_TRUCK :MightyMover vůz na baterie
-STR_80C1_POWERNAUGHT_BATTERY_TRUCK :Powernaught vůz na baterie
-STR_80C2_WIZZOWOW_BATTERY_TRUCK :Wizzowow vůz na baterie
-STR_80C3_MIGHTYMOVER_FIZZY_DRINK :MightyMover vůz na limonády
-STR_80C4_POWERNAUGHT_FIZZY_DRINK :Powernaught vůz na limonády
-STR_80C5_WIZZOWOW_FIZZY_DRINK_TRUCK :Wizzowow vůz na limonády
-STR_80C6_MIGHTYMOVER_PLASTIC_TRUCK :MightyMover vůz na plast
-STR_80C7_POWERNAUGHT_PLASTIC_TRUCK :Powernaught vůz na plast
-STR_80C8_WIZZOWOW_PLASTIC_TRUCK :Wizzowow vůz na plast
-STR_80C9_MIGHTYMOVER_BUBBLE_TRUCK :MightyMover vůz na bubliny
-STR_80CA_POWERNAUGHT_BUBBLE_TRUCK :Powernaught vůz na bubliny
-STR_80CB_WIZZOWOW_BUBBLE_TRUCK :Wizzowow vůz na bubliny
-STR_80CC_MPS_OIL_TANKER :MPS ropný tanker
-STR_80CD_CS_INC_OIL_TANKER :CS-Inc. ropný tanker
-STR_80CE_MPS_PASSENGER_FERRY :MPS trajekt pro cestující
-STR_80CF_FFP_PASSENGER_FERRY :FFP trajekt pro cestující
-STR_80D0_BAKEWELL_300_HOVERCRAFT :Bakewell 300 vznášedlo
-STR_80D1_CHUGGER_CHUG_PASSENGER :Chugger-Chug trajekt pro cestující
-STR_80D2_SHIVERSHAKE_PASSENGER_FERRY :Shivershake trajekt pro cestující
-STR_80D3_YATE_CARGO_SHIP :Yate nákladní loď
-STR_80D4_BAKEWELL_CARGO_SHIP :Bakewell nákladní loď
-STR_80D5_MIGHTYMOVER_CARGO_SHIP :Mightymover nákladní loď
-STR_80D6_POWERNAUT_CARGO_SHIP :Powernaut nákladní loď
+STR_8074_MPS_REGAL_BUS :Autobus MPS Regal
+STR_8075_HEREFORD_LEOPARD_BUS :Autobus Hereford Leopard
+STR_8076_FOSTER_BUS :Autobus Foster
+STR_8077_FOSTER_MKII_SUPERBUS :Autobus Foster MkII Superbus
+STR_8078_PLODDYPHUT_MKI_BUS :Autobus Ploddyphut MkI
+STR_8079_PLODDYPHUT_MKII_BUS :Autobus Ploddyphut MkII
+STR_807A_PLODDYPHUT_MKIII_BUS :Autobus Ploddyphut MkIII
+STR_807B_BALOGH_COAL_TRUCK :Vůz na uhlí Balogh
+STR_807C_UHL_COAL_TRUCK :Vůz na uhlí Uhl
+STR_807D_DW_COAL_TRUCK :Vůz na uhlí DW
+STR_807E_MPS_MAIL_TRUCK :Poštovní vůz MPS
+STR_807F_REYNARD_MAIL_TRUCK :Poštovní vůz Reynard
+STR_8080_PERRY_MAIL_TRUCK :Poštovní vůz Perry
+STR_8081_MIGHTYMOVER_MAIL_TRUCK :Poštovní vůz MightyMover
+STR_8082_POWERNAUGHT_MAIL_TRUCK :Poštovní vůz Powernaught
+STR_8083_WIZZOWOW_MAIL_TRUCK :Poštovní vůz Wizzowow
+STR_8084_WITCOMBE_OIL_TANKER :Cisterna na ropu Witcombe
+STR_8085_FOSTER_OIL_TANKER :Cisterna na ropu Foster
+STR_8086_PERRY_OIL_TANKER :Cisterna na ropu Perry
+STR_8087_TALBOTT_LIVESTOCK_VAN :Vůz na dobytek Talbott
+STR_8088_UHL_LIVESTOCK_VAN :Vůz na dobytek Uhl
+STR_8089_FOSTER_LIVESTOCK_VAN :Vůz na dobytek Foster
+STR_808A_BALOGH_GOODS_TRUCK :Vůz na zboží Balogh
+STR_808B_CRAIGHEAD_GOODS_TRUCK :Vůz na zboží Craighead
+STR_808C_GOSS_GOODS_TRUCK :Vůz na zboží Goss
+STR_808D_HEREFORD_GRAIN_TRUCK :Vůz na zrní Hereford
+STR_808E_THOMAS_GRAIN_TRUCK :Vůz na zrní Thomas
+STR_808F_GOSS_GRAIN_TRUCK :Vůz na zrní Goss
+STR_8090_WITCOMBE_WOOD_TRUCK :Vůz na dřevo Witcombe
+STR_8091_FOSTER_WOOD_TRUCK :Vůz na dřevo Foster
+STR_8092_MORELAND_WOOD_TRUCK :Vůz na dřevo Moreland
+STR_8093_MPS_IRON_ORE_TRUCK :Vůz na železnou rudu MPS
+STR_8094_UHL_IRON_ORE_TRUCK :Vůz na železnou rudu Uhl
+STR_8095_CHIPPY_IRON_ORE_TRUCK :Vůz na železnou rudu Chippy
+STR_8096_BALOGH_STEEL_TRUCK :Vůz na ocel Balogh
+STR_8097_UHL_STEEL_TRUCK :Vůz na ocel Uhl
+STR_8098_KELLING_STEEL_TRUCK :Vůz na ocel Kelling
+STR_8099_BALOGH_ARMORED_TRUCK :Obrněný vůz Balogh
+STR_809A_UHL_ARMORED_TRUCK :Obrněný vůz Uhl
+STR_809B_FOSTER_ARMORED_TRUCK :Obrněný vůz Foster
+STR_809C_FOSTER_FOOD_VAN :Vůz na jídlo Foster
+STR_809D_PERRY_FOOD_VAN :Vůz na jídlo Perry
+STR_809E_CHIPPY_FOOD_VAN :Vůz na jídlo Chippy
+STR_809F_UHL_PAPER_TRUCK :Vůz na papír Uhl
+STR_80A0_BALOGH_PAPER_TRUCK :Vůz na papír Balogh
+STR_80A1_MPS_PAPER_TRUCK :Vůz na papír MPS
+STR_80A2_MPS_COPPER_ORE_TRUCK :Vůz na měděnou rudu MPS
+STR_80A3_UHL_COPPER_ORE_TRUCK :Vůz na měděnou rudu Uhl
+STR_80A4_GOSS_COPPER_ORE_TRUCK :Vůz na měděnou rudu Goss
+STR_80A5_UHL_WATER_TANKER :Cisterna na vodu Uhl
+STR_80A6_BALOGH_WATER_TANKER :Cisterna na vodu Balogh
+STR_80A7_MPS_WATER_TANKER :Cisterna na vodu MPS
+STR_80A8_BALOGH_FRUIT_TRUCK :Vůz na ovoce Balogh
+STR_80A9_UHL_FRUIT_TRUCK :Vůz na ovoce Uhl
+STR_80AA_KELLING_FRUIT_TRUCK :Vůz na ovoce Kelling
+STR_80AB_BALOGH_RUBBER_TRUCK :Vůz na kaučuk Balogh
+STR_80AC_UHL_RUBBER_TRUCK :Vůz na kaučuk Uhl
+STR_80AD_RMT_RUBBER_TRUCK :Vůz na kaučuk RMT
+STR_80AE_MIGHTYMOVER_SUGAR_TRUCK :Vůz na cukr MightyMover
+STR_80AF_POWERNAUGHT_SUGAR_TRUCK :Vůz na cukr Powernaught
+STR_80B0_WIZZOWOW_SUGAR_TRUCK :Vůz na cukr Wizzowow
+STR_80B1_MIGHTYMOVER_COLA_TRUCK :Cisterna na kolu MightyMover
+STR_80B2_POWERNAUGHT_COLA_TRUCK :Cisterna na kolu Powernaught
+STR_80B3_WIZZOWOW_COLA_TRUCK :Cisterna na kolu Wizzowow
+STR_80B4_MIGHTYMOVER_COTTON_CANDY :Vůz na cukrovou vatu MightyMover
+STR_80B5_POWERNAUGHT_COTTON_CANDY :Vůz na cukrovou vatu Powernaught
+STR_80B6_WIZZOWOW_COTTON_CANDY_TRUCK :Vůz na cukrovou vatu Wizzowow
+STR_80B7_MIGHTYMOVER_TOFFEE_TRUCK :Vůz na karamel MightyMover
+STR_80B8_POWERNAUGHT_TOFFEE_TRUCK :Vůz na karamel Powernaught
+STR_80B9_WIZZOWOW_TOFFEE_TRUCK :Vůz na karamel Wizzowow
+STR_80BA_MIGHTYMOVER_TOY_VAN :Vůz na hračky MightyMover
+STR_80BB_POWERNAUGHT_TOY_VAN :Vůz na hračky Powernaught
+STR_80BC_WIZZOWOW_TOY_VAN :Vůz na hračky Wizzowow
+STR_80BD_MIGHTYMOVER_CANDY_TRUCK :Vůz na bonbony MightyMover
+STR_80BE_POWERNAUGHT_CANDY_TRUCK :Vůz na bonbony Powernaught
+STR_80BF_WIZZOWOW_CANDY_TRUCK :Vůz na bonbony Wizzowow
+STR_80C0_MIGHTYMOVER_BATTERY_TRUCK :Vůz na baterie MightyMover
+STR_80C1_POWERNAUGHT_BATTERY_TRUCK :Vůz na baterie Powernaught
+STR_80C2_WIZZOWOW_BATTERY_TRUCK :Vůz na baterie Wizzowow
+STR_80C3_MIGHTYMOVER_FIZZY_DRINK :Vůz na limonády MightyMover
+STR_80C4_POWERNAUGHT_FIZZY_DRINK :Vůz na limonády Powernaught
+STR_80C5_WIZZOWOW_FIZZY_DRINK_TRUCK :Vůz na limonády Wizzowow
+STR_80C6_MIGHTYMOVER_PLASTIC_TRUCK :Vůz na plast MightyMover
+STR_80C7_POWERNAUGHT_PLASTIC_TRUCK :Vůz na plast Powernaught
+STR_80C8_WIZZOWOW_PLASTIC_TRUCK :Vůz na plast Wizzowow
+STR_80C9_MIGHTYMOVER_BUBBLE_TRUCK :Vůz na bubliny MightyMover
+STR_80CA_POWERNAUGHT_BUBBLE_TRUCK :Vůz na bubliny Powernaught
+STR_80CB_WIZZOWOW_BUBBLE_TRUCK :Vůz na bubliny Wizzowow
+STR_80CC_MPS_OIL_TANKER :Ropný tanker MPS
+STR_80CD_CS_INC_OIL_TANKER :Ropný tanker CS-Inc.
+STR_80CE_MPS_PASSENGER_FERRY :Trajekt pro cestující MPS
+STR_80CF_FFP_PASSENGER_FERRY :Trajekt pro cestující FFP
+STR_80D0_BAKEWELL_300_HOVERCRAFT :Vznášedlo Bakewell 300
+STR_80D1_CHUGGER_CHUG_PASSENGER :Trajekt pro cestující Chugger-Chug
+STR_80D2_SHIVERSHAKE_PASSENGER_FERRY :Trajekt pro cestující Shivershake
+STR_80D3_YATE_CARGO_SHIP :Nákladní loď Yate
+STR_80D4_BAKEWELL_CARGO_SHIP :Nákladní loď Bakewell
+STR_80D5_MIGHTYMOVER_CARGO_SHIP :Nákladní loď Mightymover
+STR_80D6_POWERNAUT_CARGO_SHIP :Nákladní loď Powernaut
STR_80D7_SAMPSON_U52 :Sampson U52
STR_80D8_COLEMAN_COUNT :Coleman Count
STR_80D9_FFP_DART :FFP Dart
@@ -2533,23 +2534,20 @@
STR_80FA_FLASHBANG_X1 :Flashbang X1
STR_80FB_JUGGERPLANE_M1 :Juggerplane M1
STR_80FC_FLASHBANG_WIZZER :Flashbang Wizzer
-STR_80FD_TRICARIO_HELICOPTER :Vrtulník Tricairo
+STR_80FD_TRICARIO_HELICOPTER :Vrtulník Tricario
STR_80FE_GURU_X2_HELICOPTER :Vrtulník Guru X2
STR_80FF_POWERNAUT_HELICOPTER :Vrtulník Powernaut
STR_8100_MESSAGE_FROM_VEHICLE_MANUFACTURE :{WHITE}Zpráva od výrobce dopravních prostředků
-STR_8101_WE_HAVE_JUST_DESIGNED_A :{GOLD}Právě jsme vyvinuli nov{G ý ou é} {STRING.acc}. Měl byste zájem o roční výhradní právo na používání tohoto prostředku, aby byl otestován před uvedením na trh?
+STR_8101_WE_HAVE_JUST_DESIGNED_A :{GOLD}Právě jsme vyvinuli nov{G ou ý é} {STRING.acc}. Měl byste zájem o roční výhradní právo na používání tohoto prostředku, aby byl otestován před uvedením na trh?
STR_8102_RAILROAD_LOCOMOTIVE :{G=f}lokomotiva
STR_8102_RAILROAD_LOCOMOTIVE.acc :{G=f}lokomotivu
-STR_8102_RAILROAD_LOCOMOTIVE.dat :{G=f}lokomotivu
STR_8103_ROAD_VEHICLE :{G=n}silniční vozidlo
STR_8104_AIRCRAFT :{G=n}letadlo
STR_8105_SHIP :{G=f}loď
STR_8106_MONORAIL_LOCOMOTIVE :{G=f}lokomotiva pro monorail
STR_8106_MONORAIL_LOCOMOTIVE.acc :{G=f}lokomotivu pro monorail
-STR_8106_MONORAIL_LOCOMOTIVE.dat :{G=f}lokomotivu pro monorail
STR_8107_MAGLEV_LOCOMOTIVE :{G=f}lokomotiva Maglev
STR_8107_MAGLEV_LOCOMOTIVE.acc :{G=f}lokomotivu Maglev
-STR_8107_MAGLEV_LOCOMOTIVE.dat :{G=f}lokomotivu Maglev
##id 0x8800
STR_8800_TRAIN_DEPOT :{WHITE}Železniční depo {TOWN}
@@ -2697,6 +2695,10 @@
STR_TRAIN_NO_POWER :{RED}Bez proudu
STR_TRAIN_START_NO_CATENARY :Tato trať není elektrifikována, vlak nemůže odjet
+STR_NEW_VEHICLE_NOW_AVAILABLE :{BLACK}{BIGFONT}Nov{G á ý é} {STRING} k dispozici!
+STR_NEW_VEHICLE_TYPE :{BLACK}{BIGFONT}{STRING}
+STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}Nov{G á ý é} {STRING} k dispozici! - {STRING}
+
##id 0x9000
STR_9000_ROAD_VEHICLE_IN_THE_WAY :{WHITE}Silniční vozidlo v cestě
STR_9001_ROAD_VEHICLES :{WHITE}{COMPANY} - {COMMA} silniční{P "" "" ch} vozid{P lo la el}
@@ -2967,6 +2969,7 @@
STR_NEWGRF_ERROR_INVALID_PARAMETER :Neplatný parametr pro {STRING}: parametr {STRING} ({NUM})
STR_NEWGRF_ERROR_LOAD_BEFORE :{STRING} musí být nahráván před {STRING}.
STR_NEWGRF_ERROR_LOAD_AFTER :{STRING} musí být nahráván po {STRING}.
+STR_NEWGRF_ERROR_AFTER_TRANSLATED_FILE :GRF soubor, který se měl přeložit
STR_NEWGRF_ADD :{BLACK}Přidat
STR_NEWGRF_ADD_TIP :{BLACK}Přidat NewGRF soubor do seznamu
@@ -3199,3 +3202,5 @@
STR_DATE_LONG :{STRING} {STRING} {NUM}
########
+
+STR_FEEDER_CARGO_VALUE :{BLACK}Podíl za převoz: {LTBLUE}{CURRENCY}
--- a/src/lang/danish.txt Sat Mar 10 11:07:13 2007 +0000
+++ b/src/lang/danish.txt Sun Mar 11 16:31:18 2007 +0000
@@ -280,6 +280,7 @@
STR_OSNAME_MORPHOS :MorphOS
STR_OSNAME_AMIGAOS :AmigaOS
STR_OSNAME_OS2 :OS/2
+STR_OSNAME_SUNOS :SunOS
STR_013B_OWNED_BY :{WHITE}...ejes af {STRING}
STR_013C_CARGO :{BLACK}Last
@@ -2632,6 +2633,10 @@
STR_TRAIN_NO_POWER :{RED}Ingen strøm
STR_TRAIN_START_NO_CATENARY :Toget kan ikke køre, fordi sporet ikke har køreledninger
+STR_NEW_VEHICLE_NOW_AVAILABLE :{BLACK}{BIGFONT}Ny {STRING} er nu tilgængelig!
+STR_NEW_VEHICLE_TYPE :{BLACK}{BIGFONT}{STRING}
+STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}Ny {STRING} er nu tilgængelig! - {STRING}
+
##id 0x9000
STR_9000_ROAD_VEHICLE_IN_THE_WAY :{WHITE}Køretøj i vejen
STR_9001_ROAD_VEHICLES :{WHITE}{COMPANY} - {COMMA} Køretøj{P "" er}
@@ -2892,6 +2897,17 @@
STR_NEWGRF_MD5SUM :{BLACK}MD5sum: {SILVER}{STRING}
STR_NEWGRF_CONFIRMATION_TEXT :{YELLOW}Du er ved at ændre et igangværende spil; dette kan få OpenTTD til at gå ned.{}Er du helt sikker på at du vil fortsætte?
+STR_NEWGRF_ERROR_MSG_INFO :{SILVER}{STRING}
+STR_NEWGRF_ERROR_MSG_WARNING :{RED}Advarsel: {SILVER}{STRING}
+STR_NEWGRF_ERROR_MSG_ERROR :{RED}Fejl: {SILVER}{STRING}
+STR_NEWGRF_ERROR_MSG_FATAL :{RED}Fatalt: {SILVER}{STRING}
+STR_NEWGRF_ERROR_VERSION_NUMBER :{STRING} virker ikke med TTDPatch-versionen rapporteret af OpenTTD.
+STR_NEWGRF_ERROR_DOS_OR_WINDOWS :{STRING} er beregnet til {STRING}-versionen af TTD.
+STR_NEWGRF_ERROR_UNSET_SWITCH :{STRING} er designet til brug sammen med {STRING}
+STR_NEWGRF_ERROR_INVALID_PARAMETER :Ugyldig parameter for {STRING}: parameter {STRING} ({NUM})
+STR_NEWGRF_ERROR_LOAD_BEFORE :{STRING} skal indlæses før {STRING}.
+STR_NEWGRF_ERROR_LOAD_AFTER :{STRING} skal indlæses efter {STRING}.
+
STR_NEWGRF_ADD :{BLACK}Tilføj
STR_NEWGRF_ADD_TIP :{BLACK}Tilføj et NewGRF sæt til listen
STR_NEWGRF_REMOVE :{BLACK}Fjern
@@ -3117,4 +3133,10 @@
STR_MEASURE_LENGTH_HEIGHTDIFF :{BLACK}Længde: {NUM}{}Højdeforskel: {NUM} m
STR_MEASURE_AREA_HEIGHTDIFF :{BLACK}Areal: {NUM} x {NUM}{}Højdeforskel: {NUM} m
+############ Date formatting
+STR_DATE_TINY :{STRING}-{STRING}-{NUM}
+STR_DATE_SHORT :{STRING} {NUM}
+STR_DATE_LONG :{STRING} {STRING} {NUM}
+
########
+
--- a/src/lang/dutch.txt Sat Mar 10 11:07:13 2007 +0000
+++ b/src/lang/dutch.txt Sun Mar 11 16:31:18 2007 +0000
@@ -280,6 +280,7 @@
STR_OSNAME_MORPHOS :MorphOS
STR_OSNAME_AMIGAOS :AmigaOS
STR_OSNAME_OS2 :OS/2
+STR_OSNAME_SUNOS :SunOS
STR_013B_OWNED_BY :{WHITE}...is van {STRING}
STR_013C_CARGO :{BLACK}Lading
@@ -2633,6 +2634,10 @@
STR_TRAIN_NO_POWER :{RED}Geen stroom
STR_TRAIN_START_NO_CATENARY :Er is geen bovenleiding, de trein kan niet starten
+STR_NEW_VEHICLE_NOW_AVAILABLE :{BLACK}{BIGFONT}Nieuw {STRING} nu beschikbaar!
+STR_NEW_VEHICLE_TYPE :{BLACK}{BIGFONT}{STRING}
+STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}Nieuw {STRING} nu beschikbaar! - {STRING}
+
##id 0x9000
STR_9000_ROAD_VEHICLE_IN_THE_WAY :{WHITE}Wegvoertuig in de weg
STR_9001_ROAD_VEHICLES :{WHITE}{COMPANY} - {COMMA} Wegvoertuigen
@@ -2903,6 +2908,7 @@
STR_NEWGRF_ERROR_INVALID_PARAMETER :Ongeldide parameter voor {STRING}: parameter {STRING} ({NUM})
STR_NEWGRF_ERROR_LOAD_BEFORE :{STRING} moet geladen zijn voor {STRING}.
STR_NEWGRF_ERROR_LOAD_AFTER :{STRING} moet geladen zijn na {STRING}.
+STR_NEWGRF_ERROR_AFTER_TRANSLATED_FILE :het GRF bestand is bedoelt voor het vertalen van
STR_NEWGRF_ADD :{BLACK}Toevoegen
STR_NEWGRF_ADD_TIP :{BLACK}Voeg een NewGRF bestand toe aan te lijst
@@ -3135,3 +3141,5 @@
STR_DATE_LONG :{STRING} {STRING} {NUM}
########
+
+STR_FEEDER_CARGO_VALUE :{BLACK}Geldoverdracht: {LTBLUE}{CURRENCY}
--- a/src/lang/english.txt Sat Mar 10 11:07:13 2007 +0000
+++ b/src/lang/english.txt Sun Mar 11 16:31:18 2007 +0000
@@ -280,6 +280,7 @@
STR_OSNAME_MORPHOS :MorphOS
STR_OSNAME_AMIGAOS :AmigaOS
STR_OSNAME_OS2 :OS/2
+STR_OSNAME_SUNOS :SunOS
STR_013B_OWNED_BY :{WHITE}...owned by {STRING2}
STR_013C_CARGO :{BLACK}Cargo
@@ -590,6 +591,7 @@
STR_0207_ARRIVAL_OF_FIRST_VEHICLE :{YELLOW}Arrival of first vehicle at competitor's station
STR_0208_ACCIDENTS_DISASTERS :{YELLOW}Accidents / disasters
STR_0209_COMPANY_INFORMATION :{YELLOW}Company information
+STR_NEWS_OPEN_CLOSE :{YELLOW}Open / close of industries
STR_020A_ECONOMY_CHANGES :{YELLOW}Economy changes
STR_020B_ADVICE_INFORMATION_ON_PLAYER :{YELLOW}Advice / information on player's vehicles
STR_020C_NEW_VEHICLES :{YELLOW}New vehicles
@@ -2907,6 +2909,7 @@
STR_NEWGRF_ERROR_INVALID_PARAMETER :Invalid parameter for {STRING}: parameter {STRING} ({NUM})
STR_NEWGRF_ERROR_LOAD_BEFORE :{STRING} must be loaded before {STRING}.
STR_NEWGRF_ERROR_LOAD_AFTER :{STRING} must be loaded after {STRING}.
+STR_NEWGRF_ERROR_AFTER_TRANSLATED_FILE :the GRF file it was designed to translate
STR_NEWGRF_ADD :{BLACK}Add
STR_NEWGRF_ADD_TIP :{BLACK}Add a NewGRF file to the list
--- a/src/lang/esperanto.txt Sat Mar 10 11:07:13 2007 +0000
+++ b/src/lang/esperanto.txt Sun Mar 11 16:31:18 2007 +0000
@@ -281,6 +281,7 @@
STR_OSNAME_MORPHOS :MorphOS
STR_OSNAME_AMIGAOS :AmigaOS
STR_OSNAME_OS2 :OS/2
+STR_OSNAME_SUNOS :SunOS
STR_013B_OWNED_BY :{WHITE}...posedata de {STRING}
STR_013C_CARGO :{BLACK}Ŝarĝo
@@ -2634,6 +2635,10 @@
STR_TRAIN_NO_POWER :{RED}Senforte
STR_TRAIN_START_NO_CATENARY :Mankas ĉi-trake supera elektro, do la trajno ne povas starti
+STR_NEW_VEHICLE_NOW_AVAILABLE :{BLACK}{BIGFONT}Nova {STRING} nun haveblas!
+STR_NEW_VEHICLE_TYPE :{BLACK}{BIGFONT}{STRING}
+STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}Nova {STRING} nun haveblas! - {STRING}
+
##id 0x9000
STR_9000_ROAD_VEHICLE_IN_THE_WAY :{WHITE}Vojveturilo okupas la lokon
STR_9001_ROAD_VEHICLES :{WHITE}{COMPANY} - {COMMA} Vojveturilo{P "" j}
@@ -3136,3 +3141,5 @@
STR_DATE_LONG :{STRING} {STRING} {NUM}
########
+
+STR_FEEDER_CARGO_VALUE :{BLACK}Transigaj Kreditoj: {LTBLUE}{CURRENCY}
--- a/src/lang/finnish.txt Sat Mar 10 11:07:13 2007 +0000
+++ b/src/lang/finnish.txt Sun Mar 11 16:31:18 2007 +0000
@@ -2632,6 +2632,8 @@
STR_TRAIN_NO_POWER :{RED}Ei virtaa
STR_TRAIN_START_NO_CATENARY :Radasta puuttuu "catenary"; junaa ei voi käynnistää
+STR_NEW_VEHICLE_TYPE :{BLACK}{BIGFONT}{STRING}
+
##id 0x9000
STR_9000_ROAD_VEHICLE_IN_THE_WAY :{WHITE}Ajoneuvo tiellä.
STR_9001_ROAD_VEHICLES :{WHITE}{COMPANY} - {COMMA} ajoneuvoa
@@ -2892,6 +2894,10 @@
STR_NEWGRF_MD5SUM :{BLACK}MD5-summa: {SILVER}{STRING}
STR_NEWGRF_CONFIRMATION_TEXT :{YELLOW}Olet tekemässä muutoksia käynnissä olevaan peliin. OpenTTD voi kaatua.{}Oletko varma?
+STR_NEWGRF_ERROR_MSG_INFO :{SILVER}{STRING}
+STR_NEWGRF_ERROR_MSG_WARNING :{RED}Varoitus: {SILVER}{STRING}
+STR_NEWGRF_ERROR_MSG_ERROR :{RED}Virhe: {SILVER}{STRING}
+
STR_NEWGRF_ADD :{BLACK}Lisää
STR_NEWGRF_ADD_TIP :{BLACK}Lisää NewGRF-tiedosto listaan
STR_NEWGRF_REMOVE :{BLACK}Poista
@@ -3117,4 +3123,10 @@
STR_MEASURE_LENGTH_HEIGHTDIFF :{BLACK}Pituus: {NUM}{}Korkeusero: {NUM} m
STR_MEASURE_AREA_HEIGHTDIFF :{BLACK}Pinta-ala: {NUM} x {NUM}{}Korkeusero: {NUM} m
+############ Date formatting
+STR_DATE_TINY :{STRING}-{STRING}-{NUM}
+STR_DATE_SHORT :{STRING} {NUM}
+STR_DATE_LONG :{STRING} {STRING} {NUM}
+
########
+
--- a/src/lang/french.txt Sat Mar 10 11:07:13 2007 +0000
+++ b/src/lang/french.txt Sun Mar 11 16:31:18 2007 +0000
@@ -281,6 +281,7 @@
STR_OSNAME_MORPHOS :MorphOS
STR_OSNAME_AMIGAOS :AmigaOS
STR_OSNAME_OS2 :OS/2
+STR_OSNAME_SUNOS :SunOS
STR_013B_OWNED_BY :{WHITE}...appartient à {STRING}
STR_013C_CARGO :{BLACK}Cargaison
@@ -1040,7 +1041,7 @@
STR_CONFIG_PATCHES_AUTOSCROLL :{LTBLUE}Défiler la vue horizontalement avec le pointeur: {ORANGE}{STRING}
STR_CONFIG_PATCHES_BRIBE :{LTBLUE}Permettre la corruption de la municipalité: {ORANGE}{STRING}
STR_CONFIG_PATCHES_NONUNIFORM_STATIONS :{LTBLUE}Gares non uniformes: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_NEW_PATHFINDING_ALL :{LTBLUE}Nouvelle recherche de chemin globale (NPF, écrase NTP): {ORANGE}{STRING}
+STR_CONFIG_PATCHES_NEW_PATHFINDING_ALL :{LTBLUE}Nouvelle recherche de chemin global (NPF, écrase NTP): {ORANGE}{STRING}
STR_CONFIG_PATCHES_FREIGHT_TRAINS :{LTBLUE}Multiplier le poid pour les trains fret (simule des trains lourds): {ORANGE}{STRING}
STR_CONFIG_PATCHES_STOP_ON_TOWN_ROAD :{LTBLUE}Autoriser les arrêts de bus sur les routes des municipalités: {ORANGE}{STRING}
@@ -1879,8 +1880,8 @@
STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY :{WHITE}Impossible de construire cette industrie ici...
STR_4831_FOREST_CAN_ONLY_BE_PLANTED :{WHITE}...les forêts ne peuvent pas être plantées sur de la neige
STR_4832_ANNOUNCES_IMMINENT_CLOSURE :{BLACK}{BIGFONT}{INDUSTRY} annonce une fermeture imminente!
-STR_4833_SUPPLY_PROBLEMS_CAUSE_TO :{BLACK}{BIGFONT}Des problèmes d'approvisionnement forcent {INDUSTRY} à fermer bientôt!
-STR_4834_LACK_OF_NEARBY_TREES_CAUSES :{BLACK}{BIGFONT}Le manque d'arbres proches force {INDUSTRY} à fermer bientôt!
+STR_4833_SUPPLY_PROBLEMS_CAUSE_TO :{BLACK}{BIGFONT}Des problèmes d'approvisionnement obligent {INDUSTRY} à fermer bientôt!
+STR_4834_LACK_OF_NEARBY_TREES_CAUSES :{BLACK}{BIGFONT}Le manque d'arbres proches oblige {INDUSTRY} à fermer bientôt!
STR_4835_INCREASES_PRODUCTION :{BLACK}{BIGFONT}{INDUSTRY} augmente la production!
STR_4836_NEW_COAL_SEAM_FOUND_AT :{BLACK}{BIGFONT}Nouveau filon de charbon trouvé à {INDUSTRY}!{}La production devrait doubler!
STR_4837_NEW_OIL_RESERVES_FOUND :{BLACK}{BIGFONT}Nouveaux gisements pétrolifères découverts à {INDUSTRY}!{}La production devrait doubler!
@@ -2634,6 +2635,10 @@
STR_TRAIN_NO_POWER :{RED}Pas de puissance
STR_TRAIN_START_NO_CATENARY :Cette voie n'a pas de caténaire, le train ne peut pas démarrer
+STR_NEW_VEHICLE_NOW_AVAILABLE :{BLACK}{BIGFONT}Nouv{G eau el elle} {STRING} disponible!
+STR_NEW_VEHICLE_TYPE :{BLACK}{BIGFONT}{STRING}
+STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}Nouv{G eau el elle} {STRING} disponible! - {STRING}
+
##id 0x9000
STR_9000_ROAD_VEHICLE_IN_THE_WAY :{WHITE}Véhicule Routier présent
STR_9001_ROAD_VEHICLES :{WHITE}{COMPANY} - {COMMA} Véhicule{P "" s} routier{P "" s}
@@ -2843,10 +2848,10 @@
##id 0xB000
STR_B000_ZEPPELIN_DISASTER_AT :{BLACK}{BIGFONT}Désastre impliquant un Zeppelin à {STATION}!
-STR_B001_ROAD_VEHICLE_DESTROYED :{BLACK}{BIGFONT}Véhicule routier détruit dans use collision avec un 'OVNI'!
+STR_B001_ROAD_VEHICLE_DESTROYED :{BLACK}{BIGFONT}Un véhicule routier est détruit dans une collision avec un 'OVNI'!
STR_B002_OIL_REFINERY_EXPLOSION :{BLACK}{BIGFONT}Explosion d'une raffinerie pétrolière près de {TOWN}!
STR_B003_FACTORY_DESTROYED_IN_SUSPICIOUS :{BLACK}{BIGFONT}Usine détruite dans des circonstances suspectes près de {TOWN}!
-STR_B004_UFO_LANDS_NEAR :{BLACK}{BIGFONT}Un 'OVNI' attérit près de {TOWN}!
+STR_B004_UFO_LANDS_NEAR :{BLACK}{BIGFONT}Un 'OVNI' a été découvert près de {TOWN}!
STR_B005_COAL_MINE_SUBSIDENCE_LEAVES :{BLACK}{BIGFONT}Affaissement d'une veine de charbon entraîne la desctruction de la mine de {TOWN}!
STR_B006_FLOOD_VEHICLE_DESTROYED :{BLACK}{BIGFONT}Inondations!{}Au moins {COMMA} présumé{P "" s} manquant{P "" s} ou mort{P "" s} après des inondations meurtrières!
@@ -2895,7 +2900,7 @@
STR_NEWGRF_CONFIRMATION_TEXT :{YELLOW}Vous êtes sur le point de faire des changements dans une partie en cours; cela peut faire planter OpenTTD.{}Etes-vous absolument sûr ?
STR_NEWGRF_ERROR_MSG_INFO :{SILVER}{STRING}
-STR_NEWGRF_ERROR_MSG_WARNING :{RED}Avertissement: {SILVER}{STRING}
+STR_NEWGRF_ERROR_MSG_WARNING :{RED}Attention: {SILVER}{STRING}
STR_NEWGRF_ERROR_MSG_ERROR :{RED}Erreur: {SILVER}{STRING}
STR_NEWGRF_ERROR_MSG_FATAL :{RED}Fatal: {SILVER}{STRING}
STR_NEWGRF_ERROR_VERSION_NUMBER :{STRING} ne fonctionnera pas avec la version de TTDPatch reportée par OpenTTD.
@@ -2904,6 +2909,7 @@
STR_NEWGRF_ERROR_INVALID_PARAMETER :Paramètre invalide pour {STRING}: paramètre {STRING} ({NUM})
STR_NEWGRF_ERROR_LOAD_BEFORE :{STRING} doit être chargé avant {STRING}.
STR_NEWGRF_ERROR_LOAD_AFTER :{STRING} doit être chargé après {STRING}.
+STR_NEWGRF_ERROR_AFTER_TRANSLATED_FILE :le fichier GRF qu'il doit traduire
STR_NEWGRF_ADD :{BLACK}Ajouter
STR_NEWGRF_ADD_TIP :{BLACK}Ajouter un fichier NewGRF à la liste
@@ -3136,3 +3142,5 @@
STR_DATE_LONG :{STRING} {STRING} {NUM}
########
+
+STR_FEEDER_CARGO_VALUE :{BLACK}Crédits de transfert: {LTBLUE}{CURRENCY}
--- a/src/lang/german.txt Sat Mar 10 11:07:13 2007 +0000
+++ b/src/lang/german.txt Sun Mar 11 16:31:18 2007 +0000
@@ -281,6 +281,7 @@
STR_OSNAME_MORPHOS :MorphOS
STR_OSNAME_AMIGAOS :AmigaOS
STR_OSNAME_OS2 :OS/2
+STR_OSNAME_SUNOS :SunOS
STR_013B_OWNED_BY :{WHITE}...Eigentum von {STRING}
STR_013C_CARGO :{BLACK}Fracht
@@ -2634,6 +2635,10 @@
STR_TRAIN_NO_POWER :{RED}Keine Energie
STR_TRAIN_START_NO_CATENARY :Wegen fehlender Oberleitung kann der Zug nicht starten.
+STR_NEW_VEHICLE_NOW_AVAILABLE :{BLACK}{BIGFONT}Neue{G r "" s} {STRING} jetzt erhältlich!
+STR_NEW_VEHICLE_TYPE :{BLACK}{BIGFONT}{STRING}
+STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}Neue{G r "" s} {STRING} jetzt erhältlich! - {STRING}
+
##id 0x9000
STR_9000_ROAD_VEHICLE_IN_THE_WAY :{WHITE}Fahrzeug ist im Weg
STR_9001_ROAD_VEHICLES :{WHITE}{COMPANY} - {COMMA} Fahrzeug{P "" e}
@@ -3136,3 +3141,5 @@
STR_DATE_LONG :{STRING} {STRING} {NUM}
########
+
+STR_FEEDER_CARGO_VALUE :{BLACK}Überweise Geld: {LTBLUE}{CURRENCY}
--- a/src/lang/hungarian.txt Sat Mar 10 11:07:13 2007 +0000
+++ b/src/lang/hungarian.txt Sun Mar 11 16:31:18 2007 +0000
@@ -346,6 +346,7 @@
STR_OSNAME_MORPHOS :MorphOS
STR_OSNAME_AMIGAOS :AmigaOS
STR_OSNAME_OS2 :OS/2
+STR_OSNAME_SUNOS :SunOS
STR_013B_OWNED_BY :{WHITE}... {STRING} tulajdona
STR_013C_CARGO :{BLACK}Rakomány
@@ -2736,6 +2737,10 @@
STR_TRAIN_NO_POWER :{RED}Nincs áram
STR_TRAIN_START_NO_CATENARY :Ennek a sínnek nincs felsővezetéke, a vonat nem tud indulni
+STR_NEW_VEHICLE_NOW_AVAILABLE :{BLACK}{BIGFONT}Új {STRING} elérhető!
+STR_NEW_VEHICLE_TYPE :{BLACK}{BIGFONT}{STRING}
+STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}Új {STRING} elérhető! - {STRING}
+
##id 0x9000
STR_9000_ROAD_VEHICLE_IN_THE_WAY :{WHITE}Közúti jármű van az útban
STR_9001_ROAD_VEHICLES :{WHITE}{COMPANY} közúti járművei - {COMMA}
@@ -3238,3 +3243,4 @@
STR_DATE_LONG :{STRING} {STRING} {NUM}
########
+
--- a/src/lang/italian.txt Sat Mar 10 11:07:13 2007 +0000
+++ b/src/lang/italian.txt Sun Mar 11 16:31:18 2007 +0000
@@ -280,6 +280,7 @@
STR_OSNAME_MORPHOS :MorphOS
STR_OSNAME_AMIGAOS :AmigaOS
STR_OSNAME_OS2 :OS/2
+STR_OSNAME_SUNOS :SunOS
STR_013B_OWNED_BY :{WHITE}...posseduto da {STRING}
STR_013C_CARGO :{BLACK}Carico
@@ -2633,6 +2634,10 @@
STR_TRAIN_NO_POWER :{RED}Nessuna potenza
STR_TRAIN_START_NO_CATENARY :Questo tratto manca la catenaria, per questo il treno non può partire
+STR_NEW_VEHICLE_NOW_AVAILABLE :{BLACK}{BIGFONT}Nuovo {STRING} è disponibile!
+STR_NEW_VEHICLE_TYPE :{BLACK}{BIGFONT}{STRING}
+STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}Nuovo {STRING} è disponibile! - {STRING}
+
##id 0x9000
STR_9000_ROAD_VEHICLE_IN_THE_WAY :{WHITE}Veicolo in mezzo
STR_9001_ROAD_VEHICLES :{WHITE}{COMPANY} - {COMMA} Veicol{P o i} stradal{P e i}
@@ -3135,3 +3140,5 @@
STR_DATE_LONG :{STRING} {STRING} {NUM}
########
+
+STR_FEEDER_CARGO_VALUE :{BLACK}Crediti Trasferiti: {LTBLUE}{CURRENCY}
--- a/src/lang/japanese.txt Sat Mar 10 11:07:13 2007 +0000
+++ b/src/lang/japanese.txt Sun Mar 11 16:31:18 2007 +0000
@@ -280,6 +280,7 @@
STR_OSNAME_MORPHOS :MorphOS
STR_OSNAME_AMIGAOS :AmigaOS
STR_OSNAME_OS2 :OS/2
+STR_OSNAME_SUNOS :SunOS
STR_013B_OWNED_BY :{WHITE}...所有者は {STRING}
STR_013C_CARGO :{BLACK}貨物
@@ -2633,6 +2634,10 @@
STR_TRAIN_NO_POWER :{RED}電源はありません
STR_TRAIN_START_NO_CATENARY :線路は懸垂線がないため、この列車が動けません
+STR_NEW_VEHICLE_NOW_AVAILABLE :{BLACK}{BIGFONT}{STRING}が新登場!
+STR_NEW_VEHICLE_TYPE :{BLACK}{BIGFONT}{STRING}
+STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}{STRING}が新登場!ー{STRING}
+
##id 0x9000
STR_9000_ROAD_VEHICLE_IN_THE_WAY :{WHITE}道路車両があります
STR_9001_ROAD_VEHICLES :{WHITE}{COMPANY} - 道路車両{COMMA}両
@@ -2893,6 +2898,14 @@
STR_NEWGRF_MD5SUM :{BLACK}MD5sum:{SILVER}{STRING}
STR_NEWGRF_CONFIRMATION_TEXT :{YELLOW}実行中のゲームに変更を適用して、クラッシュのリスクがあります。{}続けてもよろしいですか?
+STR_NEWGRF_ERROR_MSG_INFO :{SILVER}{STRING}
+STR_NEWGRF_ERROR_MSG_WARNING :{RED}警告:{SILVER}{STRING}
+STR_NEWGRF_ERROR_MSG_ERROR :{RED}エラー:{SILVER}{STRING}
+STR_NEWGRF_ERROR_MSG_FATAL :{RED}エラー:{SILVER}{STRING}
+STR_NEWGRF_ERROR_VERSION_NUMBER :{STRING}はOpenTTDのTTDPatchバージョンに対応していません。
+STR_NEWGRF_ERROR_DOS_OR_WINDOWS :{STRING}はTTDの{STRING}バージョンのみに対応しています。
+STR_NEWGRF_ERROR_UNSET_SWITCH :{STRING}を使用時に、{STRING}を入にしなければなりません
+STR_NEWGRF_ERROR_INVALID_PARAMETER :{STRING}のパラメータが不正:パラメータ {STRING}({NUM})
STR_NEWGRF_ADD :{BLACK}追加
STR_NEWGRF_ADD_TIP :{BLACK}NewGRFファイルをリストに追加します
@@ -3120,5 +3133,8 @@
STR_MEASURE_AREA_HEIGHTDIFF :{BLACK}地域:{NUM} x {NUM}{}高さの違い:{NUM} m
############ Date formatting
+STR_DATE_TINY :{2:NUM}-{1:STRING}-{0:STRING}
+STR_DATE_SHORT :{1:NUM}年{0:STRING}
########
+
--- a/src/lang/korean.txt Sat Mar 10 11:07:13 2007 +0000
+++ b/src/lang/korean.txt Sun Mar 11 16:31:18 2007 +0000
@@ -281,6 +281,7 @@
STR_OSNAME_MORPHOS :MorphOS
STR_OSNAME_AMIGAOS :AmigaOS
STR_OSNAME_OS2 :OS/2
+STR_OSNAME_SUNOS :SunOS
STR_013B_OWNED_BY :{WHITE}... {STRING}의 소유입니다.
STR_013C_CARGO :{BLACK}화물
@@ -2634,6 +2635,10 @@
STR_TRAIN_NO_POWER :{RED}기관차 없음
STR_TRAIN_START_NO_CATENARY :연결고리가 모자라 운행을 시작할 수 없습니다.
+STR_NEW_VEHICLE_NOW_AVAILABLE :{BLACK}{BIGFONT}신형 {STRING} 자동차가 출시되었습니다!
+STR_NEW_VEHICLE_TYPE :{BLACK}{BIGFONT}{STRING}
+STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}신형 {STRING} 자동차가 출시되었습니다! - {STRING}
+
##id 0x9000
STR_9000_ROAD_VEHICLE_IN_THE_WAY :{WHITE}중간에 자동차가 있습니다.
STR_9001_ROAD_VEHICLES :{WHITE}{COMPANY} - {COMMA}대의 자동차
@@ -2894,7 +2899,12 @@
STR_NEWGRF_MD5SUM :{BLACK}MD5sum: {SILVER}{STRING}
STR_NEWGRF_CONFIRMATION_TEXT :{YELLOW}게임이 진행중인데 설정을 변경하려고 하면 게임과 충돌할 수도 있습니다.{}정말로 설정을 변경하시겠습니까?
+STR_NEWGRF_ERROR_MSG_INFO :{SILVER}{STRING}
+STR_NEWGRF_ERROR_MSG_WARNING :{RED}경고: {SILVER}{STRING}
+STR_NEWGRF_ERROR_MSG_ERROR :{RED}오류: {SILVER}{STRING}
+STR_NEWGRF_ERROR_MSG_FATAL :{RED}치명적 오류: {SILVER}{STRING}
STR_NEWGRF_ERROR_DOS_OR_WINDOWS :{STRING}은/는 {STRING} 버젼의 TTD를 위한 것입니다.
+STR_NEWGRF_ERROR_UNSET_SWITCH :{STRING}(은)는 {STRING}(와)과 사용되도록 디자인되었습니다
STR_NEWGRF_ERROR_LOAD_BEFORE :{STRING}은/는 반드시 {STRING}이전에 불러와야 합니다.
STR_NEWGRF_ERROR_LOAD_AFTER :{STRING}은/는 반드시 {STRING}다음에 불러와야 합니다.
@@ -3126,3 +3136,4 @@
############ Date formatting
########
+
--- a/src/lang/norwegian_bokmal.txt Sat Mar 10 11:07:13 2007 +0000
+++ b/src/lang/norwegian_bokmal.txt Sun Mar 11 16:31:18 2007 +0000
@@ -2633,6 +2633,7 @@
STR_TRAIN_NO_POWER :{RED}Ingen strøm
STR_TRAIN_START_NO_CATENARY :Dette sporet mangler et kjede, så toget kan ikke starte
+
##id 0x9000
STR_9000_ROAD_VEHICLE_IN_THE_WAY :{WHITE}Kjøretøy i veien
STR_9001_ROAD_VEHICLES :{WHITE}{COMPANY} - {COMMA} kjøretøy
@@ -2893,6 +2894,16 @@
STR_NEWGRF_MD5SUM :{BLACK}MD5sum: {SILVER}{STRING}
STR_NEWGRF_CONFIRMATION_TEXT :{YELLOW}Du er i ferd med å gjøre forandringer i et kjørende spill; Dette kan krasje OpenTTD.{}Er du helt sikker på at du vil gjøre dette?
+STR_NEWGRF_ERROR_MSG_INFO :{SILVER}{STRING}
+STR_NEWGRF_ERROR_MSG_WARNING :{RED}Advarsel: {SILVER}{STRING}
+STR_NEWGRF_ERROR_MSG_ERROR :{RED}Feil: {SILVER}{STRING}
+STR_NEWGRF_ERROR_MSG_FATAL :{RED}Fatal: {SILVER}{STRING}
+STR_NEWGRF_ERROR_VERSION_NUMBER :{STRING} virker ikke med TTDPatch versjonen som er rapportert av OpenTTD
+STR_NEWGRF_ERROR_DOS_OR_WINDOWS :{STRING} er for versjon {STRING} av TTD.
+STR_NEWGRF_ERROR_UNSET_SWITCH :{STRING} er designet for å bli brukt med {STRING}
+STR_NEWGRF_ERROR_INVALID_PARAMETER :Ugyldig parameter for {STRING}: parameter {STRING} ({NUM})
+STR_NEWGRF_ERROR_LOAD_BEFORE :{STRING} må være lastet før {STRING}.
+STR_NEWGRF_ERROR_LOAD_AFTER :{STRING} må være lastet etter {STRING}.
STR_NEWGRF_ADD :{BLACK}Legg til
STR_NEWGRF_ADD_TIP :{BLACK}Legg en ny NewGRF-fil til listen
@@ -3120,5 +3131,9 @@
STR_MEASURE_AREA_HEIGHTDIFF :{BLACK}Område: {NUM} x {NUM}{}Høydeforskjell: {NUM} m
############ Date formatting
+STR_DATE_TINY :{STRING}-{STRING}-{NUM}
+STR_DATE_SHORT :{STRING} {NUM}
+STR_DATE_LONG :{STRING} {STRING} {NUM}
########
+
--- a/src/lang/norwegian_nynorsk.txt Sat Mar 10 11:07:13 2007 +0000
+++ b/src/lang/norwegian_nynorsk.txt Sun Mar 11 16:31:18 2007 +0000
@@ -281,6 +281,7 @@
STR_OSNAME_MORPHOS :MorphOS
STR_OSNAME_AMIGAOS :AmigaOS
STR_OSNAME_OS2 :OS/2
+STR_OSNAME_SUNOS :SunOS
STR_013B_OWNED_BY :{WHITE}...ått av {STRING}
STR_013C_CARGO :{BLACK}Last
@@ -1042,6 +1043,7 @@
STR_CONFIG_PATCHES_NONUNIFORM_STATIONS :{LTBLUE}Ikkje-einsarta stasjonar: {ORANGE}{STRING}
STR_CONFIG_PATCHES_NEW_PATHFINDING_ALL :{LTBLUE}Ny global rutesøking (NGR, overstyrer NTK): {ORANGE}{STRING}
STR_CONFIG_PATCHES_FREIGHT_TRAINS :{LTBLUE}Vektmultiplikator for frakt til å simulere tunge tog: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_STOP_ON_TOWN_ROAD :{LTBLUE}Tillat å køyre gjennom stoppestadar på vegar som byane eig: {ORANGE}{STRING}
STR_CONFIG_PATCHES_SMALL_AIRPORTS :{LTBLUE}Alltid tillat bygging av små flyplassar: {ORANGE}{STRING}
@@ -1315,7 +1317,7 @@
STR_NETWORK_VERSION_MISMATCH :{SILVER}DU HAR EIN ANNAN VERSJON ENN TENAREN
STR_NETWORK_GRF_MISMATCH :{SILVER}NEWGRF PASSAR IKKJE
-STR_NETWORK_JOIN_GAME :{BLACK}Ver med på spel
+STR_NETWORK_JOIN_GAME :{BLACK}Bli med på spel
STR_NETWORK_START_GAME_WINDOW :{WHITE}Start eit nytt fleirspelarspel
@@ -1585,6 +1587,8 @@
STR_1816_TREE_LINED_ROAD :Aveny
STR_1817_ROAD_VEHICLE_DEPOT :Garasje
STR_1818_ROAD_RAIL_LEVEL_CROSSING :Jernbaneovergang
+STR_CAN_T_REMOVE_BUS_STATION :{WHITE}Kan ikkje fjerne busstasjon
+STR_CAN_T_REMOVE_TRUCK_STATION :{WHITE}Kan ikkje fjerne lastebilstasjon
##id 0x2000
STR_2000_TOWNS :{WHITE}Byar
@@ -2631,6 +2635,10 @@
STR_TRAIN_NO_POWER :{RED}Ingen straum
STR_TRAIN_START_NO_CATENARY :Dette sporet manglar eit kjede, så toget kan ikkje starte
+STR_NEW_VEHICLE_NOW_AVAILABLE :{BLACK}{BIGFONT}Ny {STRING}type er tilgjengeleg!
+STR_NEW_VEHICLE_TYPE :{BLACK}{BIGFONT}{STRING}
+STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}Ny {STRING}type er tilgjengeleg! - {STRING}
+
##id 0x9000
STR_9000_ROAD_VEHICLE_IN_THE_WAY :{WHITE}Køyretøy i vegen
STR_9001_ROAD_VEHICLES :{WHITE}{COMPANY} - {COMMA} køyretøy
@@ -2891,6 +2899,17 @@
STR_NEWGRF_MD5SUM :{BLACK}MD5sum: {SILVER}{STRING}
STR_NEWGRF_CONFIRMATION_TEXT :{YELLOW}Du er i ferd med å gjere forandringar i eit spel som er i gang. Det kan få OpenTTD til å krasje. Er du heilt sikker på at du vil gjere dette?
+STR_NEWGRF_ERROR_MSG_INFO :{SILVER}{STRING}
+STR_NEWGRF_ERROR_MSG_WARNING :{RED}Åtvaring: {SILVER}{STRING}
+STR_NEWGRF_ERROR_MSG_ERROR :{RED}Feil: {SILVER}{STRING}
+STR_NEWGRF_ERROR_MSG_FATAL :{RED}Fatal: {SILVER}{STRING}
+STR_NEWGRF_ERROR_VERSION_NUMBER :{STRING} vil ikkje virke med den TTDPatch versjonen som OpenTTD oppgjer
+STR_NEWGRF_ERROR_DOS_OR_WINDOWS :{STRING} er for {STRING} utgåva av TTD.
+STR_NEWGRF_ERROR_UNSET_SWITCH :{STRING} er laga for å brukast saman med {STRING}
+STR_NEWGRF_ERROR_INVALID_PARAMETER :Ugyldig parameter for {STRING}: parameter {STRING} ({NUM})
+STR_NEWGRF_ERROR_LOAD_BEFORE :{STRING} må være lasta før{STRING}.
+STR_NEWGRF_ERROR_LOAD_AFTER :{STRING} må være lasta etter {STRING}.
+
STR_NEWGRF_ADD :{BLACK}Legg til
STR_NEWGRF_ADD_TIP :{BLACK}Legg ei ny NewGRF-fil til lista
STR_NEWGRF_REMOVE :{BLACK}Fjern
@@ -3116,4 +3135,11 @@
STR_MEASURE_LENGTH_HEIGHTDIFF :{BLACK}Lengd: {NUM}{}Høgdeskilnad: {NUM} m
STR_MEASURE_AREA_HEIGHTDIFF :{BLACK}Område: {NUM} x {NUM}{}Høgdeskilnad: {NUM} m
+############ Date formatting
+STR_DATE_TINY :{STRING}-{STRING}-{NUM}
+STR_DATE_SHORT :{STRING} {NUM}
+STR_DATE_LONG :{STRING} {STRING} {NUM}
+
########
+
+STR_FEEDER_CARGO_VALUE :{BLACK}Overfør kreditt: {LTBLUE}{CURRENCY}
--- a/src/lang/polish.txt Sat Mar 10 11:07:13 2007 +0000
+++ b/src/lang/polish.txt Sun Mar 11 16:31:18 2007 +0000
@@ -275,7 +275,7 @@
STR_0100_FACTORY.d :{BLACK}{TINYFONT}{G=f}Fabryki
STR_0101_PRINTING_WORKS :{BLACK}{TINYFONT}{G=f}Drukarnia
STR_0101_PRINTING_WORKS.d :{BLACK}{TINYFONT}{G=f}Drukarnii
-STR_0102_OIL_WELLS :{BLACK}{TINYFONT}{G=m}Pole naftowe
+STR_0102_OIL_WELLS :{BLACK}{TINYFONT}{G=m}Pole Naftowe
STR_0102_OIL_WELLS.d :{BLACK}{TINYFONT}{G=m}Pola naftowego
STR_0103_IRON_ORE_MINE :{BLACK}{TINYFONT}{G=f}Kopalnia rudy żelaza
STR_0104_STEEL_MILL :{BLACK}{TINYFONT}{G=f}Huta
@@ -333,6 +333,7 @@
STR_OSNAME_MORPHOS :MorphOS
STR_OSNAME_AMIGAOS :AmigaOS
STR_OSNAME_OS2 :OS/2
+STR_OSNAME_SUNOS :SunOS
STR_013B_OWNED_BY :{WHITE}...w posiadaniu {STRING}
STR_013C_CARGO :{BLACK}Ładunek
@@ -776,7 +777,7 @@
STR_0269_CONSTRUCT_STEEL_MILL :{BLACK}Zbuduj Hutę
STR_026A_CONSTRUCT_FARM :{BLACK}Zbuduj Farmę
STR_026B_CONSTRUCT_IRON_ORE_MINE :{BLACK}Zbuduj Kopalnię Rudy Żelaza
-STR_026C_CONSTRUCT_OIL_WELLS :{BLACK}Zbuduj Pole naftowe
+STR_026C_CONSTRUCT_OIL_WELLS :{BLACK}Zbuduj Pole Naftowe
STR_026D_CONSTRUCT_BANK_CAN_ONLY :{BLACK}Zbuduj Bank (Można zbudować tylko w miastach z populacją wiekszą niż 1200)
STR_026E_CONSTRUCT_PAPER_MILL :{BLACK}Zbuduj Zakłady Papiernicze
STR_026F_CONSTRUCT_FOOD_PROCESSING :{BLACK}Zbuduj Przetwórnię Żywności
@@ -1502,7 +1503,7 @@
STR_NETWORK_NEED_COMPANY_PASSWORD_CAPTION :{WHITE}Firma jest chroniona. Wprowadź hasło
STR_NETWORK_CLIENT_LIST :{WHITE}Lista klientów
-STR_NETWORK_ERR_NOTAVAILABLE :{WHITE} Brak interface'u sieciowego lub skompilowane bez opcji ENABLE_NETWORK
+STR_NETWORK_ERR_NOTAVAILABLE :{WHITE} Brak interface'u sieciowego lub skompilowano bez opcji ENABLE_NETWORK
STR_NETWORK_ERR_NOSERVER :{WHITE} Nie można znaleźć żadnej gry w sieci
STR_NETWORK_ERR_NOCONNECTION :{WHITE} Serwer nie odpowiada
STR_NETWORK_ERR_NEWGRF_MISMATCH :{WHITE} Nie można było połączyć z powodu niezgodności NewGRF
@@ -1746,7 +1747,7 @@
STR_2042_DO_IT :{BLACK}Wykonaj
STR_2043_LIST_OF_THINGS_TO_DO_AT :{BLACK}Lista rzeczy do zrobienia w tym mieście - klik po więcej detali
STR_2044_CARRY_OUT_THE_HIGHLIGHTED :{BLACK}Wykonaj podświetloną akcję z poniższej listy
-STR_2045_ACTIONS_AVAILABLE :{BLACK}Możliwe działanie:
+STR_2045_ACTIONS_AVAILABLE :{BLACK}Możliwe działania:
STR_2046_SMALL_ADVERTISING_CAMPAIGN :Mała kampania reklamowa
STR_2047_MEDIUM_ADVERTISING_CAMPAIGN :Średnia kampania reklamowa
STR_2048_LARGE_ADVERTISING_CAMPAIGN :Duża kampania reklamowa
@@ -2087,7 +2088,7 @@
STR_SV_STNAME_LAKESIDE :{STRING} Jezioro
STR_SV_STNAME_EXCHANGE :{STRING} Wymiana
STR_SV_STNAME_AIRPORT :Lotnisko {STRING}
-STR_SV_STNAME_OILFIELD :{STRING} Pole naftowe
+STR_SV_STNAME_OILFIELD :{STRING} Platforma Wiertnicza
STR_SV_STNAME_MINES :{STRING} Kopalnia
STR_SV_STNAME_DOCKS :{STRING} Port
STR_SV_STNAME_BUOY_1 :{STRING} Boja 1
@@ -2762,6 +2763,10 @@
STR_TRAIN_NO_POWER :{RED}Brak zasilania
STR_TRAIN_START_NO_CATENARY :Ta trasa nie jest zelektryfikowana, wiec pociąg nie wystartuje
+STR_NEW_VEHICLE_NOW_AVAILABLE :{BLACK}{BIGFONT}Dostępn{G y a e} now{G y a e} {STRING}!
+STR_NEW_VEHICLE_TYPE :{BLACK}{BIGFONT}{STRING}
+STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}Dostępn{G y a e} now{G y a e} {STRING} - {STRING}!
+
##id 0x9000
STR_9000_ROAD_VEHICLE_IN_THE_WAY :{WHITE}Samochód na drodze
STR_9001_ROAD_VEHICLES :{WHITE}{COMPANY} - {COMMA} Samoch{P ód ody odów}
@@ -3032,6 +3037,7 @@
STR_NEWGRF_ERROR_INVALID_PARAMETER :Niewłaściwy parametr dla {STRING}: parametr {STRING} ({NUM})
STR_NEWGRF_ERROR_LOAD_BEFORE :{STRING} musi być wczytany przed {STRING}.
STR_NEWGRF_ERROR_LOAD_AFTER :{STRING} musi być wczytany po {STRING}.
+STR_NEWGRF_ERROR_AFTER_TRANSLATED_FILE :pliku GRF który miał być tłumaczony
STR_NEWGRF_ADD :{BLACK}Dodaj
STR_NEWGRF_ADD_TIP :{BLACK}Dodaj plik NewGRF do listy
@@ -3264,3 +3270,4 @@
STR_DATE_LONG :{STRING} {STRING} {NUM}
########
+
--- a/src/lang/portuguese.txt Sat Mar 10 11:07:13 2007 +0000
+++ b/src/lang/portuguese.txt Sun Mar 11 16:31:18 2007 +0000
@@ -2633,6 +2633,10 @@
STR_TRAIN_NO_POWER :{RED}Sem energia
STR_TRAIN_START_NO_CATENARY :Esta linha não tem catenária, o comboio não pode arrancar
+STR_NEW_VEHICLE_NOW_AVAILABLE :{BLACK}{BIGFONT}Novo {STRING} agora disponível!
+STR_NEW_VEHICLE_TYPE :{BLACK}{BIGFONT}{STRING}
+STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}Novo {STRING} agora disponível! - {STRING}
+
##id 0x9000
STR_9000_ROAD_VEHICLE_IN_THE_WAY :{WHITE}Veículo de estrada no caminho
STR_9001_ROAD_VEHICLES :{WHITE}{COMPANY} - {COMMA} Veículos de Estrada
@@ -3130,5 +3134,10 @@
STR_MEASURE_AREA_HEIGHTDIFF :{BLACK}Área: {NUM} x {NUM}{}Diferença de altura: {NUM} m
############ Date formatting
+STR_DATE_TINY :{STRING}-{STRING}-{NUM}
+STR_DATE_SHORT :{STRING} {NUM}
+STR_DATE_LONG :{STRING} {STRING} {NUM}
########
+
+STR_FEEDER_CARGO_VALUE :{BLACK}Créditos de Transferência: {LTBLUE}{CURRENCY}
--- a/src/lang/romanian.txt Sat Mar 10 11:07:13 2007 +0000
+++ b/src/lang/romanian.txt Sun Mar 11 16:31:18 2007 +0000
@@ -391,7 +391,6 @@
STR_ENGINE_SORT_INTRO_DATE :Data lansarii
STR_ENGINE_SORT_RUNNING_COST :Cost exploatare
STR_ENGINE_SORT_POWER_VS_RUNNING_COST :Cost exploatare/putere
-STR_ENGINE_SORT_CARGO_CAPACITY :
STR_NO_WAITING_CARGO :{BLACK}Nu este în asteptare nici un fel de încãrcãturã
STR_SELECT_ALL_FACILITIES :{BLACK}Alege toate facilitãtile
STR_SELECT_ALL_TYPES :{BLACK}Alege toate tipurile de încãrcãturi (inclusiv încãrcãturile care nu sunt în asteptare)
@@ -456,7 +455,7 @@
STR_018B_CLOSE_WINDOW :{BLACK}Închide fereastra
STR_018C_WINDOW_TITLE_DRAG_THIS :{BLACK}Titlul ferestrei - trage de aici pentru a muta fereastra
STR_STICKY_BUTTON :{BLACK}Mark this window as undeletable for the 'Close All Windows' key
-STR_RESIZE_BUTTON :{BLACK}Click&trage pt redimensionarea ferestrei
+STR_RESIZE_BUTTON :{BLACK}Apasa si trage pentru redimensionarea ferestrei
STR_SAVELOAD_HOME_BUTTON :{BLACK}Click aici pentru a ajunge la directorul predefinit pentru salvari
STR_018D_DEMOLISH_BUILDINGS_ETC :{BLACK}Demoleazã clãdiri, strãzi, etc. pe un pãtrat de teren
STR_018E_LOWER_A_CORNER_OF_LAND :{BLACK}Scade altitudinea unui vârf de teren
@@ -989,7 +988,7 @@
STR_TRAIN_HAS_INVALID_ENTRY :{WHITE}Trenul {COMMA} are o statie inexistentã în comenzi
STR_ROADVEHICLE_HAS_TOO_FEW_ORDERS :{WHITE}Autovehiculul {COMMA} are prea putine comenzi în listã
STR_ROADVEHICLE_HAS_VOID_ORDER :{WHITE}Autovehiculul {COMMA} nu are comenzi
-STR_ROADVEHICLE_HAS_DUPLICATE_ENTRY :{WHITE}Autovehiculul {COMMA} are comenzi repetate
+STR_ROADVEHICLE_HAS_DUPLICATE_ENTRY :{WHITE}Autovehiculul {COMMA} are comenzi duplicat
STR_ROADVEHICLE_HAS_INVALID_ENTRY :{WHITE}Autovehiculul {COMMA} are o statie inexistentã în comenzi
STR_SHIP_HAS_TOO_FEW_ORDERS :{WHITE}Nava {COMMA} are prea putine comenzi în listã
STR_SHIP_HAS_VOID_ORDER :{WHITE}Nava {COMMA} nu are comenzi
@@ -2633,6 +2632,10 @@
STR_TRAIN_NO_POWER :{RED}Fara curent
STR_TRAIN_START_NO_CATENARY :Aceasta sina nu este electrificata, deci trenul nu poate porni
+STR_NEW_VEHICLE_NOW_AVAILABLE :{BLACK}{BIGFONT}Un nou {STRING} este acum disponibil!
+STR_NEW_VEHICLE_TYPE :{BLACK}{BIGFONT}{STRING}
+STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}Un nou {STRING} este acum disponibil! - {STRING}
+
##id 0x9000
STR_9000_ROAD_VEHICLE_IN_THE_WAY :{WHITE}Autovehicul in cale
STR_9001_ROAD_VEHICLES :{WHITE}{COMPANY} - {COMMA}Autovehicule
@@ -2893,6 +2896,17 @@
STR_NEWGRF_MD5SUM :{BLACK}MD5sum: {SILVER}{STRING}
STR_NEWGRF_CONFIRMATION_TEXT :{YELLOW}Esti pe cale sa faci modificari intr-un joc activ. Aceasta poate destabiliza OpenTTD.{}Esti absolut sigur ca vrei sa faci asta?
+STR_NEWGRF_ERROR_MSG_INFO :{SILVER}{STRING}
+STR_NEWGRF_ERROR_MSG_WARNING :{RED}Atentie: {SILVER}{STRING}
+STR_NEWGRF_ERROR_MSG_ERROR :{RED}Eroare: {SILVER}{STRING}
+STR_NEWGRF_ERROR_MSG_FATAL :{RED}Fatal: {SILVER}{STRING}
+STR_NEWGRF_ERROR_VERSION_NUMBER :{STRING} nu va functiona cu versiunea TTDPatch raportata de OpenTTD.
+STR_NEWGRF_ERROR_DOS_OR_WINDOWS :{STRING} este pentru versiunea {STRING} a TTD.
+STR_NEWGRF_ERROR_UNSET_SWITCH :{STRING} este conceput pentru a fi folosit cu {STRING}
+STR_NEWGRF_ERROR_INVALID_PARAMETER :Parametru invalid pentru {STRING}: parametrul {STRING} ({NUM})
+STR_NEWGRF_ERROR_LOAD_BEFORE :{STRING} trebuie sa fie incarcat inaintea {STRING}.
+STR_NEWGRF_ERROR_LOAD_AFTER :{STRING} trebuie sa fie incarcat dupa {STRING}.
+
STR_NEWGRF_ADD :{BLACK}Adauga
STR_NEWGRF_ADD_TIP :{BLACK}Adauga un fisier NewGRF in lista
STR_NEWGRF_REMOVE :{BLACK}Elimina
@@ -2978,12 +2992,12 @@
STR_REPLACE_VEHICLES_STOP :{BLACK}Oprire inlocuire vehicuke
STR_NOT_REPLACING :{BLACK}Neinlocuire
STR_NOT_REPLACING_VEHICLE_SELECTED :{BLACK}Nici un vehicul selectat
-STR_REPLACE_HELP_LEFT_ARRAY :{BLACK}Alege tipul de vehicul pentru inlocuire
-STR_REPLACE_HELP_RIGHT_ARRAY :{BLACK}Alege noul tip de vehicul cu care doresti sa inlocuiesti tipul de vehicul din stanga
-STR_REPLACE_HELP_STOP_BUTTON :{BLACK}Apasa acest buton daca nu doresti sa inlocuiesti vehiculele selectate in stanga
-STR_REPLACE_HELP_START_BUTTON :{BLACK}Apasa acest buton daca doresti sa inlocuiesti vehiculele selectate in stanga cu cele selectate in dreapta
-STR_REPLACE_HELP_RAILTYPE :{BLACK}Alege un tip de cale ferata pentru care sa selectezi vehiculele
-STR_REPLACE_HELP_REPLACE_INFO_TAB :{BLACK}Afiseaza cu ce model vor fi inlocuite vehiculele din stanga
+STR_REPLACE_HELP_LEFT_ARRAY :{BLACK}Alege tipul de motor pentru inlocuire
+STR_REPLACE_HELP_RIGHT_ARRAY :{BLACK}Alege noul tip de motor pe care doresti sa-l folosesti in locul motorului selectat in stanga
+STR_REPLACE_HELP_STOP_BUTTON :{BLACK}Apasa aici pentru oprirea inlocuirii motorului selectat in stanga
+STR_REPLACE_HELP_START_BUTTON :{BLACK}Apasa aici pentru a incepe inlocuirea motorului selectat in stanga cu cel selectat in dreapta
+STR_REPLACE_HELP_RAILTYPE :{BLACK}Alege un tip de cale ferata pentru care sa inlocuiesti motoarele
+STR_REPLACE_HELP_REPLACE_INFO_TAB :{BLACK}Arata care va fi inlocuitorul motorului selectat in stanga
STR_REPLACE_HELP :{BLACK}Aceasta functie iti permite sa selectezi un model de vehicul si sa-l inlocuiesti cu altul. Schimbarea se va efectua automat la intrarea vehiculului intr-un depou.
STR_REPLACE_REMOVE_WAGON :{BLACK}Retragere vagoane: {ORANGE}{SKIP}{STRING}
STR_REPLACE_REMOVE_WAGON_HELP :{BLACK}Fã optiunea de autoînlocuire sã pãstreze identicã lungimea unui tren prin eliminarea vagoanelor (începând din fatã), dacã înlocuirea motorului ar face trenul mai lung.
@@ -3118,4 +3132,11 @@
STR_MEASURE_LENGTH_HEIGHTDIFF :{BLACK}Lungime: {NUM}{}Diferenta inaltime: {NUM} m
STR_MEASURE_AREA_HEIGHTDIFF :{BLACK}Suprafata: {NUM} x {NUM}{}Diferenta inaltime: {NUM} m
+############ Date formatting
+STR_DATE_TINY :{STRING}-{STRING}-{NUM}
+STR_DATE_SHORT :{STRING} {NUM}
+STR_DATE_LONG :{STRING} {STRING} {NUM}
+
########
+
+STR_FEEDER_CARGO_VALUE :{BLACK}Transfera Credit: {LTBLUE}{CURRENCY}
--- a/src/lang/russian.txt Sat Mar 10 11:07:13 2007 +0000
+++ b/src/lang/russian.txt Sun Mar 11 16:31:18 2007 +0000
@@ -1016,13 +1016,13 @@
STR_CONFIG_PATCHES_OFF :нет
STR_CONFIG_PATCHES_ON :да
STR_CONFIG_PATCHES_VEHICLESPEED :{LTBLUE}Показывать скорость в панели статуса транспорта: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_BUILDONSLOPES :{LTBLUE}Разрешить строительство на склонах и берегу: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_BUILDONSLOPES :{LTBLUE}Разрешить строительство на склонах и на берегу: {ORANGE}{STRING}
STR_CONFIG_PATCHES_CATCHMENT :{LTBLUE}Зона покрытия зависит от типа станции: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_EXTRADYNAMITE :{LTBLUE}Разрешить удаление всех принадлежащих городу объектов: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_EXTRADYNAMITE :{LTBLUE}Разрешить удаление всех городских объектов: {ORANGE}{STRING}
STR_CONFIG_PATCHES_MAMMOTHTRAINS :{LTBLUE}Разрешить строительство очень длинных поездов: {ORANGE}{STRING}
STR_CONFIG_PATCHES_REALISTICACCEL :{LTBLUE}Включить реалистичное ускорение для поездов: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_FORBID_90_DEG :{LTBLUE}Запретить резкие повороты поездам и кораблям: {ORANGE}{STRING} {LTBLUE}(NPF)
-STR_CONFIG_PATCHES_JOINSTATIONS :{LTBLUE}Объединять построенные рядом станции: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_FORBID_90_DEG :{LTBLUE}Запретить резкие повороты поездам и кораблям: {ORANGE}{STRING} {LTBLUE}(NPF/YAPF)
+STR_CONFIG_PATCHES_JOINSTATIONS :{LTBLUE}Объединять построенные рядом ж/д станции: {ORANGE}{STRING}
STR_CONFIG_PATCHES_FULLLOADANY :{LTBLUE}Покидать станцию, когда любой груз полностью загружен: {ORANGE}{STRING}
STR_CONFIG_PATCHES_IMPROVEDLOAD :{LTBLUE}Использовать улучшенный алгоритм загрузки: {ORANGE}{STRING}
STR_CONFIG_PATCHES_GRADUAL_LOADING :{LTBLUE}Постепенная загрузка транспорта: {ORANGE}{STRING}
@@ -1050,7 +1050,7 @@
STR_CONFIG_PATCHES_WARN_LOST_TRAIN :{LTBLUE}Предупреждать, если поезд заблудился: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ORDER_REVIEW :{LTBLUE}Проверять маршруты на правильность: {ORANGE}{STRING}
STR_CONFIG_PATCHES_ORDER_REVIEW_OFF :нет
-STR_CONFIG_PATCHES_ORDER_REVIEW_EXDEPOT :да, кроме остановленного транспорта
+STR_CONFIG_PATCHES_ORDER_REVIEW_EXDEPOT :кроме остановленного
STR_CONFIG_PATCHES_ORDER_REVIEW_ON :всего транспорта
STR_CONFIG_PATCHES_WARN_INCOME_LESS :{LTBLUE}Предупреждать, если поезд приносит убыток: {ORANGE}{STRING}
STR_CONFIG_PATCHES_NEVER_EXPIRE_VEHICLES :{LTBLUE}Транспорт никогда не устаревает: {ORANGE}{STRING}
@@ -1062,7 +1062,7 @@
STR_CONFIG_PATCHES_INVISIBLE_TREES :{LTBLUE}Убирать деревья при включении прозрачности зданий: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LAND_GENERATOR :{LTBLUE}Генератор земли: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :Оригинальный
+STR_CONFIG_PATCHES_LAND_GENERATOR_ORIGINAL :оригинальный
STR_CONFIG_PATCHES_LAND_GENERATOR_TERRA_GENESIS :TerraGenesis
STR_CONFIG_PATCHES_OIL_REF_EDGE_DISTANCE :{LTBLUE}Макс. расстояние от края карты до нефтепер. заводов: {ORANGE}{STRING}
STR_CONFIG_PATCHES_SNOWLINE_HEIGHT :{LTBLUE}Высота "снежной" линии: {ORANGE}{STRING}
@@ -1075,12 +1075,12 @@
STR_CONFIG_PATCHES_TREE_PLACER_NONE :Нет
STR_CONFIG_PATCHES_TREE_PLACER_ORIGINAL :Оригинальный
STR_CONFIG_PATCHES_TREE_PLACER_IMPROVED :Продвинутый
-STR_CONFIG_PATCHES_HEIGHTMAP_ROTATION :{LTBLUE}Вращение ЛАНДШАФТА: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_HEIGHTMAP_ROTATION_COUNTER_CLOCKWISE :Против часовой
-STR_CONFIG_PATCHES_HEIGHTMAP_ROTATION_CLOCKWISE :По часовой
+STR_CONFIG_PATCHES_HEIGHTMAP_ROTATION :{LTBLUE}Вращение карты высот: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_HEIGHTMAP_ROTATION_COUNTER_CLOCKWISE :Против часовой стрелки
+STR_CONFIG_PATCHES_HEIGHTMAP_ROTATION_CLOCKWISE :По часовой стрелке
STR_CONFIG_PATCHES_SE_FLAT_WORLD_HEIGHT :{LTBLUE}Уровень высоты для карт с плоским рельефом: {ORANGE}{STRING}
-STR_CONFIG_PATCHES_STATION_SPREAD :{LTBLUE}Протяженность станции: {ORANGE}{STRING} {RED}(большие значения замедляют игру)
+STR_CONFIG_PATCHES_STATION_SPREAD :{LTBLUE}Макс. протяженность: {ORANGE}{STRING} {RED}(большие значения замедляют игру)
STR_CONFIG_PATCHES_SERVICEATHELIPAD :{LTBLUE}Включить обслуживание на вертолетных площадках: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LINK_TERRAFORM_TOOLBAR :{LTBLUE}Открывать ландшафтную панель вместе с транспортными: {ORANGE}{STRING}
STR_CONFIG_PATCHES_REVERSE_SCROLLING :{LTBLUE}Обратить направление перетаскивания обзора: {ORANGE}{STRING}
@@ -1142,7 +1142,7 @@
STR_CONFIG_PATCHES_CURRENCY :{CURRENCY}
STR_CONFIG_PATCHES_QUERY_CAPT :{WHITE}Изменить значение
-STR_CONFIG_PATCHES_SERVICE_INTERVAL_INCOMPATIBLE :{WHITE}Некоторые из выбранных интервалов обслуживания не совместимы с выбранной установкой. Допускаются значения 5-90% или 30-800 дней.
+STR_CONFIG_PATCHES_SERVICE_INTERVAL_INCOMPATIBLE :{WHITE}Некоторые интервалы не совместимы с выбранной установкой. Допускаются значения 5-90% или 30-800 дней.
STR_CONFIG_PATCHES_YAPF_SHIPS :{LTBLUE}Использовать YAPF для кораблей: {ORANGE}{STRING}
STR_CONFIG_PATCHES_YAPF_ROAD :{LTBLUE}Использовать YAPF для автомобилей: {ORANGE}{STRING}
STR_CONFIG_PATCHES_YAPF_RAIL :{LTBLUE}Использовать YAPF для поездов: {ORANGE}{STRING}
@@ -1273,7 +1273,7 @@
TEMP_AI_IN_PROGRESS :{WHITE}Добро пожаловать в новый ИИ, он совершенствуется. Вы должны быть готовы к проблемам. Когда это случится, сделайте снимок и отправьте на форум. Наслаждайтесь!
TEMP_AI_ACTIVATED :{WHITE}Внимание: новый AI всё еще находится в состоянии альфа-версии! В настоящее время работает только с автотранспортом!
-TEMP_AI_MULTIPLAYER :{WHITE}Внимание: тестовое использование (новый ИИ). Пожалуйста, сообщайте обо всех проблемах на truelight@openttd.org.
+TEMP_AI_MULTIPLAYER :{WHITE}Внимание: экспериментальная эксплуатация нового AI. Пожалуйста, сообщайте обо всех проблемах на truelight@openttd.org.
############ network gui strings
@@ -2646,6 +2646,10 @@
STR_TRAIN_NO_POWER :{RED}Нет тока.
STR_TRAIN_START_NO_CATENARY :Кто-то украл все провода, поезд не может ехать...
+STR_NEW_VEHICLE_NOW_AVAILABLE :{BLACK}{BIGFONT}Появился новый {STRING}!
+STR_NEW_VEHICLE_TYPE :{BLACK}{BIGFONT}{STRING}
+STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}Появился новый {STRING}! - {STRING}
+
##id 0x9000
STR_9000_ROAD_VEHICLE_IN_THE_WAY :{WHITE}Машина на пути
STR_9001_ROAD_VEHICLES :{WHITE}{COMPANY} - {COMMA} Автомашин{P а ы ""}
@@ -3148,3 +3152,5 @@
STR_DATE_LONG :{STRING} {STRING} {NUM}
########
+
+STR_FEEDER_CARGO_VALUE :{BLACK}Выручка перевозки: {LTBLUE}{CURRENCY}
--- a/src/lang/simplified_chinese.txt Sat Mar 10 11:07:13 2007 +0000
+++ b/src/lang/simplified_chinese.txt Sun Mar 11 16:31:18 2007 +0000
@@ -280,6 +280,7 @@
STR_OSNAME_MORPHOS :MorphOS
STR_OSNAME_AMIGAOS :AmigaOS
STR_OSNAME_OS2 :OS/2
+STR_OSNAME_SUNOS :SunOS
STR_013B_OWNED_BY :{WHITE}归 {STRING} 所有
STR_013C_CARGO :{BLACK}货物
@@ -2633,6 +2634,10 @@
STR_TRAIN_NO_POWER :{RED}没有电力
STR_TRAIN_START_NO_CATENARY :这不是电气化铁路,电力机车不能启动
+STR_NEW_VEHICLE_NOW_AVAILABLE :{BLACK}{BIGFONT}新 {STRING} 上市了!
+STR_NEW_VEHICLE_TYPE :{BLACK}{BIGFONT}{STRING}
+STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}新 {STRING} 上市了! - {STRING}
+
##id 0x9000
STR_9000_ROAD_VEHICLE_IN_THE_WAY :{WHITE}指定的位置有汽车
STR_9001_ROAD_VEHICLES :{WHITE}{COMPANY} - {COMMA} 汽车
@@ -2893,6 +2898,17 @@
STR_NEWGRF_MD5SUM :{BLACK}MD5sum:{SILVER}{STRING}
STR_NEWGRF_CONFIRMATION_TEXT :{YELLOW}你将要改变一个正在运行的游戏,这可能导致该游戏崩溃,你确定要这样做吗?
+STR_NEWGRF_ERROR_MSG_INFO :{SILVER}{STRING}
+STR_NEWGRF_ERROR_MSG_WARNING :{RED}警告:{SILVER}{STRING}
+STR_NEWGRF_ERROR_MSG_ERROR :{RED}错误:{SILVER}{STRING}
+STR_NEWGRF_ERROR_MSG_FATAL :{RED}严重错误:{SILVER}{STRING}
+STR_NEWGRF_ERROR_VERSION_NUMBER :{STRING} 不能与 OpenTTD 报告的 TTDPatch 版本兼容。
+STR_NEWGRF_ERROR_DOS_OR_WINDOWS :{STRING} 是为 {STRING} 版 TTD 开发的。
+STR_NEWGRF_ERROR_UNSET_SWITCH :{STRING} 应当与 {STRING} 配合
+STR_NEWGRF_ERROR_INVALID_PARAMETER :{STRING} 参数错误:参数 {STRING} ({NUM})
+STR_NEWGRF_ERROR_LOAD_BEFORE :{STRING} 必须在 {STRING} 前加载。
+STR_NEWGRF_ERROR_LOAD_AFTER :{STRING} 必须在 {STRING} 后加载。
+
STR_NEWGRF_ADD :{BLACK}增加
STR_NEWGRF_ADD_TIP :{BLACK}向列表中增加一个 NewGRF 文件
STR_NEWGRF_REMOVE :{BLACK}删除
@@ -3118,4 +3134,11 @@
STR_MEASURE_LENGTH_HEIGHTDIFF :{BLACK}长度:{NUM}{}高度差:{NUM} 米
STR_MEASURE_AREA_HEIGHTDIFF :{BLACK}面积:{NUM} x {NUM}{}高度差:{NUM}米
+############ Date formatting
+STR_DATE_TINY :{STRING}-{STRING}-{NUM}
+STR_DATE_SHORT :{STRING} {NUM}
+STR_DATE_LONG :{STRING} {STRING} {NUM}
+
########
+
+STR_FEEDER_CARGO_VALUE :{BLACK}转运评分: {LTBLUE}{CURRENCY}
--- a/src/lang/slovak.txt Sat Mar 10 11:07:13 2007 +0000
+++ b/src/lang/slovak.txt Sun Mar 11 16:31:18 2007 +0000
@@ -560,36 +560,36 @@
############ range for days starts
STR_01AC_1ST :1.
-STR_01AD_2ND :2/
-STR_01AE_3RD :3/
-STR_01AF_4TH :4/
-STR_01B0_5TH :5/
-STR_01B1_6TH :6/
-STR_01B2_7TH :7/
-STR_01B3_8TH :8/
-STR_01B4_9TH :9/
-STR_01B5_10TH :10/
-STR_01B6_11TH :11/
-STR_01B7_12TH :12/
-STR_01B8_13TH :13/
-STR_01B9_14TH :14/
-STR_01BA_15TH :15/
-STR_01BB_16TH :16/
-STR_01BC_17TH :17/
-STR_01BD_18TH :18/
-STR_01BE_19TH :19/
-STR_01BF_20TH :20/
-STR_01C0_21ST :21/
-STR_01C1_22ND :22/
-STR_01C2_23RD :23/
-STR_01C3_24TH :24/
-STR_01C4_25TH :25/
-STR_01C5_26TH :26/
-STR_01C6_27TH :27/
-STR_01C7_28TH :28/
-STR_01C8_29TH :29/
-STR_01C9_30TH :30/
-STR_01CA_31ST :31/
+STR_01AD_2ND :2.
+STR_01AE_3RD :3.
+STR_01AF_4TH :4.
+STR_01B0_5TH :5.
+STR_01B1_6TH :6.
+STR_01B2_7TH :7.
+STR_01B3_8TH :8.
+STR_01B4_9TH :9.
+STR_01B5_10TH :10.
+STR_01B6_11TH :11.
+STR_01B7_12TH :12.
+STR_01B8_13TH :13.
+STR_01B9_14TH :14.
+STR_01BA_15TH :15.
+STR_01BB_16TH :16.
+STR_01BC_17TH :17.
+STR_01BD_18TH :18.
+STR_01BE_19TH :19.
+STR_01BF_20TH :20.
+STR_01C0_21ST :21.
+STR_01C1_22ND :22.
+STR_01C2_23RD :23.
+STR_01C3_24TH :24.
+STR_01C4_25TH :25.
+STR_01C5_26TH :26.
+STR_01C6_27TH :27.
+STR_01C7_28TH :28.
+STR_01C8_29TH :29.
+STR_01C9_30TH :30.
+STR_01CA_31ST :31.
############ range for days ends
STR_01CB :{TINYFONT}{COMMA}
@@ -2697,6 +2697,10 @@
STR_TRAIN_NO_POWER :{RED}Nie je prud
STR_TRAIN_START_NO_CATENARY :Vlak nemoze nastartovat, pretoze trat nie je pripojena
+STR_NEW_VEHICLE_NOW_AVAILABLE :{BLACK}{BIGFONT}Nové {STRING} dostupné!
+STR_NEW_VEHICLE_TYPE :{BLACK}{BIGFONT}{STRING}
+STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}Nové {STRING} dostupné! - {STRING}
+
##id 0x9000
STR_9000_ROAD_VEHICLE_IN_THE_WAY :{WHITE}Automobil v ceste
STR_9001_ROAD_VEHICLES :{WHITE}{COMPANY} - {COMMA} Automobil{P "" y ov}
@@ -3199,3 +3203,5 @@
STR_DATE_LONG :{STRING} {STRING} {NUM}
########
+
+STR_FEEDER_CARGO_VALUE :{BLACK}Transfer kredity: {LTBLUE}{CURRENCY}
--- a/src/lang/slovenian.txt Sat Mar 10 11:07:13 2007 +0000
+++ b/src/lang/slovenian.txt Sun Mar 11 16:31:18 2007 +0000
@@ -322,6 +322,7 @@
STR_OSNAME_MORPHOS :MorphOS
STR_OSNAME_AMIGAOS :AmigaOS
STR_OSNAME_OS2 :OS/2
+STR_OSNAME_SUNOS :SunOS
STR_013B_OWNED_BY :{WHITE} ... v lasti {STRING}
STR_013C_CARGO :{BLACK}Tovor
@@ -2713,6 +2714,10 @@
STR_TRAIN_NO_POWER :{RED}Ni napetosti
STR_TRAIN_START_NO_CATENARY :Ta proga nima napetostnih vodov, zato vlak ne more z mesta
+STR_NEW_VEHICLE_NOW_AVAILABLE :{BLACK}{BIGFONT}Novo! {STRING} sedaj na razpolago!
+STR_NEW_VEHICLE_TYPE :{BLACK}{BIGFONT}{STRING}
+STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}Novo! {STRING} sedaj na razpolago! - {STRING}
+
##id 0x9000
STR_9000_ROAD_VEHICLE_IN_THE_WAY :{WHITE}Cestno vozilo na poti
STR_9001_ROAD_VEHICLES :{WHITE}{COMPANY} - {COMMA} Cestn{P o i a ih} vozil{P o i a ""}
@@ -3215,3 +3220,5 @@
STR_DATE_LONG :{STRING} {STRING} {NUM}
########
+
+STR_FEEDER_CARGO_VALUE :{BLACK}Prenesi kredite: {LTBLUE}{CURRENCY}
--- a/src/lang/spanish.txt Sat Mar 10 11:07:13 2007 +0000
+++ b/src/lang/spanish.txt Sun Mar 11 16:31:18 2007 +0000
@@ -281,6 +281,7 @@
STR_OSNAME_MORPHOS :MorphOS
STR_OSNAME_AMIGAOS :AmigaOS
STR_OSNAME_OS2 :OS/2
+STR_OSNAME_SUNOS :SunOS
STR_013B_OWNED_BY :{WHITE}...propiedad de {STRING}
STR_013C_CARGO :{BLACK}Carga
@@ -2634,6 +2635,10 @@
STR_TRAIN_NO_POWER :{RED}Sin potencia
STR_TRAIN_START_NO_CATENARY :Esta vía carece la catenaria, así que el tren no puede comenzar
+STR_NEW_VEHICLE_NOW_AVAILABLE :{BLACK}{BIGFONT}Nuevo{STRING} ahora disponible!
+STR_NEW_VEHICLE_TYPE :{BLACK}{BIGFONT}{STRING}
+STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}Nuevo {STRING} ahora disponible! - {STRING}
+
##id 0x9000
STR_9000_ROAD_VEHICLE_IN_THE_WAY :{WHITE}Vehículo de carretera en camino
STR_9001_ROAD_VEHICLES :{WHITE}{COMPANY} - {COMMA} Vehículos de Carretera
@@ -3136,3 +3141,5 @@
STR_DATE_LONG :{STRING} {STRING} {NUM}
########
+
+STR_FEEDER_CARGO_VALUE :{BLACK}Transferir Créditos: {LTBLUE}{CURRENCY}
--- a/src/lang/swedish.txt Sat Mar 10 11:07:13 2007 +0000
+++ b/src/lang/swedish.txt Sun Mar 11 16:31:18 2007 +0000
@@ -280,6 +280,7 @@
STR_OSNAME_MORPHOS :MorphOS
STR_OSNAME_AMIGAOS :AmigaOS
STR_OSNAME_OS2 :OS/2
+STR_OSNAME_SUNOS :SunOS
STR_013B_OWNED_BY :{WHITE}...ägs av {STRING}
STR_013C_CARGO :{BLACK}Gods
@@ -2633,6 +2634,10 @@
STR_TRAIN_NO_POWER :{RED}Ingen Kraft
STR_TRAIN_START_NO_CATENARY :Detta spår saknar kedjekurva, så tåget kan inte starta
+STR_NEW_VEHICLE_NOW_AVAILABLE :{BLACK}{BIGFONT}Nya {STRING} är nu tillgänglig!
+STR_NEW_VEHICLE_TYPE :{BLACK}{BIGFONT}{STRING}
+STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}Nya {STRING} är nu tillgänglig - {STRING}
+
##id 0x9000
STR_9000_ROAD_VEHICLE_IN_THE_WAY :{WHITE}Vägfordon i vägen
STR_9001_ROAD_VEHICLES :{WHITE}{COMPANY} - {COMMA} Vägfordon
@@ -3135,3 +3140,5 @@
STR_DATE_LONG :{STRING} {STRING} {NUM}
########
+
+STR_FEEDER_CARGO_VALUE :{BLACK}Överföringingskredit: {LTBLUE}{CURRENCY}
--- a/src/lang/traditional_chinese.txt Sat Mar 10 11:07:13 2007 +0000
+++ b/src/lang/traditional_chinese.txt Sun Mar 11 16:31:18 2007 +0000
@@ -280,6 +280,7 @@
STR_OSNAME_MORPHOS :MorphOS
STR_OSNAME_AMIGAOS :AmigaOS
STR_OSNAME_OS2 :OS/2
+STR_OSNAME_SUNOS :SunOS
STR_013B_OWNED_BY :{WHITE}...已被{STRING}擁有
STR_013C_CARGO :{BLACK}貨物
@@ -2633,6 +2634,10 @@
STR_TRAIN_NO_POWER :{RED}沒有電力
STR_TRAIN_START_NO_CATENARY :這個軌道沒有電氣化,所以列車無法起動
+STR_NEW_VEHICLE_NOW_AVAILABLE :{BLACK}{BIGFONT}{STRING} 問世了!
+STR_NEW_VEHICLE_TYPE :{BLACK}{BIGFONT}{STRING}
+STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}{STRING} 問世了! - {STRING}
+
##id 0x9000
STR_9000_ROAD_VEHICLE_IN_THE_WAY :{WHITE}前方有汽車
STR_9001_ROAD_VEHICLES :{WHITE}{COMPANY} - 汽車 {COMMA} 輛
@@ -2902,6 +2907,7 @@
STR_NEWGRF_ERROR_UNSET_SWITCH :{STRING} 必須跟 {STRING} 一起使用
STR_NEWGRF_ERROR_INVALID_PARAMETER : {STRING} 的參數無效: {STRING} ({NUM})
STR_NEWGRF_ERROR_LOAD_BEFORE :載入前 {1:STRING} 必須先載入 {0:STRING}。
+STR_NEWGRF_ERROR_LOAD_AFTER :{STRING} 必須在 {STRING} 之後載入。
STR_NEWGRF_ADD :{BLACK}新增
STR_NEWGRF_ADD_TIP :{BLACK}為清單加入新的 NewGRF 檔
@@ -3129,5 +3135,10 @@
STR_MEASURE_AREA_HEIGHTDIFF :{BLACK}區域: {NUM} x {NUM}{}高度差: {NUM} m
############ Date formatting
+STR_DATE_TINY :{STRING}-{STRING}-{NUM}
+STR_DATE_SHORT :{STRING} {NUM}
+STR_DATE_LONG :{STRING} {STRING} {NUM}
########
+
+STR_FEEDER_CARGO_VALUE :{BLACK}轉運進帳: {LTBLUE}{CURRENCY}
--- a/src/lang/ukrainian.txt Sat Mar 10 11:07:13 2007 +0000
+++ b/src/lang/ukrainian.txt Sun Mar 11 16:31:18 2007 +0000
@@ -406,6 +406,7 @@
STR_OSNAME_MORPHOS :MorphOS
STR_OSNAME_AMIGAOS :AmigaOS
STR_OSNAME_OS2 :OS/2
+STR_OSNAME_SUNOS :SunOS
STR_013B_OWNED_BY :{WHITE}...власність {STRING}
STR_013C_CARGO :{BLACK}Вантаж
@@ -2361,6 +2362,8 @@
STR_LIVERY_ELECTRIC :Електричні потяги
STR_LIVERY_MONORAIL :Монорельс
STR_LIVERY_MAGLEV :Потяги на магнітній подушці
+STR_LIVERY_DMU :DMU
+STR_LIVERY_EMU :EMU
STR_LIVERY_PASSENGER_WAGON_STEAM :Пасажирський вагон (пар)
STR_LIVERY_PASSENGER_WAGON_DIESEL :Пасажирський вагон (дизель)
STR_LIVERY_PASSENGER_WAGON_ELECTRIC :Пасажирський вагон (електричка)
@@ -2794,6 +2797,10 @@
STR_TRAIN_NO_POWER :{RED}Неелектрифіковано
STR_TRAIN_START_NO_CATENARY :Нема електрики, поїзд стоїть
+STR_NEW_VEHICLE_NOW_AVAILABLE :{BLACK}{BIGFONT}Став доступним новий {STRING}!
+STR_NEW_VEHICLE_TYPE :{BLACK}{BIGFONT}{STRING}
+STR_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE :{BLACK}Став доступним новий {STRING}! - {STRING}
+
##id 0x9000
STR_9000_ROAD_VEHICLE_IN_THE_WAY :{WHITE}На шляху авто
STR_9001_ROAD_VEHICLES :{WHITE}{COMPANY} - {COMMA} автомобіл{P ь і ів}
@@ -3296,3 +3303,5 @@
STR_DATE_LONG :{STRING} {STRING} {NUM}
########
+
+STR_FEEDER_CARGO_VALUE :{BLACK}Дохід перевезень: {LTBLUE}{CURRENCY}
--- a/src/lang/unfinished/croatian.txt Sat Mar 10 11:07:13 2007 +0000
+++ b/src/lang/unfinished/croatian.txt Sun Mar 11 16:31:18 2007 +0000
@@ -114,6 +114,7 @@
STR_QUANTITY_TOFFEE :{WEIGHT} mliječne karamele
STR_QUANTITY_BATTERIES :{COMMA} baterij{P a e a}
STR_QUANTITY_PLASTIC :{VOLUME} plastike
+STR_QUANTITY_FIZZY_DRINKS :{COMMA} Gaziran{P o a a} pić{P e a a}
STR_ABBREV_NOTHING :
STR_ABBREV_PASSENGERS :{TINYFONT}PU
STR_ABBREV_COAL :{TINYFONT}UG
@@ -142,8 +143,10 @@
STR_ABBREV_COLA :{TINYFONT}CL
STR_ABBREV_CANDYFLOSS :{TINYFONT}ŠV
STR_ABBREV_BUBBLES :{TINYFONT}BL
+STR_ABBREV_TOFFEE :{TINYFONT}MČ
STR_ABBREV_BATTERIES :{TINYFONT}BA
STR_ABBREV_PLASTIC :{TINYFONT}PL
+STR_ABBREV_FIZZY_DRINKS :{TINYFONT}GP
STR_ABBREV_NONE :{TINYFONT}NI
STR_ABBREV_ALL :{TINYFONT}SVE
STR_00AE :{WHITE}{DATE_SHORT}
@@ -278,6 +281,7 @@
STR_OSNAME_MORPHOS :MorphOS
STR_OSNAME_AMIGAOS :AmigaOS
STR_OSNAME_OS2 :OS/2
+STR_OSNAME_SUNOS :SunOS
STR_013B_OWNED_BY :{WHITE}...u vlasništvu {STRING}
STR_013C_CARGO :{BLACK}Teret
@@ -392,10 +396,17 @@
STR_NO_WAITING_CARGO :{BLACK}Nijedna vrsta tereta ne čeka
STR_SELECT_ALL_FACILITIES :{BLACK}Izaberi sva sredstva
STR_SELECT_ALL_TYPES :{BLACK}Izaberi sve vrste tereta (uključujući i teret koji ne čeka)
+STR_AVAILABLE_TRAINS :{BLACK}Dostupni vlakovi
+STR_AVAILABLE_ROAD_VEHICLES :{BLACK}Dostupna vozila
+STR_AVAILABLE_SHIPS :{BLACK}Dostupni brodovi
+STR_AVAILABLE_AIRCRAFT :{BLACK}Dostupni zrakoplovi
STR_AVAILABLE_ENGINES_TIP :{BLACK}Pogledaj popis dostupnih dizajna motora za ovu vrstu vozila.
STR_MANAGE_LIST :{BLACK}Uredi popis
STR_MANAGE_LIST_TIP :{BLACK}Pošalji upute svim vozilima na ovoj listi
STR_REPLACE_VEHICLES :Zamjeni vozila
+STR_SEND_TRAIN_TO_DEPOT :Pošalji u spremište
+STR_SEND_ROAD_VEHICLE_TO_DEPOT :
+STR_SEND_SHIP_TO_DEPOT :
STR_SEND_AIRCRAFT_TO_HANGAR :Pošalji u hangar
STR_SEND_FOR_SERVICING :Pošalji na servis
@@ -717,6 +728,7 @@
STR_0291_DELETE_THIS_TOWN_COMPLETELY :{BLACK}Obriši ovaj grad u cjelosti
STR_0292_SAVE_SCENARIO :Spremi scenarij
STR_0293_LOAD_SCENARIO :Učitaj secenarij
+STR_LOAD_HEIGHTMAP :Učitaj visinsku kartu
STR_0294_QUIT_EDITOR :Završi s uređivanjem
STR_0295 :
STR_0296_QUIT :Završi
@@ -962,6 +974,7 @@
STR_TRAIN_IS_LOST :{WHITE}Vlak {COMMA} se izgubio.
STR_TRAIN_IS_UNPROFITABLE :{WHITE}Prošlogodišnja zarada vlaka {COMMA} bila je {CURRENCY}
+STR_EURO_INTRODUCE :{BLACK}{BIGFONT}Europska Monetarna Unija!{}{}Euro je predstavljen kao jedinstvena valuta za svakodnevnu uporabu u tvojoj zemlji!
# Start of order review system.
# DON'T ADD OR REMOVE LINES HERE
@@ -983,7 +996,9 @@
STR_AIRCRAFT_HAS_INVALID_ENTRY :{WHITE}Zrakoplov {COMMA} ima nevažeću stanicu u voznom redu
# end of order system
+STR_TRAIN_AUTORENEW_FAILED :{WHITE}Neuspješna automatska obnova vlaka {COMMA} (ograničena količina novca)
STR_ROADVEHICLE_AUTORENEW_FAILED :{WHITE}Automatska zamjena nije izvršena na cestovnom vozilu {COMMA} (money limit)
+STR_SHIP_AUTORENEW_FAILED :{WHITE}Neuspješna automatska obnova broda {COMMA} (ograničena količina novca)
STR_AIRCRAFT_AUTORENEW_FAILED :{WHITE}Neuspjela automatska zamjena zrakoplova {COMMA} (novčano ograničenje)
STR_TRAIN_TOO_LONG_AFTER_REPLACEMENT :{WHITE}Nakon zamjene, vlak {COMMA} je postao predug
@@ -1000,10 +1015,13 @@
STR_CONFIG_PATCHES_REALISTICACCEL :{LTBLUE}Omogući realno ubrzanje za vlakove: {ORANGE}{STRING}
STR_CONFIG_PATCHES_FORBID_90_DEG :{LTBLUE}Zabrani vlakovima i brodovima skretanja pod 90 stupnjeva: {ORANGE}{STRING} {LTBLUE} (requires NPF)
STR_CONFIG_PATCHES_JOINSTATIONS :{LTBLUE}Spoji željezničke stanice koje se izgrade jedna kraj druge: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_FULLLOADANY :{LTBLUE}Napusti stanicu ako je bilo koji teret u potpunosti natovaren pri 'punom utovaru': {ORANGE}{STRING}
STR_CONFIG_PATCHES_IMPROVEDLOAD :{LTBLUE}Koristi unaprijeđen algoritam ukrcavanja: {ORANGE}{STRING}
STR_CONFIG_PATCHES_GRADUAL_LOADING :{LTBLUE}Postupno utovaruj vozila: {ORANGE}{STRING}
STR_CONFIG_PATCHES_INFLATION :{LTBLUE}Inflacija: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_SELECTGOODS :{LTBLUE}Dostavi teret u stanicu samo ako u njoj postoji potražnja: {ORANGE}{STRING}
STR_CONFIG_PATCHES_LONGBRIDGES :{LTBLUE}Dopusti izgradnju vrlo dugačkih mostova: {ORANGE}{STRING}
+STR_CONFIG_PATCHES_GOTODEPOT :{LTBLUE}Dopusti naredbe za slanje u spremište: {ORANGE}{STRING}
STR_CONFIG_PATCHES_BUILDXTRAIND :{LTBLUE}Dopusti izgadnju industrija koje proizvode sirovine: {ORANGE}{STRING}
STR_CONFIG_PATCHES_MULTIPINDTOWN :{LTBLUE}Dopusti više sličnih industrija po gradu: {ORANGE}{STRING}
STR_CONFIG_PATCHES_SAMEINDCLOSE :{LTBLUE}Moguće je graditi spojene industrije iste vrste: {ORANGE}{STRING}
@@ -1670,6 +1688,7 @@
STR_3031_CAN_T_RENAME_STATION :{WHITE}Ne možeš preimenovati stanicu...
STR_3032_RATINGS :{BLACK}Ocjene
STR_3033_ACCEPTS :{BLACK}Prihvaća
+STR_3034_LOCAL_RATING_OF_TRANSPORT :{BLACK}Lokalna ocjena usluge prijevoza:
############ range for rating starts
STR_3035_APPALLING :Užasno
@@ -1689,24 +1708,24 @@
STR_3041_NOW_ACCEPTS_AND :{WHITE}{STATION} od sada prihvaća {STRING} i {STRING}
STR_3042_BUS_STATION_ORIENTATION :{WHITE}Smjer autobusne stanice
STR_3043_TRUCK_STATION_ORIENT :{WHITE}Smjer kamionskog terminala
-STR_3046_MUST_DEMOLISH_BUS_STATION :{WHITE}Moraš uništiti autobusnu stanicu prvo
-STR_3047_MUST_DEMOLISH_TRUCK_STATION :{WHITE}Moraš uništiti kamionski terminal prvo
-STR_3048_STATIONS :{WHITE}{COMPANY} - {COMMA} Station{P a e a}
+STR_3046_MUST_DEMOLISH_BUS_STATION :{WHITE}Prvo moraš uništiti autobusnu stanicu
+STR_3047_MUST_DEMOLISH_TRUCK_STATION :{WHITE}Prvo moraš uništiti kamionski terminal
+STR_3048_STATIONS :{WHITE}{COMPANY} - {COMMA} Stanic{P a e a}
STR_3049_0 :{YELLOW}{STATION} {STATIONFEATURES}
STR_304A_NONE :{YELLOW}- Ništa -
-STR_304B_SITE_UNSUITABLE :{WHITE}...mjesto neprikladno
+STR_304B_SITE_UNSUITABLE :{WHITE}...neprikladno mjesto
STR_304C_TOO_CLOSE_TO_ANOTHER_DOCK :{WHITE}Preblizu drugom pristaništu
STR_304D_MUST_DEMOLISH_DOCK_FIRST :{WHITE}Prvo moraš srušiti pristanište
STR_304E_SELECT_RAILROAD_STATION :{BLACK}Izaberi smjer željezničke stanice
-STR_304F_SELECT_NUMBER_OF_PLATFORMS :{BLACK}Izaberi broj platformi na željezničkoj stanici
+STR_304F_SELECT_NUMBER_OF_PLATFORMS :{BLACK}Izaberi broj perona na željezničkoj stanici
STR_3050_SELECT_LENGTH_OF_RAILROAD :{BLACK}Izaberi dužinu željezničke stanice
STR_3051_SELECT_BUS_STATION_ORIENTATION :{BLACK}Izaberi smjer autobusne stanice
STR_3052_SELECT_TRUCK_LOADING_BAY :{BLACK}Izaberi smjer kamionskog terminala
STR_3053_CENTER_MAIN_VIEW_ON_STATION :{BLACK}Centriraj glavni pogled na lokaciju stanice
-STR_3054_SHOW_STATION_RATINGS :{BLACK}Pokazi ocjene stanice
+STR_3054_SHOW_STATION_RATINGS :{BLACK}Pokaži ocjene stanice
STR_3055_CHANGE_NAME_OF_STATION :{BLACK}Promijeni ime stanice
STR_3056_SHOW_LIST_OF_ACCEPTED_CARGO :{BLACK}Prikaži popis prihvaćenog tereta
-STR_3057_STATION_NAMES_CLICK_ON :{BLACK}Imena stanica - klikni na ime kako bi centrirao glavni pogled na stanicu
+STR_3057_STATION_NAMES_CLICK_ON :{BLACK}Imena stanica - pritisni ime da bi centrirao glavni pogled na stanicu
STR_3058_SELECT_SIZE_TYPE_OF_AIRPORT :{BLACK}Izaberi veličinu/tip zračne luke
STR_305C_0 :{STATION} {STATIONFEATURES}
STR_STATION_SIGN_TINY :{TINYFONT}{STATION}
@@ -1716,11 +1735,14 @@
STR_3061_TRUCK_LOADING_AREA :Ukrcajno područje
STR_3062_BUS_STATION :Autobusna stanica
STR_3063_SHIP_DOCK :Brodsko pristanište
+STR_3064_HIGHLIGHT_COVERAGE_AREA :{BLACK}Označi područje koje pokriva željeno mjesto
+STR_3065_DON_T_HIGHLIGHT_COVERAGE :{BLACK}Nemoj označiti područje koje pokriva željeno mjesto
+STR_3066_COVERAGE_AREA_HIGHLIGHT :{BLACK}Označavanje područja pokrivanja
STR_3068_DOCK :{WHITE}Pristanište
STR_3069_BUOY :Plutača
STR_306A_BUOY_IN_THE_WAY :{WHITE}...plutača na putu
STR_306C_STATION_TOO_SPREAD_OUT :{WHITE}...stanica previše proširena
-STR_306D_NONUNIFORM_STATIONS_DISALLOWED :{WHITE}...neuniformne stanice zabranjene
+STR_306D_NONUNIFORM_STATIONS_DISALLOWED :{WHITE}...neujednačene stanice onemogućene
STR_USE_CTRL_TO_SELECT_MORE :{BLACK}Drži CTRL kako bi izabrao više od jednog itema
STR_UNDEFINED :(neodređen znakovni niz)
@@ -1730,8 +1752,8 @@
##id 0x3800
STR_3800_SHIP_DEPOT_ORIENTATION :{WHITE}Smjer brodskog spremišta
STR_3801_MUST_BE_BUILT_ON_WATER :{WHITE}...mora biti izgrađen na vodi
-STR_3802_CAN_T_BUILD_SHIP_DEPOT :{WHITE}Ne možeš graditi brodsko spremište ovdje...
-STR_3803_SELECT_SHIP_DEPOT_ORIENTATION :{BLACK}Izaberi smjer brodsko spremišta
+STR_3802_CAN_T_BUILD_SHIP_DEPOT :{WHITE}Ovdje ne možeš graditi brodsko spremište...
+STR_3803_SELECT_SHIP_DEPOT_ORIENTATION :{BLACK}Izaberi smjer brodskog spremišta
STR_3804_WATER :Voda
STR_3805_COAST_OR_RIVERBANK :Obala ili riječni nasip
STR_3806_SHIP_DEPOT :Brodsko spremište
@@ -1743,7 +1765,7 @@
STR_4002_SAVE :{BLACK}Spremi
STR_4003_DELETE :{BLACK}Obriši
STR_4004 :{COMPANY}, {DATE_LONG}
-STR_4005_BYTES_FREE :{BLACK}{COMMA} megabajt{P "" a a} free
+STR_4005_BYTES_FREE :{BLACK}{COMMA} megabajt{P "" a a} slobod{P an na no}
STR_4006_UNABLE_TO_READ_DRIVE :{BLACK}Ne mogu pročitati disk
STR_4007_GAME_SAVE_FAILED :{WHITE}Spremanje igre nije uspjelo
STR_4008_UNABLE_TO_DELETE_FILE :{WHITE}Ne mogu obrisati datoteku
@@ -1754,7 +1776,7 @@
STR_400D_SAVE_THE_CURRENT_GAME_USING :{BLACK}Spremi ovu igru, koristeći odabrano ime
STR_400E_SELECT_NEW_GAME_TYPE :{WHITE}Odaberi vrstu nove igre
STR_400F_SELECT_SCENARIO_GREEN_PRE :{BLACK}Odaberi scenarij (zeleno), namještenu igru (plavo), ili nasumičnu novu igru
-STR_4010_GENERATE_RANDOM_NEW_GAME :Generiraj nasumičnu novu igru
+STR_4010_GENERATE_RANDOM_NEW_GAME :Izradi nasumičnu novu igru
STR_4011_LOAD_HEIGHTMAP :{WHITE}Učitaj visinsku kartu
##id 0x4800
@@ -1806,21 +1828,21 @@
STR_482A_PRODUCTION_LAST_MONTH :{BLACK}Prošlomjesečna proizvodnja:
STR_482B_TRANSPORTED :{YELLOW}{CARGO}{BLACK} ({COMMA}% prevezeno)
-STR_482C_CENTER_THE_MAIN_VIEW_ON :{BLACK}Centriraj glavni pogled na lokaciju gospodarstva
-STR_482D_NEW_UNDER_CONSTRUCTION :{BLACK}{BIGFONT}Nova {STRING} pod konstrukcijom blizu grada {TOWN}!
-STR_482E_NEW_BEING_PLANTED_NEAR :{BLACK}{BIGFONT}Nova {STRING} se trenutno sadi blizu grada {TOWN}!
+STR_482C_CENTER_THE_MAIN_VIEW_ON :{BLACK}Centriraj glavni pogled na položaj industrije
+STR_482D_NEW_UNDER_CONSTRUCTION :{BLACK}{BIGFONT}Započela je izgradnja nove industrije ( {STRING} ) u blizini grada {TOWN}!
+STR_482E_NEW_BEING_PLANTED_NEAR :{BLACK}{BIGFONT}Nova {STRING} trenutno se sadi blizu grada {TOWN}!
STR_482F_COST :{BLACK}Trošak: {YELLOW}{CURRENCY}
-STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY :{WHITE}Ne možeš konstruirati ovaj tip gospodarstva ovdje...
+STR_4830_CAN_T_CONSTRUCT_THIS_INDUSTRY :{WHITE}Ovdje ne možeš izgraditi ovu vrstu industrije ovdje...
STR_4831_FOREST_CAN_ONLY_BE_PLANTED :{WHITE}...šume mogu jedino biti posađene iznad linije snijega
STR_4832_ANNOUNCES_IMMINENT_CLOSURE :{BLACK}{BIGFONT}{INDUSTRY} objavljuje skoro zatvaranje!
-STR_4833_SUPPLY_PROBLEMS_CAUSE_TO :{BLACK}{BIGFONT}Nabavni problemi uzrokuju {INDUSTRY} da objavi skoro zatvaranje!
-STR_4834_LACK_OF_NEARBY_TREES_CAUSES :{BLACK}{BIGFONT}Manjak drveća u blizini uzrokuje {INDUSTRY} da objavi skoro zatvaranje!
-STR_4835_INCREASES_PRODUCTION :{BLACK}{BIGFONT}{INDUSTRY} povećava produkciju!
-STR_4836_NEW_COAL_SEAM_FOUND_AT :{BLACK}{BIGFONT}Nova pukotina ugljena pronađena kod {INDUSTRY}!{}Očekuje se udvostručenje proizvodnje!
-STR_4837_NEW_OIL_RESERVES_FOUND :{BLACK}{BIGFONT}Nove rezerve nafte pronađene kod:{INDUSTRY}!{}Očekuje se udvostručenje proizvodnje!
-STR_4838_IMPROVED_FARMING_METHODS :{BLACK}{BIGFONT}Poboljšane metode uzgoja u {INDUSTRY}, očekuje se udvostručenje proizvodnje!
-STR_4839_PRODUCTION_DOWN_BY_50 :{BLACK}{BIGFONT}{INDUSTRY} proizvodnja pala za 50%
-STR_483A_INSECT_INFESTATION_CAUSES :{BLACK}{BIGFONT}Najezda kukaca uzrokovala havariju kod {INDUSTRY}!{}Proizvodnja pala za 50%
+STR_4833_SUPPLY_PROBLEMS_CAUSE_TO :{BLACK}{BIGFONT}Zbog problema u nabavi {INDUSTRY} se uskoro zatvara!
+STR_4834_LACK_OF_NEARBY_TREES_CAUSES :{BLACK}{BIGFONT}Manjak drveća u glavni je razlog što se {INDUSTRY} se uskoro zatvara!
+STR_4835_INCREASES_PRODUCTION :{BLACK}{BIGFONT}{INDUSTRY} povećava proizvodnju!
+STR_4836_NEW_COAL_SEAM_FOUND_AT :{BLACK}{BIGFONT}{INDUSTRY} očekuje udvostručenje proizvodnje!{}Pronađena je nova pukotina ugljena!
+STR_4837_NEW_OIL_RESERVES_FOUND :{BLACK}{BIGFONT}{INDUSTRY} očekuje udvostručenje proizvodnje!{}Pronađene su nove rezerve nafte!
+STR_4838_IMPROVED_FARMING_METHODS :{BLACK}{BIGFONT}{INDUSTRY} poboljšava metode uzgoja, očekuje se udvostručenje proizvodnje!
+STR_4839_PRODUCTION_DOWN_BY_50 :{BLACK}{BIGFONT}{INDUSTRY} smanjuje proizvodnju za 50%
+STR_483A_INSECT_INFESTATION_CAUSES :{BLACK}{BIGFONT}{INDUSTRY} pod najezdom kukaca! Havarija!{}Proizvodnja je pala za 50%
STR_483B_CAN_ONLY_BE_POSITIONED :{WHITE}...može se postaviti samo blizu rubova karte
STR_INDUSTRY_PROD_GOUP :{BLACK}{BIGFONT}{STRING} prozivodnja u {INDUSTRY} povećana je {COMMA}%!
STR_INDUSTRY_PROD_GODOWN :{BLACK}{BIGFONT}{STRING} prozivodnja u {INDUSTRY} smanjena je {COMMA}%!
@@ -1829,7 +1851,7 @@
STR_5000_TRAIN_IN_TUNNEL :{WHITE}Vlak u tunelu
STR_5001_ROAD_VEHICLE_IN_TUNNEL :{WHITE}Cestovno vozilo u tunelu
STR_5003_ANOTHER_TUNNEL_IN_THE_WAY :{WHITE}Smeta drugi tunel
-STR_5005_UNABLE_TO_EXCAVATE_LAND :{WHITE}Ne mogu iskopoati zemlju na drugoj strani tunela
+STR_5005_UNABLE_TO_EXCAVATE_LAND :{WHITE}Ne moguće iskopoati zemlju na drugoj strani tunela
STR_5006_MUST_DEMOLISH_TUNNEL_FIRST :{WHITE}Moraš prvo srušiti tunel
STR_5007_MUST_DEMOLISH_BRIDGE_FIRST :{WHITE}Moraš prvo srušiti most
STR_5008_CANNOT_START_AND_END_ON :{WHITE}Početak i kraj ne mogu biti na istom mjestu
@@ -2418,6 +2440,7 @@
STR_TRAIN_STOPPING :{RED}Zaustavljam
STR_TRAIN_STOPPING_VEL :{RED}Zaustavljam, {VELOCITY}
+
##id 0x9000
STR_9000_ROAD_VEHICLE_IN_THE_WAY :{WHITE}Cestovno vozilo na putu
STR_9002 :{WHITE}{VEHICLE}
@@ -2455,12 +2478,12 @@
STR_9023_BUILD_NEW_ROAD_VEHICLE :{BLACK}Izgradi novo cestovno vozilo
STR_9024_DRAG_ROAD_VEHICLE_TO_HERE :{BLACK}Povuci cestovno vozilo ovdje kako bi ga prodao
STR_9025_CENTER_MAIN_VIEW_ON_ROAD :{BLACK}Centriraj glavni pogled na lokaciju spremišta cestovnih vozila
-STR_9026_ROAD_VEHICLE_SELECTION :{BLACK}Popis cestovnih vozila - klikni na vozilo za informacije
+STR_9026_ROAD_VEHICLE_SELECTION :{BLACK}Popis cestovnih vozila - pritisni na vozilo za informacije
STR_9027_BUILD_THE_HIGHLIGHTED_ROAD :{BLACK}Izgradi označeno cestovno vozilo
STR_902A_COST_SPEED_RUNNING_COST :{BLACK}Trošak: {CURRENCY}{}Brzina: {VELOCITY}{}Trošak uporabe: {CURRENCY}/god{}Kapacitet: {CARGO}
STR_902C_NAME_ROAD_VEHICLE :{WHITE}Imenuj cestovno vozilo
-STR_902D_CAN_T_NAME_ROAD_VEHICLE :{WHITE}Ne mogu preimenovati cestovno vozilo...
+STR_902D_CAN_T_NAME_ROAD_VEHICLE :{WHITE}Ne mogu imenovati cestovno vozilo...
STR_902E_NAME_ROAD_VEHICLE :{BLACK}Imenuj cestovno vozilo
STR_902F_CITIZENS_CELEBRATE_FIRST :{BLACK}{BIGFONT}Građani slave . . .{}Prvi bus stiže na {STATION}!
STR_9030_CITIZENS_CELEBRATE_FIRST :{BLACK}{BIGFONT}Građani slave . . .{}Prvi kamion stiže na {STATION}!
@@ -2472,7 +2495,7 @@
STR_9035_RENAME_ROAD_VEHICLE_TYPE :{BLACK}Preimenuj vrstu cestovnog vozila
STR_9036_RENAME_ROAD_VEHICLE_TYPE :{WHITE}Preimenuj vrstu cestovnog vozila
STR_9037_CAN_T_RENAME_ROAD_VEHICLE :{WHITE}Ne mogu preimenovati vrstu cestovnog vozila...
-STR_9038_GO_TO_ROADVEH_DEPOT :Idi prema {TOWN} spremištu cestovnih vozila
+STR_9038_GO_TO_ROADVEH_DEPOT :Idi prema spremištu cestovnih vozila {TOWN}
STR_SERVICE_AT_ROADVEH_DEPOT :Servisiranje pri {TOWN} spremištu cestovnih vozila
STR_REFIT_ROAD_VEHICLE_TO_CARRY :{BLACK}Prenamijeni cestovno vozilo za prijevoz druge vrste tereta
@@ -2484,9 +2507,10 @@
##id 0x9800
STR_9800_DOCK_CONSTRUCTION :Izgradnja pristaništa
STR_9801_DOCK_CONSTRUCTION :{WHITE}Izgradnja pristaništa
-STR_9802_CAN_T_BUILD_DOCK_HERE :{WHITE}Ne mogu izgraditi pristanište ovdje...
+STR_9802_CAN_T_BUILD_DOCK_HERE :{WHITE}Ovdje ne mogu izgraditi pristanište...
STR_9803_SHIP_DEPOT :{WHITE}{TOWN} Spremište brodova
STR_9804_NEW_SHIPS :{BLACK}Novi brodovi
+STR_9805_SHIPS :{WHITE}{COMPANY} - {COMMA} Brod{P "" a ova}
STR_9808_NEW_SHIPS :{WHITE}Novi brodovi
STR_9809_BUILD_SHIP :{BLACK}Izgradi brod
STR_CLONE_SHIP :{BLACK}Kloniraj brod
@@ -2494,15 +2518,15 @@
STR_980B_SHIP_MUST_BE_STOPPED_IN :{WHITE}Brod mora biti zaustavljen u spremištu
STR_980C_CAN_T_SELL_SHIP :{WHITE}Ne mogu prodati brod...
STR_980D_CAN_T_BUILD_SHIP :{WHITE}Ne mogu izgraditi brod...
-STR_980E_SHIP_IN_THE_WAY :{WHITE}Brod smeta
+STR_980E_SHIP_IN_THE_WAY :{WHITE}Smeta brod
STR_980F :{WHITE}{VEHICLE}
STR_9811_DETAILS :{WHITE}{VEHICLE} (Detalji)
STR_9812_AGE_RUNNING_COST_YR :{BLACK}Starost: {LTBLUE}{STRING}{BLACK} Trošak uporabe: {LTBLUE}{CURRENCY}/god
-STR_9813_MAX_SPEED :{BLACK}Maks brzina: {LTBLUE}{VELOCITY}
+STR_9813_MAX_SPEED :{BLACK}Maks. brzina: {LTBLUE}{VELOCITY}
STR_9814_PROFIT_THIS_YEAR_LAST_YEAR :{BLACK}Zarada ove godine: {LTBLUE}{CURRENCY} (prošle godine: {CURRENCY})
STR_9815_RELIABILITY_BREAKDOWNS :{BLACK}Pouzdanost: {LTBLUE}{COMMA}% {BLACK}Kvarova od posljednjeg servisa: {LTBLUE}{COMMA}
STR_9816_BUILT_VALUE :{LTBLUE}{STRING}{BLACK} Izgrađeno: {LTBLUE}{NUM}{BLACK} Vrijednost: {LTBLUE}{CURRENCY}
-STR_9817_CAPACITY :{BLACK}Kapacitet: {LTBLUE}{CARGO}
+STR_9817_CAPACITY :{BLACK}Zapremnina: {LTBLUE}{CARGO}
STR_9818_CAN_T_STOP_START_SHIP :{WHITE}Ne mogu pokrenuti/zaustaviti brod...
STR_9819_CAN_T_SEND_SHIP_TO_DEPOT :{WHITE}Ne mogu poslati brod u skladište...
STR_981A_UNABLE_TO_FIND_LOCAL_DEPOT :{WHITE}Ne mogu naći lokalno spremište
@@ -2519,12 +2543,16 @@
STR_9822_CENTER_MAIN_VIEW_ON_SHIP :{BLACK}Centriraj glavni pogled na lokaciju spremišta brodova
STR_9823_SHIPS_CLICK_ON_SHIP_FOR :{BLACK}Brodovi - klikni na brod za informacije
STR_9824_BUILD_NEW_SHIPS_REQUIRES :{BLACK}Izgradi nove brodove (zahtijeva spremište brodova)
-STR_9825_SHIP_SELECTION_LIST_CLICK :{BLACK}Popis brodova - klikni na brod za informacije
+STR_9825_SHIP_SELECTION_LIST_CLICK :{BLACK}Popis brodova - pritisni na brod za informacije
STR_9826_BUILD_THE_HIGHLIGHTED_SHIP :{BLACK}Izgradi označeni brod
-STR_9827_CURRENT_SHIP_ACTION_CLICK :{BLACK}Trenutna radnja broda - klikni ovdje za zaustavljanje/pokretanje broda
+STR_9827_CURRENT_SHIP_ACTION_CLICK :{BLACK}Trenutna radnja broda - pritisni ovdje za zaustavljanje/pokretanje broda
STR_9828_SHOW_SHIP_S_ORDERS :{BLACK}Prikaži naredbe broda
STR_9829_CENTER_MAIN_VIEW_ON_SHIP :{BLACK}Centriraj glavni pogled na lokaciju broda
+STR_982B_SHOW_SHIP_DETAILS :{BLACK}Prikaži detalje broda
+STR_982F_NAME_SHIP :{BLACK}Imenuj brod
+STR_9831_NAME_SHIP :{WHITE}Imenuj brod
+STR_9832_CAN_T_NAME_SHIP :{WHITE}Ne mogu imenovati brod...
STR_9833_CITIZENS_CELEBRATE_FIRST :{BLACK}{BIGFONT}Građani slave . . .{}Prvi brod stigao do {STATION}!
STR_9834_POSITION_BUOY_WHICH_CAN :{BLACK}Smjesti plutaču koja može biti korištena kao pokazatelj puta
STR_9835_CAN_T_POSITION_BUOY_HERE :{WHITE}Ne mogu staviti plutaču ovdje...
@@ -2535,6 +2563,10 @@
STR_983A_REFIT_CARGO_SHIP_TO_CARRY :{BLACK}Prenamijeni teretni brod da nosi neku drugu vrstu tereta
STR_983B_REFIT :{WHITE}{VEHICLE} (Prenamijeni)
STR_983C_REFIT_SHIP :{BLACK}Prenamijeni brod
+STR_983D_SELECT_TYPE_OF_CARGO_FOR :{BLACK}Odabri vrstu tereta za prijevoz brodom:
+STR_983E_REFIT_SHIP_TO_CARRY_HIGHLIGHTED :{BLACK}Prenamjeni brod za prijevoz označene vrste tereta
+STR_983F_SELECT_CARGO_TYPE_TO_CARRY :{GOLD}Odabri vrstu tereta za prijevoz:
+STR_9840_NEW_CAPACITY_COST_OF_REFIT :{BLACK}Nova zapremnina: {GOLD}{CARGO}{}{BLACK}Cijena prenamjene: {GOLD}{CURRENCY}
STR_9841_CAN_T_REFIT_SHIP :{WHITE}Ne mogu prenamijeniti brod...
STR_9842_REFITTABLE :(prenamjenjiv)
SERVICE_AT_SHIP_DEPOT :Servis u brodskom spremištu grada {TOWN}
@@ -2542,6 +2574,7 @@
##id 0xA000
STR_A000_AIRPORTS :{WHITE}Zračne luke
STR_A001_CAN_T_BUILD_AIRPORT_HERE :{WHITE}Ne možeš graditi zračnu luku ovdje...
+STR_A002_AIRCRAFT_HANGAR :{WHITE}{STATION} Spremište zrakoplova
STR_A003_NEW_AIRCRAFT :{BLACK}Novi zrakoplov
STR_CLONE_AIRCRAFT :{BLACK}Kloniraj zrakoplov
STR_CLONE_AIRCRAFT_INFO :{BLACK}Ovo će izgraditi kopiju zrakoplova. Control-klik će dijeliti naredbe
@@ -2552,8 +2585,15 @@
STR_A00A :{WHITE}{VEHICLE}
STR_A00B_ORDERS :{WHITE}{VEHICLE} (Naredbe)
STR_A00C_DETAILS :{WHITE}{VEHICLE} (Detalji)
+STR_A00D_AGE_RUNNING_COST_YR :{BLACK}Starost: {LTBLUE}{STRING}{BLACK} Troškovi uporabe {LTBLUE}{CURRENCY}/god
STR_A00E_MAX_SPEED :{BLACK}Maks brzina: {LTBLUE}{VELOCITY}
STR_A00F_PROFIT_THIS_YEAR_LAST_YEAR :{BLACK}Zarada ove godine: {LTBLUE}{CURRENCY} (prošle godine: {CURRENCY})
+STR_A010_RELIABILITY_BREAKDOWNS :{BLACK}Pouzdanost: {LTBLUE}{COMMA}% {BLACK}Kvarova od poslijednjeg servisa: {LTBLUE}{COMMA}
+STR_A011_BUILT_VALUE :{LTBLUE}{STRING}{BLACK} Izgrađen: {LTBLUE}{NUM}{BLACK} Vrijednost: {LTBLUE}{CURRENCY}
+STR_A012_CAN_T_SEND_AIRCRAFT_TO :{WHITE}Ne mogu poslati zrakoplov u hangar
+STR_A014_AIRCRAFT_IS_WAITING_IN :{WHITE}Zrakoplov {COMMA} čeka u hangaru
+STR_A015_AIRCRAFT_IN_THE_WAY :{WHITE}Smeta zrakoplov
+STR_A016_CAN_T_STOP_START_AIRCRAFT :{WHITE}Ne mogu zaustaviti/pokrenuti zrakoplov...
STR_A017_AIRCRAFT_IS_IN_FLIGHT :{WHITE}Zrakoplov je u letu
STR_A019_CAPACITY :{BLACK}Nosivost: {LTBLUE}{CARGO}, {CARGO}
STR_A01A_CAPACITY :{BLACK}Nosivost: {LTBLUE}{CARGO}
@@ -2638,6 +2678,15 @@
STR_NEWGRF_MD5SUM :{BLACK}MD5 suma: {SILVER}{STRING}
STR_NEWGRF_CONFIRMATION_TEXT :{YELLOW}Spremate se napraviti izmjene na pokrenutoj igri; to može srušiti OpenTTD.{}Jeste li potpuno sigurni u to?
+STR_NEWGRF_ERROR_MSG_ERROR :{RED}Greška: {SILVER}{STRING}
+STR_NEWGRF_ERROR_MSG_FATAL :{RED}Kobno: {SILVER}{STRING}
+STR_NEWGRF_ERROR_VERSION_NUMBER :{STRING} neće raditi sa inačicom zakrpe u OpenTTD-u.
+STR_NEWGRF_ERROR_DOS_OR_WINDOWS :{STRING} je za {STRING} inačicu TTD-a.
+STR_NEWGRF_ERROR_UNSET_SWITCH :{STRING} je napravljen da se koristi sa {STRING}
+STR_NEWGRF_ERROR_INVALID_PARAMETER :Nevažeći parametar za {STRING}: parametar {STRING} ({NUM})
+STR_NEWGRF_ERROR_LOAD_BEFORE :{STRING} se mora učitati prije {STRING}.
+STR_NEWGRF_ERROR_LOAD_AFTER :{STRING} se mora učitati nakon {STRING}.
+
STR_NEWGRF_ADD :{BLACK}Dodaj
STR_NEWGRF_ADD_TIP :{BLACK}Dodaj NewGRF datoteku u listu
STR_NEWGRF_REMOVE :{BLACK}Obriši
@@ -2664,6 +2713,7 @@
STR_NEWGRF_COMPATIBLE_LOAD_WARNING :{WHITE}Kompatibilni GRF(ovi) učitani umjesto nepronađenih datoteka
STR_NEWGRF_DISABLED_WARNING :{WHITE}Nepronađene GRF datoteke su isključene
+STR_NEWGRF_NOT_FOUND_WARNING :{WHITE}Nedostaje(u) datoteka(e) GRF za učitavanje igre
STR_CURRENCY_WINDOW :{WHITE}Proizvoljna valuta
STR_CURRENCY_EXCHANGE_RATE :{LTBLUE}Devizni tečaj: {ORANGE}{CURRENCY} = £ {COMMA}
@@ -2681,13 +2731,17 @@
STR_PLANE :{BLACK}{PLANE}
STR_SHIP :{BLACK}{SHIP}
+STR_SCHEDULED_TRAINS :{WHITE}{STATION} - {COMMA} Vlak{P "" a ova}
+STR_SCHEDULED_ROAD_VEHICLES :{WHITE}{STATION} - {COMMA} Cestovn{P o a ih} vozil{P o a a}
STR_SCHEDULED_AIRCRAFT :{WHITE}{STATION} - {COMMA} Zrakoplov
+STR_SCHEDULED_SHIPS :{WHITE}{STATION} - {COMMA} Brod{P "" a ova}
STR_SCHEDULED_TRAINS_TIP :{BLACK}Prikaži sve vlakove koji imaju ovu stanicu u svom rasporedu
STR_SCHEDULED_ROAD_VEHICLES_TIP :{BLACK}Prikaži sva cestovna vozila koja imaju ovu stanicu u svom rasporedu
STR_SCHEDULED_AIRCRAFT_TIP :{BLACK}Prikaži sve zrakoplove koji imaju ovu stanicu u svom rasporedu
STR_SCHEDULED_SHIPS_TIP :{BLACK}Prikaži sve brodove koji imaju ovu stanicu u svom rasporedu
+STR_VEH_WITH_SHARED_ORDERS_LIST :{WHITE}Djeljene naredbe za {COMMA} vozil{P o a a}
STR_VEH_WITH_SHARED_ORDERS_LIST_TIP :{BLACK}Prikaži sva vozila koja dijele ovaj raspored.
### depot strings
@@ -2708,6 +2762,9 @@
STR_DEPOT_AUTOREPLACE_SHIP_TIP :{BLACK}Automatski zamijeni sve brodove u spremištu
STR_DEPOT_AUTOREPLACE_AIRCRAFT_TIP :{BLACK}Automatski zamijeni sve zrakoplove u spremištu
+STR_VEHICLE_LIST_TRAIN_DEPOT :{BLACK}{STRING} - {COMMA} Vlak{P "" a ova}
+STR_VEHICLE_LIST_ROADVEH_DEPOT :{BLACK}{STRING} - {COMMA} Cestovn{P o a ih} vozil{P o a a}
+STR_VEHICLE_LIST_SHIP_DEPOT :{BLACK}{STRING} - {COMMA} Brod{P "" a ova}
STR_VEHICLE_LIST_AIRCRAFT_DEPOT :{BLACK}{STRING} - {COMMA} Zrakoplov
STR_REPLACE_VEHICLES_WHITE :{WHITE}Zamijeni {STRING}
@@ -2726,25 +2783,38 @@
STR_REPLACE_REMOVE_WAGON_HELP :{BLACK}Neka automatska zamijena drži dužinu vlaka istom brišući vagone(počevši od naprijed), ako bi zamijena lokomotive vlak učinila dužim.
STR_REPLACE_ENGINE_WAGON_SELECT :{BLACK}Zamjenjujem:{ORANGE}{SKIP}{SKIP}{STRING}
STR_REPLACE_ENGINE_WAGON_SELECT_HELP :{BLACK}EXPERIMENTALNA FUNKCIJA {} Prebaci između prozora za izmjenu lokomotiva i vagona.{}Izmjena vagona će se izvršiti samo ako novi vagon može biti prenamijenjen za prijevoz istog tipa tereta kao i stari vagon. Ovo se provjerava za svaki vagon kada se stvarna zamjena odvija.
+STR_ENGINE_NOT_BUILDABLE :{WHITE}Lokomotiva se nemože izgraditi
+STR_ENGINES :Lokomotive
STR_WAGONS :Vagoni
+STR_MASS_STOP_DEPOT_TRAIN_TIP :{BLACK}Pritisni za zaustavljanje svih vlakova u spremištu
+STR_MASS_STOP_DEPOT_ROADVEH_TIP :{BLACK}Pritisni za zaustavljanje svih cestovnih vozila u spremištu
+STR_MASS_STOP_DEPOT_SHIP_TIP :{BLACK}Pritisni za zaustavljanje svih brodova u spremištu
+STR_MASS_STOP_HANGAR_TIP :{BLACK}Pritisni za zaustavljanje svih zrakoplova u hangaru
+STR_MASS_START_DEPOT_TRAIN_TIP :{BLACK}Pritisni za pokretanje svih vlakova u spremištu
+STR_MASS_START_DEPOT_ROADVEH_TIP :{BLACK}Pritisni za pokretanje svih cestovnih vozila u spremištu
+STR_MASS_START_DEPOT_SHIP_TIP :{BLACK}Pritisni za pokretanje svih brodova u spremištu
STR_MASS_START_HANGAR_TIP :{BLACK}Klikni za pokretanje svih aviona u hangaru
STR_MASS_STOP_LIST_TIP :{BLACK}Klikni za zaustavljanje svih vozila na listi
STR_MASS_START_LIST_TIP :{BLACK}Klikni za pokretanje svih vozila na listi
STR_SHORT_DATE :{WHITE}{DATE_TINY}
+STR_SIGN_LIST_CAPTION :{WHITE}Popis znakova - {COMMA} Znak{P "" a ova}
############ Lists rail types
STR_RAIL_VEHICLES :Tračna Vozila
+STR_ELRAIL_VEHICLES :Električna željeznička vozila
STR_MONORAIL_VEHICLES :Jednotračna vozila
+STR_MAGLEV_VEHICLES :Maglev željeznička vozila
############ End of list of rail types
+STR_TINY_BLACK :{BLACK}{TINYFONT}{COMMA}
STR_PURCHASE_INFO_COST_WEIGHT :{BLACK}Trošak: {GOLD}{CURRENCY}{BLACK} Težina {GOLD}{WEIGHT_S}
STR_PURCHASE_INFO_SPEED_POWER :{BLACK}Brzina: {GOLD}{VELOCITY}{BLACK} Snaga: {GOLD}{POWER}
@@ -2756,6 +2826,7 @@
STR_PURCHASE_INFO_COST :{BLACK}Trošak: {GOLD}{CURRENCY}
STR_PURCHASE_INFO_WEIGHT_CWEIGHT :{BLACK}Težina: {GOLD}{WEIGHT_S} ({WEIGHT_S})
STR_PURCHASE_INFO_COST_SPEED :{BLACK}Trošak: {GOLD}{CURRENCY}{BLACK} Brzina: {GOLD}{VELOCITY}
+STR_PURCHASE_INFO_AIRCRAFT_CAPACITY :{BLACK}Zapremnina: {GOLD}{COMMA} putnika, {COMMA} vreća s poštom
STR_PURCHASE_INFO_REFITTABLE_TO :{BLACK}Promjenjivo u: {GOLD}
STR_PURCHASE_INFO_ALL_TYPES :Svi tipovi tereta
STR_PURCHASE_INFO_ALL_BUT :Sve osim {GOLD}
@@ -2763,23 +2834,35 @@
########### String for New Landscape Generator
+STR_GENERATE :{WHITE}Izradi
STR_RANDOM :{BLACK}Nasumično
STR_RANDOM_HELP :{BLACK}Promijeni slučajni slijed koji se koristi za kreiranje terena
+STR_WORLD_GENERATION_CAPTION :{WHITE}Izrada svijeta
STR_RANDOM_SEED :{BLACK}Nasumični slijed:
STR_RANDOM_SEED_HELP :{BLACK}Klikni za unos nasumičnog slijeda
+STR_LAND_GENERATOR :{BLACK}Izrađivač zemljišta:
STR_TREE_PLACER :{BLACK} Algoritam za drveće:
STR_TERRAIN_TYPE :{BLACK}Tip terena:
STR_QUANTITY_OF_SEA_LAKES :{BLACK}Razina mora:
STR_SMOOTHNESS :{BLACK}Graduacija:
STR_SNOW_LINE_HEIGHT :{BLACK}Visina linije snijega
+STR_DATE :{BLACK}Datum:
STR_NUMBER_OF_TOWNS :{BLACK}Broj gradova:
STR_NUMBER_OF_INDUSTRIES :{BLACK}Broj industrija:
+STR_GENERATE_DATE :{BLACK}{DATE_LONG}
STR_SNOW_LINE_UP :{BLACK}Pomakni visinu linije snijega za jedan gore
STR_SNOW_LINE_DOWN :{BLACK}Pomakni visinu linije snijega za jedan dolje
STR_SNOW_LINE_QUERY_CAPT :{WHITE}Promijeni visinu linije snijega
STR_START_DATE_QUERY_CAPT :{WHITE}Promijeni početnu godinu
STR_SNOW_LINE_HEIGHT_NUM :{NUM}
+STR_HEIGHTMAP_SIZE :{BLACK}Veličina: {ORANGE}{NUM} x {NUM}
+STR_GENERATION_WORLD :{WHITE}Izrada svijeta u toku...
+STR_GENERATION_ABORT :{BLACK}Prekini
+STR_GENERATION_ABORT_CAPTION :{WHITE}Poništi izradu svijeta
+STR_GENERATION_ABORT_MESSAGE :{YELLOW}Da li zaista želiš prekinuti izradu?
STR_PROGRESS :{WHITE}{NUM}% gotovo
+STR_GENERATION_PROGRESS :{BLACK}{NUM} / {NUM}
+STR_WORLD_GENERATION :{BLACK}Izrada svijeta
STR_TREE_GENERATION :{BLACK}Generiranje drveća
STR_CLEARING_TILES :{BLACK}Generiranje grubog i stjenovitog područja
STR_SETTINGUP_GAME :{BLACK}Uspostavljam igru
@@ -2790,17 +2873,29 @@
STR_SE_RANDOM_LAND :{WHITE}Nasumični teren
STR_SE_NEW_WORLD :{BLACK}Kreiraj novi scenarij
STR_SE_CAPTION :{WHITE}Vrsta scenarija
+STR_FLAT_WORLD_HEIGHT_DOWN :{BLACK}Snizi ravnu površinu za jedan korak
+STR_FLAT_WORLD_HEIGHT_UP :{BLACK}Povisi ravnu površinu za jedan korak
+STR_FLAT_WORLD_HEIGHT_QUERY_CAPT :{WHITE}Promijeni visinu ravne površine
+STR_FLAT_WORLD_HEIGHT :{BLACK}Visina ravne površine:
+STR_FLAT_WORLD_HEIGHT_NUM :{NUM}
STR_SMALLMAP_CENTER :{BLACK}Centriraj malu mapu na trenutni položaj
########### String for new airports
STR_SMALL_AIRPORT :{BLACK}Mala
STR_CITY_AIRPORT :{BLACK}Grad
+STR_METRO_AIRPORT :{BLACK}Metropolitanski airport
STR_INTERNATIONAL_AIRPORT :{BLACK}Međunarodni aerodrom
STR_COMMUTER_AIRPORT :{BLACK}Redoviti putnik
+STR_INTERCONTINENTAL_AIRPORT :{BLACK}Međukontinentalni
+STR_HELIPORT :{BLACK}Heliodrom
+STR_HELIDEPOT :{BLACK}Spremište za helikoptere
+STR_HELISTATION :{BLACK}Stanica za helikoptere
STR_SMALL_AIRPORTS :{BLACK}Mali aerodromi
STR_LARGE_AIRPORTS :{BLACK}Veliki aerodromi
+STR_HUB_AIRPORTS :{BLACK}Središnje zračne luke
+STR_HELIPORTS :{BLACK}Helicopterske zračne luke
############ Tooltip measurment
@@ -2809,4 +2904,11 @@
STR_MEASURE_LENGTH_HEIGHTDIFF :{BLACK}Dužina:{NUM}{}Visinska razlika:{NUM} m
STR_MEASURE_AREA_HEIGHTDIFF :{BLACK}Područje:{NUM}x{NUM}Visinska razlika:{NUM} m
+############ Date formatting
+STR_DATE_TINY :{STRING}-{STRING}-{NUM}
+STR_DATE_SHORT :{STRING} {NUM}
+STR_DATE_LONG :{STRING} {STRING} {NUM}
+
########
+
+STR_FEEDER_CARGO_VALUE :{BLACK}Prebaci novac: {LTBLUE}{CURRENCY}
--- a/src/lang/unfinished/greek.txt Sat Mar 10 11:07:13 2007 +0000
+++ b/src/lang/unfinished/greek.txt Sun Mar 11 16:31:18 2007 +0000
@@ -5,11 +5,13 @@
##gender m f n
##id 0x0000
+STR_NULL :
STR_0001_OFF_EDGE_OF_MAP :{WHITE}Απο την άκρη του χάρτη
STR_0002_TOO_CLOSE_TO_EDGE_OF_MAP :{WHITE}Πολυ κοντά στην άκρη του χάρτη
STR_0003_NOT_ENOUGH_CASH_REQUIRES :{WHITE}Δεν υπάρχουν αρκετά χρήματα - απαιτούνται {CURRENCY}
STR_0004 :{WHITE}{CURRENCY64}.
STR_0005 :{RED}{CURRENCY64}.
+STR_EMPTY :
STR_0007_FLAT_LAND_REQUIRED :{WHITE}Απαιτείται επίπεδο εδαφος
STR_0008_WAITING :{BLACK}Αναμονη: {WHITE}{STRING}
STR_0009 :{WHITE}{CARGO}
@@ -81,6 +83,14 @@
STR_004B_BATTERY :Μπαταρία
STR_004C_PLASTIC :Πλαστικό
STR_004D_FIZZY_DRINK :Αναψυκτικό
+STR_QUANTITY_NOTHING :
+STR_QUANTITY_PASSENGERS :{COMMA} επιβάτης{P "" s}
+STR_QUANTITY_COAL :{WEIGHT} άνθρακα
+STR_QUANTITY_MAIL :{COMMA} σάκος{P "" s} με αλληλογραφία
+STR_QUANTITY_OIL :{VOLUME} πετρελαίου
+STR_QUANTITY_LIVESTOCK :{COMMA} αντικείμενο{P "" s} ζώων
+STR_QUANTITY_GOODS :{COMMA} κιβώτιο{P "" s} αγαθών
+STR_QUANTITY_GRAIN :{WEIGHT} σιτάρι
STR_QUANTITY_WOOD :{WEIGHT} ξύλου
STR_QUANTITY_IRON_ORE :{WEIGHT} μεταλλεύματος σιδήρου
STR_QUANTITY_STEEL :{WEIGHT} ατσαλιού
@@ -508,20 +518,16 @@
STR_021B_ACHIEVES_STATUS :{BLACK}{BIGFONT}{COMPANY} έφτασε στο επίπεδο '{STRING}'
STR_021C_OF_ACHIEVES_STATUS :{WHITE}{BIGFONT}{PLAYERNAME} της εταιρείας {COMPANY} έφτασε στο επίπεδο '{STRING}'!
STR_021F :{BLUE}{COMMA}
-STR_0220_CREATE_SCENARIO :{BLACK}Δημιουργία Σεναρίου
STR_0221_OPENTTD :{YELLOW}OpenTTD
STR_0222_SCENARIO_EDITOR :{YELLOW}Πρόγραμμα Επεξερτασίας Σεναρίου
STR_0223_LAND_GENERATION :{WHITE}Δημιουργία Γης
STR_0224 :{BLACK}{UPARROW}
STR_0225 :{BLACK}{DOWNARROW}
-STR_0226_RANDOM_LAND :{BLACK}Τυχαία Γη
-STR_0227_RESET_LAND :{BLACK}Επαναφορά Γης
STR_0228_INCREASE_SIZE_OF_LAND_AREA :{BLACK}Αύξηση περιοχής για χαμήλωμα/ανύψωση γης
STR_0229_DECREASE_SIZE_OF_LAND_AREA :{BLACK}Μείωση περιοχής για χαμήλωμα/ανύψωση γης
STR_022A_GENERATE_RANDOM_LAND :{BLACK}Δημιουργία τυχαίου εδάφους
STR_022B_RESET_LANDSCAPE :{BLACK}Επαναφορά τοπίου
STR_022C_RESET_LANDSCAPE :{WHITE}Επαναφορά Τοπίου
-STR_022D_ARE_YOU_SURE_YOU_WANT_TO :{WHITE}Είστε σίγουρος ότι θέλετε να επαναφέρετε το τοπίο;
STR_022E_LANDSCAPE_GENERATION :{BLACK}Δημιουργία τοπίου
STR_022F_TOWN_GENERATION :{BLACK}Δημιουργία πόλης
STR_0230_INDUSTRY_GENERATION :{BLACK}Δημιουργία Βιομηχανίας
@@ -1608,6 +1614,7 @@
+
##id 0x9000
@@ -1637,6 +1644,7 @@
+
### depot strings
@@ -1667,4 +1675,7 @@
############ Tooltip measurment
+############ Date formatting
+
########
+
--- a/src/livery.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/livery.h Sun Mar 11 16:31:18 2007 +0000
@@ -8,7 +8,7 @@
#include "helpers.hpp"
/* List of different livery schemes. */
-typedef enum LiverySchemes {
+enum LiveryScheme {
LS_BEGIN = 0,
LS_DEFAULT = 0,
@@ -39,25 +39,25 @@
LS_LARGE_PLANE,
LS_END
-} LiveryScheme;
+};
DECLARE_POSTFIX_INCREMENT(LiveryScheme);
/* List of different livery classes, used only by the livery GUI. */
-typedef enum LiveryClasses {
+enum LiveryClass {
LC_OTHER,
LC_RAIL,
LC_ROAD,
LC_SHIP,
LC_AIRCRAFT,
LC_END
-} LiveryClass;
+};
-typedef struct Livery {
+struct Livery {
bool in_use; ///< Set if this livery should be used instead of the default livery.
byte colour1; ///< First colour, for all vehicles.
byte colour2; ///< Second colour, for vehicles with 2CC support.
-} Livery;
+};
#endif /* LIVERY_H */
--- a/src/lzoconf.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/lzoconf.h Sun Mar 11 16:31:18 2007 +0000
@@ -29,8 +29,7 @@
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Markus F.X.J. Oberhumer
- <markus@oberhumer.com>
- http://www.oberhumer.com/opensource/lzo/
+ <markus@oberhumer.com> http://www.oberhumer.com/opensource/lzo/
*/
@@ -407,11 +406,11 @@
LZO_EXTERN(int) __lzo_init2(unsigned,int,int,int,int,int,int,int,int,int);
/* version functions (useful for shared libraries) */
-LZO_EXTERN(unsigned) lzo_version(void);
-LZO_EXTERN(const char *) lzo_version_string(void);
-LZO_EXTERN(const char *) lzo_version_date(void);
-LZO_EXTERN(const lzo_charp) _lzo_version_string(void);
-LZO_EXTERN(const lzo_charp) _lzo_version_date(void);
+LZO_EXTERN(unsigned) lzo_version();
+LZO_EXTERN(const char *) lzo_version_string();
+LZO_EXTERN(const char *) lzo_version_date();
+LZO_EXTERN(const lzo_charp) _lzo_version_string();
+LZO_EXTERN(const lzo_charp) _lzo_version_date();
/* string functions */
LZO_EXTERN(int)
@@ -431,7 +430,7 @@
/* misc. */
LZO_EXTERN(lzo_bool) lzo_assert(int _expr);
-LZO_EXTERN(int) _lzo_config_check(void);
+LZO_EXTERN(int) _lzo_config_check();
typedef union { lzo_bytep p; lzo_uint u; } __lzo_pu_u;
typedef union { lzo_bytep p; lzo_uint32 u32; } __lzo_pu32_u;
typedef union { void *vp; lzo_bytep bp; lzo_uint32 u32; long l; } lzo_align_t;
--- a/src/main_gui.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/main_gui.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -52,8 +52,8 @@
RailType _last_built_railtype;
static int _scengen_town_size = 2; // depress medium-sized towns per default
-extern void GenerateIndustries(void);
-extern bool GenerateTowns(void);
+extern void GenerateIndustries();
+extern bool GenerateTowns();
void HandleOnEditText(const char *str)
@@ -136,7 +136,7 @@
{
if (_networking && !_network_server) return; // only server can pause the game
- if (DoCommandP(0, _pause ? 0 : 1, 0, NULL, CMD_PAUSE)) SndPlayFx(SND_15_BEEP);
+ if (DoCommandP(0, _pause_game ? 0 : 1, 0, NULL, CMD_PAUSE)) SndPlayFx(SND_15_BEEP);
}
static void ToolbarFastForwardClick(BaseWindow *w)
@@ -265,22 +265,22 @@
static void MenuClickShowTrains(int index)
{
- ShowVehicleListWindow((PlayerID)index, VEH_Train);
+ ShowVehicleListWindow((PlayerID)index, VEH_TRAIN);
}
static void MenuClickShowRoad(int index)
{
- ShowVehicleListWindow((PlayerID)index, VEH_Road);
+ ShowVehicleListWindow((PlayerID)index, VEH_ROAD);
}
static void MenuClickShowShips(int index)
{
- ShowVehicleListWindow((PlayerID)index, VEH_Ship);
+ ShowVehicleListWindow((PlayerID)index, VEH_SHIP);
}
static void MenuClickShowAir(int index)
{
- ShowVehicleListWindow((PlayerID)index, VEH_Aircraft);
+ ShowVehicleListWindow((PlayerID)index, VEH_AIRCRAFT);
}
static void MenuClickBuildRail(int index)
@@ -337,7 +337,7 @@
ShowQueryString(STR_WAYPOINT_RAW, STR_EDIT_WAYPOINT_NAME, 30, 180, NULL, CS_ALPHANUMERAL);
}
-static void SelectSignTool(void)
+static void SelectSignTool()
{
if (_cursor.sprite == SPR_CURSOR_SIGN) {
ResetObjectToPlace();
@@ -370,12 +370,12 @@
}
}
-static void MenuClickSmallScreenshot(void)
+static void MenuClickSmallScreenshot()
{
SetScreenshotType(SC_VIEWPORT);
}
-static void MenuClickWorldScreenshot(void)
+static void MenuClickWorldScreenshot()
{
SetScreenshotType(SC_WORLD);
}
@@ -812,7 +812,7 @@
int dis = -1;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Train && IsFrontEngine(v)) CLRBIT(dis, v->owner);
+ if (v->type == VEH_TRAIN && IsFrontEngine(v)) CLRBIT(dis, v->owner);
}
PopupMainPlayerToolbMenu(w, 310, 13, dis);
}
@@ -823,7 +823,7 @@
int dis = -1;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Road) CLRBIT(dis, v->owner);
+ if (v->type == VEH_ROAD) CLRBIT(dis, v->owner);
}
PopupMainPlayerToolbMenu(w, 332, 14, dis);
}
@@ -834,7 +834,7 @@
int dis = -1;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Ship) CLRBIT(dis, v->owner);
+ if (v->type == VEH_SHIP) CLRBIT(dis, v->owner);
}
PopupMainPlayerToolbMenu(w, 354, 15, dis);
}
@@ -845,7 +845,7 @@
int dis = -1;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Aircraft) CLRBIT(dis, v->owner);
+ if (v->type == VEH_AIRCRAFT) CLRBIT(dis, v->owner);
}
PopupMainPlayerToolbMenu(w, 376, 16, dis);
}
@@ -1379,7 +1379,7 @@
ScenEditLandGenWndProc,
};
-static inline void ShowEditorTerraformToolBar(void)
+static inline void ShowEditorTerraformToolBar()
{
BaseWindow::AllocateFront(&_scen_edit_land_gen_desc, 0);
}
@@ -1593,7 +1593,7 @@
};
-static bool AnyTownExists(void)
+static bool AnyTownExists()
{
const Town *t;
@@ -1841,10 +1841,10 @@
case WKC_F10:ShowOperatingProfitGraph(); break;
case WKC_F11: ShowCompanyLeagueTable(); break;
case WKC_F12: ShowBuildIndustryWindow(); break;
- case WKC_SHIFT | WKC_F1: ShowVehicleListWindow(_local_player, VEH_Train); break;
- case WKC_SHIFT | WKC_F2: ShowVehicleListWindow(_local_player, VEH_Road); break;
- case WKC_SHIFT | WKC_F3: ShowVehicleListWindow(_local_player, VEH_Ship); break;
- case WKC_SHIFT | WKC_F4: ShowVehicleListWindow(_local_player, VEH_Aircraft); break;
+ case WKC_SHIFT | WKC_F1: ShowVehicleListWindow(_local_player, VEH_TRAIN); break;
+ case WKC_SHIFT | WKC_F2: ShowVehicleListWindow(_local_player, VEH_ROAD); break;
+ case WKC_SHIFT | WKC_F3: ShowVehicleListWindow(_local_player, VEH_SHIP); break;
+ case WKC_SHIFT | WKC_F4: ShowVehicleListWindow(_local_player, VEH_AIRCRAFT); break;
case WKC_SHIFT | WKC_F5: ToolbarZoomInClick(w); break;
case WKC_SHIFT | WKC_F6: ToolbarZoomOutClick(w); break;
case WKC_SHIFT | WKC_F7: ShowBuildRailToolbar(_last_built_railtype, -1); break;
@@ -1873,7 +1873,7 @@
} break;
case WE_MOUSELOOP:
- if (w->IsWidgetLowered(0) != !!_pause) {
+ if (w->IsWidgetLowered(0) != !!_pause_game) {
w->ToggleWidgetLoweredState(0);
w->InvalidateWidget(0);
}
@@ -2072,7 +2072,7 @@
} break;
case WE_MOUSELOOP:
- if (w->IsWidgetLowered(0) != !!_pause) {
+ if (w->IsWidgetLowered(0) != !!_pause_game) {
w->ToggleWidgetLoweredState(0);
w->SetDirty();
}
@@ -2155,7 +2155,7 @@
w->DrawWidgets();
SetDParam(0, _date);
DrawStringCentered(
- 70, 1, (_pause || _patches.status_long_date) ? STR_00AF : STR_00AE, 0
+ 70, 1, (_pause_game || _patches.status_long_date) ? STR_00AF : STR_00AE, 0
);
if (p != NULL) {
@@ -2169,7 +2169,7 @@
DrawStringCentered(320, 1, STR_SAVING_GAME, 0);
} else if (_do_autosave) {
DrawStringCentered(320, 1, STR_032F_AUTOSAVE, 0);
- } else if (_pause) {
+ } else if (_pause_game) {
DrawStringCentered(320, 1, STR_0319_PAUSED, 0);
} else if (WP(w,def_d).data_1 > -1280 && BaseWindow::FindById(WC_NEWS_WINDOW,0) == NULL && _statusbar_news_item.string_id != 0) {
/* Draw the scrolling news text */
@@ -2201,7 +2201,7 @@
break;
case WE_TICK: {
- if (_pause) return;
+ if (_pause_game) return;
if (WP(w, def_d).data_1 > -1280) { // Scrolling text
WP(w, def_d).data_1 -= 2;
@@ -2235,7 +2235,7 @@
StatusBarWndProc
};
-extern void UpdateAllStationVirtCoord(void);
+extern void UpdateAllStationVirtCoord();
static void MainWindowWndProc(BaseWindow *w, WindowEvent *e)
{
@@ -2401,9 +2401,9 @@
}
-void ShowSelectGameWindow(void);
-
-void SetupColorsAndInitialWindow(void)
+void ShowSelectGameWindow();
+
+void SetupColorsAndInitialWindow()
{
uint i;
BaseWindow *w;
@@ -2461,7 +2461,7 @@
WP(w,def_d).data_1 = -1280;
}
-void GameSizeChanged(void)
+void GameSizeChanged()
{
_cur_resolution[0] = _screen.width;
_cur_resolution[1] = _screen.height;
@@ -2470,7 +2470,7 @@
MarkWholeScreenDirty();
}
-void InitializeMainGui(void)
+void InitializeMainGui()
{
/* Clean old GUI values */
_last_built_railtype = RAILTYPE_RAIL;
--- a/src/map.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/map.h Sun Mar 11 16:31:18 2007 +0000
@@ -18,7 +18,7 @@
#define TILE_MASK(x) ((x) & _map_tile_mask)
#define TILE_ASSERT(x) assert(TILE_MASK(x) == (x));
-typedef struct Tile {
+struct Tile {
byte type_height;
byte m1;
uint16 m2;
@@ -26,22 +26,22 @@
byte m4;
byte m5;
byte m6;
-} Tile;
+};
extern Tile* _m;
void AllocateMap(uint size_x, uint size_y);
/* binary logarithm of the map size, try to avoid using this one */
-static inline uint MapLogX(void) { return _map_log_x; }
+static inline uint MapLogX() { return _map_log_x; }
/* The size of the map */
-static inline uint MapSizeX(void) { return _map_size_x; }
-static inline uint MapSizeY(void) { return _map_size_y; }
+static inline uint MapSizeX() { return _map_size_x; }
+static inline uint MapSizeY() { return _map_size_y; }
/* The maximum coordinates */
-static inline uint MapMaxX(void) { return _map_size_x - 1; }
-static inline uint MapMaxY(void) { return _map_size_y - 1; }
+static inline uint MapMaxX() { return _map_size_x - 1; }
+static inline uint MapMaxY() { return _map_size_y - 1; }
/* The number of tiles in the map */
-static inline uint MapSize(void) { return _map_size; }
+static inline uint MapSize() { return _map_size; }
/* Scale a number relative to the map size */
uint ScaleByMapSize(uint); // Scale relative to the number of tiles
@@ -92,10 +92,10 @@
}
-typedef struct TileIndexDiffC {
+struct TileIndexDiffC {
int16 x;
int16 y;
-} TileIndexDiffC;
+};
static inline TileIndexDiff ToTileIndexDiff(TileIndexDiffC tidc)
{
--- a/src/md5.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/md5.h Sun Mar 11 16:31:18 2007 +0000
@@ -68,11 +68,11 @@
typedef unsigned int md5_word_t; /* 32-bit word */
/* Define the state of the MD5 Algorithm. */
-typedef struct md5_state_s {
+struct md5_state_t {
md5_word_t count[2]; /* message length in bits, lsw first */
md5_word_t abcd[4]; /* digest buffer */
md5_byte_t buf[64]; /* accumulate block */
-} md5_state_t;
+};
/* Initialize the algorithm. */
void md5_init(md5_state_t *pms);
--- a/src/mersenne.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/mersenne.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -32,7 +32,7 @@
}
-static uint32 ReloadMT(void)
+static uint32 ReloadMT()
{
register uint32 *p0=_mt_state, *p2=_mt_state+2, *pM=_mt_state+M, s0, s1;
register int j;
@@ -56,7 +56,7 @@
}
-uint32 RandomMT(void)
+uint32 RandomMT()
{
uint32 y;
--- a/src/minilzo.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/minilzo.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -270,7 +270,7 @@
__LZO_EXTERN_C int __lzo_init_done;
__LZO_EXTERN_C const lzo_byte __lzo_copyright[];
-LZO_EXTERN(const lzo_byte *) lzo_copyright(void);
+LZO_EXTERN(const lzo_byte *) lzo_copyright();
__LZO_EXTERN_C const lzo_uint32 _lzo_crc32_table[256];
#define _LZO_STRINGIZE(x) #x
@@ -709,7 +709,7 @@
#define IS_POWER_OF_2(x) (((x) & ((x) - 1)) == 0)
-// static lzo_bool schedule_insns_bug(void);
+// static lzo_bool schedule_insns_bug();
// static lzo_bool strength_reduce_bug(int *);
#if 0 || defined(LZO_DEBUG)
--- a/src/misc.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/misc.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -29,7 +29,7 @@
#include "network/network_data.h"
uint32 DoRandom(int line, const char *file)
#else // RANDOM_DEBUG
-uint32 Random(void)
+uint32 Random()
#endif // RANDOM_DEBUG
{
@@ -61,7 +61,7 @@
#endif
-uint32 InteractiveRandom(void)
+uint32 InteractiveRandom()
{
uint32 t = _random_seeds[1][1];
uint32 s = _random_seeds[1][0];
@@ -74,27 +74,27 @@
return GB(InteractiveRandom(), 0, 16) * max >> 16;
}
-void InitializeVehicles(void);
-void InitializeWaypoints(void);
-void InitializeDepots(void);
-void InitializeEngines(void);
-void InitializeOrders(void);
-void InitializeClearLand(void);
-void InitializeRailGui(void);
-void InitializeRoadGui(void);
-void InitializeAirportGui(void);
-void InitializeDockGui(void);
-void InitializeIndustries(void);
-void InitializeMainGui(void);
-void InitializeLandscape(void);
-void InitializeTowns(void);
-void InitializeTrees(void);
-void InitializeSigns(void);
-void InitializeStations(void);
-static void InitializeNameMgr(void);
-void InitializePlayers(void);
-static void InitializeCheats(void);
-void InitializeNPF(void);
+void InitializeVehicles();
+void InitializeWaypoints();
+void InitializeDepots();
+void InitializeEngines();
+void InitializeOrders();
+void InitializeClearLand();
+void InitializeRailGui();
+void InitializeRoadGui();
+void InitializeAirportGui();
+void InitializeDockGui();
+void InitializeIndustries();
+void InitializeMainGui();
+void InitializeLandscape();
+void InitializeTowns();
+void InitializeTrees();
+void InitializeSigns();
+void InitializeStations();
+static void InitializeNameMgr();
+void InitializePlayers();
+static void InitializeCheats();
+void InitializeNPF();
void InitializeGame(int mode, uint size_x, uint size_y)
{
@@ -104,7 +104,7 @@
SetObjectToPlace(SPR_CURSOR_ZZZ, PAL_NONE, 0, WC_MAIN_WINDOW, 0);
- _pause = 0;
+ _pause_game = 0;
_fast_forward = 0;
_tick_counter = 0;
_date_fract = 0;
@@ -170,13 +170,13 @@
}
-static void InitializeCheats(void)
+static void InitializeCheats()
{
memset(&_cheats, 0, sizeof(Cheats));
}
-static void InitializeNameMgr(void)
+static void InitializeNameMgr()
{
memset(_name_array, 0, sizeof(_name_array));
}
@@ -204,7 +204,7 @@
}
}
-void ConvertNameArray(void)
+void ConvertNameArray()
{
uint i;
@@ -267,7 +267,7 @@
}
-static void Save_NAME(void)
+static void Save_NAME()
{
int i;
@@ -279,7 +279,7 @@
}
}
-static void Load_NAME(void)
+static void Load_NAME()
{
int index;
@@ -307,14 +307,14 @@
SLEG_VAR(_cur_player_tick_index, SLE_FILE_U8 | SLE_VAR_U32),
SLEG_VAR(_next_competitor_start, SLE_FILE_U16 | SLE_VAR_U32),
SLEG_VAR(_trees_tick_ctr, SLE_UINT8),
- SLEG_CONDVAR(_pause, SLE_UINT8, 4, SL_MAX_VERSION),
+ SLEG_CONDVAR(_pause_game, SLE_UINT8, 4, SL_MAX_VERSION),
SLEG_CONDVAR(_cur_town_iter, SLE_UINT32, 11, SL_MAX_VERSION),
SLEG_END()
};
/* Save load date related variables as well as persistent tick counters
* XXX: currently some unrelated stuff is just put here */
-static void SaveLoad_DATE(void)
+static void SaveLoad_DATE()
{
SlGlobList(_date_desc);
}
@@ -329,7 +329,7 @@
SLEG_END()
};
-static void SaveLoad_VIEW(void)
+static void SaveLoad_VIEW()
{
SlGlobList(_view_desc);
}
@@ -343,20 +343,20 @@
SLEG_END()
};
-static void Save_MAPS(void)
+static void Save_MAPS()
{
_map_dim_x = MapSizeX();
_map_dim_y = MapSizeY();
SlGlobList(_map_dimensions);
}
-static void Load_MAPS(void)
+static void Load_MAPS()
{
SlGlobList(_map_dimensions);
AllocateMap(_map_dim_x, _map_dim_y);
}
-static void Load_MAPT(void)
+static void Load_MAPT()
{
uint size = MapSize();
uint i;
@@ -370,7 +370,7 @@
}
}
-static void Save_MAPT(void)
+static void Save_MAPT()
{
uint size = MapSize();
uint i;
@@ -385,7 +385,7 @@
}
}
-static void Load_MAP1(void)
+static void Load_MAP1()
{
uint size = MapSize();
uint i;
@@ -399,7 +399,7 @@
}
}
-static void Save_MAP1(void)
+static void Save_MAP1()
{
uint size = MapSize();
uint i;
@@ -414,7 +414,7 @@
}
}
-static void Load_MAP2(void)
+static void Load_MAP2()
{
uint size = MapSize();
uint i;
@@ -431,7 +431,7 @@
}
}
-static void Save_MAP2(void)
+static void Save_MAP2()
{
uint size = MapSize();
uint i;
@@ -446,7 +446,7 @@
}
}
-static void Load_MAP3(void)
+static void Load_MAP3()
{
uint size = MapSize();
uint i;
@@ -460,7 +460,7 @@
}
}
-static void Save_MAP3(void)
+static void Save_MAP3()
{
uint size = MapSize();
uint i;
@@ -475,7 +475,7 @@
}
}
-static void Load_MAP4(void)
+static void Load_MAP4()
{
uint size = MapSize();
uint i;
@@ -489,7 +489,7 @@
}
}
-static void Save_MAP4(void)
+static void Save_MAP4()
{
uint size = MapSize();
uint i;
@@ -504,7 +504,7 @@
}
}
-static void Load_MAP5(void)
+static void Load_MAP5()
{
uint size = MapSize();
uint i;
@@ -518,7 +518,7 @@
}
}
-static void Save_MAP5(void)
+static void Save_MAP5()
{
uint size = MapSize();
uint i;
@@ -533,7 +533,7 @@
}
}
-static void Load_MAP6(void)
+static void Load_MAP6()
{
/* Still available for loading old games */
uint size = MapSize();
@@ -563,7 +563,7 @@
}
}
-static void Save_MAP6(void)
+static void Save_MAP6()
{
uint size = MapSize();
uint i;
@@ -579,7 +579,7 @@
}
-static void Save_CHTS(void)
+static void Save_CHTS()
{
byte count = sizeof(_cheats)/sizeof(Cheat);
Cheat* cht = (Cheat*) &_cheats;
@@ -592,7 +592,7 @@
}
}
-static void Load_CHTS(void)
+static void Load_CHTS()
{
Cheat* cht = (Cheat*)&_cheats;
uint count = SlGetFieldLength() / 2;
--- a/src/misc_cmd.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/misc_cmd.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -257,8 +257,8 @@
int32 CmdPause(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
if (flags & DC_EXEC) {
- _pause += (p1 == 1) ? 1 : -1;
- if (_pause == (byte)-1) _pause = 0;
+ _pause_game += (p1 == 1) ? 1 : -1;
+ if (_pause_game == (byte)-1) _pause_game = 0;
InvalidateWindow(WC_STATUS_BAR, 0);
InvalidateWindow(WC_MAIN_TOOLBAR, 0);
}
--- a/src/misc_gui.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/misc_gui.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -191,7 +191,7 @@
#undef LANDINFOD_LEVEL
}
-void PlaceLandBlockInfo(void)
+void PlaceLandBlockInfo()
{
if (_cursor.sprite == SPR_CURSOR_QUERY) {
ResetObjectToPlace();
@@ -215,6 +215,7 @@
" Tamás Faragó (Darkvater) - Lead coder",
" Loïc Guilloux (glx) - In training, not yet specialized",
" Jaroslav Mazanec (KUDr) - YAPG (Yet Another Pathfinder God) ;)",
+ " Jonathan Coome (Maedhros) - High priest of the newGRF Temple",
" Attila Bán (MiHaMiX) - WebTranslator, Nightlies, Wiki and bugtracker host",
" Peter Nelson (peter1138) - Spiritual descendant from newgrf gods",
" Remko Bijker (Rubidium) - THE desync hunter",
@@ -304,7 +305,7 @@
};
-void ShowAboutWindow(void)
+void ShowAboutWindow()
{
DeleteWindowById(WC_GAME_OPTIONS, 0);
BaseWindow::Allocate(&_about_desc);
@@ -465,13 +466,13 @@
};
-void ShowBuildTreesToolbar(void)
+void ShowBuildTreesToolbar()
{
if (!IsValidPlayer(_current_player)) return;
BaseWindow::AllocateFront(&_build_trees_desc, 0);
}
-void ShowBuildTreesScenToolbar(void)
+void ShowBuildTreesScenToolbar()
{
BaseWindow::AllocateFront(&_build_trees_scen_desc, 0);
}
@@ -804,17 +805,21 @@
WChar c;
uint width;
size_t len;
+ char *s = tb->buf + tb->caretpos;
- if (backspace) tb->caretpos -= Utf8PrevCharLen(tb->buf + tb->caretpos);
+ if (backspace) s = Utf8PrevChar(s);
- len = Utf8Decode(&c, tb->buf + tb->caretpos);
+ len = Utf8Decode(&c, s);
width = GetCharacterWidth(FS_NORMAL, c);
tb->width -= width;
- if (backspace) tb->caretxoffs -= width;
+ if (backspace) {
+ tb->caretpos -= len;
+ tb->caretxoffs -= width;
+ }
/* Move the remaining characters over the marker */
- memmove(tb->buf + tb->caretpos, tb->buf + tb->caretpos + len, tb->length - tb->caretpos - len + 1);
+ memmove(s, s + len, tb->length - (s - tb->buf) - len + 1);
tb->length -= len;
}
@@ -887,9 +892,9 @@
case WKC_LEFT:
if (tb->caretpos != 0) {
WChar c;
-
- tb->caretpos -= Utf8PrevCharLen(tb->buf + tb->caretpos);
- Utf8Decode(&c, tb->buf + tb->caretpos);
+ const char *s = Utf8PrevChar(tb->buf + tb->caretpos);
+ Utf8Decode(&c, s);
+ tb->caretpos = s - tb->buf; // -= (tb->buf + tb->caretpos - s)
tb->caretxoffs -= GetCharacterWidth(FS_NORMAL, c);
return true;
@@ -1186,12 +1191,12 @@
};
-typedef struct query_d {
+struct query_d {
void (*proc)(BaseWindow*, bool); ///< callback function executed on closing of popup. BaseWindow* points to parent, bool is true if 'yes' clicked, false otherwise
StringID message; ///< message shown for query window
uint32 params[20]; ///< local copy of _decode_parameters
bool calledback; ///< has callback been executed already (internal usage for WE_DESTROY event)
-} query_d;
+};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(query_d));
@@ -1326,7 +1331,7 @@
/* Colors for fios types */
const byte _fios_colors[] = {13, 9, 9, 6, 5, 6, 5, 6, 6, 8};
-void BuildFileList(void)
+void BuildFileList()
{
_fios_path_changed = true;
FiosFreeSavegameList();
@@ -1359,7 +1364,7 @@
DoDrawStringTruncated(path, 2, 27, 16, maxw);
}
-static void MakeSortedSaveGameList(void)
+static void MakeSortedSaveGameList()
{
uint sort_start = 0;
uint sort_end = 0;
@@ -1383,7 +1388,7 @@
qsort(_fios_list + sort_start, s_amount, sizeof(FiosItem), compare_FiosItems);
}
-static void GenerateFileName(void)
+static void GenerateFileName()
{
/* Check if we are not a specatator who wants to generate a name..
Let's use the name of player #0 for now. */
@@ -1395,7 +1400,7 @@
GetString(_edit_str_buf, STR_4004, lastof(_edit_str_buf));
}
-extern void StartupEngines(void);
+extern void StartupEngines();
static void SaveLoadDlgWndProc(BaseWindow *w, WindowEvent *e)
{
@@ -1659,7 +1664,7 @@
ResetObjectToPlace();
}
-void RedrawAutosave(void)
+void RedrawAutosave()
{
BaseWindow::SetDirtyById(WC_STATUS_BAR, 0);
}
@@ -1730,7 +1735,7 @@
return _opt.landscape;
}
-extern void EnginesMonthlyLoop(void);
+extern void EnginesMonthlyLoop();
/**
* @param p2 1 (increase) or -1 (decrease)
@@ -1762,7 +1767,7 @@
typedef TinyEnumT<ce_flags_long> ce_flags;
-typedef struct CheatEntry {
+struct CheatEntry {
VarType type; ///< type of selector
ce_flags flags; ///< selector flags
StringID str; ///< string with descriptive text
@@ -1770,7 +1775,7 @@
bool *been_used; ///< has this cheat been used before?
CheckButtonClick *proc;///< procedure
int16 min, max; ///< range for spinbox setting
-} CheatEntry;
+};
static const CheatEntry _cheats_ui[] = {
{SLE_BOOL, {CE_CLICK}, STR_CHEAT_MONEY, &_cheats.money.value, &_cheats.money.been_used, &ClickMoneyCheat, 0, 0},
@@ -1925,7 +1930,7 @@
};
-void ShowCheatWindow(void)
+void ShowCheatWindow()
{
DeleteWindowById(WC_CHEATS, 0);
BaseWindow::Allocate(&_cheats_desc);
--- a/src/mixer.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/mixer.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -93,7 +93,7 @@
}
}
-MixerChannel *MxAllocateChannel(void)
+MixerChannel *MxAllocateChannel()
{
MixerChannel *mc;
for (mc = _channels; mc != endof(_channels); mc++)
--- a/src/mixer.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/mixer.h Sun Mar 11 16:31:18 2007 +0000
@@ -5,7 +5,7 @@
#ifndef MIXER_H
#define MIXER_H
-typedef struct MixerChannel MixerChannel;
+struct MixerChannel;
enum {
MX_AUTOFREE = 1,
@@ -17,7 +17,7 @@
bool MxInitialize(uint rate);
void MxMixSamples(void* buffer, uint samples);
-MixerChannel* MxAllocateChannel(void);
+MixerChannel* MxAllocateChannel();
void MxSetChannelRawSrc(MixerChannel *mc, int8 *mem, uint size, uint rate, uint flags);
void MxSetChannelVolume(MixerChannel *mc, uint left, uint right);
void MxActivateChannel(MixerChannel*);
--- a/src/music.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/music.h Sun Mar 11 16:31:18 2007 +0000
@@ -8,10 +8,10 @@
#define NUM_SONGS_PLAYLIST 33
#define NUM_SONGS_AVAILABLE 22
-typedef struct SongSpecs {
+struct SongSpecs {
char filename[256];
char song_name[64];
-} SongSpecs;
+};
extern const SongSpecs origin_songs_specs[NUM_SONGS_AVAILABLE];
--- a/src/music/bemidi.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/music/bemidi.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -14,7 +14,7 @@
return NULL;
}
-static void bemidi_stop(void)
+static void bemidi_stop()
{
midiSynthFile.UnloadFile();
}
@@ -28,12 +28,12 @@
midiSynthFile.Start();
}
-static void bemidi_stop_song(void)
+static void bemidi_stop_song()
{
midiSynthFile.UnloadFile();
}
-static bool bemidi_is_playing(void)
+static bool bemidi_is_playing()
{
return !midiSynthFile.IsFinished();
}
--- a/src/music/dmusic.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/music/dmusic.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -107,7 +107,7 @@
}
-static void DMusicMidiStop(void)
+static void DMusicMidiStop()
{
seeking = false;
@@ -186,7 +186,7 @@
}
-static void DMusicMidiStopSong(void)
+static void DMusicMidiStopSong()
{
if (FAILED(performance->Stop(segment, NULL, 0, 0))) {
DEBUG(driver, 0, "DirectMusic: StopSegment failed");
@@ -195,7 +195,7 @@
}
-static bool DMusicMidiIsSongPlaying(void)
+static bool DMusicMidiIsSongPlaying()
{
/* Not the nicest code, but there is a short delay before playing actually
* starts. OpenTTD makes no provision for this. */
--- a/src/music/extmidi.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/music/extmidi.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -21,8 +21,8 @@
pid_t pid;
} _midi;
-static void DoPlay(void);
-static void DoStop(void);
+static void DoPlay();
+static void DoStop();
static const char* ExtMidiStart(const char* const * parm)
{
@@ -31,7 +31,7 @@
return NULL;
}
-static void ExtMidiStop(void)
+static void ExtMidiStop()
{
_midi.song[0] = '\0';
DoStop();
@@ -43,13 +43,13 @@
DoStop();
}
-static void ExtMidiStopSong(void)
+static void ExtMidiStopSong()
{
_midi.song[0] = '\0';
DoStop();
}
-static bool ExtMidiIsPlaying(void)
+static bool ExtMidiIsPlaying()
{
if (_midi.pid != -1 && waitpid(_midi.pid, NULL, WNOHANG) == _midi.pid)
_midi.pid = -1;
@@ -62,7 +62,7 @@
DEBUG(driver, 1, "extmidi: set volume not implemented");
}
-static void DoPlay(void)
+static void DoPlay()
{
_midi.pid = fork();
switch (_midi.pid) {
@@ -91,7 +91,7 @@
}
}
-static void DoStop(void)
+static void DoStop()
{
if (_midi.pid != -1) kill(_midi.pid, SIGTERM);
}
--- a/src/music/libtimidity.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/music/libtimidity.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -77,7 +77,7 @@
return NULL;
}
-static void LibtimidityMidiStop(void)
+static void LibtimidityMidiStop()
{
if (_midi.status == MIDI_PLAYING) {
_midi.status = MIDI_STOPPED;
@@ -107,13 +107,13 @@
_midi.status = MIDI_PLAYING;
}
-static void LibtimidityMidiStopSong(void)
+static void LibtimidityMidiStopSong()
{
_midi.status = MIDI_STOPPED;
mid_song_free(_midi.song);
}
-static bool LibtimidityMidiIsPlaying(void)
+static bool LibtimidityMidiIsPlaying()
{
if (_midi.status == MIDI_PLAYING) {
_midi.song_position = mid_song_get_time(_midi.song);
--- a/src/music/null_m.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/music/null_m.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -4,10 +4,10 @@
#include "null_m.h"
static const char* NullMidiStart(const char* const* parm) { return NULL; }
-static void NullMidiStop(void) {}
+static void NullMidiStop() {}
static void NullMidiPlaySong(const char *filename) {}
-static void NullMidiStopSong(void) {}
-static bool NullMidiIsSongPlaying(void) { return true; }
+static void NullMidiStopSong() {}
+static bool NullMidiIsSongPlaying() { return true; }
static void NullMidiSetVolume(byte vol) {}
const HalMusicDriver _null_music_driver = {
--- a/src/music/os2_m.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/music/os2_m.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -40,7 +40,7 @@
MidiSendCommand("play song from 0");
}
-static void OS2MidiStopSong(void)
+static void OS2MidiStopSong()
{
MidiSendCommand("close all");
}
@@ -50,7 +50,7 @@
MidiSendCommand("set song audio volume %d", ((vol/127)*100));
}
-static bool OS2MidiIsSongPlaying(void)
+static bool OS2MidiIsSongPlaying()
{
char buf[16];
mciSendString("status song mode", buf, sizeof(buf), NULL, 0);
@@ -62,7 +62,7 @@
return 0;
}
-static void OS2MidiStop(void)
+static void OS2MidiStop()
{
MidiSendCommand("close all");
}
--- a/src/music/qtmidi.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/music/qtmidi.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -173,7 +173,7 @@
* #_quicktime_started flag to @c true if QuickTime is present in the system
* and it was initialized properly.
*/
-static void InitQuickTimeIfNeeded(void)
+static void InitQuickTimeIfNeeded()
{
OSStatus dummy;
@@ -207,7 +207,7 @@
#define VOLUME ((short)((0x00FF & _quicktime_volume) << 1))
-static void StopSong(void);
+static void StopSong();
/**
@@ -230,7 +230,7 @@
* This function is called at regular intervals from OpenTTD's main loop, so
* we call @c MoviesTask() from here to let QuickTime do its work.
*/
-static bool SongIsPlaying(void)
+static bool SongIsPlaying()
{
if (!_quicktime_started) return true;
@@ -258,7 +258,7 @@
* Stops playing and frees any used resources before returning. As it
* deinitilizes QuickTime, the #_quicktime_started flag is set to @c false.
*/
-static void StopDriver(void)
+static void StopDriver()
{
if (!_quicktime_started) return;
@@ -312,7 +312,7 @@
/**
* Stops playing the current song, if the player is active.
*/
-static void StopSong(void)
+static void StopSong()
{
if (!_quicktime_started) return;
--- a/src/music/win32_m.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/music/win32_m.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -23,7 +23,7 @@
SetEvent(_midi.wait_obj);
}
-static void Win32MidiStopSong(void)
+static void Win32MidiStopSong()
{
if (_midi.playing) {
_midi.stop_song = true;
@@ -32,7 +32,7 @@
}
}
-static bool Win32MidiIsSongPlaying(void)
+static bool Win32MidiIsSongPlaying()
{
return _midi.playing;
}
@@ -62,7 +62,7 @@
return MidiSendCommand("play song from 0") == 0;
}
-static void MidiIntStopSong(void)
+static void MidiIntStopSong()
{
MidiSendCommand("close all");
}
@@ -73,7 +73,7 @@
midiOutSetVolume((HMIDIOUT)_midi.devid, v + (v << 16));
}
-static bool MidiIntIsSongPlaying(void)
+static bool MidiIntIsSongPlaying()
{
char buf[16];
mciSendStringA("status song mode", buf, sizeof(buf), 0);
@@ -146,7 +146,7 @@
return NULL;
}
-static void Win32MidiStop(void)
+static void Win32MidiStop()
{
_midi.terminate = true;
SetEvent(_midi.wait_obj);
--- a/src/music_gui.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/music_gui.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -46,7 +46,7 @@
msf.custom_2,
};
-static void SkipToPrevSong(void)
+static void SkipToPrevSong()
{
byte *b = _cur_playlist;
byte *p = b;
@@ -66,7 +66,7 @@
_song_is_active = false;
}
-static void SkipToNextSong(void)
+static void SkipToNextSong()
{
byte* b = _cur_playlist;
byte t;
@@ -88,7 +88,7 @@
_music_driver->set_volume(new_vol);
}
-static void DoPlaySong(void)
+static void DoPlaySong()
{
char filename[256];
snprintf(filename, sizeof(filename), "%s%s",
@@ -96,12 +96,12 @@
_music_driver->play_song(filename);
}
-static void DoStopMusic(void)
+static void DoStopMusic()
{
_music_driver->stop_song();
}
-static void SelectSongToPlay(void)
+static void SelectSongToPlay()
{
uint i = 0;
uint j = 0;
@@ -138,7 +138,7 @@
}
}
-static void StopMusic(void)
+static void StopMusic()
{
_music_wnd_cursong = 0;
DoStopMusic();
@@ -146,7 +146,7 @@
InvalidateWindowWidget(WC_MUSIC_WINDOW, 0, 9);
}
-static void PlayPlaylistSong(void)
+static void PlayPlaylistSong()
{
if (_cur_playlist[0] == 0) {
SelectSongToPlay();
@@ -167,13 +167,13 @@
InvalidateWindowWidget(WC_MUSIC_WINDOW, 0, 9);
}
-void ResetMusic(void)
+void ResetMusic()
{
_music_wnd_cursong = 1;
DoPlaySong();
}
-void MusicLoop(void)
+void MusicLoop()
{
if (!msf.playing && _song_is_active) {
StopMusic();
@@ -333,7 +333,7 @@
MusicTrackSelectionWndProc
};
-static void ShowMusicTrackSelection(void)
+static void ShowMusicTrackSelection()
{
BaseWindow::AllocateFront(&_music_track_selection_desc, 0);
}
@@ -501,7 +501,7 @@
MusicWindowWndProc
};
-void ShowMusicWindow(void)
+void ShowMusicWindow()
{
BaseWindow::AllocateFront(&_music_window_desc, 0);
}
--- a/src/network/core/core.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/network/core/core.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -21,7 +21,7 @@
* Initializes the network core (as that is needed for some platforms
* @return true if the core has been initialized, false otherwise
*/
-bool NetworkCoreInitialize(void)
+bool NetworkCoreInitialize()
{
#if defined(__MORPHOS__) || defined(__AMIGA__)
/*
@@ -72,7 +72,7 @@
/**
* Shuts down the network core (as that is needed for some platforms
*/
-void NetworkCoreShutdown(void)
+void NetworkCoreShutdown()
{
#if defined(__MORPHOS__) || defined(__AMIGA__)
/* free allocated resources */
--- a/src/network/core/core.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/network/core/core.h Sun Mar 11 16:31:18 2007 +0000
@@ -12,11 +12,11 @@
#include "os_abstraction.h"
#include "../../newgrf_config.h"
-bool NetworkCoreInitialize(void);
-void NetworkCoreShutdown(void);
+bool NetworkCoreInitialize();
+void NetworkCoreShutdown();
/** Status of a network client; reasons why a client has quit */
-typedef enum {
+enum NetworkRecvStatus {
NETWORK_RECV_STATUS_OKAY, ///< Everything is okay
NETWORK_RECV_STATUS_DESYNC, ///< A desync did occur
NETWORK_RECV_STATUS_NEWGRF_MISMATCH, ///< We did not have the required NewGRFs
@@ -27,7 +27,7 @@
NETWORK_RECV_STATUS_SERVER_FULL, ///< The server is full
NETWORK_RECV_STATUS_SERVER_BANNED, ///< The server has banned us
NETWORK_RECV_STATUS_CLOSE_QUERY, ///< Done quering the server
-} NetworkRecvStatus;
+};
/** Forward declaration due to circular dependencies */
struct Packet;
--- a/src/network/core/game.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/network/core/game.h Sun Mar 11 16:31:18 2007 +0000
@@ -19,7 +19,7 @@
* some fields will be empty on the client (like game_password) by default
* and only filled with data a player enters.
*/
-typedef struct NetworkGameInfo {
+struct NetworkGameInfo {
byte game_info_version; ///< Version of the game info
char server_name[NETWORK_NAME_LENGTH]; ///< Server name
char hostname[NETWORK_HOSTNAME_LENGTH]; ///< Hostname of the server (if any)
@@ -43,8 +43,8 @@
byte map_set; ///< Graphical set
bool dedicated; ///< Is this a dedicated server?
char rcon_password[NETWORK_PASSWORD_LENGTH]; ///< RCon password for the server. "" if rcon is disabled
- struct GRFConfig *grfconfig; ///< List of NewGRF files used
-} NetworkGameInfo;
+ GRFConfig *grfconfig; ///< List of NewGRF files used
+};
#endif /* ENABLE_NETWORK */
--- a/src/network/core/packet.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/network/core/packet.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -63,7 +63,7 @@
/**
* Writes the packet size from the raw packet from packet->size
*/
-void Packet::PrepareToSend(void)
+void Packet::PrepareToSend()
{
assert(this->cs == NULL && this->next == NULL);
@@ -163,7 +163,7 @@
/**
* Reads the packet size from the raw packet and stores it in the packet->size
*/
-void Packet::ReadRawPacketSize(void)
+void Packet::ReadRawPacketSize()
{
assert(this->cs != NULL && this->next == NULL);
this->size = (PacketSize)this->buffer[0];
@@ -173,7 +173,7 @@
/**
* Prepares the packet so it can be read
*/
-void Packet::PrepareToRead(void)
+void Packet::PrepareToRead()
{
this->ReadRawPacketSize();
@@ -181,12 +181,12 @@
this->pos = sizeof(PacketSize);
}
-bool Packet::Recv_bool(void)
+bool Packet::Recv_bool()
{
return this->Recv_uint8() != 0;
}
-uint8 Packet::Recv_uint8(void)
+uint8 Packet::Recv_uint8()
{
uint8 n;
@@ -196,7 +196,7 @@
return n;
}
-uint16 Packet::Recv_uint16(void)
+uint16 Packet::Recv_uint16()
{
uint16 n;
@@ -207,7 +207,7 @@
return n;
}
-uint32 Packet::Recv_uint32(void)
+uint32 Packet::Recv_uint32()
{
uint32 n;
@@ -220,7 +220,7 @@
return n;
}
-uint64 Packet::Recv_uint64(void)
+uint64 Packet::Recv_uint64()
{
uint64 n;
--- a/src/network/core/packet.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/network/core/packet.h Sun Mar 11 16:31:18 2007 +0000
@@ -43,7 +43,7 @@
Packet(PacketType type);
/* Sending/writing of packets */
- void PrepareToSend(void);
+ void PrepareToSend();
void Send_bool (bool data);
void Send_uint8 (uint8 data);
@@ -53,15 +53,15 @@
void Send_string(const char* data);
/* Reading/receiving of packets */
- void ReadRawPacketSize(void);
- void PrepareToRead(void);
+ void ReadRawPacketSize();
+ void PrepareToRead();
bool CanReadFromPacket (uint bytes_to_read);
- bool Recv_bool (void);
- uint8 Recv_uint8 (void);
- uint16 Recv_uint16(void);
- uint32 Recv_uint32(void);
- uint64 Recv_uint64(void);
+ bool Recv_bool ();
+ uint8 Recv_uint8 ();
+ uint16 Recv_uint16();
+ uint32 Recv_uint32();
+ uint64 Recv_uint64();
void Recv_string(char* buffer, size_t size);
};
--- a/src/network/core/tcp.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/network/core/tcp.h Sun Mar 11 16:31:18 2007 +0000
@@ -58,8 +58,8 @@
};
/** Packet that wraps a command */
-typedef struct CommandPacket {
- struct CommandPacket *next; ///< the next command packet (if in queue)
+struct CommandPacket {
+ CommandPacket *next; ///< the next command packet (if in queue)
PlayerByte player; ///< player that is executing the command
uint32 cmd; ///< command being executed
uint32 p1; ///< parameter p1
@@ -68,18 +68,19 @@
char text[80]; ///< possible text sent for name changes etc
uint32 frame; ///< the frame in which this packet is executed
byte callback; ///< any callback function executed upon successful completion of the command
-} CommandPacket;
+};
/** Status of a client */
-typedef enum {
+enum ClientStatus {
STATUS_INACTIVE, ///< The client is not connected nor active
+ STATUS_AUTHORIZING,///< The client is authorizing
STATUS_AUTH, ///< The client is authorized
STATUS_MAP_WAIT, ///< The client is waiting as someone else is downloading the map
STATUS_MAP, ///< The client is downloading the map
STATUS_DONE_MAP, ///< The client has downloaded the map
STATUS_PRE_ACTIVE, ///< The client is catching up the delayed frames
STATUS_ACTIVE, ///< The client is an active player in the game
-} ClientStatus;
+};
/** Base socket handler for all TCP sockets */
class NetworkTCPSocketHandler : public NetworkSocketHandler {
--- a/src/network/network.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/network/network.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -63,7 +63,7 @@
static uint16 _network_client_index = NETWORK_SERVER_INDEX + 1;
/* Some externs / forwards */
-extern void StateGameLoop(void);
+extern void StateGameLoop();
// Function that looks up the CI for a given client-index
NetworkClientInfo *NetworkFindClientInfoFromIndex(uint16 client_index)
@@ -117,7 +117,7 @@
}
}
-byte NetworkSpectatorCount(void)
+byte NetworkSpectatorCount()
{
NetworkTCPSocketHandler *cs;
byte count = 0;
@@ -301,7 +301,7 @@
}
/* Count the number of active clients connected */
-static uint NetworkCountPlayers(void)
+static uint NetworkCountPlayers()
{
NetworkTCPSocketHandler *cs;
uint count = 0;
@@ -317,7 +317,7 @@
static bool _min_players_paused = false;
/* Check if the minimum number of players has been reached and pause or unpause the game as appropriate */
-void CheckMinPlayers(void)
+void CheckMinPlayers()
{
if (!_network_dedicated) return;
@@ -337,7 +337,7 @@
}
// Find all IP-aliases for this host
-static void NetworkFindIPs(void)
+static void NetworkFindIPs()
{
#if !defined(PSP)
int i;
@@ -491,7 +491,7 @@
}
p += sizeof(struct ifreq);
-#ifdef AF_LINK
+#if defined(AF_LINK) && !defined(SUNOS)
p += req->ifr_addr.sa_len - sizeof(struct sockaddr);
#endif
}
@@ -717,7 +717,7 @@
}
// For the server, to accept new clients
-static void NetworkAcceptClients(void)
+static void NetworkAcceptClients()
{
struct sockaddr_in sin;
NetworkTCPSocketHandler *cs;
@@ -782,7 +782,7 @@
}
// Set up the listen socket for the server
-static bool NetworkListen(void)
+static bool NetworkListen()
{
SOCKET ls;
struct sockaddr_in sin;
@@ -826,7 +826,7 @@
}
// Close all current connections
-static void NetworkClose(void)
+static void NetworkClose()
{
NetworkTCPSocketHandler *cs;
@@ -848,7 +848,7 @@
}
// Inits the network (cleans sockets and stuff)
-static void NetworkInitialize(void)
+static void NetworkInitialize()
{
NetworkTCPSocketHandler *cs;
@@ -921,7 +921,7 @@
/* Generates the list of manually added hosts from NetworkGameList and
* dumps them into the array _network_host_list. This array is needed
* by the function that generates the config file. */
-void NetworkRebuildHostList(void)
+void NetworkRebuildHostList()
{
uint i = 0;
const NetworkGameList *item = _network_game_list;
@@ -968,7 +968,7 @@
return _networking;
}
-static void NetworkInitGameInfo(void)
+static void NetworkInitGameInfo()
{
NetworkClientInfo *ci;
@@ -1013,7 +1013,7 @@
ttd_strlcpy(ci->unique_id, _network_unique_id, sizeof(ci->unique_id));
}
-bool NetworkServerStart(void)
+bool NetworkServerStart()
{
if (!_network_available) return false;
@@ -1060,7 +1060,7 @@
// The server is rebooting...
// The only difference with NetworkDisconnect, is the packets that is sent
-void NetworkReboot(void)
+void NetworkReboot()
{
if (_network_server) {
NetworkTCPSocketHandler *cs;
@@ -1084,7 +1084,7 @@
}
// We want to disconnect from the host/clients
-void NetworkDisconnect(void)
+void NetworkDisconnect()
{
if (_network_server) {
NetworkTCPSocketHandler *cs;
@@ -1112,7 +1112,7 @@
}
// Receives something from the network
-static bool NetworkReceive(void)
+static bool NetworkReceive()
{
NetworkTCPSocketHandler *cs;
int n;
@@ -1167,7 +1167,7 @@
}
// This sends all buffered commands (if possible)
-static void NetworkSend(void)
+static void NetworkSend()
{
NetworkTCPSocketHandler *cs;
FOR_ALL_CLIENTS(cs) {
@@ -1183,7 +1183,7 @@
}
// Handle the local-command-queue
-static void NetworkHandleLocalQueue(void)
+static void NetworkHandleLocalQueue()
{
CommandPacket *cp, **cp_prev;
@@ -1218,7 +1218,7 @@
}
-static bool NetworkDoClientLoop(void)
+static bool NetworkDoClientLoop()
{
_frame_counter++;
@@ -1259,7 +1259,7 @@
}
// We have to do some UDP checking
-void NetworkUDPGameLoop(void)
+void NetworkUDPGameLoop()
{
if (_network_udp_server) {
_udp_server_socket->ReceivePackets();
@@ -1273,7 +1273,7 @@
// The main loop called from ttd.c
// Here we also have to do StateGameLoop if needed!
-void NetworkGameLoop(void)
+void NetworkGameLoop()
{
if (!_networking) return;
@@ -1318,7 +1318,7 @@
NetworkSend();
}
-static void NetworkGenerateUniqueId(void)
+static void NetworkGenerateUniqueId()
{
md5_state_t state;
md5_byte_t digest[16];
@@ -1372,7 +1372,7 @@
}
/** This tries to launch the network for a given OS */
-void NetworkStartUp(void)
+void NetworkStartUp()
{
DEBUG(net, 3, "[core] starting network...");
@@ -1409,7 +1409,7 @@
}
/** This shuts the network down */
-void NetworkShutDown(void)
+void NetworkShutDown()
{
NetworkDisconnect();
NetworkUDPShutdown();
--- a/src/network/network.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/network/network.h Sun Mar 11 16:31:18 2007 +0000
@@ -40,7 +40,7 @@
#define NETWORK_VEHICLE_TYPES 5
#define NETWORK_STATION_TYPES 5
-typedef struct NetworkPlayerInfo {
+struct NetworkPlayerInfo {
char company_name[NETWORK_NAME_LENGTH]; // Company name
char password[NETWORK_PASSWORD_LENGTH]; // The password for the player
Year inaugurated_year; // What year the company started in
@@ -53,9 +53,9 @@
uint16 num_station[NETWORK_STATION_TYPES]; // How many stations are there of this type?
char players[NETWORK_PLAYERS_LENGTH]; // The players that control this company (Name1, name2, ..)
uint16 months_empty; // How many months the company is empty
-} NetworkPlayerInfo;
+};
-typedef struct NetworkClientInfo {
+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
@@ -63,9 +63,9 @@
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
-} NetworkClientInfo;
+};
-typedef enum {
+enum NetworkJoinStatus {
NETWORK_JOIN_STATUS_CONNECTING,
NETWORK_JOIN_STATUS_AUTHORIZING,
NETWORK_JOIN_STATUS_WAITING,
@@ -74,15 +74,15 @@
NETWORK_JOIN_STATUS_REGISTERING,
NETWORK_JOIN_STATUS_GETTING_COMPANY_INFO,
-} NetworkJoinStatus;
+};
// language ids for server_lang and client_lang
-typedef enum {
+enum NetworkLanguage {
NETLANG_ANY = 0,
NETLANG_ENGLISH = 1,
NETLANG_GERMAN = 2,
NETLANG_FRENCH = 3,
-} NetworkLanguage;
+};
VARDEF NetworkGameInfo _network_game_info;
VARDEF NetworkPlayerInfo _network_player_info[MAX_PLAYERS];
@@ -153,7 +153,7 @@
void NetworkTCPQueryServer(const char* host, unsigned short port);
-byte NetworkSpectatorCount(void);
+byte NetworkSpectatorCount();
VARDEF char *_network_host_list[10];
VARDEF char *_network_ban_list[25];
@@ -161,22 +161,22 @@
void ParseConnectionString(const char **player, const char **port, char *connection_string);
void NetworkUpdateClientInfo(uint16 client_index);
void NetworkAddServer(const char *b);
-void NetworkRebuildHostList(void);
+void NetworkRebuildHostList();
bool NetworkChangeCompanyPassword(byte argc, char *argv[]);
-void NetworkPopulateCompanyInfo(void);
+void NetworkPopulateCompanyInfo();
void UpdateNetworkGameWindow(bool unselect);
-void CheckMinPlayers(void);
+void CheckMinPlayers();
void NetworkStartDebugLog(const char *hostname, uint16 port);
-void NetworkStartUp(void);
+void NetworkStartUp();
void NetworkUDPCloseAll();
-void NetworkShutDown(void);
-void NetworkGameLoop(void);
-void NetworkUDPGameLoop(void);
-bool NetworkServerStart(void);
+void NetworkShutDown();
+void NetworkGameLoop();
+void NetworkUDPGameLoop();
+bool NetworkServerStart();
bool NetworkClientConnectGame(const char *host, uint16 port);
-void NetworkReboot(void);
-void NetworkDisconnect(void);
+void NetworkReboot();
+void NetworkDisconnect();
bool IsNetworkCompatibleVersion(const char *version);
@@ -188,8 +188,8 @@
#else /* ENABLE_NETWORK */
/* Network function stubs when networking is disabled */
-static inline void NetworkStartUp(void) {}
-static inline void NetworkShutDown(void) {}
+static inline void NetworkStartUp() {}
+static inline void NetworkShutDown() {}
#define _networking 0
#define _network_server 0
--- a/src/network/network_client.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/network/network_client.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -840,7 +840,7 @@
assert_compile(lengthof(_network_client_packet) == PACKET_END);
// Is called after a client is connected to the server
-void NetworkClient_Connected(void)
+void NetworkClient_Connected()
{
// Set the frame-counter to 0 so nothing happens till we are ready
_frame_counter = 0;
--- a/src/network/network_client.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/network/network_client.h Sun Mar 11 16:31:18 2007 +0000
@@ -18,7 +18,7 @@
DEF_CLIENT_SEND_COMMAND_PARAM(PACKET_CLIENT_RCON)(const char *pass, const char *command);
NetworkRecvStatus NetworkClient_ReadPackets(NetworkTCPSocketHandler *cs);
-void NetworkClient_Connected(void);
+void NetworkClient_Connected();
#endif /* ENABLE_NETWORK */
--- a/src/network/network_data.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/network/network_data.h Sun Mar 11 16:31:18 2007 +0000
@@ -20,13 +20,13 @@
#define NETWORK_SERVER_INDEX 1
#define NETWORK_EMPTY_INDEX 0
-typedef enum {
+enum MapPacket {
MAP_PACKET_START,
MAP_PACKET_NORMAL,
MAP_PACKET_END,
-} MapPacket;
+};
-typedef enum {
+enum NetworkErrorCode {
NETWORK_ERROR_GENERAL, // Try to use thisone like never
// Signals from clients
@@ -46,10 +46,10 @@
NETWORK_ERROR_KICKED,
NETWORK_ERROR_CHEATER,
NETWORK_ERROR_FULL,
-} NetworkErrorCode;
+};
// Actions that can be used for NetworkTextMessage
-typedef enum {
+enum NetworkAction {
NETWORK_ACTION_JOIN,
NETWORK_ACTION_LEAVE,
NETWORK_ACTION_SERVER_MESSAGE,
@@ -58,18 +58,18 @@
NETWORK_ACTION_CHAT_CLIENT,
NETWORK_ACTION_GIVE_MONEY,
NETWORK_ACTION_NAME_CHANGE,
-} NetworkAction;
+};
-typedef enum {
+enum NetworkPasswordType {
NETWORK_GAME_PASSWORD,
NETWORK_COMPANY_PASSWORD,
-} NetworkPasswordType;
+};
-typedef enum {
+enum DestType {
DESTTYPE_BROADCAST, ///< Send message/notice to all players (All)
DESTTYPE_TEAM, ///< Send message/notice to everyone playing the same company (Team)
DESTTYPE_CLIENT, ///< Send message/notice to only a certain player (Private)
-} DestType;
+};
// following externs are instantiated at network.cpp
extern CommandPacket *_local_command_queue;
@@ -84,7 +84,7 @@
// Macros to make life a bit more easier
#define DEF_CLIENT_RECEIVE_COMMAND(type) NetworkRecvStatus NetworkPacketReceive_ ## type ## _command(Packet *p)
-#define DEF_CLIENT_SEND_COMMAND(type) void NetworkPacketSend_ ## type ## _command(void)
+#define DEF_CLIENT_SEND_COMMAND(type) void NetworkPacketSend_ ## type ## _command()
#define DEF_CLIENT_SEND_COMMAND_PARAM(type) void NetworkPacketSend_ ## type ## _command
#define DEF_SERVER_RECEIVE_COMMAND(type) void NetworkPacketReceive_ ## type ## _command(NetworkTCPSocketHandler *cs, Packet *p)
#define DEF_SERVER_SEND_COMMAND(type) void NetworkPacketSend_ ## type ## _command(NetworkTCPSocketHandler *cs)
@@ -104,7 +104,7 @@
void CDECL NetworkTextMessage(NetworkAction action, uint16 color, bool self_send, const char *name, const char *str, ...);
void NetworkGetClientName(char *clientname, size_t size, const NetworkTCPSocketHandler *cs);
uint NetworkCalculateLag(const NetworkTCPSocketHandler *cs);
-byte NetworkGetCurrentLanguageIndex(void);
+byte NetworkGetCurrentLanguageIndex();
NetworkClientInfo *NetworkFindClientInfoFromIndex(uint16 client_index);
NetworkClientInfo *NetworkFindClientInfoFromIP(const char *ip);
NetworkTCPSocketHandler *NetworkFindClientStateFromIndex(uint16 client_index);
--- a/src/network/network_gamelist.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/network/network_gamelist.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -89,7 +89,7 @@
};
/** Requeries the (game) servers we have not gotten a reply from */
-void NetworkGameListRequery(void)
+void NetworkGameListRequery()
{
static uint8 requery_cnt = 0;
--- a/src/network/network_gamelist.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/network/network_gamelist.h Sun Mar 11 16:31:18 2007 +0000
@@ -19,6 +19,6 @@
NetworkGameList *NetworkGameListAddItem(uint32 ip, uint16 port);
void NetworkGameListRemoveItem(NetworkGameList *remove);
-void NetworkGameListRequery(void);
+void NetworkGameListRequery();
#endif /* NETWORK_GAMELIST_H */
--- a/src/network/network_gui.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/network/network_gui.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -32,20 +32,20 @@
#define BGC 5
#define BTC 15
-typedef struct network_d {
+struct network_d {
PlayerID company; // select company in network lobby
byte field; // select text-field in start-server and game-listing
NetworkGameList *server; // selected server in lobby and game-listing
FiosItem *map; // selected map in start-server
-} network_d;
+};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(network_d));
-typedef struct network_ql_d {
+struct network_ql_d {
network_d n; // see above; general stuff
querystr_d q; // text-input in start-server and game-listing
NetworkGameList **sort_list; // list of games (sorted)
list_d l; // accompanying list-administration
-} network_ql_d;
+};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(network_ql_d));
/* Global to remember sorting after window has been closed */
@@ -54,7 +54,7 @@
static char _edit_str_buf[150];
static bool _chat_tab_completion_active;
-static void ShowNetworkStartServerWindow(void);
+static void ShowNetworkStartServerWindow();
static void ShowNetworkLobbyWindow(NetworkGameList *ngl);
extern void SwitchMode(int new_mode);
@@ -551,7 +551,7 @@
NetworkGameWindowWndProc,
};
-void ShowNetworkGameWindow(void)
+void ShowNetworkGameWindow()
{
static bool first = true;
BaseWindow *w;
@@ -778,7 +778,7 @@
NetworkStartServerWindowWndProc,
};
-static void ShowNetworkStartServerWindow(void)
+static void ShowNetworkStartServerWindow()
{
BaseWindow *w;
DeleteWindowById(WC_NETWORK_WINDOW, 0);
@@ -1151,7 +1151,7 @@
}
// Finds the amount of actions in the popup and set the height correct
-static uint ClientListPopupHeigth(void) {
+static uint ClientListPopupHeigth() {
int i, num = 0;
// Find the amount of actions
@@ -1368,7 +1368,7 @@
}
}
-void ShowClientList(void)
+void ShowClientList()
{
BaseWindow::AllocateFront(&_client_list_desc, 0);
}
@@ -1460,7 +1460,7 @@
NetworkJoinStatusWindowWndProc,
};
-void ShowJoinStatusWindow(void)
+void ShowJoinStatusWindow()
{
BaseWindow *w;
DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
--- a/src/network/network_gui.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/network/network_gui.h Sun Mar 11 16:31:18 2007 +0000
@@ -10,16 +10,16 @@
void ShowNetworkNeedPassword(NetworkPasswordType npt);
void ShowNetworkGiveMoneyWindow(PlayerID player); // PlayerID
void ShowNetworkChatQueryWindow(DestType type, byte dest);
-void ShowJoinStatusWindow(void);
-void ShowNetworkGameWindow(void);
-void ShowClientList(void);
+void ShowJoinStatusWindow();
+void ShowNetworkGameWindow();
+void ShowClientList();
#else /* ENABLE_NETWORK */
/* Network function stubs when networking is disabled */
static inline void ShowNetworkChatQueryWindow(byte desttype, byte dest) {}
-static inline void ShowClientList(void) {}
-static inline void ShowNetworkGameWindow(void) {}
+static inline void ShowClientList() {}
+static inline void ShowNetworkGameWindow() {}
#endif /* ENABLE_NETWORK */
--- a/src/network/network_server.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/network/network_server.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -214,6 +214,11 @@
// uint8: Type of password
//
+ /* Invalid packet when status is AUTH or higher */
+ if (cs->status >= STATUS_AUTH) return;
+
+ cs->status = STATUS_AUTHORIZING;
+
Packet *p = NetworkSend_Init(PACKET_SERVER_NEED_PASSWORD);
p->Send_uint8(type);
cs->Send_Packet(p);
@@ -692,7 +697,7 @@
type = (NetworkPasswordType)p->Recv_uint8();
p->Recv_string(password, sizeof(password));
- if (cs->status == STATUS_INACTIVE && type == NETWORK_GAME_PASSWORD) {
+ if (cs->status == STATUS_AUTHORIZING && type == NETWORK_GAME_PASSWORD) {
// Check game-password
if (strcmp(password, _network_game_info.server_password) != 0) {
// Password is invalid
@@ -710,7 +715,7 @@
// Valid password, allow user
SEND_COMMAND(PACKET_SERVER_WELCOME)(cs);
return;
- } else if (cs->status == STATUS_INACTIVE && type == NETWORK_COMPANY_PASSWORD) {
+ } else if (cs->status == STATUS_AUTHORIZING && type == NETWORK_COMPANY_PASSWORD) {
ci = DEREF_CLIENT_INFO(cs);
if (strcmp(password, _network_player_info[ci->client_playas].password) != 0) {
@@ -1223,7 +1228,7 @@
assert_compile(lengthof(_network_server_packet) == PACKET_END);
// This update the company_info-stuff
-void NetworkPopulateCompanyInfo(void)
+void NetworkPopulateCompanyInfo()
{
char password[NETWORK_PASSWORD_LENGTH];
const Player *p;
@@ -1276,11 +1281,11 @@
if (!IsValidPlayer(v->owner)) continue;
switch (v->type) {
- case VEH_Train:
+ case VEH_TRAIN:
if (IsFrontEngine(v)) _network_player_info[v->owner].num_vehicle[0]++;
break;
- case VEH_Road:
+ case VEH_ROAD:
if (v->cargo_type != CT_PASSENGERS) {
_network_player_info[v->owner].num_vehicle[1]++;
} else {
@@ -1288,16 +1293,16 @@
}
break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
if (IsNormalAircraft(v)) _network_player_info[v->owner].num_vehicle[3]++;
break;
- case VEH_Ship:
+ case VEH_SHIP:
_network_player_info[v->owner].num_vehicle[4]++;
break;
- case VEH_Special:
- case VEH_Disaster:
+ case VEH_SPECIAL:
+ case VEH_DISASTER:
break;
}
}
@@ -1350,7 +1355,7 @@
}
/* Check if we want to restart the map */
-static void NetworkCheckRestartMap(void)
+static void NetworkCheckRestartMap()
{
if (_network_restart_game_year != 0 && _cur_year >= _network_restart_game_year) {
DEBUG(net, 0, "Auto-restarting map. Year %d reached", _cur_year);
@@ -1364,7 +1369,7 @@
1) If a company is not protected, it is closed after 1 year (for example)
2) If a company is protected, protection is disabled after 3 years (for example)
(and item 1. happens a year later) */
-static void NetworkAutoCleanCompanies(void)
+static void NetworkAutoCleanCompanies()
{
NetworkTCPSocketHandler *cs;
const NetworkClientInfo *ci;
@@ -1533,6 +1538,12 @@
IConsolePrintF(_icolour_err,"Client #%d is dropped because it took longer than %d ticks for him to join", cs->index, _network_max_join_time);
NetworkCloseClient(cs);
}
+ } else if (cs->status == STATUS_INACTIVE) {
+ int lag = NetworkCalculateLag(cs);
+ if (lag > 4 * DAY_TICKS) {
+ IConsolePrintF(_icolour_err,"Client #%d is dropped because it took longer than %d ticks to start the joining process", cs->index, 4 * DAY_TICKS);
+ NetworkCloseClient(cs);
+ }
}
if (cs->status >= STATUS_PRE_ACTIVE) {
@@ -1553,12 +1564,12 @@
NetworkUDPAdvertise();
}
-void NetworkServerYearlyLoop(void)
+void NetworkServerYearlyLoop()
{
NetworkCheckRestartMap();
}
-void NetworkServerMonthlyLoop(void)
+void NetworkServerMonthlyLoop()
{
NetworkAutoCleanCompanies();
}
--- a/src/network/network_server.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/network/network_server.h Sun Mar 11 16:31:18 2007 +0000
@@ -17,8 +17,8 @@
bool NetworkServer_ReadPackets(NetworkTCPSocketHandler *cs);
void NetworkServer_Tick(bool send_frame);
-void NetworkServerMonthlyLoop(void);
-void NetworkServerYearlyLoop(void);
+void NetworkServerMonthlyLoop();
+void NetworkServerYearlyLoop();
static inline const char* GetPlayerIP(const NetworkClientInfo* ci)
{
@@ -31,8 +31,8 @@
#else /* ENABLE_NETWORK */
/* Network function stubs when networking is disabled */
-static inline void NetworkServerMonthlyLoop(void) {}
-static inline void NetworkServerYearlyLoop(void) {}
+static inline void NetworkServerMonthlyLoop() {}
+static inline void NetworkServerYearlyLoop() {}
#endif /* ENABLE_NETWORK */
--- a/src/network/network_udp.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/network/network_udp.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -288,8 +288,8 @@
struct sockaddr_in out_addr;
for (c = item->info.grfconfig; c != NULL; c = c->next) {
- if (HASBIT(c->flags, GCF_NOT_FOUND)) item->info.compatible = false;
- if (!HASBIT(c->flags, GCF_NOT_FOUND) || strcmp(c->name, UNKNOWN_GRF_NAME_PLACEHOLDER) != 0) continue;
+ if (c->status == GCS_NOT_FOUND) item->info.compatible = false;
+ if (c->status == GCS_NOT_FOUND || strcmp(c->name, UNKNOWN_GRF_NAME_PLACEHOLDER) != 0) continue;
in_request[in_request_count] = c;
in_request_count++;
}
@@ -392,7 +392,7 @@
* already resolved name for this GRF (another server has sent the
* name of the GRF already */
config->name = FindUnknownGRFName(config->grfid, config->md5sum, true);
- SETBIT(config->flags, GCF_NOT_FOUND);
+ config->status = GCS_NOT_FOUND;
} else {
config->filename = f->filename;
config->name = f->name;
@@ -402,7 +402,7 @@
}
// Close UDP connection
-void NetworkUDPCloseAll(void)
+void NetworkUDPCloseAll()
{
DEBUG(net, 1, "[udp] closed listeners");
@@ -435,7 +435,7 @@
// Request the the server-list from the master server
-void NetworkUDPQueryMasterServer(void)
+void NetworkUDPQueryMasterServer()
{
struct sockaddr_in out_addr;
@@ -458,7 +458,7 @@
}
// Find all servers
-void NetworkUDPSearchGame(void)
+void NetworkUDPSearchGame()
{
// We are still searching..
if (_network_udp_broadcast > 0) return;
@@ -504,7 +504,7 @@
}
/* Remove our advertise from the master-server */
-void NetworkUDPRemoveAdvertise(void)
+void NetworkUDPRemoveAdvertise()
{
struct sockaddr_in out_addr;
@@ -533,7 +533,7 @@
/* Register us to the master server
This function checks if it needs to send an advertise */
-void NetworkUDPAdvertise(void)
+void NetworkUDPAdvertise()
{
struct sockaddr_in out_addr;
@@ -580,7 +580,7 @@
_udp_master_socket->SendPacket(&p, &out_addr);
}
-void NetworkUDPInitialize(void)
+void NetworkUDPInitialize()
{
_udp_client_socket = new ClientNetworkUDPSocketHandler();
_udp_server_socket = new ServerNetworkUDPSocketHandler();
@@ -590,7 +590,7 @@
_network_udp_broadcast = 0;
}
-void NetworkUDPShutdown(void)
+void NetworkUDPShutdown()
{
NetworkUDPCloseAll();
--- a/src/network/network_udp.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/network/network_udp.h Sun Mar 11 16:31:18 2007 +0000
@@ -5,13 +5,13 @@
#ifdef ENABLE_NETWORK
-void NetworkUDPInitialize(void);
-void NetworkUDPSearchGame(void);
-void NetworkUDPQueryMasterServer(void);
+void NetworkUDPInitialize();
+void NetworkUDPSearchGame();
+void NetworkUDPQueryMasterServer();
void NetworkUDPQueryServer(const char* host, unsigned short port, bool manually = false);
-void NetworkUDPAdvertise(void);
-void NetworkUDPRemoveAdvertise(void);
-void NetworkUDPShutdown(void);
+void NetworkUDPAdvertise();
+void NetworkUDPRemoveAdvertise();
+void NetworkUDPShutdown();
#endif /* ENABLE_NETWORK */
--- a/src/newgrf.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/newgrf.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -73,15 +73,15 @@
static CargoLabel _default_cargo_list[_default_cargo_max];
-typedef enum GrfDataType {
+enum GrfDataType {
GDT_SOUND,
-} GrfDataType;
+};
static byte _grf_data_blocks;
static GrfDataType _grf_data_type;
-typedef enum grfspec_feature {
+enum grfspec_feature {
GSF_TRAIN,
GSF_ROAD,
GSF_SHIP,
@@ -95,19 +95,19 @@
GSF_INDUSTRIES,
GSF_CARGOS,
GSF_SOUNDFX,
-} grfspec_feature;
+};
typedef void (*SpecialSpriteHandler)(byte *buf, int len);
-static const int _vehcounts[4] = {
+static const uint _vehcounts[4] = {
/* GSF_TRAIN */ NUM_TRAIN_ENGINES,
/* GSF_ROAD */ NUM_ROAD_ENGINES,
/* GSF_SHIP */ NUM_SHIP_ENGINES,
/* GSF_AIRCRAFT */ NUM_AIRCRAFT_ENGINES
};
-static const int _vehshifts[4] = {
+static const uint _vehshifts[4] = {
/* GSF_TRAIN */ 0,
/* GSF_ROAD */ ROAD_ENGINES_INDEX,
/* GSF_SHIP */ SHIP_ENGINES_INDEX,
@@ -365,7 +365,7 @@
FOR_EACH_OBJECT {
uint8 ctype = grf_load_byte(&buf);
- if (ctype < NUM_CARGO) {
+ if (ctype < NUM_CARGO && HASBIT(_cargo_mask, ctype)) {
rvi[i].cargo_type = ctype;
} else {
rvi[i].cargo_type = CT_INVALID;
@@ -557,7 +557,7 @@
FOR_EACH_OBJECT {
uint8 cargo = grf_load_byte(&buf);
- if (cargo < NUM_CARGO) {
+ if (cargo < NUM_CARGO && HASBIT(_cargo_mask, cargo)) {
rvi[i].cargo_type = cargo;
} else {
rvi[i].cargo_type = CT_INVALID;
@@ -671,7 +671,7 @@
FOR_EACH_OBJECT {
uint8 cargo = grf_load_byte(&buf);
- if (cargo < NUM_CARGO) {
+ if (cargo < NUM_CARGO && HASBIT(_cargo_mask, cargo)) {
svi[i].cargo_type = cargo;
} else {
svi[i].cargo_type = CT_INVALID;
@@ -881,13 +881,11 @@
switch (prop) {
case 0x08: /* Class ID */
FOR_EACH_OBJECT {
- uint32 classid;
-
/* Property 0x08 is special; it is where the station is allocated */
if (statspec[i] == NULL) statspec[i] = CallocT<StationSpec>(1);
/* Swap classid because we read it in BE meaning WAYP or DFLT */
- classid = grf_load_dword(&buf);
+ uint32 classid = grf_load_dword(&buf);
statspec[i]->sclass = AllocateStationClass(BSWAP32(classid));
}
break;
@@ -895,13 +893,12 @@
case 0x09: /* Define sprite layout */
FOR_EACH_OBJECT {
StationSpec *statspec = _cur_grffile->stations[stid + i];
- uint t;
statspec->tiles = grf_load_extended(&buf);
statspec->renderdata = CallocT<DrawTileSprites>(statspec->tiles);
statspec->copied_renderdata = false;
- for (t = 0; t < statspec->tiles; t++) {
+ for (uint t = 0; t < statspec->tiles; t++) {
DrawTileSprites *dts = &statspec->renderdata[t];
uint seq_count = 0;
@@ -1127,11 +1124,9 @@
}
for (; numtables-- != 0; tableid++) {
- byte sprite;
-
if (tableid >= 7) { // skip invalid data
grfmsg(1, "BridgeChangeInfo: Table %d >= 7, skipping", tableid);
- for (sprite = 0; sprite < 32; sprite++) grf_load_dword(&buf);
+ for (byte sprite = 0; sprite < 32; sprite++) grf_load_dword(&buf);
continue;
}
@@ -1139,7 +1134,7 @@
bridge->sprite_table[tableid] = MallocT<PalSpriteID>(32);
}
- for (sprite = 0; sprite < 32; sprite++) {
+ for (byte sprite = 0; sprite < 32; sprite++) {
SpriteID image = grf_load_word(&buf);
SpriteID pal = grf_load_word(&buf);
@@ -1388,10 +1383,6 @@
/* GSF_SOUNDFX */ SoundEffectChangeInfo,
};
- uint8 feature;
- uint8 numprops;
- uint8 numinfo;
- byte engine;
EngineInfo *ei = NULL;
if (len == 1) {
@@ -1401,10 +1392,10 @@
if (!check_length(len, 6, "FeatureChangeInfo")) return;
buf++;
- feature = grf_load_byte(&buf);
- numprops = grf_load_byte(&buf);
- numinfo = grf_load_byte(&buf);
- engine = grf_load_byte(&buf);
+ uint8 feature = grf_load_byte(&buf);
+ uint8 numprops = grf_load_byte(&buf);
+ uint8 numinfo = grf_load_byte(&buf);
+ uint8 engine = grf_load_byte(&buf);
grfmsg(6, "FeatureChangeInfo: feature %d, %d properties, to apply to %d+%d",
feature, numprops, engine, numinfo);
@@ -1461,15 +1452,17 @@
break;
default:
- if (handler[feature](engine, numinfo, prop, &buf, bufend - buf))
+ if (handler[feature](engine, numinfo, prop, &buf, bufend - buf)) {
ignoring = true;
+ }
break;
}
break;
default:
- if (handler[feature](engine, numinfo, prop, &buf, bufend - buf))
+ if (handler[feature](engine, numinfo, prop, &buf, bufend - buf)) {
ignoring = true;
+ }
break;
}
@@ -1480,11 +1473,6 @@
/* Action 0x00 (GLS_SAFETYSCAN) */
static void SafeChangeInfo(byte *buf, int len)
{
- uint8 feature;
- uint8 numprops;
- uint8 numinfo;
- uint8 index;
-
if (len == 1) {
grfmsg(8, "Silently ignoring one-byte special sprite 0x00");
return;
@@ -1492,10 +1480,10 @@
if (!check_length(len, 6, "SafeChangeInfo")) return;
buf++;
- feature = grf_load_byte(&buf);
- numprops = grf_load_byte(&buf);
- numinfo = grf_load_byte(&buf);
- index = grf_load_byte(&buf);
+ uint8 feature = grf_load_byte(&buf);
+ uint8 numprops = grf_load_byte(&buf);
+ grf_load_byte(&buf);
+ grf_load_byte(&buf);
if (feature == GSF_BRIDGE && numprops == 1) {
uint8 prop = grf_load_byte(&buf);
@@ -1514,10 +1502,6 @@
static void InitChangeInfo(byte *buf, int len)
{
byte *bufend = buf + len;
- uint8 feature;
- uint8 numprops;
- uint8 numinfo;
- uint8 index;
if (len == 1) {
grfmsg(8, "Silently ignoring one-byte special sprite 0x00");
@@ -1526,10 +1510,10 @@
if (!check_length(len, 6, "InitChangeInfo")) return;
buf++;
- feature = grf_load_byte(&buf);
- numprops = grf_load_byte(&buf);
- numinfo = grf_load_byte(&buf);
- index = grf_load_byte(&buf);
+ uint8 feature = grf_load_byte(&buf);
+ uint8 numprops = grf_load_byte(&buf);
+ uint8 numinfo = grf_load_byte(&buf);
+ uint8 index = grf_load_byte(&buf);
while (numprops-- && buf < bufend) {
uint8 prop = grf_load_byte(&buf);
@@ -1613,19 +1597,13 @@
* vehicle directions in each sprite set
* Set num-dirs=8, unless your sprites are symmetric.
* In that case, use num-dirs=4.
- * For stations, must be 12 (hex) for the eighteen
- * different sprites that make up a station */
- /* TODO: No stations support. */
- uint8 feature;
- uint num_sets;
- uint num_ents;
- uint i;
+ */
if (!check_length(len, 4, "NewSpriteSet")) return;
buf++;
- feature = grf_load_byte(&buf);
- num_sets = grf_load_byte(&buf);
- num_ents = grf_load_extended(&buf);
+ uint8 feature = grf_load_byte(&buf);
+ uint8 num_sets = grf_load_byte(&buf);
+ uint16 num_ents = grf_load_extended(&buf);
_cur_grffile->spriteset_start = _cur_spriteid;
_cur_grffile->spriteset_feature = feature;
@@ -1636,7 +1614,7 @@
_cur_spriteid, feature, num_sets, num_ents, num_sets * num_ents
);
- for (i = 0; i < num_sets * num_ents; i++) {
+ for (uint i = 0; i < num_sets * num_ents; i++) {
LoadNextSprite(_cur_spriteid++, _file_index);
_nfo_line++;
}
@@ -1699,18 +1677,15 @@
* otherwise it specifies a number of entries, the exact
* meaning depends on the feature
* V feature-specific-data (huge mess, don't even look it up --pasky) */
- uint8 feature;
- uint8 setid;
- uint8 type;
SpriteGroup *group = NULL;
byte *bufend = buf + len;
if (!check_length(len, 5, "NewSpriteGroup")) return;
buf++;
- feature = grf_load_byte(&buf);
- setid = grf_load_byte(&buf);
- type = grf_load_byte(&buf);
+ uint8 feature = grf_load_byte(&buf);
+ uint8 setid = grf_load_byte(&buf);
+ uint8 type = grf_load_byte(&buf);
if (setid >= _cur_grffile->spritegroups_count) {
// Allocate memory for new sprite group references.
@@ -1731,7 +1706,6 @@
{
byte varadjust;
byte varsize;
- uint i;
/* Check we can load the var size parameter */
if (!check_length(bufend - buf, 1, "NewSpriteGroup (Deterministic) (1)")) return;
@@ -1794,7 +1768,7 @@
if (!check_length(bufend - buf, 2 + (2 + 2 * varsize) * group->g.determ.num_ranges, "NewSpriteGroup (Deterministic)")) return;
- for (i = 0; i < group->g.determ.num_ranges; i++) {
+ for (uint i = 0; i < group->g.determ.num_ranges; i++) {
group->g.determ.ranges[i].group = GetGroupFromGroupID(setid, type, grf_load_word(&buf));
group->g.determ.ranges[i].low = grf_load_var(varsize, &buf);
group->g.determ.ranges[i].high = grf_load_var(varsize, &buf);
@@ -1808,16 +1782,13 @@
case 0x80: // Self scope
case 0x83: // Parent scope
{
- byte triggers;
- uint i;
-
if (!check_length(bufend - buf, 7, "NewSpriteGroup (Randomized) (1)")) return;
group = AllocateSpriteGroup();
group->type = SGT_RANDOMIZED;
group->g.random.var_scope = HASBIT(type, 1) ? VSG_SCOPE_PARENT : VSG_SCOPE_SELF;
- triggers = grf_load_byte(&buf);
+ uint8 triggers = grf_load_byte(&buf);
group->g.random.triggers = GB(triggers, 0, 7);
group->g.random.cmp_mode = HASBIT(triggers, 7) ? RSG_CMP_ALL : RSG_CMP_ANY;
group->g.random.lowest_randbit = grf_load_byte(&buf);
@@ -1826,7 +1797,7 @@
if (!check_length(bufend - buf, 2 * group->g.random.num_groups, "NewSpriteGroup (Randomized) (2)")) return;
- for (i = 0; i < group->g.random.num_groups; i++) {
+ for (uint i = 0; i < group->g.random.num_groups; i++) {
group->g.random.groups[i] = GetGroupFromGroupID(setid, type, grf_load_word(&buf));
}
@@ -1848,7 +1819,6 @@
byte sprites = _cur_grffile->spriteset_numents;
byte num_loaded = type;
byte num_loading = grf_load_byte(&buf);
- uint i;
if (_cur_grffile->spriteset_start == 0) {
grfmsg(0, "NewSpriteGroup: No sprite set to work on! Skipping");
@@ -1868,13 +1838,13 @@
grfmsg(6, "NewSpriteGroup: New SpriteGroup 0x%02X, %u views, %u loaded, %u loading",
setid, sprites, num_loaded, num_loading);
- for (i = 0; i < num_loaded; i++) {
+ for (uint i = 0; i < num_loaded; i++) {
uint16 spriteid = grf_load_word(&buf);
group->g.real.loaded[i] = CreateGroupFromGroupID(feature, setid, type, spriteid, sprites);
grfmsg(8, "NewSpriteGroup: + rg->loaded[%i] = subset %u", i, spriteid);
}
- for (i = 0; i < num_loading; i++) {
+ for (uint i = 0; i < num_loading; i++) {
uint16 spriteid = grf_load_word(&buf);
group->g.real.loading[i] = CreateGroupFromGroupID(feature, setid, type, spriteid, sprites);
grfmsg(8, "NewSpriteGroup: + rg->loading[%i] = subset %u", i, spriteid);
@@ -1943,26 +1913,22 @@
static byte *last_engines;
static int last_engines_count;
- uint8 feature;
- uint8 idcount;
- bool wagover;
- uint8 cidcount;
- int c, i;
if (!check_length(len, 6, "FeatureMapSpriteGroup")) return;
- feature = buf[1];
- idcount = buf[2] & 0x7F;
- wagover = (buf[2] & 0x80) == 0x80;
+
+ uint8 feature = buf[1];
+ uint8 idcount = buf[2] & 0x7F;
+ bool wagover = (buf[2] & 0x80) == 0x80;
+
if (!check_length(len, 3 + idcount, "FeatureMapSpriteGroup")) return;
- /* If ``n-id'' (or ``idcount'') is zero, this is a ``feature
- * callback''. */
+ /* If idcount is zero, this is a feature callback */
if (idcount == 0) {
grfmsg(2, "FeatureMapSpriteGroup: Feature callbacks not implemented yet");
return;
}
- cidcount = buf[3 + idcount];
+ uint8 cidcount = buf[3 + idcount];
if (!check_length(len, 4 + idcount + cidcount * 3, "FeatureMapSpriteGroup")) return;
grfmsg(6, "FeatureMapSpriteGroup: Feature %d, %d ids, %d cids, wagon override %d",
@@ -1977,12 +1943,12 @@
if (feature == GSF_STATION) {
// We do things differently for stations.
- for (i = 0; i < idcount; i++) {
+ for (uint i = 0; i < idcount; i++) {
uint8 stid = buf[3 + i];
StationSpec *statspec = _cur_grffile->stations[stid];
byte *bp = &buf[4 + idcount];
- for (c = 0; c < cidcount; c++) {
+ for (uint c = 0; c < cidcount; c++) {
uint8 ctype = grf_load_byte(&bp);
uint16 groupid = grf_load_word(&bp);
@@ -2009,7 +1975,7 @@
return;
}
- for (i = 0; i < idcount; i++) {
+ for (uint i = 0; i < idcount; i++) {
uint8 stid = buf[3 + i];
StationSpec *statspec = _cur_grffile->stations[stid];
@@ -2046,7 +2012,7 @@
}
- for (i = 0; i < idcount; i++) {
+ for (uint i = 0; i < idcount; i++) {
uint8 engine_id = buf[3 + i];
uint8 engine = engine_id + _vehshifts[feature];
byte *bp = &buf[4 + idcount];
@@ -2058,7 +2024,7 @@
grfmsg(7, "FeatureMapSpriteGroup: [%d] Engine %d...", i, engine);
- for (c = 0; c < cidcount; c++) {
+ for (uint c = 0; c < cidcount; c++) {
uint8 ctype = grf_load_byte(&bp);
uint16 groupid = grf_load_word(&bp);
@@ -2087,7 +2053,7 @@
grfmsg(8, "-- Default group id 0x%04X", groupid);
- for (i = 0; i < idcount; i++) {
+ for (uint i = 0; i < idcount; i++) {
uint8 engine = buf[3 + i] + _vehshifts[feature];
// Don't tell me you don't love duplicated code!
@@ -2132,35 +2098,23 @@
* Word : ID of string to change/add
* S data new texts, each of them zero-terminated, after
* which the next name begins. */
- /* TODO: No support for changing non-vehicle text. Perhaps we shouldn't
- * implement it at all, but it could be useful for some "modpacks"
- * (completely new scenarios changing all graphics and logically also
- * factory names etc). We should then also support all languages (by
- * name), not only the original four ones. --pasky
- * All of the above are coming. In Time. Some sooner than others :)*/
-
- uint8 feature;
- uint8 lang;
- uint8 num;
- uint16 id;
- uint16 endid;
+
bool new_scheme = _cur_grffile->grf_version >= 7;
- bool generic;
if (!check_length(len, 6, "FeatureNewName")) return;
buf++;
- feature = grf_load_byte(&buf);
- lang = grf_load_byte(&buf);
- num = grf_load_byte(&buf);
- generic = HASBIT(lang, 7);
- id = generic ? grf_load_word(&buf) : grf_load_byte(&buf);
+ uint8 feature = grf_load_byte(&buf);
+ uint8 lang = grf_load_byte(&buf);
+ uint8 num = grf_load_byte(&buf);
+ bool generic = HASBIT(lang, 7);
+ uint16 id = generic ? grf_load_word(&buf) : grf_load_byte(&buf);
CLRBIT(lang, 7);
if (feature <= GSF_AIRCRAFT && id < _vehcounts[feature]) {
id += _vehshifts[feature];
}
- endid = id + num;
+ uint16 endid = id + num;
grfmsg(6, "FeatureNewName: About to rename engines %d..%d (feature %d) in language 0x%02X",
id, endid, feature, lang);
@@ -2260,14 +2214,12 @@
* V other data Graphics type specific data. Currently unused. */
/* TODO */
- uint8 type;
- uint16 num;
SpriteID replace = 0;
if (!check_length(len, 2, "GraphicsNew")) return;
buf++;
- type = grf_load_byte(&buf);
- num = grf_load_extended(&buf);
+ uint8 type = grf_load_byte(&buf);
+ uint16 num = grf_load_extended(&buf);
switch (type) {
case 0x04: /* Signal graphics */
@@ -2484,22 +2436,15 @@
* V value
* B num-sprites */
/* TODO: More params. More condition types. */
- uint8 param;
- uint8 paramsize;
- uint8 condtype;
- uint8 numsprites;
- uint32 param_val = 0;
uint32 cond_val = 0;
uint32 mask = 0;
bool result;
- GRFLabel *label;
- GRFLabel *choice = NULL;
if (!check_length(len, 6, "SkipIf")) return;
buf++;
- param = grf_load_byte(&buf);
- paramsize = grf_load_byte(&buf);
- condtype = grf_load_byte(&buf);
+ uint8 param = grf_load_byte(&buf);
+ uint8 paramsize = grf_load_byte(&buf);
+ uint8 condtype = grf_load_byte(&buf);
if (condtype < 2) {
/* Always 1 for bit tests, the given value should be ignored. */
@@ -2518,7 +2463,7 @@
return;
}
- param_val = GetParamVal(param, &cond_val);
+ uint32 param_val = GetParamVal(param, &cond_val);
grfmsg(7, "Test condtype %d, param 0x%08X, condval 0x%08X", condtype, param_val, cond_val);
@@ -2535,24 +2480,24 @@
switch (condtype) {
/* Tests 6 to 10 are only for param 0x88, GRFID checks */
case 6: /* Is GRFID active? */
- result = HASBIT(c->flags, GCF_ACTIVATED);
+ result = c->status == GCS_ACTIVATED;
break;
case 7: /* Is GRFID non-active? */
- result = !HASBIT(c->flags, GCF_ACTIVATED);
+ result = c->status != GCS_ACTIVATED;
break;
case 8: /* GRFID is not but will be active? */
- result = !HASBIT(c->flags, GCF_ACTIVATED) && !HASBIT(c->flags, GCF_DISABLED);
+ result = c->status == GCS_INITIALISED;
break;
case 9: /* GRFID is or will be active? */
- result = !HASBIT(c->flags, GCF_NOT_FOUND) && !HASBIT(c->flags, GCF_DISABLED);
+ result = c->status == GCS_ACTIVATED || c->status == GCS_INITIALISED;
break;
case 10: /* GRFID is not nor will be active */
/* This is the only condtype that doesn't get ignored if the GRFID is not found */
- result = c == NULL || HASBIT(c->flags, GCF_DISABLED) || HASBIT(c->flags, GCF_NOT_FOUND);
+ result = c == NULL || c->flags == GCS_DISABLED || c->status == GCS_NOT_FOUND;
break;
default: grfmsg(1, "Unsupported GRF test %d. Ignoring", condtype); return;
@@ -2582,13 +2527,14 @@
return;
}
- numsprites = grf_load_byte(&buf);
+ uint8 numsprites = grf_load_byte(&buf);
/* numsprites can be a GOTO label if it has been defined in the GRF
* file. The jump will always be the first matching label that follows
* the current nfo_line. If no matching label is found, the first matching
* label in the file is used. */
- for (label = _cur_grffile->label; label != NULL; label = label->next) {
+ GRFLabel *choice = NULL;
+ for (GRFLabel *label = _cur_grffile->label; label != NULL; label = label->next) {
if (label->label != numsprites) continue;
/* Remember a goto before the current line */
@@ -2616,7 +2562,7 @@
_skip_sprites = -1;
/* If an action 8 hasn't been encountered yet, disable the grf. */
- if (!HASBIT(_cur_grfconfig->flags, GCF_ACTIVATED)) SETBIT(_cur_grfconfig->flags, GCF_DISABLED);
+ if (_cur_grfconfig->status != GCS_ACTIVATED) _cur_grfconfig->status = GCS_DISABLED;
}
}
@@ -2624,14 +2570,10 @@
/* Action 0x08 (GLS_FILESCAN) */
static void ScanInfo(byte *buf, int len)
{
- uint8 version;
- uint32 grfid;
- const char *name;
- const char *info;
-
- if (!check_length(len, 8, "Info")) return; buf++;
- version = grf_load_byte(&buf);
- grfid = grf_load_dword(&buf);
+ if (!check_length(len, 8, "Info")) return;
+ buf++;
+ grf_load_byte(&buf);
+ uint32 grfid = grf_load_dword(&buf);
_cur_grfconfig->grfid = grfid;
@@ -2639,12 +2581,12 @@
if (GB(grfid, 24, 8) == 0xFF) SETBIT(_cur_grfconfig->flags, GCF_SYSTEM);
len -= 6;
- name = grf_load_string(&buf, len);
+ const char *name = grf_load_string(&buf, len);
_cur_grfconfig->name = TranslateTTDPatchCodes(name);
len -= strlen(name) + 1;
if (len > 0) {
- info = grf_load_string(&buf, len);
+ const char *info = grf_load_string(&buf, len);
_cur_grfconfig->info = TranslateTTDPatchCodes(info);
}
@@ -2661,19 +2603,16 @@
* 4*B grf-id globally unique ID of this .grf file
* S name name of this .grf set
* S info string describing the set, and e.g. author and copyright */
- /* TODO: Check version. (We should have own versioning done somehow.) */
- uint8 version;
- uint32 grfid;
- const char *name;
-
- if (!check_length(len, 8, "GRFInfo")) return; buf++;
- version = grf_load_byte(&buf);
- grfid = grf_load_dword(&buf);
- name = grf_load_string(&buf, len - 6);
+
+ if (!check_length(len, 8, "GRFInfo")) return;
+ buf++;
+ uint8 version = grf_load_byte(&buf);
+ uint32 grfid = grf_load_dword(&buf);
+ const char *name = grf_load_string(&buf, len - 6);
_cur_grffile->grfid = grfid;
_cur_grffile->grf_version = version;
- SETBIT(_cur_grfconfig->flags, GCF_ACTIVATED);
+ _cur_grfconfig->status = _cur_stage < GLS_ACTIVATION ? GCS_INITIALISED : GCS_ACTIVATED;
/* Do swap the GRFID for displaying purposes since people expect that */
DEBUG(grf, 1, "Loaded GRFv%d set %08lX - %s", version, BSWAP32(grfid), name);
@@ -2689,22 +2628,19 @@
* Each set:
* B num-sprites How many sprites are in this set
* W first-sprite First sprite number to replace */
- uint8 num_sets;
- uint i;
buf++; /* skip action byte */
- num_sets = grf_load_byte(&buf);
-
- for (i = 0; i < num_sets; i++) {
+ uint8 num_sets = grf_load_byte(&buf);
+
+ for (uint i = 0; i < num_sets; i++) {
uint8 num_sprites = grf_load_byte(&buf);
uint16 first_sprite = grf_load_word(&buf);
- uint j;
grfmsg(2, "SpriteReplace: [Set %d] Changing %d sprites, beginning with %d",
i, num_sprites, first_sprite
);
- for (j = 0; j < num_sprites; j++) {
+ for (uint j = 0; j < num_sprites; j++) {
LoadNextSprite(first_sprite + j, _file_index); // XXX
_nfo_line++;
}
@@ -2779,8 +2715,7 @@
} else if (severity == 3) {
/* This is a fatal error, so make sure the GRF is deactivated and no
* more of it gets loaded. */
- SETBIT(_cur_grfconfig->flags, GCF_DISABLED);
- CLRBIT(_cur_grfconfig->flags, GCF_ACTIVATED);
+ _cur_grfconfig->status = GCS_DISABLED;
_skip_sprites = -1;
}
@@ -2845,11 +2780,9 @@
/* Action 0x0D (GLS_SAFETYSCAN) */
static void SafeParamSet(byte *buf, int len)
{
- uint8 target;
-
if (!check_length(len, 5, "SafeParamSet")) return;
buf++;
- target = grf_load_byte(&buf);
+ uint8 target = grf_load_byte(&buf);
/* Only writing GRF parameters is considered safe */
if (target < 0x80) return;
@@ -2890,20 +2823,14 @@
* (source2 like in 05, and source1 as well)
*/
- byte target;
- byte oper;
- uint32 src1;
- uint32 src2;
- uint32 data = 0;
- uint32 res;
-
if (!check_length(len, 5, "ParamSet")) return;
buf++;
- target = grf_load_byte(&buf);
- oper = grf_load_byte(&buf);
- src1 = grf_load_byte(&buf);
- src2 = grf_load_byte(&buf);
-
+ uint8 target = grf_load_byte(&buf);
+ uint8 oper = grf_load_byte(&buf);
+ uint32 src1 = grf_load_byte(&buf);
+ uint32 src2 = grf_load_byte(&buf);
+
+ uint32 data = 0;
if (len >= 8) data = grf_load_dword(&buf);
/* You can add 80 to the operation to make it apply only if the target
@@ -2912,13 +2839,13 @@
* - it has been set to any value in the newgrf(w).cfg parameter list
* - it OR A PARAMETER WITH HIGHER NUMBER has been set to any value by
* an earlier action D */
- if (oper & 0x80) {
+ if (HASBIT(oper, 7)) {
if (target < 0x80 && target < _cur_grffile->param_end) {
grfmsg(7, "Param %u already defined, skipping", target);
return;
}
- oper &= 0x7F;
+ oper = GB(oper, 0, 7);
}
if (src2 == 0xFE) {
@@ -2946,7 +2873,6 @@
uint start = 0;
uint size = 0;
uint shift = _vehshifts[feature];
- int i;
if (op == 6) {
/* Return GRFID of set that reserved ID */
@@ -2957,7 +2883,7 @@
/* With an operation of 2 or 3, we want to reserve a specific block of IDs */
if (op == 2 || op == 3) start = _cur_grffile->param[target];
- for (i = start; i < _vehcounts[feature]; i++) {
+ for (uint i = start; i < _vehcounts[feature]; i++) {
if (_grm_engines[shift + i] == 0) {
size++;
} else {
@@ -2973,7 +2899,7 @@
/* Got the slot... */
if (op == 0 || op == 3) {
grfmsg(2, "GRM: Reserving %d vehicles at %d", count, start);
- for (i = 0; i < count; i++) _grm_engines[shift + start + i] = _cur_grffile->grfid;
+ for (uint i = 0; i < count; i++) _grm_engines[shift + start + i] = _cur_grffile->grfid;
}
src1 = start;
} else {
@@ -2981,8 +2907,7 @@
if (op != 4 && op != 5) {
/* Deactivate GRF */
grfmsg(0, "GRM: Unable to allocate %d vehicles, deactivating", count);
- SETBIT(_cur_grfconfig->flags, GCF_DISABLED);
- CLRBIT(_cur_grfconfig->flags, GCF_ACTIVATED);
+ _cur_grfconfig->status = GCS_DISABLED;
_skip_sprites = -1;
return;
@@ -3000,8 +2925,7 @@
/* Check if the allocated sprites will fit below the original sprite limit */
if (_cur_spriteid + count >= 16384) {
grfmsg(0, "GRM: Unable to allocate %d sprites; try changing NewGRF order", count);
- SETBIT(_cur_grfconfig->flags, GCF_DISABLED);
- CLRBIT(_cur_grfconfig->flags, GCF_ACTIVATED);
+ _cur_grfconfig->status = GCS_DISABLED;
_skip_sprites = -1;
return;
@@ -3051,6 +2975,7 @@
* cannot be found, a value of 0 is used for the parameter value
* instead. */
+ uint32 res;
switch (oper) {
case 0x00:
res = src1;
@@ -3172,15 +3097,12 @@
* B num Number of GRFIDs that follow
* D grfids GRFIDs of the files to deactivate */
- byte num;
- int i;
-
- if (!check_length(len, 1, "GRFInhibit")) return;
- buf++, len--;
- num = grf_load_byte(&buf); len--;
- if (!check_length(len, 4 * num, "GRFInhibit")) return;
-
- for (i = 0; i < num; i++) {
+ if (!check_length(len, 2, "GRFInhibit")) return;
+ buf++;
+ uint8 num = grf_load_byte(&buf);
+ if (!check_length(len, 2 + 4 * num, "GRFInhibit")) return;
+
+ for (uint i = 0; i < num; i++) {
uint32 grfid = grf_load_dword(&buf);
/* GRF is unsafe it if tries to deactivate other GRFs */
@@ -3203,23 +3125,19 @@
* B num Number of GRFIDs that follow
* D grfids GRFIDs of the files to deactivate */
- byte num;
- int i;
-
- if (!check_length(len, 1, "GRFInhibit")) return;
- buf++, len--;
- num = grf_load_byte(&buf); len--;
- if (!check_length(len, 4 * num, "GRFInhibit")) return;
-
- for (i = 0; i < num; i++) {
+ if (!check_length(len, 2, "GRFInhibit")) return;
+ buf++;
+ uint8 num = grf_load_byte(&buf);
+ if (!check_length(len, 2 + 4 * num, "GRFInhibit")) return;
+
+ for (uint i = 0; i < num; i++) {
uint32 grfid = grf_load_dword(&buf);
GRFConfig *file = GetGRFConfig(grfid);
/* Unset activation flag */
if (file != NULL && file != _cur_grfconfig) {
grfmsg(2, "GRFInhibit: Deactivating file '%s'", file->filename);
- SETBIT(file->flags, GCF_DISABLED);
- CLRBIT(file->flags, GCF_ACTIVATED);
+ file->status = GCS_DISABLED;
}
}
}
@@ -3232,12 +3150,10 @@
* B label The label to define
* V comment Optional comment - ignored */
- GRFLabel *label;
-
if (!check_length(len, 1, "DefineGotoLabel")) return;
buf++; len--;
- label = MallocT<GRFLabel>(1);
+ GRFLabel *label = MallocT<GRFLabel>(1);
label->label = grf_load_byte(&buf);
label->nfo_line = _nfo_line;
label->pos = FioGetPos();
@@ -3263,11 +3179,9 @@
*
* W num Number of sound files that follow */
- uint16 num;
-
if (!check_length(len, 1, "GRFSound")) return;
buf++;
- num = grf_load_word(&buf);
+ uint16 num = grf_load_word(&buf);
_grf_data_blocks = num;
_grf_data_type = GDT_SOUND;
@@ -3329,11 +3243,10 @@
static void LoadGRFSound(byte *buf, int len)
{
byte *buf_start = buf;
- FileEntry *se;
/* Allocate a sound entry. This is done even if the data is not loaded
* so that the indices used elsewhere are still correct. */
- se = AllocateFileEntry();
+ FileEntry *se = AllocateFileEntry();
if (grf_load_dword(&buf) != BSWAP32('RIFF')) {
grfmsg(1, "LoadGRFSound: Missing RIFF header");
@@ -3398,25 +3311,21 @@
* B num_char Number of consecutive glyphs
* W base_char First character index */
- uint8 num_def;
- uint i;
-
buf++; len--;
if (!check_length(len, 1, "LoadFontGlyph")) return;
- num_def = grf_load_byte(&buf);
+ uint8 num_def = grf_load_byte(&buf);
if (!check_length(len, 1 + num_def * 4, "LoadFontGlyph")) return;
- for (i = 0; i < num_def; i++) {
+ for (uint i = 0; i < num_def; i++) {
FontSize size = (FontSize)grf_load_byte(&buf);
uint8 num_char = grf_load_byte(&buf);
uint16 base_char = grf_load_word(&buf);
- uint c;
grfmsg(7, "LoadFontGlyph: Loading %u glyph(s) at 0x%04X for size %u", num_char, base_char, size);
- for (c = 0; c < num_char; c++) {
+ for (uint c = 0; c < num_char; c++) {
SetUnicodeGlyph(size, base_char + c, _cur_spriteid);
LoadNextSprite(_cur_spriteid++, _file_index);
_nfo_line++;
@@ -3424,20 +3333,83 @@
}
}
+/* Action 0x13 */
+static void TranslateGRFStrings(byte *buf, int len)
+{
+ /* <13> <grfid> <num-ent> <offset> <text...>
+ *
+ * 4*B grfid The GRFID of the file whose texts are to be translated
+ * B num-ent Number of strings
+ * W offset First text ID
+ * S text... Zero-terminated strings */
+
+ buf++; len--;
+ if (!check_length(len, 7, "TranslateGRFString")) return;
+
+ uint32 grfid = grf_load_dword(&buf);
+ const GRFConfig *c = GetGRFConfig(grfid);
+ if (c == NULL || (c->status != GCS_INITIALISED && c->status != GCS_ACTIVATED)) {
+ grfmsg(7, "GRFID 0x%08x unknown, skipping action 13", BSWAP32(grfid));
+ return;
+ }
+
+ if (c->status == GCS_INITIALISED) {
+ /* If the file is not active but will be activated later, give an error
+ * and disable this file. */
+ GRFError *error = CallocT<GRFError>(1);
+ error->message = STR_NEWGRF_ERROR_LOAD_AFTER;
+ error->data = STR_NEWGRF_ERROR_AFTER_TRANSLATED_FILE;
+ error->severity = STR_NEWGRF_ERROR_MSG_FATAL;
+
+ if (_cur_grfconfig->error != NULL) free(_cur_grfconfig->error);
+ _cur_grfconfig->error = error;
+
+ _cur_grfconfig->status = GCS_DISABLED;
+ _skip_sprites = -1;
+ return;
+ }
+
+ byte num_strings = grf_load_byte(&buf);
+ uint16 first_id = grf_load_word(&buf);
+
+ if (!((first_id >= 0xD000 && first_id + num_strings <= 0xD3FF) || (first_id >= 0xDC00 && first_id + num_strings <= 0xDCFF))) {
+ grfmsg(7, "Attempting to set out-of-range string IDs in action 13 (first: 0x%4X, number: 0x%2X)", first_id, num_strings);
+ return;
+ }
+
+ len -= 7;
+
+ for (uint i = 0; i < num_strings && len > 0; i++) {
+ const char *string = grf_load_string(&buf, len);
+ size_t string_length = strlen(string) + 1;
+
+ len -= (int)string_length;
+
+ if (string_length == 1) {
+ grfmsg(7, "TranslateGRFString: Ignoring empty string.");
+ continue;
+ }
+
+ /* Since no language id is supplied this string has to be added as a
+ * generic string, thus the language id of 0x7F. For this to work
+ * new_scheme has to be true as well. A language id of 0x7F will be
+ * overridden by a non-generic id, so this will not change anything if
+ * a string has been provided specifically for this language. */
+ AddGRFString(grfid, first_id + i, 0x7F, true, string, STR_UNDEFINED);
+ }
+}
+
/* 'Action 0xFF' */
static void GRFDataBlock(byte *buf, int len)
{
- byte name_len;
- const char *name;
-
if (_grf_data_blocks == 0) {
grfmsg(2, "GRFDataBlock: unexpected data block, skipping");
return;
}
buf++;
- name_len = grf_load_byte(&buf);
- name = (const char *)buf;
+ uint8 name_len = grf_load_byte(&buf);
+ const char *name = (const char *)buf;
buf += name_len + 1;
grfmsg(2, "GRFDataBlock: block name '%s'...", name);
@@ -3461,7 +3433,7 @@
}
-static void InitializeGRFSpecial(void)
+static void InitializeGRFSpecial()
{
_ttdpatch_flags[0] = ((_patches.always_small_airport ? 1 : 0) << 0x0C) // keepsmallairport
| (1 << 0x0D) // newairports
@@ -3540,22 +3512,17 @@
| (0 << 0x17); // articulatedrvs
}
-static void ResetCustomStations(void)
+static void ResetCustomStations()
{
- StationSpec *statspec;
- GRFFile *file;
- uint i;
- uint t;
-
- for (file = _first_grffile; file != NULL; file = file->next) {
+ for (GRFFile *file = _first_grffile; file != NULL; file = file->next) {
if (file->stations == NULL) continue;
- for (i = 0; i < MAX_STATIONS; i++) {
+ for (uint i = 0; i < MAX_STATIONS; i++) {
if (file->stations[i] == NULL) continue;
- statspec = file->stations[i];
+ StationSpec *statspec = file->stations[i];
/* Release renderdata, if it wasn't copied from another custom station spec */
if (!statspec->copied_renderdata) {
- for (t = 0; t < statspec->tiles; t++) {
+ for (uint t = 0; t < statspec->tiles; t++) {
free((void*)statspec->renderdata[t].seq);
}
free(statspec->renderdata);
@@ -3563,9 +3530,8 @@
/* Release platforms and layouts */
if (!statspec->copied_layouts) {
- uint l, p;
- for (l = 0; l < statspec->lengths; l++) {
- for (p = 0; p < statspec->platforms[l]; p++) {
+ for (uint l = 0; l < statspec->lengths; l++) {
+ for (uint p = 0; p < statspec->platforms[l]; p++) {
free(statspec->layouts[l][p]);
}
free(statspec->layouts[l]);
@@ -3584,11 +3550,11 @@
}
}
-static void ResetNewGRF(void)
+static void ResetNewGRF()
{
- GRFFile *f, *next;
-
- for (f = _first_grffile; f != NULL; f = next) {
+ GRFFile *next;
+
+ for (GRFFile *f = _first_grffile; f != NULL; f = next) {
next = f->next;
free(f->filename);
@@ -3603,10 +3569,8 @@
* Reset all NewGRF loaded data
* TODO
*/
-static void ResetNewGRFData(void)
+static void ResetNewGRFData()
{
- uint i;
-
CleanUpStrings();
// Copy/reset original engine info data
@@ -3618,11 +3582,9 @@
// Copy/reset original bridge info data
// First, free sprite table data
- for (i = 0; i < MAX_BRIDGES; i++) {
+ for (uint i = 0; i < MAX_BRIDGES; i++) {
if (_bridge[i].sprite_table != NULL) {
- uint j;
-
- for (j = 0; j < 7; j++) free(_bridge[i].sprite_table[j]);
+ for (uint j = 0; j < 7; j++) free(_bridge[i].sprite_table[j]);
free(_bridge[i].sprite_table);
}
}
@@ -3681,11 +3643,10 @@
}
/** Reset all NewGRFData that was used only while processing data */
-static void ClearTemporaryNewGRFData(void)
+static void ClearTemporaryNewGRFData()
{
/* Clear the GOTO labels used for GRF processing */
- GRFLabel *l;
- for (l = _cur_grffile->label; l != NULL;) {
+ for (GRFLabel *l = _cur_grffile->label; l != NULL;) {
GRFLabel *l2 = l->next;
free(l);
l = l2;
@@ -3723,9 +3684,7 @@
static void InitNewGRFFile(const GRFConfig *config, int sprite_offset)
{
- GRFFile *newfile;
-
- newfile = GetFileByFilename(config->filename);
+ GRFFile *newfile = GetFileByFilename(config->filename);
if (newfile != NULL) {
/* We already loaded it once. */
newfile->sprite_offset = sprite_offset;
@@ -3790,19 +3749,19 @@
/**
* Precalculate refit masks from cargo classes for all vehicles.
*/
-static void CalculateRefitMasks(void)
+static void CalculateRefitMasks()
{
- EngineID engine;
-
- for (engine = 0; engine < TOTAL_NUM_ENGINES; engine++) {
+ for (EngineID engine = 0; engine < TOTAL_NUM_ENGINES; engine++) {
+ /* Skip engine if not available in this climate */
+ if (!HASBIT(_engine_info[engine].climates, _opt.landscape)) continue;
+
uint32 mask = 0;
uint32 not_mask = 0;
uint32 xor_mask = _engine_info[engine].refit_mask;
- byte i;
if (cargo_allowed[engine] != 0) {
// Build up the list of cargo types from the set cargo classes.
- for (i = 0; i < NUM_CARGO; i++) {
+ for (CargoID i = 0; i < NUM_CARGO; i++) {
const CargoSpec *cs = GetCargo(i);
if (cargo_allowed[engine] & cs->classes) SETBIT(mask, i);
if (cargo_disallowed[engine] & cs->classes) SETBIT(not_mask, i);
@@ -3810,7 +3769,7 @@
} else {
// Don't apply default refit mask to wagons or engines with no capacity
if (xor_mask == 0 && (
- GetEngine(engine)->type != VEH_Train || (
+ GetEngine(engine)->type != VEH_TRAIN || (
RailVehInfo(engine)->capacity != 0 &&
RailVehInfo(engine)->railveh_type != RAILVEH_WAGON
)
@@ -3833,19 +3792,22 @@
/* Check if this engine's cargo type is valid. If not, set to the first refittable
* cargo type. Apparently cargo_type isn't a common property... */
switch (GetEngine(engine)->type) {
- case VEH_Train: {
+ case VEH_TRAIN: {
RailVehicleInfo *rvi = &_rail_vehicle_info[engine];
if (rvi->cargo_type == CT_INVALID) rvi->cargo_type = FindFirstRefittableCargo(engine);
+ if (rvi->cargo_type == CT_INVALID) _engine_info[engine].climates = 0;
break;
}
- case VEH_Road: {
+ case VEH_ROAD: {
RoadVehicleInfo *rvi = &_road_vehicle_info[engine - ROAD_ENGINES_INDEX];
if (rvi->cargo_type == CT_INVALID) rvi->cargo_type = FindFirstRefittableCargo(engine);
+ if (rvi->cargo_type == CT_INVALID) _engine_info[engine].climates = 0;
break;
}
- case VEH_Ship: {
+ case VEH_SHIP: {
ShipVehicleInfo *svi = &_ship_vehicle_info[engine - SHIP_ENGINES_INDEX];
if (svi->cargo_type == CT_INVALID) svi->cargo_type = FindFirstRefittableCargo(engine);
+ if (svi->cargo_type == CT_INVALID) _engine_info[engine].climates = 0;
break;
}
}
@@ -3892,10 +3854,10 @@
/* 0x10 */ { NULL, NULL, DefineGotoLabel, NULL, NULL, },
/* 0x11 */ { NULL, GRFUnsafe, NULL, NULL, GRFSound, },
/* 0x12 */ { NULL, NULL, NULL, NULL, LoadFontGlyph, },
+ /* 0x13 */ { NULL, NULL, NULL, NULL, TranslateGRFStrings, },
};
byte* buf;
- byte action;
if (_preload_sprite == NULL) {
/* No preloaded sprite to work with; allocate and read the
@@ -3913,7 +3875,7 @@
FioSeekTo(num, SEEK_CUR);
}
- action = buf[0];
+ byte action = buf[0];
if (action == 0xFF) {
grfmsg(7, "Handling data block in stage %d", stage);
@@ -3950,11 +3912,9 @@
if (stage != GLS_FILESCAN && stage != GLS_SAFETYSCAN && stage != GLS_LABELSCAN) {
_cur_grffile = GetFileByFilename(filename);
if (_cur_grffile == NULL) error("File '%s' lost in cache.\n", filename);
- if (stage == GLS_ACTIVATION && !HASBIT(config->flags, GCF_ACTIVATED)) return;
+ if (stage == GLS_ACTIVATION && config->status != GCS_INITIALISED) return;
}
- if (stage == GLS_ACTIVATION) CLRBIT(config->flags, GCF_ACTIVATED);
-
FioOpenFile(file_index, filename);
_file_index = file_index; // XXX
@@ -4017,12 +3977,10 @@
}
}
-void InitDepotWindowBlockSizes(void);
+void InitDepotWindowBlockSizes();
void LoadNewGRF(uint load_index, uint file_index)
{
- GrfLoadingStage stage;
-
InitializeGRFSpecial();
ResetNewGRFData();
@@ -4030,14 +3988,13 @@
/* Load newgrf sprites
* in each loading stage, (try to) open each file specified in the config
* and load information from it. */
- for (stage = GLS_LABELSCAN; stage <= GLS_ACTIVATION; stage++) {
+ for (GrfLoadingStage stage = GLS_LABELSCAN; stage <= GLS_ACTIVATION; stage++) {
uint slot = file_index;
- GRFConfig *c;
_cur_stage = stage;
_cur_spriteid = load_index;
- for (c = _grfconfig; c != NULL; c = c->next) {
- if (HASBIT(c->flags, GCF_DISABLED) || HASBIT(c->flags, GCF_NOT_FOUND)) continue;
+ for (GRFConfig *c = _grfconfig; c != NULL; c = c->next) {
+ if (c->status == GCS_DISABLED || c->status == GCS_NOT_FOUND) continue;
// TODO usererror()
if (!FioCheckFileExists(c->filename)) error("NewGRF file is missing '%s'", c->filename);
@@ -4058,8 +4015,3 @@
/* Set the block size in the depot windows based on vehicle sprite sizes */
InitDepotWindowBlockSizes();
}
-
-
-
-
-
--- a/src/newgrf.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/newgrf.h Sun Mar 11 16:31:18 2007 +0000
@@ -8,31 +8,31 @@
#include "helpers.hpp"
#include "cargotype.h"
-typedef enum GrfLoadingStage {
+enum GrfLoadingStage {
GLS_FILESCAN,
GLS_SAFETYSCAN,
GLS_LABELSCAN,
GLS_INIT,
GLS_ACTIVATION,
GLS_END,
-} GrfLoadingStage;
+};
DECLARE_POSTFIX_INCREMENT(GrfLoadingStage);
-typedef struct GRFLabel {
+struct GRFLabel {
byte label;
uint32 nfo_line;
uint32 pos;
struct GRFLabel *next;
-} GRFLabel;
+};
-typedef struct GRFFile {
+struct GRFFile {
char *filename;
uint32 grfid;
uint16 sprite_offset;
byte grf_version;
- struct GRFFile *next;
+ GRFFile *next;
/* A sprite group contains all sprites of a given vehicle (or multiple
* vehicles) when carrying given cargo. It consists of several sprite
@@ -65,7 +65,7 @@
uint8 cargo_max;
CargoLabel *cargo_list;
uint8 cargo_map[NUM_CARGO];
-} GRFFile;
+};
extern GRFFile *_first_grffile;
@@ -75,7 +75,7 @@
void LoadNewGRFFile(GRFConfig *config, uint file_index, GrfLoadingStage stage);
void LoadNewGRF(uint load_index, uint file_index);
-void ReloadNewGRFData(void); // in openttd.c
+void ReloadNewGRFData(); // in openttd.c
void CDECL grfmsg(int severity, const char *str, ...);
--- a/src/newgrf_callbacks.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/newgrf_callbacks.h Sun Mar 11 16:31:18 2007 +0000
@@ -19,8 +19,8 @@
// only for train vehicles
CBID_TRAIN_VEHICLE_LENGTH = 0x11,
- /* Called to determine the amount of cargo to load per unit of time when
- * using gradual loading. */
+ /* Called (if appropriate bit in callback mask is set) to determine the
+ * amount of cargo to load per unit of time when using gradual loading. */
CBID_VEHICLE_LOAD_AMOUNT = 0x12,
/* Called (if appropriate bit in callback mask is set) to determine if a
--- a/src/newgrf_config.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/newgrf_config.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -60,7 +60,7 @@
bool FillGRFDetails(GRFConfig *config, bool is_static)
{
if (!FioCheckFileExists(config->filename)) {
- SETBIT(config->flags, GCF_NOT_FOUND);
+ config->status = GCS_NOT_FOUND;
return false;
}
@@ -210,14 +210,14 @@
/** Check if all GRFs in the GRF config from a savegame can be loaded.
* @return will return any of the following 3 values:<br>
* <ul>
- * <li> GCF_ACTIVATED: No problems occured, all GRF files were found and loaded
- * <li> GCF_COMPATIBLE: For one or more GRF's no exact match was found, but a
+ * <li> GLC_ALL_GOOD: No problems occured, all GRF files were found and loaded
+ * <li> GLC_COMPATIBLE: For one or more GRF's no exact match was found, but a
* compatible GRF with the same grfid was found and used instead
- * <li> GCF_NOT_FOUND: For one or more GRF's no match was found at all
+ * <li> GLC_NOT_FOUND: For one or more GRF's no match was found at all
* </ul> */
-GCF_Flags IsGoodGRFConfigList(void)
+GRFListCompatibility IsGoodGRFConfigList()
{
- GCF_Flags res = GCF_ACTIVATED;
+ GRFListCompatibility res = GLC_ALL_GOOD;
for (GRFConfig *c = _grfconfig; c != NULL; c = c->next) {
const GRFConfig *f = FindGRFConfig(c->grfid, c->md5sum);
@@ -233,7 +233,7 @@
SETBIT(c->flags, GCF_COMPATIBLE);
/* Non-found has precedence over compatibility load */
- if (res != GCF_NOT_FOUND) res = GCF_COMPATIBLE;
+ if (res != GLC_NOT_FOUND) res = GLC_COMPATIBLE;
goto compatible_grf;
}
@@ -241,8 +241,8 @@
md5sumToString(buf, lastof(buf), c->md5sum);
DEBUG(grf, 0, "NewGRF %08X (%s) not found; checksum %s", BSWAP32(c->grfid), c->filename, buf);
- SETBIT(c->flags, GCF_NOT_FOUND);
- res = GCF_NOT_FOUND;
+ c->status = GCS_NOT_FOUND;
+ res = GLC_NOT_FOUND;
} else {
compatible_grf:
DEBUG(grf, 1, "Loading GRF %08X from %s", BSWAP32(f->grfid), f->filename);
@@ -335,7 +335,7 @@
/* Scan for all NewGRFs */
-void ScanNewGRFFiles(void)
+void ScanNewGRFFiles()
{
uint num;
@@ -364,7 +364,6 @@
#ifdef ENABLE_NETWORK
/** Structure for UnknownGRFs; this is a lightweight variant of GRFConfig */
-typedef struct UnknownGRF UnknownGRF;
struct UnknownGRF : public GRFIdentifier {
UnknownGRF *next;
char name[NETWORK_GRF_NAME_LENGTH];
@@ -452,7 +451,7 @@
};
-static void Save_NGRF(void)
+static void Save_NGRF()
{
int index = 0;
@@ -464,7 +463,7 @@
}
-static void Load_NGRF(void)
+static void Load_NGRF()
{
ClearGRFConfigList(&_grfconfig);
while (SlIterateArray() != -1) {
--- a/src/newgrf_config.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/newgrf_config.h Sun Mar 11 16:31:18 2007 +0000
@@ -6,42 +6,54 @@
#include "openttd.h"
/* GRF config bit flags */
-typedef enum {
- GCF_DISABLED, ///< GRF file is disabled
- GCF_NOT_FOUND, ///< GRF file was not found in the local cache
- GCF_ACTIVATED, ///< GRF file is active
+enum GCF_Flags {
GCF_SYSTEM, ///< GRF file is an openttd-internal system grf
GCF_UNSAFE, ///< GRF file is unsafe for static usage
GCF_STATIC, ///< GRF file is used statically (can be used in any MP game)
GCF_COMPATIBLE,///< GRF file does not exactly match the requested GRF (different MD5SUM), but grfid matches)
GCF_COPY, ///< The data is copied from a grf in _all_grfs
-} GCF_Flags;
+};
-typedef struct GRFIdentifier {
+enum GRFStatus {
+ GCS_UNKNOWN, ///< The status of this grf file is unknown
+ GCS_DISABLED, ///< GRF file is disabled
+ GCS_NOT_FOUND, ///< GRF file was not found in the local cache
+ GCS_INITIALISED, ///< GRF file has been initialised
+ GCS_ACTIVATED ///< GRF file has been activated
+};
+
+enum GRFListCompatibility{
+ GLC_ALL_GOOD,
+ GLC_COMPATIBLE,
+ GLC_NOT_FOUND
+};
+
+struct GRFIdentifier {
uint32 grfid;
uint8 md5sum[16];
-} GRF;
+};
-typedef struct GRFError {
+struct GRFError {
StringID message;
StringID data;
StringID severity;
uint8 num_params;
uint8 param_number[2];
-} GRFError;
+};
-typedef struct GRFConfig : public GRFIdentifier {
+struct GRFConfig : public GRFIdentifier {
char *filename;
char *name;
char *info;
GRFError *error;
uint8 flags;
+ GRFStatus status;
uint32 param[0x80];
uint8 num_params;
struct GRFConfig *next;
-} GRFConfig;
+};
/* First item in list of all scanned NewGRFs */
extern GRFConfig *_all_grfs;
@@ -55,7 +67,7 @@
/* First item in list of static GRF set up */
extern GRFConfig *_grfconfig_static;
-void ScanNewGRFFiles(void);
+void ScanNewGRFFiles();
const GRFConfig *FindGRFConfig(uint32 grfid, const uint8 *md5sum = NULL);
GRFConfig *GetGRFConfig(uint32 grfid);
GRFConfig **CopyGRFConfigList(GRFConfig **dst, const GRFConfig *src);
@@ -64,7 +76,7 @@
void ClearGRFConfig(GRFConfig **config);
void ClearGRFConfigList(GRFConfig **config);
void ResetGRFConfig(bool defaults);
-GCF_Flags IsGoodGRFConfigList(void);
+GRFListCompatibility IsGoodGRFConfigList();
bool FillGRFDetails(GRFConfig *config, bool is_static);
char *GRFBuildParamList(char *dst, const GRFConfig *c, const char *last);
--- a/src/newgrf_engine.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/newgrf_engine.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -24,17 +24,17 @@
int _traininfo_vehicle_pitch = 0;
int _traininfo_vehicle_width = 29;
-typedef struct WagonOverride {
+struct WagonOverride {
byte *train_id;
int trains;
CargoID cargo;
const SpriteGroup *group;
-} WagonOverride;
+};
-typedef struct WagonOverrides {
+struct WagonOverrides {
int overrides_count;
WagonOverride *overrides;
-} WagonOverrides;
+};
static WagonOverrides _engine_wagon_overrides[TOTAL_NUM_ENGINES];
@@ -85,7 +85,7 @@
/**
* Unload all wagon override sprite groups.
*/
-void UnloadWagonOverrides(void)
+void UnloadWagonOverrides()
{
WagonOverrides *wos;
WagonOverride *wo;
@@ -123,7 +123,7 @@
/**
* Unload all engine sprite groups.
*/
-void UnloadCustomEngineSprites(void)
+void UnloadCustomEngineSprites()
{
memset(_engine_custom_sprites, 0, sizeof(_engine_custom_sprites));
memset(_engine_grf, 0, sizeof(_engine_grf));
@@ -144,7 +144,7 @@
}
/** Unload all rotor override sprite groups */
-void UnloadRotorOverrideSprites(void)
+void UnloadRotorOverrideSprites()
{
EngineID engine;
@@ -195,7 +195,7 @@
static int MapOldSubType(const Vehicle *v)
{
- if (v->type != VEH_Train) return v->subtype;
+ if (v->type != VEH_TRAIN) return v->subtype;
if (IsTrainEngine(v)) return 0;
if (IsFreeWagon(v)) return 4;
return 2;
@@ -489,7 +489,7 @@
switch (variable) {
case 0x40: /* Get length of consist */
case 0x41: /* Get length of same consecutive wagons */
- if (v->type != VEH_Train) return 1;
+ if (v->type != VEH_TRAIN) return 1;
{
const Vehicle* u;
@@ -545,7 +545,7 @@
return v->owner;
case 0x44: /* Aircraft information */
- if (v->type != VEH_Aircraft) return UINT_MAX;
+ if (v->type != VEH_AIRCRAFT) return UINT_MAX;
{
const Vehicle *w = v->next;
@@ -590,7 +590,7 @@
/* Variables which use the parameter */
case 0x60: /* Count consist's engine ID occurance */
- if (v->type != VEH_Train) return v->engine_type == parameter;
+ if (v->type != VEH_TRAIN) return v->engine_type == parameter;
{
uint count = 0;
@@ -699,7 +699,7 @@
/* Vehicle specific properties */
switch (v->type) {
- case VEH_Train:
+ case VEH_TRAIN:
switch (variable - 0x80) {
case 0x62: return v->u.rail.track;
case 0x66: return v->u.rail.railtype;
@@ -714,7 +714,7 @@
}
break;
- case VEH_Road:
+ case VEH_ROAD:
switch (variable - 0x80) {
case 0x62: return v->u.road.state;
case 0x64: return v->u.road.blocked_ctr;
@@ -726,7 +726,7 @@
}
break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
switch (variable - 0x80) {
case 0x62: return MapAircraftMovementState(v); // Current movement state
case 0x63: return v->u.air.targetairport; // Airport to which the action refers
@@ -751,7 +751,7 @@
if (v == NULL) return group->g.real.loading[0];
- if (v->type == VEH_Train) {
+ if (v->type == VEH_TRAIN) {
in_motion = GetFirstVehicleInChain(v)->current_order.type != OT_LOADING;
} else {
in_motion = v->current_order.type != OT_LOADING;
@@ -780,7 +780,7 @@
res->ResolveReal = &VehicleResolveReal;
res->u.vehicle.self = v;
- res->u.vehicle.parent = (v != NULL && v->type == VEH_Train) ? GetFirstVehicleInChain(v) : v;
+ res->u.vehicle.parent = (v != NULL && v->type == VEH_TRAIN) ? GetFirstVehicleInChain(v) : v;
res->u.vehicle.self_type = engine_type;
@@ -812,7 +812,7 @@
} else {
cargo = v->cargo_type;
- if (v->type == VEH_Train) {
+ if (v->type == VEH_TRAIN) {
group = GetWagonOverrideSpriteSet(engine, cargo, v->u.rail.first_engine);
if (group != NULL) return group;
@@ -874,7 +874,7 @@
*/
bool UsesWagonOverride(const Vehicle* v)
{
- assert(v->type == VEH_Train);
+ assert(v->type == VEH_TRAIN);
return GetWagonOverrideSpriteSet(v->engine_type, v->cargo_type, v->u.rail.first_engine) != NULL;
}
@@ -962,7 +962,7 @@
* i.e.), so we give them all the NEW_CARGO triggered
* vehicle's portion of random bits. */
assert(first);
- DoTriggerVehicle((v->type == VEH_Train) ? GetFirstVehicleInChain(v) : v, VEHICLE_TRIGGER_ANY_NEW_CARGO, new_random_bits, false);
+ DoTriggerVehicle((v->type == VEH_TRAIN) ? GetFirstVehicleInChain(v) : v, VEHICLE_TRIGGER_ANY_NEW_CARGO, new_random_bits, false);
break;
case VEHICLE_TRIGGER_DEPOT:
@@ -1007,7 +1007,7 @@
_engine_custom_names[engine] = name;
}
-void UnloadCustomEngineNames(void)
+void UnloadCustomEngineNames()
{
EngineID i;
for (i = 0; i < TOTAL_NUM_ENGINES; i++) {
@@ -1025,7 +1025,7 @@
static EngineID _engine_list_order[NUM_TRAIN_ENGINES];
static byte _engine_list_position[NUM_TRAIN_ENGINES];
-void ResetEngineListOrder(void)
+void ResetEngineListOrder()
{
EngineID i;
--- a/src/newgrf_engine.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/newgrf_engine.h Sun Mar 11 16:31:18 2007 +0000
@@ -36,7 +36,7 @@
#define GetCustomVehicleSprite(v, direction) GetCustomEngineSprite(v->engine_type, v, direction)
#define GetCustomVehicleIcon(et, direction) GetCustomEngineSprite(et, NULL, direction)
-typedef enum VehicleTrigger {
+enum VehicleTrigger {
VEHICLE_TRIGGER_NEW_CARGO = 1,
// Externally triggered only for the first vehicle in chain
VEHICLE_TRIGGER_DEPOT = 2,
@@ -44,18 +44,18 @@
VEHICLE_TRIGGER_EMPTY = 4,
// Not triggered externally (called for the whole chain if we got NEW_CARGO)
VEHICLE_TRIGGER_ANY_NEW_CARGO = 8,
-} VehicleTrigger;
+};
void TriggerVehicle(Vehicle *veh, VehicleTrigger trigger);
void SetCustomEngineName(EngineID engine, StringID name);
StringID GetCustomEngineName(EngineID engine);
-void UnloadWagonOverrides(void);
-void UnloadRotorOverrideSprites(void);
-void UnloadCustomEngineSprites(void);
-void UnloadCustomEngineNames(void);
+void UnloadWagonOverrides();
+void UnloadRotorOverrideSprites();
+void UnloadCustomEngineSprites();
+void UnloadCustomEngineNames();
-void ResetEngineListOrder(void);
+void ResetEngineListOrder();
EngineID GetRailVehAtPosition(EngineID pos);
uint16 ListPositionOfEngine(EngineID engine);
void AlterRailVehListOrder(EngineID engine, EngineID target);
--- a/src/newgrf_gui.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/newgrf_gui.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -91,8 +91,8 @@
}
/* Show flags */
- if (HASBIT(c->flags, GCF_NOT_FOUND)) y += DrawStringMultiLine(x, y, STR_NEWGRF_NOT_FOUND, w);
- if (HASBIT(c->flags, GCF_DISABLED)) y += DrawStringMultiLine(x, y, STR_NEWGRF_DISABLED, w);
+ if (c->status == GCS_NOT_FOUND) y += DrawStringMultiLine(x, y, STR_NEWGRF_NOT_FOUND, w);
+ if (c->status == GCS_DISABLED) y += DrawStringMultiLine(x, y, STR_NEWGRF_DISABLED, w);
if (HASBIT(c->flags, GCF_COMPATIBLE)) y += DrawStringMultiLine(x, y, STR_NEWGRF_COMPATIBLE_LOADED, w);
/* Draw GRF info if it exists */
@@ -106,10 +106,10 @@
/* Dialogue for adding NewGRF files to the selection */
-typedef struct newgrf_add_d {
+struct newgrf_add_d {
GRFConfig **list;
const GRFConfig *sel;
-} newgrf_add_d;
+};
static void NewGRFAddDlgWndProc(BaseWindow *w, WindowEvent *e)
@@ -236,14 +236,14 @@
/* 'NewGRF Settings' dialogue */
-typedef struct newgrf_d {
+struct newgrf_d {
GRFConfig **orig_list; ///< grf list the window is shown with
GRFConfig **list; ///< temporary grf list to which changes are made
GRFConfig *sel; ///< selected grf item
bool editable; ///< is the window editable
bool show_params; ///< are the grf-parameters shown in the info-panel
bool execute; ///< on pressing 'apply changes' are grf changes applied immediately, or only list is updated
-} newgrf_d;
+};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(newgrf_d));
@@ -335,16 +335,23 @@
SpriteID pal;
/* Pick a colour */
- if (HASBIT(c->flags, GCF_NOT_FOUND) || HASBIT(c->flags, GCF_DISABLED)) {
- pal = PALETTE_TO_RED;
- } else if (HASBIT(c->flags, GCF_STATIC)) {
+ switch (c->status) {
+ case GCS_NOT_FOUND:
+ case GCS_DISABLED:
+ pal = PALETTE_TO_RED;
+ break;
+ case GCS_ACTIVATED:
+ pal = PALETTE_TO_GREEN;
+ break;
+ default:
+ pal = PALETTE_TO_BLUE;
+ break;
+ }
+
+ if (HASBIT(c->flags, GCF_STATIC)) {
pal = PALETTE_TO_GREY;
} else if (HASBIT(c->flags, GCF_COMPATIBLE)) {
pal = PALETTE_TO_ORANGE;
- } else if (HASBIT(c->flags, GCF_ACTIVATED)) {
- pal = PALETTE_TO_GREEN;
- } else {
- pal = PALETTE_TO_BLUE;
}
DrawSprite(SPR_SQUARE, pal, 5, y + 2);
--- a/src/newgrf_sound.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/newgrf_sound.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -15,7 +15,7 @@
/* Allocate a new FileEntry */
-FileEntry *AllocateFileEntry(void)
+FileEntry *AllocateFileEntry()
{
if (_sound_count == GetSoundInternalPoolSize()) {
if (!AddBlockToPool(&_SoundInternal_pool)) return NULL;
@@ -25,7 +25,7 @@
}
-void InitializeSoundPool(void)
+void InitializeSoundPool()
{
CleanPool(&_SoundInternal_pool);
_sound_count = 0;
@@ -42,7 +42,7 @@
}
-uint GetNumSounds(void)
+uint GetNumSounds()
{
return _sound_count;
}
--- a/src/newgrf_sound.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/newgrf_sound.h Sun Mar 11 16:31:18 2007 +0000
@@ -3,7 +3,7 @@
#ifndef NEWGRF_SOUND_H
#define NEWGRF_SOUND_H
-typedef enum VehicleSoundEvents {
+enum VehicleSoundEvent {
VSE_START = 1,
VSE_TUNNEL = 2,
VSE_BREAKDOWN = 3,
@@ -13,13 +13,13 @@
VSE_RUNNING_16 = 7,
VSE_STOPPED_16 = 8,
VSE_LOAD_UNLOAD = 9,
-} VehicleSoundEvent;
+};
-FileEntry *AllocateFileEntry(void);
-void InitializeSoundPool(void);
+FileEntry *AllocateFileEntry();
+void InitializeSoundPool();
FileEntry *GetSound(uint index);
-uint GetNumSounds(void);
+uint GetNumSounds();
bool PlayVehicleSound(const Vehicle *v, VehicleSoundEvent event);
#endif /* NEWGRF_SOUND_H */
--- a/src/newgrf_spritegroup.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/newgrf_spritegroup.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -49,7 +49,7 @@
/* Allocate a new SpriteGroup */
-SpriteGroup *AllocateSpriteGroup(void)
+SpriteGroup *AllocateSpriteGroup()
{
/* This is totally different to the other pool allocators, as we never remove an item from the pool. */
if (_spritegroup_count == GetSpriteGroupPoolSize()) {
@@ -60,7 +60,7 @@
}
-void InitializeSpriteGroupPool(void)
+void InitializeSpriteGroupPool()
{
CleanPool(&_SpriteGroup_pool);
--- a/src/newgrf_spritegroup.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/newgrf_spritegroup.h Sun Mar 11 16:31:18 2007 +0000
@@ -4,12 +4,12 @@
#define NEWGRF_SPRITEGROUP_H
-typedef struct SpriteGroup SpriteGroup;
+struct SpriteGroup;
/* 'Real' sprite groups contain a list of other result or callback sprite
* groups. */
-typedef struct RealSpriteGroup {
+struct RealSpriteGroup {
// Loaded = in motion, loading = not moving
// Each group contains several spritesets, for various loading stages
@@ -21,28 +21,28 @@
byte num_loading; ///< Number of loading groups
const SpriteGroup **loaded; ///< List of loaded groups (can be SpriteIDs or Callback results)
const SpriteGroup **loading; ///< List of loading groups (can be SpriteIDs or Callback results)
-} RealSpriteGroup;
+};
/* Shared by deterministic and random groups. */
-typedef enum VarSpriteGroupScopes {
+enum VarSpriteGroupScope {
VSG_SCOPE_SELF,
// Engine of consists for vehicles, city for stations.
VSG_SCOPE_PARENT,
-} VarSpriteGroupScope;
+};
-typedef enum DeterministicSpriteGroupSizes {
+enum DeterministicSpriteGroupSize {
DSG_SIZE_BYTE,
DSG_SIZE_WORD,
DSG_SIZE_DWORD,
-} DeterministicSpriteGroupSize;
+};
-typedef enum DeterministicSpriteGroupAdjustTypes {
+enum DeterministicSpriteGroupAdjustType {
DSGA_TYPE_NONE,
DSGA_TYPE_DIV,
DSGA_TYPE_MOD,
-} DeterministicSpriteGroupAdjustType;
+};
-typedef enum DeterministicSpriteGroupAdjustOperations {
+enum DeterministicSpriteGroupAdjustOperation {
DSGA_OP_ADD, // a + b
DSGA_OP_SUB, // a - b
DSGA_OP_SMIN, // (signed) min(a, b)
@@ -57,10 +57,10 @@
DSGA_OP_AND, // a & b
DSGA_OP_OR, // a | b
DSGA_OP_XOR, // a ^ b
-} DeterministicSpriteGroupAdjustOperation;
+};
-typedef struct DeterministicSpriteGroupAdjust {
+struct DeterministicSpriteGroupAdjust {
DeterministicSpriteGroupAdjustOperation operation;
DeterministicSpriteGroupAdjustType type;
byte variable;
@@ -70,17 +70,17 @@
uint32 add_val;
uint32 divmod_val;
const SpriteGroup *subroutine;
-} DeterministicSpriteGroupAdjust;
+};
-typedef struct DeterministicSpriteGroupRange {
+struct DeterministicSpriteGroupRange {
const SpriteGroup *group;
uint32 low;
uint32 high;
-} DeterministicSpriteGroupRange;
+};
-typedef struct DeterministicSpriteGroup {
+struct DeterministicSpriteGroup {
VarSpriteGroupScope var_scope;
DeterministicSpriteGroupSize size;
byte num_adjusts;
@@ -90,14 +90,14 @@
// Dynamically allocated, this is the sole owner
const SpriteGroup *default_group;
-} DeterministicSpriteGroup;
+};
-typedef enum RandomizedSpriteGroupCompareModes {
+enum RandomizedSpriteGroupCompareMode {
RSG_CMP_ANY,
RSG_CMP_ALL,
-} RandomizedSpriteGroupCompareMode;
+};
-typedef struct RandomizedSpriteGroup {
+struct RandomizedSpriteGroup {
// Take this object:
VarSpriteGroupScope var_scope;
@@ -111,32 +111,32 @@
// Take the group with appropriate index:
const SpriteGroup **groups;
-} RandomizedSpriteGroup;
+};
/* This contains a callback result. A failed callback has a value of
* CALLBACK_FAILED */
-typedef struct CallbackResultSpriteGroup {
+struct CallbackResultSpriteGroup {
uint16 result;
-} CallbackResultSpriteGroup;
+};
/* A result sprite group returns the first SpriteID and the number of
* sprites in the set */
-typedef struct ResultSpriteGroup {
+struct ResultSpriteGroup {
SpriteID sprite;
byte num_sprites;
-} ResultSpriteGroup;
+};
/* List of different sprite group types */
-typedef enum SpriteGroupType {
+enum SpriteGroupType {
SGT_INVALID,
SGT_REAL,
SGT_DETERMINISTIC,
SGT_RANDOMIZED,
SGT_CALLBACK,
SGT_RESULT,
-} SpriteGroupType;
+};
/* Common wrapper for all the different sprite group types */
struct SpriteGroup {
@@ -152,11 +152,11 @@
};
-SpriteGroup *AllocateSpriteGroup(void);
-void InitializeSpriteGroupPool(void);
+SpriteGroup *AllocateSpriteGroup();
+void InitializeSpriteGroupPool();
-typedef struct ResolverObject {
+struct ResolverObject {
uint16 callback;
uint32 callback_param1;
uint32 callback_param2;
@@ -187,7 +187,7 @@
void (*SetTriggers)(const struct ResolverObject*, int);
uint32 (*GetVariable)(const struct ResolverObject*, byte, byte, bool*);
const SpriteGroup *(*ResolveReal)(const struct ResolverObject*, const SpriteGroup*);
-} ResolverObject;
+};
/* Base sprite group resolver */
--- a/src/newgrf_station.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/newgrf_station.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -31,7 +31,7 @@
* This includes initialising the Default and Waypoint classes with an empty
* entry, for standard stations and waypoints.
*/
-void ResetStationClasses(void)
+void ResetStationClasses()
{
for (StationClassID i = STAT_CLASS_BEGIN; i < STAT_CLASS_MAX; i++) {
station_classes[i].id = 0;
@@ -95,7 +95,7 @@
/** Build a list of station class name StringIDs to use in a dropdown list
* @return Pointer to a (static) array of StringIDs
*/
-StringID *BuildStationClassDropdown(void)
+StringID *BuildStationClassDropdown()
{
/* Allow room for all station classes, plus a terminator entry */
static StringID names[STAT_CLASS_MAX + 1];
@@ -115,7 +115,7 @@
* Get the number of station classes in use.
* @return Number of station classes.
*/
-uint GetNumStationClasses(void)
+uint GetNumStationClasses()
{
uint i;
for (i = 0; i < STAT_CLASS_MAX && station_classes[i].id != 0; i++);
--- a/src/newgrf_station.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/newgrf_station.h Sun Mar 11 16:31:18 2007 +0000
@@ -9,12 +9,12 @@
#include "newgrf_cargo.h"
#include "helpers.hpp"
-typedef enum {
+enum StationClassID {
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> {};
@@ -27,7 +27,7 @@
* where index is computed as (x * platforms) + platform. */
typedef byte *StationLayout;
-typedef struct StationSpec {
+struct StationSpec {
uint32 grfid; ///< ID of GRF file station belongs to.
int localidx; ///< Index within GRF file of station.
@@ -84,25 +84,25 @@
* evaluating callbacks.
*/
const struct SpriteGroup *spritegroup[NUM_CARGO + 3];
-} StationSpec;
+};
/**
* Struct containing information relating to station classes.
*/
-typedef struct StationClass {
+struct StationClass {
uint32 id; ///< ID of this class, e.g. 'DFLT', 'WAYP', etc.
StringID name; ///< Name of this class.
uint stations; ///< Number of stations in this class.
StationSpec **spec; ///< Array of station specifications.
-} StationClass;
+};
-void ResetStationClasses(void);
+void ResetStationClasses();
StationClassID AllocateStationClass(uint32 cls);
void SetStationClassName(StationClassID sclass, StringID name);
StringID GetStationClassName(StationClassID sclass);
-StringID *BuildStationClassDropdown(void);
+StringID *BuildStationClassDropdown();
-uint GetNumStationClasses(void);
+uint GetNumStationClasses();
uint GetNumCustomStations(StationClassID sclass);
void SetCustomStationSpec(StationSpec *statspec);
--- a/src/newgrf_text.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/newgrf_text.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -30,16 +30,16 @@
* the grf base will not be used in order to find the string, but rather for
* jumping from standard langID scheme to the new one.
*/
-typedef enum grf_base_languages {
+enum grf_base_languages {
GRFLB_AMERICAN = 0x01,
GRFLB_ENGLISH = 0x02,
GRFLB_GERMAN = 0x04,
GRFLB_FRENCH = 0x08,
GRFLB_SPANISH = 0x10,
GRFLB_GENERIC = 0x80,
-} grf_base_language;
+};
-typedef enum grf_extended_languages {
+enum grf_extended_languages {
GRFLX_AMERICAN = 0x00,
GRFLX_ENGLISH = 0x01,
GRFLX_GERMAN = 0x02,
@@ -73,13 +73,13 @@
GRFLX_CROATIAN = 0x38,
GRFLX_TURKISH = 0x3E,
GRFLX_UNSPECIFIED = 0x7F,
-} grf_language;
+};
-typedef struct iso_grf {
+struct iso_grf {
char code[6];
byte grfLangID;
-} iso_grf;
+};
/**
* ISO code VS NewGrf langID conversion array.
@@ -170,12 +170,12 @@
* Putting both grfid and stringid together allows us to avoid duplicates,
* since it is NOT SUPPOSED to happen.
*/
-typedef struct GRFTextEntry {
+struct GRFTextEntry {
uint32 grfid;
uint16 stringid;
StringID def_string;
GRFText *textholder;
-} GRFTextEntry;
+};
static uint _num_grf_texts = 0;
@@ -441,7 +441,7 @@
* House cleaning.
* Remove all strings and reset the text counter.
*/
-void CleanUpStrings(void)
+void CleanUpStrings()
{
uint id;
--- a/src/newgrf_text.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/newgrf_text.h Sun Mar 11 16:31:18 2007 +0000
@@ -9,7 +9,7 @@
StringID AddGRFString(uint32 grfid, uint16 stringid, byte langid, bool new_scheme, const char *text_to_add, StringID def_string);
StringID GetGRFStringID(uint32 grfid, uint16 stringid);
char *GetGRFString(char *buff, uint16 stringid, const char* last);
-void CleanUpStrings(void);
+void CleanUpStrings();
void SetCurrentGrfLangID(const char *iso_name);
char *TranslateTTDPatchCodes(const char *str);
--- a/src/news.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/news.h Sun Mar 11 16:31:18 2007 +0000
@@ -3,6 +3,8 @@
#ifndef NEWS_H
#define NEWS_H
+#include "window.h"
+
struct NewsItem {
StringID string_id;
uint16 duration;
@@ -24,25 +26,29 @@
#define NEWS_FLAGS(mode,flag,type,cb) ((cb)<<24 | (type)<<16 | (flag)<<8 | (mode))
void AddNewsItem(StringID string, uint32 flags, uint data_a, uint data_b);
-void NewsLoop(void);
+void NewsLoop();
void DrawNewsBorder(const BaseWindow *w);
-void InitNewsItemStructs(void);
+void InitNewsItemStructs();
VARDEF NewsItem _statusbar_news_item;
enum NewsType {
- NT_ARRIVAL_PLAYER = 0,
- NT_ARRIVAL_OTHER = 1,
- NT_ACCIDENT = 2,
- NT_COMPANY_INFO = 3,
- NT_ECONOMY = 4,
- NT_ADVICE = 5,
- NT_NEW_VEHICLES = 6,
- NT_ACCEPTANCE = 7,
- NT_SUBSIDIES = 8,
- NT_GENERAL = 9,
+ NT_ARRIVAL_PLAYER,
+ NT_ARRIVAL_OTHER,
+ NT_ACCIDENT,
+ NT_COMPANY_INFO,
+ NT_OPENCLOSE,
+ NT_ECONOMY,
+ NT_ADVICE,
+ NT_NEW_VEHICLES,
+ NT_ACCEPTANCE,
+ NT_SUBSIDIES,
+ NT_GENERAL,
+ NT_END,
};
+extern const char *_news_display_name[NT_END];
+
enum NewsMode {
NM_SMALL = 0, ///< Show only a small popup informing us about vehicle age for example
NM_NORMAL = 1, ///< Show a simple news message (height 170 pixels)
--- a/src/news_gui.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/news_gui.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -1,5 +1,7 @@
/* $Id$ */
+/** @file news_gui.cpp */
+
#include "stdafx.h"
#include "openttd.h"
#include "functions.h"
@@ -38,6 +40,7 @@
*/
#define MAX_NEWS 30
+#define NB_WIDG_PER_SETTING 4
typedef byte NewsID;
#define INVALID_NEWS 255
@@ -55,7 +58,7 @@
void DrawNewsNewVehicleAvail(BaseWindow *w);
void DrawNewsBankrupcy(BaseWindow *w);
-static void MoveToNextItem(void);
+static void MoveToNextItem();
StringID GetNewsStringNewVehicleAvail(const NewsItem *ni);
StringID GetNewsStringBankrupcy(const NewsItem *ni);
@@ -71,7 +74,7 @@
GetNewsStringBankrupcy, /* DNC_BANKRUPCY */
};
-void InitNewsItemStructs(void)
+void InitNewsItemStructs()
{
memset(_news_items, 0, sizeof(_news_items));
_current_news = INVALID_NEWS;
@@ -351,17 +354,32 @@
NewsWindowProc
};
-static const SoundFx _news_sounds[] = {
+static const SoundFx _news_sounds[NT_END] = {
SND_1D_APPLAUSE,
SND_1D_APPLAUSE,
SND_BEGIN,
SND_BEGIN,
SND_BEGIN,
SND_BEGIN,
+ SND_BEGIN,
SND_1E_OOOOH,
SND_BEGIN,
SND_BEGIN,
- SND_BEGIN
+ SND_BEGIN,
+};
+
+const char *_news_display_name[NT_END] = {
+ "arrival_player",
+ "arrival_other",
+ "accident",
+ "company_info",
+ "openclose",
+ "economy",
+ "advice",
+ "new_vehicles",
+ "acceptance",
+ "subsidies",
+ "general",
};
/** Get the value of an item of the news-display settings. This is
@@ -371,7 +389,7 @@
*/
static inline byte GetNewsDisplayValue(byte item)
{
- assert(item < 10 && GB(_news_display_opt, item * 2, 2) <= 2);
+ assert(item < NT_END && GB(_news_display_opt, item * 2, 2) <= 2);
return GB(_news_display_opt, item * 2, 2);
}
@@ -382,7 +400,7 @@
*/
static inline void SetNewsDisplayValue(byte item, byte val)
{
- assert(item < 10 && val <= 2);
+ assert(item < NT_END && val <= 2);
SB(_news_display_opt, item * 2, 2, val);
}
@@ -451,7 +469,7 @@
// Are we ready to show another news item?
// Only if nothing is in the newsticker and no newspaper is displayed
-static bool ReadyForNextItem(void)
+static bool ReadyForNextItem()
{
const BaseWindow *w;
NewsID item = (_forced_news == INVALID_NEWS) ? _current_news : _forced_news;
@@ -472,7 +490,7 @@
return (ni->duration == 0 || BaseWindow::FindById(WC_NEWS_WINDOW, 0) == NULL);
}
-static void MoveToNextItem(void)
+static void MoveToNextItem()
{
DeleteWindowById(WC_NEWS_WINDOW, 0);
_forced_news = INVALID_NEWS;
@@ -512,7 +530,7 @@
}
}
-void NewsLoop(void)
+void NewsLoop()
{
// no news item yet
if (_total_news == 0) return;
@@ -540,7 +558,7 @@
}
}
-void ShowLastNewsMessage(void)
+void ShowLastNewsMessage()
{
if (_forced_news == INVALID_NEWS) {
/* Not forced any news yet, show the current one, unless a news window is
@@ -680,7 +698,7 @@
MessageHistoryWndProc
};
-void ShowMessageHistory(void)
+void ShowMessageHistory()
{
BaseWindow *w;
@@ -698,167 +716,193 @@
}
}
+
+enum {
+ WIDGET_NEWSOPT_BTN_SUMMARY = 4, ///< Button that adjusts at once the level for all settings
+ WIDGET_NEWSOPT_DROP_SUMMARY, ///< Drop down button for same upper button
+ WIDGET_NEWSOPT_SOUNDTICKER = 7, ///< Button activating sound on events
+ WIDGET_NEWSOPT_START_OPTION = 9, ///< First widget that is part of a group [<] .. [.]
+};
+
/** Setup the disabled/enabled buttons in the message window
* If the value is 'off' disable the [<] widget, and enable the [>] one
- * Same-wise for all the others. Starting value of 3 is the first widget
+ * Same-wise for all the others. Starting value of 4 is the first widget
* group. These are grouped as [<][>] .. [<][>], etc.
+ * @param w Window been used
+ * @param value to set in the widget
+ * @param element index of the group of widget to set
*/
static void SetMessageButtonStates(BaseWindow *w, byte value, int element)
{
- element *= 2;
+ element *= NB_WIDG_PER_SETTING;
- w->SetWidgetDisabledState(element + 3, value == 0);
- w->SetWidgetDisabledState(element + 3 + 1, value == 2);
+ w->SetWidgetDisabledState(element + WIDGET_NEWSOPT_START_OPTION, value == 0);
+ w->SetWidgetDisabledState(element + WIDGET_NEWSOPT_START_OPTION + 2, value == 2);
}
+/**
+ * Event handler of the Message Options window
+ * @param w window pointer
+ * @param e event been triggered
+ */
static void MessageOptionsWndProc(BaseWindow *w, WindowEvent *e)
{
static const StringID message_opt[] = {STR_OFF, STR_SUMMARY, STR_FULL, INVALID_STRING_ID};
- /* WP(w, def_d).data_1 are stores the clicked state of the fake widgets
- * WP(w, def_d).data_2 stores state of the ALL on/off/summary button */
+ /* WP(w, def_d).data_1 stores state of the ALL on/off/summary button */
switch (e->event) {
- case WE_CREATE: {
- uint32 val = _news_display_opt;
- int i;
- WP(w, def_d).data_1 = WP(w, def_d).data_2 = 0;
-
- // Set up the initial disabled buttons in the case of 'off' or 'full'
- for (i = 0; i != 10; i++, val >>= 2) SetMessageButtonStates(w, val & 0x3, i);
- } break;
-
- case WE_PAINT: {
- uint32 val = _news_display_opt;
- int click_state = WP(w, def_d).data_1;
- int i, y;
-
- if (_news_ticker_sound) w->LowerWidget(25);
- w->DrawWidgets();
-
- /* XXX - Draw the fake widgets-buttons. Can't add these to the widget-desc since
- * openttd currently can only handle 32 widgets. So hack it *g* */
- 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 : 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);
- }
-
- DrawString( 8, y + 9, message_opt[WP(w, def_d).data_2], 0x10);
- DrawString(103, y + 9, STR_MESSAGES_ALL, 0);
- DrawString(103, y + 9 + 12, STR_MESSAGE_SOUND, 0);
+ case WE_CREATE: {
+ uint32 val = _news_display_opt;
+ int i;
+ WP(w, def_d).data_1 = 0;
- } break;
-
- case WE_CLICK:
- switch (e->we.click.widget) {
- case 2: /* Clicked on any of the fake widgets */
- if (e->we.click.pt.x > 13 && e->we.click.pt.x < 89 && e->we.click.pt.y > 26 && e->we.click.pt.y < 146) {
- int element = (e->we.click.pt.y - 26) / 12;
- byte val = (GetNewsDisplayValue(element) + 1) % 3;
-
- SetMessageButtonStates(w, val, element);
- SetNewsDisplayValue(element, val);
-
- WP(w, def_d).data_1 |= (1 << element);
- w->autorepeat_timeout = 5; // XXX - setup unclick (fake widget)
- w->SetDirty();
- }
- break;
- case 23: case 24: /* Dropdown menu for all settings */
- w->ShowDropDownMenu(message_opt, WP(w, def_d).data_2, 24, 0, 0);
- break;
- case 25: /* Change ticker sound on/off */
- _news_ticker_sound ^= 1;
- w->ToggleWidgetLoweredState(e->we.click.widget);
- w->InvalidateWidget(e->we.click.widget);
- break;
- default: { /* Clicked on the [<] .. [>] widgets */
- int wid = e->we.click.widget;
- if (wid > 2 && wid < 23) {
- int element = (wid - 3) / 2;
- byte val = (GetNewsDisplayValue(element) + ((wid & 1) ? -1 : 1)) % 3;
-
- SetMessageButtonStates(w, val, element);
- SetNewsDisplayValue(element, val);
- w->SetDirty();
- }
- } break;
+ /* Set up the initial disabled buttons in the case of 'off' or 'full' */
+ for (i = 0; i < NT_END; i++, val >>= 2) SetMessageButtonStates(w, val & 0x3, i);
} break;
- case WE_DROPDOWN_SELECT: {/* Select all settings for newsmessages */
- int i;
-
- WP(w, def_d).data_2 = e->we.dropdown.index;
+ case WE_PAINT: {
+ uint32 val = _news_display_opt;
+ int i, y;
- for (i = 0; i != 10; i++) {
- SB(_news_display_opt, i*2, 2, e->we.dropdown.index);
- SetMessageButtonStates(w, e->we.dropdown.index, i);
- }
- w->SetDirty();
- break;
- }
+ if (_news_ticker_sound) w->LowerWidget(WIDGET_NEWSOPT_SOUNDTICKER);
+ w->DrawWidgets();
- case WE_TIMEOUT: /* XXX - Hack to animate 'fake' buttons */
- WP(w, def_d).data_1 = 0;
- w->SetDirty();
- break;
+ /* Draw the string of each setting on each button. */
+ for (i = 0, y = 26; i < NT_END; i++, y += 12, val >>= 2) {
+ /* 51 comes from 13 + 89 (left and right of the button)+1, shiefted by one as to get division,
+ * which will give centered position */
+ DrawStringCentered(51, y + 1, message_opt[val & 0x3], 0x10);
+ }
+
+ /* Draw the general bottom button string as well */
+ DrawStringCentered(51, y + 10, message_opt[WP(w, def_d).data_1], 0x10);
+ } break;
+
+ case WE_CLICK:
+ switch (e->we.click.widget) {
+ case WIDGET_NEWSOPT_BTN_SUMMARY:
+ case WIDGET_NEWSOPT_DROP_SUMMARY: // Dropdown menu for all settings
+ w->ShowDropDownMenu(message_opt, WP(w, def_d).data_1, WIDGET_NEWSOPT_DROP_SUMMARY, 0, 0);
+ break;
+
+ case WIDGET_NEWSOPT_SOUNDTICKER: // Change ticker sound on/off
+ _news_ticker_sound ^= 1;
+ w->ToggleWidgetLoweredState(e->we.click.widget);
+ w->InvalidateWidget(e->we.click.widget);
+ break;
+
+ default: { // Clicked on the [<] .. [>] widgets
+ int wid = e->we.click.widget - WIDGET_NEWSOPT_START_OPTION;
+ if (wid >= 0 && wid < (NB_WIDG_PER_SETTING * NT_END)) {
+ int element = wid / NB_WIDG_PER_SETTING;
+ byte val = (GetNewsDisplayValue(element) + ((wid % NB_WIDG_PER_SETTING) ? 1 : -1)) % 3;
+
+ SetMessageButtonStates(w, val, element);
+ SetNewsDisplayValue(element, val);
+ w->SetDirty();
+ }
+ } break;
+ } break;
+
+
+ case WE_DROPDOWN_SELECT: { // Select all settings for newsmessages
+ int i;
+
+ WP(w, def_d).data_1 = e->we.dropdown.index;
+
+ for (i = 0; i < NT_END; i++) {
+ SetMessageButtonStates(w, e->we.dropdown.index, i);
+ SetNewsDisplayValue(i, e->we.dropdown.index);
+ }
+ w->SetDirty();
+ } break;
}
}
static const OldWidget _message_options_widgets[] = {
-{ WWT_CLOSEBOX, RESIZE_NONE, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
-{ WWT_CAPTION, RESIZE_NONE, 13, 11, 409, 0, 13, STR_0204_MESSAGE_OPTIONS, STR_018C_WINDOW_TITLE_DRAG_THIS},
-{ WWT_PANEL, RESIZE_NONE, 13, 0, 409, 14, 184, 0x0, STR_NULL},
-
-{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 4, 12, 26, 37, SPR_ARROW_LEFT, STR_HSCROLL_BAR_SCROLLS_LIST},
-{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 90, 98, 26, 37, SPR_ARROW_RIGHT, STR_HSCROLL_BAR_SCROLLS_LIST},
-
-{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 4, 12, 38, 49, SPR_ARROW_LEFT, STR_HSCROLL_BAR_SCROLLS_LIST},
-{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 90, 98, 38, 49, SPR_ARROW_RIGHT, STR_HSCROLL_BAR_SCROLLS_LIST},
-
-{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 4, 12, 50, 61, SPR_ARROW_LEFT, STR_HSCROLL_BAR_SCROLLS_LIST},
-{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 90, 98, 50, 61, SPR_ARROW_RIGHT, STR_HSCROLL_BAR_SCROLLS_LIST},
-
-{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 4, 12, 62, 73, SPR_ARROW_LEFT, STR_HSCROLL_BAR_SCROLLS_LIST},
-{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 90, 98, 62, 73, SPR_ARROW_RIGHT, STR_HSCROLL_BAR_SCROLLS_LIST},
-
-{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 4, 12, 74, 85, SPR_ARROW_LEFT, STR_HSCROLL_BAR_SCROLLS_LIST},
-{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 90, 98, 74, 85, SPR_ARROW_RIGHT, STR_HSCROLL_BAR_SCROLLS_LIST},
+{ WWT_CLOSEBOX, RESIZE_NONE, 13, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
+{ WWT_CAPTION, RESIZE_NONE, 13, 11, 409, 0, 13, STR_0204_MESSAGE_OPTIONS, STR_018C_WINDOW_TITLE_DRAG_THIS},
+{ WWT_PANEL, RESIZE_NONE, 13, 0, 409, 14, 196, 0x0, STR_NULL},
-{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 4, 12, 86, 97, SPR_ARROW_LEFT, STR_HSCROLL_BAR_SCROLLS_LIST},
-{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 90, 98, 86, 97, SPR_ARROW_RIGHT, STR_HSCROLL_BAR_SCROLLS_LIST},
-
-{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 4, 12, 98, 109, SPR_ARROW_LEFT, STR_HSCROLL_BAR_SCROLLS_LIST},
-{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 90, 98, 98, 109, SPR_ARROW_RIGHT, STR_HSCROLL_BAR_SCROLLS_LIST},
-
-{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 4, 12, 110, 121, SPR_ARROW_LEFT, STR_HSCROLL_BAR_SCROLLS_LIST},
-{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 90, 98, 110, 121, SPR_ARROW_RIGHT, STR_HSCROLL_BAR_SCROLLS_LIST},
+/* Text at the top of the main panel, in black */
+{ WWT_LABEL, RESIZE_NONE, 13, 0, 409, 13, 26, STR_0205_MESSAGE_TYPES, STR_NULL},
-{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 4, 12, 122, 133, SPR_ARROW_LEFT, STR_HSCROLL_BAR_SCROLLS_LIST},
-{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 90, 98, 122, 133, SPR_ARROW_RIGHT, STR_HSCROLL_BAR_SCROLLS_LIST},
+/* General drop down and sound button */
+{ WWT_PANEL, RESIZE_NONE, 3, 4, 86, 166, 177, 0x0, STR_NULL},
+{ WWT_TEXTBTN, RESIZE_NONE, 3, 87, 98, 166, 177, STR_0225, STR_NULL},
+{ WWT_TEXT, RESIZE_NONE, 3, 103, 409, 167, 179, STR_MESSAGES_ALL, STR_NULL},
-{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 4, 12, 134, 145, SPR_ARROW_LEFT, STR_HSCROLL_BAR_SCROLLS_LIST},
-{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 90, 98, 134, 145, SPR_ARROW_RIGHT, STR_HSCROLL_BAR_SCROLLS_LIST},
+{ WWT_TEXTBTN_2, RESIZE_NONE, 3, 4, 98, 178, 189, STR_02DB_OFF, STR_NULL},
+{ WWT_TEXT, RESIZE_NONE, 3, 103, 409, 179, 191, STR_MESSAGE_SOUND, STR_NULL},
-{ WWT_PANEL, RESIZE_NONE, 3, 4, 86, 154, 165, 0x0, STR_NULL},
-{ WWT_TEXTBTN, RESIZE_NONE, 3, 87, 98, 154, 165, STR_0225, STR_NULL},
-{ WWT_TEXTBTN_2, RESIZE_NONE, 3, 4, 98, 166, 177, STR_02DB_OFF, STR_NULL},
+/* Each four group is composed of the buttons [<] [..] [>] and the descriptor of the setting */
+{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 4, 12, 26, 37, SPR_ARROW_LEFT, STR_HSCROLL_BAR_SCROLLS_LIST},
+{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 13, 89, 26, 37, STR_EMPTY, STR_NULL},
+{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 90, 98, 26, 37, SPR_ARROW_RIGHT, STR_HSCROLL_BAR_SCROLLS_LIST},
+{ WWT_TEXT, RESIZE_NONE, 3, 103, 409, 27, 39, STR_0206_ARRIVAL_OF_FIRST_VEHICLE, STR_NULL},
-{ WWT_LABEL, RESIZE_NONE, 13, 0, 409, 13, 26, STR_0205_MESSAGE_TYPES, STR_NULL},
+{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 4, 12, 38, 49, SPR_ARROW_LEFT, STR_HSCROLL_BAR_SCROLLS_LIST},
+{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 13, 89, 38, 49, STR_EMPTY, STR_NULL},
+{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 90, 98, 38, 49, SPR_ARROW_RIGHT, STR_HSCROLL_BAR_SCROLLS_LIST},
+{ WWT_TEXT, RESIZE_NONE, 3, 103, 409, 39, 51, STR_0207_ARRIVAL_OF_FIRST_VEHICLE, STR_NULL},
+
+{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 4, 12, 50, 61, SPR_ARROW_LEFT, STR_HSCROLL_BAR_SCROLLS_LIST},
+{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 13, 89, 50, 61, STR_EMPTY, STR_NULL},
+{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 90, 98, 50, 61, SPR_ARROW_RIGHT, STR_HSCROLL_BAR_SCROLLS_LIST},
+{ WWT_TEXT, RESIZE_NONE, 3, 103, 409, 51, 63, STR_0208_ACCIDENTS_DISASTERS, STR_NULL},
+
+{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 4, 12, 62, 73, SPR_ARROW_LEFT, STR_HSCROLL_BAR_SCROLLS_LIST},
+{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 13, 89, 62, 73, STR_EMPTY, STR_NULL},
+{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 90, 98, 62, 73, SPR_ARROW_RIGHT, STR_HSCROLL_BAR_SCROLLS_LIST},
+{ WWT_TEXT, RESIZE_NONE, 3, 103, 409, 63, 75, STR_0209_COMPANY_INFORMATION, STR_NULL},
+
+{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 4, 12, 74, 85, SPR_ARROW_LEFT, STR_HSCROLL_BAR_SCROLLS_LIST},
+{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 13, 89, 74, 85, STR_EMPTY, STR_NULL},
+{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 90, 98, 74, 85, SPR_ARROW_RIGHT, STR_HSCROLL_BAR_SCROLLS_LIST},
+{ WWT_TEXT, RESIZE_NONE, 3, 103, 409, 75, 87, STR_NEWS_OPEN_CLOSE, STR_NULL},
+
+{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 4, 12, 86, 97, SPR_ARROW_LEFT, STR_HSCROLL_BAR_SCROLLS_LIST},
+{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 13, 89, 86, 97, STR_EMPTY, STR_NULL},
+{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 90, 98, 86, 97, SPR_ARROW_RIGHT, STR_HSCROLL_BAR_SCROLLS_LIST},
+{ WWT_TEXT, RESIZE_NONE, 3, 103, 409, 87, 99, STR_020A_ECONOMY_CHANGES, STR_NULL},
+
+{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 4, 12, 98, 109, SPR_ARROW_LEFT, STR_HSCROLL_BAR_SCROLLS_LIST},
+{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 13, 89, 98, 109, STR_EMPTY, STR_NULL},
+{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 90, 98, 98, 109, SPR_ARROW_RIGHT, STR_HSCROLL_BAR_SCROLLS_LIST},
+{ WWT_TEXT, RESIZE_NONE, 3, 103, 409, 99, 111, STR_020B_ADVICE_INFORMATION_ON_PLAYER, STR_NULL},
+
+{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 4, 12, 110, 121, SPR_ARROW_LEFT, STR_HSCROLL_BAR_SCROLLS_LIST},
+{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 13, 89, 110, 121, STR_EMPTY, STR_NULL},
+{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 90, 98, 110, 121, SPR_ARROW_RIGHT, STR_HSCROLL_BAR_SCROLLS_LIST},
+{ WWT_TEXT, RESIZE_NONE, 3, 103, 409, 111, 123, STR_020C_NEW_VEHICLES, STR_NULL},
+
+{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 4, 12, 122, 133, SPR_ARROW_LEFT, STR_HSCROLL_BAR_SCROLLS_LIST},
+{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 13, 89, 122, 133, STR_EMPTY, STR_NULL},
+{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 90, 98, 122, 133, SPR_ARROW_RIGHT, STR_HSCROLL_BAR_SCROLLS_LIST},
+{ WWT_TEXT, RESIZE_NONE, 3, 103, 409, 123, 135, STR_020D_CHANGES_OF_CARGO_ACCEPTANCE, STR_NULL},
+
+{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 4, 12, 134, 145, SPR_ARROW_LEFT, STR_HSCROLL_BAR_SCROLLS_LIST},
+{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 13, 89, 134, 145, STR_EMPTY, STR_NULL},
+{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 90, 98, 134, 145, SPR_ARROW_RIGHT, STR_HSCROLL_BAR_SCROLLS_LIST},
+{ WWT_TEXT, RESIZE_NONE, 3, 103, 409, 135, 147, STR_020E_SUBSIDIES, STR_NULL},
+
+{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 4, 12, 146, 157, SPR_ARROW_LEFT, STR_HSCROLL_BAR_SCROLLS_LIST},
+{ WWT_PUSHTXTBTN, RESIZE_NONE, 3, 13, 89, 146, 157, STR_EMPTY, STR_NULL},
+{ WWT_PUSHIMGBTN, RESIZE_NONE, 3, 90, 98, 146, 157, SPR_ARROW_RIGHT, STR_HSCROLL_BAR_SCROLLS_LIST},
+{ WWT_TEXT, RESIZE_NONE, 3, 103, 409, 147, 159, STR_020F_GENERAL_INFORMATION, STR_NULL},
+
{ WIDGETS_END},
};
static const WindowDesc _message_options_desc = {
- 270, 22, 410, 185,
+ 270, 22, 410, 197,
WC_GAME_OPTIONS, WC_NONE,
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
_message_options_widgets,
MessageOptionsWndProc
};
-void ShowMessageOptions(void)
+void ShowMessageOptions()
{
DeleteWindowById(WC_GAME_OPTIONS, 0);
BaseWindow::Allocate(&_message_options_desc);
--- a/src/npf.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/npf.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -869,7 +869,7 @@
return best_result;
}
-void InitializeNPF(void)
+void InitializeNPF()
{
init_AyStar(&_npf_aystar, NPFHash, NPF_HASH_SIZE);
_npf_aystar.loops_per_tick = 0;
@@ -888,7 +888,7 @@
* dest_tile, not just any stop of that station.
* So only for train orders to stations we fill fstd->station_index, for all
* others only dest_coords */
- if (v->current_order.type == OT_GOTO_STATION && v->type == VEH_Train) {
+ if (v->current_order.type == OT_GOTO_STATION && v->type == VEH_TRAIN) {
fstd->station_index = v->current_order.dest;
/* Let's take the closest tile of the station as our target for trains */
fstd->dest_coords = CalcClosestStationTile(v->current_order.dest, v->tile);
--- a/src/npf.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/npf.h Sun Mar 11 16:31:18 2007 +0000
@@ -35,10 +35,10 @@
NPF_INFINITE_PENALTY = 1000 * NPF_TILE_LENGTH
};
-typedef struct NPFFindStationOrTileData { /* Meant to be stored in AyStar.targetdata */
+struct NPFFindStationOrTileData { /* Meant to be stored in AyStar.targetdata */
TileIndex dest_coords; /* An indication of where the station is, for heuristic purposes, or the target tile */
StationID station_index; /* station index we're heading for, or INVALID_STATION when we're heading for a tile */
-} NPFFindStationOrTileData;
+};
enum { /* Indices into AyStar.userdata[] */
NPF_TYPE = 0, /* Contains a TransportTypes value */
@@ -51,18 +51,18 @@
NPF_NODE_FLAGS,
};
-typedef enum { /* Flags for AyStarNode.userdata[NPF_NODE_FLAGS]. Use NPFGetBit() and NPFGetBit() to use them. */
+enum NPFNodeFlag { /* Flags for AyStarNode.userdata[NPF_NODE_FLAGS]. Use NPFGetBit() and NPFGetBit() to use them. */
NPF_FLAG_SEEN_SIGNAL, /* Used to mark that a signal was seen on the way, for rail only */
NPF_FLAG_REVERSE, /* Used to mark that this node was reached from the second start node, if applicable */
NPF_FLAG_LAST_SIGNAL_RED, /* Used to mark that the last signal on this path was red */
-} NPFNodeFlag;
+};
-typedef struct NPFFoundTargetData { /* Meant to be stored in AyStar.userpath */
+struct NPFFoundTargetData { /* Meant to be stored in AyStar.userpath */
uint best_bird_dist; /* The best heuristic found. Is 0 if the target was found */
uint best_path_dist; /* The shortest path. Is (uint)-1 if no path is found */
Trackdir best_trackdir; /* The trackdir that leads to the shortest path/closest birds dist */
AyStarNode node; /* The node within the target the search led us to */
-} NPFFoundTargetData;
+};
/* These functions below are _not_ re-entrant, in favor of speed! */
--- a/src/oldloader.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/oldloader.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -27,7 +27,7 @@
OLD_MAP_SIZE = 256 * 256
};
-typedef struct LoadgameState {
+struct LoadgameState {
FILE *file;
uint chunk_size;
@@ -41,10 +41,10 @@
uint total_read;
bool failed;
-} LoadgameState;
+};
/* OldChunk-Type */
-typedef enum OldChunkTypes {
+enum OldChunkType {
OC_SIMPLE = 0,
OC_NULL = 1,
OC_CHUNK = 2,
@@ -78,20 +78,20 @@
OC_TILE = OC_VAR_U32 | OC_FILE_U16,
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 {
+struct OldChunks {
OldChunkType type; ///< Type of field
uint32 amount; ///< Amount of fields
void *ptr; ///< Pointer where to save the data (may only be set if offset is 0)
uint offset; ///< Offset from basepointer (may only be set if ptr is NULL)
OldChunkProc *proc; ///< Pointer to function that is called with OC_CHUNK
-} OldChunks;
+};
/* If it fails, check lines above.. */
assert_compile(sizeof(TileIndex) == 4);
@@ -290,7 +290,7 @@
extern uint32 GetOldTownName(uint32 townnameparts, byte old_town_name_type);
-static void FixOldTowns(void)
+static void FixOldTowns()
{
Town *town;
@@ -303,7 +303,7 @@
}
}
-static void FixOldStations(void)
+static void FixOldStations()
{
Station *st;
@@ -315,7 +315,7 @@
}
}
-static void FixOldVehicles(void)
+static void FixOldVehicles()
{
/* Check for shared orders, and link them correctly */
Vehicle* v;
@@ -374,7 +374,7 @@
static uint16 _old_string_id_2;
static uint16 _old_extra_chunk_nums;
-static void ReadTTDPatchFlags(void)
+static void ReadTTDPatchFlags()
{
int i;
@@ -486,9 +486,9 @@
AssignOrder(GetOrder(num), UnpackOldOrder(_old_order));
/* Relink the orders to eachother (in TTD(Patch) the orders for one
- vehicle are behind eachother, with OT_NOTHING as indication that
+ vehicle are behind eachother, with an invalid order (OT_NOTHING) as indication that
it is the last order */
- if (num > 0 && GetOrder(num)->type != OT_NOTHING)
+ if (num > 0 && GetOrder(num)->IsValid())
GetOrder(num - 1)->next = GetOrder(num);
return true;
@@ -1068,13 +1068,13 @@
* Basically v->type -= 0x10; would suffice, but play safely */
switch (v->type) {
default: NOT_REACHED();
- case 0x00 /*VEH_Invalid */: v->type = VEH_Invalid; res = LoadChunk(ls, NULL, vehicle_empty_chunk); break;
- case 0x10 /*VEH_Train */: v->type = VEH_Train; res = LoadChunk(ls, &v->u.rail, vehicle_train_chunk); break;
- case 0x11 /*VEH_Road */: v->type = VEH_Road; res = LoadChunk(ls, &v->u.road, vehicle_road_chunk); break;
- case 0x12 /*VEH_Ship */: v->type = VEH_Ship; res = LoadChunk(ls, &v->u.ship, vehicle_ship_chunk); break;
- case 0x13 /*VEH_Aircraft*/: v->type = VEH_Aircraft; res = LoadChunk(ls, &v->u.air, vehicle_air_chunk); break;
- case 0x14 /*VEH_Special */: v->type = VEH_Special; res = LoadChunk(ls, &v->u.special, vehicle_special_chunk); break;
- case 0x15 /*VEH_Disaster*/: v->type = VEH_Disaster; res = LoadChunk(ls, &v->u.disaster, vehicle_disaster_chunk); break;
+ case 0x00 /*VEH_INVALID */: v->type = VEH_INVALID; res = LoadChunk(ls, NULL, vehicle_empty_chunk); break;
+ case 0x10 /*VEH_TRAIN */: v->type = VEH_TRAIN; res = LoadChunk(ls, &v->u.rail, vehicle_train_chunk); break;
+ case 0x11 /*VEH_ROAD */: v->type = VEH_ROAD; res = LoadChunk(ls, &v->u.road, vehicle_road_chunk); break;
+ case 0x12 /*VEH_SHIP */: v->type = VEH_SHIP; res = LoadChunk(ls, &v->u.ship, vehicle_ship_chunk); break;
+ case 0x13 /*VEH_AIRCRAFT*/: v->type = VEH_AIRCRAFT; res = LoadChunk(ls, &v->u.air, vehicle_air_chunk); break;
+ case 0x14 /*VEH_SPECIAL */: v->type = VEH_SPECIAL; res = LoadChunk(ls, &v->u.special, vehicle_special_chunk); break;
+ case 0x15 /*VEH_DISASTER*/: v->type = VEH_DISASTER; res = LoadChunk(ls, &v->u.disaster, vehicle_disaster_chunk); break;
}
/* This chunk size should always be 10 bytes */
@@ -1209,7 +1209,7 @@
v->string_id = RemapOldStringID(_old_string_id);
/* Vehicle-subtype is different in TTD(Patch) */
- if (v->type == VEH_Special) v->subtype = v->subtype >> 1;
+ if (v->type == VEH_SPECIAL) v->subtype = v->subtype >> 1;
}
return true;
@@ -1611,7 +1611,7 @@
fclose(ls.file);
- _pause = 2;
+ _pause_game = 2;
return true;
}
--- a/src/oldpool.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/oldpool.h Sun Mar 11 16:31:18 2007 +0000
@@ -3,7 +3,7 @@
#ifndef OLDPOOL_H
#define OLDPOOL_H
-typedef struct OldMemoryPool OldMemoryPool;
+struct OldMemoryPool;
/* The function that is called after a new block is added
start_item is the first item of the new made block */
@@ -68,7 +68,7 @@
); \
} \
\
- static inline uint Get##name##PoolSize(void) \
+ static inline uint Get##name##PoolSize() \
{ \
return _##name##_pool.total_items; \
}
--- a/src/openttd.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/openttd.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -64,14 +64,15 @@
#include "road_map.h"
#include "water_map.h"
#include "industry_map.h"
+#include "unmovable_map.h"
#include <stdarg.h>
-void CallLandscapeTick(void);
-void IncreaseDate(void);
-void DoPaletteAnimations(void);
-void MusicLoop(void);
-void ResetMusic(void);
+void CallLandscapeTick();
+void IncreaseDate();
+void DoPaletteAnimations();
+void MusicLoop();
+void ResetMusic();
extern void SetDifficultyLevel(int mode, GameOptions *gm_opt);
extern Player* DoStartupNewPlayer(bool is_ai);
@@ -137,7 +138,7 @@
}
extern const char _openttd_revision[];
-static void showhelp(void)
+static void showhelp()
{
char buf[4096], *p;
@@ -265,7 +266,7 @@
res[1] = clamp(strtoul(t + 1, NULL, 0), 64, MAX_SCREEN_HEIGHT);
}
-static void InitializeDynamicVariables(void)
+static void InitializeDynamicVariables()
{
/* Dynamic stuff needs to be initialized somewhere... */
_town_sort = NULL;
@@ -273,7 +274,7 @@
}
-static void UnInitializeGame(void)
+static void UnInitializeGame()
{
UnInitWindowSystem();
@@ -294,7 +295,7 @@
free(_config_file);
}
-static void LoadIntroGame(void)
+static void LoadIntroGame()
{
char filename[256];
@@ -319,7 +320,7 @@
WaitTillGeneratedWorld();
}
- _pause = 0;
+ _pause_game = 0;
SetLocalPlayer(PLAYER_FIRST);
/* Make sure you can't scroll in the menu */
_scrolling_viewport = 0;
@@ -331,7 +332,7 @@
}
#if defined(UNIX) && !defined(__MORPHOS__)
-extern void DedicatedFork(void);
+extern void DedicatedFork();
#endif
int ttd_main(int argc, char *argv[])
@@ -593,7 +594,7 @@
return 0;
}
-void HandleExitGameRequest(void)
+void HandleExitGameRequest()
{
if (_game_mode == GM_MENU) { // do not ask to quit on the main screen
_exit_game = true;
@@ -610,8 +611,8 @@
* at any given time */
static ThreadMsg _message = MSG_OTTD_NO_MESSAGE;
-static inline void OTTD_ReleaseMutex(void) {_message = MSG_OTTD_NO_MESSAGE;}
-static inline ThreadMsg OTTD_PollThreadEvent(void) {return _message;}
+static inline void OTTD_ReleaseMutex() {_message = MSG_OTTD_NO_MESSAGE;}
+static inline ThreadMsg OTTD_PollThreadEvent() {return _message;}
/** Called by running thread to execute some action in the main game.
* It will stall as long as the mutex is not freed (handled) by the game */
@@ -649,7 +650,7 @@
}
-static void MakeNewGameDone(void)
+static void MakeNewGameDone()
{
/* In a dedicated server, the server does not play */
if (_network_dedicated) {
@@ -679,14 +680,14 @@
GenerateWorld(from_heightmap ? GW_HEIGHTMAP : GW_NEWGAME, 1 << _patches.map_x, 1 << _patches.map_y);
}
-static void MakeNewEditorWorldDone(void)
+static void MakeNewEditorWorldDone()
{
SetLocalPlayer(OWNER_NONE);
MarkWholeScreenDirty();
}
-static void MakeNewEditorWorld(void)
+static void MakeNewEditorWorld()
{
_game_mode = GM_EDITOR;
@@ -696,16 +697,16 @@
GenerateWorld(GW_EMPTY, 1 << _patches.map_x, 1 << _patches.map_y);
}
-void StartupPlayers(void);
-void StartupDisasters(void);
-extern void StartupEconomy(void);
+void StartupPlayers();
+void StartupDisasters();
+extern void StartupEconomy();
/**
* Start Scenario starts a new game based on a scenario.
* Eg 'New Game' --> select a preset scenario
* This starts a scenario based on your current difficulty settings
*/
-static void StartScenario(void)
+static void StartScenario()
{
_game_mode = GM_NORMAL;
@@ -900,10 +901,10 @@
// The state must not be changed from anywhere
// but here.
// That check is enforced in DoCommand.
-void StateGameLoop(void)
+void StateGameLoop()
{
// dont execute the state loop during pause
- if (_pause) return;
+ if (_pause_game) return;
if (IsGeneratingWorld()) return;
if (_game_mode == GM_EDITOR) {
@@ -932,7 +933,7 @@
}
}
-static void DoAutosave(void)
+static void DoAutosave()
{
char buf[200];
@@ -998,7 +999,7 @@
{ 0, 0}, // 15 : impossible
};
-static void HandleKeyScrolling(void)
+static void HandleKeyScrolling()
{
if (_dirkeys && !_no_scroll) {
int factor = _shift_pressed ? 50 : 10;
@@ -1006,7 +1007,7 @@
}
}
-void GameLoop(void)
+void GameLoop()
{
ThreadMsg message;
@@ -1064,16 +1065,16 @@
StateGameLoop();
#endif /* ENABLE_NETWORK */
- if (!_pause && _display_opt & DO_FULL_ANIMATION) DoPaletteAnimations();
+ if (!_pause_game && _display_opt & DO_FULL_ANIMATION) DoPaletteAnimations();
- if (!_pause || _cheats.build_in_pause.value) MoveAllTextEffects();
+ if (!_pause_game || _cheats.build_in_pause.value) MoveAllTextEffects();
InputLoop();
MusicLoop();
}
-void BeforeSaveGame(void)
+void BeforeSaveGame()
{
const BaseWindow *w = BaseWindow::FindById(WC_MAIN_WINDOW, 0);
@@ -1084,7 +1085,7 @@
}
}
-static void ConvertTownOwner(void)
+static void ConvertTownOwner()
{
TileIndex tile;
@@ -1106,7 +1107,7 @@
}
// before savegame version 4, the name of the company determined if it existed
-static void CheckIsPlayerActive(void)
+static void CheckIsPlayerActive()
{
Player *p;
@@ -1116,7 +1117,7 @@
}
// since savegame version 4.1, exclusive transport rights are stored at towns
-static void UpdateExclusiveRights(void)
+static void UpdateExclusiveRights()
{
Town *t;
@@ -1142,7 +1143,7 @@
18, 2, 20, };
// since savegame version 4.2 the currencies are arranged differently
-static void UpdateCurrencies(void)
+static void UpdateCurrencies()
{
_opt.currency = convert_currency[_opt.currency];
}
@@ -1150,7 +1151,7 @@
/* Up to revision 1413 the invisible tiles at the southern border have not been
* MP_VOID, even though they should have. This is fixed by this function
*/
-static void UpdateVoidTiles(void)
+static void UpdateVoidTiles()
{
uint i;
@@ -1159,14 +1160,14 @@
}
// since savegame version 6.0 each sign has an "owner", signs without owner (from old games are set to 255)
-static void UpdateSignOwner(void)
+static void UpdateSignOwner()
{
Sign *si;
FOR_ALL_SIGNS(si) si->owner = OWNER_NONE;
}
-extern void UpdateOldAircraft( void );
+extern void UpdateOldAircraft();
static inline RailType UpdateRailType(RailType rt, RailType min)
@@ -1174,7 +1175,7 @@
return rt >= min ? (RailType)(rt + 1): rt;
}
-bool AfterLoadGame(void)
+bool AfterLoadGame()
{
TileIndex map_size = MapSize();
BaseWindow *w;
@@ -1209,12 +1210,12 @@
if (_opt.road_side) _opt.road_side = 1;
/* Check if all NewGRFs are present, we are very strict in MP mode */
- GCF_Flags gcf_res = IsGoodGRFConfigList();
- if (_networking && gcf_res != GCF_ACTIVATED) return false;
+ GRFListCompatibility gcf_res = IsGoodGRFConfigList();
+ if (_networking && gcf_res != GLC_ALL_GOOD) return false;
switch (gcf_res) {
- case GCF_COMPATIBLE: _switch_mode_errorstr = STR_NEWGRF_COMPATIBLE_LOAD_WARNING; break;
- case GCF_NOT_FOUND: _switch_mode_errorstr = STR_NEWGRF_DISABLED_WARNING; break;
+ case GLC_COMPATIBLE: _switch_mode_errorstr = STR_NEWGRF_COMPATIBLE_LOAD_WARNING; break;
+ case GLC_NOT_FOUND: _switch_mode_errorstr = STR_NEWGRF_DISABLED_WARNING; break;
default: break;
}
@@ -1444,7 +1445,7 @@
}
FOR_ALL_VEHICLES(v) {
- if (v->type != VEH_Train && v->type != VEH_Road) continue;
+ if (v->type != VEH_TRAIN && v->type != VEH_ROAD) continue;
if (IsBridgeTile(v->tile)) {
DiagDirection dir = GetBridgeRampDirection(v->tile);
@@ -1461,7 +1462,7 @@
} else {
continue;
}
- if (v->type == VEH_Train) {
+ if (v->type == VEH_TRAIN) {
v->u.rail.track = TRACK_BIT_WORMHOLE;
} else {
v->u.road.state = RVSB_WORMHOLE;
@@ -1503,7 +1504,7 @@
RailType min_rail = RAILTYPE_ELECTRIC;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Train) {
+ if (v->type == VEH_TRAIN) {
RailType rt = RailVehInfo(v->engine_type)->railtype;
v->u.rail.railtype = rt;
@@ -1548,7 +1549,7 @@
}
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Train && (IsFrontEngine(v) || IsFreeWagon(v))) TrainConsistChanged(v);
+ if (v->type == VEH_TRAIN && (IsFrontEngine(v) || IsFreeWagon(v))) TrainConsistChanged(v);
}
}
@@ -1640,7 +1641,7 @@
if (CheckSavegameVersion(25)) {
Vehicle *v;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Road) {
+ if (v->type == VEH_ROAD) {
v->vehstatus &= ~0x40;
v->u.road.slot = NULL;
v->u.road.slot_age = 0;
@@ -1649,14 +1650,14 @@
} else {
Vehicle *v;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Road && v->u.road.slot != NULL) v->u.road.slot->num_vehicles++;
+ if (v->type == VEH_ROAD && v->u.road.slot != NULL) v->u.road.slot->num_vehicles++;
}
}
if (CheckSavegameVersion(26)) {
Station *st;
FOR_ALL_STATIONS(st) {
- st->last_vehicle_type = VEH_Invalid;
+ st->last_vehicle_type = VEH_INVALID;
}
}
@@ -1823,7 +1824,7 @@
Vehicle *v;
/* Aircraft units changed from 8 mph to 1 km/h */
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Aircraft && v->subtype <= AIR_AIRCRAFT) {
+ if (v->type == VEH_AIRCRAFT && v->subtype <= AIR_AIRCRAFT) {
const AircraftVehicleInfo *avi = AircraftVehInfo(v->engine_type);
v->cur_speed *= 129;
v->cur_speed /= 10;
@@ -1835,6 +1836,14 @@
if (CheckSavegameVersion(49)) FOR_ALL_PLAYERS(p) p->face = ConvertFromOldPlayerFace(p->face);
+ if (CheckSavegameVersion(52)) {
+ for (TileIndex t = 0; t < map_size; t++) {
+ if (IsStatueTile(t)) {
+ _m[t].m2 = CalcClosestTownFromTile(t, (uint)-1)->index;
+ }
+ }
+ }
+
return true;
}
@@ -1844,7 +1853,7 @@
* hash AfterLoadVehicles() will loop infinitely. We need AfterLoadVehicles()
* to recalculate vehicle data as some NewGRF vehicle sets could have been
* removed or added and changed statistics */
-void ReloadNewGRFData(void)
+void ReloadNewGRFData()
{
/* reload grf data */
GfxLoadSprites();
--- a/src/openttd.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/openttd.h Sun Mar 11 16:31:18 2007 +0000
@@ -11,43 +11,43 @@
#include "hal.h"
#include "helpers.hpp"
-typedef struct Oblong {
+struct Oblong {
int x, y;
int width, height;
-} Oblong;
+};
-typedef struct BoundingRect {
+struct BoundingRect {
int width;
int height;
-} BoundingRect;
+};
-typedef struct Pair {
+struct Pair {
int a;
int b;
-} Pair;
+};
#include "map.h"
#include "slope.h"
// Forward declarations of structs.
-typedef struct Vehicle Vehicle;
-typedef struct Depot Depot;
-typedef struct Waypoint Waypoint;
-typedef struct BaseWindow BaseWindow;
-typedef struct Station Station;
-typedef struct ViewPort ViewPort;
-typedef struct Town Town;
-typedef struct NewsItem NewsItem;
-typedef struct Industry Industry;
-typedef struct DrawPixelInfo DrawPixelInfo;
+struct Vehicle;
+struct Depot;
+struct Waypoint;
+struct Window;
+struct Station;
+struct ViewPort;
+struct Town;
+struct NewsItem;
+struct Industry;
+struct DrawPixelInfo;
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 struct PalSpriteID {
+struct PalSpriteID {
SpriteID sprite;
SpriteID pal;
-} PalSpriteID;
+};
typedef uint16 EngineID;
typedef uint16 UnitID;
typedef uint16 StringID;
@@ -140,7 +140,7 @@
typedef OwnerByte PlayerByte;
-typedef enum TransportTypes {
+enum TransportType {
/* These constants are for now linked to the representation of bridges
* and tunnels, so they can be used by GetTileTrackStatus_TunnelBridge.
* In an ideal world, these constants would be used everywhere when
@@ -153,20 +153,20 @@
TRANSPORT_WATER, // = 2
TRANSPORT_END,
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 {
+struct TileInfo {
uint x;
uint y;
Slope tileh;
TileIndex tile;
uint z;
-} TileInfo;
+};
/* Display Options */
@@ -195,7 +195,7 @@
NUM_PRICES = 49,
};
-typedef struct Prices {
+struct Prices {
int32 station_value;
int32 build_rail;
int32 build_road;
@@ -243,11 +243,11 @@
int32 roadveh_running;
int32 ship_running;
int32 build_industry;
-} Prices;
+};
#define GAME_DIFFICULTY_NUM 18
-typedef struct GameDifficulty {
+struct GameDifficulty {
int max_no_competitors;
int competitor_start_time;
int number_towns;
@@ -266,7 +266,7 @@
int line_reverse_mode;
int disasters;
int town_council_tolerance; // minimum required town ratings to be allowed to demolish stuff
-} GameDifficulty;
+};
enum {
// Temperate
@@ -317,18 +317,18 @@
typedef uint AcceptedCargo[NUM_CARGO];
-typedef struct TileDesc {
+struct TileDesc {
StringID str;
Owner owner;
Date build_date;
uint32 dparam[2];
-} TileDesc;
+};
-typedef struct {
+struct ViewportSign {
int32 left;
int32 top;
byte width_1, width_2;
-} ViewportSign;
+};
typedef void DrawTileProc(TileInfo *ti);
@@ -365,7 +365,7 @@
typedef uint32 VehicleEnterTileProc(Vehicle *v, TileIndex tile, int x, int y);
typedef Slope GetSlopeTilehProc(TileIndex, Slope tileh);
-typedef struct {
+struct TileTypeProcs {
DrawTileProc *draw_tile_proc;
GetSlopeZProc *get_slope_z_proc;
ClearTileProc *clear_tile_proc;
@@ -379,7 +379,7 @@
GetProducedCargoProc *get_produced_cargo_proc;
VehicleEnterTileProc *vehicle_enter_tile_proc;
GetSlopeTilehProc *get_slope_tileh_proc;
-} TileTypeProcs;
+};
enum WindowClass {
@@ -577,11 +577,11 @@
/** To have a concurrently running thread interface with the main program, use
* the OTTD_SendThreadMessage() function. Actions to perform upon the message are handled
* in the ProcessSentMessage() function */
-typedef enum ThreadMsgs {
+enum ThreadMsg {
MSG_OTTD_NO_MESSAGE,
MSG_OTTD_SAVETHREAD_DONE,
MSG_OTTD_SAVETHREAD_ERROR,
-} ThreadMsg;
+};
void OTTD_SendThreadMessage(ThreadMsg msg);
--- a/src/order.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/order.h Sun Mar 11 16:31:18 2007 +0000
@@ -88,8 +88,8 @@
* - Vehicle -> current_order
* - REF_SHEDULE (all REFs are currently limited to 16 bits!!)
*/
-typedef struct Order {
- struct Order *next; ///< Pointer to next order. If NULL, end of list
+struct Order {
+ Order *next; ///< Pointer to next order. If NULL, end of list
OrderTypeByte type;
uint8 flags;
@@ -99,24 +99,28 @@
CargoID refit_cargo; // Refit CargoID
byte refit_subtype; // Refit subtype
-} Order;
+
+ bool IsValid() const;
+ void Free();
+ void FreeChain();
+};
#define MAX_BACKUP_ORDER_COUNT 40
-typedef struct {
+struct BackuppedOrders {
VehicleID clone;
VehicleOrderID orderindex;
Order order[MAX_BACKUP_ORDER_COUNT + 1];
uint16 service_interval;
char name[32];
-} BackuppedOrders;
+};
VARDEF TileIndex _backup_orders_tile;
VARDEF BackuppedOrders _backup_orders_data[1];
DECLARE_OLD_POOL(Order, Order, 6, 1000)
-static inline VehicleOrderID GetMaxOrderIndex(void)
+static inline VehicleOrderID GetMaxOrderIndex()
{
/* TODO - This isn't the real content of the function, but
* with the new pool-system this will be replaced with one that
@@ -126,7 +130,7 @@
return GetOrderPoolSize() - 1;
}
-static inline VehicleOrderID GetNumOrders(void)
+static inline VehicleOrderID GetNumOrders()
{
return GetOrderPoolSize();
}
@@ -134,18 +138,26 @@
/**
* Check if a Order really exists.
*/
-static inline bool IsValidOrder(const Order *o)
+inline bool Order::IsValid() const
{
- return o->type != OT_NOTHING;
+ return type != OT_NOTHING;
}
-static inline void DeleteOrder(Order *o)
+inline void Order::Free()
{
- o->type = OT_NOTHING;
- o->next = NULL;
+ type = OT_NOTHING;
+ flags = 0;
+ dest = 0;
+ next = NULL;
}
-#define FOR_ALL_ORDERS_FROM(order, start) for (order = GetOrder(start); order != NULL; order = (order->index + 1U < GetOrderPoolSize()) ? GetOrder(order->index + 1U) : NULL) if (IsValidOrder(order))
+inline void Order::FreeChain()
+{
+ if (next != NULL) next->FreeChain();
+ Free();
+}
+
+#define FOR_ALL_ORDERS_FROM(order, start) for (order = GetOrder(start); order != NULL; order = (order->index + 1U < GetOrderPoolSize()) ? GetOrder(order->index + 1U) : NULL) if (order->IsValid())
#define FOR_ALL_ORDERS(order) FOR_ALL_ORDERS_FROM(order, 0)
@@ -160,7 +172,7 @@
return true;
FOR_ALL_ORDERS(order)
- if (order->type == OT_NOTHING)
+ if (!order->IsValid())
if (--amount == 0)
return true;
--- a/src/order_cmd.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/order_cmd.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -49,7 +49,7 @@
// Sanity check
// TTD stores invalid orders as OT_NOTHING with non-zero flags/station
- if (order.type == OT_NOTHING && (order.flags != 0 || order.dest != 0)) {
+ if (!order.IsValid() && (order.flags != 0 || order.dest != 0)) {
order.type = OT_DUMMY;
order.flags = 0;
}
@@ -109,14 +109,14 @@
* @return Order* if a free space is found, else NULL.
*
*/
-static Order *AllocateOrder(void)
+static Order *AllocateOrder()
{
Order *order;
/* We don't use FOR_ALL here, because FOR_ALL skips invalid items.
* TODO - This is just a temporary stage, this will be removed. */
for (order = GetOrder(0); order != NULL; order = (order->index + 1U < GetOrderPoolSize()) ? GetOrder(order->index + 1U) : NULL) {
- if (!IsValidOrder(order)) {
+ if (!order->IsValid()) {
OrderID index = order->index;
memset(order, 0, sizeof(*order));
@@ -213,11 +213,11 @@
}
switch (v->type) {
- case VEH_Train:
+ case VEH_TRAIN:
if (!(st->facilities & FACIL_TRAIN)) return CMD_ERROR;
break;
- case VEH_Road:
+ case VEH_ROAD:
if (v->cargo_type == CT_PASSENGERS) {
if (!(st->facilities & FACIL_BUS_STOP)) return CMD_ERROR;
} else {
@@ -225,11 +225,11 @@
}
break;
- case VEH_Ship:
+ case VEH_SHIP:
if (!(st->facilities & FACIL_DOCK)) return CMD_ERROR;
break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
if (!(st->facilities & FACIL_AIRPORT)) return CMD_ERROR;
break;
@@ -254,7 +254,7 @@
case OF_NON_STOP | OF_UNLOAD:
case OF_NON_STOP | OF_UNLOAD | OF_TRANSFER:
case OF_NON_STOP | OF_TRANSFER:
- if (v->type != VEH_Train) return CMD_ERROR;
+ if (v->type != VEH_TRAIN) return CMD_ERROR;
break;
default: return CMD_ERROR;
@@ -263,7 +263,7 @@
}
case OT_GOTO_DEPOT: {
- if (v->type == VEH_Aircraft) {
+ if (v->type == VEH_AIRCRAFT) {
const Station* st;
if (!IsValidStationID(new_order.dest)) return CMD_ERROR;
@@ -283,15 +283,15 @@
if (!CheckOwnership(GetTileOwner(dp->xy))) return CMD_ERROR;
switch (v->type) {
- case VEH_Train:
+ case VEH_TRAIN:
if (!IsTileDepotType(dp->xy, TRANSPORT_RAIL)) return CMD_ERROR;
break;
- case VEH_Road:
+ case VEH_ROAD:
if (!IsTileDepotType(dp->xy, TRANSPORT_ROAD)) return CMD_ERROR;
break;
- case VEH_Ship:
+ case VEH_SHIP:
if (!IsTileDepotType(dp->xy, TRANSPORT_WATER)) return CMD_ERROR;
break;
@@ -309,7 +309,7 @@
case OF_NON_STOP | OF_PART_OF_ORDERS:
case OF_NON_STOP | OF_PART_OF_ORDERS | OF_HALT_IN_DEPOT:
- if (v->type != VEH_Train) return CMD_ERROR;
+ if (v->type != VEH_TRAIN) return CMD_ERROR;
break;
default: return CMD_ERROR;
@@ -320,7 +320,7 @@
case OT_GOTO_WAYPOINT: {
const Waypoint* wp;
- if (v->type != VEH_Train) return CMD_ERROR;
+ if (v->type != VEH_TRAIN) return CMD_ERROR;
if (!IsValidWaypointID(new_order.dest)) return CMD_ERROR;
wp = GetWaypoint(new_order.dest);
@@ -334,7 +334,7 @@
case 0: break;
case OF_NON_STOP:
- if (v->type != VEH_Train) return CMD_ERROR;
+ if (v->type != VEH_TRAIN) return CMD_ERROR;
break;
default: return CMD_ERROR;
@@ -353,7 +353,7 @@
* handle any more then this.. */
if (v->num_orders >= MAX_BACKUP_ORDER_COUNT) return_cmd_error(STR_8832_TOO_MANY_ORDERS);
- if (v->type == VEH_Ship &&
+ if (v->type == VEH_SHIP &&
IsHumanPlayer(v->owner) &&
!_patches.new_pathfinding_all) {
// Make sure the new destination is not too far away from the previous
@@ -496,8 +496,7 @@
}
/* Give the item free */
- order->type = OT_NOTHING;
- order->next = NULL;
+ order->Free();
u = GetFirstVehicleFromSharedList(v);
DeleteOrderWarnings(u);
@@ -553,9 +552,9 @@
v->cur_order_index = b;
- if (v->type == VEH_Train) v->u.rail.days_since_order_progr = 0;
+ if (v->type == VEH_TRAIN) v->u.rail.days_since_order_progr = 0;
- if (v->type == VEH_Road) ClearSlot(v);
+ if (v->type == VEH_ROAD) ClearSlot(v);
/* NON-stop flag is misused to see if a train is in a station that is
* on his order list or not */
@@ -566,8 +565,8 @@
}
/* We have an aircraft/ship, they have a mini-schedule, so update them all */
- if (v->type == VEH_Aircraft) InvalidateWindowClasses(WC_AIRCRAFT_LIST);
- if (v->type == VEH_Ship) InvalidateWindowClasses(WC_SHIPS_LIST);
+ if (v->type == VEH_AIRCRAFT) InvalidateWindowClasses(WC_AIRCRAFT_LIST);
+ if (v->type == VEH_SHIP) InvalidateWindowClasses(WC_SHIPS_LIST);
return 0;
}
@@ -685,7 +684,7 @@
return CMD_ERROR;
/* Trucks can't share orders with busses (and visa versa) */
- if (src->type == VEH_Road) {
+ if (src->type == VEH_ROAD) {
if (src->cargo_type != dst->cargo_type && (src->cargo_type == CT_PASSENGERS || dst->cargo_type == CT_PASSENGERS))
return CMD_ERROR;
}
@@ -732,7 +731,7 @@
return CMD_ERROR;
/* Trucks can't copy all the orders from busses (and visa versa) */
- if (src->type == VEH_Road) {
+ if (src->type == VEH_ROAD) {
const Order *order;
TileIndex required_dst = INVALID_TILE;
@@ -871,9 +870,8 @@
*dest = *order;
dest++;
}
- /* End the list with an OT_NOTHING */
- dest->type = OT_NOTHING;
- dest->next = NULL;
+ /* End the list with an empty order */
+ dest->Free();
}
}
@@ -902,7 +900,7 @@
* order number is one more than the current amount of orders, and because
* in network the commands are queued before send, the second insert always
* fails in test mode. By bypassing the test-mode, that no longer is a problem. */
- for (i = 0; bak->order[i].type != OT_NOTHING; i++) {
+ for (i = 0; bak->order[i].IsValid(); i++) {
if (!DoCommandP(0, v->index + (i << 16), PackOrder(&bak->order[i]), NULL, CMD_INSERT_ORDER | CMD_NO_TEST_IF_IN_NETWORK))
break;
}
@@ -951,10 +949,10 @@
{
switch (v->type) {
default: NOT_REACHED();
- case VEH_Train: return st->train_tile;
- case VEH_Aircraft: return st->airport_tile;
- case VEH_Ship: return st->dock_tile;
- case VEH_Road:
+ case VEH_TRAIN: return st->train_tile;
+ case VEH_AIRCRAFT: return st->airport_tile;
+ case VEH_SHIP: return st->dock_tile;
+ case VEH_ROAD:
if (v->cargo_type == CT_PASSENGERS) {
return (st->bus_stops != NULL) ? st->bus_stops->xy : 0;
} else {
@@ -1063,7 +1061,7 @@
}
order = &v->current_order;
- if ((v->type == VEH_Aircraft && order->type == OT_GOTO_DEPOT ? OT_GOTO_STATION : order->type) == type &&
+ if ((v->type == VEH_AIRCRAFT && order->type == OT_GOTO_DEPOT ? OT_GOTO_STATION : order->type) == type &&
v->current_order.dest == destination) {
order->type = OT_DUMMY;
order->flags = 0;
@@ -1073,7 +1071,7 @@
/* Clear the order from the order-list */
invalidate = false;
FOR_VEHICLE_ORDERS(v, order) {
- if ((v->type == VEH_Aircraft && order->type == OT_GOTO_DEPOT ? OT_GOTO_STATION : order->type) == type &&
+ if ((v->type == VEH_AIRCRAFT && order->type == OT_GOTO_DEPOT ? OT_GOTO_STATION : order->type) == type &&
order->dest == destination) {
order->type = OT_DUMMY;
order->flags = 0;
@@ -1112,8 +1110,6 @@
*/
void DeleteVehicleOrders(Vehicle *v)
{
- Order *cur, *next;
-
DeleteOrderWarnings(v);
/* If we have a shared order-list, don't delete the list, but just
@@ -1146,7 +1142,7 @@
}
/* Remove the orders */
- cur = v->orders;
+ Order *cur = v->orders;
v->orders = NULL;
v->num_orders = 0;
@@ -1156,18 +1152,14 @@
switch (v->type) {
default: NOT_REACHED();
- case VEH_Train: window_class = WC_TRAINS_LIST; break;
- case VEH_Road: window_class = WC_ROADVEH_LIST; break;
- case VEH_Ship: window_class = WC_SHIPS_LIST; break;
- case VEH_Aircraft: window_class = WC_AIRCRAFT_LIST; break;
+ case VEH_TRAIN: window_class = WC_TRAINS_LIST; break;
+ case VEH_ROAD: window_class = WC_ROADVEH_LIST; break;
+ case VEH_SHIP: window_class = WC_SHIPS_LIST; break;
+ case VEH_AIRCRAFT: window_class = WC_AIRCRAFT_LIST; break;
}
DeleteWindowById(window_class, (cur->index << 16) | (v->type << 11) | VLW_SHARED_ORDERS | v->owner);
- }
- while (cur != NULL) {
- next = cur->next;
- DeleteOrder(cur);
- cur = next;
+ cur->FreeChain(); // Free the orders.
}
}
@@ -1199,7 +1191,7 @@
return false;
}
-void InitializeOrders(void)
+void InitializeOrders()
{
CleanPool(&_Order_pool);
AddBlockToPool(&_Order_pool);
@@ -1221,7 +1213,7 @@
SLE_END()
};
-static void Save_ORDR(void)
+static void Save_ORDR()
{
Order *order;
@@ -1231,7 +1223,7 @@
}
}
-static void Load_ORDR(void)
+static void Load_ORDR()
{
if (CheckSavegameVersionOldStyle(5, 2)) {
/* Version older than 5.2 did not have a ->next pointer. Convert them
@@ -1274,9 +1266,9 @@
/* Update all the next pointer */
for (i = 1; i < len; ++i) {
/* The orders were built like this:
- * Vehicle one had order[0], and as long as order++.type was not
- * OT_NOTHING, it was part of the order-list of that vehicle */
- if (GetOrder(i)->type != OT_NOTHING)
+ * While the order is valid, set the previous will get it's next pointer set
+ * We start with index 1 because no order will have the first in it's next pointer */
+ if (GetOrder(i)->IsValid())
GetOrder(i - 1)->next = GetOrder(i);
}
} else {
--- a/src/order_gui.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/order_gui.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -98,7 +98,7 @@
(uint)v->num_orders + ((shared_orders || v->num_orders != 0) ? 1 : 0) <= (uint)WP(w, order_d).sel);
/* non-stop only for trains */
- w->SetWidgetDisabledState(ORDER_WIDGET_NON_STOP, v->type != VEH_Train || order == NULL);
+ w->SetWidgetDisabledState(ORDER_WIDGET_NON_STOP, v->type != VEH_TRAIN || order == NULL);
w->SetWidgetDisabledState(ORDER_WIDGET_FULL_LOAD, order == NULL); // full load
w->SetWidgetDisabledState(ORDER_WIDGET_UNLOAD, order == NULL); // unload
w->SetWidgetDisabledState(ORDER_WIDGET_TRANSFER, order == NULL); // transfer
@@ -162,16 +162,16 @@
case OT_GOTO_DEPOT: {
StringID s = STR_NULL;
- if (v->type == VEH_Aircraft) {
+ if (v->type == VEH_AIRCRAFT) {
s = STR_GO_TO_AIRPORT_HANGAR;
SetDParam(2, order->dest);
} else {
SetDParam(2, GetDepot(order->dest)->town_index);
switch (v->type) {
- case VEH_Train: s = (order->flags & OF_NON_STOP) ? STR_880F_GO_NON_STOP_TO_TRAIN_DEPOT : STR_GO_TO_TRAIN_DEPOT; break;
- case VEH_Road: s = STR_9038_GO_TO_ROADVEH_DEPOT; break;
- case VEH_Ship: s = STR_GO_TO_SHIP_DEPOT; break;
+ case VEH_TRAIN: s = (order->flags & OF_NON_STOP) ? STR_880F_GO_NON_STOP_TO_TRAIN_DEPOT : STR_GO_TO_TRAIN_DEPOT; break;
+ case VEH_ROAD: s = STR_9038_GO_TO_ROADVEH_DEPOT; break;
+ case VEH_SHIP: s = STR_GO_TO_SHIP_DEPOT; break;
default: break;
}
}
@@ -231,7 +231,7 @@
if (_patches.gotodepot) {
switch (GetTileType(tile)) {
case MP_RAILWAY:
- if (v->type == VEH_Train && IsTileOwner(tile, _local_player)) {
+ if (v->type == VEH_TRAIN && IsTileOwner(tile, _local_player)) {
if (IsRailDepot(tile)) {
order.type = OT_GOTO_DEPOT;
order.flags = OF_PART_OF_ORDERS;
@@ -242,7 +242,7 @@
break;
case MP_STREET:
- if (GetRoadTileType(tile) == ROAD_TILE_DEPOT && v->type == VEH_Road && IsTileOwner(tile, _local_player)) {
+ if (GetRoadTileType(tile) == ROAD_TILE_DEPOT && v->type == VEH_ROAD && IsTileOwner(tile, _local_player)) {
order.type = OT_GOTO_DEPOT;
order.flags = OF_PART_OF_ORDERS;
order.dest = GetDepotByTile(tile)->index;
@@ -251,7 +251,7 @@
break;
case MP_STATION:
- if (v->type != VEH_Aircraft) break;
+ if (v->type != VEH_AIRCRAFT) break;
if (IsHangar(tile) && IsTileOwner(tile, _local_player)) {
order.type = OT_GOTO_DEPOT;
order.flags = OF_PART_OF_ORDERS;
@@ -261,7 +261,7 @@
break;
case MP_WATER:
- if (v->type != VEH_Ship) break;
+ if (v->type != VEH_SHIP) break;
if (IsTileDepotType(tile, TRANSPORT_WATER) &&
IsTileOwner(tile, _local_player)) {
TileIndex tile2 = GetOtherShipDepotTile(tile);
@@ -279,7 +279,7 @@
// check waypoint
if (IsTileType(tile, MP_RAILWAY) &&
- v->type == VEH_Train &&
+ v->type == VEH_TRAIN &&
IsTileOwner(tile, _local_player) &&
IsRailWaypoint(tile)) {
order.type = OT_GOTO_WAYPOINT;
@@ -294,10 +294,10 @@
if (st->owner == _current_player || st->owner == OWNER_NONE) {
byte facil;
- (facil=FACIL_DOCK, v->type == VEH_Ship) ||
- (facil=FACIL_TRAIN, v->type == VEH_Train) ||
- (facil=FACIL_AIRPORT, v->type == VEH_Aircraft) ||
- (facil=FACIL_BUS_STOP, v->type == VEH_Road && v->cargo_type == CT_PASSENGERS) ||
+ (facil=FACIL_DOCK, v->type == VEH_SHIP) ||
+ (facil=FACIL_TRAIN, v->type == VEH_TRAIN) ||
+ (facil=FACIL_AIRPORT, v->type == VEH_AIRCRAFT) ||
+ (facil=FACIL_BUS_STOP, v->type == VEH_ROAD && v->cargo_type == CT_PASSENGERS) ||
(facil=FACIL_TRUCK_STOP, 1);
if (st->facilities & facil) {
order.type = OT_GOTO_STATION;
@@ -309,8 +309,7 @@
}
// not found
- order.type = OT_NOTHING;
- order.flags = 0;
+ order.Free();
order.dest = INVALID_STATION;
return order;
}
@@ -319,7 +318,7 @@
{
if (u->type != v->type) return false;
- if (u->type == VEH_Train && !IsFrontEngine(u)) {
+ if (u->type == VEH_TRAIN && !IsFrontEngine(u)) {
u = GetFirstVehicleInChain(u);
if (!IsFrontEngine(u)) return false;
}
@@ -347,7 +346,7 @@
if (u != NULL && HandleOrderVehClick(v, u, w)) return;
cmd = GetOrderCmdFromTile(v, tile);
- if (cmd.type == OT_NOTHING) return;
+ if (!cmd.IsValid()) return;
if (DoCommandP(v->tile, v->index + (OrderGetSel(w) << 16), PackOrder(&cmd), NULL, CMD_INSERT_ORDER | CMD_MSG(STR_8833_CAN_T_INSERT_NEW_ORDER))) {
if (WP(w,order_d).sel != -1) WP(w,order_d).sel++;
@@ -465,7 +464,7 @@
switch (ord->type) {
case OT_GOTO_STATION: xy = GetStation(ord->dest)->xy ; break;
- case OT_GOTO_DEPOT: xy = (v->type == VEH_Aircraft) ? GetStation(ord->dest)->xy : GetDepot(ord->dest)->xy; break;
+ case OT_GOTO_DEPOT: xy = (v->type == VEH_AIRCRAFT) ? GetStation(ord->dest)->xy : GetDepot(ord->dest)->xy; break;
case OT_GOTO_WAYPOINT: xy = GetWaypoint(ord->dest)->xy; break;
default: xy = 0; break;
}
@@ -677,7 +676,7 @@
if (v->owner != _local_player) {
w = BaseWindow::AllocateFront(&_other_orders_desc, veh);
} else {
- w = BaseWindow::AllocateFront((v->type == VEH_Train) ? &_orders_train_desc : &_orders_desc, veh);
+ w = BaseWindow::AllocateFront((v->type == VEH_TRAIN) ? &_orders_train_desc : &_orders_desc, veh);
}
if (w != NULL) {
--- a/src/os/macosx/macos.mm Sat Mar 10 11:07:13 2007 +0000
+++ b/src/os/macosx/macos.mm Sun Mar 11 16:31:18 2007 +0000
@@ -24,7 +24,7 @@
void ToggleFullScreen(bool fs);
-static char *GetOSString(void)
+static char *GetOSString()
{
static char buffer[175];
const char* CPU;
--- a/src/os/macosx/splash.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/os/macosx/splash.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -26,7 +26,7 @@
DEBUG(misc, 1, "[libpng] warning: %s - %s", message, (char *)png_get_error_ptr(png_ptr));
}
-void DisplaySplashImage(void)
+void DisplaySplashImage()
{
png_byte header[8];
FILE *f;
@@ -139,6 +139,6 @@
#else /* WITH_PNG */
-void DisplaySplashImage(void) {}
+void DisplaySplashImage() {}
#endif /* WITH_PNG */
--- a/src/os/macosx/splash.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/os/macosx/splash.h Sun Mar 11 16:31:18 2007 +0000
@@ -9,7 +9,7 @@
extern "C" {
#endif //__cplusplus
- void DisplaySplashImage(void);
+ void DisplaySplashImage();
#ifdef __cplusplus
}
--- a/src/os2.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/os2.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -33,7 +33,7 @@
return file[3] == '\0';
}
-void FiosGetDrives(void)
+void FiosGetDrives()
{
unsigned disk, disk2, save, total;
@@ -114,11 +114,15 @@
char filename[MAX_PATH];
snprintf(filename, lengthof(filename), "%s" PATHSEP "%s", path, ent->d_name);
- if (stat(filename, sb) != 0) return false;
+ return stat(filename, sb) == 0;
+}
- return (ent->d_name[0] != '.'); // hidden file
+bool FiosIsHiddenFile(const struct dirent *ent)
+{
+ return ent->d_name[0] == '.';
}
+
static void ChangeWorkingDirectory(char *exe)
{
char *s = strrchr(exe, PATHSEPCHAR);
@@ -174,7 +178,7 @@
return ttd_main(argc, argv);
}
-void DeterminePaths(void)
+void DeterminePaths()
{
char *s;
--- a/src/os_timer.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/os_timer.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -9,12 +9,12 @@
#if defined(_MSC_VER) && !defined(RDTSC_AVAILABLE)
# if _MSC_VER >= 1400
#include <intrin.h>
-uint64 _rdtsc(void)
+uint64 _rdtsc()
{
return __rdtsc();
}
# else
-uint64 _declspec(naked) _rdtsc(void)
+uint64 _declspec(naked) _rdtsc()
{
_asm {
rdtsc
@@ -27,14 +27,14 @@
/* rdtsc for OS/2. Hopefully this works, who knows */
#if defined (__WATCOMC__) && !defined(RDTSC_AVAILABLE)
-unsigned __int64 _rdtsc( void);
+unsigned __int64 _rdtsc();
# pragma aux _rdtsc = 0x0F 0x31 value [edx eax] parm nomemory modify exact [edx eax] nomemory;
# define RDTSC_AVAILABLE
#endif
/* rdtsc for all other *nix-en (hopefully). Use GCC syntax */
#if defined(__i386__) || defined(__x86_64__) && !defined(RDTSC_AVAILABLE)
-uint64 _rdtsc(void)
+uint64 _rdtsc()
{
uint32 high, low;
__asm__ __volatile__ ("rdtsc" : "=a" (low), "=d" (high));
@@ -45,7 +45,7 @@
/* rdtsc for PPC which has this not */
#if (defined(__POWERPC__) || defined(__powerpc__)) && !defined(RDTSC_AVAILABLE)
-uint64 _rdtsc(void)
+uint64 _rdtsc()
{
uint32 high = 0, high2 = 0, low;
/* PPC does not have rdtsc, so we cheat by reading the two 32-bit time-counters
@@ -70,5 +70,5 @@
* you just won't be able to profile your code with TIC()/TOC() */
#if !defined(RDTSC_AVAILABLE)
#warning "(non-fatal) No support for rdtsc(), you won't be able to profile with TIC/TOC"
-uint64 _rdtsc(void) {return 0;}
+uint64 _rdtsc() {return 0;}
#endif
--- a/src/pathfind.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/pathfind.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -423,7 +423,7 @@
after_proc(&tpf);
}
-typedef struct {
+struct StackedItem {
TileIndex tile;
uint16 cur_length; // This is the current length to this tile.
uint16 priority; // This is the current length + estimated length to the goal.
@@ -431,7 +431,7 @@
byte depth;
byte state;
byte first_track;
-} StackedItem;
+};
static const Trackdir _new_trackdir[6][4] = {
{TRACKDIR_X_NE, INVALID_TRACKDIR, TRACKDIR_X_SW, INVALID_TRACKDIR,},
@@ -442,13 +442,13 @@
{INVALID_TRACKDIR, INVALID_TRACKDIR, TRACKDIR_RIGHT_S, TRACKDIR_RIGHT_N,},
};
-typedef struct HashLink {
+struct HashLink {
TileIndex tile;
uint16 typelength;
uint16 next;
-} HashLink;
+};
-typedef struct {
+struct NewTrackPathFinder {
NTPEnumProc *enum_proc;
void *userdata;
TileIndex dest;
@@ -468,7 +468,7 @@
HashLink links[0x400]; // hash links
-} NewTrackPathFinder;
+};
#define NTP_GET_LINK_OFFS(tpf, link) ((byte*)(link) - (byte*)tpf->links)
#define NTP_GET_LINK_PTR(tpf, link_offs) (HashLink*)((byte*)tpf->links + (link_offs))
--- a/src/pathfind.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/pathfind.h Sun Mar 11 16:31:18 2007 +0000
@@ -14,7 +14,7 @@
//#define PF_BENCH // perform simple benchmarks on the train pathfinder (not
//supported on all archs)
-typedef struct TrackPathFinder TrackPathFinder;
+struct TrackPathFinder;
typedef bool TPFEnumProc(TileIndex tile, void *data, Trackdir trackdir, uint length, byte *state);
typedef void TPFAfterProc(TrackPathFinder *tpf);
@@ -30,17 +30,17 @@
*/
#define PATHFIND_HASH_TILE(tile) (TileX(tile) & 0x1F) + ((TileY(tile) & 0x1F) << 5)
-typedef struct TrackPathFinderLink {
+struct TrackPathFinderLink {
TileIndex tile;
uint16 flags;
uint16 next;
-} TrackPathFinderLink;
+};
-typedef struct RememberData {
+struct RememberData {
uint16 cur_length;
byte depth;
byte pft_var6;
-} RememberData;
+};
struct TrackPathFinder {
int num_links_left;
@@ -67,10 +67,10 @@
void FollowTrack(TileIndex tile, uint16 flags, DiagDirection direction, TPFEnumProc* enum_proc, TPFAfterProc* after_proc, void* data);
-typedef struct {
+struct FindLengthOfTunnelResult {
TileIndex tile;
int length;
-} FindLengthOfTunnelResult;
+};
FindLengthOfTunnelResult FindLengthOfTunnel(TileIndex tile, DiagDirection direction);
void NewTrainPathfind(TileIndex tile, TileIndex dest, RailTypeMask railtypes, DiagDirection direction, NTPEnumProc* enum_proc, void* data);
--- a/src/player.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/player.h Sun Mar 11 16:31:18 2007 +0000
@@ -9,15 +9,15 @@
#include "engine.h"
#include "livery.h"
-typedef struct PlayerEconomyEntry {
+struct PlayerEconomyEntry {
int32 income;
int32 expenses;
int32 delivered_cargo;
int32 performance_history; // player score (scale 0-1000)
int64 company_value;
-} PlayerEconomyEntry;
+};
-typedef struct AiBuildRec {
+struct AiBuildRec {
TileIndex spec_tile;
TileIndex use_tile;
byte rand_rng;
@@ -28,9 +28,9 @@
byte buildcmd_b;
byte direction;
CargoID cargo;
-} AiBuildRec;
+};
-typedef struct PlayerAI {
+struct PlayerAI {
byte state;
byte tick; // Used to determine how often to move
uint32 state_counter; // Can hold tile index!
@@ -68,9 +68,9 @@
TileIndex banned_tiles[16];
byte banned_val[16];
-} PlayerAI;
+};
-typedef struct Ai_PathFinderInfo {
+struct Ai_PathFinderInfo {
TileIndex start_tile_tl; // tl = top-left
TileIndex start_tile_br; // br = bottom-right
TileIndex end_tile_tl; // tl = top-left
@@ -84,17 +84,17 @@
int position; // Current position in the build-path, needed to build the path
bool rail_or_road; // true = rail, false = road
-} Ai_PathFinderInfo;
+};
// The amount of memory reserved for the AI-special-vehicles
#define AI_MAX_SPECIAL_VEHICLES 100
-typedef struct Ai_SpecialVehicle {
+struct Ai_SpecialVehicle {
VehicleID veh_id;
uint32 flag;
-} Ai_SpecialVehicle;
+};
-typedef struct PlayerAiNew {
+struct PlayerAiNew {
uint8 state;
uint tick;
uint idle;
@@ -144,12 +144,12 @@
int to_ic;
byte to_type;
-} PlayerAiNew;
+};
typedef uint32 PlayerFace;
-typedef struct Player {
+struct Player {
uint32 name_2;
uint16 name_1;
@@ -198,7 +198,7 @@
int16 engine_renew_months;
uint32 engine_renew_money;
uint16 num_engines[TOTAL_NUM_ENGINES]; // caches the number of engines of each type the player owns (no need to save this)
-} Player;
+};
uint16 GetDrawStringPlayerColor(PlayerID player);
@@ -217,7 +217,7 @@
// NOSAVE: can be determined from player structs
VARDEF byte _player_colors[MAX_PLAYERS];
-static inline byte ActivePlayerCount(void)
+static inline byte ActivePlayerCount()
{
const Player *p;
byte count = 0;
@@ -235,7 +235,7 @@
return &_players[i];
}
-static inline bool IsLocalPlayer(void)
+static inline bool IsLocalPlayer()
{
return _local_player == _current_player;
}
@@ -282,17 +282,17 @@
return RAILTYPE_RAIL;
}
-typedef struct HighScore {
+struct HighScore {
char company[100];
StringID title; // NO_SAVE, has troubles with changing string-numbers.
uint16 score; // do NOT change type, will break hs.dat
-} HighScore;
+};
VARDEF HighScore _highscore_table[5][5]; // 4 difficulty-settings (+ network); top 5
-void SaveToHighScore(void);
-void LoadFromHighScore(void);
+void SaveToHighScore();
+void LoadFromHighScore();
int8 SaveHighScoreValue(const Player *p);
-int8 SaveHighScoreValueNetwork(void);
+int8 SaveHighScoreValueNetwork();
/* Engine Replacement Functions */
--- a/src/player_gui.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/player_gui.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -286,10 +286,10 @@
3,
};
-typedef struct livery_d {
+struct livery_d {
uint32 sel;
LiveryClass livery_class;
-} livery_d;
+};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(livery_d));
static void ShowColourDropDownMenu(BaseWindow *w, uint32 widget)
@@ -645,10 +645,10 @@
FOR_ALL_VEHICLES(v) {
if (v->owner == player) {
switch (v->type) {
- case VEH_Train: if (IsFrontEngine(v)) train++; break;
- case VEH_Road: road++; break;
- case VEH_Aircraft: if (IsNormalAircraft(v)) air++; break;
- case VEH_Ship: ship++; break;
+ case VEH_TRAIN: if (IsFrontEngine(v)) train++; break;
+ case VEH_ROAD: road++; break;
+ case VEH_AIRCRAFT: if (IsNormalAircraft(v)) air++; break;
+ case VEH_SHIP: ship++; break;
default: break;
}
}
@@ -1131,7 +1131,7 @@
/* Show the endgame victory screen in 2050. Update the new highscore
* if it was high enough */
-void ShowEndGameChart(void)
+void ShowEndGameChart()
{
BaseWindow *w;
--- a/src/players.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/players.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -337,7 +337,7 @@
static const byte _color_similar_1[16] = {8, 6, 255, 12, 255, 0, 1, 1, 0, 13, 11, 10, 3, 9, 15, 14};
static const byte _color_similar_2[16] = {5, 7, 255, 255, 255, 8, 7, 6, 5, 12, 255, 255, 9, 255, 255, 255};
-static byte GeneratePlayerColor(void)
+static byte GeneratePlayerColor()
{
byte colors[16], pcolor, t2;
int i,j,n;
@@ -425,7 +425,7 @@
}
}
-static Player *AllocatePlayer(void)
+static Player *AllocatePlayer()
{
Player *p;
// Find a free slot
@@ -494,13 +494,13 @@
return p;
}
-void StartupPlayers(void)
+void StartupPlayers()
{
// The AI starts like in the setting with +2 month max
_next_competitor_start = _opt.diff.competitor_start_time * 90 * DAY_TICKS + RandomRange(60 * DAY_TICKS) + 1;
}
-static void MaybeStartNewPlayer(void)
+static void MaybeStartNewPlayer()
{
uint n;
Player *p;
@@ -527,14 +527,14 @@
_next_competitor_start += _network_server ? InteractiveRandomRange(60 * DAY_TICKS) : RandomRange(60 * DAY_TICKS);
}
-void InitializePlayers(void)
+void InitializePlayers()
{
memset(_players, 0, sizeof(_players));
for (PlayerID i = PLAYER_FIRST; i != MAX_PLAYERS; i++) _players[i].index = i;
_cur_player_tick_index = 0;
}
-void OnTick_Players(void)
+void OnTick_Players()
{
Player *p;
@@ -560,7 +560,7 @@
extern void ShowPlayerFinances(PlayerID player);
-void PlayersYearlyLoop(void)
+void PlayersYearlyLoop()
{
Player *p;
@@ -593,7 +593,7 @@
const Engine* e = GetEngine(i);
const EngineInfo *ei = EngInfo(i);
- if (e->type == VEH_Train && HASBIT(ei->climates, _opt.landscape) &&
+ if (e->type == VEH_TRAIN && HASBIT(ei->climates, _opt.landscape) &&
(HASBIT(e->player_avail, p) || _date >= e->intro_date + 365)) {
const RailVehicleInfo *rvi = RailVehInfo(i);
@@ -704,7 +704,7 @@
return CMD_ERROR;
// make sure that we do not replace a plane with a helicopter or vise versa
- if (GetEngine(new_engine_type)->type == VEH_Aircraft &&
+ if (GetEngine(new_engine_type)->type == VEH_AIRCRAFT &&
(AircraftVehInfo(old_engine_type)->subtype & AIR_CTOL) != (AircraftVehInfo(new_engine_type)->subtype & AIR_CTOL))
return CMD_ERROR;
@@ -743,7 +743,7 @@
if (flags & DC_EXEC) {
p->renew_keep_length = (bool)GB(p2, 0, 1);
if (IsLocalPlayer()) {
- InvalidateWindow(WC_REPLACE_VEHICLE, VEH_Train);
+ InvalidateWindow(WC_REPLACE_VEHICLE, VEH_TRAIN);
}
}
break;
@@ -946,7 +946,7 @@
}
/* Return true if any cheat has been used, false otherwise */
-static bool CheatHasBeenUsed(void)
+static bool CheatHasBeenUsed()
{
const Cheat* cht = (Cheat*)&_cheats;
const Cheat* cht_last = &cht[sizeof(_cheats) / sizeof(Cheat)];
@@ -998,7 +998,7 @@
/* Save the highscores in a network game when it has ended */
#define LAST_HS_ITEM lengthof(_highscore_table) - 1
-int8 SaveHighScoreValueNetwork(void)
+int8 SaveHighScoreValueNetwork()
{
const Player* p;
const Player* pl[MAX_PLAYERS];
@@ -1036,7 +1036,7 @@
}
/* Save HighScore table to file */
-void SaveToHighScore(void)
+void SaveToHighScore()
{
FILE *fp = fopen(_highscore_file, "wb");
@@ -1060,7 +1060,7 @@
}
/* Initialize the highscore table to 0 and if any file exists, load in values */
-void LoadFromHighScore(void)
+void LoadFromHighScore()
{
FILE *fp = fopen(_highscore_file, "rb");
@@ -1257,7 +1257,7 @@
}
}
-static void Save_PLYR(void)
+static void Save_PLYR()
{
Player *p;
FOR_ALL_PLAYERS(p) {
@@ -1268,7 +1268,7 @@
}
}
-static void Load_PLYR(void)
+static void Load_PLYR()
{
int index;
while ((index = SlIterateArray()) != -1) {
--- a/src/queue.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/queue.h Sun Mar 11 16:31:18 2007 +0000
@@ -9,21 +9,19 @@
//#define HASH_STATS
-typedef struct Queue Queue;
+struct Queue;
typedef bool Queue_PushProc(Queue* q, void* item, int priority);
typedef void* Queue_PopProc(Queue* q);
typedef bool Queue_DeleteProc(Queue* q, void* item, int priority);
typedef void Queue_ClearProc(Queue* q, bool free_values);
typedef void Queue_FreeProc(Queue* q, bool free_values);
-typedef struct InsSortNode InsSortNode;
struct InsSortNode {
void* item;
int priority;
InsSortNode* next;
};
-typedef struct BinaryHeapNode BinaryHeapNode;
struct BinaryHeapNode {
void* item;
int priority;
@@ -99,7 +97,6 @@
/*
* Hash
*/
-typedef struct HashNode HashNode;
struct HashNode {
uint key1;
uint key2;
@@ -111,7 +108,7 @@
* the resulting range is clearly defined.
*/
typedef uint Hash_HashProc(uint key1, uint key2);
-typedef struct Hash {
+struct Hash {
/* The hash function used */
Hash_HashProc* hash;
/* The amount of items in the hash */
@@ -123,7 +120,7 @@
/* A pointer to an array of numbuckets booleans, which will be true if
* there are any Nodes in the bucket */
bool* buckets_in_use;
-} Hash;
+};
/* Call these function to manipulate a hash */
--- a/src/rail.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/rail.h Sun Mar 11 16:31:18 2007 +0000
@@ -9,7 +9,7 @@
#include "direction.h"
#include "tile.h"
-typedef enum RailTypes {
+enum RailType {
RAILTYPE_BEGIN = 0,
RAILTYPE_RAIL = 0,
RAILTYPE_ELECTRIC = 1,
@@ -17,7 +17,7 @@
RAILTYPE_MAGLEV = 3,
RAILTYPE_END,
INVALID_RAILTYPE = 0xFF
-} RailType;
+};
typedef byte RailTypeMask;
@@ -30,7 +30,7 @@
/** These are used to specify a single track.
* Can be translated to a trackbit with TrackToTrackbit */
-typedef enum Track {
+enum Track {
TRACK_BEGIN = 0,
TRACK_X = 0,
TRACK_Y = 1,
@@ -40,7 +40,7 @@
TRACK_RIGHT = 5,
TRACK_END,
INVALID_TRACK = 0xFF
-} Track;
+};
/** Allow incrementing of Track variables */
DECLARE_POSTFIX_INCREMENT(Track);
@@ -61,7 +61,7 @@
/** Bitfield corresponding to Track */
-typedef enum TrackBits {
+enum TrackBits {
TRACK_BIT_NONE = 0U,
TRACK_BIT_X = 1U << TRACK_X,
TRACK_BIT_Y = 1U << TRACK_Y,
@@ -81,7 +81,7 @@
TRACK_BIT_WORMHOLE = 0x40U,
TRACK_BIT_DEPOT = 0x80U,
INVALID_TRACK_BIT = 0xFF
-} TrackBits;
+};
/** Define basic enum properties */
template <> struct EnumPropsT<TrackBits> : MakeEnumPropsT<TrackBits, byte, TRACK_BIT_NONE, TRACK_BIT_ALL, INVALID_TRACK_BIT> {};
@@ -110,7 +110,7 @@
* reversing track dirs are not considered to be 'valid' except in a small
* corner in the road vehicle controller.
*/
-typedef enum Trackdirs {
+enum Trackdir {
TRACKDIR_BEGIN = 0,
TRACKDIR_X_NE = 0,
TRACKDIR_Y_SE = 1,
@@ -130,7 +130,7 @@
TRACKDIR_RVREV_NW = 15,
TRACKDIR_END,
INVALID_TRACKDIR = 0xFF,
-} Trackdir;
+};
/** Define basic enum properties */
template <> struct EnumPropsT<Trackdir> : MakeEnumPropsT<Trackdir, byte, TRACKDIR_BEGIN, TRACKDIR_END, INVALID_TRACKDIR> {};
@@ -138,7 +138,7 @@
/** These are a combination of tracks and directions. Values are 0-5 in one
* direction (corresponding to the Track enum) and 8-13 in the other direction. */
-typedef enum TrackdirBits {
+enum TrackdirBits {
TRACKDIR_BIT_NONE = 0x0000,
TRACKDIR_BIT_X_NE = 0x0001,
TRACKDIR_BIT_Y_SE = 0x0002,
@@ -155,7 +155,7 @@
TRACKDIR_BIT_RIGHT_N = 0x2000,
TRACKDIR_BIT_MASK = 0x3F3F,
INVALID_TRACKDIR_BIT = 0xFFFF,
-} TrackdirBits;
+};
/** Define basic enum properties */
template <> struct EnumPropsT<TrackdirBits> : MakeEnumPropsT<TrackdirBits, uint16, TRACKDIR_BIT_NONE, TRACKDIR_BIT_MASK, INVALID_TRACKDIR_BIT> {};
@@ -164,7 +164,7 @@
/** This struct contains all the info that is needed to draw and construct tracks.
*/
-typedef struct RailtypeInfo {
+struct RailtypeInfo {
/** Struct containing the main sprites. @note not all sprites are listed, but only
* the ones used directly in the code */
struct {
@@ -237,7 +237,7 @@
* Offset to add to ground sprite when drawing custom waypoints / stations
*/
byte custom_ground_offset;
-} RailtypeInfo;
+};
// these are the maximums used for updating signal blocks, and checking if a depot is in a pbs block
--- a/src/rail_cmd.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/rail_cmd.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -879,7 +879,7 @@
/* update power of trains in this depot */
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Train && IsFrontEngine(v) && v->tile == tile && v->u.rail.track == 0x80) {
+ if (v->type == VEH_TRAIN && IsFrontEngine(v) && v->tile == tile && v->u.rail.track == 0x80) {
TrainPowerChanged(v);
}
}
@@ -1417,7 +1417,7 @@
DrawTileSequence(x, y, dts->ground_sprite + offset, dts->seq, 0);
}
-typedef struct SetSignalsData {
+struct SetSignalsData {
int cur;
int cur_stack;
bool stop;
@@ -1435,7 +1435,7 @@
TileIndex next_tile[NUM_SSD_STACK];
DiagDirectionByte next_dir[NUM_SSD_STACK];
-} SetSignalsData;
+};
static bool SetSignalsEnumProc(TileIndex tile, void* data, Trackdir trackdir, uint length, byte* state)
{
@@ -1473,16 +1473,16 @@
}
/* Struct to parse data from VehicleFromPos to SignalVehicleCheckProc */
-typedef struct SignalVehicleCheckStruct {
+struct SignalVehicleCheckStruct {
TileIndex tile;
uint track;
-} SignalVehicleCheckStruct;
+};
static void *SignalVehicleCheckProc(Vehicle *v, void *data)
{
const SignalVehicleCheckStruct* dest = (SignalVehicleCheckStruct*)data;
- if (v->type != VEH_Train) return NULL;
+ if (v->type != VEH_TRAIN) return NULL;
/* Wrong tile, or no train? Not a match */
if (v->tile != dest->tile) return NULL;
@@ -1888,7 +1888,7 @@
static void ClickTile_Track(TileIndex tile)
{
switch (GetRailTileType(tile)) {
- case RAIL_TILE_DEPOT: ShowDepotWindow(tile, VEH_Train); break;
+ case RAIL_TILE_DEPOT: ShowDepotWindow(tile, VEH_TRAIN); break;
case RAIL_TILE_WAYPOINT: ShowRenameWaypointWindow(GetWaypointByTile(tile)); break;
default: break;
}
@@ -1951,7 +1951,7 @@
int length;
// this routine applies only to trains in depot tiles
- if (v->type != VEH_Train || !IsTileDepotType(tile, TRANSPORT_RAIL)) return VETSB_CONTINUE;
+ if (v->type != VEH_TRAIN || !IsTileDepotType(tile, TRANSPORT_RAIL)) return VETSB_CONTINUE;
/* depot direction */
dir = GetRailDepotDirection(tile);
--- a/src/rail_gui.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/rail_gui.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -45,9 +45,9 @@
static void HandleStationPlacement(TileIndex start, TileIndex end);
-static void ShowBuildTrainDepotPicker(void);
-static void ShowBuildWaypointPicker(void);
-static void ShowStationBuilder(void);
+static void ShowBuildTrainDepotPicker();
+static void ShowBuildWaypointPicker();
+static void ShowStationBuilder();
void CcPlaySound1E(bool success, TileIndex tile, uint32 p1, uint32 p2)
{
@@ -348,7 +348,7 @@
);
}
-static void HandleAutodirPlacement(void)
+static void HandleAutodirPlacement()
{
TileHighlightData *thd = &_thd;
int trackstat = thd->drawstyle & 0xF; // 0..5
@@ -361,7 +361,7 @@
DoRailroadTrack(trackstat);
}
-static void HandleAutoSignalPlacement(void)
+static void HandleAutoSignalPlacement()
{
TileHighlightData *thd = &_thd;
uint32 p2 = GB(thd->drawstyle, 0, 3); // 0..5
@@ -1012,7 +1012,7 @@
StationBuildWndProc
};
-static void ShowStationBuilder(void)
+static void ShowStationBuilder()
{
BaseWindow *w;
if (GetNumStationClasses() <= 2 && GetNumCustomStations(STAT_CLASS_DFLT) == 1) {
@@ -1091,7 +1091,7 @@
BuildTrainDepotWndProc
};
-static void ShowBuildTrainDepotPicker(void)
+static void ShowBuildTrainDepotPicker()
{
BaseWindow::Allocate(&_build_depot_desc);
}
@@ -1177,7 +1177,7 @@
BuildWaypointWndProc
};
-static void ShowBuildWaypointPicker(void)
+static void ShowBuildWaypointPicker()
{
BaseWindow *w = BaseWindow::Allocate(&_build_waypoint_desc);
w->hscroll.cap = 5;
@@ -1185,7 +1185,7 @@
}
-void InitializeRailGui(void)
+void InitializeRailGui()
{
_build_depot_direction = DIAGDIR_NW;
_railstation.numtracks = 1;
--- a/src/rail_map.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/rail_map.h Sun Mar 11 16:31:18 2007 +0000
@@ -8,12 +8,12 @@
#include "tile.h"
-typedef enum RailTileType {
+enum RailTileType {
RAIL_TILE_NORMAL = 0,
RAIL_TILE_SIGNALS = 1,
RAIL_TILE_WAYPOINT = 2,
RAIL_TILE_DEPOT = 3,
-} RailTileType;
+};
static inline RailTileType GetRailTileType(TileIndex t)
{
@@ -118,12 +118,12 @@
return (WaypointID)_m[t].m2;
}
-typedef enum SignalType {
+enum SignalType {
SIGTYPE_NORMAL = 0, // normal signal
SIGTYPE_ENTRY = 1, // presignal block entry
SIGTYPE_EXIT = 2, // presignal block exit
SIGTYPE_COMBO = 3 // presignal inter-block
-} SignalType;
+};
static inline SignalType GetSignalType(TileIndex t)
{
@@ -159,10 +159,10 @@
}
-typedef enum SignalVariant {
+enum SignalVariant {
SIG_ELECTRIC = 0,
SIG_SEMAPHORE = 1
-} SignalVariant;
+};
static inline SignalVariant GetSignalVariant(TileIndex t)
{
@@ -183,10 +183,10 @@
* simple boolean logic will do. But do try to compare to this enum instead of
* normal boolean evaluation, since that will make future additions easier.
*/
-typedef enum SignalStates {
+enum SignalState {
SIGNAL_STATE_RED = 0,
SIGNAL_STATE_GREEN = 1,
-} SignalState;
+};
static inline SignalState GetSingleSignalState(TileIndex t, byte signalbit)
{
@@ -242,7 +242,7 @@
RailType GetTileRailType(TileIndex tile);
-typedef enum RailGroundType {
+enum RailGroundType {
RAIL_GROUND_BARREN = 0,
RAIL_GROUND_GRASS = 1,
RAIL_GROUND_FENCE_NW = 2,
@@ -256,7 +256,7 @@
RAIL_GROUND_FENCE_HORIZ1 = 10,
RAIL_GROUND_FENCE_HORIZ2 = 11,
RAIL_GROUND_ICE_DESERT = 12,
-} RailGroundType;
+};
static inline void SetRailGroundType(TileIndex t, RailGroundType rgt)
{
--- a/src/road.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/road.h Sun Mar 11 16:31:18 2007 +0000
@@ -5,7 +5,7 @@
#include "helpers.hpp"
-typedef enum RoadBits {
+enum RoadBits {
ROAD_NONE = 0U,
ROAD_NW = 1U,
ROAD_SW = 2U,
@@ -14,7 +14,7 @@
ROAD_X = ROAD_SW | ROAD_NE,
ROAD_Y = ROAD_NW | ROAD_SE,
ROAD_ALL = ROAD_X | ROAD_Y
-} RoadBits;
+};
DECLARE_ENUM_AS_BIT_SET(RoadBits);
--- a/src/road_cmd.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/road_cmd.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -70,7 +70,7 @@
// you can remove all kind of roads with extra dynamite
if (_patches.extra_dynamite) return true;
- t = ClosestTownFromTile(tile, _patches.dist_local_authority);
+ t = ClosestTownFromTile(tile, (uint)-1);
SetDParam(0, t->index);
_error_message = STR_2009_LOCAL_AUTHORITY_REFUSES;
@@ -599,11 +599,11 @@
}
-typedef struct DrawRoadTileStruct {
+struct DrawRoadTileStruct {
uint16 image;
byte subcoord_x;
byte subcoord_y;
-} DrawRoadTileStruct;
+};
#include "table/road_land.h"
@@ -935,7 +935,7 @@
static void ClickTile_Road(TileIndex tile)
{
- if (GetRoadTileType(tile) == ROAD_TILE_DEPOT) ShowDepotWindow(tile, VEH_Road);
+ if (GetRoadTileType(tile) == ROAD_TILE_DEPOT) ShowDepotWindow(tile, VEH_ROAD);
}
static const byte _road_trackbits[16] = {
@@ -1001,7 +1001,7 @@
{
switch (GetRoadTileType(tile)) {
case ROAD_TILE_CROSSING:
- if (v->type == VEH_Train && !IsCrossingBarred(tile)) {
+ if (v->type == VEH_TRAIN && !IsCrossingBarred(tile)) {
/* train crossing a road */
SndPlayVehicleFx(SND_0E_LEVEL_CROSSING, v);
BarCrossing(tile);
@@ -1010,7 +1010,7 @@
break;
case ROAD_TILE_DEPOT:
- if (v->type == VEH_Road &&
+ if (v->type == VEH_ROAD &&
v->u.road.frame == 11 &&
_roadveh_enter_depot_unk0[GetRoadDepotDirection(tile)] == v->u.road.state) {
VehicleEnterDepot(v);
--- a/src/road_gui.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/road_gui.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -21,9 +21,9 @@
#include "station.h"
-static void ShowBusStationPicker(void);
-static void ShowTruckStationPicker(void);
-static void ShowRoadDepotPicker(void);
+static void ShowBusStationPicker();
+static void ShowTruckStationPicker();
+static void ShowRoadDepotPicker();
static bool _remove_button_clicked;
@@ -346,7 +346,7 @@
BuildRoadToolbWndProc
};
-void ShowBuildRoadToolbar(void)
+void ShowBuildRoadToolbar()
{
if (!IsValidPlayer(_current_player)) return;
@@ -380,7 +380,7 @@
BuildRoadToolbWndProc
};
-void ShowBuildRoadScenToolbar(void)
+void ShowBuildRoadScenToolbar()
{
BaseWindow::AllocateFront(&_build_road_scen_desc, 0);
}
@@ -440,7 +440,7 @@
BuildRoadDepotWndProc
};
-static void ShowRoadDepotPicker(void)
+static void ShowRoadDepotPicker()
{
BaseWindow::Allocate(&_build_road_depot_desc);
}
@@ -543,7 +543,7 @@
RoadStationPickerWndProc
};
-static void ShowBusStationPicker(void)
+static void ShowBusStationPicker()
{
BaseWindow::Allocate(&_bus_station_picker_desc);
}
@@ -572,12 +572,12 @@
RoadStationPickerWndProc
};
-static void ShowTruckStationPicker(void)
+static void ShowTruckStationPicker()
{
BaseWindow::Allocate(&_truck_station_picker_desc);
}
-void InitializeRoadGui(void)
+void InitializeRoadGui()
{
_road_depot_orientation = DIAGDIR_NW;
_road_station_picker_orientation = DIAGDIR_NW;
--- a/src/road_map.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/road_map.h Sun Mar 11 16:31:18 2007 +0000
@@ -9,11 +9,11 @@
#include "tile.h"
-typedef enum RoadTileType {
+enum RoadTileType {
ROAD_TILE_NORMAL,
ROAD_TILE_CROSSING,
ROAD_TILE_DEPOT
-} RoadTileType;
+};
static inline RoadTileType GetRoadTileType(TileIndex t)
{
@@ -105,7 +105,7 @@
}
-typedef enum Roadside {
+enum Roadside {
ROADSIDE_BARREN = 0,
ROADSIDE_GRASS = 1,
ROADSIDE_PAVED = 2,
@@ -113,7 +113,7 @@
ROADSIDE_TREES = 5,
ROADSIDE_GRASS_ROAD_WORKS = 6,
ROADSIDE_PAVED_ROAD_WORKS = 7
-} Roadside;
+};
static inline Roadside GetRoadside(TileIndex tile)
{
--- a/src/roadveh.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/roadveh.h Sun Mar 11 16:31:18 2007 +0000
@@ -8,7 +8,7 @@
static inline bool IsRoadVehInDepot(const Vehicle* v)
{
- assert(v->type == VEH_Road);
+ assert(v->type == VEH_ROAD);
return v->u.road.state == 254;
}
--- a/src/roadveh_cmd.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/roadveh_cmd.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -128,7 +128,7 @@
UnitID unit_num;
Engine *e;
- if (!IsEngineBuildable(p1, VEH_Road, _current_player)) return_cmd_error(STR_ENGINE_NOT_BUILDABLE);
+ if (!IsEngineBuildable(p1, VEH_ROAD, _current_player)) return_cmd_error(STR_ENGINE_NOT_BUILDABLE);
SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
@@ -144,7 +144,7 @@
if (v == NULL) return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
/* find the first free roadveh id */
- unit_num = HASBIT(p2, 0) ? 0 : GetFreeUnitNumber(VEH_Road);
+ unit_num = HASBIT(p2, 0) ? 0 : GetFreeUnitNumber(VEH_ROAD);
if (unit_num > _patches.max_roadveh)
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
@@ -200,7 +200,7 @@
v->date_of_last_service = _date;
v->build_year = _cur_year;
- v->type = VEH_Road;
+ v->type = VEH_ROAD;
v->cur_image = 0xC15;
v->random_bits = VehicleRandomBits();
@@ -213,7 +213,7 @@
RebuildVehicleLists();
InvalidateWindow(WC_COMPANY, v->owner);
if (IsLocalPlayer())
- InvalidateAutoreplaceWindow(VEH_Road); // updates the replace Road window
+ InvalidateAutoreplaceWindow(VEH_ROAD); // updates the replace Road window
GetPlayer(_current_player)->num_engines[p1]++;
}
@@ -235,7 +235,7 @@
v = GetVehicle(p1);
- if (v->type != VEH_Road || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_ROAD || !CheckOwnership(v->owner)) return CMD_ERROR;
/* Check if this road veh can be started/stopped. The callback will fail or
* return 0xFF if it can. */
@@ -285,7 +285,7 @@
v = GetVehicle(p1);
- if (v->type != VEH_Road || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_ROAD || !CheckOwnership(v->owner)) return CMD_ERROR;
SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
@@ -306,11 +306,11 @@
return -(int32)v->value;
}
-typedef struct RoadFindDepotData {
+struct RoadFindDepotData {
uint best_length;
TileIndex tile;
OwnerByte owner;
-} RoadFindDepotData;
+};
static const DiagDirection _road_pf_directions[] = {
DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_NE, DIAGDIR_SE, DIAGDIR_SW, DIAGDIR_SE, INVALID_DIAGDIR, INVALID_DIAGDIR,
@@ -384,14 +384,14 @@
if (p2 & DEPOT_MASS_SEND) {
/* Mass goto depot requested */
if (!ValidVLWFlags(p2 & VLW_MASK)) return CMD_ERROR;
- return SendAllVehiclesToDepot(VEH_Road, flags, p2 & DEPOT_SERVICE, _current_player, (p2 & VLW_MASK), p1);
+ return SendAllVehiclesToDepot(VEH_ROAD, flags, p2 & DEPOT_SERVICE, _current_player, (p2 & VLW_MASK), p1);
}
if (!IsValidVehicleID(p1)) return CMD_ERROR;
v = GetVehicle(p1);
- if (v->type != VEH_Road || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_ROAD || !CheckOwnership(v->owner)) return CMD_ERROR;
if (v->vehstatus & VS_CRASHED) return CMD_ERROR;
@@ -454,7 +454,7 @@
v = GetVehicle(p1);
- if (v->type != VEH_Road || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_ROAD || !CheckOwnership(v->owner)) return CMD_ERROR;
if (v->vehstatus & VS_STOPPED ||
v->u.road.crashed_ctr != 0 ||
@@ -577,7 +577,7 @@
const Vehicle* u = (Vehicle*)data;
return
- v->type == VEH_Train &&
+ v->type == VEH_TRAIN &&
myabs(v->z_pos - u->z_pos) <= 6 &&
myabs(v->x_pos - u->x_pos) <= 4 &&
myabs(v->y_pos - u->y_pos) <= 4 ?
@@ -682,8 +682,7 @@
order = GetVehicleOrder(v, v->cur_order_index);
if (order == NULL) {
- v->current_order.type = OT_NOTHING;
- v->current_order.flags = 0;
+ v->current_order.Free();
v->dest_tile = 0;
ClearSlot(v);
return;
@@ -785,12 +784,12 @@
}
}
-typedef struct RoadVehFindData {
+struct RoadVehFindData {
int x;
int y;
const Vehicle* veh;
Direction dir;
-} RoadVehFindData;
+};
static void* EnumCheckRoadVehClose(Vehicle *v, void* data)
{
@@ -804,7 +803,7 @@
return
rvf->veh != v &&
- v->type == VEH_Road &&
+ v->type == VEH_ROAD &&
!IsRoadVehInDepot(v) &&
myabs(v->z_pos - rvf->veh->z_pos) < 6 &&
v->direction == rvf->dir &&
@@ -933,19 +932,19 @@
return ChangeDir(old_dir, delta);
}
-typedef struct OvertakeData {
+struct OvertakeData {
const Vehicle* u;
const Vehicle* v;
TileIndex tile;
byte tilebits;
-} OvertakeData;
+};
static void* EnumFindVehToOvertake(Vehicle* v, void* data)
{
const OvertakeData* od = (OvertakeData*)data;
return
- v->tile == od->tile && v->type == VEH_Road && v != od->u && v != od->v ?
+ v->tile == od->tile && v->type == VEH_ROAD && v != od->u && v != od->v ?
v : NULL;
}
@@ -1030,11 +1029,11 @@
return i;
}
-typedef struct {
+struct FindRoadToChooseData {
TileIndex dest;
uint maxtracklen;
uint mindist;
-} FindRoadToChooseData;
+};
static bool EnumRoadTrackFindDist(TileIndex tile, void* data, Trackdir trackdir, uint length, byte* state)
{
@@ -1256,9 +1255,9 @@
RVC_DRIVE_THROUGH_STOP_FRAME = 7
};
-typedef struct RoadDriveEntry {
- byte x,y;
-} RoadDriveEntry;
+struct RoadDriveEntry {
+ byte x, y;
+};
#include "table/roadveh.h"
@@ -1618,8 +1617,7 @@
v->cur_speed = 0;
return;
}
- v->current_order.type = OT_NOTHING;
- v->current_order.flags = 0;
+ v->current_order.Free();
ClearSlot(v);
}
@@ -1824,12 +1822,12 @@
}
-void RoadVehiclesYearlyLoop(void)
+void RoadVehiclesYearlyLoop()
{
Vehicle *v;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Road) {
+ if (v->type == VEH_ROAD) {
v->profit_last_year = v->profit_this_year;
v->profit_this_year = 0;
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
@@ -1856,7 +1854,7 @@
v = GetVehicle(p1);
- if (v->type != VEH_Road || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_ROAD || !CheckOwnership(v->owner)) return CMD_ERROR;
if (!IsRoadVehInDepotStopped(v)) return_cmd_error(STR_9013_MUST_BE_STOPPED_INSIDE);
if (new_cid > NUM_CARGO || !CanRefitTo(v->engine_type, new_cid)) return CMD_ERROR;
--- a/src/saveload.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/saveload.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -28,12 +28,12 @@
#include "variables.h"
#include <setjmp.h>
-extern const uint16 SAVEGAME_VERSION = 51;
+extern const uint16 SAVEGAME_VERSION = 52;
uint16 _sl_version; ///< the major savegame version identifier
byte _sl_minor_version; ///< the minor savegame version, DO NOT USE!
typedef void WriterProc(uint len);
-typedef uint ReaderProc(void);
+typedef uint ReaderProc();
/** The saveload struct, containing reader-writer functions, bufffer, version, etc. */
static struct {
@@ -63,7 +63,7 @@
uint bufsize; ///< the size of the temporary memory *buf
FILE *fh; ///< the file from which is read or written to
- void (*excpt_uninit)(void); ///< the function to execute on any encountered error
+ void (*excpt_uninit)(); ///< the function to execute on any encountered error
const char *excpt_msg; ///< the error message
jmp_buf excpt; ///< @todo used to jump to "exception handler"; really ugly
} _sl;
@@ -74,7 +74,7 @@
/**
* Fill the input buffer by reading from the file with the given reader
*/
-static void SlReadFill(void)
+static void SlReadFill()
{
uint len = _sl.read_bytes();
assert(len != 0);
@@ -84,7 +84,7 @@
_sl.offs_base += len;
}
-static inline uint32 SlGetOffs(void) {return _sl.offs_base - (_sl.bufe - _sl.bufp);}
+static inline uint32 SlGetOffs() {return _sl.offs_base - (_sl.bufe - _sl.bufp);}
/** Return the size in bytes of a certain type of normal/atomic variable
* as it appears in memory. See VarTypes
@@ -111,13 +111,13 @@
}
/** Return the size in bytes of a reference (pointer) */
-static inline size_t SlCalcRefLen(void) {return 2;}
+static inline size_t SlCalcRefLen() {return 2;}
/** Flush the output buffer by writing to disk with the given reader.
* If the buffer pointer has not yet been set up, set it up now. Usually
* only called when the buffer is full, or there is no more data to be processed
*/
-static void SlWriteFill(void)
+static void SlWriteFill()
{
/* flush the buffer to disk (the writer) */
if (_sl.bufp != NULL) {
@@ -145,14 +145,14 @@
* flush it to its final destination
* @return return the read byte from file
*/
-static inline byte SlReadByteInternal(void)
+static inline byte SlReadByteInternal()
{
if (_sl.bufp == _sl.bufe) SlReadFill();
return *_sl.bufp++;
}
/** Wrapper for SlReadByteInternal */
-byte SlReadByte(void) {return SlReadByteInternal();}
+byte SlReadByte() {return SlReadByteInternal();}
/** Write away a single byte from memory. If the temporary buffer is full,
* flush it to its destination (file)
@@ -167,19 +167,19 @@
/** Wrapper for SlWriteByteInternal */
void SlWriteByte(byte b) {SlWriteByteInternal(b);}
-static inline int SlReadUint16(void)
+static inline int SlReadUint16()
{
int x = SlReadByte() << 8;
return x | SlReadByte();
}
-static inline uint32 SlReadUint32(void)
+static inline uint32 SlReadUint32()
{
uint32 x = SlReadUint16() << 16;
return x | SlReadUint16();
}
-static inline uint64 SlReadUint64(void)
+static inline uint64 SlReadUint64()
{
uint32 x = SlReadUint32();
uint32 y = SlReadUint32();
@@ -213,7 +213,7 @@
* x = ((x & 0x7F) << 8) + SlReadByte();
* @return Return the value of the index
*/
-static uint SlReadSimpleGamma(void)
+static uint SlReadSimpleGamma()
{
uint i = SlReadByte();
if (HASBIT(i, 7)) {
@@ -269,10 +269,10 @@
return 1 + (i >= (1 << 7)) + (i >= (1 << 14)) + (i >= (1 << 21));
}
-static inline uint SlReadSparseIndex(void) {return SlReadSimpleGamma();}
+static inline uint SlReadSparseIndex() {return SlReadSimpleGamma();}
static inline void SlWriteSparseIndex(uint index) {SlWriteSimpleGamma(index);}
-static inline uint SlReadArrayLength(void) {return SlReadSimpleGamma();}
+static inline uint SlReadArrayLength() {return SlReadSimpleGamma();}
static inline void SlWriteArrayLength(uint length) {SlWriteSimpleGamma(length);}
static inline uint SlGetArrayLength(uint length) {return SlGetGammaLength(length);}
@@ -286,7 +286,7 @@
* Iterate through the elements of an array and read the whole thing
* @return The index of the object, or -1 if we have reached the end of current block
*/
-int SlIterateArray(void)
+int SlIterateArray()
{
int index;
static uint32 next_offs;
@@ -382,7 +382,7 @@
}
/* Get the length of the current object */
-uint SlGetFieldLength(void) {return _sl.obj_len;}
+uint SlGetFieldLength() {return _sl.obj_len;}
/** Return a signed-long version of the value of a setting
* @param ptr pointer to the variable
@@ -850,7 +850,7 @@
/* Stub Chunk handlers to only calculate length and do nothing else */
static ChunkSaveLoadProc *_tmp_proc_1;
static inline void SlStubSaveProc2(void *arg) {_tmp_proc_1();}
-static void SlStubSaveProc(void) {SlAutolength(SlStubSaveProc2, NULL);}
+static void SlStubSaveProc() {SlAutolength(SlStubSaveProc2, NULL);}
/** Save a chunk of data (eg. vehicles, stations, etc.). Each chunk is
* prefixed by an ID identifying it, followed by data, and terminator where appropiate
@@ -891,7 +891,7 @@
}
/** Save all chunks */
-static void SlSaveChunks(void)
+static void SlSaveChunks()
{
const ChunkHandler *ch;
const ChunkHandler* const *chsc;
@@ -933,7 +933,7 @@
}
/** Load all chunks */
-static void SlLoadChunks(void)
+static void SlLoadChunks()
{
uint32 id;
const ChunkHandler *ch;
@@ -954,7 +954,7 @@
#include "minilzo.h"
-static uint ReadLZO(void)
+static uint ReadLZO()
{
byte out[LZO_SIZE + LZO_SIZE / 64 + 16 + 3 + 8];
uint32 tmp[2];
@@ -999,14 +999,14 @@
if (fwrite(out, outlen + sizeof(uint32)*2, 1, _sl.fh) != 1) SlError("file write failed");
}
-static bool InitLZO(void)
+static bool InitLZO()
{
_sl.bufsize = LZO_SIZE;
_sl.buf = _sl.buf_ori = (byte*)malloc(LZO_SIZE);
return true;
}
-static void UninitLZO(void)
+static void UninitLZO()
{
free(_sl.buf_ori);
}
@@ -1014,7 +1014,7 @@
/*********************************************
******** START OF NOCOMP CODE (uncompressed)*
*********************************************/
-static uint ReadNoComp(void)
+static uint ReadNoComp()
{
return fread(_sl.buf, 1, LZO_SIZE, _sl.fh);
}
@@ -1024,14 +1024,14 @@
fwrite(_sl.buf, 1, size, _sl.fh);
}
-static bool InitNoComp(void)
+static bool InitNoComp()
{
_sl.bufsize = LZO_SIZE;
_sl.buf = _sl.buf_ori =(byte*)malloc(LZO_SIZE);
return true;
}
-static void UninitNoComp(void)
+static void UninitNoComp()
{
free(_sl.buf_ori);
}
@@ -1045,18 +1045,18 @@
#include "gfx.h"
#include "gui.h"
-typedef struct ThreadedSave {
+struct ThreadedSave {
uint count;
byte ff_state;
bool saveinprogress;
CursorID cursor;
-} ThreadedSave;
+};
/* A maximum size of of 128K * 500 = 64.000KB savegames */
STATIC_OLD_POOL(Savegame, byte, 17, 500, NULL, NULL)
static ThreadedSave _ts;
-static bool InitMem(void)
+static bool InitMem()
{
_ts.count = 0;
@@ -1069,7 +1069,7 @@
return true;
}
-static void UnInitMem(void)
+static void UnInitMem()
{
CleanPool(&_Savegame_pool);
}
@@ -1091,7 +1091,7 @@
static z_stream _z;
-static bool InitReadZlib(void)
+static bool InitReadZlib()
{
memset(&_z, 0, sizeof(_z));
if (inflateInit(&_z) != Z_OK) return false;
@@ -1101,7 +1101,7 @@
return true;
}
-static uint ReadZlib(void)
+static uint ReadZlib()
{
int r;
@@ -1126,13 +1126,13 @@
return 4096 - _z.avail_out;
}
-static void UninitReadZlib(void)
+static void UninitReadZlib()
{
inflateEnd(&_z);
free(_sl.buf_ori);
}
-static bool InitWriteZlib(void)
+static bool InitWriteZlib()
{
memset(&_z, 0, sizeof(_z));
if (deflateInit(&_z, 6) != Z_OK) return false;
@@ -1168,7 +1168,7 @@
WriteZlibLoop(&_z, _sl.buf, len, 0);
}
-static void UninitWriteZlib(void)
+static void UninitWriteZlib()
{
/* flush any pending output. */
if (_sl.fh) WriteZlibLoop(&_z, NULL, 0, Z_FINISH);
@@ -1326,18 +1326,18 @@
}
/** The format for a reader/writer type of a savegame */
-typedef struct {
+struct SaveLoadFormat {
const char *name; ///< name of the compressor/decompressor (debug-only)
uint32 tag; ///< the 4-letter tag by which it is identified in the savegame
- bool (*init_read)(void); ///< function executed upon initalization of the loader
+ bool (*init_read)(); ///< function executed upon initalization of the loader
ReaderProc *reader; ///< function that loads the data from the file
- void (*uninit_read)(void); ///< function executed when reading is finished
+ void (*uninit_read)(); ///< function executed when reading is finished
- bool (*init_write)(void); ///< function executed upon intialization of the saver
+ bool (*init_write)(); ///< function executed upon intialization of the saver
WriterProc *writer; ///< function that saves the data to the file
- void (*uninit_write)(void); ///< function executed when writing is done
-} SaveLoadFormat;
+ void (*uninit_write)(); ///< function executed when writing is done
+};
static const SaveLoadFormat _saveload_formats[] = {
{"memory", 0, NULL, NULL, NULL, InitMem, WriteMem, UnInitMem},
@@ -1377,12 +1377,12 @@
/* actual loader/saver function */
void InitializeGame(int mode, uint size_x, uint size_y);
-extern bool AfterLoadGame(void);
-extern void BeforeSaveGame(void);
+extern bool AfterLoadGame();
+extern void BeforeSaveGame();
extern bool LoadOldSaveGame(const char *file);
/** Small helper function to close the to be loaded savegame an signal error */
-static inline SaveOrLoadResult AbortSaveLoad(void)
+static inline SaveOrLoadResult AbortSaveLoad()
{
if (_sl.fh != NULL) fclose(_sl.fh);
@@ -1393,7 +1393,7 @@
/** Update the gui accordingly when starting saving
* and set locks on saveload. Also turn off fast-forward cause with that
* saving takes Aaaaages */
-void SaveFileStart(void)
+void SaveFileStart()
{
_ts.ff_state = _fast_forward;
_fast_forward = 0;
@@ -1405,7 +1405,7 @@
/** Update the gui accordingly when saving is done and release locks
* on saveload */
-void SaveFileDone(void)
+void SaveFileDone()
{
_fast_forward = _ts.ff_state;
if (_cursor.sprite == SPR_CURSOR_ZZZ) SetMouseCursor(SPR_CURSOR_MOUSE, PAL_NONE);
@@ -1415,7 +1415,7 @@
}
/** Show a gui message when saving has failed */
-void SaveFileError(void)
+void SaveFileError()
{
ShowErrorMessage(STR_4007_GAME_SAVE_FAILED, STR_NULL, 0, 0);
SaveFileDone();
@@ -1487,7 +1487,7 @@
return NULL;
}
-void WaitTillSaved(void)
+void WaitTillSaved()
{
OTTDJoinThread(save_thread);
save_thread = NULL;
@@ -1658,7 +1658,7 @@
}
/** Do a save when exiting the game (patch option) _patches.autosave_on_exit */
-void DoExitSave(void)
+void DoExitSave()
{
char buf[200];
snprintf(buf, sizeof(buf), "%s%sexit.sav", _paths.autosave_dir, PATHSEP);
--- a/src/saveload.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/saveload.h Sun Mar 11 16:31:18 2007 +0000
@@ -9,41 +9,41 @@
#define SIZE_MAX ((size_t)-1)
-typedef enum SaveOrLoadResult {
+enum SaveOrLoadResult {
SL_OK = 0, // completed successfully
SL_ERROR = 1, // error that was caught before internal structures were modified
SL_REINIT = 2, // error that was caught in the middle of updating game state, need to clear it. (can only happen during load)
-} SaveOrLoadResult;
+};
-typedef enum SaveOrLoadMode {
+enum SaveOrLoadMode {
SL_INVALID = -1,
SL_LOAD = 0,
SL_SAVE = 1,
SL_OLD_LOAD = 2,
SL_PNG = 3,
SL_BMP = 4,
-} SaveOrLoadMode;
+};
SaveOrLoadResult SaveOrLoad(const char *filename, int mode);
-void WaitTillSaved(void);
-void DoExitSave(void);
+void WaitTillSaved();
+void DoExitSave();
-typedef void ChunkSaveLoadProc(void);
+typedef void ChunkSaveLoadProc();
typedef void AutolengthProc(void *arg);
-typedef struct {
+struct ChunkHandler {
uint32 id;
ChunkSaveLoadProc *save_proc;
ChunkSaveLoadProc *load_proc;
uint32 flags;
-} ChunkHandler;
+};
-typedef struct {
+struct NullStruct {
byte null;
-} NullStruct;
+};
-typedef enum SLRefType {
+enum SLRefType {
REF_ORDER = 0,
REF_VEHICLE = 1,
REF_STATION = 2,
@@ -51,7 +51,7 @@
REF_VEHICLE_OLD = 4,
REF_ROADSTOPS = 5,
REF_ENGINE_RENEWS = 6,
-} SLRefType;
+};
#define SL_MAX_VERSION 255
@@ -166,7 +166,7 @@
typedef byte SaveLoadType;
/** SaveLoad type struct. Do NOT use this directly but use the SLE_ macros defined just below! */
-typedef struct SaveLoad {
+struct SaveLoad {
SaveLoadType cmd; ///< the action to take with the saved/loaded type, All types need different action
VarType conv; ///< type of the variable to be saved, int
uint16 length; ///< (conditional) length of the variable (eg. arrays) (max array size is 65536 elements)
@@ -177,7 +177,7 @@
* during runtime. Decision on which one to use is controlled by the function
* that is called to save it. address: SlGlobList, offset: SlObject */
void *address; ///< address of variable OR offset of variable in the struct (max offset is 65536)
-} SaveLoad;
+};
/* Same as SaveLoad but global variables are used (for better readability); */
typedef SaveLoad SaveLoadGlobVarList;
@@ -290,14 +290,14 @@
void WriteValue(void *ptr, VarType conv, int64 val);
void SlSetArrayIndex(uint index);
-int SlIterateArray(void);
+int SlIterateArray();
void SlAutolength(AutolengthProc *proc, void *arg);
-uint SlGetFieldLength(void);
+uint SlGetFieldLength();
void SlSetLength(size_t length);
size_t SlCalcObjMemberLength(const void *object, const SaveLoad *sld);
-byte SlReadByte(void);
+byte SlReadByte();
void SlWriteByte(byte b);
void SlGlobList(const SaveLoadGlobVarList *sldg);
@@ -305,7 +305,7 @@
void SlObject(void *object, const SaveLoad *sld);
bool SlObjectMember(void *object, const SaveLoad *sld);
-void SaveFileStart(void);
-void SaveFileDone(void);
-void SaveFileError(void);
+void SaveFileStart();
+void SaveFileDone();
+void SaveFileError();
#endif /* SAVELOAD_H */
--- a/src/screenshot.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/screenshot.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -24,11 +24,11 @@
typedef void ScreenshotCallback(void *userdata, Pixel *buf, uint y, uint pitch, uint n);
typedef bool ScreenshotHandlerProc(const char *name, ScreenshotCallback *callb, void *userdata, uint w, uint h, int pixelformat, const Colour *palette);
-typedef struct {
+struct ScreenshotFormat {
const char *name;
const char *extension;
ScreenshotHandlerProc *proc;
-} ScreenshotFormat;
+};
//************************************************
//*** SCREENSHOT CODE FOR WINDOWS BITMAP (.BMP)
@@ -37,29 +37,29 @@
#pragma pack(push, 1)
#endif
-typedef struct BitmapFileHeader {
+struct BitmapFileHeader {
uint16 type;
uint32 size;
uint32 reserved;
uint32 off_bits;
-} GCC_PACK BitmapFileHeader;
+} GCC_PACK;
assert_compile(sizeof(BitmapFileHeader) == 14);
#if defined(_MSC_VER) || defined(__WATCOMC__)
#pragma pack(pop)
#endif
-typedef struct BitmapInfoHeader {
+struct BitmapInfoHeader {
uint32 size;
int32 width, height;
uint16 planes, bitcount;
uint32 compression, sizeimage, xpels, ypels, clrused, clrimp;
-} BitmapInfoHeader;
+};
assert_compile(sizeof(BitmapInfoHeader) == 40);
-typedef struct RgbQuad {
+struct RgbQuad {
byte blue, green, red, reserved;
-} RgbQuad;
+};
assert_compile(sizeof(RgbQuad) == 4);
// generic .BMP writer
@@ -260,7 +260,7 @@
//*** SCREENSHOT CODE FOR ZSOFT PAINTBRUSH (.PCX)
//************************************************
-typedef struct {
+struct PcxHeader {
byte manufacturer;
byte version;
byte rle;
@@ -276,7 +276,7 @@
uint16 width;
uint16 height;
byte filler[54];
-} PcxHeader;
+};
assert_compile(sizeof(PcxHeader) == 128);
static bool MakePCXImage(const char *name, ScreenshotCallback *callb, void *userdata, uint w, uint h, int pixelformat, const Colour *palette)
@@ -421,7 +421,7 @@
{"PCX", "pcx", &MakePCXImage},
};
-void InitializeScreenshotFormats(void)
+void InitializeScreenshotFormats()
{
int i, j;
for (i = 0, j = 0; i != lengthof(_screenshot_formats); i++)
@@ -524,18 +524,18 @@
current_screenshot_type = t;
}
-bool IsScreenshotRequested(void)
+bool IsScreenshotRequested()
{
return (current_screenshot_type != SC_NONE);
}
-static bool MakeSmallScreenshot(void)
+static bool MakeSmallScreenshot()
{
const ScreenshotFormat *sf = _screenshot_formats + _cur_screenshot_format;
return sf->proc(MakeScreenshotName(sf->extension), CurrentScreenCallback, NULL, _screen.width, _screen.height, 8, _cur_palette);
}
-static bool MakeWorldScreenshot(void)
+static bool MakeWorldScreenshot()
{
ViewPort vp;
const ScreenshotFormat *sf;
@@ -554,7 +554,7 @@
return sf->proc(MakeScreenshotName(sf->extension), LargeWorldCallback, &vp, vp.width, vp.height, 8, _cur_palette);
}
-bool MakeScreenshot(void)
+bool MakeScreenshot()
{
switch (current_screenshot_type) {
case SC_VIEWPORT:
--- a/src/screenshot.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/screenshot.h Sun Mar 11 16:31:18 2007 +0000
@@ -3,20 +3,20 @@
#ifndef SCREENSHOT_H
#define SCREENSHOT_H
-void InitializeScreenshotFormats(void);
+void InitializeScreenshotFormats();
const char *GetScreenshotFormatDesc(int i);
void SetScreenshotFormat(int i);
-typedef enum ScreenshotType {
+enum ScreenshotType {
SC_NONE,
SC_VIEWPORT,
SC_WORLD
-} ScreenshotType;
+};
-bool MakeScreenshot(void);
+bool MakeScreenshot();
void SetScreenshotType(ScreenshotType t);
-bool IsScreenshotRequested(void);
+bool IsScreenshotRequested();
extern char _screenshot_format_name[8];
extern uint _num_screenshot_formats;
--- a/src/sdl.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/sdl.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -65,7 +65,7 @@
SDLProcs sdl_proc;
-static const char *LoadSdlDLL(void)
+static const char *LoadSdlDLL()
{
if (sdl_proc.SDL_Init != NULL)
return NULL;
--- a/src/sdl.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/sdl.h Sun Mar 11 16:31:18 2007 +0000
@@ -13,10 +13,10 @@
#ifdef DYNAMICALLY_LOADED_SDL
#include <SDL.h>
- typedef struct SDLProcs {
+ struct SDLProcs {
int (SDLCALL *SDL_Init)(Uint32);
int (SDLCALL *SDL_InitSubSystem)(Uint32);
- char *(SDLCALL *SDL_GetError)(void);
+ char *(SDLCALL *SDL_GetError)();
void (SDLCALL *SDL_QuitSubSystem)(Uint32);
void (SDLCALL *SDL_UpdateRect)(SDL_Surface *, Sint32, Sint32, Uint32, Uint32);
void (SDLCALL *SDL_UpdateRects)(SDL_Surface *, int, SDL_Rect *);
@@ -26,15 +26,15 @@
void (SDLCALL *SDL_FreeSurface)(SDL_Surface *);
int (SDLCALL *SDL_PollEvent)(SDL_Event *);
void (SDLCALL *SDL_WarpMouse)(Uint16, Uint16);
- uint32 (SDLCALL *SDL_GetTicks)(void);
+ uint32 (SDLCALL *SDL_GetTicks)();
int (SDLCALL *SDL_OpenAudio)(SDL_AudioSpec *, SDL_AudioSpec*);
void (SDLCALL *SDL_PauseAudio)(int);
- void (SDLCALL *SDL_CloseAudio)(void);
+ void (SDLCALL *SDL_CloseAudio)();
int (SDLCALL *SDL_LockSurface)(SDL_Surface*);
void (SDLCALL *SDL_UnlockSurface)(SDL_Surface*);
- SDLMod (SDLCALL *SDL_GetModState)(void);
+ SDLMod (SDLCALL *SDL_GetModState)();
void (SDLCALL *SDL_Delay)(Uint32);
- void (SDLCALL *SDL_Quit)(void);
+ void (SDLCALL *SDL_Quit)();
SDL_Surface *(SDLCALL *SDL_SetVideoMode)(int, int, int, Uint32);
int (SDLCALL *SDL_EnableKeyRepeat)(int, int);
void (SDLCALL *SDL_EnableUNICODE)(int);
@@ -46,7 +46,7 @@
int (SDLCALL *SDL_SetColorKey)(SDL_Surface *, Uint32, Uint32);
void (SDLCALL *SDL_WM_SetIcon)(SDL_Surface *, Uint8 *);
Uint32 (SDLCALL *SDL_MapRGB)(SDL_PixelFormat *, Uint8, Uint8, Uint8);
- } SDLProcs;
+ };
extern SDLProcs sdl_proc;
--- a/src/settings.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/settings.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -41,6 +41,7 @@
#include "date.h"
#include "rail.h"
#include "helpers.hpp"
+#include "news.h"
#ifdef WITH_FREETYPE
#include "gfx.h"
#include "fontcache.h"
@@ -49,10 +50,10 @@
/** The patch values that are used for new games and/or modified in config file */
Patches _patches_newgame;
-typedef struct IniFile IniFile;
-typedef struct IniItem IniItem;
-typedef struct IniGroup IniGroup;
-typedef struct SettingsMemoryPool SettingsMemoryPool;
+struct IniFile;
+struct IniItem;
+struct IniGroup;
+struct SettingsMemoryPool;
typedef const char *SettingListCallbackProc(const IniItem *item, uint index);
typedef void SettingDescProc(IniFile *ini, const SettingDesc *desc, const char *grpname, void *object);
@@ -153,7 +154,7 @@
};
// allocate an inifile object
-static IniFile *ini_alloc(void)
+static IniFile *ini_alloc()
{
IniFile *ini;
SettingsMemoryPool *pool;
@@ -1183,7 +1184,6 @@
static const SettingDescGlobVarList _misc_settings[] = {
SDTG_MMANY("display_opt", SLE_UINT8, S, 0, _display_opt, (DO_SHOW_TOWN_NAMES|DO_SHOW_STATION_NAMES|DO_SHOW_SIGNS|DO_FULL_ANIMATION|DO_FULL_DETAIL|DO_TRANS_BUILDINGS|DO_WAYPOINTS), "SHOW_TOWN_NAMES|SHOW_STATION_NAMES|SHOW_SIGNS|FULL_ANIMATION|TRANS_BUILDINGS|FULL_DETAIL|WAYPOINTS", STR_NULL, NULL),
- SDTG_VAR("news_display_opt", SLE_UINT, S, 0, _news_display_opt,0xAAAAAAAA,0,0xAAAAAAAA,0,STR_NULL, NULL), // default to all full messages: 10101010101010101010 = 0xAAAAAAAA
SDTG_BOOL("news_ticker_sound", S, 0, _news_ticker_sound, true, STR_NULL, NULL),
SDTG_BOOL("fullscreen", S, 0, _fullscreen, false, STR_NULL, NULL),
SDTG_STR("videodriver", SLE_STRB,C|S,0, _ini_videodriver, NULL, STR_NULL, NULL),
@@ -1502,6 +1502,43 @@
#undef NO
#undef CR
+static uint NewsDisplayLoadConfig(IniFile *ini, const char *grpname)
+{
+ IniGroup *group = ini_getgroup(ini, grpname, -1);
+ IniItem *item;
+ /* By default, set everything to full (0xAAAAAAAA = 1010101010101010) */
+ uint res = 0xAAAAAAAA;
+
+ /* If no group exists, return everything full */
+ if (group == NULL) return res;
+
+ for (item = group->item; item != NULL; item = item->next) {
+ int news_item = -1;
+ for (int i = 0; i < NT_END; i++) {
+ if (strcasecmp(item->name, _news_display_name[i]) == 0) {
+ news_item = i;
+ break;
+ }
+ }
+ if (news_item == -1) {
+ DEBUG(misc, 0, "Invalid display option: %s", item->name);
+ continue;
+ }
+
+ if (strcasecmp(item->value, "full") == 0) {
+ SB(res, news_item * 2, 2, 2);
+ } else if (strcasecmp(item->value, "off") == 0) {
+ SB(res, news_item * 2, 2, 0);
+ } else if (strcasecmp(item->value, "summarized") == 0) {
+ SB(res, news_item * 2, 2, 1);
+ } else {
+ DEBUG(misc, 0, "Invalid display value: %s", item->value);
+ continue;
+ }
+ }
+
+ return res;
+}
/* Load a GRF configuration from the given group name */
static GRFConfig *GRFLoadConfig(IniFile *ini, const char *grpname, bool is_static)
@@ -1530,7 +1567,7 @@
if (!FillGRFDetails(c, is_static)) {
const char *msg;
- if (HASBIT(c->flags, GCF_NOT_FOUND)) {
+ if (c->status == GCS_NOT_FOUND) {
msg = "not found";
} else if (HASBIT(c->flags, GCF_UNSAFE)) {
msg = "unsafe for static use";
@@ -1556,6 +1593,26 @@
return first;
}
+static void NewsDisplaySaveConfig(IniFile *ini, const char *grpname, uint news_display)
+{
+ IniGroup *group = ini_getgroup(ini, grpname, -1);
+ IniItem **item;
+
+ if (group == NULL) return;
+ group->item = NULL;
+ item = &group->item;
+
+ for (int i = 0; i < NT_END; i++) {
+ const char *value;
+ int v = GB(news_display, i * 2, 2);
+
+ value = (v == 0 ? "off" : (v == 1 ? "summarized" : "full"));
+
+ *item = ini_item_alloc(group, _news_display_name[i], strlen(_news_display_name[i]));
+ (*item)->value = (char*)pool_strdup(&ini->pool, value, strlen(value));
+ item = &(*item)->next;
+ }
+}
/* Save a GRF configuration to the given group name */
static void GRFSaveConfig(IniFile *ini, const char *grpname, const GRFConfig *list)
@@ -1599,22 +1656,24 @@
}
/** Load the values from the configuration files */
-void LoadFromConfig(void)
+void LoadFromConfig()
{
IniFile *ini = ini_load(_config_file);
HandleSettingDescs(ini, ini_load_settings, ini_load_setting_list);
_grfconfig_newgame = GRFLoadConfig(ini, "newgrf", false);
_grfconfig_static = GRFLoadConfig(ini, "newgrf-static", true);
+ _news_display_opt = NewsDisplayLoadConfig(ini, "news_display");
ini_free(ini);
}
/** Save the values to the configuration file */
-void SaveToConfig(void)
+void SaveToConfig()
{
IniFile *ini = ini_load(_config_file);
HandleSettingDescs(ini, ini_save_settings, ini_save_setting_list);
GRFSaveConfig(ini, "newgrf", _grfconfig_newgame);
GRFSaveConfig(ini, "newgrf-static", _grfconfig_static);
+ NewsDisplaySaveConfig(ini, "news_display", _news_display_opt);
ini_save(_config_file, ini);
ini_free(ini);
}
@@ -1794,7 +1853,7 @@
SaveSettings((const SettingDesc*)sdg, NULL);
}
-static void Load_OPTS(void)
+static void Load_OPTS()
{
/* Copy over default setting since some might not get loaded in
* a networking environment. This ensures for example that the local
@@ -1803,12 +1862,12 @@
LoadSettings(_gameopt_settings, &_opt);
}
-static void Save_OPTS(void)
+static void Save_OPTS()
{
SaveSettings(_gameopt_settings, &_opt);
}
-static void Load_PATS(void)
+static void Load_PATS()
{
/* Copy over default setting since some might not get loaded in
* a networking environment. This ensures for example that the local
@@ -1817,23 +1876,13 @@
LoadSettings(_patch_settings, &_patches);
}
-static void Save_PATS(void)
+static void Save_PATS()
{
SaveSettings(_patch_settings, &_patches);
}
-void CheckConfig(void)
+void CheckConfig()
{
- // fix up news_display_opt from old to new
- int i;
- uint32 tmp;
- for (i = 0, tmp = _news_display_opt; i != 10; i++, tmp >>= 2) {
- if ((tmp & 0x3) == 0x3) { // old settings
- _news_display_opt = 0xAAAAAAAA; // set all news-messages to full 1010101010...
- break;
- }
- }
-
// Increase old default values for pf_maxdepth and pf_maxlength
// to support big networks.
if (_patches_newgame.pf_maxdepth == 16 && _patches_newgame.pf_maxlength == 512) {
@@ -1842,7 +1891,7 @@
}
}
-void UpdatePatches(void)
+void UpdatePatches()
{
/* Since old(er) savegames don't have any patches saved, we initialise
* them with the default values just as it was in the old days.
--- a/src/settings.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/settings.h Sun Mar 11 16:31:18 2007 +0000
@@ -46,7 +46,7 @@
typedef int32 OnChange(int32 var);
-typedef struct SettingDescBase {
+struct SettingDescBase {
const char *name; ///< name of the setting. Used in configuration file and for console
const void *def; ///< default value given when none is present
SettingDescType cmd; ///< various flags for the variable
@@ -56,12 +56,12 @@
const char *many; ///< ONE/MANY_OF_MANY: string of possible values for this type
StringID str; ///< (translated) string with descriptive text; gui and console
OnChange *proc; ///< callback procedure for when the value is changed
-} SettingDescBase;
+};
-typedef struct SettingDesc {
+struct SettingDesc {
SettingDescBase desc; ///< Settings structure (going to configuration file)
SaveLoad save; ///< Internal structure (going to savegame, parts to config)
-} SettingDesc;
+};
/* NOTE: The only difference between SettingDesc and SettingDescGlob is
* that one uses global variables as a source and the other offsets
@@ -72,10 +72,10 @@
* offset in a certain struct */
typedef SettingDesc SettingDescGlobVarList;
-typedef enum {
+enum IniGroupType {
IGT_VARIABLES = 0, ///< values of the form "landscape = hilly"
IGT_LIST = 1, ///< a list of values, seperated by \n and terminated by the next group block
-} IniGroupType;
+};
/** The patch values that are used for new games and/or modified in config file */
extern Patches _patches_newgame;
--- a/src/settings_gui.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/settings_gui.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -64,7 +64,7 @@
return buf;
}
-static int GetCurRes(void)
+static int GetCurRes()
{
int i;
@@ -77,18 +77,18 @@
return i;
}
-static inline bool RoadVehiclesAreBuilt(void)
+static inline bool RoadVehiclesAreBuilt()
{
const Vehicle* v;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Road) return true;
+ if (v->type == VEH_ROAD) return true;
}
return false;
}
-static void ShowCustCurrency(void);
+static void ShowCustCurrency();
static void GameOptionsWndProc(BaseWindow *w, WindowEvent *e)
{
@@ -289,18 +289,18 @@
};
-void ShowGameOptions(void)
+void ShowGameOptions()
{
DeleteWindowById(WC_GAME_OPTIONS, 0);
BaseWindow::Allocate(&_game_options_desc);
}
-typedef struct {
+struct GameSettingData {
int16 min;
int16 max;
int16 step;
StringID str;
-} GameSettingData;
+};
static const GameSettingData _game_setting_info[] = {
{ 0, 7, 1, STR_NULL},
@@ -369,7 +369,7 @@
}
}
-extern void StartupEconomy(void);
+extern void StartupEconomy();
enum {
GAMEDIFF_WND_TOP_OFFSET = 45,
@@ -551,7 +551,7 @@
GameDifficultyWndProc
};
-void ShowGameDifficulty(void)
+void ShowGameDifficulty()
{
DeleteWindowById(WC_GAME_OPTIONS, 0);
/* Copy current settings (ingame or in intro) to temporary holding place
@@ -655,16 +655,16 @@
"freight_trains",
};
-typedef struct PatchEntry {
+struct PatchEntry {
const SettingDesc *setting;
uint index;
-} PatchEntry;
+};
-typedef struct PatchPage {
+struct PatchPage {
const char **names;
PatchEntry *entries;
byte num;
-} PatchPage;
+};
/* PatchPage holds the categories, the number of elements in each category
* and (in NULL) a dynamic array of settings based on the string-representations
@@ -827,8 +827,8 @@
if (value < sdb->min) value = (sdb->flags & SGF_0ISDISABLED) ? 0 : sdb->min;
}
- /* Set up scroller timeout */
- if (value != oldvalue) {
+ /* Set up scroller timeout for numeric values */
+ if (value != oldvalue && !(sd->desc.flags & SGF_MULTISTRING)) {
WP(w,def_d).data_2 = btn * 2 + 1 + ((x >= 10) ? 1 : 0);
w->autorepeat_timeout = 5;
_left_button_clicked = false;
@@ -914,7 +914,7 @@
PatchesSelectionWndProc,
};
-void ShowPatchesSelection(void)
+void ShowPatchesSelection()
{
DeleteWindowById(WC_GAME_OPTIONS, 0);
BaseWindow::Allocate(&_patches_selection_desc);
@@ -1134,7 +1134,7 @@
CustCurrencyWndProc,
};
-static void ShowCustCurrency(void)
+static void ShowCustCurrency()
{
_str_separator[0] = _custom_currency.separator;
_str_separator[1] = '\0';
--- a/src/ship.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/ship.h Sun Mar 11 16:31:18 2007 +0000
@@ -12,7 +12,7 @@
static inline bool IsShipInDepot(const Vehicle* v)
{
- assert(v->type == VEH_Ship);
+ assert(v->type == VEH_SHIP);
return v->u.ship.state == 0x80;
}
--- a/src/ship_cmd.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/ship_cmd.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -264,8 +264,7 @@
order = GetVehicleOrder(v, v->cur_order_index);
if (order == NULL) {
- v->current_order.type = OT_NOTHING;
- v->current_order.flags = 0;
+ v->current_order.Free();
v->dest_tile = 0;
return;
}
@@ -447,12 +446,12 @@
}
}
-typedef struct {
+struct PathFindShip {
TileIndex skiptile;
TileIndex dest_coords;
uint best_bird_dist;
uint best_length;
-} PathFindShip;
+};
static bool ShipTrackFollower(TileIndex tile, PathFindShip *pfs, int track, uint length, byte *state)
{
@@ -705,8 +704,7 @@
/* A leave station order only needs one tick to get processed, so we can
* always skip ahead. */
if (v->current_order.type == OT_LEAVESTATION) {
- v->current_order.type = OT_NOTHING;
- v->current_order.flags = 0;
+ v->current_order.Free();
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
} else if (v->dest_tile != 0) {
/* We have a target, let's see if we reached it... */
@@ -821,12 +819,12 @@
}
-void ShipsYearlyLoop(void)
+void ShipsYearlyLoop()
{
Vehicle *v;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Ship) {
+ if (v->type == VEH_SHIP) {
v->profit_last_year = v->profit_this_year;
v->profit_this_year = 0;
InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
@@ -846,7 +844,7 @@
UnitID unit_num;
Engine *e;
- if (!IsEngineBuildable(p1, VEH_Ship, _current_player)) return_cmd_error(STR_ENGINE_NOT_BUILDABLE);
+ if (!IsEngineBuildable(p1, VEH_SHIP, _current_player)) return_cmd_error(STR_ENGINE_NOT_BUILDABLE);
SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
@@ -859,7 +857,7 @@
if (!IsTileOwner(tile, _current_player)) return CMD_ERROR;
v = AllocateVehicle();
- unit_num = HASBIT(p2, 0) ? 0 : GetFreeUnitNumber(VEH_Ship);
+ unit_num = HASBIT(p2, 0) ? 0 : GetFreeUnitNumber(VEH_SHIP);
if (v == NULL || unit_num > _patches.max_ships)
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
@@ -910,7 +908,7 @@
v->date_of_last_service = _date;
v->build_year = _cur_year;
v->cur_image = 0x0E5E;
- v->type = VEH_Ship;
+ v->type = VEH_SHIP;
v->random_bits = VehicleRandomBits();
v->vehicle_flags = 0;
@@ -922,7 +920,7 @@
RebuildVehicleLists();
InvalidateWindow(WC_COMPANY, v->owner);
if (IsLocalPlayer())
- InvalidateAutoreplaceWindow(VEH_Ship); // updates the replace Ship window
+ InvalidateAutoreplaceWindow(VEH_SHIP); // updates the replace Ship window
GetPlayer(_current_player)->num_engines[p1]++;
}
@@ -943,7 +941,7 @@
v = GetVehicle(p1);
- if (v->type != VEH_Ship || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_SHIP || !CheckOwnership(v->owner)) return CMD_ERROR;
SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
@@ -977,7 +975,7 @@
v = GetVehicle(p1);
- if (v->type != VEH_Ship || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_SHIP || !CheckOwnership(v->owner)) return CMD_ERROR;
/* Check if this ship can be started/stopped. The callback will fail or
* return 0xFF if it can. */
@@ -1016,14 +1014,14 @@
if (p2 & DEPOT_MASS_SEND) {
/* Mass goto depot requested */
if (!ValidVLWFlags(p2 & VLW_MASK)) return CMD_ERROR;
- return SendAllVehiclesToDepot(VEH_Ship, flags, p2 & DEPOT_SERVICE, _current_player, (p2 & VLW_MASK), p1);
+ return SendAllVehiclesToDepot(VEH_SHIP, flags, p2 & DEPOT_SERVICE, _current_player, (p2 & VLW_MASK), p1);
}
if (!IsValidVehicleID(p1)) return CMD_ERROR;
v = GetVehicle(p1);
- if (v->type != VEH_Ship || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_SHIP || !CheckOwnership(v->owner)) return CMD_ERROR;
if (v->vehstatus & VS_CRASHED) return CMD_ERROR;
@@ -1092,7 +1090,7 @@
v = GetVehicle(p1);
- if (v->type != VEH_Ship || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_SHIP || !CheckOwnership(v->owner)) return CMD_ERROR;
if (!IsShipInDepotStopped(v)) {
return_cmd_error(STR_980B_SHIP_MUST_BE_STOPPED_IN);
--- a/src/signs.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/signs.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -44,7 +44,7 @@
* Update the coordinates of all signs
*
*/
-void UpdateAllSignVirtCoords(void)
+void UpdateAllSignVirtCoords()
{
Sign *si;
@@ -73,7 +73,7 @@
*
* @return The pointer to the new sign, or NULL if there is no more free space
*/
-static Sign *AllocateSign(void)
+static Sign *AllocateSign()
{
Sign *si;
@@ -219,7 +219,7 @@
* Initialize the signs
*
*/
-void InitializeSigns(void)
+void InitializeSigns()
{
CleanPool(&_Sign_pool);
AddBlockToPool(&_Sign_pool);
@@ -241,7 +241,7 @@
* Save all signs
*
*/
-static void Save_SIGN(void)
+static void Save_SIGN()
{
Sign *si;
@@ -256,7 +256,7 @@
* Load all signs
*
*/
-static void Load_SIGN(void)
+static void Load_SIGN()
{
int index;
while ((index = SlIterateArray()) != -1) {
--- a/src/signs.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/signs.h Sun Mar 11 16:31:18 2007 +0000
@@ -5,7 +5,7 @@
#include "oldpool.h"
-typedef struct Sign {
+struct Sign {
StringID str;
ViewportSign sign;
int32 x;
@@ -14,11 +14,11 @@
PlayerByte owner; // placed by this player. Anyone can delete them though. OWNER_NONE for gray signs from old games.
SignID index;
-} Sign;
+};
DECLARE_OLD_POOL(Sign, Sign, 2, 16000)
-static inline SignID GetMaxSignIndex(void)
+static inline SignID GetMaxSignIndex()
{
/* TODO - This isn't the real content of the function, but
* with the new pool-system this will be replaced with one that
@@ -28,7 +28,7 @@
return GetSignPoolSize() - 1;
}
-static inline uint GetNumSigns(void)
+static inline uint GetNumSigns()
{
return GetSignPoolSize();
}
@@ -59,12 +59,12 @@
VARDEF bool _sign_sort_dirty;
-void UpdateAllSignVirtCoords(void);
+void UpdateAllSignVirtCoords();
void PlaceProc_Sign(TileIndex tile);
/* misc.c */
void ShowRenameSignWindow(const Sign *si);
-void ShowSignList(void);
+void ShowSignList();
#endif /* SIGNS_H */
--- a/src/signs_gui.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/signs_gui.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -37,7 +37,7 @@
return strcmp(buf1, _bufcache); // sort by name
}
-static void GlobalSortSignList(void)
+static void GlobalSortSignList()
{
const Sign *si;
uint n = 0;
@@ -137,7 +137,7 @@
};
-void ShowSignList(void)
+void ShowSignList()
{
BaseWindow *w;
--- a/src/slope.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/slope.h Sun Mar 11 16:31:18 2007 +0000
@@ -3,7 +3,7 @@
#ifndef SLOPE_H
#define SLOPE_H
-typedef enum Slope {
+enum Slope {
SLOPE_FLAT = 0x00,
SLOPE_W = 0x01,
SLOPE_S = 0x02,
@@ -25,7 +25,7 @@
SLOPE_STEEP_S = SLOPE_STEEP | SLOPE_WSE,
SLOPE_STEEP_E = SLOPE_STEEP | SLOPE_SEN,
SLOPE_STEEP_N = SLOPE_STEEP | SLOPE_ENW
-} Slope;
+};
static inline bool IsSteepSlope(Slope s)
{
--- a/src/smallmap_gui.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/smallmap_gui.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -256,10 +256,10 @@
MKCOLOR(0x27272727),
};
-typedef struct AndOr {
+struct AndOr {
uint32 mor;
uint32 mand;
-} AndOr;
+};
static inline uint32 ApplyMask(uint32 colour, const AndOr *mask)
{
@@ -691,7 +691,7 @@
byte color;
FOR_ALL_VEHICLES(v) {
- if (v->type != VEH_Special &&
+ if (v->type != VEH_SPECIAL &&
(v->vehstatus & (VS_HIDDEN | VS_UNCLICKABLE)) == 0) {
// Remap into flat coordinates.
Point pt = RemapCoords(
@@ -976,7 +976,7 @@
SmallMapWindowProc
};
-void ShowSmallMap(void)
+void ShowSmallMap()
{
BaseWindow *w;
@@ -1089,7 +1089,7 @@
ExtraViewPortWndProc
};
-void ShowExtraViewPortWindow(void)
+void ShowExtraViewPortWindow()
{
BaseWindow *w, *v;
int i = 0;
--- a/src/sound.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/sound.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -93,7 +93,7 @@
}
}
-uint GetNumOriginalSounds(void)
+uint GetNumOriginalSounds()
{
return _file_count;
}
@@ -177,7 +177,7 @@
72,
};
-void SndCopyToPool(void)
+void SndCopyToPool()
{
uint i;
--- a/src/sound.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/sound.h Sun Mar 11 16:31:18 2007 +0000
@@ -5,7 +5,7 @@
#include "helpers.hpp"
-typedef struct MusicFileSettings {
+struct MusicFileSettings {
byte playlist;
byte music_vol;
byte effect_vol;
@@ -14,11 +14,11 @@
bool playing;
bool shuffle;
char extmidi[80];
-} MusicFileSettings;
+};
VARDEF MusicFileSettings msf;
-typedef struct FileEntry {
+struct FileEntry {
uint32 file_offset;
uint32 file_size;
uint16 rate;
@@ -26,12 +26,12 @@
uint8 channels;
uint8 volume;
uint8 priority;
-} FileEntry;
+};
bool SoundInitialize(const char *filename);
-uint GetNumOriginalSounds(void);
+uint GetNumOriginalSounds();
-typedef enum SoundFx {
+enum SoundFx {
SND_BEGIN = 0,
SND_02_SPLAT = 0, // 0 == 0x00 !
SND_03_FACTORY_WHISTLE,
@@ -107,7 +107,7 @@
SND_47_MAGLEV_2,
SND_48_DISTANT_BIRD, // 72 == 0x48
SND_END
-} SoundFx;
+};
/** Define basic enum properties */
template <> struct EnumPropsT<SoundFx> : MakeEnumPropsT<SoundFx, byte, SND_BEGIN, SND_END, SND_END> {};
@@ -116,6 +116,6 @@
void SndPlayTileFx(SoundFx sound, TileIndex tile);
void SndPlayVehicleFx(SoundFx sound, const Vehicle *v);
void SndPlayFx(SoundFx sound);
-void SndCopyToPool(void);
+void SndCopyToPool();
#endif /* SOUND_H */
--- a/src/sound/cocoa_s.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/sound/cocoa_s.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -116,7 +116,7 @@
}
-static void CocoaSoundStop(void)
+static void CocoaSoundStop()
{
struct AudioUnitInputCallback callback;
--- a/src/sound/null_s.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/sound/null_s.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -4,7 +4,7 @@
#include "null_s.h"
static const char *NullSoundStart(const char * const *parm) { return NULL; }
-static void NullSoundStop(void) {}
+static void NullSoundStop() {}
const HalSoundDriver _null_sound_driver = {
NullSoundStart,
--- a/src/sound/sdl_s.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/sound/sdl_s.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -32,7 +32,7 @@
return NULL;
}
-static void SdlSoundStop(void)
+static void SdlSoundStop()
{
SDL_CALL SDL_CloseAudio();
SdlClose(SDL_INIT_AUDIO);
--- a/src/sound/win32_s.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/sound/win32_s.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -24,7 +24,7 @@
error("waveOutPrepareHeader failed");
}
-static void FillHeaders(void)
+static void FillHeaders()
{
WAVEHDR *hdr;
@@ -69,7 +69,7 @@
return NULL;
}
-static void Win32SoundStop(void)
+static void Win32SoundStop()
{
HWAVEOUT waveout = _waveout;
--- a/src/sprite.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/sprite.h Sun Mar 11 16:31:18 2007 +0000
@@ -8,7 +8,7 @@
* bounding box. Used especially for various multi-sprite buildings (like
* depots or stations): */
-typedef struct DrawTileSeqStruct {
+struct DrawTileSeqStruct {
int8 delta_x; // 0x80 is sequence terminator
int8 delta_y;
int8 delta_z;
@@ -17,19 +17,19 @@
byte size_z;
SpriteID image;
SpriteID pal;
-} DrawTileSeqStruct;
+};
-typedef struct DrawTileSprites {
+struct DrawTileSprites {
SpriteID ground_sprite;
SpriteID ground_pal;
const DrawTileSeqStruct* seq;
-} DrawTileSprites;
+};
/**
* This structure is the same for both Industries and Houses.
* Buildings here reference a general type of construction
*/
-typedef struct DrawBuildingsTileStruct {
+struct DrawBuildingsTileStruct {
PalSpriteID ground;
PalSpriteID building;
byte subtile_x:4;
@@ -38,7 +38,7 @@
byte height:4;
byte dz;
byte draw_proc; /* this allows to specify a special drawing procedure.*/
-} DrawBuildingsTileStruct;
+};
// Iterate through all DrawTileSeqStructs in DrawTileSprites.
#define foreach_draw_tile_seq(idx, list) for (idx = list; ((byte) idx->delta_x) != 0x80; idx++)
--- a/src/spritecache.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/spritecache.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -15,11 +15,11 @@
#endif /* SPRITE_CACHE_SIZE */
-typedef struct SpriteCache {
+struct SpriteCache {
void *ptr;
uint32 file_pos;
int16 lru;
-} SpriteCache;
+};
static uint _spritecache_items = 0;
@@ -55,18 +55,18 @@
}
-typedef struct MemBlock {
+struct MemBlock {
uint32 size;
byte data[VARARRAY_SIZE];
-} MemBlock;
+};
static uint _sprite_lru_counter;
static MemBlock *_spritecache_ptr;
static int _compact_cache_counter;
-static void CompactSpriteCache(void);
+static void CompactSpriteCache();
-static bool ReadSpriteHeaderSkipData(void)
+static bool ReadSpriteHeaderSkipData()
{
uint16 num = FioReadWord();
byte type;
@@ -223,7 +223,7 @@
return (MemBlock*)((byte*)block + (block->size & ~S_FREE_MASK));
}
-static uint32 GetSpriteCacheUsage(void)
+static uint32 GetSpriteCacheUsage()
{
uint32 tot_size = 0;
MemBlock* s;
@@ -235,7 +235,7 @@
}
-void IncreaseSpriteLRU(void)
+void IncreaseSpriteLRU()
{
// Increase all LRU values
if (_sprite_lru_counter > 16384) {
@@ -265,7 +265,7 @@
// Called when holes in the sprite cache should be removed.
// That is accomplished by moving the cached data.
-static void CompactSpriteCache(void)
+static void CompactSpriteCache()
{
MemBlock *s;
@@ -306,7 +306,7 @@
}
}
-static void DeleteEntryFromSpriteCache(void)
+static void DeleteEntryFromSpriteCache()
{
SpriteID i;
uint best = UINT_MAX;
@@ -403,7 +403,7 @@
}
-void GfxInitSpriteMem(void)
+void GfxInitSpriteMem()
{
// initialize sprite cache heap
if (_spritecache_ptr == NULL) _spritecache_ptr = (MemBlock*)malloc(SPRITE_CACHE_SIZE);
--- a/src/spritecache.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/spritecache.h Sun Mar 11 16:31:18 2007 +0000
@@ -3,14 +3,14 @@
#ifndef SPRITECACHE_H
#define SPRITECACHE_H
-typedef struct Sprite {
+struct Sprite {
byte info;
byte height;
uint16 width;
int16 x_offs;
int16 y_offs;
byte data[VARARRAY_SIZE];
-} Sprite;
+};
const void *GetRawSprite(SpriteID sprite);
bool SpriteExists(SpriteID sprite);
@@ -25,8 +25,8 @@
return (byte*)GetRawSprite(sprite);
}
-void GfxInitSpriteMem(void);
-void IncreaseSpriteLRU(void);
+void GfxInitSpriteMem();
+void IncreaseSpriteLRU();
bool LoadNextSprite(int load_index, byte file_index);
void DupSprite(SpriteID old_spr, SpriteID new_spr);
--- a/src/station.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/station.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -48,7 +48,7 @@
delete_ctr = 0;
facilities = 0;
- last_vehicle_type = VEH_Invalid;
+ last_vehicle_type = VEH_INVALID;
random_bits = 0; // Random() must be called when station is really built (DC_EXEC)
waiting_triggers = 0;
@@ -155,7 +155,7 @@
return IsTileType(tile, MP_STATION) && GetStationIndex(tile) == index && IsRailwayStation(tile);
}
-/*static*/ Station *Station::AllocateRaw(void)
+/*static*/ Station *Station::AllocateRaw()
{
Station *st = NULL;
@@ -455,7 +455,7 @@
Vehicle *v;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Road && v->u.road.slot == this) ClearSlot(v);
+ if (v->type == VEH_ROAD && v->u.road.slot == this) ClearSlot(v);
}
}
assert(num_vehicles == 0);
@@ -467,7 +467,7 @@
/** Low-level function for allocating a RoadStop on the pool */
-RoadStop *RoadStop::AllocateRaw( void )
+RoadStop *RoadStop::AllocateRaw()
{
RoadStop *rs;
--- a/src/station.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/station.h Sun Mar 11 16:31:18 2007 +0000
@@ -11,13 +11,14 @@
#include "newgrf_station.h"
static const StationID INVALID_STATION = 0xFFFF;
+static const byte INITIAL_STATION_RATING = 175;
-typedef struct GoodsEntry {
+struct GoodsEntry {
GoodsEntry() :
waiting_acceptance(0),
unload_pending(0),
days_since_pickup(0),
- rating(175),
+ rating(INITIAL_STATION_RATING),
enroute_from(INVALID_STATION),
enroute_from_xy(INVALID_TILE),
last_speed(0),
@@ -35,7 +36,7 @@
byte last_speed;
byte last_age;
int32 feeder_profit;
-} GoodsEntry;
+};
/** A Stop for a Road Vehicle */
struct RoadStop {
@@ -76,14 +77,14 @@
bool IsEntranceBusy() const;
void SetEntranceBusy(bool busy);
protected:
- static RoadStop *AllocateRaw(void);
+ static RoadStop *AllocateRaw();
};
-typedef struct StationSpecList {
+struct StationSpecList {
const StationSpec *spec;
uint32 grfid; /// GRF ID of this custom station
uint8 localidx; /// Station ID within GRF of station
-} StationSpecList;
+};
/** StationRect - used to track station spread out rectangle - cheaper than scanning whole map */
struct StationRect : public Rect {
@@ -184,7 +185,7 @@
bool IsValid() const;
protected:
- static Station *AllocateRaw(void);
+ static Station *AllocateRaw();
};
enum {
@@ -207,26 +208,26 @@
HVOT_BUOY = 1 << 6
};
-typedef enum CatchmentAreas {
+enum CatchmentArea {
CA_NONE = 0,
CA_BUS = 3,
CA_TRUCK = 3,
CA_TRAIN = 4,
CA_DOCK = 5
-} CatchmentArea;
+};
void ModifyStationRatingAround(TileIndex tile, PlayerID owner, int amount, uint radius);
void ShowStationViewWindow(StationID station);
-void UpdateAllStationVirtCoord(void);
+void UpdateAllStationVirtCoord();
/* sorter stuff */
-void RebuildStationLists(void);
-void ResortStationLists(void);
+void RebuildStationLists();
+void ResortStationLists();
DECLARE_OLD_POOL(Station, Station, 6, 1000)
-static inline StationID GetMaxStationIndex(void)
+static inline StationID GetMaxStationIndex()
{
/* TODO - This isn't the real content of the function, but
* with the new pool-system this will be replaced with one that
@@ -236,7 +237,7 @@
return GetStationPoolSize() - 1;
}
-static inline uint GetNumStations(void)
+static inline uint GetNumStations()
{
return GetStationPoolSize();
}
@@ -260,7 +261,7 @@
/* End of stuff for ROADSTOPS */
-void AfterLoadStations(void);
+void AfterLoadStations();
void GetProductionAroundTiles(AcceptedCargo produced, TileIndex tile, int w, int h, int rad);
void GetAcceptanceAroundTiles(AcceptedCargo accepts, TileIndex tile, int w, int h, int rad);
@@ -270,7 +271,7 @@
RoadStop * GetRoadStopByTile(TileIndex tile, RoadStop::Type type);
uint GetNumRoadStops(const Station* st, RoadStop::Type type);
-RoadStop * AllocateRoadStop( void );
+RoadStop * AllocateRoadStop();
void ClearSlot(Vehicle *v);
void DeleteOilRig(TileIndex t);
--- a/src/station_cmd.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/station_cmd.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -330,7 +330,7 @@
}
// Update the virtual coords needed to draw the station sign for all stations.
-void UpdateAllStationVirtCoord(void)
+void UpdateAllStationVirtCoord()
{
Station* st;
@@ -449,12 +449,12 @@
}
}
-typedef struct ottd_Rectangle {
+struct ottd_Rectangle {
uint min_x;
uint min_y;
uint max_x;
uint max_y;
-} ottd_Rectangle;
+};
static inline void MergePoint(ottd_Rectangle* rect, TileIndex tile)
{
@@ -1401,7 +1401,7 @@
// Intercontinental Airport (vlarge) - 4 runways
static const byte _airport_sections_intercontinental[] = {
102, 120, 89, 89, 89, 89, 89, 89, 118,
- 120, 22, 22, 22, 22, 22, 22, 119, 117,
+ 120, 23, 23, 23, 23, 23, 23, 119, 117,
87, 54, 87, 8, 8, 8, 8, 51, 117,
87, 162, 87, 85, 116, 116, 8, 9, 10,
87, 8, 8, 11, 31, 11, 8, 160, 32,
@@ -1410,7 +1410,7 @@
87, 142, 8, 11, 29, 11, 10, 163, 10,
87, 164, 87, 8, 8, 8, 10, 37, 117,
87, 120, 89, 89, 89, 89, 89, 89, 119,
- 121, 22, 22, 22, 22, 22, 22, 119, 37
+ 121, 23, 23, 23, 23, 23, 23, 119, 37
};
@@ -1670,7 +1670,7 @@
{
const Vehicle *v;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Ship) {
+ if (v->type == VEH_SHIP) {
const Order *order;
FOR_VEHICLE_ORDERS(v, order) {
if (order->type == OT_GOTO_STATION && order->dest == st->index) {
@@ -2071,11 +2071,11 @@
static void AnimateTile_Station(TileIndex tile)
{
- typedef struct AnimData {
+ struct AnimData {
StationGfx from; // first sprite
StationGfx to; // last sprite
byte delay;
- } AnimData;
+ };
static const AnimData data[] = {
{ GFX_RADAR_LARGE_FIRST, GFX_RADAR_LARGE_LAST, 3 },
@@ -2103,7 +2103,7 @@
static void ClickTile_Station(TileIndex tile)
{
if (IsHangar(tile)) {
- ShowDepotWindow(tile, VEH_Aircraft);
+ ShowDepotWindow(tile, VEH_AIRCRAFT);
} else {
ShowStationViewWindow(GetStationIndex(tile));
}
@@ -2115,7 +2115,7 @@
static uint32 VehicleEnter_Station(Vehicle *v, TileIndex tile, int x, int y)
{
- if (v->type == VEH_Train) {
+ if (v->type == VEH_TRAIN) {
if (IsRailwayStation(tile) && IsFrontEngine(v) &&
!IsCompatibleTrainStationTile(tile + TileOffsByDiagDir(DirToDiagDir(v->direction)), tile)) {
StationID station_id = GetStationIndex(tile);
@@ -2145,7 +2145,7 @@
}
}
}
- } else if (v->type == VEH_Road) {
+ } else if (v->type == VEH_ROAD) {
if (v->u.road.state < RVSB_IN_ROAD_STOP && !IsReversingRoadTrackdir((Trackdir)v->u.road.state) && v->u.road.frame == 0) {
if (IsRoadStop(tile)) {
/* Attempt to allocate a parking bay in a road stop */
@@ -2210,6 +2210,12 @@
GoodsEntry *ge = st->goods;
do {
+ /* Slowly increase the rating back to his original level in the case we
+ * didn't deliver cargo yet to this station. This happens when a bribe
+ * failed while you didn't moved that cargo yet to a station. */
+ if (ge->enroute_from == INVALID_STATION && ge->rating < INITIAL_STATION_RATING)
+ ge->rating++;
+ /* Only change the rating if we are moving this cargo */
if (ge->enroute_from != INVALID_STATION) {
byte_inc_sat(&ge->enroute_time);
byte_inc_sat(&ge->days_since_pickup);
@@ -2234,7 +2240,7 @@
{
byte days = ge->days_since_pickup;
- if (st->last_vehicle_type == VEH_Ship)
+ if (st->last_vehicle_type == VEH_SHIP)
days >>= 2;
(days > 21) ||
(rating += 25, days > 12) ||
@@ -2299,7 +2305,7 @@
if (b == 0) UpdateStationRating(st);
}
-void OnTick_Station(void)
+void OnTick_Station()
{
if (_game_mode == GM_EDITOR) return;
@@ -2312,7 +2318,7 @@
FOR_ALL_STATIONS(st) StationHandleSmallTick(st);
}
-void StationMonthlyLoop(void)
+void StationMonthlyLoop()
{
}
@@ -2537,7 +2543,7 @@
st->time_since_load = 255;
st->time_since_unload = 255;
st->delete_ctr = 0;
- st->last_vehicle_type = VEH_Invalid;
+ st->last_vehicle_type = VEH_INVALID;
st->facilities = FACIL_AIRPORT | FACIL_DOCK;
st->build_date = _date;
@@ -2546,7 +2552,7 @@
st->goods[j].days_since_pickup = 0;
st->goods[j].enroute_from = INVALID_STATION;
st->goods[j].enroute_from_xy = INVALID_TILE;
- st->goods[j].rating = 175;
+ st->goods[j].rating = INITIAL_STATION_RATING;
st->goods[j].last_speed = 0;
st->goods[j].last_age = 255;
}
@@ -2643,7 +2649,7 @@
return CMD_ERROR;
}
-void InitializeStations(void)
+void InitializeStations()
{
/* Clean the station pool and create 1 block in it */
CleanPool(&_Station_pool);
@@ -2658,7 +2664,7 @@
}
-void AfterLoadStations(void)
+void AfterLoadStations()
{
/* Update the speclists of all stations to point to the currently loaded custom stations. */
Station *st;
@@ -2814,7 +2820,7 @@
}
}
-static void Save_STNS(void)
+static void Save_STNS()
{
Station *st;
// Write the stations
@@ -2824,7 +2830,7 @@
}
}
-static void Load_STNS(void)
+static void Load_STNS()
{
int index;
while ((index = SlIterateArray()) != -1) {
@@ -2847,7 +2853,7 @@
if (_station_tick_ctr > GetMaxStationIndex()) _station_tick_ctr = 0;
}
-static void Save_ROADSTOP(void)
+static void Save_ROADSTOP()
{
RoadStop *rs;
@@ -2857,7 +2863,7 @@
}
}
-static void Load_ROADSTOP(void)
+static void Load_ROADSTOP()
{
int index;
--- a/src/station_gui.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/station_gui.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -30,9 +30,9 @@
STATIONLIST_WIDGET_BUS,
STATIONLIST_WIDGET_AIRPLANE,
STATIONLIST_WIDGET_SHIP,
- STATIONLIST_WIDGET_CARGOSTART = 12,
- STATIONLIST_WIDGET_NOCARGOWAITING = 24,
- STATIONLIST_WIDGET_FACILALL = 26,
+ STATIONLIST_WIDGET_CARGOSTART = 20,
+ STATIONLIST_WIDGET_NOCARGOWAITING = 12,
+ STATIONLIST_WIDGET_FACILALL = 14,
STATIONLIST_WIDGET_CARGOALL,
STATIONLIST_WIDGET_SORTBY,
STATIONLIST_WIDGET_SORTCRITERIA,
@@ -138,6 +138,14 @@
return (_internal_sort_order & 1) ? sum2 - sum1 : sum1 - sum2;
}
+/**
+ * qsort-compatible version of sorting two stations by maximum rating
+ * @param a First object to be sorted, must be of type (const Station *)
+ * @param b Second object to be sorted, must be of type (const Station *)
+ * @return The sort order
+ * @retval >0 a should come before b in the list
+ * @retval <0 b should come before a in the list
+ */
static int CDECL StationRatingMaxSorter(const void *a, const void *b)
{
const Station* st1 = *(const Station**)a;
@@ -146,31 +154,31 @@
byte maxr2 = 0;
for (CargoID j = 0; j < NUM_CARGO; j++) {
- if (st1->goods[j].waiting_acceptance & 0xfff) maxr1 = max(maxr1, st1->goods[j].rating);
- if (st2->goods[j].waiting_acceptance & 0xfff) maxr2 = max(maxr2, st2->goods[j].rating);
+ if (st1->goods[j].enroute_from != INVALID_STATION) maxr1 = max(maxr1, st1->goods[j].rating);
+ if (st2->goods[j].enroute_from != INVALID_STATION) maxr2 = max(maxr2, st2->goods[j].rating);
}
return (_internal_sort_order & 1) ? maxr2 - maxr1 : maxr1 - maxr2;
}
-typedef enum StationListFlags {
+enum StationListFlags {
SL_ORDER = 0x01,
SL_RESORT = 0x02,
SL_REBUILD = 0x04,
-} StationListFlags;
+};
DECLARE_ENUM_AS_BIT_SET(StationListFlags);
-typedef struct plstations_d {
+struct plstations_d {
const Station** sort_list;
uint16 list_length;
byte sort_type;
StationListFlags flags;
uint16 resort_timer; //was byte refresh_counter;
-} plstations_d;
+};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(plstations_d));
-void RebuildStationLists(void)
+void RebuildStationLists()
{
BaseWindow *w = NULL;
@@ -182,7 +190,7 @@
}
}
-void ResortStationLists(void)
+void ResortStationLists()
{
BaseWindow *w = NULL;
@@ -194,7 +202,7 @@
}
}
-static void BuildStationsList(plstations_d* sl, PlayerID owner, byte facilities, uint16 cargo_filter)
+static void BuildStationsList(plstations_d* sl, PlayerID owner, byte facilities, uint32 cargo_filter, bool include_empty)
{
uint n = 0;
const Station *st;
@@ -221,7 +229,7 @@
}
}
//stations without waiting cargo
- if (num_waiting_cargo == 0 && HASBIT(cargo_filter, NUM_CARGO)) {
+ if (num_waiting_cargo == 0 && include_empty) {
station_sort[n++] = st;
}
}
@@ -259,28 +267,28 @@
sl->flags &= ~SL_RESORT;
}
+static uint32 _cargo_filter = std::numeric_limits<uint32>::max();
+
static void PlayerStationsWndProc(BaseWindow *w, WindowEvent *e)
{
- static const uint16 CARGO_ALL_SELECTED = 0x1FFF;
-
const PlayerID owner = (PlayerID)w->window_number;
static byte facilities = FACIL_TRAIN | FACIL_TRUCK_STOP | FACIL_BUS_STOP | FACIL_AIRPORT | FACIL_DOCK;
- static uint16 cargo_filter = CARGO_ALL_SELECTED;
static Listing station_sort = {0, 0};
+ static bool include_empty = true;
plstations_d *sl = &WP(w, plstations_d);
switch (e->event) {
case WE_CREATE: /* set up resort timer */
+ if (_cargo_filter == std::numeric_limits<uint32>::max()) _cargo_filter = _cargo_mask;
+
for (uint i = 0; i < 5; i++) {
if (HASBIT(facilities, i)) w->LowerWidget(i + STATIONLIST_WIDGET_TRAIN);
}
- for (CargoID i = 0; i < NUM_CARGO; i++) {
- if (HASBIT(cargo_filter, i)) w->LowerWidget(i + STATIONLIST_WIDGET_CARGOSTART);
- }
+
w->SetWidgetLoweredState(STATIONLIST_WIDGET_FACILALL, facilities == (FACIL_TRAIN | FACIL_TRUCK_STOP | FACIL_BUS_STOP | FACIL_AIRPORT | FACIL_DOCK));
- w->SetWidgetLoweredState(STATIONLIST_WIDGET_CARGOALL, cargo_filter == CARGO_ALL_SELECTED);
- w->SetWidgetLoweredState(STATIONLIST_WIDGET_NOCARGOWAITING, HASBIT(cargo_filter, STATIONLIST_WIDGET_NOCARGOWAITING - NUM_CARGO));
+ w->SetWidgetLoweredState(STATIONLIST_WIDGET_CARGOALL, _cargo_filter == _cargo_mask && include_empty);
+ w->SetWidgetLoweredState(STATIONLIST_WIDGET_NOCARGOWAITING, include_empty);
sl->sort_list = NULL;
sl->flags = SL_REBUILD;
@@ -290,7 +298,7 @@
break;
case WE_PAINT: {
- BuildStationsList(sl, owner, facilities, cargo_filter);
+ BuildStationsList(sl, owner, facilities, _cargo_filter, include_empty);
SortStationsList(sl);
SetVScrollCount(w, sl->list_length);
@@ -312,14 +320,16 @@
int y = 14;
int xb = 2; // offset from left of widget
- for (CargoID i = 0; i < NUM_CARGO; i++) {
- const CargoSpec *cs = GetCargo(i);
- if (cs->IsValid()) {
- cg_ofst = w->IsWidgetLowered(i + STATIONLIST_WIDGET_CARGOSTART) ? 2 : 1;
- GfxFillRect(x + cg_ofst, y + cg_ofst, x + cg_ofst + 10 , y + cg_ofst + 7, cs->rating_colour);
- DrawStringCentered(x + 6 + cg_ofst, y + cg_ofst, cs->abbrev, 0x10);
- }
+ uint i = 0;
+ for (CargoID c = 0; c < NUM_CARGO; c++) {
+ const CargoSpec *cs = GetCargo(c);
+ if (!cs->IsValid()) continue;
+
+ cg_ofst = HASBIT(_cargo_filter, c) ? 2 : 1;
+ GfxFillRect(x + cg_ofst, y + cg_ofst, x + cg_ofst + 10 , y + cg_ofst + 7, cs->rating_colour);
+ DrawStringCentered(x + 6 + cg_ofst, y + cg_ofst, cs->abbrev, 0x10);
x += 14;
+ i++;
}
x += 6;
@@ -412,17 +422,22 @@
w->SetDirty();
break;
- case STATIONLIST_WIDGET_CARGOALL:
- for (CargoID i = 0; i < NUM_CARGO; i++) {
+ case STATIONLIST_WIDGET_CARGOALL: {
+ uint i = 0;
+ for (CargoID c = 0; c < NUM_CARGO; c++) {
+ if (!GetCargo(c)->IsValid()) continue;
w->LowerWidget(i + STATIONLIST_WIDGET_CARGOSTART);
+ i++;
}
w->LowerWidget(STATIONLIST_WIDGET_NOCARGOWAITING);
w->LowerWidget(STATIONLIST_WIDGET_CARGOALL);
- cargo_filter = CARGO_ALL_SELECTED;
+ _cargo_filter = _cargo_mask;
+ include_empty = true;
sl->flags |= SL_REBUILD;
w->SetDirty();
break;
+ }
case STATIONLIST_WIDGET_SORTBY: /*flip sorting method asc/desc*/
sl->flags ^= SL_ORDER; //DESC-flag
@@ -438,20 +453,53 @@
w->ShowDropDownMenu(_station_sort_listing, sl->sort_type, STATIONLIST_WIDGET_SORTDROPBTN, 0, 0);
break;
+ case STATIONLIST_WIDGET_NOCARGOWAITING:
+ if (_ctrl_pressed) {
+ include_empty = !include_empty;
+ w->ToggleWidgetLoweredState(STATIONLIST_WIDGET_NOCARGOWAITING);
+ } else {
+ for (uint i = STATIONLIST_WIDGET_CARGOSTART; i < w->widget_count; i++) {
+ w->RaiseWidget(i);
+ }
+
+ _cargo_filter = 0;
+ include_empty = true;
+
+ w->LowerWidget(STATIONLIST_WIDGET_NOCARGOWAITING);
+ }
+ sl->flags |= SL_REBUILD;
+ w->SetWidgetLoweredState(STATIONLIST_WIDGET_CARGOALL, _cargo_filter == _cargo_mask && include_empty);
+ w->SetDirty();
+ break;
+
default:
- if (e->we.click.widget >= STATIONLIST_WIDGET_CARGOSTART && e->we.click.widget <= STATIONLIST_WIDGET_NOCARGOWAITING) { //change cargo_filter
+ if (e->we.click.widget >= STATIONLIST_WIDGET_CARGOSTART) { //change cargo_filter
+ /* Determine the selected cargo type */
+ CargoID c;
+ int i = 0;
+ for (c = 0; c < NUM_CARGO; c++) {
+ if (!GetCargo(c)->IsValid()) continue;
+ if (e->we.click.widget - STATIONLIST_WIDGET_CARGOSTART == i) break;
+ i++;
+ }
+
if (_ctrl_pressed) {
- TOGGLEBIT(cargo_filter, e->we.click.widget - STATIONLIST_WIDGET_CARGOSTART);
+ TOGGLEBIT(_cargo_filter, c);
w->ToggleWidgetLoweredState(e->we.click.widget);
} else {
- for (uint i = 0; cargo_filter != 0; i++, cargo_filter >>= 1) {
- if (HASBIT(cargo_filter, 0)) w->RaiseWidget(i + STATIONLIST_WIDGET_CARGOSTART);
+ for (uint i = STATIONLIST_WIDGET_CARGOSTART; i < w->widget_count; i++) {
+ w->RaiseWidget(i);
}
- SETBIT(cargo_filter, e->we.click.widget - STATIONLIST_WIDGET_CARGOSTART);
+ w->RaiseWidget(STATIONLIST_WIDGET_NOCARGOWAITING);
+
+ _cargo_filter = 0;
+ include_empty = false;
+
+ SETBIT(_cargo_filter, c);
w->LowerWidget(e->we.click.widget);
}
sl->flags |= SL_REBUILD;
- w->SetWidgetLoweredState(STATIONLIST_WIDGET_CARGOALL, cargo_filter == CARGO_ALL_SELECTED);
+ w->SetWidgetLoweredState(STATIONLIST_WIDGET_CARGOALL, _cargo_filter == _cargo_mask && include_empty);
w->SetDirty();
}
break;
@@ -503,26 +551,14 @@
{ WWT_TEXTBTN, RESIZE_NONE, 14, 56, 69, 14, 24, STR_SHIP, STR_USE_CTRL_TO_SELECT_MORE},
//Index 11
{ WWT_PANEL, RESIZE_NONE, 14, 83, 88, 14, 24, 0x0, STR_USE_CTRL_TO_SELECT_MORE},
-{ WWT_PANEL, RESIZE_NONE, 14, 89, 102, 14, 24, 0x0, STR_USE_CTRL_TO_SELECT_MORE},
-{ WWT_PANEL, RESIZE_NONE, 14, 103, 116, 14, 24, 0x0, STR_USE_CTRL_TO_SELECT_MORE},
-{ WWT_PANEL, RESIZE_NONE, 14, 117, 130, 14, 24, 0x0, STR_USE_CTRL_TO_SELECT_MORE},
-{ WWT_PANEL, RESIZE_NONE, 14, 131, 144, 14, 24, 0x0, STR_USE_CTRL_TO_SELECT_MORE},
-{ WWT_PANEL, RESIZE_NONE, 14, 145, 158, 14, 24, 0x0, STR_USE_CTRL_TO_SELECT_MORE},
-{ WWT_PANEL, RESIZE_NONE, 14, 159, 172, 14, 24, 0x0, STR_USE_CTRL_TO_SELECT_MORE},
-{ WWT_PANEL, RESIZE_NONE, 14, 173, 186, 14, 24, 0x0, STR_USE_CTRL_TO_SELECT_MORE},
-{ WWT_PANEL, RESIZE_NONE, 14, 187, 200, 14, 24, 0x0, STR_USE_CTRL_TO_SELECT_MORE},
-{ WWT_PANEL, RESIZE_NONE, 14, 201, 214, 14, 24, 0x0, STR_USE_CTRL_TO_SELECT_MORE},
-{ WWT_PANEL, RESIZE_NONE, 14, 215, 228, 14, 24, 0x0, STR_USE_CTRL_TO_SELECT_MORE},
-{ WWT_PANEL, RESIZE_NONE, 14, 229, 242, 14, 24, 0x0, STR_USE_CTRL_TO_SELECT_MORE},
-{ WWT_PANEL, RESIZE_NONE, 14, 243, 256, 14, 24, 0x0, STR_USE_CTRL_TO_SELECT_MORE},
-{ WWT_PANEL, RESIZE_NONE, 14, 257, 270, 14, 24, 0x0, STR_NO_WAITING_CARGO},
-{ WWT_PANEL, RESIZE_RIGHT, 14, 285, 357, 14, 24, 0x0, STR_NULL},
+{ WWT_PANEL, RESIZE_NONE, 14, 89, 102, 14, 24, 0x0, STR_NO_WAITING_CARGO},
+{ WWT_PANEL, RESIZE_RIGHT, 14, 117, 357, 14, 24, 0x0, STR_NULL},
-//26
+//14
{ WWT_PANEL, RESIZE_NONE, 14, 70, 83, 14, 24, 0x0, STR_SELECT_ALL_FACILITIES},
-{ WWT_PANEL, RESIZE_NONE, 14, 271, 284, 14, 24, 0x0, STR_SELECT_ALL_TYPES},
+{ WWT_PANEL, RESIZE_NONE, 14, 103, 116, 14, 24, 0x0, STR_SELECT_ALL_TYPES},
-//28
+//16
{ WWT_TEXTBTN, RESIZE_NONE, 14, 0, 80, 25, 36, STR_SORT_BY, STR_SORT_ORDER_TIP},
{ WWT_PANEL, RESIZE_NONE, 14, 81, 232, 25, 36, 0x0, STR_SORT_CRITERIA_TIP},
{ WWT_TEXTBTN, RESIZE_NONE, 14, 233, 243, 25, 36, STR_0225, STR_SORT_CRITERIA_TIP},
@@ -550,6 +586,47 @@
w->vscroll.cap = 12;
w->resize.step_height = 10;
w->resize.height = w->Height() - 10 * 7; // minimum if 5 in the list
+
+ /* Add cargo filter buttons */
+ uint num_active = 0;
+ for (CargoID c = 0; c < NUM_CARGO; c++) {
+ if (GetCargo(c)->IsValid()) num_active++;
+ }
+
+ w->widget_count += num_active;
+ w->widget = ReallocT(w->widget, w->widget_count + 1);
+ w->widget[w->widget_count].type = WWT_LAST;
+
+ uint i = 0;
+ for (CargoID c = 0; c < NUM_CARGO; c++) {
+ if (!GetCargo(c)->IsValid()) continue;
+
+ OldWidget *wi = &w->widget[STATIONLIST_WIDGET_CARGOSTART + i];
+ wi->type = WWT_PANEL;
+ wi->m_display_flags = RESIZE_NONE;
+ wi->color = 14;
+ wi->left = 89 + i * 14;
+ wi->right = wi->left + 13;
+ wi->top = 14;
+ wi->bottom = 24;
+ wi->data = 0;
+ wi->tooltips = STR_USE_CTRL_TO_SELECT_MORE;
+
+ if (HASBIT(_cargo_filter, c)) w->LowerWidget(STATIONLIST_WIDGET_CARGOSTART + i);
+ i++;
+ }
+
+ w->widget[STATIONLIST_WIDGET_NOCARGOWAITING].left += num_active * 14;
+ w->widget[STATIONLIST_WIDGET_NOCARGOWAITING].right += num_active * 14;
+ w->widget[STATIONLIST_WIDGET_CARGOALL].left += num_active * 14;
+ w->widget[STATIONLIST_WIDGET_CARGOALL].right += num_active * 14;
+ w->widget[13].left += num_active * 14;
+
+ if (num_active > 15) {
+ /* Resize and fix the minimum width, if necessary */
+ w->Resize((num_active - 15) * 14, 0);
+ w->resize.width = w->Width();
+ }
}
static const OldWidget _station_view_expanded_widgets[] = {
@@ -630,8 +707,7 @@
y += 10;
}
- CargoID i = 0;
- do {
+ for (CargoID i = 0; i != NUM_CARGO && pos > -5; i++) {
uint waiting = GB(st->goods[i].waiting_acceptance, 0, 12);
if (waiting == 0) continue;
@@ -667,7 +743,7 @@
y += 10;
}
}
- } while (pos > -5 && ++i != NUM_CARGO);
+ }
if (w->IsOfPrototype(_station_view_widgets)) {
char *b = _userstring;
@@ -746,13 +822,13 @@
case 10: { /* Show a list of scheduled trains to this station */
const Station *st = GetStation(w->window_number);
- ShowVehicleListWindow(st->owner, VEH_Train, (StationID)w->window_number);
+ ShowVehicleListWindow(st->owner, VEH_TRAIN, (StationID)w->window_number);
break;
}
case 11: { /* Show a list of scheduled road-vehicles to this station */
const Station *st = GetStation(w->window_number);
- ShowVehicleListWindow(st->owner, VEH_Road, (StationID)w->window_number);
+ ShowVehicleListWindow(st->owner, VEH_ROAD, (StationID)w->window_number);
break;
}
@@ -760,7 +836,7 @@
const Station *st = GetStation(w->window_number);
/* Since oilrigs have no owners, show the scheduled aircraft of current player */
PlayerID owner = (st->owner == OWNER_NONE) ? _current_player : st->owner;
- ShowVehicleListWindow(owner, VEH_Aircraft, (StationID)w->window_number);
+ ShowVehicleListWindow(owner, VEH_AIRCRAFT, (StationID)w->window_number);
break;
}
@@ -768,7 +844,7 @@
const Station *st = GetStation(w->window_number);
/* Since oilrigs/bouys have no owners, show the scheduled ships of current player */
PlayerID owner = (st->owner == OWNER_NONE) ? _current_player : st->owner;
- ShowVehicleListWindow(owner, VEH_Ship, (StationID)w->window_number);
+ ShowVehicleListWindow(owner, VEH_SHIP, (StationID)w->window_number);
break;
}
}
--- a/src/station_map.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/station_map.h Sun Mar 11 16:31:18 2007 +0000
@@ -58,16 +58,16 @@
BUS_SIZE_EXT = GFX_BASE_END - GFX_BUS_BASE_EXT,
};
-typedef enum HangarTiles {
+enum HangarTile {
HANGAR_TILE_0 = 32,
HANGAR_TILE_1 = 65,
HANGAR_TILE_2 = 86,
HANGAR_TILE_3 = 129, // added for west facing hangar
HANGAR_TILE_4 = 130, // added for north facing hangar
HANGAR_TILE_5 = 131 // added for east facing hangar
-} HangarTiles;
+};
-typedef enum StationType {
+enum StationType {
STATION_RAIL,
STATION_AIRPORT,
STATION_TRUCK,
@@ -75,7 +75,7 @@
STATION_OILRIG,
STATION_DOCK,
STATION_BUOY
-} StationType;
+};
StationType GetStationType(TileIndex);
--- a/src/stdafx.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/stdafx.h Sun Mar 11 16:31:18 2007 +0000
@@ -8,8 +8,14 @@
* does not have stdint.h and apparently neither does MorphOS, so define
* INT64_MAX for them ourselves. */
#if !defined(_MSC_VER) && !defined( __MORPHOS__)
-# define __STDC_LIMIT_MACROS
-# include <stdint.h>
+# if defined (SUNOS)
+/* SunOS/Solaris does not have stdint.h, but inttypes.h defines everything
+ * stdint.h defines and we need. */
+# include <inttypes.h>
+# else
+# define __STDC_LIMIT_MACROS
+# include <stdint.h>
+# endif
#else
# define INT64_MAX 9223372036854775807LL
#endif
@@ -194,14 +200,16 @@
* call to the same function and is not thread- or reentrancy-safe */
#if !defined(STRGEN)
# if defined(WIN32) || defined(WIN64)
-# if defined(WINCE)
+# include <tchar.h>
/* XXX - WinCE without MSVCRT doesn't support wfopen, so it seems */
-# else
-# define fopen(file, mode) _wfopen(OTTD2FS(file), L ## mode)
-# endif
- const char *FS2OTTD(const wchar_t *name);
- const wchar_t *OTTD2FS(const char *name);
+# if !defined(WINCE)
+# define fopen(file, mode) _tfopen(OTTD2FS(file), _T(mode))
+# endif /* WINCE */
+
+ const char *FS2OTTD(const TCHAR *name);
+ const TCHAR *OTTD2FS(const char *name);
# else
+
# define fopen(file, mode) fopen(OTTD2FS(file), mode)
const char *FS2OTTD(const char *name);
const char *OTTD2FS(const char *name);
--- a/src/strgen/strgen.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/strgen/strgen.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -31,7 +31,7 @@
typedef void (*ParseCmdProc)(char *buf, int value);
-typedef struct LanguagePackHeader {
+struct LanguagePackHeader {
uint32 ident;
uint32 version; // 32-bits of auto generated version info which is basically a hash of strings.h
char name[32]; // the international name of this language
@@ -40,15 +40,15 @@
uint16 offsets[32]; // the offsets
byte plural_form; // plural form index
byte pad[3]; // pad header to be a multiple of 4
-} LanguagePackHeader;
+};
-typedef struct CmdStruct {
+struct CmdStruct {
const char *cmd;
ParseCmdProc proc;
long value;
int8 consumes;
byte flags;
-} CmdStruct;
+};
enum {
C_DONTCOUNT = 1,
@@ -56,11 +56,11 @@
};
-typedef struct Case {
+struct Case {
int caseidx;
char *string;
- struct Case *next;
-} Case;
+ Case *next;
+};
static bool _masterlang;
static bool _translated;
@@ -68,7 +68,7 @@
static int _cur_line;
static int _errors, _warnings;
-typedef struct LangString {
+struct LangString {
char *name; // Name of the string
char *english; // English text
char *translated; // Translated text
@@ -77,7 +77,7 @@
int line; // line of string in source-file
Case *english_case; // cases for english
Case *translated_case; // cases for foreign
-} LangString;
+};
static LangString *_strings[65536];
@@ -106,16 +106,16 @@
static const char *_cur_ident;
-typedef struct CmdPair {
+struct CmdPair {
const CmdStruct *a;
const char *v;
-} CmdPair;
+};
-typedef struct ParsedCommandStruct {
+struct ParsedCommandStruct {
int np;
CmdPair pairs[32];
const CmdStruct *cmd[32]; // ordered by param #
-} ParsedCommandStruct;
+};
// Used when generating some advanced commands.
static ParsedCommandStruct _cur_pcs;
@@ -938,7 +938,7 @@
// make a hash of the file to get a unique "version number"
-static void MakeHashOfStrings(void)
+static void MakeHashOfStrings()
{
uint32 hash = 0;
uint i;
@@ -1069,7 +1069,7 @@
return sum;
}
-static void PutArgidxCommand(void)
+static void PutArgidxCommand()
{
PutUtf8(SCC_ARG_INDEX);
PutByte(TranslateArgumentIdx(_cur_argidx));
--- a/src/string.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/string.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -268,3 +268,30 @@
*buf = '?';
return 1;
}
+
+/**
+ * Properly terminate an UTF8 string to some maximum length
+ * @param s string to check if it needs additional trimming
+ * @param maxlen the maximum length the buffer can have.
+ * @return the new length in bytes of the string (eg. strlen(new_string))
+ * @NOTE maxlen is the string length _INCLUDING_ the terminating '\0'
+ */
+size_t Utf8TrimString(char *s, size_t maxlen)
+{
+ size_t length = 0;
+
+ for (const char *ptr = strchr(s, '\0'); *s != '\0';) {
+ size_t len = Utf8EncodedCharLen(*s);
+ /* Silently ignore invalid UTF8 sequences, our only concern trimming */
+ if (len == 0) len = 1;
+
+ /* Take care when a hard cutoff was made for the string and
+ * the last UTF8 sequence is invalid */
+ if (length + len >= maxlen || (s + len > ptr)) break;
+ s += len;
+ length += len;
+ }
+
+ *s = '\0';
+ return length;
+}
--- a/src/string.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/string.h Sun Mar 11 16:31:18 2007 +0000
@@ -37,11 +37,11 @@
/**
* Valid filter types for IsValidChar.
*/
-typedef enum CharSetFilter {
+enum CharSetFilter {
CS_ALPHANUMERAL, //! Both numeric and alphabetic and spaces and stuff
CS_NUMERAL, //! Only numeric ones
CS_ALPHA, //! Only alphabetic values
-} CharSetFilter;
+};
/** Convert the given string to lowercase, only works with ASCII! */
void strtolower(char *str);
@@ -74,6 +74,7 @@
size_t Utf8Decode(WChar *c, const char *s);
size_t Utf8Encode(char *buf, WChar c);
+size_t Utf8TrimString(char *s, size_t maxlen);
static inline WChar Utf8Consume(const char **s)
@@ -100,6 +101,23 @@
}
+/**
+ * Return the length of an UTF-8 encoded value based on a single char. This
+ * char should be the first byte of the UTF-8 encoding. If not, or encoding
+ * is invalid, return value is 0
+ */
+static inline size_t Utf8EncodedCharLen(char c)
+{
+ if (GB(c, 3, 5) == 0x1E) return 4;
+ if (GB(c, 4, 4) == 0x0E) return 3;
+ if (GB(c, 5, 3) == 0x06) return 2;
+ if (GB(c, 7, 1) == 0x00) return 1;
+
+ /* Invalid UTF8 start encoding */
+ return 0;
+}
+
+
/* Check if the given character is part of a UTF8 sequence */
static inline bool IsUtf8Part(char c)
{
@@ -107,25 +125,17 @@
}
/**
- * Retrieve the (partial) length of the previous UNICODE character
- * in an UTF-8 encoded string.
- * @param s char pointer pointing to the first char of the next character
- * @returns the decoded length in bytes (size) of the UNICODE character
- * that was just before the one where 's' is pointing to
- * @note If 's' is not pointing to the first byte of the next UNICODE character
- * only a partial length of the sequence will be returned.
- * For example given this sequence: 0xE3 0x85 0x80, 0xE3 0x81 0x9E
- * 1. 's' is pointing to the second 0xE3, return value is 3
- * 2. 's' is pointing to 0x80, return value is 2.
- * So take care with the return values of this function. To get the real length
- * for an (invalid) sequence, pass the string offset of this function's return
- * value to Utf8EncodedCharLen() or Utf8Decode()
+ * Retrieve the previous UNICODE character in an UTF-8 encoded string.
+ * @param s char pointer pointing to (the first char of) the next character
+ * @returns a pointer in 's' to the previous UNICODE character's first byte
+ * @note The function should not be used to determine the length of the previous
+ * encoded char because it might be an invalid/corrupt start-sequence
*/
-static inline size_t Utf8PrevCharLen(const char *s)
+static inline char *Utf8PrevChar(const char *s)
{
- size_t len = 1;
- while (IsUtf8Part(*--s)) len++;
- return len;
+ const char *ret = s;
+ while (IsUtf8Part(*--ret));
+ return (char*)ret;
}
@@ -137,5 +147,20 @@
return true;
}
+/**
+ * Check whether UNICODE character is whitespace or not
+ * @param c UNICODE character to check
+ * @return a boolean value whether 'c' is a whitespace character or not
+ * @see http://www.fileformat.info/info/unicode/category/Zs/list.htm
+ */
+static inline bool IsWhitespace(WChar c)
+{
+ return
+ c == 0x0020 /* SPACE */ ||
+ c == 0x00A0 /* NO-BREAK SPACE */ ||
+ c == 0x3000 /* IDEOGRAPHIC SPACE */
+ ;
+}
+
#endif /* STRING_H */
--- a/src/strings.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/strings.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -35,7 +35,7 @@
static char *FormatString(char *buff, const char *str, const int32 *argv, uint casei, const char* last);
-typedef struct LanguagePack {
+struct LanguagePack {
uint32 ident;
uint32 version; // 32-bits of auto generated version info which is basically a hash of strings.h
char name[32]; // the international name of this language
@@ -45,7 +45,7 @@
byte plural_form; // how to compute plural forms
byte pad[3]; // pad header to be a multiple of 4
char data[VARARRAY_SIZE];
-} LanguagePack;
+};
static char **_langpack_offs;
static LanguagePack *_langpack;
@@ -461,7 +461,7 @@
return b + pos;
}
-typedef struct Units {
+struct Units {
int s_m; ///< Multiplier for velocity
int s_s; ///< Shift for velocity
StringID velocity; ///< String for velocity
@@ -479,7 +479,7 @@
int f_m; ///< Multiplier for force
int f_s; ///< Shift for force
StringID force; ///< String for force
-} Units;
+};
/* Unit conversions */
static const Units units[] = {
@@ -1180,7 +1180,7 @@
}
// make a list of the available language packs. put the data in _dynlang struct.
-void InitializeLanguagePacks(void)
+void InitializeLanguagePacks()
{
DynamicLanguages *dl = &_dynlang;
int i;
--- a/src/strings.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/strings.h Sun Mar 11 16:31:18 2007 +0000
@@ -9,6 +9,6 @@
extern char _userstring[128];
void InjectDParam(int amount);
-int32 GetParamInt32(void);
+int32 GetParamInt32();
#endif /* STRINGS_H */
--- a/src/subsidy_gui.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/subsidy_gui.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -170,7 +170,7 @@
};
-void ShowSubsidiesList(void)
+void ShowSubsidiesList()
{
BaseWindow::AllocateFront(&_subsidies_list_desc, 0);
}
--- a/src/table/ai_rail.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/table/ai_rail.h Sun Mar 11 16:31:18 2007 +0000
@@ -1,24 +1,24 @@
/* $Id$ */
-typedef struct {
+struct AiDefaultBlockData {
byte mode;
byte attr;
TileIndexDiffC tileoffs;
-} AiDefaultBlockData;
+};
-typedef struct {
+struct AiDefaultRailBlock {
byte p0;
byte p1;
byte p2;
byte p3;
byte dir;
const AiDefaultBlockData *data;
-} AiDefaultRailBlock;
+};
-typedef struct {
+struct AiDefaultRoadBlock {
byte dir;
const AiDefaultBlockData *data;
-} AiDefaultRoadBlock;
+};
#define MKHDR(a,b,c,d,e) a,b,c,d,e,
--- a/src/table/build_industry.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/table/build_industry.h Sun Mar 11 16:31:18 2007 +0000
@@ -1068,7 +1068,7 @@
/* Procedures that can be run to check whether an industry may
* build at location the given to the procedure */
-typedef enum CheckProcs {
+enum CheckProc {
CHECK_NOTHING = 0,
CHECK_FOREST = 1,
CHECK_REFINERY = 2,
@@ -1079,11 +1079,11 @@
CHECK_BUBBLEGEN = 7,
CHECK_OIL_RIG = 8,
CHECK_END,
-} CheckProc;
+};
-#define MK(tbl, d, c1, c2, c3, proc, p1, r1, p2, r2, m, a1, a2, a3, pr, clim, in, s1, s2, s3) \
+#define MK(tbl, d, c1, c2, c3, proc, p1, r1, p2, r2, m, a1, a2, a3, pr, clim, in, intx, s1, s2, s3) \
{tbl, lengthof(tbl), d, {c1, c2, c3}, proc, {p1, p2}, {r1, r2}, m, \
- {a1, a2, a3}, pr, clim, in, s1, s2, s3}
+ {a1, a2, a3}, pr, clim, in, intx, s1, s2, s3}
static const IndustrySpec _industry_specs[] = {
/* Format:
@@ -1092,14 +1092,14 @@
(produced cargo + rate) (twice) minimum cargo moved to station
3 accepted cargo
industry life climate availability
- industry name
+ industry name building text
messages : Closure production up production down */
MK(_tile_table_coal_mine, 210,
IT_POWER_STATION, IT_INVALID, IT_INVALID, CHECK_NOTHING,
CT_COAL, 15, CT_INVALID, 0, 5,
CT_INVALID, CT_INVALID, CT_INVALID,
INDUSTRYLIFE_PRODUCTION, 1 << LT_NORMAL | 1 << LT_HILLY,
- STR_4802_COAL_MINE,
+ STR_4802_COAL_MINE, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4836_NEW_COAL_SEAM_FOUND_AT, STR_4839_PRODUCTION_DOWN_BY_50),
MK(_tile_table_power_station, 30,
@@ -1107,7 +1107,7 @@
CT_INVALID, 0, CT_INVALID, 0, 5,
CT_COAL, CT_INVALID, CT_INVALID,
INDUSTRYLIFE_NOT_CLOSABLE, 1 << LT_NORMAL | 1 << LT_HILLY,
- STR_4803_POWER_STATION,
+ STR_4803_POWER_STATION, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
MK(_tile_table_sawmill, 28,
@@ -1115,7 +1115,7 @@
CT_GOODS, 0, CT_INVALID, 0, 5,
CT_WOOD, CT_INVALID, CT_INVALID,
INDUSTRYLIFE_CLOSABLE, 1 << LT_NORMAL,
- STR_4804_SAWMILL,
+ STR_4804_SAWMILL, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
MK(_tile_table_forest, 200,
@@ -1123,7 +1123,7 @@
CT_WOOD, 13, CT_INVALID, 0, 30,
CT_INVALID, CT_INVALID, CT_INVALID,
INDUSTRYLIFE_PRODUCTION, 1 << LT_NORMAL | 1 << LT_HILLY,
- STR_4805_FOREST,
+ STR_4805_FOREST, STR_482E_NEW_BEING_PLANTED_NEAR,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_483A_INSECT_INFESTATION_CAUSES),
MK(_tile_table_oil_refinery, 31,
@@ -1131,7 +1131,7 @@
CT_GOODS, 0, CT_INVALID, 0, 5,
CT_OIL, CT_INVALID, CT_INVALID,
INDUSTRYLIFE_CLOSABLE, 1 << LT_NORMAL | 1 << LT_HILLY | 1 << LT_DESERT,
- STR_4806_OIL_REFINERY,
+ STR_4806_OIL_REFINERY, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
MK(_tile_table_oil_rig, 240,
@@ -1139,7 +1139,7 @@
CT_OIL, 15, CT_PASSENGERS, 2, 5,
CT_INVALID, CT_INVALID, CT_INVALID,
INDUSTRYLIFE_PRODUCTION, 1 << LT_NORMAL,
- STR_4807_OIL_RIG,
+ STR_4807_OIL_RIG, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4837_NEW_OIL_RESERVES_FOUND, STR_4839_PRODUCTION_DOWN_BY_50),
MK(_tile_table_factory, 26,
@@ -1147,7 +1147,7 @@
CT_GOODS, 0, CT_INVALID, 0, 5,
CT_LIVESTOCK, CT_GRAIN, CT_STEEL,
INDUSTRYLIFE_CLOSABLE, 1 << LT_NORMAL,
- STR_4808_FACTORY,
+ STR_4808_FACTORY, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
MK(_tile_table_printing_works, 26,
@@ -1155,7 +1155,7 @@
CT_GOODS, 0, CT_INVALID, 0, 5,
CT_PAPER, CT_INVALID, CT_INVALID,
INDUSTRYLIFE_CLOSABLE, 1 << LT_HILLY,
- STR_4809_PRINTING_WORKS,
+ STR_4809_PRINTING_WORKS, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
MK(_tile_table_steel_mill, 27,
@@ -1163,7 +1163,7 @@
CT_STEEL, 0, CT_INVALID, 0, 5,
CT_IRON_ORE, CT_INVALID, CT_INVALID,
INDUSTRYLIFE_CLOSABLE, 1 << LT_NORMAL,
- STR_480A_STEEL_MILL,
+ STR_480A_STEEL_MILL, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
MK(_tile_table_farm, 250,
@@ -1171,7 +1171,7 @@
CT_GRAIN, 10, CT_LIVESTOCK, 10, 5,
CT_INVALID, CT_INVALID, CT_INVALID,
INDUSTRYLIFE_PRODUCTION, 1 << LT_NORMAL | 1 << LT_HILLY,
- STR_480B_FARM,
+ STR_480B_FARM, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4838_IMPROVED_FARMING_METHODS, STR_483A_INSECT_INFESTATION_CAUSES),
MK(_tile_table_copper_mine, 205,
@@ -1179,7 +1179,7 @@
CT_COPPER_ORE, 10, CT_INVALID, 0, 5,
CT_INVALID, CT_INVALID, CT_INVALID,
INDUSTRYLIFE_PRODUCTION, 1 << LT_DESERT,
- STR_480C_COPPER_ORE_MINE,
+ STR_480C_COPPER_ORE_MINE, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
MK(_tile_table_oil_well, 220,
@@ -1187,7 +1187,7 @@
CT_OIL, 12, CT_INVALID, 0, 5,
CT_INVALID, CT_INVALID, CT_INVALID,
INDUSTRYLIFE_PRODUCTION, 1 << LT_NORMAL | 1 << LT_HILLY | 1 << LT_DESERT,
- STR_480D_OIL_WELLS,
+ STR_480D_OIL_WELLS, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4837_NEW_OIL_RESERVES_FOUND, STR_4839_PRODUCTION_DOWN_BY_50),
MK(_tile_table_bank, 193,
@@ -1195,7 +1195,7 @@
CT_VALUABLES, 6, CT_INVALID, 0, 5,
CT_VALUABLES, CT_INVALID, CT_INVALID,
INDUSTRYLIFE_NOT_CLOSABLE, 1 << LT_NORMAL,
- STR_480E_BANK,
+ STR_480E_BANK, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
MK(_tile_table_food_process, 26,
@@ -1203,7 +1203,7 @@
CT_FOOD, 0, CT_INVALID, 0, 5,
CT_FRUIT, CT_MAIZE, CT_INVALID,
INDUSTRYLIFE_CLOSABLE, 1 << LT_HILLY | 1 << LT_DESERT,
- STR_480F_FOOD_PROCESSING_PLANT,
+ STR_480F_FOOD_PROCESSING_PLANT, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
MK(_tile_table_paper_mill, 28,
@@ -1211,7 +1211,7 @@
CT_PAPER, 0, CT_INVALID, 0, 5,
CT_WOOD, CT_INVALID, CT_INVALID,
INDUSTRYLIFE_CLOSABLE, 1 << LT_HILLY,
- STR_4810_PAPER_MILL,
+ STR_4810_PAPER_MILL, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
MK(_tile_table_gold_mine, 208,
@@ -1219,7 +1219,7 @@
CT_GOLD, 7, CT_INVALID, 0, 5,
CT_INVALID, CT_INVALID, CT_INVALID,
INDUSTRYLIFE_PRODUCTION, 1 << LT_DESERT,
- STR_4811_GOLD_MINE,
+ STR_4811_GOLD_MINE, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
MK(_tile_table_bank2, 19,
@@ -1227,7 +1227,7 @@
CT_INVALID, 0, CT_INVALID, 0, 5,
CT_GOLD, CT_INVALID, CT_INVALID,
INDUSTRYLIFE_NOT_CLOSABLE, 1 << LT_HILLY | 1 << LT_DESERT,
- STR_4812_BANK,
+ STR_4812_BANK, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
MK(_tile_table_diamond_mine, 213,
@@ -1235,7 +1235,7 @@
CT_DIAMONDS, 7, CT_INVALID, 0, 5,
CT_INVALID, CT_INVALID, CT_INVALID,
INDUSTRYLIFE_PRODUCTION, 1 << LT_DESERT,
- STR_4813_DIAMOND_MINE,
+ STR_4813_DIAMOND_MINE, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
MK(_tile_table_iron_mine, 220,
@@ -1243,7 +1243,7 @@
CT_IRON_ORE, 10, CT_INVALID, 0, 5,
CT_INVALID, CT_INVALID, CT_INVALID,
INDUSTRYLIFE_PRODUCTION, 1 << LT_NORMAL,
- STR_4814_IRON_ORE_MINE,
+ STR_4814_IRON_ORE_MINE, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
MK(_tile_table_fruit_plantation, 225,
@@ -1251,7 +1251,7 @@
CT_FRUIT, 10, CT_INVALID, 0, 15,
CT_INVALID, CT_INVALID, CT_INVALID,
INDUSTRYLIFE_PRODUCTION, 1 << LT_DESERT,
- STR_4815_FRUIT_PLANTATION,
+ STR_4815_FRUIT_PLANTATION, STR_482E_NEW_BEING_PLANTED_NEAR,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4838_IMPROVED_FARMING_METHODS, STR_483A_INSECT_INFESTATION_CAUSES),
MK(_tile_table_rubber_plantation, 218,
@@ -1259,7 +1259,7 @@
CT_RUBBER, 10, CT_INVALID, 0, 15,
CT_INVALID, CT_INVALID, CT_INVALID,
INDUSTRYLIFE_PRODUCTION, 1 << LT_DESERT,
- STR_4816_RUBBER_PLANTATION,
+ STR_4816_RUBBER_PLANTATION, STR_482E_NEW_BEING_PLANTED_NEAR,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4838_IMPROVED_FARMING_METHODS, STR_483A_INSECT_INFESTATION_CAUSES),
MK(_tile_table_water_supply, 199,
@@ -1267,7 +1267,7 @@
CT_WATER, 12, CT_INVALID, 0, 5,
CT_INVALID, CT_INVALID, CT_INVALID,
INDUSTRYLIFE_PRODUCTION, 1 << LT_DESERT,
- STR_4817_WATER_SUPPLY,
+ STR_4817_WATER_SUPPLY, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
MK(_tile_table_water_tower, 14,
@@ -1275,7 +1275,7 @@
CT_INVALID, 0, CT_INVALID, 0, 5,
CT_WATER, CT_INVALID, CT_INVALID,
INDUSTRYLIFE_NOT_CLOSABLE, 1 << LT_DESERT,
- STR_4818_WATER_TOWER,
+ STR_4818_WATER_TOWER, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
MK(_tile_table_factory2, 26,
@@ -1283,7 +1283,7 @@
CT_GOODS, 0, CT_INVALID, 0, 5,
CT_RUBBER, CT_COPPER_ORE, CT_WOOD,
INDUSTRYLIFE_CLOSABLE, 1 << LT_DESERT,
- STR_4819_FACTORY,
+ STR_4819_FACTORY, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
MK(_tile_table_farm2, 250,
@@ -1291,7 +1291,7 @@
CT_MAIZE, 11, CT_INVALID, 0, 5,
CT_INVALID, CT_INVALID, CT_INVALID,
INDUSTRYLIFE_PRODUCTION, 1 << LT_DESERT,
- STR_481A_FARM,
+ STR_481A_FARM, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4838_IMPROVED_FARMING_METHODS, STR_483A_INSECT_INFESTATION_CAUSES),
MK(_tile_table_lumber_mill, 17,
@@ -1299,7 +1299,7 @@
CT_WOOD, 0, CT_INVALID, 0, 5,
CT_INVALID, CT_INVALID, CT_INVALID,
INDUSTRYLIFE_CLOSABLE, 1 << LT_DESERT,
- STR_481B_LUMBER_MILL,
+ STR_481B_LUMBER_MILL, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4834_LACK_OF_NEARBY_TREES_CAUSES, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
MK(_tile_table_cotton_candy, 195,
@@ -1307,7 +1307,7 @@
CT_COTTON_CANDY, 13, CT_INVALID, 0, 30,
CT_INVALID, CT_INVALID, CT_INVALID,
INDUSTRYLIFE_PRODUCTION, 1 << LT_CANDY,
- STR_481C_COTTON_CANDY_FOREST,
+ STR_481C_COTTON_CANDY_FOREST, STR_482E_NEW_BEING_PLANTED_NEAR,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4838_IMPROVED_FARMING_METHODS, STR_4839_PRODUCTION_DOWN_BY_50),
MK(_tile_table_candy_factory, 26,
@@ -1315,7 +1315,7 @@
CT_CANDY, 0, CT_INVALID, 0, 5,
CT_SUGAR, CT_TOFFEE, CT_COTTON_CANDY,
INDUSTRYLIFE_CLOSABLE, 1 << LT_CANDY,
- STR_481D_CANDY_FACTORY,
+ STR_481D_CANDY_FACTORY, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
MK(_tile_table_battery_farm, 187,
@@ -1323,7 +1323,7 @@
CT_BATTERIES, 11, CT_INVALID, 0, 30,
CT_INVALID, CT_INVALID, CT_INVALID,
INDUSTRYLIFE_PRODUCTION, 1 << LT_CANDY,
- STR_481E_BATTERY_FARM,
+ STR_481E_BATTERY_FARM, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4838_IMPROVED_FARMING_METHODS, STR_483A_INSECT_INFESTATION_CAUSES),
MK(_tile_table_cola_wells, 193,
@@ -1331,7 +1331,7 @@
CT_COLA, 12, CT_INVALID, 0, 5,
CT_INVALID, CT_INVALID, CT_INVALID,
INDUSTRYLIFE_PRODUCTION, 1 << LT_CANDY,
- STR_481F_COLA_WELLS,
+ STR_481F_COLA_WELLS, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
MK(_tile_table_toy_shop, 17,
@@ -1339,7 +1339,7 @@
CT_INVALID, 0, CT_INVALID, 0, 5,
CT_TOYS, CT_INVALID, CT_INVALID,
INDUSTRYLIFE_NOT_CLOSABLE, 1 << LT_CANDY,
- STR_4820_TOY_SHOP,
+ STR_4820_TOY_SHOP, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
MK(_tile_table_toy_factory, 20,
@@ -1347,7 +1347,7 @@
CT_TOYS, 0, CT_INVALID, 0, 5,
CT_PLASTIC, CT_BATTERIES, CT_INVALID,
INDUSTRYLIFE_CLOSABLE, 1 << LT_CANDY,
- STR_4821_TOY_FACTORY,
+ STR_4821_TOY_FACTORY, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
MK(_tile_table_plastic_fountain, 192,
@@ -1355,7 +1355,7 @@
CT_PLASTIC, 14, CT_INVALID, 0, 5,
CT_INVALID, CT_INVALID, CT_INVALID,
INDUSTRYLIFE_PRODUCTION, 1 << LT_CANDY,
- STR_4822_PLASTIC_FOUNTAINS,
+ STR_4822_PLASTIC_FOUNTAINS, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
MK(_tile_table_fizzy_drink, 22,
@@ -1363,7 +1363,7 @@
CT_FIZZY_DRINKS, 0, CT_INVALID, 0, 5,
CT_COLA, CT_BUBBLES, CT_INVALID,
INDUSTRYLIFE_CLOSABLE, 1 << LT_CANDY,
- STR_4823_FIZZY_DRINK_FACTORY,
+ STR_4823_FIZZY_DRINK_FACTORY, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4833_SUPPLY_PROBLEMS_CAUSE_TO, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
MK(_tile_table_bubble_generator, 203,
@@ -1371,7 +1371,7 @@
CT_BUBBLES, 13, CT_INVALID, 0, 5,
CT_INVALID, CT_INVALID, CT_INVALID,
INDUSTRYLIFE_PRODUCTION, 1 << LT_CANDY,
- STR_4824_BUBBLE_GENERATOR,
+ STR_4824_BUBBLE_GENERATOR, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
MK(_tile_table_toffee_quarry, 213,
@@ -1379,7 +1379,7 @@
CT_TOFFEE, 10, CT_INVALID, 0, 5,
CT_INVALID, CT_INVALID, CT_INVALID,
INDUSTRYLIFE_PRODUCTION, 1 << LT_CANDY,
- STR_4825_TOFFEE_QUARRY,
+ STR_4825_TOFFEE_QUARRY, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
MK(_tile_table_sugar_mine, 210,
@@ -1387,7 +1387,7 @@
CT_SUGAR, 11, CT_INVALID, 0, 5,
CT_INVALID, CT_INVALID, CT_INVALID,
INDUSTRYLIFE_PRODUCTION, 1 << LT_CANDY,
- STR_4826_SUGAR_MINE,
+ STR_4826_SUGAR_MINE, STR_482D_NEW_UNDER_CONSTRUCTION,
STR_4832_ANNOUNCES_IMMINENT_CLOSURE, STR_4835_INCREASES_PRODUCTION, STR_4839_PRODUCTION_DOWN_BY_50),
};
#undef MK
--- a/src/table/elrail_data.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/table/elrail_data.h Sun Mar 11 16:31:18 2007 +0000
@@ -7,23 +7,23 @@
/** Tile Location group.
* This defines whether the X and or Y coordinate of a tile is even */
-typedef enum TLG {
+enum TLG {
XEVEN_YEVEN = 0,
XEVEN_YODD = 1,
XODD_YEVEN = 2,
XODD_YODD = 3,
TLG_END
-} TLG;
+};
/** When determining the pylon configuration on the edge, two tiles are taken
* into account: the tile being drawn itself (the home tile, the one in
* ti->tile), and the neighbouring tile */
-typedef enum {
+enum TileSource {
TS_HOME = 0,
TS_NEIGHBOUR = 1,
TS_END
-} TileSource;
+};
enum {
NUM_TRACKS_AT_PCP = 6
@@ -253,7 +253,7 @@
SPR_PYLON_Y_SW
};
-typedef struct {
+struct SortableSpriteStruct {
SpriteID image;
int8 x_offset;
int8 y_offset;
@@ -261,7 +261,7 @@
int8 y_size;
int8 z_size;
int8 z_offset;
-} SortableSpriteStruct;
+};
enum {
/** Distance between wire and rail */
@@ -340,6 +340,14 @@
{ SPR_WIRE_DEPOT_NW, 8, 0, 1, 8, 1, ELRAIL_ELEVATION } //! Wire for NW depot exit
};
+static const SortableSpriteStruct CatenarySpriteData_Tunnel[] = {
+ { SPR_WIRE_TUNNEL_NE, 0, 8, 8, 1, 1, ELRAIL_ELEVATION }, //! Wire for NE tunnel exit
+ { SPR_WIRE_TUNNEL_SE, 8, 0, 1, 8, 1, ELRAIL_ELEVATION }, //! Wire for SE tunnel exit
+ { SPR_WIRE_TUNNEL_SW, 0, 8, 8, 1, 1, ELRAIL_ELEVATION }, //! Wire for SW tunnel exit
+ { SPR_WIRE_TUNNEL_NW, 8, 0, 1, 8, 1, ELRAIL_ELEVATION } //! Wire for NW tunnel exit
+};
+
+
/** Refers to a certain element of the catenary.
* Identifiers for Wires:
* <ol><li>Direction of the wire</li>
@@ -351,7 +359,7 @@
* <li>Position of the Pylon relative to the track</li>
* <li>Position of the Pylon inside the tile</li></ol>
*/
-typedef enum {
+enum CatenarySprite {
WIRE_X_FLAT_SW,
WIRE_X_FLAT_NE,
WIRE_X_FLAT_BOTH,
@@ -395,7 +403,7 @@
WIRE_EW_S_E,
INVALID_CATENARY = 0xFF
-} CatenarySprite;
+};
/* Selects a Wire (with white and grey ends) depending on whether:
* a) none (should never happen)
--- a/src/table/industry_land.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/table/industry_land.h Sun Mar 11 16:31:18 2007 +0000
@@ -1,17 +1,17 @@
/* $Id$ */
-typedef struct DrawIndustrySpec1Struct {
+struct DrawIndustrySpec1Struct {
byte x;
byte image_1;
byte image_2;
byte image_3;
-} DrawIndustrySpec1Struct;
+};
-typedef struct DrawIndustrySpec4Struct {
+struct DrawIndustrySpec4Struct {
byte image_1;
byte image_2;
byte image_3;
-} DrawIndustrySpec4Struct;
+};
#define M(s1, p1, s2, p2, sx, sy, w, h, dz, p) { { s1, p1 }, { s2, p2 }, sx, sy, w - 1, h - 1, dz, p }
--- a/src/table/namegen.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/table/namegen.h Sun Mar 11 16:31:18 2007 +0000
@@ -1690,7 +1690,7 @@
* with cloning this for your own language. */
// Sing., pl.
-typedef enum CzechGender {
+enum CzechGender {
CZG_SMASC,
CZG_SFEM,
CZG_SNEUT,
@@ -1701,12 +1701,14 @@
CZG_FREE,
// Like CZG_FREE, but disallow CZG_SNEUT.
CZG_NFREE
-} CzechGender;
-typedef enum CzechPattern {
+};
+
+enum CzechPattern {
CZP_JARNI,
CZP_MLADY,
CZP_PRIVL
-} CzechPattern;
+};
+
/* [CzechGender][CzechPattern] - replaces the last character of the adjective
* by this. */
// XXX: [CZG_SMASC][CZP_PRIVL] needs special handling: -ovX -> -uv.
@@ -1721,38 +1723,38 @@
// This way the substantives can choose only some adjectives/endings:
// At least one of these flags must be satisfied:
-typedef enum CzechAllow {
+enum CzechAllow {
CZA_SHORT = 1,
CZA_MIDDLE = 2,
CZA_LONG = 4,
CZA_ALL = ~0
-} CzechAllow;
+};
DECLARE_ENUM_AS_BIT_SET(CzechAllow);
// All these flags must be satisfied (in the stem->others direction):
-typedef enum CzechChoose {
+enum CzechChoose {
CZC_NONE = 0, // No requirements.
CZC_COLOR = 1,
CZC_POSTFIX = 2, // Matched if postfix was inserted.
CZC_NOPOSTFIX = 4, // Matched if no postfix was inserted.
CZC_ANY = ~0
-} CzechChoose;
+};
DECLARE_ENUM_AS_BIT_SET(CzechChoose);
-typedef struct CzechNameSubst {
+struct CzechNameSubst {
CzechGender gender;
CzechAllow allow;
CzechChoose choose;
const char *name;
-} CzechNameSubst;
+};
-typedef struct CzechNameAdj {
+struct CzechNameAdj {
CzechPattern pattern;
CzechChoose choose;
const char *name;
-} CzechNameAdj;
+};
// Some of items which should be common are doubled.
static const CzechNameAdj name_czech_adj[] = {
--- a/src/table/palettes.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/table/palettes.h Sun Mar 11 16:31:18 2007 +0000
@@ -141,7 +141,7 @@
#define GET_PALETTE(x) _palettes[x]
-typedef struct {
+struct ExtraPaletteValues {
Colour a[15]; // dark blue water
Colour ac[15]; // dark blue water Toyland
Colour lighthouse[12]; // lighthouse & stadium
@@ -149,7 +149,7 @@
Colour e[15]; // ???
Colour b[45]; // glittery water
Colour bc[45]; // glittery water Toyland
-} ExtraPaletteValues;
+};
static const ExtraPaletteValues _extra_palette_values = {
{ M( 32, 68, 112), M( 36, 72, 116), M( 40, 76, 120), M( 44, 80, 124),
@@ -173,10 +173,10 @@
#undef M
// Color table for colors in lang files (e.g. {BLACK})
-typedef struct StringColor {
+struct StringColor {
byte text;
byte shadow;
-} StringColor;
+};
static const StringColor _string_colormap[] = {
{ 150, 215 }, // BLUE
--- a/src/table/sprites.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/table/sprites.h Sun Mar 11 16:31:18 2007 +0000
@@ -291,6 +291,12 @@
SPR_WIRE_Y_NW_DOWN = SPR_ELRAIL_BASE + 26,
/* Tunnel entries */
+ SPR_WIRE_TUNNEL_NE = SPR_ELRAIL_BASE + 27,
+ SPR_WIRE_TUNNEL_SE = SPR_ELRAIL_BASE + 28,
+ SPR_WIRE_TUNNEL_SW = SPR_ELRAIL_BASE + 29,
+ SPR_WIRE_TUNNEL_NW = SPR_ELRAIL_BASE + 30,
+
+ /* Depot entries */
SPR_WIRE_DEPOT_SW = SPR_ELRAIL_BASE + 27,
SPR_WIRE_DEPOT_NW = SPR_ELRAIL_BASE + 28,
SPR_WIRE_DEPOT_NE = SPR_ELRAIL_BASE + 29,
@@ -1191,7 +1197,7 @@
};
/** Cursor sprite numbers */
-typedef enum CursorSprites {
+enum CursorSprite {
/* Terraform */
/* Cursors */
SPR_CURSOR_MOUSE = 0,
@@ -1278,7 +1284,7 @@
SPR_CURSOR_CLONE_ROADVEH = SPR_OPENTTD_BASE + 110,
SPR_CURSOR_CLONE_SHIP = SPR_OPENTTD_BASE + 112,
SPR_CURSOR_CLONE_AIRPLANE = SPR_OPENTTD_BASE + 114,
-} CursorSprite;
+};
/// Animation macro in table/animcursors.h (_animcursors[])
enum AnimCursors {
--- a/src/table/town_land.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/table/town_land.h Sun Mar 11 16:31:18 2007 +0000
@@ -2017,9 +2017,9 @@
assert_compile(lengthof(_housetype_remove_ratingmod) == HOUSE_MAX);
-typedef struct {
+struct HousetypeYear {
Year min, max;
-} HousetypeYear;
+};
static const HousetypeYear _housetype_years[] = {
{ 1963, MAX_YEAR },
--- a/src/table/tree_land.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/table/tree_land.h Sun Mar 11 16:31:18 2007 +0000
@@ -13,10 +13,10 @@
static const byte _tree_base_by_landscape[4] = {0, 12, 20, 32};
static const byte _tree_count_by_landscape[4] = {12, 8, 12, 9};
-typedef struct TreePos {
+struct TreePos {
uint8 x;
uint8 y;
-} TreePos;
+};
static const TreePos _tree_layout_xy[][4] = {
{ { 9, 3 }, { 1, 8 }, { 0, 0 }, { 8, 9 } },
--- a/src/table/unicode.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/table/unicode.h Sun Mar 11 16:31:18 2007 +0000
@@ -1,10 +1,10 @@
/* $Id$ */
-typedef struct DefaultUnicodeMapping {
+struct DefaultUnicodeMapping {
WChar code; ///< Unicode value
byte key; ///< Character index of sprite
-} DefaultUnicodeMapping;
+};
/* Default unicode mapping table for sprite based glyphs.
--- a/src/table/unmovable_land.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/table/unmovable_land.h Sun Mar 11 16:31:18 2007 +0000
@@ -1,6 +1,6 @@
/* $Id$ */
-typedef struct DrawTileUnmovableStruct {
+struct DrawTileUnmovableStruct {
uint16 image;
byte subcoord_x;
byte subcoord_y;
@@ -8,7 +8,7 @@
byte height;
byte z_size;
byte unused;
-} DrawTileUnmovableStruct;
+};
#define TILE_SEQ_END() { (byte)0x80, 0, 0, 0, 0, 0, 0, 0 }
--- a/src/table/water_land.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/table/water_land.h Sun Mar 11 16:31:18 2007 +0000
@@ -1,6 +1,6 @@
/* $Id$ */
-typedef struct WaterDrawTileStruct {
+struct WaterDrawTileStruct {
byte delta_x;
byte delta_y;
byte delta_z;
@@ -8,7 +8,7 @@
byte height;
byte unk;
SpriteID image;
-} WaterDrawTileStruct;
+};
#define BEGIN(image) { 0, 0, 0, 0, 0, 0, image }
#define END(y) { 0x80, y, 0, 0, 0, 0, 0 }
--- a/src/texteff.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/texteff.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -17,13 +17,13 @@
#include "date.h"
enum {
- MAX_TEXTMESSAGE_LENGTH = 150,
+ MAX_TEXTMESSAGE_LENGTH = 200,
MAX_TEXT_MESSAGES = 30,
MAX_CHAT_MESSAGES = 10,
MAX_ANIMATED_TILES = 256,
};
-typedef struct TextEffect {
+struct TextEffect {
StringID string_id;
int32 x;
int32 y;
@@ -32,14 +32,14 @@
uint16 duration;
uint32 params_1;
uint32 params_2;
-} TextEffect;
+};
-typedef struct TextMessage {
+struct TextMessage {
char message[MAX_TEXTMESSAGE_LENGTH];
uint16 color;
Date end_date;
-} TextMessage;
+};
static TextEffect _text_effect_list[MAX_TEXT_MESSAGES];
static TextMessage _textmsg_list[MAX_CHAT_MESSAGES];
@@ -55,7 +55,7 @@
extern void memcpy_pitch(void *dst, void *src, int w, int h, int srcpitch, int dstpitch);
-static inline uint GetTextMessageCount(void)
+static inline uint GetTextMessageCount()
{
uint i;
@@ -82,6 +82,9 @@
vsnprintf(buf, lengthof(buf), message, va);
va_end(va);
+
+ Utf8TrimString(buf, MAX_TEXTMESSAGE_LENGTH);
+
/* Force linebreaks for strings that are too long */
lines = GB(FormatStringLinebreaks(buf, _textmsg_box.width - 8), 0, 16) + 1;
if (lines >= MAX_CHAT_MESSAGES) return;
@@ -109,7 +112,7 @@
_textmessage_dirty = true;
}
-void InitTextMessage(void)
+void InitTextMessage()
{
uint i;
@@ -119,7 +122,7 @@
}
/* Hide the textbox */
-void UndrawTextMessage(void)
+void UndrawTextMessage()
{
if (_textmessage_visible) {
/* Sometimes we also need to hide the cursor
@@ -157,7 +160,7 @@
}
/* Check if a message is expired every day */
-void TextMessageDailyLoop(void)
+void TextMessageDailyLoop()
{
uint i;
@@ -181,7 +184,7 @@
}
/* Draw the textmessage-box */
-void DrawTextMessage(void)
+void DrawTextMessage()
{
uint y, count;
@@ -274,7 +277,7 @@
MarkTextEffectAreaDirty(te);
}
-void MoveAllTextEffects(void)
+void MoveAllTextEffects()
{
TextEffect *te;
@@ -283,7 +286,7 @@
}
}
-void InitTextEffects(void)
+void InitTextEffects()
{
TextEffect *te;
@@ -354,7 +357,7 @@
return false;
}
-void AnimateAnimatedTiles(void)
+void AnimateAnimatedTiles()
{
const TileIndex* ti;
@@ -363,12 +366,12 @@
}
}
-void InitializeAnimatedTiles(void)
+void InitializeAnimatedTiles()
{
memset(_animated_tile_list, 0, sizeof(_animated_tile_list));
}
-static void SaveLoad_ANIT(void)
+static void SaveLoad_ANIT()
{
/* In pre version 6, we has 16bit per tile, now we have 32bit per tile, convert it ;) */
if (CheckSavegameVersion(6)) {
--- a/src/tgp.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/tgp.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -165,14 +165,14 @@
static const int amplitude_decimal_bits = 10;
/** Height map - allocated array of heights (MapSizeX() + 1) x (MapSizeY() + 1) */
-typedef struct HeightMap
+struct HeightMap
{
height_t *h; //! array of heights
uint dim_x; //! height map size_x MapSizeX() + 1
uint total_size; //! height map total size
uint size_x; //! MapSizeX()
uint size_y; //! MapSizeY()
-} HeightMap;
+};
/** Global height map instance */
static HeightMap _height_map = {NULL, 0, 0, 0, 0};
@@ -229,7 +229,7 @@
/** Allocate array of (MapSizeX()+1)*(MapSizeY()+1) heights and init the _height_map structure members */
-static inline bool AllocHeightMap(void)
+static inline bool AllocHeightMap()
{
height_t *h;
@@ -249,7 +249,7 @@
}
/** Free height map */
-static inline void FreeHeightMap(void)
+static inline void FreeHeightMap()
{
if (_height_map.h == NULL) return;
free(_height_map.h);
@@ -321,7 +321,7 @@
}
/** Base Perlin noise generator - fills height map with raw Perlin noise */
-static void HeightMapGenerate(void)
+static void HeightMapGenerate()
{
uint size_min = min(_height_map.size_x, _height_map.size_y);
uint iteration_round = 0;
@@ -524,7 +524,7 @@
* Please note that all the small numbers; 53, 101, 167, etc. are small primes
* to help give the perlin noise a bit more of a random feel.
*/
-static void HeightMapCoastLines(void)
+static void HeightMapCoastLines()
{
int smallest_size = min(_patches.map_x, _patches.map_y);
const int margin = 4;
@@ -610,7 +610,7 @@
}
/** Smooth coasts by modulating height of tiles close to map edges with cosine of distance from edge */
-static void HeightMapSmoothCoasts(void)
+static void HeightMapSmoothCoasts()
{
uint x, y;
/* First Smooth NW and SE coasts (y close to 0 and y close to size_y) */
@@ -654,7 +654,7 @@
* - coast Smoothing
* - slope Smoothing
* - height histogram redistribution by sine wave transform */
-static void HeightMapNormalize(void)
+static void HeightMapNormalize()
{
const amplitude_t water_percent = _water_percent[_opt.diff.quantity_sea_lakes];
const height_t h_max_new = I2H(_max_height[_opt.diff.terrain_type]);
@@ -793,7 +793,7 @@
* areas wont be high enough, and there will be very little tropic on the map.
* Thus Tropic works best on Hilly or Mountainous.
*/
-void GenerateTerrainPerlin(void)
+void GenerateTerrainPerlin()
{
uint x, y;
--- a/src/tgp.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/tgp.h Sun Mar 11 16:31:18 2007 +0000
@@ -3,6 +3,6 @@
#ifndef TGP_H
#define TGP_H
-void GenerateTerrainPerlin(void);
+void GenerateTerrainPerlin();
#endif /* TGP_H */
--- a/src/thread.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/thread.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -8,7 +8,7 @@
#if defined(__AMIGA__) || defined(__MORPHOS__) || defined(PSP) || defined(NO_THREADS)
OTTDThread *OTTDCreateThread(OTTDThreadFunc function, void *arg) { return NULL; }
void *OTTDJoinThread(OTTDThread *t) { return NULL; }
-void OTTDExitThread(void) { NOT_REACHED(); };
+void OTTDExitThread() { NOT_REACHED(); };
#elif defined(__OS2__)
@@ -58,7 +58,7 @@
return ret;
}
-void OTTDExitThread(void)
+void OTTDExitThread()
{
_endthread();
}
@@ -96,7 +96,7 @@
return ret;
}
-void OTTDExitThread(void)
+void OTTDExitThread()
{
pthread_exit(NULL);
}
@@ -151,7 +151,7 @@
return ret;
}
-void OTTDExitThread(void)
+void OTTDExitThread()
{
ExitThread(0);
}
--- a/src/thread.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/thread.h Sun Mar 11 16:31:18 2007 +0000
@@ -3,12 +3,12 @@
#ifndef THREAD_H
#define THREAD_H
-typedef struct OTTDThread OTTDThread;
+struct OTTDThread;
typedef void* (*OTTDThreadFunc)(void*);
OTTDThread* OTTDCreateThread(OTTDThreadFunc, void*);
void* OTTDJoinThread(OTTDThread*);
-void OTTDExitThread(void);
+void OTTDExitThread();
#endif /* THREAD_H */
--- a/src/tile.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/tile.h Sun Mar 11 16:31:18 2007 +0000
@@ -8,7 +8,7 @@
#include "map.h"
#include "slope.h"
-typedef enum TileTypes {
+enum TileType {
MP_CLEAR,
MP_RAILWAY,
MP_STREET,
@@ -20,13 +20,13 @@
MP_INDUSTRY,
MP_TUNNELBRIDGE,
MP_UNMOVABLE,
-} TileType;
+};
-typedef enum TropicZones {
+enum TropicZone {
TROPICZONE_INVALID = 0,
TROPICZONE_DESERT = 1,
TROPICZONE_RAINFOREST = 2,
-} TropicZone;
+};
Slope GetTileSlope(TileIndex tile, uint *h);
uint GetTileZ(TileIndex tile);
--- a/src/town.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/town.h Sun Mar 11 16:31:18 2007 +0000
@@ -80,10 +80,10 @@
uint16 radius[5];
};
-uint32 GetWorldPopulation(void);
+uint32 GetWorldPopulation();
void UpdateTownVirtCoord(Town *t);
-void InitializeTown(void);
+void InitializeTown();
void ShowTownViewWindow(TownID town);
void ExpandTown(Town *t);
Town *CreateRandomTown(uint attempts, uint size_mode);
@@ -173,7 +173,7 @@
VARDEF uint _total_towns;
-static inline TownID GetMaxTownIndex(void)
+static inline TownID GetMaxTownIndex()
{
/* TODO - This isn't the real content of the function, but
* with the new pool-system this will be replaced with one that
@@ -183,7 +183,7 @@
return GetTownPoolSize() - 1;
}
-static inline uint GetNumTowns(void)
+static inline uint GetNumTowns()
{
return _total_towns;
}
@@ -191,7 +191,7 @@
/**
* Return a random valid town.
*/
-static inline Town *GetRandomTown(void)
+static inline Town *GetRandomTown()
{
int num = RandomRange(GetNumTowns());
TownID index = INVALID_TOWN;
--- a/src/town_cmd.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/town_cmd.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -251,7 +251,7 @@
if (_town_sort_order & 2) _town_sort_dirty = true;
}
-uint32 GetWorldPopulation(void)
+uint32 GetWorldPopulation()
{
uint32 pop;
const Town* t;
@@ -442,7 +442,7 @@
UpdateTownRadius(t);
}
-void OnTick_Town(void)
+void OnTick_Town()
{
if (_game_mode == GM_EDITOR) return;
@@ -760,7 +760,7 @@
// Generate a random road block
// The probability of a straight road
// is somewhat higher than a curved.
-static RoadBits GenRandomRoadBits(void)
+static RoadBits GenRandomRoadBits()
{
uint32 r = Random();
uint a = GB(r, 0, 2);
@@ -987,7 +987,7 @@
UpdateTownMaxPass(t);
}
-static Town *AllocateTown(void)
+static Town *AllocateTown()
{
Town *t;
@@ -1090,7 +1090,7 @@
static const byte _num_initial_towns[3] = {11, 23, 46};
-bool GenerateTowns(void)
+bool GenerateTowns()
{
uint num = 0;
uint n = ScaleByMapSize(_num_initial_towns[_opt.diff.number_towns] + (Random() & 7));
@@ -1465,7 +1465,7 @@
NEWS_FLAGS(NM_NORMAL, NF_TILE, NT_GENERAL, 0), t->xy, 0);
}
-static bool DoBuildStatueOfCompany(TileIndex tile)
+static bool DoBuildStatueOfCompany(TileIndex tile, TownID town_id)
{
PlayerID old;
int32 r;
@@ -1485,7 +1485,7 @@
if (CmdFailed(r)) return false;
- MakeStatue(tile, _current_player);
+ MakeStatue(tile, _current_player, town_id);
MarkTileDirtyByTile(tile);
return true;
@@ -1493,12 +1493,12 @@
/**
* Search callback function for TownActionBuildStatue
- * @param data that is passed by the caller. In this case, nothing
+ * @param town_id The town_id for which we want a statue
* @return the result of the test
*/
-static bool SearchTileForStatue(TileIndex tile, uint32 data)
+static bool SearchTileForStatue(TileIndex tile, uint32 town_id)
{
- return DoBuildStatueOfCompany(tile);
+ return DoBuildStatueOfCompany(tile, town_id);
}
/**
@@ -1510,7 +1510,7 @@
{
TileIndex tile = t->xy;
- if (CircularTileSearch(tile, 9, SearchTileForStatue, 0))
+ if (CircularTileSearch(tile, 9, SearchTileForStatue, t->index))
SETBIT(t->statues, _current_player); ///< Once found and built, "inform" the Town
}
@@ -1807,7 +1807,7 @@
return true;
}
-void TownsMonthlyLoop(void)
+void TownsMonthlyLoop()
{
Town *t;
@@ -1823,7 +1823,7 @@
}
}
-void InitializeTowns(void)
+void InitializeTowns()
{
Subsidy *s;
@@ -1922,7 +1922,7 @@
SLE_END()
};
-static void Save_TOWN(void)
+static void Save_TOWN()
{
Town *t;
@@ -1932,7 +1932,7 @@
}
}
-static void Load_TOWN(void)
+static void Load_TOWN()
{
int index;
@@ -1956,7 +1956,7 @@
_cur_town_ctr = 0;
}
-void AfterLoadTown(void)
+void AfterLoadTown()
{
Town *t;
FOR_ALL_TOWNS(t) {
--- a/src/town_gui.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/town_gui.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -404,7 +404,7 @@
return r;
}
-static void MakeSortedTownList(void)
+static void MakeSortedTownList()
{
const Town* t;
uint n = 0;
@@ -513,7 +513,7 @@
};
-void ShowTownDirectory(void)
+void ShowTownDirectory()
{
BaseWindow *w = BaseWindow::AllocateFront(&_town_directory_desc, 0);
--- a/src/train.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/train.h Sun Mar 11 16:31:18 2007 +0000
@@ -13,14 +13,14 @@
* This is an enum to tell what bit to access as it is a bitmask
*/
-typedef enum TrainSubtypes {
+enum TrainSubtype {
Train_Front = 0, // Leading engine of a train
Train_Articulated_Part = 1, // Articulated part of an engine
Train_Wagon = 2, // Wagon
Train_Engine = 3, // Engine, that can be front engines, but might be placed behind another engine
Train_Free_Wagon = 4, // First in a wagon chain (in depot)
Train_Multiheaded = 5, // Engine is a multiheaded
-} TrainSubtype;
+};
/** Check if a vehicle is front engine
@@ -215,8 +215,8 @@
return v->next;
}
-void ConvertOldMultiheadToNew(void);
-void ConnectMultiheadedTrains(void);
+void ConvertOldMultiheadToNew();
+void ConnectMultiheadedTrains();
uint CountArticulatedParts(EngineID engine_type);
int CheckTrainInDepot(const Vehicle *v, bool needs_to_be_stopped);
--- a/src/train_cmd.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/train_cmd.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -140,7 +140,7 @@
{
uint16 max_speed = 0xFFFF;
- assert(v->type == VEH_Train);
+ assert(v->type == VEH_TRAIN);
assert(IsFrontEngine(v) || IsFreeWagon(v));
const RailVehicleInfo *rvi_v = RailVehInfo(v->engine_type);
@@ -262,7 +262,7 @@
const Order* o = &v->current_order;
StationID sid = GetStationIndex(tile);
- assert(v->type == VEH_Train);
+ assert(v->type == VEH_TRAIN);
//When does a train drive through a station
//first we deal with the "new nonstop handling"
if (_patches.new_nonstop && o->flags & OF_NON_STOP && sid == o->dest) {
@@ -545,7 +545,7 @@
u->max_age = 0;
u->engine_type = engine_type;
u->value = 0;
- u->type = VEH_Train;
+ u->type = VEH_TRAIN;
u->subtype = 0;
SetArticulatedPart(u);
u->cur_image = 0xAC2;
@@ -580,7 +580,7 @@
Vehicle *w;
FOR_ALL_VEHICLES(w) {
- if (w->type == VEH_Train && w->tile == tile &&
+ if (w->type == VEH_TRAIN && w->tile == tile &&
IsFreeWagon(w) && w->engine_type == engine) {
u = GetLastVehicleInChain(w);
break;
@@ -623,7 +623,7 @@
v->u.rail.railtype = rvi->railtype;
v->build_year = _cur_year;
- v->type = VEH_Train;
+ v->type = VEH_TRAIN;
v->cur_image = 0xAC2;
v->random_bits = VehicleRandomBits();
@@ -636,7 +636,7 @@
InvalidateWindow(WC_VEHICLE_DEPOT, v->tile);
if (IsLocalPlayer()) {
- InvalidateAutoreplaceWindow(VEH_Train); // updates the replace Train window
+ InvalidateAutoreplaceWindow(VEH_TRAIN); // updates the replace Train window
}
GetPlayer(_current_player)->num_engines[engine]++;
}
@@ -651,7 +651,7 @@
const Vehicle* v;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Train && IsFreeWagon(v) &&
+ if (v->type == VEH_TRAIN && IsFreeWagon(v) &&
v->tile == u->tile &&
v->u.rail.track == TRACK_BIT_DEPOT) {
if (CmdFailed(DoCommand(0, v->index | (u->index << 16), 1, DC_EXEC,
@@ -689,7 +689,7 @@
u->build_year = v->build_year;
if (building) v->value >>= 1;
u->value = v->value;
- u->type = VEH_Train;
+ u->type = VEH_TRAIN;
u->cur_image = 0xAC2;
u->random_bits = VehicleRandomBits();
VehiclePositionChanged(u);
@@ -704,7 +704,7 @@
int32 CmdBuildRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
{
/* Check if the engine-type is valid (for the player) */
- if (!IsEngineBuildable(p1, VEH_Train, _current_player)) return_cmd_error(STR_ENGINE_NOT_BUILDABLE);
+ if (!IsEngineBuildable(p1, VEH_TRAIN, _current_player)) return_cmd_error(STR_ENGINE_NOT_BUILDABLE);
/* Check if the train is actually being built in a depot belonging
* to the player. Doesn't matter if only the cost is queried */
@@ -739,7 +739,7 @@
Vehicle *v = vl[0];
- UnitID unit_num = HASBIT(p2, 0) ? 0 : GetFreeUnitNumber(VEH_Train);
+ UnitID unit_num = HASBIT(p2, 0) ? 0 : GetFreeUnitNumber(VEH_TRAIN);
if (unit_num > _patches.max_trains)
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
@@ -781,7 +781,7 @@
v->service_interval = _patches.servint_trains;
v->date_of_last_service = _date;
v->build_year = _cur_year;
- v->type = VEH_Train;
+ v->type = VEH_TRAIN;
v->cur_image = 0xAC2;
v->random_bits = VehicleRandomBits();
@@ -818,7 +818,7 @@
RebuildVehicleLists();
InvalidateWindow(WC_COMPANY, v->owner);
if (IsLocalPlayer())
- InvalidateAutoreplaceWindow(VEH_Train); // updates the replace Train window
+ InvalidateAutoreplaceWindow(VEH_TRAIN); // updates the replace Train window
GetPlayer(_current_player)->num_engines[p1]++;
}
@@ -897,7 +897,7 @@
TileIndex tile = src->tile;
FOR_ALL_VEHICLES(dst) {
- if (dst->type == VEH_Train && IsFreeWagon(dst) && dst->tile == tile) {
+ if (dst->type == VEH_TRAIN && IsFreeWagon(dst) && dst->tile == tile) {
// check so all vehicles in the line have the same engine.
Vehicle *v = dst;
@@ -964,7 +964,7 @@
Vehicle *src = GetVehicle(s);
- if (src->type != VEH_Train || !CheckOwnership(src->owner)) return CMD_ERROR;
+ if (src->type != VEH_TRAIN || !CheckOwnership(src->owner)) return CMD_ERROR;
// if nothing is selected as destination, try and find a matching vehicle to drag to.
Vehicle *dst;
@@ -973,7 +973,7 @@
} else {
if (!IsValidVehicleID(d)) return CMD_ERROR;
dst = GetVehicle(d);
- if (dst->type != VEH_Train || !CheckOwnership(dst->owner)) return CMD_ERROR;
+ if (dst->type != VEH_TRAIN || !CheckOwnership(dst->owner)) return CMD_ERROR;
}
// if an articulated part is being handled, deal with its parent vehicle
@@ -1078,7 +1078,7 @@
// moving a loco to a new line?, then we need to assign a unitnumber.
if (dst == NULL && !IsFrontEngine(src) && IsTrainEngine(src)) {
- UnitID unit_num = GetFreeUnitNumber(VEH_Train);
+ UnitID unit_num = GetFreeUnitNumber(VEH_TRAIN);
if (unit_num > _patches.max_trains)
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
@@ -1242,7 +1242,7 @@
Vehicle *v = GetVehicle(p1);
- if (v->type != VEH_Train || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_TRAIN || !CheckOwnership(v->owner)) return CMD_ERROR;
/* Check if this train can be started/stopped. The callback will fail or
* return 0xFF if it can. */
@@ -1283,7 +1283,7 @@
Vehicle *v = GetVehicle(p1);
- if (v->type != VEH_Train || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_TRAIN || !CheckOwnership(v->owner)) return CMD_ERROR;
SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
@@ -1562,7 +1562,7 @@
/* Check if the vehicle is a train and is on the tile we are testing */
static void *TestTrainOnCrossing(Vehicle *v, void *data)
{
- if (v->tile != *(const TileIndex*)data || v->type != VEH_Train) return NULL;
+ if (v->tile != *(const TileIndex*)data || v->type != VEH_TRAIN) return NULL;
return v;
}
@@ -1669,7 +1669,7 @@
Vehicle *v = GetVehicle(p1);
- if (v->type != VEH_Train || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_TRAIN || !CheckOwnership(v->owner)) return CMD_ERROR;
if (p2) {
// turn a single unit around
@@ -1717,7 +1717,7 @@
Vehicle *v = GetVehicle(p1);
- if (v->type != VEH_Train || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_TRAIN || !CheckOwnership(v->owner)) return CMD_ERROR;
if (flags & DC_EXEC) v->u.rail.force_proceed = 0x50;
@@ -1740,7 +1740,7 @@
Vehicle *v = GetVehicle(p1);
- if (v->type != VEH_Train || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_TRAIN || !CheckOwnership(v->owner)) return CMD_ERROR;
if (CheckTrainStoppedInDepot(v) < 0) return_cmd_error(STR_TRAIN_MUST_BE_STOPPED);
/* Check cargo */
@@ -1822,7 +1822,7 @@
return cost;
}
-typedef struct TrainFindDepotData {
+struct TrainFindDepotData {
uint best_length;
TileIndex tile;
PlayerID owner;
@@ -1831,7 +1831,7 @@
* This value is unused when new depot finding and NPF are both disabled
*/
bool reverse;
-} TrainFindDepotData;
+};
static bool NtpCallbFindDepot(TileIndex tile, TrainFindDepotData *tfdd, int track, uint length)
{
@@ -1918,14 +1918,14 @@
if (p2 & DEPOT_MASS_SEND) {
/* Mass goto depot requested */
if (!ValidVLWFlags(p2 & VLW_MASK)) return CMD_ERROR;
- return SendAllVehiclesToDepot(VEH_Train, flags, p2 & DEPOT_SERVICE, _current_player, (p2 & VLW_MASK), p1);
+ return SendAllVehiclesToDepot(VEH_TRAIN, flags, p2 & DEPOT_SERVICE, _current_player, (p2 & VLW_MASK), p1);
}
if (!IsValidVehicleID(p1)) return CMD_ERROR;
Vehicle *v = GetVehicle(p1);
- if (v->type != VEH_Train || !CheckOwnership(v->owner)) return CMD_ERROR;
+ if (v->type != VEH_TRAIN || !CheckOwnership(v->owner)) return CMD_ERROR;
if (v->vehstatus & VS_CRASHED) return CMD_ERROR;
@@ -1979,7 +1979,7 @@
}
-void OnTick_Train(void)
+void OnTick_Train()
{
_age_cargo_skip_counter = (_age_cargo_skip_counter == 0) ? 184 : (_age_cargo_skip_counter - 1);
}
@@ -2134,13 +2134,13 @@
}
/* Check for station tiles */
-typedef struct TrainTrackFollowerData {
+struct TrainTrackFollowerData {
TileIndex dest_coords;
StationID station_index; // station index we're heading for
uint best_bird_dist;
uint best_track_dist;
TrackdirByte best_track;
-} TrainTrackFollowerData;
+};
static bool NtpCallbFindStation(TileIndex tile, TrainTrackFollowerData *ttfd, Trackdir track, uint length)
{
@@ -2454,8 +2454,7 @@
// If no order, do nothing.
if (order == NULL) {
- v->current_order.type = OT_NOTHING;
- v->current_order.flags = 0;
+ v->current_order.Free();
v->dest_tile = 0;
return false;
}
@@ -2712,11 +2711,11 @@
);
}
-typedef struct {
+struct RailtypeSlowdownParams {
byte small_turn, large_turn;
byte z_up; // fraction to remove when moving up
byte z_down; // fraction to remove when moving down
-} RailtypeSlowdownParams;
+};
static const RailtypeSlowdownParams _railtype_slowdown[] = {
// normal accel
@@ -2768,10 +2767,10 @@
}
-typedef struct TrainCollideChecker {
+struct TrainCollideChecker {
const Vehicle *v;
const Vehicle *v_skip;
-} TrainCollideChecker;
+};
static void *FindTrainCollideEnum(Vehicle *v, void *data)
{
@@ -2779,7 +2778,7 @@
if (v != tcc->v &&
v != tcc->v_skip &&
- v->type == VEH_Train &&
+ v->type == VEH_TRAIN &&
v->u.rail.track != TRACK_BIT_DEPOT &&
myabs(v->z_pos - tcc->v->z_pos) <= 6 &&
myabs(v->x_pos - tcc->v->x_pos) < 6 &&
@@ -2861,16 +2860,16 @@
SndPlayVehicleFx(SND_13_BIG_CRASH, v);
}
-typedef struct VehicleAtSignalData {
+struct VehicleAtSignalData {
TileIndex tile;
Direction direction;
-} VehicleAtSignalData;
+};
static void *CheckVehicleAtSignal(Vehicle *v, void *data)
{
const VehicleAtSignalData* vasd = (VehicleAtSignalData*)data;
- if (v->type == VEH_Train && IsFrontEngine(v) && v->tile == vasd->tile) {
+ if (v->type == VEH_TRAIN && IsFrontEngine(v) && v->tile == vasd->tile) {
DirDiff diff = ChangeDirDiff(DirDifference(v->direction, vasd->direction), DIRDIFF_90RIGHT);
if (diff == DIRDIFF_90RIGHT || (v->cur_speed <= 5 && diff <= DIRDIFF_REVERSE)) return v;
@@ -2910,8 +2909,7 @@
}
if (v->current_order.type == OT_LEAVESTATION) {
- v->current_order.type = OT_NOTHING;
- v->current_order.flags = 0;
+ v->current_order.Free();
InvalidateWindowWidget(WC_VEHICLE_VIEW, v->index, STATUS_BAR);
}
}
@@ -3391,7 +3389,7 @@
TrainLocoHandler(v, false);
// make sure vehicle wasn't deleted.
- if (v->type == VEH_Train && IsFrontEngine(v))
+ if (v->type == VEH_TRAIN && IsFrontEngine(v))
TrainLocoHandler(v, true);
} else if (IsFreeWagon(v) && HASBITS(v->vehstatus, VS_CRASHED)) {
// Delete flooded standalone wagon
@@ -3495,12 +3493,12 @@
}
}
-void TrainsYearlyLoop(void)
+void TrainsYearlyLoop()
{
Vehicle *v;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Train && IsFrontEngine(v)) {
+ if (v->type == VEH_TRAIN && IsFrontEngine(v)) {
// show warning if train is not generating enough income last 2 years (corresponds to a red icon in the vehicle list)
if (_patches.train_income_warn && v->owner == _local_player && v->age >= 730 && v->profit_this_year < 0) {
SetDParam(1, v->profit_this_year);
@@ -3520,7 +3518,7 @@
}
-void InitializeTrains(void)
+void InitializeTrains()
{
_age_cargo_skip_counter = 1;
}
@@ -3529,18 +3527,18 @@
* Link front and rear multiheaded engines to each other
* This is done when loading a savegame
*/
-void ConnectMultiheadedTrains(void)
+void ConnectMultiheadedTrains()
{
Vehicle *v;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Train) {
+ if (v->type == VEH_TRAIN) {
v->u.rail.other_multiheaded_part = NULL;
}
}
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Train && IsFrontEngine(v)) {
+ if (v->type == VEH_TRAIN && IsFrontEngine(v)) {
Vehicle *u = v;
BEGIN_ENUM_WAGONS(u) {
@@ -3577,17 +3575,17 @@
* Converts all trains to the new subtype format introduced in savegame 16.2
* It also links multiheaded engines or make them forget they are multiheaded if no suitable partner is found
*/
-void ConvertOldMultiheadToNew(void)
+void ConvertOldMultiheadToNew()
{
Vehicle *v;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Train) {
+ if (v->type == VEH_TRAIN) {
SETBIT(v->subtype, 7); // indicates that it's the old format and needs to be converted in the next loop
}
}
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Train) {
+ if (v->type == VEH_TRAIN) {
if (HASBIT(v->subtype, 7) && ((v->subtype & ~0x80) == 0 || (v->subtype & ~0x80) == 4)) {
Vehicle *u = v;
--- a/src/train_gui.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/train_gui.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -25,7 +25,7 @@
// find a locomotive in the depot.
found = NULL;
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Train && IsFrontEngine(v) &&
+ if (v->type == VEH_TRAIN && IsFrontEngine(v) &&
v->tile == tile &&
v->u.rail.track == TRACK_BIT_DEPOT) {
if (found != NULL) return; // must be exactly one.
--- a/src/tree_cmd.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/tree_cmd.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -84,7 +84,7 @@
}
}
-static void PlaceMoreTrees(void)
+static void PlaceMoreTrees()
{
uint i = ScaleByMapSize(GB(Random(), 0, 5) + 25);
do {
@@ -124,7 +124,7 @@
}
}
-void PlaceTreesRandomly(void)
+void PlaceTreesRandomly()
{
uint i, j, ht;
@@ -180,7 +180,7 @@
}
}
-void GenerateTrees(void)
+void GenerateTrees()
{
uint i, total;
@@ -310,11 +310,11 @@
}
}
-typedef struct TreeListEnt {
+struct TreeListEnt {
SpriteID image;
SpriteID pal;
byte x,y;
-} TreeListEnt;
+};
static void DrawTile_Trees(TileInfo *ti)
{
@@ -604,7 +604,7 @@
MarkTileDirtyByTile(tile);
}
-void OnTick_Trees(void)
+void OnTick_Trees()
{
uint32 r;
TileIndex tile;
@@ -654,7 +654,7 @@
/* not used */
}
-void InitializeTrees(void)
+void InitializeTrees()
{
_trees_tick_ctr = 0;
}
--- a/src/tree_map.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/tree_map.h Sun Mar 11 16:31:18 2007 +0000
@@ -5,7 +5,7 @@
#include "macros.h"
-typedef enum TreeType {
+enum TreeType {
TREE_INVALID = -1,
TREE_TEMPERATE = 0,
TREE_SUB_ARCTIC = 12,
@@ -13,7 +13,7 @@
TREE_CACTUS = 27,
TREE_SUB_TROPICAL = 28,
TREE_TOYLAND = 32
-} TreeType;
+};
enum {
TREE_COUNT_TEMPERATE = TREE_SUB_ARCTIC - TREE_TEMPERATE,
@@ -25,11 +25,11 @@
/* ground type, m2 bits 4...5
* valid densities (bits 6...7) in comments after the enum */
-typedef enum TreeGround {
+enum TreeGround {
TREE_GROUND_GRASS = 0, // 0
TREE_GROUND_ROUGH = 1, // 0
TREE_GROUND_SNOW_DESERT = 2 // 0-3 for snow, 3 for desert
-} TreeGround;
+};
static inline TreeType GetTreeType(TileIndex t)
--- a/src/tunnelbridge_cmd.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/tunnelbridge_cmd.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -77,7 +77,7 @@
}
#define M(x) (1 << (x))
-typedef enum BridgeFoundations{
+enum BridgeFoundation {
// foundation, whole tile is leveled up --> 3 corners raised
BRIDGE_FULL_LEVELED_FOUNDATION = M(SLOPE_WSE) | M(SLOPE_NWS) | M(SLOPE_ENW) | M(SLOPE_SEN),
// foundation, tile is partly leveled up --> 1 corner raised
@@ -85,7 +85,7 @@
// no foundations (X,Y direction)
BRIDGE_NO_FOUNDATION = M(SLOPE_FLAT) | M(SLOPE_SW) | M(SLOPE_SE) | M(SLOPE_NW) | M(SLOPE_NE),
BRIDGE_HORZ_RAMP = (BRIDGE_PARTLY_LEVELED_FOUNDATION | BRIDGE_NO_FOUNDATION) & ~M(SLOPE_FLAT)
-} BridgeFoundataion;
+};
#undef M
static inline const PalSpriteID *GetBridgeSpriteTable(int index, byte table)
@@ -543,7 +543,7 @@
v = FindVehicleBetween(starttile, tile, z);
if (v != NULL) {
- _error_message = v->type == VEH_Train ?
+ _error_message = v->type == VEH_TRAIN ?
STR_5000_TRAIN_IN_TUNNEL : STR_5001_ROAD_VEHICLE_IN_TUNNEL;
return INVALID_TILE;
}
@@ -1257,7 +1257,7 @@
DiagDirection dir;
DiagDirection vdir;
- if (v->type == VEH_Train) {
+ if (v->type == VEH_TRAIN) {
fc = (x & 0xF) + (y << 4);
dir = GetTunnelDirection(tile);
@@ -1265,7 +1265,7 @@
if (v->u.rail.track != TRACK_BIT_WORMHOLE && dir == vdir) {
if (IsFrontEngine(v) && fc == _tunnel_fractcoord_1[dir]) {
- if (!PlayVehicleSound(v, VSE_TUNNEL) && v->spritenum < 4) {
+ if (!PlayVehicleSound(v, VSE_TUNNEL) && RailVehInfo(v->engine_type)->engclass == 0) {
SndPlayVehicleFx(SND_05_TRAIN_THROUGH_TUNNEL, v);
}
return VETSB_CONTINUE;
@@ -1286,7 +1286,7 @@
v->vehstatus &= ~VS_HIDDEN;
return VETSB_ENTERED_WORMHOLE;
}
- } else if (v->type == VEH_Road) {
+ } else if (v->type == VEH_ROAD) {
fc = (x & 0xF) + (y << 4);
dir = GetTunnelDirection(tile);
vdir = DirToDiagDir(v->direction);
@@ -1320,11 +1320,11 @@
} else if (IsBridge(tile)) { // XXX is this necessary?
DiagDirection dir;
- if (v->type == VEH_Road || (v->type == VEH_Train && IsFrontEngine(v))) {
+ if (v->type == VEH_ROAD || (v->type == VEH_TRAIN && IsFrontEngine(v))) {
/* modify speed of vehicle */
uint16 spd = _bridge[GetBridgeType(tile)].speed;
- if (v->type == VEH_Road) spd *= 2;
+ if (v->type == VEH_ROAD) spd *= 2;
if (v->cur_speed > spd) v->cur_speed = spd;
}
@@ -1337,7 +1337,7 @@
case DIAGDIR_SW: if ((x & 0xF) != TILE_SIZE - 1) return VETSB_CONTINUE; break;
case DIAGDIR_NW: if ((y & 0xF) != 0) return VETSB_CONTINUE; break;
}
- if (v->type == VEH_Train) {
+ if (v->type == VEH_TRAIN) {
v->u.rail.track = TRACK_BIT_WORMHOLE;
CLRBIT(v->u.rail.flags, VRF_GOINGUP);
CLRBIT(v->u.rail.flags, VRF_GOINGDOWN);
@@ -1347,7 +1347,7 @@
return VETSB_ENTERED_WORMHOLE;
} else if (DirToDiagDir(v->direction) == ReverseDiagDir(dir)) {
v->tile = tile;
- if (v->type == VEH_Train) {
+ if (v->type == VEH_TRAIN) {
if (v->u.rail.track == TRACK_BIT_WORMHOLE) {
v->u.rail.track = (DiagDirToAxis(dir) == AXIS_X ? TRACK_BIT_X : TRACK_BIT_Y);
return VETSB_ENTERED_WORMHOLE;
--- a/src/unix.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/unix.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -59,7 +59,7 @@
#endif
}
-void FiosGetDrives(void)
+void FiosGetDrives()
{
return;
}
@@ -92,9 +92,12 @@
#endif
snprintf(filename, lengthof(filename), "%s" PATHSEP "%s", path, ent->d_name);
- if (stat(filename, sb) != 0) return false;
+ return stat(filename, sb) == 0;
+}
- return (ent->d_name[0] != '.'); // hidden file
+bool FiosIsHiddenFile(const struct dirent *ent)
+{
+ return ent->d_name[0] == '.';
}
#if defined(__BEOS__) || defined(__linux__)
@@ -127,9 +130,9 @@
}
#ifdef WITH_COCOA
-void cocoaSetWorkingDirectory(void);
-void cocoaSetupAutoreleasePool(void);
-void cocoaReleaseAutoreleasePool(void);
+void cocoaSetWorkingDirectory();
+void cocoaSetupAutoreleasePool();
+void cocoaReleaseAutoreleasePool();
#endif
int CDECL main(int argc, char* argv[])
@@ -165,7 +168,7 @@
return ret;
}
-void DeterminePaths(void)
+void DeterminePaths()
{
char *s;
@@ -296,7 +299,7 @@
/** Try and try to decipher the current locale from environmental
* variables. MacOSX is hardcoded, other OS's are dynamic. If no suitable
* locale can be found, don't do any conversion "" */
-static const char *GetLocalCode(void)
+static const char *GetLocalCode()
{
#if defined(__APPLE__)
return "UTF-8-MAC";
--- a/src/unmovable_cmd.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/unmovable_cmd.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -152,12 +152,7 @@
DrawClearLandTile(ti, 0);
image = SPR_BOUGHT_LAND;
- if (_display_opt & DO_TRANS_BUILDINGS) {
- SETBIT(image, PALETTE_MODIFIER_TRANSPARENT);
- pal = PALETTE_TO_TRANSPARENT;
- } else {
- pal = PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile));
- }
+ pal = PLAYER_SPRITE_COLOR(GetTileOwner(ti->tile));
AddSortableSpriteToDraw(
image, pal,
ti->x + TILE_SIZE / 2, ti->y + TILE_SIZE / 2, 1, 1, 10, GetSlopeZ(ti->x + TILE_SIZE / 2, ti->y + TILE_SIZE / 2)
@@ -233,6 +228,12 @@
if (_game_mode != GM_EDITOR && _current_player != OWNER_WATER && ((flags & DC_AUTO || !_cheats.magic_bulldozer.value)) )
return_cmd_error(STR_5800_OBJECT_IN_THE_WAY);
+ if (IsStatue(tile)) {
+ TownID town = GetStatueTownID(tile);
+ CLRBIT(GetTown(town)->statues, _current_player);
+ InvalidateWindow(WC_TOWN_AUTHORITY, town);
+ }
+
if (flags & DC_EXEC) {
DoClearSquare(tile);
}
@@ -335,7 +336,7 @@
return false;
}
-void GenerateUnmovables(void)
+void GenerateUnmovables()
{
int i, li, j, loop_count;
TileIndex tile;
--- a/src/unmovable_map.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/unmovable_map.h Sun Mar 11 16:31:18 2007 +0000
@@ -8,7 +8,7 @@
HQ_NUM_SIZE = 5
};
-typedef enum UnmovableType {
+enum UnmovableType {
UNMOVABLE_TRANSMITTER = 0,
UNMOVABLE_LIGHTHOUSE = 1,
UNMOVABLE_STATUE = 2,
@@ -19,7 +19,7 @@
UNMOVABLE_HQ_SOUTH = 0x83,
UNMOVABLE_HQ_END = UNMOVABLE_HQ_NORTH + HQ_NUM_SIZE * HQ_NUM_TILE
-} UnmovableType;
+};
@@ -54,6 +54,23 @@
return IS_INT_INSIDE(GetUnmovableType(t), UNMOVABLE_HQ_NORTH, UNMOVABLE_HQ_END);
}
+static inline bool IsStatue(TileIndex t)
+{
+ assert(IsTileType(t, MP_UNMOVABLE));
+ return GetUnmovableType(t) == UNMOVABLE_STATUE;
+}
+
+static inline bool IsStatueTile(TileIndex t)
+{
+ return IsTileType(t, MP_UNMOVABLE) && IsStatue(t);
+}
+
+static inline TownID GetStatueTownID(TileIndex t)
+{
+ assert(IsStatue(t));
+ return _m[t].m2;
+}
+
static inline byte GetCompanyHQSize(TileIndex t)
{
assert(IsTileType(t, MP_UNMOVABLE) && IsCompanyHQ(t));
@@ -100,9 +117,10 @@
MakeUnmovable(t, UNMOVABLE_LIGHTHOUSE, OWNER_NONE);
}
-static inline void MakeStatue(TileIndex t, Owner o)
+static inline void MakeStatue(TileIndex t, Owner o, TownID town_id)
{
MakeUnmovable(t, UNMOVABLE_STATUE, o);
+ _m[t].m2 = town_id;
}
static inline void MakeOwnedLand(TileIndex t, Owner o)
--- a/src/variables.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/variables.h Sun Mar 11 16:31:18 2007 +0000
@@ -19,7 +19,7 @@
VARDEF uint32 _cargo_payment_rates[NUM_CARGO];
VARDEF uint16 _cargo_payment_rates_frac[NUM_CARGO];
-typedef struct {
+struct GameOptions {
GameDifficulty diff;
byte diff_level;
byte currency;
@@ -29,7 +29,7 @@
byte snow_line;
byte autosave;
byte road_side;
-} GameOptions;
+};
/* These are the options for the current game
* either ingame, or loaded. Also used for networking games */
@@ -80,7 +80,7 @@
// ********* END OF SAVE REGION
-typedef struct Patches {
+struct Patches {
bool modified_catchment; // different-size catchment areas
bool vehicle_speed; // show vehicle speed
bool build_on_slopes; // allow building on slopes
@@ -221,22 +221,22 @@
/** YAPF settings */
YapfSettings yapf;
-} Patches;
+};
VARDEF Patches _patches;
-typedef struct Cheat {
+struct Cheat {
bool been_used; // has this cheat been used before?
bool value; // tells if the bool cheat is active or not
-} Cheat;
+};
// WARNING! Do _not_ remove entries in Cheats struct or change the order
// of the existing ones! Would break downward compatibility.
// Only add new entries at the end of the struct!
-typedef struct Cheats {
+struct Cheats {
Cheat magic_bulldozer; // dynamite industries, unmovables
Cheat switch_player; // change to another player
Cheat money; // get rich
@@ -247,11 +247,11 @@
Cheat change_date; // changes date ingame
Cheat setup_prod; // setup raw-material production in game
Cheat dummy; // empty cheat (enable running el-engines on normal rail)
-} Cheats;
+};
VARDEF Cheats _cheats;
-typedef struct Paths {
+struct Paths {
char *personal_dir; // includes cfg file and save folder
char *game_data_dir; // includes data, gm, lang
char *data_dir;
@@ -262,7 +262,7 @@
char *scenario_dir;
char *heightmap_dir;
char *second_data_dir;
-} Paths;
+};
VARDEF Paths _paths;
@@ -296,11 +296,11 @@
VARDEF bool _generating_world;
// Deals with the type of the savegame, independent of extension
-typedef struct {
+struct SmallFiosItem {
int mode; // savegame/scenario type (old, new)
char name[MAX_PATH]; // name
char title[255]; // internal name of the game
-} SmallFiosItem;
+};
// Used when switching from the intro menu.
VARDEF byte _switch_mode;
@@ -314,7 +314,7 @@
VARDEF char _ini_videodriver[32], _ini_musicdriver[32], _ini_sounddriver[32];
// Used for dynamic language support
-typedef struct {
+struct DynamicLanguages {
int num; // number of languages
int curr; // currently selected language index
char curr_file[MAX_LANG]; // currently selected language file
@@ -323,7 +323,7 @@
char *name;
char *file;
} ent[MAX_LANG];
-} DynamicLanguages;
+};
VARDEF DynamicLanguages _dynlang;
--- a/src/vehicle.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/vehicle.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -37,7 +37,6 @@
#include "newgrf_engine.h"
#include "newgrf_sound.h"
#include "helpers.hpp"
-#include "cargotype.h"
#define INVALID_COORD (-0x8000)
#define GEN_HASH(x, y) ((GB((y), 6, 6) << 6) + GB((x), 7, 6))
@@ -87,7 +86,7 @@
* TODO - This is just a temporary stage, this will be removed. */
for (v = GetVehicle(start_item); v != NULL; v = (v->index + 1U < GetVehiclePoolSize()) ? GetVehicle(v->index + 1) : NULL) {
v->index = start_item++;
- v->type = VEH_Invalid;
+ v->type = VEH_INVALID;
}
}
@@ -119,16 +118,16 @@
StringID VehicleInTheWayErrMsg(const Vehicle* v)
{
switch (v->type) {
- case VEH_Train: return STR_8803_TRAIN_IN_THE_WAY;
- case VEH_Road: return STR_9000_ROAD_VEHICLE_IN_THE_WAY;
- case VEH_Aircraft: return STR_A015_AIRCRAFT_IN_THE_WAY;
+ case VEH_TRAIN: return STR_8803_TRAIN_IN_THE_WAY;
+ case VEH_ROAD: return STR_9000_ROAD_VEHICLE_IN_THE_WAY;
+ case VEH_AIRCRAFT: return STR_A015_AIRCRAFT_IN_THE_WAY;
default: return STR_980E_SHIP_IN_THE_WAY;
}
}
static void *EnsureNoVehicleProc(Vehicle *v, void *data)
{
- if (v->tile != *(const TileIndex*)data || v->type == VEH_Disaster)
+ if (v->tile != *(const TileIndex*)data || v->type == VEH_DISASTER)
return NULL;
_error_message = VehicleInTheWayErrMsg(v);
@@ -144,7 +143,7 @@
{
const TileInfo *ti = (const TileInfo*)data;
- if (v->tile != ti->tile || v->type == VEH_Disaster) return NULL;
+ if (v->tile != ti->tile || v->type == VEH_DISASTER) return NULL;
if (v->z_pos > ti->z) return NULL;
_error_message = VehicleInTheWayErrMsg(v);
@@ -186,7 +185,7 @@
}
FOR_ALL_VEHICLES(veh) {
if (without_crashed && (veh->vehstatus & VS_CRASHED) != 0) continue;
- if ((veh->type == VEH_Train || veh->type == VEH_Road) && (z==0xFF || veh->z_pos == z)) {
+ if ((veh->type == VEH_TRAIN || veh->type == VEH_ROAD) && (z==0xFF || veh->z_pos == z)) {
if ((veh->x_pos>>4) >= x1 && (veh->x_pos>>4) <= x2 &&
(veh->y_pos>>4) >= y1 && (veh->y_pos>>4) <= y2) {
return veh;
@@ -217,26 +216,26 @@
}
// Called after load to update coordinates
-void AfterLoadVehicles(void)
+void AfterLoadVehicles()
{
Vehicle *v;
FOR_ALL_VEHICLES(v) {
v->first = NULL;
- if (v->type == VEH_Train) v->u.rail.first_engine = INVALID_ENGINE;
+ if (v->type == VEH_TRAIN) v->u.rail.first_engine = INVALID_ENGINE;
}
FOR_ALL_VEHICLES(v) {
- if (v->type == VEH_Train && (IsFrontEngine(v) || IsFreeWagon(v)))
+ if (v->type == VEH_TRAIN && (IsFrontEngine(v) || IsFreeWagon(v)))
TrainConsistChanged(v);
}
FOR_ALL_VEHICLES(v) {
switch (v->type) {
- case VEH_Train: v->cur_image = GetTrainImage(v, v->direction); break;
- case VEH_Road: v->cur_image = GetRoadVehImage(v, v->direction); break;
- case VEH_Ship: v->cur_image = GetShipImage(v, v->direction); break;
- case VEH_Aircraft:
+ case VEH_TRAIN: v->cur_image = GetTrainImage(v, v->direction); break;
+ case VEH_ROAD: v->cur_image = GetRoadVehImage(v, v->direction); break;
+ case VEH_SHIP: v->cur_image = GetShipImage(v, v->direction); break;
+ case VEH_AIRCRAFT:
if (IsNormalAircraft(v)) {
v->cur_image = GetAircraftImage(v, v->direction);
@@ -267,7 +266,7 @@
assert(v->orders == NULL);
- v->type = VEH_Invalid;
+ v->type = VEH_INVALID;
v->left_coord = INVALID_COORD;
v->first = NULL;
v->next = NULL;
@@ -284,12 +283,12 @@
* Get a value for a vehicle's random_bits.
* @return A random value from 0 to 255.
*/
-byte VehicleRandomBits(void)
+byte VehicleRandomBits()
{
return GB(Random(), 0, 8);
}
-Vehicle *ForceAllocateSpecialVehicle(void)
+Vehicle *ForceAllocateSpecialVehicle()
{
/* This stays a strange story.. there should always be room for special
* vehicles (special effects all over the map), but with 65k of vehicles
@@ -344,7 +343,7 @@
}
-Vehicle *AllocateVehicle(void)
+Vehicle *AllocateVehicle()
{
VehicleID counter = 0;
return AllocateSingleVehicle(&counter);
@@ -446,12 +445,12 @@
}
}
-void ResetVehiclePosHash(void)
+void ResetVehiclePosHash()
{
memset(_vehicle_position_hash, 0, sizeof(_vehicle_position_hash));
}
-void InitializeVehicles(void)
+void InitializeVehicles()
{
uint i;
@@ -483,7 +482,7 @@
{
Vehicle *u;
- FOR_ALL_VEHICLES(u) if (u->type == VEH_Train && u->next == v) return u;
+ FOR_ALL_VEHICLES(u) if (u->type == VEH_TRAIN && u->next == v) return u;
return NULL;
}
@@ -516,7 +515,7 @@
Vehicle* u;
assert(v != NULL);
- assert(v->type == VEH_Train);
+ assert(v->type == VEH_TRAIN);
if (v->first != NULL) {
if (IsFrontEngine(v->first) || IsFreeWagon(v->first)) return v->first;
@@ -553,12 +552,12 @@
bool IsEngineCountable(const Vehicle *v)
{
switch (v->type) {
- case VEH_Aircraft: return IsNormalAircraft(v); // don't count plane shadows and helicopter rotors
- case VEH_Train:
+ case VEH_AIRCRAFT: return IsNormalAircraft(v); // don't count plane shadows and helicopter rotors
+ case VEH_TRAIN:
return !IsArticulatedPart(v) && // tenders and other articulated parts
(!IsMultiheaded(v) || IsTrainEngine(v)); // rear parts of multiheaded engines
- case VEH_Road:
- case VEH_Ship:
+ case VEH_ROAD:
+ case VEH_SHIP:
return true;
default: return false; // Only count player buildable vehicles
}
@@ -574,9 +573,9 @@
DeleteVehicleNews(v->index, INVALID_STRING_ID);
DeleteName(v->string_id);
- if (v->type == VEH_Road) ClearSlot(v);
-
- if (v->type != VEH_Train || (v->type == VEH_Train && (IsFrontEngine(v) || IsFreeWagon(v)))) {
+ if (v->type == VEH_ROAD) ClearSlot(v);
+
+ if (v->type != VEH_TRAIN || (v->type == VEH_TRAIN && (IsFrontEngine(v) || IsFreeWagon(v)))) {
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
}
@@ -606,7 +605,6 @@
void Train_Tick(Vehicle *v);
static void EffectVehicle_Tick(Vehicle *v);
void DisasterVehicle_Tick(Vehicle *v);
-static int32 MaybeReplaceVehicle(Vehicle *v, bool check, bool display_costs);
// head of the linked list to tell what vehicles that visited a depot in a tick
static Vehicle* _first_veh_in_depot_list;
@@ -647,7 +645,7 @@
DisasterVehicle_Tick,
};
-void CallVehicleTicks(void)
+void CallVehicleTicks()
{
Vehicle *v;
@@ -665,12 +663,12 @@
_vehicle_tick_procs[v->type](v);
switch (v->type) {
- case VEH_Train:
- case VEH_Road:
- case VEH_Aircraft:
- case VEH_Ship:
- if (v->type == VEH_Train && IsTrainWagon(v)) continue;
- if (v->type == VEH_Aircraft && v->subtype != AIR_HELICOPTER) continue;
+ case VEH_TRAIN:
+ case VEH_ROAD:
+ case VEH_AIRCRAFT:
+ case VEH_SHIP:
+ if (v->type == VEH_TRAIN && IsTrainWagon(v)) continue;
+ if (v->type == VEH_AIRCRAFT && v->subtype != AIR_HELICOPTER) continue;
v->motion_counter += (v->direction & 1) ? (v->cur_speed * 3) / 4 : v->cur_speed;
/* Play a running sound if the motion counter passes 256 (Do we not skip sounds?) */
@@ -701,7 +699,7 @@
//if the aircraft carries passengers and is NOT full, then
//continue loading, no matter how much mail is in
- if (v->type == VEH_Aircraft &&
+ if (v->type == VEH_AIRCRAFT &&
v->cargo_type == CT_PASSENGERS &&
v->cargo_cap != v->cargo_count) {
return true;
@@ -737,7 +735,7 @@
TileIndex tile = v->tile;
if (IsTileType(tile, MP_STATION) ||
- (v->type == VEH_Ship && (
+ (v->type == VEH_SHIP && (
IsTileType(TILE_ADDXY(tile, 1, 0), MP_STATION) ||
IsTileType(TILE_ADDXY(tile, -1, 0), MP_STATION) ||
IsTileType(TILE_ADDXY(tile, 0, 1), MP_STATION) ||
@@ -791,10 +789,10 @@
int32 base_cost = 0;
switch (GetEngine(engine_type)->type) {
- case VEH_Ship: base_cost = _price.ship_base; break;
- case VEH_Road: base_cost = _price.roadveh_base; break;
- case VEH_Aircraft: base_cost = _price.aircraft_base; break;
- case VEH_Train:
+ case VEH_SHIP: base_cost = _price.ship_base; break;
+ case VEH_ROAD: base_cost = _price.roadveh_base; break;
+ case VEH_AIRCRAFT: base_cost = _price.aircraft_base; break;
+ case VEH_TRAIN:
base_cost = 2 * ((RailVehInfo(engine_type)->railveh_type == RAILVEH_WAGON) ?
_price.build_railwagon : _price.build_railvehicle);
break;
@@ -1098,11 +1096,11 @@
v->u.special.unk2 = 0;
}
-typedef struct BulldozerMovement {
+struct BulldozerMovement {
byte direction:2;
byte image:2;
byte duration:3;
-} BulldozerMovement;
+};
static const BulldozerMovement _bulldozer_movement[] = {
{ 0, 0, 4 },
@@ -1172,12 +1170,12 @@
v->progress = 0;
}
-typedef struct BubbleMovement {
+struct BubbleMovement {
int8 x:4;
int8 y:4;
int8 z:4;
byte image:4;
-} BubbleMovement;
+};
#define MK(x, y, z, i) { x, y, z, i }
#define ME(i) { i, 4, 0, 0 }
@@ -1431,7 +1429,7 @@
v = ForceAllocateSpecialVehicle();
if (v != NULL) {
- v->type = VEH_Special;
+ v->type = VEH_SPECIAL;
v->subtype = type;
v->x_pos = x;
v->y_pos = y;
@@ -1542,7 +1540,7 @@
/* calculate reliability value to use in comparison */
rel = v->reliability;
- if (v->type == VEH_Ship) rel += 0x6666;
+ if (v->type == VEH_SHIP) rel += 0x6666;
/* disabled breakdowns? */
if (_opt.diff.vehicle_breakdowns < 1) return;
@@ -1621,10 +1619,10 @@
bool vehicle_list_window = HASBIT(p2, 6);
switch (vehicle_type) {
- case VEH_Train: stop_command = CMD_START_STOP_TRAIN; break;
- case VEH_Road: stop_command = CMD_START_STOP_ROADVEH; break;
- case VEH_Ship: stop_command = CMD_START_STOP_SHIP; break;
- case VEH_Aircraft: stop_command = CMD_START_STOP_AIRCRAFT; break;
+ case VEH_TRAIN: stop_command = CMD_START_STOP_TRAIN; break;
+ case VEH_ROAD: stop_command = CMD_START_STOP_ROADVEH; break;
+ case VEH_SHIP: stop_command = CMD_START_STOP_SHIP; break;
+ case VEH_AIRCRAFT: stop_command = CMD_START_STOP_AIRCRAFT; break;
default: return CMD_ERROR;
}
@@ -1645,7 +1643,7 @@
if (!!(v->vehstatus & VS_STOPPED) != start_stop) continue;
if (!vehicle_list_window) {
- if (vehicle_type == VEH_Train) {
+ if (vehicle_type == VEH_TRAIN) {
if (CheckTrainInDepot(v, false) == -1) continue;
} else {
if (!(v->vehstatus & VS_HIDDEN)) continue;
@@ -1685,10 +1683,10 @@
byte vehicle_type = GB(p1, 0, 8);
switch (vehicle_type) {
- case VEH_Train: sell_command = CMD_SELL_RAIL_WAGON; break;
- case VEH_Road: sell_command = CMD_SELL_ROAD_VEH; break;
- case VEH_Ship: sell_command = CMD_SELL_SHIP; break;
- case VEH_Aircraft: sell_command = CMD_SELL_AIRCRAFT; break;
+ case VEH_TRAIN: sell_command = CMD_SELL_RAIL_WAGON; break;
+ case VEH_ROAD: sell_command = CMD_SELL_ROAD_VEH; break;
+ case VEH_SHIP: sell_command = CMD_SELL_SHIP; break;
+ case VEH_AIRCRAFT: sell_command = CMD_SELL_AIRCRAFT; break;
default: return CMD_ERROR;
}
@@ -1814,7 +1812,7 @@
if (!CheckOwnership(v->owner)) return CMD_ERROR;
- if (v->type == VEH_Train && (!IsFrontEngine(v) || v->u.rail.crash_anim_pos >= 4400)) return CMD_ERROR;
+ if (v->type == VEH_TRAIN && (!IsFrontEngine(v) || v->u.rail.crash_anim_pos >= 4400)) return CMD_ERROR;
// check that we can allocate enough vehicles
if (!(flags & DC_EXEC)) {
@@ -1857,13 +1855,13 @@
DoCommand(0, w->index, v2->cargo_type | (v2->cargo_subtype << 8), flags, GetCmdRefitVeh(v));
break; // We learned that the engine in question needed a refit. No need to check anymore
}
- } while (v->type == VEH_Train && (w2 = w2->next) != NULL && (v2 = v2->next) != NULL);
-
- if (v->type == VEH_Train && HASBIT(v->u.rail.flags, VRF_REVERSE_DIRECTION)) {
+ } while (v->type == VEH_TRAIN && (w2 = w2->next) != NULL && (v2 = v2->next) != NULL);
+
+ if (v->type == VEH_TRAIN && HASBIT(v->u.rail.flags, VRF_REVERSE_DIRECTION)) {
SETBIT(w->u.rail.flags, VRF_REVERSE_DIRECTION);
}
- if (v->type == VEH_Train && !IsFrontEngine(v)) {
+ if (v->type == VEH_TRAIN && !IsFrontEngine(v)) {
// this s a train car
// add this unit to the end of the train
DoCommand(0, (w_rear->index << 16) | w->index, 1, flags, CMD_MOVE_RAIL_VEHICLE);
@@ -1875,9 +1873,9 @@
}
w_rear = w; // trains needs to know the last car in the train, so they can add more in next loop
}
- } while (v->type == VEH_Train && (v = GetNextVehicle(v)) != NULL);
-
- if (flags & DC_EXEC && v_front->type == VEH_Train) {
+ } while (v->type == VEH_TRAIN && (v = GetNextVehicle(v)) != NULL);
+
+ if (flags & DC_EXEC && v_front->type == VEH_TRAIN) {
// for trains this needs to be the front engine due to the callback function
_new_vehicle_id = w_front->index;
}
@@ -1888,400 +1886,6 @@
return total_cost;
}
-/*
- * move the cargo from one engine to another if possible
- */
-static void MoveVehicleCargo(Vehicle *dest, Vehicle *source)
-{
- Vehicle *v = dest;
- int units_moved;
-
- do {
- do {
- if (source->cargo_type != dest->cargo_type)
- continue; // cargo not compatible
-
- if (dest->cargo_count == dest->cargo_cap)
- continue; // the destination vehicle is already full
-
- units_moved = min(source->cargo_count, dest->cargo_cap - dest->cargo_count);
- source->cargo_count -= units_moved;
- dest->cargo_count += units_moved;
- dest->cargo_source = source->cargo_source;
-
- // copy the age of the cargo
- dest->cargo_days = source->cargo_days;
- dest->day_counter = source->day_counter;
- dest->tick_counter = source->tick_counter;
-
- } while (source->cargo_count > 0 && (dest = dest->next) != NULL);
- dest = v;
- } while ((source = source->next) != NULL);
-
- /*
- * The of the train will be incorrect at this moment. This is due
- * to the fact that removing the old wagon updates the weight of
- * the complete train, which is without the weight of cargo we just
- * moved back into some (of the) new wagon(s).
- */
- if (dest->type == VEH_Train) TrainConsistChanged(dest->first);
-}
-
-static bool VerifyAutoreplaceRefitForOrders(const Vehicle *v, const EngineID engine_type)
-{
- const Order *o;
- const Vehicle *u;
-
- if (v->type == VEH_Train) {
- u = GetFirstVehicleInChain(v);
- } else {
- u = v;
- }
-
- FOR_VEHICLE_ORDERS(u, o) {
- if (!(o->refit_cargo < NUM_CARGO)) continue;
- if (!CanRefitTo(v->engine_type, o->refit_cargo)) continue;
- if (!CanRefitTo(engine_type, o->refit_cargo)) return false;
- }
-
- return true;
-}
-
-/**
- * Function to find what type of cargo to refit to when autoreplacing
- * @param *v Original vehicle, that is being replaced
- * @param engine_type The EngineID of the vehicle that is being replaced to
- * @return The cargo type to replace to
- * CT_NO_REFIT is returned if no refit is needed
- * CT_INVALID is returned when both old and new vehicle got cargo capacity and refitting the new one to the old one's cargo type isn't possible
- */
-static CargoID GetNewCargoTypeForReplace(Vehicle *v, EngineID engine_type)
-{
- bool new_cargo_capacity = true;
- CargoID new_cargo_type = CT_INVALID;
-
- switch (v->type) {
- case VEH_Train:
- new_cargo_capacity = (RailVehInfo(engine_type)->capacity > 0);
- new_cargo_type = RailVehInfo(engine_type)->cargo_type;
- break;
-
- case VEH_Road:
- new_cargo_capacity = (RoadVehInfo(engine_type)->capacity > 0);
- new_cargo_type = RoadVehInfo(engine_type)->cargo_type;
- break;
- case VEH_Ship:
- new_cargo_capacity = (ShipVehInfo(engine_type)->capacity > 0);
- new_cargo_type = ShipVehInfo(engine_type)->cargo_type;
- break;
-
- case VEH_Aircraft:
- /* all aircraft starts as passenger planes with cargo capacity
- * new_cargo_capacity is always true for aircraft, which is the init value. No need to set it here */
- new_cargo_type = CT_PASSENGERS;
- break;
-
- default: NOT_REACHED(); break;
- }
-
- if (!new_cargo_capacity) return CT_NO_REFIT; // Don't try to refit an engine with no cargo capacity
-
- if (v->cargo_type == new_cargo_type || CanRefitTo(engine_type, v->cargo_type)) {
- if (VerifyAutoreplaceRefitForOrders(v, engine_type)) {
- return v->cargo_type == new_cargo_type ? (CargoID)CT_NO_REFIT : v->cargo_type;
- } else {
- return CT_INVALID;
- }
- }
- if (v->type != VEH_Train) return CT_INVALID; // We can't refit the vehicle to carry the cargo we want
-
- /* Below this line it's safe to assume that the vehicle in question is a train */
-
- if (v->cargo_cap != 0) return CT_INVALID; // trying to replace a vehicle with cargo capacity into another one with incompatible cargo type
-
- /* the old engine didn't have cargo capacity, but the new one does
- * now we will figure out what cargo the train is carrying and refit to fit this */
- v = GetFirstVehicleInChain(v);
- do {
- if (v->cargo_cap == 0) continue;
- /* Now we found a cargo type being carried on the train and we will see if it is possible to carry to this one */
- if (v->cargo_type == new_cargo_type) return CT_NO_REFIT;
- if (CanRefitTo(engine_type, v->cargo_type)) return v->cargo_type;
- } while ((v=v->next) != NULL);
- return CT_NO_REFIT; // We failed to find a cargo type on the old vehicle and we will not refit the new one
-}
-
-/* Replaces a vehicle (used to be called autorenew)
- * This function is only called from MaybeReplaceVehicle()
- * Must be called with _current_player set to the owner of the vehicle
- * @param w Vehicle to replace
- * @param flags is the flags to use when calling DoCommand(). Mainly DC_EXEC counts
- * @return value is cost of the replacement or CMD_ERROR
- */
-static int32 ReplaceVehicle(Vehicle **w, byte flags, int32 total_cost)
-{
- int32 cost;
- int32 sell_value;
- Vehicle *old_v = *w;
- const Player *p = GetPlayer(old_v->owner);
- EngineID new_engine_type;
- const UnitID cached_unitnumber = old_v->unitnumber;
- bool new_front = false;
- Vehicle *new_v = NULL;
- char vehicle_name[32];
- CargoID replacement_cargo_type;
-
- new_engine_type = EngineReplacementForPlayer(p, old_v->engine_type);
- if (new_engine_type == INVALID_ENGINE) new_engine_type = old_v->engine_type;
-
- replacement_cargo_type = GetNewCargoTypeForReplace(old_v, new_engine_type);
-
- /* check if we can't refit to the needed type, so no replace takes place to prevent the vehicle from altering cargo type */
- if (replacement_cargo_type == CT_INVALID) return 0;
-
- sell_value = DoCommand(0, old_v->index, 0, DC_QUERY_COST, GetCmdSellVeh(old_v));
-
- /* We give the player a loan of the same amount as the sell value.
- * This is needed in case he needs the income from the sale to build the new vehicle.
- * We take it back if building fails or when we really sell the old engine */
- SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
- SubtractMoneyFromPlayer(sell_value);
-
- cost = DoCommand(old_v->tile, new_engine_type, 3, flags, GetCmdBuildVeh(old_v));
- if (CmdFailed(cost)) {
- SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
- SubtractMoneyFromPlayer(-sell_value); // Take back the money we just gave the player
- return cost;
- }
-
- if (replacement_cargo_type != CT_NO_REFIT) cost += GetRefitCost(new_engine_type); // add refit cost
-
- if (flags & DC_EXEC) {
- new_v = GetVehicle(_new_vehicle_id);
- *w = new_v; //we changed the vehicle, so MaybeReplaceVehicle needs to work on the new one. Now we tell it what the new one is
-
- /* refit if needed */
- if (replacement_cargo_type != CT_NO_REFIT) {
- if (CmdFailed(DoCommand(0, new_v->index, replacement_cargo_type, DC_EXEC, GetCmdRefitVeh(new_v)))) {
- /* Being here shows a failure, which most likely is in GetNewCargoTypeForReplace() or incorrect estimation costs */
- error("Autoreplace failed to refit. Replace engine %d to %d and refit to cargo %d", old_v->engine_type, new_v->engine_type, replacement_cargo_type);
- }
- }
-
- if (new_v->type == VEH_Train && HASBIT(old_v->u.rail.flags, VRF_REVERSE_DIRECTION) && !IsMultiheaded(new_v) && !(new_v->next != NULL && IsArticulatedPart(new_v->next))) {
- // we are autorenewing to a single engine, so we will turn it as the old one was turned as well
- SETBIT(new_v->u.rail.flags, VRF_REVERSE_DIRECTION);
- }
-
- if (old_v->type == VEH_Train && !IsFrontEngine(old_v)) {
- /* this is a railcar. We need to move the car into the train
- * We add the new engine after the old one instead of replacing it. It will give the same result anyway when we
- * sell the old engine in a moment
- */
- DoCommand(0, (GetPrevVehicleInChain(old_v)->index << 16) | new_v->index, 1, DC_EXEC, CMD_MOVE_RAIL_VEHICLE);
- /* Now we move the old one out of the train */
- DoCommand(0, (INVALID_VEHICLE << 16) | old_v->index, 0, DC_EXEC, CMD_MOVE_RAIL_VEHICLE);
- } else {
- // copy/clone the orders
- DoCommand(0, (old_v->index << 16) | new_v->index, IsOrderListShared(old_v) ? CO_SHARE : CO_COPY, DC_EXEC, CMD_CLONE_ORDER);
- new_v->cur_order_index = old_v->cur_order_index;
- ChangeVehicleViewWindow(old_v, new_v);
- new_v->profit_this_year = old_v->profit_this_year;
- new_v->profit_last_year = old_v->profit_last_year;
- new_v->service_interval = old_v->service_interval;
- new_front = true;
- new_v->unitnumber = old_v->unitnumber; // use the same unit number
-
- new_v->current_order = old_v->current_order;
- if (old_v->type == VEH_Train && GetNextVehicle(old_v) != NULL){
- Vehicle *temp_v = GetNextVehicle(old_v);
-
- // move the entire train to the new engine, excluding the old engine
- if (IsMultiheaded(old_v) && temp_v == old_v->u.rail.other_multiheaded_part) {
- // we got front and rear of a multiheaded engine right after each other. We should work with the next in line instead
- temp_v = GetNextVehicle(temp_v);
- }
-
- if (temp_v != NULL) {
- DoCommand(0, (new_v->index << 16) | temp_v->index, 1, DC_EXEC, CMD_MOVE_RAIL_VEHICLE);
- }
- }
- }
- /* We are done setting up the new vehicle. Now we move the cargo from the old one to the new one */
- MoveVehicleCargo(new_v->type == VEH_Train ? GetFirstVehicleInChain(new_v) : new_v, old_v);
-
- // Get the name of the old vehicle if it has a custom name.
- if (!IsCustomName(old_v->string_id)) {
- vehicle_name[0] = '\0';
- } else {
- GetName(vehicle_name, old_v->string_id & 0x7FF, lastof(vehicle_name));
- }
- } else { // flags & DC_EXEC not set
- /* Ensure that the player will not end up having negative money while autoreplacing
- * This is needed because the only other check is done after the income from selling the old vehicle is substracted from the cost */
- if (p->money64 < (cost + total_cost)) {
- SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
- SubtractMoneyFromPlayer(-sell_value); // Pay back the loan
- return CMD_ERROR;
- }
- }
-
- /* Take back the money we just gave the player just before building the vehicle
- * The player will get the same amount now that the sale actually takes place */
- SET_EXPENSES_TYPE(EXPENSES_NEW_VEHICLES);
- SubtractMoneyFromPlayer(-sell_value);
-
- /* sell the engine/ find out how much you get for the old engine (income is returned as negative cost) */
- cost += DoCommand(0, old_v->index, 0, flags, GetCmdSellVeh(old_v));
-
- if (new_front) {
- /* now we assign the old unitnumber to the new vehicle */
- new_v->unitnumber = cached_unitnumber;
- }
-
- /* Transfer the name of the old vehicle */
- if ((flags & DC_EXEC) && vehicle_name[0] != '\0') {
- _cmd_text = vehicle_name;
- DoCommand(0, new_v->index, 0, DC_EXEC, CMD_NAME_VEHICLE);
- }
-
- return cost;
-}
-
-/** replaces a vehicle if it's set for autoreplace or is too old
- * (used to be called autorenew)
- * @param v The vehicle to replace
- * if the vehicle is a train, v needs to be the front engine
- * @param check Checks if the replace is valid. No action is done at all
- * @param display_costs If set, a cost animation is shown (only if check is false)
- * @return CMD_ERROR if something went wrong. Otherwise the price of the replace
- */
-static int32 MaybeReplaceVehicle(Vehicle *v, bool check, bool display_costs)
-{
- Vehicle *w;
- const Player *p = GetPlayer(v->owner);
- byte flags = 0;
- int32 cost, temp_cost = 0;
- bool stopped;
-
- /* Remember the length in case we need to trim train later on
- * If it's not a train, the value is unused
- * round up to the length of the tiles used for the train instead of the train length instead
- * Useful when newGRF uses custom length */
- uint16 old_total_length = (v->type == VEH_Train ?
- (v->u.rail.cached_total_length + TILE_SIZE - 1) / TILE_SIZE * TILE_SIZE :
- -1
- );
-
-
- _current_player = v->owner;
-
- assert(IsPlayerBuildableVehicleType(v));
-
- assert(v->vehstatus & VS_STOPPED); // the vehicle should have been stopped in VehicleEnteredDepotThisTick() if needed
-
- /* Remember the flag v->leave_depot_instantly because if we replace the vehicle, the vehicle holding this flag will be sold
- * If it is set, then we only stopped the vehicle to replace it (if needed) and we will need to start it again.
- * We also need to reset the flag since it should remain false except from when the vehicle enters a depot until autoreplace is handled in the same tick */
- stopped = v->leave_depot_instantly;
- v->leave_depot_instantly = false;
-
- for (;;) {
- cost = 0;
- w = v;
- do {
- if (w->type == VEH_Train && IsMultiheaded(w) && !IsTrainEngine(w)) {
- /* we build the rear ends of multiheaded trains with the front ones */
- continue;
- }
-
- // check if the vehicle should be replaced
- if (!p->engine_renew ||
- w->age - w->max_age < (p->engine_renew_months * 30) || // replace if engine is too old
- w->max_age == 0) { // rail cars got a max age of 0
- if (!EngineHasReplacementForPlayer(p, w->engine_type)) // updates to a new model
- continue;
- }
-
- /* Now replace the vehicle */
- temp_cost = ReplaceVehicle(&w, flags, cost);
-
- if (flags & DC_EXEC &&
- (w->type != VEH_Train || w->u.rail.first_engine == INVALID_ENGINE)) {
- /* now we bought a new engine and sold the old one. We need to fix the
- * pointers in order to avoid pointing to the old one for trains: these
- * pointers should point to the front engine and not the cars
- */
- v = w;
- }
-
- if (!CmdFailed(temp_cost)) {
- cost += temp_cost;
- }
- } while (w->type == VEH_Train && (w = GetNextVehicle(w)) != NULL);
-
- if (!(flags & DC_EXEC) && (p->money64 < (int32)(cost + p->engine_renew_money) || cost == 0)) {
- if (!check && p->money64 < (int32)(cost + p->engine_renew_money) && ( _local_player == v->owner ) && cost != 0) {
- StringID message;
- SetDParam(0, v->unitnumber);
- switch (v->type) {
- case VEH_Train: message = STR_TRAIN_AUTORENEW_FAILED; break;
- case VEH_Road: message = STR_ROADVEHICLE_AUTORENEW_FAILED; break;
- case VEH_Ship: message = STR_SHIP_AUTORENEW_FAILED; break;
- case VEH_Aircraft: message = STR_AIRCRAFT_AUTORENEW_FAILED; break;
- // This should never happen
- default: NOT_REACHED(); message = 0; break;
- }
-
- AddNewsItem(message, NEWS_FLAGS(NM_SMALL, NF_VIEWPORT|NF_VEHICLE, NT_ADVICE, 0), v->index, 0);
- }
- if (stopped) v->vehstatus &= ~VS_STOPPED;
- if (display_costs) _current_player = OWNER_NONE;
- return CMD_ERROR;
- }
-
- if (flags & DC_EXEC) {
- break; // we are done replacing since the loop ran once with DC_EXEC
- } else if (check) {
- /* It's a test only and we know that we can do this
- * NOTE: payment for wagon removal is NOT included in this price */
- return cost;
- }
- // now we redo the loop, but this time we actually do stuff since we know that we can do it
- flags |= DC_EXEC;
- }
-
- /* If setting is on to try not to exceed the old length of the train with the replacement */
- if (v->type == VEH_Train && p->renew_keep_length) {
- Vehicle *temp;
- w = v;
-
- while (v->u.rail.cached_total_length > old_total_length) {
- // the train is too long. We will remove cars one by one from the start of the train until it's short enough
- while (w != NULL && RailVehInfo(w->engine_type)->railveh_type != RAILVEH_WAGON) {
- w = GetNextVehicle(w);
- }
- if (w == NULL) {
- // we failed to make the train short enough
- SetDParam(0, v->unitnumber);
- AddNewsItem(STR_TRAIN_TOO_LONG_AFTER_REPLACEMENT, NEWS_FLAGS(NM_SMALL, NF_VIEWPORT|NF_VEHICLE, NT_ADVICE, 0), v->index, 0);
- break;
- }
- temp = w;
- w = GetNextVehicle(w);
- DoCommand(0, (INVALID_VEHICLE << 16) | temp->index, 0, DC_EXEC, CMD_MOVE_RAIL_VEHICLE);
- MoveVehicleCargo(v, temp);
- cost += DoCommand(0, temp->index, 0, DC_EXEC, CMD_SELL_RAIL_WAGON);
- }
- }
-
- if (stopped) v->vehstatus &= ~VS_STOPPED;
- if (display_costs) {
- if (IsLocalPlayer()) ShowCostOrIncomeAnimation(v->x_pos, v->y_pos, v->z_pos, cost);
- _current_player = OWNER_NONE;
- }
- return cost;
-}
/* Extend the list size for BuildDepotVehicleList() */
static inline void ExtendVehicleListSize(const Vehicle ***engine_list, uint16 *engine_list_length, uint16 step_size)
@@ -2307,8 +1911,8 @@
Vehicle *v;
/* This function should never be called without an array to store results */
- assert(!(engine_list == NULL && type != VEH_Train));
- assert(!(type == VEH_Train && engine_list == NULL && wagon_list == NULL));
+ assert(!(engine_list == NULL && type != VEH_TRAIN));
+ assert(!(type == VEH_TRAIN && engine_list == NULL && wagon_list == NULL));
/* Both array and the length should either be NULL to disable the list or both should not be NULL */
assert((engine_list == NULL && engine_list_length == NULL) || (engine_list != NULL && engine_list_length != NULL));
@@ -2321,9 +1925,9 @@
if (wagon_count != NULL) *wagon_count = 0;
switch (type) {
- case VEH_Train:
+ case VEH_TRAIN:
FOR_ALL_VEHICLES(v) {
- if (v->tile == tile && v->type == VEH_Train && v->u.rail.track == TRACK_BIT_DEPOT) {
+ if (v->tile == tile && v->type == VEH_TRAIN && v->u.rail.track == TRACK_BIT_DEPOT) {
if (IsFrontEngine(v)) {
if (engine_list == NULL) continue;
if (*engine_count == *engine_list_length) ExtendVehicleListSize((const Vehicle***)engine_list, engine_list_length, 25);
@@ -2337,28 +1941,28 @@
}
break;
- case VEH_Road:
+ case VEH_ROAD:
FOR_ALL_VEHICLES(v) {
- if (v->tile == tile && v->type == VEH_Road && IsRoadVehInDepot(v)) {
+ if (v->tile == tile && v->type == VEH_ROAD && IsRoadVehInDepot(v)) {
if (*engine_count == *engine_list_length) ExtendVehicleListSize((const Vehicle***)engine_list, engine_list_length, 25);
(*engine_list)[(*engine_count)++] = v;
}
}
break;
- case VEH_Ship:
+ case VEH_SHIP:
FOR_ALL_VEHICLES(v) {
- if (v->tile == tile && v->type == VEH_Ship && IsShipInDepot(v)) {
+ if (v->tile == tile && v->type == VEH_SHIP && IsShipInDepot(v)) {
if (*engine_count == *engine_list_length) ExtendVehicleListSize((const Vehicle***)engine_list, engine_list_length, 25);
(*engine_list)[(*engine_count)++] = v;
}
}
break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
FOR_ALL_VEHICLES(v) {
if (v->tile == tile &&
- v->type == VEH_Aircraft && IsNormalAircraft(v) &&
+ v->type == VEH_AIRCRAFT && IsNormalAircraft(v) &&
v->vehstatus & VS_HIDDEN) {
if (*engine_count == *engine_list_length) ExtendVehicleListSize((const Vehicle***)engine_list, engine_list_length, 25);
(*engine_list)[(*engine_count)++] = v;
@@ -2385,7 +1989,7 @@
*/
uint GenerateVehicleSortList(const Vehicle ***sort_list, uint16 *length_of_array, byte type, PlayerID owner, uint32 index, uint16 window_type)
{
- const byte subtype = (type != VEH_Aircraft) ? (byte)Train_Front : (byte)AIR_AIRCRAFT;
+ const byte subtype = (type != VEH_AIRCRAFT) ? (byte)Train_Front : (byte)AIR_AIRCRAFT;
uint n = 0;
const Vehicle *v;
@@ -2393,8 +1997,8 @@
case VLW_STATION_LIST: {
FOR_ALL_VEHICLES(v) {
if (v->type == type && (
- (type == VEH_Train && IsFrontEngine(v)) ||
- (type != VEH_Train && v->subtype <= subtype))) {
+ (type == VEH_TRAIN && IsFrontEngine(v)) ||
+ (type != VEH_TRAIN && v->subtype <= subtype))) {
const Order *order;
FOR_VEHICLE_ORDERS(v, order) {
@@ -2428,8 +2032,8 @@
case VLW_STANDARD: {
FOR_ALL_VEHICLES(v) {
if (v->type == type && v->owner == owner && (
- (type == VEH_Train && IsFrontEngine(v)) ||
- (type != VEH_Train && v->subtype <= subtype))) {
+ (type == VEH_TRAIN && IsFrontEngine(v)) ||
+ (type != VEH_TRAIN && v->subtype <= subtype))) {
/* TODO find a better estimate on the total number of vehicles for current player */
if (n == *length_of_array) ExtendVehicleListSize(sort_list, length_of_array, GetNumVehicles()/4);
(*sort_list)[n++] = v;
@@ -2441,8 +2045,8 @@
case VLW_DEPOT_LIST: {
FOR_ALL_VEHICLES(v) {
if (v->type == type && (
- (type == VEH_Train && IsFrontEngine(v)) ||
- (type != VEH_Train && v->subtype <= subtype))) {
+ (type == VEH_TRAIN && IsFrontEngine(v)) ||
+ (type != VEH_TRAIN && v->subtype <= subtype))) {
const Order *order;
FOR_VEHICLE_ORDERS(v, order) {
@@ -2510,10 +2114,10 @@
bool IsVehicleInDepot(const Vehicle *v)
{
switch (v->type) {
- case VEH_Train: return CheckTrainInDepot(v, false) != -1;
- case VEH_Road: return IsRoadVehInDepot(v);
- case VEH_Ship: return IsShipInDepot(v);
- case VEH_Aircraft: return IsAircraftInHangar(v);
+ case VEH_TRAIN: return CheckTrainInDepot(v, false) != -1;
+ case VEH_ROAD: return IsRoadVehInDepot(v);
+ case VEH_SHIP: return IsShipInDepot(v);
+ case VEH_AIRCRAFT: return IsAircraftInHangar(v);
default: NOT_REACHED();
}
return false;
@@ -2522,32 +2126,32 @@
void VehicleEnterDepot(Vehicle *v)
{
switch (v->type) {
- case VEH_Train:
+ case VEH_TRAIN:
InvalidateWindowClasses(WC_TRAINS_LIST);
if (!IsFrontEngine(v)) v = GetFirstVehicleInChain(v);
UpdateSignalsOnSegment(v->tile, GetRailDepotDirection(v->tile));
v->load_unload_time_rem = 0;
break;
- case VEH_Road:
+ case VEH_ROAD:
InvalidateWindowClasses(WC_ROADVEH_LIST);
v->u.road.state = RVSB_IN_DEPOT;
break;
- case VEH_Ship:
+ case VEH_SHIP:
InvalidateWindowClasses(WC_SHIPS_LIST);
v->u.ship.state = TRACK_BIT_DEPOT;
RecalcShipStuff(v);
break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
InvalidateWindowClasses(WC_AIRCRAFT_LIST);
HandleAircraftEnterHangar(v);
break;
default: NOT_REACHED();
}
- if (v->type != VEH_Train) {
+ if (v->type != VEH_TRAIN) {
/* Trains update the vehicle list when the first unit enters the depot and calls VehicleEnterDepot() when the last unit enters.
* We only increase the number of vehicles when the first one enters, so we will not need to search for more vehicles in the depot */
InvalidateWindowData(WC_VEHICLE_DEPOT, v->tile);
@@ -2591,7 +2195,7 @@
if (HASBIT(t.flags, OFB_PART_OF_ORDERS)) {
/* Part of orders */
- if (v->type == VEH_Train) v->u.rail.days_since_order_progr = 0;
+ if (v->type == VEH_TRAIN) v->u.rail.days_since_order_progr = 0;
v->cur_order_index++;
} else if (HASBIT(t.flags, OFB_HALT_IN_DEPOT)) {
/* Force depot visit */
@@ -2600,10 +2204,10 @@
StringID string;
switch (v->type) {
- case VEH_Train: string = STR_8814_TRAIN_IS_WAITING_IN_DEPOT; break;
- case VEH_Road: string = STR_9016_ROAD_VEHICLE_IS_WAITING; break;
- case VEH_Ship: string = STR_981C_SHIP_IS_WAITING_IN_DEPOT; break;
- case VEH_Aircraft: string = STR_A014_AIRCRAFT_IS_WAITING_IN; break;
+ case VEH_TRAIN: string = STR_8814_TRAIN_IS_WAITING_IN_DEPOT; break;
+ case VEH_ROAD: string = STR_9016_ROAD_VEHICLE_IS_WAITING; break;
+ case VEH_SHIP: string = STR_981C_SHIP_IS_WAITING_IN_DEPOT; break;
+ case VEH_AIRCRAFT: string = STR_A014_AIRCRAFT_IS_WAITING_IN; break;
default: NOT_REACHED(); string = STR_EMPTY; // Set the string to something to avoid a compiler warning
}
@@ -2744,7 +2348,7 @@
if (v->vehstatus & VS_CRASHED) return INVALID_TRACKDIR;
switch (v->type) {
- case VEH_Train:
+ case VEH_TRAIN:
if (v->u.rail.track == TRACK_BIT_DEPOT) /* We'll assume the train is facing outwards */
return DiagdirToDiagTrackdir(GetRailDepotDirection(v->tile)); /* Train in depot */
@@ -2753,14 +2357,14 @@
return TrackDirectionToTrackdir(FindFirstTrack(v->u.rail.track), v->direction);
- case VEH_Ship:
+ case VEH_SHIP:
if (IsShipInDepot(v))
/* We'll assume the ship is facing outwards */
return DiagdirToDiagTrackdir(GetShipDepotDirection(v->tile));
return TrackDirectionToTrackdir(FindFirstTrack(v->u.ship.state), v->direction);
- case VEH_Road:
+ case VEH_ROAD:
if (IsRoadVehInDepot(v)) /* We'll assume the road vehicle is facing outwards */
return DiagdirToDiagTrackdir(GetRoadDepotDirection(v->tile));
@@ -2775,7 +2379,7 @@
/* Vehicle is turning around, get the direction from vehicle's direction */
return DiagdirToDiagTrackdir(DirToDiagDir(v->direction));
- /* case VEH_Aircraft: case VEH_Special: case VEH_Disaster: */
+ /* case VEH_AIRCRAFT: case VEH_SPECIAL: case VEH_DISASTER: */
default: return INVALID_TRACKDIR;
}
}
@@ -2797,10 +2401,10 @@
static UnitID gmax = 0;
switch (type) {
- case VEH_Train: max = _patches.max_trains; break;
- case VEH_Road: max = _patches.max_roadveh; break;
- case VEH_Ship: max = _patches.max_ships; break;
- case VEH_Aircraft: max = _patches.max_aircraft; break;
+ case VEH_TRAIN: max = _patches.max_trains; break;
+ case VEH_ROAD: max = _patches.max_roadveh; break;
+ case VEH_SHIP: max = _patches.max_ships; break;
+ case VEH_AIRCRAFT: max = _patches.max_aircraft; break;
default: NOT_REACHED();
}
@@ -2860,7 +2464,7 @@
if (p->livery[LS_DEFAULT].in_use && (_patches.liveries == 2 || (_patches.liveries == 1 && player == _local_player))) {
/* Determine the livery scheme to use */
switch (GetEngine(engine_type)->type) {
- case VEH_Train: {
+ case VEH_TRAIN: {
const RailVehicleInfo *rvi = RailVehInfo(engine_type);
switch (rvi->railtype) {
@@ -2901,21 +2505,21 @@
break;
}
- case VEH_Road: {
+ case VEH_ROAD: {
const RoadVehicleInfo *rvi = RoadVehInfo(engine_type);
if (cargo_type == CT_INVALID) cargo_type = rvi->cargo_type;
scheme = (cargo_type == CT_PASSENGERS) ? LS_BUS : LS_TRUCK;
break;
}
- case VEH_Ship: {
+ case VEH_SHIP: {
const ShipVehicleInfo *svi = ShipVehInfo(engine_type);
if (cargo_type == CT_INVALID) cargo_type = svi->cargo_type;
scheme = (cargo_type == CT_PASSENGERS) ? LS_PASSENGER_SHIP : LS_FREIGHT_SHIP;
break;
}
- case VEH_Aircraft: {
+ case VEH_AIRCRAFT: {
const AircraftVehicleInfo *avi = AircraftVehInfo(engine_type);
if (cargo_type == CT_INVALID) cargo_type = CT_PASSENGERS;
switch (avi->subtype) {
@@ -2948,7 +2552,7 @@
SpriteID GetVehiclePalette(const Vehicle *v)
{
- if (v->type == VEH_Train) {
+ if (v->type == VEH_TRAIN) {
return GetEngineColourMap(
(v->u.rail.first_engine != INVALID_ENGINE && (IsArticulatedPart(v) || UsesWagonOverride(v))) ?
v->u.rail.first_engine : v->engine_type,
@@ -3071,7 +2675,7 @@
static const SaveLoad _train_desc[] = {
- SLE_WRITEBYTE(Vehicle, type, VEH_Train, 0), // Train type. VEH_Train in mem, 0 in file.
+ SLE_WRITEBYTE(Vehicle, type, VEH_TRAIN, 0), // Train type. VEH_TRAIN in mem, 0 in file.
SLE_INCLUDEX(0, INC_VEHICLE_COMMON),
SLE_VARX(offsetof(Vehicle, u) + offsetof(VehicleRail, crash_anim_pos), SLE_UINT16),
SLE_VARX(offsetof(Vehicle, u) + offsetof(VehicleRail, force_proceed), SLE_UINT8),
@@ -3089,7 +2693,7 @@
};
static const SaveLoad _roadveh_desc[] = {
- SLE_WRITEBYTE(Vehicle, type, VEH_Road, 1), // Road type. VEH_Road in mem, 1 in file.
+ SLE_WRITEBYTE(Vehicle, type, VEH_ROAD, 1), // Road type. VEH_ROAD in mem, 1 in file.
SLE_INCLUDEX(0, INC_VEHICLE_COMMON),
SLE_VARX(offsetof(Vehicle, u) + offsetof(VehicleRoad, state), SLE_UINT8),
SLE_VARX(offsetof(Vehicle, u) + offsetof(VehicleRoad, frame), SLE_UINT8),
@@ -3109,7 +2713,7 @@
};
static const SaveLoad _ship_desc[] = {
- SLE_WRITEBYTE(Vehicle, type, VEH_Ship, 2), // Ship type. VEH_Ship in mem, 2 in file.
+ SLE_WRITEBYTE(Vehicle, type, VEH_SHIP, 2), // Ship type. VEH_SHIP in mem, 2 in file.
SLE_INCLUDEX(0, INC_VEHICLE_COMMON),
SLE_VARX(offsetof(Vehicle, u) + offsetof(VehicleShip, state), SLE_UINT8),
@@ -3120,7 +2724,7 @@
};
static const SaveLoad _aircraft_desc[] = {
- SLE_WRITEBYTE(Vehicle, type, VEH_Aircraft, 3), // Aircraft type. VEH_Aircraft in mem, 3 in file.
+ SLE_WRITEBYTE(Vehicle, type, VEH_AIRCRAFT, 3), // Aircraft type. VEH_AIRCRAFT in mem, 3 in file.
SLE_INCLUDEX(0, INC_VEHICLE_COMMON),
SLE_VARX(offsetof(Vehicle, u) + offsetof(VehicleAir, crashed_counter), SLE_UINT16),
SLE_VARX(offsetof(Vehicle, u) + offsetof(VehicleAir, pos), SLE_UINT8),
@@ -3139,7 +2743,7 @@
};
static const SaveLoad _special_desc[] = {
- SLE_WRITEBYTE(Vehicle,type,VEH_Special, 4),
+ SLE_WRITEBYTE(Vehicle,type,VEH_SPECIAL, 4),
SLE_VAR(Vehicle, subtype, SLE_UINT8),
@@ -3171,7 +2775,7 @@
};
static const SaveLoad _disaster_desc[] = {
- SLE_WRITEBYTE(Vehicle, type, VEH_Disaster, 5),
+ SLE_WRITEBYTE(Vehicle, type, VEH_DISASTER, 5),
SLE_REF(Vehicle, next, REF_VEHICLE_OLD),
@@ -3223,7 +2827,7 @@
};
// Will be called when the vehicles need to be saved.
-static void Save_VEHS(void)
+static void Save_VEHS()
{
Vehicle *v;
// Write the vehicles
@@ -3234,7 +2838,7 @@
}
// Will be called when vehicles need to be loaded.
-static void Load_VEHS(void)
+static void Load_VEHS()
{
int index;
Vehicle *v;
@@ -3284,13 +2888,13 @@
void Vehicle::BeginLoading()
{
- assert(IsTileType(tile, MP_STATION) || type == VEH_Ship);
+ assert(IsTileType(tile, MP_STATION) || type == VEH_SHIP);
current_order.type = OT_LOADING;
}
void Vehicle::LeaveStation()
{
- assert(IsTileType(tile, MP_STATION) || type == VEH_Ship);
+ assert(IsTileType(tile, MP_STATION) || type == VEH_SHIP);
assert(current_order.type == OT_LOADING);
current_order.type = OT_LEAVESTATION;
current_order.flags = 0;
--- a/src/vehicle.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/vehicle.h Sun Mar 11 16:31:18 2007 +0000
@@ -63,13 +63,13 @@
};
enum {
- VEH_Train,
- VEH_Road,
- VEH_Ship,
- VEH_Aircraft,
- VEH_Special,
- VEH_Disaster,
- VEH_Invalid = 0xFF,
+ VEH_TRAIN,
+ VEH_ROAD,
+ VEH_SHIP,
+ VEH_AIRCRAFT,
+ VEH_SPECIAL,
+ VEH_DISASTER,
+ VEH_INVALID = 0xFF,
} ;
enum VehStatus {
@@ -90,7 +90,7 @@
};
/* Effect vehicle types */
-typedef enum EffectVehicle {
+enum EffectVehicle {
EV_CHIMNEY_SMOKE = 0,
EV_STEAM_SMOKE = 1,
EV_DIESEL_SMOKE = 2,
@@ -101,9 +101,9 @@
EV_EXPLOSION_SMALL = 7,
EV_BULLDOZER = 8,
EV_BUBBLE = 9
-} EffectVehicle;
+};
-typedef struct VehicleRail {
+struct VehicleRail {
uint16 last_speed; // NOSAVE: only used in UI
uint16 crash_anim_pos;
uint16 days_since_order_progr;
@@ -140,7 +140,7 @@
// Link between the two ends of a multiheaded engine
Vehicle *other_multiheaded_part;
-} VehicleRail;
+};
enum {
VRF_REVERSING = 0,
@@ -162,15 +162,15 @@
VRF_EL_ENGINE_ALLOWED_NORMAL_RAIL = 6,
};
-typedef struct VehicleAir {
+struct VehicleAir {
uint16 crashed_counter;
byte pos;
byte previous_pos;
StationID targetairport;
byte state;
-} VehicleAir;
+};
-typedef struct VehicleRoad {
+struct VehicleRoad {
byte state; /// @see RoadVehicleStates
byte frame;
uint16 blocked_ctr;
@@ -180,21 +180,21 @@
byte reverse_ctr;
struct RoadStop *slot;
byte slot_age;
-} VehicleRoad;
+};
-typedef struct VehicleSpecial {
+struct VehicleSpecial {
uint16 unk0;
byte unk2;
-} VehicleSpecial;
+};
-typedef struct VehicleDisaster {
+struct VehicleDisaster {
uint16 image_override;
uint16 unk2;
-} VehicleDisaster;
+};
-typedef struct VehicleShip {
+struct VehicleShip {
TrackBitsByte state;
-} VehicleShip;
+};
struct Vehicle {
@@ -322,12 +322,12 @@
typedef void *VehicleFromPosProc(Vehicle *v, void *data);
void VehicleServiceInDepot(Vehicle *v);
-Vehicle *AllocateVehicle(void);
+Vehicle *AllocateVehicle();
bool AllocateVehicles(Vehicle **vl, int num);
-Vehicle *ForceAllocateVehicle(void);
-Vehicle *ForceAllocateSpecialVehicle(void);
+Vehicle *ForceAllocateVehicle();
+Vehicle *ForceAllocateSpecialVehicle();
void VehiclePositionChanged(Vehicle *v);
-void AfterLoadVehicles(void);
+void AfterLoadVehicles();
Vehicle *GetLastVehicleInChain(Vehicle *v);
Vehicle *GetPrevVehicleInChain(const Vehicle *v);
Vehicle *GetFirstVehicleInChain(const Vehicle *v);
@@ -335,12 +335,12 @@
bool IsEngineCountable(const Vehicle *v);
void DeleteVehicleChain(Vehicle *v);
void *VehicleFromPos(TileIndex tile, void *data, VehicleFromPosProc *proc);
-void CallVehicleTicks(void);
+void CallVehicleTicks();
Vehicle *FindVehicleOnTileZ(TileIndex tile, byte z);
-void InitializeTrains(void);
-byte VehicleRandomBits(void);
-void ResetVehiclePosHash(void);
+void InitializeTrains();
+byte VehicleRandomBits();
+void ResetVehiclePosHash();
bool CanFillVehicle(Vehicle *v);
bool CanRefitTo(EngineID engine_type, CargoID cid_to);
@@ -400,6 +400,8 @@
void InvalidateAutoreplaceWindow(EngineID e);
+int32 MaybeReplaceVehicle(Vehicle *v, bool check, bool display_costs);
+
/* Flags to add to p2 for goto depot commands */
/* Note: bits 8-10 are used for VLW flags */
enum {
@@ -409,11 +411,11 @@
DEPOT_LOCATE_HANGAR = (1 << 3), // Find another airport if the target one lacks a hangar
};
-typedef struct GetNewVehiclePosResult {
+struct GetNewVehiclePosResult {
int x,y;
TileIndex old_tile;
TileIndex new_tile;
-} GetNewVehiclePosResult;
+};
/**
* Returns the Trackdir on which the vehicle is currently located.
@@ -437,7 +439,7 @@
DECLARE_OLD_POOL(Vehicle, Vehicle, 9, 125)
-static inline VehicleID GetMaxVehicleIndex(void)
+static inline VehicleID GetMaxVehicleIndex()
{
/* TODO - This isn't the real content of the function, but
* with the new pool-system this will be replaced with one that
@@ -447,7 +449,7 @@
return GetVehiclePoolSize() - 1;
}
-static inline uint GetNumVehicles(void)
+static inline uint GetNumVehicles()
{
return GetVehiclePoolSize();
}
@@ -457,7 +459,7 @@
*/
static inline bool IsValidVehicle(const Vehicle *v)
{
- return v->type != VEH_Invalid;
+ return v->type != VEH_INVALID;
}
void DestroyVehicle(Vehicle *v);
@@ -465,16 +467,16 @@
static inline void DeleteVehicle(Vehicle *v)
{
DestroyVehicle(v);
- v->type = VEH_Invalid;
+ v->type = VEH_INVALID;
}
static inline bool IsPlayerBuildableVehicleType(byte type)
{
switch (type) {
- case VEH_Train:
- case VEH_Road:
- case VEH_Ship:
- case VEH_Aircraft:
+ case VEH_TRAIN:
+ case VEH_ROAD:
+ case VEH_SHIP:
+ case VEH_AIRCRAFT:
return true;
}
return false;
--- a/src/vehicle_gui.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/vehicle_gui.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -30,22 +30,22 @@
#include "helpers.hpp"
#include "cargotype.h"
-typedef struct Sorting {
+struct Sorting {
Listing aircraft;
Listing roadveh;
Listing ship;
Listing train;
-} Sorting;
+};
static Sorting _sorting;
-typedef struct vehiclelist_d {
+struct vehiclelist_d {
const Vehicle** sort_list; // List of vehicles (sorted)
Listing *_sorting; // pointer to the appropiate subcategory of _sorting
uint16 length_of_sort_list; // Keeps track of how many vehicle pointers sort list got space for
byte vehicle_type; // The vehicle type that is sorted
list_d l; // General list struct
-} vehiclelist_d;
+};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vehiclelist_d));
static bool _internal_sort_order; // descending/ascending
@@ -90,7 +90,7 @@
INVALID_STRING_ID
};
-void RebuildVehicleLists(void)
+void RebuildVehicleLists()
{
BaseWindow *w = NULL;
@@ -109,7 +109,7 @@
}
}
-void ResortVehicleLists(void)
+void ResortVehicleLists()
{
BaseWindow *w = NULL;
@@ -177,17 +177,17 @@
DrawSprite(SPR_BLOT, pal, x, y);
}
-typedef struct RefitOption {
+struct RefitOption {
CargoID cargo;
byte subtype;
uint16 value;
EngineID engine;
-} RefitOption;
+};
-typedef struct RefitList {
+struct RefitList {
uint num_lines;
RefitOption *items;
-} RefitList;
+};
static RefitList *BuildRefitList(const Vehicle *v)
{
@@ -264,7 +264,7 @@
}
}
}
- } while (v->type == VEH_Train && (u = u->next) != NULL && num_lines < max_lines);
+ } while (v->type == VEH_TRAIN && (u = u->next) != NULL && num_lines < max_lines);
list->num_lines = num_lines;
list->items = refit;
@@ -317,7 +317,7 @@
case WE_PAINT: {
Vehicle *v = GetVehicle(w->window_number);
- if (v->type == VEH_Train) {
+ if (v->type == VEH_TRAIN) {
uint length = CountVehiclesInChain(v);
if (length != WP(w, refit_d).length) {
@@ -369,10 +369,10 @@
int command = 0;
switch (v->type) {
- case VEH_Train: command = CMD_REFIT_RAIL_VEHICLE | CMD_MSG(STR_RAIL_CAN_T_REFIT_VEHICLE); break;
- case VEH_Road: command = CMD_REFIT_ROAD_VEH | CMD_MSG(STR_REFIT_ROAD_VEHICLE_CAN_T); break;
- case VEH_Ship: command = CMD_REFIT_SHIP | CMD_MSG(STR_9841_CAN_T_REFIT_SHIP); break;
- case VEH_Aircraft: command = CMD_REFIT_AIRCRAFT | CMD_MSG(STR_A042_CAN_T_REFIT_AIRCRAFT); break;
+ case VEH_TRAIN: command = CMD_REFIT_RAIL_VEHICLE | CMD_MSG(STR_RAIL_CAN_T_REFIT_VEHICLE); break;
+ case VEH_ROAD: command = CMD_REFIT_ROAD_VEH | CMD_MSG(STR_REFIT_ROAD_VEHICLE_CAN_T); break;
+ case VEH_SHIP: command = CMD_REFIT_SHIP | CMD_MSG(STR_9841_CAN_T_REFIT_SHIP); break;
+ case VEH_AIRCRAFT: command = CMD_REFIT_AIRCRAFT | CMD_MSG(STR_A042_CAN_T_REFIT_AIRCRAFT); break;
}
if (DoCommandP(v->tile, v->index, WP(w,refit_d).cargo->cargo | WP(w,refit_d).cargo->subtype << 8, NULL, command)) w->Close();
} else {
@@ -434,26 +434,26 @@
w->resize.step_height = 14;
WP(w, refit_d).sel = -1;
WP(w, refit_d).list = BuildRefitList(v);
- if (v->type == VEH_Train) WP(w, refit_d).length = CountVehiclesInChain(v);
+ if (v->type == VEH_TRAIN) WP(w, refit_d).length = CountVehiclesInChain(v);
SetVScrollCount(w, WP(w, refit_d).list->num_lines);
switch (v->type) {
- case VEH_Train:
+ case VEH_TRAIN:
w->widget[3].tooltips = STR_RAIL_SELECT_TYPE_OF_CARGO_FOR;
w->widget[6].data = STR_RAIL_REFIT_VEHICLE;
w->widget[6].tooltips = STR_RAIL_REFIT_TO_CARRY_HIGHLIGHTED;
break;
- case VEH_Road:
+ case VEH_ROAD:
w->widget[3].tooltips = STR_ROAD_SELECT_TYPE_OF_CARGO_FOR;
w->widget[6].data = STR_REFIT_ROAD_VEHICLE;
w->widget[6].tooltips = STR_REFIT_ROAD_VEHICLE_TO_CARRY_HIGHLIGHTED;
break;
- case VEH_Ship:
+ case VEH_SHIP:
w->widget[3].tooltips = STR_983D_SELECT_TYPE_OF_CARGO_FOR;
w->widget[6].data = STR_983C_REFIT_SHIP;
w->widget[6].tooltips = STR_983E_REFIT_SHIP_TO_CARRY_HIGHLIGHTED;
break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
w->widget[3].tooltips = STR_A03E_SELECT_TYPE_OF_CARGO_FOR;
w->widget[6].data = STR_A03D_REFIT_AIRCRAFT;
w->widget[6].tooltips = STR_A03F_REFIT_AIRCRAFT_TO_CARRY;
@@ -649,7 +649,7 @@
int r;
const Vehicle *ua = va, *ub = vb;
- if (va->type == VEH_Train && vb->type == VEH_Train) {
+ if (va->type == VEH_TRAIN && vb->type == VEH_TRAIN) {
do {
if (RailVehInfo(ua->engine_type)->max_speed != 0)
max_speed_a = min(max_speed_a, RailVehInfo(ua->engine_type)->max_speed);
@@ -699,7 +699,7 @@
return (_internal_sort_order & 1) ? -r : r;
}
-void InitializeGUI(void)
+void InitializeGUI()
{
memset(&_sorting, 0, sizeof(_sorting));
}
@@ -823,22 +823,22 @@
/* Set up the window widgets */
switch (vl->vehicle_type) {
- case VEH_Train:
+ case VEH_TRAIN:
w->widget[VLW_WIDGET_LIST].tooltips = STR_883D_TRAINS_CLICK_ON_TRAIN_FOR;
w->widget[VLW_WIDGET_AVAILABLE_VEHICLES].data = STR_AVAILABLE_TRAINS;
break;
- case VEH_Road:
+ case VEH_ROAD:
w->widget[VLW_WIDGET_LIST].tooltips = STR_901A_ROAD_VEHICLES_CLICK_ON;
w->widget[VLW_WIDGET_AVAILABLE_VEHICLES].data = STR_AVAILABLE_ROAD_VEHICLES;
break;
- case VEH_Ship:
+ case VEH_SHIP:
w->widget[VLW_WIDGET_LIST].tooltips = STR_9823_SHIPS_CLICK_ON_SHIP_FOR;
w->widget[VLW_WIDGET_AVAILABLE_VEHICLES].data = STR_AVAILABLE_SHIPS;
break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
w->widget[VLW_WIDGET_LIST].tooltips = STR_A01F_AIRCRAFT_CLICK_ON_AIRCRAFT;
w->widget[VLW_WIDGET_AVAILABLE_VEHICLES].data = STR_AVAILABLE_AIRCRAFT;
break;
@@ -852,29 +852,29 @@
break;
case VLW_STANDARD: /* Company Name - standard widget setup */
switch (vl->vehicle_type) {
- case VEH_Train: w->widget[VLW_WIDGET_CAPTION].data = STR_881B_TRAINS; break;
- case VEH_Road: w->widget[VLW_WIDGET_CAPTION].data = STR_9001_ROAD_VEHICLES; break;
- case VEH_Ship: w->widget[VLW_WIDGET_CAPTION].data = STR_9805_SHIPS; break;
- case VEH_Aircraft: w->widget[VLW_WIDGET_CAPTION].data = STR_A009_AIRCRAFT; break;
+ case VEH_TRAIN: w->widget[VLW_WIDGET_CAPTION].data = STR_881B_TRAINS; break;
+ case VEH_ROAD: w->widget[VLW_WIDGET_CAPTION].data = STR_9001_ROAD_VEHICLES; break;
+ case VEH_SHIP: w->widget[VLW_WIDGET_CAPTION].data = STR_9805_SHIPS; break;
+ case VEH_AIRCRAFT: w->widget[VLW_WIDGET_CAPTION].data = STR_A009_AIRCRAFT; break;
default: NOT_REACHED(); break;
}
break;
case VLW_STATION_LIST: /* Station Name */
switch (vl->vehicle_type) {
- case VEH_Train: w->widget[VLW_WIDGET_CAPTION].data = STR_SCHEDULED_TRAINS; break;
- case VEH_Road: w->widget[VLW_WIDGET_CAPTION].data = STR_SCHEDULED_ROAD_VEHICLES; break;
- case VEH_Ship: w->widget[VLW_WIDGET_CAPTION].data = STR_SCHEDULED_SHIPS; break;
- case VEH_Aircraft: w->widget[VLW_WIDGET_CAPTION].data = STR_SCHEDULED_AIRCRAFT; break;
+ case VEH_TRAIN: w->widget[VLW_WIDGET_CAPTION].data = STR_SCHEDULED_TRAINS; break;
+ case VEH_ROAD: w->widget[VLW_WIDGET_CAPTION].data = STR_SCHEDULED_ROAD_VEHICLES; break;
+ case VEH_SHIP: w->widget[VLW_WIDGET_CAPTION].data = STR_SCHEDULED_SHIPS; break;
+ case VEH_AIRCRAFT: w->widget[VLW_WIDGET_CAPTION].data = STR_SCHEDULED_AIRCRAFT; break;
default: NOT_REACHED(); break;
}
break;
case VLW_DEPOT_LIST:
switch (vl->vehicle_type) {
- case VEH_Train: w->widget[VLW_WIDGET_CAPTION].data = STR_VEHICLE_LIST_TRAIN_DEPOT; break;
- case VEH_Road: w->widget[VLW_WIDGET_CAPTION].data = STR_VEHICLE_LIST_ROADVEH_DEPOT; break;
- case VEH_Ship: w->widget[VLW_WIDGET_CAPTION].data = STR_VEHICLE_LIST_SHIP_DEPOT; break;
- case VEH_Aircraft: w->widget[VLW_WIDGET_CAPTION].data = STR_VEHICLE_LIST_AIRCRAFT_DEPOT; break;
+ case VEH_TRAIN: w->widget[VLW_WIDGET_CAPTION].data = STR_VEHICLE_LIST_TRAIN_DEPOT; break;
+ case VEH_ROAD: w->widget[VLW_WIDGET_CAPTION].data = STR_VEHICLE_LIST_ROADVEH_DEPOT; break;
+ case VEH_SHIP: w->widget[VLW_WIDGET_CAPTION].data = STR_VEHICLE_LIST_SHIP_DEPOT; break;
+ case VEH_AIRCRAFT: w->widget[VLW_WIDGET_CAPTION].data = STR_VEHICLE_LIST_AIRCRAFT_DEPOT; break;
default: NOT_REACHED(); break;
}
break;
@@ -882,16 +882,16 @@
}
switch (vl->vehicle_type) {
- case VEH_Train:
+ case VEH_TRAIN:
w->resize.step_width = 1;
/* Fallthrough */
- case VEH_Road:
+ case VEH_ROAD:
w->vscroll.cap = 7;
w->resize.step_height = PLY_WND_PRC__SIZE_OF_ROW_SMALL;
w->resize.height = 220 - (PLY_WND_PRC__SIZE_OF_ROW_SMALL * 3); // Minimum of 4 vehicles
break;
- case VEH_Ship:
- case VEH_Aircraft:
+ case VEH_SHIP:
+ case VEH_AIRCRAFT:
w->vscroll.cap = 4;
w->resize.step_height = PLY_WND_PRC__SIZE_OF_ROW_BIG;
break;
@@ -904,10 +904,10 @@
* point to the correct global _sorting struct so we are freed
* from having conditionals during window operation */
switch (vl->vehicle_type) {
- case VEH_Train: vl->_sorting = &_sorting.train; break;
- case VEH_Road: vl->_sorting = &_sorting.roadveh; break;
- case VEH_Ship: vl->_sorting = &_sorting.ship; break;
- case VEH_Aircraft: vl->_sorting = &_sorting.aircraft; break;
+ case VEH_TRAIN: vl->_sorting = &_sorting.train; break;
+ case VEH_ROAD: vl->_sorting = &_sorting.roadveh; break;
+ case VEH_SHIP: vl->_sorting = &_sorting.ship; break;
+ case VEH_AIRCRAFT: vl->_sorting = &_sorting.aircraft; break;
default: NOT_REACHED(); break;
}
@@ -929,7 +929,7 @@
sel--;
if (order->type == OT_GOTO_STATION) {
- if (v->type == VEH_Ship && GetStation(order->dest)->IsBuoy()) continue;
+ if (v->type == VEH_SHIP && GetStation(order->dest)->IsBuoy()) continue;
SetDParam(0, order->dest);
DrawString(x, y, STR_A036, 0);
@@ -980,13 +980,13 @@
case VLW_DEPOT_LIST:
switch (vl->vehicle_type) {
- case VEH_Train: SetDParam(0, STR_8800_TRAIN_DEPOT); break;
- case VEH_Road: SetDParam(0, STR_9003_ROAD_VEHICLE_DEPOT); break;
- case VEH_Ship: SetDParam(0, STR_9803_SHIP_DEPOT); break;
- case VEH_Aircraft: SetDParam(0, STR_A002_AIRCRAFT_HANGAR); break;
+ case VEH_TRAIN: SetDParam(0, STR_8800_TRAIN_DEPOT); break;
+ case VEH_ROAD: SetDParam(0, STR_9003_ROAD_VEHICLE_DEPOT); break;
+ case VEH_SHIP: SetDParam(0, STR_9803_SHIP_DEPOT); break;
+ case VEH_AIRCRAFT: SetDParam(0, STR_A002_AIRCRAFT_HANGAR); break;
default: NOT_REACHED(); break;
}
- if (vl->vehicle_type == VEH_Aircraft) {
+ if (vl->vehicle_type == VEH_AIRCRAFT) {
SetDParam(1, index); // Airport name
} else {
SetDParam(1, GetDepot(index)->town_index);
@@ -1021,10 +1021,10 @@
DrawVehicleImage(v, x + 19, y + 6, w->widget[VLW_WIDGET_LIST].right - w->widget[VLW_WIDGET_LIST].left - 20, 0, INVALID_VEHICLE);
DrawString(x + 19, y + w->resize.step_height - 8, STR_0198_PROFIT_THIS_YEAR_LAST_YEAR, 0);
- if ((v->type == VEH_Train && v->string_id != STR_SV_TRAIN_NAME) ||
- (v->type == VEH_Road && v->string_id != STR_SV_ROADVEH_NAME) ||
- (v->type == VEH_Ship && v->string_id != STR_SV_SHIP_NAME) ||
- (v->type == VEH_Aircraft && v->string_id != STR_SV_AIRCRAFT_NAME)) {
+ if ((v->type == VEH_TRAIN && v->string_id != STR_SV_TRAIN_NAME) ||
+ (v->type == VEH_ROAD && v->string_id != STR_SV_ROADVEH_NAME) ||
+ (v->type == VEH_SHIP && v->string_id != STR_SV_SHIP_NAME) ||
+ (v->type == VEH_AIRCRAFT && v->string_id != STR_SV_AIRCRAFT_NAME)) {
/* The vehicle got a name so we will print it */
SetDParam(0, v->string_id);
@@ -1093,10 +1093,10 @@
v = vl->sort_list[id_v];
switch (vl->vehicle_type) {
- case VEH_Train: ShowTrainViewWindow(v); break;
- case VEH_Road: ShowRoadVehViewWindow(v); break;
- case VEH_Ship: ShowShipViewWindow(v); break;
- case VEH_Aircraft: ShowAircraftViewWindow(v); break;
+ case VEH_TRAIN: ShowTrainViewWindow(v); break;
+ case VEH_ROAD: ShowRoadVehViewWindow(v); break;
+ case VEH_SHIP: ShowShipViewWindow(v); break;
+ case VEH_AIRCRAFT: ShowAircraftViewWindow(v); break;
default: NOT_REACHED(); break;
}
} break;
@@ -1241,18 +1241,18 @@
* some of the windows to the correct size */
switch (vehicle_type) {
default: NOT_REACHED();
- case VEH_Train:
+ case VEH_TRAIN:
w = BaseWindow::AllocateFront(&_player_vehicle_list_train_desc, num);
if (w != NULL) w->Resize(65, 38);
break;
- case VEH_Road:
+ case VEH_ROAD:
w = BaseWindow::AllocateFront(&_player_vehicle_list_road_veh_desc, num);
if (w != NULL) w->Resize(0, 38);
break;
- case VEH_Ship:
+ case VEH_SHIP:
w = BaseWindow::AllocateFront(&_player_vehicle_list_ship_desc, num);
break;
- case VEH_Aircraft:
+ case VEH_AIRCRAFT:
w = BaseWindow::AllocateFront(&_player_vehicle_list_aircraft_desc, num);
break;
}
@@ -1284,7 +1284,7 @@
{
uint16 depot_airport_index;
- if (vehicle_type == VEH_Aircraft) {
+ if (vehicle_type == VEH_AIRCRAFT) {
depot_airport_index = GetStationIndex(depot_tile);
} else {
Depot *depot = GetDepotByTile(depot_tile);
--- a/src/vehicle_gui.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/vehicle_gui.h Sun Mar 11 16:31:18 2007 +0000
@@ -8,11 +8,11 @@
void DrawVehicleProfitButton(const Vehicle *v, int x, int y);
void ShowVehicleRefitWindow(const Vehicle *v, VehicleOrderID order);
-void InitializeVehiclesGuiList(void);
+void InitializeVehiclesGuiList();
/* sorter stuff */
-void RebuildVehicleLists(void);
-void ResortVehicleLists(void);
+void RebuildVehicleLists();
+void ResortVehicleLists();
#define PERIODIC_RESORT_DAYS 10
@@ -56,17 +56,17 @@
static inline void DrawVehicleImage(const Vehicle *v, int x, int y, int count, int skip, VehicleID selection)
{
switch (v->type) {
- case VEH_Train: DrawTrainImage(v, x, y, count, skip, selection); break;
- case VEH_Road: DrawRoadVehImage(v, x, y, selection); break;
- case VEH_Ship: DrawShipImage(v, x, y, selection); break;
- case VEH_Aircraft: DrawAircraftImage(v, x, y, selection); break;
+ case VEH_TRAIN: DrawTrainImage(v, x, y, count, skip, selection); break;
+ case VEH_ROAD: DrawRoadVehImage(v, x, y, selection); break;
+ case VEH_SHIP: DrawShipImage(v, x, y, selection); break;
+ case VEH_AIRCRAFT: DrawAircraftImage(v, x, y, selection); break;
default: NOT_REACHED();
}
}
static inline uint GetVehicleListHeight(byte type)
{
- return (type == VEH_Train || type == VEH_Road) ? 14 : 24;
+ return (type == VEH_TRAIN || type == VEH_ROAD) ? 14 : 24;
}
#endif /* VEHICLE_GUI_H */
--- a/src/video/cocoa_v.mm Sat Mar 10 11:07:13 2007 +0000
+++ b/src/video/cocoa_v.mm Sun Mar 11 16:31:18 2007 +0000
@@ -31,18 +31,18 @@
/* Portions of CPS.h */
-typedef struct CPSProcessSerNum {
+struct CPSProcessSerNum {
UInt32 lo;
UInt32 hi;
-} CPSProcessSerNum;
+};
extern "C" OSErr CPSGetCurrentProcess(CPSProcessSerNum* psn);
extern "C" OSErr CPSEnableForegroundOperation(CPSProcessSerNum* psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
extern "C" OSErr CPSSetFrontProcess(CPSProcessSerNum* psn);
/* From Menus.h (according to Xcode Developer Documentation) */
-extern "C" void ShowMenuBar(void);
-extern "C" void HideMenuBar(void);
+extern "C" void ShowMenuBar();
+extern "C" void HideMenuBar();
/* Disables a warning. This is needed since the method exists but has been dropped from the header, supposedly as of 10.4. */
#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4)
@@ -103,11 +103,11 @@
*/
#define QZ_GAMMA_TABLE_SIZE 256
-typedef struct {
+struct OTTD_QuartzGammaTable {
CGGammaValue red[QZ_GAMMA_TABLE_SIZE];
CGGammaValue green[QZ_GAMMA_TABLE_SIZE];
CGGammaValue blue[QZ_GAMMA_TABLE_SIZE];
-} OTTD_QuartzGammaTable;
+};
/* Add methods to get at private members of NSScreen.
* Since there is a bug in Apple's screen switching code that does not update
@@ -126,12 +126,12 @@
@end
-static void QZ_Draw(void);
-static void QZ_UnsetVideoMode(void);
+static void QZ_Draw();
+static void QZ_UnsetVideoMode();
static void QZ_UpdatePalette(uint start, uint count);
static void QZ_WarpCursor(int x, int y);
-static void QZ_ShowMouse(void);
-static void QZ_HideMouse(void);
+static void QZ_ShowMouse();
+static void QZ_HideMouse();
static void CocoaVideoFullScreen(bool full_screen);
@@ -192,7 +192,7 @@
* Game loop and accessories *
******************************************************************************/
-static uint32 GetTick(void)
+static uint32 GetTick()
{
struct timeval tim;
@@ -200,7 +200,7 @@
return tim.tv_usec / 1000 + tim.tv_sec * 1000;
}
-static void QZ_CheckPaletteAnim(void)
+static void QZ_CheckPaletteAnim()
{
if (_pal_last_dirty != -1) {
QZ_UpdatePalette(_pal_first_dirty, _pal_last_dirty - _pal_first_dirty + 1);
@@ -210,10 +210,10 @@
-typedef struct VkMapping {
+struct VkMapping {
unsigned short vk_from;
byte map_to;
-} VkMapping;
+};
#define AS(x, z) {x, z}
@@ -469,7 +469,7 @@
}
-static bool QZ_PollEvent(void)
+static bool QZ_PollEvent()
{
NSEvent *event;
NSPoint pt;
@@ -663,7 +663,7 @@
}
-static void QZ_GameLoop(void)
+static void QZ_GameLoop()
{
uint32 cur_ticks = GetTick();
uint32 next_tick = cur_ticks + 30;
@@ -712,7 +712,7 @@
}
cur_ticks = GetTick();
- if (cur_ticks >= next_tick || (_fast_forward && !_pause) || cur_ticks < prev_cur_ticks) {
+ if (cur_ticks >= next_tick || (_fast_forward && !_pause_game) || cur_ticks < prev_cur_ticks) {
next_tick = cur_ticks + 30;
_ctrl_pressed = !!(_cocoa_video_data.current_mods & NSControlKeyMask);
@@ -764,7 +764,7 @@
* The genie effect uses the alpha component. Otherwise,
* it doesn't seem to matter what value it has.
*/
-static void QZ_SetPortAlphaOpaque(void)
+static void QZ_SetPortAlphaOpaque()
{
if (_cocoa_video_data.device_bpp == 32) {
uint32* pixels = (uint32*)_cocoa_video_data.realpixels;
@@ -1032,7 +1032,7 @@
1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0
};
-static void QZ_DrawResizeIcon(void)
+static void QZ_DrawResizeIcon()
{
int xoff = _cocoa_video_data.width - 16;
int yoff = _cocoa_video_data.height - 16;
@@ -1054,7 +1054,7 @@
}
}
-static void QZ_DrawWindow(void)
+static void QZ_DrawWindow()
{
int i;
RgnHandle dirty, temp;
@@ -1421,7 +1421,7 @@
}
/* Wait for the VBL to occur (estimated since we don't have a hardware interrupt) */
-static void QZ_WaitForVerticalBlank(void)
+static void QZ_WaitForVerticalBlank()
{
/* The VBL delay is based on Ian Ollmann's RezLib <iano@cco.caltech.edu> */
double refreshRate;
@@ -1452,7 +1452,7 @@
}
-static void QZ_DrawScreen(void)
+static void QZ_DrawScreen()
{
const uint8* src = _cocoa_video_data.pixels;
uint8* dst = (uint8*)_cocoa_video_data.realpixels;
@@ -1579,12 +1579,12 @@
}
}
-static void QZ_InitPalette(void)
+static void QZ_InitPalette()
{
QZ_UpdatePalette(0, 256);
}
-static void QZ_Draw(void)
+static void QZ_Draw()
{
if (_cocoa_video_data.fullscreen) {
QZ_DrawScreen();
@@ -1608,7 +1608,7 @@
{1920, 1200}
};
-static void QZ_UpdateVideoModes(void)
+static void QZ_UpdateVideoModes()
{
uint i, j, count;
OTTDPoint modes[32];
@@ -1636,7 +1636,7 @@
_num_resolutions = j;
}
-static void QZ_UnsetVideoMode(void)
+static void QZ_UnsetVideoMode()
{
if (_cocoa_video_data.fullscreen) {
/* Release fullscreen resources */
@@ -1719,7 +1719,7 @@
return ret;
}
-static void QZ_VideoInit(void)
+static void QZ_VideoInit()
{
memset(&_cocoa_video_data, 0, sizeof(_cocoa_video_data));
@@ -1789,7 +1789,7 @@
/* Generate the mouse moved event */
}
-static void QZ_ShowMouse(void)
+static void QZ_ShowMouse()
{
if (!_cocoa_video_data.cursor_visible) {
[ NSCursor unhide ];
@@ -1802,7 +1802,7 @@
}
}
-static void QZ_HideMouse(void)
+static void QZ_HideMouse()
{
if (_cocoa_video_data.cursor_visible) {
#ifndef _DEBUG
@@ -1842,7 +1842,7 @@
}
@end
-static void setApplicationMenu(void)
+static void setApplicationMenu()
{
/* warning: this code is very odd */
NSMenu *appleMenu;
@@ -1887,7 +1887,7 @@
}
/* Create a window menu */
-static void setupWindowMenu(void)
+static void setupWindowMenu()
{
NSMenu* windowMenu;
NSMenuItem* windowMenuItem;
@@ -1913,7 +1913,7 @@
[windowMenuItem release];
}
-static void setupApplication(void)
+static void setupApplication()
{
CPSProcessSerNum PSN;
@@ -1942,7 +1942,7 @@
* Video driver interface *
******************************************************************************/
-static void CocoaVideoStop(void)
+static void CocoaVideoStop()
{
if (!_cocoa_video_started) return;
@@ -1986,7 +1986,7 @@
_cocoa_video_data.num_dirty_rects++;
}
-static void CocoaVideoMainLoop(void)
+static void CocoaVideoMainLoop()
{
/* Start the main event loop */
[NSApp run];
@@ -2044,7 +2044,7 @@
/* This is needed since OS X applications are started with the working dir set to / when double-clicked */
-void cocoaSetWorkingDirectory(void)
+void cocoaSetWorkingDirectory()
{
char parentdir[MAXPATHLEN];
int chdir_ret;
@@ -2061,12 +2061,12 @@
/* These are called from main() to prevent a _NSAutoreleaseNoPool error when
* exiting before the cocoa video driver has been loaded
*/
-void cocoaSetupAutoreleasePool(void)
+void cocoaSetupAutoreleasePool()
{
_ottd_autorelease_pool = [[NSAutoreleasePool alloc] init];
}
-void cocoaReleaseAutoreleasePool(void)
+void cocoaReleaseAutoreleasePool()
{
[_ottd_autorelease_pool release];
}
--- a/src/video/dedicated_v.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/video/dedicated_v.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -33,7 +33,7 @@
/**
* Switches OpenTTD to a console app at run-time, instead of a PM app
* Necessary to see stdout, etc. */
-static void OS2_SwitchToConsoleMode(void)
+static void OS2_SwitchToConsoleMode()
{
PPIB pib;
PTIB tib;
@@ -74,10 +74,12 @@
static char _win_console_thread_buffer[200];
/* Windows Console thread. Just loop and signal when input has been received */
-static void WINAPI CheckForConsoleInput(void)
+static void WINAPI CheckForConsoleInput()
{
+ DWORD nb;
+ HANDLE hStdin = GetStdHandle(STD_INPUT_HANDLE);
while (true) {
- fgets(_win_console_thread_buffer, lengthof(_win_console_thread_buffer), stdin);
+ ReadFile(hStdin, _win_console_thread_buffer, lengthof(_win_console_thread_buffer), &nb, NULL);
/* Signal input waiting that input is read and wait for it being handled
* SignalObjectAndWait() should be used here, but it's unsupported in Win98< */
SetEvent(_hInputReady);
@@ -85,7 +87,7 @@
}
}
-static void CreateWindowsConsoleThread(void)
+static void CreateWindowsConsoleThread()
{
DWORD dwThreadId;
/* Create event to signal when console input is ready */
@@ -99,7 +101,7 @@
DEBUG(driver, 2, "Windows console thread started");
}
-static void CloseWindowsConsoleThread(void)
+static void CloseWindowsConsoleThread()
{
CloseHandle(_hThread);
CloseHandle(_hInputReady);
@@ -140,7 +142,7 @@
return NULL;
}
-static void DedicatedVideoStop(void)
+static void DedicatedVideoStop()
{
#ifdef WIN32
CloseWindowsConsoleThread();
@@ -153,7 +155,7 @@
static void DedicatedVideoFullScreen(bool fs) {}
#if defined(UNIX) || defined(__OS2__) || defined(PSP)
-static bool InputWaiting(void)
+static bool InputWaiting()
{
struct timeval tv;
fd_set readfds;
@@ -168,7 +170,7 @@
return select(STDIN + 1, &readfds, NULL, NULL, &tv) > 0;
}
-static uint32 GetTime(void)
+static uint32 GetTime()
{
struct timeval tim;
@@ -178,19 +180,19 @@
#else
-static bool InputWaiting(void)
+static bool InputWaiting()
{
return WaitForSingleObject(_hInputReady, 1) == WAIT_OBJECT_0;
}
-static uint32 GetTime(void)
+static uint32 GetTime()
{
return GetTickCount();
}
#endif
-static void DedicatedHandleKeyInput(void)
+static void DedicatedHandleKeyInput()
{
static char input_line[200] = "";
@@ -225,7 +227,7 @@
IConsoleCmdExec(input_line); // execute command
}
-static void DedicatedVideoMainLoop(void)
+static void DedicatedVideoMainLoop()
{
uint32 cur_ticks = GetTime();
uint32 next_tick = cur_ticks + 30;
--- a/src/video/null_v.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/video/null_v.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -17,11 +17,11 @@
return NULL;
}
-static void NullVideoStop(void) { free(_null_video_mem); }
+static void NullVideoStop() { free(_null_video_mem); }
static void NullVideoMakeDirty(int left, int top, int width, int height) {}
-static void NullVideoMainLoop(void)
+static void NullVideoMainLoop()
{
uint i;
--- a/src/video/sdl_v.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/video/sdl_v.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -49,12 +49,12 @@
SDL_CALL SDL_SetColors(_sdl_screen, pal, start, count);
}
-static void InitPalette(void)
+static void InitPalette()
{
UpdatePalette(0, 256);
}
-static void CheckPaletteAnim(void)
+static void CheckPaletteAnim()
{
if (_pal_last_dirty != -1) {
UpdatePalette(_pal_first_dirty, _pal_last_dirty - _pal_first_dirty + 1);
@@ -62,7 +62,7 @@
}
}
-static void DrawSurfaceToScreen(void)
+static void DrawSurfaceToScreen()
{
int n = _num_dirty_rects;
if (n != 0) {
@@ -88,7 +88,7 @@
{1920, 1200}
};
-static void GetVideoModes(void)
+static void GetVideoModes()
{
int i;
SDL_Rect **modes;
@@ -209,11 +209,11 @@
return true;
}
-typedef struct VkMapping {
+struct VkMapping {
uint16 vk_from;
byte vk_count;
byte map_to;
-} VkMapping;
+};
#define AS(x, z) {x, 0, z}
#define AM(x, y, z, w) {x, y - x, z}
@@ -301,7 +301,7 @@
return (key << 16) + sym->unicode;
}
-static int PollEvent(void)
+static int PollEvent()
{
SDL_Event ev;
@@ -415,12 +415,12 @@
return NULL;
}
-static void SdlVideoStop(void)
+static void SdlVideoStop()
{
SdlClose(SDL_INIT_VIDEO);
}
-static void SdlVideoMainLoop(void)
+static void SdlVideoMainLoop()
{
uint32 cur_ticks = SDL_CALL SDL_GetTicks();
uint32 next_tick = cur_ticks + 30;
@@ -452,7 +452,7 @@
}
cur_ticks = SDL_CALL SDL_GetTicks();
- if (cur_ticks >= next_tick || (_fast_forward && !_pause) || cur_ticks < prev_cur_ticks) {
+ if (cur_ticks >= next_tick || (_fast_forward && !_pause_game) || cur_ticks < prev_cur_ticks) {
next_tick = cur_ticks + 30;
_ctrl_pressed = !!(mod & KMOD_CTRL);
--- a/src/video/win32_v.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/video/win32_v.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -36,8 +36,11 @@
uint _display_hz;
uint _fullscreen_bpp;
static uint16 _bck_resolution[2];
+#if !defined(UNICODE)
+uint _codepage;
+#endif
-static void MakePalette(void)
+static void MakePalette()
{
LOGPALETTE *pal;
uint i;
@@ -73,11 +76,11 @@
SetDIBColorTable(dc, start, count, rgb);
}
-typedef struct {
+struct VkMapping {
byte vk_from;
byte vk_count;
byte map_to;
-} VkMapping;
+};
#define AS(x, z) {x, 0, z}
#define AM(x, y, z, w) {x, y - x, z}
@@ -156,7 +159,7 @@
#ifdef _DEBUG
// Keep this function here..
// It allows you to redraw the screen from within the MSVC debugger
-int RedrawScreenDebug(void)
+int RedrawScreenDebug()
{
HDC dc,dc2;
static int _fooctr;
@@ -208,6 +211,8 @@
static LRESULT CALLBACK WndProcGdi(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
+ static uint32 keycode = 0;
+
switch (msg) {
case WM_CREATE:
SetTimer(hwnd, TID_POLLMOUSE, MOUSE_POLL_DELAY, (TIMERPROC)TrackMouseTimerProc);
@@ -347,40 +352,51 @@
return 0;
}
- case WM_KEYDOWN: {
- // this is the rewritten ascii input function
- // it disables windows deadkey handling --> more linux like :D
- wchar_t w = 0;
-#if !defined(WINCE)
- byte ks[256];
-#endif
- uint scancode;
- uint32 pressed_key;
+#if !defined(UNICODE)
+ case WM_INPUTLANGCHANGE: {
+ TCHAR locale[6];
+ LCID lcid = GB(lParam, 0, 16);
-#if defined(WINCE)
- /* On WinCE GetKeyboardState isn't supported */
- w = wParam;
-#else
- GetKeyboardState(ks);
- if (ToUnicode(wParam, 0, ks, &w, 1, 0) != 1) {
- /* On win9x ToUnicode always fails, so fall back to ToAscii */
- if (ToAscii(wParam, 0, ks, (LPWORD)&w, 0) != 1) w = 0; // no translation was possible
- }
-#endif
+ int len = GetLocaleInfo(lcid, LOCALE_IDEFAULTANSICODEPAGE, locale, lengthof(locale));
+ if (len != 0) _codepage = _ttoi(locale);
+ return 1;
+ }
+#endif /* UNICODE */
- pressed_key = w | MapWindowsKey(wParam) << 16;
+ case WM_CHAR: {
+ /* Silently drop all non-text messages as those were handled by WM_KEYDOWN */
+ if (wParam < VK_SPACE) return 0;
+ uint scancode = GB(lParam, 16, 8);
+ uint charcode = wParam;
- scancode = GB(lParam, 16, 8);
- if (scancode == 41) pressed_key = w | WKC_BACKQUOTE << 16;
+#if !defined(UNICODE)
+ wchar_t w;
+ int len = MultiByteToWideChar(_codepage, 0, (char*)&charcode, 1, &w, 1);
+ charcode = len == 1 ? w : 0;
+#endif /* UNICODE */
- if (GB(pressed_key, 16, 16) == ('D' | WKC_CTRL) && !_wnd.fullscreen) {
+ /* No matter the keyboard layout, we will map the '~' to the console */
+ scancode = scancode == 41 ? (int)WKC_BACKQUOTE : keycode;
+ HandleKeypress(GB(charcode, 0, 16) | (scancode << 16));
+ return 0;
+ }
+
+ case WM_KEYDOWN: {
+ keycode = MapWindowsKey(wParam);
+
+ /* Silently drop all text messages as those will be handled by WM_CHAR
+ * WM_KEYDOWN only handles CTRL+ commands and special keys like VK_LEFT, etc. */
+ if (keycode == 0 || (keycode > WKC_PAUSE && GB(keycode, 13, 4) == 0)) return 0;
+
+ if (keycode == ('D' | WKC_CTRL) && !_wnd.fullscreen) {
_double_size ^= 1;
_wnd.double_size = _double_size;
ClientSizeChanged(_wnd.width, _wnd.height);
MarkWholeScreenDirty();
}
- HandleKeypress(pressed_key);
- break;
+
+ HandleKeypress(0 | (keycode << 16));
+ return 0;
}
case WM_SYSKEYDOWN: /* user presses F10 or Alt, both activating the title-menu */
@@ -511,7 +527,7 @@
return DefWindowProc(hwnd, msg, wParam, lParam);
}
-static void RegisterWndClass(void)
+static void RegisterWndClass()
{
static bool registered = false;
@@ -681,7 +697,7 @@
{ 1920, 1200 }
};
-static void FindResolutions(void)
+static void FindResolutions()
{
uint n = 0;
#if defined(WINCE)
@@ -749,7 +765,7 @@
return NULL;
}
-static void Win32GdiStop(void)
+static void Win32GdiStop()
{
DeleteObject(_wnd.gdi_palette);
DeleteObject(_wnd.dib_sect);
@@ -798,14 +814,14 @@
InvalidateRect(_wnd.main_wnd, &r, FALSE);
}
-static void CheckPaletteAnim(void)
+static void CheckPaletteAnim()
{
if (_pal_last_dirty == -1)
return;
InvalidateRect(_wnd.main_wnd, NULL, FALSE);
}
-static void Win32GdiMainLoop(void)
+static void Win32GdiMainLoop()
{
MSG mesg;
uint32 cur_ticks = GetTickCount();
@@ -818,6 +834,7 @@
while (PeekMessage(&mesg, NULL, 0, 0, PM_REMOVE)) {
InteractiveRandom(); // randomness
+ TranslateMessage(&mesg);
DispatchMessage(&mesg);
}
if (_exit_game) return;
@@ -835,7 +852,7 @@
}
cur_ticks = GetTickCount();
- if (cur_ticks >= next_tick || (_fast_forward && !_pause) || cur_ticks < prev_cur_ticks) {
+ if (cur_ticks >= next_tick || (_fast_forward && !_pause_game) || cur_ticks < prev_cur_ticks) {
next_tick = cur_ticks + 30;
_ctrl_pressed = _wnd.has_focus && GetAsyncKeyState(VK_CONTROL)<0;
_shift_pressed = _wnd.has_focus && GetAsyncKeyState(VK_SHIFT)<0;
--- a/src/viewport.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/viewport.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -47,34 +47,34 @@
* X < > Y *
*/
-typedef struct StringSpriteToDraw {
+struct StringSpriteToDraw {
uint16 string;
uint16 color;
- struct StringSpriteToDraw *next;
+ StringSpriteToDraw *next;
int32 x;
int32 y;
uint32 params[2];
uint16 width;
-} StringSpriteToDraw;
-
-typedef struct TileSpriteToDraw {
+};
+
+struct TileSpriteToDraw {
SpriteID image;
SpriteID pal;
- struct TileSpriteToDraw *next;
+ TileSpriteToDraw *next;
int32 x;
int32 y;
byte z;
-} TileSpriteToDraw;
-
-typedef struct ChildScreenSpriteToDraw {
+};
+
+struct ChildScreenSpriteToDraw {
SpriteID image;
SpriteID pal;
int32 x;
int32 y;
- struct ChildScreenSpriteToDraw *next;
-} ChildScreenSpriteToDraw;
-
-typedef struct ParentSpriteToDraw {
+ ChildScreenSpriteToDraw *next;
+};
+
+struct ParentSpriteToDraw {
SpriteID image;
SpriteID pal;
int32 left;
@@ -89,13 +89,13 @@
byte unk16;
byte zmin;
byte zmax;
-} ParentSpriteToDraw;
+};
// Quick hack to know how much memory to reserve when allocating from the spritelist
// to prevent a buffer overflow.
#define LARGEST_SPRITELIST_STRUCT ParentSpriteToDraw
-typedef struct ViewportDrawer {
+struct ViewportDrawer {
DrawPixelInfo dpi;
byte *spritelist_mem;
@@ -112,7 +112,7 @@
byte combine_sprites;
int offs_x, offs_y; // used when drawing ground sprites relative
-} ViewportDrawer;
+};
static ViewportDrawer *_cur_vd;
@@ -129,7 +129,7 @@
return p;
}
-void InitViewports(void) {
+void InitViewports() {
memset(_viewports, 0, sizeof(_viewports));
_active_viewports = 0;
}
@@ -373,7 +373,7 @@
return pt;
}
-Point GetTileBelowCursor(void)
+Point GetTileBelowCursor()
{
return GetTileFromScreenXY(_cursor.pos.x, _cursor.pos.y, _cursor.pos.x, _cursor.pos.y);
}
@@ -536,12 +536,12 @@
if (vd->combine_sprites == 1) vd->combine_sprites = 2;
}
-void StartSpriteCombine(void)
+void StartSpriteCombine()
{
_cur_vd->combine_sprites = 1;
}
-void EndSpriteCombine(void)
+void EndSpriteCombine()
{
_cur_vd->combine_sprites = 0;
}
@@ -727,7 +727,7 @@
}
}
-static void ViewportAddLandscape(void)
+static void ViewportAddLandscape()
{
ViewportDrawer *vd = _cur_vd;
int x, y, width, height;
@@ -1447,7 +1447,7 @@
);
}
-static void SetSelectionTilesDirty(void)
+static void SetSelectionTilesDirty()
{
int y_size, x_size;
int x = _thd.pos.x;
@@ -1745,7 +1745,7 @@
}
}
-Vehicle *CheckMouseOverVehicle(void)
+Vehicle *CheckMouseOverVehicle()
{
const BaseWindow *w;
const ViewPort *vp;
@@ -1762,7 +1762,7 @@
-void PlaceObject(void)
+void PlaceObject()
{
Point pt;
BaseWindow *w;
@@ -1868,7 +1868,7 @@
}
// called regular to update tile highlighting in all cases
-void UpdateTileSelection(void)
+void UpdateTileSelection()
{
int x1;
int y1;
@@ -1978,7 +1978,7 @@
if (distance > 1) GuiShowTooltipsWithArgs(STR_MEASURE_LENGTH, 1, &distance);
}
-static void VpStartPreSizing(void)
+static void VpStartPreSizing()
{
_thd.selend.x = -1;
_special_mouse_mode = WSM_PRESIZE;
@@ -2387,7 +2387,7 @@
}
// while dragging
-bool VpHandlePlaceSizingDrag(void)
+bool VpHandlePlaceSizingDrag()
{
BaseWindow *w;
WindowEvent e;
@@ -2479,7 +2479,7 @@
SetMouseCursor(icon, pal);
}
-void ResetObjectToPlace(void)
+void ResetObjectToPlace()
{
SetObjectToPlace(SPR_CURSOR_MOUSE, PAL_NONE, VHM_NONE, WC_MAIN_WINDOW, 0);
}
--- a/src/viewport.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/viewport.h Sun Mar 11 16:31:18 2007 +0000
@@ -3,6 +3,8 @@
#ifndef VIEWPORT_H
#define VIEWPORT_H
+#include "window.h"
+
struct ViewPort {
int left,top; // screen coordinates for the viewport
int width, height; // screen width/height for the viewport
@@ -16,12 +18,12 @@
void SetSelectionRed(bool);
/* viewport.c */
-void InitViewports(void);
+void InitViewports();
void DeleteWindowViewport(BaseWindow *w);
void AssignWindowViewport(BaseWindow *w, int x, int y,
int width, int height, uint32 follow_flags, byte zoom);
ViewPort *IsPtInWindowViewport(const BaseWindow *w, int x, int y);
-Point GetTileBelowCursor(void);
+Point GetTileBelowCursor();
void UpdateViewportPosition(BaseWindow *w);
enum {
@@ -49,11 +51,11 @@
void AddChildSpriteScreen(SpriteID image, SpriteID pal, int x, int y);
-void StartSpriteCombine(void);
-void EndSpriteCombine(void);
+void StartSpriteCombine();
+void EndSpriteCombine();
void HandleViewportClicked(const ViewPort *vp, int x, int y);
-void PlaceObject(void);
+void PlaceObject();
void SetRedErrorSquare(TileIndex tile);
void SetTileSelectSize(int w, int h);
void SetTileSelectBigSize(int ox, int oy, int sx, int sy);
@@ -62,7 +64,7 @@
void VpSetPresizeRange(uint from, uint to);
void VpSetPlaceSizingLimit(int limit);
-Vehicle *CheckMouseOverVehicle(void);
+Vehicle *CheckMouseOverVehicle();
enum {
VPM_X_OR_Y = 0,
@@ -109,7 +111,7 @@
HT_DIR_MASK = 0x7 ///< masks the drag-direction
};
-typedef struct TileHighlightData {
+struct TileHighlightData {
Point size;
Point outersize;
Point pos;
@@ -135,7 +137,7 @@
int userdata;
TileIndex redsq;
-} TileHighlightData;
+};
// common button handler
--- a/src/water_cmd.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/water_cmd.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -401,11 +401,11 @@
}
}
-typedef struct LocksDrawTileStruct {
+struct LocksDrawTileStruct {
int8 delta_x, delta_y, delta_z;
byte width, height, depth;
SpriteID image;
-} LocksDrawTileStruct;
+};
#include "table/water_land.h"
@@ -610,7 +610,7 @@
if (!(v->vehstatus & VS_CRASHED)) {
uint16 pass = 0;
- if (v->type == VEH_Road) { // flood bus/truck
+ if (v->type == VEH_ROAD) { // flood bus/truck
pass = 1; // driver
if (v->cargo_type == CT_PASSENGERS)
pass += v->cargo_count;
@@ -618,7 +618,7 @@
v->vehstatus |= VS_CRASHED;
v->u.road.crashed_ctr = 2000; // max 2220, disappear pretty fast
RebuildVehicleLists();
- } else if (v->type == VEH_Train) {
+ } else if (v->type == VEH_TRAIN) {
Vehicle *u;
v = GetFirstVehicleInChain(v);
@@ -727,7 +727,7 @@
if (GetWaterTileType(tile) == WATER_TILE_DEPOT) {
TileIndex tile2 = GetOtherShipDepotTile(tile);
- ShowDepotWindow(tile < tile2 ? tile : tile2, VEH_Ship);
+ ShowDepotWindow(tile < tile2 ? tile : tile2, VEH_SHIP);
}
}
--- a/src/water_map.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/water_map.h Sun Mar 11 16:31:18 2007 +0000
@@ -3,25 +3,25 @@
#ifndef WATER_MAP_H
#define WATER_MAP_H
-typedef enum WaterTileType {
+enum WaterTileType {
WATER_TILE_CLEAR,
WATER_TILE_COAST,
WATER_TILE_LOCK,
WATER_TILE_DEPOT,
-} WaterTileType;
+};
-typedef enum DepotPart {
+enum DepotPart {
DEPOT_NORTH = 0x80,
DEPOT_SOUTH = 0x81,
DEPOT_END = 0x84,
-} DepotPart;
+};
-typedef enum LockPart {
+enum LockPart {
LOCK_MIDDLE = 0x10,
LOCK_LOWER = 0x14,
LOCK_UPPER = 0x18,
LOCK_END = 0x1C
-} LockPart;
+};
static inline WaterTileType GetWaterTileType(TileIndex t)
{
--- a/src/waypoint.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/waypoint.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -40,7 +40,7 @@
DEFINE_OLD_POOL(Waypoint, Waypoint, WaypointPoolNewBlock, NULL)
/* Create a new waypoint */
-static Waypoint* AllocateWaypoint(void)
+static Waypoint* AllocateWaypoint()
{
Waypoint *wp;
@@ -82,7 +82,7 @@
}
/* Update all signs */
-void UpdateAllWaypointSigns(void)
+void UpdateAllWaypointSigns()
{
Waypoint *wp;
@@ -151,7 +151,7 @@
* Update waypoint graphics id against saved GRFID/localidx.
* This is to ensure the chosen graphics are correct if GRF files are changed.
*/
-void AfterLoadWaypoints(void)
+void AfterLoadWaypoints()
{
Waypoint *wp;
@@ -254,7 +254,7 @@
}
/* Daily loop for waypoints */
-void WaypointsDailyLoop(void)
+void WaypointsDailyLoop()
{
Waypoint *wp;
@@ -379,7 +379,7 @@
}
/* Fix savegames which stored waypoints in their old format */
-void FixOldWaypoints(void)
+void FixOldWaypoints()
{
Waypoint *wp;
@@ -394,7 +394,7 @@
}
}
-void InitializeWaypoints(void)
+void InitializeWaypoints()
{
CleanPool(&_Waypoint_pool);
AddBlockToPool(&_Waypoint_pool);
@@ -416,7 +416,7 @@
SLE_END()
};
-static void Save_WAYP(void)
+static void Save_WAYP()
{
Waypoint *wp;
@@ -426,7 +426,7 @@
}
}
-static void Load_WAYP(void)
+static void Load_WAYP()
{
int index;
--- a/src/waypoint.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/waypoint.h Sun Mar 11 16:31:18 2007 +0000
@@ -66,8 +66,8 @@
Station *ComposeWaypointStation(TileIndex tile);
void ShowRenameWaypointWindow(const Waypoint *cp);
void DrawWaypointSprite(int x, int y, int image, RailType railtype);
-void FixOldWaypoints(void);
-void UpdateAllWaypointSigns(void);
-void AfterLoadWaypoints(void);
+void FixOldWaypoints();
+void UpdateAllWaypointSigns();
+void AfterLoadWaypoints();
#endif /* WAYPOINT_H */
--- a/src/widget.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/widget.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -233,6 +233,13 @@
goto draw_default;
}
+ case WWT_TEXT: {
+ StringID str = wi->data;
+
+ if (str != STR_NULL) DrawStringTruncated(r.left, r.top, str, wi->color, r.right - r.left);
+ break;
+ }
+
case WWT_INSET: {
StringID str = wi->data;
DrawFrameRect(r.left, r.top, r.right, r.bottom, wi->color, FR_LOWERED | FR_DARKENED);
--- a/src/win32.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/win32.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -100,11 +100,11 @@
static bool _did_emerg_save;
static int _ident;
-typedef struct DebugFileInfo {
+struct DebugFileInfo {
uint32 size;
uint32 crc32;
SYSTEMTIME file_time;
-} DebugFileInfo;
+};
static uint32 *_crc_table;
@@ -221,7 +221,7 @@
_T("Be aware that critical parts of the internal game state may have become ")
_T("corrupted. The saved game is not guaranteed to work.");
-static bool EmergencySave(void)
+static bool EmergencySave()
{
SaveOrLoad("crash.sav", SL_SAVE);
return true;
@@ -230,14 +230,14 @@
/* Disable the crash-save submit code as it's not used */
#if 0
-typedef struct {
+struct WinInetProcs {
HINTERNET (WINAPI *InternetOpen)(LPCTSTR,DWORD, LPCTSTR, LPCTSTR, DWORD);
HINTERNET (WINAPI *InternetConnect)(HINTERNET, LPCTSTR, INTERNET_PORT, LPCTSTR, LPCTSTR, DWORD, DWORD, DWORD);
HINTERNET (WINAPI *HttpOpenRequest)(HINTERNET, LPCTSTR, LPCTSTR, LPCTSTR, LPCTSTR, LPCTSTR *, DWORD, DWORD);
BOOL (WINAPI *HttpSendRequest)(HINTERNET, LPCTSTR, DWORD, LPVOID, DWORD);
BOOL (WINAPI *InternetCloseHandle)(HINTERNET);
BOOL (WINAPI *HttpQueryInfo)(HINTERNET, DWORD, LPVOID, LPDWORD, LPDWORD);
-} WinInetProcs;
+};
#define M(x) x "\0"
#if defined(UNICODE)
@@ -431,14 +431,14 @@
return FALSE;
}
-static void Handler2(void)
+static void Handler2()
{
ShowCursor(TRUE);
ShowWindow(GetActiveWindow(), FALSE);
DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(100), NULL, CrashDialogFunc);
}
-extern bool CloseConsoleLogIfActive(void);
+extern bool CloseConsoleLogIfActive();
static LONG WINAPI ExceptionHandler(EXCEPTION_POINTERS *ep)
{
@@ -607,10 +607,10 @@
}
#ifdef _M_AMD64
-extern "C" void *_get_save_esp(void);
+extern "C" void *_get_save_esp();
#endif
-static void Win32InitializeExceptions(void)
+static void Win32InitializeExceptions()
{
#ifdef _M_AMD64
_safe_esp = _get_save_esp();
@@ -636,7 +636,7 @@
static DIR _global_dir;
static LONG _global_dir_is_in_use = false;
-static inline DIR *dir_calloc(void)
+static inline DIR *dir_calloc()
{
DIR *d;
@@ -658,23 +658,23 @@
}
}
-DIR *opendir(const wchar_t *path)
+DIR *opendir(const TCHAR *path)
{
DIR *d;
UINT sem = SetErrorMode(SEM_FAILCRITICALERRORS); // disable 'no-disk' message box
- DWORD fa = GetFileAttributesW(path);
+ DWORD fa = GetFileAttributes(path);
if ((fa != INVALID_FILE_ATTRIBUTES) && (fa & FILE_ATTRIBUTE_DIRECTORY)) {
d = dir_calloc();
if (d != NULL) {
- wchar_t search_path[MAX_PATH];
- bool slash = path[wcslen(path) - 1] == L'\\';
+ TCHAR search_path[MAX_PATH];
+ bool slash = path[_tcslen(path) - 1] == '\\';
/* build search path for FindFirstFile, try not to append additional slashes
* as it throws Win9x off its groove for root directories */
- _snwprintf(search_path, lengthof(search_path), L"%s%s*", path, slash ? L"" : L"\\");
+ _sntprintf(search_path, lengthof(search_path), _T("%s%s*"), path, slash ? _T("") : _T("\\"));
*lastof(search_path) = '\0';
- d->hFind = FindFirstFileW(search_path, &d->fd);
+ d->hFind = FindFirstFile(search_path, &d->fd);
if (d->hFind != INVALID_HANDLE_VALUE ||
GetLastError() == ERROR_NO_MORE_FILES) { // the directory is empty
@@ -705,7 +705,7 @@
/* the directory was empty when opened */
if (d->hFind == INVALID_HANDLE_VALUE) return NULL;
d->at_first_entry = false;
- } else if (!FindNextFileW(d->hFind, &d->fd)) { // determine cause and bail
+ } else if (!FindNextFile(d->hFind, &d->fd)) { // determine cause and bail
if (GetLastError() == ERROR_NO_MORE_FILES) SetLastError(prev_err);
return NULL;
}
@@ -728,7 +728,7 @@
return file[3] == '\0'; // C:\...
}
-void FiosGetDrives(void)
+void FiosGetDrives()
{
TCHAR drives[256];
const TCHAR *s;
@@ -748,8 +748,7 @@
{
// hectonanoseconds between Windows and POSIX epoch
static const int64 posix_epoch_hns = 0x019DB1DED53E8000LL;
- const WIN32_FIND_DATAW *fd = &ent->dir->fd;
- if (fd->dwFileAttributes & (FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM)) return false;
+ const WIN32_FIND_DATA *fd = &ent->dir->fd;
sb->st_size = ((uint64) fd->nFileSizeHigh << 32) + fd->nFileSizeLow;
/* UTC FILETIME to seconds-since-1970 UTC
@@ -763,6 +762,11 @@
return true;
}
+bool FiosIsHiddenFile(const struct dirent *ent)
+{
+ return (ent->dir->fd.dwFileAttributes & (FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM)) != 0;
+}
+
bool FiosGetDiskFreeSpace(const char *path, uint32 *tot)
{
UINT sem = SetErrorMode(SEM_FAILCRITICALERRORS); // disable 'no-disk' message box
@@ -811,7 +815,7 @@
return n;
}
-void CreateConsole(void)
+void CreateConsole()
{
HANDLE hand;
CONSOLE_SCREEN_BUFFER_INFO coninfo;
@@ -874,24 +878,22 @@
int _set_error_mode(int);
#endif
-#if defined(WINCE) && !defined(_tWinMain)
-/* GCC crosscompiler for WINCE doesn't support wide version */
-# define _tWinMain WinMain
-#endif /* WINCE */
-
-int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
- LPTSTR lpCmdLine, int nCmdShow)
+int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
int argc;
char *argv[64]; // max 64 command line arguments
char *cmdline;
+#if !defined(UNICODE)
+ _codepage = GetACP(); // get system codepage as some kind of a default
+#endif /* UNICODE */
+
#if defined(UNICODE)
/* For UNICODE we need to convert the commandline to char* _AND_
* save it because argv[] points into this buffer and thus needs to
* be available between subsequent calls to FS2OTTD() */
char cmdlinebuf[MAX_PATH];
-#endif
+#endif /* UNICODE */
cmdline = WIDE_TO_MB_BUFFER(GetCommandLine(), cmdlinebuf, lengthof(cmdlinebuf));
@@ -940,14 +942,18 @@
}
#endif
-void DeterminePaths(void)
+void DeterminePaths()
{
char *s, *cfg;
- wchar_t path[MAX_PATH];
_paths.personal_dir = _paths.game_data_dir = cfg = (char*)malloc(MAX_PATH);
- GetCurrentDirectoryW(MAX_PATH - 1, path);
+#if defined(UNICODE)
+ TCHAR path[MAX_PATH];
+ GetCurrentDirectory(MAX_PATH - 1, path);
convert_from_fs(path, cfg, MAX_PATH);
+#else
+ GetCurrentDirectory(MAX_PATH - 1, cfg);
+#endif
cfg[0] = toupper(cfg[0]);
s = strchr(cfg, '\0');
@@ -968,10 +974,10 @@
_log_file = str_fmt("%sopenttd.log", _paths.personal_dir);
// make (auto)save and scenario folder
- CreateDirectoryW(OTTD2FS(_paths.save_dir), NULL);
- CreateDirectoryW(OTTD2FS(_paths.autosave_dir), NULL);
- CreateDirectoryW(OTTD2FS(_paths.scenario_dir), NULL);
- CreateDirectoryW(OTTD2FS(_paths.heightmap_dir), NULL);
+ CreateDirectory(OTTD2FS(_paths.save_dir), NULL);
+ CreateDirectory(OTTD2FS(_paths.autosave_dir), NULL);
+ CreateDirectory(OTTD2FS(_paths.scenario_dir), NULL);
+ CreateDirectory(OTTD2FS(_paths.heightmap_dir), NULL);
}
/**
@@ -991,25 +997,26 @@
uint16 width, length;
if (IsClipboardFormatAvailable(CF_UNICODETEXT)) {
- const char *ret;
-
OpenClipboard(NULL);
cbuf = GetClipboardData(CF_UNICODETEXT);
ptr = (const char*)GlobalLock(cbuf);
- ret = convert_from_fs((wchar_t*)ptr, utf8_buf, lengthof(utf8_buf));
+ const char *ret = convert_from_fs((wchar_t*)ptr, utf8_buf, lengthof(utf8_buf));
GlobalUnlock(cbuf);
CloseClipboard();
if (*ret == '\0') return false;
+#if !defined(UNICODE)
} else if (IsClipboardFormatAvailable(CF_TEXT)) {
OpenClipboard(NULL);
cbuf = GetClipboardData(CF_TEXT);
ptr = (const char*)GlobalLock(cbuf);
- ttd_strlcpy(utf8_buf, ptr, lengthof(utf8_buf));
+ ttd_strlcpy(utf8_buf, FS2OTTD(ptr), lengthof(utf8_buf));
+
GlobalUnlock(cbuf);
CloseClipboard();
+#endif /* UNICODE */
} else {
return false;
}
@@ -1053,7 +1060,7 @@
// Utility function to get the current timestamp in milliseconds
// Useful for profiling
-int64 GetTS(void)
+int64 GetTS()
{
static double freq;
__int64 value;
@@ -1065,8 +1072,103 @@
return (__int64)(value * freq);
}
-/** Convert from OpenTTD's encoding to that of the local environment in
- * UNICODE. OpenTTD encoding is UTF8, local is wide-char
+
+/**
+ * Convert to OpenTTD's encoding from that of the local environment.
+ * When the project is built in UNICODE, the system codepage is irrelevant and
+ * the input string is wide. In ANSI mode, the string is in the
+ * local codepage which we'll convert to wide-char, and then to UTF-8.
+ * OpenTTD internal encoding is UTF8.
+ * The returned value's contents can only be guaranteed until the next call to
+ * this function. So if the value is needed for anything else, use convert_from_fs
+ * @param name pointer to a valid string that will be converted (local, or wide)
+ * @return pointer to the converted string; if failed string is of zero-length
+ * @see the current code-page comes from video\win32_v.cpp, event-notification
+ * WM_INPUTLANGCHANGE */
+const char *FS2OTTD(const TCHAR *name)
+{
+ static char utf8_buf[512];
+#if defined(UNICODE)
+ return convert_from_fs(name, utf8_buf, lengthof(utf8_buf));
+#else
+ char *s = utf8_buf;
+
+ for (; *name != '\0'; name++) {
+ wchar_t w;
+ int len = MultiByteToWideChar(_codepage, 0, name, 1, &w, 1);
+ if (len != 1) {
+ DEBUG(misc, 0, "[utf8] M2W error converting '%c'. Errno %d", *name, GetLastError());
+ continue;
+ }
+
+ if (s + Utf8CharLen(w) >= lastof(utf8_buf)) break;
+ s += Utf8Encode(s, w);
+ }
+
+ *s = '\0';
+ return utf8_buf;
+#endif /* UNICODE */
+}
+
+/**
+ * Convert from OpenTTD's encoding to that of the local environment.
+ * When the project is built in UNICODE the system codepage is irrelevant and
+ * the converted string is wide. In ANSI mode, the UTF8 string is converted
+ * to multi-byte.
+ * OpenTTD internal encoding is UTF8.
+ * The returned value's contents can only be guaranteed until the next call to
+ * this function. So if the value is needed for anything else, use convert_from_fs
+ * @param name pointer to a valid string that will be converted (UTF8)
+ * @return pointer to the converted string; if failed string is of zero-length
+ * @see the current code-page comes from video\win32_v.cpp, event-notification
+ * WM_INPUTLANGCHANGE */
+const TCHAR *OTTD2FS(const char *name)
+{
+ static TCHAR system_buf[512];
+#if defined(UNICODE)
+ return convert_to_fs(name, system_buf, lengthof(system_buf));
+#else
+ char *s = system_buf;
+
+ for (WChar c; (c = Utf8Consume(&name)) != '\0';) {
+ if (s >= lastof(system_buf)) break;
+
+ char mb;
+ int len = WideCharToMultiByte(_codepage, 0, (wchar_t*)&c, 1, &mb, 1, NULL, NULL);
+ if (len != 1) {
+ DEBUG(misc, 0, "[utf8] W2M error converting '0x%X'. Errno %d", c, GetLastError());
+ continue;
+ }
+
+ *s++ = mb;
+ }
+
+ *s = '\0';
+ return system_buf;
+#endif /* UNICODE */
+}
+
+
+/** Convert to OpenTTD's encoding from that of the environment in
+ * UNICODE. OpenTTD encoding is UTF8, local is wide
+ * @param name pointer to a valid string that will be converted
+ * @param utf8_buf pointer to a valid buffer that will receive the converted string
+ * @param buflen length in characters of the receiving buffer
+ * @return pointer to utf8_buf. If conversion fails the string is of zero-length */
+char *convert_from_fs(const wchar_t *name, char *utf8_buf, size_t buflen)
+{
+ int len = WideCharToMultiByte(CP_UTF8, 0, name, -1, utf8_buf, buflen, NULL, NULL);
+ if (len == 0) {
+ DEBUG(misc, 0, "[utf8] W2M error converting wide-string. Errno %d", GetLastError());
+ utf8_buf[0] = '\0';
+ }
+
+ return utf8_buf;
+}
+
+
+/** Convert from OpenTTD's encoding to that of the environment in
+ * UNICODE. OpenTTD encoding is UTF8, local is wide
* @param name pointer to a valid string that will be converted
* @param utf16_buf pointer to a valid wide-char buffer that will receive the
* converted string
@@ -1076,55 +1178,13 @@
{
int len = MultiByteToWideChar(CP_UTF8, 0, name, -1, utf16_buf, buflen);
if (len == 0) {
- DEBUG(misc, 0, "[utf8] error converting '%s'. Errno %d", name, GetLastError());
+ DEBUG(misc, 0, "[utf8] M2W error converting '%s'. Errno %d", name, GetLastError());
utf16_buf[0] = '\0';
}
return utf16_buf;
}
-/** Convert from OpenTTD's encoding to that of the local environment in
- * UNICODE. OpenTTD encoding is UTF8, local is wide-char.
- * The returned value's contents can only be guaranteed until the next call to
- * this function. So if the value is needed for anything else, use convert_from_fs
- * @param name pointer to a valid string that will be converted
- * @return pointer to the converted string; if failed string is of zero-length */
-const wchar_t *OTTD2FS(const char *name)
-{
- static wchar_t utf16_buf[512];
- return convert_to_fs(name, utf16_buf, lengthof(utf16_buf));
-}
-
-
-/** Convert to OpenTTD's encoding from that of the local environment in
- * UNICODE. OpenTTD encoding is UTF8, local is wide-char
- * @param name pointer to a valid string that will be converted
- * @param utf8_buf pointer to a valid buffer that will receive the converted string
- * @param buflen length in characters of the receiving buffer
- * @return pointer to utf8_buf. If conversion fails the string is of zero-length */
-char *convert_from_fs(const wchar_t *name, char *utf8_buf, size_t buflen)
-{
- int len = WideCharToMultiByte(CP_UTF8, 0, name, -1, utf8_buf, buflen, NULL, NULL);
- if (len == 0) {
- DEBUG(misc, 0, "[utf8] error converting wide-string. Errno %d", GetLastError());
- utf8_buf[0] = '\0';
- }
-
- return utf8_buf;
-}
-
-/** Convert to OpenTTD's encoding from that of the local environment in
- * UNICODE. OpenTTD encoding is UTF8, local is wide-char.
- * The returned value's contents can only be guaranteed until the next call to
- * this function. So if the value is needed for anything else, use convert_from_fs
- * @param name pointer to a valid string that will be converted
- * @return pointer to the converted string; if failed string is of zero-length */
-const char *FS2OTTD(const wchar_t *name)
-{
- static char utf8_buf[512];
- return convert_from_fs(name, utf8_buf, lengthof(utf8_buf));
-}
-
/** Our very own SHGetFolderPath function for support of windows operating
* systems that don't have this function (eg Win9x, etc.). We try using the
* native function, and if that doesn't exist we will try a more crude approach
--- a/src/win32.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/win32.h Sun Mar 11 16:31:18 2007 +0000
@@ -26,6 +26,7 @@
# define WIDE_TO_MB(str) FS2OTTD(str)
# define WIDE_TO_MB_BUFFER(str, buffer, buflen) convert_from_fs(str, buffer, buflen)
#else
+extern uint _codepage; // local code-page in the system @see win32_v.cpp:WM_INPUTLANGCHANGE
# define MB_TO_WIDE(str) (str)
# define MB_TO_WIDE_BUFFER(str, buffer, buflen) (str)
# define WIDE_TO_MB(str) (str)
--- a/src/window.cpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/window.cpp Sun Mar 11 16:31:18 2007 +0000
@@ -1221,6 +1221,7 @@
// }
//}
+
bool BaseWindow::IsOfPrototype(const OldWidget *widgets) const
{
return (original_widget == widgets);
@@ -1269,9 +1270,9 @@
//}
-typedef struct SizeRect {
+struct SizeRect {
int left,top,width,height;
-} SizeRect;
+};
static SizeRect _awap_r;
@@ -1397,7 +1398,7 @@
// return LocalAllocateWindowDesc(desc, 0);
//}
-void InitWindowSystem(void)
+void InitWindowSystem()
{
IConsoleClose();
@@ -1407,7 +1408,7 @@
_no_scroll = 0;
}
-void UnInitWindowSystem(void)
+void UnInitWindowSystem()
{
BaseWindow::s_list.CloseAll();
@@ -1427,7 +1428,7 @@
// assert(_last_z_window == _z_windows);
}
-void ResetWindowSystem(void)
+void ResetWindowSystem()
{
UnInitWindowSystem();
InitWindowSystem();
@@ -1437,7 +1438,7 @@
_thd.new_pos.y = 0;
}
-static void DecreaseWindowCounters(void)
+static void DecreaseWindowCounters()
{
BaseWindow *w = NULL;
REVERSED_FOR_ALL_WINDOWS(w) {
@@ -1457,12 +1458,12 @@
}
}
-BaseWindow *GetCallbackWnd(void)
+BaseWindow *GetCallbackWnd()
{
return BaseWindow::FindById(_thd.window_class, _thd.window_number);
}
-static void HandlePlacePresize(void)
+static void HandlePlacePresize()
{
BaseWindow *w;
WindowEvent e;
@@ -1482,7 +1483,7 @@
w->wndproc(w, &e);
}
-static bool HandleDragDrop(void)
+static bool HandleDragDrop()
{
BaseWindow *w;
WindowEvent e;
@@ -1506,7 +1507,7 @@
return false;
}
-static bool HandlePopupMenu(void)
+static bool HandlePopupMenu()
{
BaseWindow *w;
WindowEvent e;
@@ -1533,7 +1534,7 @@
return false;
}
-static bool HandleMouseOver(void)
+static bool HandleMouseOver()
{
Point ptGlobal(_cursor.pos.x, _cursor.pos.y);
/* try if the event is being captured */
@@ -1633,7 +1634,7 @@
SetDirty();
}
-static bool HandleScrollbarScrolling(void)
+static bool HandleScrollbarScrolling()
{
int i;
int pos;
@@ -1678,7 +1679,7 @@
return false;
}
-static bool HandleViewportScroll(void)
+static bool HandleViewportScroll()
{
WindowEvent e;
BaseWindow *w;
@@ -1869,12 +1870,12 @@
}
}
-extern void UpdateTileSelection(void);
-extern bool VpHandlePlaceSizingDrag(void);
+extern void UpdateTileSelection();
+extern bool VpHandlePlaceSizingDrag();
static int _input_events_this_tick = 0;
-static void HandleAutoscroll(void)
+static void HandleAutoscroll()
{
BaseWindow *w;
ViewPort *vp;
@@ -1962,7 +1963,7 @@
// query button and place sign button work in pause mode
_cursor.sprite != SPR_CURSOR_QUERY &&
_cursor.sprite != SPR_CURSOR_SIGN &&
- _pause != 0 &&
+ _pause_game != 0 &&
!_cheats.build_in_pause.value) {
return;
}
@@ -1989,7 +1990,7 @@
}
}
-void HandleMouseEvents(void)
+void HandleMouseEvents()
{
int click;
int mousewheel;
@@ -2027,13 +2028,13 @@
MouseLoop(click, mousewheel);
}
-void InputLoop(void)
+void InputLoop()
{
HandleMouseEvents();
HandleAutoscroll();
}
-void UpdateWindows(void)
+void UpdateWindows()
{
static int we4_timer = 0;
int t = we4_timer + 1;
@@ -2135,7 +2136,7 @@
}
}
-void CallWindowTickEvent(void)
+void CallWindowTickEvent()
{
BaseWindow *w = NULL;
REVERSED_FOR_ALL_WINDOWS(w) {
@@ -2143,7 +2144,7 @@
}
}
-void BaseWindow::DeleteNonVitalWindows(void)
+void BaseWindow::DeleteNonVitalWindows()
{
restart_search:
@@ -2171,7 +2172,7 @@
* with this function. It closes all windows calling the standard function,
* then, does a little hacked loop of closing all stickied windows. Note
* that standard windows (status bar, etc.) are not stickied, so these aren't affected */
-void BaseWindow::DeleteAllNonVitalWindows(void)
+void BaseWindow::DeleteAllNonVitalWindows()
{
/* Delete every window except for stickied ones, then sticky ones as well */
DeleteNonVitalWindows();
@@ -2190,7 +2191,7 @@
}
/* Delete all always on-top windows to get an empty screen */
-void BaseWindow::HideVitalWindows(void)
+void BaseWindow::HideVitalWindows()
{
DeleteWindowById(WC_TOOLBAR_MENU, 0);
DeleteWindowById(WC_MAIN_TOOLBAR, 0);
--- a/src/window.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/window.h Sun Mar 11 16:31:18 2007 +0000
@@ -96,7 +96,6 @@
WWB_MASK = 0xE0,
};
-
enum WindowWidgetTypes {
WWT_EMPTY,
@@ -108,6 +107,7 @@
WWT_TEXTBTN, /* button with text */
WWT_TEXTBTN_2, /* button with diff text when clicked */
WWT_LABEL, /* centered label */
+ WWT_TEXT, /* pure simple text */
WWT_MATRIX,
WWT_SCROLLBAR,
WWT_FRAME, /* frame */
@@ -231,14 +231,14 @@
struct OldWidget;
-typedef struct WindowDesc {
+struct WindowDesc {
int16 left, top, width, height;
WindowClass cls;
WindowClass parent_cls;
uint32 flags;
const OldWidget *widgets;
WindowProc *proc;
-} WindowDesc;
+};
enum WindowDefaultFlag {
WDF_STD_TOOLTIPS = 1, ///< use standard routine when displaying tooltips
@@ -259,14 +259,14 @@
WDP_ALIGN_TBL = -4, ///< Align the left side of the window with the left side of the main toolbar
};
-typedef struct Textbuf {
+struct Textbuf {
char *buf; ///< buffer in which text is saved
uint16 maxlength, maxwidth; ///< the maximum size of the buffer. Maxwidth specifies screensize in pixels, maxlength is in bytes
uint16 length, width; ///< the current size of the string. Width specifies screensize in pixels, length is in bytes
bool caret; ///< is the caret ("_") visible or not
uint16 caretpos; ///< the current position of the caret in the buffer, in bytes
uint16 caretxoffs; ///< the current position of the caret in pixels
-} Textbuf;
+};
#define WP(ptr,str) (*(str*)(ptr)->custom)
/* You cannot 100% reliably calculate the biggest custom struct as
@@ -274,22 +274,22 @@
* 96 is the largest window-size for 64-bit machines currently */
#define WINDOW_CUSTOM_SIZE 96
-typedef struct Scrollbar {
+struct Scrollbar {
uint16 count, cap, pos;
-} Scrollbar;
+};
-typedef struct ResizeInfo {
+struct ResizeInfo {
uint width; ///< Minimum width and height
uint height;
uint step_width; ///< In how big steps the width and height go
uint step_height;
-} ResizeInfo;
+};
-typedef struct WindowMessage {
- int msg;
- int wparam;
- int lparam;
-} WindowMessage;
+struct WindowMessage {
+ int msg;
+ int wparam;
+ int lparam;
+};
struct OldWidget {
WindowWidgetTypes type; ///< OldWidget type, see @WindowWidgetTypes
@@ -602,16 +602,16 @@
for (WindowList::ReverseIterator it = BaseWindow::s_list.m_list.rbegin(); it != BaseWindow::s_list.m_list.rend() && (wz = (*it).w) != NULL; it++)
-typedef struct querystr_d {
+struct querystr_d {
StringID caption;
Textbuf text;
const char *orig;
CharSetFilter afilter;
bool handled;
-} querystr_d;
+};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(querystr_d));
-typedef struct {
+struct menu_d {
byte item_count; ///< follow_vehicle
byte sel_index; ///< scrollpos_x
byte main_button; ///< scrollpos_y
@@ -619,36 +619,36 @@
StringID string_id; ///< unk30
uint16 checked_items; ///< unk32
byte disabled_items;
-} menu_d;
+};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(menu_d));
-typedef struct {
+struct def_d {
int16 data_1, data_2, data_3;
int16 data_4, data_5;
bool close;
byte byte_1;
-} def_d;
+};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(def_d));
-typedef struct {
+struct void_d {
void *data;
-} void_d;
+};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(void_d));
-typedef struct {
+struct tree_d {
uint16 base;
uint16 count;
-} tree_d;
+};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(tree_d));
-typedef struct {
+struct tooltips_d {
StringID string_id;
byte paramcount;
uint32 params[5];
-} tooltips_d;
+};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(tooltips_d));
-typedef struct {
+struct buildvehicle_d {
byte vehicle_type;
union {
RailTypeByte railtype;
@@ -661,10 +661,10 @@
EngineID sel_engine;
EngineID rename_engine;
EngineList eng_list;
-} buildvehicle_d;
+};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(buildvehicle_d));
-typedef struct {
+struct replaceveh_d {
byte sel_index[2];
EngineID sel_engine[2];
uint16 count[2];
@@ -673,10 +673,10 @@
bool update_left;
bool update_right;
bool init_lists;
-} replaceveh_d;
+};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(replaceveh_d));
-typedef struct {
+struct depot_d {
VehicleID sel;
byte type;
bool generate_list;
@@ -686,110 +686,110 @@
uint16 wagon_count;
Vehicle **vehicle_list;
Vehicle **wagon_list;
-} depot_d;
+};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(depot_d));
-typedef struct {
+struct order_d {
int sel;
-} order_d;
+};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(order_d));
-typedef struct {
+struct traindetails_d {
byte tab;
-} traindetails_d;
+};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(traindetails_d));
-typedef struct {
+struct smallmap_d {
int32 scroll_x;
int32 scroll_y;
int32 subscroll;
-} smallmap_d;
+};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(smallmap_d));
-typedef struct {
+struct facesel_d {
uint32 face;
byte gender;
-} facesel_d;
+};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(facesel_d));
-typedef struct {
+struct refit_d {
int sel;
struct RefitOption *cargo;
struct RefitList *list;
uint length;
VehicleOrderID order;
-} refit_d;
+};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(refit_d));
-typedef struct {
+struct vp_d {
VehicleID follow_vehicle;
int32 scrollpos_x;
int32 scrollpos_y;
-} vp_d;
+};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vp_d));
/* vp2_d is the same as vp_d, except for the data_# values.. */
-typedef struct {
+struct vp2_d {
VehicleID follow_vehicle;
int32 scrollpos_x;
int32 scrollpos_y;
byte data_1;
byte data_2;
byte data_3;
-} vp2_d;
+};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(vp2_d));
-typedef struct {
+struct news_d {
uint16 follow_vehicle;
int32 scrollpos_x;
int32 scrollpos_y;
NewsItem *ni;
-} news_d;
+};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(news_d));
-typedef struct {
+struct highscore_d {
uint32 background_img;
int8 rank;
-} highscore_d;
+};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(highscore_d));
-typedef struct {
+struct scroller_d {
int height;
uint16 counter;
-} scroller_d;
+};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(scroller_d));
-typedef enum SortListFlags {
+enum SortListFlags {
VL_NONE = 0x00, ///< no sort
VL_DESC = 0x01, ///< sort descending or ascending
VL_RESORT = 0x02, ///< instruct the code to resort the list in the next loop
VL_REBUILD = 0x04, ///< create sort-listing to use for qsort and friends
VL_END = 0x08
-} SortListFlags;
+};
DECLARE_ENUM_AS_BIT_SET(SortListFlags);
-typedef struct Listing {
+struct Listing {
bool order; ///< Ascending/descending
byte criteria; ///< Sorting criteria
-} Listing;
+};
-typedef struct list_d {
+struct list_d {
uint16 list_length; ///< length of the list being sorted
byte sort_type; ///< what criteria to sort on
SortListFlags flags; ///< used to control sorting/resorting/etc.
uint16 resort_timer; ///< resort list after a given amount of ticks if set
-} list_d;
+};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(list_d));
-typedef struct message_d {
+struct message_d {
int msg;
int wparam;
int lparam;
-} message_d;
+};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(message_d));
-typedef struct dropdown_d {
+struct dropdown_d {
uint32 disabled_state;
uint32 hidden_state;
WindowClass parent_wnd_class;
@@ -800,13 +800,13 @@
const StringID *items;
byte click_delay;
bool drag_mode;
-} dropdown_d;
+};
assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(dropdown_d));
/* window.cpp */
//void CallWindowEventNP(BaseWindow *w, int event);
-void CallWindowTickEvent(void);
+void CallWindowTickEvent();
//void SetWindowDirty(const BaseWindow *w);
void SendWindowMessage(WindowClass wnd_class, WindowNumber wnd_num, int msg, int wparam, int lparam);
void SendWindowMessageClass(WindowClass wnd_class, int msg, int wparam, int lparam);
@@ -979,10 +979,10 @@
return HASBIT(widget[widget_index].m_display_flags, WIDG_LOWERED);
}
-void InitWindowSystem(void);
-void UnInitWindowSystem(void);
-void ResetWindowSystem(void);
-void InputLoop(void);
+void InitWindowSystem();
+void UnInitWindowSystem();
+void ResetWindowSystem();
+void InputLoop();
//void InvalidateThisWindowData(BaseWindow *w);
void InvalidateWindowData(WindowClass cls, WindowNumber number);
//void RaiseWindowButtons(BaseWindow *w);
--- a/src/yapf/follow_track.hpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/yapf/follow_track.hpp Sun Mar 11 16:31:18 2007 +0000
@@ -22,7 +22,7 @@
FORCEINLINE void Init(const Vehicle* v, CPerformanceTimer* pPerf)
{
- assert(!IsRailTT() || (v != NULL && v->type == VEH_Train));
+ assert(!IsRailTT() || (v != NULL && v->type == VEH_TRAIN));
m_veh = v;
m_pPerf = pPerf;
// don't worry, all is inlined so compiler should remove unnecessary initializations
--- a/src/yapf/yapf.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/yapf/yapf.h Sun Mar 11 16:31:18 2007 +0000
@@ -66,7 +66,7 @@
void YapfNotifyTrackLayoutChange(TileIndex tile, Track track);
/** performance measurement helpers */
-void* NpfBeginInterval(void);
+void* NpfBeginInterval();
int NpfEndInterval(void* perf);
@@ -88,7 +88,7 @@
*/
/** Base struct for track followers. */
-typedef struct FollowTrack_t
+struct FollowTrack_t
{
const Vehicle* m_veh; ///< moving vehicle
TileIndex m_old_tile; ///< the origin (vehicle moved from) before move
@@ -100,7 +100,7 @@
bool m_is_bridge; ///< last turn passed bridge ramp
bool m_is_station; ///< last turn passed station
int m_tiles_skipped; ///< number of skipped tunnel or station tiles
-} FollowTrack_t;
+};
/** Initializes FollowTrack_t structure */
void FollowTrackInit(FollowTrack_t *This, const Vehicle* v);
--- a/src/yapf/yapf.hpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/yapf/yapf.hpp Sun Mar 11 16:31:18 2007 +0000
@@ -23,7 +23,7 @@
#include "../debug.h"
extern Patches _patches_newgame;
-extern uint64 _rdtsc(void);
+extern uint64 _rdtsc();
#include <limits.h>
#include <new>
--- a/src/yapf/yapf_costrail.hpp Sat Mar 10 11:07:13 2007 +0000
+++ b/src/yapf/yapf_costrail.hpp Sun Mar 11 16:31:18 2007 +0000
@@ -154,7 +154,7 @@
int cost = 0;
const Vehicle* v = Yapf().GetVehicle();
assert(v != NULL);
- assert(v->type == VEH_Train);
+ assert(v->type == VEH_TRAIN);
assert(v->u.rail.cached_total_length != 0);
int needed_platform_length = (v->u.rail.cached_total_length + TILE_SIZE - 1) / TILE_SIZE;
if (platform_length > needed_platform_length) {
--- a/src/yapf/yapf_settings.h Sat Mar 10 11:07:13 2007 +0000
+++ b/src/yapf/yapf_settings.h Sun Mar 11 16:31:18 2007 +0000
@@ -11,17 +11,17 @@
# ifndef YS_DEF
/*
* if YS_DEF is not defined, we will only do following declaration:
- * typedef struct YapfSettings {
+ * struct YapfSettings {
* bool disable_node_optimization;
* uint32 max_search_nodes;
* .... all other yapf related settings ...
- * } YapfSettings;
+ * };
*
* otherwise we will just expand YS_DEF_xx macros and then #undef them
*/
-# define YS_DEF_BEGIN typedef struct YapfSettings {
+# define YS_DEF_BEGIN struct YapfSettings {
# define YS_DEF(type, name) type name;
-# define YS_DEF_END } YapfSettings;
+# define YS_DEF_END };
# endif /* !YS_DEF */